@infinityfx/lively 4.0.10 → 5.0.0-alpha.0
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 +1 -1
- package/dist/animations/text-animation.js +3 -0
- package/dist/animations/text-animation.js.map +1 -0
- package/dist/animations/view-animation.js +3 -0
- package/dist/animations/view-animation.js.map +1 -0
- package/dist/animations.js +2 -0
- package/dist/animations.js.map +1 -0
- package/dist/core/animation-link.js +2 -0
- package/dist/core/animation-link.js.map +1 -0
- package/dist/core/animator.js +2 -0
- package/dist/core/animator.js.map +1 -0
- package/dist/core/clip.js +1 -1
- package/dist/core/clip.js.map +1 -1
- package/dist/core/state.js +2 -0
- package/dist/core/state.js.map +1 -0
- package/dist/core/track.js +1 -1
- package/dist/core/track.js.map +1 -1
- package/dist/core/utils.js +1 -1
- package/dist/core/utils.js.map +1 -1
- package/dist/hooks/use-audio.js +1 -1
- package/dist/hooks/use-hover.js +3 -0
- package/dist/hooks/use-hover.js.map +1 -0
- package/dist/hooks/use-link.js +2 -1
- package/dist/hooks/use-link.js.map +1 -1
- package/dist/hooks/use-scroll.js +1 -1
- package/dist/hooks/use-spring.js +2 -1
- package/dist/hooks/use-spring.js.map +1 -1
- package/dist/hooks/use-tap.js +3 -0
- package/dist/hooks/use-tap.js.map +1 -0
- package/dist/hooks/use-viewport.js +1 -1
- package/dist/hooks/use-visible.js +1 -1
- package/dist/hooks.js +1 -1
- package/dist/index.js +1 -1
- package/dist/layout-group.js +3 -0
- package/dist/types/animate.d.ts +31 -19
- package/dist/types/animations/text-animation.d.ts +5 -0
- package/dist/types/animations/view-animation.d.ts +9 -0
- package/dist/types/animations.d.ts +3 -0
- package/dist/types/core/animation-link.d.ts +19 -0
- package/dist/types/core/animator.d.ts +75 -0
- package/dist/types/core/clip.d.ts +32 -35
- package/dist/types/core/state.d.ts +16 -0
- package/dist/types/core/track.d.ts +30 -22
- package/dist/types/core/utils.d.ts +891 -35
- package/dist/types/hooks/use-audio.d.ts +1 -2
- package/dist/types/hooks/use-hover.d.ts +1 -0
- package/dist/types/hooks/use-link.d.ts +3 -1
- package/dist/types/hooks/use-scroll.d.ts +4 -6
- package/dist/types/hooks/use-spring.d.ts +9 -6
- package/dist/types/hooks/use-tap.d.ts +1 -0
- package/dist/types/hooks/use-viewport.d.ts +7 -2
- package/dist/types/hooks/use-visible.d.ts +1 -6
- package/dist/types/hooks.d.ts +5 -5
- package/dist/types/index.d.ts +5 -3
- package/dist/types/layout-group.d.ts +7 -0
- package/package.json +17 -17
- package/dist/animatable.js +0 -3
- package/dist/animatable.js.map +0 -1
- package/dist/core/action.js +0 -2
- package/dist/core/action.js.map +0 -1
- package/dist/core/cache.js +0 -2
- package/dist/core/cache.js.map +0 -1
- package/dist/core/link.js +0 -2
- package/dist/core/link.js.map +0 -1
- package/dist/core/timeline.js +0 -2
- package/dist/core/timeline.js.map +0 -1
- package/dist/hooks/use-path.js +0 -2
- package/dist/hooks/use-path.js.map +0 -1
- package/dist/hooks/use-trigger.js +0 -3
- package/dist/hooks/use-trigger.js.map +0 -1
- package/dist/layout/layout-group.js +0 -3
- package/dist/layout/morph.js +0 -3
- package/dist/layout/morph.js.map +0 -1
- package/dist/layout/typable.js +0 -3
- package/dist/layout/typable.js.map +0 -1
- package/dist/layout.js +0 -2
- package/dist/layout.js.map +0 -1
- package/dist/types/animatable.d.ts +0 -112
- package/dist/types/core/action.d.ts +0 -15
- package/dist/types/core/cache.d.ts +0 -23
- package/dist/types/core/link.d.ts +0 -14
- package/dist/types/core/timeline.d.ts +0 -41
- package/dist/types/hooks/use-path.d.ts +0 -1
- package/dist/types/hooks/use-trigger.d.ts +0 -4
- package/dist/types/layout/layout-group.d.ts +0 -16
- package/dist/types/layout/morph.d.ts +0 -24
- package/dist/types/layout/typable.d.ts +0 -11
- package/dist/types/layout.d.ts +0 -4
- /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
|
|
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 a,useEffect as s,Children as c,isValidElement as m,cloneElement as l}from"react";import f from"./core/animator.js";import u from"./core/clip.js";import{serializeTriggers as d,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 S,unregisterFromLayoutGroup as T}from"./core/state.js";const D=e("");function x({ref:e,children:x,inherit:z=!1,initial:A={},animate:I={},triggers:_={animate:["mount"]},stagger:b=.07,staggerLimit:C=10,ignoreScaleDeformation:O=!1,transition:P={},morph:q,clips:B,paused:F=!1,onAnimationEnd:G}){const H=_._livelyId??"_la"+n(),J=r(D),K=r(v),M=i(0),N=i(d(_)),Q=i(null);if(!Q.current){const t={animate:I instanceof u?I:new u(I,A)};for(const e in B)t[e]=B[e]instanceof u?B[e]:new u(B[e],A);const e=Q.current=new f({id:H,clips:t,lifeCycleAnimations:p(_),ignoreScaleDeformation:O,transition:P,stagger:b,staggerLimit:C});e.register(J,z),e.addLinks(I)}const{current:R}=Q;return o(e,(()=>R),[]),a((()=>{if(R.register(J,z),R.addLinks(I),q){clearTimeout(M.current),w(q,R);const t=L(q,H);t&&(R.transition(t),E(q,t),R.state="mounted")}S(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(),T(K,H),q&&(M.current=E(q,R,1)),window.removeEventListener("resize",t)}}),[]),s((()=>{const t=d(_);g(_,((e,n,r)=>{j(N.current[e],t[e])})),N.current=t}),[_]),s((()=>{if(!(I instanceof u||"mounted"!==R.state))for(const t in I){const e=I[t];t in R.links&&"object"!=typeof e&&R.links[t].set(e,R.defaultTransitionOptions)}}),[I]),s((()=>(G&&R.on("animationend",G),()=>{G&&R.off("animationend",G)})),[G]),s((()=>R.setPlayState(F)),[F]),t(D,{value:H,children:c.map(x,((t,e)=>{if(!m(t))return t;let{ref:n,style:r}=t.props;return r=y(r,R.mergeInitialStyles(A),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":!0})}))})}export{D as AnimateContext,x 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 @@
|
|
|
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,ignoreScaleDeformation:e,transition:a,stagger:n,staggerLimit:r}){this.parent=null,this.dependents=new Set,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=e,this.defaultTransitionOptions=o,this.cache=h??["x","y","sx","sy","rotate","borderRadius"],this.stagger=n,this.staggerLimit=r}register(t,a){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))}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.animations.length&&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,{},a===this.tracks.size?()=>this.dispatch("animationend"):void 0)}))}));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),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?()=>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","ignoreScaleDeformation","transition","stagger","staggerLimit","this","parent","dependents","Set","links","onDisposeLinks","tracks","trackList","initialStyles","eventListeners","state","paused","frame","cache","options","defaultTransitionOptions","register","parentId","inherit","isRegistered","registerAnimator","getParentAnimator","add","mount","trigger","cancelAnimationFrame","tick","dispose","stop","delete","forEach","track","snapshot","unregisterAnimator","on","event","callback","off","dispatch","args","animations","length","correct","requestAnimationFrame","bind","addLinks","animate","disposeLinks","extractAnimationLinks","key","link","forEachTrack","i","clip","Clip","composite","get","push","size","undefined","addTrack","element","index","HTMLElement","SVGElement","has","Track","splice","animation","mergeInitialStyles","styles","map","pretime","isEmpty","duration","delay","iterations","getConfig","Math","max","min","elapsed","play","cascade","tag","cascadeDelay","animator","isConnected","override","clear","added","from","setPlayState","toggle"],"mappings":"qNAmBc,MAAOA,EA8BjB,WAAAC,EAAYC,GAAEA,EAAEC,MAAEA,EAAKC,oBAAEA,EAAmBC,uBAAEA,EAAsBC,WAAEA,EAAUC,QAAEA,EAAOC,aAAEA,IA3B3FC,KAAAC,OAA+B,KAC/BD,KAAAE,WAAiC,IAAIC,IAOrCH,KAAAI,MAEI,CAAA,EACJJ,KAAAK,eAAsC,KACtCL,KAAAM,OAAuB,IAAIH,IAC3BH,KAAAO,UAAqB,GAMrBP,KAAAQ,cAAqC,KACrCR,KAAAS,eAEI,CAAA,EACJT,KAAAU,MAAgD,YAChDV,KAAAW,QAAS,EACTX,KAAAY,MAAQ,EAiBJ,MAAMC,MAAEA,KAAUC,GAAYjB,EAE9BG,KAAKP,GAAKA,EACVO,KAAKN,MAAQA,EACbM,KAAKL,oBAAsBA,EAC3BK,KAAKJ,uBAAyBA,EAC9BI,KAAKe,yBAA2BD,EAChCd,KAAKa,M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,EAAG,GAKjC,CACJ,CAEA,IAAAK,CAAKJ,GAAYmC,SAAEA,EAAQb,MAAEA,EAAQ,EAACS,IAAEA,KAAQtE,IAC5C,GAAIuC,EAAKoB,QAAS,OAAO,EAEzB,IAAIQ,EAAU,EAYd,OAXAjF,KAAKmD,cAAa,CAACpB,EAAOqB,KAClBoC,GAAUzD,EAAM0D,QAEpB,MAAMC,EAAQ3D,EAAM0B,KAAKJ,EAAM,IACxBvC,EACH6D,MAAOA,EAAQG,KAAKE,IAAI5B,EAAGpD,KAAKD,aAAe,GAAKC,KAAKF,SAC1DsD,IAAMpD,KAAKM,OAAOoD,KAAO,IAAM1D,KAAKsC,SAAS,eAAgB8C,QAAOzB,GAEvEsB,EAAUH,KAAKC,IAAIE,EAASS,EAAM,IAG/BT,CACX,CAEA,UAAApF,CAAW8F,EAAsB7E,EAA6Bd,KAAKe,0BAC3Df,KAAKW,SAETX,KAAKO,UAAUuB,SAAQ,CAACC,EAAOqB,KAC3B,MAAMvC,MAAEA,GAAU8E,GAAQvC,EAAIuC,EAAKrF,OAAOoD,KAAOiC,EAAKpF,UAAU6C,GAAK,CAAA,EAErErB,EAAMlC,WAAWgB,EAAOC,EAAQ,IAGpCd,KAAKsC,SAAS,mBAClB,CAEA,YAAAsD,CAAajF,GACTX,KAAKO,UAAUuB,SAAQC,GAASA,EAAM8D,OAAOlF,KAC7CX,KAAKW,OAASA,EAEdX,KAAKE,WAAW4B,SAAQwD,GAAYA,EAASM,aAAajF,IAC9D,CAEA,IAAAiB,CAAKwC,GACDpE,KAAKO,UAAUuB,SAAQC,GAASA,EAAM0D,MAAMrB,IAChD"}
|
package/dist/core/clip.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
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
|
package/dist/core/clip.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clip.js","sources":["../../src/core/clip.ts"],"sourcesContent":[null],"names":["Clip","constructor","duration","delay","repeat","alternate","
|
|
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,SAAUE,EAAmBV,GAC/BL,EAAoBgB,OAAOX,EAC/B,CAEM,SAAUY,EAAoBZ,EAAYa,GAC5C,MAAMC,EAAOjB,EAAuBM,IAAIH,IAAO,CAC3Ce,UAAW,IAAIC,IACfH,oBAKJ,OAFAhB,EAAuBY,IAAIT,EAAIc,GAExBA,CACX,CAGM,SAAUG,EAAsBjB,GAClCH,EAAuBc,OAAOX,EAClC,CAEM,SAAUkB,EAAsBC,EAAkBnB,GACpD,MAAMoB,EAAcvB,EAAuBM,IAAIgB,GAE/C,QAAIC,IACAA,EAAYL,UAAUM,IAAIrB,GACnBoB,EAAYP,iBAI3B,CAEM,SAAUS,EAA0BH,EAAkBnB,GACxD,MAAMoB,EAAcvB,EAAuBM,IAAIgB,GAE3CC,GAAaA,EAAYL,UAAUJ,OAAOX,EAClD,CAEM,SAAUuB,EAAgBC,EAAkBC,GAC9CD,EAAIE,SAAQ1B,IACR,MAAMQ,EAAWb,EAAoBQ,IAAIH,GACrCQ,GAAUiB,EAASjB,EAAS,GAExC,CAEM,SAAUmB,EAAgBC,EAAiBpB,GAC7C,MAAMqB,EAAQ/B,EAAYK,IAAIyB,IAAY,IAAIZ,IAC9Ca,EAAMR,IAAIb,GAEVV,EAAYW,IAAImB,EAASC,EAC7B,CAEM,SAAUC,EAAeF,EAAiBG,GAC5C,MAAMC,EAAUlC,EAAYK,IAAIyB,GAChC,IAAKI,EAAS,OAAO,KAErB,IAAK,MAAMxB,KAAYwB,EACnB,GAAIxB,GAAYA,EAASR,KAAO+B,GAAiC,cAAnBvB,EAASyB,MAAuB,OAAOzB,EAGzF,OAAO,IACX,CAEM,SAAU0B,EAAkBN,EAAiBpB,EAAyB2B,EAAQ,GAChF,MAAMN,EAAQ/B,EAAYK,IAAIyB,GAC9B,OAAIC,GAASM,EAAcC,YAAW,IAAMP,EAAMlB,OAAOH,MACrDqB,GAAOA,EAAMlB,OAAOH,GAEjB,EACX"}
|
package/dist/core/track.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import t from"./clip.js";import{clampLowerBound as e,scaleCorrectShadow as s,scaleCorrectRadius as i}from"./utils.js";class n{constructor(t,e){this.scale=[1,1],this.correctionAnimation=null,this.queue=[],this.animations=[],this.active=0,this.element=t,this.shouldCache=e,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(){--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.animations.length||this.correct())}transition(s=this.cache,i={}){const n=this.snapshot(),a=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;case"borderRadius":case"boxShadow":a[t]=[s[t],n[t]];break;default:a[t]=[s[t],null]}a.scale=[o.join(" "),null],a.translate=[h.map((t=>`${t}px`)).join(" "),null];const l=new t(a);l.isEmpty||(this.cache=n,this.push(l,{commit:!1,composite:"override"}))}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(){for(let t=0;t<this.element.children.length;t++){const e=this.element.children[t],s=e.offsetLeft,i=e.offsetTop,n=e.offsetWidth,a=e.offsetHeight,[o,h]=this.scale,[l,c]=getComputedStyle(e).translate.split(" ").map(parseFloat);e.style.transform=`translate(${-l||0}px, ${-c||0}px) scale(${1/o}, ${1/h}) translate(${s*(1-o)+n/2*(1-o)+(l||0)}px, ${i*(1-h)+a/2*(1-h)+(c||0)}px)`}if(this.element instanceof SVGElement||"0px"===this.styles.borderRadius&&"none"===this.styles.boxShadow)return;this.correctionAnimation?.cancel();const t=this.styles.borderRadius!==this.corrected.borderRadius?[1,1]:this.scale,n=this.styles.boxShadow!==this.corrected.boxShadow?[1,1]:this.scale,{width:a,height:o}=this.element.getBoundingClientRect();this.scale=[a/e(this.element.offsetWidth),o/e(this.element.offsetHeight)],this.corrected={borderRadius:i(this.styles.borderRadius,this.scale,t),boxShadow:s(this.styles.boxShadow,this.scale,n)},this.correctionAnimation=this.element.animate(this.corrected,{duration:0,fill:"forwards"})}}export{n as default};
|
|
2
2
|
//# sourceMappingURL=track.js.map
|
package/dist/core/track.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"track.js","sources":["../../src/core/track.ts"],"sourcesContent":[null],"names":["Track","constructor","element","
|
|
1
|
+
{"version":3,"file":"track.js","sources":["../../src/core/track.ts"],"sourcesContent":[null],"names":["Track","constructor","element","shouldCache","this","scale","correctionAnimation","queue","animations","active","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","filter","playState","splice","length","correct","transition","from","translate","clampLowerBound","join","map","num","Clip","isEmpty","composite","clear","forEach","entry","finish","toggle","paused","i","children","child","l","offsetLeft","t","offsetTop","w","offsetWidth","h","offsetHeight","tx","ty","split","parseFloat","style","transform","previousRadiusScale","previousShadowScale","scaleCorrectRadius","scaleCorrectShadow","fill"],"mappings":"sHAqBc,MAAOA,EAgBjB,WAAAC,CAAYC,EAAmCC,GAV/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AAKM,OAAOK,eAAiBX,KAAKU,UAAUC,aAAe,CAAC,EAAG,GAAKX,KAAKC,MAC3GsF,EAAkCvF,KAAKM,OAAOM,YAAcZ,KAAKU,UAAUE,UAAY,CAAC,EAAG,GAAKZ,KAAKC,OAErGmB,MAAEA,EAAKC,OAAEA,GAAWrB,KAAKF,QAAQwB,wBACvCtB,KAAKC,MAAQ,CACTmB,EAAQoC,EAAgBxD,KAAKF,QAAQ+E,aACrCxD,EAASmC,EAAgBxD,KAAKF,QAAQiF,eAG1C/E,KAAKU,UAAY,CACbC,aAAc6E,EAAmBxF,KAAKM,OAAOK,aAAcX,KAAKC,MAAOqF,GACvE1E,UAAW6E,EAAmBzF,KAAKM,OAAOM,UAAWZ,KAAKC,MAAOsF,IAErEvF,KAAKE,oBAAsBF,KAAKF,QAAQsC,QAAQpC,KAAKU,UAAW,CAC5DmC,SAAU,EACV6C,KAAM,YAEd"}
|
package/dist/core/utils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{isValidElement as t}from"react";import n from"./clip.js";import o from"./animation-link.js";const e=1e-4,r=(t,n=8)=>Math.sign(t)*Math.max(Math.abs(t),1/Math.pow(10,n)),s=t=>Array.isArray(t)?t:[t];function i(...t){return n=>{t.forEach((t=>{t&&"current"in t&&(t.current=n),t instanceof Function&&t(n)}))}}function f(...t){const n={};for(const o of t)Object.assign(n,o);return"strokeLength"in n&&(n.strokeDashoffset=2-n.strokeLength,delete n.strokeLength),"strokeDashoffset"in n&&(n.strokeDasharray=2),n}function c(t,n){for(const o in t){const e=t[o];if("object"!=typeof e)continue;const{on:r,...s}="on"in e?e:{on:e};n(o,r,s)}}function a(t){const n={};return c(t,((t,o)=>{n[t]=o})),n}function u(t,n){return t.forEach(((t,o)=>{if(t!==n[o]&&!1!==n[o])return!0})),!1}function l(t){const n={};return c(t,((t,o)=>{["mount","unmount"].forEach((e=>{o.includes(e)&&(e in n||(n[e]=[]),n[e].push(t))}))})),n}function h(t){let n,o=[],r=0;for(let s=0;s<t.length;s++){const i=t[s],f=Math.round(s/(t.length-1)/e)*e;if(null===i)continue;const c="object"!=typeof i?{offset:f,to:i}:i;"offset"in c||(c.offset=f),o.push(c);const a=c.to||c.after;n===a&&r++,n=a}return r===o.length?null:o}function p(t,n,o,e){t.has(n)||t.set(n,{offset:n});const r=t.get(n);if("strokeLength"===o)return r.strokeDashoffset=2-e;r[o]=e}function g(t,n){const r=new Map;for(const s in t){const i=t[s];if(i instanceof o)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:o}of c)void 0!==n&&(1===o&&(o-=e),p(r,o+e,s,n)),void 0!==t&&p(r,o,s,t)}return Array.from(r.values()).sort(((t,n)=>t.offset-n.offset))}function m(t,n,o){const e=t.split(/\s*\/\s*/);return e.length<2&&(e[1]=e[0]),e.map(((t,e)=>t.split(" ").map((t=>parseFloat(t)*o[e]/n[e]+(t.match(/[^\d\.]+$/)?.[0]||"px"))).join(" "))).join("/")}function y(t,n,o){const[e,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(...o)/Math.max(...n),l=new Array(3).fill([i*o[0]/n[0],f*o[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=>`${e} ${t.map((t=>`${t}px`)).join(" ")}${s?" inset":""}`)).join(", ")}function d(n,o,e="_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=e+(null!==i?`${i}_`:n);"object"==typeof s.triggers&&(s.triggers._livelyId=f,o.delete(f)),d(s.children,o,f)}return o}const j={duration:0,delay:1,repeat:2,alternate:3,reverse:4,easing:5,composite:6};function k(t,e){const r={},s=[];if(!(t instanceof n))for(const n in t){let i=t[n];"object"==typeof i||n in j||(i=new o(i)),i instanceof o&&(s.push(i.on("change",(()=>e(n,i)))),r[n]=i)}return[r,()=>s.forEach((t=>t()))]}function A(t,n){const o={};for(const e in t)o[e]=t[e].get(n);return o}export{j as ClipConfigKeys,p as addKeyframeEntry,s as asArray,r as clampLowerBound,k as extractAnimationLinks,d as filterRemovedAnimators,c as forEachTrigger,A as getInitialStyleFromLinks,l as getLifeCycleAnimations,e as keyframeEpsilon,i as mergeRefs,f as mergeStyles,g as parseClipKeyframes,m as scaleCorrectRadius,y as scaleCorrectShadow,a as serializeTriggers,u as shouldTrigger,h as transformKeyframeList};
|
|
2
2
|
//# sourceMappingURL=utils.js.map
|
package/dist/core/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../src/core/utils.ts"],"sourcesContent":[null],"names":["
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../src/core/utils.ts"],"sourcesContent":[null],"names":["keyframeEpsilon","clampLowerBound","num","precision","Math","sign","max","abs","pow","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","split","axis","parseFloat","match","join","scaleCorrectShadow","shadow","color","params","inset","ofx","ofy","blr","spr","ratio","shadows","fill","val","filterRemovedAnimators","children","animatorIds","prefix","isValidElement","props","id","_livelyId","delete","ClipConfigKeys","duration","delay","repeat","alternate","reverse","easing","composite","extractAnimationLinks","animate","links","callbacks","Clip","remove","getInitialStyleFromLinks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ooks/use-audio.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{useRef as e,useEffect as n}from"react";import t from"./use-link.js";
|
|
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":";"}
|
package/dist/hooks/use-link.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
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":[
|
|
1
|
+
{"version":3,"file":"use-link.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
package/dist/hooks/use-scroll.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{useLayoutEffect as t}from"react";import
|
|
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
|
package/dist/hooks/use-spring.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
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":[
|
|
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
|
|
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,
|
|
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
|
|
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
|
|
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 e,useId as r,useRef as n,useState as o,useLayoutEffect as i,useEffect as a}from"react";import{filterRemovedAnimators as u}from"./core/utils.js";import{registerLayoutGroup as m,forEachAnimator as s,unregisterLayoutGroup as c}from"./core/state.js";const d=e("");function l({children:e,skipInitialMount:l=!1,mode:p="wait"}){const f="_lg"+r(),g=n(0),h=n(0),v=n(e),w=m(f,l),[x,M]=o(0),j=u(e,new Set(w.animators));if(j.size){let t=0;s(j,(e=>{"mounted"===e.state&&(t=Math.max(t,e.trigger("unmount",{cascade:"reverse",composite:"override"})),e.state="unmounting",e.dispatch("unmount"))})),h.current=Math.max(h.current,Date.now()+1e3*t)}clearTimeout(g.current);const T=h.current-Date.now();return T>0?(s(w.animators,(t=>{"unmounting"!==t.state||j.has(t.id)||(t.trigger("mount",{override:!0}),t.state="mounted")})),g.current=setTimeout((()=>{v.current=e,M((t=>t+1))}),T)):v.current=e,i((()=>{s(w.animators,(t=>{"mounted"===t.state&&t.transition()}))})),a((()=>(w.skipInitialMount=!1,()=>{c(f),clearTimeout(g.current)})),[]),t(d,{value:f,children:v.current})}export{d as LayoutGroupContext,l as default};
|
|
3
|
+
//# sourceMappingURL=layout-group.js.map
|
package/dist/types/animate.d.ts
CHANGED
|
@@ -1,19 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import Clip, {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
1
|
+
import Animator, { AnimationOptions, AnimationTrigger } from "./core/animator";
|
|
2
|
+
import Clip, { ClipInitials, ClipOptions } from "./core/clip";
|
|
3
|
+
import { CacheKey } 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
|
+
ignoreScaleDeformation?: 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, ignoreScaleDeformation, 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,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
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import AnimationLink, { TransitionOptions } from "./animation-link";
|
|
2
|
+
import Clip, { ClipConfig, ClipInitials, ClipKey, ClipOptions } from "./clip";
|
|
3
|
+
import Track, { CacheKey } from "./track";
|
|
4
|
+
export type LifeCycleTrigger = 'mount' | 'unmount';
|
|
5
|
+
export type AnimationTrigger = LifeCycleTrigger | boolean | number;
|
|
6
|
+
export type AnimationOptions = Omit<ClipConfig, 'duration' | 'easing'> & {
|
|
7
|
+
cascade?: 'forward' | 'reverse';
|
|
8
|
+
override?: boolean;
|
|
9
|
+
commit?: boolean;
|
|
10
|
+
tag?: string;
|
|
11
|
+
};
|
|
12
|
+
export type AnimatorEvent = 'animationend' | 'transitionstart' | 'unmount';
|
|
13
|
+
export default class Animator<T extends string> {
|
|
14
|
+
id: string;
|
|
15
|
+
parent: Animator<any> | null;
|
|
16
|
+
dependents: Set<Animator<any>>;
|
|
17
|
+
clips: {
|
|
18
|
+
[key in T]: Clip;
|
|
19
|
+
};
|
|
20
|
+
lifeCycleAnimations: {
|
|
21
|
+
[key in LifeCycleTrigger]?: T[];
|
|
22
|
+
};
|
|
23
|
+
links: {
|
|
24
|
+
[key in ClipKey]?: AnimationLink<any>;
|
|
25
|
+
};
|
|
26
|
+
onDisposeLinks: (() => void) | null;
|
|
27
|
+
tracks: Set<Element>;
|
|
28
|
+
trackList: Track[];
|
|
29
|
+
ignoreScaleDeformation: boolean;
|
|
30
|
+
defaultTransitionOptions: TransitionOptions;
|
|
31
|
+
cache: CacheKey[];
|
|
32
|
+
stagger: number;
|
|
33
|
+
staggerLimit: number;
|
|
34
|
+
initialStyles: ClipInitials | null;
|
|
35
|
+
eventListeners: {
|
|
36
|
+
[key in AnimatorEvent]?: Set<(...args: any) => void>;
|
|
37
|
+
};
|
|
38
|
+
state: 'unmounted' | 'unmounting' | 'mounted';
|
|
39
|
+
paused: boolean;
|
|
40
|
+
frame: number;
|
|
41
|
+
constructor({ id, clips, lifeCycleAnimations, ignoreScaleDeformation, transition, stagger, staggerLimit }: {
|
|
42
|
+
id: string;
|
|
43
|
+
clips: {
|
|
44
|
+
[key in T]: Clip;
|
|
45
|
+
};
|
|
46
|
+
lifeCycleAnimations: {
|
|
47
|
+
[key in LifeCycleTrigger]?: T[];
|
|
48
|
+
};
|
|
49
|
+
ignoreScaleDeformation: boolean;
|
|
50
|
+
transition: TransitionOptions & {
|
|
51
|
+
cache?: CacheKey[];
|
|
52
|
+
};
|
|
53
|
+
stagger: number;
|
|
54
|
+
staggerLimit: number;
|
|
55
|
+
});
|
|
56
|
+
register(parentId: string, inherit: boolean | number): void;
|
|
57
|
+
mount(): void;
|
|
58
|
+
dispose(): void;
|
|
59
|
+
on<K extends (...args: any) => void>(event: AnimatorEvent, callback: K): void;
|
|
60
|
+
off<K extends (...args: any) => void>(event: AnimatorEvent, callback: K): void;
|
|
61
|
+
dispatch(event: AnimatorEvent, ...args: any): void;
|
|
62
|
+
tick(): void;
|
|
63
|
+
addLinks(animate: Clip | ClipOptions): void;
|
|
64
|
+
addTrack(element: any, index: number): void;
|
|
65
|
+
mergeInitialStyles(styles: ClipInitials): ClipInitials;
|
|
66
|
+
pretime(clip: Clip, options: AnimationOptions): number;
|
|
67
|
+
trigger(on: LifeCycleTrigger, options?: AnimationOptions): number;
|
|
68
|
+
play(animation: T | Clip, { cascade, delay, tag, ...options }?: AnimationOptions): number;
|
|
69
|
+
cascade(clip: Clip, options: AnimationOptions): number;
|
|
70
|
+
forEachTrack(callback: (track: Track, index: number) => void): void;
|
|
71
|
+
push(clip: Clip, { override, delay, tag, ...options }: AnimationOptions): number;
|
|
72
|
+
transition(from?: Animator<any>, options?: TransitionOptions): void;
|
|
73
|
+
setPlayState(paused: boolean): void;
|
|
74
|
+
stop(animation?: T): void;
|
|
75
|
+
}
|