@infinityfx/lively 3.5.1 → 3.5.3

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{__assign as n,__rest as r}from"tslib";import{jsx as e}from"react/jsx-runtime";import{createContext as t,forwardRef as i,useRef as a,useContext as o,useState as u,useCallback as d,useImperativeHandle as l,useEffect as c,Children as m,isValidElement as s,cloneElement as v}from"react";import f from"./core/clip.js";import p from"./core/timeline.js";import{merge as h,pick as g,combineRefs as y}from"./core/utils.js";var b=t(null);var x=i((function(t,i){var x=a(null),w=a([]),j=o(b),E=t.inherit&&j?h({},t,g(j,["group","animations","triggers","animate","initial","stagger","staggerLimit","deform","disabled","paused"])):t,L=E.id,A=void 0===L?"":L,k=E.inherit,z=E.triggers,C=void 0===z?[]:z,M=E.disabled,D=E.adaptive,F=void 0!==D&&D,N=E.manual,O=void 0!==N&&N,P=E.paused,T=void 0!==t.order?t.order:(k&&(null==j?void 0:j.index)||0)+1,V=a([]),q=u((function(){var n={animate:f.from(E.animate,E.initial)};for(var r in E.animations)n[r]=f.from(E.animations[r],E.initial);return n}))[0],B=a(new p(n(n({},E),{mountClips:C.reduce((function(n,r){var e=r.name;return"mount"===r.on&&n.push(q[e||"animate"]),n}),[])}))),G=d((function(n,r,e){var i;void 0===r&&(r={}),void 0===e&&(e=1);var a=q[n];if(M||T>1&&e<2)return 0;h(r,{reverse:null==a?void 0:a.reverse});for(var o=0,u=r.delay||0,d=a?B.current.time(a):0,l=0,c=w.current;l<c.length;l++){var m=c[l];(null===(i=m.current)||void 0===i?void 0:i.inherit)&&(o=Math.max(m.current.play(n,h({delay:u+d},r),e+1),o))}var s=(r.reverse?o:u)*(T/e);return a&&B.current.add(a,h({delay:s},r)),t.onAnimationEnd&&setTimeout(t.onAnimationEnd.bind({},n),1e3*(d+s)),d+s}),[M,T]);function H(n,e){void 0===e&&(e={});for(var t=0,i=0,a=C;i<a.length;i++){var o=a[i],u=o.name,d=o.on,l=r(o,["name","on"]);d===n&&(t=Math.max(G(u||"animate",h(l,e)),t))}return t}return l(y(x,i),(function(){return{play:G,trigger:H,timeline:B.current,children:w.current,inherit:k,adaptive:F,manual:O,id:A}})),c((function(){return B.current[P||M?"pause":"play"]()}),[P,M]),c((function(){for(var n=0;n<C.length;n++){var e=C[n],t=e.name,i=e.on,a=r(e,["name","on"]);if("string"!=typeof i){var o="boolean"==typeof i?i:i.called,u=V.current[n];void 0!==u&&o&&o!==u&&G(t||"animate",a),V.current[n]=o}}}),[C]),c((function(){B.current.connect(E.animate);var n=function(){return B.current.cache()};return window.addEventListener("resize",n),null==j||j.add(x),document.fonts.ready.then((function(){O||B.current.mounted||H("mount"),B.current.mounted=!0})),function(){window.removeEventListener("resize",n),null==j||j.remove(x)}}),[]),e(b.Provider,{value:n(n({},t.passthrough?j:n({index:T},E)),{add:function(n){t.passthrough&&(null==j||j.add(n)),w.current.includes(n)||w.current.push(n)},remove:function(n){t.passthrough&&(null==j||j.remove(n));var r=w.current.indexOf(n)||-1;r>=0&&w.current.splice(r,1)}}),children:m.map(t.children,(function(n){return!s(n)||n.type instanceof Function?n:v(n,{ref:y((function(n){return B.current.insert(n)}),n.ref),pathLength:1,style:h({backfaceVisibility:"hidden",willChange:"transform"},n.props.style,q.animate.initial,{strokeDasharray:1}),"data-lively-offset-boundary":!(!["x","y"].some((function(n){var r;return null===(r=t.cachable)||void 0===r?void 0:r.includes(n)}))&&void 0!==t.cachable)||void 0})}))})}));x.displayName="Animatable";export{b as AnimatableContext,x as default};
2
+ import{__assign as n,__rest as r}from"tslib";import{jsx as e}from"react/jsx-runtime";import{createContext as t,forwardRef as i,useRef as a,useContext as o,useState as u,useCallback as d,useImperativeHandle as l,useEffect as c,Children as m,isValidElement as s,cloneElement as v}from"react";import f from"./core/clip.js";import p from"./core/timeline.js";import{merge as h,pick as g,combineRefs as y}from"./core/utils.js";var b=t(null);var x=i((function(t,i){var x=a(null),w=a([]),j=o(b),E=t.inherit&&j?h({},t,g(j,["group","animations","triggers","animate","initial","stagger","staggerLimit","deform","disabled","paused"])):t,L=E.id,A=void 0===L?"":L,k=E.inherit,z=E.triggers,C=void 0===z?[]:z,M=E.disabled,D=E.adaptive,F=void 0!==D&&D,N=E.manual,O=void 0!==N&&N,P=E.paused,T=void 0!==t.order?t.order:(k&&(null==j?void 0:j.index)||0)+1,V=a([]),q=u((function(){var n={animate:f.from(E.animate,E.initial)};for(var r in E.animations)n[r]=f.from(E.animations[r],E.initial);return n}))[0],B=a(new p(n(n({},E),{mountClips:C.reduce((function(n,r){var e=r.name;return"mount"===r.on&&n.push(q[e||"animate"]),n}),[])}))),G=d((function(n,r,e){var i;void 0===r&&(r={}),void 0===e&&(e=1);var a=q[n];if(M||T>1&&e<2)return 0;h(r,{reverse:null==a?void 0:a.reverse});for(var o=0,u=r.delay||0,d=a?B.current.time(a):0,l=0,c=w.current;l<c.length;l++){var m=c[l];(null===(i=m.current)||void 0===i?void 0:i.inherit)&&(o=Math.max(m.current.play(n,h({delay:u+d},r),e+1),o))}var s=(r.reverse?o:u)*(T/e);return a&&B.current.add(a,h({delay:s},r)),t.onAnimationEnd&&setTimeout(t.onAnimationEnd.bind({},n),1e3*(d+s)),d+s}),[M,T]);function H(n,e){void 0===e&&(e={});for(var t=0,i=0,a=C;i<a.length;i++){var o=a[i],u=o.name,d=o.on,l=r(o,["name","on"]);d===n&&(t=Math.max(G(u||"animate",h(l,e)),t))}return t}return l(y(x,i),(function(){return{play:G,trigger:H,timeline:B.current,children:w.current,inherit:k,adaptive:F,manual:O,id:A}}),[C]),c((function(){return B.current[P||M?"pause":"play"]()}),[P,M]),c((function(){for(var n=0;n<C.length;n++){var e=C[n],t=e.name,i=e.on,a=r(e,["name","on"]);if("string"!=typeof i){var o="boolean"==typeof i?i:i.called,u=V.current[n];void 0!==u&&o&&o!==u&&G(t||"animate",a),V.current[n]=o}}}),[C]),c((function(){B.current.connect(E.animate);var n=function(){return B.current.cache()};return window.addEventListener("resize",n),null==j||j.add(x),document.fonts.ready.then((function(){O||B.current.mounted||H("mount"),B.current.mounted=!0})),function(){window.removeEventListener("resize",n),null==j||j.remove(x)}}),[]),e(b.Provider,{value:n(n({},t.passthrough?j:n({index:T},E)),{add:function(n){t.passthrough&&(null==j||j.add(n)),w.current.includes(n)||w.current.push(n)},remove:function(n){t.passthrough&&(null==j||j.remove(n));var r=w.current.indexOf(n)||-1;r>=0&&w.current.splice(r,1)}}),children:m.map(t.children,(function(n){return!s(n)||n.type instanceof Function?n:v(n,{ref:y((function(n){return B.current.insert(n)}),n.ref),pathLength:1,style:h({backfaceVisibility:"hidden",willChange:"transform"},n.props.style,q.animate.initial,{strokeDasharray:1}),"data-lively-offset-boundary":!(!["x","y"].some((function(n){var r;return null===(r=t.cachable)||void 0===r?void 0:r.includes(n)}))&&void 0!==t.cachable)||void 0})}))})}));x.displayName="Animatable";export{b as AnimatableContext,x as default};
3
3
  //# sourceMappingURL=animatable.js.map
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import{jsx as r}from"react/jsx-runtime";import{useRef as n,useState as t,useEffect as e,Children as i,isValidElement as u}from"react";import o from"../animatable.js";function a(r,n){return void 0===n&&(n={}),i.forEach(r,(function(r){var t;if(u(r)){var e=null===(t=r.type)||void 0===t?void 0:t.displayName;"Animatable"!==e&&"Animate"!==e||!("id"in r.props)||(n[r.props.id]=!0),a(r.props.children,n)}})),n}function c(r,n){var t=typeof r,e=typeof n;if(t!==e)return!1;if(u(r))return!(!u(n)||r.key!==n.key)&&c(r.props,n.props);if(Array.isArray(r)){if(!Array.isArray(n)||r.length!==n.length)return!1;for(var i=0;i<r.length;i++)if(!c(r[i],n[i]))return!1;return!0}if("object"===t&&null!==r&&null!==n){var o=Object.keys(r),a=Object.keys(n);if(o.length!==a.length)return!1;if(!o.length)return r.toString()===n.toString();for(i=0;i<o.length;i++)if(!(o[i]in n)||!c(r[o[i]],n[a[i]]))return!1;return!0}return"function"===t&&t===e||r===n}function f(r,n){try{return c(r,n)}catch(r){return!1}}function l(i){var u=i.children,c=i.transition,l=n(null),h=n(a(u)),p=t(u),d=p[0],m=p[1];return e((function(){if(l.current&&!f(d,u)){for(var r=0,n=a(u),t=0,e=l.current.children;t<e.length;t++){var i=e[t];i.current&&!i.current.manual&&i.current.id in h.current&&!(i.current.id in n)&&(r=Math.max(i.current.trigger("unmount"),r))}h.current=n,setTimeout((function(){return m(u)}),1e3*r)}}),[u]),e((function(){var r;if(l.current)for(var n=0,t=l.current.children;n<t.length;n++){var e=t[n];(null===(r=e.current)||void 0===r?void 0:r.timeline.mounted)&&e.current.adaptive&&e.current.timeline.transition(void 0,c)}}),[d]),r(o,{ref:l,cachable:[],passthrough:!0,children:d})}export{l as default};
2
+ import{jsx as r}from"react/jsx-runtime";import{useRef as n,useState as t,useEffect as e,Children as i,isValidElement as u}from"react";import o from"../animatable.js";import a from"../hooks/use-mount-effect.js";function c(r,n){return void 0===n&&(n={}),i.forEach(r,(function(r){var t;if(u(r)){var e=null===(t=r.type)||void 0===t?void 0:t.displayName;"Animatable"!==e&&"Animate"!==e||!("id"in r.props)||(n[r.props.id]=!0),c(r.props.children,n)}})),n}function f(r,n){var t=typeof r,e=typeof n;if(t!==e)return!1;if(u(r))return!(!u(n)||r.key!==n.key)&&f(r.props,n.props);if(Array.isArray(r)){if(!Array.isArray(n)||r.length!==n.length)return!1;for(var i=0;i<r.length;i++)if(!f(r[i],n[i]))return!1;return!0}if("object"===t&&null!==r&&null!==n){var o=Object.keys(r),a=Object.keys(n);if(o.length!==a.length)return!1;if(!o.length)return r.toString()===n.toString();for(i=0;i<o.length;i++)if(!(o[i]in n)||!f(r[o[i]],n[a[i]]))return!1;return!0}return"function"===t&&t===e||r===n}function l(r,n){try{return f(r,n)}catch(r){return!1}}function h(i){var u=i.children,f=i.transition,h=n(null),m=n(c(u)),p=t(u),s=p[0],d=p[1];return e((function(){if(h.current&&!l(s,u)){for(var r=0,n=c(u),t=0,e=h.current.children;t<e.length;t++){var i=e[t];i.current&&!i.current.manual&&i.current.id in m.current&&!(i.current.id in n)&&(r=Math.max(i.current.trigger("unmount"),r))}m.current=n,setTimeout((function(){return d(u)}),1e3*r)}}),[u]),a((function(){var r;if(h.current)for(var n=0,t=h.current.children;n<t.length;n++){var e=t[n];(null===(r=e.current)||void 0===r?void 0:r.timeline.mounted)&&e.current.adaptive&&e.current.timeline.transition(void 0,f)}}),[s]),r(o,{ref:h,cachable:[],passthrough:!0,children:s})}export{h as default};
3
3
  //# sourceMappingURL=layout-group.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infinityfx/lively",
3
- "version": "3.5.1",
3
+ "version": "3.5.3",
4
4
  "type": "module",
5
5
  "description": "Feature complete, lightweight react animation library.",
6
6
  "main": "dist/index.js",