@infinityfx/lively 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/_rollupPluginBabelHelpers-7a0b7756.js +3 -0
- package/dist/cjs/animations.js +1 -0
- package/dist/cjs/hooks.js +1 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/pop-4d766072.js +1 -0
- package/dist/esm/_rollupPluginBabelHelpers-e1425fd3.js +3 -0
- package/dist/esm/animations.js +1 -0
- package/dist/esm/hooks.js +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/pop-daf75174.js +1 -0
- package/package.json +26 -12
- package/dist/index.js +0 -3
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";function t(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function r(){
|
|
2
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
3
|
+
r=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{u({},"")}catch(t){u=function(t,r,e){return t[r]=e}}function f(t,r,e,n){var o=r&&r.prototype instanceof p?r:p,i=Object.create(o.prototype),a=new _(n||[]);return i._invoke=function(t,r,e){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return P()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=O(a,e);if(c){if(c===s)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===n)throw n="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n="executing";var u=l(t,r,e);if("normal"===u.type){if(n=e.done?"completed":"suspendedYield",u.arg===s)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n="completed",e.method="throw",e.arg=u.arg)}}}(t,e,a),i}function l(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var s={};function p(){}function h(){}function y(){}var v={};u(v,i,(function(){return this}));var d=Object.getPrototypeOf,b=d&&d(d(E([])));b&&b!==e&&n.call(b,i)&&(v=b);var m=y.prototype=p.prototype=Object.create(v);function g(t){["next","throw","return"].forEach((function(r){u(t,r,(function(t){return this._invoke(r,t)}))}))}function w(t,r){function e(o,i,a,c){var u=l(t[o],t,i);if("throw"!==u.type){var f=u.arg,s=f.value;return s&&"object"==typeof s&&n.call(s,"__await")?r.resolve(s.__await).then((function(t){e("next",t,a,c)}),(function(t){e("throw",t,a,c)})):r.resolve(s).then((function(t){f.value=t,a(f)}),(function(t){return e("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,n){function i(){return new r((function(r,o){e(t,n,r,o)}))}return o=o?o.then(i,i):i()}}function O(t,r){var e=t.iterator[r.method];if(void 0===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,O(t,r),"throw"===r.method))return s;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var n=l(e,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,s;var o=n.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,s):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,s)}function j(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function x(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function _(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function E(t){if(t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var e=-1,o=function r(){for(;++e<t.length;)if(n.call(t,e))return r.value=t[e],r.done=!1,r;return r.value=void 0,r.done=!0,r};return o.next=o}}return{next:P}}function P(){return{value:void 0,done:!0}}return h.prototype=y,u(m,"constructor",y),u(y,"constructor",h),h.displayName=u(y,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===h||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,u(t,c,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},g(w.prototype),u(w.prototype,a,(function(){return this})),t.AsyncIterator=w,t.async=function(r,e,n,o,i){void 0===i&&(i=Promise);var a=new w(f(r,e,n,o),i);return t.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},g(m),u(m,c,"Generator"),u(m,i,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=E,_.prototype={constructor:_,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function e(e,n){return a.type="throw",a.arg=t,r.next=e,n&&(r.method="next",r.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return e("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return e(i.catchLoc,!0);if(this.prev<i.finallyLoc)return e(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return e(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return e(i.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,s):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),s},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),x(e),s}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;x(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:E(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),s}},t}function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function n(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}function o(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function i(t,r,e){return r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function a(){return a=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},a.apply(this,arguments)}function c(t){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},c(t)}function u(t,r){return u=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},u(t,r)}function f(t,r){if(r&&("object"==typeof r||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function l(t,r){if(t){if("string"==typeof t)return s(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?s(t,r):void 0}}function s(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}exports._asyncToGenerator=function(t){return function(){var r=this,e=arguments;return new Promise((function(o,i){var a=t.apply(r,e);function c(t){n(a,o,i,c,u,"next",t)}function u(t){n(a,o,i,c,u,"throw",t)}c(void 0)}))}},exports._classCallCheck=function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")},exports._createClass=function(t,r,e){return r&&o(t.prototype,r),e&&o(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t},exports._createSuper=function(t){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(t){return!1}}();return function(){var e,n=c(t);if(r){var o=c(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return f(this,e)}},exports._defineProperty=i,exports._extends=a,exports._inherits=function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&&u(t,r)},exports._objectSpread2=function(r){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?t(Object(n),!0).forEach((function(t){i(r,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(n,t))}))}return r},exports._objectWithoutProperties=function(t,r){if(null==t)return{};var e,n,o=function(t,r){if(null==t)return{};var e,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)e=i[n],r.indexOf(e)>=0||(o[e]=t[e]);return o}(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)e=i[n],r.indexOf(e)>=0||Object.prototype.propertyIsEnumerable.call(t,e)&&(o[e]=t[e])}return o},exports._regeneratorRuntime=r,exports._slicedToArray=function(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==e)return;var n,o,i=[],a=!0,c=!1;try{for(e=e.call(t);!(a=(n=e.next()).done)&&(i.push(n.value),!r||i.length!==r);a=!0);}catch(t){c=!0,o=t}finally{try{a||null==e.return||e.return()}finally{if(c)throw o}}return i}(t,r)||l(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()},exports._toConsumableArray=function(t){return function(t){if(Array.isArray(t))return s(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||l(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()},exports._typeof=e;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./pop-4d766072.js"),r=require("./_rollupPluginBabelHelpers-7a0b7756.js");function o(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{scaleCorrection:e.scaleCorrection,use:o.use.bind(this,e)}}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{scaleCorrection:e.scaleCorrection,use:i.use.bind(this,e)}}function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{scaleCorrection:e.scaleCorrection,use:t.use.bind(this,e)}}o.use=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=r.scaleCorrection,i=void 0!==o&&o;return new e.Animation({opacity:1,scaleCorrection:i,duration:.65},{opacity:0})},i.use=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=r.direction,i=void 0===o?"right":o,t=r.scaleCorrection,n=void 0!==t&&t,c=0,s=1,a={x:0,y:.5};switch(i){case"left":a.x=1;break;case"up":c=1,s=0,a={x:0,y:1};break;case"down":c=1,s=0,a={x:0,y:0}}return new e.Animation({scale:{x:1},scaleCorrection:n,origin:a,duration:.6},{scale:{x:c,y:s}})},t.use=function(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=o.direction,t=void 0===i?"right":i,n=o.scaleCorrection,c=void 0!==n&&n;return["left","right","top","bottom"].includes(t)||(t="right"),new e.Animation({clip:r._defineProperty({},t,0),scaleCorrection:c},{clip:r._defineProperty({},t,1)})},exports.Move=e.Move,exports.Pop=e.Pop,exports.Fade=o,exports.Scale=i,exports.Wipe=t;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./_rollupPluginBabelHelpers-7a0b7756.js"),r=require("react");exports.useUnmount=function(u){var t=r.useState(u),n=e._slicedToArray(t,2),c=n[0],o=n[1],s=r.useRef();return r.useEffect((function(){u&&o(!0),!u&&s.current&&s.current.play(s.current.props.onUnmount,{callback:function(){o(!1)}})}),[u]),[c,s]};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./_rollupPluginBabelHelpers-7a0b7756.js"),t=require("react"),i=require("./pop-4d766072.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=r(t),o=function(r){e._inherits(h,r);var n,o,a,s,l,c,p,u=e._createSuper(h);function h(t){var i;for(var r in e._classCallCheck(this,h),(i=u.call(this,t)).hover=!1,i.hasFocus=!1,i.inView=!1,i.scrollDelta=0,i.viewportMargin=t.viewportMargin,i.elements=[],i.animations={default:i.toAnimation(i.props.animate)},i.props.animations)i.animations[r]=i.toAnimation(i.props.animations[r]);return i.level=0,i.children=[],i}return e._createClass(h,[{key:"toAnimation",value:function(t){return!t||"object"!==e._typeof(t)&&"function"!=typeof t?null:"use"in t?t.use():new i.Animation(e._objectSpread2(e._objectSpread2({},t),{},{scaleCorrection:this.props.scaleCorrection}),this.props.initial)}},{key:"countNestedLevels",value:function(e){var i=this;if(!e)return 0;var r=0,n=0;return t.Children.forEach(e,(function(e){var o;if(t.isValidElement(e)){e.type===h&&(r=1);var a=i.countNestedLevels(null===(o=e.props)||void 0===o?void 0:o.children);n=n<a?a:n}})),n+r}},{key:"componentDidMount",value:function(){var e=this;this.elements.forEach((function(t){var i;null===(i=e.animations.default)||void 0===i||i.setInitialStyles(t)})),(this.props.parentLevel<1||this.props.noCascade)&&(this.scrollEventListener=this.onScroll.bind(this),i.addEventListener("scroll",this.scrollEventListener),this.props.onMount&&this.play(this.props.onMount,{staggerDelay:.001,immediate:!0}),this.props.whileViewport&&this.onScroll())}},{key:"componentWillUnmount",value:function(){i.removeEventListener("scroll",this.scrollEventListener),this.props.onUnmount&&(this.props.parentLevel<1||this.props.noCascade)&&this.play(this.props.onUnmount,{reverse:!0,immediate:!0})}},{key:"inViewport",value:function(){var t=this,i=!0,r=!0;return this.elements.forEach((function(e){var n=e.getBoundingClientRect().y;i=i&&n+e.clientHeight*(1-t.viewportMargin)<window.innerHeight,r=r&&n>window.innerHeight+e.clientHeight*t.viewportMargin})),this.elements.length||this.children.forEach((function(t){var n=t.animatable.inViewport(),o=e._slicedToArray(n,2),a=o[0],s=o[1];i=i&&a,r=r&&s})),[i,r]}},{key:"onScroll",value:(p=e._asyncToGenerator(e._regeneratorRuntime().mark((function t(){var i,r,n,o;return e._regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(Date.now()-this.scrollDelta<350)){t.next=2;break}return t.abrupt("return");case 2:this.scrollDelta=Date.now(),i=this.inViewport(),r=e._slicedToArray(i,2),n=r[0],o=r[1],!this.inView&&n&&(this.inView=!0,this.props.whileViewport&&this.play(this.props.whileViewport)),this.inView&&o&&(this.inView=!1,this.props.whileViewport&&this.play(this.props.whileViewport,{reverse:!0,immediate:!0}));case 6:case"end":return t.stop()}}),t,this)}))),function(){return p.apply(this,arguments)})},{key:"onEnter",value:(c=e._asyncToGenerator(e._regeneratorRuntime().mark((function t(i){var r,n=arguments;return e._regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=n.length>1&&void 0!==n[1]&&n[1],this.hover||(this.props.whileHover&&this.play(this.props.whileHover),this.hover=!0),r&&r(i);case 3:case"end":return e.stop()}}),t,this)}))),function(e){return c.apply(this,arguments)})},{key:"onLeave",value:(l=e._asyncToGenerator(e._regeneratorRuntime().mark((function t(i){var r,n=arguments;return e._regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=n.length>1&&void 0!==n[1]&&n[1],this.hover&&(this.props.whileHover&&this.play(this.props.whileHover,{reverse:!0}),this.hover=!1),r&&r(i);case 3:case"end":return e.stop()}}),t,this)}))),function(e){return l.apply(this,arguments)})},{key:"onFocus",value:(s=e._asyncToGenerator(e._regeneratorRuntime().mark((function t(i){var r,n=arguments;return e._regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=n.length>1&&void 0!==n[1]&&n[1],this.hasFocus||(this.props.whileFocus&&this.play(this.props.whileFocus),this.hasFocus=!0),r&&r(i);case 3:case"end":return e.stop()}}),t,this)}))),function(e){return s.apply(this,arguments)})},{key:"onBlur",value:(a=e._asyncToGenerator(e._regeneratorRuntime().mark((function t(i){var r,n=arguments;return e._regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=n.length>1&&void 0!==n[1]&&n[1],this.hasFocus&&(this.props.whileFocus&&this.play(this.props.whileFocus,{reverse:!0}),this.hasFocus=!1),r&&r(i);case 3:case"end":return e.stop()}}),t,this)}))),function(e){return a.apply(this,arguments)})},{key:"onClick",value:(o=e._asyncToGenerator(e._regeneratorRuntime().mark((function t(i){var r,n=arguments;return e._regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=n.length>1&&void 0!==n[1]&&n[1],this.props.onClick&&this.play(this.props.onClick),r&&r(i);case 3:case"end":return e.stop()}}),t,this)}))),function(e){return o.apply(this,arguments)})},{key:"play",value:(n=e._asyncToGenerator(e._regeneratorRuntime().mark((function t(r){var n,o,a,s,l,c,p,u,h,v,d,m,f,y,g,b,_=this,w=arguments;return e._regeneratorRuntime().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=w.length>1&&void 0!==w[1]?w[1]:{},o=n.callback,a=n.reverse,s=void 0!==a&&a,l=n.immediate,c=void 0!==l&&l,p=n.cascade,u=void 0!==p&&p,h=n.groupAdjust,v=void 0===h?0:h,d=n.cascadeDelay,m=void 0===d?0:d,f=n.staggerDelay,y=void 0===f?0:f,!(this.props.parentLevel>0)||u){e.next=3;break}return e.abrupt("return");case 3:if(g="string"==typeof r?this.animations[r]:this.animations.default){e.next=6;break}return e.abrupt("return");case 6:b=0,this.elements.forEach((function(e,t){var i="group"in _.props?_.props.parentLevel-_.props.group:_.level+v;m=s?g.duration:m;var r=s?i*m:(_.props.parentLevel-i)*m;r=_.props.stagger*t+r+y,b=r>b?r:b,g.play(e,{delay:r,reverse:s,immediate:c})})),this.children.forEach((function(e){var t=e.animatable,i=e.staggerIndex,n=void 0===i?-1:i;null==t||t.play(r,{reverse:s,immediate:c,cascade:!0,staggerDelay:n<0?0:_.props.stagger*n,cascadeDelay:g.duration,groupAdjust:n<0?0:1})})),o&&i.AnimationQueue.delay(o,b+g.duration);case 10:case"end":return e.stop()}}),t,this)}))),function(e){return n.apply(this,arguments)})},{key:"style",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e._objectSpread2(e._objectSpread2({},t),{},{transitionProperty:"transform, opacity, clip-path, border-radius, background-color, color, width, height, left, top",willChange:"transform"});return i}},{key:"mergeProperties",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e._objectSpread2(e._objectSpread2({},i),t);for(var n in r)["children","parentLevel","ref"].includes(n)?delete r[n]:"object"===e._typeof(t[n])&&"object"===e._typeof(i[n])&&(r[n]=e._objectSpread2(e._objectSpread2({},i[n]),t[n]));return r}},{key:"deepClone",value:function(i){var r,n=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=o.index,s=void 0===a?0:a,l=o.useElements,c=void 0!==l&&l,p=o.useEvents,u=void 0!==p&&p;if(!t.isValidElement(i))return i;var v,d={};i.type!==h&&(c&&(d={style:this.style(null===(v=i.props)||void 0===v?void 0:v.style),ref:function(e){return n.elements[s]=e}}),u&&(this.props.parentLevel<1||this.props.noCascade)&&(d=e._objectSpread2(e._objectSpread2({},d),{},{onMouseEnter:function(e){var t;return n.onEnter(e,null===(t=i.props)||void 0===t?void 0:t.onMouseEnter)},onMouseLeave:function(e){var t;return n.onLeave(e,null===(t=i.props)||void 0===t?void 0:t.onMouseLeave)},onFocus:function(e){var t;return n.onFocus(e,null===(t=i.props)||void 0===t?void 0:t.onFocus)},onBlur:function(e){var t;return n.onBlur(e,null===(t=i.props)||void 0===t?void 0:t.onBlur)},onClick:function(e){var t;return n.onClick(e,null===(t=i.props)||void 0===t?void 0:t.onClick)}}),u=!1));i.type!==h||null!==(r=i.props)&&void 0!==r&&r.noCascade||(d=e._objectSpread2(e._objectSpread2(e._objectSpread2({},d),this.mergeProperties(i.props,this.props)),{},{parentLevel:this.parentLevel>0?this.parentLevel:this.level,ref:function(e){return n.children[n.children.length]={animatable:e,staggerIndex:c?s:-1}}}));var m=t.Children.map(i.props.children,(function(e,t){return n.deepClone(e,{index:t,useEvents:u})}));return Object.values(d).length?t.cloneElement(i,d,m):i}},{key:"render",value:function(){var e=this;return this.level=this.countNestedLevels(this.props.children),t.Children.map(this.props.children,(function(t,i){return e.deepClone(t,{index:i,useElements:!0,useEvents:!0})}))}}]),h}(t.Component);e._defineProperty(o,"defaultProps",{scaleCorrection:!1,parentLevel:0,stagger:.1,viewportMargin:.25,animate:{},animations:{}});var a=["levels","animations"],s=function(i){e._inherits(s,i);var r=e._createSuper(s);function s(t){var i;return e._classCallCheck(this,s),(i=r.call(this,t)).levels=i.props.levels,i.animations=new Array(i.levels).fill(0).map((function(e,t){return t<i.props.animations.length?i.props.animations[t]:i.props.animations[i.props.animations.length-1]})),i}return e._createClass(s,[{key:"makeAnimatable",value:function(i){var r=this,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(s<1||t.Children.count(i)<1)return i;var l=this.props;l.levels,l.animations;var c=e._objectWithoutProperties(l,a),p=this.animations[this.levels-s];return s===this.levels&&(c.ref=function(e){return r.animatable=e}),n.default.createElement(o,e._extends({animate:p,scaleCorrection:p.scaleCorrection},c),t.Children.map(i,(function(e){return t.isValidElement(e)?t.cloneElement(e,{},r.makeAnimatable(e.props.children,s-1)):e})))}},{key:"play",value:function(t){var i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};null===(i=this.animatable)||void 0===i||i.play(t,e._objectSpread2(e._objectSpread2({},r),{},{reverse:!0}))}},{key:"render",value:function(){return this.makeAnimatable(this.props.children,this.levels)}}]),s}(t.Component);e._defineProperty(s,"defaultProps",{levels:1,stagger:.1,viewportMargin:.25,animations:[i.Move,i.Pop]});var l=function(t){e._inherits(n,t);var r=e._createSuper(n);function n(t){var i;return e._classCallCheck(this,n),(i=r.call(this,t)).animations.morphs=[],i}return e._createClass(n,[{key:"componentDidMount",value:function(){var e=this,t=this.elements[0];t&&(i.Animation.setInitial(t),t.setAttribute("uitools-morph-id",this.props.id),t.setAttribute("uitools-morph-active",this.props.active),this.self=t,this.createResetAnimation(),i.AnimationQueue.delay((function(){for(var i=document.querySelectorAll('[uitools-morph-id="'.concat(e.props.id,'"]')),r=0;r<i.length;r++)i[r]!==t&&(e.createMorphAnimation(i[r],r),"true"!==i[r].getAttribute("uitools-morph-active")&&e.animations.transition.setInitialStyles(i[r]))}),.001))}},{key:"componentDidUpdate",value:function(){var e=this,t="true"===this.self.getAttribute("uitools-morph-active");this.self.setAttribute("uitools-morph-active",this.props.active),i.AnimationQueue.delay((function(){if(e.props.active&&!t)e.animations.transition.setInitialStyles(e.self),e.animations.transition.play(e.self);else if(!e.props.active&&t){for(var i=0,r=document.querySelectorAll('[uitools-morph-id="'.concat(e.props.id,'"]')),n=0;n<r.length;n++)if(r[n]!==e.self&&"true"===r[n].getAttribute("uitools-morph-active")){i=n;break}e.animations.morphs[i].play(e.self)}}),.001)}},{key:"createResetAnimation",value:function(){var e,t=null===(e=this.self.UITools)||void 0===e?void 0:e.initialStyles;this.animations.transition=new i.Animation({opacity:[0,0,1],scale:{x:1,y:1},position:{x:0,y:0},borderRadius:t.borderRadius,backgroundColor:[t.backgroundColor,t.backgroundColor,t.backgroundColor],scaleCorrection:this.scaleCorrection},{})}},{key:"createMorphAnimation",value:function(e,t){var r,n,o=null===(r=this.self.UITools)||void 0===r?void 0:r.initialStyles,a=null===(n=e.UITools)||void 0===n?void 0:n.initialStyles;this.animations.morphs[t]=new i.Animation({position:[{x:0,y:0},{x:a.x-o.x+(a.clientWidth-o.clientWidth)/2,y:a.y-o.y+(a.clientHeight-o.clientHeight)/2},{x:a.x-o.x+(a.clientWidth-o.clientWidth)/2,y:a.y-o.y+(a.clientHeight-o.clientHeight)/2}],scale:[{x:1,y:1},{x:a.clientWidth/o.clientWidth,y:a.clientHeight/o.clientHeight},{x:a.clientWidth/o.clientWidth,y:a.clientHeight/o.clientHeight}],opacity:[1,1,0],borderRadius:[o.borderRadius,a.borderRadius,a.borderRadius],backgroundColor:[o.backgroundColor,a.backgroundColor,a.backgroundColor],scaleCorrection:this.scaleCorrection},{})}}]),n}(o);e._defineProperty(l,"defaultProps",{id:0,active:!1,scaleCorrection:!1}),exports.Animatable=o,exports.Animate=s,exports.Morph=l;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var t=require("./_rollupPluginBabelHelpers-7a0b7756.js"),e=function(){function e(){t._classCallCheck(this,e),this.queue=[],this.tick()}var i,n;return t._createClass(e,[{key:"tick",value:(n=t._asyncToGenerator(t._regeneratorRuntime().mark((function e(){var i,n;return t._regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:i=Date.now(),n=0;case 2:if(!(n<this.queue.length+1)){t.next=10;break}if(!(this.queue.length===n||this.queue[n].timestamp>i)){t.next=6;break}return this.queue.splice(0,n),t.abrupt("break",10);case 6:this.queue[n].callback();case 7:n++,t.next=2;break;case 10:requestAnimationFrame(this.tick.bind(this));case 11:case"end":return t.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"search",value:function(t){for(var e,i,n=0,o=this.queue.length-1;n<=o;)if(e=n+o>>>1,(i=this.queue[e].timestamp-t.timestamp)<0)n=e+1;else{if(!(i>0))return e;o=e-1}return n}},{key:"insert",value:function(t){var e=this.search(t);this.queue.splice(e,0,t)}},{key:"delay",value:function(t,e){t instanceof Function&&this.insert({callback:t,timestamp:Date.now()+1e3*e})}}],[{key:"get",value:function(){return"UITools"in window||(window.UITools={}),"AnimationLoop"in window.UITools||(window.UITools.AnimationQueue=new e),window.UITools.AnimationQueue}},{key:"delay",value:(i=t._asyncToGenerator(t._regeneratorRuntime().mark((function e(i,n){return t._regeneratorRuntime().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.get().delay(i,n));case 1:case"end":return t.stop()}}),e,this)}))),function(t,e){return i.apply(this,arguments)})},{key:"sleep",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return new Promise((function(i){t.delay(i,e)}))}}]),e}(),i=function(e){var i=e.match(/^#([\da-f]{1,2})([\da-f]{1,2})([\da-f]{1,2})([\da-f]{2})?/i),n=t._slicedToArray(i,5);n[0];var o=n[1],r=n[2],a=n[3],s=n[4];return{r:parseInt(o.padStart(2,o),16),g:parseInt(r.padStart(2,r),16),b:parseInt(a.padStart(2,a),16),a:void 0!==s?parseInt(s,16):255}},n=function(e){var i=e.match(/^rgba?\((\d+)\D+(\d+)\D+(\d+)\D*(\d+)?\)/i),n=t._slicedToArray(i,5);n[0];var o=n[1],r=n[2],a=n[3],s=n[4];return{r:parseInt(o),g:parseInt(r),b:parseInt(a),a:void 0!==s?parseInt(s):255}},o=["delay","duration","loop","interpolate","origin","scaleCorrection"],r=function(){function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.delay,n=void 0===i?0:i,a=e.duration,s=void 0===a?1:a,l=e.loop,c=void 0!==l&&l,u=e.interpolate,d=void 0===u?"ease":u,p=e.origin,h=void 0===p?{x:.5,y:.5}:p,v=e.scaleCorrection,f=void 0!==v&&v,y=t._objectWithoutProperties(e,o),g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};t._classCallCheck(this,r),this.scaleCorrection=f,this.keyframes=this.getKeyframes(y,g),this.delay=n,this.duration=s,this.delta=s/(this.keyframes.length-1),this.interpolation=d,this.origin=this.originToStyle(h),this.loop=c}return t._createClass(r,[{key:"originToStyle",value:function(e){var i=.5,n=.5;if("object"===t._typeof(e))i=e.x,n=e.y;else if("string"==typeof e)switch(e){case"left":i=0;break;case"right":i=1;break;case"top":n=0;break;case"bottom":n=1}else i=n=e;return"".concat(100*i,"% ").concat(100*n,"%")}},{key:"getKeyframes",value:function(e){var i=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=0,a=function(a){var s=a in n?n[a]:r.initials[a];Array.isArray(e[a])||(e[a]=[e[a]]),e[a]=e[a].length>1?e[a]:[s].concat(t._toConsumableArray(e[a])),e[a]=e[a].map((function(t){return i.sanitize(a,t)})),o=e[a].length>o?e[a].length:o};for(var s in e)a(s);return new Array(o).fill(0).map((function(t,n){var a={};for(var s in e)s in r.initials&&(a[s]=i.interpolateKeyframe(e[s],n,o));return i.keyframeToStyle(a)}))}},{key:"sanitize",value:function(e,o){var a=this,s=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("string"==typeof o){if(o.match(/^#[0-9a-f]{3,8}$/i))return i(o);if(o.match(/^rgba?\(.*\)$/i))return n(o);var l=parseFloat(o),c=o.match(/[^0-9\.]*$/i);return isNaN(l)?r.initials[e]:("%"===c&&(l/=100),c?[l,c]:l)}if("object"===t._typeof(o)){var u=Object.keys(o);("x"in o||"y"in o)&&(u=["x","y"]),("r"in o||"g"in o||"b"in o||"a"in o)&&(u=["r","g","b","a"]),("left"in o||"right"in o||"top"in o||"bottom"in o)&&(u=["left","right","top","bottom"]),u.forEach((function(t){o[t]=a.sanitize(e,o[t],t)}))}return void 0!==o?o:r.initials[e][s]}},{key:"interpolate",value:function(t,e,i){if("string"==typeof t||"string"==typeof e)return i>.5?e:t;var n=!1;Array.isArray(t)&&(n=t[1],t=t[0]),Array.isArray(e)&&(n=e[1],e=e[0]);var o=t*(1-i)+e*i;return n?[o,n]:o}},{key:"interpolateKeyframe",value:function(e,i,n){var o=this;if(e.length===n)return e[i];var r=i*((e.length-1)/(n-1)),a=Math.floor(r),s=e[a];if(a===e.length-1)return s;var l=e[a+1];if("object"===t._typeof(s)){var c={};return Object.keys(s).forEach((function(t){c[t]=o.interpolate(s[t],l[t],r-a)})),c}return this.interpolate(s,l,r-a)}},{key:"toString",value:function(t,e){return Array.isArray(t)&&(e=t[1],t=t[0]),t*("%"===e?100:1)+e}},{key:"toLength",value:function(t){return Array.isArray(t)&&(t="px"===t[1]?t[0]+"px":t[0]),t}},{key:"keyframeToStyle",value:function(e){var i=this,n={transform:""};return Object.entries(e).forEach((function(e){var o=t._slicedToArray(e,2),r=o[0],a=o[1];switch(r){case"position":n.transform+="translate(".concat(i.toString(a.x,"px"),", ").concat(i.toString(a.y,"px"),") ");break;case"scale":if("number"==typeof a&&(a={x:a,y:a}),i.scaleCorrection){n.width=i.toLength(a.x),n.height=i.toLength(a.y);break}n.transform+="scale(".concat(i.toString(a.x,"%"),", ").concat(i.toString(a.y,"%"),") ");break;case"rotation":n.transform+="rotate(".concat((i.toString(a),"deg"),") ");break;case"clip":n.clipPath="inset(".concat(i.toString(a.top,"%")," ").concat(i.toString(a.right,"%")," ").concat(i.toString(a.bottom,"%")," ").concat(i.toString(a.left,"%"),")");break;case"borderRadius":n[r]=i.toString(a,"px");break;case"backgroundColor":case"color":n[r]="rgba(".concat(a.r,", ").concat(a.g,", ").concat(a.b,", ").concat(a.a,")");break;case"opacity":case"active":n[r]=a}})),n.transform.length||delete n.transform,n}},{key:"setInitialStyles",value:function(t){r.setInitial(t);var e=this.keyframes[0];t.style.transitionDuration="0s",this.apply(t,e,!0)}},{key:"test",value:function(t,e,i,n,o,r){var a=n+o+((i-=e-(t="string"==typeof t?parseInt(t)/e:t)*e)<0?i:0),s=n/(n+o);return{size:(i<0?0:i)+"px",padStart:(n=r?t*n:a*s)+"px",padEnd:(o=r?t*o:a*(1-s))+"px"}}},{key:"apply",value:function(i,n){var o=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=function(){var e=i.UITools.initialStyles;Object.entries(n).forEach((function(n){var r=t._slicedToArray(n,2),a=r[0],s=r[1];if("width"===a){var l=e.clientWidth,c=e.width,u=e.paddingLeft,d=e.paddingRight,p=e.includePadding,h=o.test(s,l,c,u,d,p),v=h.size,f=h.padStart,y=h.padEnd;return i.style.width=v,i.style.paddingLeft=f,void(i.style.paddingRight=y)}if("height"===a){var g=e.clientHeight,m=e.height,b=e.paddingTop,k=e.paddingBottom,w=e.includePadding,I=o.test(s,g,m,b,k,w),x=I.size,T=I.padStart,U=I.padEnd;return i.style.height=x,i.style.paddingTop=T,void(i.style.paddingBottom=U)}"active"!==a&&(i.style[a]=s)}))};if("active"in n){var s=Object.keys(n.active)[0];"start"===s||r?(i.style.display=n.active[s]?"":"none",r?a():e.delay(a,.01)):(e.delay((function(){i.style.display=n.active[s]?"":"none"}),this.delta),a())}else a()}},{key:"start",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=e.immediate,n=void 0!==i&&i,o=e.reverse,r=void 0!==o&&o;!t.UITools.animating||n?(t.style.transitionDuration="".concat(this.delta,"s"),t.style.transitionTimingFunction=this.interpolation,t.style.transformOrigin=this.origin,t.UITools.animating=!0,t.UITools.index=1,this.getNext(t,r)):t.UITools.queue.push([this,{reverse:r}])}},{key:"play",value:function(t){var i=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=n.delay,r=void 0===o?0:o,a=n.immediate,s=void 0!==a&&a,l=n.reverse,c=void 0!==l&&l;t.style&&(this.delay||r?e.delay((function(){return i.start(t,{immediate:s,reverse:c})}),this.delay+r):this.start(t,{immediate:s,reverse:c}))}},{key:"getNext",value:function(i){var n=this,o=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(i.UITools.index===this.keyframes.length){i.UITools.animating=!1;var r=i.UITools.queue.shift()||[],a=t._slicedToArray(r,2),s=a[0],l=a[1];return s?s.start(i,l):void(this.loop&&this.start(i,l))}var c=i.UITools.index;o&&(c=this.keyframes.length-1-c),requestAnimationFrame((function(){n.apply(i,n.keyframes[c])})),i.UITools.index++,e.delay((function(){return n.getNext(i,o)}),this.delta)}}],[{key:"setInitial",value:function(t){var e=getComputedStyle(t),i=e.width,n=e.height,o=e.paddingLeft,r=e.paddingRight,a=e.paddingTop,s=e.paddingBottom,l=e.borderRadius,c=e.boxSizing,u=e.backgroundColor,d=e.color,p=t.getBoundingClientRect(),h=p.x,v=p.y;"UITools"in t||(t.UITools={}),"queue"in t.UITools||(t.UITools.queue=[]),"initialStyles"in t.UITools||(t.UITools.initialStyles={x:h,y:v,includePadding:"border-box"===c,clientWidth:t.clientWidth,clientHeight:t.clientHeight,width:parseInt(i),height:parseInt(n),paddingLeft:parseInt(o),paddingRight:parseInt(r),paddingTop:parseInt(a),paddingBottom:parseInt(s),borderRadius:parseInt(l.split(" ")[0]),backgroundColor:u,color:d})}}]),r}();function a(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{scaleCorrection:t.scaleCorrection,use:a.use.bind(this,t)}}function s(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{scaleCorrection:t.scaleCorrection,use:s.use.bind(this,t)}}t._defineProperty(r,"initials",{opacity:1,scale:{x:1,y:1},position:{x:0,y:0},clip:{left:0,top:0,right:0,bottom:0},borderRadius:0,active:{start:!0},backgroundColor:{r:127,g:127,b:127,a:255},color:{r:127,g:127,b:127,a:255}}),a.use=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.direction,i=void 0===e?"up":e,n=t.scaleCorrection,o=void 0!==n&&n,a="0px",s="20px";switch(i){case"down":s="-20px";break;case"left":a="20px",s="0px";break;case"right":a="-20px",s="0px"}return new r({position:{x:"0px",y:"0px"},opacity:1,scaleCorrection:o,duration:.5},{position:{x:a,y:s},opacity:0})},s.use=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.scaleCorrection,i=void 0!==e&&e;return new r({opacity:1,scale:1,scaleCorrection:i,duration:.25},{opacity:0,scale:.85})},exports.Animation=r,exports.AnimationQueue=e,exports.Move=a,exports.Pop=s,exports.addEventListener=function(t,e){var i;e instanceof Function&&(null!==(i=window.UITools)&&void 0!==i&&i.Events||(window.UITools={Events:{}}),t in window.UITools.Events||(window.UITools.Events[t]={unique:0},window.addEventListener(t,(function(e){Object.values(window.UITools.Events[t]).forEach((function(t){t instanceof Function&&t(e)}))}))),e.UITools={ListenerID:window.UITools.Events[t].unique},window.UITools.Events[t][window.UITools.Events[t].unique]=e,window.UITools.Events[t].unique++)},exports.removeEventListener=function(t,e){var i,n,o;"undefined"!=typeof window&&null!==(i=window.UITools)&&void 0!==i&&null!==(n=i.Events)&&void 0!==n&&n[t]&&null!=e&&null!==(o=e.UITools)&&void 0!==o&&o.ListenerID&&delete window.UITools.Events[t][e.UITools.ListenerID]};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
function t(t,r){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable}))),e.push.apply(e,n)}return e}function r(r){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?t(Object(n),!0).forEach((function(t){f(r,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach((function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(n,t))}))}return r}function e(){
|
|
2
|
+
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
3
|
+
e=function(){return t};var t={},r=Object.prototype,n=r.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function u(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{u({},"")}catch(t){u=function(t,r,e){return t[r]=e}}function f(t,r,e,n){var o=r&&r.prototype instanceof h?r:h,i=Object.create(o.prototype),a=new E(n||[]);return i._invoke=function(t,r,e){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return L()}for(e.method=o,e.arg=i;;){var a=e.delegate;if(a){var c=O(a,e);if(c){if(c===s)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if("suspendedStart"===n)throw n="completed",e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);n="executing";var u=l(t,r,e);if("normal"===u.type){if(n=e.done?"completed":"suspendedYield",u.arg===s)continue;return{value:u.arg,done:e.done}}"throw"===u.type&&(n="completed",e.method="throw",e.arg=u.arg)}}}(t,e,a),i}function l(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=f;var s={};function h(){}function p(){}function y(){}var v={};u(v,i,(function(){return this}));var d=Object.getPrototypeOf,b=d&&d(d(P([])));b&&b!==r&&n.call(b,i)&&(v=b);var m=y.prototype=h.prototype=Object.create(v);function g(t){["next","throw","return"].forEach((function(r){u(t,r,(function(t){return this._invoke(r,t)}))}))}function w(t,r){function e(o,i,a,c){var u=l(t[o],t,i);if("throw"!==u.type){var f=u.arg,s=f.value;return s&&"object"==typeof s&&n.call(s,"__await")?r.resolve(s.__await).then((function(t){e("next",t,a,c)}),(function(t){e("throw",t,a,c)})):r.resolve(s).then((function(t){f.value=t,a(f)}),(function(t){return e("throw",t,a,c)}))}c(u.arg)}var o;this._invoke=function(t,n){function i(){return new r((function(r,o){e(t,n,r,o)}))}return o=o?o.then(i,i):i()}}function O(t,r){var e=t.iterator[r.method];if(void 0===e){if(r.delegate=null,"throw"===r.method){if(t.iterator.return&&(r.method="return",r.arg=void 0,O(t,r),"throw"===r.method))return s;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return s}var n=l(e,t.iterator,r.arg);if("throw"===n.type)return r.method="throw",r.arg=n.arg,r.delegate=null,s;var o=n.arg;return o?o.done?(r[t.resultName]=o.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=void 0),r.delegate=null,s):o:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,s)}function j(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function x(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function P(t){if(t){var r=t[i];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var e=-1,o=function r(){for(;++e<t.length;)if(n.call(t,e))return r.value=t[e],r.done=!1,r;return r.value=void 0,r.done=!0,r};return o.next=o}}return{next:L}}function L(){return{value:void 0,done:!0}}return p.prototype=y,u(m,"constructor",y),u(y,"constructor",p),p.displayName=u(y,c,"GeneratorFunction"),t.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===p||"GeneratorFunction"===(r.displayName||r.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,y):(t.__proto__=y,u(t,c,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},g(w.prototype),u(w.prototype,a,(function(){return this})),t.AsyncIterator=w,t.async=function(r,e,n,o,i){void 0===i&&(i=Promise);var a=new w(f(r,e,n,o),i);return t.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},g(m),u(m,c,"Generator"),u(m,i,(function(){return this})),u(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var r=[];for(var e in t)r.push(e);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=P,E.prototype={constructor:E,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(x),!t)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function e(e,n){return a.type="throw",a.arg=t,r.next=e,n&&(r.method="next",r.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return e("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return e(i.catchLoc,!0);if(this.prev<i.finallyLoc)return e(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return e(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return e(i.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,s):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),s},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),x(e),s}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;x(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,e){return this.delegate={iterator:P(t),resultName:r,nextLoc:e},"next"===this.method&&(this.arg=void 0),s}},t}function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}function i(t){return function(){var r=this,e=arguments;return new Promise((function(n,i){var a=t.apply(r,e);function c(t){o(a,n,i,c,u,"next",t)}function u(t){o(a,n,i,c,u,"throw",t)}c(void 0)}))}}function a(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")}function c(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function u(t,r,e){return r&&c(t.prototype,r),e&&c(t,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function f(t,r,e){return r in t?Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[r]=e,t}function l(){return l=Object.assign?Object.assign.bind():function(t){for(var r=1;r<arguments.length;r++){var e=arguments[r];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n])}return t},l.apply(this,arguments)}function s(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),r&&p(t,r)}function h(t){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},h(t)}function p(t,r){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},p(t,r)}function y(t,r){if(null==t)return{};var e,n,o=function(t,r){if(null==t)return{};var e,n,o={},i=Object.keys(t);for(n=0;n<i.length;n++)e=i[n],r.indexOf(e)>=0||(o[e]=t[e]);return o}(t,r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)e=i[n],r.indexOf(e)>=0||Object.prototype.propertyIsEnumerable.call(t,e)&&(o[e]=t[e])}return o}function v(t,r){if(r&&("object"==typeof r||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function d(t){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(t){return!1}}();return function(){var e,n=h(t);if(r){var o=h(this).constructor;e=Reflect.construct(n,arguments,o)}else e=n.apply(this,arguments);return v(this,e)}}function b(t,r){return function(t){if(Array.isArray(t))return t}(t)||function(t,r){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==e)return;var n,o,i=[],a=!0,c=!1;try{for(e=e.call(t);!(a=(n=e.next()).done)&&(i.push(n.value),!r||i.length!==r);a=!0);}catch(t){c=!0,o=t}finally{try{a||null==e.return||e.return()}finally{if(c)throw o}}return i}(t,r)||g(t,r)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function m(t){return function(t){if(Array.isArray(t))return w(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||g(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(t,r){if(t){if("string"==typeof t)return w(t,r);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?w(t,r):void 0}}function w(t,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}export{s as _,d as a,u as b,f as c,a as d,n as e,r as f,b as g,i as h,e as i,y as j,l as k,m as l};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as e}from"./pop-daf75174.js";export{M as Move,P as Pop}from"./pop-daf75174.js";import{c as o}from"./_rollupPluginBabelHelpers-e1425fd3.js";function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{scaleCorrection:e.scaleCorrection,use:r.use.bind(this,e)}}function i(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{scaleCorrection:e.scaleCorrection,use:i.use.bind(this,e)}}function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{scaleCorrection:e.scaleCorrection,use:t.use.bind(this,e)}}r.use=function(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=o.scaleCorrection,i=void 0!==r&&r;return new e({opacity:1,scaleCorrection:i,duration:.65},{opacity:0})},i.use=function(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=o.direction,i=void 0===r?"right":r,t=o.scaleCorrection,n=void 0!==t&&t,c=0,s=1,a={x:0,y:.5};switch(i){case"left":a.x=1;break;case"up":c=1,s=0,a={x:0,y:1};break;case"down":c=1,s=0,a={x:0,y:0}}return new e({scale:{x:1},scaleCorrection:n,origin:a,duration:.6},{scale:{x:c,y:s}})},t.use=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=r.direction,t=void 0===i?"right":i,n=r.scaleCorrection,c=void 0!==n&&n;return["left","right","top","bottom"].includes(t)||(t="right"),new e({clip:o({},t,0),scaleCorrection:c},{clip:o({},t,1)})};export{r as Fade,i as Scale,t as Wipe};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{g as r}from"./_rollupPluginBabelHelpers-e1425fd3.js";import{useState as n,useRef as o,useEffect as t}from"react";function e(e){var u=n(e),c=r(u,2),l=c[0],p=c[1],a=o();return t((function(){e&&p(!0),!e&&a.current&&a.current.play(a.current.props.onUnmount,{callback:function(){p(!1)}})}),[e]),[l,a]}export{e as useUnmount};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e,a as t,b as i,c as n,d as r,e as o,f as s,g as a,h as l,i as p,j as u,k as c}from"./_rollupPluginBabelHelpers-e1425fd3.js";import h,{Children as v,isValidElement as d,cloneElement as f,Component as m}from"react";import{A as y,a as g,r as w,b as k,M as b,P as C}from"./pop-daf75174.js";var x=function(n){e(E,m);var u,c,h,b,C,x,A,L=t(E);function E(e){var t;for(var i in r(this,E),(t=L.call(this,e)).hover=!1,t.hasFocus=!1,t.inView=!1,t.scrollDelta=0,t.viewportMargin=e.viewportMargin,t.elements=[],t.animations={default:t.toAnimation(t.props.animate)},t.props.animations)t.animations[i]=t.toAnimation(t.props.animations[i]);return t.level=0,t.children=[],t}return i(E,[{key:"toAnimation",value:function(e){return!e||"object"!==o(e)&&"function"!=typeof e?null:"use"in e?e.use():new y(s(s({},e),{},{scaleCorrection:this.props.scaleCorrection}),this.props.initial)}},{key:"countNestedLevels",value:function(e){var t=this;if(!e)return 0;var i=0,n=0;return v.forEach(e,(function(e){var r;if(d(e)){e.type===E&&(i=1);var o=t.countNestedLevels(null===(r=e.props)||void 0===r?void 0:r.children);n=n<o?o:n}})),n+i}},{key:"componentDidMount",value:function(){var e=this;this.elements.forEach((function(t){var i;null===(i=e.animations.default)||void 0===i||i.setInitialStyles(t)})),(this.props.parentLevel<1||this.props.noCascade)&&(this.scrollEventListener=this.onScroll.bind(this),g("scroll",this.scrollEventListener),this.props.onMount&&this.play(this.props.onMount,{staggerDelay:.001,immediate:!0}),this.props.whileViewport&&this.onScroll())}},{key:"componentWillUnmount",value:function(){w("scroll",this.scrollEventListener),this.props.onUnmount&&(this.props.parentLevel<1||this.props.noCascade)&&this.play(this.props.onUnmount,{reverse:!0,immediate:!0})}},{key:"inViewport",value:function(){var e=this,t=!0,i=!0;return this.elements.forEach((function(n){var r=n.getBoundingClientRect().y;t=t&&r+n.clientHeight*(1-e.viewportMargin)<window.innerHeight,i=i&&r>window.innerHeight+n.clientHeight*e.viewportMargin})),this.elements.length||this.children.forEach((function(e){var n=e.animatable.inViewport(),r=a(n,2),o=r[0],s=r[1];t=t&&o,i=i&&s})),[t,i]}},{key:"onScroll",value:(A=l(p().mark((function e(){var t,i,n,r;return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(Date.now()-this.scrollDelta<350)){e.next=2;break}return e.abrupt("return");case 2:this.scrollDelta=Date.now(),t=this.inViewport(),i=a(t,2),n=i[0],r=i[1],!this.inView&&n&&(this.inView=!0,this.props.whileViewport&&this.play(this.props.whileViewport)),this.inView&&r&&(this.inView=!1,this.props.whileViewport&&this.play(this.props.whileViewport,{reverse:!0,immediate:!0}));case 6:case"end":return e.stop()}}),e,this)}))),function(){return A.apply(this,arguments)})},{key:"onEnter",value:(x=l(p().mark((function e(t){var i,n=arguments;return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=n.length>1&&void 0!==n[1]&&n[1],this.hover||(this.props.whileHover&&this.play(this.props.whileHover),this.hover=!0),i&&i(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return x.apply(this,arguments)})},{key:"onLeave",value:(C=l(p().mark((function e(t){var i,n=arguments;return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=n.length>1&&void 0!==n[1]&&n[1],this.hover&&(this.props.whileHover&&this.play(this.props.whileHover,{reverse:!0}),this.hover=!1),i&&i(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return C.apply(this,arguments)})},{key:"onFocus",value:(b=l(p().mark((function e(t){var i,n=arguments;return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=n.length>1&&void 0!==n[1]&&n[1],this.hasFocus||(this.props.whileFocus&&this.play(this.props.whileFocus),this.hasFocus=!0),i&&i(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return b.apply(this,arguments)})},{key:"onBlur",value:(h=l(p().mark((function e(t){var i,n=arguments;return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=n.length>1&&void 0!==n[1]&&n[1],this.hasFocus&&(this.props.whileFocus&&this.play(this.props.whileFocus,{reverse:!0}),this.hasFocus=!1),i&&i(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return h.apply(this,arguments)})},{key:"onClick",value:(c=l(p().mark((function e(t){var i,n=arguments;return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:i=n.length>1&&void 0!==n[1]&&n[1],this.props.onClick&&this.play(this.props.onClick),i&&i(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return c.apply(this,arguments)})},{key:"play",value:(u=l(p().mark((function e(t){var i,n,r,o,s,a,l,u,c,h,v,d,f,m,y,g,w=this,b=arguments;return p().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(i=b.length>1&&void 0!==b[1]?b[1]:{},n=i.callback,r=i.reverse,o=void 0!==r&&r,s=i.immediate,a=void 0!==s&&s,l=i.cascade,u=void 0!==l&&l,c=i.groupAdjust,h=void 0===c?0:c,v=i.cascadeDelay,d=void 0===v?0:v,f=i.staggerDelay,m=void 0===f?0:f,!(this.props.parentLevel>0)||u){e.next=3;break}return e.abrupt("return");case 3:if(y="string"==typeof t?this.animations[t]:this.animations.default){e.next=6;break}return e.abrupt("return");case 6:g=0,this.elements.forEach((function(e,t){var i="group"in w.props?w.props.parentLevel-w.props.group:w.level+h;d=o?y.duration:d;var n=o?i*d:(w.props.parentLevel-i)*d;n=w.props.stagger*t+n+m,g=n>g?n:g,y.play(e,{delay:n,reverse:o,immediate:a})})),this.children.forEach((function(e){var i=e.animatable,n=e.staggerIndex,r=void 0===n?-1:n;null==i||i.play(t,{reverse:o,immediate:a,cascade:!0,staggerDelay:r<0?0:w.props.stagger*r,cascadeDelay:y.duration,groupAdjust:r<0?0:1})})),n&&k.delay(n,g+y.duration);case 10:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"style",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=s(s({},e),{},{transitionProperty:"transform, opacity, clip-path, border-radius, background-color, color, width, height, left, top",willChange:"transform"});return t}},{key:"mergeProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=s(s({},t),e);for(var n in i)["children","parentLevel","ref"].includes(n)?delete i[n]:"object"===o(e[n])&&"object"===o(t[n])&&(i[n]=s(s({},t[n]),e[n]));return i}},{key:"deepClone",value:function(e){var t,i=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.index,o=void 0===r?0:r,a=n.useElements,l=void 0!==a&&a,p=n.useEvents,u=void 0!==p&&p;if(!d(e))return e;var c,h={};e.type!==E&&(l&&(h={style:this.style(null===(c=e.props)||void 0===c?void 0:c.style),ref:function(e){return i.elements[o]=e}}),u&&(this.props.parentLevel<1||this.props.noCascade)&&(h=s(s({},h),{},{onMouseEnter:function(t){var n;return i.onEnter(t,null===(n=e.props)||void 0===n?void 0:n.onMouseEnter)},onMouseLeave:function(t){var n;return i.onLeave(t,null===(n=e.props)||void 0===n?void 0:n.onMouseLeave)},onFocus:function(t){var n;return i.onFocus(t,null===(n=e.props)||void 0===n?void 0:n.onFocus)},onBlur:function(t){var n;return i.onBlur(t,null===(n=e.props)||void 0===n?void 0:n.onBlur)},onClick:function(t){var n;return i.onClick(t,null===(n=e.props)||void 0===n?void 0:n.onClick)}}),u=!1));e.type!==E||null!==(t=e.props)&&void 0!==t&&t.noCascade||(h=s(s(s({},h),this.mergeProperties(e.props,this.props)),{},{parentLevel:this.parentLevel>0?this.parentLevel:this.level,ref:function(e){return i.children[i.children.length]={animatable:e,staggerIndex:l?o:-1}}}));var m=v.map(e.props.children,(function(e,t){return i.deepClone(e,{index:t,useEvents:u})}));return Object.values(h).length?f(e,h,m):e}},{key:"render",value:function(){var e=this;return this.level=this.countNestedLevels(this.props.children),v.map(this.props.children,(function(t,i){return e.deepClone(t,{index:i,useElements:!0,useEvents:!0})}))}}]),E}();n(x,"defaultProps",{scaleCorrection:!1,parentLevel:0,stagger:.1,viewportMargin:.25,animate:{},animations:{}});var A=["levels","animations"],L=function(n){e(a,m);var o=t(a);function a(e){var t;return r(this,a),(t=o.call(this,e)).levels=t.props.levels,t.animations=new Array(t.levels).fill(0).map((function(e,i){return i<t.props.animations.length?t.props.animations[i]:t.props.animations[t.props.animations.length-1]})),t}return i(a,[{key:"makeAnimatable",value:function(e){var t=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(i<1||v.count(e)<1)return e;var n=this.props;n.levels,n.animations;var r=u(n,A),o=this.animations[this.levels-i];return i===this.levels&&(r.ref=function(e){return t.animatable=e}),h.createElement(x,c({animate:o,scaleCorrection:o.scaleCorrection},r),v.map(e,(function(e){return d(e)?f(e,{},t.makeAnimatable(e.props.children,i-1)):e})))}},{key:"play",value:function(e){var t,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};null===(t=this.animatable)||void 0===t||t.play(e,s(s({},i),{},{reverse:!0}))}},{key:"render",value:function(){return this.makeAnimatable(this.props.children,this.levels)}}]),a}();n(L,"defaultProps",{levels:1,stagger:.1,viewportMargin:.25,animations:[b,C]});var E=function(n){e(s,x);var o=t(s);function s(e){var t;return r(this,s),(t=o.call(this,e)).animations.morphs=[],t}return i(s,[{key:"componentDidMount",value:function(){var e=this,t=this.elements[0];t&&(y.setInitial(t),t.setAttribute("uitools-morph-id",this.props.id),t.setAttribute("uitools-morph-active",this.props.active),this.self=t,this.createResetAnimation(),k.delay((function(){for(var i=document.querySelectorAll('[uitools-morph-id="'.concat(e.props.id,'"]')),n=0;n<i.length;n++)i[n]!==t&&(e.createMorphAnimation(i[n],n),"true"!==i[n].getAttribute("uitools-morph-active")&&e.animations.transition.setInitialStyles(i[n]))}),.001))}},{key:"componentDidUpdate",value:function(){var e=this,t="true"===this.self.getAttribute("uitools-morph-active");this.self.setAttribute("uitools-morph-active",this.props.active),k.delay((function(){if(e.props.active&&!t)e.animations.transition.setInitialStyles(e.self),e.animations.transition.play(e.self);else if(!e.props.active&&t){for(var i=0,n=document.querySelectorAll('[uitools-morph-id="'.concat(e.props.id,'"]')),r=0;r<n.length;r++)if(n[r]!==e.self&&"true"===n[r].getAttribute("uitools-morph-active")){i=r;break}e.animations.morphs[i].play(e.self)}}),.001)}},{key:"createResetAnimation",value:function(){var e,t=null===(e=this.self.UITools)||void 0===e?void 0:e.initialStyles;this.animations.transition=new y({opacity:[0,0,1],scale:{x:1,y:1},position:{x:0,y:0},borderRadius:t.borderRadius,backgroundColor:[t.backgroundColor,t.backgroundColor,t.backgroundColor],scaleCorrection:this.scaleCorrection},{})}},{key:"createMorphAnimation",value:function(e,t){var i,n,r=null===(i=this.self.UITools)||void 0===i?void 0:i.initialStyles,o=null===(n=e.UITools)||void 0===n?void 0:n.initialStyles;this.animations.morphs[t]=new y({position:[{x:0,y:0},{x:o.x-r.x+(o.clientWidth-r.clientWidth)/2,y:o.y-r.y+(o.clientHeight-r.clientHeight)/2},{x:o.x-r.x+(o.clientWidth-r.clientWidth)/2,y:o.y-r.y+(o.clientHeight-r.clientHeight)/2}],scale:[{x:1,y:1},{x:o.clientWidth/r.clientWidth,y:o.clientHeight/r.clientHeight},{x:o.clientWidth/r.clientWidth,y:o.clientHeight/r.clientHeight}],opacity:[1,1,0],borderRadius:[r.borderRadius,o.borderRadius,o.borderRadius],backgroundColor:[r.backgroundColor,o.backgroundColor,o.backgroundColor],scaleCorrection:this.scaleCorrection},{})}}]),s}();n(E,"defaultProps",{id:0,active:!1,scaleCorrection:!1});export{x as Animatable,L as Animate,E as Morph};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as t,d as e,h as i,i as n,g as a,e as o,c as r,j as s,l}from"./_rollupPluginBabelHelpers-e1425fd3.js";var c=function(){function a(){e(this,a),this.queue=[],this.tick()}var o,r;return t(a,[{key:"tick",value:(r=i(n().mark((function t(){var e,i;return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=Date.now(),i=0;case 2:if(!(i<this.queue.length+1)){t.next=10;break}if(!(this.queue.length===i||this.queue[i].timestamp>e)){t.next=6;break}return this.queue.splice(0,i),t.abrupt("break",10);case 6:this.queue[i].callback();case 7:i++,t.next=2;break;case 10:requestAnimationFrame(this.tick.bind(this));case 11:case"end":return t.stop()}}),t,this)}))),function(){return r.apply(this,arguments)})},{key:"search",value:function(t){for(var e,i,n=0,a=this.queue.length-1;n<=a;)if(e=n+a>>>1,(i=this.queue[e].timestamp-t.timestamp)<0)n=e+1;else{if(!(i>0))return e;a=e-1}return n}},{key:"insert",value:function(t){var e=this.search(t);this.queue.splice(e,0,t)}},{key:"delay",value:function(t,e){t instanceof Function&&this.insert({callback:t,timestamp:Date.now()+1e3*e})}}],[{key:"get",value:function(){return"UITools"in window||(window.UITools={}),"AnimationLoop"in window.UITools||(window.UITools.AnimationQueue=new a),window.UITools.AnimationQueue}},{key:"delay",value:(o=i(n().mark((function t(e,i){return n().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.get().delay(e,i));case 1:case"end":return t.stop()}}),t,this)}))),function(t,e){return o.apply(this,arguments)})},{key:"sleep",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return new Promise((function(i){t.delay(i,e)}))}}]),a}(),u=function(t){var e=t.match(/^#([\da-f]{1,2})([\da-f]{1,2})([\da-f]{1,2})([\da-f]{2})?/i),i=a(e,5);i[0];var n=i[1],o=i[2],r=i[3],s=i[4];return{r:parseInt(n.padStart(2,n),16),g:parseInt(o.padStart(2,o),16),b:parseInt(r.padStart(2,r),16),a:void 0!==s?parseInt(s,16):255}},d=function(t){var e=t.match(/^rgba?\((\d+)\D+(\d+)\D+(\d+)\D*(\d+)?\)/i),i=a(e,5);i[0];var n=i[1],o=i[2],r=i[3],s=i[4];return{r:parseInt(n),g:parseInt(o),b:parseInt(r),a:void 0!==s?parseInt(s):255}},h=function(t,e){var i;e instanceof Function&&(null!==(i=window.UITools)&&void 0!==i&&i.Events||(window.UITools={Events:{}}),t in window.UITools.Events||(window.UITools.Events[t]={unique:0},window.addEventListener(t,(function(e){Object.values(window.UITools.Events[t]).forEach((function(t){t instanceof Function&&t(e)}))}))),e.UITools={ListenerID:window.UITools.Events[t].unique},window.UITools.Events[t][window.UITools.Events[t].unique]=e,window.UITools.Events[t].unique++)},p=function(t,e){var i,n,a;"undefined"!=typeof window&&null!==(i=window.UITools)&&void 0!==i&&null!==(n=i.Events)&&void 0!==n&&n[t]&&null!=e&&null!==(a=e.UITools)&&void 0!==a&&a.ListenerID&&delete window.UITools.Events[t][e.UITools.ListenerID]},v=["delay","duration","loop","interpolate","origin","scaleCorrection"],f=function(){function i(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.delay,a=void 0===n?0:n,o=t.duration,r=void 0===o?1:o,l=t.loop,c=void 0!==l&&l,u=t.interpolate,d=void 0===u?"ease":u,h=t.origin,p=void 0===h?{x:.5,y:.5}:h,f=t.scaleCorrection,g=void 0!==f&&f,y=s(t,v),m=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};e(this,i),this.scaleCorrection=g,this.keyframes=this.getKeyframes(y,m),this.delay=a,this.duration=r,this.delta=r/(this.keyframes.length-1),this.interpolation=d,this.origin=this.originToStyle(p),this.loop=c}return t(i,[{key:"originToStyle",value:function(t){var e=.5,i=.5;if("object"===o(t))e=t.x,i=t.y;else if("string"==typeof t)switch(t){case"left":e=0;break;case"right":e=1;break;case"top":i=0;break;case"bottom":i=1}else e=i=t;return"".concat(100*e,"% ").concat(100*i,"%")}},{key:"getKeyframes",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=0,o=function(o){var r=o in n?n[o]:i.initials[o];Array.isArray(t[o])||(t[o]=[t[o]]),t[o]=t[o].length>1?t[o]:[r].concat(l(t[o])),t[o]=t[o].map((function(t){return e.sanitize(o,t)})),a=t[o].length>a?t[o].length:a};for(var r in t)o(r);return new Array(a).fill(0).map((function(n,o){var r={};for(var s in t)s in i.initials&&(r[s]=e.interpolateKeyframe(t[s],o,a));return e.keyframeToStyle(r)}))}},{key:"sanitize",value:function(t,e){var n=this,a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("string"==typeof e){if(e.match(/^#[0-9a-f]{3,8}$/i))return u(e);if(e.match(/^rgba?\(.*\)$/i))return d(e);var r=parseFloat(e),s=e.match(/[^0-9\.]*$/i);return isNaN(r)?i.initials[t]:("%"===s&&(r/=100),s?[r,s]:r)}if("object"===o(e)){var l=Object.keys(e);("x"in e||"y"in e)&&(l=["x","y"]),("r"in e||"g"in e||"b"in e||"a"in e)&&(l=["r","g","b","a"]),("left"in e||"right"in e||"top"in e||"bottom"in e)&&(l=["left","right","top","bottom"]),l.forEach((function(i){e[i]=n.sanitize(t,e[i],i)}))}return void 0!==e?e:i.initials[t][a]}},{key:"interpolate",value:function(t,e,i){if("string"==typeof t||"string"==typeof e)return i>.5?e:t;var n=!1;Array.isArray(t)&&(n=t[1],t=t[0]),Array.isArray(e)&&(n=e[1],e=e[0]);var a=t*(1-i)+e*i;return n?[a,n]:a}},{key:"interpolateKeyframe",value:function(t,e,i){var n=this;if(t.length===i)return t[e];var a=e*((t.length-1)/(i-1)),r=Math.floor(a),s=t[r];if(r===t.length-1)return s;var l=t[r+1];if("object"===o(s)){var c={};return Object.keys(s).forEach((function(t){c[t]=n.interpolate(s[t],l[t],a-r)})),c}return this.interpolate(s,l,a-r)}},{key:"toString",value:function(t,e){return Array.isArray(t)&&(e=t[1],t=t[0]),t*("%"===e?100:1)+e}},{key:"toLength",value:function(t){return Array.isArray(t)&&(t="px"===t[1]?t[0]+"px":t[0]),t}},{key:"keyframeToStyle",value:function(t){var e=this,i={transform:""};return Object.entries(t).forEach((function(t){var n=a(t,2),o=n[0],r=n[1];switch(o){case"position":i.transform+="translate(".concat(e.toString(r.x,"px"),", ").concat(e.toString(r.y,"px"),") ");break;case"scale":if("number"==typeof r&&(r={x:r,y:r}),e.scaleCorrection){i.width=e.toLength(r.x),i.height=e.toLength(r.y);break}i.transform+="scale(".concat(e.toString(r.x,"%"),", ").concat(e.toString(r.y,"%"),") ");break;case"rotation":i.transform+="rotate(".concat((e.toString(r),"deg"),") ");break;case"clip":i.clipPath="inset(".concat(e.toString(r.top,"%")," ").concat(e.toString(r.right,"%")," ").concat(e.toString(r.bottom,"%")," ").concat(e.toString(r.left,"%"),")");break;case"borderRadius":i[o]=e.toString(r,"px");break;case"backgroundColor":case"color":i[o]="rgba(".concat(r.r,", ").concat(r.g,", ").concat(r.b,", ").concat(r.a,")");break;case"opacity":case"active":i[o]=r}})),i.transform.length||delete i.transform,i}},{key:"setInitialStyles",value:function(t){i.setInitial(t);var e=this.keyframes[0];t.style.transitionDuration="0s",this.apply(t,e,!0)}},{key:"test",value:function(t,e,i,n,a,o){var r=n+a+((i-=e-(t="string"==typeof t?parseInt(t)/e:t)*e)<0?i:0),s=n/(n+a);return{size:(i<0?0:i)+"px",padStart:(n=o?t*n:r*s)+"px",padEnd:(a=o?t*a:r*(1-s))+"px"}}},{key:"apply",value:function(t,e){var i=this,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=function(){var n=t.UITools.initialStyles;Object.entries(e).forEach((function(e){var o=a(e,2),r=o[0],s=o[1];if("width"===r){var l=n.clientWidth,c=n.width,u=n.paddingLeft,d=n.paddingRight,h=n.includePadding,p=i.test(s,l,c,u,d,h),v=p.size,f=p.padStart,g=p.padEnd;return t.style.width=v,t.style.paddingLeft=f,void(t.style.paddingRight=g)}if("height"===r){var y=n.clientHeight,m=n.height,b=n.paddingTop,k=n.paddingBottom,w=n.includePadding,I=i.test(s,y,m,b,k,w),x=I.size,T=I.padStart,U=I.padEnd;return t.style.height=x,t.style.paddingTop=T,void(t.style.paddingBottom=U)}"active"!==r&&(t.style[r]=s)}))};if("active"in e){var r=Object.keys(e.active)[0];"start"===r||n?(t.style.display=e.active[r]?"":"none",n?o():c.delay(o,.01)):(c.delay((function(){t.style.display=e.active[r]?"":"none"}),this.delta),o())}else o()}},{key:"start",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=e.immediate,n=void 0!==i&&i,a=e.reverse,o=void 0!==a&&a;!t.UITools.animating||n?(t.style.transitionDuration="".concat(this.delta,"s"),t.style.transitionTimingFunction=this.interpolation,t.style.transformOrigin=this.origin,t.UITools.animating=!0,t.UITools.index=1,this.getNext(t,o)):t.UITools.queue.push([this,{reverse:o}])}},{key:"play",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=i.delay,a=void 0===n?0:n,o=i.immediate,r=void 0!==o&&o,s=i.reverse,l=void 0!==s&&s;t.style&&(this.delay||a?c.delay((function(){return e.start(t,{immediate:r,reverse:l})}),this.delay+a):this.start(t,{immediate:r,reverse:l}))}},{key:"getNext",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.UITools.index===this.keyframes.length){t.UITools.animating=!1;var n=t.UITools.queue.shift()||[],o=a(n,2),r=o[0],s=o[1];return r?r.start(t,s):void(this.loop&&this.start(t,s))}var l=t.UITools.index;i&&(l=this.keyframes.length-1-l),requestAnimationFrame((function(){e.apply(t,e.keyframes[l])})),t.UITools.index++,c.delay((function(){return e.getNext(t,i)}),this.delta)}}],[{key:"setInitial",value:function(t){var e=getComputedStyle(t),i=e.width,n=e.height,a=e.paddingLeft,o=e.paddingRight,r=e.paddingTop,s=e.paddingBottom,l=e.borderRadius,c=e.boxSizing,u=e.backgroundColor,d=e.color,h=t.getBoundingClientRect(),p=h.x,v=h.y;"UITools"in t||(t.UITools={}),"queue"in t.UITools||(t.UITools.queue=[]),"initialStyles"in t.UITools||(t.UITools.initialStyles={x:p,y:v,includePadding:"border-box"===c,clientWidth:t.clientWidth,clientHeight:t.clientHeight,width:parseInt(i),height:parseInt(n),paddingLeft:parseInt(a),paddingRight:parseInt(o),paddingTop:parseInt(r),paddingBottom:parseInt(s),borderRadius:parseInt(l.split(" ")[0]),backgroundColor:u,color:d})}}]),i}();function g(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{scaleCorrection:t.scaleCorrection,use:g.use.bind(this,t)}}function y(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{scaleCorrection:t.scaleCorrection,use:y.use.bind(this,t)}}r(f,"initials",{opacity:1,scale:{x:1,y:1},position:{x:0,y:0},clip:{left:0,top:0,right:0,bottom:0},borderRadius:0,active:{start:!0},backgroundColor:{r:127,g:127,b:127,a:255},color:{r:127,g:127,b:127,a:255}}),g.use=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.direction,i=void 0===e?"up":e,n=t.scaleCorrection,a=void 0!==n&&n,o="0px",r="20px";switch(i){case"down":r="-20px";break;case"left":o="20px",r="0px";break;case"right":o="-20px",r="0px"}return new f({position:{x:"0px",y:"0px"},opacity:1,scaleCorrection:a,duration:.5},{position:{x:o,y:r},opacity:0})},y.use=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.scaleCorrection,i=void 0!==e&&e;return new f({opacity:1,scale:1,scaleCorrection:i,duration:.25},{opacity:0,scale:.85})};export{f as A,g as M,y as P,h as a,c as b,p as r};
|
package/package.json
CHANGED
|
@@ -1,14 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infinityfx/lively",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "Zero configuration, performant react animation library",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"module": "dist/index.js",
|
|
5
|
+
"main": "dist/cjs/index.js",
|
|
6
|
+
"module": "dist/esm/index.js",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"import": "./dist/esm/index.js",
|
|
10
|
+
"require": "./dist/cjs/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./animations": {
|
|
13
|
+
"import": "./dist/esm/animations.js",
|
|
14
|
+
"require": "./dist/cjs/animations.js"
|
|
15
|
+
},
|
|
16
|
+
"./hooks": {
|
|
17
|
+
"import": "./dist/esm/hooks.js",
|
|
18
|
+
"require": "./dist/cjs/hooks.js"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
7
21
|
"repository": "infinityfx-llc/lively",
|
|
8
22
|
"author": "InfinityFX <contact@infinity-fx.com> (https://infinity-fx.com)",
|
|
9
23
|
"license": "GPL-3.0",
|
|
10
24
|
"bugs": "https://github.com/infinityfx-llc/lively/issues",
|
|
11
25
|
"homepage": "https://github.com/infinityfx-llc/lively#readme",
|
|
26
|
+
"funding": "https://ko-fi.com/infinityfx",
|
|
12
27
|
"keywords": [
|
|
13
28
|
"animation",
|
|
14
29
|
"react",
|
|
@@ -21,18 +36,17 @@
|
|
|
21
36
|
"watch": "rollup -c -w"
|
|
22
37
|
},
|
|
23
38
|
"peerDependencies": {
|
|
24
|
-
"react": ">=16.0.0"
|
|
39
|
+
"react": ">=16.0.0",
|
|
40
|
+
"react-dom": ">=16.0.0"
|
|
25
41
|
},
|
|
26
42
|
"devDependencies": {
|
|
27
|
-
"react": ">=16.0.0",
|
|
28
|
-
"rollup": "^2.75.7",
|
|
29
|
-
"@rollup/plugin-babel": "^5.3.1",
|
|
30
|
-
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
31
|
-
"rollup-plugin-terser": "^7.0.2",
|
|
32
|
-
"@babel/cli": "^7.18.6",
|
|
33
43
|
"@babel/core": "^7.18.6",
|
|
34
44
|
"@babel/preset-env": "^7.18.6",
|
|
35
|
-
"@babel/preset-react": "^7.18.6"
|
|
45
|
+
"@babel/preset-react": "^7.18.6",
|
|
46
|
+
"@rollup/plugin-babel": "^5.3.1",
|
|
47
|
+
"@rollup/plugin-node-resolve": "^13.3.0",
|
|
48
|
+
"rollup": "^2.75.7",
|
|
49
|
+
"rollup-plugin-terser": "^7.0.2"
|
|
36
50
|
},
|
|
37
51
|
"sideEffects": false
|
|
38
|
-
}
|
|
52
|
+
}
|
package/dist/index.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Lively={},t.React)}(this,(function(t,e){"use strict";function n(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,r)}return n}function r(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?n(Object(r),!0).forEach((function(e){p(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function i(){
|
|
2
|
-
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
3
|
-
i=function(){return t};var t={},e=Object.prototype,n=e.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},o=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",s=r.toStringTag||"@@toStringTag";function l(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,n){return t[e]=n}}function c(t,e,n,r){var i=e&&e.prototype instanceof h?e:h,o=Object.create(i.prototype),a=new T(r||[]);return o._invoke=function(t,e,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return O()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=k(a,n);if(s){if(s===p)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var l=u(t,e,n);if("normal"===l.type){if(r=n.done?"completed":"suspendedYield",l.arg===p)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(r="completed",n.method="throw",n.arg=l.arg)}}}(t,n,a),o}function u(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var p={};function h(){}function f(){}function d(){}var v={};l(v,o,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(I([])));g&&g!==e&&n.call(g,o)&&(v=g);var m=d.prototype=h.prototype=Object.create(v);function w(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function b(t,e){function r(i,o,a,s){var l=u(t[i],t,o);if("throw"!==l.type){var c=l.arg,p=c.value;return p&&"object"==typeof p&&n.call(p,"__await")?e.resolve(p.__await).then((function(t){r("next",t,a,s)}),(function(t){r("throw",t,a,s)})):e.resolve(p).then((function(t){c.value=t,a(c)}),(function(t){return r("throw",t,a,s)}))}s(l.arg)}var i;this._invoke=function(t,n){function o(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(o,o):o()}}function k(t,e){var n=t.iterator[e.method];if(void 0===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,k(t,e),"throw"===e.method))return p;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var r=u(n,t.iterator,e.arg);if("throw"===r.type)return e.method="throw",e.arg=r.arg,e.delegate=null,p;var i=r.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,p):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function x(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function E(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(x,this),this.reset(!0)}function I(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function e(){for(;++r<t.length;)if(n.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return i.next=i}}return{next:O}}function O(){return{value:void 0,done:!0}}return f.prototype=d,l(m,"constructor",d),l(d,"constructor",f),f.displayName=l(d,s,"GeneratorFunction"),t.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===f||"GeneratorFunction"===(e.displayName||e.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,d):(t.__proto__=d,l(t,s,"GeneratorFunction")),t.prototype=Object.create(m),t},t.awrap=function(t){return{__await:t}},w(b.prototype),l(b.prototype,a,(function(){return this})),t.AsyncIterator=b,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new b(c(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},w(m),l(m,s,"Generator"),l(m,o,(function(){return this})),l(m,"toString",(function(){return"[object Generator]"})),t.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},t.values=I,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(E),!t)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(n,r){return a.type="throw",a.arg=t,e.next=n,r&&(e.method="next",e.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var s=n.call(o,"catchLoc"),l=n.call(o,"finallyLoc");if(s&&l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(s){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,p):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),E(n),p}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;E(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:I(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=void 0),p}},t}function o(t){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o(t)}function a(t,e,n,r,i,o,a){try{var s=t[o](a),l=s.value}catch(t){return void n(t)}s.done?e(l):Promise.resolve(l).then(r,i)}function s(t){return function(){var e=this,n=arguments;return new Promise((function(r,i){var o=t.apply(e,n);function s(t){a(o,r,i,s,l,"next",t)}function l(t){a(o,r,i,s,l,"throw",t)}s(void 0)}))}}function l(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function u(t,e,n){return e&&c(t.prototype,e),n&&c(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function p(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function h(){return h=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},h.apply(this,arguments)}function f(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&v(t,e)}function d(t){return d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},d(t)}function v(t,e){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},v(t,e)}function y(t,e){if(null==t)return{};var n,r,i=function(t,e){if(null==t)return{};var n,r,i={},o=Object.keys(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||(i[n]=t[n]);return i}(t,e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(r=0;r<o.length;r++)n=o[r],e.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(i[n]=t[n])}return i}function g(t,e){if(e&&("object"==typeof e||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}function m(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 n,r=d(t);if(e){var i=d(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return g(this,n)}}function w(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,o=[],a=!0,s=!1;try{for(n=n.call(t);!(a=(r=n.next()).done)&&(o.push(r.value),!e||o.length!==e);a=!0);}catch(t){s=!0,i=t}finally{try{a||null==n.return||n.return()}finally{if(s)throw i}}return o}(t,e)||k(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(t){return function(t){if(Array.isArray(t))return x(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||k(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function k(t,e){if(t){if("string"==typeof t)return x(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?x(t,e):void 0}}function x(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var E=function(){function t(){l(this,t),this.queue=[],this.tick()}var e,n;return u(t,[{key:"tick",value:(n=s(i().mark((function t(){var e,n;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=Date.now(),n=0;case 2:if(!(n<this.queue.length+1)){t.next=10;break}if(!(this.queue.length===n||this.queue[n].timestamp>e)){t.next=6;break}return this.queue.splice(0,n),t.abrupt("break",10);case 6:this.queue[n].callback();case 7:n++,t.next=2;break;case 10:requestAnimationFrame(this.tick.bind(this));case 11:case"end":return t.stop()}}),t,this)}))),function(){return n.apply(this,arguments)})},{key:"search",value:function(t){for(var e,n,r=0,i=this.queue.length-1;r<=i;)if(e=r+i>>>1,(n=this.queue[e].timestamp-t.timestamp)<0)r=e+1;else{if(!(n>0))return e;i=e-1}return r}},{key:"insert",value:function(t){var e=this.search(t);this.queue.splice(e,0,t)}},{key:"delay",value:function(t,e){t instanceof Function&&this.insert({callback:t,timestamp:Date.now()+1e3*e})}}],[{key:"get",value:function(){return"UITools"in window||(window.UITools={}),"AnimationLoop"in window.UITools||(window.UITools.AnimationQueue=new t),window.UITools.AnimationQueue}},{key:"delay",value:(e=s(i().mark((function t(e,n){return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this.get().delay(e,n));case 1:case"end":return t.stop()}}),t,this)}))),function(t,n){return e.apply(this,arguments)})}]),t}(),T=["delay","duration","loop","interpolate","origin","scaleCorrection"],I=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e.delay,r=void 0===n?0:n,i=e.duration,o=void 0===i?1:i,a=e.loop,s=void 0!==a&&a,c=e.interpolate,u=void 0===c?"ease":c,p=e.origin,h=void 0===p?{x:.5,y:.5}:p,f=e.scaleCorrection,d=void 0!==f&&f,v=y(e,T),g=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};l(this,t),this.scaleCorrection=d,this.keyframes=this.getKeyframes(v,g),this.delay=r,this.duration=o,this.delta=o/(this.keyframes.length-1),this.interpolation=u,this.origin=this.originToStyle(h),this.loop=s}return u(t,[{key:"originToStyle",value:function(t){var e=.5,n=.5;if("object"===o(t))e=t.x,n=t.y;else if("string"==typeof t)switch(t){case"left":e=0;break;case"right":e=1;break;case"top":n=0;break;case"bottom":n=1;case"center":break;default:e=n=parseFloat(t)}else e=n=t;return"".concat(100*e,"% ").concat(100*n,"%")}},{key:"getKeyframes",value:function(e){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};for(var i in e){var o=i in r?r[i]:t.initials[i];Array.isArray(e[i])?e[i]=e[i].length>1?e[i]:[o].concat(b(e[i])):e[i]=[o,e[i]]}var a=Object.values(e).reduce((function(t,e){return e.length>t?e.length:t}),0),s=new Array(a).fill(0);return s=s.map((function(t,r){var i={};for(var o in e)i[o]=n.interpolateKeyframe(e[o],r,a);return n.keyframeToStyle(i)}))}},{key:"interpolate",value:function(t,e,n){var r="string"==typeof t?t.match(/[^0-9\.]*/i):null;"string"!=typeof e||r||(r=e.match(/[^0-9\.]*/i));var i=(t=parseFloat(t))*(1-n)+(e=parseFloat(e))*n;return r?i+r:i}},{key:"interpolateKeyframe",value:function(t,e,n){var r=this;if(!t)return null;if(t.length===n)return t[e];var i=e*((t.length-1)/(n-1)),a=Math.floor(i),s=t[a],l=a===t.length-1?null:t[a+1];if(!l)return s;if("object"===o(s)){var c={};return Object.keys(s).forEach((function(t){c[t]=r.interpolate(s[t],l[t],i-a)})),c}return this.interpolate(s,l,i-a)}},{key:"propertyToString",value:function(e,n,r,i){return"string"==typeof(n=n[r])?n:(n=isNaN(n)?t.initials[e][r]:n,"".concat(n*("%"===i?100:1)).concat(i))}},{key:"propertyToNumber",value:function(e,n,r){return"string"==typeof(n=n[r])?"%"===n.match(/[^0-9\.]*/i)?parseFloat(n)/100:n:isNaN(n)?t.initials[e][r]:n}},{key:"keyframeToStyle",value:function(t){var e=this,n={transform:""};return Object.entries(t).forEach((function(t){var r=w(t,2),i=r[0],a=r[1];if(null!=a)switch(i){case"position":n.transform+="translate(".concat(e.propertyToString(i,a,"x","px"),", ").concat(e.propertyToString(i,a,"y","px"),") ");break;case"scale":if(a="object"!==o(a)?{x:a,y:a}:a,e.scaleCorrection){n.width=e.propertyToNumber(i,a,"x"),n.height=e.propertyToNumber(i,a,"y");break}n.transform+="scale(".concat(e.propertyToString(i,a,"x","%"),", ").concat(e.propertyToString(i,a,"y","%"),") ");break;case"rotation":n.transform+="rotate(".concat(parseFloat(a),"deg) ");break;case"clip":var s=e.propertyToString(i,a,"top","%"),l=e.propertyToString(i,a,"right","%"),c=e.propertyToString(i,a,"bottom","%"),u=e.propertyToString(i,a,"left","%");n.clipPath="inset(".concat(s," ").concat(l," ").concat(c," ").concat(u,")");break;case"borderRadius":n[i]="string"==typeof a?a:a+"px";break;case"opacity":case"active":case"backgroundColor":case"color":n[i]=a}})),n.transform.length||delete n.transform,n}},{key:"setInitialStyles",value:function(e){t.setInitial(e);var n=this.keyframes[0];e.style.transitionDuration="0s",this.apply(e,n,!0)}},{key:"test",value:function(t,e,n,r,i,o){var a=r+i+((n-=e-(t="string"==typeof t?parseInt(t)/e:t)*e)<0?n:0),s=r/(r+i);return{size:(n<0?0:n)+"px",padStart:(r=o?t*r:a*s)+"px",padEnd:(i=o?t*i:a*(1-s))+"px"}}},{key:"apply",value:function(t,e){var n=this,r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=function(){var r=t.UITools.initialStyles;Object.entries(e).forEach((function(e){var i=w(e,2),o=i[0],a=i[1];if("width"===o){var s=r.clientWidth,l=r.width,c=r.paddingLeft,u=r.paddingRight,p=r.includePadding,h=n.test(a,s,l,c,u,p),f=h.size,d=h.padStart,v=h.padEnd;return t.style.width=f,t.style.paddingLeft=d,void(t.style.paddingRight=v)}if("height"===o){var y=r.clientHeight,g=r.height,m=r.paddingTop,b=r.paddingBottom,k=r.includePadding,x=n.test(a,y,g,m,b,k),E=x.size,T=x.padStart,I=x.padEnd;return t.style.height=E,t.style.paddingTop=T,void(t.style.paddingBottom=I)}"active"!==o&&(t.style[o]=a)}))};if("active"in e){var o=Object.keys(e.active)[0];"start"===o||r?(t.style.display=e.active[o]?"":"none",r?i():E.delay(i,.01)):(E.delay((function(){t.style.display=e.active[o]?"":"none"}),this.delta),i())}else i()}},{key:"start",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.immediate,r=void 0!==n&&n,i=e.reverse,o=void 0!==i&&i;!t.UITools.animating||r?(t.style.transitionDuration="".concat(this.delta,"s"),t.style.transitionTimingFunction=this.interpolation,t.style.transformOrigin=this.origin,t.UITools.animating=!0,t.UITools.index=1,this.getNext(t,o)):t.UITools.queue.push([this,{reverse:o}])}},{key:"play",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=n.delay,i=void 0===r?0:r,o=n.immediate,a=void 0!==o&&o,s=n.reverse,l=void 0!==s&&s;t.style&&(this.delay||i?E.delay((function(){return e.start(t,{immediate:a,reverse:l})}),this.delay+i):this.start(t,{immediate:a,reverse:l}))}},{key:"getNext",value:function(t){var e=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.UITools.index===this.keyframes.length){t.UITools.animating=!1;var r=t.UITools.queue.shift()||[],i=w(r,2),o=i[0],a=i[1];return o?o.start(t,a):void(this.loop&&this.start(t,a))}var s=t.UITools.index;n&&(s=this.keyframes.length-1-s),requestAnimationFrame((function(){e.apply(t,e.keyframes[s])})),t.UITools.index++,E.delay((function(){return e.getNext(t,n)}),this.delta)}}],[{key:"from",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return e&&"boolean"!=typeof e?new t(r(r({},e),{},{scaleCorrection:i}),n):null}},{key:"setInitial",value:function(t){var e=getComputedStyle(t),n=e.width,r=e.height,i=e.paddingLeft,o=e.paddingRight,a=e.paddingTop,s=e.paddingBottom,l=e.borderRadius,c=e.boxSizing,u=e.backgroundColor,p=e.color,h=t.getBoundingClientRect(),f=h.x,d=h.y;"UITools"in t||(t.UITools={}),"queue"in t.UITools||(t.UITools.queue=[]),"initialStyles"in t.UITools||(t.UITools.initialStyles={x:f,y:d,includePadding:"border-box"===c,clientWidth:t.clientWidth,clientHeight:t.clientHeight,width:parseInt(n),height:parseInt(r),paddingLeft:parseInt(i),paddingRight:parseInt(o),paddingTop:parseInt(a),paddingBottom:parseInt(s),borderRadius:parseInt(l.split(" ")[0]),backgroundColor:u,color:p})}}]),t}();p(I,"initials",{opacity:1,scale:{x:1,y:1},position:{x:0,y:0},clip:{left:0,top:0,right:0,bottom:0},borderRadius:0,active:{value:!0,at:0},backgroundColor:"initial",color:"initial"});var O=function(t){f(g,t);var n,a,c,p,h,d,v,y=m(g);function g(t){var e;return l(this,g),(e=y.call(this,t)).hover=!1,e.hasFocus=!1,e.inView=!1,e.scrollDelta=0,e.viewportMargin=t.viewportMargin,e.elements=[],e.animations={animate:e.getAnimation(),onMount:e.getAnimation("onMount"),onUnmount:e.getAnimation("onUnmount"),onClick:e.getAnimation("onClick"),whileHover:e.getAnimation("whileHover"),whileFocus:e.getAnimation("whileFocus"),whileViewport:e.getAnimation("whileViewport")},e.level=0,e.children=[],e}return u(g,[{key:"getAnimation",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"animate";return"animate"===t&&this.props.animation&&("object"===o(this.props.animation)||"function"==typeof this.props.animation)&&"use"in this.props.animation?this.props.animation.use():I.from(this.props[t],this.props.initial,this.props.scaleCorrection)}},{key:"countNestedLevels",value:function(t){var n=this;if(!t)return 0;var r=0,i=0;return e.Children.forEach(t,(function(t){var o;if(e.isValidElement(t)){t.type===g&&(r=1);var a=n.countNestedLevels(null===(o=t.props)||void 0===o?void 0:o.children);i=i<a?a:i}})),i+r}},{key:"addEvent",value:function(t,e){var n;e instanceof Function&&(null!==(n=window.UITools)&&void 0!==n&&n.Events||(window.UITools={Events:{}}),t in window.UITools.Events||(window.UITools.Events[t]={unique:0},window.addEventListener(t,(function(e){Object.values(window.UITools.Events[t]).forEach((function(t){t instanceof Function&&t(e)}))}))),e.UITools={ListenerID:window.UITools.Events[t].unique},window.UITools.Events[t][window.UITools.Events[t].unique]=e,window.UITools.Events[t].unique++)}},{key:"removeEvent",value:function(t,e){var n,r;"undefined"!=typeof window&&null!==(n=window.UITools)&&void 0!==n&&n.Events&&t in(null===(r=window.UITools)||void 0===r?void 0:r.Events)&&"ListenerID"in e.UITools&&delete window.UITools.Events[t][e.UITools.ListenerID]}},{key:"componentDidMount",value:function(){var t=this;this.elements.forEach((function(e){var n;null===(n=t.animations.animate)||void 0===n||n.setInitialStyles(e)})),(this.props.parentLevel<1||this.props.noCascade)&&(this.scrollEventListener=this.onScroll.bind(this),this.addEvent("scroll",this.scrollEventListener),this.props.onMount&&this.play("onMount",{staggerDelay:.001}),this.props.whileViewport&&this.onScroll())}},{key:"componentWillUnmount",value:function(){this.removeEvent("scroll",this.scrollEventListener),this.props.onUnmount&&(this.props.parentLevel<1||this.props.noCascade)&&this.play("onUnmount",{reverse:!0,immediate:!0})}},{key:"inViewport",value:function(){var t=this,e=!0,n=!0;return this.elements.forEach((function(r){var i=r.getBoundingClientRect().y;e=e&&i+r.clientHeight*(1-t.viewportMargin)<window.innerHeight,n=n&&i>window.innerHeight+r.clientHeight*t.viewportMargin})),this.elements.length||this.children.forEach((function(t){var r=w(t.animatable.inViewport(),2),i=r[0],o=r[1];e=e&&i,n=n&&o})),[e,n]}},{key:"onScroll",value:(v=s(i().mark((function t(){var e,n,r,o;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!(Date.now()-this.scrollDelta<350)){t.next=2;break}return t.abrupt("return");case 2:this.scrollDelta=Date.now(),e=this.inViewport(),n=w(e,2),r=n[0],o=n[1],!this.inView&&r&&(this.inView=!0,this.props.whileViewport&&this.play("whileViewport")),this.inView&&o&&(this.inView=!1,this.props.whileViewport&&this.play("whileViewport",{reverse:!0,immediate:!0}));case 6:case"end":return t.stop()}}),t,this)}))),function(){return v.apply(this,arguments)})},{key:"onEnter",value:(d=s(i().mark((function t(e){var n,r=arguments;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=r.length>1&&void 0!==r[1]&&r[1],this.hover||(this.props.whileHover&&this.play("whileHover"),this.hover=!0),n&&n(e);case 3:case"end":return t.stop()}}),t,this)}))),function(t){return d.apply(this,arguments)})},{key:"onLeave",value:(h=s(i().mark((function t(e){var n,r=arguments;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=r.length>1&&void 0!==r[1]&&r[1],this.hover&&(this.props.whileHover&&this.play("whileHover",{reverse:!0}),this.hover=!1),n&&n(e);case 3:case"end":return t.stop()}}),t,this)}))),function(t){return h.apply(this,arguments)})},{key:"onFocus",value:(p=s(i().mark((function t(e){var n,r=arguments;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=r.length>1&&void 0!==r[1]&&r[1],this.hasFocus||(this.props.whileFocus&&this.play("whileFocus"),this.hasFocus=!0),n&&n(e);case 3:case"end":return t.stop()}}),t,this)}))),function(t){return p.apply(this,arguments)})},{key:"onBlur",value:(c=s(i().mark((function t(e){var n,r=arguments;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=r.length>1&&void 0!==r[1]&&r[1],this.hasFocus&&(this.props.whileFocus&&this.play("whileFocus",{reverse:!0}),this.hasFocus=!1),n&&n(e);case 3:case"end":return t.stop()}}),t,this)}))),function(t){return c.apply(this,arguments)})},{key:"onClick",value:(a=s(i().mark((function t(e){var n,r=arguments;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=r.length>1&&void 0!==r[1]&&r[1],this.props.onClick&&this.play("onClick"),n&&n(e);case 3:case"end":return t.stop()}}),t,this)}))),function(t){return a.apply(this,arguments)})},{key:"play",value:(n=s(i().mark((function t(e){var n,r,o,a,s,l,c,u,p,h,f,d,v,y,g=this,m=arguments;return i().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=m.length>1&&void 0!==m[1]?m[1]:{},r=n.reverse,o=void 0!==r&&r,a=n.immediate,s=void 0!==a&&a,l=n.cascade,c=void 0!==l&&l,u=n.groupAdjust,p=void 0===u?0:u,h=n.cascadeDelay,f=void 0===h?0:h,d=n.staggerDelay,v=void 0===d?0:d,!(this.props.parentLevel>0)||c){t.next=3;break}return t.abrupt("return");case 3:if((y=this.animations[e])||(y=this.animations.animate),y){t.next=7;break}return t.abrupt("return");case 7:this.elements.forEach((function(t,e){var n="group"in g.props?g.props.parentLevel-g.props.group:g.level+p;f=o?y.duration:f;var r=o?n*f:(g.props.parentLevel-n)*f;y.play(t,{delay:g.props.stagger*e+r+v,reverse:o,immediate:s})})),this.children.forEach((function(t){var n=t.animatable,r=t.staggerIndex,i=void 0===r?-1:r;n.play(e,{reverse:o,immediate:s,cascade:!0,staggerDelay:i<0?0:g.props.stagger*i,cascadeDelay:y.duration,groupAdjust:i<0?0:1})}));case 9:case"end":return t.stop()}}),t,this)}))),function(t){return n.apply(this,arguments)})},{key:"style",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=r(r({},t),{},{transitionProperty:"transform, opacity, clip-path, border-radius, backgroundColor, color".concat(this.props.scaleCorrection?", width, height, left, top":""),willChange:"transform"});return e}},{key:"mergeProperties",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={};return n.initial=this.mergeProperty(e.initial,t.initial),n.animate=this.mergeProperty(e.animate,t.animate),n.onMount=this.mergeProperty(e.onMount,t.onMount),n.onUnmount=this.mergeProperty(e.onUnmount,t.onUnmount),n.onClick=this.mergeProperty(e.onClick,t.onClick),n.whileHover=this.mergeProperty(e.whileHover,t.whileHover),n.whileFocus=this.mergeProperty(e.whileFocus,t.whileFocus),n.whileViewport=this.mergeProperty(e.whileViewport,t.whileViewport),n.viewportMargin=this.mergeProperty(e.viewportMargin,t.viewportMargin),n.stagger=this.mergeProperty(e.stagger,t.stagger),n}},{key:"mergeProperty",value:function(t,e){return t?e?"object"===o(t)||"object"===o(e)?r(r({},t),e):e:t:e}},{key:"deepClone",value:function(t){var n,i=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=o.index,s=void 0===a?0:a,l=o.useElements,c=void 0!==l&&l,u=o.useEvents,p=void 0!==u&&u;if(!e.isValidElement(t))return t;var h,f={};t.type!==g&&(c&&(f={style:this.style(null===(h=t.props)||void 0===h?void 0:h.style),ref:function(t){return i.elements[s]=t}}),p&&(this.props.parentLevel<1||this.props.noCascade)&&(f=r(r({},f),{},{onMouseEnter:function(e){var n;return i.onEnter(e,null===(n=t.props)||void 0===n?void 0:n.onMouseEnter)},onMouseLeave:function(e){var n;return i.onLeave(e,null===(n=t.props)||void 0===n?void 0:n.onMouseLeave)},onFocus:function(e){var n;return i.onFocus(e,null===(n=t.props)||void 0===n?void 0:n.onFocus)},onBlur:function(e){var n;return i.onBlur(e,null===(n=t.props)||void 0===n?void 0:n.onBlur)},onClick:function(e){var n;return i.onClick(e,null===(n=t.props)||void 0===n?void 0:n.onClick)}}),p=!1));t.type!==g||null!==(n=t.props)&&void 0!==n&&n.noCascade||(f=r(r(r({},f),this.mergeProperties(t.props,this.props)),{},{parentLevel:this.parentLevel>0?this.parentLevel:this.level,ref:function(t){return i.children[i.children.length]={animatable:t,staggerIndex:c?s:-1}}}));var d=e.Children.map(t.props.children,(function(t,e){return i.deepClone(t,{index:e,useEvents:p})}));return Object.values(f).length?e.cloneElement(t,f,d):t}},{key:"render",value:function(){var t=this;return this.level=this.countNestedLevels(this.props.children),e.Children.map(this.props.children,(function(e,n){return t.deepClone(e,{index:n,useElements:!0,useEvents:!0})}))}}]),g}(e.Component);function C(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{scaleCorrection:t.scaleCorrection,use:C.use.bind(this,t)}}function j(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{scaleCorrection:t.scaleCorrection,use:j.use.bind(this,t)}}p(O,"defaultProps",{scaleCorrection:!1,parentLevel:0,stagger:.1,viewportMargin:.25,animate:{}}),C.use=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.direction,n=void 0===e?"up":e,r=t.scaleCorrection,i=void 0!==r&&r,o="0px",a="20px";switch(n){case"down":a="-20px";break;case"left":o="20px",a="0px";break;case"right":o="-20px",a="0px"}return new I({position:{x:"0px",y:"0px"},opacity:1,scaleCorrection:i,duration:.5},{position:{x:o,y:a},opacity:0})},j.use=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=t.scaleCorrection,n=void 0!==e&&e;return new I({opacity:1,scale:1,scaleCorrection:n,duration:.25},{opacity:0,scale:.85})};var L=["levels","animations"],S=function(t){f(r,t);var n=m(r);function r(t){var e;return l(this,r),(e=n.call(this,t)).levels=e.props.levels,e.animations=new Array(e.levels).fill(0).map((function(t,n){return n<e.props.animations.length?e.props.animations[n]:e.props.animations[e.props.animations.length-1]})),e}return u(r,[{key:"makeAnimatable",value:function(t){var n=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(r<1||e.Children.count(t)<1)return t;var i=this.props;i.levels,i.animations;var o=y(i,L),a=this.animations[this.levels-r];return React.createElement(O,h({animation:a,scaleCorrection:a.scaleCorrection},o),e.Children.map(t,(function(t){return e.isValidElement(t)?e.cloneElement(t,{},n.makeAnimatable(t.props.children,r-1)):t})))}},{key:"render",value:function(){return this.makeAnimatable(this.props.children,this.levels)}}]),r}(e.Component);p(S,"defaultProps",{levels:1,stagger:.1,viewportMargin:.25,animations:[C,j]});var P=function(t){f(n,t);var e=m(n);function n(t){var r;return l(this,n),(r=e.call(this,t)).animations.morphs=[],r}return u(n,[{key:"componentDidMount",value:function(){var t=this,e=this.elements[0];e&&(I.setInitial(e),e.setAttribute("uitools-morph-id",this.props.id),e.setAttribute("uitools-morph-active",this.props.active),this.self=e,this.createResetAnimation(),E.delay((function(){for(var n=document.querySelectorAll('[uitools-morph-id="'.concat(t.props.id,'"]')),r=0;r<n.length;r++)n[r]!==e&&(t.createMorphAnimation(n[r],r),"true"!==n[r].getAttribute("uitools-morph-active")&&t.animations.transition.setInitialStyles(n[r]))}),.001))}},{key:"componentDidUpdate",value:function(){var t=this,e="true"===this.self.getAttribute("uitools-morph-active");this.self.setAttribute("uitools-morph-active",this.props.active),E.delay((function(){if(t.props.active&&!e)t.animations.transition.setInitialStyles(t.self),t.animations.transition.play(t.self);else if(!t.props.active&&e){for(var n=0,r=document.querySelectorAll('[uitools-morph-id="'.concat(t.props.id,'"]')),i=0;i<r.length;i++)if(r[i]!==t.self&&"true"===r[i].getAttribute("uitools-morph-active")){n=i;break}t.animations.morphs[n].play(t.self)}}),.001)}},{key:"createResetAnimation",value:function(){var t,e=null===(t=this.self.UITools)||void 0===t?void 0:t.initialStyles;this.animations.transition=I.from({opacity:[0,0,1],scale:{x:1,y:1},position:{x:0,y:0},borderRadius:e.borderRadius,backgroundColor:[e.backgroundColor,e.backgroundColor,e.backgroundColor]},{},this.scaleCorrection)}},{key:"createMorphAnimation",value:function(t,e){var n,r,i=null===(n=this.self.UITools)||void 0===n?void 0:n.initialStyles,o=null===(r=t.UITools)||void 0===r?void 0:r.initialStyles;this.animations.morphs[e]=I.from({position:[{x:0,y:0},{x:o.x-i.x+(o.clientWidth-i.clientWidth)/2,y:o.y-i.y+(o.clientHeight-i.clientHeight)/2},{x:o.x-i.x+(o.clientWidth-i.clientWidth)/2,y:o.y-i.y+(o.clientHeight-i.clientHeight)/2}],scale:[{x:1,y:1},{x:o.clientWidth/i.clientWidth,y:o.clientHeight/i.clientHeight},{x:o.clientWidth/i.clientWidth,y:o.clientHeight/i.clientHeight}],opacity:[1,1,0],borderRadius:[i.borderRadius,o.borderRadius,o.borderRadius],backgroundColor:[i.backgroundColor,o.backgroundColor,o.backgroundColor]},{},this.scaleCorrection)}}]),n}(O);p(P,"defaultProps",{id:0,active:!1,scaleCorrection:!1}),t.Animatable=O,t.Animate=S,t.Morph=P,Object.defineProperty(t,"__esModule",{value:!0})}));
|