@infinityfx/lively 5.0.0-alpha.1 → 5.0.0-alpha.2
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/core/animator.js +1 -1
- package/dist/core/animator.js.map +1 -1
- package/dist/core/clip.js +1 -1
- package/dist/core/clip.js.map +1 -1
- package/dist/core/state.js +1 -1
- package/dist/core/state.js.map +1 -1
- package/dist/hooks/use-tap.js +1 -1
- package/dist/types/core/animator.d.ts +8 -4
- package/dist/types/core/clip.d.ts +1 -1
- package/dist/types/core/state.d.ts +2 -3
- 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
|
|
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 l from"./core/animator.js";import f from"./core/clip.js";import{serializeTriggers as u,getLifeCycleAnimations as p,forEachTrigger as g,mergeStyles as y,getInitialStyleFromLinks as h,mergeRefs as k,shouldTrigger as j}from"./core/utils.js";import{LayoutGroupContext as v}from"./layout-group.js";import{registerToLayoutGroup as w,getMorphTarget as L,deleteMorphTarget as E,unregisterFromLayoutGroup as C}from"./core/state.js";const x=n("");function z({ref:n,children:z,inherit:A=!1,initial:I={},animate:S={},triggers:T={animate:["mount"]},stagger:_=.07,staggerLimit:b=10,deformCorrection:D,transition:P,morph:q,clips:B,paused:F=!1,onAnimationEnd:G}){const H=T._livelyId??"_la"+e(),J=r(x),K=r(v),M=i(u(T)),N=i(null);if(!N.current){const t={animate:S instanceof f?S:new f(S,I)};for(const n in B)t[n]=B[n]instanceof f?B[n]:new f(B[n],I);const n=N.current=new l({id:H,clips:t,lifeCycleAnimations:p(T),deformCorrection:D,transition:P,stagger:_,staggerLimit:b});n.register(J,A),n.addLinks(S)}const{current:O}=N,Q=w(K,H);return o(n,(()=>O),[]),s((()=>{if(O.register(J,A,q),O.addLinks(S),q){const t=L(q,H);t&&(O.transition(t),E(q,t.id),O.state="mounted")}w(K,H)&&(O.state="mounted"),document.fonts.ready.finally((()=>O.mount()));const t=()=>O.forEachTrack((t=>t.snapshot()));return window.addEventListener("resize",t),()=>{O.dispose(q),C(K,H),window.removeEventListener("resize",t)}}),[]),a((()=>{const t=u(T);g(T,((n,e,r)=>{j(M.current[n],t[n])})),M.current=t}),[T]),a((()=>{if(!(S instanceof f||"mounted"!==O.state))for(const t in S){const n=S[t];t in O.links&&"object"!=typeof n&&O.links[t].set(n,{duration:S.duration,easing:S.easing})}}),[S]),a((()=>(G&&O.on("animationend",G),()=>{G&&O.off("animationend",G)})),[G]),a((()=>O.setPlayState(F)),[F]),t(x,{value:H,children:c.map(z,((t,n)=>{if(!m(t))return t;let{ref:e,style:r}=t.props;return r=y(r,O.mergeInitialStyles(I,Q),h(O.links,n)),d(t,{ref:k(e||null,(t=>O.addTrack(t,n))),style:r,pathLength:"strokeDasharray"in r?1:void 0,"data-lively":H})}))})}export{x as AnimateContext,z as default};
|
|
3
3
|
//# sourceMappingURL=animate.js.map
|
package/dist/core/animator.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"./clip.js";import{
|
|
1
|
+
import t from"./clip.js";import{registerAnimator as i,registerAsMorph as s,getParentAnimator as e,unregisterAnimator as a,deleteMorphTarget as n}from"./state.js";import r from"./track.js";import{extractAnimationLinks as h}from"./utils.js";class o{constructor({id:t,clips:i,lifeCycleAnimations:s,deformCorrection:e,transition:a,stagger:n,staggerLimit:r}){this.parent=null,this.dependents=new Set,this.inherit=[],this.links={},this.onDisposeLinks=null,this.tracks=new Set,this.trackList=[],this.initialStyles={},this.eventListeners={},this.state="unmounted",this.paused=!1,this.timeout=0,this.frame=0;const{cache:h,...o}=a||{};this.id=t,this.clips=i,this.lifeCycleAnimations=s,this.ignoreScaleDeformation=void 0!==e&&!e,this.defaultTransitionOptions=o,this.cache=h||["x","y","sx","sy","rotate","borderRadius"],this.align="object"==typeof e?e:{x:"left",y:"top"},this.stagger=n,this.staggerLimit=r,void 0===e&&this.inherit.push("ignoreScaleDeformation"),void 0===e&&this.inherit.push("align"),a||this.inherit.push("defaultTransitionOptions"),h||this.inherit.push("cache")}register(t,a,n){if(clearTimeout(this.timeout),i(this.id,this),n&&s(n,this.id),t&&!1!==a&&(this.parent=e(t,"boolean"==typeof a?0:a)),this.parent){this.parent.dependents.add(this);for(const t of this.inherit)this[t]=this.parent[t]}}mount(){"unmounted"===this.state&&this.trigger("mount"),this.state="mounted",cancelAnimationFrame(this.frame),this.tick()}dispose(t){this.stop(),this.onDisposeLinks?.(),cancelAnimationFrame(this.frame),this.trackList.forEach((t=>t.cache=t.snapshot())),this.state="unmounted",this.timeout=setTimeout((()=>{a(this.id),t&&n(t,this.id),this.parent&&this.parent.dependents.delete(this)}),1)}on(t,i){t in this.eventListeners||(this.eventListeners[t]=new Set),this.eventListeners[t].add(i)}off(t,i){this.eventListeners[t]?.delete(i)}dispatch(t,...i){this.eventListeners[t]?.forEach((t=>t(...i)))}tick(){this.paused||this.trackList.forEach((t=>{this.ignoreScaleDeformation||t.correct()})),this.frame=requestAnimationFrame(this.tick.bind(this))}addLinks(i){const[s,e]=h(i,((i,s)=>{this.forEachTrack(((e,a)=>{const n=new t({...s.options,composite:"override",[i]:s.get(a)});e.push(n)}))}));this.links=s,this.onDisposeLinks=e}addTrack(t,i){if(!(t instanceof HTMLElement||t instanceof SVGElement)||this.tracks.has(t))return;const s=new r(t,this.cache,this.align),e=this.lifeCycleAnimations.mount;this.tracks.add(t),this.trackList.splice(i,0,s),"mounted"===this.state&&e&&e.forEach((t=>s.push(this.clips[t])))}mergeInitialStyles(i,s=!1){const e=s?"mounted":"unmounted";if(e in this.initialStyles)return this.initialStyles[e];const a=(this.lifeCycleAnimations.mount||[]).map((t=>this.clips[t])).filter((t=>!t.isEmpty));return a.length?i=t.mergeInitialStyles(a,i,s):this.parent&&(i=this.parent.mergeInitialStyles(i,s)),this.initialStyles[e]=i}pretime(t,i){if(t.isEmpty)return 0;const{duration:s,delay:e,iterations:a}=t.getConfig(i);return(s*a+e)/1e3+Math.max(Math.min(this.tracks.size,this.staggerLimit)-1,0)*this.stagger}trigger(t,i={}){let s=this.lifeCycleAnimations[t],e=0;return s&&s.forEach((t=>e=Math.max(this.play(t,i),e))),e}play(t,{cascade:i="forward",delay:s=0,tag:e,...a}={}){if(this.paused||this.parent&&!e)return 0;let n="string"==typeof t?this.clips[t]:t;e&&e in this.clips&&(n=this.clips[e]),e||"string"!=typeof t||(e=t);const r=this.pretime(n,a),h=this.cascade(n,{...a,delay:"reverse"===i?s:r+s,tag:e});return this.push(n,{...a,delay:"reverse"===i?h+s:s,tag:e})}cascade(t,i){let s=0;return this.dependents.forEach((e=>{s=Math.max(s,e.play(t,i))})),s}forEachTrack(t){let i=0;for(;i<this.tracks.size;){const s=this.trackList[i];s.element.isConnected?t(s,i++):(this.tracks.delete(s.element),this.trackList.splice(i,1))}}push(t,{override:i,delay:s=0,tag:e,...a}){if(t.isEmpty)return 0;let n=0;return this.forEachTrack(((r,h)=>{i&&r.clear();const o=r.push(t,{...a,delay:s+Math.min(h,this.staggerLimit-1)*this.stagger},h===this.tracks.size-1?()=>this.dispatch("animationend",e):void 0);n=Math.max(n,o)})),n}transition(t,i=this.defaultTransitionOptions){this.paused||(this.trackList.forEach(((s,e)=>{const{cache:a}=t&&e<t.tracks.size?t.trackList[e]:{};s.transition(a,i)})),this.dispatch("transitionstart"))}setPlayState(t){this.trackList.forEach((i=>i.toggle(t))),this.paused=t,this.dependents.forEach((i=>i.setPlayState(t)))}stop(t){this.trackList.forEach((i=>i.clear(t)))}}export{o as default};
|
|
2
2
|
//# sourceMappingURL=animator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"animator.js","sources":["../../src/core/animator.ts"],"sourcesContent":[null],"names":["Animator","constructor","id","clips","lifeCycleAnimations","deformCorrection","transition","stagger","staggerLimit","this","parent","dependents","Set","inherit","links","onDisposeLinks","tracks","trackList","initialStyles","eventListeners","state","paused","frame","cache","options","ignoreScaleDeformation","undefined","defaultTransitionOptions","align","x","y","push","register","parentId","
|
|
1
|
+
{"version":3,"file":"animator.js","sources":["../../src/core/animator.ts"],"sourcesContent":[null],"names":["Animator","constructor","id","clips","lifeCycleAnimations","deformCorrection","transition","stagger","staggerLimit","this","parent","dependents","Set","inherit","links","onDisposeLinks","tracks","trackList","initialStyles","eventListeners","state","paused","timeout","frame","cache","options","ignoreScaleDeformation","undefined","defaultTransitionOptions","align","x","y","push","register","parentId","morph","clearTimeout","registerAnimator","registerAsMorph","getParentAnimator","add","key","mount","trigger","cancelAnimationFrame","tick","dispose","stop","forEach","track","snapshot","setTimeout","unregisterAnimator","deleteMorphTarget","delete","on","event","callback","off","dispatch","args","correct","requestAnimationFrame","bind","addLinks","animate","disposeLinks","extractAnimationLinks","link","forEachTrack","i","clip","Clip","composite","get","addTrack","element","index","HTMLElement","SVGElement","has","Track","animations","splice","animation","mergeInitialStyles","styles","mounted","map","filter","isEmpty","length","pretime","duration","delay","iterations","getConfig","Math","max","min","size","elapsed","play","cascade","tag","cascadeDelay","animator","isConnected","override","clear","added","from","setPlayState","toggle"],"mappings":"+OAmBc,MAAOA,EAoCjB,WAAAC,EAAYC,GAAEA,EAAEC,MAAEA,EAAKC,oBAAEA,EAAmBC,iBAAEA,EAAgBC,WAAEA,EAAUC,QAAEA,EAAOC,aAAEA,IAjCrFC,KAAAC,OAA+B,KAC/BD,KAAAE,WAAiC,IAAIC,IACrCH,KAAAI,QAAyF,GAOzFJ,KAAAK,MAEI,CAAA,EACJL,KAAAM,eAAsC,KACtCN,KAAAO,OAAuB,IAAIJ,IAC3BH,KAAAQ,UAAqB,GAOrBR,KAAAS,cAGI,CAAA,EACJT,KAAAU,eAEI,CAAA,EACJV,KAAAW,MAAgD,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kD,SAAS,eAAgB6C,QAAO7E,GAE3E0E,EAAUJ,KAAKC,IAAIG,EAASS,EAAM,IAG/BT,CACX,CAEA,UAAA/F,CAAWyG,EAAsBtF,EAA6BhB,KAAKmB,0BAC3DnB,KAAKY,SAETZ,KAAKQ,UAAU+B,SAAQ,CAACC,EAAOqB,KAC3B,MAAM9C,MAAEA,GAAUuF,GAAQzC,EAAIyC,EAAK/F,OAAOoF,KAAOW,EAAK9F,UAAUqD,GAAK,CAAA,EAErErB,EAAM3C,WAAWkB,EAAOC,EAAQ,IAGpChB,KAAKkD,SAAS,mBAClB,CAEA,YAAAqD,CAAa3F,GACTZ,KAAKQ,UAAU+B,SAAQC,GAASA,EAAMgE,OAAO5F,KAC7CZ,KAAKY,OAASA,EAEdZ,KAAKE,WAAWqC,SAAQ0D,GAAYA,EAASM,aAAa3F,IAC9D,CAEA,IAAA0B,CAAKqC,GACD3E,KAAKQ,UAAU+B,SAAQC,GAASA,EAAM4D,MAAMzB,IAChD"}
|
package/dist/core/clip.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{parseClipKeyframes as e}from"./utils.js";class t{constructor({duration:t=.5,delay:s=0,repeat:i=1,alternate:a=!1,reverse:r=!1,easing:n="ease",composite:o="none",...l},c={}){this.duration=t,this.delay=s,this.repeat=i,this.alternate=a,this.reverse=r,this.easing=n,this.composite=o,this.keyframes=e(l,c),this.isEmpty=!this.keyframes.length}getConfig({delay:e=0,repeat:t=this.repeat,alternate:s=this.alternate,reverse:i=this.reverse,composite:a=this.composite,commit:r=!0}){return{duration:1e3*this.duration,delay:1e3*(this.delay+e),iterations:t,directions:s?i?"alternate-reverse":"alternate":i?"reverse":"normal",easing:this.easing,composite:"combine"===a?"accumulate":"replace",blendmode:a,commit:r}}static mergeInitialStyles(e,t){const
|
|
1
|
+
import{parseClipKeyframes as e}from"./utils.js";class t{constructor({duration:t=.5,delay:s=0,repeat:i=1,alternate:a=!1,reverse:r=!1,easing:n="ease",composite:o="none",...l},c={}){this.duration=t,this.delay=s,this.repeat=i,this.alternate=a,this.reverse=r,this.easing=n,this.composite=o,this.keyframes=e(l,c),this.isEmpty=!this.keyframes.length}getConfig({delay:e=0,repeat:t=this.repeat,alternate:s=this.alternate,reverse:i=this.reverse,composite:a=this.composite,commit:r=!0}){return{duration:1e3*this.duration,delay:1e3*(this.delay+e),iterations:t,directions:s?i?"alternate-reverse":"alternate":i?"reverse":"normal",easing:this.easing,composite:"combine"===a?"accumulate":"replace",blendmode:a,commit:r}}static mergeInitialStyles(e,t,s=!1){const i={backfaceVisibility:"hidden",willChange:"transform"};for(const t of e){const e=s!==t.reverse?t.keyframes.length-1:0,{offset:a,...r}=t.keyframes[e];Object.assign(i,r)}return Object.assign(i,t)}}export{t as default};
|
|
2
2
|
//# sourceMappingURL=clip.js.map
|
package/dist/core/clip.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clip.js","sources":["../../src/core/clip.ts"],"sourcesContent":[null],"names":["Clip","constructor","duration","delay","repeat","alternate","reverse","easing","composite","keyframes","initial","this","parseClipKeyframes","isEmpty","length","getConfig","commit","iterations","directions","blendmode","mergeInitialStyles","clips","styles","merged","backfaceVisibility","willChange","clip","offset","Object","assign"],"mappings":"gDAoCc,MAAOA,EAYjB,WAAAC,EAAYC,SACRA,EAAW,GAAEC,MACbA,EAAQ,EAACC,OACTA,EAAS,EAACC,UACVA,GAAY,EAAKC,QACjBA,GAAU,EAAKC,OACfA,EAAS,OAAMC,UACfA,EAAY,UACTC,GACSC,EAAwB,IACpCC,KAAKT,SAAWA,EAChBS,KAAKR,MAAQA,EACbQ,KAAKP,OAASA,EACdO,KAAKN,UAAYA,EACjBM,KAAKL,QAAUA,EACfK,KAAKJ,OAASA,EACdI,KAAKH,UAAYA,EAEjBG,KAAKF,UAAYG,EAAmBH,EAAWC,GAC/CC,KAAKE,SAAWF,KAAKF,UAAUK,MACnC,CAEA,SAAAC,EAAUZ,MACNA,EAAQ,EAACC,OACTA,EAASO,KAAKP,OAAMC,UACpBA,EAAYM,KAAKN,UAASC,QAC1BA,EAAUK,KAAKL,QAAOE,UACtBA,EAAYG,KAAKH,UAASQ,OAC1BA,GAAS,IAGT,MAAO,CACHd,SAA0B,IAAhBS,KAAKT,SACfC,MAA8B,KAAtBQ,KAAKR,MAAQA,GACrBc,WAAYb,EACZc,WAAYb,EACPC,EAAU,oBAA+B,YACzCA,EAAU,UAAqB,SACpCC,OAAQI,KAAKJ,OACbC,UAAyB,YAAdA,EAA0B,aAAwB,UAC7DW,UAAWX,EACXQ,SAER,CAEA,yBAAOI,CAAmBC,EAAeC,
|
|
1
|
+
{"version":3,"file":"clip.js","sources":["../../src/core/clip.ts"],"sourcesContent":[null],"names":["Clip","constructor","duration","delay","repeat","alternate","reverse","easing","composite","keyframes","initial","this","parseClipKeyframes","isEmpty","length","getConfig","commit","iterations","directions","blendmode","mergeInitialStyles","clips","styles","mounted","merged","backfaceVisibility","willChange","clip","index","offset","Object","assign"],"mappings":"gDAoCc,MAAOA,EAYjB,WAAAC,EAAYC,SACRA,EAAW,GAAEC,MACbA,EAAQ,EAACC,OACTA,EAAS,EAACC,UACVA,GAAY,EAAKC,QACjBA,GAAU,EAAKC,OACfA,EAAS,OAAMC,UACfA,EAAY,UACTC,GACSC,EAAwB,IACpCC,KAAKT,SAAWA,EAChBS,KAAKR,MAAQA,EACbQ,KAAKP,OAASA,EACdO,KAAKN,UAAYA,EACjBM,KAAKL,QAAUA,EACfK,KAAKJ,OAASA,EACdI,KAAKH,UAAYA,EAEjBG,KAAKF,UAAYG,EAAmBH,EAAWC,GAC/CC,KAAKE,SAAWF,KAAKF,UAAUK,MACnC,CAEA,SAAAC,EAAUZ,MACNA,EAAQ,EAACC,OACTA,EAASO,KAAKP,OAAMC,UACpBA,EAAYM,KAAKN,UAASC,QAC1BA,EAAUK,KAAKL,QAAOE,UACtBA,EAAYG,KAAKH,UAASQ,OAC1BA,GAAS,IAGT,MAAO,CACHd,SAA0B,IAAhBS,KAAKT,SACfC,MAA8B,KAAtBQ,KAAKR,MAAQA,GACrBc,WAAYb,EACZc,WAAYb,EACPC,EAAU,oBAA+B,YACzCA,EAAU,UAAqB,SACpCC,OAAQI,KAAKJ,OACbC,UAAyB,YAAdA,EAA0B,aAAwB,UAC7DW,UAAWX,EACXQ,SAER,CAEA,yBAAOI,CAAmBC,EAAeC,EAAsBC,GAAU,GACrE,MAAMC,EAAS,CACXC,mBAAoB,SACpBC,WAAY,aAGhB,IAAK,MAAMC,KAAQN,EAAO,CACtB,MAAMO,EAAQL,IAAYI,EAAKrB,QAAUqB,EAAKlB,UAAUK,OAAS,EAAI,GAC/De,OAAEA,KAAWP,GAAWK,EAAKlB,UAAUmB,GAC7CE,OAAOC,OAAOP,EAAQF,EAC1B,CAEA,OAAOQ,OAAOC,OAAOP,EAAQF,EACjC"}
|
package/dist/core/state.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const t=new Map,n=new Map,e=new Map;function o(n,e){let o=t.get(n)||null;for(let t=0;t<e;t++){if(!o)return null;o=o.parent}return o}function u(n
|
|
1
|
+
const t=new Map,n=new Map,e=new Map;function o(n,e){let o=t.get(n)||null;for(let t=0;t<e;t++){if(!o)return null;o=o.parent}return o}function u(n,e){t.set(n,e)}function i(n){t.delete(n)}function r(t,e){const o=n.get(t)||{animators:new Set,skipInitialMount:e};return n.set(t,o),o}function c(t){n.delete(t)}function s(t,e){const o=n.get(t);return!!o&&(o.animators.add(e),o.skipInitialMount)}function f(t,e){const o=n.get(t);o&&o.animators.delete(e)}function a(n,e){n.forEach((n=>{const o=t.get(n);o&&e(o)}))}function l(t,n){const o=e.get(t)||new Set;o.add(n),e.set(t,o)}function d(n,o){const u=e.get(n);if(!u)return null;for(const n of u){const e=t.get(n);if(e&&e.id!==o&&"unmounted"===e.state)return e}return null}function g(t,n){const o=e.get(t);return o&&o.delete(n),0}export{g as deleteMorphTarget,a as forEachAnimator,d as getMorphTarget,o as getParentAnimator,u as registerAnimator,l as registerAsMorph,r as registerLayoutGroup,s as registerToLayoutGroup,i as unregisterAnimator,f as unregisterFromLayoutGroup,c as unregisterLayoutGroup};
|
|
2
2
|
//# sourceMappingURL=state.js.map
|
package/dist/core/state.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sources":["../../src/core/state.ts"],"sourcesContent":[null],"names":["registeredAnimators","Map","registeredLayoutGroups","morphGroups","getParentAnimator","id","stepsRemoved","parent","get","i","
|
|
1
|
+
{"version":3,"file":"state.js","sources":["../../src/core/state.ts"],"sourcesContent":[null],"names":["registeredAnimators","Map","registeredLayoutGroups","morphGroups","getParentAnimator","id","stepsRemoved","parent","get","i","registerAnimator","animator","set","unregisterAnimator","delete","registerLayoutGroup","skipInitialMount","data","animators","Set","unregisterLayoutGroup","registerToLayoutGroup","layoutId","layoutGroup","add","unregisterFromLayoutGroup","forEachAnimator","ids","callback","forEach","registerAsMorph","morphId","group","getMorphTarget","receiverId","targets","state","deleteMorphTarget"],"mappings":"AAEA,MAAMA,EAAsB,IAAIC,IAE1BC,EAAyB,IAAID,IAK7BE,EAAc,IAAIF,IAElB,SAAUG,EAAkBC,EAAYC,GAC1C,IAAIC,EAASP,EAAoBQ,IAAIH,IAAO,KAE5C,IAAK,IAAII,EAAI,EAAGA,EAAIH,EAAcG,IAAK,CACnC,IAAKF,EAAQ,OAAO,KAEpBA,EAASA,EAAOA,MACpB,CAEA,OAAOA,CACX,CAEM,SAAUG,EAAiBL,EAAYM,GACzCX,EAAoBY,IAAIP,EAAIM,EAChC,CAEM,SAAUE,EAAmBR,GAC/BL,EAAoBc,OAAOT,EAC/B,CAEM,SAAUU,EAAoBV,EAAYW,GAC5C,MAAMC,EAAOf,EAAuBM,IAAIH,IAAO,CAC3Ca,UAAW,IAAIC,IACfH,oBAKJ,OAFAd,EAAuBU,IAAIP,EAAIY,GAExBA,CACX,CAGM,SAAUG,EAAsBf,GAClCH,EAAuBY,OAAOT,EAClC,CAEM,SAAUgB,EAAsBC,EAAkBjB,GACpD,MAAMkB,EAAcrB,EAAuBM,IAAIc,GAE/C,QAAIC,IACAA,EAAYL,UAAUM,IAAInB,GACnBkB,EAAYP,iBAI3B,CAEM,SAAUS,EAA0BH,EAAkBjB,GACxD,MAAMkB,EAAcrB,EAAuBM,IAAIc,GAE3CC,GAAaA,EAAYL,UAAUJ,OAAOT,EAClD,CAEM,SAAUqB,EAAgBC,EAAkBC,GAC9CD,EAAIE,SAAQxB,IACR,MAAMM,EAAWX,EAAoBQ,IAAIH,GACrCM,GAAUiB,EAASjB,EAAS,GAExC,CAEM,SAAUmB,EAAgBC,EAAiB1B,GAC7C,MAAM2B,EAAQ7B,EAAYK,IAAIuB,IAAY,IAAIZ,IAC9Ca,EAAMR,IAAInB,GAEVF,EAAYS,IAAImB,EAASC,EAC7B,CAEM,SAAUC,EAAeF,EAAiBG,GAC5C,MAAMC,EAAUhC,EAAYK,IAAIuB,GAChC,IAAKI,EAAS,OAAO,KAErB,IAAK,MAAM9B,KAAM8B,EAAS,CACtB,MAAMxB,EAAWX,EAAoBQ,IAAIH,GACzC,GAAIM,GAAYA,EAASN,KAAO6B,GAAiC,cAAnBvB,EAASyB,MAAuB,OAAOzB,CACzF,CAEA,OAAO,IACX,CAEM,SAAU0B,EAAkBN,EAAiB1B,GAC/C,MAAM2B,EAAQ7B,EAAYK,IAAIuB,GAG9B,OAFIC,GAAOA,EAAMlB,OAAOT,GAEjB,CACX"}
|
package/dist/hooks/use-tap.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{useRef as n,useState as r,useEffect as t}from"react";function e(){const e=n(null),[o,i]=r(!1);return t((()=>{if(!e.current)return;const n=new AbortController;return e.current.addEventListener("pointerdown",(()=>i(!0)),{signal:n.signal}),
|
|
2
|
+
import{useRef as n,useState as r,useEffect as t}from"react";function e(){const e=n(null),[o,i]=r(!1);return t((()=>{if(!e.current)return;const n=new AbortController;return e.current.addEventListener("pointerdown",(()=>i(!0)),{signal:n.signal}),window.addEventListener("pointerup",(()=>i(!1)),{signal:n.signal}),()=>n.abort()}),[]),[e,o]}export{e as default};
|
|
3
3
|
//# sourceMappingURL=use-tap.js.map
|
|
@@ -33,12 +33,16 @@ export default class Animator<T extends string> {
|
|
|
33
33
|
align: CorrectionAlignment;
|
|
34
34
|
stagger: number;
|
|
35
35
|
staggerLimit: number;
|
|
36
|
-
initialStyles:
|
|
36
|
+
initialStyles: {
|
|
37
|
+
mounted?: ClipInitials;
|
|
38
|
+
unmounted?: ClipInitials;
|
|
39
|
+
};
|
|
37
40
|
eventListeners: {
|
|
38
41
|
[key in AnimatorEvent]?: Set<(...args: any) => void>;
|
|
39
42
|
};
|
|
40
43
|
state: 'unmounted' | 'unmounting' | 'mounted';
|
|
41
44
|
paused: boolean;
|
|
45
|
+
timeout: number;
|
|
42
46
|
frame: number;
|
|
43
47
|
constructor({ id, clips, lifeCycleAnimations, deformCorrection, transition, stagger, staggerLimit }: {
|
|
44
48
|
id: string;
|
|
@@ -55,16 +59,16 @@ export default class Animator<T extends string> {
|
|
|
55
59
|
stagger: number;
|
|
56
60
|
staggerLimit: number;
|
|
57
61
|
});
|
|
58
|
-
register(parentId: string, inherit: boolean | number): void;
|
|
62
|
+
register(parentId: string, inherit: boolean | number, morph?: string): void;
|
|
59
63
|
mount(): void;
|
|
60
|
-
dispose(): void;
|
|
64
|
+
dispose(morph?: string): void;
|
|
61
65
|
on<K extends (...args: any) => void>(event: AnimatorEvent, callback: K): void;
|
|
62
66
|
off<K extends (...args: any) => void>(event: AnimatorEvent, callback: K): void;
|
|
63
67
|
dispatch(event: AnimatorEvent, ...args: any): void;
|
|
64
68
|
tick(): void;
|
|
65
69
|
addLinks(animate: Clip | ClipOptions): void;
|
|
66
70
|
addTrack(element: any, index: number): void;
|
|
67
|
-
mergeInitialStyles(styles: ClipInitials): ClipInitials;
|
|
71
|
+
mergeInitialStyles(styles: ClipInitials, mounted?: boolean): ClipInitials;
|
|
68
72
|
pretime(clip: Clip, options: AnimationOptions): number;
|
|
69
73
|
trigger(on: LifeCycleTrigger, options?: AnimationOptions): number;
|
|
70
74
|
play(animation: T | Clip, { cascade, delay, tag, ...options }?: AnimationOptions): number;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import Animator from "./animator";
|
|
2
2
|
export declare function getParentAnimator(id: string, stepsRemoved: number): Animator<any> | null;
|
|
3
|
-
export declare function isRegistered(id: string): boolean;
|
|
4
3
|
export declare function registerAnimator(id: string, animator: Animator<any>): void;
|
|
5
4
|
export declare function unregisterAnimator(id: string): void;
|
|
6
5
|
export declare function registerLayoutGroup(id: string, skipInitialMount: boolean): {
|
|
@@ -11,6 +10,6 @@ export declare function unregisterLayoutGroup(id: string): void;
|
|
|
11
10
|
export declare function registerToLayoutGroup(layoutId: string, id: string): boolean;
|
|
12
11
|
export declare function unregisterFromLayoutGroup(layoutId: string, id: string): void;
|
|
13
12
|
export declare function forEachAnimator(ids: Set<string>, callback: (animator: Animator<any>) => void): void;
|
|
14
|
-
export declare function registerAsMorph(morphId: string,
|
|
13
|
+
export declare function registerAsMorph(morphId: string, id: string): void;
|
|
15
14
|
export declare function getMorphTarget(morphId: string, receiverId: string): Animator<any> | null;
|
|
16
|
-
export declare function deleteMorphTarget(morphId: string,
|
|
15
|
+
export declare function deleteMorphTarget(morphId: string, id: string): number;
|