@infinityfx/lively 2.0.0-beta.2 → 2.0.0-beta.4
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/animatable-09e62071.js +1 -0
- package/dist/cjs/animation-ca5a8d1c.js +1 -0
- package/dist/cjs/animations.js +1 -1
- package/dist/cjs/auto.js +1 -1
- package/dist/cjs/{events-eb85ed65.js → events-d4e828a9.js} +1 -1
- package/dist/cjs/hooks.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/link-964db6c5.js +1 -0
- package/dist/cjs/{pop-4504ece8.js → pop-4edf5e2f.js} +1 -1
- package/dist/cjs/{scroll-638f0ef0.js → scroll-218eb875.js} +1 -1
- package/dist/esm/animatable-87fd0b01.js +1 -0
- package/dist/esm/animation-2ca8d322.js +1 -0
- package/dist/esm/animations.js +1 -1
- package/dist/esm/auto.js +1 -1
- package/dist/esm/{events-6abe8a94.js → events-ac24ef8f.js} +1 -1
- package/dist/esm/hooks.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/link-fda65080.js +1 -0
- package/dist/esm/{pop-5ce05de1.js → pop-5d0c6406.js} +1 -1
- package/dist/esm/{scroll-e67b146b.js → scroll-b155427a.js} +1 -1
- package/package.json +3 -5
- package/types/animatable.d.ts +55 -29
- package/types/animate.d.ts +44 -2
- package/types/animations/animation.d.ts +6 -0
- package/types/auto/layout-group.d.ts +16 -0
- package/types/auto/morph.d.ts +26 -0
- package/types/auto.d.ts +4 -0
- package/types/core/link.d.ts +12 -0
- package/types/globals.d.ts +8 -27
- package/types/hooks/link.d.ts +8 -0
- package/types/hooks/path.d.ts +9 -0
- package/types/hooks/reduced-motions.d.ts +4 -0
- package/types/hooks/scroll.d.ts +6 -1
- package/types/hooks/unmount.d.ts +2 -2
- package/types/hooks.d.ts +3 -1
- package/types/index.d.ts +1 -1
- package/dist/cjs/animatable-e8874f92.js +0 -1
- package/dist/cjs/animation-48d0562e.js +0 -1
- package/dist/cjs/link-b1d8de51.js +0 -1
- package/dist/esm/animatable-036cf87e.js +0 -1
- package/dist/esm/animation-759a01d8.js +0 -1
- package/dist/esm/link-c7db7b65.js +0 -1
- package/types/animate/animate.d.ts +0 -36
- package/types/hooks/animation.d.ts +0 -1
- package/types/morph.d.ts +0 -35
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("@babel/runtime/helpers/classCallCheck"),t=require("@babel/runtime/helpers/createClass"),r=require("@babel/runtime/helpers/inherits"),n=require("@babel/runtime/helpers/possibleConstructorReturn"),i=require("@babel/runtime/helpers/getPrototypeOf"),o=require("@babel/runtime/helpers/defineProperty"),a=require("react"),s=require("./animation-ca5a8d1c.js"),l=require("./link-964db6c5.js"),u=require("./events-d4e828a9.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=c(e),f=c(t),p=c(r),y=c(n),d=c(i),v=c(o);function m(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return g(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return g(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var b=function(){function e(){h.default(this,e),this.t=Date.now(),this.managers=[],this.step()}return f.default(e,[{key:"step",value:function(){var e,t=Date.now(),r=m(this.managers);try{for(r.s();!(e=r.n()).done;){e.value.step((t-this.t)/1e3)}}catch(e){r.e(e)}finally{r.f()}this.t=t,requestAnimationFrame(this.step.bind(this))}},{key:"add",value:function(e){var t=this.managers.findIndex((function(t){return t.priority>=e.priority}));this.managers.splice(t<0?0:t,0,e)}},{key:"remove",value:function(e){this.managers.splice(this.managers.indexOf(e),1)}}],[{key:"get",value:function(){return window.Lively||(window.Lively=new e),window.Lively}}]),e}();function w(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return k(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return k(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var O=function(){function e(t,r,n){h.default(this,e),this.element=t,this.tracks=[],this.queue=[],this.playing=!0,this.culling=r,this.layout=n,this.transforms=["translate","scale","skew","rotate"]}return f.default(e,[{key:"purge",value:function(){if(!("cache"in this.element)){this.element.cache={strokeDasharray:1,borderRadius:l.getProperty(this.element,"borderRadius")};for(var e=0;e<this.element.style.length;e++){var t=this.element.style[e];this.element.cache[t]=this.element.style[t]}}for(var r in this.element.style={},this.element.cache)this.element.style[r]=this.element.cache[r]}},{key:"clear",value:function(){this.tracks=[],this.queue=[]}},{key:"add",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.immediate,n=void 0!==r&&r,i=t.composite,o=void 0===i||i;n&&this.clear(),o||!this.tracks.length?this.tracks.push(e):this.queue.push(e)}},{key:"remove",value:function(e){this.tracks.splice(this.tracks.indexOf(e),1),!this.tracks.length&&this.queue.length&&this.tracks.push(this.queue.shift())}},{key:"step",value:function(e){if(this.playing){for(var t=this.element.correction?{scale:l.DEFAULT_OBJECTS.scale}:{},r=this.tracks.length+ +!this.channel.isEmpty,n=0;n<r;n++){var i=this.tracks[n]||this.channel;l.mergeProperties(t,i.get(this.element,this.culling)),i.step(e)&&this.remove(i)}this.apply(this.element,t)}}},{key:"apply",value:function(e,t){if(!l.is.empty(t)){var r=[];for(var n in t){var i=t[n];if("scale"==n){if(this.layout){var o,a={x:[1/i.x[0],i.x[1]],y:[1/i.y[0],i.y[1]]},s=w(e.children);try{for(s.s();!(o=s.n()).done;){o.value.correction=a}}catch(e){s.e(e)}finally{s.f()}var u=t.borderRadius||e.cache.borderRadius;delete t.borderRadius,e.style.borderRadius="".concat(u[0]/i.x[0]).concat(u[1]," / ").concat(u[0]/i.y[0]).concat(u[1])}e.correction&&(i=l.merge(i,e.correction,l.MERGE_FUNCTIONS.scale))}var c=this.transforms.indexOf(n);if(c>=0)r[c]="".concat(n,"(").concat(l.is.object(i)?l.objToStr(i,", ",["x","y"]):l.arrToStyle(i),")");else{var h,f=w(l.Alias[n]||[n]);try{for(f.s();!(h=f.n()).done;){var p=h.value;l.is.color(i)?e.style[p]="rgba(".concat(i.r[0],", ").concat(i.g[0],", ").concat(i.b[0],", ").concat(i.a[0],")"):e.style[p]=p in l.Alias?l.Alias[p](i):l.arrToStyle(i)}}catch(e){f.e(e)}finally{f.f()}}}(r=r.filter((function(e){return!!e}))).length&&(e.style.transform=r.join(" "))}}},{key:"initialize",value:function(e){this.apply(this.element,e.initials),this.channel=e.channel}}]),e}();function j(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function A(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?j(Object(r),!0).forEach((function(t){v.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function S(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return x(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return x(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var E=function(){function e(t){var r=t.priority,n=void 0===r?0:r,i=t.stagger,o=void 0===i?.1:i,a=t.culling,s=void 0===a||a,l=t.noDeform,u=void 0!==l&&l,c=t.paused,f=void 0!==c&&c;h.default(this,e),this.targets=[],this.priority=n,this.stagger=o,this.culling=s,this.noDeform=u,this.paused=f}return f.default(e,[{key:"register",value:function(){b.get().add(this)}},{key:"destroy",value:function(){this.targets=[],b.get().remove(this)}},{key:"purge",value:function(){var e,t=S(this.targets);try{for(t.s();!(e=t.n()).done;){e.value.purge()}}catch(e){t.e(e)}finally{t.f()}}},{key:"clear",value:function(){var e,t=S(this.targets);try{for(t.s();!(e=t.n()).done;){e.value.clear()}}catch(e){t.e(e)}finally{t.f()}}},{key:"set",value:function(e){var t=this;this.targets=e.map((function(e){return new O(e,t.culling,t.noDeform)}))}},{key:"play",value:function(e,t){if(!e.isEmpty)for(var r=0;r<this.targets.length;r++){var n=A(A({},t),{},{delay:(t.delay||0)+r*this.stagger});this.targets[r].add(e.play(n),n)}}},{key:"initialize",value:function(e){var t,r=S(this.targets);try{for(r.s();!(t=r.n()).done;){t.value.initialize(e)}}catch(e){r.e(e)}finally{r.f()}}},{key:"step",value:function(e){if(!this.paused){var t,r=S(this.targets);try{for(r.s();!(t=r.n()).done;){t.value.step(e)}}catch(e){r.e(e)}finally{r.f()}}}}]),e}();function P(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function I(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?P(Object(r),!0).forEach((function(t){v.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):P(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function D(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return q(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return q(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function q(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function C(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=d.default(e);if(t){var i=d.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return y.default(this,r)}}var L=function(e){p.default(r,e);var t=C(r);function r(e){var n;for(var i in h.default(this,r),(n=t.call(this,e)).animations={default:n.parse(n.props.animate||{})},n.props.animations||{})n.animations[i]=n.parse(n.props.animations[i]);return n.children=[],n.elements=[],n.stagger=n.props.stagger||.1,n.manager=new E({priority:n.props.group,stagger:n.stagger,culling:n.props.lazy,noDeform:n.props.noDeform,paused:n.props.paused}),n}return f.default(r,[{key:"parse",value:function(e){return s.Animation.isInstance(e)?e.use():l.is.object(e)?new s.Clip(e,this.props.initial):null}},{key:"update",value:function(){this.manager.clear(),this.manager.purge(),this.manager.initialize(this.animations.default)}},{key:"componentDidMount",value:function(){var e=this;this.scrollEventListener=l.throttle(this.onScroll.bind(this)),u.addEventListener("scroll",this.scrollEventListener),this.eventListener=this.onEvent.bind(this),u.onAny(r.events,this.elements,this.eventListener),this.manager.set(this.elements),this.manager.register(),this.update(),document.fonts.ready.then((function(){e.update(),clearTimeout(e.timeout),e.inViewport=!1,e.props.group||(e.play(e.props.onMount),e.onScroll())}))}},{key:"componentWillUnmount",value:function(){u.removeEventListener("scroll",this.scrollEventListener),u.offAny(r.events,this.elements,this.eventListener),this.manager.destroy()}},{key:"componentDidUpdate",value:function(){this.manager.paused=this.props.paused;var e,t=D(this.children);try{for(t.s();!(e=t.n()).done;){e.value.manager.paused=this.props.paused}}catch(e){t.e(e)}finally{t.f()}}},{key:"dispatch",value:function(e){l.is.function(this.props[e])&&this.props[e]()}},{key:"onEvent",value:function(e){switch(e.type){case"click":this.play(this.props.onClick);break;case"mouseenter":this.hover||(this.hover=!0,this.play(this.props.whileHover));break;case"mouseleave":this.hover&&(this.hover=!1,this.play(this.props.whileHover,{reverse:!0}));break;case"focus":this.focus||(this.focus=!0,this.play(this.props.whileFocus));break;case"blur":this.focus&&(this.focus=!1,this.play(this.props.whileFocus,{reverse:!0}))}}},{key:"getBoundingBox",value:function(){var e,t={x:Number.MAX_VALUE,y:Number.MAX_VALUE,right:0,bottom:0},r=D(this.elements.length?this.elements:this.children);try{for(r.s();!(e=r.n()).done;){var n=e.value,i=this.elements.length?n.getBoundingClientRect():n.getBoundingBox();t.y=Math.min(i.y,t.y),t.x=Math.min(i.x,t.x),t.right=Math.max(i.right,t.right),t.bottom=Math.max(i.bottom,t.bottom)}}catch(e){r.e(e)}finally{r.f()}return t}},{key:"onScroll",value:function(){if(this.props.whileViewport){var e=l.inViewport(this.getBoundingBox(),this.props.viewportMargin),t=e.entered,r=e.left;t&&!this.inViewport&&(this.inViewport=!0,this.play(this.props.whileViewport),this.dispatch("onEnterViewport")),r&&this.inViewport&&(this.inViewport=!1,this.play(this.props.whileViewport,{reverse:!0,immediate:!0}),this.dispatch("onLeaveViewport"))}}},{key:"play",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.reverse,i=void 0!==n&&n,o=r.composite,a=void 0!==o&&o,s=r.immediate,u=void 0!==s&&s,c=r.delay,h=void 0===c?0:c,f=r.callback,p=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!(!e||this.props.disabled||this.props.group>0&&!p)){l.is.string(e)||(e="default"),this.dispatch("onAnimationStart");var y,d=this.animations[e],v=d.length(),m=0,g=D(this.children);try{for(g.s();!(y=g.n()).done;){var b=y.value;m=Math.max(m,b.play(e,{reverse:i,immediate:u,delay:h+v},!0))}}catch(e){g.e(e)}finally{g.f()}return this.manager.play(d,{reverse:i,composite:a,immediate:u,delay:i?m:h}),u&&clearTimeout(this.timeout),this.props.group||(this.timeout=setTimeout((function(){t.dispatch("onAnimationEnd"),l.is.function(f)&&f()}),1e3*(m+v))),v+(i?m:h)}}},{key:"stop",value:function(){this.manager.clear()}},{key:"prerender",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return a.Children.map(e,(function(e){if(!a.isValidElement(e))return e;var o={pathLength:1},s=t.elementIndex++;if(n&&(o.ref=function(e){return t.elements[s]=e}),r.isInstance(e)&&i&&!e.props.noCascade){var u=t.childIndex++;i=!1,o.group=t.props.group+1,o.ref=function(e){return t.children[u]=e},t.props.group||(o.active=t.props.active),l.mergeObjects(o,I(I({},t.props),e.props),t.constructor.cascadingProps)}return a.cloneElement(e,o,t.prerender(e.props.children,!1,i))}))}},{key:"render",value:function(){return this.elementIndex=this.childIndex=0,this.prerender(this.props.children)}}],[{key:"isInstance",value:function(e){return e.type===r||e.type.prototype instanceof r}}]),r}(a.Component);v.default(L,"events",["click","mouseenter","mouseleave","focus","blur"]),v.default(L,"cascadingProps",["animate","initial","animations","stagger"]),v.default(L,"defaultProps",{group:0,viewportMargin:.75,lazy:!0,paused:!1}),exports.Animatable=L;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var t=require("@babel/runtime/helpers/slicedToArray"),e=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/objectWithoutProperties"),n=require("@babel/runtime/helpers/classCallCheck"),i=require("@babel/runtime/helpers/createClass"),a=require("@babel/runtime/helpers/inherits"),o=require("@babel/runtime/helpers/possibleConstructorReturn"),u=require("@babel/runtime/helpers/getPrototypeOf"),s=require("./link-964db6c5.js");function l(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var c=l(t),f=l(e),h=l(r),p=l(n),d=l(i),v=l(a),y=l(o),b=l(u);function m(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return g(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return g(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function g(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var O=function t(e,r,n,i){if(s.is.object(e)){var a={};for(var o in e)a[o]=t(e[o],r[o],n,i);return a}return[i(e[0],r[0],n),e[1]]},j=function(t,e,r){return s.is.number(t)&&s.is.number(e)?t*(1-r)+e*r:r>.5?e:t},w=function(t,e,r){return j(t,e,(1-Math.cos(r*Math.PI))/2)},P=function(t,e,r){var n,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a={duration:i},o={},u=m(r);try{for(u.s();!(n=u.n()).done;){var s=n.value;"scale"==s?(a.scale={x:1,y:1},o.scale={x:1+(e.layout.width-t.layout.width)/t.layout.width,y:1+(e.layout.height-t.layout.height)/t.layout.height}):"translate"==s?(a.translate={x:0,y:0},o.translate={x:(e.layout.x-t.layout.x)*t.layout.parentWidth,y:(e.layout.y-t.layout.y)*t.layout.parentHeight}):(a[s]=t[s],o[s]=e[s])}}catch(t){u.e(t)}finally{u.f()}return new B(a,o)},S=Object.freeze({__proto__:null,interpolate:O,constant:function(t){return t},linear:j,ease:w,spring:function(t,e,r){return r=1-1*Math.exp(-3.6*r)*Math.cos(2.5*Math.pow(r,2)*Math.PI),j(t,e,r)},computeMorph:P}),I=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.reverse,i=void 0!==n&&n,a=r.repeat,o=void 0===a?1:a,u=r.delay,s=void 0===u?0:u,l=r.alternate,c=void 0!==l&&l;p.default(this,t),this.indices={},this.clip=e,this.t=0,this.T=e.duration*o+s,this.reverse=i,this.delay=s,this.alternate=c}return d.default(t,[{key:"getInterpolatedValue",value:function(t,e,r,n){if(s.is.function(e))e=s.convert(e(r,this.clip.duration),t),e=s.Units.toBase(e,t,n);else{t in this.indices||(this.indices[t]=this.reverse?e.length-1:0);var i,a=this.reverse?-1:1,o=this.indices[t],u=e[o],l=e[o+a],c=u.set;if(this.reverse?l.time>r:l.time<r){this.indices[t]=o+=a;var f=["start","end"],h=f[+!this.reverse],p=f[+this.reverse];h in u||p in l?(c=h in u?u[h]:l[p],i=!0):(u=e[o],l=e[o+a])}if(s.is.null(c)&&(c=s.getProperty(n,t)),c=s.Units.toBase(c,t,n),i)e=c;else{var d=s.is.null(l.set)?s.getProperty(n,t):l.set;d=s.Units.toBase(d,t,n);var v=S[l.interpolate||this.clip.interpolate]||w;e=O(c,d,(r-u.time)/(l.time-u.time),v)}}return e}},{key:"get",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r={},n=this.t>=this.T;if(this.t<this.delay||e&&!n&&!s.isVisible(t))return r;var i=this.t-this.delay,a=this.clip.duration,o=this.alternate&&Math.floor(i/a)%2==+!n;for(var u in i=n?a:i%a,i=s.xor(this.reverse,o)?a-i:i,r.origin=this.clip.origin,this.clip.properties)r[u]=this.getInterpolatedValue(u,this.clip.properties[u],i,t);return r}},{key:"step",value:function(t){var e=this.t>=this.T;return this.t+=t,e}}]),t}();function x(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=b.default(t);if(e){var i=b.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return y.default(this,r)}}var k=function(t){v.default(r,t);var e=x(r);function r(){var t;return p.default(this,r),(t=e.call(this,{duration:1/0,properties:{},origin:{x:.5,y:.5}})).isEmpty=!0,t.cache={},t}return d.default(r,[{key:"add",value:function(t,e){this.clip.properties[t]=e,this.isEmpty=!1}},{key:"getInterpolatedValue",value:function(t,e,r,n){s.is.null(e.internal.t)&&(e.internal.t=r),e.internal.t===r&&(this.cache[t]={});var i=e.internal.duration?Math.min((r-e.internal.t)/e.internal.duration,1):1,a=this.cache[t]||{};if(a.t===i)return a.value;var o=s.Units.toBase(s.convert(e(r,this.clip.duration),t),t,n),u=s.getProperty(n,t);u=s.Units.toBase(u,t,n);var l=O(u,o,i,j);return this.cache[t]={value:l,t:i},l}}]),r}(I),A=["duration","delay","repeat","alternate","interpolate","origin"];function q(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return M(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return M(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function M(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function T(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function z(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?T(Object(r),!0).forEach((function(e){f.default(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var B=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.duration,n=void 0===r?1:r,i=e.delay,a=e.repeat,o=e.alternate,u=e.interpolate,l=e.origin,f=void 0===l?{x:.5,y:.5}:l,d=h.default(e,A),v=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};p.default(this,t),this.duration=n,this.origin=s.originToStr(f),this.channel=new k;var y=this.parse(d,v),b=c.default(y,2);this.properties=b[0],this.initials=b[1],this.isEmpty=s.is.empty(this.properties),this.interpolate=u,this.defaults={delay:i,repeat:a,alternate:o}}return d.default(t,[{key:"length",value:function(){return this.duration*(this.defaults.repeat||1)+(this.defaults.delay||0)}},{key:"parse",value:function(t,e){var r=this,n=function(n){var i=t[n];if(s.Link.isInstance(i))return r.channel.add(n,i),delete t[n],"continue";if(s.is.function(i))return"continue";(i=s.is.array(i)?i:[i]).length<2?i.unshift(n in e?e[n]:null):s.is.null(i[0])||(e[n]=i[0]);for(var a=i.map((function(t){return r.sanitize(t,n)})),o=0;o<a.length;o++)r.quantize(a,o);t[n]=a};for(var i in t)n(i);for(var a in e=z({},e))e[a]=s.convert(e[a],a);return[t,e]}},{key:"sanitize",value:function(t,e){s.is.object(t)||(t={set:t}),s.hasSomeKey(t,s.POSITIONS)||(t={set:t}),"set"in t||(t.set="start"in t?t.start:t.end),"time"in t&&t.time>this.duration&&delete t.time,t=z({},t);var r,n=q(s.POSITIONS);try{for(n.s();!(r=n.n()).done;){var i=r.value;i in t&&(t[i]=s.convert(t[i],e))}}catch(t){n.e(t)}finally{n.f()}return t}},{key:"quantize",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e-1;if("time"in t[e])return t[e].time;if(0==e||e==t.length-1)return t[e].time=0==e?0:this.duration;var n=this.quantize(t,r,r);return t[e].time=n+(this.quantize(t,e+1,r)-n)*((e-r)/(e-r+1))}},{key:"play",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new I(this,s.mergeObjects(t,this.defaults))}}]),t}(),C={create:function(t){var e=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.use=t.use.bind(t,e),t};return e.use=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t(e),n=c.default(r,2),i=n[0],a=n[1];return new B(i,a)},e},isInstance:function(t){return s.is.function(t)&&s.is.function(t.use)}};exports.Animation=C,exports.Clip=B,exports.computeMorph=P;
|
package/dist/cjs/animations.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./animation-
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./animation-ca5a8d1c.js"),r=require("@babel/runtime/helpers/defineProperty"),t=require("./pop-4edf5e2f.js"),n=require("@babel/runtime/helpers/objectWithoutProperties");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("@babel/runtime/helpers/slicedToArray"),require("@babel/runtime/helpers/classCallCheck"),require("@babel/runtime/helpers/createClass"),require("@babel/runtime/helpers/inherits"),require("@babel/runtime/helpers/possibleConstructorReturn"),require("@babel/runtime/helpers/getPrototypeOf"),require("./link-964db6c5.js"),require("@babel/runtime/helpers/typeof");var i=o(r),c=o(n);function u(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function a(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?u(Object(t),!0).forEach((function(r){i.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):u(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var p=e.Animation.create((function(e){return[a({opacity:1,duration:.65},e),{opacity:0}]})),s=["direction"];function b(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function l(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?b(Object(t),!0).forEach((function(r){i.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):b(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var f=e.Animation.create((function(e){var r=e.direction,t=void 0===r?"right":r,n=c.default(e,s),o=0,i=1,u={x:0,y:.5};switch(t){case"left":u.x=1;break;case"up":o=1,i=0,u={x:0,y:1};break;case"down":o=1,i=0,u={x:0,y:0}}return[l({scale:{x:1},origin:u,duration:.6},n),{scale:{x:o,y:i}}]})),O=["direction"];function y(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function j(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?y(Object(t),!0).forEach((function(r){i.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):y(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}var d=e.Animation.create((function(e){var r=e.direction,t=void 0===r?"right":r,n=c.default(e,O);return["left","right","top","bottom"].includes(t)||(t="right"),[j({clip:i.default({},t,0)},n),{clip:i.default({},t,1)}]}));exports.Animation=e.Animation,exports.Move=t.Move,exports.Pop=t.Pop,exports.Fade=p,exports.Scale=f,exports.Wipe=d;
|
package/dist/cjs/auto.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/classCallCheck"),t=require("@babel/runtime/helpers/createClass"),r=require("@babel/runtime/helpers/get"),n=require("@babel/runtime/helpers/inherits"),i=require("@babel/runtime/helpers/possibleConstructorReturn"),a=require("@babel/runtime/helpers/getPrototypeOf"),o=require("@babel/runtime/helpers/defineProperty"),u=require("./animatable-
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/classCallCheck"),t=require("@babel/runtime/helpers/createClass"),r=require("@babel/runtime/helpers/get"),n=require("@babel/runtime/helpers/inherits"),i=require("@babel/runtime/helpers/possibleConstructorReturn"),a=require("@babel/runtime/helpers/getPrototypeOf"),o=require("@babel/runtime/helpers/defineProperty"),u=require("./animatable-09e62071.js"),l=require("react"),s=require("./link-964db6c5.js"),c=require("./animation-ca5a8d1c.js"),p=require("@babel/runtime/helpers/toConsumableArray"),f=require("./scroll-218eb875.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("./events-d4e828a9.js"),require("@babel/runtime/helpers/typeof"),require("@babel/runtime/helpers/slicedToArray"),require("@babel/runtime/helpers/objectWithoutProperties");var h=d(e),y=d(t),m=d(r),v=d(n),b=d(i),g=d(a),O=d(o),P=d(l),j=d(p);function w(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function E(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?w(Object(r),!0).forEach((function(t){O.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function A(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return R(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return R(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){u=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function R(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function x(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=g.default(e);if(t){var i=g.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return b.default(this,r)}}var k={},q=function(e){v.default(r,e);var t=x(r);function r(e){var n;return h.default(this,r),(n=t.call(this,e)).animations={default:new c.Clip({},{opacity:+e.active,pointerEvents:e.active?"":"none"}),unmorph:new c.Clip({},{opacity:0,pointerEvents:"none"})},n.properties=s.subArray(n.props.include,n.props.exclude),n.uuid=(e.id||0)+e.group.toString(),n}return y.default(r,[{key:"shouldComponentUpdate",value:function(e){return this.props.active!==e.active&&(this.uuid in k?k[this.uuid].push(this):k[this.uuid]=[this]),this.props.active!==e.active}},{key:"getSnapshotBeforeUpdate",value:function(e){if(this.props.active!==e.active&&this.props.active){var t,r=A(k[this.uuid]);try{for(r.s();!(t=r.n()).done;){var n=t.value;if(n!==this)return s.getSnapshot(n.elements[0],this.props.group)}}catch(e){r.e(e)}finally{r.f()}}return null}},{key:"componentDidUpdate",value:function(e,t,n){if(m.default(g.default(r.prototype),"componentDidUpdate",this).call(this),k[this.uuid]=[],n){var i=s.getSnapshot(this.elements[0],this.props.group);i.opacity=1,i.pointerEvents="",this.manager.play(c.computeMorph(i,n,this.properties,this.props.duration),{composite:!0})}else this.manager.initialize(this.animations.unmorph)}},{key:"render",value:function(){var e=this.props.children;if(s.is.array(e)){if(e.length>1)return e;e=e[0]}return l.isValidElement(e)?m.default(g.default(r.prototype),"render",this).call(this):e}}]),r}(u.Animatable);function S(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=g.default(e);if(t){var i=g.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return b.default(this,r)}}O.default(q,"cascadingProps",["id","duration"]),O.default(q,"defaultProps",E(E({},u.Animatable.defaultProps),{},{active:!1,include:s.MORPH_PROPERTIES,exclude:[]}));var C=function(e){v.default(r,e);var t=S(r);function r(e){var n;return h.default(this,r),(n=t.call(this,e)).children=[],n.properties=s.subArray(n.props.include,n.props.exclude),n}return y.default(r,[{key:"getSnapshotBeforeUpdate",value:function(){return this.children.map((function(e){var t=null==e?void 0:e.elements[0];return t?{data:s.getSnapshot(t),key:e.props.layoutKey}:null}))}},{key:"componentDidUpdate",value:function(e,t,r){for(var n=0,i=0;n<r.length;n++,i++){var a=this.children[i];if(a&&a.elements[0]){var o=r[n];if(o&&a.props.layoutKey===o.key){var u=s.getSnapshot(a.elements[0]);a.manager.play(c.computeMorph(u,o.data,this.properties,this.props.duration),{composite:!0})}else i--}}}},{key:"render",value:function(){var e=this;return this.childIndex=0,l.Children.map(this.props.children,(function(t){if(!l.isValidElement(t)||!u.Animatable.isInstance(t))return t;var r=e.childIndex++;return l.cloneElement(t,{ref:function(t){return e.children[r]=t},layoutKey:t.key})}))}}]),r}(l.Component);function I(e){var t=e.children,r=e.className,n=e.style,i=e.duration;if(!s.is.string(t))return t;var a=t.split("");return P.default.createElement("div",{className:r,style:n},P.default.createElement(u.Animatable,{whileViewport:!0,animate:{opacity:1,translate:{y:0},rotate:0,duration:.8},initial:{opacity:0,translate:{y:"100%"},rotate:10},stagger:(i-.8)/(a.length-1)},a.map((function(e,t){return P.default.createElement("span",{style:{display:"inline-block"},key:t},/\s/.test(e)?" ":e)}))))}function M(e){var t,r=e.children,n=e.color,i=e.duration,a=(null===(t=r.props)||void 0===t?void 0:t.children)||[];Array.isArray(a)||(a=[a]);var o=[P.default.createElement(u.Animatable,{key:0,initial:{clip:{right:0}},animate:{clip:{left:1},duration:i/2}},P.default.createElement("div",{style:{position:"absolute",inset:0,backgroundColor:n}}))].concat(j.default(a));return P.default.createElement(u.Animatable,{whileViewport:!0,animate:{clip:{right:0},duration:i/2},initial:{clip:{right:1}}},l.cloneElement(r,{},o))}function B(e){var t,r=e.children,n=e.amount,i=f.useScroll(),a=l.useRef();return P.default.createElement(u.Animatable,{ref:a,animate:{translate:i((function(e){if(void 0===t){var r,i=null===(r=a.current)||void 0===r?void 0:r.elements[0];i&&(t=Math.max(i.getBoundingClientRect().y+window.scrollY-window.innerHeight/2,0))}return{x:0,y:(e-(t||0))*n}}))}},r)}O.default(C,"defaultProps",{include:s.MORPH_PROPERTIES,exclude:[]}),I.defaultProps={style:{},className:"",duration:1.6},M.defaultProps={color:"grey",duration:1.6},B.defaultProps={amount:.5},exports.ColorWipe=M,exports.LayoutGroup=C,exports.Morph=q,exports.Parallax=B,exports.WriteOn=I;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var n=require("./link-
|
|
1
|
+
"use strict";var n=require("./link-964db6c5.js");function e(n,e){var t="undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(!t){if(Array.isArray(n)||(t=function(n,e){if(!n)return;if("string"==typeof n)return r(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);"Object"===t&&n.constructor&&(t=n.constructor.name);if("Map"===t||"Set"===t)return Array.from(n);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return r(n,e)}(n))||e&&n&&"number"==typeof n.length){t&&(n=t);var o=0,i=function(){};return{s:i,n:function(){return o>=n.length?{done:!0}:{done:!1,value:n[o++]}},e:function(n){throw n},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,u=!0,f=!1;return{s:function(){t=t.call(n)},n:function(){var n=t.next();return u=n.done,n},e:function(n){f=!0,a=n},f:function(){try{u||null==t.return||t.return()}finally{if(f)throw a}}}}function r(n,e){(null==e||e>n.length)&&(e=n.length);for(var r=0,t=new Array(e);r<e;r++)t[r]=n[r];return t}var t={};exports.addEventListener=function(e,r){e in t||(t[e]={unique:0},window.addEventListener(e,(function(r){for(var o=0,i=Object.values(t[e]);o<i.length;o++){var a=i[o];n.is.function(a)&&a(r)}})));var o=t[e];r.LivelyID=o.unique,o[o.unique++]=r},exports.offAny=function(n,r,t){var o,i=e(n);try{for(i.s();!(o=i.n()).done;){var a,u=o.value,f=e(r);try{for(f.s();!(a=f.n()).done;){a.value.removeEventListener(u,t)}}catch(n){f.e(n)}finally{f.f()}}}catch(n){i.e(n)}finally{i.f()}},exports.onAny=function(n,r,t){var o,i=e(n);try{for(i.s();!(o=i.n()).done;){var a,u=o.value,f=e(r);try{for(f.s();!(a=f.n()).done;){a.value.addEventListener(u,t)}}catch(n){f.e(n)}finally{f.f()}}}catch(n){i.e(n)}finally{i.f()}},exports.removeEventListener=function(e,r){!n.is.null(window)&&e in t&&!n.is.null(r)&&"LivelyID"in r&&delete t[e][r.LivelyID]};
|
package/dist/cjs/hooks.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/slicedToArray"),r=require("react"),t=require("./link-
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/slicedToArray"),r=require("react"),t=require("./link-964db6c5.js"),n=require("./scroll-218eb875.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("@babel/runtime/helpers/typeof"),require("@babel/runtime/helpers/defineProperty"),require("./events-d4e828a9.js");var i=u(e);exports.useScroll=n.useScroll,exports.useLink=function(e){var r=t.Link.create(e);return[r,r.set]},exports.usePath=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=r.useRef(),u=r.useCallback((function(r,u){if(!n.current)return{x:0,y:0};var i=n.current.getTotalLength()*r/u,o=n.current.getPointAtLength(i),c=o.x,s=o.y;return{x:e[0]+c*t,y:e[1]+s*t}}),[n]);return[u,n]},exports.useReducedMotion=function(){var e=r.useState(!1),t=i.default(e,2),n=t[0],u=t[1],o=function(e){return u(e.matches)};return r.useEffect((function(){var e=matchMedia("(prefers-reduced-motion: reduce)");return e.addEventListener("change",o),u(e.matches),function(){return e.removeEventListener("change",o)}}),[]),n},exports.useUnmount=function(e){var t=r.useState(e),n=i.default(t,2),u=n[0],o=n[1],c=r.useRef();return[u,function(){if(!u)return o(!0);c.current.play(c.current.props.onUnmount,{reverse:!0,immediate:!0,callback:function(){return o(!1)}})},c]};
|
package/dist/cjs/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./animatable-
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./animatable-09e62071.js"),t=require("@babel/runtime/helpers/extends"),r=require("@babel/runtime/helpers/objectWithoutProperties"),n=require("@babel/runtime/helpers/classCallCheck"),i=require("@babel/runtime/helpers/createClass"),a=require("@babel/runtime/helpers/inherits"),l=require("@babel/runtime/helpers/possibleConstructorReturn"),u=require("@babel/runtime/helpers/getPrototypeOf"),o=require("@babel/runtime/helpers/defineProperty"),s=require("react"),c=require("./pop-4edf5e2f.js"),f=require("./link-964db6c5.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("./animation-ca5a8d1c.js"),require("@babel/runtime/helpers/slicedToArray"),require("./events-d4e828a9.js"),require("@babel/runtime/helpers/typeof");var b=p(t),m=p(r),h=p(n),d=p(i),v=p(a),y=p(l),O=p(u),j=p(o),q=p(s),P=["levels","animations"];function g(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function k(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?g(Object(r),!0).forEach((function(t){j.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):g(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function A(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=O.default(e);if(t){var i=O.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return y.default(this,r)}}var C=function(t){v.default(n,t);var r=A(n);function n(e){var t;return h.default(this,n),(t=r.call(this,e)).levels=t.props.levels,t.animations=f.padArray(t.props.animations,t.levels),t}return d.default(n,[{key:"makeAnimatable",value:function(t){var r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(n<1||s.Children.count(t)<1)return t;var i=this.props;i.levels,i.animations;var a=m.default(i,P),l=this.animations[this.levels-n];return n===this.levels&&(a.ref=function(e){return r.animatable=e}),q.default.createElement(e.Animatable,b.default({},a,{animate:l}),s.Children.map(t,(function(e){return s.isValidElement(e)?s.cloneElement(e,{},r.makeAnimatable(e.props.children,n-1)):e})))}},{key:"play",value:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};null===(t=this.animatable)||void 0===t||t.play(e,k({},r))}},{key:"render",value:function(){return this.makeAnimatable(this.props.children,this.levels)}}]),n}(s.Component);j.default(C,"defaultProps",{levels:1,animations:[c.Move,c.Pop]}),exports.Animatable=e.Animatable,exports.Animate=C;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var t=require("@babel/runtime/helpers/typeof"),n=require("@babel/runtime/helpers/slicedToArray"),r=require("@babel/runtime/helpers/defineProperty");function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var o=e(t),i=e(n),u=e(r),a=["%","px","em","rem","vw","vh","vmin","vmax","deg","rad"],l={rotate:"deg",skew:"deg",scale:"%",clip:"%",opacity:null,zIndex:null,lineHeight:null,fontWeight:null,length:null,default:"px"},c=[["x","y"],["r","g","b","a"],["left","top","right","bottom"]],f={translate:{x:[0,"px"],y:[0,"px"]},scale:{x:[1,"%"],y:[1,"%"]},clip:{left:[0,"%"],top:[0,"%"],right:[0,"%"],bottom:[0,"%"]},r:[127,null],g:[127,null],b:[127,null],a:[255,null]},s=["translate","scale","rotate","opacity","borderRadius","backgroundColor","color","zIndex","pointerEvents"],p={translate:function(t,n){return t+n},rotate:function(t,n){return t+n},scale:function(t,n){return t*n},default:function(t,n){return(t+n)/2}};function d(t,n){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,n){if(!t)return;if("string"==typeof t)return h(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return h(t,n)}(t))||n&&t&&"number"==typeof t.length){r&&(t=r);var e=0,o=function(){};return{s:o,n:function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}function h(t,n){(null==n||n>t.length)&&(n=t.length);for(var r=0,e=new Array(n);r<n;r++)e[r]=t[r];return e}var y=function(t,n){return Object.keys(t).some((function(t){return n.includes(t)}))},b={null:function(t){return null==t},array:function(t){return Array.isArray(t)},object:function(t){return!b.null(t)&&"object"===o.default(t)&&!b.array(t)},function:function(t){return t instanceof Function},string:function(t){return"string"==typeof t},bool:function(t){return"boolean"==typeof t},number:function(t){return"number"==typeof t},empty:function(t){return function(t,n){return Object.keys(t).length===n}(t,0)},rgb:function(t){return t.match(/^rgba?\(.*\)$/i)},hex:function(t){return t.match(/^#[0-9a-f]{3,8}$/i)},color:function(t){return b.object(t)&&"r"in t}},g=function(t){var n=new DOMMatrix(t),r=Math.sqrt(n.a*n.a+n.b*n.b)*Math.sign(n.a),e=Math.sqrt(n.c*n.c+n.d*n.d)*Math.sign(n.d),o=180*Math.atan2(n.d,n.c)/Math.PI-90,i=180*Math.atan2(n.b,n.a)/Math.PI;return{translate:{x:n.e,y:n.f},scale:{x:r,y:e},rotate:i,skew:{x:o,y:0}}},v=function t(n,r,e){if(b.object(n)){var o={};for(var i in n)o[i]=t(n[i],r[i],e);return o}return b.number(n[0])&&b.number(r[0])?[e(n[0],r[0]),n[1]]:r};function m(t,n){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);n&&(e=e.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),r.push.apply(r,e)}return r}function x(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?m(Object(r),!0).forEach((function(n){u.default(t,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))}))}return t}function w(t,n){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,n){if(!t)return;if("string"==typeof t)return O(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return O(t,n)}(t))||n&&t&&"number"==typeof t.length){r&&(t=r);var e=0,o=function(){};return{s:o,n:function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return u=t.done,t},e:function(t){a=!0,i=t},f:function(){try{u||null==r.return||r.return()}finally{if(a)throw i}}}}function O(t,n){(null==n||n>t.length)&&(n=t.length);for(var r=0,e=new Array(n);r<n;r++)e[r]=t[r];return e}var j=function t(n,r){var e,o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(b.null(n))return null;if("scale"!==r||o||b.object(n)||(n={x:n,y:n}),b.object(n)){var u,a=Object.keys(n),l=w(c);try{for(l.s();!(u=l.n()).done;){var s=u.value;if(y(n,s)){a=s;break}}}catch(t){l.e(t)}finally{l.f()}n=x({},n);var p,d=w(a);try{for(d.s();!(p=d.n()).done;){var h=p.value,g=r in f?f[r][h]:f[h];n[h]=h in n?t(n[h],r,!0):g}}catch(t){d.e(t)}finally{d.f()}return n}if(b.string(n)){if(b.hex(n))return S(n);if(b.rgb(n))return P(n);var v=k(n),m=i.default(v,2);n=m[0],"%"==(e=m[1])&&(n/=100)}return[n,e=b.number(n)?M.normalize(e,r):null]},S=function(t){var n=t.match(/^#([\da-f]{1,2})([\da-f]{1,2})([\da-f]{1,2})([\da-f]{2})?/i),r=i.default(n,5);r[0];var e=r[1],o=r[2],u=r[3],a=r[4],l=function(t){return[b.null(t)?255:parseInt(t.padStart(2,t),16),null]};return{r:l(e),g:l(o),b:l(u),a:l(a)}},P=function(t){var n=t.match(/^rgba?\((\d+)\D+(\d+)\D+(\d+)\D*(\d+)?\)/i),r=i.default(n,5);r[0];var e=r[1],o=r[2],u=r[3],a=r[4],l=function(t){return[b.null(t)?255:parseInt(t),null]};return{r:l(e),g:l(o),b:l(u),a:l(a)}},A=function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Object.keys(t);return r.map((function(n){return I(t[n])})).join(n)},k=function(t){var n=t.toString().match(/^([\d.]+)([^\d.]*)$/i);return n?[parseFloat(n[1]),n[2]||null]:[t,null]},I=function(t){return("%"==t[1]?100*t[0]:t[0])+(b.null(t[1])?"":t[1])},M={emtopx:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.body;return t*parseFloat(getComputedStyle(n).fontSize)},remtopx:function(t){return M.emtopx(t)},vwtopx:function(t){return t*window.innerWidth},vhtopx:function(t){return t*window.innerHeight},vmintopx:function(t){return t*Math.min(window.innerWidth,window.innerHeight)},vmaxtopx:function(t){return t*Math.max(window.innerWidth,window.innerHeight)},radtodeg:function(t){return 180*t/Math.PI},fromProperty:function(t){return t in l?l[t]:l.default},toBase:function(t,n,r){if(b.object(t)){var e={};for(var o in t)e[o]=M.toBase(t[o],n);return e}if(!b.number(t[0]))return t;var i=M.fromProperty(n);if(b.null(t[1])&&!b.null(i))return[t[0],i];var u=M["".concat(t[1],"to").concat(i)];return u?[u(t[0],r),i]:t},normalize:function(t,n){return a.includes(t)||b.null(t)&&n in l?t:M.fromProperty(n)}},C=function(t){return"inset(".concat(A(t," ",["top","right","bottom","left"]),")")},T={origin:["transformOrigin"],length:["strokeDashoffset"],clip:["clipPath","webkitClipPath"],transformOrigin:function(t){return"".concat(100*t.x,"% ").concat(100*t.y,"%")},strokeDashoffset:function(t){return 1-t[0]},clipPath:C,webkitClipPath:C},D={bind:function(t,n){t.origin=t.origin||t;var r=function(){for(var r,e=arguments.length,o=new Array(e),i=0;i<e;i++)o[i]=arguments[i];return(r=t.origin).call.apply(r,[n].concat(o))};return r.origin=t.origin,r},create:function(t){var n=D.bind((function(t){if(b.function(t)){var r=D.bind(n,{transform:t});return r.set=n.set,r.internal=n.internal,r}return this.transform(n.internal.value)}),{transform:function(t){return t}});return n.set=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;n.internal.value=t,n.internal.duration=r,n.internal.t=null},n.internal={value:t,duration:0},n},isInstance:function(t){return b.function(t)&&b.function(t.set)}},E=D;exports.Alias=T,exports.DEFAULT_OBJECTS=f,exports.Link=E,exports.MERGE_FUNCTIONS=p,exports.MORPH_PROPERTIES=s,exports.POSITIONS=["set","start","end"],exports.Units=M,exports.arrToStyle=I,exports.convert=j,exports.getProperty=function(t,n){var r=getComputedStyle(t),e=g(r.transform);if(n in e)return j(e[n],n);var o=r[n];return b.rgb(o)?P(o):k(o)},exports.getSnapshot=function(t){var n,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],e=getComputedStyle(t),o=t.getBoundingClientRect(),i=o.x,u=o.y,a=o.width,l=o.height,c=(r?t.parentElement:document.body).getBoundingClientRect(),f={layout:{x:i=(i-c.x+a/2)/c.width,y:u=(u-c.y+l/2)/c.height,width:a,height:l,parentWidth:c.width,parentHeight:c.height}},p=d(s);try{for(p.s();!(n=p.n()).done;){var h=n.value;f[h]=e[h]}}catch(t){p.e(t)}finally{p.f()}return Object.assign(f,g(e.transform)),f},exports.hasSomeKey=y,exports.inViewport=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=t.y,e=t.bottom,o=e-r;return{left:r>window.innerHeight+o*n,entered:r+o*n<window.innerHeight}},exports.is=b,exports.isVisible=function(t){var n=t.getBoundingClientRect(),r=n.x,e=n.y,o=n.right,i=n.bottom;return!(o-r<1||i-e<1)&&(e<window.innerHeight&&i>0&&r<window.innerWidth&&o>0)},exports.merge=v,exports.mergeObjects=function(t,n){var r,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Object.keys(n),o=d(e);try{for(o.s();!(r=o.n()).done;){var i=r.value;b.null(n[i])||(t[i]=n[i])}}catch(t){o.e(t)}finally{o.f()}return t},exports.mergeProperties=function(t,n){for(var r in n){var e=p[r]||p.default;t[r]=r in t?v(t[r],n[r],e):n[r]}},exports.objToStr=A,exports.originToStr=function(t){var n=b.object(t)?t:{},r=n.x,e=void 0===r?.5:r,o=n.y,i=void 0===o?.5:o;if(b.string(t))switch(t){case"left":e=0;break;case"right":e=1;break;case"top":i=0;break;case"bottom":i=1}return{x:e,y:i}},exports.padArray=function(t,n){return new Array(n).fill(0).map((function(n,r){return r<t.length?t[r]:t[t.length-1]}))},exports.subArray=function(t,n){return t.filter((function(t){return!n.includes(t)}))},exports.throttle=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250;return function(){var r=Date.now();t.LivelyTimestamp-r<n||(t.LivelyTimestamp=r,t())}},exports.xor=function(t,n){return t&&!n||!t&&n};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/objectWithoutProperties"),r=require("./animation-
|
|
1
|
+
"use strict";var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/objectWithoutProperties"),r=require("./animation-ca5a8d1c.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=n(e),c=n(t),i=["direction"];function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function p(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){o.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var u=r.Animation.create((function(e){var t=e.direction,r=void 0===t?"up":t,n=c.default(e,i),o="0px",a="20px";switch(r){case"down":a="-20px";break;case"left":o="20px",a="0px";break;case"right":o="-20px",a="0px"}return[p({translate:{x:0,y:0},opacity:1,duration:.5},n),{translate:{x:o,y:a},opacity:0}]}));function s(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?s(Object(r),!0).forEach((function(t){o.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):s(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var f=r.Animation.create((function(e){return[b({opacity:1,scale:1,duration:.25},e),{opacity:0,scale:.85}]}));exports.Move=u,exports.Pop=f;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("react"),r=require("./link-
|
|
1
|
+
"use strict";var e=require("react"),r=require("./link-964db6c5.js"),n=require("./events-d4e828a9.js");exports.useScroll=function(){var t=r.Link.create(0);return e.useEffect((function(){var e=function(){return t.set(window.scrollY)};return e(),n.addEventListener("scroll",e),function(){return n.removeEventListener("scroll",e)}}),[]),t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"@babel/runtime/helpers/classCallCheck";import e from"@babel/runtime/helpers/createClass";import r from"@babel/runtime/helpers/inherits";import n from"@babel/runtime/helpers/possibleConstructorReturn";import i from"@babel/runtime/helpers/getPrototypeOf";import o from"@babel/runtime/helpers/defineProperty";import{Children as a,isValidElement as s,cloneElement as l,Component as c}from"react";import{A as u,C as h}from"./animation-2ca8d322.js";import{g as f,D as p,m as y,i as m,a as v,o as d,b as g,A as b,M as w,t as k,c as O,d as j}from"./link-fda65080.js";import{a as A,o as x,r as S,b as P}from"./events-ac24ef8f.js";function I(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return D(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return D(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function D(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var E=function(){function r(){t(this,r),this.t=Date.now(),this.managers=[],this.step()}return e(r,[{key:"step",value:function(){var t,e=Date.now(),r=I(this.managers);try{for(r.s();!(t=r.n()).done;){t.value.step((e-this.t)/1e3)}}catch(t){r.e(t)}finally{r.f()}this.t=e,requestAnimationFrame(this.step.bind(this))}},{key:"add",value:function(t){var e=this.managers.findIndex((function(e){return e.priority>=t.priority}));this.managers.splice(e<0?0:e,0,t)}},{key:"remove",value:function(t){this.managers.splice(this.managers.indexOf(t),1)}}],[{key:"get",value:function(){return window.Lively||(window.Lively=new r),window.Lively}}]),r}();function M(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return L(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return L(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function L(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var R=function(){function r(e,n,i){t(this,r),this.element=e,this.tracks=[],this.queue=[],this.playing=!0,this.culling=n,this.layout=i,this.transforms=["translate","scale","skew","rotate"]}return e(r,[{key:"purge",value:function(){if(!("cache"in this.element)){this.element.cache={strokeDasharray:1,borderRadius:f(this.element,"borderRadius")};for(var t=0;t<this.element.style.length;t++){var e=this.element.style[t];this.element.cache[e]=this.element.style[e]}}for(var r in this.element.style={},this.element.cache)this.element.style[r]=this.element.cache[r]}},{key:"clear",value:function(){this.tracks=[],this.queue=[]}},{key:"add",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.immediate,n=void 0!==r&&r,i=e.composite,o=void 0===i||i;n&&this.clear(),o||!this.tracks.length?this.tracks.push(t):this.queue.push(t)}},{key:"remove",value:function(t){this.tracks.splice(this.tracks.indexOf(t),1),!this.tracks.length&&this.queue.length&&this.tracks.push(this.queue.shift())}},{key:"step",value:function(t){if(this.playing){for(var e=this.element.correction?{scale:p.scale}:{},r=this.tracks.length+ +!this.channel.isEmpty,n=0;n<r;n++){var i=this.tracks[n]||this.channel;y(e,i.get(this.element,this.culling)),i.step(t)&&this.remove(i)}this.apply(this.element,e)}}},{key:"apply",value:function(t,e){if(!m.empty(e)){var r=[];for(var n in e){var i=e[n];if("scale"==n){if(this.layout){var o,a={x:[1/i.x[0],i.x[1]],y:[1/i.y[0],i.y[1]]},s=M(t.children);try{for(s.s();!(o=s.n()).done;){o.value.correction=a}}catch(t){s.e(t)}finally{s.f()}var l=e.borderRadius||t.cache.borderRadius;delete e.borderRadius,t.style.borderRadius="".concat(l[0]/i.x[0]).concat(l[1]," / ").concat(l[0]/i.y[0]).concat(l[1])}t.correction&&(i=v(i,t.correction,w.scale))}var c=this.transforms.indexOf(n);if(c>=0)r[c]="".concat(n,"(").concat(m.object(i)?d(i,", ",["x","y"]):g(i),")");else{var u,h=M(b[n]||[n]);try{for(h.s();!(u=h.n()).done;){var f=u.value;m.color(i)?t.style[f]="rgba(".concat(i.r[0],", ").concat(i.g[0],", ").concat(i.b[0],", ").concat(i.a[0],")"):t.style[f]=f in b?b[f](i):g(i)}}catch(t){h.e(t)}finally{h.f()}}}(r=r.filter((function(t){return!!t}))).length&&(t.style.transform=r.join(" "))}}},{key:"initialize",value:function(t){this.apply(this.element,t.initials),this.channel=t.channel}}]),r}();function C(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function V(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?C(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):C(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function B(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return U(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return U(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function U(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var T=function(){function r(e){var n=e.priority,i=void 0===n?0:n,o=e.stagger,a=void 0===o?.1:o,s=e.culling,l=void 0===s||s,c=e.noDeform,u=void 0!==c&&c,h=e.paused,f=void 0!==h&&h;t(this,r),this.targets=[],this.priority=i,this.stagger=a,this.culling=l,this.noDeform=u,this.paused=f}return e(r,[{key:"register",value:function(){E.get().add(this)}},{key:"destroy",value:function(){this.targets=[],E.get().remove(this)}},{key:"purge",value:function(){var t,e=B(this.targets);try{for(e.s();!(t=e.n()).done;){t.value.purge()}}catch(t){e.e(t)}finally{e.f()}}},{key:"clear",value:function(){var t,e=B(this.targets);try{for(e.s();!(t=e.n()).done;){t.value.clear()}}catch(t){e.e(t)}finally{e.f()}}},{key:"set",value:function(t){var e=this;this.targets=t.map((function(t){return new R(t,e.culling,e.noDeform)}))}},{key:"play",value:function(t,e){if(!t.isEmpty)for(var r=0;r<this.targets.length;r++){var n=V(V({},e),{},{delay:(e.delay||0)+r*this.stagger});this.targets[r].add(t.play(n),n)}}},{key:"initialize",value:function(t){var e,r=B(this.targets);try{for(r.s();!(e=r.n()).done;){e.value.initialize(t)}}catch(t){r.e(t)}finally{r.f()}}},{key:"step",value:function(t){if(!this.paused){var e,r=B(this.targets);try{for(r.s();!(e=r.n()).done;){e.value.step(t)}}catch(t){r.e(t)}finally{r.f()}}}}]),r}();function q(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function z(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?q(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):q(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function $(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return F(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return F(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function F(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function H(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,o=i(t);if(e){var a=i(this).constructor;r=Reflect.construct(o,arguments,a)}else r=o.apply(this,arguments);return n(this,r)}}var N=function(n){r(o,c);var i=H(o);function o(e){var r;for(var n in t(this,o),(r=i.call(this,e)).animations={default:r.parse(r.props.animate||{})},r.props.animations||{})r.animations[n]=r.parse(r.props.animations[n]);return r.children=[],r.elements=[],r.stagger=r.props.stagger||.1,r.manager=new T({priority:r.props.group,stagger:r.stagger,culling:r.props.lazy,noDeform:r.props.noDeform,paused:r.props.paused}),r}return e(o,[{key:"parse",value:function(t){return u.isInstance(t)?t.use():m.object(t)?new h(t,this.props.initial):null}},{key:"update",value:function(){this.manager.clear(),this.manager.purge(),this.manager.initialize(this.animations.default)}},{key:"componentDidMount",value:function(){var t=this;this.scrollEventListener=k(this.onScroll.bind(this)),A("scroll",this.scrollEventListener),this.eventListener=this.onEvent.bind(this),x(o.events,this.elements,this.eventListener),this.manager.set(this.elements),this.manager.register(),this.update(),document.fonts.ready.then((function(){t.update(),clearTimeout(t.timeout),t.inViewport=!1,t.props.group||(t.play(t.props.onMount),t.onScroll())}))}},{key:"componentWillUnmount",value:function(){S("scroll",this.scrollEventListener),P(o.events,this.elements,this.eventListener),this.manager.destroy()}},{key:"componentDidUpdate",value:function(){this.manager.paused=this.props.paused;var t,e=$(this.children);try{for(e.s();!(t=e.n()).done;){t.value.manager.paused=this.props.paused}}catch(t){e.e(t)}finally{e.f()}}},{key:"dispatch",value:function(t){m.function(this.props[t])&&this.props[t]()}},{key:"onEvent",value:function(t){switch(t.type){case"click":this.play(this.props.onClick);break;case"mouseenter":this.hover||(this.hover=!0,this.play(this.props.whileHover));break;case"mouseleave":this.hover&&(this.hover=!1,this.play(this.props.whileHover,{reverse:!0}));break;case"focus":this.focus||(this.focus=!0,this.play(this.props.whileFocus));break;case"blur":this.focus&&(this.focus=!1,this.play(this.props.whileFocus,{reverse:!0}))}}},{key:"getBoundingBox",value:function(){var t,e={x:Number.MAX_VALUE,y:Number.MAX_VALUE,right:0,bottom:0},r=$(this.elements.length?this.elements:this.children);try{for(r.s();!(t=r.n()).done;){var n=t.value,i=this.elements.length?n.getBoundingClientRect():n.getBoundingBox();e.y=Math.min(i.y,e.y),e.x=Math.min(i.x,e.x),e.right=Math.max(i.right,e.right),e.bottom=Math.max(i.bottom,e.bottom)}}catch(t){r.e(t)}finally{r.f()}return e}},{key:"onScroll",value:function(){if(this.props.whileViewport){var t=O(this.getBoundingBox(),this.props.viewportMargin),e=t.entered,r=t.left;e&&!this.inViewport&&(this.inViewport=!0,this.play(this.props.whileViewport),this.dispatch("onEnterViewport")),r&&this.inViewport&&(this.inViewport=!1,this.play(this.props.whileViewport,{reverse:!0,immediate:!0}),this.dispatch("onLeaveViewport"))}}},{key:"play",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.reverse,i=void 0!==n&&n,o=r.composite,a=void 0!==o&&o,s=r.immediate,l=void 0!==s&&s,c=r.delay,u=void 0===c?0:c,h=r.callback,f=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!(!t||this.props.disabled||this.props.group>0&&!f)){m.string(t)||(t="default"),this.dispatch("onAnimationStart");var p,y=this.animations[t],v=y.length(),d=0,g=$(this.children);try{for(g.s();!(p=g.n()).done;){var b=p.value;d=Math.max(d,b.play(t,{reverse:i,immediate:l,delay:u+v},!0))}}catch(t){g.e(t)}finally{g.f()}return this.manager.play(y,{reverse:i,composite:a,immediate:l,delay:i?d:u}),l&&clearTimeout(this.timeout),this.props.group||(this.timeout=setTimeout((function(){e.dispatch("onAnimationEnd"),m.function(h)&&h()}),1e3*(d+v))),v+(i?d:u)}}},{key:"stop",value:function(){this.manager.clear()}},{key:"prerender",value:function(t){var e=this,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return a.map(t,(function(t){if(!s(t))return t;var i={pathLength:1},a=e.elementIndex++;if(r&&(i.ref=function(t){return e.elements[a]=t}),o.isInstance(t)&&n&&!t.props.noCascade){var c=e.childIndex++;n=!1,i.group=e.props.group+1,i.ref=function(t){return e.children[c]=t},e.props.group||(i.active=e.props.active),j(i,z(z({},e.props),t.props),e.constructor.cascadingProps)}return l(t,i,e.prerender(t.props.children,!1,n))}))}},{key:"render",value:function(){return this.elementIndex=this.childIndex=0,this.prerender(this.props.children)}}],[{key:"isInstance",value:function(t){return t.type===o||t.type.prototype instanceof o}}]),o}();o(N,"events",["click","mouseenter","mouseleave","focus","blur"]),o(N,"cascadingProps",["animate","initial","animations","stagger"]),o(N,"defaultProps",{group:0,viewportMargin:.75,lazy:!0,paused:!1});export{N as A};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"@babel/runtime/helpers/slicedToArray";import e from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/objectWithoutProperties";import n from"@babel/runtime/helpers/classCallCheck";import i from"@babel/runtime/helpers/createClass";import a from"@babel/runtime/helpers/inherits";import o from"@babel/runtime/helpers/possibleConstructorReturn";import u from"@babel/runtime/helpers/getPrototypeOf";import{i as s,e as l,U as c,g as f,f as h,x as p,h as y,d as v,j as d,L as m,P as b}from"./link-fda65080.js";function g(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return w(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return w(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function w(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var O=function t(e,r,n,i){if(s.object(e)){var a={};for(var o in e)a[o]=t(e[o],r[o],n,i);return a}return[i(e[0],r[0],n),e[1]]},j=function(t,e,r){return s.number(t)&&s.number(e)?t*(1-r)+e*r:r>.5?e:t},P=function(t,e,r){return j(t,e,(1-Math.cos(r*Math.PI))/2)},x=function(t,e,r){var n,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a={duration:i},o={},u=g(r);try{for(u.s();!(n=u.n()).done;){var s=n.value;"scale"==s?(a.scale={x:1,y:1},o.scale={x:1+(e.layout.width-t.layout.width)/t.layout.width,y:1+(e.layout.height-t.layout.height)/t.layout.height}):"translate"==s?(a.translate={x:0,y:0},o.translate={x:(e.layout.x-t.layout.x)*t.layout.parentWidth,y:(e.layout.y-t.layout.y)*t.layout.parentHeight}):(a[s]=t[s],o[s]=e[s])}}catch(t){u.e(t)}finally{u.f()}return new R(a,o)},A=Object.freeze({__proto__:null,interpolate:O,constant:function(t){return t},linear:j,ease:P,spring:function(t,e,r){return r=1-1*Math.exp(-3.6*r)*Math.cos(2.5*Math.pow(r,2)*Math.PI),j(t,e,r)},computeMorph:x}),k=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.reverse,a=void 0!==i&&i,o=r.repeat,u=void 0===o?1:o,s=r.delay,l=void 0===s?0:s,c=r.alternate,f=void 0!==c&&c;n(this,t),this.indices={},this.clip=e,this.t=0,this.T=e.duration*u+l,this.reverse=a,this.delay=l,this.alternate=f}return i(t,[{key:"getInterpolatedValue",value:function(t,e,r,n){if(s.function(e))e=l(e(r,this.clip.duration),t),e=c.toBase(e,t,n);else{t in this.indices||(this.indices[t]=this.reverse?e.length-1:0);var i,a=this.reverse?-1:1,o=this.indices[t],u=e[o],h=e[o+a],p=u.set;if(this.reverse?h.time>r:h.time<r){this.indices[t]=o+=a;var y=["start","end"],v=y[+!this.reverse],d=y[+this.reverse];v in u||d in h?(p=v in u?u[v]:h[d],i=!0):(u=e[o],h=e[o+a])}if(s.null(p)&&(p=f(n,t)),p=c.toBase(p,t,n),i)e=p;else{var m=s.null(h.set)?f(n,t):h.set;m=c.toBase(m,t,n);var b=A[h.interpolate||this.clip.interpolate]||P;e=O(p,m,(r-u.time)/(h.time-u.time),b)}}return e}},{key:"get",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r={},n=this.t>=this.T;if(this.t<this.delay||e&&!n&&!h(t))return r;var i=this.t-this.delay,a=this.clip.duration,o=this.alternate&&Math.floor(i/a)%2==+!n;for(var u in i=n?a:i%a,i=p(this.reverse,o)?a-i:i,r.origin=this.clip.origin,this.clip.properties)r[u]=this.getInterpolatedValue(u,this.clip.properties[u],i,t);return r}},{key:"step",value:function(t){var e=this.t>=this.T;return this.t+=t,e}}]),t}();function I(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=u(t);if(e){var i=u(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return o(this,r)}}var S=function(t){a(r,k);var e=I(r);function r(){var t;return n(this,r),(t=e.call(this,{duration:1/0,properties:{},origin:{x:.5,y:.5}})).isEmpty=!0,t.cache={},t}return i(r,[{key:"add",value:function(t,e){this.clip.properties[t]=e,this.isEmpty=!1}},{key:"getInterpolatedValue",value:function(t,e,r,n){s.null(e.internal.t)&&(e.internal.t=r),e.internal.t===r&&(this.cache[t]={});var i=e.internal.duration?Math.min((r-e.internal.t)/e.internal.duration,1):1,a=this.cache[t]||{};if(a.t===i)return a.value;var o=c.toBase(l(e(r,this.clip.duration),t),t,n),u=f(n,t);u=c.toBase(u,t,n);var h=O(u,o,i,j);return this.cache[t]={value:h,t:i},h}}]),r}(),M=["duration","delay","repeat","alternate","interpolate","origin"];function z(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return B(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return B(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function B(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function C(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function E(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?C(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):C(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var R=function(){function e(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=i.duration,o=void 0===a?1:a,u=i.delay,l=i.repeat,c=i.alternate,f=i.interpolate,h=i.origin,p=void 0===h?{x:.5,y:.5}:h,y=r(i,M),v=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n(this,e),this.duration=o,this.origin=d(p),this.channel=new S;var m=this.parse(y,v),b=t(m,2);this.properties=b[0],this.initials=b[1],this.isEmpty=s.empty(this.properties),this.interpolate=f,this.defaults={delay:u,repeat:l,alternate:c}}return i(e,[{key:"length",value:function(){return this.duration*(this.defaults.repeat||1)+(this.defaults.delay||0)}},{key:"parse",value:function(t,e){var r=this,n=function(n){var i=t[n];if(m.isInstance(i))return r.channel.add(n,i),delete t[n],"continue";if(s.function(i))return"continue";(i=s.array(i)?i:[i]).length<2?i.unshift(n in e?e[n]:null):s.null(i[0])||(e[n]=i[0]);for(var a=i.map((function(t){return r.sanitize(t,n)})),o=0;o<a.length;o++)r.quantize(a,o);t[n]=a};for(var i in t)n(i);for(var a in e=E({},e))e[a]=l(e[a],a);return[t,e]}},{key:"sanitize",value:function(t,e){s.object(t)||(t={set:t}),y(t,b)||(t={set:t}),"set"in t||(t.set="start"in t?t.start:t.end),"time"in t&&t.time>this.duration&&delete t.time,t=E({},t);var r,n=z(b);try{for(n.s();!(r=n.n()).done;){var i=r.value;i in t&&(t[i]=l(t[i],e))}}catch(t){n.e(t)}finally{n.f()}return t}},{key:"quantize",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e-1;if("time"in t[e])return t[e].time;if(0==e||e==t.length-1)return t[e].time=0==e?0:this.duration;var n=this.quantize(t,r,r);return t[e].time=n+(this.quantize(t,e+1,r)-n)*((e-r)/(e-r+1))}},{key:"play",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new k(this,v(t,this.defaults))}}]),e}(),T={create:function(e){var r=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.use=t.use.bind(t,e),t};return r.use=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e(r),i=t(n,2),a=i[0],o=i[1];return new R(a,o)},r},isInstance:function(t){return s.function(t)&&s.function(t.use)}};export{T as A,R as C,x as c};
|
package/dist/esm/animations.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as e}from"./animation-
|
|
1
|
+
import{A as e}from"./animation-2ca8d322.js";export{A as Animation}from"./animation-2ca8d322.js";import r from"@babel/runtime/helpers/defineProperty";export{M as Move,P as Pop}from"./pop-5d0c6406.js";import t from"@babel/runtime/helpers/objectWithoutProperties";import"@babel/runtime/helpers/slicedToArray";import"@babel/runtime/helpers/classCallCheck";import"@babel/runtime/helpers/createClass";import"@babel/runtime/helpers/inherits";import"@babel/runtime/helpers/possibleConstructorReturn";import"@babel/runtime/helpers/getPrototypeOf";import"./link-fda65080.js";import"@babel/runtime/helpers/typeof";function o(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){r(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}var i=e.create((function(e){return[n({opacity:1,duration:.65},e),{opacity:0}]})),c=["direction"];function p(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function a(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?p(Object(o),!0).forEach((function(t){r(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):p(Object(o)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))}))}return e}var s=e.create((function(e){var r=e.direction,o=void 0===r?"right":r,n=t(e,c),i=0,p=1,s={x:0,y:.5};switch(o){case"left":s.x=1;break;case"up":i=1,p=0,s={x:0,y:1};break;case"down":i=1,p=0,s={x:0,y:0}}return[a({scale:{x:1},origin:s,duration:.6},n),{scale:{x:i,y:p}}]})),b=["direction"];function l(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function u(e){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?l(Object(o),!0).forEach((function(t){r(e,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):l(Object(o)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(o,r))}))}return e}var O=e.create((function(e){var o=e.direction,n=void 0===o?"right":o,i=t(e,b);return["left","right","top","bottom"].includes(n)||(n="right"),[u({clip:r({},n,0)},i),{clip:r({},n,1)}]}));export{i as Fade,s as Scale,O as Wipe};
|
package/dist/esm/auto.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import t from"@babel/runtime/helpers/classCallCheck";import e from"@babel/runtime/helpers/createClass";import r from"@babel/runtime/helpers/get";import n from"@babel/runtime/helpers/inherits";import i from"@babel/runtime/helpers/possibleConstructorReturn";import o from"@babel/runtime/helpers/getPrototypeOf";import a from"@babel/runtime/helpers/defineProperty";import{A as l}from"./animatable-87fd0b01.js";import u,{isValidElement as s,Children as c,cloneElement as p,Component as f,useRef as h}from"react";import{s as m,k as d,i as y,l as v}from"./link-fda65080.js";import{C as b,c as g}from"./animation-2ca8d322.js";import O from"@babel/runtime/helpers/toConsumableArray";import{u as w}from"./scroll-b155427a.js";import"./events-ac24ef8f.js";import"@babel/runtime/helpers/typeof";import"@babel/runtime/helpers/slicedToArray";import"@babel/runtime/helpers/objectWithoutProperties";function j(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function P(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?j(Object(r),!0).forEach((function(e){a(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function k(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return E(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return E(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){l=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw o}}}}function E(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function x(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=o(t);if(e){var a=o(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return i(this,r)}}var R={},A=function(i){n(u,l);var a=x(u);function u(e){var r;return t(this,u),(r=a.call(this,e)).animations={default:new b({},{opacity:+e.active,pointerEvents:e.active?"":"none"}),unmorph:new b({},{opacity:0,pointerEvents:"none"})},r.properties=m(r.props.include,r.props.exclude),r.uuid=(e.id||0)+e.group.toString(),r}return e(u,[{key:"shouldComponentUpdate",value:function(t){return this.props.active!==t.active&&(this.uuid in R?R[this.uuid].push(this):R[this.uuid]=[this]),this.props.active!==t.active}},{key:"getSnapshotBeforeUpdate",value:function(t){if(this.props.active!==t.active&&this.props.active){var e,r=k(R[this.uuid]);try{for(r.s();!(e=r.n()).done;){var n=e.value;if(n!==this)return d(n.elements[0],this.props.group)}}catch(t){r.e(t)}finally{r.f()}}return null}},{key:"componentDidUpdate",value:function(t,e,n){if(r(o(u.prototype),"componentDidUpdate",this).call(this),R[this.uuid]=[],n){var i=d(this.elements[0],this.props.group);i.opacity=1,i.pointerEvents="",this.manager.play(g(i,n,this.properties,this.props.duration),{composite:!0})}else this.manager.initialize(this.animations.unmorph)}},{key:"render",value:function(){var t=this.props.children;if(y.array(t)){if(t.length>1)return t;t=t[0]}return s(t)?r(o(u.prototype),"render",this).call(this):t}}]),u}();function C(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=o(t);if(e){var a=o(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return i(this,r)}}a(A,"cascadingProps",["id","duration"]),a(A,"defaultProps",P(P({},l.defaultProps),{},{active:!1,include:v,exclude:[]}));var S=function(r){n(o,f);var i=C(o);function o(e){var r;return t(this,o),(r=i.call(this,e)).children=[],r.properties=m(r.props.include,r.props.exclude),r}return e(o,[{key:"getSnapshotBeforeUpdate",value:function(){return this.children.map((function(t){var e=null==t?void 0:t.elements[0];return e?{data:d(e),key:t.props.layoutKey}:null}))}},{key:"componentDidUpdate",value:function(t,e,r){for(var n=0,i=0;n<r.length;n++,i++){var o=this.children[i];if(o&&o.elements[0]){var a=r[n];if(a&&o.props.layoutKey===a.key){var l=d(o.elements[0]);o.manager.play(g(l,a.data,this.properties,this.props.duration),{composite:!0})}else i--}}}},{key:"render",value:function(){var t=this;return this.childIndex=0,c.map(this.props.children,(function(e){if(!s(e)||!l.isInstance(e))return e;var r=t.childIndex++;return p(e,{ref:function(e){return t.children[r]=e},layoutKey:e.key})}))}}]),o}();function B(t){var e=t.children,r=t.className,n=t.style,i=t.duration;if(!y.string(e))return e;var o=e.split("");return u.createElement("div",{className:r,style:n},u.createElement(l,{whileViewport:!0,animate:{opacity:1,translate:{y:0},rotate:0,duration:.8},initial:{opacity:0,translate:{y:"100%"},rotate:10},stagger:(i-.8)/(o.length-1)},o.map((function(t,e){return u.createElement("span",{style:{display:"inline-block"},key:e},/\s/.test(t)?" ":t)}))))}function D(t){var e,r=t.children,n=t.color,i=t.duration,o=(null===(e=r.props)||void 0===e?void 0:e.children)||[];Array.isArray(o)||(o=[o]);var a=[u.createElement(l,{key:0,initial:{clip:{right:0}},animate:{clip:{left:1},duration:i/2}},u.createElement("div",{style:{position:"absolute",inset:0,backgroundColor:n}}))].concat(O(o));return u.createElement(l,{whileViewport:!0,animate:{clip:{right:0},duration:i/2},initial:{clip:{right:1}}},p(r,{},a))}function U(t){var e,r=t.children,n=t.amount,i=w(),o=h();return u.createElement(l,{ref:o,animate:{translate:i((function(t){if(void 0===e){var r,i=null===(r=o.current)||void 0===r?void 0:r.elements[0];i&&(e=Math.max(i.getBoundingClientRect().y+window.scrollY-window.innerHeight/2,0))}return{x:0,y:(t-(e||0))*n}}))}},r)}a(S,"defaultProps",{include:v,exclude:[]}),B.defaultProps={style:{},className:"",duration:1.6},D.defaultProps={color:"grey",duration:1.6},U.defaultProps={amount:.5};export{D as ColorWipe,S as LayoutGroup,A as Morph,U as Parallax,B as WriteOn};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as n}from"./link-
|
|
1
|
+
import{i as n}from"./link-fda65080.js";function r(n,r){var e="undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(!e){if(Array.isArray(n)||(e=function(n,r){if(!n)return;if("string"==typeof n)return t(n,r);var e=Object.prototype.toString.call(n).slice(8,-1);"Object"===e&&n.constructor&&(e=n.constructor.name);if("Map"===e||"Set"===e)return Array.from(n);if("Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e))return t(n,r)}(n))||r&&n&&"number"==typeof n.length){e&&(n=e);var o=0,a=function(){};return{s:a,n:function(){return o>=n.length?{done:!0}:{done:!1,value:n[o++]}},e:function(n){throw n},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,u=!0,f=!1;return{s:function(){e=e.call(n)},n:function(){var n=e.next();return u=n.done,n},e:function(n){f=!0,i=n},f:function(){try{u||null==e.return||e.return()}finally{if(f)throw i}}}}function t(n,r){(null==r||r>n.length)&&(r=n.length);for(var t=0,e=new Array(r);t<r;t++)e[t]=n[t];return e}var e={},o=function(r,t){r in e||(e[r]={unique:0},window.addEventListener(r,(function(t){for(var o=0,a=Object.values(e[r]);o<a.length;o++){var i=a[o];n.function(i)&&i(t)}})));var o=e[r];t.LivelyID=o.unique,o[o.unique++]=t},a=function(r,t){!n.null(window)&&r in e&&!n.null(t)&&"LivelyID"in t&&delete e[r][t.LivelyID]},i=function(n,t,e){var o,a=r(n);try{for(a.s();!(o=a.n()).done;){var i,u=o.value,f=r(t);try{for(f.s();!(i=f.n()).done;){i.value.addEventListener(u,e)}}catch(n){f.e(n)}finally{f.f()}}}catch(n){a.e(n)}finally{a.f()}},u=function(n,t,e){var o,a=r(n);try{for(a.s();!(o=a.n()).done;){var i,u=o.value,f=r(t);try{for(f.s();!(i=f.n()).done;){i.value.removeEventListener(u,e)}}catch(n){f.e(n)}finally{f.f()}}}catch(n){a.e(n)}finally{a.f()}};export{o as a,u as b,i as o,a as r};
|
package/dist/esm/hooks.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import r from"@babel/runtime/helpers/slicedToArray";import{useState as e,useRef as t,useCallback as n,useEffect as o}from"react";import{L as i}from"./link-fda65080.js";export{u as useScroll}from"./scroll-b155427a.js";import"@babel/runtime/helpers/typeof";import"@babel/runtime/helpers/defineProperty";import"./events-ac24ef8f.js";function c(n){var o=e(n),u=r(o,2),i=u[0],c=u[1],a=t();return[i,function(){if(!i)return c(!0);a.current.play(a.current.props.onUnmount,{reverse:!0,immediate:!0,callback:function(){return c(!1)}})},a]}function a(r){var e=i.create(r);return[e,e.set]}function f(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=t(),u=n((function(t,n){if(!o.current)return{x:0,y:0};var u=o.current.getTotalLength()*t/n,i=o.current.getPointAtLength(u),c=i.x,a=i.y;return{x:r[0]+c*e,y:r[1]+a*e}}),[o]);return[u,o]}function m(){var t=e(!1),n=r(t,2),u=n[0],i=n[1],c=function(r){return i(r.matches)};return o((function(){var r=matchMedia("(prefers-reduced-motion: reduce)");return r.addEventListener("change",c),i(r.matches),function(){return r.removeEventListener("change",c)}}),[]),u}export{a as useLink,f as usePath,m as useReducedMotion,c as useUnmount};
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as e}from"./animatable-
|
|
1
|
+
import{A as e}from"./animatable-87fd0b01.js";export{A as Animatable}from"./animatable-87fd0b01.js";import t from"@babel/runtime/helpers/extends";import r from"@babel/runtime/helpers/objectWithoutProperties";import n from"@babel/runtime/helpers/classCallCheck";import o from"@babel/runtime/helpers/createClass";import i from"@babel/runtime/helpers/inherits";import a from"@babel/runtime/helpers/possibleConstructorReturn";import l from"@babel/runtime/helpers/getPrototypeOf";import s from"@babel/runtime/helpers/defineProperty";import p,{Children as c,isValidElement as m,cloneElement as u,Component as f}from"react";import{M as b,P as h}from"./pop-5d0c6406.js";import{p as v}from"./link-fda65080.js";import"./animation-2ca8d322.js";import"@babel/runtime/helpers/slicedToArray";import"./events-ac24ef8f.js";import"@babel/runtime/helpers/typeof";var y=["levels","animations"];function d(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function O(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?d(Object(r),!0).forEach((function(t){s(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):d(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function j(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(t){var o=l(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return a(this,r)}}var P=function(a){i(s,f);var l=j(s);function s(e){var t;return n(this,s),(t=l.call(this,e)).levels=t.props.levels,t.animations=v(t.props.animations,t.levels),t}return o(s,[{key:"makeAnimatable",value:function(n){var o=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(i<1||c.count(n)<1)return n;var a=this.props;a.levels,a.animations;var l=r(a,y),s=this.animations[this.levels-i];return i===this.levels&&(l.ref=function(e){return o.animatable=e}),p.createElement(e,t({},l,{animate:s}),c.map(n,(function(e){return m(e)?u(e,{},o.makeAnimatable(e.props.children,i-1)):e})))}},{key:"play",value:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};null===(t=this.animatable)||void 0===t||t.play(e,O({},r))}},{key:"render",value:function(){return this.makeAnimatable(this.props.children,this.levels)}}]),s}();s(P,"defaultProps",{levels:1,animations:[b,h]});export{P as Animate};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import n from"@babel/runtime/helpers/typeof";import t from"@babel/runtime/helpers/slicedToArray";import r from"@babel/runtime/helpers/defineProperty";var e=["set","start","end"],o=["%","px","em","rem","vw","vh","vmin","vmax","deg","rad"],i={rotate:"deg",skew:"deg",scale:"%",clip:"%",opacity:null,zIndex:null,lineHeight:null,fontWeight:null,length:null,default:"px"},a=[["x","y"],["r","g","b","a"],["left","top","right","bottom"]],u={translate:{x:[0,"px"],y:[0,"px"]},scale:{x:[1,"%"],y:[1,"%"]},clip:{left:[0,"%"],top:[0,"%"],right:[0,"%"],bottom:[0,"%"]},r:[127,null],g:[127,null],b:[127,null],a:[255,null]},c=["translate","scale","rotate","opacity","borderRadius","backgroundColor","color","zIndex","pointerEvents"],l={translate:function(n,t){return n+t},rotate:function(n,t){return n+t},scale:function(n,t){return n*t},default:function(n,t){return(n+t)/2}};function f(n,t){var r="undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(!r){if(Array.isArray(n)||(r=function(n,t){if(!n)return;if("string"==typeof n)return s(n,t);var r=Object.prototype.toString.call(n).slice(8,-1);"Object"===r&&n.constructor&&(r=n.constructor.name);if("Map"===r||"Set"===r)return Array.from(n);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return s(n,t)}(n))||t&&n&&"number"==typeof n.length){r&&(n=r);var e=0,o=function(){};return{s:o,n:function(){return e>=n.length?{done:!0}:{done:!1,value:n[e++]}},e:function(n){throw n},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(n)},n:function(){var n=r.next();return a=n.done,n},e:function(n){u=!0,i=n},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function s(n,t){(null==t||t>n.length)&&(t=n.length);for(var r=0,e=new Array(t);r<t;r++)e[r]=n[r];return e}var d=function(n,t){return n&&!t||!n&&t},h=function(n,t){return Object.keys(n).some((function(n){return t.includes(n)}))},y=function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=n.y,e=n.bottom,o=e-r;return{left:r>window.innerHeight+o*t,entered:r+o*t<window.innerHeight}},b=function(n){var t=n.getBoundingClientRect(),r=t.x,e=t.y,o=t.right,i=t.bottom;return!(o-r<1||i-e<1)&&(e<window.innerHeight&&i>0&&r<window.innerWidth&&o>0)},g={null:function(n){return null==n},array:function(n){return Array.isArray(n)},object:function(t){return!g.null(t)&&"object"===n(t)&&!g.array(t)},function:function(n){return n instanceof Function},string:function(n){return"string"==typeof n},bool:function(n){return"boolean"==typeof n},number:function(n){return"number"==typeof n},empty:function(n){return function(n,t){return Object.keys(n).length===t}(n,0)},rgb:function(n){return n.match(/^rgba?\(.*\)$/i)},hex:function(n){return n.match(/^#[0-9a-f]{3,8}$/i)},color:function(n){return g.object(n)&&"r"in n}},p=function(n){var t=new DOMMatrix(n),r=Math.sqrt(t.a*t.a+t.b*t.b)*Math.sign(t.a),e=Math.sqrt(t.c*t.c+t.d*t.d)*Math.sign(t.d),o=180*Math.atan2(t.d,t.c)/Math.PI-90,i=180*Math.atan2(t.b,t.a)/Math.PI;return{translate:{x:t.e,y:t.f},scale:{x:r,y:e},rotate:i,skew:{x:o,y:0}}},v=function(n,t){var r=getComputedStyle(n),e=p(r.transform);if(t in e)return D(e[t],t);var o=r[t];return g.rgb(o)?H(o):z(o)},m=function(n){var t,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],e=getComputedStyle(n),o=n.getBoundingClientRect(),i=o.x,a=o.y,u=o.width,l=o.height,s=(r?n.parentElement:document.body).getBoundingClientRect(),d={layout:{x:i=(i-s.x+u/2)/s.width,y:a=(a-s.y+l/2)/s.height,width:u,height:l,parentWidth:s.width,parentHeight:s.height}},h=f(c);try{for(h.s();!(t=h.n()).done;){var y=t.value;d[y]=e[y]}}catch(n){h.e(n)}finally{h.f()}return Object.assign(d,p(e.transform)),d},w=function(n,t){return new Array(t).fill(0).map((function(t,r){return r<n.length?n[r]:n[n.length-1]}))},x=function(n,t){return n.filter((function(n){return!t.includes(n)}))},j=function(n,t){var r,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Object.keys(t),o=f(e);try{for(o.s();!(r=o.n()).done;){var i=r.value;g.null(t[i])||(n[i]=t[i])}}catch(n){o.e(n)}finally{o.f()}return n},O=function n(t,r,e){if(g.object(t)){var o={};for(var i in t)o[i]=n(t[i],r[i],e);return o}return g.number(t[0])&&g.number(r[0])?[e(t[0],r[0]),t[1]]:r},P=function(n,t){for(var r in t){var e=l[r]||l.default;n[r]=r in n?O(n[r],t[r],e):t[r]}},k=function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250;return function(){var r=Date.now();n.LivelyTimestamp-r<t||(n.LivelyTimestamp=r,n())}};function A(n,t){var r=Object.keys(n);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(n);t&&(e=e.filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),r.push.apply(r,e)}return r}function S(n){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?A(Object(e),!0).forEach((function(t){r(n,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):A(Object(e)).forEach((function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))}))}return n}function M(n,t){var r="undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(!r){if(Array.isArray(n)||(r=function(n,t){if(!n)return;if("string"==typeof n)return I(n,t);var r=Object.prototype.toString.call(n).slice(8,-1);"Object"===r&&n.constructor&&(r=n.constructor.name);if("Map"===r||"Set"===r)return Array.from(n);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return I(n,t)}(n))||t&&n&&"number"==typeof n.length){r&&(n=r);var e=0,o=function(){};return{s:o,n:function(){return e>=n.length?{done:!0}:{done:!1,value:n[e++]}},e:function(n){throw n},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(n)},n:function(){var n=r.next();return a=n.done,n},e:function(n){u=!0,i=n},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function I(n,t){(null==t||t>n.length)&&(t=n.length);for(var r=0,e=new Array(t);r<t;r++)e[r]=n[r];return e}var D=function n(r,e){var o,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(g.null(r))return null;if("scale"!==e||i||g.object(r)||(r={x:r,y:r}),g.object(r)){var c,l=Object.keys(r),f=M(a);try{for(f.s();!(c=f.n()).done;){var s=c.value;if(h(r,s)){l=s;break}}}catch(n){f.e(n)}finally{f.f()}r=S({},r);var d,y=M(l);try{for(y.s();!(d=y.n()).done;){var b=d.value,p=e in u?u[e][b]:u[b];r[b]=b in r?n(r[b],e,!0):p}}catch(n){y.e(n)}finally{y.f()}return r}if(g.string(r)){if(g.hex(r))return C(r);if(g.rgb(r))return H(r);var v=z(r),m=t(v,2);r=m[0],"%"==(o=m[1])&&(r/=100)}return[r,o=g.number(r)?T.normalize(o,e):null]},C=function(n){var r=n.match(/^#([\da-f]{1,2})([\da-f]{1,2})([\da-f]{1,2})([\da-f]{2})?/i),e=t(r,5);e[0];var o=e[1],i=e[2],a=e[3],u=e[4],c=function(n){return[g.null(n)?255:parseInt(n.padStart(2,n),16),null]};return{r:c(o),g:c(i),b:c(a),a:c(u)}},H=function(n){var r=n.match(/^rgba?\((\d+)\D+(\d+)\D+(\d+)\D*(\d+)?\)/i),e=t(r,5);e[0];var o=e[1],i=e[2],a=e[3],u=e[4],c=function(n){return[g.null(n)?255:parseInt(n),null]};return{r:c(o),g:c(i),b:c(a),a:c(u)}},E=function(n,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Object.keys(n);return r.map((function(t){return B(n[t])})).join(t)},W=function(n){var t=g.object(n)?n:{},r=t.x,e=void 0===r?.5:r,o=t.y,i=void 0===o?.5:o;if(g.string(n))switch(n){case"left":e=0;break;case"right":e=1;break;case"top":i=0;break;case"bottom":i=1}return{x:e,y:i}},z=function(n){var t=n.toString().match(/^([\d.]+)([^\d.]*)$/i);return t?[parseFloat(t[1]),t[2]||null]:[n,null]},B=function(n){return("%"==n[1]?100*n[0]:n[0])+(g.null(n[1])?"":n[1])},T={emtopx:function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.body;return n*parseFloat(getComputedStyle(t).fontSize)},remtopx:function(n){return T.emtopx(n)},vwtopx:function(n){return n*window.innerWidth},vhtopx:function(n){return n*window.innerHeight},vmintopx:function(n){return n*Math.min(window.innerWidth,window.innerHeight)},vmaxtopx:function(n){return n*Math.max(window.innerWidth,window.innerHeight)},radtodeg:function(n){return 180*n/Math.PI},fromProperty:function(n){return n in i?i[n]:i.default},toBase:function(n,t,r){if(g.object(n)){var e={};for(var o in n)e[o]=T.toBase(n[o],t);return e}if(!g.number(n[0]))return n;var i=T.fromProperty(t);if(g.null(n[1])&&!g.null(i))return[n[0],i];var a=T["".concat(n[1],"to").concat(i)];return a?[a(n[0],r),i]:n},normalize:function(n,t){return o.includes(n)||g.null(n)&&t in i?n:T.fromProperty(t)}},$=function(n){return"inset(".concat(E(n," ",["top","right","bottom","left"]),")")},R={origin:["transformOrigin"],length:["strokeDashoffset"],clip:["clipPath","webkitClipPath"],transformOrigin:function(n){return"".concat(100*n.x,"% ").concat(100*n.y,"%")},strokeDashoffset:function(n){return 1-n[0]},clipPath:$,webkitClipPath:$},F={bind:function(n,t){n.origin=n.origin||n;var r=function(){for(var r,e=arguments.length,o=new Array(e),i=0;i<e;i++)o[i]=arguments[i];return(r=n.origin).call.apply(r,[t].concat(o))};return r.origin=n.origin,r},create:function(n){var t=F.bind((function(n){if(g.function(n)){var r=F.bind(t,{transform:n});return r.set=t.set,r.internal=t.internal,r}return this.transform(t.internal.value)}),{transform:function(n){return n}});return t.set=function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;t.internal.value=n,t.internal.duration=r,t.internal.t=null},t.internal={value:n,duration:0},t},isInstance:function(n){return g.function(n)&&g.function(n.set)}},L=F;export{R as A,u as D,L,l as M,e as P,T as U,O as a,B as b,y as c,j as d,D as e,b as f,v as g,h,g as i,W as j,m as k,c as l,P as m,E as o,w as p,x as s,k as t,d as x};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/objectWithoutProperties";import{A as t}from"./animation-
|
|
1
|
+
import e from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/objectWithoutProperties";import{A as t}from"./animation-2ca8d322.js";var o=["direction"];function n(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function c(r){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?n(Object(o),!0).forEach((function(t){e(r,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}))}return r}var i=t.create((function(e){var t=e.direction,n=void 0===t?"up":t,i=r(e,o),p="0px",a="20px";switch(n){case"down":a="-20px";break;case"left":p="20px",a="0px";break;case"right":p="-20px",a="0px"}return[c({translate:{x:0,y:0},opacity:1,duration:.5},i),{translate:{x:p,y:a},opacity:0}]}));function p(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,o)}return t}function a(r){for(var t=1;t<arguments.length;t++){var o=null!=arguments[t]?arguments[t]:{};t%2?p(Object(o),!0).forEach((function(t){e(r,t,o[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(o)):p(Object(o)).forEach((function(e){Object.defineProperty(r,e,Object.getOwnPropertyDescriptor(o,e))}))}return r}var s=t.create((function(e){return[a({opacity:1,scale:1,duration:.25},e),{opacity:0,scale:.85}]}));export{i as M,s as P};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEffect as r}from"react";import{L as t}from"./link-
|
|
1
|
+
import{useEffect as r}from"react";import{L as t}from"./link-fda65080.js";import{a as n,r as o}from"./events-ac24ef8f.js";function e(){var e=t.create(0);return r((function(){var r=function(){return e.set(window.scrollY)};return r(),n("scroll",r),function(){return o("scroll",r)}}),[]),e}export{e as u};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@infinityfx/lively",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.4",
|
|
4
4
|
"description": "Feature complete, lightweight react animation library.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
10
|
"import": "./dist/esm/index.js",
|
|
11
|
-
"require": "./dist/cjs/index.js"
|
|
12
|
-
"types": "./types/index.d.ts"
|
|
11
|
+
"require": "./dist/cjs/index.js"
|
|
13
12
|
},
|
|
14
13
|
"./animations": {
|
|
15
14
|
"import": "./dist/esm/animations.js",
|
|
@@ -21,8 +20,7 @@
|
|
|
21
20
|
},
|
|
22
21
|
"./auto": {
|
|
23
22
|
"import": "./dist/esm/auto.js",
|
|
24
|
-
"require": "./dist/cjs/auto.js"
|
|
25
|
-
"types": "./types/auto.d.ts"
|
|
23
|
+
"require": "./dist/cjs/auto.js"
|
|
26
24
|
}
|
|
27
25
|
},
|
|
28
26
|
"typesVersions": {
|
package/types/animatable.d.ts
CHANGED
|
@@ -17,6 +17,32 @@ interface AnimatableProps {
|
|
|
17
17
|
*/
|
|
18
18
|
viewportMargin?: number;
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Controls the order in which the component animates when part of a cascading animation.
|
|
22
|
+
*/
|
|
23
|
+
group?: number;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Whether to pause an animation when the animated `element` is not visible on screen.
|
|
27
|
+
*
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
lazy?: boolean;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Whether all playing animations should be paused or not.
|
|
34
|
+
*
|
|
35
|
+
* @default false
|
|
36
|
+
*/
|
|
37
|
+
paused?: boolean;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Whether to correct an `element`'s children and certain of it's properties for deformations caused by scaling the `element`.
|
|
41
|
+
*
|
|
42
|
+
* @default false
|
|
43
|
+
*/
|
|
44
|
+
noDeform?: boolean;
|
|
45
|
+
|
|
20
46
|
/**
|
|
21
47
|
* Define a default animation.
|
|
22
48
|
*/
|
|
@@ -81,51 +107,51 @@ interface AnimatableProps {
|
|
|
81
107
|
* @default false
|
|
82
108
|
*/
|
|
83
109
|
whileFocus?: string | boolean;
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Controls the order in which the component animates when part of a cascading animation.
|
|
87
|
-
*/
|
|
88
|
-
group?: number;
|
|
89
110
|
}
|
|
90
111
|
|
|
91
112
|
export class Animatable extends React.Component<AnimatableProps> {
|
|
92
113
|
|
|
93
|
-
|
|
114
|
+
/**
|
|
115
|
+
* Checks whether something is an instance of `Animatable` or a class that extends it.
|
|
116
|
+
*/
|
|
117
|
+
static isInstance(val: any): boolean;
|
|
94
118
|
|
|
95
|
-
private
|
|
119
|
+
private parse;
|
|
96
120
|
|
|
97
121
|
private update;
|
|
98
122
|
|
|
99
|
-
private
|
|
100
|
-
|
|
101
|
-
private onScroll;
|
|
123
|
+
private dispatch;
|
|
102
124
|
|
|
103
|
-
private
|
|
125
|
+
private onEvent;
|
|
104
126
|
|
|
105
|
-
private
|
|
106
|
-
|
|
107
|
-
private onLeave;
|
|
108
|
-
|
|
109
|
-
private onFocus;
|
|
110
|
-
|
|
111
|
-
private onBlur;
|
|
127
|
+
private onScroll;
|
|
112
128
|
|
|
113
|
-
private
|
|
129
|
+
private getBoundingBox;
|
|
114
130
|
|
|
115
|
-
|
|
131
|
+
/**
|
|
132
|
+
* Play an animation referenced in `this.animations`.
|
|
133
|
+
*
|
|
134
|
+
* @param {string} animation
|
|
135
|
+
* @param {object} [options]
|
|
136
|
+
* @param {Function} [options.callback] - A callback function that gets called when the animation finishes playing.
|
|
137
|
+
* @param {boolean} [options.reverse] - Play the animation in reverse.
|
|
138
|
+
* @param {boolean} [options.composite] - Whether to play the animation simultaneously with other animations.
|
|
139
|
+
* @param {boolean} [options.immediate] - Whether to immediately play the animation, will override other playing animations when `composite` is `false`.
|
|
140
|
+
* @param {number} [options.delay] - Delay the animation by some amount in seconds.
|
|
141
|
+
*/
|
|
142
|
+
play(animation: string, { callback, reverse, composite, immediate, delay }?: {
|
|
116
143
|
callback?: Function;
|
|
117
144
|
reverse?: boolean;
|
|
145
|
+
composite?: boolean;
|
|
118
146
|
immediate?: boolean;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
cascadeDelay?: number;
|
|
122
|
-
staggerDelay?: number;
|
|
123
|
-
}): Promise<void>;
|
|
147
|
+
delay?: number;
|
|
148
|
+
}, delegate?: boolean): number;
|
|
124
149
|
|
|
125
|
-
|
|
150
|
+
/**
|
|
151
|
+
* Stop playing all currently playing animations.
|
|
152
|
+
*/
|
|
153
|
+
stop(): void;
|
|
126
154
|
|
|
127
|
-
private
|
|
128
|
-
|
|
129
|
-
private countNestedLevels;
|
|
155
|
+
private prerender;
|
|
130
156
|
|
|
131
157
|
}
|
package/types/animate.d.ts
CHANGED
|
@@ -1,3 +1,45 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AnimatableProps } from '../animatable';
|
|
3
|
+
import { Animation } from '../animations/animation';
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
interface AnimateProps extends AnimatableProps {
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* An array of `Animation` objects that defines what animation to apply to element depending on it's level.
|
|
9
|
+
*
|
|
10
|
+
* @default [Move, Pop]
|
|
11
|
+
*/
|
|
12
|
+
animations?: Animation[];
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* How many levels of `elements` to animate.
|
|
16
|
+
*
|
|
17
|
+
* @default 1
|
|
18
|
+
*/
|
|
19
|
+
levels?: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export class Animate extends React.Component<AnimateProps> {
|
|
23
|
+
|
|
24
|
+
private makeAnimatable;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Play an animation referenced in `this.animations`.
|
|
28
|
+
*
|
|
29
|
+
* @param {string} animation
|
|
30
|
+
* @param {object} [options]
|
|
31
|
+
* @param {Function} [options.callback] - A callback function that gets called when the animation finishes playing.
|
|
32
|
+
* @param {boolean} [options.reverse] - Play the animation in reverse.
|
|
33
|
+
* @param {boolean} [options.composite] - Whether to play the animation simultaneously with other animations.
|
|
34
|
+
* @param {boolean} [options.immediate] - Whether to immediately play the animation, will override other playing animations when `composite` is `false`.
|
|
35
|
+
* @param {number} [options.delay] - Delay the animation by some amount in seconds.
|
|
36
|
+
*/
|
|
37
|
+
play(animation: string, { callback, reverse, composite, immediate, delay }?: {
|
|
38
|
+
callback?: Function;
|
|
39
|
+
reverse?: boolean;
|
|
40
|
+
composite?: boolean;
|
|
41
|
+
immediate?: boolean;
|
|
42
|
+
delay?: number;
|
|
43
|
+
}, delegate?: boolean): number;
|
|
44
|
+
|
|
45
|
+
}
|
|
@@ -2,8 +2,14 @@ import { AnimationInitials, AnimationProperties } from '../globals';
|
|
|
2
2
|
|
|
3
3
|
export type Animation = {
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new `Animation` based on a `Function` that returns a tuple of animation properties and initials.
|
|
7
|
+
*/
|
|
5
8
|
create(getProperties?: () => [AnimationProperties, AnimationInitials]): Animation;
|
|
6
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Check whether something is an instance of `Animation`.
|
|
12
|
+
*/
|
|
7
13
|
isAnimation(animation: any): boolean;
|
|
8
14
|
|
|
9
15
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
interface LayoutGroupProps {
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @default ['translate', 'scale', 'rotate', 'opacity', 'borderRadius', 'backgroundColor', 'color', 'zIndex', 'pointerEvents']
|
|
7
|
+
*/
|
|
8
|
+
include?: string[];
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @default []
|
|
12
|
+
*/
|
|
13
|
+
exclude?: string[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export class LayoutGroup extends React.Component<LayoutGroupProps> {}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { AnimatableProps } from '../animatable';
|
|
3
|
+
|
|
4
|
+
interface MorphProps extends AnimatableProps {
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @default false
|
|
8
|
+
*/
|
|
9
|
+
active?: boolean;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* @default ['translate', 'scale', 'rotate', 'opacity', 'borderRadius', 'backgroundColor', 'color', 'zIndex', 'pointerEvents']
|
|
13
|
+
*/
|
|
14
|
+
include?: string[];
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @default []
|
|
18
|
+
*/
|
|
19
|
+
exclude?: string[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export class Morph extends React.Component<MorphProps> {
|
|
23
|
+
|
|
24
|
+
private static cascadingProps;
|
|
25
|
+
|
|
26
|
+
}
|
package/types/auto.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type Link = {
|
|
2
|
+
|
|
3
|
+
set: (val: any, duration?: number) => void;
|
|
4
|
+
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A reactive `Function` which returns it currently stored value.
|
|
9
|
+
*
|
|
10
|
+
* @param {Function} transformer - A function which transforms the `Link` value before returning it.
|
|
11
|
+
*/
|
|
12
|
+
export function Link(transformer?: (val: any) => any): any;
|
package/types/globals.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
type
|
|
3
|
+
type TranslateProperty = { x?: number; y?: number; } | string;
|
|
4
4
|
|
|
5
5
|
type ScaleProperty = { x?: number; y?: number; } | string | number;
|
|
6
6
|
|
|
@@ -17,7 +17,7 @@ export interface AnimationInitials extends React.CSSProperties {
|
|
|
17
17
|
*
|
|
18
18
|
* @default { x: 0, y: 0 }
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
translate?: TranslateProperty;
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* @default { x: 1, y: 1 }
|
|
@@ -27,7 +27,7 @@ export interface AnimationInitials extends React.CSSProperties {
|
|
|
27
27
|
/**
|
|
28
28
|
* @default 0
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
rotate?: number | string;
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* @default { left: 0, top: 0, right: 0, bottom: 0 }
|
|
@@ -35,27 +35,11 @@ export interface AnimationInitials extends React.CSSProperties {
|
|
|
35
35
|
clip?: ClipProperty;
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
39
|
-
* An alias for the `display` property which maps `true` to `""` and `false` to `"none"`.
|
|
40
|
-
*
|
|
41
|
-
* @default true
|
|
42
|
-
*/
|
|
43
|
-
active?: boolean;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Whether to allow mouse interactions with the `element`.
|
|
47
|
-
* An alias for the `pointerEvents` property which maps `true` to `"all"` and `false` to `"none"`.
|
|
48
|
-
*
|
|
49
|
-
* @default true
|
|
50
|
-
*/
|
|
51
|
-
interact?: boolean;
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Value between `0` and `1` which defines how much of an `<svg>` element stroke is shown.
|
|
38
|
+
* Value between `0` and `1` which defines how much of an `SVGElement`'s stroke is shown.
|
|
55
39
|
*
|
|
56
40
|
* @default 1
|
|
57
41
|
*/
|
|
58
|
-
|
|
42
|
+
length?: number;
|
|
59
43
|
}
|
|
60
44
|
|
|
61
45
|
export interface AnimationProperties extends AnimationInitials {
|
|
@@ -95,15 +79,12 @@ export interface AnimationProperties extends AnimationInitials {
|
|
|
95
79
|
*
|
|
96
80
|
* @default "ease"
|
|
97
81
|
*/
|
|
98
|
-
interpolate?: '
|
|
82
|
+
interpolate?: 'constant' | 'linear' | 'ease' | 'spring';
|
|
99
83
|
|
|
100
84
|
/**
|
|
85
|
+
* Alias for `transform-origin`.
|
|
86
|
+
*
|
|
101
87
|
* @default { x: 0.5, y: 0.5 }
|
|
102
88
|
*/
|
|
103
89
|
origin?: string | { x?: number, y?: number } | number;
|
|
104
|
-
|
|
105
|
-
/**
|
|
106
|
-
* @default false
|
|
107
|
-
*/
|
|
108
|
-
useLayout?: boolean;
|
|
109
90
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns a `Function`, which can be passed as an animation value for the `translate` property, that describes the motion along a referenced `SVGElement`'s path.
|
|
5
|
+
*
|
|
6
|
+
* @param {number[]} [offset=[0, 0]] - Offset the path's position by some amount along the x and y axis in pixels.
|
|
7
|
+
* @param {number} [scale=1] - Scale the size of the path some amount.
|
|
8
|
+
*/
|
|
9
|
+
export function usePath(offset?: number[], scale?: number): [Function, React.Ref<SVGElement>];
|
package/types/hooks/scroll.d.ts
CHANGED
package/types/hooks/unmount.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Animatable } from '../animatable';
|
|
3
|
-
import { Animate } from '../animate
|
|
3
|
+
import { Animate } from '../animate';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Returns a boolean value which dictates whether the referenced component should be mounted or not and allows for animating the respective component when it unmounts.
|
|
7
7
|
*
|
|
8
|
-
* @param initial whether the referenced component is initially mounted.
|
|
8
|
+
* @param {boolean} initial - whether the referenced component is initially mounted.
|
|
9
9
|
*/
|
|
10
10
|
export function useUnmount(initial: boolean): [boolean, (mounted: boolean) => void, React.Ref<Animatable | Animate>];
|
package/types/hooks.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export as namespace Hooks;
|
|
2
2
|
|
|
3
3
|
export { useUnmount } from './hooks/unmount';
|
|
4
|
-
export {
|
|
4
|
+
export { useLink } from './hooks/link';
|
|
5
5
|
export { useScroll } from './hooks/scroll';
|
|
6
|
+
export { usePath } from './hooks/path';
|
|
7
|
+
export { useReducedMotion } from './hooks/reduced-motion';
|
package/types/index.d.ts
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("@babel/runtime/helpers/classCallCheck"),t=require("@babel/runtime/helpers/createClass"),r=require("@babel/runtime/helpers/inherits"),n=require("@babel/runtime/helpers/possibleConstructorReturn"),i=require("@babel/runtime/helpers/getPrototypeOf"),o=require("@babel/runtime/helpers/defineProperty"),a=require("react"),s=require("./animation-48d0562e.js"),l=require("./link-b1d8de51.js"),u=require("./events-eb85ed65.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var h=c(e),f=c(t),p=c(r),y=c(n),d=c(i),v=c(o);function m(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return g(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return g(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var b=function(){function e(){h.default(this,e),this.t=Date.now(),this.managers=[],this.step()}return f.default(e,[{key:"step",value:function(){var e,t=Date.now(),r=m(this.managers);try{for(r.s();!(e=r.n()).done;){e.value.step((t-this.t)/1e3)}}catch(e){r.e(e)}finally{r.f()}this.t=t,requestAnimationFrame(this.step.bind(this))}},{key:"add",value:function(e){var t=this.managers.findIndex((function(t){return t.priority>=e.priority}));this.managers.splice(t<0?0:t,0,e)}},{key:"remove",value:function(e){this.managers.splice(this.managers.indexOf(e),1)}}],[{key:"get",value:function(){return window.Lively||(window.Lively=new e),window.Lively}}]),e}();function w(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return k(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return k(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var A=function(){function e(t,r,n){h.default(this,e),this.element=t,this.tracks=[],this.queue=[],this.playing=!0,this.culling=r,this.layout=n}return f.default(e,[{key:"purge",value:function(){if(!("cache"in this.element)){this.element.cache={strokeDasharray:1,borderRadius:l.getProperty(this.element,"borderRadius")};for(var e=0;e<this.element.style.length;e++){var t=this.element.style[e];this.element.cache[t]=this.element.style[t]}}for(var r in this.element.style={},this.element.cache)this.element.style[r]=this.element.cache[r]}},{key:"clear",value:function(){this.tracks=[],this.queue=[]}},{key:"add",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t.immediate,n=void 0!==r&&r,i=t.composite,o=void 0===i||i;n&&this.clear(),o||!this.tracks.length?this.tracks.push(e):this.queue.push(e)}},{key:"remove",value:function(e){this.tracks.splice(this.tracks.indexOf(e),1),!this.tracks.length&&this.queue.length&&this.tracks.push(this.queue.shift())}},{key:"step",value:function(e){if(this.playing){for(var t=this.element.correction?{scale:l.DEFAULT_OBJECTS.scale}:{},r=this.tracks.length+ +!this.channel.isEmpty,n=0;n<r;n++){var i=this.tracks[n]||this.channel;l.mergeProperties(t,i.get(this.element,this.culling)),i.step(e)&&this.remove(i)}this.apply(this.element,t)}}},{key:"apply",value:function(e,t){if(!l.is.empty(t)){var r=[];for(var n in t){var i=t[n];if("scale"==n){if(this.layout){var o,a={x:[1/i.x[0],i.x[1]],y:[1/i.y[0],i.y[1]]},s=w(e.children);try{for(s.s();!(o=s.n()).done;){o.value.correction=a}}catch(e){s.e(e)}finally{s.f()}var u=t.borderRadius||e.cache.borderRadius;delete t.borderRadius,e.style.borderRadius="".concat(u[0]/i.x[0]).concat(u[1]," / ").concat(u[0]/i.y[0]).concat(u[1])}e.correction&&(i=l.merge(i,e.correction,l.MERGE_FUNCTIONS.scale))}if(l.TRANSFORMS.includes(n))i="".concat(n,"(").concat(l.is.object(i)?l.objToStr(i,", ",["x","y"]):l.arrToStyle(i),")"),r.push(i);else{var c,h=w(l.Alias[n]||[n]);try{for(h.s();!(c=h.n()).done;){var f=c.value;l.is.color(i)?e.style[f]="rgba(".concat(i.r[0],", ").concat(i.g[0],", ").concat(i.b[0],", ").concat(i.a[0],")"):e.style[f]=f in l.Alias?l.Alias[f](i):l.arrToStyle(i)}}catch(e){h.e(e)}finally{h.f()}}}r.length&&(e.style.transform=r.join(" "))}}},{key:"initialize",value:function(e){this.apply(this.element,e.initials),this.channel=e.channel}}]),e}();function O(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function j(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?O(Object(r),!0).forEach((function(t){v.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):O(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function S(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return x(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return x(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function x(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var E=function(){function e(t){var r=t.priority,n=void 0===r?0:r,i=t.stagger,o=void 0===i?.1:i,a=t.culling,s=void 0===a||a,l=t.noDeform,u=void 0!==l&&l;h.default(this,e),this.targets=[],this.priority=n,this.stagger=o,this.culling=s,this.noDeform=u,this.paused=!1}return f.default(e,[{key:"register",value:function(){b.get().add(this)}},{key:"destroy",value:function(){this.targets=[],b.get().remove(this)}},{key:"purge",value:function(){var e,t=S(this.targets);try{for(t.s();!(e=t.n()).done;){e.value.purge()}}catch(e){t.e(e)}finally{t.f()}}},{key:"clear",value:function(){var e,t=S(this.targets);try{for(t.s();!(e=t.n()).done;){e.value.clear()}}catch(e){t.e(e)}finally{t.f()}}},{key:"set",value:function(e){var t=this;this.targets=e.map((function(e){return new A(e,t.culling,t.noDeform)}))}},{key:"play",value:function(e,t){if(!e.isEmpty)for(var r=0;r<this.targets.length;r++){var n=j(j({},t),{},{delay:(t.delay||0)+r*this.stagger});this.targets[r].add(e.play(n),n)}}},{key:"initialize",value:function(e){var t,r=S(this.targets);try{for(r.s();!(t=r.n()).done;){t.value.initialize(e)}}catch(e){r.e(e)}finally{r.f()}}},{key:"step",value:function(e){if(!this.paused){var t,r=S(this.targets);try{for(r.s();!(t=r.n()).done;){t.value.step(e)}}catch(e){r.e(e)}finally{r.f()}}}}]),e}();function I(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return M(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return M(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function P(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=d.default(e);if(t){var i=d.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return y.default(this,r)}}var q=function(e){p.default(r,e);var t=P(r);function r(e){var n;for(var i in h.default(this,r),(n=t.call(this,e)).animations={default:n.parse(n.props.animate||{})},n.props.animations||{})n.animations[i]=n.parse(n.props.animations[i]);return n.children=[],n.elements=[],n.stagger=n.props.stagger||.1,n.manager=new E({priority:n.props.group,stagger:n.stagger,culling:n.props.lazy,noDeform:n.props.noDeform}),n}return f.default(r,[{key:"parse",value:function(e){return s.Animation.isInstance(e)?e.use():l.is.object(e)?new s.Clip(e,this.props.initial):null}},{key:"update",value:function(){this.manager.purge(),this.manager.initialize(this.animations.default)}},{key:"componentDidMount",value:function(){var e=this;this.scrollEventListener=l.throttle(this.onScroll.bind(this)),u.addEventListener("scroll",this.scrollEventListener),this.eventListener=this.onEvent.bind(this),u.onAny(r.events,this.elements,this.eventListener),this.manager.set(this.elements),this.manager.paused=this.props.paused,this.manager.register(),this.update(),document.fonts.ready.then((function(){e.update(),e.manager.clear(),clearTimeout(e.timeout),e.inViewport=!1,e.props.group||(e.play(e.props.onMount),e.onScroll())}))}},{key:"componentWillUnmount",value:function(){u.removeEventListener("scroll",this.scrollEventListener),u.offAny(r.events,this.elements,this.eventListener),this.manager.destroy()}},{key:"componentDidUpdate",value:function(){this.manager.paused=this.props.paused;var e,t=I(this.children);try{for(t.s();!(e=t.n()).done;){e.value.manager.paused=this.props.paused}}catch(e){t.e(e)}finally{t.f()}}},{key:"dispatch",value:function(e){l.is.function(this.props[e])&&this.props[e]()}},{key:"onEvent",value:function(e){switch(e.type){case"click":this.play(this.props.onClick);break;case"mouseenter":this.hover||(this.hover=!0,this.play(this.props.whileHover));break;case"mouseleave":this.hover&&(this.hover=!1,this.play(this.props.whileHover,{reverse:!0}));break;case"focus":this.focus||(this.focus=!0,this.play(this.props.whileFocus));break;case"blur":this.focus&&(this.focus=!1,this.play(this.props.whileFocus,{reverse:!0}))}}},{key:"getBoundingBox",value:function(){var e,t={x:Number.MAX_VALUE,y:Number.MAX_VALUE,right:0,bottom:0},r=I(this.elements.length?this.elements:this.children);try{for(r.s();!(e=r.n()).done;){var n=e.value,i=this.elements.length?n.getBoundingClientRect():n.getBoundingBox();t.y=Math.min(i.y,t.y),t.x=Math.min(i.x,t.x),t.right=Math.max(i.right,t.right),t.bottom=Math.max(i.bottom,t.bottom)}}catch(e){r.e(e)}finally{r.f()}return t}},{key:"onScroll",value:function(){if(this.props.whileViewport){var e=l.is.inViewport(this.getBoundingBox(),this.props.viewportMargin),t=e.entered,r=e.left;t&&!this.inViewport&&(this.inViewport=!0,this.play(this.props.whileViewport),this.dispatch("onEnterViewport")),r&&this.inViewport&&(this.inViewport=!1,this.play(this.props.whileViewport,{reverse:!0,immediate:!0}),this.dispatch("onLeaveViewport"))}}},{key:"play",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.reverse,i=void 0!==n&&n,o=r.composite,a=void 0!==o&&o,s=r.immediate,u=void 0!==s&&s,c=r.delay,h=void 0===c?0:c,f=r.callback,p=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!(!e||this.props.disabled||this.props.group>0&&!p)){l.is.string(e)||(e="default"),this.dispatch("onAnimationStart");var y,d=this.animations[e],v=d.length(),m=0,g=I(this.children);try{for(g.s();!(y=g.n()).done;){var b=y.value;m=Math.max(m,b.play(e,{reverse:i,immediate:u,delay:h+v},!0))}}catch(e){g.e(e)}finally{g.f()}return this.manager.play(d,{reverse:i,composite:a,immediate:u,delay:i?m:h}),u&&clearTimeout(this.timeout),this.props.group||(this.timeout=setTimeout((function(){t.dispatch("onAnimationEnd"),l.is.function(f)&&f()}),1e3*(m+v))),v+(i?m:h)}}},{key:"stop",value:function(){this.manager.clear()}},{key:"prerender",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return a.Children.map(e,(function(e,o){if(!a.isValidElement(e))return e;var s={pathLength:1};if(n&&(s.ref=function(e){return t.elements[o]=e}),r.isInstance(e)&&i&&!e.props.noCascade){var u=t.childIndex++;i=!1,s.group=t.props.group+1,s.ref=function(e){return t.children[u]=e},t.props.group||(s.active=t.props.active),l.mergeObjects(s,t.props,t.constructor.cascadingProps),l.mergeObjects(s,e.props,t.constructor.cascadingProps)}return a.cloneElement(e,s,t.prerender(e.props.children,!1,i))}))}},{key:"render",value:function(){return this.childIndex=0,this.prerender(this.props.children)}}],[{key:"isInstance",value:function(e){return e.type===r||e.type.prototype instanceof r}}]),r}(a.Component);v.default(q,"events",["click","mouseenter","mouseleave","focus","blur"]),v.default(q,"cascadingProps",["animate","initial","animations","stagger"]),v.default(q,"defaultProps",{group:0,viewportMargin:.75,lazy:!0,paused:!1}),exports.Animatable=q;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var t=require("@babel/runtime/helpers/slicedToArray"),e=require("@babel/runtime/helpers/defineProperty"),r=require("@babel/runtime/helpers/objectWithoutProperties"),n=require("@babel/runtime/helpers/classCallCheck"),i=require("@babel/runtime/helpers/createClass"),a=require("@babel/runtime/helpers/inherits"),o=require("@babel/runtime/helpers/possibleConstructorReturn"),u=require("@babel/runtime/helpers/getPrototypeOf"),s=require("./link-b1d8de51.js");function l(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var c=l(t),f=l(e),h=l(r),p=l(n),d=l(i),v=l(a),y=l(o),b=l(u);function m(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return g(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return g(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function g(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var O=function t(e,r,n,i){if(s.is.object(e)){var a={};for(var o in e)a[o]=t(e[o],r[o],n,i);return a}return[i(e[0],r[0],n),e[1]]},j=function(t,e,r){return s.is.number(t)&&s.is.number(e)?t*(1-r)+e*r:r>.5?e:t},w=function(t,e,r){return j(t,e,(1-Math.cos(r*Math.PI))/2)},P=function(t,e,r){var n,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a={duration:i},o={},u=m(r);try{for(u.s();!(n=u.n()).done;){var s=n.value;"scale"==s?(a.scale={x:1,y:1},o.scale={x:1+(e.layout.width-t.layout.width)/t.layout.width,y:1+(e.layout.height-t.layout.height)/t.layout.height}):"translate"==s?(a.translate={x:0,y:0},o.translate={x:(e.layout.x-t.layout.x)*e.layout.parentWidth,y:(e.layout.y-t.layout.y)*e.layout.parentHeight}):(a[s]=t[s],o[s]=e[s])}}catch(t){u.e(t)}finally{u.f()}return new B(a,o)},S=Object.freeze({__proto__:null,interpolate:O,constant:function(t){return t},linear:j,ease:w,spring:function(t,e,r){return r=1-1*Math.exp(-3.6*r)*Math.cos(2.5*Math.pow(r,2)*Math.PI),j(t,e,r)},computeMorph:P}),I=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.reverse,i=void 0!==n&&n,a=r.repeat,o=void 0===a?1:a,u=r.delay,s=void 0===u?0:u,l=r.alternate,c=void 0!==l&&l;p.default(this,t),this.indices={},this.clip=e,this.t=0,this.T=e.duration*o+s,this.reverse=i,this.delay=s,this.alternate=c}return d.default(t,[{key:"getInterpolatedValue",value:function(t,e,r,n){if(s.is.function(e))e=s.convert(e(r,this.clip.duration),t),e=s.Units.toBase(e,t,n);else{t in this.indices||(this.indices[t]=this.reverse?e.length-1:0);var i,a=this.reverse?-1:1,o=this.indices[t],u=e[o],l=e[o+a],c=u.set;if(this.reverse?l.time>r:l.time<r){this.indices[t]=o+=a;var f=["start","end"],h=f[+!this.reverse],p=f[+this.reverse];h in u||p in l?(c=h in u?u[h]:l[p],i=!0):(u=e[o],l=e[o+a])}if(s.is.null(c)&&(c=s.getProperty(n,t)),c=s.Units.toBase(c,t,n),i)e=c;else{var d=s.is.null(l.set)?s.getProperty(n,t):l.set;d=s.Units.toBase(d,t,n);var v=S[l.interpolate||this.clip.interpolate]||w;e=O(c,d,(r-u.time)/(l.time-u.time),v)}}return e}},{key:"get",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r={},n=this.t>=this.T;if(this.t<this.delay||e&&!n&&!s.is.visible(t))return r;var i=this.t-this.delay,a=this.clip.duration,o=this.alternate&&Math.floor(i/a)%2==+!n;for(var u in i=n?a:i%a,i=s.xor(this.reverse,o)?a-i:i,r.origin=this.clip.origin,this.clip.properties)r[u]=this.getInterpolatedValue(u,this.clip.properties[u],i,t);return r}},{key:"step",value:function(t){var e=this.t>=this.T;return this.t+=t,e}}]),t}();function x(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=b.default(t);if(e){var i=b.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return y.default(this,r)}}var k=function(t){v.default(r,t);var e=x(r);function r(){var t;return p.default(this,r),(t=e.call(this,{duration:1/0,properties:{},origin:{x:.5,y:.5}})).isEmpty=!0,t.cache={},t}return d.default(r,[{key:"add",value:function(t,e){this.clip.properties[t]=e,this.isEmpty=!1}},{key:"getInterpolatedValue",value:function(t,e,r,n){s.is.null(e.internal.t)&&(e.internal.t=r),e.internal.t===r&&(this.cache[t]={});var i=e.internal.duration?Math.min((r-e.internal.t)/e.internal.duration,1):1,a=this.cache[t]||{};if(a.t===i)return a.value;var o=s.Units.toBase(s.convert(e(r,this.clip.duration),t),t,n),u=s.getProperty(n,t);u=s.Units.toBase(u,t,n);var l=O(u,o,i,j);return this.cache[t]={value:l,t:i},l}}]),r}(I),A=["duration","delay","repeat","alternate","interpolate","origin"];function q(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return M(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return M(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function M(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function T(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function z(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?T(Object(r),!0).forEach((function(e){f.default(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):T(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}var B=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.duration,n=void 0===r?1:r,i=e.delay,a=e.repeat,o=e.alternate,u=e.interpolate,l=e.origin,f=void 0===l?{x:.5,y:.5}:l,d=h.default(e,A),v=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};p.default(this,t),this.duration=n,this.origin=s.originToStr(f),this.channel=new k;var y=this.parse(d,v),b=c.default(y,2);this.properties=b[0],this.initials=b[1],this.isEmpty=s.is.empty(this.properties),this.interpolate=u,this.defaults={delay:i,repeat:a,alternate:o}}return d.default(t,[{key:"length",value:function(){return this.duration*(this.defaults.repeat||1)+(this.defaults.delay||0)}},{key:"parse",value:function(t,e){var r=this,n=function(n){var i=t[n];if(s.Link.isInstance(i))return r.channel.add(n,i),delete t[n],"continue";if(s.is.function(i))return"continue";(i=s.is.array(i)?i:[i]).length<2?i.unshift(n in e?e[n]:null):s.is.null(i[0])||(e[n]=i[0]);for(var a=i.map((function(t){return r.sanitize(t,n)})),o=0;o<a.length;o++)r.quantize(a,o);t[n]=a};for(var i in t)n(i);for(var a in e=z({},e))e[a]=s.convert(e[a],a);return[t,e]}},{key:"sanitize",value:function(t,e){s.is.object(t)||(t={set:t}),s.hasSomeKey(t,s.POSITIONS)||(t={set:t}),"set"in t||(t.set="start"in t?t.start:t.end),"time"in t&&t.time>this.duration&&delete t.time,t=z({},t);var r,n=q(s.POSITIONS);try{for(n.s();!(r=n.n()).done;){var i=r.value;i in t&&(t[i]=s.convert(t[i],e))}}catch(t){n.e(t)}finally{n.f()}return t}},{key:"quantize",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e-1;if("time"in t[e])return t[e].time;if(0==e||e==t.length-1)return t[e].time=0==e?0:this.duration;var n=this.quantize(t,r,r);return t[e].time=n+(this.quantize(t,e+1,r)-n)*((e-r)/(e-r+1))}},{key:"play",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new I(this,s.mergeObjects(t,this.defaults))}}]),t}(),C={create:function(t){var e=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.use=t.use.bind(t,e),t};return e.use=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t(e),n=c.default(r,2),i=n[0],a=n[1];return new B(i,a)},e},isInstance:function(t){return s.is.function(t)&&s.is.function(t.use)}};exports.Animation=C,exports.Clip=B,exports.computeMorph=P;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var t=require("@babel/runtime/helpers/typeof"),n=require("@babel/runtime/helpers/slicedToArray"),r=require("@babel/runtime/helpers/defineProperty");function e(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var o=e(t),i=e(n),a=e(r),u=["%","px","em","rem","vw","vh","vmin","vmax","deg","rad"],l={rotate:"deg",skew:"deg",scale:"%",clip:"%",opacity:null,zIndex:null,lineHeight:null,fontWeight:null,length:null,default:"px"},c=[["x","y"],["r","g","b","a"],["left","top","right","bottom"]],f={translate:{x:[0,"px"],y:[0,"px"]},scale:{x:[1,"%"],y:[1,"%"]},clip:{left:[0,"%"],top:[0,"%"],right:[0,"%"],bottom:[0,"%"]},r:[127,null],g:[127,null],b:[127,null],a:[255,null]},s=["translate","scale","rotate","opacity","borderRadius","backgroundColor","color","zIndex","pointerEvents"],p={translate:function(t,n){return t+n},rotate:function(t,n){return t+n},scale:function(t,n){return t*n},default:function(t,n){return(t+n)/2}};function d(t,n){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,n){if(!t)return;if("string"==typeof t)return h(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return h(t,n)}(t))||n&&t&&"number"==typeof t.length){r&&(t=r);var e=0,o=function(){};return{s:o,n:function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function h(t,n){(null==n||n>t.length)&&(n=t.length);for(var r=0,e=new Array(n);r<n;r++)e[r]=t[r];return e}var y=function(t,n){return Object.keys(t).some((function(t){return n.includes(t)}))},b={null:function(t){return null==t},array:function(t){return Array.isArray(t)},object:function(t){return!b.null(t)&&"object"===o.default(t)&&!b.array(t)},function:function(t){return t instanceof Function},string:function(t){return"string"==typeof t},bool:function(t){return"boolean"==typeof t},number:function(t){return"number"==typeof t},empty:function(t){return function(t,n){return Object.keys(t).length===n}(t,0)},inViewport:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=t.y,e=t.bottom,o=e-r;return{left:r>window.innerHeight+o*n,entered:r+o*n<window.innerHeight}},visible:function(t){var n=t.getBoundingClientRect(),r=n.x,e=n.y,o=n.right,i=n.bottom;return!(o-r<1||i-e<1)&&(e<window.innerHeight&&i>0&&r<window.innerWidth&&o>0)},rgb:function(t){return t.match(/^rgba?\(.*\)$/i)},hex:function(t){return t.match(/^#[0-9a-f]{3,8}$/i)},color:function(t){return b.object(t)&&"r"in t}},g=function(t){var n=new DOMMatrix(t),r=Math.sqrt(n.a*n.a+n.b*n.b)*Math.sign(n.a),e=Math.sqrt(n.c*n.c+n.d*n.d)*Math.sign(n.d),o=180*Math.atan2(n.d,n.c)/Math.PI-90,i=180*Math.atan2(n.b,n.a)/Math.PI;return{translate:{x:n.e,y:n.f},scale:{x:r,y:e},rotate:i,skew:{x:o,y:0}}},v=function t(n,r,e){if(b.object(n)){var o={};for(var i in n)o[i]=t(n[i],r[i],e);return o}return b.number(n[0])&&b.number(r[0])?[e(n[0],r[0]),n[1]]:r};function m(t,n){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(t);n&&(e=e.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),r.push.apply(r,e)}return r}function x(t){for(var n=1;n<arguments.length;n++){var r=null!=arguments[n]?arguments[n]:{};n%2?m(Object(r),!0).forEach((function(n){a.default(t,n,r[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):m(Object(r)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))}))}return t}function w(t,n){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,n){if(!t)return;if("string"==typeof t)return O(t,n);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return O(t,n)}(t))||n&&t&&"number"==typeof t.length){r&&(t=r);var e=0,o=function(){};return{s:o,n:function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){u=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function O(t,n){(null==n||n>t.length)&&(n=t.length);for(var r=0,e=new Array(n);r<n;r++)e[r]=t[r];return e}var j=function t(n,r){var e,o=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(b.null(n))return null;if("scale"!==r||o||b.object(n)||(n={x:n,y:n}),b.object(n)){var a,u=Object.keys(n),l=w(c);try{for(l.s();!(a=l.n()).done;){var s=a.value;if(y(n,s)){u=s;break}}}catch(t){l.e(t)}finally{l.f()}n=x({},n);var p,d=w(u);try{for(d.s();!(p=d.n()).done;){var h=p.value,g=r in f?f[r][h]:f[h];n[h]=h in n?t(n[h],r,!0):g}}catch(t){d.e(t)}finally{d.f()}return n}if(b.string(n)){if(b.hex(n))return S(n);if(b.rgb(n))return P(n);var v=k(n),m=i.default(v,2);n=m[0],"%"==(e=m[1])&&(n/=100)}return[n,e=b.number(n)?M.normalize(e,r):null]},S=function(t){var n=t.match(/^#([\da-f]{1,2})([\da-f]{1,2})([\da-f]{1,2})([\da-f]{2})?/i),r=i.default(n,5);r[0];var e=r[1],o=r[2],a=r[3],u=r[4],l=function(t){return[b.null(t)?255:parseInt(t.padStart(2,t),16),null]};return{r:l(e),g:l(o),b:l(a),a:l(u)}},P=function(t){var n=t.match(/^rgba?\((\d+)\D+(\d+)\D+(\d+)\D*(\d+)?\)/i),r=i.default(n,5);r[0];var e=r[1],o=r[2],a=r[3],u=r[4],l=function(t){return[b.null(t)?255:parseInt(t),null]};return{r:l(e),g:l(o),b:l(a),a:l(u)}},A=function(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Object.keys(t);return r.map((function(n){return I(t[n])})).join(n)},k=function(t){var n=t.toString().match(/^([\d.]+)([^\d.]*)$/i);return n?[parseFloat(n[1]),n[2]||null]:[t,null]},I=function(t){return("%"==t[1]?100*t[0]:t[0])+(b.null(t[1])?"":t[1])},M={emtopx:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.body;return t*parseFloat(getComputedStyle(n).fontSize)},remtopx:function(t){return M.emtopx(t)},vwtopx:function(t){return t*window.innerWidth},vhtopx:function(t){return t*window.innerHeight},vmintopx:function(t){return t*Math.min(window.innerWidth,window.innerHeight)},vmaxtopx:function(t){return t*Math.max(window.innerWidth,window.innerHeight)},radtodeg:function(t){return 180*t/Math.PI},fromProperty:function(t){return t in l?l[t]:l.default},toBase:function(t,n,r){if(b.object(t)){var e={};for(var o in t)e[o]=M.toBase(t[o],n);return e}if(!b.number(t[0]))return t;var i=M.fromProperty(n);if(b.null(t[1])&&!b.null(i))return[t[0],i];var a=M["".concat(t[1],"to").concat(i)];return a?[a(t[0],r),i]:t},normalize:function(t,n){return u.includes(t)||b.null(t)&&n in l?t:M.fromProperty(n)}},T=function(t){return"inset(".concat(A(t," ",["top","right","bottom","left"]),")")},C={origin:["transformOrigin"],length:["strokeDashoffset"],clip:["clipPath","webkitClipPath"],transformOrigin:function(t){return"".concat(100*t.x,"% ").concat(100*t.y,"%")},strokeDashoffset:function(t){return 1-t[0]},clipPath:T,webkitClipPath:T},D={bind:function(t,n){t.origin=t.origin||t;var r=function(){for(var r,e=arguments.length,o=new Array(e),i=0;i<e;i++)o[i]=arguments[i];return(r=t.origin).call.apply(r,[n].concat(o))};return r.origin=t.origin,r},create:function(t){var n=D.bind((function(t){if(b.function(t)){var r=D.bind(n,{transform:t});return r.set=n.set,r.internal=n.internal,r}return this.transform(n.internal.value)}),{transform:function(t){return t}});return n.set=function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;n.internal.value=t,n.internal.duration=r,n.internal.t=null},n.internal={value:t,duration:0},n},isInstance:function(t){return b.function(t)&&b.function(t.set)}},E=D;exports.Alias=C,exports.DEFAULT_OBJECTS=f,exports.Link=E,exports.MERGE_FUNCTIONS=p,exports.MORPH_PROPERTIES=s,exports.POSITIONS=["set","start","end"],exports.TRANSFORMS=["translate","scale","skew","rotate"],exports.Units=M,exports.arrToStyle=I,exports.convert=j,exports.getProperty=function(t,n){var r=getComputedStyle(t),e=g(r.transform);if(n in e)return j(e[n],n);var o=r[n];return b.rgb(o)?P(o):k(o)},exports.getSnapshot=function(t){var n,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],e=getComputedStyle(t),o=t.getBoundingClientRect(),i=o.x,a=o.y,u=o.width,l=o.height,c=(r?t.parentElement:document.body).getBoundingClientRect(),f={layout:{x:i=(i-c.x+u/2)/c.width,y:a=(a-c.y+l/2)/c.height,width:u,height:l,parentWidth:c.width,parentHeight:c.height}},p=d(s);try{for(p.s();!(n=p.n()).done;){var h=n.value;f[h]=e[h]}}catch(t){p.e(t)}finally{p.f()}return Object.assign(f,g(e.transform)),f},exports.hasSomeKey=y,exports.is=b,exports.merge=v,exports.mergeObjects=function(t,n){var r,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Object.keys(n),o=d(e);try{for(o.s();!(r=o.n()).done;){var i=r.value;b.null(n[i])||(t[i]=n[i])}}catch(t){o.e(t)}finally{o.f()}return t},exports.mergeProperties=function(t,n){for(var r in n){var e=p[r]||p.default;t[r]=r in t?v(t[r],n[r],e):n[r]}},exports.objToStr=A,exports.originToStr=function(t){var n=b.object(t)?t:{},r=n.x,e=void 0===r?.5:r,o=n.y,i=void 0===o?.5:o;if(b.string(t))switch(t){case"left":e=0;break;case"right":e=1;break;case"top":i=0;break;case"bottom":i=1}return{x:e,y:i}},exports.padArray=function(t,n){return new Array(n).fill(0).map((function(n,r){return r<t.length?t[r]:t[t.length-1]}))},exports.subArray=function(t,n){return t.filter((function(t){return!n.includes(t)}))},exports.throttle=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250;return function(){var r=Date.now();t.LivelyTimestamp-r<n||(t.LivelyTimestamp=r,t())}},exports.xor=function(t,n){return t&&!n||!t&&n};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import t from"@babel/runtime/helpers/classCallCheck";import e from"@babel/runtime/helpers/createClass";import r from"@babel/runtime/helpers/inherits";import n from"@babel/runtime/helpers/possibleConstructorReturn";import i from"@babel/runtime/helpers/getPrototypeOf";import o from"@babel/runtime/helpers/defineProperty";import{Children as a,isValidElement as s,cloneElement as l,Component as u}from"react";import{A as c,C as h}from"./animation-759a01d8.js";import{g as f,D as p,m as y,i as m,a as v,T as d,o as g,b,A as w,M as k,t as A,c as j}from"./link-c7db7b65.js";import{a as O,o as x,r as S,b as I}from"./events-6abe8a94.js";function E(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return M(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return M(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function M(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var D=function(){function r(){t(this,r),this.t=Date.now(),this.managers=[],this.step()}return e(r,[{key:"step",value:function(){var t,e=Date.now(),r=E(this.managers);try{for(r.s();!(t=r.n()).done;){t.value.step((e-this.t)/1e3)}}catch(t){r.e(t)}finally{r.f()}this.t=e,requestAnimationFrame(this.step.bind(this))}},{key:"add",value:function(t){var e=this.managers.findIndex((function(e){return e.priority>=t.priority}));this.managers.splice(e<0?0:e,0,t)}},{key:"remove",value:function(t){this.managers.splice(this.managers.indexOf(t),1)}}],[{key:"get",value:function(){return window.Lively||(window.Lively=new r),window.Lively}}]),r}();function P(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return L(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return L(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function L(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var R=function(){function r(e,n,i){t(this,r),this.element=e,this.tracks=[],this.queue=[],this.playing=!0,this.culling=n,this.layout=i}return e(r,[{key:"purge",value:function(){if(!("cache"in this.element)){this.element.cache={strokeDasharray:1,borderRadius:f(this.element,"borderRadius")};for(var t=0;t<this.element.style.length;t++){var e=this.element.style[t];this.element.cache[e]=this.element.style[e]}}for(var r in this.element.style={},this.element.cache)this.element.style[r]=this.element.cache[r]}},{key:"clear",value:function(){this.tracks=[],this.queue=[]}},{key:"add",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.immediate,n=void 0!==r&&r,i=e.composite,o=void 0===i||i;n&&this.clear(),o||!this.tracks.length?this.tracks.push(t):this.queue.push(t)}},{key:"remove",value:function(t){this.tracks.splice(this.tracks.indexOf(t),1),!this.tracks.length&&this.queue.length&&this.tracks.push(this.queue.shift())}},{key:"step",value:function(t){if(this.playing){for(var e=this.element.correction?{scale:p.scale}:{},r=this.tracks.length+ +!this.channel.isEmpty,n=0;n<r;n++){var i=this.tracks[n]||this.channel;y(e,i.get(this.element,this.culling)),i.step(t)&&this.remove(i)}this.apply(this.element,e)}}},{key:"apply",value:function(t,e){if(!m.empty(e)){var r=[];for(var n in e){var i=e[n];if("scale"==n){if(this.layout){var o,a={x:[1/i.x[0],i.x[1]],y:[1/i.y[0],i.y[1]]},s=P(t.children);try{for(s.s();!(o=s.n()).done;){o.value.correction=a}}catch(t){s.e(t)}finally{s.f()}var l=e.borderRadius||t.cache.borderRadius;delete e.borderRadius,t.style.borderRadius="".concat(l[0]/i.x[0]).concat(l[1]," / ").concat(l[0]/i.y[0]).concat(l[1])}t.correction&&(i=v(i,t.correction,k.scale))}if(d.includes(n))i="".concat(n,"(").concat(m.object(i)?g(i,", ",["x","y"]):b(i),")"),r.push(i);else{var u,c=P(w[n]||[n]);try{for(c.s();!(u=c.n()).done;){var h=u.value;m.color(i)?t.style[h]="rgba(".concat(i.r[0],", ").concat(i.g[0],", ").concat(i.b[0],", ").concat(i.a[0],")"):t.style[h]=h in w?w[h](i):b(i)}}catch(t){c.e(t)}finally{c.f()}}}r.length&&(t.style.transform=r.join(" "))}}},{key:"initialize",value:function(t){this.apply(this.element,t.initials),this.channel=t.channel}}]),r}();function V(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function C(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?V(Object(r),!0).forEach((function(e){o(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):V(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function B(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return T(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return T(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function T(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var U=function(){function r(e){var n=e.priority,i=void 0===n?0:n,o=e.stagger,a=void 0===o?.1:o,s=e.culling,l=void 0===s||s,u=e.noDeform,c=void 0!==u&&u;t(this,r),this.targets=[],this.priority=i,this.stagger=a,this.culling=l,this.noDeform=c,this.paused=!1}return e(r,[{key:"register",value:function(){D.get().add(this)}},{key:"destroy",value:function(){this.targets=[],D.get().remove(this)}},{key:"purge",value:function(){var t,e=B(this.targets);try{for(e.s();!(t=e.n()).done;){t.value.purge()}}catch(t){e.e(t)}finally{e.f()}}},{key:"clear",value:function(){var t,e=B(this.targets);try{for(e.s();!(t=e.n()).done;){t.value.clear()}}catch(t){e.e(t)}finally{e.f()}}},{key:"set",value:function(t){var e=this;this.targets=t.map((function(t){return new R(t,e.culling,e.noDeform)}))}},{key:"play",value:function(t,e){if(!t.isEmpty)for(var r=0;r<this.targets.length;r++){var n=C(C({},e),{},{delay:(e.delay||0)+r*this.stagger});this.targets[r].add(t.play(n),n)}}},{key:"initialize",value:function(t){var e,r=B(this.targets);try{for(r.s();!(e=r.n()).done;){e.value.initialize(t)}}catch(t){r.e(t)}finally{r.f()}}},{key:"step",value:function(t){if(!this.paused){var e,r=B(this.targets);try{for(r.s();!(e=r.n()).done;){e.value.step(t)}}catch(t){r.e(t)}finally{r.f()}}}}]),r}();function q(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return z(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return z(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw o}}}}function z(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function $(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,o=i(t);if(e){var a=i(this).constructor;r=Reflect.construct(o,arguments,a)}else r=o.apply(this,arguments);return n(this,r)}}var F=function(n){r(o,u);var i=$(o);function o(e){var r;for(var n in t(this,o),(r=i.call(this,e)).animations={default:r.parse(r.props.animate||{})},r.props.animations||{})r.animations[n]=r.parse(r.props.animations[n]);return r.children=[],r.elements=[],r.stagger=r.props.stagger||.1,r.manager=new U({priority:r.props.group,stagger:r.stagger,culling:r.props.lazy,noDeform:r.props.noDeform}),r}return e(o,[{key:"parse",value:function(t){return c.isInstance(t)?t.use():m.object(t)?new h(t,this.props.initial):null}},{key:"update",value:function(){this.manager.purge(),this.manager.initialize(this.animations.default)}},{key:"componentDidMount",value:function(){var t=this;this.scrollEventListener=A(this.onScroll.bind(this)),O("scroll",this.scrollEventListener),this.eventListener=this.onEvent.bind(this),x(o.events,this.elements,this.eventListener),this.manager.set(this.elements),this.manager.paused=this.props.paused,this.manager.register(),this.update(),document.fonts.ready.then((function(){t.update(),t.manager.clear(),clearTimeout(t.timeout),t.inViewport=!1,t.props.group||(t.play(t.props.onMount),t.onScroll())}))}},{key:"componentWillUnmount",value:function(){S("scroll",this.scrollEventListener),I(o.events,this.elements,this.eventListener),this.manager.destroy()}},{key:"componentDidUpdate",value:function(){this.manager.paused=this.props.paused;var t,e=q(this.children);try{for(e.s();!(t=e.n()).done;){t.value.manager.paused=this.props.paused}}catch(t){e.e(t)}finally{e.f()}}},{key:"dispatch",value:function(t){m.function(this.props[t])&&this.props[t]()}},{key:"onEvent",value:function(t){switch(t.type){case"click":this.play(this.props.onClick);break;case"mouseenter":this.hover||(this.hover=!0,this.play(this.props.whileHover));break;case"mouseleave":this.hover&&(this.hover=!1,this.play(this.props.whileHover,{reverse:!0}));break;case"focus":this.focus||(this.focus=!0,this.play(this.props.whileFocus));break;case"blur":this.focus&&(this.focus=!1,this.play(this.props.whileFocus,{reverse:!0}))}}},{key:"getBoundingBox",value:function(){var t,e={x:Number.MAX_VALUE,y:Number.MAX_VALUE,right:0,bottom:0},r=q(this.elements.length?this.elements:this.children);try{for(r.s();!(t=r.n()).done;){var n=t.value,i=this.elements.length?n.getBoundingClientRect():n.getBoundingBox();e.y=Math.min(i.y,e.y),e.x=Math.min(i.x,e.x),e.right=Math.max(i.right,e.right),e.bottom=Math.max(i.bottom,e.bottom)}}catch(t){r.e(t)}finally{r.f()}return e}},{key:"onScroll",value:function(){if(this.props.whileViewport){var t=m.inViewport(this.getBoundingBox(),this.props.viewportMargin),e=t.entered,r=t.left;e&&!this.inViewport&&(this.inViewport=!0,this.play(this.props.whileViewport),this.dispatch("onEnterViewport")),r&&this.inViewport&&(this.inViewport=!1,this.play(this.props.whileViewport,{reverse:!0,immediate:!0}),this.dispatch("onLeaveViewport"))}}},{key:"play",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.reverse,i=void 0!==n&&n,o=r.composite,a=void 0!==o&&o,s=r.immediate,l=void 0!==s&&s,u=r.delay,c=void 0===u?0:u,h=r.callback,f=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!(!t||this.props.disabled||this.props.group>0&&!f)){m.string(t)||(t="default"),this.dispatch("onAnimationStart");var p,y=this.animations[t],v=y.length(),d=0,g=q(this.children);try{for(g.s();!(p=g.n()).done;){var b=p.value;d=Math.max(d,b.play(t,{reverse:i,immediate:l,delay:c+v},!0))}}catch(t){g.e(t)}finally{g.f()}return this.manager.play(y,{reverse:i,composite:a,immediate:l,delay:i?d:c}),l&&clearTimeout(this.timeout),this.props.group||(this.timeout=setTimeout((function(){e.dispatch("onAnimationEnd"),m.function(h)&&h()}),1e3*(d+v))),v+(i?d:c)}}},{key:"stop",value:function(){this.manager.clear()}},{key:"prerender",value:function(t){var e=this,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return a.map(t,(function(t,i){if(!s(t))return t;var a={pathLength:1};if(r&&(a.ref=function(t){return e.elements[i]=t}),o.isInstance(t)&&n&&!t.props.noCascade){var u=e.childIndex++;n=!1,a.group=e.props.group+1,a.ref=function(t){return e.children[u]=t},e.props.group||(a.active=e.props.active),j(a,e.props,e.constructor.cascadingProps),j(a,t.props,e.constructor.cascadingProps)}return l(t,a,e.prerender(t.props.children,!1,n))}))}},{key:"render",value:function(){return this.childIndex=0,this.prerender(this.props.children)}}],[{key:"isInstance",value:function(t){return t.type===o||t.type.prototype instanceof o}}]),o}();o(F,"events",["click","mouseenter","mouseleave","focus","blur"]),o(F,"cascadingProps",["animate","initial","animations","stagger"]),o(F,"defaultProps",{group:0,viewportMargin:.75,lazy:!0,paused:!1});export{F as A};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import t from"@babel/runtime/helpers/slicedToArray";import e from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/objectWithoutProperties";import n from"@babel/runtime/helpers/classCallCheck";import i from"@babel/runtime/helpers/createClass";import a from"@babel/runtime/helpers/inherits";import o from"@babel/runtime/helpers/possibleConstructorReturn";import u from"@babel/runtime/helpers/getPrototypeOf";import{i as s,d as l,U as c,g as f,x as h,h as p,c as v,e as y,L as d,P as m}from"./link-c7db7b65.js";function b(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return g(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return g(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function g(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var w=function t(e,r,n,i){if(s.object(e)){var a={};for(var o in e)a[o]=t(e[o],r[o],n,i);return a}return[i(e[0],r[0],n),e[1]]},O=function(t,e,r){return s.number(t)&&s.number(e)?t*(1-r)+e*r:r>.5?e:t},j=function(t,e,r){return O(t,e,(1-Math.cos(r*Math.PI))/2)},P=function(t,e,r){var n,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a={duration:i},o={},u=b(r);try{for(u.s();!(n=u.n()).done;){var s=n.value;"scale"==s?(a.scale={x:1,y:1},o.scale={x:1+(e.layout.width-t.layout.width)/t.layout.width,y:1+(e.layout.height-t.layout.height)/t.layout.height}):"translate"==s?(a.translate={x:0,y:0},o.translate={x:(e.layout.x-t.layout.x)*e.layout.parentWidth,y:(e.layout.y-t.layout.y)*e.layout.parentHeight}):(a[s]=t[s],o[s]=e[s])}}catch(t){u.e(t)}finally{u.f()}return new E(a,o)},x=Object.freeze({__proto__:null,interpolate:w,constant:function(t){return t},linear:O,ease:j,spring:function(t,e,r){return r=1-1*Math.exp(-3.6*r)*Math.cos(2.5*Math.pow(r,2)*Math.PI),O(t,e,r)},computeMorph:P}),A=function(){function t(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=r.reverse,a=void 0!==i&&i,o=r.repeat,u=void 0===o?1:o,s=r.delay,l=void 0===s?0:s,c=r.alternate,f=void 0!==c&&c;n(this,t),this.indices={},this.clip=e,this.t=0,this.T=e.duration*u+l,this.reverse=a,this.delay=l,this.alternate=f}return i(t,[{key:"getInterpolatedValue",value:function(t,e,r,n){if(s.function(e))e=l(e(r,this.clip.duration),t),e=c.toBase(e,t,n);else{t in this.indices||(this.indices[t]=this.reverse?e.length-1:0);var i,a=this.reverse?-1:1,o=this.indices[t],u=e[o],h=e[o+a],p=u.set;if(this.reverse?h.time>r:h.time<r){this.indices[t]=o+=a;var v=["start","end"],y=v[+!this.reverse],d=v[+this.reverse];y in u||d in h?(p=y in u?u[y]:h[d],i=!0):(u=e[o],h=e[o+a])}if(s.null(p)&&(p=f(n,t)),p=c.toBase(p,t,n),i)e=p;else{var m=s.null(h.set)?f(n,t):h.set;m=c.toBase(m,t,n);var b=x[h.interpolate||this.clip.interpolate]||j;e=w(p,m,(r-u.time)/(h.time-u.time),b)}}return e}},{key:"get",value:function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r={},n=this.t>=this.T;if(this.t<this.delay||e&&!n&&!s.visible(t))return r;var i=this.t-this.delay,a=this.clip.duration,o=this.alternate&&Math.floor(i/a)%2==+!n;for(var u in i=n?a:i%a,i=h(this.reverse,o)?a-i:i,r.origin=this.clip.origin,this.clip.properties)r[u]=this.getInterpolatedValue(u,this.clip.properties[u],i,t);return r}},{key:"step",value:function(t){var e=this.t>=this.T;return this.t+=t,e}}]),t}();function k(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var r,n=u(t);if(e){var i=u(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return o(this,r)}}var I=function(t){a(r,A);var e=k(r);function r(){var t;return n(this,r),(t=e.call(this,{duration:1/0,properties:{},origin:{x:.5,y:.5}})).isEmpty=!0,t.cache={},t}return i(r,[{key:"add",value:function(t,e){this.clip.properties[t]=e,this.isEmpty=!1}},{key:"getInterpolatedValue",value:function(t,e,r,n){s.null(e.internal.t)&&(e.internal.t=r),e.internal.t===r&&(this.cache[t]={});var i=e.internal.duration?Math.min((r-e.internal.t)/e.internal.duration,1):1,a=this.cache[t]||{};if(a.t===i)return a.value;var o=c.toBase(l(e(r,this.clip.duration),t),t,n),u=f(n,t);u=c.toBase(u,t,n);var h=w(u,o,i,O);return this.cache[t]={value:h,t:i},h}}]),r}(),S=["duration","delay","repeat","alternate","interpolate","origin"];function M(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(!t)return;if("string"==typeof t)return z(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return z(t,e)}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return o=t.done,t},e:function(t){u=!0,a=t},f:function(){try{o||null==r.return||r.return()}finally{if(u)throw a}}}}function z(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function B(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function C(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?B(Object(n),!0).forEach((function(r){e(t,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):B(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var E=function(){function e(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=i.duration,o=void 0===a?1:a,u=i.delay,l=i.repeat,c=i.alternate,f=i.interpolate,h=i.origin,p=void 0===h?{x:.5,y:.5}:h,v=r(i,S),d=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};n(this,e),this.duration=o,this.origin=y(p),this.channel=new I;var m=this.parse(v,d),b=t(m,2);this.properties=b[0],this.initials=b[1],this.isEmpty=s.empty(this.properties),this.interpolate=f,this.defaults={delay:u,repeat:l,alternate:c}}return i(e,[{key:"length",value:function(){return this.duration*(this.defaults.repeat||1)+(this.defaults.delay||0)}},{key:"parse",value:function(t,e){var r=this,n=function(n){var i=t[n];if(d.isInstance(i))return r.channel.add(n,i),delete t[n],"continue";if(s.function(i))return"continue";(i=s.array(i)?i:[i]).length<2?i.unshift(n in e?e[n]:null):s.null(i[0])||(e[n]=i[0]);for(var a=i.map((function(t){return r.sanitize(t,n)})),o=0;o<a.length;o++)r.quantize(a,o);t[n]=a};for(var i in t)n(i);for(var a in e=C({},e))e[a]=l(e[a],a);return[t,e]}},{key:"sanitize",value:function(t,e){s.object(t)||(t={set:t}),p(t,m)||(t={set:t}),"set"in t||(t.set="start"in t?t.start:t.end),"time"in t&&t.time>this.duration&&delete t.time,t=C({},t);var r,n=M(m);try{for(n.s();!(r=n.n()).done;){var i=r.value;i in t&&(t[i]=l(t[i],e))}}catch(t){n.e(t)}finally{n.f()}return t}},{key:"quantize",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e-1;if("time"in t[e])return t[e].time;if(0==e||e==t.length-1)return t[e].time=0==e?0:this.duration;var n=this.quantize(t,r,r);return t[e].time=n+(this.quantize(t,e+1,r)-n)*((e-r)/(e-r+1))}},{key:"play",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new A(this,v(t,this.defaults))}}]),e}(),R={create:function(e){var r=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.use=t.use.bind(t,e),t};return r.use=function(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e(r),i=t(n,2),a=i[0],o=i[1];return new E(a,o)},r},isInstance:function(t){return s.function(t)&&s.function(t.use)}};export{R as A,E as C,P as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import n from"@babel/runtime/helpers/typeof";import t from"@babel/runtime/helpers/slicedToArray";import r from"@babel/runtime/helpers/defineProperty";var e=["set","start","end"],o=["%","px","em","rem","vw","vh","vmin","vmax","deg","rad"],i={rotate:"deg",skew:"deg",scale:"%",clip:"%",opacity:null,zIndex:null,lineHeight:null,fontWeight:null,length:null,default:"px"},a=[["x","y"],["r","g","b","a"],["left","top","right","bottom"]],u={translate:{x:[0,"px"],y:[0,"px"]},scale:{x:[1,"%"],y:[1,"%"]},clip:{left:[0,"%"],top:[0,"%"],right:[0,"%"],bottom:[0,"%"]},r:[127,null],g:[127,null],b:[127,null],a:[255,null]},c=["translate","scale","skew","rotate"],l=["translate","scale","rotate","opacity","borderRadius","backgroundColor","color","zIndex","pointerEvents"],f={translate:function(n,t){return n+t},rotate:function(n,t){return n+t},scale:function(n,t){return n*t},default:function(n,t){return(n+t)/2}};function s(n,t){var r="undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(!r){if(Array.isArray(n)||(r=function(n,t){if(!n)return;if("string"==typeof n)return d(n,t);var r=Object.prototype.toString.call(n).slice(8,-1);"Object"===r&&n.constructor&&(r=n.constructor.name);if("Map"===r||"Set"===r)return Array.from(n);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return d(n,t)}(n))||t&&n&&"number"==typeof n.length){r&&(n=r);var e=0,o=function(){};return{s:o,n:function(){return e>=n.length?{done:!0}:{done:!1,value:n[e++]}},e:function(n){throw n},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(n)},n:function(){var n=r.next();return a=n.done,n},e:function(n){u=!0,i=n},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function d(n,t){(null==t||t>n.length)&&(t=n.length);for(var r=0,e=new Array(t);r<t;r++)e[r]=n[r];return e}var h=function(n,t){return n&&!t||!n&&t},y=function(n,t){return Object.keys(n).some((function(n){return t.includes(n)}))},b={null:function(n){return null==n},array:function(n){return Array.isArray(n)},object:function(t){return!b.null(t)&&"object"===n(t)&&!b.array(t)},function:function(n){return n instanceof Function},string:function(n){return"string"==typeof n},bool:function(n){return"boolean"==typeof n},number:function(n){return"number"==typeof n},empty:function(n){return function(n,t){return Object.keys(n).length===t}(n,0)},inViewport:function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=n.y,e=n.bottom,o=e-r;return{left:r>window.innerHeight+o*t,entered:r+o*t<window.innerHeight}},visible:function(n){var t=n.getBoundingClientRect(),r=t.x,e=t.y,o=t.right,i=t.bottom;return!(o-r<1||i-e<1)&&(e<window.innerHeight&&i>0&&r<window.innerWidth&&o>0)},rgb:function(n){return n.match(/^rgba?\(.*\)$/i)},hex:function(n){return n.match(/^#[0-9a-f]{3,8}$/i)},color:function(n){return b.object(n)&&"r"in n}},g=function(n){var t=new DOMMatrix(n),r=Math.sqrt(t.a*t.a+t.b*t.b)*Math.sign(t.a),e=Math.sqrt(t.c*t.c+t.d*t.d)*Math.sign(t.d),o=180*Math.atan2(t.d,t.c)/Math.PI-90,i=180*Math.atan2(t.b,t.a)/Math.PI;return{translate:{x:t.e,y:t.f},scale:{x:r,y:e},rotate:i,skew:{x:o,y:0}}},p=function(n,t){var r=getComputedStyle(n),e=g(r.transform);if(t in e)return I(e[t],t);var o=r[t];return b.rgb(o)?C(o):T(o)},v=function(n){var t,r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],e=getComputedStyle(n),o=n.getBoundingClientRect(),i=o.x,a=o.y,u=o.width,c=o.height,f=(r?n.parentElement:document.body).getBoundingClientRect(),d={layout:{x:i=(i-f.x+u/2)/f.width,y:a=(a-f.y+c/2)/f.height,width:u,height:c,parentWidth:f.width,parentHeight:f.height}},h=s(l);try{for(h.s();!(t=h.n()).done;){var y=t.value;d[y]=e[y]}}catch(n){h.e(n)}finally{h.f()}return Object.assign(d,g(e.transform)),d},m=function(n,t){return new Array(t).fill(0).map((function(t,r){return r<n.length?n[r]:n[n.length-1]}))},w=function(n,t){return n.filter((function(n){return!t.includes(n)}))},x=function(n,t){var r,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Object.keys(t),o=s(e);try{for(o.s();!(r=o.n()).done;){var i=r.value;b.null(t[i])||(n[i]=t[i])}}catch(n){o.e(n)}finally{o.f()}return n},j=function n(t,r,e){if(b.object(t)){var o={};for(var i in t)o[i]=n(t[i],r[i],e);return o}return b.number(t[0])&&b.number(r[0])?[e(t[0],r[0]),t[1]]:r},O=function(n,t){for(var r in t){var e=f[r]||f.default;n[r]=r in n?j(n[r],t[r],e):t[r]}},P=function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250;return function(){var r=Date.now();n.LivelyTimestamp-r<t||(n.LivelyTimestamp=r,n())}};function k(n,t){var r=Object.keys(n);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(n);t&&(e=e.filter((function(t){return Object.getOwnPropertyDescriptor(n,t).enumerable}))),r.push.apply(r,e)}return r}function A(n){for(var t=1;t<arguments.length;t++){var e=null!=arguments[t]?arguments[t]:{};t%2?k(Object(e),!0).forEach((function(t){r(n,t,e[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(e)):k(Object(e)).forEach((function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))}))}return n}function S(n,t){var r="undefined"!=typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(!r){if(Array.isArray(n)||(r=function(n,t){if(!n)return;if("string"==typeof n)return M(n,t);var r=Object.prototype.toString.call(n).slice(8,-1);"Object"===r&&n.constructor&&(r=n.constructor.name);if("Map"===r||"Set"===r)return Array.from(n);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return M(n,t)}(n))||t&&n&&"number"==typeof n.length){r&&(n=r);var e=0,o=function(){};return{s:o,n:function(){return e>=n.length?{done:!0}:{done:!1,value:n[e++]}},e:function(n){throw n},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,u=!1;return{s:function(){r=r.call(n)},n:function(){var n=r.next();return a=n.done,n},e:function(n){u=!0,i=n},f:function(){try{a||null==r.return||r.return()}finally{if(u)throw i}}}}function M(n,t){(null==t||t>n.length)&&(t=n.length);for(var r=0,e=new Array(t);r<t;r++)e[r]=n[r];return e}var I=function n(r,e){var o,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(b.null(r))return null;if("scale"!==e||i||b.object(r)||(r={x:r,y:r}),b.object(r)){var c,l=Object.keys(r),f=S(a);try{for(f.s();!(c=f.n()).done;){var s=c.value;if(y(r,s)){l=s;break}}}catch(n){f.e(n)}finally{f.f()}r=A({},r);var d,h=S(l);try{for(h.s();!(d=h.n()).done;){var g=d.value,p=e in u?u[e][g]:u[g];r[g]=g in r?n(r[g],e,!0):p}}catch(n){h.e(n)}finally{h.f()}return r}if(b.string(r)){if(b.hex(r))return D(r);if(b.rgb(r))return C(r);var v=T(r),m=t(v,2);r=m[0],"%"==(o=m[1])&&(r/=100)}return[r,o=b.number(r)?z.normalize(o,e):null]},D=function(n){var r=n.match(/^#([\da-f]{1,2})([\da-f]{1,2})([\da-f]{1,2})([\da-f]{2})?/i),e=t(r,5);e[0];var o=e[1],i=e[2],a=e[3],u=e[4],c=function(n){return[b.null(n)?255:parseInt(n.padStart(2,n),16),null]};return{r:c(o),g:c(i),b:c(a),a:c(u)}},C=function(n){var r=n.match(/^rgba?\((\d+)\D+(\d+)\D+(\d+)\D*(\d+)?\)/i),e=t(r,5);e[0];var o=e[1],i=e[2],a=e[3],u=e[4],c=function(n){return[b.null(n)?255:parseInt(n),null]};return{r:c(o),g:c(i),b:c(a),a:c(u)}},H=function(n,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Object.keys(n);return r.map((function(t){return W(n[t])})).join(t)},E=function(n){var t=b.object(n)?n:{},r=t.x,e=void 0===r?.5:r,o=t.y,i=void 0===o?.5:o;if(b.string(n))switch(n){case"left":e=0;break;case"right":e=1;break;case"top":i=0;break;case"bottom":i=1}return{x:e,y:i}},T=function(n){var t=n.toString().match(/^([\d.]+)([^\d.]*)$/i);return t?[parseFloat(t[1]),t[2]||null]:[n,null]},W=function(n){return("%"==n[1]?100*n[0]:n[0])+(b.null(n[1])?"":n[1])},z={emtopx:function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.body;return n*parseFloat(getComputedStyle(t).fontSize)},remtopx:function(n){return z.emtopx(n)},vwtopx:function(n){return n*window.innerWidth},vhtopx:function(n){return n*window.innerHeight},vmintopx:function(n){return n*Math.min(window.innerWidth,window.innerHeight)},vmaxtopx:function(n){return n*Math.max(window.innerWidth,window.innerHeight)},radtodeg:function(n){return 180*n/Math.PI},fromProperty:function(n){return n in i?i[n]:i.default},toBase:function(n,t,r){if(b.object(n)){var e={};for(var o in n)e[o]=z.toBase(n[o],t);return e}if(!b.number(n[0]))return n;var i=z.fromProperty(t);if(b.null(n[1])&&!b.null(i))return[n[0],i];var a=z["".concat(n[1],"to").concat(i)];return a?[a(n[0],r),i]:n},normalize:function(n,t){return o.includes(n)||b.null(n)&&t in i?n:z.fromProperty(t)}},B=function(n){return"inset(".concat(H(n," ",["top","right","bottom","left"]),")")},$={origin:["transformOrigin"],length:["strokeDashoffset"],clip:["clipPath","webkitClipPath"],transformOrigin:function(n){return"".concat(100*n.x,"% ").concat(100*n.y,"%")},strokeDashoffset:function(n){return 1-n[0]},clipPath:B,webkitClipPath:B},R={bind:function(n,t){n.origin=n.origin||n;var r=function(){for(var r,e=arguments.length,o=new Array(e),i=0;i<e;i++)o[i]=arguments[i];return(r=n.origin).call.apply(r,[t].concat(o))};return r.origin=n.origin,r},create:function(n){var t=R.bind((function(n){if(b.function(n)){var r=R.bind(t,{transform:n});return r.set=t.set,r.internal=t.internal,r}return this.transform(t.internal.value)}),{transform:function(n){return n}});return t.set=function(n){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;t.internal.value=n,t.internal.duration=r,t.internal.t=null},t.internal={value:n,duration:0},t},isInstance:function(n){return b.function(n)&&b.function(n.set)}},F=R;export{$ as A,u as D,F as L,f as M,e as P,c as T,z as U,j as a,W as b,x as c,I as d,E as e,v as f,p as g,y as h,b as i,l as j,O as m,H as o,m as p,w as s,P as t,h as x};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { AnimatableProps } from '../animatable';
|
|
3
|
-
import { Animation } from '../animations/animation';
|
|
4
|
-
|
|
5
|
-
interface AnimateProps extends AnimatableProps {
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* An array of `Animation` objects that defines what animation to apply to element depending on it's level.
|
|
9
|
-
*
|
|
10
|
-
* @default [Move, Pop]
|
|
11
|
-
*/
|
|
12
|
-
animations?: Animation[];
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* How many levels of `elements` to animate.
|
|
16
|
-
*
|
|
17
|
-
* @default 1
|
|
18
|
-
*/
|
|
19
|
-
levels?: number;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export class Animate extends React.Component<AnimateProps> {
|
|
23
|
-
|
|
24
|
-
private makeAnimatable;
|
|
25
|
-
|
|
26
|
-
play(animationName: string, { callback, reverse, immediate, cascade, groupAdjust, cascadeDelay, staggerDelay }?: {
|
|
27
|
-
callback?: Function;
|
|
28
|
-
reverse?: boolean;
|
|
29
|
-
immediate?: boolean;
|
|
30
|
-
cascade?: boolean;
|
|
31
|
-
groupAdjust?: number;
|
|
32
|
-
cascadeDelay?: number;
|
|
33
|
-
staggerDelay?: number;
|
|
34
|
-
}): Promise<void>;
|
|
35
|
-
|
|
36
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function useAnimation(initial: any): [object, Function];
|
package/types/morph.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
interface MorphProps {
|
|
4
|
-
active?: boolean;
|
|
5
|
-
group?: number;
|
|
6
|
-
useLayout?: boolean;
|
|
7
|
-
interpolate?: string;
|
|
8
|
-
duration?: number;
|
|
9
|
-
ignore?: string[];
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export class Morph extends React.Component<MorphProps> {
|
|
13
|
-
|
|
14
|
-
private static properties;
|
|
15
|
-
private static layoutProperties;
|
|
16
|
-
|
|
17
|
-
private layoutUpdate;
|
|
18
|
-
|
|
19
|
-
private update;
|
|
20
|
-
|
|
21
|
-
private setUniqueId;
|
|
22
|
-
|
|
23
|
-
private morph;
|
|
24
|
-
|
|
25
|
-
private createAnimations;
|
|
26
|
-
|
|
27
|
-
private createAnimation;
|
|
28
|
-
|
|
29
|
-
private createMorphAnimation;
|
|
30
|
-
|
|
31
|
-
private createUnmorphAnimation;
|
|
32
|
-
|
|
33
|
-
private getChildren;
|
|
34
|
-
|
|
35
|
-
}
|