@infinityfx/lively 2.0.0 → 2.0.1

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 +1 @@
1
- "use strict";var e=require("@babel/runtime/helpers/classCallCheck"),t=require("@babel/runtime/helpers/createClass"),r=require("@babel/runtime/helpers/inherits"),n=require("@babel/runtime/helpers/possibleConstructorReturn"),i=require("@babel/runtime/helpers/getPrototypeOf"),o=require("@babel/runtime/helpers/defineProperty"),a=require("react"),s=require("./animation-ebe42adf.js"),l=require("./link-27893881.js"),u=require("./events-d2682977.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=c(e),f=c(t),p=c(r),y=c(n),d=c(i),v=c(o);function m(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 g(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 g(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,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function g(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}var b=function(){function e(){h.default(this,e),this.t=Date.now(),this.managers=[],this.step()}return f.default(e,[{key:"step",value:function(){var e,t=Date.now(),r=m(this.managers);try{for(r.s();!(e=r.n()).done;){e.value.step((t-this.t)/1e3)}}catch(e){r.e(e)}finally{r.f()}this.t=t,requestAnimationFrame(this.step.bind(this))}},{key:"add",value:function(e){var t=Math.max(this.managers.findIndex((function(t){return t.priority>=e.priority})),0);this.managers.splice(t,0,e)}},{key:"remove",value:function(e){this.managers.splice(this.managers.indexOf(e),1)}}],[{key:"get",value:function(){return window.Lively||(window.Lively=new e),window.Lively}}]),e}();function w(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 k(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 k(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,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function k(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}var O=function(){function e(t,r,n){h.default(this,e),this.element=t,this.tracks=[],this.queue=[],this.playing=!0,this.culling=r,this.layout=n,this.transforms=["translate","scale","skew","rotate"]}return f.default(e,[{key:"purge",value:function(){if(!("cache"in this.element)){this.element.cache={strokeDasharray:1,borderRadius:l.getProperty(this.element,"borderRadius")};for(var e=0;e<this.element.style.length;e++){var t=this.element.style[e];this.element.cache[t]=this.element.style[t]}}for(var r in this.element.style={},this.element.cache)this.element.style[r]=this.element.cache[r]}},{key:"clear",value:function(){this.tracks=[],this.queue=[]}},{key:"add",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.immediate,n=void 0!==r&&r,i=t.composite,o=void 0===i||i;n&&this.clear(),o||!this.tracks.length?this.tracks.push(e):this.queue.push(e)}},{key:"remove",value:function(e){this.tracks.splice(this.tracks.indexOf(e),1),!this.tracks.length&&this.queue.length&&this.tracks.push(this.queue.shift())}},{key:"step",value:function(e){if(this.playing){for(var t=this.element.correction?{scale:l.DEFAULT_OBJECTS.scale}:{},r=this.tracks.length+ +!this.channel.isEmpty,n=0;n<r;n++){var i=this.tracks[n]||this.channel;l.mergeProperties(t,i.get(this.element,this.culling)),i.step(e)&&this.remove(i)}this.apply(this.element,t)}}},{key:"apply",value:function(e,t){if(!l.is.empty(t)){var r=[];for(var n in t){var i=t[n];if("scale"==n){if(this.layout){var o,a={x:[1/i.x[0],i.x[1]],y:[1/i.y[0],i.y[1]]},s=w(e.children);try{for(s.s();!(o=s.n()).done;){o.value.correction=a}}catch(e){s.e(e)}finally{s.f()}var u=t.borderRadius||e.cache.borderRadius;delete t.borderRadius,e.style.borderRadius="".concat(u[0]/i.x[0]).concat(u[1]," / ").concat(u[0]/i.y[0]).concat(u[1])}e.correction&&(i=l.merge(i,e.correction,l.MERGE_FUNCTIONS.scale))}var c=this.transforms.indexOf(n);c>=0?r[c]="".concat(n,"(").concat(l.is.object(i)?l.objToStr(i,", ",["x","y"]):l.arrToStyle(i),")"):(n=l.Aliases[n]||n,l.is.color(i)?e.style[n]="rgba(".concat(i.r[0],", ").concat(i.g[0],", ").concat(i.b[0],", ").concat(i.a[0],")"):e.style[n]=n in l.Aliases?l.Aliases[n](i):l.arrToStyle(i))}(r=r.filter((function(e){return!!e}))).length&&(e.style.transform=r.join(" "))}}},{key:"initialize",value:function(e){this.apply(this.element,e.initials),this.channel=e.channel}}]),e}();function j(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 A(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?j(Object(r),!0).forEach((function(t){v.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function S(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 o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}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}var E=function(){function e(t){var r=t.priority,n=void 0===r?0:r,i=t.stagger,o=void 0===i?.1:i,a=t.culling,s=void 0===a||a,l=t.noDeform,u=void 0!==l&&l,c=t.paused,f=void 0!==c&&c;h.default(this,e),this.targets=[],this.priority=n,this.stagger=o,this.culling=s,this.noDeform=u,this.paused=f}return f.default(e,[{key:"register",value:function(){b.get().add(this)}},{key:"destroy",value:function(){this.targets=[],b.get().remove(this)}},{key:"purge",value:function(){var e,t=S(this.targets);try{for(t.s();!(e=t.n()).done;){e.value.purge()}}catch(e){t.e(e)}finally{t.f()}}},{key:"clear",value:function(){var e,t=S(this.targets);try{for(t.s();!(e=t.n()).done;){e.value.clear()}}catch(e){t.e(e)}finally{t.f()}}},{key:"set",value:function(e){var t=this;this.targets=e.map((function(e){return new O(e,t.culling,t.noDeform)}))}},{key:"play",value:function(e,t){if(!e.isEmpty)for(var r=0;r<this.targets.length;r++){var n=A(A({},t),{},{delay:(t.delay||0)+r*this.stagger});this.targets[r].add(e.play(n),t)}}},{key:"initialize",value:function(e){var t,r=S(this.targets);try{for(r.s();!(t=r.n()).done;){t.value.initialize(e)}}catch(e){r.e(e)}finally{r.f()}}},{key:"step",value:function(e){if(!this.paused){var t,r=S(this.targets);try{for(r.s();!(t=r.n()).done;){t.value.step(e)}}catch(e){r.e(e)}finally{r.f()}}}}]),e}();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 I(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){v.default(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 D(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 M(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 M(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,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function M(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 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=d.default(e);if(t){var i=d.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return y.default(this,r)}}var C=function(e){p.default(r,e);var t=q(r);function r(e){var n;for(var i in h.default(this,r),(n=t.call(this,e)).animations={default:n.parse(n.props.animate||{})},n.props.animations||{})n.animations[i]=n.parse(n.props.animations[i]);return n.children=[],n.elements=[],n.stagger=n.props.stagger||.1,n.manager=new E({priority:n.props.group,stagger:n.stagger,culling:n.props.lazy,noDeform:n.props.noDeform,paused:n.props.paused}),n}return f.default(r,[{key:"parse",value:function(e){return s.Animation.isInstance(e)?e.use():l.is.object(e)?new s.Clip(e,this.props.initial):null}},{key:"update",value:function(){this.manager.clear(),this.manager.purge(),this.manager.initialize(this.animations.default)}},{key:"componentDidMount",value:function(){var e=this;this.scrollEventListener=l.throttle(this.onScroll.bind(this)),u.addEventListener("scroll",this.scrollEventListener),this.eventListener=this.onEvent.bind(this),u.onAny(r.events,this.elements,this.eventListener),this.manager.set(this.elements),this.manager.register(),this.update(),document.fonts.ready.then((function(){e.update(),clearTimeout(e.timeout),e.inViewport=!1,e.props.group||(e.play(e.props.onMount),e.onScroll())}))}},{key:"componentWillUnmount",value:function(){u.removeEventListener("scroll",this.scrollEventListener),u.offAny(r.events,this.elements,this.eventListener),this.manager.destroy()}},{key:"componentDidUpdate",value:function(){this.manager.paused=this.props.paused;var e,t=D(this.children);try{for(t.s();!(e=t.n()).done;){e.value.manager.paused=this.props.paused}}catch(e){t.e(e)}finally{t.f()}}},{key:"dispatch",value:function(e){l.is.function(this.props[e])&&this.props[e]()}},{key:"onEvent",value:function(e){switch(e.type){case"click":this.play(this.props.onClick);break;case"mouseenter":this.hover||(this.hover=!0,this.play(this.props.whileHover));break;case"mouseleave":this.hover&&(this.hover=!1,this.play(this.props.whileHover,{reverse:!0}));break;case"focus":this.focus||(this.focus=!0,this.play(this.props.whileFocus));break;case"blur":this.focus&&(this.focus=!1,this.play(this.props.whileFocus,{reverse:!0}))}}},{key:"getBoundingBox",value:function(){var e,t={x:Number.MAX_VALUE,y:Number.MAX_VALUE,right:0,bottom:0},r=D(this.elements.length?this.elements:this.children);try{for(r.s();!(e=r.n()).done;){var n=e.value,i=this.elements.length?n.getBoundingClientRect():n.getBoundingBox();t.y=Math.min(i.y,t.y),t.x=Math.min(i.x,t.x),t.right=Math.max(i.right,t.right),t.bottom=Math.max(i.bottom,t.bottom)}}catch(e){r.e(e)}finally{r.f()}return t}},{key:"onScroll",value:function(){if(this.props.whileViewport){var e=l.inViewport(this.getBoundingBox(),this.props.viewportMargin),t=e.entered,r=e.left;t&&!this.inViewport&&(this.inViewport=!0,this.play(this.props.whileViewport),this.dispatch("onEnterViewport")),r&&this.inViewport&&(this.inViewport=!1,this.play(this.props.whileViewport,{reverse:!0,immediate:!0}),this.dispatch("onLeaveViewport"))}}},{key:"play",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.reverse,i=void 0!==n&&n,o=r.composite,a=void 0!==o&&o,s=r.immediate,u=void 0!==s&&s,c=r.delay,h=void 0===c?0:c,f=r.callback,p=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!(!e||this.props.disabled||this.props.group>0&&!p)){l.is.string(e)||(e="default"),this.dispatch("onAnimationStart");var y,d=this.animations[e],v=d.length(),m=0,g=D(this.children);try{for(g.s();!(y=g.n()).done;){var b=y.value;m=Math.max(m,b.play(e,{reverse:i,immediate:u,delay:h+v},!0))}}catch(e){g.e(e)}finally{g.f()}return this.manager.play(d,{reverse:i,composite:a,immediate:u,delay:i?m:h}),u&&clearTimeout(this.timeout),this.props.group||(this.timeout=setTimeout((function(){t.dispatch("onAnimationEnd"),l.is.function(f)&&f()}),1e3*(m+v))),v+(i?m:h)}}},{key:"stop",value:function(){this.manager.clear()}},{key:"prerender",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return a.Children.map(e,(function(e){if(!a.isValidElement(e))return e;var o={pathLength:1},s=t.elementIndex++;if(n&&(o.ref=function(e){return t.elements[s]=e}),r.isInstance(e)&&i&&!e.props.noCascade){var u=t.childIndex++;i=!1,o.group=t.props.group+1,o.ref=function(e){return t.children[u]=e},t.props.group||(o.active=t.props.active),l.mergeObjects(o,I(I({},t.props),e.props),t.constructor.cascadingProps)}return a.cloneElement(e,o,t.prerender(e.props.children,!1,i))}))}},{key:"render",value:function(){return this.elementIndex=this.childIndex=0,this.prerender(this.props.children)}}],[{key:"isInstance",value:function(e){return e.type===r||e.type.prototype instanceof r}}]),r}(a.Component);v.default(C,"events",["click","mouseenter","mouseleave","focus","blur"]),v.default(C,"cascadingProps",["animate","initial","animations","stagger"]),v.default(C,"defaultProps",{group:0,viewportMargin:.75,lazy:!0,paused:!1}),exports.Animatable=C;
1
+ "use strict";var e=require("@babel/runtime/helpers/classCallCheck"),t=require("@babel/runtime/helpers/createClass"),r=require("@babel/runtime/helpers/inherits"),n=require("@babel/runtime/helpers/possibleConstructorReturn"),i=require("@babel/runtime/helpers/getPrototypeOf"),o=require("@babel/runtime/helpers/defineProperty"),a=require("react"),s=require("./animation-ebe42adf.js"),l=require("./link-27893881.js"),u=require("./events-d2682977.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=c(e),f=c(t),p=c(r),y=c(n),d=c(i),v=c(o);function m(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 g(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 g(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,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function g(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}var b=function(){function e(){h.default(this,e),this.t=Date.now(),this.managers=[],this.step()}return f.default(e,[{key:"step",value:function(){var e,t=Date.now(),r=m(this.managers);try{for(r.s();!(e=r.n()).done;){e.value.step((t-this.t)/1e3)}}catch(e){r.e(e)}finally{r.f()}this.t=t,requestAnimationFrame(this.step.bind(this))}},{key:"add",value:function(e){var t=Math.max(this.managers.findIndex((function(t){return t.priority>=e.priority})),0);this.managers.splice(t,0,e)}},{key:"remove",value:function(e){this.managers.splice(this.managers.indexOf(e),1)}}],[{key:"get",value:function(){return window.Lively||(window.Lively=new e),window.Lively}}]),e}();function w(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 k(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 k(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,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function k(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}var O=function(){function e(t,r,n){h.default(this,e),this.element=t,this.tracks=[],this.queue=[],this.playing=!0,this.culling=r,this.layout=n,this.transforms=["translate","scale","skew","rotate"]}return f.default(e,[{key:"purge",value:function(){if(!("cache"in this.element)){this.element.cache={strokeDasharray:1,borderRadius:l.getProperty(this.element,"borderRadius")};for(var e=0;e<this.element.style.length;e++){var t=this.element.style[e];this.element.cache[t]=this.element.style[t]}}for(var r in this.element.style={},this.element.cache)this.element.style[r]=this.element.cache[r]}},{key:"clear",value:function(){this.tracks=[],this.queue=[]}},{key:"add",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.immediate,n=void 0!==r&&r,i=t.composite,o=void 0===i||i;n&&this.clear(),o||!this.tracks.length?this.tracks.push(e):this.queue.push(e)}},{key:"remove",value:function(e){this.tracks.splice(this.tracks.indexOf(e),1),!this.tracks.length&&this.queue.length&&this.tracks.push(this.queue.shift())}},{key:"step",value:function(e){if(this.playing){for(var t=this.element.correction?{scale:l.DEFAULT_OBJECTS.scale}:{},r=this.tracks.length+ +!this.channel.isEmpty,n=0;n<r;n++){var i=this.tracks[n]||this.channel;l.mergeProperties(t,i.get(this.element,this.culling)),i.step(e)&&this.remove(i)}this.apply(this.element,t)}}},{key:"apply",value:function(e,t){if(!l.is.empty(t)){var r=[];for(var n in t){var i=t[n];if("scale"==n){if(this.layout){var o,a={x:[1/i.x[0],i.x[1]],y:[1/i.y[0],i.y[1]]},s=w(e.children);try{for(s.s();!(o=s.n()).done;){o.value.correction=a}}catch(e){s.e(e)}finally{s.f()}var u=t.borderRadius||e.cache.borderRadius;delete t.borderRadius,e.style.borderRadius="".concat(u[0]/i.x[0]).concat(u[1]," / ").concat(u[0]/i.y[0]).concat(u[1])}e.correction&&(i=l.merge(i,e.correction,l.MERGE_FUNCTIONS.scale))}var c=this.transforms.indexOf(n);c>=0?r[c]="".concat(n,"(").concat(l.is.object(i)?l.objToStr(i,", ",["x","y"]):l.arrToStyle(i),")"):(n=l.Aliases[n]||n,l.is.color(i)?e.style[n]="rgba(".concat(i.r[0],", ").concat(i.g[0],", ").concat(i.b[0],", ").concat(i.a[0],")"):e.style[n]=n in l.Aliases?l.Aliases[n](i):l.arrToStyle(i))}(r=r.filter((function(e){return!!e}))).length&&(e.style.transform=r.join(" "))}}},{key:"initialize",value:function(e){this.apply(this.element,e.initials),this.channel=e.channel}}]),e}();function j(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 A(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?j(Object(r),!0).forEach((function(t){v.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function S(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 o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}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}var E=function(){function e(t){var r=t.priority,n=void 0===r?0:r,i=t.stagger,o=void 0===i?.1:i,a=t.culling,s=void 0===a||a,l=t.noDeform,u=void 0!==l&&l,c=t.paused,f=void 0!==c&&c;h.default(this,e),this.targets=[],this.priority=n,this.stagger=o,this.culling=s,this.noDeform=u,this.paused=f}return f.default(e,[{key:"register",value:function(){b.get().add(this)}},{key:"destroy",value:function(){this.targets=[],b.get().remove(this)}},{key:"purge",value:function(){var e,t=S(this.targets);try{for(t.s();!(e=t.n()).done;){e.value.purge()}}catch(e){t.e(e)}finally{t.f()}}},{key:"clear",value:function(){var e,t=S(this.targets);try{for(t.s();!(e=t.n()).done;){e.value.clear()}}catch(e){t.e(e)}finally{t.f()}}},{key:"set",value:function(e){var t=this;this.targets=e.map((function(e){return new O(e,t.culling,t.noDeform)}))}},{key:"play",value:function(e,t){if(!e.isEmpty)for(var r=0;r<this.targets.length;r++){var n=A(A({},t),{},{delay:(t.delay||0)+r*this.stagger});this.targets[r].add(e.play(n),t)}}},{key:"initialize",value:function(e){var t,r=S(this.targets);try{for(r.s();!(t=r.n()).done;){t.value.initialize(e)}}catch(e){r.e(e)}finally{r.f()}}},{key:"step",value:function(e){if(!this.paused){var t,r=S(this.targets);try{for(r.s();!(t=r.n()).done;){t.value.step(e)}}catch(e){r.e(e)}finally{r.f()}}}}]),e}();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 I(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){v.default(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 D(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 M(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 M(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,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function M(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 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=d.default(e);if(t){var i=d.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return y.default(this,r)}}var C=function(e){p.default(r,e);var t=q(r);function r(e){var n;for(var i in h.default(this,r),(n=t.call(this,e)).animations={default:n.parse(n.props.animate||{})},n.props.animations||{})n.animations[i]=n.parse(n.props.animations[i]);return n.children=[],n.elements=[],n.stagger=n.props.stagger||.1,n.manager=new E({priority:n.props.group,stagger:n.stagger,culling:n.props.lazy,noDeform:n.props.noDeform,paused:n.props.paused}),n}return f.default(r,[{key:"parse",value:function(e){return s.Animation.isInstance(e)?e.use():l.is.object(e)?new s.Clip(e,this.props.initial):null}},{key:"update",value:function(){this.manager.clear(),this.manager.purge(),this.manager.initialize(this.animations.default)}},{key:"componentDidMount",value:function(){var e=this;this.scrollEventListener=l.throttle(this.onScroll.bind(this)),u.addEventListener("scroll",this.scrollEventListener),this.eventListener=this.onEvent.bind(this),u.onAny(r.events,this.elements,this.eventListener),this.manager.set(this.elements),this.manager.register(),this.update(),document.fonts.ready.then((function(){e.update(),clearTimeout(e.timeout),e.inViewport=!1,e.props.group||(e.play(e.props.onMount),e.onScroll())}))}},{key:"componentWillUnmount",value:function(){u.removeEventListener("scroll",this.scrollEventListener),u.offAny(r.events,this.elements,this.eventListener),this.manager.destroy()}},{key:"componentDidUpdate",value:function(){this.manager.paused=this.props.paused;var e,t=D(this.children);try{for(t.s();!(e=t.n()).done;){e.value.manager.paused=this.props.paused}}catch(e){t.e(e)}finally{t.f()}}},{key:"dispatch",value:function(e){l.is.function(this.props[e])&&this.props[e]()}},{key:"onEvent",value:function(e){switch(e.type){case"click":this.play(this.props.onClick);break;case"mouseenter":this.hover||(this.hover=!0,this.play(this.props.whileHover));break;case"mouseleave":this.hover&&(this.hover=!1,this.play(this.props.whileHover,{reverse:!0}));break;case"focus":this.focus||(this.focus=!0,this.play(this.props.whileFocus));break;case"blur":this.focus&&(this.focus=!1,this.play(this.props.whileFocus,{reverse:!0}))}}},{key:"getBoundingBox",value:function(){var e,t={x:Number.MAX_VALUE,y:Number.MAX_VALUE,right:0,bottom:0},r=D(this.elements.length?this.elements:this.children);try{for(r.s();!(e=r.n()).done;){var n=e.value,i=this.elements.length?n.getBoundingClientRect():n.getBoundingBox();t.y=Math.min(i.y,t.y),t.x=Math.min(i.x,t.x),t.right=Math.max(i.right,t.right),t.bottom=Math.max(i.bottom,t.bottom)}}catch(e){r.e(e)}finally{r.f()}return t}},{key:"onScroll",value:function(){if(this.props.whileViewport){var e=l.inViewport(this.getBoundingBox(),this.props.viewportMargin),t=e.entered,r=e.left;t&&!this.inViewport&&(this.inViewport=!0,this.play(this.props.whileViewport),this.dispatch("onEnterViewport")),r&&this.inViewport&&(this.inViewport=!1,this.play(this.props.whileViewport,{reverse:!0,immediate:!0}),this.dispatch("onLeaveViewport"))}}},{key:"play",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.reverse,i=void 0!==n&&n,o=r.composite,a=void 0!==o&&o,s=r.immediate,u=void 0!==s&&s,c=r.delay,h=void 0===c?0:c,f=r.callback,p=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!(!e||this.props.disabled||this.props.group>0&&!p)){l.is.string(e)||(e="default"),this.dispatch("onAnimationStart");var y,d=this.animations[e],v=d.length(),m=0,g=D(this.children);try{for(g.s();!(y=g.n()).done;){var b=y.value;m=Math.max(m,b.play(e,{reverse:i,immediate:u,delay:h+v},!0))}}catch(e){g.e(e)}finally{g.f()}return this.manager.play(d,{reverse:i,composite:a,immediate:u,delay:i?m:h}),u&&clearTimeout(this.timeout),this.props.group||(this.timeout=setTimeout((function(){t.dispatch("onAnimationEnd"),l.is.function(f)&&f()}),1e3*(m+v))),v+(i?m:h)}}},{key:"stop",value:function(){this.manager.clear()}},{key:"prerender",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return a.Children.map(e,(function(e){if(!a.isValidElement(e))return e;var o={pathLength:1};if(n){var s=t.elementIndex++;o.ref=function(e){return t.elements[s]=e}}if(r.isInstance(e)&&i&&!e.props.noCascade){var u=t.childIndex++;i=!1,o.group=t.props.group+1,o.ref=function(e){return t.children[u]=e},t.props.group||(o.active=t.props.active),l.mergeObjects(o,I(I({},t.props),e.props),t.constructor.cascadingProps)}return a.cloneElement(e,o,t.prerender(e.props.children,!1,i))}))}},{key:"render",value:function(){return this.elementIndex=this.childIndex=0,this.prerender(this.props.children)}}],[{key:"isInstance",value:function(e){return e.type===r||e.type.prototype instanceof r}}]),r}(a.Component);v.default(C,"events",["click","mouseenter","mouseleave","focus","blur"]),v.default(C,"cascadingProps",["animate","initial","animations","stagger"]),v.default(C,"defaultProps",{group:0,viewportMargin:.75,lazy:!0,paused:!1}),exports.Animatable=C;
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-96d26e6a.js"),l=require("react"),s=require("./link-27893881.js"),c=require("./animation-ebe42adf.js"),p=require("@babel/runtime/helpers/toConsumableArray"),f=require("./scroll-22eb6b9a.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("./events-d2682977.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 R(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 R(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 R(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 x(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 k={},q=function(e){v.default(r,e);var t=x(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)+e.group.toString(),n}return y.default(r,[{key:"shouldComponentUpdate",value:function(e){return this.props.active!==e.active&&(this.uuid in k?k[this.uuid].push(this):k[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(k[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),k[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.is.array(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 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=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(q,"cascadingProps",["id","duration"]),O.default(q,"defaultProps",E(E({},u.Animatable.defaultProps),{},{active:!1,include:s.MORPH_PROPERTIES,exclude:[]}));var C=function(e){v.default(r,e);var t=S(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.is.string(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=q,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-f7712df4.js"),l=require("react"),s=require("./link-27893881.js"),c=require("./animation-ebe42adf.js"),p=require("@babel/runtime/helpers/toConsumableArray"),f=require("./scroll-22eb6b9a.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("./events-d2682977.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 R(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 R(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 R(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 x(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 k={},q=function(e){v.default(r,e);var t=x(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)+e.group.toString(),n}return y.default(r,[{key:"shouldComponentUpdate",value:function(e){return this.props.active!==e.active&&(this.uuid in k?k[this.uuid].push(this):k[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(k[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),k[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.is.array(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 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=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(q,"cascadingProps",["id","duration"]),O.default(q,"defaultProps",E(E({},u.Animatable.defaultProps),{},{active:!1,include:s.MORPH_PROPERTIES,exclude:[]}));var C=function(e){v.default(r,e);var t=S(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.is.string(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=q,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-27893881.js"),n=require("./scroll-22eb6b9a.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-d2682977.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),s=o.x,a=o.y;return{x:e[0]+s*t,y:e[1]+a*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],s=r.useRef();return[u,function(){if(!u)return o(!0);s.current.play(s.current.props.onUnmount,{reverse:!0,immediate:!0,callback:function(){return o(!1)}})},s]};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/slicedToArray"),r=require("react"),t=require("./link-27893881.js"),n=require("./scroll-22eb6b9a.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-d2682977.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,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=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]};
package/dist/cjs/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./animatable-96d26e6a.js"),r=require("@babel/runtime/helpers/extends"),t=require("@babel/runtime/helpers/objectWithoutProperties"),n=require("@babel/runtime/helpers/classCallCheck"),a=require("@babel/runtime/helpers/createClass"),i=require("@babel/runtime/helpers/inherits"),l=require("@babel/runtime/helpers/possibleConstructorReturn"),u=require("@babel/runtime/helpers/getPrototypeOf"),s=require("@babel/runtime/helpers/defineProperty"),o=require("react"),f=require("./pop-8f3d8837.js"),c=require("./link-27893881.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("./animation-ebe42adf.js"),require("@babel/runtime/helpers/slicedToArray"),require("./events-d2682977.js"),require("@babel/runtime/helpers/typeof");var m=p(r),b=p(t),h=p(n),d=p(a),v=p(i),y=p(l),q=p(u),A=p(s),j=p(o),k=["levels","animations"];function C(e){var r=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 t,n=q.default(e);if(r){var a=q.default(this).constructor;t=Reflect.construct(n,arguments,a)}else t=n.apply(this,arguments);return y.default(this,t)}}var P=function(r){v.default(n,r);var t=C(n);function n(e){var r;return h.default(this,n),(r=t.call(this,e)).levels=r.props.levels,r.animations=c.padArray(r.props.animations,r.levels),r}return d.default(n,[{key:"makeAnimatable",value:function(r){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(n<1||o.Children.count(r)<1)return r;var a=this.props;a.levels,a.animations;var i=b.default(a,k),l=this.animations[this.levels-n];return n===this.levels&&(i.ref=function(e){return t.animatable=e}),j.default.createElement(e.Animatable,m.default({},i,{animate:l}),o.Children.map(r,(function(e){return o.isValidElement(e)?o.cloneElement(e,{},t.makeAnimatable(e.props.children,n-1)):e})))}},{key:"play",value:function(){var e;null===(e=this.animatable)||void 0===e||e.play(arguments)}},{key:"render",value:function(){return this.makeAnimatable(this.props.children,this.levels)}}]),n}(o.Component);A.default(P,"defaultProps",{levels:1,animations:[f.Move,f.Pop]}),exports.Animatable=e.Animatable,exports.Animate=P;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./animatable-f7712df4.js"),r=require("@babel/runtime/helpers/extends"),t=require("@babel/runtime/helpers/objectWithoutProperties"),n=require("@babel/runtime/helpers/classCallCheck"),a=require("@babel/runtime/helpers/createClass"),i=require("@babel/runtime/helpers/inherits"),l=require("@babel/runtime/helpers/possibleConstructorReturn"),u=require("@babel/runtime/helpers/getPrototypeOf"),s=require("@babel/runtime/helpers/defineProperty"),o=require("react"),f=require("./pop-8f3d8837.js"),c=require("./link-27893881.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("./animation-ebe42adf.js"),require("@babel/runtime/helpers/slicedToArray"),require("./events-d2682977.js"),require("@babel/runtime/helpers/typeof");var m=p(r),b=p(t),h=p(n),d=p(a),v=p(i),y=p(l),q=p(u),A=p(s),j=p(o),k=["levels","animations"];function C(e){var r=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 t,n=q.default(e);if(r){var a=q.default(this).constructor;t=Reflect.construct(n,arguments,a)}else t=n.apply(this,arguments);return y.default(this,t)}}var P=function(r){v.default(n,r);var t=C(n);function n(e){var r;return h.default(this,n),(r=t.call(this,e)).levels=r.props.levels,r.animations=c.padArray(r.props.animations,r.levels),r}return d.default(n,[{key:"makeAnimatable",value:function(r){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(n<1||o.Children.count(r)<1)return r;var a=this.props;a.levels,a.animations;var i=b.default(a,k),l=this.animations[this.levels-n];return n===this.levels&&(i.ref=function(e){return t.animatable=e}),j.default.createElement(e.Animatable,m.default({},i,{animate:l}),o.Children.map(r,(function(e){return o.isValidElement(e)?o.cloneElement(e,{},t.makeAnimatable(e.props.children,n-1)):e})))}},{key:"play",value:function(){var e;null===(e=this.animatable)||void 0===e||e.play.apply(e,arguments)}},{key:"render",value:function(){return this.makeAnimatable(this.props.children,this.levels)}}]),n}(o.Component);A.default(P,"defaultProps",{levels:1,animations:[f.Move,f.Pop]}),exports.Animatable=e.Animatable,exports.Animate=P;
@@ -1 +1 @@
1
- import t from"@babel/runtime/helpers/classCallCheck";import e from"@babel/runtime/helpers/createClass";import r from"@babel/runtime/helpers/inherits";import n from"@babel/runtime/helpers/possibleConstructorReturn";import i from"@babel/runtime/helpers/getPrototypeOf";import o from"@babel/runtime/helpers/defineProperty";import{Children as a,isValidElement as s,cloneElement as l,Component as c}from"react";import{A as u,C as h}from"./animation-bac0209f.js";import{g as f,D as p,m as y,i as m,a as v,o as d,b as g,A as b,M as w,t as k,c as O,d as j}from"./link-90f1fd43.js";import{a as A,o as x,r as S,b as P}from"./events-7937206b.js";function I(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return D(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return D(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},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,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function D(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var E=function(){function r(){t(this,r),this.t=Date.now(),this.managers=[],this.step()}return e(r,[{key:"step",value:function(){var t,e=Date.now(),r=I(this.managers);try{for(r.s();!(t=r.n()).done;){t.value.step((e-this.t)/1e3)}}catch(t){r.e(t)}finally{r.f()}this.t=e,requestAnimationFrame(this.step.bind(this))}},{key:"add",value:function(t){var e=Math.max(this.managers.findIndex((function(e){return e.priority>=t.priority})),0);this.managers.splice(e,0,t)}},{key:"remove",value:function(t){this.managers.splice(this.managers.indexOf(t),1)}}],[{key:"get",value:function(){return window.Lively||(window.Lively=new r),window.Lively}}]),r}();function M(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return L(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return L(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},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,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function L(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var R=function(){function r(e,n,i){t(this,r),this.element=e,this.tracks=[],this.queue=[],this.playing=!0,this.culling=n,this.layout=i,this.transforms=["translate","scale","skew","rotate"]}return e(r,[{key:"purge",value:function(){if(!("cache"in this.element)){this.element.cache={strokeDasharray:1,borderRadius:f(this.element,"borderRadius")};for(var t=0;t<this.element.style.length;t++){var e=this.element.style[t];this.element.cache[e]=this.element.style[e]}}for(var r in this.element.style={},this.element.cache)this.element.style[r]=this.element.cache[r]}},{key:"clear",value:function(){this.tracks=[],this.queue=[]}},{key:"add",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.immediate,n=void 0!==r&&r,i=e.composite,o=void 0===i||i;n&&this.clear(),o||!this.tracks.length?this.tracks.push(t):this.queue.push(t)}},{key:"remove",value:function(t){this.tracks.splice(this.tracks.indexOf(t),1),!this.tracks.length&&this.queue.length&&this.tracks.push(this.queue.shift())}},{key:"step",value:function(t){if(this.playing){for(var e=this.element.correction?{scale:p.scale}:{},r=this.tracks.length+ +!this.channel.isEmpty,n=0;n<r;n++){var i=this.tracks[n]||this.channel;y(e,i.get(this.element,this.culling)),i.step(t)&&this.remove(i)}this.apply(this.element,e)}}},{key:"apply",value:function(t,e){if(!m.empty(e)){var r=[];for(var n in e){var i=e[n];if("scale"==n){if(this.layout){var o,a={x:[1/i.x[0],i.x[1]],y:[1/i.y[0],i.y[1]]},s=M(t.children);try{for(s.s();!(o=s.n()).done;){o.value.correction=a}}catch(t){s.e(t)}finally{s.f()}var l=e.borderRadius||t.cache.borderRadius;delete e.borderRadius,t.style.borderRadius="".concat(l[0]/i.x[0]).concat(l[1]," / ").concat(l[0]/i.y[0]).concat(l[1])}t.correction&&(i=v(i,t.correction,w.scale))}var c=this.transforms.indexOf(n);c>=0?r[c]="".concat(n,"(").concat(m.object(i)?d(i,", ",["x","y"]):g(i),")"):(n=b[n]||n,m.color(i)?t.style[n]="rgba(".concat(i.r[0],", ").concat(i.g[0],", ").concat(i.b[0],", ").concat(i.a[0],")"):t.style[n]=n in b?b[n](i):g(i))}(r=r.filter((function(t){return!!t}))).length&&(t.style.transform=r.join(" "))}}},{key:"initialize",value:function(t){this.apply(this.element,t.initials),this.channel=t.channel}}]),r}();function C(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function V(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?C(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):C(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function B(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return U(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return U(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},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,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function U(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var T=function(){function r(e){var n=e.priority,i=void 0===n?0:n,o=e.stagger,a=void 0===o?.1:o,s=e.culling,l=void 0===s||s,c=e.noDeform,u=void 0!==c&&c,h=e.paused,f=void 0!==h&&h;t(this,r),this.targets=[],this.priority=i,this.stagger=a,this.culling=l,this.noDeform=u,this.paused=f}return e(r,[{key:"register",value:function(){E.get().add(this)}},{key:"destroy",value:function(){this.targets=[],E.get().remove(this)}},{key:"purge",value:function(){var t,e=B(this.targets);try{for(e.s();!(t=e.n()).done;){t.value.purge()}}catch(t){e.e(t)}finally{e.f()}}},{key:"clear",value:function(){var t,e=B(this.targets);try{for(e.s();!(t=e.n()).done;){t.value.clear()}}catch(t){e.e(t)}finally{e.f()}}},{key:"set",value:function(t){var e=this;this.targets=t.map((function(t){return new R(t,e.culling,e.noDeform)}))}},{key:"play",value:function(t,e){if(!t.isEmpty)for(var r=0;r<this.targets.length;r++){var n=V(V({},e),{},{delay:(e.delay||0)+r*this.stagger});this.targets[r].add(t.play(n),e)}}},{key:"initialize",value:function(t){var e,r=B(this.targets);try{for(r.s();!(e=r.n()).done;){e.value.initialize(t)}}catch(t){r.e(t)}finally{r.f()}}},{key:"step",value:function(t){if(!this.paused){var e,r=B(this.targets);try{for(r.s();!(e=r.n()).done;){e.value.step(t)}}catch(t){r.e(t)}finally{r.f()}}}}]),r}();function q(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function z(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?q(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):q(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function $(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return F(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return F(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},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,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function F(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function H(t){var e=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(t){return!1}}();return function(){var r,o=i(t);if(e){var a=i(this).constructor;r=Reflect.construct(o,arguments,a)}else r=o.apply(this,arguments);return n(this,r)}}var N=function(n){r(o,c);var i=H(o);function o(e){var r;for(var n in t(this,o),(r=i.call(this,e)).animations={default:r.parse(r.props.animate||{})},r.props.animations||{})r.animations[n]=r.parse(r.props.animations[n]);return r.children=[],r.elements=[],r.stagger=r.props.stagger||.1,r.manager=new T({priority:r.props.group,stagger:r.stagger,culling:r.props.lazy,noDeform:r.props.noDeform,paused:r.props.paused}),r}return e(o,[{key:"parse",value:function(t){return u.isInstance(t)?t.use():m.object(t)?new h(t,this.props.initial):null}},{key:"update",value:function(){this.manager.clear(),this.manager.purge(),this.manager.initialize(this.animations.default)}},{key:"componentDidMount",value:function(){var t=this;this.scrollEventListener=k(this.onScroll.bind(this)),A("scroll",this.scrollEventListener),this.eventListener=this.onEvent.bind(this),x(o.events,this.elements,this.eventListener),this.manager.set(this.elements),this.manager.register(),this.update(),document.fonts.ready.then((function(){t.update(),clearTimeout(t.timeout),t.inViewport=!1,t.props.group||(t.play(t.props.onMount),t.onScroll())}))}},{key:"componentWillUnmount",value:function(){S("scroll",this.scrollEventListener),P(o.events,this.elements,this.eventListener),this.manager.destroy()}},{key:"componentDidUpdate",value:function(){this.manager.paused=this.props.paused;var t,e=$(this.children);try{for(e.s();!(t=e.n()).done;){t.value.manager.paused=this.props.paused}}catch(t){e.e(t)}finally{e.f()}}},{key:"dispatch",value:function(t){m.function(this.props[t])&&this.props[t]()}},{key:"onEvent",value:function(t){switch(t.type){case"click":this.play(this.props.onClick);break;case"mouseenter":this.hover||(this.hover=!0,this.play(this.props.whileHover));break;case"mouseleave":this.hover&&(this.hover=!1,this.play(this.props.whileHover,{reverse:!0}));break;case"focus":this.focus||(this.focus=!0,this.play(this.props.whileFocus));break;case"blur":this.focus&&(this.focus=!1,this.play(this.props.whileFocus,{reverse:!0}))}}},{key:"getBoundingBox",value:function(){var t,e={x:Number.MAX_VALUE,y:Number.MAX_VALUE,right:0,bottom:0},r=$(this.elements.length?this.elements:this.children);try{for(r.s();!(t=r.n()).done;){var n=t.value,i=this.elements.length?n.getBoundingClientRect():n.getBoundingBox();e.y=Math.min(i.y,e.y),e.x=Math.min(i.x,e.x),e.right=Math.max(i.right,e.right),e.bottom=Math.max(i.bottom,e.bottom)}}catch(t){r.e(t)}finally{r.f()}return e}},{key:"onScroll",value:function(){if(this.props.whileViewport){var t=O(this.getBoundingBox(),this.props.viewportMargin),e=t.entered,r=t.left;e&&!this.inViewport&&(this.inViewport=!0,this.play(this.props.whileViewport),this.dispatch("onEnterViewport")),r&&this.inViewport&&(this.inViewport=!1,this.play(this.props.whileViewport,{reverse:!0,immediate:!0}),this.dispatch("onLeaveViewport"))}}},{key:"play",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.reverse,i=void 0!==n&&n,o=r.composite,a=void 0!==o&&o,s=r.immediate,l=void 0!==s&&s,c=r.delay,u=void 0===c?0:c,h=r.callback,f=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!(!t||this.props.disabled||this.props.group>0&&!f)){m.string(t)||(t="default"),this.dispatch("onAnimationStart");var p,y=this.animations[t],v=y.length(),d=0,g=$(this.children);try{for(g.s();!(p=g.n()).done;){var b=p.value;d=Math.max(d,b.play(t,{reverse:i,immediate:l,delay:u+v},!0))}}catch(t){g.e(t)}finally{g.f()}return this.manager.play(y,{reverse:i,composite:a,immediate:l,delay:i?d:u}),l&&clearTimeout(this.timeout),this.props.group||(this.timeout=setTimeout((function(){e.dispatch("onAnimationEnd"),m.function(h)&&h()}),1e3*(d+v))),v+(i?d:u)}}},{key:"stop",value:function(){this.manager.clear()}},{key:"prerender",value:function(t){var e=this,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return a.map(t,(function(t){if(!s(t))return t;var i={pathLength:1},a=e.elementIndex++;if(r&&(i.ref=function(t){return e.elements[a]=t}),o.isInstance(t)&&n&&!t.props.noCascade){var c=e.childIndex++;n=!1,i.group=e.props.group+1,i.ref=function(t){return e.children[c]=t},e.props.group||(i.active=e.props.active),j(i,z(z({},e.props),t.props),e.constructor.cascadingProps)}return l(t,i,e.prerender(t.props.children,!1,n))}))}},{key:"render",value:function(){return this.elementIndex=this.childIndex=0,this.prerender(this.props.children)}}],[{key:"isInstance",value:function(t){return t.type===o||t.type.prototype instanceof o}}]),o}();o(N,"events",["click","mouseenter","mouseleave","focus","blur"]),o(N,"cascadingProps",["animate","initial","animations","stagger"]),o(N,"defaultProps",{group:0,viewportMargin:.75,lazy:!0,paused:!1});export{N as A};
1
+ import t from"@babel/runtime/helpers/classCallCheck";import e from"@babel/runtime/helpers/createClass";import r from"@babel/runtime/helpers/inherits";import n from"@babel/runtime/helpers/possibleConstructorReturn";import i from"@babel/runtime/helpers/getPrototypeOf";import o from"@babel/runtime/helpers/defineProperty";import{Children as a,isValidElement as s,cloneElement as l,Component as c}from"react";import{A as u,C as h}from"./animation-bac0209f.js";import{g as f,D as p,m as y,i as m,a as v,o as d,b as g,A as b,M as w,t as k,c as O,d as j}from"./link-90f1fd43.js";import{a as A,o as x,r as S,b as P}from"./events-7937206b.js";function I(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return D(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return D(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},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,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function D(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var E=function(){function r(){t(this,r),this.t=Date.now(),this.managers=[],this.step()}return e(r,[{key:"step",value:function(){var t,e=Date.now(),r=I(this.managers);try{for(r.s();!(t=r.n()).done;){t.value.step((e-this.t)/1e3)}}catch(t){r.e(t)}finally{r.f()}this.t=e,requestAnimationFrame(this.step.bind(this))}},{key:"add",value:function(t){var e=Math.max(this.managers.findIndex((function(e){return e.priority>=t.priority})),0);this.managers.splice(e,0,t)}},{key:"remove",value:function(t){this.managers.splice(this.managers.indexOf(t),1)}}],[{key:"get",value:function(){return window.Lively||(window.Lively=new r),window.Lively}}]),r}();function M(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return L(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return L(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},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,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function L(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var R=function(){function r(e,n,i){t(this,r),this.element=e,this.tracks=[],this.queue=[],this.playing=!0,this.culling=n,this.layout=i,this.transforms=["translate","scale","skew","rotate"]}return e(r,[{key:"purge",value:function(){if(!("cache"in this.element)){this.element.cache={strokeDasharray:1,borderRadius:f(this.element,"borderRadius")};for(var t=0;t<this.element.style.length;t++){var e=this.element.style[t];this.element.cache[e]=this.element.style[e]}}for(var r in this.element.style={},this.element.cache)this.element.style[r]=this.element.cache[r]}},{key:"clear",value:function(){this.tracks=[],this.queue=[]}},{key:"add",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.immediate,n=void 0!==r&&r,i=e.composite,o=void 0===i||i;n&&this.clear(),o||!this.tracks.length?this.tracks.push(t):this.queue.push(t)}},{key:"remove",value:function(t){this.tracks.splice(this.tracks.indexOf(t),1),!this.tracks.length&&this.queue.length&&this.tracks.push(this.queue.shift())}},{key:"step",value:function(t){if(this.playing){for(var e=this.element.correction?{scale:p.scale}:{},r=this.tracks.length+ +!this.channel.isEmpty,n=0;n<r;n++){var i=this.tracks[n]||this.channel;y(e,i.get(this.element,this.culling)),i.step(t)&&this.remove(i)}this.apply(this.element,e)}}},{key:"apply",value:function(t,e){if(!m.empty(e)){var r=[];for(var n in e){var i=e[n];if("scale"==n){if(this.layout){var o,a={x:[1/i.x[0],i.x[1]],y:[1/i.y[0],i.y[1]]},s=M(t.children);try{for(s.s();!(o=s.n()).done;){o.value.correction=a}}catch(t){s.e(t)}finally{s.f()}var l=e.borderRadius||t.cache.borderRadius;delete e.borderRadius,t.style.borderRadius="".concat(l[0]/i.x[0]).concat(l[1]," / ").concat(l[0]/i.y[0]).concat(l[1])}t.correction&&(i=v(i,t.correction,w.scale))}var c=this.transforms.indexOf(n);c>=0?r[c]="".concat(n,"(").concat(m.object(i)?d(i,", ",["x","y"]):g(i),")"):(n=b[n]||n,m.color(i)?t.style[n]="rgba(".concat(i.r[0],", ").concat(i.g[0],", ").concat(i.b[0],", ").concat(i.a[0],")"):t.style[n]=n in b?b[n](i):g(i))}(r=r.filter((function(t){return!!t}))).length&&(t.style.transform=r.join(" "))}}},{key:"initialize",value:function(t){this.apply(this.element,t.initials),this.channel=t.channel}}]),r}();function C(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function V(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?C(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):C(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function B(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return U(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return U(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},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,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function U(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var T=function(){function r(e){var n=e.priority,i=void 0===n?0:n,o=e.stagger,a=void 0===o?.1:o,s=e.culling,l=void 0===s||s,c=e.noDeform,u=void 0!==c&&c,h=e.paused,f=void 0!==h&&h;t(this,r),this.targets=[],this.priority=i,this.stagger=a,this.culling=l,this.noDeform=u,this.paused=f}return e(r,[{key:"register",value:function(){E.get().add(this)}},{key:"destroy",value:function(){this.targets=[],E.get().remove(this)}},{key:"purge",value:function(){var t,e=B(this.targets);try{for(e.s();!(t=e.n()).done;){t.value.purge()}}catch(t){e.e(t)}finally{e.f()}}},{key:"clear",value:function(){var t,e=B(this.targets);try{for(e.s();!(t=e.n()).done;){t.value.clear()}}catch(t){e.e(t)}finally{e.f()}}},{key:"set",value:function(t){var e=this;this.targets=t.map((function(t){return new R(t,e.culling,e.noDeform)}))}},{key:"play",value:function(t,e){if(!t.isEmpty)for(var r=0;r<this.targets.length;r++){var n=V(V({},e),{},{delay:(e.delay||0)+r*this.stagger});this.targets[r].add(t.play(n),e)}}},{key:"initialize",value:function(t){var e,r=B(this.targets);try{for(r.s();!(e=r.n()).done;){e.value.initialize(t)}}catch(t){r.e(t)}finally{r.f()}}},{key:"step",value:function(t){if(!this.paused){var e,r=B(this.targets);try{for(r.s();!(e=r.n()).done;){e.value.step(t)}}catch(t){r.e(t)}finally{r.f()}}}}]),r}();function q(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function z(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?q(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):q(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function $(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return F(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return F(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},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,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function F(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function H(t){var e=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(t){return!1}}();return function(){var r,o=i(t);if(e){var a=i(this).constructor;r=Reflect.construct(o,arguments,a)}else r=o.apply(this,arguments);return n(this,r)}}var N=function(n){r(o,c);var i=H(o);function o(e){var r;for(var n in t(this,o),(r=i.call(this,e)).animations={default:r.parse(r.props.animate||{})},r.props.animations||{})r.animations[n]=r.parse(r.props.animations[n]);return r.children=[],r.elements=[],r.stagger=r.props.stagger||.1,r.manager=new T({priority:r.props.group,stagger:r.stagger,culling:r.props.lazy,noDeform:r.props.noDeform,paused:r.props.paused}),r}return e(o,[{key:"parse",value:function(t){return u.isInstance(t)?t.use():m.object(t)?new h(t,this.props.initial):null}},{key:"update",value:function(){this.manager.clear(),this.manager.purge(),this.manager.initialize(this.animations.default)}},{key:"componentDidMount",value:function(){var t=this;this.scrollEventListener=k(this.onScroll.bind(this)),A("scroll",this.scrollEventListener),this.eventListener=this.onEvent.bind(this),x(o.events,this.elements,this.eventListener),this.manager.set(this.elements),this.manager.register(),this.update(),document.fonts.ready.then((function(){t.update(),clearTimeout(t.timeout),t.inViewport=!1,t.props.group||(t.play(t.props.onMount),t.onScroll())}))}},{key:"componentWillUnmount",value:function(){S("scroll",this.scrollEventListener),P(o.events,this.elements,this.eventListener),this.manager.destroy()}},{key:"componentDidUpdate",value:function(){this.manager.paused=this.props.paused;var t,e=$(this.children);try{for(e.s();!(t=e.n()).done;){t.value.manager.paused=this.props.paused}}catch(t){e.e(t)}finally{e.f()}}},{key:"dispatch",value:function(t){m.function(this.props[t])&&this.props[t]()}},{key:"onEvent",value:function(t){switch(t.type){case"click":this.play(this.props.onClick);break;case"mouseenter":this.hover||(this.hover=!0,this.play(this.props.whileHover));break;case"mouseleave":this.hover&&(this.hover=!1,this.play(this.props.whileHover,{reverse:!0}));break;case"focus":this.focus||(this.focus=!0,this.play(this.props.whileFocus));break;case"blur":this.focus&&(this.focus=!1,this.play(this.props.whileFocus,{reverse:!0}))}}},{key:"getBoundingBox",value:function(){var t,e={x:Number.MAX_VALUE,y:Number.MAX_VALUE,right:0,bottom:0},r=$(this.elements.length?this.elements:this.children);try{for(r.s();!(t=r.n()).done;){var n=t.value,i=this.elements.length?n.getBoundingClientRect():n.getBoundingBox();e.y=Math.min(i.y,e.y),e.x=Math.min(i.x,e.x),e.right=Math.max(i.right,e.right),e.bottom=Math.max(i.bottom,e.bottom)}}catch(t){r.e(t)}finally{r.f()}return e}},{key:"onScroll",value:function(){if(this.props.whileViewport){var t=O(this.getBoundingBox(),this.props.viewportMargin),e=t.entered,r=t.left;e&&!this.inViewport&&(this.inViewport=!0,this.play(this.props.whileViewport),this.dispatch("onEnterViewport")),r&&this.inViewport&&(this.inViewport=!1,this.play(this.props.whileViewport,{reverse:!0,immediate:!0}),this.dispatch("onLeaveViewport"))}}},{key:"play",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.reverse,i=void 0!==n&&n,o=r.composite,a=void 0!==o&&o,s=r.immediate,l=void 0!==s&&s,c=r.delay,u=void 0===c?0:c,h=r.callback,f=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!(!t||this.props.disabled||this.props.group>0&&!f)){m.string(t)||(t="default"),this.dispatch("onAnimationStart");var p,y=this.animations[t],v=y.length(),d=0,g=$(this.children);try{for(g.s();!(p=g.n()).done;){var b=p.value;d=Math.max(d,b.play(t,{reverse:i,immediate:l,delay:u+v},!0))}}catch(t){g.e(t)}finally{g.f()}return this.manager.play(y,{reverse:i,composite:a,immediate:l,delay:i?d:u}),l&&clearTimeout(this.timeout),this.props.group||(this.timeout=setTimeout((function(){e.dispatch("onAnimationEnd"),m.function(h)&&h()}),1e3*(d+v))),v+(i?d:u)}}},{key:"stop",value:function(){this.manager.clear()}},{key:"prerender",value:function(t){var e=this,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return a.map(t,(function(t){if(!s(t))return t;var i={pathLength:1};if(r){var a=e.elementIndex++;i.ref=function(t){return e.elements[a]=t}}if(o.isInstance(t)&&n&&!t.props.noCascade){var c=e.childIndex++;n=!1,i.group=e.props.group+1,i.ref=function(t){return e.children[c]=t},e.props.group||(i.active=e.props.active),j(i,z(z({},e.props),t.props),e.constructor.cascadingProps)}return l(t,i,e.prerender(t.props.children,!1,n))}))}},{key:"render",value:function(){return this.elementIndex=this.childIndex=0,this.prerender(this.props.children)}}],[{key:"isInstance",value:function(t){return t.type===o||t.type.prototype instanceof o}}]),o}();o(N,"events",["click","mouseenter","mouseleave","focus","blur"]),o(N,"cascadingProps",["animate","initial","animations","stagger"]),o(N,"defaultProps",{group:0,viewportMargin:.75,lazy:!0,paused:!1});export{N as A};
package/dist/esm/auto.js CHANGED
@@ -1 +1 @@
1
- import t from"@babel/runtime/helpers/classCallCheck";import e 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 l}from"./animatable-0e21f2b4.js";import u,{isValidElement as s,Children as c,cloneElement as p,Component as f,useRef as h}from"react";import{s as m,k as d,i as y,l as v}from"./link-90f1fd43.js";import{C as b,c as g}from"./animation-bac0209f.js";import O from"@babel/runtime/helpers/toConsumableArray";import{u as w}from"./scroll-1f98b7cf.js";import"./events-7937206b.js";import"@babel/runtime/helpers/typeof";import"@babel/runtime/helpers/slicedToArray";import"@babel/runtime/helpers/objectWithoutProperties";function j(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function P(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?j(Object(r),!0).forEach((function(e){a(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function k(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return E(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return E(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},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,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){l=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw o}}}}function E(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function x(t){var e=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(t){return!1}}();return function(){var r,n=o(t);if(e){var a=o(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return i(this,r)}}var R={},A=function(i){n(u,l);var a=x(u);function u(e){var r;return t(this,u),(r=a.call(this,e)).animations={default:new b({},{opacity:+e.active,pointerEvents:e.active?"":"none"}),unmorph:new b({},{opacity:0,pointerEvents:"none"})},r.properties=m(r.props.include,r.props.exclude),r.uuid=(e.id||0)+e.group.toString(),r}return e(u,[{key:"shouldComponentUpdate",value:function(t){return this.props.active!==t.active&&(this.uuid in R?R[this.uuid].push(this):R[this.uuid]=[this]),this.props.active!==t.active}},{key:"getSnapshotBeforeUpdate",value:function(t){if(this.props.active!==t.active&&this.props.active){var e,r=k(R[this.uuid]);try{for(r.s();!(e=r.n()).done;){var n=e.value;if(n!==this)return d(n.elements[0],this.props.group)}}catch(t){r.e(t)}finally{r.f()}}return null}},{key:"componentDidUpdate",value:function(t,e,n){if(r(o(u.prototype),"componentDidUpdate",this).call(this),R[this.uuid]=[],n){var i=d(this.elements[0],this.props.group);i.opacity=1,i.pointerEvents="",this.manager.play(g(i,n,this.properties,this.props.duration),{composite:!0})}else this.manager.initialize(this.animations.unmorph)}},{key:"render",value:function(){var t=this.props.children;if(y.array(t)){if(t.length>1)return t;t=t[0]}return s(t)?r(o(u.prototype),"render",this).call(this):t}}]),u}();function C(t){var e=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(t){return!1}}();return function(){var r,n=o(t);if(e){var a=o(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return i(this,r)}}a(A,"cascadingProps",["id","duration"]),a(A,"defaultProps",P(P({},l.defaultProps),{},{active:!1,include:v,exclude:[]}));var S=function(r){n(o,f);var i=C(o);function o(e){var r;return t(this,o),(r=i.call(this,e)).children=[],r.properties=m(r.props.include,r.props.exclude),r}return e(o,[{key:"getSnapshotBeforeUpdate",value:function(){return this.children.map((function(t){var e=null==t?void 0:t.elements[0];return e?{data:d(e),key:t.props.layoutKey}:null}))}},{key:"componentDidUpdate",value:function(t,e,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 l=d(o.elements[0]);o.manager.play(g(l,a.data,this.properties,this.props.duration),{composite:!0})}else i--}}}},{key:"render",value:function(){var t=this;return this.childIndex=0,c.map(this.props.children,(function(e){if(!s(e)||!l.isInstance(e))return e;var r=t.childIndex++;return p(e,{ref:function(e){return t.children[r]=e},layoutKey:e.key})}))}}]),o}();function B(t){var e=t.children,r=t.className,n=t.style,i=t.duration;if(!y.string(e))return e;var o=e.split("");return u.createElement("div",{className:r,style:n},u.createElement(l,{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(t,e){return u.createElement("span",{style:{display:"inline-block"},key:e},/\s/.test(t)?" ":t)}))))}function D(t){var e,r=t.children,n=t.color,i=t.duration,o=(null===(e=r.props)||void 0===e?void 0:e.children)||[];Array.isArray(o)||(o=[o]);var a=[u.createElement(l,{key:0,initial:{clip:{right:0}},animate:{clip:{left:1},duration:i/2}},u.createElement("div",{style:{position:"absolute",inset:0,backgroundColor:n}}))].concat(O(o));return u.createElement(l,{whileViewport:!0,animate:{clip:{right:0},duration:i/2},initial:{clip:{right:1}}},p(r,{},a))}function U(t){var e,r=t.children,n=t.amount,i=w(),o=h();return u.createElement(l,{ref:o,animate:{translate:i((function(t){if(void 0===e){var r,i=null===(r=o.current)||void 0===r?void 0:r.elements[0];i&&(e=Math.max(i.getBoundingClientRect().y+window.scrollY-window.innerHeight/2,0))}return{x:0,y:(t-(e||0))*n}}))}},r)}a(S,"defaultProps",{include:v,exclude:[]}),B.defaultProps={style:{},className:"",duration:1.6},D.defaultProps={color:"grey",duration:1.6},U.defaultProps={amount:.5};export{D as ColorWipe,S as LayoutGroup,A as Morph,U as Parallax,B as WriteOn};
1
+ import t from"@babel/runtime/helpers/classCallCheck";import e 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 l}from"./animatable-8501cb4c.js";import u,{isValidElement as s,Children as c,cloneElement as p,Component as f,useRef as h}from"react";import{s as m,k as d,i as y,l as v}from"./link-90f1fd43.js";import{C as b,c as g}from"./animation-bac0209f.js";import O from"@babel/runtime/helpers/toConsumableArray";import{u as w}from"./scroll-1f98b7cf.js";import"./events-7937206b.js";import"@babel/runtime/helpers/typeof";import"@babel/runtime/helpers/slicedToArray";import"@babel/runtime/helpers/objectWithoutProperties";function j(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function P(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?j(Object(r),!0).forEach((function(e){a(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function k(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return E(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return E(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},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,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){l=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw o}}}}function E(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function x(t){var e=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(t){return!1}}();return function(){var r,n=o(t);if(e){var a=o(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return i(this,r)}}var R={},A=function(i){n(u,l);var a=x(u);function u(e){var r;return t(this,u),(r=a.call(this,e)).animations={default:new b({},{opacity:+e.active,pointerEvents:e.active?"":"none"}),unmorph:new b({},{opacity:0,pointerEvents:"none"})},r.properties=m(r.props.include,r.props.exclude),r.uuid=(e.id||0)+e.group.toString(),r}return e(u,[{key:"shouldComponentUpdate",value:function(t){return this.props.active!==t.active&&(this.uuid in R?R[this.uuid].push(this):R[this.uuid]=[this]),this.props.active!==t.active}},{key:"getSnapshotBeforeUpdate",value:function(t){if(this.props.active!==t.active&&this.props.active){var e,r=k(R[this.uuid]);try{for(r.s();!(e=r.n()).done;){var n=e.value;if(n!==this)return d(n.elements[0],this.props.group)}}catch(t){r.e(t)}finally{r.f()}}return null}},{key:"componentDidUpdate",value:function(t,e,n){if(r(o(u.prototype),"componentDidUpdate",this).call(this),R[this.uuid]=[],n){var i=d(this.elements[0],this.props.group);i.opacity=1,i.pointerEvents="",this.manager.play(g(i,n,this.properties,this.props.duration),{composite:!0})}else this.manager.initialize(this.animations.unmorph)}},{key:"render",value:function(){var t=this.props.children;if(y.array(t)){if(t.length>1)return t;t=t[0]}return s(t)?r(o(u.prototype),"render",this).call(this):t}}]),u}();function C(t){var e=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(t){return!1}}();return function(){var r,n=o(t);if(e){var a=o(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return i(this,r)}}a(A,"cascadingProps",["id","duration"]),a(A,"defaultProps",P(P({},l.defaultProps),{},{active:!1,include:v,exclude:[]}));var S=function(r){n(o,f);var i=C(o);function o(e){var r;return t(this,o),(r=i.call(this,e)).children=[],r.properties=m(r.props.include,r.props.exclude),r}return e(o,[{key:"getSnapshotBeforeUpdate",value:function(){return this.children.map((function(t){var e=null==t?void 0:t.elements[0];return e?{data:d(e),key:t.props.layoutKey}:null}))}},{key:"componentDidUpdate",value:function(t,e,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 l=d(o.elements[0]);o.manager.play(g(l,a.data,this.properties,this.props.duration),{composite:!0})}else i--}}}},{key:"render",value:function(){var t=this;return this.childIndex=0,c.map(this.props.children,(function(e){if(!s(e)||!l.isInstance(e))return e;var r=t.childIndex++;return p(e,{ref:function(e){return t.children[r]=e},layoutKey:e.key})}))}}]),o}();function B(t){var e=t.children,r=t.className,n=t.style,i=t.duration;if(!y.string(e))return e;var o=e.split("");return u.createElement("div",{className:r,style:n},u.createElement(l,{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(t,e){return u.createElement("span",{style:{display:"inline-block"},key:e},/\s/.test(t)?" ":t)}))))}function D(t){var e,r=t.children,n=t.color,i=t.duration,o=(null===(e=r.props)||void 0===e?void 0:e.children)||[];Array.isArray(o)||(o=[o]);var a=[u.createElement(l,{key:0,initial:{clip:{right:0}},animate:{clip:{left:1},duration:i/2}},u.createElement("div",{style:{position:"absolute",inset:0,backgroundColor:n}}))].concat(O(o));return u.createElement(l,{whileViewport:!0,animate:{clip:{right:0},duration:i/2},initial:{clip:{right:1}}},p(r,{},a))}function U(t){var e,r=t.children,n=t.amount,i=w(),o=h();return u.createElement(l,{ref:o,animate:{translate:i((function(t){if(void 0===e){var r,i=null===(r=o.current)||void 0===r?void 0:r.elements[0];i&&(e=Math.max(i.getBoundingClientRect().y+window.scrollY-window.innerHeight/2,0))}return{x:0,y:(t-(e||0))*n}}))}},r)}a(S,"defaultProps",{include:v,exclude:[]}),B.defaultProps={style:{},className:"",duration:1.6},D.defaultProps={color:"grey",duration:1.6},U.defaultProps={amount:.5};export{D as ColorWipe,S as LayoutGroup,A as Morph,U as Parallax,B 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-90f1fd43.js";export{u as useScroll}from"./scroll-1f98b7cf.js";import"@babel/runtime/helpers/typeof";import"@babel/runtime/helpers/defineProperty";import"./events-7937206b.js";function c(n){var o=e(n),u=r(o,2),i=u[0],c=u[1],a=t();return[i,function(){if(!i)return c(!0);a.current.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 f(){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 m(){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,f as usePath,m 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";import{L as i}from"./link-90f1fd43.js";export{u as useScroll}from"./scroll-1f98b7cf.js";import"@babel/runtime/helpers/typeof";import"@babel/runtime/helpers/defineProperty";import"./events-7937206b.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 f(){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 m(){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,f as usePath,m as useReducedMotion,c as useUnmount};
package/dist/esm/index.js CHANGED
@@ -1 +1 @@
1
- import{A as e}from"./animatable-0e21f2b4.js";export{A as Animatable}from"./animatable-0e21f2b4.js";import t from"@babel/runtime/helpers/extends";import r from"@babel/runtime/helpers/objectWithoutProperties";import n from"@babel/runtime/helpers/classCallCheck";import i from"@babel/runtime/helpers/createClass";import a from"@babel/runtime/helpers/inherits";import o from"@babel/runtime/helpers/possibleConstructorReturn";import l from"@babel/runtime/helpers/getPrototypeOf";import s from"@babel/runtime/helpers/defineProperty";import m,{Children as p,isValidElement as u,cloneElement as f,Component as c}from"react";import{M as b,P as h}from"./pop-8a2462ca.js";import{p as v}from"./link-90f1fd43.js";import"./animation-bac0209f.js";import"@babel/runtime/helpers/slicedToArray";import"./events-7937206b.js";import"@babel/runtime/helpers/typeof";var y=["levels","animations"];function d(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=l(e);if(t){var i=l(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return o(this,r)}}var k=function(o){a(s,c);var l=d(s);function s(e){var t;return n(this,s),(t=l.call(this,e)).levels=t.props.levels,t.animations=v(t.props.animations,t.levels),t}return i(s,[{key:"makeAnimatable",value:function(n){var i=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(a<1||p.count(n)<1)return n;var o=this.props;o.levels,o.animations;var l=r(o,y),s=this.animations[this.levels-a];return a===this.levels&&(l.ref=function(e){return i.animatable=e}),m.createElement(e,t({},l,{animate:s}),p.map(n,(function(e){return u(e)?f(e,{},i.makeAnimatable(e.props.children,a-1)):e})))}},{key:"play",value:function(){var e;null===(e=this.animatable)||void 0===e||e.play(arguments)}},{key:"render",value:function(){return this.makeAnimatable(this.props.children,this.levels)}}]),s}();s(k,"defaultProps",{levels:1,animations:[b,h]});export{k as Animate};
1
+ import{A as e}from"./animatable-8501cb4c.js";export{A as Animatable}from"./animatable-8501cb4c.js";import t from"@babel/runtime/helpers/extends";import r from"@babel/runtime/helpers/objectWithoutProperties";import n from"@babel/runtime/helpers/classCallCheck";import i from"@babel/runtime/helpers/createClass";import a from"@babel/runtime/helpers/inherits";import o from"@babel/runtime/helpers/possibleConstructorReturn";import l from"@babel/runtime/helpers/getPrototypeOf";import s from"@babel/runtime/helpers/defineProperty";import m,{Children as p,isValidElement as u,cloneElement as c,Component as f}from"react";import{M as b,P as h}from"./pop-8a2462ca.js";import{p as v}from"./link-90f1fd43.js";import"./animation-bac0209f.js";import"@babel/runtime/helpers/slicedToArray";import"./events-7937206b.js";import"@babel/runtime/helpers/typeof";var y=["levels","animations"];function d(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=l(e);if(t){var i=l(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return o(this,r)}}var k=function(o){a(s,f);var l=d(s);function s(e){var t;return n(this,s),(t=l.call(this,e)).levels=t.props.levels,t.animations=v(t.props.animations,t.levels),t}return i(s,[{key:"makeAnimatable",value:function(n){var i=this,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(a<1||p.count(n)<1)return n;var o=this.props;o.levels,o.animations;var l=r(o,y),s=this.animations[this.levels-a];return a===this.levels&&(l.ref=function(e){return i.animatable=e}),m.createElement(e,t({},l,{animate:s}),p.map(n,(function(e){return u(e)?c(e,{},i.makeAnimatable(e.props.children,a-1)):e})))}},{key:"play",value:function(){var e;null===(e=this.animatable)||void 0===e||e.play.apply(e,arguments)}},{key:"render",value:function(){return this.makeAnimatable(this.props.children,this.levels)}}]),s}();s(k,"defaultProps",{levels:1,animations:[b,h]});export{k as Animate};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infinityfx/lively",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Feature complete, lightweight react animation library.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",