@infinityfx/lively 3.5.3 → 4.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.
- package/dist/animatable.js +1 -1
- package/dist/animate.js +1 -1
- package/dist/animations/fade.js +1 -1
- package/dist/animations/fade.js.map +1 -1
- package/dist/animations/move.js +1 -1
- package/dist/animations/move.js.map +1 -1
- package/dist/animations/pop.js +1 -1
- package/dist/animations/pop.js.map +1 -1
- package/dist/animations/scale.js +1 -1
- package/dist/animations/scale.js.map +1 -1
- package/dist/animations/wipe.js +1 -1
- package/dist/animations/wipe.js.map +1 -1
- package/dist/core/action.js +1 -1
- package/dist/core/action.js.map +1 -1
- package/dist/core/cache.js +1 -1
- package/dist/core/cache.js.map +1 -1
- package/dist/core/clip.js +1 -1
- package/dist/core/clip.js.map +1 -1
- package/dist/core/link.js +2 -0
- package/dist/core/link.js.map +1 -0
- package/dist/core/timeline.js +1 -1
- package/dist/core/timeline.js.map +1 -1
- 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-link.js +1 -1
- package/dist/hooks/use-link.js.map +1 -1
- package/dist/hooks/use-mount-effect.js +1 -1
- package/dist/hooks/use-mount-effect.js.map +1 -1
- package/dist/hooks/use-path.js +1 -1
- package/dist/hooks/use-path.js.map +1 -1
- package/dist/hooks/use-reduced-motion.js +1 -1
- package/dist/hooks/use-scroll.js +1 -1
- package/dist/hooks/use-trigger.js +2 -1
- package/dist/hooks/use-trigger.js.map +1 -1
- package/dist/hooks/use-viewport.js +1 -1
- package/dist/hooks/use-visible.js +1 -1
- package/dist/hooks.js +1 -1
- package/dist/layout/layout-group.js +1 -1
- package/dist/layout/morph.js +1 -1
- package/dist/layout/typable.js +1 -1
- package/dist/types/animatable.d.ts +6 -20
- package/dist/types/animate.d.ts +7 -8
- package/dist/types/core/clip.d.ts +2 -2
- package/dist/types/core/link.d.ts +14 -0
- package/dist/types/core/timeline.d.ts +4 -4
- package/dist/types/core/track.d.ts +0 -1
- package/dist/types/core/utils.d.ts +1 -1
- package/dist/types/hooks/use-audio.d.ts +2 -2
- package/dist/types/hooks/use-link.d.ts +1 -12
- package/dist/types/hooks/use-scroll.d.ts +1 -1
- package/dist/types/hooks/use-viewport.d.ts +1 -1
- package/dist/types/hooks.d.ts +1 -2
- package/dist/types/layout/morph.d.ts +8 -33
- package/dist/types/layout/typable.d.ts +2 -30
- package/package.json +10 -9
- package/tsconfig.json +1 -1
- package/dist/hooks/use-couple.js +0 -3
- package/dist/hooks/use-couple.js.map +0 -1
- package/dist/types/hooks/use-couple.d.ts +0 -1
package/dist/animatable.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{
|
|
2
|
+
import{__rest as e}from"tslib";import{jsx as n}from"react/jsx-runtime";import{createContext as r,useRef as t,use as i,useMemo as a,useCallback as o,useImperativeHandle as s,useEffect as u,Children as l,isValidElement as c,cloneElement as d}from"react";import m from"./core/clip.js";import f from"./core/timeline.js";import{merge as p,pick as h,combineRefs as v}from"./core/utils.js";import g from"./hooks/use-mount-effect.js";const y=r(null);function b(r){const b=t(null),j=t([]),x=i(y),w=r.inherit&&x?p({},r,h(x,["group","animations","triggers","animate","initial","stagger","staggerLimit","deform","disabled","paused"])):r,{id:O="",inherit:k,triggers:E=[],disabled:L,adaptive:z=!1,manual:A=!1,paused:C}=w,M=void 0!==r.order?r.order:(k&&(null==x?void 0:x.index)||0)+1,D=t([]),F=a((()=>{const e={animate:m.from(w.animate,w.initial)};for(const n in w.animations)e[n]=m.from(w.animations[n],w.initial);return e}),[]),T=t(new f(Object.assign(Object.assign({},w),{mountClips:E.reduce(((e,{name:n,on:r})=>("mount"===r&&e.push(F[n||"animate"]),e)),[])}))),V=o(((e,n={},t=1)=>{var i;const a=F[e];if(L||M>1&&t<2)return 0;p(n,{reverse:null==a?void 0:a.reverse});let o=0,s=n.delay||0,u=a?T.current.time(a):0;for(const r of j.current)(null===(i=r.current)||void 0===i?void 0:i.inherit)&&(o=Math.max(r.current.play(e,p({delay:s+u},n),t+1),o));const l=(n.reverse?o:s)*(M/t);return a&&T.current.add(a,p({delay:l},n)),r.onAnimationEnd&&setTimeout(r.onAnimationEnd.bind({},e),1e3*(u+l)),u+l}),[L,M]);function q(n,r={}){let t=0;for(let i of E){const{name:a,on:o}=i,s=e(i,["name","on"]);o===n&&(t=Math.max(V(a||"animate",p(s,r)),t))}return t}return s(v(b,r.ref),(()=>({play:V,trigger:q,timeline:T.current,children:j.current,inherit:k,adaptive:z,manual:A,id:O})),[E]),u((()=>T.current[C||L?"pause":"play"]()),[C,L]),u((()=>{for(let n=0;n<E.length;n++){let r=E[n],{name:t,on:i}=r,a=e(r,["name","on"]);if("string"==typeof i)continue;const o="boolean"==typeof i?i:i.called,s=D.current[n];void 0!==s&&o&&o!==s&&V(t||"animate",a),D.current[n]=o}}),[E]),g((()=>(T.current.link(w.animate),window.addEventListener("resize",T.current.cache),null==x||x.add(b),document.fonts.ready.then((()=>{A||T.current.mounted||q("mount"),T.current.mounted=!0})),()=>{window.removeEventListener("resize",T.current.cache),T.current.unlink(),null==x||x.remove(b)})),[]),n(y,{value:Object.assign(Object.assign({},r.passthrough?x:Object.assign({index:M},w)),{add:e=>{r.passthrough&&(null==x||x.add(e)),j.current.includes(e)||j.current.push(e)},remove:e=>{r.passthrough&&(null==x||x.remove(e));const n=j.current.indexOf(e)||-1;n>=0&&j.current.splice(n,1)}}),children:l.map(r.children,(e=>!c(e)||e.type instanceof Function?e:d(e,{ref:v((e=>T.current.insert(e)),e.ref),pathLength:1,style:p({backfaceVisibility:"hidden",willChange:"transform"},e.props.style,F.animate.initial,{strokeDasharray:1}),"data-lively-offset-boundary":!(!["x","y"].some((e=>{var n;return null===(n=r.cachable)||void 0===n?void 0:n.includes(e)}))&&void 0!==r.cachable)||void 0})))})}export{y as AnimatableContext,b as default};
|
|
3
3
|
//# sourceMappingURL=animatable.js.map
|
package/dist/animate.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{__rest as i
|
|
2
|
+
import{__rest as i}from"tslib";import{jsx as r,Fragment as t}from"react/jsx-runtime";import{Children as n,isValidElement as o,cloneElement as e}from"react";import m from"./animatable.js";import a from"./animations/move.js";import s from"./animations/pop.js";function l(l){var{children:p,animations:c=[a,s],levels:f=2}=l,h=i(l,["children","animations","levels"]);return r(t,{children:function i(t,a=f){let s,l=f-a;for(;!(s=c[l])&&l>=0;)l--;return a<1||n.count(t)<1?t:r(m,Object.assign({},h,{animate:s,inherit:a<f||h.inherit,children:n.map(t,(r=>o(r)?e(r,{},i(r.props.children,a-1)):r))}))}(p)})}export{l as default};
|
|
3
3
|
//# sourceMappingURL=animate.js.map
|
package/dist/animations/fade.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import o from"../core/clip.js";
|
|
1
|
+
import o from"../core/clip.js";const t=new o({opacity:1,duration:.65},{opacity:0});export{t as default};
|
|
2
2
|
//# sourceMappingURL=fade.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fade.js","sources":["../../src/animations/fade.ts"],"sourcesContent":[null],"names":["Fade","Clip","opacity","duration"],"mappings":"+BAEA,
|
|
1
|
+
{"version":3,"file":"fade.js","sources":["../../src/animations/fade.ts"],"sourcesContent":[null],"names":["Fade","Clip","opacity","duration"],"mappings":"+BAEA,MAAMA,EAAO,IAAIC,EAAK,CAClBC,QAAS,EACTC,SAAU,KACX,CACCD,QAAS"}
|
package/dist/animations/move.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import t from"../core/clip.js";const a=new t({opacity:1,translate:"0px 0px",duration:.5},{opacity:0,translate:"0px 20px"});export{a as default};
|
|
2
2
|
//# sourceMappingURL=move.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"move.js","sources":["../../src/animations/move.ts"],"sourcesContent":[null],"names":["Move","Clip","opacity","translate","duration"],"mappings":"+BAEA,
|
|
1
|
+
{"version":3,"file":"move.js","sources":["../../src/animations/move.ts"],"sourcesContent":[null],"names":["Move","Clip","opacity","translate","duration"],"mappings":"+BAEA,MAAMA,EAAO,IAAIC,EAAK,CAClBC,QAAS,EACTC,UAAW,UACXC,SAAU,IACX,CACCF,QAAS,EACTC,UAAW"}
|
package/dist/animations/pop.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import o from"../core/clip.js";const a=new o({opacity:1,scale:1,duration:.25},{opacity:0,scale:.85});export{a as default};
|
|
2
2
|
//# sourceMappingURL=pop.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pop.js","sources":["../../src/animations/pop.ts"],"sourcesContent":[null],"names":["Pop","Clip","opacity","scale","duration"],"mappings":"+BAEA,
|
|
1
|
+
{"version":3,"file":"pop.js","sources":["../../src/animations/pop.ts"],"sourcesContent":[null],"names":["Pop","Clip","opacity","scale","duration"],"mappings":"+BAEA,MAAMA,EAAM,IAAIC,EAAK,CACjBC,QAAS,EACTC,MAAO,EACPC,SAAU,KACX,CACCF,QAAS,EACTC,MAAO"}
|
package/dist/animations/scale.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"../core/clip.js";const r=new e({scale:1},{transformOrigin:"left",scale:"0 1"});export{r as default};
|
|
2
2
|
//# sourceMappingURL=scale.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scale.js","sources":["../../src/animations/scale.ts"],"sourcesContent":[null],"names":["Scale","Clip","scale","transformOrigin"],"mappings":"+BAEA,
|
|
1
|
+
{"version":3,"file":"scale.js","sources":["../../src/animations/scale.ts"],"sourcesContent":[null],"names":["Scale","Clip","scale","transformOrigin"],"mappings":"+BAEA,MAAMA,EAAQ,IAAIC,EAAK,CACnBC,MAAO,GACR,CACCC,gBAAiB,OACjBD,MAAO"}
|
package/dist/animations/wipe.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"../core/clip.js";
|
|
1
|
+
import t from"../core/clip.js";const e=new t({clipPath:"inset(0% 0% 0% 0%)"},{clipPath:"inset(0% 100% 0% 0%)"});export{e as default};
|
|
2
2
|
//# sourceMappingURL=wipe.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wipe.js","sources":["../../src/animations/wipe.ts"],"sourcesContent":[null],"names":["Wipe","Clip","clipPath"],"mappings":"+BAEA,
|
|
1
|
+
{"version":3,"file":"wipe.js","sources":["../../src/animations/wipe.ts"],"sourcesContent":[null],"names":["Wipe","Clip","clipPath"],"mappings":"+BAEA,MAAMA,EAAO,IAAIC,EAAK,CAClBC,SAAU,sBACX,CACCA,SAAU"}
|
package/dist/core/action.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
class i{constructor(i,t,s,n={}){this.commit=!0,this.onfinish=null,this.composite=s.composite,s.composite="combine"===s.composite?"accumulate":"replace",this.animation=i.element.animate(t,s),this.dynamic=n,this.track=i,this.animation.onfinish=this.finish.bind(this)}finish(){var i;try{this.commit&&this.animation.commitStyles()}catch(i){}this.animation.cancel(),null===(i=this.onfinish)||void 0===i||i.call(this)}step(i){var t,s,n;if("paused"===this.animation.playState)return;const a=(null===(t=this.animation.effect)||void 0===t?void 0:t.getComputedTiming().progress)||0;for(const t in this.dynamic)this.track.apply(t,null===(n=(s=this.dynamic)[t])||void 0===n?void 0:n.call(s,a,i))}}export{i as default};
|
|
2
2
|
//# sourceMappingURL=action.js.map
|
package/dist/core/action.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action.js","sources":["../../src/core/action.ts"],"sourcesContent":[null],"names":["Action","track","keyframes","config","dynamic","this","commit","onfinish","composite","animation","element","animate","finish","bind","
|
|
1
|
+
{"version":3,"file":"action.js","sources":["../../src/core/action.ts"],"sourcesContent":[null],"names":["Action","constructor","track","keyframes","config","dynamic","this","commit","onfinish","composite","animation","element","animate","finish","bind","commitStyles","ex","cancel","_a","call","step","index","playState","progress","effect","getComputedTiming","prop","apply","_b","_c"],"mappings":"AAGc,MAAOA,EASjB,WAAAC,CAAYC,EAAcC,EAAkDC,EAAqFC,EAA6B,CAAA,GAN9LC,KAAMC,QAAY,EAIlBD,KAAQE,SAAwB,KAG5BF,KAAKG,UAAYL,EAAOK,UACvBL,EAAeK,UAAiC,YAArBL,EAAOK,UAA0B,aAAe,UAC5EH,KAAKI,UAAYR,EAAMS,QAAQC,QAAQT,EAAWC,GAClDE,KAAKD,QAAUA,EACfC,KAAKJ,MAAQA,EAEbI,KAAKI,UAAUF,SAAWF,KAAKO,OAAOC,KAAKR,KAC9C,CAED,MAAAO,SACI,IACQP,KAAKC,QAAQD,KAAKI,UAAUK,cACnC,CAAC,MAAOC,GAAM,CACfV,KAAKI,UAAUO,SAEF,QAAbC,EAAAZ,KAAKE,gBAAQ,IAAAU,GAAAA,EAAAC,KAAAb,KAChB,CAED,IAAAc,CAAKC,aACD,GAAiC,WAA7Bf,KAAKI,UAAUY,UAAwB,OAE3C,MAAMC,WAAWL,EAAAZ,KAAKI,UAAUc,6BAAQC,oBAAoBF,WAAY,EAExE,IAAK,MAAMG,KAAQpB,KAAKD,QACpBC,KAAKJ,MAAMyB,MAAMD,EAAmD,WAA7CE,EAAAtB,KAAKD,SAAQqB,UAAgC,IAAAG,OAAA,EAAAA,EAAAV,KAAAS,EAAGL,EAAUF,GAExF"}
|
package/dist/core/cache.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import e from"./clip.js";class t{constructor(e,t=["x","y","sx","sy","borderRadius","backgroundColor","color","rotate","opacity"]){this.element=e,this.include=t,this.computed=getComputedStyle(e),this.data=this.read()}read(){const e={};for(const t of this.include)e[t]=this.computed[t];if(this.element instanceof SVGElement)return e;e.sx=this.element.offsetWidth,e.sy=this.element.offsetHeight,e.x=e.sx/2,e.y=e.sy/2;let t=this.element;for(;t&&(e.x+=t.offsetLeft,e.y+=t.offsetTop,t=t.offsetParent,!(null==t?void 0:t.dataset.livelyOffsetBoundary)););return e}update(){this.data=this.read()}difference(t=this.data,{duration:s=.5,easing:o="ease",reverse:i=!1}){const a=this.read(),r=[[1,1],[1,1]],n=[["0px","0px"],["0px","0px"]],c={duration:s,easing:o,reverse:i,composite:"combine"},d=Object.assign(Object.assign({},c),{composite:"override"});for(const e of this.include)switch(e){case"x":case"y":n[0]["x"==e?0:1]=t[e]-a[e]+"px";break;case"sx":case"sy":r[0]["sx"==e?0:1]=0===a[e]?1:t[e]/a[e];break;default:d[e]=[t[e],a[e]]}return c.scale=r.map((e=>e.join(" "))),c.translate=n.map((e=>e.join(" "))),[new e(c),new e(d)]}}export{t as StyleCache};
|
|
2
2
|
//# sourceMappingURL=cache.js.map
|
package/dist/core/cache.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.js","sources":["../../src/core/cache.ts"],"sourcesContent":[null],"names":["StyleCache","element","include","this","computed","getComputedStyle","data","read","
|
|
1
|
+
{"version":3,"file":"cache.js","sources":["../../src/core/cache.ts"],"sourcesContent":[null],"names":["StyleCache","constructor","element","include","this","computed","getComputedStyle","data","read","prop","SVGElement","sx","offsetWidth","sy","offsetHeight","x","y","parent","offsetLeft","offsetTop","offsetParent","dataset","livelyOffsetBoundary","update","difference","from","duration","easing","reverse","to","scale","translate","keyframes1","composite","keyframes2","Object","assign","key","map","val","join","Clip"],"mappings":"+BAeaA,EAOT,WAAAC,CAAYC,EAAmCC,EAAyB,CAAC,IAAK,IAAK,KAAM,KAAM,eAAgB,kBAAmB,QAAS,SAAU,YACjJC,KAAKF,QAAUA,EACfE,KAAKD,QAAUA,EACfC,KAAKC,SAAWC,iBAAiBJ,GACjCE,KAAKG,KAAOH,KAAKI,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AAMQ,KAAIC,GAAOA,EAAIC,KAAK,OAC7CR,EAAWD,UAAYA,EAAUO,KAAIC,GAAOA,EAAIC,KAAK,OAE9C,CAAC,IAAIC,EAAKT,GAAa,IAAIS,EAAKP,GAC1C"}
|
package/dist/core/clip.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__rest as
|
|
1
|
+
import{__rest as t}from"tslib";import e from"./action.js";import{isLink as i}from"./link.js";import{normalizeAnimatableKeyframes as s,distributeAnimatableKeyframes as r,merge as n}from"./utils.js";class a{constructor(e,a){var{duration:o=1,delay:h=0,repeat:l=1,alternate:m=!1,easing:c="ease",reverse:f=!1,composite:y="none"}=e,p=t(e,["duration","delay","repeat","alternate","easing","reverse","composite"]);void 0===a&&(a={}),this.dynamic={};const d={};for(let t in p){let e=p[t],n=a[t];if(t="strokeLength"===t?"strokeDashoffset":t,e instanceof Function){i(e)||(this.dynamic[t]=e);continue}const o=Array.isArray(e)?e:[e];o.length<2&&void 0!==n&&o.unshift(n),null===o[0]&&(void 0!==n?o[0]=n:o.splice(0,1)),s(o)&&r(t,o,d)}this.keyframes=Object.values(d),this.initial=n({},a,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:o,this.delay=h,this.repeat=l,this.alternate=m,this.easing=c,this.reverse=f,this.composite=y}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(t,{composite:i=this.composite,reverse:s=this.reverse,commit:r=!0,delay:n=0}){if(this.isEmpty)return;const a=new e(t,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,t.push(a)}}export{a 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","
|
|
1
|
+
{"version":3,"file":"clip.js","sources":["../../src/core/clip.ts"],"sourcesContent":[null],"names":["Clip","constructor","_a","initial","duration","delay","repeat","alternate","easing","reverse","composite","properties","__rest","this","dynamic","keyframes","prop","val","init","Function","isLink","arr","Array","isArray","length","undefined","unshift","splice","normalizeAnimatableKeyframes","distributeAnimatableKeyframes","Object","values","merge","offset","isEmpty","keys","from","data","unique","config","clip","key","hasOwnProperty","play","track","commit","action","Action","iterations","direction","fill","push"],"mappings":"qMAoCc,MAAOA,EAcjB,WAAAC,CAAYC,EAAiJC,GAAjJ,IAAAC,SAAEA,EAAW,EAACC,MAAEA,EAAQ,EAACC,OAAEA,EAAS,EAACC,UAAEA,GAAY,EAAKC,OAAEA,EAAS,OAAMC,QAAEA,GAAU,EAAKC,UAAEA,EAAY,QAAuCR,EAA5BS,EAAUC,EAAAV,EAA7H,+EAAiJ,IAAAC,IAAAA,EAAgC,CAAA,GAV7LU,KAAOC,QAAsB,GAWzB,MAAMC,EAEF,CAAA,EAEJ,IAAK,IAAIC,KAAQL,EAAY,CACzB,IAAIM,EAAMN,EAAWK,GAAwBE,EAAOf,EAAQa,GAG5D,GAFAA,EAAgB,iBAATA,EAA0B,mBAAqBA,EAElDC,aAAeE,SAAU,CACpBC,EAAOH,KAAMJ,KAAKC,QAAQE,GAAyBC,GACxD,QACH,CAED,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,IAElCQ,EAA8Bb,EAAMK,EAAYN,EACnD,CAEDF,KAAKE,UAAYe,OAAOC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ions:new Set};const r=function(e){return e instanceof Function?n(t.value,(n=>e(r(),n))):c?c(e||0):t.value};return r.set=(n,s)=>{t.value=n,e.forEach((n=>{if(!n.key.deref())return e.delete(n);n.observe(s||{})}))},r.subscribe=e=>t.subscriptions.add(e),r.unsubscribe=e=>t.subscriptions.delete(e),e.add({key:new WeakRef(r),observe:function(e){const n=r();n!==t.cached&&(t.cached=n,t.subscriptions.forEach((n=>n(e))))}}),r}function s(e){return void 0!==e.subscribe}export{n as createLink,s as isLink};
|
|
2
|
+
//# sourceMappingURL=link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.js","sources":["../../src/core/link.ts"],"sourcesContent":[null],"names":["links","Set","createLink","initial","computed","internal","value","cached","subscriptions","Link","arg","Function","index","set","options","forEach","link","key","deref","delete","observe","subscribe","callback","add","unsubscribe","WeakRef","current","subscription","isLink","val","undefined"],"mappings":"AAgBA,MAAMA,EAAQ,IAAIC,IAKF,SAAAC,EAAiBC,EAAYC,GACzC,IAAIC,EAAW,CACXC,MAAOH,EACPI,OAAQJ,EACRK,cAAe,IAAIP,KAGvB,MAAMQ,EAAgB,SAAUC,GAC5B,OAAIA,aAAeC,SAAiBT,EAAWG,EAASC,OAAQM,GAAkBF,EAAID,IAAQG,KAEvFR,EAAWA,EAASM,GAAO,GAAKL,EAASC,KACpD,EA+BA,OA7BAG,EAAKI,IAAM,CAACP,EAAUQ,KAClBT,EAASC,MAAQA,EAEjBN,EAAMe,SAAQC,IACV,IAAKA,EAAKC,IAAIC,QAAS,OAAOlB,EAAMmB,OAAOH,GAE3CA,EAAKI,QAAQN,GAAW,CAAA,EAAG,GAC7B,EAGNL,EAAKY,UAAaC,GAA2BjB,EAASG,cAAce,IAAID,GAExEb,EAAKe,YAAeF,GAA2BjB,EAASG,cAAcW,OAAOG,GAY7EtB,EAAMuB,IAAI,CACNN,IAAK,IAAIQ,QAAQhB,GACjBW,QAZJ,SAAiBN,GACb,MAAMY,EAAUjB,IAEZiB,IAAYrB,EAASE,SACrBF,EAASE,OAASmB,EAElBrB,EAASG,cAAcO,SAAQY,GAAgBA,EAAab,KAEnE,IAOML,CACX,CAEM,SAAUmB,EAAUC,GACtB,YAAoCC,IAAnBD,EAAKR,SAC1B"}
|
package/dist/core/timeline.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import s from"./clip.js";import{isLink as t}from"./link.js";import i from"./track.js";import{IndexedMap as e,merge as a}from"./utils.js";class r{constructor({stagger:s=.1,staggerLimit:t=10,deform:i=!0,cachable:a,mountClips:r}){this.index=0,this.paused=!1,this.tracks=new e,this.frame=0,this.linked=[],this.mounted=!1,this.stagger=s,this.staggerLimit=t-1,this.deform=i,this.cachable=a,this.mountClips=r}step(){cancelAnimationFrame(this.frame),this.tracks.values.forEach(((s,t)=>s.step(t))),this.frame=requestAnimationFrame(this.step.bind(this))}time(s){return s.duration+s.delay+this.stagger*Math.max(Math.min(this.staggerLimit,this.tracks.size-1),0)}receiver(t,i,e){if(!this.paused)for(let r=0;r<this.tracks.size;r++){const h=this.tracks.values[r],c=i(r);e.duration?(a(e,{composite:"override"}),new s(Object.assign(Object.assign({},e),{[t]:c})).play(h,{})):h.apply(t,c)}}link(i){if(!(this.linked.length||!i||i instanceof s)){for(let s in i){const e=i[s];if(t(e)){const t=this.receiver.bind(this,s,e);e.subscribe(t),this.linked.push((()=>e.unsubscribe(t))),t({})}}this.step()}}unlink(){this.linked.forEach((s=>s())),this.linked=[]}transition(s,t={}){for(let i=0;i<this.tracks.size;i++)this.tracks.values[i].transition(null==s?void 0:s.tracks.values[i],t)}insert(s){if((s instanceof HTMLElement||s instanceof SVGElement)&&!this.tracks.has(s)){const t=new i(s,this.deform,this.cachable);this.tracks.set(s,t),this.mounted&&this.mountClips.forEach((s=>s.play(t,{})))}}add(s,{immediate:t=!1,composite:i,reverse:e,delay:a=0,commit:r}){for(let h=0;h<this.tracks.size;h++)t&&this.tracks.values[h].clear(),s.play(this.tracks.values[h],{delay:a+Math.min(h,this.staggerLimit)*(this.stagger<0?s.duration/this.tracks.size:1)*Math.abs(this.stagger),composite:i,reverse:e,commit:r})}pause(){for(const s of this.tracks.values)s.pause();this.paused=!0}play(){for(const s of this.tracks.values)s.play();this.paused=!1}cache(){for(const s of this.tracks.values)s.cache.update()}}export{r as default};
|
|
2
2
|
//# sourceMappingURL=timeline.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeline.js","sources":["../../src/core/timeline.ts"],"sourcesContent":[null],"names":["Timeline","
|
|
1
|
+
{"version":3,"file":"timeline.js","sources":["../../src/core/timeline.ts"],"sourcesContent":[null],"names":["Timeline","constructor","stagger","staggerLimit","deform","cachable","mountClips","this","index","paused","tracks","IndexedMap","frame","linked","mounted","step","cancelAnimationFrame","values","forEach","track","i","requestAnimationFrame","bind","time","clip","duration","delay","Math","max","min","size","receiver","prop","link","config","value","merge","composite","Clip","Object","assign","play","apply","length","isLink","subscribe","push","unsubscribe","unlink","transition","from","options","insert","element","HTMLElement","SVGElement","has","Track","set","add","immediate","reverse","commit","clear","abs","pause","cache","update"],"mappings":"yIAQc,MAAOA,EAcjB,WAAAC,EAAYC,QAAEA,EAAU,GAAGC,aAAEA,EAAe,GAAEC,OAAEA,GAAS,EAAIC,SAAEA,EAAQC,WAAEA,IAZzEC,KAAKC,MAAW,EAKhBD,KAAME,QAAY,EAClBF,KAAAG,OAAqC,IAAIC,EACzCJ,KAAKK,MAAW,EAChBL,KAAMM,OAAmB,GACzBN,KAAOO,SAAY,EAIfP,KAAKL,QAAUA,EACfK,KAAKJ,aAAeA,EAAe,EACnCI,KAAKH,OAASA,EACdG,KAAKF,SAAWA,EAChBE,KAAKD,WAAaA,CACrB,CAED,IAAAS,GACIC,qBAAqBT,KAAKK,OAE1BL,KAAKG,OAAOO,OAAOC,SAAQ,CAACC,EAAOC,IAAMD,EAAMJ,KAAKK,KAEpDb,KAAKK,MAAQS,sBAAsBd,KAAKQ,KAAKO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AKA,aAAmBC,aAAeD,aAAmBE,cAAgBhD,KAAKG,OAAO8C,IAAIH,GAAU,CAChG,MAAMlC,EAAQ,IAAIsC,EAAMJ,EAAS9C,KAAKH,OAAQG,KAAKF,UACnDE,KAAKG,OAAOgD,IAAIL,EAASlC,GAErBZ,KAAKO,SAASP,KAAKD,WAAWY,SAAQM,GAAQA,EAAKiB,KAAKtB,EAAO,CAAE,IACxE,CACJ,CAED,GAAAwC,CAAInC,GAAYoC,UAAEA,GAAY,EAAKvB,UAAEA,EAASwB,QAAEA,EAAOnC,MAAEA,EAAQ,EAACoC,OAAEA,IAEhE,IAAK,IAAI1C,EAAI,EAAGA,EAAIb,KAAKG,OAAOoB,KAAMV,IAC9BwC,GAAWrD,KAAKG,OAAOO,OAAOG,GAAG2C,QAErCvC,EAAKiB,KAAKlC,KAAKG,OAAOO,OAAOG,GAAI,CAC7BM,MAAOA,EAAQC,KAAKE,IAAIT,EAAGb,KAAKJ,eAAiBI,KAAKL,QAAU,EAAIsB,EAAKC,SAAWlB,KAAKG,OAAOoB,KAAO,GAAKH,KAAKqC,IAAIzD,KAAKL,SAC1HmC,YACAwB,UACAC,UAGX,CAED,KAAAG,GACI,IAAK,MAAM9C,KAASZ,KAAKG,OAAOO,OAAQE,EAAM8C,QAC9C1D,KAAKE,QAAS,CACjB,CAED,IAAAgC,GACI,IAAK,MAAMtB,KAASZ,KAAKG,OAAOO,OAAQE,EAAMsB,OAC9ClC,KAAKE,QAAS,CACjB,CAED,KAAAyD,GACI,IAAK,MAAM/C,KAASZ,KAAKG,OAAOO,OAAQE,EAAM+C,MAAMC,QACvD"}
|
package/dist/core/track.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{StyleCache as t}from"./cache.js";import{lengthToOffset as e}from"./utils.js";
|
|
1
|
+
import{StyleCache as t}from"./cache.js";import{lengthToOffset as e}from"./utils.js";class i{constructor(e,i,s){this.playing=0,this.active=[],this.queue=[],this.scale=[1,1],this.element=e,this.deform=i,this.cache=new t(e,s)}push(t){return 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++),t}next(){this.cache.update(),--this.playing>0||(this.active=this.queue.length?this.queue.splice(0,1):[],this.playing=this.active.length,this.play())}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)}pause(){for(const t of this.active)t.animation.pause()}play(){for(const t of this.active)t.animation.play()}step(t){for(const e of this.active)e.step(t);this.active.length&&this.correct()}transition(t,e){this.clear(!0);const i=this.cache.difference(null==t?void 0:t.cache.data,e);this.cache.update(),null==t||t.clear(),null==t||t.cache.update(),i.forEach((t=>t.play(this,{commit:!1})))}apply(t,i){const s="strokeLength"===t;this.element.style[s?"strokeDashoffset":t]=s?e(i):i,this.correct()}decomposeScale(){const[t,e]=this.cache.computed.scale.split(" ");let i=Math.max(parseFloat(t)||1,1e-4);/%$/.test(t)&&(i/=100);let s=e?Math.max(parseFloat(e),1e-4):i;return/%$/.test(e)&&(s/=100),[i,s]}computeBorderRadius(t=this.cache.computed.borderRadius){const e=t.split(/\s*\/\s*/);e.length<2&&(e[1]=e[0]);const i=this.scale;return this.scale=this.decomposeScale(),e.map(((t,e)=>t.split(" ").map((t=>{var s;return parseFloat(t)*i[e]/this.scale[e]+((null===(s=t.match(/[^\d\.]+$/))||void 0===s?void 0:s[0])||"px")})).join(" "))).join("/")}correct(){if(this.deform)return;this.element.style.borderRadius=this.computeBorderRadius();const[t,e]=this.decomposeScale();for(let i=0;i<this.element.children.length;i++){this.element.children[i].style.transform=`scale(${1/t}, ${1/e})`}}}export{i 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","element","deform","cachable","this","playing","active","queue","scale","cache","StyleCache","
|
|
1
|
+
{"version":3,"file":"track.js","sources":["../../src/core/track.ts"],"sourcesContent":[null],"names":["Track","constructor","element","deform","cachable","this","playing","active","queue","scale","cache","StyleCache","push","action","onfinish","next","bind","composite","animation","pause","update","length","splice","play","clear","partial","forEach","commit","cancel","finish","ex","step","index","correct","transition","previous","options","clips","difference","data","clip","apply","prop","val","isStroke","style","lengthToOffset","decomposeScale","xString","yString","computed","split","x","Math","max","parseFloat","test","y","computeBorderRadius","borderRadius","arr","prev","map","axis","i","_a","match","join","children","transform"],"mappings":"oFAOc,MAAOA,EAUjB,WAAAC,CAAYC,EAAmCC,EAAiBC,GANhEC,KAAOC,QAAW,EAClBD,KAAME,OAAa,GACnBF,KAAKG,MAAa,GAElBH,KAAAI,MAA0B,CAAC,EAAG,GAG1BJ,KAAKH,QAAUA,EACfG,KAAKF,OAASA,EACdE,KAAKK,MAAQ,IAAIC,EAAWT,EAASE,EACxC,CAED,IAAAQ,CAAKC,GAWD,OAVAA,EAAOC,SAAWT,KAAKU,KAAKC,KAAKX,MAE7BA,KAAKC,SAAgC,SAArBO,EAAOI,WACvBZ,KAAKG,MAAMI,KAAKC,GAChBA,EAAOK,UAAUC,UAEjBd,KAAKE,OAAOK,KAAKC,GACQ,SAArBA,EAAOI,WAAsBZ,KAAKC,WAGnCO,CACV,CAED,IAAAE,GACIV,KAAKK,MAAMU,WAELf,KAAKC,QAAU,IAErBD,KAAKE,OAASF,KAAKG,MAAMa,OAAShB,KAAKG,MAAMc,OAAO,EAAG,GAAK,GAC5DjB,KAAKC,QAAUD,KAAKE,OAAOc,OAC3BhB,KAAKkB,OACR,CAED,KAAAC,CAAMC,GACFpB,KAAKE,OAAOmB,SAAQb,IAChBA,EAAOC,SAAW,KAElB,IACSW,EAGIZ,EAAOc,QAA+B,YAArBd,EAAOI,WACzBJ,EAAOK,UAAUU,SAHrBf,EAAOK,UAAUW,QAKxB,CAAC,MAAOC,G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AAI,IAEjC,MAAMC,EAAOxD,KAAKI,MAGlB,OAFAJ,KAAKI,MAAQJ,KAAK0C,iBAEXa,EAAIE,KAAI,CAACC,EAAMC,IACXD,EAAKZ,MAAM,KAAKW,KAAInB,UACvB,OAAOY,WAAWZ,GAAOkB,EAAKG,GAAK3D,KAAKI,MAAMuD,KAA4B,QAAtBC,EAAAtB,EAAIuB,MAAM,oBAAY,IAAAD,OAAA,EAAAA,EAAG,KAAM,KAAK,IACzFE,KAAK,OACTA,KAAK,IACX,CAED,OAAAlC,GACI,GAAI5B,KAAKF,OAAQ,OAEjBE,KAAKH,QAAQ2C,MAAMc,aAAetD,KAAKqD,sBACvC,MAAON,EAAGK,GAAKpD,KAAK0C,iBAEpB,IAAK,IAAIiB,EAAI,EAAGA,EAAI3D,KAAKH,QAAQkE,SAAS/C,OAAQ2C,IAAK,CACrC3D,KAAKH,QAAQkE,SAASJ,GAE9BnB,MAAMwB,UAAY,SAAS,EAAIjB,MAAM,EAAIK,IAGlD,CACJ"}
|
package/dist/core/utils.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function t(){for(
|
|
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=>1-parseFloat(t.toString());class s{constructor(){this.map=new Map,this.values=[],this.size=0}has(t){return this.map.has(t)}set(t,e){this.map.set(t,this.values.push(e)-1),this.size=this.map.size}}function i(t,e,n={}){const s=(e,s)=>{const i=1e4*e;i in n||(n[i]={offset:e}),n[i][t]="strokeDashoffset"===t?o(s):s};for(let t=0;t<e.length;t++){let{offset:n,value:o,after:i}=e[t];void 0!==o&&(void 0!==i&&1===n&&(n-=1e-4),s(n,o)),void 0!==i&&(n=Math.min(n+1e-4,1),s(n,i))}return n}function r(t){let e,n=0;for(let o=0;o<t.length;o++){let s=t[o],i=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=i):(s===e&&n++,t[o]={offset:i,value:null!==s?s:void 0})}return n<2||n!==t.length}export{s as IndexedMap,n as combineRefs,i as distributeAnimatableKeyframes,o as lengthToOffset,t as merge,r as normalizeAnimatableKeyframes,e as pick};
|
|
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":["merge","objects","
|
|
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","lengthToOffset","val","parseFloat","toString","IndexedMap","constructor","this","Map","values","size","has","set","value","push","distributeAnimatableKeyframes","prop","keyframes","offset","after","Math","min","normalizeAnimatableKeyframes","match","equal","keyframe","round"],"mappings":"AAUgB,SAAAA,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,CAEgB,SAAAK,EAA2DC,EAAQC,GAC/E,MAAMC,EAAS,CAAA,EAEf,IAAK,MAAML,KAAOI,EAAMC,EAAOL,GAAOG,EAAIH,GAE1C,OAAOK,CACX,CAEgB,SAAAC,KAAeC,GAC3B,OAAQC,IACJD,EAAKE,SAAQC,IACLA,GAAO,YAAaA,IAAMA,EAA6BC,QAAUH,GACjEE,aAAeE,UAAUF,EAAIF,EAAG,GACtC,CAEV,CAEa,MAAAK,EAAkBC,GAAa,EA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AAK,CAAEgC,SAAQL,MAAoB,OAAbY,EAAoBA,OAAWpC,GAEtE,CAED,OAAOmC,EAAQ,GAAKA,IAAUP,EAAU9B,MAC5C"}
|
package/dist/hooks/use-audio.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{useRef as e,useEffect as n}from"react";import
|
|
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:c=2e3,smoothing:i=.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 v(){if(!s.current)return;s.current.getFloatFrequencyData(u.current);const e=m(),n=Math.floor(a/24e3*1024),t=Math.floor(c/24e3*1024);for(let r=0;r<o;r++){const a=n+(t-n)/o*r,c=Math.floor(a),i=Math.ceil(a),s=a-c,l=u.current[c]*(1-s)+u.current[i]*s;e[r]=Math.max(0,(100+l)/70)}m.set(e),f=requestAnimationFrame(v)}function y(){"suspended"===r.state&&r.resume(),f=requestAnimationFrame(v)}function p(){cancelAnimationFrame(f),m.set(new Array(o).fill(0),{duration:.3})}return n((()=>{const e=d.current;if(e)return r||(r=new AudioContext),s.current||(s.current=new AnalyserNode(r,{fftSize:2048,smoothingTimeConstant:i})),l.current||(l.current=r.createMediaElementSource(e)),s.current.connect(r.destination),l.current.connect(s.current),e.addEventListener("play",y),e.addEventListener("pause",p),e.addEventListener("ended",p),()=>{var n,t;null===(n=s.current)||void 0===n||n.disconnect(),null===(t=l.current)||void 0===t||t.disconnect(),e.removeEventListener("play",y),e.removeEventListener("pause",p),e.removeEventListener("ended",p)}}),[]),[d,m]}export{o as default};
|
|
3
3
|
//# sourceMappingURL=use-audio.js.map
|
package/dist/hooks/use-link.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useRef as
|
|
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};
|
|
2
2
|
//# sourceMappingURL=use-link.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-link.js","sources":["../../src/hooks/use-link.ts"],"sourcesContent":[null],"names":["
|
|
1
|
+
{"version":3,"file":"use-link.js","sources":["../../src/hooks/use-link.ts"],"sourcesContent":[null],"names":["useLink","initial","useRef","createLink","current"],"mappings":"4EAGwB,SAAAA,EAAiBC,GAGrC,OAFaC,EAAOC,EAAWF,IAEnBG,OAChB"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useEffect as e,useLayoutEffect as o}from"react";
|
|
1
|
+
import{useEffect as e,useLayoutEffect as o}from"react";const t="undefined"==typeof window?e:o;export{t as default};
|
|
2
2
|
//# sourceMappingURL=use-mount-effect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-mount-effect.js","sources":["../../src/hooks/use-mount-effect.ts"],"sourcesContent":[null],"names":["useMountEffect","window","useEffect","useLayoutEffect"],"mappings":"uDAEA,
|
|
1
|
+
{"version":3,"file":"use-mount-effect.js","sources":["../../src/hooks/use-mount-effect.ts"],"sourcesContent":[null],"names":["useMountEffect","window","useEffect","useLayoutEffect"],"mappings":"uDAEA,MAAMA,EAAmC,oBAAXC,OAAyBC,EAAYC"}
|
package/dist/hooks/use-path.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useRef as t,useCallback as r}from"react";function n(){
|
|
1
|
+
import{useRef as t,useCallback as r}from"react";function n(){const n=t(null);return[r((t=>(r,e)=>{if(!n.current)return t([0,0],e);const u=n.current.getTotalLength()*r,{x:o,y:c}=n.current.getPointAtLength(u);return t([o,c],e)}),[n]),n]}export{n as default};
|
|
2
2
|
//# sourceMappingURL=use-path.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-path.js","sources":["../../src/hooks/use-path.ts"],"sourcesContent":[null],"names":["usePath","ref","useRef","useCallback","transform","progress","index","current","len","getTotalLength","
|
|
1
|
+
{"version":3,"file":"use-path.js","sources":["../../src/hooks/use-path.ts"],"sourcesContent":[null],"names":["usePath","ref","useRef","useCallback","transform","progress","index","current","len","getTotalLength","x","y","getPointAtLength"],"mappings":"gDAEc,SAAUA,IACpB,MAAMC,EAAMC,EAAU,MAatB,MAAO,CAXMC,GAAaC,GACf,CAACC,EAAkBC,KACtB,IAAKL,EAAIM,QAAS,OAAOH,EAAU,CAAC,EAAG,GAAIE,GAE3C,MAAME,EAAMP,EAAIM,QAAQE,iBAAmBJ,GACrCK,EAAEA,EAACC,EAAEA,GAAMV,EAAIM,QAAQK,iBAAiBJ,GAE9C,OAAOJ,EAAU,CAACM,EAAGC,GAAIL,EAAM,GAEpC,CAACL,IAEUA,EAClB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{useState as e,useEffect as
|
|
2
|
+
import{useState as e,useEffect as t}from"react";function r(){const[r,n]=e(!1);return t((()=>{const e=e=>n(e.matches),t=matchMedia("(prefers-reduced-motion: reduce)");return t.addEventListener("change",e),n(t.matches),()=>t.removeEventListener("change",e)}),[]),r}export{r as default};
|
|
3
3
|
//# sourceMappingURL=use-reduced-motion.js.map
|
package/dist/hooks/use-scroll.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import t from"./use-link.js";import e from"./use-mount-effect.js";function
|
|
2
|
+
import t from"./use-link.js";import e from"./use-mount-effect.js";function o({restore:o=0,target:n}={}){const r=t({x:0,y:0,top:0,left:0});return e((()=>{const t=(null==n?void 0:n.current)?n.current:window;function e(t){const e=(null==n?void 0:n.current)||document.documentElement,o=e.scrollLeft,l=o/(e.scrollWidth-e.clientWidth||1),c=e.scrollTop,s=c/(e.scrollHeight-e.clientHeight||1);r.set({x:l,y:s,top:c,left:o},{duration:t})}e(o);const l=()=>e();return t.addEventListener("scroll",l),()=>t.removeEventListener("scroll",l)}),[n]),r}export{o as default};
|
|
3
3
|
//# sourceMappingURL=use-scroll.js.map
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
|
+
import{useRef as r,useState as t,useMemo as n}from"react";function e(){const e=r(0),[c,o]=t(0);return n((()=>{function r(){o(++e.current)}return r.called=c,r}),[c])}export{e as default};
|
|
2
3
|
//# sourceMappingURL=use-trigger.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-trigger.js","sources":[
|
|
1
|
+
{"version":3,"file":"use-trigger.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{useRef as e}from"react";import n from"./use-link.js";import t from"./use-mount-effect.js";function
|
|
2
|
+
import{useRef as e}from"react";import n from"./use-link.js";import t from"./use-mount-effect.js";function r(r=.5){const i=e(null),o=n([-1,-1]);return t((()=>{function e(){if(!i.current)return;const{x:e,y:n,width:t,height:s}=i.current.getBoundingClientRect();o.set([(e+t*r)/(window.innerWidth+2*t*(r-.5)),(n+s*r)/(window.innerHeight+2*s*(r-.5))])}return e(),window.addEventListener("scroll",e),window.addEventListener("resize",e),()=>{window.removeEventListener("scroll",e),window.removeEventListener("resize",e)}}),[r]),[o,i]}export{r as default};
|
|
3
3
|
//# sourceMappingURL=use-viewport.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{useRef as e}from"react";import
|
|
2
|
+
import{useRef as e,useEffect as r}from"react";import t from"./use-trigger.js";import s from"./use-viewport.js";function i({enter:i=1,exit:n=!1,threshold:u=.5}={}){const[o,c]=s(u),b=e({visible:!1,enters:!0===i?1/0:+i,exits:!0===n?1/0:+n}),f=t();return r((()=>{function e(){const[e,r]=o(),t=e>0&&e<1&&r>0&&r<1,{visible:s,enters:i,exits:n}=b.current;!s&&t&&i&&(b.current.enters--,f()),s&&!t&&n&&(b.current.exits--,f()),b.current.visible=t}return o.subscribe(e),()=>o.unsubscribe(e)}),[]),[f,c]}export{i 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";
|
|
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";
|
|
2
2
|
//# sourceMappingURL=hooks.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as r}from"react/jsx-runtime";import{useRef as
|
|
2
|
+
import{jsx as r}from"react/jsx-runtime";import{useRef as t,useState as n,useEffect as e,Children as i,isValidElement as o}from"react";import u from"../animatable.js";import c from"../hooks/use-mount-effect.js";function f(r,t={}){return i.forEach(r,(r=>{var n;if(!o(r))return;const e=null===(n=r.type)||void 0===n?void 0:n.displayName;"Animatable"!==e&&"Animate"!==e||!("id"in r.props)||(t[r.props.id]=!0),f(r.props.children,t)})),t}function l(r,t){const n=typeof r,e=typeof t;if(n!==e)return!1;if(o(r))return!(!o(t)||r.key!==t.key)&&l(r.props,t.props);if(Array.isArray(r)){if(!Array.isArray(t)||r.length!==t.length)return!1;for(let n=0;n<r.length;n++)if(!l(r[n],t[n]))return!1;return!0}if("object"===n&&null!==r&&null!==t){const n=Object.keys(r),e=Object.keys(t);if(n.length!==e.length)return!1;if(!n.length)return r.toString()===t.toString();for(let i=0;i<n.length;i++)if(!(n[i]in t)||!l(r[n[i]],t[e[i]]))return!1;return!0}return"function"===n&&n===e||r===t}function a(r,t){try{return l(r,t)}catch(r){return!1}}function s({children:i,transition:o}){const l=t(null),s=t(f(i)),[m,p]=n(i);return e((()=>{if(!l.current||a(m,i))return;let r=0,t=f(i);for(const n of l.current.children)n.current&&!n.current.manual&&n.current.id in s.current&&!(n.current.id in t)&&(r=Math.max(n.current.trigger("unmount"),r));s.current=t,setTimeout((()=>p(i)),1e3*r)}),[i]),c((()=>{var r;if(l.current)for(const t of l.current.children)(null===(r=t.current)||void 0===r?void 0:r.timeline.mounted)&&t.current.adaptive&&t.current.timeline.transition(void 0,o)}),[m]),r(u,{ref:l,cachable:[],passthrough:!0,children:m})}export{s as default};
|
|
3
3
|
//# sourceMappingURL=layout-group.js.map
|
package/dist/layout/morph.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{__rest as t
|
|
2
|
+
import{__rest as t}from"tslib";import{jsx as r}from"react/jsx-runtime";import{use as e,useRef as i,useState as n,useEffect as o}from"react";import u,{AnimatableContext as s}from"../animatable.js";import{combineRefs as m}from"../core/utils.js";import l from"../hooks/use-mount-effect.js";const c={};function a(a){var{children:f,transition:d={},show:g=!0,group:p}=a,v=t(a,["children","transition","show","group"]);const b=e(s),h=i(null),[j,w]=n(g),[x,T]=n(g);return p=(null==b?void 0:b.group)?`${b.group}__${p}`:p,l((()=>{if(!h.current)return;const t=h.current.timeline;let r;c[p].targets.forEach((e=>{e.mounted&&e!==t&&(r=e)})),g&&!t.mounted&&(c[p].visible=!0,r?t.transition(r,d):h.current.trigger("mount")),T(g)}),[g]),o((()=>{var t;if(!h.current)return;const r=h.current.timeline;if(!g&&r.mounted){if(!c[p].visible){const r=null===(t=h.current)||void 0===t?void 0:t.trigger("unmount");setTimeout((()=>w(!1)),1e3*r)}c[p].targets.delete(r)}(g||c[p].visible)&&w(g),setTimeout((()=>c[p].visible=!1)),r.mounted=g}),[x]),g||j!==g?r(u,Object.assign({},v,{manual:!0,group:p,ref:m((t=>{p in c||(c[p]={targets:new Set,visible:!1}),t&&(c[p].targets.add(t.timeline),h.current=t)}),v.ref),children:f})):null}export{a as default};
|
|
3
3
|
//# sourceMappingURL=morph.js.map
|
package/dist/layout/typable.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{__rest as r
|
|
2
|
+
import{__rest as r}from"tslib";import{jsx as t}from"react/jsx-runtime";import{Children as e}from"react";import i from"../animatable.js";function a(a){var{children:m,stagger:s=1,staggerLimit:g=Number.MAX_VALUE}=a,n=r(a,["children","stagger","staggerLimit"]);return t(i,Object.assign({},n,{stagger:-1*s,staggerLimit:g,children:e.map(m,(r=>"string"!=typeof r&&"number"!=typeof r?r:r.toString().split("").map((r=>t("span",{style:{whiteSpace:" "===r?"pre-wrap":void 0},children:r})))))}))}export{a as default};
|
|
3
3
|
//# sourceMappingURL=typable.js.map
|
|
@@ -8,7 +8,7 @@ export type AnimatableType<T extends string = any> = {
|
|
|
8
8
|
play: (animation: T | 'animate', options?: PlayOptions, layer?: number) => number;
|
|
9
9
|
trigger: (trigger: StaticTrigger, options?: PlayOptions) => number;
|
|
10
10
|
timeline: Timeline;
|
|
11
|
-
children: React.
|
|
11
|
+
children: React.RefObject<AnimatableType | null>[];
|
|
12
12
|
inherit: boolean | undefined;
|
|
13
13
|
adaptive: boolean;
|
|
14
14
|
manual: boolean;
|
|
@@ -32,6 +32,7 @@ type SharedProps<T extends string = any> = {
|
|
|
32
32
|
paused?: boolean;
|
|
33
33
|
};
|
|
34
34
|
export type AnimatableProps<T extends string = any> = {
|
|
35
|
+
ref?: React.Ref<AnimatableType>;
|
|
35
36
|
children: React.ReactNode;
|
|
36
37
|
id?: string;
|
|
37
38
|
order?: number;
|
|
@@ -44,24 +45,9 @@ export type AnimatableProps<T extends string = any> = {
|
|
|
44
45
|
} & SharedProps<T>;
|
|
45
46
|
type AnimatableContext = {
|
|
46
47
|
index?: number;
|
|
47
|
-
add: (child: React.RefObject<AnimatableType>) => void;
|
|
48
|
-
remove: (child: React.RefObject<AnimatableType>) => void;
|
|
48
|
+
add: (child: React.RefObject<AnimatableType | null>) => void;
|
|
49
|
+
remove: (child: React.RefObject<AnimatableType | null>) => void;
|
|
49
50
|
} & SharedProps;
|
|
50
51
|
export declare const AnimatableContext: import("react").Context<AnimatableContext | null>;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
children: React.ReactNode;
|
|
54
|
-
id?: string | undefined;
|
|
55
|
-
order?: number | undefined;
|
|
56
|
-
inherit?: boolean | undefined;
|
|
57
|
-
passthrough?: boolean | undefined;
|
|
58
|
-
adaptive?: boolean | undefined;
|
|
59
|
-
cachable?: CachableKey[] | undefined;
|
|
60
|
-
manual?: boolean | undefined;
|
|
61
|
-
onAnimationEnd?: ((animation: "animate" | T) => void) | undefined;
|
|
62
|
-
} & SharedProps<T> & {
|
|
63
|
-
ref?: import("react").ForwardedRef<AnimatableType<any>> | undefined;
|
|
64
|
-
}) => ReturnType<typeof AnimatableBase>) & {
|
|
65
|
-
displayName: string;
|
|
66
|
-
};
|
|
67
|
-
export default Animatable;
|
|
52
|
+
export default function Animatable<T extends string>(props: AnimatableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
53
|
+
export {};
|
package/dist/types/animate.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import { AnimatableProps, AnimatableType } from "./animatable";
|
|
1
|
+
import { AnimatableProps } from "./animatable";
|
|
3
2
|
import Clip, { ClipProperties } from "./core/clip";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export
|
|
3
|
+
type AnimateProps = {
|
|
4
|
+
animations?: (ClipProperties | Clip)[];
|
|
5
|
+
levels?: number;
|
|
6
|
+
} & Omit<AnimatableProps, 'animations' | 'animate' | 'order'>;
|
|
7
|
+
export default function Animate({ children, animations, levels, ...props }: AnimateProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { Link } from "./link";
|
|
3
3
|
import type Track from "./track";
|
|
4
4
|
export type Easing = 'linear' | 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'step-start' | 'step-end';
|
|
5
5
|
export type AnimatableKey = keyof React.CSSProperties | 'strokeLength';
|
|
@@ -15,7 +15,7 @@ export type AnimatableInitials = React.CSSProperties & {
|
|
|
15
15
|
strokeLength?: number | string;
|
|
16
16
|
};
|
|
17
17
|
export type CompositeType = 'none' | 'override' | 'combine';
|
|
18
|
-
type ClipConfig = {
|
|
18
|
+
export type ClipConfig = {
|
|
19
19
|
duration?: number;
|
|
20
20
|
delay?: number;
|
|
21
21
|
repeat?: number;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ClipConfig } from "./clip";
|
|
2
|
+
type Computed<P> = (index: number) => P;
|
|
3
|
+
export type Computation<T, P> = (value: T, index: number) => P;
|
|
4
|
+
type LinkCallback = (options: ClipConfig) => void;
|
|
5
|
+
export type Link<T> = {
|
|
6
|
+
(index?: number): T;
|
|
7
|
+
<P>(computation: Computation<T, P>): Link<ReturnType<typeof computation>>;
|
|
8
|
+
set(value: T, options?: ClipConfig): void;
|
|
9
|
+
subscribe(callback: LinkCallback): void;
|
|
10
|
+
unsubscribe(callback: LinkCallback): void;
|
|
11
|
+
};
|
|
12
|
+
export declare function createLink<T, P>(initial: T, computed?: Computed<P>): Link<T>;
|
|
13
|
+
export declare function isLink<T>(val: any): val is Link<T>;
|
|
14
|
+
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type Link } from "../hooks/use-link";
|
|
2
1
|
import { CachableKey } from "./cache";
|
|
3
2
|
import Clip, { ClipProperties, CompositeType } from "./clip";
|
|
4
3
|
import Track, { TransitionOptions } from "./track";
|
|
@@ -19,7 +18,7 @@ export default class Timeline {
|
|
|
19
18
|
paused: boolean;
|
|
20
19
|
tracks: IndexedMap<Element, Track>;
|
|
21
20
|
frame: number;
|
|
22
|
-
|
|
21
|
+
linked: (() => void)[];
|
|
23
22
|
mounted: boolean;
|
|
24
23
|
mountClips: Clip[];
|
|
25
24
|
constructor({ stagger, staggerLimit, deform, cachable, mountClips }: {
|
|
@@ -31,8 +30,9 @@ export default class Timeline {
|
|
|
31
30
|
});
|
|
32
31
|
step(): void;
|
|
33
32
|
time(clip: Clip): number;
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
private receiver;
|
|
34
|
+
link(clip?: ClipProperties | Clip): void;
|
|
35
|
+
unlink(): void;
|
|
36
36
|
transition(from: Timeline | undefined, options?: TransitionOptions): void;
|
|
37
37
|
insert(element: any): void;
|
|
38
38
|
add(clip: Clip, { immediate, composite, reverse, delay, commit }: PlayOptions): void;
|
|
@@ -23,7 +23,6 @@ export default class Track {
|
|
|
23
23
|
step(index: number): void;
|
|
24
24
|
transition(previous: Track | undefined, options: TransitionOptions): void;
|
|
25
25
|
apply(prop: string, val: any): void;
|
|
26
|
-
set(prop: string, val: any): void;
|
|
27
26
|
decomposeScale(): [number, number];
|
|
28
27
|
computeBorderRadius(borderRadius?: string): string;
|
|
29
28
|
correct(): void;
|
|
@@ -16,7 +16,7 @@ export declare function merge<T extends {
|
|
|
16
16
|
export declare function pick<T extends {
|
|
17
17
|
[key: string]: any;
|
|
18
18
|
}, K extends keyof T>(map: T, keys: K[]): { [key in K]: T[K]; };
|
|
19
|
-
export declare function combineRefs(...refs: React.Ref<any>[]): (el: any) => void;
|
|
19
|
+
export declare function combineRefs(...refs: (React.Ref<any> | undefined)[]): (el: any) => void;
|
|
20
20
|
export declare const lengthToOffset: (val: any) => number;
|
|
21
21
|
export declare class IndexedMap<K, V> {
|
|
22
22
|
private map;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { Link } from "
|
|
2
|
+
import { Link } from "../core/link";
|
|
3
3
|
export default function useAudio({ bands, minFrequency, maxFrequency, smoothing }?: {
|
|
4
4
|
bands?: number | undefined;
|
|
5
5
|
minFrequency?: number | undefined;
|
|
6
6
|
maxFrequency?: number | undefined;
|
|
7
7
|
smoothing?: number | undefined;
|
|
8
|
-
}): [React.
|
|
8
|
+
}): [React.RefObject<HTMLAudioElement | null>, Link<number[]>];
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
|
|
2
|
-
type Transformer<T, P = any> = (val: T, index: number) => P;
|
|
3
|
-
export type Link<T> = {
|
|
4
|
-
<P = any>(transform: Transformer<T, P>): Link<ReturnType<Transformer<T, P>>>;
|
|
5
|
-
(index?: number): T;
|
|
6
|
-
onchange: (callback: ChangeListener) => void;
|
|
7
|
-
offchange: (callback: ChangeListener) => void;
|
|
8
|
-
set: (value: T, transition?: number) => void;
|
|
9
|
-
};
|
|
10
|
-
export declare function isLink<T>(val: any): val is Link<T>;
|
|
11
|
-
export default function useLink<T = any>(initial: T): Link<T>;
|
|
12
|
-
export {};
|
|
1
|
+
export default function useLink<T = any>(initial: T): import("../core/link").Link<T>;
|
package/dist/types/hooks.d.ts
CHANGED
|
@@ -6,5 +6,4 @@ import usePath from "./hooks/use-path";
|
|
|
6
6
|
import useViewport from "./hooks/use-viewport";
|
|
7
7
|
import useVisible from "./hooks/use-visible";
|
|
8
8
|
import useAudio from "./hooks/use-audio";
|
|
9
|
-
|
|
10
|
-
export { useLink, useTrigger, useReducedMotion, useScroll, usePath, useViewport, useVisible, useAudio, useCouple };
|
|
9
|
+
export { useLink, useTrigger, useReducedMotion, useScroll, usePath, useViewport, useVisible, useAudio };
|
|
@@ -1,35 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
import { AnimatableType } from "../animatable";
|
|
1
|
+
import { AnimatableProps } from "../animatable";
|
|
3
2
|
import { TransitionOptions } from "../core/track";
|
|
4
|
-
|
|
3
|
+
type MorphProps = {
|
|
5
4
|
group: string;
|
|
6
|
-
transition?: Omit<TransitionOptions,
|
|
7
|
-
show?: boolean
|
|
8
|
-
} &
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
inherit?: boolean | undefined;
|
|
13
|
-
passthrough?: boolean | undefined;
|
|
14
|
-
adaptive?: boolean | undefined;
|
|
15
|
-
cachable?: import("../core/cache").CachableKey[] | undefined;
|
|
16
|
-
manual?: boolean | undefined;
|
|
17
|
-
onAnimationEnd?: ((animation: any) => void) | undefined;
|
|
18
|
-
} & {
|
|
19
|
-
group?: string | undefined;
|
|
20
|
-
animations?: {
|
|
21
|
-
[x: string]: import("../core/clip").ClipProperties | import("../animations").Clip;
|
|
22
|
-
} | undefined;
|
|
23
|
-
triggers?: ({
|
|
24
|
-
name?: any;
|
|
25
|
-
on: boolean | import("../hooks/use-trigger").Trigger | ("mount" | "unmount");
|
|
26
|
-
} & import("../core/timeline").PlayOptions)[] | undefined;
|
|
27
|
-
animate?: import("../core/clip").ClipProperties | import("../animations").Clip | undefined;
|
|
28
|
-
initial?: import("../core/clip").AnimatableInitials | undefined;
|
|
29
|
-
stagger?: number | undefined;
|
|
30
|
-
staggerLimit?: number | undefined;
|
|
31
|
-
deform?: boolean | undefined;
|
|
32
|
-
disabled?: boolean | undefined;
|
|
33
|
-
paused?: boolean | undefined;
|
|
34
|
-
} & import("react").RefAttributes<AnimatableType>>;
|
|
35
|
-
export default Morph;
|
|
5
|
+
transition?: Omit<TransitionOptions, 'reverse'>;
|
|
6
|
+
show?: boolean;
|
|
7
|
+
} & AnimatableProps;
|
|
8
|
+
export default function Morph({ children, transition, // should be able to be inherited
|
|
9
|
+
show, group, ...props }: MorphProps): import("react/jsx-runtime").JSX.Element | null;
|
|
10
|
+
export {};
|
|
@@ -1,30 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
declare const Typable: import("react").ForwardRefExoticComponent<{
|
|
4
|
-
children: import("react").ReactNode;
|
|
5
|
-
id?: string | undefined;
|
|
6
|
-
order?: number | undefined;
|
|
7
|
-
inherit?: boolean | undefined;
|
|
8
|
-
passthrough?: boolean | undefined;
|
|
9
|
-
adaptive?: boolean | undefined;
|
|
10
|
-
cachable?: import("../core/cache").CachableKey[] | undefined;
|
|
11
|
-
manual?: boolean | undefined;
|
|
12
|
-
onAnimationEnd?: ((animation: any) => void) | undefined;
|
|
13
|
-
} & {
|
|
14
|
-
group?: string | undefined;
|
|
15
|
-
animations?: {
|
|
16
|
-
[x: string]: import("../core/clip").ClipProperties | import("../animations").Clip;
|
|
17
|
-
} | undefined;
|
|
18
|
-
triggers?: ({
|
|
19
|
-
name?: any;
|
|
20
|
-
on: boolean | import("../hooks/use-trigger").Trigger | ("mount" | "unmount");
|
|
21
|
-
} & import("../core/timeline").PlayOptions)[] | undefined;
|
|
22
|
-
animate?: import("../core/clip").ClipProperties | import("../animations").Clip | undefined;
|
|
23
|
-
initial?: import("../core/clip").AnimatableInitials | undefined;
|
|
24
|
-
stagger?: number | undefined;
|
|
25
|
-
staggerLimit?: number | undefined;
|
|
26
|
-
deform?: boolean | undefined;
|
|
27
|
-
disabled?: boolean | undefined;
|
|
28
|
-
paused?: boolean | undefined;
|
|
29
|
-
} & import("react").RefAttributes<AnimatableType>>;
|
|
30
|
-
export default Typable;
|
|
1
|
+
import { AnimatableProps } from "../animatable";
|
|
2
|
+
export default function Typable({ children, stagger, staggerLimit, ...props }: AnimatableProps): import("react/jsx-runtime").JSX.Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infinityfx/lively",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Feature complete, lightweight react animation library.",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -50,21 +50,22 @@
|
|
|
50
50
|
"tslib": "^2.6.2"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"react": ">=
|
|
54
|
-
"react-dom": ">=
|
|
53
|
+
"react": ">=19.0.0",
|
|
54
|
+
"react-dom": ">=19.0.0"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|
|
57
57
|
"@rollup/plugin-commonjs": "^25.0.7",
|
|
58
58
|
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
59
59
|
"@rollup/plugin-terser": "^0.4.4",
|
|
60
60
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
61
|
-
"@types/react": "
|
|
62
|
-
"react": "
|
|
63
|
-
"react
|
|
64
|
-
"
|
|
65
|
-
"rollup
|
|
61
|
+
"@types/react": "npm:types-react@^19.0.0-beta.1",
|
|
62
|
+
"@types/react-dom": "npm:types-react-dom@^19.0.0-beta.1",
|
|
63
|
+
"react": "^19.0.0-beta-73bcdfbae5-20240502",
|
|
64
|
+
"react-dom": "^19.0.0-beta-73bcdfbae5-20240502",
|
|
65
|
+
"rollup": "^4.17.2",
|
|
66
66
|
"rollup-plugin-delete": "^2.0.0",
|
|
67
|
-
"
|
|
67
|
+
"rollup-plugin-preserve-directives": "^0.4.0",
|
|
68
|
+
"typescript": "^5.4.5"
|
|
68
69
|
},
|
|
69
70
|
"sideEffects": false
|
|
70
71
|
}
|
package/tsconfig.json
CHANGED
package/dist/hooks/use-couple.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import{useState as n,useEffect as r}from"react";import o,{isLink as t}from"./use-link.js";function f(f,u){void 0===u&&(u=[]);var c=n(f)[0],e=o(c);return r((function(){var n=function(){return e.set(f())};return n(),u.forEach((function(r){t(r)&&r.onchange(n)})),function(){return u.forEach((function(r){t(r)&&r.offchange(n)}))}}),u),e}export{f as default};
|
|
3
|
-
//# sourceMappingURL=use-couple.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"use-couple.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export default function useCouple<T>(callback: () => T, dependencies?: unknown[]): import("./use-link").Link<T>;
|