@infinityfx/lively 4.0.0-alpha.3 → 4.0.0-beta.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.
@@ -1,3 +1,3 @@
1
1
  "use client";
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 c,isValidElement as l,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 c=(n.reverse?o:s)*(M/t);return a&&T.current.add(a,p({delay:c},n)),r.onAnimationEnd&&setTimeout(r.onAnimationEnd.bind({},e),1e3*(u+c)),u+c}),[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.pause(!(!C&&!L))),[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:c.map(r.children,(e=>!l(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};
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:L=[],disabled:E,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:L.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(E||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}),[E,M]);function q(n,r={}){let t=0;for(let i of L){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})),[L]),u((()=>T.current.pause(!(!C&&!E))),[C,E]),u((()=>{for(let n=0;n<L.length;n++){let r=L[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}}),[L]),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})))})}b.isLively=!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}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};
2
+ import{__rest as i}from"tslib";import{jsx as r,Fragment as t}from"react/jsx-runtime";import{Children as n,isValidElement as e,cloneElement as o}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=>e(r)?o(r,{},i(r.props.children,a-1)):r))}))}(p)})}l.isLively=!0;export{l as default};
3
3
  //# sourceMappingURL=animate.js.map
@@ -1,2 +1,2 @@
1
- import t from"./clip.js";import{isLink as s}from"./link.js";import i from"./track.js";import{IndexedMap as e,merge as a}from"./utils.js";class r{constructor({stagger:t=.1,staggerLimit:s=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=t,this.staggerLimit=s-1,this.deform=i,this.cachable=a,this.mountClips=r}step(){cancelAnimationFrame(this.frame),this.paused||this.tracks.stack.forEach(((t,s)=>t.step(s))),this.frame=requestAnimationFrame(this.step.bind(this))}time(t){return t.duration+t.delay+this.stagger*Math.max(Math.min(this.staggerLimit,this.tracks.size-1),0)}receiver(s,i,e){if(!this.paused)for(let r=0;r<this.tracks.size;r++){const c=this.tracks.stack[r],h=i(r);e.duration?(a(e,{composite:"override"}),new t(Object.assign(Object.assign({},e),{[s]:h})).play(c,{})):c.apply(s,h)}}link(i){if(!(this.linked.length||!i||i instanceof t)){for(let t in i){const e=i[t];if(s(e)){const s=this.receiver.bind(this,t,e);e.subscribe(s),this.linked.push((()=>e.unsubscribe(s))),s({})}}this.step()}}unlink(){this.linked.forEach((t=>t())),this.linked=[]}transition(t,s={}){for(let i=0;i<this.tracks.size;i++)this.tracks.stack[i].transition(null==t?void 0:t.tracks.stack[i],s)}insert(t){if((t instanceof HTMLElement||t instanceof SVGElement)&&!this.tracks.has(t)){const s=new i(t,this.deform,this.cachable);this.tracks.set(t,s),this.mounted&&this.mountClips.forEach((t=>t.play(s,{})))}}add(t,{immediate:s=!1,composite:i,reverse:e,delay:a=0,commit:r}){let c,h=0;for(;c=this.tracks.stack[h];)c.element.isConnected?(s&&c.clear(),t.play(c,{delay:a+Math.min(h,this.staggerLimit)*(this.stagger<0?t.duration/this.tracks.size:1)*Math.abs(this.stagger),composite:i,reverse:e,commit:r}),h++):this.tracks.delete(c.element)}pause(t){for(const s of this.tracks.stack)s.pause(t);this.paused=t}cache(){for(const t of this.tracks.stack)t.cache.update()}}export{r as default};
1
+ import t from"./clip.js";import{isLink as s}from"./link.js";import i from"./track.js";import{IndexedMap as e,merge as a}from"./utils.js";class r{constructor({stagger:t=.1,staggerLimit:s=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=t,this.staggerLimit=s-1,this.deform=i,this.cachable=a,this.mountClips=r}step(){cancelAnimationFrame(this.frame),this.paused||this.tracks.stack.forEach(((t,s)=>t.step(s))),this.frame=requestAnimationFrame(this.step.bind(this))}time(t){return t.duration+t.delay+this.stagger*Math.max(Math.min(this.staggerLimit,this.tracks.size-1),0)}receiver(s,i,e){if(!this.paused)for(let r=0;r<this.tracks.size;r++){const c=this.tracks.stack[r],h=i(r);e.duration?(a(e,{composite:"override"}),new t(Object.assign(Object.assign({},e),{[s]:h})).play(c,{})):c.apply(s,h)}}link(i){if(this.step(),!(this.linked.length||!i||i instanceof t))for(let t in i){const e=i[t];if(s(e)){const s=this.receiver.bind(this,t,e);e.subscribe(s),this.linked.push((()=>e.unsubscribe(s))),s({})}}}unlink(){this.linked.forEach((t=>t())),this.linked=[]}transition(t,s={}){for(let i=0;i<this.tracks.size;i++)this.tracks.stack[i].transition(null==t?void 0:t.tracks.stack[i],s)}insert(t){if((t instanceof HTMLElement||t instanceof SVGElement)&&!this.tracks.has(t)){const s=new i(t,this.deform,this.cachable);this.tracks.set(t,s),this.mounted&&this.mountClips.forEach((t=>t.play(s,{})))}}add(t,{immediate:s=!1,composite:i,reverse:e,delay:a=0,commit:r}){let c,h=0;for(;c=this.tracks.stack[h];)c.element.isConnected?(s&&c.clear(),t.play(c,{delay:a+Math.min(h,this.staggerLimit)*(this.stagger<0?t.duration/this.tracks.size:1)*Math.abs(this.stagger),composite:i,reverse:e,commit:r}),h++):this.tracks.delete(c.element)}pause(t){for(const s of this.tracks.stack)s.pause(t);this.paused=t}cache(){for(const t of this.tracks.stack)t.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","constructor","stagger","staggerLimit","deform","cachable","mountClips","this","index","paused","tracks","IndexedMap","frame","linked","mounted","step","cancelAnimationFrame","stack","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","isConnected","clear","abs","delete","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,OAErBL,KAAKE,QAAQF,KAAKG,OAAOO,MAAMC,SAAQ,CAACC,EAAOC,IAAMD,EAAMJ,KAAKK,KAErEb,KAAKK,MAAQS,sBAAsBd,KAAKQ,KAAKO,KAAKf,MACrD,CAED,IAAAgB,CAAKC,GACD,OAAOA,EAAKC,SAAWD,EAAKE,MAAQnB,KAAKL,QAAUyB,KAAKC,IAAID,KAAKE,IAAItB,KAAKJ,aAAcI,KAAKG,OAAOoB,KAAO,GAAI,EAClH,CAEO,QAAAC,CAASC,EAAcC,EAAiBC,GAC5C,IAAI3B,KAAKE,OAET,IAAK,IAAIW,EAAI,EAAGA,EAAIb,KAAKG,OAAOoB,KAAMV,IAAK,CACvC,MAAMD,EAAQZ,KAAKG,OAAOO,MAAMG,GAC5Be,EAAQF,E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AQ,EAACoC,OAAEA,IAChE,IAAW3C,EAAPC,EAAI,EAER,KAAOD,EAAQZ,KAAKG,OAAOO,MAAMG,IACxBD,EAAMkC,QAAQU,aAKfH,GAAWzC,EAAM6C,QAErBxC,EAAKiB,KAAKtB,EAAO,CACbO,MAAOA,EAAQC,KAAKE,IAAIT,EAAGb,KAAKJ,eAAiBI,KAAKL,QAAU,EAAIsB,EAAKC,SAAWlB,KAAKG,OAAOoB,KAAO,GAAKH,KAAKsC,IAAI1D,KAAKL,SAC1HmC,YACAwB,UACAC,WAGJ1C,KAbIb,KAAKG,OAAOwD,OAAO/C,EAAMkC,QAepC,CAED,KAAAc,CAAMhC,GACF,IAAK,MAAMhB,KAASZ,KAAKG,OAAOO,MAAOE,EAAMgD,MAAMhC,GAEnD5B,KAAKE,OAAS0B,CACjB,CAED,KAAAiC,GACI,IAAK,MAAMjD,KAASZ,KAAKG,OAAOO,MAAOE,EAAMiD,MAAMC,QACtD"}
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","stack","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","isConnected","clear","abs","delete","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,QAA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use client";
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};
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;o(r)&&((null===(n=r.type)||void 0===n?void 0:n.isLively)&&"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)),[p,h]=n(i);return e((()=>{if(!l.current||a(p,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((()=>h(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)}),[p]),r(u,{ref:l,cachable:[],passthrough:!0,children:p})}export{s as default};
3
3
  //# sourceMappingURL=layout-group.js.map
@@ -1,3 +1,3 @@
1
1
  "use client";
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};
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 l}from"../core/utils.js";import m 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,m((()=>{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:l((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}a.isLively=!0;export{a as default};
3
3
  //# sourceMappingURL=morph.js.map
@@ -1,3 +1,3 @@
1
1
  "use client";
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};
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})))))}))}a.isLively=!0;export{a as default};
3
3
  //# sourceMappingURL=typable.js.map
@@ -49,5 +49,8 @@ type AnimatableContext = {
49
49
  remove: (child: React.RefObject<AnimatableType | null>) => void;
50
50
  } & SharedProps;
51
51
  export declare const AnimatableContext: import("react").Context<AnimatableContext | null>;
52
- export default function Animatable<T extends string>(props: AnimatableProps<T>): import("react/jsx-runtime").JSX.Element;
53
- export {};
52
+ declare function Animatable<T extends string>(props: AnimatableProps<T>): import("react/jsx-runtime").JSX.Element;
53
+ declare namespace Animatable {
54
+ var isLively: boolean;
55
+ }
56
+ export default Animatable;
@@ -4,5 +4,8 @@ type AnimateProps = {
4
4
  animations?: (ClipProperties | Clip)[];
5
5
  levels?: number;
6
6
  } & Omit<AnimatableProps, 'animations' | 'animate' | 'order'>;
7
- export default function Animate({ children, animations, levels, ...props }: AnimateProps): import("react/jsx-runtime").JSX.Element;
8
- export {};
7
+ declare function Animate({ children, animations, levels, ...props }: AnimateProps): import("react/jsx-runtime").JSX.Element;
8
+ declare namespace Animate {
9
+ var isLively: boolean;
10
+ }
11
+ export default Animate;
@@ -5,6 +5,9 @@ type MorphProps = {
5
5
  transition?: Omit<TransitionOptions, 'reverse'>;
6
6
  show?: boolean;
7
7
  } & AnimatableProps;
8
- export default function Morph({ children, transition, // should be able to be inherited
8
+ declare function Morph({ children, transition, // should be able to be inherited
9
9
  show, group, ...props }: MorphProps): import("react/jsx-runtime").JSX.Element | null;
10
- export {};
10
+ declare namespace Morph {
11
+ var isLively: boolean;
12
+ }
13
+ export default Morph;
@@ -1,2 +1,6 @@
1
1
  import { AnimatableProps } from "../animatable";
2
- export default function Typable({ children, stagger, staggerLimit, ...props }: AnimatableProps): import("react/jsx-runtime").JSX.Element;
2
+ declare function Typable({ children, stagger, staggerLimit, ...props }: AnimatableProps): import("react/jsx-runtime").JSX.Element;
3
+ declare namespace Typable {
4
+ var isLively: boolean;
5
+ }
6
+ export default Typable;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infinityfx/lively",
3
- "version": "4.0.0-alpha.3",
3
+ "version": "4.0.0-beta.1",
4
4
  "type": "module",
5
5
  "description": "Feature complete, lightweight react animation library.",
6
6
  "main": "dist/index.js",