@infinityfx/lively 2.1.0 → 2.1.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"),a=require("@babel/runtime/helpers/defineProperty"),o=require("react"),s=require("./animation-06e8c1ee.js"),l=require("./link-b0ac399e.js"),u=require("./events-0c00d6a9.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(a);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 a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}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 a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}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"),webkitBackfaceVisibility:"hidden"};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,a=void 0===i||i;n&&this.clear(),a||!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 a,o={x:[1/i.x[0],i.x[1]],y:[1/i.y[0],i.y[1]]},s=w(e.children);try{for(s.s();!(a=s.n()).done;){a.value.correction=o}}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 a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var E=function(){function e(t){var r=t.priority,n=void 0===r?0:r,i=t.stagger,a=void 0===i?.1:i,o=t.culling,s=void 0===o||o,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=a,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});r<this.targets.length-1&&(n.callback=null),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 a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}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 L=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=l.is.null(n.props.stagger)?.1:n.props.stagger,n.cascade=l.is.null(n.props.cascade)?1:n.props.cascade,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(),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,a=r.composite,o=void 0!==a&&a,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=this.animations[e],d=y.length()*this.cascade,v=f;this.props.group||(f=function(){t.dispatch("onAnimationEnd"),l.is.function(v)&&v()});for(var m=0,g=0;g<this.children.length;g++)m=Math.max(m,this.children[g].play(e,{reverse:i,immediate:u,delay:h+d+this.stagger*g,callback:f},!0));return i&&!this.props.group||!i&&!this.children.length||(f=null),this.manager.play(y,{reverse:i,composite:o,immediate:u,delay:i?m:h,callback:f}),d+(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 o.Children.map(e,(function(e){if(!o.isValidElement(e))return e;var a={pathLength:1};if(n){var s=t.elementIndex++;a.ref=function(e){return t.elements[s]=e}}var u=r.isInstance(e)&&i&&!e.props.stopPropagation;return u&&(a.index=t.childIndex++,a.group=t.props.group+1,a.ref=function(e){return t.children[a.index]=e},t.props.group||(a.active=t.props.active),l.mergeObjects(a,I(I({},t.props),e.props),t.constructor.cascadingProps)),o.cloneElement(e,a,t.prerender(e.props.children,!1,!u))}))}},{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}(o.Component);v.default(L,"events",["click","mouseenter","mouseleave","focus","blur"]),v.default(L,"cascadingProps",["animate","initial","animations","stagger","cascade"]),v.default(L,"defaultProps",{group:0,viewportMargin:.75,lazy:!0,paused:!1}),exports.Animatable=L;
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"),a=require("@babel/runtime/helpers/defineProperty"),o=require("react"),s=require("./animation-7bc99fc6.js"),l=require("./link-b0ac399e.js"),u=require("./events-0c00d6a9.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(a);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 a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}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 a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}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"),webkitBackfaceVisibility:"hidden"};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,a=void 0===i||i;n&&this.clear(),a||!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 a,o={x:[1/i.x[0],i.x[1]],y:[1/i.y[0],i.y[1]]},s=w(e.children);try{for(s.s();!(a=s.n()).done;){a.value.correction=o}}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 a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var E=function(){function e(t){var r=t.priority,n=void 0===r?0:r,i=t.stagger,a=void 0===i?.1:i,o=t.culling,s=void 0===o||o,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=a,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});r<this.targets.length-1&&(n.callback=null),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 a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}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 L=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=l.is.null(n.props.stagger)?.1:n.props.stagger,n.cascade=l.is.null(n.props.cascade)?1:n.props.cascade,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(),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,a=r.composite,o=void 0!==a&&a,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=this.animations[e],d=y.length()*this.cascade,v=f;this.props.group||(f=function(){t.dispatch("onAnimationEnd"),l.is.function(v)&&v()});for(var m=0,g=0;g<this.children.length;g++)m=Math.max(m,this.children[g].play(e,{reverse:i,immediate:u,delay:h+d+this.stagger*g,callback:f},!0));return i&&!this.props.group||!i&&!this.children.length||(f=null),this.manager.play(y,{reverse:i,composite:o,immediate:u,delay:i?m:h,callback:f}),d+(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 o.Children.map(e,(function(e){if(!o.isValidElement(e))return e;var a={pathLength:1};if(n){var s=t.elementIndex++;a.ref=function(e){return t.elements[s]=e}}var u=r.isInstance(e)&&i&&!e.props.stopPropagation;return u&&(a.index=t.childIndex++,a.group=t.props.group+1,a.ref=function(e){return t.children[a.index]=e},t.props.group||(a.active=t.props.active),l.mergeObjects(a,I(I({},t.props),e.props),t.constructor.cascadingProps)),o.cloneElement(e,a,t.prerender(e.props.children,!1,!u))}))}},{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}(o.Component);v.default(L,"events",["click","mouseenter","mouseleave","focus","blur"]),v.default(L,"cascadingProps",["animate","initial","animations","stagger","cascade"]),v.default(L,"defaultProps",{group:0,viewportMargin:.75,lazy:!0,paused:!1}),exports.Animatable=L;
@@ -0,0 +1 @@
1
+ "use strict";var t=require("@babel/runtime/helpers/slicedToArray"),e=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/objectWithoutProperties"),n=require("@babel/runtime/helpers/classCallCheck"),i=require("@babel/runtime/helpers/createClass"),a=require("@babel/runtime/helpers/inherits"),o=require("@babel/runtime/helpers/possibleConstructorReturn"),u=require("@babel/runtime/helpers/getPrototypeOf"),l=require("./link-b0ac399e.js");function s(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var c=s(t),f=s(e),h=s(r),p=s(n),v=s(i),y=s(a),d=s(o),m=s(u);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 g(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 g(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 a,o=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function g(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 O=function t(e,r,n,i){if(l.is.object(e)){var a={};for(var o in e)a[o]=t(e[o],r[o],n,i);return a}return[i(e[0],r[0],n),e[1]]},w=function(t,e,r){return l.is.number(t)&&l.is.number(e)?t*(1-r)+e*r:r>.5?e:t},j={constant:function(t){return t},linear:w,ease:function(t,e,r){return w(t,e,(1-Math.cos(r*Math.PI))/2)},spring:function(t,e,r){return r=1-1*Math.exp(-3.6*r)*Math.cos(2.5*Math.pow(r,2)*Math.PI),w(t,e,r)}},k=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.reverse,i=void 0!==n&&n,a=r.repeat,o=void 0===a?1:a,u=r.delay,l=void 0===u?0:u,s=r.alternate,c=void 0!==s&&s,f=r.callback;p.default(this,t),this.indices={},this.clip=e,this.t=0,this.T=e.duration*o+l,this.reverse=i,this.delay=l,this.alternate=c,this.callback=f}return v.default(t,[{key:"normalize",value:function(t,e,r){return l.is.null(t)&&(t=l.getProperty(r,e)),l.Units.toBase(t,e,r)}},{key:"getInterpolatedValue",value:function(t,e,r,n){if(l.is.function(e))return l.Units.toBase(l.convert(e(r,this.clip.duration),t),t,n);var i=this.reverse?-1:1,a=this.indices[t];(l.is.null(a)||(this.reverse?r-e[a].time:e[a].time-r)>0)&&(this.indices[t]=a=this.reverse?e.length-1:0);var o=e[a],u=e[a+i];if(this.reverse?u.time>r:u.time<r){this.indices[t]=a+=i;var s=["start","end"],c=s[+!this.reverse],f=s[+this.reverse];if(c in o||f in u)return this.normalize(c in o?o[c]:u[f],t,n);o=e[a],u=e[a+i]}var h=this.normalize(o.set,t,n),p=this.normalize(u.set,t,n),v=j[u.interpolate||this.clip.interpolate]||j.ease;return O(h,p,(r-o.time)/(u.time-o.time),v)}},{key:"get",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r={},n=this.t>=this.T;if(this.t<this.delay||e&&!n&&!l.isVisible(t))return r;var i=this.t-this.delay,a=this.clip.duration,o=this.alternate&&Math.floor(i/a)%2==+!n;for(var u in i=n?a:i%a,i=l.xor(this.reverse,o)?a-i:i,r.origin=this.clip.origin,this.clip.properties)r[u]=this.getInterpolatedValue(u,this.clip.properties[u],i,t);return r}},{key:"step",value:function(t){var e=this.t>=this.T;return this.t+=t,e&&l.is.function(this.callback)&&this.callback(),e}}]),t}();function P(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=m.default(t);if(e){var i=m.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return d.default(this,r)}}var S=function(t){y.default(r,t);var e=P(r);function r(t){var n;return p.default(this,r),(n=e.call(this,{duration:1/0,properties:{},origin:{x:.5,y:.5},interpolate:t})).isEmpty=!0,n.cache={},n}return v.default(r,[{key:"add",value:function(t,e){this.clip.properties[t]=e,this.isEmpty=!1}},{key:"getInterpolatedValue",value:function(t,e,r,n){l.is.null(e.internal.t)&&(e.internal.t=r),e.internal.t===r&&(this.cache[t]={});var i=e.internal.duration?Math.min((r-e.internal.t)/e.internal.duration,1):1,a=this.cache[t]||{};if(a.t===i)return a.value;var o=l.Units.toBase(l.convert(e(),t),t,n),u=a.from;if(1!=i){u||(u=l.Units.toBase(l.getProperty(n,t),t,n));var s=j[this.clip.interpolate]||j.linear;o=O(u,o,i,s)}return this.cache[t]={value:o,from:1!=i?u:null,t:i},o}}]),r}(k),I=["duration","delay","repeat","alternate","interpolate","origin"];function x(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 A(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 A(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 a,o=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function A(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 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 M(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){f.default(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}var z=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.duration,n=void 0===r?1:r,i=e.delay,a=e.repeat,o=e.alternate,u=e.interpolate,s=e.origin,f=void 0===s?{x:.5,y:.5}:s,v=h.default(e,I),y=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};p.default(this,t),this.duration=n,this.origin=l.originToStr(f),this.channel=new S(u);var d=this.parse(v,y),m=c.default(d,2);this.properties=m[0],this.initials=m[1],this.isEmpty=l.is.empty(this.properties),this.interpolate=u,this.defaults={delay:i,repeat:a,alternate:o}}return v.default(t,[{key:"length",value:function(){return this.duration*(this.defaults.repeat||1)+(this.defaults.delay||0)}},{key:"parse",value:function(t,e){var r=this,n=function(n){var i=t[n];if(l.Link.isInstance(i))return r.channel.add(n,i),delete t[n],"continue";if(l.is.function(i))return"continue";(i=l.is.array(i)?i:[i]).length<2?i.unshift(n in e?e[n]:null):l.is.null(i[0])||(e[n]=i[0]);for(var a=i.map((function(t){return r.sanitize(t,n)})),o=0;o<a.length;o++)r.quantize(a,o);t[n]=a};for(var i in t)n(i);for(var a in e=M({},e))e[a]=l.convert(e[a],a);return[t,e]}},{key:"sanitize",value:function(t,e){t=l.is.object(t)?M({},t):{set:t},l.hasSomeKey(t,l.POSITIONS)||(t={set:t}),"set"in t||(t.set=t.start||t.end),"time"in t&&t.time>this.duration&&delete t.time;var r,n=x(l.POSITIONS);try{for(n.s();!(r=n.n()).done;){var i=r.value;i in t&&(t[i]=l.convert(t[i],e))}}catch(t){n.e(t)}finally{n.f()}return t}},{key:"quantize",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e-1;if("time"in t[e])return t[e].time;if(0==e||e==t.length-1)return t[e].time=0==e?0:this.duration;var n=this.quantize(t,r,r);return t[e].time=n+(this.quantize(t,e+1,r)-n)*((e-r)/(e-r+1))}},{key:"play",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new k(this,l.mergeObjects(t,this.defaults))}}]),t}(),T={create:function(t){var e=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.use=t.use.bind(t,e),t};return e.use=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t(e),n=c.default(r,2),i=n[0],a=n[1];return new z(i,a)},e},isInstance:function(t){return l.is.function(t)&&l.is.function(t.use)}};exports.Animation=T,exports.Clip=z,exports.computeMorph=function(t,e,r){var n,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a={duration:i},o={},u=b(r);try{for(u.s();!(n=u.n()).done;){var l=n.value;"scale"==l?(a.scale={x:1,y:1},o.scale={x:1+(e.layout.width-t.layout.width)/t.layout.width,y:1+(e.layout.height-t.layout.height)/t.layout.height}):"translate"==l?(a.translate={x:0,y:0},o.translate={x:(e.layout.x-t.layout.x)*t.layout.parentWidth,y:(e.layout.y-t.layout.y)*t.layout.parentHeight}):(a[l]=t[l],o[l]=e[l])}}catch(t){u.e(t)}finally{u.f()}return new z(a,o)};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./animation-06e8c1ee.js"),r=require("@babel/runtime/helpers/defineProperty"),t=require("./pop-3317da8f.js"),n=require("@babel/runtime/helpers/objectWithoutProperties");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("@babel/runtime/helpers/slicedToArray"),require("@babel/runtime/helpers/classCallCheck"),require("@babel/runtime/helpers/createClass"),require("@babel/runtime/helpers/inherits"),require("@babel/runtime/helpers/possibleConstructorReturn"),require("@babel/runtime/helpers/getPrototypeOf"),require("./link-b0ac399e.js"),require("@babel/runtime/helpers/typeof");var i=o(r),c=o(n);function u(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function a(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?u(Object(t),!0).forEach((function(r){i.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):u(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var p=e.Animation.create((function(e){return[a({opacity:1,duration:.65},e),{opacity:0}]})),s=["direction"];function b(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function l(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?b(Object(t),!0).forEach((function(r){i.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):b(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var f=e.Animation.create((function(e){var r=e.direction,t=void 0===r?"right":r,n=c.default(e,s),o=0,i=1,u={x:0,y:.5};switch(t){case"left":u.x=1;break;case"up":o=1,i=0,u={x:0,y:1};break;case"down":o=1,i=0,u={x:0,y:0}}return[l({scale:{x:1},origin:u,duration:.6},n),{scale:{x:o,y:i}}]})),O=["direction"];function y(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function j(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?y(Object(t),!0).forEach((function(r){i.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):y(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var d=e.Animation.create((function(e){var r=e.direction,t=void 0===r?"right":r,n=c.default(e,O);return["left","right","top","bottom"].includes(t)||(t="right"),[j({clip:i.default({},t,0)},n),{clip:i.default({},t,1)}]}));exports.Animation=e.Animation,exports.Move=t.Move,exports.Pop=t.Pop,exports.Fade=p,exports.Scale=f,exports.Wipe=d;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./animation-7bc99fc6.js"),r=require("@babel/runtime/helpers/defineProperty"),t=require("./pop-07308ebd.js"),n=require("@babel/runtime/helpers/objectWithoutProperties");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("@babel/runtime/helpers/slicedToArray"),require("@babel/runtime/helpers/classCallCheck"),require("@babel/runtime/helpers/createClass"),require("@babel/runtime/helpers/inherits"),require("@babel/runtime/helpers/possibleConstructorReturn"),require("@babel/runtime/helpers/getPrototypeOf"),require("./link-b0ac399e.js"),require("@babel/runtime/helpers/typeof");var i=o(r),c=o(n);function u(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function a(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?u(Object(t),!0).forEach((function(r){i.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):u(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var p=e.Animation.create((function(e){return[a({opacity:1,duration:.65},e),{opacity:0}]})),s=["direction"];function b(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function l(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?b(Object(t),!0).forEach((function(r){i.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):b(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var f=e.Animation.create((function(e){var r=e.direction,t=void 0===r?"right":r,n=c.default(e,s),o=0,i=1,u={x:0,y:.5};switch(t){case"left":u.x=1;break;case"up":o=1,i=0,u={x:0,y:1};break;case"down":o=1,i=0,u={x:0,y:0}}return[l({scale:{x:1},origin:u,duration:.6},n),{scale:{x:o,y:i}}]})),O=["direction"];function y(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function j(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?y(Object(t),!0).forEach((function(r){i.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):y(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var d=e.Animation.create((function(e){var r=e.direction,t=void 0===r?"right":r,n=c.default(e,O);return["left","right","top","bottom"].includes(t)||(t="right"),[j({clip:i.default({},t,0)},n),{clip:i.default({},t,1)}]}));exports.Animation=e.Animation,exports.Move=t.Move,exports.Pop=t.Pop,exports.Fade=p,exports.Scale=f,exports.Wipe=d;
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-90b2e55b.js"),l=require("react"),s=require("./link-b0ac399e.js"),c=require("./animation-06e8c1ee.js"),p=require("@babel/runtime/helpers/toConsumableArray"),f=require("./scroll-f0161c1d.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("./events-0c00d6a9.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 x(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return A(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 A(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 A(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function R(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=g.default(e);if(t){var i=g.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return b.default(this,r)}}var k={},q=function(e){v.default(r,e);var t=R(r);function r(e){var n;return h.default(this,r),(n=t.call(this,e)).animations={default:new c.Clip({},{opacity:+e.active,pointerEvents:e.active?"":"none"}),unmorph:new c.Clip({},{opacity:0,pointerEvents:"none"})},n.properties=s.subArray(n.props.include,n.props.exclude),n.uuid=(e.id||0).toString()+(e.index||0)+e.group,n}return y.default(r,[{key:"shouldComponentUpdate",value:function(e){return this.props.active!==e.active&&(this.uuid in 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=x(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),{},{cascade:0,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-fa2bde4d.js"),l=require("react"),s=require("./link-b0ac399e.js"),c=require("./animation-7bc99fc6.js"),p=require("@babel/runtime/helpers/toConsumableArray"),f=require("./scroll-f0161c1d.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("./events-0c00d6a9.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 x(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return A(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 A(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 A(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function R(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=g.default(e);if(t){var i=g.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return b.default(this,r)}}var k={},q=function(e){v.default(r,e);var t=R(r);function r(e){var n;return h.default(this,r),(n=t.call(this,e)).animations={default:new c.Clip({},{opacity:+e.active,pointerEvents:e.active?"":"none"}),unmorph:new c.Clip({},{opacity:0,pointerEvents:"none"})},n.properties=s.subArray(n.props.include,n.props.exclude),n.uuid=(e.id||0).toString()+(e.index||0)+e.group,n}return y.default(r,[{key:"shouldComponentUpdate",value:function(e){return this.props.active!==e.active&&(this.uuid in 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=x(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),{},{cascade:0,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/index.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./animatable-90b2e55b.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"),c=require("./pop-3317da8f.js"),f=require("./link-b0ac399e.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("./animation-06e8c1ee.js"),require("@babel/runtime/helpers/slicedToArray"),require("./events-0c00d6a9.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=f.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:[c.Move,c.Pop]}),exports.Animatable=e.Animatable,exports.Animate=P;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./animatable-fa2bde4d.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"),c=require("./pop-07308ebd.js"),f=require("./link-b0ac399e.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("./animation-7bc99fc6.js"),require("@babel/runtime/helpers/slicedToArray"),require("./events-0c00d6a9.js"),require("@babel/runtime/helpers/typeof");var b=p(r),m=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=f.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=m.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,b.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:[c.Move,c.Pop]}),exports.Animatable=e.Animatable,exports.Animate=P;
@@ -1 +1 @@
1
- "use strict";var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/objectWithoutProperties"),r=require("./animation-06e8c1ee.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(e),c=n(t),i=["direction"];function a(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 p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){o.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var u=r.Animation.create((function(e){var t=e.direction,r=void 0===t?"up":t,n=c.default(e,i),o="0px",a="20px";switch(r){case"down":a="-20px";break;case"left":o="20px",a="0px";break;case"right":o="-20px",a="0px"}return[p({translate:{x:0,y:0},opacity:1,duration:.5},n),{translate:{x:o,y:a},opacity:0}]}));function s(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 b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){o.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var f=r.Animation.create((function(e){return[b({opacity:1,scale:1,duration:.25},e),{opacity:0,scale:.85}]}));exports.Move=u,exports.Pop=f;
1
+ "use strict";var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/objectWithoutProperties"),r=require("./animation-7bc99fc6.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(e),c=n(t),i=["direction"];function a(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 p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){o.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var u=r.Animation.create((function(e){var t=e.direction,r=void 0===t?"up":t,n=c.default(e,i),o="0px",a="20px";switch(r){case"down":a="-20px";break;case"left":o="20px",a="0px";break;case"right":o="-20px",a="0px"}return[p({translate:{x:0,y:0},opacity:1,duration:.5},n),{translate:{x:o,y:a},opacity:0}]}));function s(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 b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){o.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var f=r.Animation.create((function(e){return[b({opacity:1,scale:1,duration:.25},e),{opacity:0,scale:.85}]}));exports.Move=u,exports.Pop=f;
@@ -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-917bbc34.js";import{g as p,D as f,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-d312db50.js";import{a as A,o as x,r as S,b as P}from"./events-6da12fc3.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:p(this.element,"borderRadius"),webkitBackfaceVisibility:"hidden"};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:f.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 V(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 C(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?V(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):V(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 q=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,p=void 0!==h&&h;t(this,r),this.targets=[],this.priority=i,this.stagger=a,this.culling=l,this.noDeform=u,this.paused=p}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=C(C({},e),{},{delay:(e.delay||0)+r*this.stagger});r<this.targets.length-1&&(n.callback=null),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 z(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 T(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?z(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):z(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=m.null(r.props.stagger)?.1:r.props.stagger,r.cascade=m.null(r.props.cascade)?1:r.props.cascade,r.manager=new q({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(),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,p=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!(!t||this.props.disabled||this.props.group>0&&!p)){m.string(t)||(t="default"),this.dispatch("onAnimationStart");var f=this.animations[t],y=f.length()*this.cascade,v=h;this.props.group||(h=function(){e.dispatch("onAnimationEnd"),m.function(v)&&v()});for(var d=0,g=0;g<this.children.length;g++)d=Math.max(d,this.children[g].play(t,{reverse:i,immediate:l,delay:u+y+this.stagger*g,callback:h},!0));return i&&!this.props.group||!i&&!this.children.length||(h=null),this.manager.play(f,{reverse:i,composite:a,immediate:l,delay:i?d:u,callback:h}),y+(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}}var c=o.isInstance(t)&&n&&!t.props.stopPropagation;return c&&(i.index=e.childIndex++,i.group=e.props.group+1,i.ref=function(t){return e.children[i.index]=t},e.props.group||(i.active=e.props.active),j(i,T(T({},e.props),t.props),e.constructor.cascadingProps)),l(t,i,e.prerender(t.props.children,!1,!c))}))}},{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","cascade"]),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-1e215254.js";import{g as p,D as f,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-d312db50.js";import{a as A,o as x,r as S,b as P}from"./events-6da12fc3.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:p(this.element,"borderRadius"),webkitBackfaceVisibility:"hidden"};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:f.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 V(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 C(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?V(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):V(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 q=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,p=void 0!==h&&h;t(this,r),this.targets=[],this.priority=i,this.stagger=a,this.culling=l,this.noDeform=u,this.paused=p}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=C(C({},e),{},{delay:(e.delay||0)+r*this.stagger});r<this.targets.length-1&&(n.callback=null),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 z(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 T(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?z(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):z(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=m.null(r.props.stagger)?.1:r.props.stagger,r.cascade=m.null(r.props.cascade)?1:r.props.cascade,r.manager=new q({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(),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,p=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!(!t||this.props.disabled||this.props.group>0&&!p)){m.string(t)||(t="default"),this.dispatch("onAnimationStart");var f=this.animations[t],y=f.length()*this.cascade,v=h;this.props.group||(h=function(){e.dispatch("onAnimationEnd"),m.function(v)&&v()});for(var d=0,g=0;g<this.children.length;g++)d=Math.max(d,this.children[g].play(t,{reverse:i,immediate:l,delay:u+y+this.stagger*g,callback:h},!0));return i&&!this.props.group||!i&&!this.children.length||(h=null),this.manager.play(f,{reverse:i,composite:a,immediate:l,delay:i?d:u,callback:h}),y+(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}}var c=o.isInstance(t)&&n&&!t.props.stopPropagation;return c&&(i.index=e.childIndex++,i.group=e.props.group+1,i.ref=function(t){return e.children[i.index]=t},e.props.group||(i.active=e.props.active),j(i,T(T({},e.props),t.props),e.constructor.cascadingProps)),l(t,i,e.prerender(t.props.children,!1,!c))}))}},{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","cascade"]),o(N,"defaultProps",{group:0,viewportMargin:.75,lazy:!0,paused:!1});export{N as A};
@@ -0,0 +1 @@
1
+ import t from"@babel/runtime/helpers/slicedToArray";import e from"@babel/runtime/helpers/defineProperty";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 u from"@babel/runtime/helpers/getPrototypeOf";import{i as l,g as s,U as c,e as f,f as h,x as p,h as v,d as y,j as d,L as m,P as b}from"./link-d312db50.js";function g(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 w(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 w(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 a,o=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function w(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 O=function t(e,r,n,i){if(l.object(e)){var a={};for(var o in e)a[o]=t(e[o],r[o],n,i);return a}return[i(e[0],r[0],n),e[1]]},j=function(t,e,r){return l.number(t)&&l.number(e)?t*(1-r)+e*r:r>.5?e:t},k={constant:function(t){return t},linear:j,ease:function(t,e,r){return j(t,e,(1-Math.cos(r*Math.PI))/2)},spring:function(t,e,r){return r=1-1*Math.exp(-3.6*r)*Math.cos(2.5*Math.pow(r,2)*Math.PI),j(t,e,r)}},P=function(t,e,r){var n,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a={duration:i},o={},u=g(r);try{for(u.s();!(n=u.n()).done;){var l=n.value;"scale"==l?(a.scale={x:1,y:1},o.scale={x:1+(e.layout.width-t.layout.width)/t.layout.width,y:1+(e.layout.height-t.layout.height)/t.layout.height}):"translate"==l?(a.translate={x:0,y:0},o.translate={x:(e.layout.x-t.layout.x)*t.layout.parentWidth,y:(e.layout.y-t.layout.y)*t.layout.parentHeight}):(a[l]=t[l],o[l]=e[l])}}catch(t){u.e(t)}finally{u.f()}return new B(a,o)},x=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.reverse,a=void 0!==i&&i,o=r.repeat,u=void 0===o?1:o,l=r.delay,s=void 0===l?0:l,c=r.alternate,f=void 0!==c&&c,h=r.callback;n(this,t),this.indices={},this.clip=e,this.t=0,this.T=e.duration*u+s,this.reverse=a,this.delay=s,this.alternate=f,this.callback=h}return i(t,[{key:"normalize",value:function(t,e,r){return l.null(t)&&(t=s(r,e)),c.toBase(t,e,r)}},{key:"getInterpolatedValue",value:function(t,e,r,n){if(l.function(e))return c.toBase(f(e(r,this.clip.duration),t),t,n);var i=this.reverse?-1:1,a=this.indices[t];(l.null(a)||(this.reverse?r-e[a].time:e[a].time-r)>0)&&(this.indices[t]=a=this.reverse?e.length-1:0);var o=e[a],u=e[a+i];if(this.reverse?u.time>r:u.time<r){this.indices[t]=a+=i;var s=["start","end"],h=s[+!this.reverse],p=s[+this.reverse];if(h in o||p in u)return this.normalize(h in o?o[h]:u[p],t,n);o=e[a],u=e[a+i]}var v=this.normalize(o.set,t,n),y=this.normalize(u.set,t,n),d=k[u.interpolate||this.clip.interpolate]||k.ease;return O(v,y,(r-o.time)/(u.time-o.time),d)}},{key:"get",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r={},n=this.t>=this.T;if(this.t<this.delay||e&&!n&&!h(t))return r;var i=this.t-this.delay,a=this.clip.duration,o=this.alternate&&Math.floor(i/a)%2==+!n;for(var u in i=n?a:i%a,i=p(this.reverse,o)?a-i:i,r.origin=this.clip.origin,this.clip.properties)r[u]=this.getInterpolatedValue(u,this.clip.properties[u],i,t);return r}},{key:"step",value:function(t){var e=this.t>=this.T;return this.t+=t,e&&l.function(this.callback)&&this.callback(),e}}]),t}();function A(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=u(t);if(e){var i=u(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return o(this,r)}}var I=function(t){a(r,x);var e=A(r);function r(t){var i;return n(this,r),(i=e.call(this,{duration:1/0,properties:{},origin:{x:.5,y:.5},interpolate:t})).isEmpty=!0,i.cache={},i}return i(r,[{key:"add",value:function(t,e){this.clip.properties[t]=e,this.isEmpty=!1}},{key:"getInterpolatedValue",value:function(t,e,r,n){l.null(e.internal.t)&&(e.internal.t=r),e.internal.t===r&&(this.cache[t]={});var i=e.internal.duration?Math.min((r-e.internal.t)/e.internal.duration,1):1,a=this.cache[t]||{};if(a.t===i)return a.value;var o=c.toBase(f(e(),t),t,n),u=a.from;if(1!=i){u||(u=c.toBase(s(n,t),t,n));var h=k[this.clip.interpolate]||k.linear;o=O(u,o,i,h)}return this.cache[t]={value:o,from:1!=i?u:null,t:i},o}}]),r}(),S=["duration","delay","repeat","alternate","interpolate","origin"];function z(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 M(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 M(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 a,o=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function M(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 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 E(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?C(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var B=function(){function e(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=i.duration,o=void 0===a?1:a,u=i.delay,s=i.repeat,c=i.alternate,f=i.interpolate,h=i.origin,p=void 0===h?{x:.5,y:.5}:h,v=r(i,S),y=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n(this,e),this.duration=o,this.origin=d(p),this.channel=new I(f);var m=this.parse(v,y),b=t(m,2);this.properties=b[0],this.initials=b[1],this.isEmpty=l.empty(this.properties),this.interpolate=f,this.defaults={delay:u,repeat:s,alternate:c}}return i(e,[{key:"length",value:function(){return this.duration*(this.defaults.repeat||1)+(this.defaults.delay||0)}},{key:"parse",value:function(t,e){var r=this,n=function(n){var i=t[n];if(m.isInstance(i))return r.channel.add(n,i),delete t[n],"continue";if(l.function(i))return"continue";(i=l.array(i)?i:[i]).length<2?i.unshift(n in e?e[n]:null):l.null(i[0])||(e[n]=i[0]);for(var a=i.map((function(t){return r.sanitize(t,n)})),o=0;o<a.length;o++)r.quantize(a,o);t[n]=a};for(var i in t)n(i);for(var a in e=E({},e))e[a]=f(e[a],a);return[t,e]}},{key:"sanitize",value:function(t,e){t=l.object(t)?E({},t):{set:t},v(t,b)||(t={set:t}),"set"in t||(t.set=t.start||t.end),"time"in t&&t.time>this.duration&&delete t.time;var r,n=z(b);try{for(n.s();!(r=n.n()).done;){var i=r.value;i in t&&(t[i]=f(t[i],e))}}catch(t){n.e(t)}finally{n.f()}return t}},{key:"quantize",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e-1;if("time"in t[e])return t[e].time;if(0==e||e==t.length-1)return t[e].time=0==e?0:this.duration;var n=this.quantize(t,r,r);return t[e].time=n+(this.quantize(t,e+1,r)-n)*((e-r)/(e-r+1))}},{key:"play",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new x(this,y(t,this.defaults))}}]),e}(),R={create:function(e){var r=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.use=t.use.bind(t,e),t};return r.use=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e(r),i=t(n,2),a=i[0],o=i[1];return new B(a,o)},r},isInstance:function(t){return l.function(t)&&l.function(t.use)}};export{R as A,B as C,P as c};
@@ -1 +1 @@
1
- import{A as e}from"./animation-917bbc34.js";export{A as Animation}from"./animation-917bbc34.js";import r from"@babel/runtime/helpers/defineProperty";export{M as Move,P as Pop}from"./pop-18547158.js";import t from"@babel/runtime/helpers/objectWithoutProperties";import"@babel/runtime/helpers/slicedToArray";import"@babel/runtime/helpers/classCallCheck";import"@babel/runtime/helpers/createClass";import"@babel/runtime/helpers/inherits";import"@babel/runtime/helpers/possibleConstructorReturn";import"@babel/runtime/helpers/getPrototypeOf";import"./link-d312db50.js";import"@babel/runtime/helpers/typeof";function o(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}var i=e.create((function(e){return[n({opacity:1,duration:.65},e),{opacity:0}]})),c=["direction"];function p(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function a(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?p(Object(o),!0).forEach((function(t){r(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):p(Object(o)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))}))}return e}var b=e.create((function(e){var r=e.direction,o=void 0===r?"right":r,n=t(e,c),i=0,p=1,b={x:0,y:.5};switch(o){case"left":b.x=1;break;case"up":i=1,p=0,b={x:0,y:1};break;case"down":i=1,p=0,b={x:0,y:0}}return[a({scale:{x:1},origin:b,duration:.6},n),{scale:{x:i,y:p}}]})),s=["direction"];function l(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function u(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?l(Object(o),!0).forEach((function(t){r(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):l(Object(o)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))}))}return e}var O=e.create((function(e){var o=e.direction,n=void 0===o?"right":o,i=t(e,s);return["left","right","top","bottom"].includes(n)||(n="right"),[u({clip:r({},n,0)},i),{clip:r({},n,1)}]}));export{i as Fade,b as Scale,O as Wipe};
1
+ import{A as e}from"./animation-1e215254.js";export{A as Animation}from"./animation-1e215254.js";import r from"@babel/runtime/helpers/defineProperty";export{M as Move,P as Pop}from"./pop-437670a0.js";import t from"@babel/runtime/helpers/objectWithoutProperties";import"@babel/runtime/helpers/slicedToArray";import"@babel/runtime/helpers/classCallCheck";import"@babel/runtime/helpers/createClass";import"@babel/runtime/helpers/inherits";import"@babel/runtime/helpers/possibleConstructorReturn";import"@babel/runtime/helpers/getPrototypeOf";import"./link-d312db50.js";import"@babel/runtime/helpers/typeof";function o(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}var i=e.create((function(e){return[n({opacity:1,duration:.65},e),{opacity:0}]})),c=["direction"];function p(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function a(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?p(Object(o),!0).forEach((function(t){r(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):p(Object(o)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))}))}return e}var s=e.create((function(e){var r=e.direction,o=void 0===r?"right":r,n=t(e,c),i=0,p=1,s={x:0,y:.5};switch(o){case"left":s.x=1;break;case"up":i=1,p=0,s={x:0,y:1};break;case"down":i=1,p=0,s={x:0,y:0}}return[a({scale:{x:1},origin:s,duration:.6},n),{scale:{x:i,y:p}}]})),b=["direction"];function l(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function u(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?l(Object(o),!0).forEach((function(t){r(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):l(Object(o)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))}))}return e}var O=e.create((function(e){var o=e.direction,n=void 0===o?"right":o,i=t(e,b);return["left","right","top","bottom"].includes(n)||(n="right"),[u({clip:r({},n,0)},i),{clip:r({},n,1)}]}));export{i as Fade,s as Scale,O as Wipe};
package/dist/esm/auto.js CHANGED
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/classCallCheck";import t from"@babel/runtime/helpers/createClass";import r from"@babel/runtime/helpers/get";import n from"@babel/runtime/helpers/inherits";import i from"@babel/runtime/helpers/possibleConstructorReturn";import o from"@babel/runtime/helpers/getPrototypeOf";import a from"@babel/runtime/helpers/defineProperty";import{A as l}from"./animatable-9057c824.js";import u,{isValidElement as c,Children as s,cloneElement as p,Component as f,useRef as h}from"react";import{s as d,k as m,i as y,l as v}from"./link-d312db50.js";import{C as b,c as g}from"./animation-917bbc34.js";import O from"@babel/runtime/helpers/toConsumableArray";import{u as w}from"./scroll-c1b912fb.js";import"./events-6da12fc3.js";import"@babel/runtime/helpers/typeof";import"@babel/runtime/helpers/slicedToArray";import"@babel/runtime/helpers/objectWithoutProperties";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 P(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){a(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 k(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,l=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(l)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}function E(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=o(e);if(t){var a=o(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return i(this,r)}}var R={},A=function(i){n(u,l);var a=E(u);function u(t){var r;return e(this,u),(r=a.call(this,t)).animations={default:new b({},{opacity:+t.active,pointerEvents:t.active?"":"none"}),unmorph:new b({},{opacity:0,pointerEvents:"none"})},r.properties=d(r.props.include,r.props.exclude),r.uuid=(t.id||0).toString()+(t.index||0)+t.group,r}return t(u,[{key:"shouldComponentUpdate",value:function(e){return this.props.active!==e.active&&(this.uuid in R?R[this.uuid].push(this):R[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=k(R[this.uuid]);try{for(r.s();!(t=r.n()).done;){var n=t.value;if(n!==this)return m(n.elements[0],this.props.group)}}catch(e){r.e(e)}finally{r.f()}}return null}},{key:"componentDidUpdate",value:function(e,t,n){if(r(o(u.prototype),"componentDidUpdate",this).call(this),R[this.uuid]=[],n){var i=m(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 e=this.props.children;if(y.array(e)){if(e.length>1)return e;e=e[0]}return c(e)?r(o(u.prototype),"render",this).call(this):e}}]),u}();function C(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=o(e);if(t){var a=o(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return i(this,r)}}a(A,"cascadingProps",["id","duration"]),a(A,"defaultProps",P(P({},l.defaultProps),{},{cascade:0,active:!1,include:v,exclude:[]}));var S=function(r){n(o,f);var i=C(o);function o(t){var r;return e(this,o),(r=i.call(this,t)).children=[],r.properties=d(r.props.include,r.props.exclude),r}return t(o,[{key:"getSnapshotBeforeUpdate",value:function(){return this.children.map((function(e){var t=null==e?void 0:e.elements[0];return t?{data:m(t),key:e.props.layoutKey}:null}))}},{key:"componentDidUpdate",value:function(e,t,r){for(var n=0,i=0;n<r.length;n++,i++){var o=this.children[i];if(o&&o.elements[0]){var a=r[n];if(a&&o.props.layoutKey===a.key){var l=m(o.elements[0]);o.manager.play(g(l,a.data,this.properties,this.props.duration),{composite:!0})}else i--}}}},{key:"render",value:function(){var e=this;return this.childIndex=0,s.map(this.props.children,(function(t){if(!c(t)||!l.isInstance(t))return t;var r=e.childIndex++;return p(t,{ref:function(t){return e.children[r]=t},layoutKey:t.key})}))}}]),o}();function B(e){var t=e.children,r=e.className,n=e.style,i=e.duration;if(!y.string(t))return t;var o=t.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(e,t){return u.createElement("span",{style:{display:"inline-block"},key:t},/\s/.test(e)?" ":e)}))))}function D(e){var t,r=e.children,n=e.color,i=e.duration,o=(null===(t=r.props)||void 0===t?void 0:t.children)||[];Array.isArray(o)||(o=[o]);var a=[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(e){var t,r=e.children,n=e.amount,i=w(),o=h();return u.createElement(l,{ref:o,animate:{translate:i((function(e){if(void 0===t){var r,i=null===(r=o.current)||void 0===r?void 0:r.elements[0];i&&(t=Math.max(i.getBoundingClientRect().y+window.scrollY-window.innerHeight/2,0))}return{x:0,y:(e-(t||0))*n}}))}},r)}a(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 e from"@babel/runtime/helpers/classCallCheck";import t from"@babel/runtime/helpers/createClass";import r from"@babel/runtime/helpers/get";import n from"@babel/runtime/helpers/inherits";import i from"@babel/runtime/helpers/possibleConstructorReturn";import o from"@babel/runtime/helpers/getPrototypeOf";import a from"@babel/runtime/helpers/defineProperty";import{A as l}from"./animatable-306358e2.js";import u,{isValidElement as s,Children as c,cloneElement as p,Component as f,useRef as h}from"react";import{s as d,k as m,i as y,l as v}from"./link-d312db50.js";import{C as b,c as g}from"./animation-1e215254.js";import O from"@babel/runtime/helpers/toConsumableArray";import{u as w}from"./scroll-c1b912fb.js";import"./events-6da12fc3.js";import"@babel/runtime/helpers/typeof";import"@babel/runtime/helpers/slicedToArray";import"@babel/runtime/helpers/objectWithoutProperties";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 P(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){a(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 k(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,l=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(l)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}function E(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=o(e);if(t){var a=o(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return i(this,r)}}var R={},A=function(i){n(u,l);var a=E(u);function u(t){var r;return e(this,u),(r=a.call(this,t)).animations={default:new b({},{opacity:+t.active,pointerEvents:t.active?"":"none"}),unmorph:new b({},{opacity:0,pointerEvents:"none"})},r.properties=d(r.props.include,r.props.exclude),r.uuid=(t.id||0).toString()+(t.index||0)+t.group,r}return t(u,[{key:"shouldComponentUpdate",value:function(e){return this.props.active!==e.active&&(this.uuid in R?R[this.uuid].push(this):R[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=k(R[this.uuid]);try{for(r.s();!(t=r.n()).done;){var n=t.value;if(n!==this)return m(n.elements[0],this.props.group)}}catch(e){r.e(e)}finally{r.f()}}return null}},{key:"componentDidUpdate",value:function(e,t,n){if(r(o(u.prototype),"componentDidUpdate",this).call(this),R[this.uuid]=[],n){var i=m(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 e=this.props.children;if(y.array(e)){if(e.length>1)return e;e=e[0]}return s(e)?r(o(u.prototype),"render",this).call(this):e}}]),u}();function C(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=o(e);if(t){var a=o(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return i(this,r)}}a(A,"cascadingProps",["id","duration"]),a(A,"defaultProps",P(P({},l.defaultProps),{},{cascade:0,active:!1,include:v,exclude:[]}));var S=function(r){n(o,f);var i=C(o);function o(t){var r;return e(this,o),(r=i.call(this,t)).children=[],r.properties=d(r.props.include,r.props.exclude),r}return t(o,[{key:"getSnapshotBeforeUpdate",value:function(){return this.children.map((function(e){var t=null==e?void 0:e.elements[0];return t?{data:m(t),key:e.props.layoutKey}:null}))}},{key:"componentDidUpdate",value:function(e,t,r){for(var n=0,i=0;n<r.length;n++,i++){var o=this.children[i];if(o&&o.elements[0]){var a=r[n];if(a&&o.props.layoutKey===a.key){var l=m(o.elements[0]);o.manager.play(g(l,a.data,this.properties,this.props.duration),{composite:!0})}else i--}}}},{key:"render",value:function(){var e=this;return this.childIndex=0,c.map(this.props.children,(function(t){if(!s(t)||!l.isInstance(t))return t;var r=e.childIndex++;return p(t,{ref:function(t){return e.children[r]=t},layoutKey:t.key})}))}}]),o}();function B(e){var t=e.children,r=e.className,n=e.style,i=e.duration;if(!y.string(t))return t;var o=t.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(e,t){return u.createElement("span",{style:{display:"inline-block"},key:t},/\s/.test(e)?" ":e)}))))}function D(e){var t,r=e.children,n=e.color,i=e.duration,o=(null===(t=r.props)||void 0===t?void 0:t.children)||[];Array.isArray(o)||(o=[o]);var a=[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(e){var t,r=e.children,n=e.amount,i=w(),o=h();return u.createElement(l,{ref:o,animate:{translate:i((function(e){if(void 0===t){var r,i=null===(r=o.current)||void 0===r?void 0:r.elements[0];i&&(t=Math.max(i.getBoundingClientRect().y+window.scrollY-window.innerHeight/2,0))}return{x:0,y:(e-(t||0))*n}}))}},r)}a(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/index.js CHANGED
@@ -1 +1 @@
1
- import{A as e}from"./animatable-9057c824.js";export{A as Animatable}from"./animatable-9057c824.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-18547158.js";import{p as v}from"./link-d312db50.js";import"./animation-917bbc34.js";import"@babel/runtime/helpers/slicedToArray";import"./events-6da12fc3.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};
1
+ import{A as e}from"./animatable-306358e2.js";export{A as Animatable}from"./animatable-306358e2.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 h,P as b}from"./pop-437670a0.js";import{p as v}from"./link-d312db50.js";import"./animation-1e215254.js";import"@babel/runtime/helpers/slicedToArray";import"./events-6da12fc3.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.apply(e,arguments)}},{key:"render",value:function(){return this.makeAnimatable(this.props.children,this.levels)}}]),s}();s(k,"defaultProps",{levels:1,animations:[h,b]});export{k as Animate};
@@ -1 +1 @@
1
- import e from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/objectWithoutProperties";import{A as t}from"./animation-917bbc34.js";var o=["direction"];function n(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function c(r){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?n(Object(o),!0).forEach((function(t){e(r,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}))}return r}var i=t.create((function(e){var t=e.direction,n=void 0===t?"up":t,i=r(e,o),p="0px",a="20px";switch(n){case"down":a="-20px";break;case"left":p="20px",a="0px";break;case"right":p="-20px",a="0px"}return[c({translate:{x:0,y:0},opacity:1,duration:.5},i),{translate:{x:p,y:a},opacity:0}]}));function p(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function a(r){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?p(Object(o),!0).forEach((function(t){e(r,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):p(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}))}return r}var b=t.create((function(e){return[a({opacity:1,scale:1,duration:.25},e),{opacity:0,scale:.85}]}));export{i as M,b as P};
1
+ import e from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/objectWithoutProperties";import{A as t}from"./animation-1e215254.js";var o=["direction"];function n(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function c(r){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?n(Object(o),!0).forEach((function(t){e(r,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}))}return r}var i=t.create((function(e){var t=e.direction,n=void 0===t?"up":t,i=r(e,o),p="0px",a="20px";switch(n){case"down":a="-20px";break;case"left":p="20px",a="0px";break;case"right":p="-20px",a="0px"}return[c({translate:{x:0,y:0},opacity:1,duration:.5},i),{translate:{x:p,y:a},opacity:0}]}));function p(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function a(r){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?p(Object(o),!0).forEach((function(t){e(r,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):p(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}))}return r}var s=t.create((function(e){return[a({opacity:1,scale:1,duration:.25},e),{opacity:0,scale:.85}]}));export{i as M,s as P};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@infinityfx/lively",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Feature complete, lightweight react animation library.",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -1 +0,0 @@
1
- "use strict";var t=require("@babel/runtime/helpers/slicedToArray"),e=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/objectWithoutProperties"),n=require("@babel/runtime/helpers/classCallCheck"),i=require("@babel/runtime/helpers/createClass"),a=require("@babel/runtime/helpers/inherits"),o=require("@babel/runtime/helpers/possibleConstructorReturn"),u=require("@babel/runtime/helpers/getPrototypeOf"),l=require("./link-b0ac399e.js");function s(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var c=s(t),f=s(e),h=s(r),p=s(n),v=s(i),y=s(a),d=s(o),b=s(u);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 g(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 g(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 a,o=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function g(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 O=function t(e,r,n,i){if(l.is.object(e)){var a={};for(var o in e)a[o]=t(e[o],r[o],n,i);return a}return[i(e[0],r[0],n),e[1]]},w=function(t,e,r){return l.is.number(t)&&l.is.number(e)?t*(1-r)+e*r:r>.5?e:t},j={constant:function(t){return t},linear:w,ease:function(t,e,r){return w(t,e,(1-Math.cos(r*Math.PI))/2)},spring:function(t,e,r){return r=1-1*Math.exp(-3.6*r)*Math.cos(2.5*Math.pow(r,2)*Math.PI),w(t,e,r)}},P=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.reverse,i=void 0!==n&&n,a=r.repeat,o=void 0===a?1:a,u=r.delay,l=void 0===u?0:u,s=r.alternate,c=void 0!==s&&s,f=r.callback;p.default(this,t),this.indices={},this.clip=e,this.t=0,this.T=e.duration*o+l,this.reverse=i,this.delay=l,this.alternate=c,this.callback=f}return v.default(t,[{key:"getInterpolatedValue",value:function(t,e,r,n){if(l.is.function(e))return l.Units.toBase(l.convert(e(r,this.clip.duration),t),t,n);t in this.indices||(this.indices[t]=this.reverse?e.length-1:0);var i,a=this.reverse?-1:1,o=this.indices[t],u=e[o],s=e[o+a],c=u.set;if(this.reverse?s.time>r:s.time<r){this.indices[t]=o+=a;var f=["start","end"],h=f[+!this.reverse],p=f[+this.reverse];h in u||p in s?(c=h in u?u[h]:s[p],i=!0):(u=e[o],s=e[o+a])}if(l.is.null(c)&&(c=l.getProperty(n,t)),c=l.Units.toBase(c,t,n),i)return c;var v=l.is.null(s.set)?l.getProperty(n,t):s.set;v=l.Units.toBase(v,t,n);var y=j[s.interpolate||this.clip.interpolate]||j.ease;return O(c,v,(r-u.time)/(s.time-u.time),y)}},{key:"get",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r={},n=this.t>=this.T;if(this.t<this.delay||e&&!n&&!l.isVisible(t))return r;var i=this.t-this.delay,a=this.clip.duration,o=this.alternate&&Math.floor(i/a)%2==+!n;for(var u in i=n?a:i%a,i=l.xor(this.reverse,o)?a-i:i,r.origin=this.clip.origin,this.clip.properties)r[u]=this.getInterpolatedValue(u,this.clip.properties[u],i,t);return r}},{key:"step",value:function(t){var e=this.t>=this.T;return this.t+=t,e&&l.is.function(this.callback)&&this.callback(),e}}]),t}();function k(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=b.default(t);if(e){var i=b.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return d.default(this,r)}}var S=function(t){y.default(r,t);var e=k(r);function r(t){var n;return p.default(this,r),(n=e.call(this,{duration:1/0,properties:{},origin:{x:.5,y:.5},interpolate:t})).isEmpty=!0,n.cache={},n}return v.default(r,[{key:"add",value:function(t,e){this.clip.properties[t]=e,this.isEmpty=!1}},{key:"getInterpolatedValue",value:function(t,e,r,n){l.is.null(e.internal.t)&&(e.internal.t=r),e.internal.t===r&&(this.cache[t]={});var i=e.internal.duration?Math.min((r-e.internal.t)/e.internal.duration,1):1,a=this.cache[t]||{};if(a.t===i)return a.value;var o=l.Units.toBase(l.convert(e(),t),t,n);if(1!=i){var u=l.getProperty(n,t);u=l.Units.toBase(u,t,n);var s=j[this.clip.interpolate]||j.linear;o=O(u,o,i,s)}return this.cache[t]={value:o,t:i},o}}]),r}(P),I=["duration","delay","repeat","alternate","interpolate","origin"];function x(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 A(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 A(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 a,o=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function A(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 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 M(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){f.default(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}var T=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.duration,n=void 0===r?1:r,i=e.delay,a=e.repeat,o=e.alternate,u=e.interpolate,s=e.origin,f=void 0===s?{x:.5,y:.5}:s,v=h.default(e,I),y=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};p.default(this,t),this.duration=n,this.origin=l.originToStr(f),this.channel=new S(u);var d=this.parse(v,y),b=c.default(d,2);this.properties=b[0],this.initials=b[1],this.isEmpty=l.is.empty(this.properties),this.interpolate=u,this.defaults={delay:i,repeat:a,alternate:o}}return v.default(t,[{key:"length",value:function(){return this.duration*(this.defaults.repeat||1)+(this.defaults.delay||0)}},{key:"parse",value:function(t,e){var r=this,n=function(n){var i=t[n];if(l.Link.isInstance(i))return r.channel.add(n,i),delete t[n],"continue";if(l.is.function(i))return"continue";(i=l.is.array(i)?i:[i]).length<2?i.unshift(n in e?e[n]:null):l.is.null(i[0])||(e[n]=i[0]);for(var a=i.map((function(t){return r.sanitize(t,n)})),o=0;o<a.length;o++)r.quantize(a,o);t[n]=a};for(var i in t)n(i);for(var a in e=M({},e))e[a]=l.convert(e[a],a);return[t,e]}},{key:"sanitize",value:function(t,e){t=l.is.object(t)?M({},t):{set:t},l.hasSomeKey(t,l.POSITIONS)||(t={set:t}),"set"in t||(t.set=t.start||t.end),"time"in t&&t.time>this.duration&&delete t.time;var r,n=x(l.POSITIONS);try{for(n.s();!(r=n.n()).done;){var i=r.value;i in t&&(t[i]=l.convert(t[i],e))}}catch(t){n.e(t)}finally{n.f()}return t}},{key:"quantize",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e-1;if("time"in t[e])return t[e].time;if(0==e||e==t.length-1)return t[e].time=0==e?0:this.duration;var n=this.quantize(t,r,r);return t[e].time=n+(this.quantize(t,e+1,r)-n)*((e-r)/(e-r+1))}},{key:"play",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new P(this,l.mergeObjects(t,this.defaults))}}]),t}(),B={create:function(t){var e=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.use=t.use.bind(t,e),t};return e.use=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t(e),n=c.default(r,2),i=n[0],a=n[1];return new T(i,a)},e},isInstance:function(t){return l.is.function(t)&&l.is.function(t.use)}};exports.Animation=B,exports.Clip=T,exports.computeMorph=function(t,e,r){var n,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a={duration:i},o={},u=m(r);try{for(u.s();!(n=u.n()).done;){var l=n.value;"scale"==l?(a.scale={x:1,y:1},o.scale={x:1+(e.layout.width-t.layout.width)/t.layout.width,y:1+(e.layout.height-t.layout.height)/t.layout.height}):"translate"==l?(a.translate={x:0,y:0},o.translate={x:(e.layout.x-t.layout.x)*t.layout.parentWidth,y:(e.layout.y-t.layout.y)*t.layout.parentHeight}):(a[l]=t[l],o[l]=e[l])}}catch(t){u.e(t)}finally{u.f()}return new T(a,o)};
@@ -1 +0,0 @@
1
- import t from"@babel/runtime/helpers/slicedToArray";import e from"@babel/runtime/helpers/defineProperty";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 u from"@babel/runtime/helpers/getPrototypeOf";import{i as l,U as s,e as c,g as f,f as h,x as p,h as v,d as y,j as d,L as m,P as b}from"./link-d312db50.js";function g(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 w(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 w(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 a,o=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function w(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 O=function t(e,r,n,i){if(l.object(e)){var a={};for(var o in e)a[o]=t(e[o],r[o],n,i);return a}return[i(e[0],r[0],n),e[1]]},j=function(t,e,r){return l.number(t)&&l.number(e)?t*(1-r)+e*r:r>.5?e:t},k={constant:function(t){return t},linear:j,ease:function(t,e,r){return j(t,e,(1-Math.cos(r*Math.PI))/2)},spring:function(t,e,r){return r=1-1*Math.exp(-3.6*r)*Math.cos(2.5*Math.pow(r,2)*Math.PI),j(t,e,r)}},P=function(t,e,r){var n,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a={duration:i},o={},u=g(r);try{for(u.s();!(n=u.n()).done;){var l=n.value;"scale"==l?(a.scale={x:1,y:1},o.scale={x:1+(e.layout.width-t.layout.width)/t.layout.width,y:1+(e.layout.height-t.layout.height)/t.layout.height}):"translate"==l?(a.translate={x:0,y:0},o.translate={x:(e.layout.x-t.layout.x)*t.layout.parentWidth,y:(e.layout.y-t.layout.y)*t.layout.parentHeight}):(a[l]=t[l],o[l]=e[l])}}catch(t){u.e(t)}finally{u.f()}return new z(a,o)},x=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.reverse,a=void 0!==i&&i,o=r.repeat,u=void 0===o?1:o,l=r.delay,s=void 0===l?0:l,c=r.alternate,f=void 0!==c&&c,h=r.callback;n(this,t),this.indices={},this.clip=e,this.t=0,this.T=e.duration*u+s,this.reverse=a,this.delay=s,this.alternate=f,this.callback=h}return i(t,[{key:"getInterpolatedValue",value:function(t,e,r,n){if(l.function(e))return s.toBase(c(e(r,this.clip.duration),t),t,n);t in this.indices||(this.indices[t]=this.reverse?e.length-1:0);var i,a=this.reverse?-1:1,o=this.indices[t],u=e[o],h=e[o+a],p=u.set;if(this.reverse?h.time>r:h.time<r){this.indices[t]=o+=a;var v=["start","end"],y=v[+!this.reverse],d=v[+this.reverse];y in u||d in h?(p=y in u?u[y]:h[d],i=!0):(u=e[o],h=e[o+a])}if(l.null(p)&&(p=f(n,t)),p=s.toBase(p,t,n),i)return p;var m=l.null(h.set)?f(n,t):h.set;m=s.toBase(m,t,n);var b=k[h.interpolate||this.clip.interpolate]||k.ease;return O(p,m,(r-u.time)/(h.time-u.time),b)}},{key:"get",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r={},n=this.t>=this.T;if(this.t<this.delay||e&&!n&&!h(t))return r;var i=this.t-this.delay,a=this.clip.duration,o=this.alternate&&Math.floor(i/a)%2==+!n;for(var u in i=n?a:i%a,i=p(this.reverse,o)?a-i:i,r.origin=this.clip.origin,this.clip.properties)r[u]=this.getInterpolatedValue(u,this.clip.properties[u],i,t);return r}},{key:"step",value:function(t){var e=this.t>=this.T;return this.t+=t,e&&l.function(this.callback)&&this.callback(),e}}]),t}();function A(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=u(t);if(e){var i=u(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return o(this,r)}}var I=function(t){a(r,x);var e=A(r);function r(t){var i;return n(this,r),(i=e.call(this,{duration:1/0,properties:{},origin:{x:.5,y:.5},interpolate:t})).isEmpty=!0,i.cache={},i}return i(r,[{key:"add",value:function(t,e){this.clip.properties[t]=e,this.isEmpty=!1}},{key:"getInterpolatedValue",value:function(t,e,r,n){l.null(e.internal.t)&&(e.internal.t=r),e.internal.t===r&&(this.cache[t]={});var i=e.internal.duration?Math.min((r-e.internal.t)/e.internal.duration,1):1,a=this.cache[t]||{};if(a.t===i)return a.value;var o=s.toBase(c(e(),t),t,n);if(1!=i){var u=f(n,t);u=s.toBase(u,t,n);var h=k[this.clip.interpolate]||k.linear;o=O(u,o,i,h)}return this.cache[t]={value:o,t:i},o}}]),r}(),S=["duration","delay","repeat","alternate","interpolate","origin"];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 B(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 B(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 a,o=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function B(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 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 E(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?C(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var z=function(){function e(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=i.duration,o=void 0===a?1:a,u=i.delay,s=i.repeat,c=i.alternate,f=i.interpolate,h=i.origin,p=void 0===h?{x:.5,y:.5}:h,v=r(i,S),y=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n(this,e),this.duration=o,this.origin=d(p),this.channel=new I(f);var m=this.parse(v,y),b=t(m,2);this.properties=b[0],this.initials=b[1],this.isEmpty=l.empty(this.properties),this.interpolate=f,this.defaults={delay:u,repeat:s,alternate:c}}return i(e,[{key:"length",value:function(){return this.duration*(this.defaults.repeat||1)+(this.defaults.delay||0)}},{key:"parse",value:function(t,e){var r=this,n=function(n){var i=t[n];if(m.isInstance(i))return r.channel.add(n,i),delete t[n],"continue";if(l.function(i))return"continue";(i=l.array(i)?i:[i]).length<2?i.unshift(n in e?e[n]:null):l.null(i[0])||(e[n]=i[0]);for(var a=i.map((function(t){return r.sanitize(t,n)})),o=0;o<a.length;o++)r.quantize(a,o);t[n]=a};for(var i in t)n(i);for(var a in e=E({},e))e[a]=c(e[a],a);return[t,e]}},{key:"sanitize",value:function(t,e){t=l.object(t)?E({},t):{set:t},v(t,b)||(t={set:t}),"set"in t||(t.set=t.start||t.end),"time"in t&&t.time>this.duration&&delete t.time;var r,n=M(b);try{for(n.s();!(r=n.n()).done;){var i=r.value;i in t&&(t[i]=c(t[i],e))}}catch(t){n.e(t)}finally{n.f()}return t}},{key:"quantize",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e-1;if("time"in t[e])return t[e].time;if(0==e||e==t.length-1)return t[e].time=0==e?0:this.duration;var n=this.quantize(t,r,r);return t[e].time=n+(this.quantize(t,e+1,r)-n)*((e-r)/(e-r+1))}},{key:"play",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new x(this,y(t,this.defaults))}}]),e}(),R={create:function(e){var r=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.use=t.use.bind(t,e),t};return r.use=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e(r),i=t(n,2),a=i[0],o=i[1];return new z(a,o)},r},isInstance:function(t){return l.function(t)&&l.function(t.use)}};export{R as A,z as C,P as c};