@infinityfx/lively 5.0.0-alpha.8 → 5.0.0-alpha.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/animate.js +1 -1
- package/dist/layout-group.js +1 -1
- package/package.json +1 -1
package/dist/animate.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as t}from"react/jsx-runtime";import{createContext as n,useId as e,use as r,useRef as i,useImperativeHandle as o,useLayoutEffect as
|
|
2
|
+
import{jsx as t}from"react/jsx-runtime";import{createContext as n,useId as e,use as r,useRef as i,useImperativeHandle as o,useLayoutEffect as s,useEffect as a,Children as c,isValidElement as m,cloneElement as d}from"react";import u from"./core/animator.js";import l from"./core/clip.js";import{serializeTriggers as f,getLifeCycleAnimations as p,forEachTrigger as g,mergeStyles as y,getInitialStyleFromLinks as h,mergeRefs as j}from"./core/utils.js";import{LayoutGroupContext as k}from"./layout-group.js";import{registerToLayoutGroup as w,getMorphTarget as v,deleteMorphTarget as L,unregisterFromLayoutGroup as E}from"./core/state.js";const C=n("");function b({ref:n,children:b,inherit:x=!1,initial:z={},animate:A={},triggers:D={animate:["mount"]},stagger:I=.07,staggerLimit:S=10,deformCorrection:T,transition:U,morph:_,clips:M,paused:O=!1,onAnimationEnd:P}){const q=D._livelyId??"_la"+e(),B=r(C),F=r(k),G=i(0),H=i(null),J=i(f(D)),K=i(null);if(!K.current){const t={animate:A instanceof l?A:new l(A,z)};for(const n in M)t[n]=M[n]instanceof l?M[n]:new l(M[n],z);const n=K.current=new u({id:q,clips:t,lifeCycleAnimations:p(D),deformCorrection:T,transition:U,stagger:I,staggerLimit:S});n.register(B,x,_),n.addLinks(A)}const{current:N}=K,Q=i(w(F,N.id));return o(n,(()=>N),[]),s((()=>{if(G.current=Date.now(),N.register(B,x,_),N.addLinks(A),_){const t=H.current||v(_,N.id);H.current=t,t&&(N.isMounting=!0,N.transition(t),L(_,t.id),N.state="mounted",Q.current=!0,t.delayUnmountUntil=0)}w(F,N.id),Q.current&&(N.state="mounted"),document.fonts.ready.finally((()=>N.mount()));const t=()=>N.forEachTrack((t=>t.snapshot()));return window.addEventListener("resize",t),()=>{window.removeEventListener("resize",t),N.dispose(_),E(F,N.id)}}),[]),a((()=>{g(D,((t,n,e)=>{const r=J.current[t];n.forEach(((n,i)=>{r[i]!==n&&!1!==n&&N.play(t,Object.assign({tag:t},e[i])),r[i]=n}))}))}),[D]),a((()=>{if(!(A instanceof l||"mounted"!==N.state))for(const t in A){const n=A[t];t in N.links&&"object"!=typeof n&&N.links[t].set(n,{duration:A.duration,easing:A.easing,composite:A.composite})}}),[A]),a((()=>(P&&N.on("animationend",P),()=>{P&&N.off("animationend",P)})),[P]),a((()=>N.setPlayState(O)),[O]),t(C,{value:N.id,children:c.map(b,((t,n)=>{if(!m(t))return t;let{ref:e,style:r}=t.props;return r=y(r,N.mergeInitialStyles(z,Q.current?"mounted":"unmounted"),h(N.links,n)),d(t,{ref:j(e||null,(t=>N.addTrack(t,n))),style:r,pathLength:"strokeDasharray"in r?1:void 0,"data-lively":N.id})}))})}export{C as AnimateContext,b as default};
|
|
3
3
|
//# sourceMappingURL=animate.js.map
|
package/dist/layout-group.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{jsx as t}from"react/jsx-runtime";import{createContext as n,useId as e,useRef as r,useState as o,useLayoutEffect as i,useEffect as a}from"react";import{filterRemovedAnimators as s,getRemovedAnimators as u}from"./core/utils.js";import{registerLayoutGroup as
|
|
2
|
+
import{jsx as t}from"react/jsx-runtime";import{createContext as n,useId as e,useRef as r,useState as o,useLayoutEffect as i,useEffect as a}from"react";import{filterRemovedAnimators as s,getRemovedAnimators as u}from"./core/utils.js";import{registerLayoutGroup as c,forEachAnimator as m,unregisterLayoutGroup as l}from"./core/state.js";const d=n("");function f({children:n,skipInitialMount:f=!1,mode:p="wait"}){const g="_lg"+e(),h=r(0),w=r(n),y=c(g,f),[M,v]=o(0),U=s(n,new Set(y.animators),`${g}_la_`);if(U.size){if("sync"===p){const t=Array.isArray(n)?n.slice():[n];for(const[n,e]of u(w.current,U))t.splice(n,0,e);w.current=t}m(U,(t=>{if("mounted"===t.state){const n=t.trigger("unmount",{cascade:"reverse",composite:"override"});t.delayUnmountUntil=Date.now()+1e3*n,n&&(t.state="unmounting",t.dispatch("unmount"))}}))}let j=0;m(y.animators,(t=>j=Math.max(j,t.delayUnmountUntil)));const x=j-Date.now();return clearTimeout(h.current),x>0?(m(y.animators,(t=>{"unmounting"!==t.state||U.has(t.id)||(t.trigger("mount",{override:!0}),t.state="mounted")})),h.current=setTimeout((()=>{w.current=n,v((t=>t+1))}),x)):"wait"===p&&(w.current=n),i((()=>{m(y.animators,(t=>{"mounted"!==t.state||t.isMounting||t.transition(),t.isMounting=!1}))}),[n]),a((()=>(y.skipInitialMount=!1,()=>{l(g),clearTimeout(h.current)})),[]),t(d,{value:g,children:w.current})}export{d as LayoutGroupContext,f as default};
|
|
3
3
|
//# sourceMappingURL=layout-group.js.map
|