@infinityfx/lively 4.0.0-beta.15 → 4.0.0-beta.17
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/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/layout/layout-group.js +1 -1
- package/dist/types/animatable.d.ts +51 -0
- package/dist/types/animate.d.ts +8 -0
- package/dist/types/core/track.d.ts +4 -2
- package/dist/types/layout/layout-group.d.ts +10 -0
- package/dist/types/layout/morph.d.ts +8 -0
- package/dist/types/layout/typable.d.ts +5 -0
- package/package.json +3 -3
package/dist/core/timeline.js
CHANGED
|
@@ -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 this.tracks.size?t.duration+t.delay+this.stagger*Math.max(Math.min(this.staggerLimit,this.tracks.size-1),0):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),c.correct())}}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};
|
|
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 this.tracks.size?t.duration+t.delay+this.stagger*Math.max(Math.min(this.staggerLimit,this.tracks.size-1),0):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),c.correct())}}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(){cancelAnimationFrame(this.frame),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","size","duration","delay","Math","max","min","receiver","prop","link","config","value","merge","composite","Clip","Object","assign","play","apply","correct","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":"
|
|
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","size","duration","delay","Math","max","min","receiver","prop","link","config","value","merge","composite","Clip","Object","assign","play","apply","correct","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":"yIAcc,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,EAUfP,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,OAAKjB,KAAKG,OAAOe,KAEVD,EAAKE,SAAWF,EAAKG,MAAQpB,KAAKL,QAAU0B,KAAKC,IAAID,KAAKE,IAAIvB,KAAKJ,aAAcI,KAAKG,OAAOe,KAAO,GAAI,GAFjF,CAGjC,CAEO,QAAAM,CAASC,EAAcC,EAAiBC,GAC5C,IAAI3B,KAAKE,OAET,IAAK,IAAIW,EAAI,EAAGA,EAAIb,KAAKG,OAAOe,KAAML,IAAK,CACvC,MAAMD,EAAQZ,KAAKG,OAAOO,MAAMG,GAC5Be,EAAQF,EAAKb,GAEbc,EAAOR,UACPU,EAAMF,EAAQ,CAAEG,UAAW,aAE3B,IAAIC,EAAUC,OAAAC,OAAAD,OAAAC,OAAA,CAAA,EAAAN,GAAQ,CAAAF,CAACA,GAAOG,KAASM,KAAKtB,EAAO,CAAA,KAEnDA,EAAMuB,MAAMV,EAAMG,GAClBhB,EAAMwB,UAEb,CACJ,CAED,IAA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AAKJ,eAAiBI,KAAKL,QAAU,EAAIsB,EAAKE,SAAWnB,KAAKG,OAAOe,KAAO,GAAKG,KAAKsC,IAAI3D,KAAKL,SAC1HmC,YACAyB,UACAC,WAGJ3C,KAbIb,KAAKG,OAAOyD,OAAOhD,EAAMmC,QAepC,CAED,KAAAc,CAAMjC,GACF,IAAK,MAAMhB,KAASZ,KAAKG,OAAOO,MAAOE,EAAMiD,MAAMjC,GAEnD5B,KAAKE,OAAS0B,CACjB,CAED,KAAAkC,GACI,IAAK,MAAMlD,KAASZ,KAAKG,OAAOO,MAAOE,EAAMkD,MAAMC,QACtD"}
|
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";class s{constructor(e,s,i){this.playing=0,this.active=[],this.queue=[],this.paused=!1,this.scale=[1,1],this.
|
|
1
|
+
import{StyleCache as t}from"./cache.js";import{lengthToOffset as e}from"./utils.js";class s{constructor(e,s,i){this.playing=0,this.active=[],this.queue=[],this.paused=!1,this.scale=[1,1],this.corrected={borderRadius:"",boxShadow:""},this.element=e,this.deform=s,this.cache=new t(e,i)}push(t){t.onfinish=this.next.bind(this),this.playing&&"none"===t.composite?(this.queue.push(t),t.animation.pause()):(this.active.push(t),"none"===t.composite&&this.playing++,this.paused&&t.animation.pause())}next(){this.cache.update(),--this.playing>0||(this.active=this.queue.length?this.queue.splice(0,1):[],this.playing=this.active.length,this.pause(!1))}clear(t){this.active.forEach((e=>{e.onfinish=null;try{t?e.commit||"combine"===e.composite||e.animation.cancel():e.animation.finish()}catch(t){e.animation.cancel()}})),t||(this.active=[],this.queue=[],this.playing=0),this.deform||(this.element.style.borderRadius="",this.element.style.boxShadow="",this.corrected.borderRadius=this.cache.data.borderRadius=this.cache.computed.borderRadius,this.corrected.boxShadow=this.cache.data.boxShadow=this.cache.computed.boxShadow,this.scale=[1,1])}pause(t){for(const e of this.active)e.animation[t?"pause":"play"]();this.paused=t}step(t){for(const e of this.active)e.step(t);!this.paused&&this.active.length&&this.correct()}transition(t,e){this.clear(!0);const s=this.cache.difference(null==t?void 0:t.cache.data,e);this.cache.update(),null==t||t.clear(),null==t||t.cache.update(),s.forEach((t=>t.play(this,{commit:!1})))}apply(t,s){const i="strokeLength"===t;this.element.style[i?"strokeDashoffset":t]=i?e(s):s}decomposeScale(){const[t,e]=this.cache.computed.scale.split(" ");let s=Math.max(parseFloat(t)||1,1e-5);/%$/.test(t)&&(s/=100);let i=e?Math.max(parseFloat(e)||1,1e-5):s;return/%$/.test(e)&&(i/=100),[s,i]}correct(){if(this.deform)return;const t=this.cache.computed,e=t.borderRadius.split(/\s*\/\s*/);e.length<2&&(e[1]=e[0]);const s=t.boxShadow.split(/(?<=px),\s?/),[i,a]=s[0].split(/(?<=\))\s/),o=t.borderRadius!==this.corrected.borderRadius?[1,1]:this.scale,h=t.boxShadow!==this.corrected.boxShadow?[1,1]:this.scale,[c,r]=this.scale=this.decomposeScale();if(this.element.style.borderRadius=e.map(((t,e)=>t.split(" ").map((t=>{var s;return parseFloat(t)*o[e]/this.scale[e]+((null===(s=t.match(/[^\d\.]+$/))||void 0===s?void 0:s[0])||"px")})).join(" "))).join("/"),this.corrected.borderRadius=t.borderRadius,a){const e=a.split(" ").map(parseFloat),s=+(c<r),o=s?r:c,l=Math.max(...h),n=new Array(3).fill([e[0]*h[0]/c,e[1]*h[1]/r,e[2]*l/o,e[3]*l/o]);n[1][0]-=s?1/c:0,n[1][1]-=s?0:1/r,n[2][0]+=s?1/c:0,n[2][1]+=s?0:1/r,this.element.style.boxShadow=n.map((t=>`${i} ${t.map((t=>`${t}px`)).join(" ")}`)).join(", "),this.corrected.boxShadow=t.boxShadow}for(let t=0;t<this.element.children.length;t++){const e=this.element.children[t],s=e.offsetLeft,i=e.offsetTop,a=e.offsetWidth,o=e.offsetHeight,[h,l]=getComputedStyle(e).translate.split(" ").map(parseFloat);e.style.transform=`translate(${-h||0}px, ${-l||0}px) scale(${1/c}, ${1/r}) translate(${s*(1-c)+a/2*(1-c)+(h||0)}px, ${i*(1-r)+o/2*(1-r)+(l||0)}px)`}}}export{s 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","deform","cachable","this","playing","active","queue","paused","scale","
|
|
1
|
+
{"version":3,"file":"track.js","sources":["../../src/core/track.ts"],"sourcesContent":[null],"names":["Track","constructor","element","deform","cachable","this","playing","active","queue","paused","scale","corrected","borderRadius","boxShadow","cache","StyleCache","push","action","onfinish","next","bind","composite","animation","pause","update","length","splice","clear","partial","forEach","commit","cancel","finish","ex","style","data","computed","value","step","index","correct","transition","previous","options","clips","difference","clip","play","apply","prop","val","isStroke","lengthToOffset","decomposeScale","xString","yString","split","x","Math","max","parseFloat","test","y","radii","shadows","color","shadow","previousRadiusScale","previousShadowScale","map","axis","i","radius","_a","match","join","props","ms","pms","Array","fill","children","child","l","offsetLeft","t","offsetTop","w","offsetWidth","h","offsetHeight","tx","ty","getComputedStyle","translate","transform"],"mappings":"oFAWc,MAAOA,EAejB,WAAAC,CAAYC,EAAmCC,EAAiBC,GAXhEC,KAAOC,QAAW,EAClBD,KAAME,OAAa,GACnBF,KAAKG,MAAa,GAElBH,KAAMI,QAAY,EAClBJ,KAAAK,MAA0B,CAAC,EAAG,GAC9BL,KAAAM,UAAY,CACRC,aAAc,GACdC,UAAW,IAIXR,KAAKH,QAAUA,EACfG,KAAKF,OAASA,EACdE,KAAKS,MAAQ,IAAIC,EAAWb,EAASE,EACxC,CAED,IAAAY,CAAKC,GACDA,EAAOC,SAAWb,KAAKc,KAAKC,KAAKf,MAE7BA,KAAKC,SAAgC,SAArBW,EAAOI,WACvBhB,KAAKG,MAAMQ,KAAKC,GAChBA,EAAOK,UAAUC,UAEjBlB,KAAKE,OAAOS,KAAKC,GACQ,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AI,GAAK,EAAI9B,IAAMkC,GAAM,SAASN,GAAK,EAAIvB,GAAK2B,EAAI,GAAK,EAAI3B,IAAM8B,GAAM,OACjM,CACJ"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as e}from"react/jsx-runtime";import{useRef as
|
|
2
|
+
import{jsx as e}from"react/jsx-runtime";import{useRef as r,useState as n,useLayoutEffect as t,Children as o,isValidElement as i,cloneElement as c}from"react";import u from"../animatable.js";import{Groups as s}from"./morph.js";function d(e,r,n=[]){const t="nodes"in e?e.nodes:e;for(let e=0;e<t.length;e++){const o=[...n,e];let i=r(t[e],o);if(i||(i=d(t[e].nodes,r,o)),i)return i}}function l(e,r){return d(e,((e,n)=>{if(e.key===r)return n}))||null}function a(e,r){let n=e[r[0]];for(let e=1;e<r.length&&n;e++)n=n.nodes[r[e]];return n}function m(e,r,n,t){var o;const i=r[r.length-1],c=r.length>1?null===(o=a(e,r.slice(0,-1)))||void 0===o?void 0:o.nodes:e;c&&(t?c.splice(i,n,t):c.splice(i,n))}function f({tree:e,nodes:r,mounting:n,partialIndex:t=[],keys:u=new Set}){return o.forEach(r,((r,o)=>{const s=i(r),d=s&&(Array.isArray(r.props.children)||i(r.props.children)),m=s&&r.type.isLively&&"id"in r.props,p=[...t,o],h=d&&!m?c(r,void 0,[]):r,g=m?r.props.id:"$l."+p.join("");if(m){const r=l(e,g);if(null===r)n.set(g,{node:h,index:p});else{const n=a(e,r);n&&(n.node=h)}}else{const r=a(e,p);r&&r.key.startsWith("$l.")?r.node=h:n.set(g,{node:h,index:p})}d&&f({tree:e,nodes:r.props.children,mounting:n,partialIndex:p,keys:u}),u.add(g)})),u}function p(e){const r=e.map((e=>i(e.node)?e.nodes.length?c(e.node,{key:e.key},p(e.nodes)):c(e.node,{key:e.key}):e.node));return r.length>1?r:r[0]}function h({children:o,transition:i,initialMount:c=!0}){var a;const h=r(!c),g=r(null),[y,v]=n({}),k=r([]),x=r(new Map),w=r(void 0),j=r(0),E=r(new Set),z=f({tree:k.current,nodes:o,mounting:x.current});if(x.current.forEach(((e,r)=>{z.has(r)||x.current.delete(r)})),d(k.current,(e=>{z.has(e.key)||E.current.add(e.key)})),E.current.size&&g.current){for(const e of g.current.children){const r=null===(a=e.current)||void 0===a?void 0:a.id,n=E.current.has(r);if(e.current)if(n&&z.has(r))E.current.delete(r),e.current.trigger("mount",{immediate:!0}),e.current.timeline.mounted=!0;else if(n&&e.current.timeline.mounted){const r=Date.now()+1e3*e.current.trigger("unmount",{immediate:!0});if(j.current=Math.max(j.current,r),e.current.group){const r=s[e.current.group].get(e.current.timeline);r&&(r.state="unmounted")}e.current.timeline.mounted=!1}}const e=j.current-Date.now();clearTimeout(w.current);const r=(e=!0)=>{E.current.forEach((e=>{const r=l(k.current,e);r&&m(k.current,r,1)})),E.current.clear(),e&&v({})};e>0?w.current=setTimeout(r,e):r(!1)}return!E.current.size&&x.current.size&&(x.current.forEach((({node:e,index:r},n)=>{m(k.current,r,0,{key:n,node:e,nodes:[]})})),x.current.clear()),t((()=>{var e;if(!g.current)return;let r,n=g.current.children.slice();for(;r=n.pop();)h.current&&r.current&&(r.current.timeline.mounted=!0),(null===(e=r.current)||void 0===e?void 0:e.id)&&r.current.timeline.mounted&&r.current.adaptive&&null!==l(k.current,r.current.id)&&(r.current.timeline.transition(void 0,i),n.push(...r.current.children));h.current=!1})),e(u,{ref:g,passthrough:!0,cachable:[],children:p(k.current)})}export{h as default};
|
|
3
3
|
//# sourceMappingURL=layout-group.js.map
|
|
@@ -24,8 +24,23 @@ type SharedProps<T extends string = any> = {
|
|
|
24
24
|
} & PlayOptions)[];
|
|
25
25
|
animate?: ClipProperties | Clip;
|
|
26
26
|
initial?: AnimatableInitials;
|
|
27
|
+
/**
|
|
28
|
+
* How much to stagger child elements' animations by in seconds.
|
|
29
|
+
*
|
|
30
|
+
* @default 0.1
|
|
31
|
+
*/
|
|
27
32
|
stagger?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Integer number, after which child elements no longer stagger their animation, but play all at once.
|
|
35
|
+
*
|
|
36
|
+
* @default 10
|
|
37
|
+
*/
|
|
28
38
|
staggerLimit?: number;
|
|
39
|
+
/**
|
|
40
|
+
* Whether scale animations will cause artifacting to `border-radius` and/or child elements.
|
|
41
|
+
*
|
|
42
|
+
* @default true
|
|
43
|
+
*/
|
|
29
44
|
deform?: boolean;
|
|
30
45
|
disabled?: boolean;
|
|
31
46
|
paused?: boolean;
|
|
@@ -33,12 +48,43 @@ type SharedProps<T extends string = any> = {
|
|
|
33
48
|
export type AnimatableProps<T extends string = any> = {
|
|
34
49
|
ref?: React.Ref<AnimatableType>;
|
|
35
50
|
children: React.ReactNode;
|
|
51
|
+
/**
|
|
52
|
+
* A unique identifier within a [`LayoutGroup`](https://lively.infinityfx.dev/docs/components/layout-group) parent.
|
|
53
|
+
*/
|
|
36
54
|
id?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Where in the order of a cascade animation this component should play it's animations.
|
|
57
|
+
*/
|
|
37
58
|
order?: number;
|
|
59
|
+
/**
|
|
60
|
+
* Whether to participate in cascade animations and inherit animation properties from a parent.
|
|
61
|
+
*
|
|
62
|
+
* @default false
|
|
63
|
+
*/
|
|
38
64
|
inherit?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Whether to **not** participate in cascading animations.
|
|
67
|
+
*
|
|
68
|
+
* @default false
|
|
69
|
+
*/
|
|
39
70
|
passthrough?: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Whether to animate layout changes when this component is a child of a [`LayoutGroup`](https://lively.infinityfx.dev/docs/components/layout-group).
|
|
73
|
+
*
|
|
74
|
+
* @default false
|
|
75
|
+
*/
|
|
40
76
|
adaptive?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Which properties to keep track of for layout change animations.
|
|
79
|
+
*
|
|
80
|
+
* @default ['x', 'y', 'sx', 'sy', 'rotate', 'color', 'backgroundColor', 'borderRadius', 'opacity']
|
|
81
|
+
*/
|
|
41
82
|
cachable?: CachableKey[];
|
|
83
|
+
/**
|
|
84
|
+
* Whether to disable automatic mount/unmount triggering.
|
|
85
|
+
*
|
|
86
|
+
* @default false
|
|
87
|
+
*/
|
|
42
88
|
manual?: boolean;
|
|
43
89
|
onAnimationEnd?: (animation: T | 'animate') => void;
|
|
44
90
|
} & SharedProps<T>;
|
|
@@ -48,6 +94,11 @@ type AnimatableContext = {
|
|
|
48
94
|
remove: (child: React.RefObject<AnimatableType | null>) => void;
|
|
49
95
|
} & SharedProps;
|
|
50
96
|
export declare const AnimatableContext: import("react").Context<AnimatableContext | null>;
|
|
97
|
+
/**
|
|
98
|
+
* Wrap around a react component to animate it.
|
|
99
|
+
*
|
|
100
|
+
* @see {@link https://lively.infinityfx.dev/docs/components/animatable}
|
|
101
|
+
*/
|
|
51
102
|
declare function Animatable<T extends string>(props: AnimatableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
52
103
|
declare namespace Animatable {
|
|
53
104
|
var isLively: boolean;
|
package/dist/types/animate.d.ts
CHANGED
|
@@ -2,8 +2,16 @@ import { AnimatableProps } from "./animatable";
|
|
|
2
2
|
import Clip, { ClipProperties } from "./core/clip";
|
|
3
3
|
type AnimateProps = {
|
|
4
4
|
animations?: (ClipProperties | Clip)[];
|
|
5
|
+
/**
|
|
6
|
+
* The number of levels to cascade down animations.
|
|
7
|
+
*/
|
|
5
8
|
levels?: number;
|
|
6
9
|
} & Omit<AnimatableProps, 'animations' | 'animate' | 'order'>;
|
|
10
|
+
/**
|
|
11
|
+
* Automated cascade animations.
|
|
12
|
+
*
|
|
13
|
+
* @see {@link https://lively.infinityfx.dev/docs/components/animate}
|
|
14
|
+
*/
|
|
7
15
|
declare function Animate({ children, animations, levels, ...props }: AnimateProps): import("react/jsx-runtime").JSX.Element;
|
|
8
16
|
declare namespace Animate {
|
|
9
17
|
var isLively: boolean;
|
|
@@ -15,7 +15,10 @@ export default class Track {
|
|
|
15
15
|
cache: StyleCache;
|
|
16
16
|
paused: boolean;
|
|
17
17
|
scale: [number, number];
|
|
18
|
-
|
|
18
|
+
corrected: {
|
|
19
|
+
borderRadius: string;
|
|
20
|
+
boxShadow: string;
|
|
21
|
+
};
|
|
19
22
|
constructor(element: HTMLElement | SVGElement, deform: boolean, cachable?: CachableKey[]);
|
|
20
23
|
push(action: Action): void;
|
|
21
24
|
next(): void;
|
|
@@ -25,6 +28,5 @@ export default class Track {
|
|
|
25
28
|
transition(previous: Track | undefined, options: TransitionOptions): void;
|
|
26
29
|
apply(prop: string, val: any): void;
|
|
27
30
|
decomposeScale(): [number, number];
|
|
28
|
-
computeBorderRadius(): void;
|
|
29
31
|
correct(): void;
|
|
30
32
|
}
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import type { TransitionOptions } from "../core/track";
|
|
2
|
+
/**
|
|
3
|
+
* Animate layout changes or unmounts.
|
|
4
|
+
*
|
|
5
|
+
* @see {@link https://lively.infinityfx.dev/docs/components/layout-group}
|
|
6
|
+
*/
|
|
2
7
|
export default function LayoutGroup({ children, transition, initialMount }: {
|
|
3
8
|
children: React.ReactNode;
|
|
4
9
|
transition?: Omit<TransitionOptions, 'reverse'>;
|
|
10
|
+
/**
|
|
11
|
+
* Whether to play mount mount animations on first render
|
|
12
|
+
*
|
|
13
|
+
* @default true
|
|
14
|
+
*/
|
|
5
15
|
initialMount?: boolean;
|
|
6
16
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,7 +6,15 @@ export declare const Groups: {
|
|
|
6
6
|
state: 'mounted' | 'unmounted' | 'collected';
|
|
7
7
|
}>;
|
|
8
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* Peform layout morphs between components when one mounts and unmount.
|
|
11
|
+
*
|
|
12
|
+
* @see {@link https://lively.infinityfx.dev/docs/components/morph}
|
|
13
|
+
*/
|
|
9
14
|
declare function Morph({ children, group, transition, ...props }: {
|
|
15
|
+
/**
|
|
16
|
+
* Global identifier, components with the same group will morph between eachother.
|
|
17
|
+
*/
|
|
10
18
|
group: string;
|
|
11
19
|
transition?: Omit<TransitionOptions, 'reverse'>;
|
|
12
20
|
} & AnimatableProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { AnimatableProps } from "../animatable";
|
|
2
|
+
/**
|
|
3
|
+
* Wrap around text to animate it.
|
|
4
|
+
*
|
|
5
|
+
* @see {@link https://lively.infinityfx.dev/docs/components/typable}
|
|
6
|
+
*/
|
|
2
7
|
declare function Typable({ children, stagger, staggerLimit, ...props }: AnimatableProps): import("react/jsx-runtime").JSX.Element;
|
|
3
8
|
declare namespace Typable {
|
|
4
9
|
var isLively: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infinityfx/lively",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.17",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Feature complete, lightweight react animation library.",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -65,8 +65,8 @@
|
|
|
65
65
|
"@rollup/plugin-typescript": "^11.1.6",
|
|
66
66
|
"@types/react": "npm:types-react@^19.0.0-rc.1",
|
|
67
67
|
"@types/react-dom": "npm:types-react-dom@^19.0.0-rc.1",
|
|
68
|
-
"react": "^19.0.0-rc-
|
|
69
|
-
"react-dom": "^19.0.0-rc-
|
|
68
|
+
"react": "^19.0.0-rc-1631855f-20241023",
|
|
69
|
+
"react-dom": "^19.0.0-rc-1631855f-20241023",
|
|
70
70
|
"rollup": "^4.18.0",
|
|
71
71
|
"rollup-plugin-delete": "^2.0.0",
|
|
72
72
|
"rollup-plugin-preserve-directives": "^0.4.0",
|