@infinityfx/lively 4.0.11 → 5.0.0-alpha.1

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.
Files changed (89) hide show
  1. package/dist/animate.js +1 -1
  2. package/dist/animations/text-animation.js +3 -0
  3. package/dist/animations/text-animation.js.map +1 -0
  4. package/dist/animations/view-animation.js +3 -0
  5. package/dist/animations/view-animation.js.map +1 -0
  6. package/dist/animations.js +2 -0
  7. package/dist/animations.js.map +1 -0
  8. package/dist/core/animation-link.js +2 -0
  9. package/dist/core/animation-link.js.map +1 -0
  10. package/dist/core/animator.js +2 -0
  11. package/dist/core/animator.js.map +1 -0
  12. package/dist/core/clip.js +1 -1
  13. package/dist/core/clip.js.map +1 -1
  14. package/dist/core/state.js +2 -0
  15. package/dist/core/state.js.map +1 -0
  16. package/dist/core/track.js +1 -1
  17. package/dist/core/track.js.map +1 -1
  18. package/dist/core/utils.js +1 -1
  19. package/dist/core/utils.js.map +1 -1
  20. package/dist/hooks/use-audio.js +1 -1
  21. package/dist/hooks/use-hover.js +3 -0
  22. package/dist/hooks/use-hover.js.map +1 -0
  23. package/dist/hooks/use-link.js +2 -1
  24. package/dist/hooks/use-link.js.map +1 -1
  25. package/dist/hooks/use-scroll.js +1 -1
  26. package/dist/hooks/use-spring.js +2 -1
  27. package/dist/hooks/use-spring.js.map +1 -1
  28. package/dist/hooks/use-tap.js +3 -0
  29. package/dist/hooks/use-tap.js.map +1 -0
  30. package/dist/hooks/use-viewport.js +1 -1
  31. package/dist/hooks/use-visible.js +1 -1
  32. package/dist/hooks.js +1 -1
  33. package/dist/index.js +1 -1
  34. package/dist/layout-group.js +3 -0
  35. package/dist/types/animate.d.ts +31 -19
  36. package/dist/types/animations/text-animation.d.ts +5 -0
  37. package/dist/types/animations/view-animation.d.ts +9 -0
  38. package/dist/types/animations.d.ts +3 -0
  39. package/dist/types/core/animation-link.d.ts +19 -0
  40. package/dist/types/core/animator.d.ts +77 -0
  41. package/dist/types/core/clip.d.ts +32 -35
  42. package/dist/types/core/state.d.ts +16 -0
  43. package/dist/types/core/track.d.ts +37 -22
  44. package/dist/types/core/utils.d.ts +894 -35
  45. package/dist/types/hooks/use-audio.d.ts +1 -2
  46. package/dist/types/hooks/use-hover.d.ts +1 -0
  47. package/dist/types/hooks/use-link.d.ts +3 -1
  48. package/dist/types/hooks/use-scroll.d.ts +4 -6
  49. package/dist/types/hooks/use-spring.d.ts +9 -6
  50. package/dist/types/hooks/use-tap.d.ts +1 -0
  51. package/dist/types/hooks/use-viewport.d.ts +7 -2
  52. package/dist/types/hooks/use-visible.d.ts +1 -6
  53. package/dist/types/hooks.d.ts +5 -5
  54. package/dist/types/index.d.ts +5 -4
  55. package/dist/types/layout-group.d.ts +7 -0
  56. package/package.json +6 -6
  57. package/dist/animatable.js +0 -3
  58. package/dist/animatable.js.map +0 -1
  59. package/dist/core/action.js +0 -2
  60. package/dist/core/action.js.map +0 -1
  61. package/dist/core/cache.js +0 -2
  62. package/dist/core/cache.js.map +0 -1
  63. package/dist/core/link.js +0 -2
  64. package/dist/core/link.js.map +0 -1
  65. package/dist/core/timeline.js +0 -2
  66. package/dist/core/timeline.js.map +0 -1
  67. package/dist/hooks/use-path.js +0 -2
  68. package/dist/hooks/use-path.js.map +0 -1
  69. package/dist/hooks/use-trigger.js +0 -3
  70. package/dist/hooks/use-trigger.js.map +0 -1
  71. package/dist/layout/layout-group.js +0 -3
  72. package/dist/layout/morph.js +0 -3
  73. package/dist/layout/morph.js.map +0 -1
  74. package/dist/layout/typable.js +0 -3
  75. package/dist/layout/typable.js.map +0 -1
  76. package/dist/layout.js +0 -2
  77. package/dist/layout.js.map +0 -1
  78. package/dist/types/animatable.d.ts +0 -113
  79. package/dist/types/core/action.d.ts +0 -15
  80. package/dist/types/core/cache.d.ts +0 -23
  81. package/dist/types/core/link.d.ts +0 -14
  82. package/dist/types/core/timeline.d.ts +0 -42
  83. package/dist/types/hooks/use-path.d.ts +0 -1
  84. package/dist/types/hooks/use-trigger.d.ts +0 -4
  85. package/dist/types/layout/layout-group.d.ts +0 -16
  86. package/dist/types/layout/morph.d.ts +0 -24
  87. package/dist/types/layout/typable.d.ts +0 -11
  88. package/dist/types/layout.d.ts +0 -4
  89. /package/dist/{layout/layout-group.js.map → layout-group.js.map} +0 -0
package/dist/animate.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import{jsx as r,Fragment as t}from"react/jsx-runtime";import{Children as i,isValidElement as e,cloneElement as n}from"react";import a from"./animatable.js";function o({children:o,animations:p=[{translate:["0px 16px","0px 0px"],opacity:[0,1],duration:.35}],levels:l=2,...m}){return r(t,{children:function t(o,c=l){let s,u=l-c;for(;!(s=p[u])&&u>=0;)u--;return c<1||i.count(o)<1?o:r(a,{...m,animate:s,inherit:c<l||m.inherit,children:i.map(o,(r=>e(r)?n(r,{},t(r.props.children,c-1)):r))})}(o)})}o.isLively=!0;export{o as default};
2
+ import{jsx as t}from"react/jsx-runtime";import{createContext as e,useId as n,use as r,useRef as i,useImperativeHandle as o,useLayoutEffect as s,useEffect as a,Children as c,isValidElement as m,cloneElement as l}from"react";import f from"./core/animator.js";import d from"./core/clip.js";import{serializeTriggers as u,getLifeCycleAnimations as p,forEachTrigger as g,mergeStyles as y,getInitialStyleFromLinks as h,mergeRefs as k,shouldTrigger as j}from"./core/utils.js";import{LayoutGroupContext as v}from"./layout-group.js";import{registerAsMorph as w,getMorphTarget as L,deleteMorphTarget as E,registerToLayoutGroup as T,unregisterFromLayoutGroup as C}from"./core/state.js";const x=e("");function z({ref:e,children:z,inherit:A=!1,initial:I={},animate:S={},triggers:_={animate:["mount"]},stagger:b=.07,staggerLimit:D=10,deformCorrection:O,transition:P,morph:q,clips:B,paused:F=!1,onAnimationEnd:G}){const H=_._livelyId??"_la"+n(),J=r(x),K=r(v),M=i(0),N=i(u(_)),Q=i(null);if(!Q.current){const t={animate:S instanceof d?S:new d(S,I)};for(const e in B)t[e]=B[e]instanceof d?B[e]:new d(B[e],I);const e=Q.current=new f({id:H,clips:t,lifeCycleAnimations:p(_),deformCorrection:O,transition:P,stagger:b,staggerLimit:D});e.register(J,A),e.addLinks(S)}const{current:R}=Q;return o(e,(()=>R),[]),s((()=>{if(R.register(J,A),R.addLinks(S),q){clearTimeout(M.current),w(q,R);const t=L(q,H);t&&(R.transition(t),E(q,t),R.state="mounted")}T(K,H)&&(R.state="mounted"),document.fonts.ready.finally((()=>R.mount()));const t=()=>R.forEachTrack((t=>t.snapshot()));return window.addEventListener("resize",t),()=>{R.dispose(),C(K,H),q&&(M.current=E(q,R,1)),window.removeEventListener("resize",t)}}),[]),a((()=>{const t=u(_);g(_,((e,n,r)=>{j(N.current[e],t[e])})),N.current=t}),[_]),a((()=>{if(!(S instanceof d||"mounted"!==R.state))for(const t in S){const e=S[t];t in R.links&&"object"!=typeof e&&R.links[t].set(e,R.defaultTransitionOptions)}}),[S]),a((()=>(G&&R.on("animationend",G),()=>{G&&R.off("animationend",G)})),[G]),a((()=>R.setPlayState(F)),[F]),t(x,{value:H,children:c.map(z,((t,e)=>{if(!m(t))return t;let{ref:n,style:r}=t.props;return r=y(r,R.mergeInitialStyles(I),h(R.links,e)),l(t,{ref:k(n||null,(t=>R.addTrack(t,e))),style:r,pathLength:"strokeDasharray"in r?1:void 0,"data-lively":H})}))})}export{x as AnimateContext,z as default};
3
3
  //# sourceMappingURL=animate.js.map
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import{jsx as r}from"react/jsx-runtime";import t from"../animate.js";function e({children:e,duration:i=1,...n}){let a=0;const l=(Array.isArray(e)?e:[e]).map((t=>["string","number"].includes(typeof t)?t.toString().split("").map((t=>r("span",{style:{display:"inline-block",whiteSpace:"pre-wrap"},children:t},a++))):t)).flat();return r(t,{...n,stagger:i/l.length,staggerLimit:Number.MAX_VALUE,children:l})}export{e as default};
3
+ //# sourceMappingURL=text-animation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"text-animation.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import{jsx as t}from"react/jsx-runtime";import{cloneElement as e}from"react";import r from"../animate.js";import i from"../hooks/use-visible.js";function m({children:m,enter:n,exit:o={},maxEnters:s=1,maxExits:a=0,...x}){const[c,f,p]=i(0);return t(r,{...x,clips:{enter:n,exit:o},triggers:{enter:[Math.min(f,s)],exit:[Math.min(p,a)]},children:e(m,{ref:c})})}export{m as default};
3
+ //# sourceMappingURL=view-animation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-animation.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,2 @@
1
+ export{default as ViewAnimation}from"./animations/view-animation.js";export{default as TextAnimation}from"./animations/text-animation.js";
2
+ //# sourceMappingURL=animations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"animations.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ class t{constructor(t,e){this.options={duration:.4},this.eventListeners={},this.value=t,this.getWithIndex=e||(()=>this.value)}set(t,e={}){this.value=t,Object.assign(this.options,e),this.dispatch("change")}get(t=0){return this.getWithIndex(t)}on(t,e){return t in this.eventListeners||(this.eventListeners[t]=new Set),this.eventListeners[t].add(e),()=>{this.eventListeners[t]?.delete(e)}}dispatch(t){this.eventListeners[t]?.forEach((t=>t(this.value)))}}export{t as default};
2
+ //# sourceMappingURL=animation-link.js.map
@@ -0,0 +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"}
@@ -0,0 +1,2 @@
1
+ import t from"./clip.js";import{isRegistered as i,registerAnimator as s,getParentAnimator as e,unregisterAnimator as a}from"./state.js";import n from"./track.js";import{extractAnimationLinks as r}from"./utils.js";class h{constructor({id:t,clips:i,lifeCycleAnimations:s,deformCorrection:e,transition:a,stagger:n,staggerLimit:r}){this.parent=null,this.dependents=new Set,this.inherit=[],this.links={},this.onDisposeLinks=null,this.tracks=new Set,this.trackList=[],this.initialStyles=null,this.eventListeners={},this.state="unmounted",this.paused=!1,this.frame=0;const{cache:h,...o}=a||{};this.id=t,this.clips=i,this.lifeCycleAnimations=s,this.ignoreScaleDeformation=void 0!==e&&!e,this.defaultTransitionOptions=o,this.cache=h||["x","y","sx","sy","rotate","borderRadius"],this.align="object"==typeof e?e:{x:"left",y:"top"},this.stagger=n,this.staggerLimit=r,void 0===e&&this.inherit.push("ignoreScaleDeformation"),void 0===e&&this.inherit.push("align"),a||this.inherit.push("defaultTransitionOptions"),h||this.inherit.push("cache")}register(t,a){if(!i(this.id)&&(s(this.id,this),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(){this.stop(),this.onDisposeLinks?.(),cancelAnimationFrame(this.frame),this.parent&&this.parent.dependents.delete(this),this.trackList.forEach((t=>t.cache=t.snapshot())),this.state="unmounted",a(this.id)}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 n(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=>s.push(this.clips[t])))}mergeInitialStyles(i){if(this.initialStyles)return this.initialStyles;const s=(this.lifeCycleAnimations.mount||[]).map((t=>this.clips[t]));return s.length?i=t.mergeInitialStyles(s,i):this.parent&&(i=this.parent.mergeInitialStyles(i)),this.initialStyles=i}pretime(t,i){if(t.isEmpty)return 0;const{duration:s,delay:e,iterations:a}=t.getConfig(i);return s*a+e+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=>e=Math.max(this.play(t,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 r=this.pretime(n,a),h=this.cascade(n,{...a,delay:"reverse"===i?s:r+s,tag:e});return this.push(n,{...a,delay:"reverse"===i?h+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(((r,h)=>{i&&r.clear();const o=r.push(t,{...a,delay:s+Math.min(h,this.staggerLimit-1)*this.stagger},h===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)))}}export{h as default};
2
+ //# sourceMappingURL=animator.js.map
@@ -0,0 +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","paused","frame","cache","options","ignoreScaleDeformation","undefined","defaultTransitionOptions","align","x","y","push","register","parentId","isRegistered","registerAnimator","getParentAnimator","add","key","mount","trigger","cancelAnimationFrame","tick","dispose","stop","delete","forEach","track","snapshot","unregisterAnimator","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","animation","mergeInitialStyles","styles","map","length","pretime","isEmpty","duration","delay","iterations","getConfig","Math","max","min","size","elapsed","play","cascade","tag","cascadeDelay","animator","isConnected","override","clear","added","from","setPlayState","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xD,KAAKD,aAAe,GAAKC,KAAKF,SAC1D0D,IAAMxD,KAAKO,OAAO6E,KAAO,EAAI,IAAMpF,KAAK6C,SAAS,eAAgB2C,QAAOvE,GAE3EoE,EAAUJ,KAAKC,IAAIG,EAASS,EAAM,IAG/BT,CACX,CAEA,UAAAxF,CAAWkG,EAAsBhF,EAA6Bf,KAAKkB,0BAC3DlB,KAAKY,SAETZ,KAAKQ,UAAU6B,SAAQ,CAACC,EAAOkB,KAC3B,MAAM1C,MAAEA,GAAUiF,GAAQvC,EAAIuC,EAAKxF,OAAO6E,KAAOW,EAAKvF,UAAUgD,GAAK,CAAA,EAErElB,EAAMzC,WAAWiB,EAAOC,EAAQ,IAGpCf,KAAK6C,SAAS,mBAClB,CAEA,YAAAmD,CAAapF,GACTZ,KAAKQ,UAAU6B,SAAQC,GAASA,EAAM2D,OAAOrF,KAC7CZ,KAAKY,OAASA,EAEdZ,KAAKE,WAAWmC,SAAQqD,GAAYA,EAASM,aAAapF,IAC9D,CAEA,IAAAuB,CAAKmC,GACDtE,KAAKQ,UAAU6B,SAAQC,GAASA,EAAMuD,MAAMvB,IAChD"}
package/dist/core/clip.js CHANGED
@@ -1,2 +1,2 @@
1
- import t from"./action.js";import{isLink as e}from"./link.js";import{normalizeAnimatableKeyframes as i,createDynamic as s,distributeAnimatableKeyframes as r,merge as n}from"./utils.js";class a{constructor({duration:t=1,delay:a=0,repeat:o=1,alternate:h=!1,easing:l="ease",reverse:c=!1,composite:m="none",...f},y={}){this.dynamic={};const d={};for(let t in f){let n=f[t],a=y[t];if(n instanceof Function){e(n)||(this.dynamic[t]=n);continue}const o=Array.isArray(n)?n:[n];o.length<2&&void 0!==a&&o.unshift(a),null===o[0]&&(void 0!==a?o[0]=a:o.splice(0,1)),i(o)&&("borderRadius"!==t?r(t,o,d):this.dynamic[t]=s(t,Object.values(r(t,o)),l))}this.keyframes=Object.values(d).sort(((t,e)=>t.offset-e.offset)),this.initial=n({},y,this.keyframes.length?this.keyframes[0]:{}),delete this.initial.offset,this.isEmpty=!this.keyframes.length&&!Object.keys(this.dynamic).length,this.duration=this.isEmpty?0:t,this.delay=a,this.repeat=o,this.alternate=h,this.easing=l,this.reverse=c,this.composite=m}static from(t,e){return t instanceof a?t:new a(t||{},e)}unique(t){const e=new a({});for(const i in this)this.hasOwnProperty(i)&&(e[i]=i in t?t[i]:this[i]);return e}play(e,{composite:i=this.composite,reverse:s=this.reverse,commit:r=!0,delay:n=0}){if(this.isEmpty)return;const a=new t(e,this.keyframes,{duration:1e3*this.duration,delay:1e3*(n+this.delay),iterations:this.repeat,direction:this.alternate?s?"alternate-reverse":"alternate":s?"reverse":"normal",fill:"both",easing:this.easing,composite:i},this.dynamic);a.commit=r,e.push(a)}}export{a 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,directions:s?i?"alternate-reverse":"alternate":i?"reverse":"normal",easing:this.easing,composite:"combine"===a?"accumulate":"replace",blendmode:a,commit:r}}static mergeInitialStyles(e,t){const s={backfaceVisibility:"hidden",willChange:"transform"};for(const t of e)if(!t.isEmpty){const{offset:e,...i}=t.keyframes[0];Object.assign(s,i)}return Object.assign(s,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","easing","reverse","composite","properties","initial","this","dynamic","keyframes","prop","val","init","Function","isLink","arr","Array","isArray","length","undefined","unshift","splice","normalizeAnimatableKeyframes","distributeAnimatableKeyframes","createDynamic","Object","values","sort","a","b","offset","merge","isEmpty","keys","from","data","unique","config","clip","key","hasOwnProperty","play","track","commit","action","Action","iterations","direction","fill","push"],"mappings":"yLAoCc,MAAOA,EAcjB,WAAAC,EAAYC,SAAEA,EAAW,EAACC,MAAEA,EAAQ,EAACC,OAAEA,EAAS,EAACC,UAAEA,GAAY,EAAKC,OAAEA,EAAS,OAAMC,QAAEA,GAAU,EAAKC,UAAEA,EAAY,UAAWC,GAA8BC,EAA8B,IAV3LC,KAAAC,QAA6B,CAAA,EAWzB,MAAMC,EAEF,CAAA,EAEJ,IAAK,IAAIC,KAAQL,EAAY,CACzB,IAAIM,EAAMN,EAAWK,GAAwBE,EAAON,EAAQI,GAE5D,GAAIC,aAAeE,SAAU,CACpBC,EAAOH,KAAMJ,KAAKC,QAAQE,GAAyBC,GACxD,QACJ,CAEA,MAAMI,EAAMC,MAAMC,QAAQN,GAAOA,EAAM,CAACA,GAEpCI,EAAIG,OAAS,QAAcC,IAATP,GAAoBG,EAAIK,QAAQR,GACvC,OAAXG,EAAI,UAAsBI,IAATP,EAAqBG,EAAI,GAAKH,EAAOG,EAAIM,OAAO,EAAG,IAEnEC,EAA6BP,KAErB,iBAATL,EAKJa,EAA8Bb,EAAMK,EAAYN,GAJ5CF,KAAKC,QAAQE,GAAQc,EAAcd,EAAMe,OAAOC,OAAOH,EAA8Bb,EAAMK,IAAcb,GAKjH,CAGAK,KAAKE,UAAYgB,OAAOC,OAAOjB,GAAWkB,MAAK,CAACC,EAAGC,IAAMD,EAAEE,OAASD,EAAEC,SACtEvB,KAAKD,QAAUyB,EAAM,CAAA,EAAIzB,EAASC,KAAKE,UAAUS,OAAUX,KAAKE,UAAU,GAAa,CAAA,UAEhFF,KAAKD,QAAQwB,OACpBvB,KAAKyB,SAAWzB,KAAKE,UAAUS,SAAWO,OAAOQ,KAAK1B,KAAKC,SAASU,OACpEX,KAAKT,SAAWS,KAAKyB,QAAU,EAAIlC,EACnCS,KAAKR,MAAQA,EACbQ,KAAKP,OAASA,EACdO,KAAKN,UAAYA,EACjBM,KAAKL,OAASA,EACdK,KAAKJ,QAAUA,EACfI,KAAKH,UAAYA,CACrB,CAEA,WAAO8B,CAAKC,EAA8B7B,GACtC,OAAO6B,aAAgBvC,EAAOuC,EAAO,IAAIvC,EAAKuC,GAAQ,CAAA,EAAI7B,EAC9D,CAEA,MAAA8B,CAAOC,GACH,MAAMC,EAAO,IAAI1C,EAAK,IAEtB,IAAK,MAAM2C,KAAOhC,KACVA,KAAKiC,eAAeD,KACnBD,EAAaC,GAAOA,KAAOF,EAASA,EAAOE,GAAgBhC,KAAKgC,IAIzE,OAAOD,CACX,CAEA,IAAAG,CAAKC,GAActC,UAAEA,EAAYG,KAAKH,UAASD,QAAEA,EAAUI,KAAKJ,QAAOwC,OAAEA,GAAS,EAAI5C,MAAEA,EAAQ,IAC5F,GAAIQ,KAAKyB,QAAS,OAElB,MAAMY,EAAS,IAAIC,EAAOH,EAAOnC,KAAKE,UAAW,CAC7CX,SAA0B,IAAhBS,KAAKT,SACfC,MAA8B,KAAtBA,EAAQQ,KAAKR,OACrB+C,WAAYvC,KAAKP,OACjB+C,UAAWxC,KAAKN,UACXE,EAAU,oBAAsB,YAChCA,EAAU,UAAY,SAC3B6C,KAAM,OACN9C,OAAQK,KAAKL,OACbE,aACDG,KAAKC,SAERoC,EAAOD,OAASA,EAEhBD,EAAMO,KAAKL,EACf"}
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","directions","blendmode","mergeInitialStyles","clips","styles","merged","backfaceVisibility","willChange","clip","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,WAAYb,EACPC,EAAU,oBAA+B,YACzCA,EAAU,UAAqB,SACpCC,OAAQI,KAAKJ,OACbC,UAAyB,YAAdA,EAA0B,aAAwB,UAC7DW,UAAWX,EACXQ,SAER,CAEA,yBAAOI,CAAmBC,EAAeC,GACrC,MAAMC,EAAS,CACXC,mBAAoB,SACpBC,WAAY,aAGhB,IAAK,MAAMC,KAAQL,EACf,IAAKK,EAAKb,QAAS,CACf,MAAMc,OAAEA,KAAWL,GAAWI,EAAKjB,UAAU,GAC7CmB,OAAOC,OAAON,EAAQD,EAC1B,CAGJ,OAAOM,OAAOC,OAAON,EAAQD,EACjC"}
@@ -0,0 +1,2 @@
1
+ const t=new Map,n=new Map,e=new Map;function o(n,e){let o=t.get(n)||null;for(let t=0;t<e;t++){if(!o)return null;o=o.parent}return o}function u(n){return t.has(n)}function i(n,e){t.set(n,e)}function r(n){t.delete(n)}function c(t,e){const o=n.get(t)||{animators:new Set,skipInitialMount:e};return n.set(t,o),o}function s(t){n.delete(t)}function f(t,e){const o=n.get(t);return!!o&&(o.animators.add(e),o.skipInitialMount)}function a(t,e){const o=n.get(t);o&&o.animators.delete(e)}function l(n,e){n.forEach((n=>{const o=t.get(n);o&&e(o)}))}function d(t,n){const o=e.get(t)||new Set;o.add(n),e.set(t,o)}function g(t,n){const o=e.get(t);if(!o)return null;for(const t of o)if(t&&t.id!==n&&"unmounted"===t.state)return t;return null}function p(t,n,o=0){const u=e.get(t);return u&&o?setTimeout((()=>u.delete(n))):(u&&u.delete(n),0)}export{p as deleteMorphTarget,l as forEachAnimator,g as getMorphTarget,o as getParentAnimator,u as isRegistered,i as registerAnimator,d as registerAsMorph,c as registerLayoutGroup,f as registerToLayoutGroup,r as unregisterAnimator,a as unregisterFromLayoutGroup,s as unregisterLayoutGroup};
2
+ //# sourceMappingURL=state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state.js","sources":["../../src/core/state.ts"],"sourcesContent":[null],"names":["registeredAnimators","Map","registeredLayoutGroups","morphGroups","getParentAnimator","id","stepsRemoved","parent","get","i","isRegistered","has","registerAnimator","animator","set","unregisterAnimator","delete","registerLayoutGroup","skipInitialMount","data","animators","Set","unregisterLayoutGroup","registerToLayoutGroup","layoutId","layoutGroup","add","unregisterFromLayoutGroup","forEachAnimator","ids","callback","forEach","registerAsMorph","morphId","group","getMorphTarget","receiverId","targets","state","deleteMorphTarget","delay","setTimeout"],"mappings":"AAEA,MAAMA,EAAsB,IAAIC,IAE1BC,EAAyB,IAAID,IAK7BE,EAAc,IAAIF,IAElB,SAAUG,EAAkBC,EAAYC,GAC1C,IAAIC,EAASP,EAAoBQ,IAAIH,IAAO,KAE5C,IAAK,IAAII,EAAI,EAAGA,EAAIH,EAAcG,IAAK,CACnC,IAAKF,EAAQ,OAAO,KAEpBA,EAASA,EAAOA,MACpB,CAEA,OAAOA,CACX,CAEM,SAAUG,EAAaL,GACzB,OAAOL,EAAoBW,IAAIN,EACnC,CAEM,SAAUO,EAAiBP,EAAYQ,GACzCb,EAAoBc,IAAIT,EAAIQ,EAChC,CAEM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cache.js";import{lengthToOffset as e,limitSmallestQuantity as s}from"./utils.js";class i{constructor(e,s,i){this.playing=0,this.active=[],this.queue=[],this.paused=!1,this.scale=[1,1],this.corrected={borderRadius:"",boxShadow:""},this.element=e,this.deform=s,this.cache=new t(e,i)}push(t){t.onfinish=this.next.bind(this),this.playing&&"none"===t.composite?(this.queue.push(t),t.animation.pause()):(this.active.push(t),"none"===t.composite&&this.playing++,this.paused&&t.animation.pause())}next(){this.cache.update(),--this.playing>0||(this.active=this.active.filter((t=>"running"===t.animation.playState)),this.active.push(...this.queue.splice(0,1)),this.playing=this.active.filter((t=>"none"===t.composite)).length,this.pause(!1),this.playing||this.correct())}clear(t){this.active.forEach((e=>{e.onfinish=null;try{t?e.commit||"combine"===e.composite||e.animation.cancel():e.animation.finish()}catch(t){e.animation.cancel()}})),t||(this.active=[],this.queue=[],this.playing=0),this.deform||(this.element.style.borderRadius="",this.element.style.boxShadow="",this.corrected.borderRadius=this.cache.data.borderRadius=this.cache.computed.borderRadius,this.corrected.boxShadow=this.cache.data.boxShadow=this.cache.computed.boxShadow,this.scale=[1,1])}pause(t){for(const e of this.active)e.animation[t?"pause":"play"]();this.paused=t}step(t){for(const e of this.active)e.step(t);!this.paused&&this.active.length&&this.correct()}transition(t,e){this.clear(!0);const s=this.cache.difference(t?.cache.data,e);this.cache.update(),t?.clear(),t?.cache.update(),s.forEach((t=>t.play(this,{commit:!1})))}apply(t,s){const i="strokeLength"===t;this.element.style[i?"strokeDashoffset":t]=i?e(s):s}decomposeScale(){const[t,e]=this.cache.computed.scale.split(" ");let i=parseFloat(t),a=e?parseFloat(e):i;return isNaN(i)&&(i=1),isNaN(a)&&(a=1),/%$/.test(t)&&(i/=100),/%$/.test(e)&&(a/=100),[s(i,1e-4),s(a,1e-4)]}correct(){if(this.deform)return;const t=this.cache.computed,e=t.borderRadius.split(/\s*\/\s*/);e.length<2&&(e[1]=e[0]);const s=t.boxShadow.split(/(?<=px),\s?/),[i,a,o]=s[0].split(/(?<=\))\s|\s(?=inset)/),h=t.borderRadius!==this.corrected.borderRadius?[1,1]:this.scale,c=t.boxShadow!==this.corrected.boxShadow?[1,1]:this.scale,[r,n]=this.scale=this.decomposeScale();if(this.element.style.borderRadius=e.map(((t,e)=>t.split(" ").map((t=>parseFloat(t)*h[e]/this.scale[e]+(t.match(/[^\d\.]+$/)?.[0]||"px"))).join(" "))).join("/"),this.corrected.borderRadius=t.borderRadius,a){const e=a.split(" ").map(parseFloat),s=+(r<n),h=s?n:r,l=Math.max(...c),p=new Array(3).fill([e[0]*c[0]/r,e[1]*c[1]/n,e[2]*l/h,e[3]*l/h]);p[1][0]-=s?1/r:0,p[1][1]-=s?0:1/n,p[2][0]+=s?1/r:0,p[2][1]+=s?0:1/n,this.element.style.boxShadow=p.map((t=>`${i} ${t.map((t=>`${t}px`)).join(" ")}${o?" inset":""}`)).join(", "),this.corrected.boxShadow=t.boxShadow}for(let t=0;t<this.element.children.length;t++){const e=this.element.children[t],s=e.offsetLeft,i=e.offsetTop,a=e.offsetWidth,o=e.offsetHeight,[h,c]=getComputedStyle(e).translate.split(" ").map(parseFloat);e.style.transform=`translate(${-h||0}px, ${-c||0}px) scale(${1/r}, ${1/n}) translate(${s*(1-r)+a/2*(1-r)+(h||0)}px, ${i*(1-n)+o/2*(1-n)+(c||0)}px)`}}}export{i 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.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;case"borderRadius":case"boxShadow":a[t]=[s[t],n[t]];break;default:a[t]=[s[t],null]}[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.active&&(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};
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","deform","cachable","this","playing","active","queue","paused","scale","corrected","borderRadius","boxShadow","cache","StyleCache","push","action","onfinish","next","bind","composite","animation","pause","update","filter","playState","splice","length","correct","clear","partial","forEach","commit","cancel","finish","ex","style","data","computed","value","step","index","transition","previous","options","clips","difference","clip","play","apply","prop","val","isStroke","lengthToOffset","decomposeScale","xString","yString","split","x","parseFloat","y","isNaN","test","limitSmallestQuantity","radii","shadows","color","shadow","inset","previousRadiusScale","previousShadowScale","map","axis","i","radius","match","join","props","ms","pms","Math","max","Array","fill","children","child","l","offsetLeft","t","offsetTop","w","offsetWidth","h","offsetHeight","tx","ty","getComputedStyle","translate","transform"],"mappings":"+GAWc,MAAOA,EAejB,WAAAC,CAAYC,EAAmCC,EAAiBC,GAXhEC,KAAAC,QAAkB,EAClBD,KAAAE,OAAmB,GACnBF,KAAAG,MAAkB,GAElBH,KAAAI,QAAkB,EAClBJ,KAAAK,MAA0B,CAAC,EAAG,GAC9BL,KAAAM,UAAY,CACRC,aAAc,GACdC,UAAW,IAIXR,KAAKH,QAAUA,EACfG,KAAKF,OAASA,EACdE,KAAKS,MAAQ,IAAIC,EAAWb,EAASE,EACzC,CAEA,IAAAY,CAAKC,GACDA,EAAOC,SAAWb,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,GAC9Ba,EAAID,EAAME,WACZC,EAAIH,EAAMI,UACVC,EAAIL,EAAMM,YACVC,EAAIP,EAAMQ,cAEPC,EAAIC,GAAMC,iBAAiBX,GAAOY,UAAUxC,MAAM,KAAKc,IAAIZ,YAElE0B,EAAMjD,MAAM8D,UAAY,cAAcJ,GAAM,SAASC,GAAM,cAAc,EAAIrC,MAAM,EAAIE,gBAAgB0B,GAAK,EAAI5B,GAAKgC,EAAI,GAAK,EAAIhC,IAAMoC,GAAM,SAASN,GAAK,EAAI5B,GAAKgC,EAAI,GAAK,EAAIhC,IAAMmC,GAAM,OAClM,CACJ"}
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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,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,2 +1,2 @@
1
- function t(...t){for(let e=1;e<t.length;e++)for(const n in t[e])n in t[0]&&void 0!==t[0][n]||(t[0][n]=t[e][n]);return t[0]}function e(t,e){const n={};for(const o of e)n[o]=t[o];return n}function n(...t){return e=>{t.forEach((t=>{t&&"current"in t&&(t.current=e),t instanceof Function&&t(e)}))}}const o=(t,e)=>(Math.sign(t)||1)*Math.max(Math.abs(t),e),s=t=>1-parseFloat(t.toString());class r extends Map{constructor(){super(...arguments),this.stack=[]}set(t,e){return this.stack.push(e),super.set(t,e)}delete(t){const e=this.stack.indexOf(this.get(t));return e>=0&&this.stack.splice(e,1),super.delete(t)}}function i(t,e,n={}){const o=(e,o)=>{const r=1e4*e,i="strokeLength"===t;r in n||(n[r]={offset:e}),n[r][i?"strokeDashoffset":t]=i?s(o):o};for(let t=0;t<e.length;t++){let{offset:n,value:s,after:r}=e[t];void 0!==s&&(void 0!==r&&1===n&&(n-=1e-4),o(n,s)),void 0!==r&&(n=Math.min(n+1e-4,1),o(n,r))}return n}function c(t){let e,n=0;for(let o=0;o<t.length;o++){let s=t[o],r=t.length<2?1:Math.round(o/(t.length-1)*1e4)/1e4;0===o&&(e=s),s&&"object"==typeof s?"offset"in s||(s.offset=r):(s===e&&n++,t[o]={offset:r,value:null!==s?s:void 0})}return n<2||n!==t.length}function f(t,e,n){return function(o){const s=this.element.animate(e,{duration:1e3,fill:"forwards",easing:n});s.currentTime=1e3*o;const r=getComputedStyle(this.element)[t];return s.cancel(),r}}export{r as IndexedMap,n as combineRefs,f as createDynamic,i as distributeAnimatableKeyframes,s as lengthToOffset,o as limitSmallestQuantity,t as merge,c as normalizeAnimatableKeyframes,e as pick};
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){const o=t[e];if("object"!=typeof o)continue;const{on:r,...s}="on"in o?o:{on:o};n(e,r,s)}}function u(t){const n={};return a(t,((t,e)=>{n[t]=e})),n}function l(t,n){return t.forEach(((t,e)=>{if(t!==n[e]&&!1!==n[e])return!0})),!1}function h(t){const n={};return a(t,((t,e)=>{["mount","unmount"].forEach((o=>{e.includes(o)&&(o in n||(n[o]=[]),n[o].push(t))}))})),n}function p(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 g(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 m(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=p(f);if(c)for(let{to:t,after:n,offset:e}of c)void 0!==n&&(1===e&&(e-=r),g(o,e+r,s,n)),void 0!==t&&g(o,e,s,t)}return Array.from(o.values()).sort(((t,n)=>t.offset-n.offset))}function y(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 d(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 $(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 k(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 j={duration:0,delay:1,repeat:2,alternate:3,reverse:4,easing:5,composite:6};function A(t,o){const r={},s=[];if(!(t instanceof n))for(const n in t){let i=t[n];"object"==typeof i||n in j||(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 b(t,n){const e={};for(const o in t)e[o]=t[o].get(n);return e}export{j as ClipConfigKeys,g as addKeyframeEntry,i as asArray,s as clampLowerBound,$ as correctForParentScale,A as extractAnimationLinks,x as filterRemovedAnimators,a as forEachTrigger,b as getInitialStyleFromLinks,h as getLifeCycleAnimations,k as getRemovedAnimators,r as keyframeEpsilon,f as mergeRefs,c as mergeStyles,m as parseClipKeyframes,y as scaleCorrectRadius,d as scaleCorrectShadow,u as serializeTriggers,l as shouldTrigger,p as transformKeyframeList};
2
2
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sources":["../../src/core/utils.ts"],"sourcesContent":[null],"names":["merge","objects","i","length","key","undefined","pick","map","keys","picked","combineRefs","refs","el","forEach","ref","current","Function","limitSmallestQuantity","val","e","Math","sign","max","abs","lengthToOffset","parseFloat","toString","IndexedMap","Map","constructor","this","stack","set","value","push","super","indexOf","get","splice","delete","distributeAnimatableKeyframes","prop","keyframes","offset","isStroke","after","min","normalizeAnimatableKeyframes","match","equal","keyframe","round","createDynamic","easing","t","animation","element","animate","duration","fill","currentTime","getComputedStyle","cancel"],"mappings":"AAWM,SAAUA,KAA8CC,GAC1D,IAAK,IAAIC,EAAI,EAAGA,EAAID,EAAQE,OAAQD,IAChC,IAAK,MAAME,KAAOH,EAAQC,GAClBE,KAAOH,EAAQ,SAA0BI,IAApBJ,EAAQ,GAAGG,KAEpCH,EAAQ,GAAGG,GAAOH,EAAQC,GAAGE,IAIrC,OAAOH,EAAQ,EACnB,CAEM,SAAUK,EAA2DC,EAAQC,GAC/E,MAAMC,EAAS,CAAA,EAEf,IAAK,MAAML,KAAOI,EAAMC,EAAOL,GAAOG,EAAIH,GAE1C,OAAOK,CACX,CAEM,S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AAXC,EAAQ,EAEZ,IAAK,IAAI/C,EAAI,EAAGA,EAAIwC,EAAUvC,OAAQD,IAAK,CACvC,IAAIgD,EAAWR,EAAUxC,GACrByC,EAASD,EAAUvC,OAAS,EAAI,EAAIiB,KAAK+B,MAAMjD,GAAKwC,EAAUvC,OAAS,GAAK,KAAS,IAC/E,IAAND,IAAS8C,EAAQE,GAEjBA,GAAgC,iBAAbA,EACb,WAAYA,IAAWA,EAASP,OAASA,IAE3CO,IAAaF,GAAOC,IACxBP,EAAUxC,GAAK,CAAEyC,SAAQV,MAAoB,OAAbiB,EAAoBA,OAAW7C,GAEvE,CAEA,OAAO4C,EAAQ,GAAKA,IAAUP,EAAUvC,MAC5C,UAGgBiD,EAAcX,EAAcC,EAAuBW,GAC/D,OAAO,SAAuBC,GAC1B,MAAMC,EAAYzB,KAAK0B,QAAQC,QAAQf,EAAW,CAAEgB,SAAU,IAAMC,KAAM,WAAYN,WACtFE,EAAUK,YAAc,IAAON,EAE/B,MAAMrB,EAAQ4B,iBAAiB/B,KAAK0B,SAASf,GAI7C,OAFAc,EAAUO,SAEH7B,CACX,CACJ"}
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","entry","on","options","serializeTriggers","serialized","list","shouldTrigger","previous","prev","i","getLifeCycleAnimations","animations","trigger","includes","push","transformKeyframeList","last","keyframes","equal","length","offset","round","keyframe","to","after","addKeyframeEntry","map","prop","has","set","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","index"],"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,MAAMG,EAAQH,EAASE,GACvB,GAAqB,iBAAVC,EAAoB,SAE/B,MAAMC,GAAEA,KAAOC,GAAY,OAAQF,EAAQA,EAAQ,CAAEC,GAAID,GAEzDF,EAASC,EAAKE,EAAIC,EACtB,CACJ,CAEM,SAAUC,EAAoCN,GAChD,MAAMO,EAEF,CAAA,EAMJ,OAJAR,EAAeC,GAA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,EAAcxD,IAEjFA,aAAiBwD,IACjBgF,EAAUpG,KAAKpC,EAAMuB,GAAG,UAAU,IAAMH,EAASC,EAAgBrB,MAEjEuI,EAAMlH,GAAkBrB,EAEhC,CAGJ,MAAO,CAACuI,EAfa,IAAMC,EAAUnI,SAAQqI,GAAUA,MAgB3D,CAEM,SAAUC,EAAyBJ,EAEtCK,GACC,MAAMhI,EAAuB,CAAA,EAE7B,IAAK,MAAMS,KAAOkH,EACd3H,EAAOS,GAAkBkH,EAAMlH,GAAiB+B,IAAIwF,GAGxD,OAAOhI,CACX"}
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import{useRef as e,useEffect as n}from"react";import t from"./use-link.js";let r;function o({bands:o=8,minFrequency:a=100,maxFrequency:i=2e3,smoothing:c=.7}={}){const u=e(new Float32Array(1024)),s=e(void 0),l=e(void 0),d=e(null),m=t(new Array(8).fill(0));let f;function g(){if(!s.current)return;s.current.getFloatFrequencyData(u.current);const e=m(),n=Math.floor(a/24e3*1024),t=Math.floor(i/24e3*1024);for(let r=0;r<o;r++){const a=n+(t-n)/o*r,i=Math.floor(a),c=Math.ceil(a),s=a-i,l=u.current[i]*(1-s)+u.current[c]*s;e[r]=Math.max(0,(100+l)/70)}m.set(e),f=requestAnimationFrame(g)}function A(){cancelAnimationFrame(f),m.set(new Array(o).fill(0),{duration:.3})}return n((()=>{const e=d.current,n=new AbortController;if(e)return r||(r=new AudioContext),s.current||(s.current=new AnalyserNode(r,{fftSize:2048,smoothingTimeConstant:c})),l.current||(l.current=r.createMediaElementSource(e)),s.current.connect(r.destination),l.current.connect(s.current),e.addEventListener("play",(()=>{"suspended"===r.state&&r.resume(),f=requestAnimationFrame(g)}),{signal:n.signal}),e.addEventListener("pause",A,{signal:n.signal}),e.addEventListener("ended",A,{signal:n.signal}),()=>{n.abort(),s.current?.disconnect(),l.current?.disconnect()}}),[]),[d,m]}export{o as default};
2
+ import{useRef as e,useEffect as n}from"react";import t from"./use-link.js";function r({bands:r=8,minFrequency:a=100,maxFrequency:o=2e3,smoothing:i=.7}={}){const c=e(null),u=e(null),l=e(null),s=e(new Float32Array(1024)),m=t(new Array(r).fill(0));return n((()=>{const e=c.current,n=new AbortController;if(!e)return;if(!u.current){const n=u.current=new AudioContext,t=l.current=new AnalyserNode(n,{fftSize:2048,smoothingTimeConstant:i});n.createMediaElementSource(e).connect(t),t.connect(n.destination)}let t;function f(){if(!l.current)return;l.current.getFloatFrequencyData(s.current);const e=m.get(),n=Math.floor(a/24e3*1024),i=Math.floor(o/24e3*1024);for(let t=0;t<r;t++){const a=n+(i-n)/r*t,o=a-Math.floor(a),c=s.current[Math.floor(a)]*(1-o)+s.current[Math.ceil(a)]*o;e[t]=Math.max(0,(100+c)/70)}m.set(e,{duration:0}),t=requestAnimationFrame(f)}function d(){cancelAnimationFrame(t),m.set(m.get().fill(0))}return e.addEventListener("play",(()=>{u.current&&("suspended"===u.current.state&&u.current.resume(),t=requestAnimationFrame(f))}),{signal:n.signal}),e.addEventListener("pause",d,{signal:n.signal}),e.addEventListener("ended",d,{signal:n.signal}),()=>{n.abort(),u.current?.close(),cancelAnimationFrame(t)}}),[]),[c,m]}export{r as default};
3
3
  //# sourceMappingURL=use-audio.js.map
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import{useRef as e,useState as r,useEffect as n}from"react";function t(){const t=e(null),[o,a]=r(!1);return n((()=>{if(!t.current)return;const e=new AbortController;return t.current.addEventListener("mouseenter",(()=>a(!0)),{signal:e.signal}),t.current.addEventListener("mouseleave",(()=>a(!1)),{signal:e.signal}),()=>e.abort()}),[]),[t,o]}export{t as default};
3
+ //# sourceMappingURL=use-hover.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-hover.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,2 +1,3 @@
1
- import{useRef as r}from"react";import{createLink as t}from"../core/link.js";function o(o){return r(t(o)).current}export{o as default};
1
+ "use client";
2
+ import{useRef as n,useEffect as t}from"react";import e from"../core/animation-link.js";function r(r,o){const c=o||(n=>n),i=r instanceof e,a=n(i?new e(c(r.get(),0),(n=>c(r.get(n),n))):new e(r));return t((()=>{if(i)return r.on("change",(()=>{Object.assign(a.current.options,r.options),a.current.dispatch("change")}))}),[]),a.current}export{r as default};
2
3
  //# sourceMappingURL=use-link.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-link.js","sources":["../../src/hooks/use-link.ts"],"sourcesContent":[null],"names":["useLink","initial","useRef","createLink","current"],"mappings":"4EAGc,SAAUA,EAAiBC,GAGrC,OAFaC,EAAOC,EAAWF,IAEnBG,OAChB"}
1
+ {"version":3,"file":"use-link.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import{useLayoutEffect as t}from"react";import e from"./use-link.js";function r({restore:r=0,target:o}={}){const n=e({x:0,y:0,top:0,left:0});return t((()=>{const t=o?.current?o.current:window;function e(t){const e=o?.current||document.documentElement,r=e.scrollLeft,c=r/(e.scrollWidth-e.clientWidth||1),l=e.scrollTop,s=l/(e.scrollHeight-e.clientHeight||1);n.set({x:c,y:s,top:l,left:r},{duration:t})}e(r);const c=()=>e();return t.addEventListener("scroll",c),()=>t.removeEventListener("scroll",c)}),[o]),n}export{r as default};
2
+ import{useLayoutEffect as t}from"react";import r from"./use-link.js";function n(n){const e=r({x:0,y:0});return t((()=>{const t=new AbortController,r=n?.current?n.current:window;function o(){const t=n?.current||document.documentElement;e.set({x:t.scrollLeft/(t.scrollWidth-t.clientWidth||1),y:t.scrollTop/(t.scrollHeight-t.clientHeight||1)},{duration:0})}return o(),r.addEventListener("scroll",o,{signal:t.signal}),()=>t.abort()}),[n]),e}export{n as default};
3
3
  //# sourceMappingURL=use-scroll.js.map
@@ -1,2 +1,3 @@
1
- import{useRef as r}from"react";import t from"./use-link.js";function e(e,{stiffness:n=2,damping:a=.1,mass:s=1,restThreshold:u=.01}={}){const c=r({t:0,value:e,velocity:new Array(Array.isArray(e)?e.length:1).fill(0)}),o=t(e),i=r(o((r=>r)));function l(){const r=Date.now(),t=Math.min((r-c.current.t)/1e3,1/12),e=o(),i=c.current.velocity,m=Array.isArray(e);let f=0,h=0;const y=m?e:[e],A=Array.isArray(c.current.value)?c.current.value:[c.current.value];for(let r=0;r<i.length;r++){const e=A[r]-y[r];i[r]+=(n*e-a*i[r])/s,y[r]+=i[r]*t,f+=Math.abs(e),h+=Math.abs(i[r])}f/=i.length,h/=i.length,o.set(m?y:y[0]),c.current.t=r,(f>u||h>u)&&requestAnimationFrame(l)}return i.current.set=r=>{c.current.value=r,c.current.t=Date.now(),requestAnimationFrame(l)},i.current}export{e as default};
1
+ "use client";
2
+ import{useRef as t,useCallback as e}from"react";import r from"./use-link.js";import{asArray as n}from"../core/utils.js";function a(a,{stiffness:i=2,damping:o=.1,mass:s=1}={}){const m=Array.isArray(a),c=t({target:n(a),velocity:new Array(m?a.length:1).fill(0),time:0}),u=r(a),l=e((()=>{const t=Math.min((Date.now()-c.current.time)/1e3,1/30),{target:e,velocity:r}=c.current,n=u.get(),a=m?n:[n];let f=0;for(let n=0;n<r.length;n++)r[n]+=(i*(e[n]-a[n])-o*r[n])/s,a[n]+=r[n]*t,f+=Math.abs(r[n])/r.length;u.value=m?a:a[0],u.options.duration=0,u.dispatch("change"),c.current.time=Date.now(),f>.01&&requestAnimationFrame(l)}),[]);return u.set=t=>{c.current.target=n(t),c.current.time=Date.now(),requestAnimationFrame(l)},u}export{a as default};
2
3
  //# sourceMappingURL=use-spring.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-spring.js","sources":["../../src/hooks/use-spring.ts"],"sourcesContent":[null],"names":["useSpring","initial","stiffness","damping","mass","restThreshold","state","useRef","t","value","velocity","Array","isArray","length","fill","internal","useLink","link","val","update","Date","now","dt","Math","min","current","isVector","scalarOffset","scalarVelocity","vec","tar","i","offset","abs","set","requestAnimationFrame"],"mappings":"4DAGc,SAAUA,EAAuCC,GAAYC,UAAEA,EAAY,EAACC,QAAEA,EAA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1
+ {"version":3,"file":"use-spring.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import{useRef as n,useState as r,useEffect as t}from"react";function e(){const e=n(null),[o,i]=r(!1);return t((()=>{if(!e.current)return;const n=new AbortController;return e.current.addEventListener("pointerdown",(()=>i(!0)),{signal:n.signal}),e.current.addEventListener("pointerup",(()=>i(!1)),{signal:n.signal}),()=>n.abort()}),[]),[e,o]}export{e as default};
3
+ //# sourceMappingURL=use-tap.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-tap.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import{useRef as e,useLayoutEffect as n}from"react";import t from"./use-link.js";function r(r=.5){const i=e(null),o=t([-1,-1]);return n((()=>{function e(){if(!i.current)return;const{x:e,y:n,width:t,height:d}=i.current.getBoundingClientRect();o.set([(e+t*r)/(window.innerWidth+2*t*(r-.5)),(n+d*r)/(window.innerHeight+2*d*(r-.5))])}return e(),window.addEventListener("scroll",e),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e),window.removeEventListener("resize",e)}}),[r]),[i,o]}export{r as default};
2
+ import{useRef as n,useLayoutEffect as t}from"react";import e from"./use-link.js";function r(r=.5){const i=n(null),o=e({x:-1,y:-1});return t((()=>{const n=new AbortController;function t(){if(!i.current)return;const{x:n,y:t,width:e,height:s}=i.current.getBoundingClientRect();o.set({x:(n+e*r)/(window.innerWidth+2*e*(r-.5)),y:(t+s*r)/(window.innerHeight+2*s*(r-.5))},{duration:0})}return t(),window.addEventListener("scroll",t,{signal:n.signal}),window.addEventListener("resize",t,{signal:n.signal}),()=>n.abort()}),[r]),[i,o]}export{r as default};
3
3
  //# sourceMappingURL=use-viewport.js.map
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import{useRef as r,useEffect as e}from"react";import t from"./use-trigger.js";import n from"./use-viewport.js";function o({enter:o=1,exit:u=!1,threshold:c=.5}={}){const[s,i]=n(c),f=r(!1),l=t(),m=t();return e((()=>{function r(){const[r,e]=i(),t=r>0&&r<1&&e>0&&e<1;!f.current&&t&&l.called<(!0===o?1/0:+o)&&l(),f.current&&!t&&m.called<(!0===u?1/0:+u)&&m(),f.current=t}return r(),i.subscribe(r),()=>i.unsubscribe(r)}),[l,m]),[s,l,m]}export{o as default};
2
+ import{useRef as r,useState as t,useLayoutEffect as e}from"react";import n from"./use-viewport.js";function o(o=.5){const c=r(!1),[u,s]=n(o),[a,f]=t(0),[i,m]=t(0);return e((()=>s.on("change",(({x:r,y:t})=>{const e=r>0&&r<1&&t>0&&t<1;!c.current&&e&&f(a+1),c.current&&!e&&m(i+1),c.current=e}))),[a,i]),[u,a,i]}export{o as default};
3
3
  //# sourceMappingURL=use-visible.js.map
package/dist/hooks.js CHANGED
@@ -1,2 +1,2 @@
1
- export{default as useLink}from"./hooks/use-link.js";export{default as useTrigger}from"./hooks/use-trigger.js";export{default as useReducedMotion}from"./hooks/use-reduced-motion.js";export{default as useScroll}from"./hooks/use-scroll.js";export{default as usePath}from"./hooks/use-path.js";export{default as useViewport}from"./hooks/use-viewport.js";export{default as useVisible}from"./hooks/use-visible.js";export{default as useAudio}from"./hooks/use-audio.js";export{default as useSpring}from"./hooks/use-spring.js";
1
+ export{default as useLink}from"./hooks/use-link.js";export{default as useHover}from"./hooks/use-hover.js";export{default as useTap}from"./hooks/use-tap.js";export{default as useViewport}from"./hooks/use-viewport.js";export{default as useVisible}from"./hooks/use-visible.js";export{default as useScroll}from"./hooks/use-scroll.js";export{default as useReducedMotion}from"./hooks/use-reduced-motion.js";export{default as useAudio}from"./hooks/use-audio.js";export{default as useSpring}from"./hooks/use-spring.js";
2
2
  //# sourceMappingURL=hooks.js.map
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export{default as Animatable}from"./animatable.js";export{default as Animate}from"./animate.js";
1
+ export{default as Animate}from"./animate.js";export{default as LayoutGroup}from"./layout-group.js";export{default as Clip}from"./core/clip.js";
2
2
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,3 @@
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),w=n(0),v=n(r),x=c(g,f),[M,j]=o(0),y=u(r,new Set(x.animators));if(y.size){if("sync"===p){const t=Array.isArray(r)?r.slice():[r];for(const[r,e]of s(v.current,y))t.splice(r,0,e);v.current=t}let t=0;m(y,(r=>{"mounted"===r.state&&(t=Math.max(t,r.trigger("unmount",{cascade:"reverse",composite:"override"})),r.state="unmounting",r.dispatch("unmount"))})),w.current=Math.max(w.current,Date.now()+1e3*t)}clearTimeout(h.current);const T=w.current-Date.now();return T>0?(m(x.animators,(t=>{"unmounting"!==t.state||y.has(t.id)||(t.trigger("mount",{override:!0}),t.state="mounted")})),h.current=setTimeout((()=>{v.current=r,j((t=>t+1))}),T)):"wait"===p&&(v.current=r),i((()=>{m(x.animators,(t=>{"mounted"===t.state&&t.transition()}))}),[r]),a((()=>(x.skipInitialMount=!1,()=>{l(g),clearTimeout(h.current)})),[]),t(d,{value:g,children:v.current})}export{d as LayoutGroupContext,f as default};
3
+ //# sourceMappingURL=layout-group.js.map
@@ -1,19 +1,31 @@
1
- import { AnimatableProps } from "./animatable";
2
- import Clip, { ClipProperties } from "./core/clip";
3
- type AnimateProps = {
4
- animations?: (ClipProperties | Clip)[];
5
- /**
6
- * The number of levels to cascade down animations.
7
- */
8
- levels?: number;
9
- } & Omit<AnimatableProps, 'animations' | 'animate' | 'order'>;
10
- /**
11
- * Automated cascade animations.
12
- *
13
- * @see {@link https://lively.infinityfx.dev/docs/components/animate}
14
- */
15
- declare function Animate({ children, animations, levels, ...props }: AnimateProps): import("react/jsx-runtime").JSX.Element;
16
- declare namespace Animate {
17
- var isLively: boolean;
18
- }
19
- export default Animate;
1
+ import Animator, { AnimationOptions, AnimationTrigger } from "./core/animator";
2
+ import Clip, { ClipInitials, ClipOptions } from "./core/clip";
3
+ import { CacheKey, CorrectionAlignment } from "./core/track";
4
+ import { TransitionOptions } from "./core/animation-link";
5
+ export type AnimateTriggers<T extends string> = {
6
+ [key in T]?: AnimationTrigger[] | ({
7
+ on: AnimationTrigger[];
8
+ } & AnimationOptions);
9
+ };
10
+ export type AnimateProps<T extends string> = {
11
+ ref?: React.Ref<Animator<T | 'animate'>>;
12
+ children: React.ReactNode;
13
+ inherit?: boolean | number;
14
+ initial?: ClipInitials;
15
+ animate?: ClipOptions | Clip;
16
+ clips?: {
17
+ [key in T]: ClipOptions | Clip;
18
+ };
19
+ triggers?: AnimateTriggers<T | 'animate'>;
20
+ stagger?: number;
21
+ staggerLimit?: number;
22
+ deformCorrection?: CorrectionAlignment | boolean;
23
+ transition?: TransitionOptions & {
24
+ cache?: CacheKey[];
25
+ };
26
+ morph?: string;
27
+ paused?: boolean;
28
+ onAnimationEnd?: (animation?: T) => void;
29
+ };
30
+ export declare const AnimateContext: import("react").Context<string>;
31
+ export default function Animate<T extends string>({ ref, children, inherit, initial, animate, triggers, stagger, staggerLimit, deformCorrection, transition, morph, clips, paused, onAnimationEnd }: AnimateProps<T>): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { AnimateProps } from "../animate";
2
+ export type ReactText = string | number | boolean | null | undefined | ReactText[];
3
+ export default function TextAnimation({ children, duration, ...props }: Omit<AnimateProps<any>, 'stagger' | 'staggerLimit'> & {
4
+ duration?: number;
5
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,9 @@
1
+ import { AnimateProps } from "../animate";
2
+ import Clip, { ClipOptions } from "../core/clip";
3
+ export default function ViewAnimation({ children, enter, exit, maxEnters, maxExits, ...props }: Omit<AnimateProps<any>, 'children' | 'animate' | 'clips' | 'triggers' | 'stagger' | 'staggerLimit'> & {
4
+ children: React.ReactElement<any>;
5
+ enter: ClipOptions | Clip;
6
+ exit?: ClipOptions | Clip;
7
+ maxEnters?: number;
8
+ maxExits?: number;
9
+ }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,3 @@
1
+ import ViewAnimation from "./animations/view-animation";
2
+ import TextAnimation from "./animations/text-animation";
3
+ export { ViewAnimation, TextAnimation };
@@ -0,0 +1,19 @@
1
+ import { Easing } from "./clip";
2
+ export type TransitionOptions = {
3
+ duration?: number;
4
+ easing?: Easing;
5
+ };
6
+ export type AnimationLinkEvent = 'change';
7
+ export default class AnimationLink<T, K = T> {
8
+ value: T;
9
+ options: TransitionOptions;
10
+ getWithIndex: (index: number) => K;
11
+ eventListeners: {
12
+ [key in AnimationLinkEvent]?: Set<(value: T) => void>;
13
+ };
14
+ constructor(initial: T, getWithIndex?: (index: number) => K);
15
+ set(value: T, options?: TransitionOptions): void;
16
+ get(index?: number): K;
17
+ on(event: AnimationLinkEvent, callback: (value: T) => void): () => void;
18
+ dispatch(event: AnimationLinkEvent): void;
19
+ }