@infinityfx/lively 2.1.2 → 2.1.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.
package/dist/cjs/auto.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/classCallCheck"),t=require("@babel/runtime/helpers/createClass"),r=require("@babel/runtime/helpers/get"),n=require("@babel/runtime/helpers/inherits"),i=require("@babel/runtime/helpers/possibleConstructorReturn"),a=require("@babel/runtime/helpers/getPrototypeOf"),o=require("@babel/runtime/helpers/defineProperty"),u=require("./animatable-68f722e8.js"),l=require("react"),s=require("./link-8b6abc45.js"),c=require("./animation-6471b73e.js"),p=require("@babel/runtime/helpers/toConsumableArray"),f=require("./scroll-07f63b1d.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("./events-5eb50ffa.js"),require("@babel/runtime/helpers/typeof"),require("@babel/runtime/helpers/slicedToArray"),require("@babel/runtime/helpers/objectWithoutProperties");var h=d(e),y=d(t),m=d(r),v=d(n),b=d(i),g=d(a),O=d(o),P=d(l),j=d(p);function w(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function E(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?w(Object(r),!0).forEach((function(t){O.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function A(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return x(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return x(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function R(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=g.default(e);if(t){var i=g.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return b.default(this,r)}}var S={},k=function(e){v.default(r,e);var t=R(r);function r(e){var n;return h.default(this,r),(n=t.call(this,e)).animations={default:new c.Clip({},{opacity:+e.active,pointerEvents:e.active?"":"none"}),unmorph:new c.Clip({},{opacity:0,pointerEvents:"none"})},n.properties=s.subArray(n.props.include,n.props.exclude),n.uuid=(e.id||0).toString()+(e.index||0)+e.group,n}return y.default(r,[{key:"shouldComponentUpdate",value:function(e){return this.props.active!==e.active&&(this.uuid in S?S[this.uuid].push(this):S[this.uuid]=[this]),this.props.active!==e.active}},{key:"getSnapshotBeforeUpdate",value:function(e){if(this.props.active!==e.active&&this.props.active){var t,r=A(S[this.uuid]);try{for(r.s();!(t=r.n()).done;){var n=t.value;if(n!==this)return s.getSnapshot(n.elements[0],this.props.group)}}catch(e){r.e(e)}finally{r.f()}}return null}},{key:"componentDidUpdate",value:function(e,t,n){if(m.default(g.default(r.prototype),"componentDidUpdate",this).call(this),S[this.uuid]=[],n){var i=s.getSnapshot(this.elements[0],this.props.group);i.opacity=1,i.pointerEvents="",this.manager.play(c.computeMorph(i,n,this.properties,this.props.duration),{composite:!0})}else this.manager.initialize(this.animations.unmorph)}},{key:"render",value:function(){var e=this.props.children;if(s.isArr(e)){if(e.length>1)return e;e=e[0]}return l.isValidElement(e)?m.default(g.default(r.prototype),"render",this).call(this):e}}]),r}(u.Animatable);function q(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=g.default(e);if(t){var i=g.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return b.default(this,r)}}O.default(k,"cascadingProps",["id","duration"]),O.default(k,"defaultProps",E(E({},u.Animatable.defaultProps),{},{cascade:0,active:!1,include:s.MORPH_PROPERTIES,exclude:[]}));var C=function(e){v.default(r,e);var t=q(r);function r(e){var n;return h.default(this,r),(n=t.call(this,e)).children=[],n.properties=s.subArray(n.props.include,n.props.exclude),n}return y.default(r,[{key:"getSnapshotBeforeUpdate",value:function(){return this.children.map((function(e){var t=null==e?void 0:e.elements[0];return t?{data:s.getSnapshot(t),key:e.props.layoutKey}:null}))}},{key:"componentDidUpdate",value:function(e,t,r){for(var n=0,i=0;n<r.length;n++,i++){var a=this.children[i];if(a&&a.elements[0]){var o=r[n];if(o&&a.props.layoutKey===o.key){var u=s.getSnapshot(a.elements[0]);a.manager.play(c.computeMorph(u,o.data,this.properties,this.props.duration),{composite:!0})}else i--}}}},{key:"render",value:function(){var e=this;return this.childIndex=0,l.Children.map(this.props.children,(function(t){if(!l.isValidElement(t)||!u.Animatable.isInstance(t))return t;var r=e.childIndex++;return l.cloneElement(t,{ref:function(t){return e.children[r]=t},layoutKey:t.key})}))}}]),r}(l.Component);function I(e){var t=e.children,r=e.className,n=e.style,i=e.duration;if(!s.isStr(t))return t;var a=t.split("");return P.default.createElement("div",{className:r,style:n},P.default.createElement(u.Animatable,{whileViewport:!0,animate:{opacity:1,translate:{y:0},rotate:0,duration:.8},initial:{opacity:0,translate:{y:"100%"},rotate:10},stagger:(i-.8)/(a.length-1)},a.map((function(e,t){return P.default.createElement("span",{style:{display:"inline-block"},key:t},/\s/.test(e)?" ":e)}))))}function M(e){var t,r=e.children,n=e.color,i=e.duration,a=(null===(t=r.props)||void 0===t?void 0:t.children)||[];Array.isArray(a)||(a=[a]);var o=[P.default.createElement(u.Animatable,{key:0,initial:{clip:{right:0}},animate:{clip:{left:1},duration:i/2}},P.default.createElement("div",{style:{position:"absolute",inset:0,backgroundColor:n}}))].concat(j.default(a));return P.default.createElement(u.Animatable,{whileViewport:!0,animate:{clip:{right:0},duration:i/2},initial:{clip:{right:1}}},l.cloneElement(r,{},o))}function B(e){var t,r=e.children,n=e.amount,i=f.useScroll(),a=l.useRef();return P.default.createElement(u.Animatable,{ref:a,animate:{translate:i((function(e){if(void 0===t){var r,i=null===(r=a.current)||void 0===r?void 0:r.elements[0];i&&(t=Math.max(i.getBoundingClientRect().y+window.scrollY-window.innerHeight/2,0))}return{x:0,y:(e-(t||0))*n}}))}},r)}O.default(C,"defaultProps",{include:s.MORPH_PROPERTIES,exclude:[]}),I.defaultProps={style:{},className:"",duration:1.6},M.defaultProps={color:"grey",duration:1.6},B.defaultProps={amount:.5},exports.ColorWipe=M,exports.LayoutGroup=C,exports.Morph=k,exports.Parallax=B,exports.WriteOn=I;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/classCallCheck"),t=require("@babel/runtime/helpers/createClass"),r=require("@babel/runtime/helpers/get"),n=require("@babel/runtime/helpers/inherits"),i=require("@babel/runtime/helpers/possibleConstructorReturn"),a=require("@babel/runtime/helpers/getPrototypeOf"),o=require("@babel/runtime/helpers/defineProperty"),u=require("./animatable-68f722e8.js"),l=require("react"),s=require("./link-8b6abc45.js"),c=require("./animation-6471b73e.js"),p=require("@babel/runtime/helpers/toConsumableArray"),f=require("./scroll-7da583bf.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("./events-5eb50ffa.js"),require("@babel/runtime/helpers/typeof"),require("@babel/runtime/helpers/slicedToArray"),require("@babel/runtime/helpers/objectWithoutProperties");var h=d(e),y=d(t),m=d(r),v=d(n),b=d(i),g=d(a),O=d(o),P=d(l),j=d(p);function w(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function E(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?w(Object(r),!0).forEach((function(t){O.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function A(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return x(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return x(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function R(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=g.default(e);if(t){var i=g.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return b.default(this,r)}}var S={},k=function(e){v.default(r,e);var t=R(r);function r(e){var n;return h.default(this,r),(n=t.call(this,e)).animations={default:new c.Clip({},{opacity:+e.active,pointerEvents:e.active?"":"none"}),unmorph:new c.Clip({},{opacity:0,pointerEvents:"none"})},n.properties=s.subArray(n.props.include,n.props.exclude),n.uuid=(e.id||0).toString()+(e.index||0)+e.group,n}return y.default(r,[{key:"shouldComponentUpdate",value:function(e){return this.props.active!==e.active&&(this.uuid in S?S[this.uuid].push(this):S[this.uuid]=[this]),this.props.active!==e.active}},{key:"getSnapshotBeforeUpdate",value:function(e){if(this.props.active!==e.active&&this.props.active){var t,r=A(S[this.uuid]);try{for(r.s();!(t=r.n()).done;){var n=t.value;if(n!==this)return s.getSnapshot(n.elements[0],this.props.group)}}catch(e){r.e(e)}finally{r.f()}}return null}},{key:"componentDidUpdate",value:function(e,t,n){if(m.default(g.default(r.prototype),"componentDidUpdate",this).call(this),S[this.uuid]=[],n){var i=s.getSnapshot(this.elements[0],this.props.group);i.opacity=1,i.pointerEvents="",this.manager.play(c.computeMorph(i,n,this.properties,this.props.duration),{composite:!0})}else this.manager.initialize(this.animations.unmorph)}},{key:"render",value:function(){var e=this.props.children;if(s.isArr(e)){if(e.length>1)return e;e=e[0]}return l.isValidElement(e)?m.default(g.default(r.prototype),"render",this).call(this):e}}]),r}(u.Animatable);function q(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=g.default(e);if(t){var i=g.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return b.default(this,r)}}O.default(k,"cascadingProps",["id","duration"]),O.default(k,"defaultProps",E(E({},u.Animatable.defaultProps),{},{cascade:0,active:!1,include:s.MORPH_PROPERTIES,exclude:[]}));var C=function(e){v.default(r,e);var t=q(r);function r(e){var n;return h.default(this,r),(n=t.call(this,e)).children=[],n.properties=s.subArray(n.props.include,n.props.exclude),n}return y.default(r,[{key:"getSnapshotBeforeUpdate",value:function(){return this.children.map((function(e){var t=null==e?void 0:e.elements[0];return t?{data:s.getSnapshot(t),key:e.props.layoutKey}:null}))}},{key:"componentDidUpdate",value:function(e,t,r){for(var n=0,i=0;n<r.length;n++,i++){var a=this.children[i];if(a&&a.elements[0]){var o=r[n];if(o&&a.props.layoutKey===o.key){var u=s.getSnapshot(a.elements[0]);a.manager.play(c.computeMorph(u,o.data,this.properties,this.props.duration),{composite:!0})}else i--}}}},{key:"render",value:function(){var e=this;return this.childIndex=0,l.Children.map(this.props.children,(function(t){if(!l.isValidElement(t)||!u.Animatable.isInstance(t))return t;var r=e.childIndex++;return l.cloneElement(t,{ref:function(t){return e.children[r]=t},layoutKey:t.key})}))}}]),r}(l.Component);function I(e){var t=e.children,r=e.className,n=e.style,i=e.duration;if(!s.isStr(t))return t;var a=t.split("");return P.default.createElement("div",{className:r,style:n},P.default.createElement(u.Animatable,{whileViewport:!0,animate:{opacity:1,translate:{y:0},rotate:0,duration:.8},initial:{opacity:0,translate:{y:"100%"},rotate:10},stagger:(i-.8)/(a.length-1)},a.map((function(e,t){return P.default.createElement("span",{style:{display:"inline-block"},key:t},/\s/.test(e)?" ":e)}))))}function M(e){var t,r=e.children,n=e.color,i=e.duration,a=(null===(t=r.props)||void 0===t?void 0:t.children)||[];Array.isArray(a)||(a=[a]);var o=[P.default.createElement(u.Animatable,{key:0,initial:{clip:{right:0}},animate:{clip:{left:1},duration:i/2}},P.default.createElement("div",{style:{position:"absolute",inset:0,backgroundColor:n}}))].concat(j.default(a));return P.default.createElement(u.Animatable,{whileViewport:!0,animate:{clip:{right:0},duration:i/2},initial:{clip:{right:1}}},l.cloneElement(r,{},o))}function B(e){var t,r=e.children,n=e.amount,i=f.useScroll(),a=l.useRef();return P.default.createElement(u.Animatable,{ref:a,animate:{translate:i((function(e){if(void 0===t){var r,i=null===(r=a.current)||void 0===r?void 0:r.elements[0];i&&(t=Math.max(i.getBoundingClientRect().y+window.scrollY-window.innerHeight/2,0))}return{x:0,y:(e-(t||0))*n}}))}},r)}O.default(C,"defaultProps",{include:s.MORPH_PROPERTIES,exclude:[]}),I.defaultProps={style:{},className:"",duration:1.6},M.defaultProps={color:"grey",duration:1.6},B.defaultProps={amount:.5},exports.ColorWipe=M,exports.LayoutGroup=C,exports.Morph=k,exports.Parallax=B,exports.WriteOn=I;
package/dist/cjs/hooks.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/slicedToArray"),r=require("react"),t=require("./link-8b6abc45.js"),n=require("./scroll-07f63b1d.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("@babel/runtime/helpers/typeof"),require("@babel/runtime/helpers/defineProperty"),require("./events-5eb50ffa.js");var i=u(e);exports.useScroll=n.useScroll,exports.useLink=function(e){var r=t.Link.create(e);return[r,r.set]},exports.usePath=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=r.useRef(),u=r.useCallback((function(r,u){if(!n.current)return{x:0,y:0};var i=n.current.getTotalLength()*r/u,o=n.current.getPointAtLength(i),a=o.x,c=o.y;return{x:e[0]+a*t,y:e[1]+c*t}}),[n]);return[u,n]},exports.useReducedMotion=function(){var e=r.useState(!1),t=i.default(e,2),n=t[0],u=t[1],o=function(e){return u(e.matches)};return r.useEffect((function(){var e=matchMedia("(prefers-reduced-motion: reduce)");return e.addEventListener("change",o),u(e.matches),function(){return e.removeEventListener("change",o)}}),[]),n},exports.useUnmount=function(e){var t=r.useState(e),n=i.default(t,2),u=n[0],o=n[1],a=r.useRef();return[u,function(){var e;if(!u)return o(!0);null===(e=a.current)||void 0===e||e.play(a.current.props.onUnmount,{reverse:!0,immediate:!0,callback:function(){return o(!1)}})},a]};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/slicedToArray"),r=require("react"),t=require("./scroll-7da583bf.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("./events-5eb50ffa.js"),require("./link-8b6abc45.js"),require("@babel/runtime/helpers/typeof"),require("@babel/runtime/helpers/defineProperty");var u=n(e);exports.useLink=t.useLink,exports.useScroll=t.useScroll,exports.usePath=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=r.useRef(),u=r.useCallback((function(r,u){if(!n.current)return{x:0,y:0};var i=n.current.getTotalLength()*r/u,o=n.current.getPointAtLength(i),a=o.x,s=o.y;return{x:e[0]+a*t,y:e[1]+s*t}}),[n]);return[u,n]},exports.useReducedMotion=function(){var e=r.useState(!1),t=u.default(e,2),n=t[0],i=t[1],o=function(e){return i(e.matches)};return r.useEffect((function(){var e=matchMedia("(prefers-reduced-motion: reduce)");return e.addEventListener("change",o),i(e.matches),function(){return e.removeEventListener("change",o)}}),[]),n},exports.useUnmount=function(e){var t=r.useState(e),n=u.default(t,2),i=n[0],o=n[1],a=r.useRef();return[i,function(){var e;if(!i)return o(!0);null===(e=a.current)||void 0===e||e.play(a.current.props.onUnmount,{reverse:!0,immediate:!0,callback:function(){return o(!1)}})},a]};
@@ -0,0 +1 @@
1
+ "use strict";var e=require("@babel/runtime/helpers/slicedToArray"),r=require("react"),t=require("./events-5eb50ffa.js"),n=require("./link-8b6abc45.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=u(e);function c(e){var t=r.useRef(n.Link.create(e));return[t.current,t.current.set]}exports.useLink=c,exports.useScroll=function(){var e=c(0),n=i.default(e,2),u=n[0],s=n[1];return r.useEffect((function(){var e=function(){return s(window.scrollY)};return e(),t.addEventListener("scroll",e),function(){return t.removeEventListener("scroll",e)}}),[]),u};
package/dist/esm/auto.js CHANGED
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/classCallCheck";import t from"@babel/runtime/helpers/createClass";import r from"@babel/runtime/helpers/get";import n from"@babel/runtime/helpers/inherits";import i from"@babel/runtime/helpers/possibleConstructorReturn";import o from"@babel/runtime/helpers/getPrototypeOf";import a from"@babel/runtime/helpers/defineProperty";import{A as u}from"./animatable-bc43497c.js";import l,{isValidElement as c,Children as s,cloneElement as p,Component as f,useRef as h}from"react";import{v as d,w as m,u as y,y as v,j as b}from"./link-bd9f6403.js";import{C as g,c as w}from"./animation-38e60844.js";import O from"@babel/runtime/helpers/toConsumableArray";import{u as j}from"./scroll-374d92bc.js";import"./events-62ddbb02.js";import"@babel/runtime/helpers/typeof";import"@babel/runtime/helpers/slicedToArray";import"@babel/runtime/helpers/objectWithoutProperties";function P(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function k(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?P(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):P(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function x(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return E(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return E(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function R(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=o(e);if(t){var a=o(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return i(this,r)}}var A={},C=function(i){n(l,u);var a=R(l);function l(t){var r;return e(this,l),(r=a.call(this,t)).animations={default:new g({},{opacity:+t.active,pointerEvents:t.active?"":"none"}),unmorph:new g({},{opacity:0,pointerEvents:"none"})},r.properties=d(r.props.include,r.props.exclude),r.uuid=(t.id||0).toString()+(t.index||0)+t.group,r}return t(l,[{key:"shouldComponentUpdate",value:function(e){return this.props.active!==e.active&&(this.uuid in A?A[this.uuid].push(this):A[this.uuid]=[this]),this.props.active!==e.active}},{key:"getSnapshotBeforeUpdate",value:function(e){if(this.props.active!==e.active&&this.props.active){var t,r=x(A[this.uuid]);try{for(r.s();!(t=r.n()).done;){var n=t.value;if(n!==this)return m(n.elements[0],this.props.group)}}catch(e){r.e(e)}finally{r.f()}}return null}},{key:"componentDidUpdate",value:function(e,t,n){if(r(o(l.prototype),"componentDidUpdate",this).call(this),A[this.uuid]=[],n){var i=m(this.elements[0],this.props.group);i.opacity=1,i.pointerEvents="",this.manager.play(w(i,n,this.properties,this.props.duration),{composite:!0})}else this.manager.initialize(this.animations.unmorph)}},{key:"render",value:function(){var e=this.props.children;if(y(e)){if(e.length>1)return e;e=e[0]}return c(e)?r(o(l.prototype),"render",this).call(this):e}}]),l}();function S(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=o(e);if(t){var a=o(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return i(this,r)}}a(C,"cascadingProps",["id","duration"]),a(C,"defaultProps",k(k({},u.defaultProps),{},{cascade:0,active:!1,include:v,exclude:[]}));var B=function(r){n(o,f);var i=S(o);function o(t){var r;return e(this,o),(r=i.call(this,t)).children=[],r.properties=d(r.props.include,r.props.exclude),r}return t(o,[{key:"getSnapshotBeforeUpdate",value:function(){return this.children.map((function(e){var t=null==e?void 0:e.elements[0];return t?{data:m(t),key:e.props.layoutKey}:null}))}},{key:"componentDidUpdate",value:function(e,t,r){for(var n=0,i=0;n<r.length;n++,i++){var o=this.children[i];if(o&&o.elements[0]){var a=r[n];if(a&&o.props.layoutKey===a.key){var u=m(o.elements[0]);o.manager.play(w(u,a.data,this.properties,this.props.duration),{composite:!0})}else i--}}}},{key:"render",value:function(){var e=this;return this.childIndex=0,s.map(this.props.children,(function(t){if(!c(t)||!u.isInstance(t))return t;var r=e.childIndex++;return p(t,{ref:function(t){return e.children[r]=t},layoutKey:t.key})}))}}]),o}();function D(e){var t=e.children,r=e.className,n=e.style,i=e.duration;if(!b(t))return t;var o=t.split("");return l.createElement("div",{className:r,style:n},l.createElement(u,{whileViewport:!0,animate:{opacity:1,translate:{y:0},rotate:0,duration:.8},initial:{opacity:0,translate:{y:"100%"},rotate:10},stagger:(i-.8)/(o.length-1)},o.map((function(e,t){return l.createElement("span",{style:{display:"inline-block"},key:t},/\s/.test(e)?" ":e)}))))}function U(e){var t,r=e.children,n=e.color,i=e.duration,o=(null===(t=r.props)||void 0===t?void 0:t.children)||[];Array.isArray(o)||(o=[o]);var a=[l.createElement(u,{key:0,initial:{clip:{right:0}},animate:{clip:{left:1},duration:i/2}},l.createElement("div",{style:{position:"absolute",inset:0,backgroundColor:n}}))].concat(O(o));return l.createElement(u,{whileViewport:!0,animate:{clip:{right:0},duration:i/2},initial:{clip:{right:1}}},p(r,{},a))}function I(e){var t,r=e.children,n=e.amount,i=j(),o=h();return l.createElement(u,{ref:o,animate:{translate:i((function(e){if(void 0===t){var r,i=null===(r=o.current)||void 0===r?void 0:r.elements[0];i&&(t=Math.max(i.getBoundingClientRect().y+window.scrollY-window.innerHeight/2,0))}return{x:0,y:(e-(t||0))*n}}))}},r)}a(B,"defaultProps",{include:v,exclude:[]}),D.defaultProps={style:{},className:"",duration:1.6},U.defaultProps={color:"grey",duration:1.6},I.defaultProps={amount:.5};export{U as ColorWipe,B as LayoutGroup,C as Morph,I as Parallax,D as WriteOn};
1
+ import e from"@babel/runtime/helpers/classCallCheck";import t from"@babel/runtime/helpers/createClass";import r from"@babel/runtime/helpers/get";import n from"@babel/runtime/helpers/inherits";import i from"@babel/runtime/helpers/possibleConstructorReturn";import o from"@babel/runtime/helpers/getPrototypeOf";import a from"@babel/runtime/helpers/defineProperty";import{A as u}from"./animatable-bc43497c.js";import l,{isValidElement as s,Children as c,cloneElement as p,Component as f,useRef as h}from"react";import{v as d,w as m,u as y,y as v,j as b}from"./link-bd9f6403.js";import{C as g,c as w}from"./animation-38e60844.js";import O from"@babel/runtime/helpers/toConsumableArray";import{a as j}from"./scroll-128ad06b.js";import"./events-62ddbb02.js";import"@babel/runtime/helpers/typeof";import"@babel/runtime/helpers/slicedToArray";import"@babel/runtime/helpers/objectWithoutProperties";function P(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function k(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?P(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):P(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function x(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return E(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return E(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){u=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw o}}}}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function R(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=o(e);if(t){var a=o(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return i(this,r)}}var A={},C=function(i){n(l,u);var a=R(l);function l(t){var r;return e(this,l),(r=a.call(this,t)).animations={default:new g({},{opacity:+t.active,pointerEvents:t.active?"":"none"}),unmorph:new g({},{opacity:0,pointerEvents:"none"})},r.properties=d(r.props.include,r.props.exclude),r.uuid=(t.id||0).toString()+(t.index||0)+t.group,r}return t(l,[{key:"shouldComponentUpdate",value:function(e){return this.props.active!==e.active&&(this.uuid in A?A[this.uuid].push(this):A[this.uuid]=[this]),this.props.active!==e.active}},{key:"getSnapshotBeforeUpdate",value:function(e){if(this.props.active!==e.active&&this.props.active){var t,r=x(A[this.uuid]);try{for(r.s();!(t=r.n()).done;){var n=t.value;if(n!==this)return m(n.elements[0],this.props.group)}}catch(e){r.e(e)}finally{r.f()}}return null}},{key:"componentDidUpdate",value:function(e,t,n){if(r(o(l.prototype),"componentDidUpdate",this).call(this),A[this.uuid]=[],n){var i=m(this.elements[0],this.props.group);i.opacity=1,i.pointerEvents="",this.manager.play(w(i,n,this.properties,this.props.duration),{composite:!0})}else this.manager.initialize(this.animations.unmorph)}},{key:"render",value:function(){var e=this.props.children;if(y(e)){if(e.length>1)return e;e=e[0]}return s(e)?r(o(l.prototype),"render",this).call(this):e}}]),l}();function S(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=o(e);if(t){var a=o(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return i(this,r)}}a(C,"cascadingProps",["id","duration"]),a(C,"defaultProps",k(k({},u.defaultProps),{},{cascade:0,active:!1,include:v,exclude:[]}));var B=function(r){n(o,f);var i=S(o);function o(t){var r;return e(this,o),(r=i.call(this,t)).children=[],r.properties=d(r.props.include,r.props.exclude),r}return t(o,[{key:"getSnapshotBeforeUpdate",value:function(){return this.children.map((function(e){var t=null==e?void 0:e.elements[0];return t?{data:m(t),key:e.props.layoutKey}:null}))}},{key:"componentDidUpdate",value:function(e,t,r){for(var n=0,i=0;n<r.length;n++,i++){var o=this.children[i];if(o&&o.elements[0]){var a=r[n];if(a&&o.props.layoutKey===a.key){var u=m(o.elements[0]);o.manager.play(w(u,a.data,this.properties,this.props.duration),{composite:!0})}else i--}}}},{key:"render",value:function(){var e=this;return this.childIndex=0,c.map(this.props.children,(function(t){if(!s(t)||!u.isInstance(t))return t;var r=e.childIndex++;return p(t,{ref:function(t){return e.children[r]=t},layoutKey:t.key})}))}}]),o}();function D(e){var t=e.children,r=e.className,n=e.style,i=e.duration;if(!b(t))return t;var o=t.split("");return l.createElement("div",{className:r,style:n},l.createElement(u,{whileViewport:!0,animate:{opacity:1,translate:{y:0},rotate:0,duration:.8},initial:{opacity:0,translate:{y:"100%"},rotate:10},stagger:(i-.8)/(o.length-1)},o.map((function(e,t){return l.createElement("span",{style:{display:"inline-block"},key:t},/\s/.test(e)?" ":e)}))))}function U(e){var t,r=e.children,n=e.color,i=e.duration,o=(null===(t=r.props)||void 0===t?void 0:t.children)||[];Array.isArray(o)||(o=[o]);var a=[l.createElement(u,{key:0,initial:{clip:{right:0}},animate:{clip:{left:1},duration:i/2}},l.createElement("div",{style:{position:"absolute",inset:0,backgroundColor:n}}))].concat(O(o));return l.createElement(u,{whileViewport:!0,animate:{clip:{right:0},duration:i/2},initial:{clip:{right:1}}},p(r,{},a))}function I(e){var t,r=e.children,n=e.amount,i=j(),o=h();return l.createElement(u,{ref:o,animate:{translate:i((function(e){if(void 0===t){var r,i=null===(r=o.current)||void 0===r?void 0:r.elements[0];i&&(t=Math.max(i.getBoundingClientRect().y+window.scrollY-window.innerHeight/2,0))}return{x:0,y:(e-(t||0))*n}}))}},r)}a(B,"defaultProps",{include:v,exclude:[]}),D.defaultProps={style:{},className:"",duration:1.6},U.defaultProps={color:"grey",duration:1.6},I.defaultProps={amount:.5};export{U as ColorWipe,B as LayoutGroup,C as Morph,I as Parallax,D as WriteOn};
package/dist/esm/hooks.js CHANGED
@@ -1 +1 @@
1
- import r from"@babel/runtime/helpers/slicedToArray";import{useState as e,useRef as t,useCallback as n,useEffect as o}from"react";import{L as i}from"./link-bd9f6403.js";export{u as useScroll}from"./scroll-374d92bc.js";import"@babel/runtime/helpers/typeof";import"@babel/runtime/helpers/defineProperty";import"./events-62ddbb02.js";function c(n){var o=e(n),u=r(o,2),i=u[0],c=u[1],a=t();return[i,function(){var r;if(!i)return c(!0);null===(r=a.current)||void 0===r||r.play(a.current.props.onUnmount,{reverse:!0,immediate:!0,callback:function(){return c(!1)}})},a]}function a(r){var e=i.create(r);return[e,e.set]}function m(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=t(),u=n((function(t,n){if(!o.current)return{x:0,y:0};var u=o.current.getTotalLength()*t/n,i=o.current.getPointAtLength(u),c=i.x,a=i.y;return{x:r[0]+c*e,y:r[1]+a*e}}),[o]);return[u,o]}function f(){var t=e(!1),n=r(t,2),u=n[0],i=n[1],c=function(r){return i(r.matches)};return o((function(){var r=matchMedia("(prefers-reduced-motion: reduce)");return r.addEventListener("change",c),i(r.matches),function(){return r.removeEventListener("change",c)}}),[]),u}export{a as useLink,m as usePath,f as useReducedMotion,c as useUnmount};
1
+ import r from"@babel/runtime/helpers/slicedToArray";import{useState as e,useRef as t,useCallback as n,useEffect as o}from"react";export{u as useLink,a as useScroll}from"./scroll-128ad06b.js";import"./events-62ddbb02.js";import"./link-bd9f6403.js";import"@babel/runtime/helpers/typeof";import"@babel/runtime/helpers/defineProperty";function i(n){var o=e(n),i=r(o,2),u=i[0],a=i[1],c=t();return[u,function(){var r;if(!u)return a(!0);null===(r=c.current)||void 0===r||r.play(c.current.props.onUnmount,{reverse:!0,immediate:!0,callback:function(){return a(!1)}})},c]}function c(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=t(),i=n((function(t,n){if(!o.current)return{x:0,y:0};var i=o.current.getTotalLength()*t/n,u=o.current.getPointAtLength(i),a=u.x,c=u.y;return{x:r[0]+a*e,y:r[1]+c*e}}),[o]);return[i,o]}function l(){var t=e(!1),n=r(t,2),i=n[0],u=n[1],a=function(r){return u(r.matches)};return o((function(){var r=matchMedia("(prefers-reduced-motion: reduce)");return r.addEventListener("change",a),u(r.matches),function(){return r.removeEventListener("change",a)}}),[]),i}export{c as usePath,l as useReducedMotion,i as useUnmount};
@@ -0,0 +1 @@
1
+ import r from"@babel/runtime/helpers/slicedToArray";import{useRef as t,useEffect as n}from"react";import{a as e,r as o}from"./events-62ddbb02.js";import{L as a}from"./link-bd9f6403.js";function s(r){var n=t(a.create(r));return[n.current,n.current.set]}function u(){var t=s(0),a=r(t,2),u=a[0],c=a[1];return n((function(){var r=function(){return c(window.scrollY)};return r(),e("scroll",r),function(){return o("scroll",r)}}),[]),u}export{u as a,s as u};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infinityfx/lively",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "Feature complete, lightweight react animation library.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -1 +0,0 @@
1
- "use strict";var e=require("react"),r=require("./link-8b6abc45.js"),n=require("./events-5eb50ffa.js");exports.useScroll=function(){var t=r.Link.create(0);return e.useEffect((function(){var e=function(){return t.set(window.scrollY)};return e(),n.addEventListener("scroll",e),function(){return n.removeEventListener("scroll",e)}}),[]),t};
@@ -1 +0,0 @@
1
- import{useEffect as r}from"react";import{L as t}from"./link-bd9f6403.js";import{a as n,r as o}from"./events-62ddbb02.js";function e(){var e=t.create(0);return r((function(){var r=function(){return e.set(window.scrollY)};return r(),n("scroll",r),function(){return o("scroll",r)}}),[]),e}export{e as u};