@infinityfx/lively 1.0.1 → 2.0.0-beta.0
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-4affe044.js +1 -0
- package/dist/cjs/animation-41f6a9bd.js +1 -0
- package/dist/cjs/animations.js +1 -1
- package/dist/cjs/auto.js +1 -0
- package/dist/cjs/events-55caa68e.js +1 -0
- package/dist/cjs/hooks.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/link-f18a1432.js +1 -0
- package/dist/cjs/pop-2e6c3dc0.js +1 -0
- package/dist/cjs/scroll-8689a91d.js +1 -0
- package/dist/esm/animatable-af91d604.js +1 -0
- package/dist/esm/animation-0877248f.js +1 -0
- package/dist/esm/animations.js +1 -1
- package/dist/esm/auto.js +1 -0
- package/dist/esm/events-c52e8067.js +1 -0
- package/dist/esm/hooks.js +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/link-91bd8953.js +1 -0
- package/dist/esm/pop-7800e023.js +1 -0
- package/dist/esm/scroll-ec3d4643.js +1 -0
- package/package.json +8 -6
- package/types/animatable.d.ts +82 -7
- package/types/animate/animate.d.ts +17 -11
- package/types/animations/animation.d.ts +9 -0
- package/types/animations/fade.d.ts +9 -0
- package/types/animations/move.d.ts +19 -0
- package/types/animations/pop.d.ts +9 -0
- package/types/animations/scale.d.ts +19 -0
- package/types/animations/wipe.d.ts +19 -0
- package/types/animations.d.ts +8 -0
- package/types/globals.d.ts +109 -0
- package/types/hooks/animation.d.ts +1 -0
- package/types/hooks/scroll.d.ts +1 -0
- package/types/hooks/unmount.d.ts +10 -0
- package/types/hooks.d.ts +5 -0
- package/types/morph.d.ts +2 -2
- package/dist/cjs/animatable-415b0e20.js +0 -1
- package/dist/cjs/animate.js +0 -1
- package/dist/cjs/animation-c1347465.js +0 -1
- package/dist/cjs/helper-dfb168a5.js +0 -1
- package/dist/cjs/link-884ecbbe.js +0 -1
- package/dist/cjs/pop-241f383a.js +0 -1
- package/dist/cjs/scroll-fd4c118f.js +0 -1
- package/dist/esm/animatable-19e75c27.js +0 -1
- package/dist/esm/animate.js +0 -1
- package/dist/esm/animation-9ea0228d.js +0 -1
- package/dist/esm/helper-6ed90764.js +0 -1
- package/dist/esm/link-67981677.js +0 -1
- package/dist/esm/pop-ee3fdaef.js +0 -1
- package/dist/esm/scroll-84c1f46b.js +0 -1
|
@@ -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"),a=require("@babel/runtime/helpers/defineProperty"),o=require("react"),s=require("./animation-41f6a9bd.js"),l=require("./link-f18a1432.js"),u=require("./events-55caa68e.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),v=c(i),d=c(a);function m(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return g(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return g(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var b=function(){function e(){h.default(this,e),this.t=Date.now(),this.managers=[],this.step()}return f.default(e,[{key:"step",value:function(){var e,t=Date.now(),r=m(this.managers);try{for(r.s();!(e=r.n()).done;){e.value.step((t-this.t)/1e3)}}catch(e){r.e(e)}finally{r.f()}this.t=t,requestAnimationFrame(this.step.bind(this))}},{key:"add",value:function(e){this.managers.push(e)}},{key:"remove",value:function(e){this.managers.splice(this.managers.indexOf(e),1)}}],[{key:"get",value:function(){return window.Lively||(window.Lively=new e),window.Lively}}]),e}();function w(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return k(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return k(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var A=function(){function e(t){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];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,a=void 0===i||i;n&&this.clear(),a||!this.tracks.length?this.tracks.push(e):this.queue.push(e)}},{key:"remove",value:function(e){this.tracks.splice(this.tracks.indexOf(e),1),!this.tracks.length&&this.queue.length&&this.tracks.push(this.queue.shift())}},{key:"step",value:function(e){if(this.playing){for(var t=this.element.correction?{scale:l.DEFAULT_OBJECTS.scale}:{},r=this.tracks.length+ +!this.channel.isEmpty,n=0;n<r;n++){var i=this.tracks[n]||this.channel;l.mergeProperties(t,i.get(this.element,this.culling)),i.step(e)&&this.remove(i)}this.apply(this.element,t)}}},{key:"apply",value:function(e,t){if(!l.is.empty(t)){var r=[];for(var n in t){var i=t[n];if("scale"==n){if(this.layout){var a,o={x:[1/i.x[0],i.x[1]],y:[1/i.y[0],i.y[1]]},s=w(e.children);try{for(s.s();!(a=s.n()).done;){a.value.correction=o}}catch(e){s.e(e)}finally{s.f()}var u=t.borderRadius||e.cache.borderRadius;delete t.borderRadius,e.style.borderRadius="".concat(u[0]/i.x[0]).concat(u[1]," / ").concat(u[0]/i.y[0]).concat(u[1])}e.correction&&(i=l.merge(i,e.correction,l.MERGE_FUNCTIONS.scale))}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){d.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 E(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return E(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var x=function(){function e(t,r,n){h.default(this,e),this.targets=[],this.stagger=t,this.useCulling=r,this.useLayout=n,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.useCulling,t.useLayout)}))}},{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 L(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 C(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 C(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function C(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 I(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=v.default(e);if(t){var i=v.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return y.default(this,r)}}var M=function(e){p.default(r,e);var t=I(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 x(n.stagger,n.props.lazy,n.props.useLayout),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.resizeEventListener=l.debounce(this.update.bind(this)),u.addEventListener("resize",this.resizeEventListener),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("resize",this.resizeEventListener),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=L(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=L(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,a=r.composite,o=void 0!==a&&a,s=r.immediate,u=void 0!==s&&s,c=r.delay,h=void 0===c?0:c,f=r.callback,p=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!(!e||this.props.disabled||this.props.group>0&&!p)){l.is.string(e)||(e="default"),this.dispatch("onAnimationStart");var y,v=this.animations[e],d=v.length(),m=0,g=L(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+d},!0))}}catch(e){g.e(e)}finally{g.f()}return this.manager.play(v,{reverse:i,composite:o,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+d))),d+(i?m:h)}}},{key:"stop",value:function(){this.manager.clear()}},{key:"prerender",value:function(e){var t=this,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return o.Children.map(e,(function(e,a){if(!o.isValidElement(e))return e;var s={pathLength:1};if(n&&(s.ref=function(e){return t.elements[a]=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},l.mergeObjects(s,t.props,["animate","initial","animations","stagger"]),l.mergeObjects(s,e.props,["animate","initial","animations","stagger"])}return o.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}(o.Component);d.default(M,"events",["click","mouseenter","mouseleave","focus","blur"]),d.default(M,"defaultProps",{group:0,viewportMargin:.75,lazy:!0,paused:!1}),exports.Animatable=M;
|
|
@@ -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-f18a1432.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),v=l(i),y=l(a),d=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,origin:{x:0,y:0}},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,y:e.layout.y-t.layout.y}):(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}),x=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 v.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 v=s.is.null(l.set)?s.getProperty(n,t):l.set;v=s.Units.toBase(v,t,n);var y=S[l.interpolate||this.clip.interpolate]||w;e=O(c,v,(r-u.time)/(l.time-u.time),y)}}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 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=b.default(t);if(e){var i=b.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return d.default(this,r)}}var k=function(t){y.default(r,t);var e=I(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 v.default(r,[{key:"add",value:function(t,e){this.clip.properties[t]=e,this.isEmpty=!1}},{key:"getInterpolatedValue",value:function(t,e,r,n){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}(x),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,v=h.default(e,A),y=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 d=this.parse(v,y),b=c.default(d,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 v.default(t,[{key:"length",value:function(){return this.duration*(this.defaults.repeat||1)+(this.defaults.delay||0)}},{key:"parse",value:function(t,e){var r=this,n=function(n){var i=t[n];if(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 x(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-41f6a9bd.js"),r=require("@babel/runtime/helpers/defineProperty"),t=require("./pop-2e6c3dc0.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-f18a1432.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
ADDED
|
@@ -0,0 +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/inherits"),n=require("@babel/runtime/helpers/possibleConstructorReturn"),a=require("@babel/runtime/helpers/getPrototypeOf"),i=require("@babel/runtime/helpers/defineProperty"),l=require("react"),u=require("./animatable-4affe044.js"),o=require("./link-f18a1432.js"),s=require("./animation-41f6a9bd.js"),c=require("@babel/runtime/helpers/toConsumableArray"),p=require("./scroll-8689a91d.js");function f(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("./events-55caa68e.js"),require("@babel/runtime/helpers/typeof"),require("@babel/runtime/helpers/slicedToArray"),require("@babel/runtime/helpers/objectWithoutProperties");var d=f(e),h=f(t),m=f(r),y=f(n),b=f(a),v=f(i),g=f(l),q=f(c);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=b.default(e);if(t){var a=b.default(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return y.default(this,r)}}var k=function(e){m.default(r,e);var t=P(r);function r(e){var n;return d.default(this,r),(n=t.call(this,e)).children=[],n.properties=o.subArray(n.props.include,n.props.ignore),n}return h.default(r,[{key:"getSnapshotBeforeUpdate",value:function(){return this.children.map((function(e){var t=null==e?void 0:e.elements[0];return t?{data:o.getSnapshot(t),key:e.props.layoutKey}:null}))}},{key:"componentDidUpdate",value:function(e,t,r){for(var n=0,a=0;a<r.length;a++){var i=this.children[n];if(i&&i.elements[0]){var l=r[a];if(l&&i.props.layoutKey===l.key){var u=o.getSnapshot(i.elements[0]);i.manager.play(s.computeMorph(u,l.data,this.properties),{composite:!0}),n++}}else n++}}},{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 E(e){var t=e.children,r=e.className,n=e.style,a=e.duration;if(!o.is.string(t))return t;var i=t.split("");return g.default.createElement("div",{className:r,style:n},g.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:(a-.8)/(i.length-1)},i.map((function(e,t){return g.default.createElement("span",{style:{display:"inline-block"},key:t},/\s/.test(e)?" ":e)}))))}function x(e){var t,r=e.children,n=e.color,a=e.duration,i=(null===(t=r.props)||void 0===t?void 0:t.children)||[];Array.isArray(i)||(i=[i]);var o=[g.default.createElement(u.Animatable,{key:0,initial:{clip:{right:0}},animate:{clip:{left:1},duration:a/2}},g.default.createElement("div",{style:{position:"absolute",inset:0,backgroundColor:n}}))].concat(q.default(i));return g.default.createElement(u.Animatable,{whileViewport:!0,animate:{clip:{right:0},duration:a/2},initial:{clip:{right:1}}},l.cloneElement(r,{},o))}function R(e){var t,r=e.children,n=e.amount,a=p.useScroll(),i=l.useRef();return g.default.createElement(u.Animatable,{ref:i,animate:{translate:a((function(e){if(void 0===t){var r,a=null===(r=i.current)||void 0===r?void 0:r.elements[0];a&&(t=Math.max(a.getBoundingClientRect().y+window.scrollY-window.innerHeight/2,0))}return{x:0,y:(e-(t||0))*n}}))}},r)}v.default(k,"defaultProps",{include:o.MORPH_PROPERTIES,ignore:[]}),E.defaultProps={style:{},className:"",duration:1.6},x.defaultProps={color:"grey",duration:1.6},R.defaultProps={amount:.5},exports.ColorWipe=x,exports.LayoutGroup=k,exports.Parallax=R,exports.WriteOn=E;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var n=require("./link-f18a1432.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-f18a1432.js"),n=require("./scroll-8689a91d.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-55caa68e.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,a=n.current.getPointAtLength(i),o=a.x,c=a.y;return{x:e[0]+o*t,y:e[1]+c*t}}),[n]);return[u,n]},exports.useReducedMotion=function(){var e=r.useState(!1),t=i.default(e,2),n=t[0],u=t[1],a=function(e){return u(e.matches)};return r.useEffect((function(){var e=matchMedia("(prefers-reduced-motion: reduce)");return e.addEventListener("change",a),u(e.matches),function(){return e.removeEventListener("change",a)}}),[]),n},exports.useUnmount=function(e){var t=r.useState(e),n=i.default(t,2),u=n[0],a=n[1],o=r.useRef();return[u,function(){if(!u)return a(!0);o.current.play(o.current.props.onUnmount,{reverse:!0,immediate:!0,callback:function(){return a(!1)}})},o]};
|
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-4affe044.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-2e6c3dc0.js"),f=require("./link-f18a1432.js");function p(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("./animation-41f6a9bd.js"),require("@babel/runtime/helpers/slicedToArray"),require("./events-55caa68e.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"],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 y(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 y(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 y(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 b=function(t,n){return Object.keys(t).some((function(t){return n.includes(t)}))},h={null:function(t){return null==t},array:function(t){return Array.isArray(t)},object:function(t){return!h.null(t)&&"object"===o.default(t)&&!h.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 h.object(t)&&"r"in t}},v=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}}},g=function t(n,r,e){if(h.object(n)){var o={};for(var i in n)o[i]=t(n[i],r[i],e);return o}return h.number(n[0])&&h.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(h.null(n))return null;if("scale"!==r||o||h.object(n)||(n={x:n,y:n}),h.object(n)){var u,a=Object.keys(n),l=w(c);try{for(l.s();!(u=l.n()).done;){var s=u.value;if(b(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 y=p.value,v=r in f?f[r][y]:f[y];n[y]=y in n?t(n[y],r,!0):v}}catch(t){d.e(t)}finally{d.f()}return n}if(h.string(n)){if(h.hex(n))return S(n);if(h.rgb(n))return P(n);var g=k(n),m=i.default(g,2);n=m[0],"%"==(e=m[1])&&(n/=100)}return[n,e=h.number(n)?T.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[h.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[h.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 M(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]},M=function(t){return("%"==t[1]?100*t[0]:t[0])+(h.null(t[1])?"":t[1])},T={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 T.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(h.object(t)){var e={};for(var o in t)e[o]=T.toBase(t[o],n);return e}if(!h.number(t[0]))return t;var i=T.fromProperty(n);if(h.null(t[1])&&!h.null(i))return[t[0],i];var u=T["".concat(t[1],"to").concat(i)];return u?[u(t[0],r),i]:t},normalize:function(t,n){return a.includes(t)||h.null(t)&&n in l?t:T.fromProperty(n)}},I=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:I,webkitClipPath:I},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(h.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 h.function(t)&&h.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=T,exports.arrToStyle=M,exports.convert=j,exports.debounce=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250;return function(){clearTimeout(t.LivelyTimeout),t.LivelyTimeout=setTimeout(t,n)}},exports.getProperty=function(t,n){var r=getComputedStyle(t),e=v(r.transform);if(n in e)return j(e[n],n);var o=r[n];return h.rgb(o)?P(o):k(o)},exports.getSnapshot=function(t){var n,r=t.getBoundingClientRect(),e=r.x,o=r.y,i=r.width,u=r.height,a=getComputedStyle(t),l={layout:{x:e,y:o,width:i,height:u}},c=d(s);try{for(c.s();!(n=c.n()).done;){var f=n.value;l[f]=a[f]}}catch(t){c.e(t)}finally{c.f()}return Object.assign(l,v(a.transform)),l},exports.hasSomeKey=b,exports.is=h,exports.merge=g,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;h.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?g(t[r],n[r],e):n[r]}},exports.objToStr=A,exports.originToStr=function(t){var n=h.object(t)?t:{},r=n.x,e=void 0===r?.5:r,o=n.y,i=void 0===o?.5:o;if(h.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/objectWithoutProperties"),r=require("./animation-41f6a9bd.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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var e=require("react"),r=require("./link-f18a1432.js"),n=require("./events-55caa68e.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 e from"@babel/runtime/helpers/classCallCheck";import t 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 a from"@babel/runtime/helpers/defineProperty";import{Children as o,isValidElement as s,cloneElement as l,Component as u}from"react";import{A as c,C as h}from"./animation-0877248f.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,d as A,t as j,c as O}from"./link-91bd8953.js";import{a as S,o as x,r as E,b as L}from"./events-c52e8067.js";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 a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function M(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var C=function(){function r(){e(this,r),this.t=Date.now(),this.managers=[],this.step()}return t(r,[{key:"step",value:function(){var e,t=Date.now(),r=I(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){this.managers.push(e)}},{key:"remove",value:function(e){this.managers.splice(this.managers.indexOf(e),1)}}],[{key:"get",value:function(){return window.Lively||(window.Lively=new r),window.Lively}}]),r}();function R(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 V(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 V(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function V(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 P=function(){function r(t){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];e(this,r),this.element=t,this.tracks=[],this.queue=[],this.playing=!0,this.culling=n,this.layout=i}return t(r,[{key:"purge",value:function(){if(!("cache"in this.element)){this.element.cache={strokeDasharray:1,borderRadius:f(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,a=void 0===i||i;n&&this.clear(),a||!this.tracks.length?this.tracks.push(e):this.queue.push(e)}},{key:"remove",value:function(e){this.tracks.splice(this.tracks.indexOf(e),1),!this.tracks.length&&this.queue.length&&this.tracks.push(this.queue.shift())}},{key:"step",value:function(e){if(this.playing){for(var t=this.element.correction?{scale:p.scale}:{},r=this.tracks.length+ +!this.channel.isEmpty,n=0;n<r;n++){var i=this.tracks[n]||this.channel;y(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(!m.empty(t)){var r=[];for(var n in t){var i=t[n];if("scale"==n){if(this.layout){var a,o={x:[1/i.x[0],i.x[1]],y:[1/i.y[0],i.y[1]]},s=R(e.children);try{for(s.s();!(a=s.n()).done;){a.value.correction=o}}catch(e){s.e(e)}finally{s.f()}var l=t.borderRadius||e.cache.borderRadius;delete t.borderRadius,e.style.borderRadius="".concat(l[0]/i.x[0]).concat(l[1]," / ").concat(l[0]/i.y[0]).concat(l[1])}e.correction&&(i=v(i,e.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=R(w[n]||[n]);try{for(c.s();!(u=c.n()).done;){var h=u.value;m.color(i)?e.style[h]="rgba(".concat(i.r[0],", ").concat(i.g[0],", ").concat(i.b[0],", ").concat(i.a[0],")"):e.style[h]=h in w?w[h](i):b(i)}}catch(e){c.e(e)}finally{c.f()}}}r.length&&(e.style.transform=r.join(" "))}}},{key:"initialize",value:function(e){this.apply(this.element,e.initials),this.channel=e.channel}}]),r}();function z(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 D(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?z(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):z(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function B(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 T(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 T(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function T(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 U=function(){function r(t,n,i){e(this,r),this.targets=[],this.stagger=t,this.useCulling=n,this.useLayout=i,this.paused=!1}return t(r,[{key:"register",value:function(){C.get().add(this)}},{key:"destroy",value:function(){this.targets=[],C.get().remove(this)}},{key:"purge",value:function(){var e,t=B(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=B(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 P(e,t.useCulling,t.useLayout)}))}},{key:"play",value:function(e,t){if(!e.isEmpty)for(var r=0;r<this.targets.length;r++){var n=D(D({},t),{},{delay:(t.delay||0)+r*this.stagger});this.targets[r].add(e.play(n),n)}}},{key:"initialize",value:function(e){var t,r=B(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=B(this.targets);try{for(r.s();!(t=r.n()).done;){t.value.step(e)}}catch(e){r.e(e)}finally{r.f()}}}}]),r}();function q(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return $(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return $(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function $(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 F(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,a=i(e);if(t){var o=i(this).constructor;r=Reflect.construct(a,arguments,o)}else r=a.apply(this,arguments);return n(this,r)}}var H=function(n){r(a,u);var i=F(a);function a(t){var r;for(var n in e(this,a),(r=i.call(this,t)).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(r.stagger,r.props.lazy,r.props.useLayout),r}return t(a,[{key:"parse",value:function(e){return c.isInstance(e)?e.use():m.object(e)?new h(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.resizeEventListener=A(this.update.bind(this)),S("resize",this.resizeEventListener),this.scrollEventListener=j(this.onScroll.bind(this)),S("scroll",this.scrollEventListener),this.eventListener=this.onEvent.bind(this),x(a.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(){E("resize",this.resizeEventListener),E("scroll",this.scrollEventListener),L(a.events,this.elements,this.eventListener),this.manager.destroy()}},{key:"componentDidUpdate",value:function(){this.manager.paused=this.props.paused;var e,t=q(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){m.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=q(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=m.inViewport(this.getBoundingBox(),this.props.viewportMargin),t=e.entered,r=e.left;t&&!this.inViewport&&(this.inViewport=!0,this.play(this.props.whileViewport),this.dispatch("onEnterViewport")),r&&this.inViewport&&(this.inViewport=!1,this.play(this.props.whileViewport,{reverse:!0,immediate:!0}),this.dispatch("onLeaveViewport"))}}},{key:"play",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.reverse,i=void 0!==n&&n,a=r.composite,o=void 0!==a&&a,s=r.immediate,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(!(!e||this.props.disabled||this.props.group>0&&!f)){m.string(e)||(e="default"),this.dispatch("onAnimationStart");var p,y=this.animations[e],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(e,{reverse:i,immediate:l,delay:c+v},!0))}}catch(e){g.e(e)}finally{g.f()}return this.manager.play(y,{reverse:i,composite:o,immediate:l,delay:i?d:c}),l&&clearTimeout(this.timeout),this.props.group||(this.timeout=setTimeout((function(){t.dispatch("onAnimationEnd"),m.function(h)&&h()}),1e3*(d+v))),v+(i?d:c)}}},{key:"stop",value:function(){this.manager.clear()}},{key:"prerender",value:function(e){var t=this,r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return o.map(e,(function(e,i){if(!s(e))return e;var o={pathLength:1};if(r&&(o.ref=function(e){return t.elements[i]=e}),a.isInstance(e)&&n&&!e.props.noCascade){var u=t.childIndex++;n=!1,o.group=t.props.group+1,o.ref=function(e){return t.children[u]=e},O(o,t.props,["animate","initial","animations","stagger"]),O(o,e.props,["animate","initial","animations","stagger"])}return l(e,o,t.prerender(e.props.children,!1,n))}))}},{key:"render",value:function(){return this.childIndex=0,this.prerender(this.props.children)}}],[{key:"isInstance",value:function(e){return e.type===a||e.type.prototype instanceof a}}]),a}();a(H,"events",["click","mouseenter","mouseleave","focus","blur"]),a(H,"defaultProps",{group:0,viewportMargin:.75,lazy:!0,paused:!1});export{H 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,x as h,h as p,c as v,f as y,L as d,P as m}from"./link-91bd8953.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)},x=function(t,e,r){var n,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,a={duration:i,origin:{x:0,y:0}},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,y:e.layout.y-t.layout.y}):(a[s]=t[s],o[s]=e[s])}}catch(t){u.e(t)}finally{u.f()}return new E(a,o)},P=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:x}),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=P[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,x as c};
|
package/dist/esm/animations.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{A as e}from"./animation-0877248f.js";export{A as Animation}from"./animation-0877248f.js";import r from"@babel/runtime/helpers/defineProperty";export{M as Move,P as Pop}from"./pop-7800e023.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-91bd8953.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
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"@babel/runtime/helpers/classCallCheck";import t 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 a,{Children as l,isValidElement as s,cloneElement as u,Component as c,useRef as p}from"react";import{A as m}from"./animatable-af91d604.js";import{s as f,j as d,k as h,i as y}from"./link-91bd8953.js";import{c as v}from"./animation-0877248f.js";import b from"@babel/runtime/helpers/toConsumableArray";import{u as g}from"./scroll-ec3d4643.js";import"./events-c52e8067.js";import"@babel/runtime/helpers/typeof";import"@babel/runtime/helpers/slicedToArray";import"@babel/runtime/helpers/objectWithoutProperties";function k(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,o=i(e);if(t){var a=i(this).constructor;r=Reflect.construct(o,arguments,a)}else r=o.apply(this,arguments);return n(this,r)}}var w=function(n){r(o,c);var i=k(o);function o(t){var r;return e(this,o),(r=i.call(this,t)).children=[],r.properties=f(r.props.include,r.props.ignore),r}return t(o,[{key:"getSnapshotBeforeUpdate",value:function(){return this.children.map((function(e){var t=null==e?void 0:e.elements[0];return t?{data:d(t),key:e.props.layoutKey}:null}))}},{key:"componentDidUpdate",value:function(e,t,r){for(var n=0,i=0;i<r.length;i++){var o=this.children[n];if(o&&o.elements[0]){var a=r[i];if(a&&o.props.layoutKey===a.key){var l=d(o.elements[0]);o.manager.play(v(l,a.data,this.properties),{composite:!0}),n++}}else n++}}},{key:"render",value:function(){var e=this;return this.childIndex=0,l.map(this.props.children,(function(t){if(!s(t)||!m.isInstance(t))return t;var r=e.childIndex++;return u(t,{ref:function(t){return e.children[r]=t},layoutKey:t.key})}))}}]),o}();function P(e){var t=e.children,r=e.className,n=e.style,i=e.duration;if(!y.string(t))return t;var o=t.split("");return a.createElement("div",{className:r,style:n},a.createElement(m,{whileViewport:!0,animate:{opacity:1,translate:{y:0},rotate:0,duration:.8},initial:{opacity:0,translate:{y:"100%"},rotate:10},stagger:(i-.8)/(o.length-1)},o.map((function(e,t){return a.createElement("span",{style:{display:"inline-block"},key:t},/\s/.test(e)?" ":e)}))))}function j(e){var t,r=e.children,n=e.color,i=e.duration,o=(null===(t=r.props)||void 0===t?void 0:t.children)||[];Array.isArray(o)||(o=[o]);var l=[a.createElement(m,{key:0,initial:{clip:{right:0}},animate:{clip:{left:1},duration:i/2}},a.createElement("div",{style:{position:"absolute",inset:0,backgroundColor:n}}))].concat(b(o));return a.createElement(m,{whileViewport:!0,animate:{clip:{right:0},duration:i/2},initial:{clip:{right:1}}},u(r,{},l))}function C(e){var t,r=e.children,n=e.amount,i=g(),o=p();return a.createElement(m,{ref:o,animate:{translate:i((function(e){if(void 0===t){var r,i=null===(r=o.current)||void 0===r?void 0:r.elements[0];i&&(t=Math.max(i.getBoundingClientRect().y+window.scrollY-window.innerHeight/2,0))}return{x:0,y:(e-(t||0))*n}}))}},r)}o(w,"defaultProps",{include:h,ignore:[]}),P.defaultProps={style:{},className:"",duration:1.6},j.defaultProps={color:"grey",duration:1.6},C.defaultProps={amount:.5};export{j as ColorWipe,w as LayoutGroup,C as Parallax,P as WriteOn};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as n}from"./link-91bd8953.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 e from"@babel/runtime/helpers/slicedToArray";import{useState as r,useRef as t,useCallback as n,useEffect as o}from"react";import{L as i}from"./link-91bd8953.js";export{u as useScroll}from"./scroll-ec3d4643.js";import"@babel/runtime/helpers/typeof";import"@babel/runtime/helpers/defineProperty";import"./events-c52e8067.js";function c(n){var o=r(n),u=e(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(e){var r=i.create(e);return[r,r.set]}function m(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[0,0],r=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:e[0]+c*r,y:e[1]+a*r}}),[o]);return[u,o]}function s(){var t=r(!1),n=e(t,2),u=n[0],i=n[1],c=function(e){return i(e.matches)};return o((function(){var e=matchMedia("(prefers-reduced-motion: reduce)");return e.addEventListener("change",c),i(e.matches),function(){return e.removeEventListener("change",c)}}),[]),u}export{a as useLink,m as usePath,s as useReducedMotion,c as useUnmount};
|
package/dist/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as
|
|
1
|
+
import{A as e}from"./animatable-af91d604.js";export{A as Animatable}from"./animatable-af91d604.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-7800e023.js";import{p as v}from"./link-91bd8953.js";import"./animation-0877248f.js";import"@babel/runtime/helpers/slicedToArray";import"./events-c52e8067.js";import"@babel/runtime/helpers/typeof";var y=["levels","animations"];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){s(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 d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=l(e);if(t){var 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=d(s);function s(e){var t;return n(this,s),(t=l.call(this,e)).levels=t.props.levels,t.animations=v(t.props.animations,t.levels),t}return 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,j({},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","skew","rotate"],l=["translate","scale","rotate","opacity","borderRadius","backgroundColor","color"],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 y=function(n,t){return n&&!t||!n&&t},h=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}},v=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}}},m=function(n,t){var r=getComputedStyle(n),e=v(r.transform);if(t in e)return D(e[t],t);var o=r[t];return b.rgb(o)?T(o):W(o)},p=function(n){var t,r=n.getBoundingClientRect(),e=r.x,o=r.y,i=r.width,a=r.height,u=getComputedStyle(n),c={layout:{x:e,y:o,width:i,height:a}},f=s(l);try{for(f.s();!(t=f.n()).done;){var d=t.value;c[d]=u[d]}}catch(n){f.e(n)}finally{f.f()}return Object.assign(c,v(u.transform)),c},g=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(){clearTimeout(n.LivelyTimeout),n.LivelyTimeout=setTimeout(n,t)}},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(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=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 v=d.value,m=e in u?u[e][v]:u[v];r[v]=v in r?n(r[v],e,!0):m}}catch(n){y.e(n)}finally{y.f()}return r}if(b.string(r)){if(b.hex(r))return C(r);if(b.rgb(r))return T(r);var p=W(r),g=t(p,2);r=g[0],"%"==(o=g[1])&&(r/=100)}return[r,o=b.number(r)?z.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[b.null(n)?255:parseInt(n.padStart(2,n),16),null]};return{r:c(o),g:c(i),b:c(a),a:c(u)}},T=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 $(n[t])})).join(t)},L=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}},W=function(n){var t=n.toString().match(/^([\d.]+)([^\d.]*)$/i);return t?[parseFloat(t[1]),t[2]||null]:[n,null]},$=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"]),")")},E={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},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(b.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 b.function(n)&&b.function(n.set)}},R=F;export{E as A,u as D,R as L,f as M,e as P,c as T,z as U,j as a,$ as b,x as c,P as d,D as e,L as f,m as g,h,b as i,p as j,l as k,O as m,H as o,g as p,w as s,k as t,y as x};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/objectWithoutProperties";import{A as t}from"./animation-0877248f.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useEffect as r}from"react";import{L as t}from"./link-91bd8953.js";import{a as n,r as o}from"./events-c52e8067.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": "
|
|
3
|
+
"version": "2.0.0-beta.0",
|
|
4
4
|
"description": "Feature complete, lightweight react animation library.",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -19,15 +19,17 @@
|
|
|
19
19
|
"import": "./dist/esm/hooks.js",
|
|
20
20
|
"require": "./dist/cjs/hooks.js"
|
|
21
21
|
},
|
|
22
|
-
"./
|
|
23
|
-
"import": "./dist/esm/
|
|
24
|
-
"require": "./dist/cjs/
|
|
25
|
-
"types": "./types/
|
|
22
|
+
"./auto": {
|
|
23
|
+
"import": "./dist/esm/auto.js",
|
|
24
|
+
"require": "./dist/cjs/auto.js",
|
|
25
|
+
"types": "./types/auto.d.ts"
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"typesVersions": {
|
|
29
29
|
"*": {
|
|
30
|
-
"
|
|
30
|
+
"animations": ["./types/animations.d.ts"],
|
|
31
|
+
"hooks": ["./types/hooks.d.ts"],
|
|
32
|
+
"auto": ["./types/auto.d.ts"]
|
|
31
33
|
}
|
|
32
34
|
},
|
|
33
35
|
"repository": "infinityfx-llc/lively",
|
package/types/animatable.d.ts
CHANGED
|
@@ -1,25 +1,100 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { AnimationInitials, AnimationProperties } from './globals';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
interface AnimatableProps {
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* How much to delay each subsequent `element` or `<Animatable>` component of the parent `<Animatable>` component, when animating it, in seconds.
|
|
8
|
+
*
|
|
9
|
+
* @default 0.1
|
|
10
|
+
*/
|
|
4
11
|
stagger?: number;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Percentage of `element` that needs to enter or leave the viewport (`window`) to trigger viewport based animations.
|
|
15
|
+
*
|
|
16
|
+
* @default 0.75
|
|
17
|
+
*/
|
|
5
18
|
viewportMargin?: number;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Define a default animation.
|
|
22
|
+
*/
|
|
23
|
+
animate?: AnimationProperties;
|
|
24
|
+
|
|
25
|
+
initial?: AnimationInitials;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Define animations as key-value pairs, where the key is the animation name.
|
|
29
|
+
*/
|
|
30
|
+
animations?: {
|
|
31
|
+
[key: string]: AnimationProperties;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Whether to prevent cascading of an animation to child `<Animatable>` components.
|
|
36
|
+
*
|
|
37
|
+
* @default false
|
|
38
|
+
*/
|
|
9
39
|
noCascade?: boolean;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Play either the default or the defined animation when the component mounts.
|
|
43
|
+
*
|
|
44
|
+
* @default false
|
|
45
|
+
*/
|
|
10
46
|
onMount?: string | boolean;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Play either the default or the defined animation reversed when the component unmounts.
|
|
50
|
+
*
|
|
51
|
+
* Note: this only works in combination with the `useUnmount`.
|
|
52
|
+
*
|
|
53
|
+
* @default false
|
|
54
|
+
*/
|
|
11
55
|
onUnmount?: string | boolean;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Play either the default or the defined animation when any child `element` is clicked.
|
|
59
|
+
*
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
12
62
|
onClick?: string | boolean;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Play either the default or the defined animation (reversed when leaving) when any child `element` enters or leaves the viewport.
|
|
66
|
+
*
|
|
67
|
+
* @default false
|
|
68
|
+
*/
|
|
13
69
|
whileViewport?: string | boolean;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Play either the default or the defined animation (reversed when leaving) when the mouse enters or leaves any child `element`.
|
|
73
|
+
*
|
|
74
|
+
* @default false
|
|
75
|
+
*/
|
|
14
76
|
whileHover?: string | boolean;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Play either the default or the defined animation (reversed when losing) when any child `element` gains or looses focus.
|
|
80
|
+
*
|
|
81
|
+
* @default false
|
|
82
|
+
*/
|
|
15
83
|
whileFocus?: string | boolean;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Controls the order in which the component animates when part of a cascading animation.
|
|
87
|
+
*/
|
|
88
|
+
group?: number;
|
|
16
89
|
}
|
|
17
90
|
|
|
18
|
-
export class Animatable extends React.Component<
|
|
91
|
+
export class Animatable extends React.Component<AnimatableProps> {
|
|
19
92
|
|
|
20
|
-
private
|
|
93
|
+
private parse;
|
|
94
|
+
|
|
95
|
+
private style;
|
|
21
96
|
|
|
22
|
-
private
|
|
97
|
+
private update;
|
|
23
98
|
|
|
24
99
|
private inViewport;
|
|
25
100
|
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { AnimatableProps } from '../animatable';
|
|
3
|
+
import { Animation } from '../animations/animation';
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
+
*/
|
|
13
19
|
levels?: number;
|
|
14
20
|
}
|
|
15
21
|
|
|
16
|
-
export class Animate extends React.Component<
|
|
22
|
+
export class Animate extends React.Component<AnimateProps> {
|
|
17
23
|
|
|
18
24
|
private makeAnimatable;
|
|
19
25
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AnimationProperties } from '../globals';
|
|
2
|
+
import { Animation } from './animation';
|
|
3
|
+
|
|
4
|
+
interface MoveOptions extends AnimationProperties {
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The direction to move the `element` to.
|
|
8
|
+
*
|
|
9
|
+
* @default "up"
|
|
10
|
+
*/
|
|
11
|
+
direction: 'up' | 'left' | 'down' | 'right';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Move and simultaneously fade the `element` along an axis over a duration of 0.5 seconds.
|
|
16
|
+
*
|
|
17
|
+
* @type {Animation}
|
|
18
|
+
*/
|
|
19
|
+
export function Move(options: MoveOptions): this
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { AnimationProperties } from '../globals';
|
|
2
|
+
import { Animation } from './animation';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Slightly scale and fade the `element` over a duration of 0.25 seconds.
|
|
6
|
+
*
|
|
7
|
+
* @type {Animation}
|
|
8
|
+
*/
|
|
9
|
+
export function Pop(options: AnimationProperties): this;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AnimationProperties } from '../globals';
|
|
2
|
+
import { Animation } from './animation';
|
|
3
|
+
|
|
4
|
+
interface ScaleOptions extends AnimationProperties {
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The direction to scale the `element` up to.
|
|
8
|
+
*
|
|
9
|
+
* @default "right"
|
|
10
|
+
*/
|
|
11
|
+
direction: 'up' | 'left' | 'down' | 'right';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Scale the `element` along an axis over a duration of 0.6 seconds.
|
|
16
|
+
*
|
|
17
|
+
* @type {Animation}
|
|
18
|
+
*/
|
|
19
|
+
export function Scale(options: ScaleOptions): this;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Animation } from './animation';
|
|
2
|
+
import { AnimationProperties } from '../globals';
|
|
3
|
+
|
|
4
|
+
interface WipeOptions extends AnimationProperties {
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The direction to wipe the `element` to.
|
|
8
|
+
*
|
|
9
|
+
* @default "right"
|
|
10
|
+
*/
|
|
11
|
+
direction: 'up' | 'left' | 'down' | 'right';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Wipe the `element` along an axis over a duration of 1 seconds.
|
|
16
|
+
*
|
|
17
|
+
* @type {Animation}
|
|
18
|
+
*/
|
|
19
|
+
export function Wipe(options: WipeOptions): this;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export as namespace Animations;
|
|
2
|
+
|
|
3
|
+
export { Fade } from './animations/fade';
|
|
4
|
+
export { Move } from './animations/move';
|
|
5
|
+
export { Pop } from './animations/pop';
|
|
6
|
+
export { Scale } from './animations/scale';
|
|
7
|
+
export { Wipe } from './animations/wipe';
|
|
8
|
+
export { Animation } from './animations/animation';
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
type PositionProperty = { x?: number; y?: number; } | string;
|
|
4
|
+
|
|
5
|
+
type ScaleProperty = { x?: number; y?: number; } | string | number;
|
|
6
|
+
|
|
7
|
+
type ClipProperty = {
|
|
8
|
+
left?: number | string;
|
|
9
|
+
top?: number | string;
|
|
10
|
+
right?: number | string;
|
|
11
|
+
bottom?: number | string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface AnimationInitials extends React.CSSProperties {
|
|
15
|
+
/**
|
|
16
|
+
* Define the position of an `element` relative to initial rendered position.
|
|
17
|
+
*
|
|
18
|
+
* @default { x: 0, y: 0 }
|
|
19
|
+
*/
|
|
20
|
+
position?: PositionProperty;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* @default { x: 1, y: 1 }
|
|
24
|
+
*/
|
|
25
|
+
scale?: ScaleProperty;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* @default 0
|
|
29
|
+
*/
|
|
30
|
+
rotation?: number;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @default { left: 0, top: 0, right: 0, bottom: 0 }
|
|
34
|
+
*/
|
|
35
|
+
clip?: ClipProperty;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Whether to render the `element`.
|
|
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.
|
|
55
|
+
*
|
|
56
|
+
* @default 1
|
|
57
|
+
*/
|
|
58
|
+
strokeLength?: number;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface AnimationProperties extends AnimationInitials {
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Delay of the animation in seconds.
|
|
65
|
+
*
|
|
66
|
+
* @default 0
|
|
67
|
+
*/
|
|
68
|
+
delay?: number;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Duration of animation in seconds.
|
|
72
|
+
*
|
|
73
|
+
* @default 1
|
|
74
|
+
*/
|
|
75
|
+
duration?: number;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Number of times to repeat the animation.
|
|
79
|
+
*
|
|
80
|
+
* Accepts `Infinity` as a value to loop the animation indefinitely.
|
|
81
|
+
*
|
|
82
|
+
* @default 1
|
|
83
|
+
*/
|
|
84
|
+
repeat?: number;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Whether to alternate the animation direction (reversed) on repeats.
|
|
88
|
+
*
|
|
89
|
+
* @default false
|
|
90
|
+
*/
|
|
91
|
+
alternate?: boolean;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Interpolation method used between keyframes.
|
|
95
|
+
*
|
|
96
|
+
* @default "ease"
|
|
97
|
+
*/
|
|
98
|
+
interpolate?: 'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear' | 'step-start' | 'step-end' | 'spring';
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @default { x: 0.5, y: 0.5 }
|
|
102
|
+
*/
|
|
103
|
+
origin?: string | { x?: number, y?: number } | number;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* @default false
|
|
107
|
+
*/
|
|
108
|
+
useLayout?: boolean;
|
|
109
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function useAnimation(initial: any): [object, Function];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function useScroll(): object;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Animatable } from '../animatable';
|
|
3
|
+
import { Animate } from '../animate/animate';
|
|
4
|
+
|
|
5
|
+
/**
|
|
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
|
+
*
|
|
8
|
+
* @param initial whether the referenced component is initially mounted.
|
|
9
|
+
*/
|
|
10
|
+
export function useUnmount(initial: boolean): [boolean, (mounted: boolean) => void, React.Ref<Animatable | Animate>];
|
package/types/hooks.d.ts
ADDED
package/types/morph.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
interface MorphProps {
|
|
4
4
|
active?: boolean;
|
|
5
5
|
group?: number;
|
|
6
6
|
useLayout?: boolean;
|
|
@@ -9,7 +9,7 @@ declare interface Morph {
|
|
|
9
9
|
ignore?: string[];
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export class Morph extends React.Component<
|
|
12
|
+
export class Morph extends React.Component<MorphProps> {
|
|
13
13
|
|
|
14
14
|
private static properties;
|
|
15
15
|
private static layoutProperties;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("@babel/runtime/helpers/typeof"),t=require("@babel/runtime/helpers/slicedToArray"),r=require("@babel/runtime/helpers/asyncToGenerator"),n=require("@babel/runtime/helpers/classCallCheck"),i=require("@babel/runtime/helpers/createClass"),a=require("@babel/runtime/helpers/inherits"),o=require("@babel/runtime/helpers/possibleConstructorReturn"),s=require("@babel/runtime/helpers/getPrototypeOf"),u=require("@babel/runtime/helpers/defineProperty"),l=require("@babel/runtime/regenerator"),c=require("react"),p=require("./animation-c1347465.js"),f=require("./link-884ecbbe.js"),h=require("./helper-dfb168a5.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var v=d(e),y=d(t),m=d(r),w=d(n),b=d(i),g=d(a),k=d(o),L=d(s),x=d(u),E=d(l);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 C(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){x.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 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 O(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 O(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){s=!0,a=e},f:function(){try{o||null==r.return||r.return()}finally{if(s)throw a}}}}function O(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 D(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var r,n=L.default(e);if(t){var i=L.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return k.default(this,r)}}var q=function(e){g.default(k,e);var t,r,n,i,a,o,s,u,l,d=D(k);function k(e){var t;w.default(this,k),(t=d.call(this,e)).hover=!1,t.hasFocus=!1,t.inView=!1,t.scrollDelta=0,t.viewportMargin=e.viewportMargin;var r=t.props.animate||{},n=r.duration,i=r.interpolate,a=r.origin,o=r.useLayout;for(var s in t.links={duration:n,interpolate:i,origin:a,useLayout:o},t.animations={default:t.parse(t.props.animate)},t.props.animations)t.animations[s]=t.parse(t.props.animations[s]);return t.links=new p.Keyframe(t.links),t.elements=[],t.children=[],t.level=0,t}return b.default(k,[{key:"parse",value:function(e){if(p.Animation.isAnimation(e))return e.use();if(!h.isObject(e))return null;var t={};for(var r in e){var n=e[r];f.Link.isLink(n)?this.links[r]=n.link(this.style.bind(this)):t[r]=n}return new p.AnimationClip(t,this.props.initial)}},{key:"style",value:function(){var e=this;cancelAnimationFrame(this.frame),this.frame=requestAnimationFrame((function(){var t,r=A(e.elements);try{for(r.s();!(t=r.n()).done;){var n=t.value;e.links.update(n)}}catch(e){r.e(e)}finally{r.f()}}))}},{key:"update",value:function(){var e,t=A(this.elements);try{for(t.s();!(e=t.n()).done;){var r=e.value;h.cacheElementStyles(r),this.animations.default.restore(r,!0),this.links.update(r)}}catch(e){t.e(e)}finally{t.f()}}},{key:"componentDidMount",value:function(){var e=this,t=this.props.parentLevel<1||this.props.noCascade;this.resizeEventListener=this.onResize.bind(this),h.addEventListener("resize",this.resizeEventListener),t&&(this.scrollEventListener=this.onScroll.bind(this),h.addEventListener("scroll",this.scrollEventListener)),this.update(),m.default(E.default.mark((function r(){return E.default.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!("fonts"in document)){r.next=4;break}return r.next=3,document.fonts.ready;case 3:e.update({mount:!0});case 4:t&&(e.props.onMount&&e.play(e.props.onMount,{staggerDelay:.001,immediate:!0}),p.AnimationQueue.delay((function(){return e.onScroll()}),.001));case 5:case"end":return r.stop()}}),r)})))()}},{key:"componentDidUpdate",value:(l=m.default(E.default.mark((function e(){return E.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.update();case 1:case"end":return e.stop()}}),e,this)}))),function(){return l.apply(this,arguments)})},{key:"componentWillUnmount",value:function(){h.removeEventListener("scroll",this.scrollEventListener),h.removeEventListener("resize",this.resizeEventListener)}},{key:"inViewport",value:function(){var e=this,t=!0,r=!0;if(this.elements.forEach((function(n){var i=n.getBoundingClientRect().y;t=t&&i+n.clientHeight*(1-e.viewportMargin)<window.innerHeight,r=r&&i>window.innerHeight+n.clientHeight*e.viewportMargin})),!this.elements.length){var n,i=A(this.children);try{for(i.s();!(n=i.n()).done;){var a=n.value.animatable.inViewport(),o=y.default(a,2),s=o[0],u=o[1];t=t&&s,r=r&&u}}catch(e){i.e(e)}finally{i.f()}}return[t,r]}},{key:"onScroll",value:(u=m.default(E.default.mark((function e(){var t,r,n,i;return E.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.props.whileViewport&&!(Date.now()-this.scrollDelta<350)){e.next=2;break}return e.abrupt("return");case 2:this.scrollDelta=Date.now(),t=this.inViewport(),r=y.default(t,2),n=r[0],i=r[1],!this.inView&&n&&(this.inView=!0,this.props.whileViewport&&this.play(this.props.whileViewport)),this.inView&&i&&(this.inView=!1,this.props.whileViewport&&this.play(this.props.whileViewport,{reverse:!0,immediate:!0}));case 6:case"end":return e.stop()}}),e,this)}))),function(){return u.apply(this,arguments)})},{key:"onResize",value:(s=m.default(E.default.mark((function e(){var t;return E.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:null!==(t=this.nextResize)&&void 0!==t&&t.cancel&&this.nextResize.cancel(),this.nextResize=p.AnimationQueue.delay(this.update.bind(this,{mount:!0}),.25);case 2:case"end":return e.stop()}}),e,this)}))),function(){return s.apply(this,arguments)})},{key:"onEnter",value:(o=m.default(E.default.mark((function e(t){var r,n=arguments;return E.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=n.length>1&&void 0!==n[1]&&n[1],this.hover||(this.props.whileHover&&this.play(this.props.whileHover),this.hover=!0),r&&r(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"onLeave",value:(a=m.default(E.default.mark((function e(t){var r,n=arguments;return E.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=n.length>1&&void 0!==n[1]&&n[1],this.hover&&(this.props.whileHover&&this.play(this.props.whileHover,{reverse:!0}),this.hover=!1),r&&r(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"onFocus",value:(i=m.default(E.default.mark((function e(t){var r,n=arguments;return E.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=n.length>1&&void 0!==n[1]&&n[1],this.hasFocus||(this.props.whileFocus&&this.play(this.props.whileFocus),this.hasFocus=!0),r&&r(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"onBlur",value:(n=m.default(E.default.mark((function e(t){var r,n=arguments;return E.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=n.length>1&&void 0!==n[1]&&n[1],this.hasFocus&&(this.props.whileFocus&&this.play(this.props.whileFocus,{reverse:!0}),this.hasFocus=!1),r&&r(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"onClick",value:(r=m.default(E.default.mark((function e(t){var r,n=arguments;return E.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=n.length>1&&void 0!==n[1]&&n[1],this.props.onClick&&this.play(this.props.onClick),r&&r(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return r.apply(this,arguments)})},{key:"play",value:(t=m.default(E.default.mark((function e(t){var r,n,i,a,o,s,u,l,c,f,h,d,v,y,m,w,b,g,k,L,x,j=this,C=arguments;return E.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=C.length>1&&void 0!==C[1]?C[1]:{},n=r.callback,i=r.reverse,a=void 0!==i&&i,o=r.immediate,s=void 0!==o&&o,u=r.cascade,l=void 0!==u&&u,c=r.groupAdjust,f=void 0===c?0:c,h=r.cascadeDelay,d=void 0===h?0:h,v=r.staggerDelay,y=void 0===v?0:v,!(this.props.parentLevel>0)||l){e.next=3;break}return e.abrupt("return");case 3:if(m="string"==typeof t?this.animations[t]:this.animations.default){e.next=6;break}return e.abrupt("return");case 6:w=0,this.elements.forEach((function(e,t){var r="group"in j.props?j.props.parentLevel-j.props.group:j.level+f;d=a?m.duration:d;var n=a?r*d:(j.props.parentLevel-r)*d;n=j.props.stagger*t+n+y,w=n>w?n:w,m.play(e,{delay:n,reverse:a,immediate:s})})),b=A(this.children);try{for(b.s();!(g=b.n()).done;)k=g.value,L=k.animatable,x=k.staggerIndex,L.play(t,{reverse:a,immediate:s,cascade:!0,staggerDelay:x<0?0:this.props.stagger*x,cascadeDelay:m.duration,groupAdjust:x<0?0:1})}catch(e){b.e(e)}finally{b.f()}n&&p.AnimationQueue.delay(n,w+m.duration);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"mergeProperties",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=C(C({},t),e);for(var n in r)["children","parentLevel","ref"].includes(n)?delete r[n]:Array.isArray(e[n])||Array.isArray(t[n])||"object"===v.default(e[n])&&"object"===v.default(t[n])&&(r[n]=C(C({},t[n]),e[n]));return r}},{key:"deepClone",value:function(e){var t,r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.index,a=void 0===i?0:i,o=n.useElements,s=void 0!==o&&o,u=n.useEvents,l=void 0===u||u;if(!c.isValidElement(e))return e;var p={};if(e.type===k||e.type.prototype instanceof k||(s&&(p={ref:function(e){return r.elements[a]=e}}),l&&(this.props.parentLevel<1||this.props.noCascade)&&(p=C(C({},p),{},{onMouseEnter:function(t){var n;return r.onEnter(t,null===(n=e.props)||void 0===n?void 0:n.onMouseEnter)},onMouseLeave:function(t){var n;return r.onLeave(t,null===(n=e.props)||void 0===n?void 0:n.onMouseLeave)},onFocus:function(t){var n;return r.onFocus(t,null===(n=e.props)||void 0===n?void 0:n.onFocus)},onBlur:function(t){var n;return r.onBlur(t,null===(n=e.props)||void 0===n?void 0:n.onBlur)},onClick:function(t){var n;return r.onClick(t,null===(n=e.props)||void 0===n?void 0:n.onClick)}}),l=!1)),(e.type===k||e.type.prototype instanceof k)&&(null===(t=e.props)||void 0===t||!t.noCascade)){var f=this.childrenIndex++;p=C(C(C({},p),this.mergeProperties(e.props,this.props)),{},{parentLevel:this.parentLevel>0?this.parentLevel:this.level,ref:function(e){return r.children[f]={animatable:e,staggerIndex:s?a:-1}}})}var h=c.Children.map(e.props.children,(function(e,t){return r.deepClone(e,{index:t,useEvents:l})}));return c.cloneElement(e,p,h)}},{key:"countNestedLevels",value:function(e){var t=this;if(!e)return 0;var r=0,n=0;return c.Children.forEach(e,(function(e){var i;if(c.isValidElement(e)){(e.type===k||e.type.prototype instanceof k)&&(r=1);var a=t.countNestedLevels(null===(i=e.props)||void 0===i?void 0:i.children);n=n<a?a:n}})),n+r}},{key:"render",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props.children;return this.level=this.countNestedLevels(t),this.childrenIndex=0,c.Children.map(t,(function(t,r){return e.deepClone(t,{index:r,useElements:!0})}))}}]),k}(c.Component);x.default(q,"defaultProps",{parentLevel:0,stagger:.1,viewportMargin:.25,animate:{},animations:{}}),exports.Animatable=q;
|
package/dist/cjs/animate.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("@babel/runtime/helpers/extends"),t=require("@babel/runtime/helpers/objectWithoutProperties"),r=require("@babel/runtime/helpers/classCallCheck"),n=require("@babel/runtime/helpers/createClass"),i=require("@babel/runtime/helpers/inherits"),a=require("@babel/runtime/helpers/possibleConstructorReturn"),l=require("@babel/runtime/helpers/getPrototypeOf"),o=require("@babel/runtime/helpers/defineProperty"),u=require("react"),s=require("./animatable-415b0e20.js"),c=require("./pop-241f383a.js"),p=require("./helper-dfb168a5.js"),f=require("@babel/runtime/helpers/toConsumableArray"),d=require("./scroll-fd4c118f.js");function m(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}require("@babel/runtime/helpers/typeof"),require("@babel/runtime/helpers/slicedToArray"),require("@babel/runtime/helpers/asyncToGenerator"),require("@babel/runtime/regenerator"),require("./animation-c1347465.js"),require("./link-884ecbbe.js");var b=m(e),h=m(t),y=m(r),v=m(n),g=m(i),O=m(a),j=m(l),q=m(o),P=m(u),w=m(f),A=["levels","animations"];function k(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?k(Object(r),!0).forEach((function(t){q.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):k(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}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=j.default(e);if(t){var i=j.default(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return O.default(this,r)}}var x=function(e){g.default(r,e);var t=C(r);function r(e){var n;return y.default(this,r),(n=t.call(this,e)).levels=n.props.levels,n.animations=p.padArray(n.props.animations,n.levels),n}return v.default(r,[{key:"makeAnimatable",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(r<1||u.Children.count(e)<1)return e;var n=this.props;n.levels,n.animations;var i=h.default(n,A),a=this.animations[this.levels-r];return r===this.levels&&(i.ref=function(e){return t.animatable=e}),P.default.createElement(s.Animatable,b.default({animate:a},i),u.Children.map(e,(function(e){return u.isValidElement(e)?u.cloneElement(e,{},t.makeAnimatable(e.props.children,r-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,E({},r))}},{key:"render",value:function(){return this.makeAnimatable(this.props.children,this.levels)}}]),r}(u.Component);function R(e){var t=e.children,r=e.className,n=e.style,i=e.duration;if("string"!=typeof t)return t;var a=t.split("");return P.default.createElement("div",{className:r,style:n},P.default.createElement(s.Animatable,{whileViewport:!0,animate:{opacity:1,position:{y:0},rotation:0,duration:.8},initial:{opacity:0,position:{y:"100%"},rotation: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 D(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 l=[P.default.createElement(s.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(w.default(a));return P.default.createElement(s.Animatable,{whileViewport:!0,animate:{clip:{right:0},duration:i/2},initial:{clip:{right:1}}},u.cloneElement(r,{},l))}function M(e){var t,r=e.children,n=e.amount,i=d.useScroll(),a=u.useRef();return P.default.createElement(s.Animatable,{ref:a,animate:{position: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)}q.default(x,"defaultProps",{levels:1,stagger:.1,viewportMargin:.25,animations:[c.Move,c.Pop]}),R.defaultProps={style:{},className:"",duration:1.6},D.defaultProps={color:"grey",duration:1.6},M.defaultProps={amount:.5},exports.Animate=x,exports.ColorWipe=D,exports.Parallax=M,exports.WriteOn=R;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var t=require("@babel/runtime/helpers/slicedToArray"),e=require("@babel/runtime/helpers/objectWithoutProperties"),i=require("@babel/runtime/helpers/classCallCheck"),n=require("@babel/runtime/helpers/createClass"),r=require("./helper-dfb168a5.js"),a=require("@babel/runtime/helpers/asyncToGenerator"),o=require("@babel/runtime/regenerator");function s(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var u=s(t),l=s(e),c=s(i),h=s(n),d=s(a),f=s(o),v={opacity:1,scale:{x:1,y:1},position:{x:0,y:0},rotation:0,clip:{left:0,top:0,right:0,bottom:0},borderRadius:0,padding:0,fontSize:"1rem",backgroundColor:{r:127,g:127,b:127,a:255},color:{r:127,g:127,b:127,a:255},active:!0,interact:!0,zIndex:0};function y(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(!t)return;if("string"==typeof t)return p(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return p(t,e)}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){s=!0,a=t},f:function(){try{o||null==i.return||i.return()}finally{if(s)throw a}}}}function p(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}var g=function(t){var e=t.match(/^#([\da-f]{1,2})([\da-f]{1,2})([\da-f]{1,2})([\da-f]{2})?/i),i=u.default(e,5);i[0];var n=i[1],r=i[2],a=i[3],o=i[4];return{r:parseInt(n.padStart(2,n),16),g:parseInt(r.padStart(2,r),16),b:parseInt(a.padStart(2,a),16),a:void 0!==o?parseInt(o,16):255}},m=function(t){var e=t.match(/^rgba?\((\d+)\D+(\d+)\D+(\d+)\D*(\d+)?\)/i),i=u.default(e,5);i[0];var n=i[1],r=i[2],a=i[3],o=i[4];return{r:parseInt(n),g:parseInt(r),b:parseInt(a),a:void 0!==o?parseInt(o):255}},b=function(t){var e=.5,i=.5;if(r.isObject(t))e=t.x,i=t.y;else if("string"==typeof t)switch(t){case"left":e=0;break;case"right":e=1;break;case"top":i=0;break;case"bottom":i=1}else e=i=t;return"".concat(100*e,"% ").concat(100*i,"%")},k=function t(e,i){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("string"==typeof i){if(i.match(/^#[0-9a-f]{3,8}$/i))return g(i);if(i.match(/^rgba?\(.*\)$/i))return m(i);var a=(i.match(/[^0-9\.]*$/i)||["px"])[0];return i=parseFloat(i),isNaN(i)?v[e]:("%"===a&&(i/=100),a?[i,a]:i)}if(r.isObject(i)){var o=Object.keys(i),s=i;("x"in i||"y"in i)&&(o=["x","y"]),("r"in i||"g"in i||"b"in i||"a"in i)&&(o=["r","g","b","a"]),("left"in i||"right"in i||"top"in i||"bottom"in i)&&(o=["left","right","top","bottom"]),i={};var u,l=y(o);try{for(l.s();!(u=l.n()).done;){var c=u.value;i[c]=t(e,s[c],c)}}catch(t){l.e(t)}finally{l.f()}}if(void 0!==i)return i;var h=v[e];return n in h?h[n]:h},x=function(t,e){return Array.isArray(t)&&(e=t[1],t=t[0]),t*("%"===e?100:1)+e},L=function(t){return Array.isArray(t)&&(t="px"===t[1]?t[0]+"px":t[0]),t},A=function t(e,i,n){if(r.isObject(e)){var a={};for(var o in e)a[o]=t(e[o],r.isObject(i)?i[o]:i,n);return a}var s;if(Array.isArray(e)&&(s=e[1],e=e[0]),Array.isArray(i)&&(s=i[1],i=i[0]),"number"!=typeof e||"number"!=typeof i)return n>.5?i:e;var u=e*(1-n)+i*n;return s?[u,s]:u},q=function(t,e,i){if(t.length===i)return t[e];var n=e*((t.length-1)/(i-1)),r=Math.floor(n);return r===t.length-1?t[r]:A(t[r],t[r+1],n-r)},w=function(){function t(){c.default(this,t),this.queue=[],this.tick()}var e;return h.default(t,[{key:"uuid",value:function(){return Math.floor(1e6*Math.random()).toString(16).padStart("0",6)}},{key:"tick",value:(e=d.default(f.default.mark((function t(){var e,i,n;return f.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=Date.now(),i=0;case 2:if(!(i<this.queue.length+1)){t.next=13;break}if(n=this.queue[i],!(this.queue.length===i||n.timestamp>e)){t.next=7;break}return this.queue.splice(0,i),t.abrupt("break",13);case 7:n.callback(),delete n.cancel,delete n.store[n.id+n.timestamp];case 10:i++,t.next=2;break;case 13:requestAnimationFrame(this.tick.bind(this));case 14:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"search",value:function(t){for(var e,i,n=0,r=this.queue.length-1;n<=r;)if(e=n+r>>>1,(i=this.queue[e].timestamp-t.timestamp)<0)n=e+1;else{if(!(i>0))return e;r=e-1}return n}},{key:"insert",value:function(t){var e=this.search(t);this.queue.splice(e,0,t)}},{key:"cancel",value:function(t){for(var e=this.search(t);e>0&&this.queue[e].timestamp>=t.timestamp;)e--;for(;e<this.queue.length&&this.queue[e].timestamp<=t.timestamp;){if(this.queue[e].id===t.id){this.queue.splice(e,1);break}e++}delete t.cancel}},{key:"delay",value:function(t,e){var i=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(t instanceof Function){var r={timestamp:Date.now()+1e3*e,id:this.uuid(),cancel:function(){return i.cancel(r)},callback:t,store:n};return this.insert(r),n[r.id+r.timestamp]=r,r}}}],[{key:"get",value:function(){return r.livelyProperty("AnimationQueue",new t),window.Lively.AnimationQueue}},{key:"cancelAll",value:function(t){for(var e in t)t[e].cancel(),delete t[e]}},{key:"delay",value:function(t,e,i){return this.get().delay(t,e,i)}},{key:"sleep",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return new Promise((function(i){t.delay(i,e)}))}}]),t}(),S=["duration","interpolate","origin","useLayout"],I=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.duration,n=void 0===i?0:i,r=e.interpolate,a=void 0===r?"ease":r,o=e.origin,s=void 0===o?{x:.5,y:.5}:o,u=e.useLayout,h=void 0!==u&&u,d=l.default(e,S);c.default(this,t),this.style=d,this.start={},this.end={},this.duration=n,this.interpolate="spring"===a?"cubic-bezier(0.65, 0.34, 0.7, 1.42)":a,this.origin=b(s),this.useLayout=h}return h.default(t,[{key:"addProperty",value:function(t,e){if(!r.isObject(e)||!("start"in e||"end"in e||"set"in e))return this.style[t]=e;"start"in e&&(this.start[t]=e.start),"end"in e&&(this.end[t]=e.end),"set"in e&&(this.style[t]=e.set)}},{key:"compile",value:function(){return this.style=this.interpret(this.style),this.start=this.interpret(this.start),this.end=this.interpret(this.end),this}},{key:"interpret",value:function(t){if(!Object.keys(t).length)return null;var e={transform:""};for(var i in t){var n=t[i];if(n instanceof Function){if(null===(n=n()))continue;n=k(i,n)}switch(i){case"position":e.transform+="translate(".concat(x(n.x,"px"),", ").concat(x(n.y,"px"),") ");break;case"scale":if("number"==typeof n&&(n={x:n,y:n}),this.useLayout){e.width=L(n.x),e.height=L(n.y);break}e.transform+="scale(".concat(x(n.x,"%"),", ").concat(x(n.y,"%"),") ");break;case"rotation":e.transform+="rotate(".concat(x(n,"deg"),") ");break;case"clip":e.clipPath="inset(".concat(x(n.top,"%")," ").concat(x(n.right,"%")," ").concat(x(n.bottom,"%")," ").concat(x(n.left,"%"),")"),e.webkitClipPath=e.clipPath;break;case"borderRadius":case"padding":case"fontSize":e[i]=x(n,"px");break;case"backgroundColor":case"color":e[i]="rgba(".concat(n.r,", ").concat(n.g,", ").concat(n.b,", ").concat(n.a,")");break;case"interact":e.pointerEvents=n?"all":"none";break;case"opacity":case"active":case"zIndex":e[i]=n}}return e}},{key:"initial",value:function(t){t.style.transitionTimingFunction=this.interpolate,t.style.transformOrigin=this.origin,this.apply(t,{duration:0})}},{key:"apply",value:function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=i.duration,r=void 0===n?this.duration:n,a=i.reverse,o=void 0!==a&&a,s=t.setStyle.bind(t,e,this.style,r);this[o?"end":"start"]?(t.setStyle(e,this[o?"end":"start"],0),w.delay(s,.001)):s(),this[o?"start":"end"]&&w.delay(t.setStyle.bind(t,e,this[o?"start":"end"],0),r,e.Lively.timeouts)}},{key:"update",value:function(e){e.style.transitionTimingFunction=this.interpolate,e.style.transformOrigin=this.origin;var i=this.interpret(this.style);t.setStyle(e,i,this.duration)}}],[{key:"setStyle",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;for(var n in t.style.transitionDuration="".concat(i,"s"),e)"width"!==n?"height"!==n?"padding"===n&&(e.width||e.height)||"start"===n||"end"===n||(t.style[n]=e[n]):this.setLength(t,e,"height","paddingTop","paddingBottom"):this.setLength(t,e,"width","paddingLeft","paddingRight")}},{key:"setLength",value:function(t,e,i,n,r){var a=t.Lively.initials[i],o=parseInt(t.Lively.initials[n]),s=parseInt(t.Lively.initials[r]),u=e[i],l=e.padding?1:o/(0===s?1e-6:s);"string"==typeof u&&(u="calc(".concat(u," / ").concat(a,")"));var c=e.padding?e.padding:o+s+"px";t.style[i]="max(calc(".concat(a," * ").concat(u," - ").concat("border-box"!==t.style.boxSizing?"0px":c,"), 0px)");var h="calc(min(calc(".concat(a," * ").concat(u,"), ").concat(c,") * ");t.style[n]=h+.5*l,t.style[r]=h+1/(0===l?1e-6:l)*.5}}]),t}(),j=["delay","duration","repeat"],O=["interpolate","origin","useLayout"],C=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.delay,n=void 0===i?0:i,r=e.duration,a=void 0===r?1:r,o=e.repeat,s=void 0===o?1:o,u=l.default(e,j),h=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};c.default(this,t),this.length=0,this.delay=n,this.duration=a,this.repeat=s,this.keyframes=this.parse(u,h)}return h.default(t,[{key:"initial",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.keyframes[0];e&&e.initial(t)}},{key:"restore",value:function(t){var e,i,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];(n||null!==(e=t.Lively)&&void 0!==e&&e.keyframe)&&this.initial(t,null===(i=t.Lively)||void 0===i?void 0:i.keyframe)}},{key:"parse",value:function(t,e){var i=this,n=t.interpolate,r=t.origin,a=t.useLayout,o=l.default(t,O),s=function(t){Array.isArray(o[t])||(o[t]=[o[t]]),o[t].length<2&&o[t].unshift(t in e?e[t]:v[t]),o[t]=o[t].map((function(e){return k(t,e)})),i.length=Math.max(o[t].length,i.length)};for(var u in o)s(u);return new Array(this.length).fill(0).map((function(t,e){var s=new I({interpolate:n,origin:r,useLayout:a,duration:i.duration/(i.length-1)});for(var u in o)u in v&&s.addProperty(u,q(o[u],e,i.length));return s.compile()}))}},{key:"start",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=i.immediate,r=void 0!==n&&n,a=i.reverse,o=void 0!==a&&a,s=i.repeat,u=void 0===s?this.repeat:s;!t.Lively.animating||r?(this.initial(t,o?this.keyframes[this.length-1]:this.keyframes[0]),t.Lively.index=1,t.Lively.animating=!0,requestAnimationFrame((function(){return e.getNext(t,o,u)}))):t.Lively.queue.push([this,{reverse:o,repeat:u}])}},{key:"play",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=e.delay,n=void 0===i?0:i,r=e.immediate,a=void 0!==r&&r,o=e.reverse,s=void 0!==o&&o;if(t.style&&this.length){a&&(t.Lively.queue=[],w.cancelAll(t.Lively.timeouts));var u=this.start.bind(this,t,{immediate:a,reverse:s});this.delay||n?w.delay(u,this.delay+n,t.Lively.timeouts):u()}}},{key:"getNext",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(t.Lively.index===this.length){t.Lively.animating=!1;var r=t.Lively.queue.shift()||[],a=u.default(r,2),o=a[0],s=a[1];return o?o.start(t,s):void(n>1&&this.start(t,{reverse:i,repeat:n-1}))}var l=t.Lively.index;i&&(l=this.length-1-l),this.keyframes[l].apply(t,{reverse:i}),t.Lively.keyframe=this.keyframes[l],t.Lively.index++,w.delay((function(){return e.getNext(t,i,n)}),this.duration/(this.length-1),t.Lively.timeouts)}}]),t}(),F={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]:{},i=t(e),n=u.default(i,2),r=n[0],a=n[1];return new C(r,a)},e},isAnimation:function(t){return t instanceof Function&&"use"in t}};exports.Animation=F,exports.AnimationClip=C,exports.AnimationQueue=w,exports.Keyframe=I;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=e(require("@babel/runtime/helpers/typeof")),t=function(e,n){var t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window;"Lively"in t||(t.Lively={}),e in t.Lively||(t.Lively[e]=n)};exports.addEventListener=function(e,n){if(n instanceof Function){t("Events",{}),e in window.Lively.Events||(window.Lively.Events[e]={unique:0},window.addEventListener(e,(function(n){Object.values(window.Lively.Events[e]).forEach((function(e){e instanceof Function&&e(n)}))})));var i=window.Lively.Events[e];n.Lively={ListenerID:i.unique},i[i.unique++]=n}},exports.cacheElementStyles=function(e){t("queue",[],e),t("timeouts",{},e),e.Lively.style||(e.Lively.style=function(e){for(var n={},t=0;t<e.style.length;t++)n[e.style[t]]=e.style[e.style[t]];return n}(e),e.Lively.style.transitionProperty="transform, opacity, clip-path, border-radius, font-size, background-color, color, width, height, padding",e.Lively.style.willChange="transform"),function(e,n){for(var t in e.style={},n)e.style[t]=n[t]}(e,e.Lively.style);var n=getComputedStyle(e),i=n.paddingLeft,o=n.paddingRight,r=n.paddingTop,l=n.paddingBottom,d=n.backgroundColor,s=n.color,a=n.borderRadius,u=n.padding,y=n.fontSize,v=n.zIndex,p=e.getBoundingClientRect(),c=p.x,f=p.y,L=p.width,g=p.height;e.Lively.initials={x:c,y:f,paddingLeft:i,paddingRight:o,paddingTop:r,paddingBottom:l,backgroundColor:d,color:s,fontSize:y,zIndex:"auto"===v?0:parseInt(v),width:L+"px",height:g+"px",borderRadius:a.split(" ")[0],padding:u.split(" ")[0]}},exports.isObject=function(e){return e&&"object"===n.default(e)&&!Array.isArray(e)},exports.livelyProperty=t,exports.padArray=function(e,n){return new Array(n).fill(0).map((function(n,t){return t<e.length?e[t]:e[e.length-1]}))},exports.removeEventListener=function(e,n){var t,i;"undefined"!=typeof window&&null!==(t=window.Lively)&&void 0!==t&&null!==(i=t.Events)&&void 0!==i&&i[e]&&null!=n&&n.Lively&&"ListenerID"in n.Lively&&delete window.Lively.Events[e][n.Lively.ListenerID]};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";function n(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,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 u,a=!0,c=!1;return{s:function(){e=e.call(n)},n:function(){var n=e.next();return a=n.done,n},e:function(n){c=!0,u=n},f:function(){try{a||null==e.return||e.return()}finally{if(c)throw u}}}}function t(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}function r(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(n){return n};return n.isBound?"undefined"!=typeof window?n(this.value):null:(n.isBound=!0,r.construct(this,n))}r.construct=function(t){for(var e=arguments.length,o=new Array(e>1?e-1:0),i=1;i<e;i++)o[i-1]=arguments[i];var u=r.bind.apply(r,[t].concat(o));return u.set=function(n){return t.value=n},u.link=function(n){return t.linked.push(n),u},u.feed=function(r){t.value=r;var e,o=n(t.linked);try{for(o.s();!(e=o.n()).done;){(0,e.value)()}}catch(n){o.e(n)}finally{o.f()}},u},r.create=function(n){return r.construct({value:n,linked:[]})},r.isLink=function(n){return n instanceof Function&&"link"in n},exports.Link=r;
|
package/dist/cjs/pop-241f383a.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("@babel/runtime/helpers/defineProperty"),t=require("@babel/runtime/helpers/objectWithoutProperties"),r=require("./animation-c1347465.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 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 a(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){o.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}var u=r.Animation.create((function(e){var t=e.direction,r=void 0===t?"up":t,n=c.default(e,i),o="0px",p="20px";switch(r){case"down":p="-20px";break;case"left":o="20px",p="0px";break;case"right":o="-20px",p="0px"}return[a({position:{x:0,y:0},opacity:1,duration:.5},n),{position:{x:o,y:p},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 +0,0 @@
|
|
|
1
|
-
"use strict";var e=require("react"),r=require("./link-884ecbbe.js"),n=require("./helper-dfb168a5.js");exports.useScroll=function(){var t=r.Link.create(0);return e.useEffect((function(){var e=function(){return t.feed(window.scrollY)};return t.set(window.scrollY),n.addEventListener("scroll",e),function(){return n.removeEventListener("scroll",e)}}),[]),t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/typeof";import t from"@babel/runtime/helpers/slicedToArray";import r from"@babel/runtime/helpers/asyncToGenerator";import n from"@babel/runtime/helpers/classCallCheck";import i from"@babel/runtime/helpers/createClass";import o from"@babel/runtime/helpers/inherits";import s from"@babel/runtime/helpers/possibleConstructorReturn";import a from"@babel/runtime/helpers/getPrototypeOf";import u from"@babel/runtime/helpers/defineProperty";import l from"@babel/runtime/regenerator";import{isValidElement as p,Children as c,cloneElement as h,Component as f}from"react";import{K as v,b as d,a as m,A as y}from"./animation-9ea0228d.js";import{L as w}from"./link-67981677.js";import{i as b,c as g,a as k,r as x}from"./helper-6ed90764.js";function L(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?L(Object(r),!0).forEach((function(t){u(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):L(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function O(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return E(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return E(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,i=function(){};return{s:i,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw o}}}}function E(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function 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=a(e);if(t){var i=a(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return s(this,r)}}var C=function(s){o(R,f);var a,u,L,E,C,D,F,P,M,V=A(R);function R(e){var t;n(this,R),(t=V.call(this,e)).hover=!1,t.hasFocus=!1,t.inView=!1,t.scrollDelta=0,t.viewportMargin=e.viewportMargin;var r=t.props.animate||{},i=r.duration,o=r.interpolate,s=r.origin,a=r.useLayout;for(var u in t.links={duration:i,interpolate:o,origin:s,useLayout:a},t.animations={default:t.parse(t.props.animate)},t.props.animations)t.animations[u]=t.parse(t.props.animations[u]);return t.links=new v(t.links),t.elements=[],t.children=[],t.level=0,t}return i(R,[{key:"parse",value:function(e){if(d.isAnimation(e))return e.use();if(!b(e))return null;var t={};for(var r in e){var n=e[r];w.isLink(n)?this.links[r]=n.link(this.style.bind(this)):t[r]=n}return new m(t,this.props.initial)}},{key:"style",value:function(){var e=this;cancelAnimationFrame(this.frame),this.frame=requestAnimationFrame((function(){var t,r=O(e.elements);try{for(r.s();!(t=r.n()).done;){var n=t.value;e.links.update(n)}}catch(e){r.e(e)}finally{r.f()}}))}},{key:"update",value:function(){var e,t=O(this.elements);try{for(t.s();!(e=t.n()).done;){var r=e.value;g(r),this.animations.default.restore(r,!0),this.links.update(r)}}catch(e){t.e(e)}finally{t.f()}}},{key:"componentDidMount",value:function(){var e=this,t=this.props.parentLevel<1||this.props.noCascade;this.resizeEventListener=this.onResize.bind(this),k("resize",this.resizeEventListener),t&&(this.scrollEventListener=this.onScroll.bind(this),k("scroll",this.scrollEventListener)),this.update(),r(l.mark((function r(){return l.wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(!("fonts"in document)){r.next=4;break}return r.next=3,document.fonts.ready;case 3:e.update({mount:!0});case 4:t&&(e.props.onMount&&e.play(e.props.onMount,{staggerDelay:.001,immediate:!0}),y.delay((function(){return e.onScroll()}),.001));case 5:case"end":return r.stop()}}),r)})))()}},{key:"componentDidUpdate",value:(M=r(l.mark((function e(){return l.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this.update();case 1:case"end":return e.stop()}}),e,this)}))),function(){return M.apply(this,arguments)})},{key:"componentWillUnmount",value:function(){x("scroll",this.scrollEventListener),x("resize",this.resizeEventListener)}},{key:"inViewport",value:function(){var e=this,r=!0,n=!0;if(this.elements.forEach((function(t){var i=t.getBoundingClientRect().y;r=r&&i+t.clientHeight*(1-e.viewportMargin)<window.innerHeight,n=n&&i>window.innerHeight+t.clientHeight*e.viewportMargin})),!this.elements.length){var i,o=O(this.children);try{for(o.s();!(i=o.n()).done;){var s=i.value.animatable.inViewport(),a=t(s,2),u=a[0],l=a[1];r=r&&u,n=n&&l}}catch(e){o.e(e)}finally{o.f()}}return[r,n]}},{key:"onScroll",value:(P=r(l.mark((function e(){var r,n,i,o;return l.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.props.whileViewport&&!(Date.now()-this.scrollDelta<350)){e.next=2;break}return e.abrupt("return");case 2:this.scrollDelta=Date.now(),r=this.inViewport(),n=t(r,2),i=n[0],o=n[1],!this.inView&&i&&(this.inView=!0,this.props.whileViewport&&this.play(this.props.whileViewport)),this.inView&&o&&(this.inView=!1,this.props.whileViewport&&this.play(this.props.whileViewport,{reverse:!0,immediate:!0}));case 6:case"end":return e.stop()}}),e,this)}))),function(){return P.apply(this,arguments)})},{key:"onResize",value:(F=r(l.mark((function e(){var t;return l.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:null!==(t=this.nextResize)&&void 0!==t&&t.cancel&&this.nextResize.cancel(),this.nextResize=y.delay(this.update.bind(this,{mount:!0}),.25);case 2:case"end":return e.stop()}}),e,this)}))),function(){return F.apply(this,arguments)})},{key:"onEnter",value:(D=r(l.mark((function e(t){var r,n=arguments;return l.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=n.length>1&&void 0!==n[1]&&n[1],this.hover||(this.props.whileHover&&this.play(this.props.whileHover),this.hover=!0),r&&r(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return D.apply(this,arguments)})},{key:"onLeave",value:(C=r(l.mark((function e(t){var r,n=arguments;return l.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=n.length>1&&void 0!==n[1]&&n[1],this.hover&&(this.props.whileHover&&this.play(this.props.whileHover,{reverse:!0}),this.hover=!1),r&&r(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return C.apply(this,arguments)})},{key:"onFocus",value:(E=r(l.mark((function e(t){var r,n=arguments;return l.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=n.length>1&&void 0!==n[1]&&n[1],this.hasFocus||(this.props.whileFocus&&this.play(this.props.whileFocus),this.hasFocus=!0),r&&r(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return E.apply(this,arguments)})},{key:"onBlur",value:(L=r(l.mark((function e(t){var r,n=arguments;return l.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=n.length>1&&void 0!==n[1]&&n[1],this.hasFocus&&(this.props.whileFocus&&this.play(this.props.whileFocus,{reverse:!0}),this.hasFocus=!1),r&&r(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return L.apply(this,arguments)})},{key:"onClick",value:(u=r(l.mark((function e(t){var r,n=arguments;return l.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=n.length>1&&void 0!==n[1]&&n[1],this.props.onClick&&this.play(this.props.onClick),r&&r(t);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"play",value:(a=r(l.mark((function e(t){var r,n,i,o,s,a,u,p,c,h,f,v,d,m,w,b,g,k,x,L,j,E=this,A=arguments;return l.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(r=A.length>1&&void 0!==A[1]?A[1]:{},n=r.callback,i=r.reverse,o=void 0!==i&&i,s=r.immediate,a=void 0!==s&&s,u=r.cascade,p=void 0!==u&&u,c=r.groupAdjust,h=void 0===c?0:c,f=r.cascadeDelay,v=void 0===f?0:f,d=r.staggerDelay,m=void 0===d?0:d,!(this.props.parentLevel>0)||p){e.next=3;break}return e.abrupt("return");case 3:if(w="string"==typeof t?this.animations[t]:this.animations.default){e.next=6;break}return e.abrupt("return");case 6:b=0,this.elements.forEach((function(e,t){var r="group"in E.props?E.props.parentLevel-E.props.group:E.level+h;v=o?w.duration:v;var n=o?r*v:(E.props.parentLevel-r)*v;n=E.props.stagger*t+n+m,b=n>b?n:b,w.play(e,{delay:n,reverse:o,immediate:a})})),g=O(this.children);try{for(g.s();!(k=g.n()).done;)x=k.value,L=x.animatable,j=x.staggerIndex,L.play(t,{reverse:o,immediate:a,cascade:!0,staggerDelay:j<0?0:this.props.stagger*j,cascadeDelay:w.duration,groupAdjust:j<0?0:1})}catch(e){g.e(e)}finally{g.f()}n&&y.delay(n,b+w.duration);case 11:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"mergeProperties",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=j(j({},r),t);for(var i in n)["children","parentLevel","ref"].includes(i)?delete n[i]:Array.isArray(t[i])||Array.isArray(r[i])||"object"===e(t[i])&&"object"===e(r[i])&&(n[i]=j(j({},r[i]),t[i]));return n}},{key:"deepClone",value:function(e){var t,r=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=n.index,o=void 0===i?0:i,s=n.useElements,a=void 0!==s&&s,u=n.useEvents,l=void 0===u||u;if(!p(e))return e;var f={};if(e.type===R||e.type.prototype instanceof R||(a&&(f={ref:function(e){return r.elements[o]=e}}),l&&(this.props.parentLevel<1||this.props.noCascade)&&(f=j(j({},f),{},{onMouseEnter:function(t){var n;return r.onEnter(t,null===(n=e.props)||void 0===n?void 0:n.onMouseEnter)},onMouseLeave:function(t){var n;return r.onLeave(t,null===(n=e.props)||void 0===n?void 0:n.onMouseLeave)},onFocus:function(t){var n;return r.onFocus(t,null===(n=e.props)||void 0===n?void 0:n.onFocus)},onBlur:function(t){var n;return r.onBlur(t,null===(n=e.props)||void 0===n?void 0:n.onBlur)},onClick:function(t){var n;return r.onClick(t,null===(n=e.props)||void 0===n?void 0:n.onClick)}}),l=!1)),(e.type===R||e.type.prototype instanceof R)&&(null===(t=e.props)||void 0===t||!t.noCascade)){var v=this.childrenIndex++;f=j(j(j({},f),this.mergeProperties(e.props,this.props)),{},{parentLevel:this.parentLevel>0?this.parentLevel:this.level,ref:function(e){return r.children[v]={animatable:e,staggerIndex:a?o:-1}}})}var d=c.map(e.props.children,(function(e,t){return r.deepClone(e,{index:t,useEvents:l})}));return h(e,f,d)}},{key:"countNestedLevels",value:function(e){var t=this;if(!e)return 0;var r=0,n=0;return c.forEach(e,(function(e){var i;if(p(e)){(e.type===R||e.type.prototype instanceof R)&&(r=1);var o=t.countNestedLevels(null===(i=e.props)||void 0===i?void 0:i.children);n=n<o?o:n}})),n+r}},{key:"render",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.props.children;return this.level=this.countNestedLevels(t),this.childrenIndex=0,c.map(t,(function(t,r){return e.deepClone(t,{index:r,useElements:!0})}))}}]),R}();u(C,"defaultProps",{parentLevel:0,stagger:.1,viewportMargin:.25,animate:{},animations:{}});export{C as A};
|
package/dist/esm/animate.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/extends";import t from"@babel/runtime/helpers/objectWithoutProperties";import r from"@babel/runtime/helpers/classCallCheck";import n from"@babel/runtime/helpers/createClass";import i from"@babel/runtime/helpers/inherits";import o from"@babel/runtime/helpers/possibleConstructorReturn";import a from"@babel/runtime/helpers/getPrototypeOf";import l from"@babel/runtime/helpers/defineProperty";import s,{Children as c,isValidElement as p,cloneElement as u,Component as m,useRef as f}from"react";import{A as b}from"./animatable-19e75c27.js";import{M as h,P as y}from"./pop-ee3fdaef.js";import{p as v}from"./helper-6ed90764.js";import d from"@babel/runtime/helpers/toConsumableArray";import{u as g}from"./scroll-84c1f46b.js";import"@babel/runtime/helpers/typeof";import"@babel/runtime/helpers/slicedToArray";import"@babel/runtime/helpers/asyncToGenerator";import"@babel/runtime/regenerator";import"./animation-9ea0228d.js";import"./link-67981677.js";var O=["levels","animations"];function j(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function P(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?j(Object(r),!0).forEach((function(t){l(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 w(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=a(e);if(t){var i=a(this).constructor;r=Reflect.construct(n,arguments,i)}else r=n.apply(this,arguments);return o(this,r)}}var k=function(o){i(l,m);var a=w(l);function l(e){var t;return r(this,l),(t=a.call(this,e)).levels=t.props.levels,t.animations=v(t.props.animations,t.levels),t}return n(l,[{key:"makeAnimatable",value:function(r){var n=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(i<1||c.count(r)<1)return r;var o=this.props;o.levels,o.animations;var a=t(o,O),l=this.animations[this.levels-i];return i===this.levels&&(a.ref=function(e){return n.animatable=e}),s.createElement(b,e({animate:l},a),c.map(r,(function(e){return p(e)?u(e,{},n.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,P({},r))}},{key:"render",value:function(){return this.makeAnimatable(this.props.children,this.levels)}}]),l}();function E(e){var t=e.children,r=e.className,n=e.style,i=e.duration;if("string"!=typeof t)return t;var o=t.split("");return s.createElement("div",{className:r,style:n},s.createElement(b,{whileViewport:!0,animate:{opacity:1,position:{y:0},rotation:0,duration:.8},initial:{opacity:0,position:{y:"100%"},rotation:10},stagger:(i-.8)/(o.length-1)},o.map((function(e,t){return s.createElement("span",{style:{display:"inline-block"},key:t},/\s/.test(e)?" ":e)}))))}function A(e){var t,r=e.children,n=e.color,i=e.duration,o=(null===(t=r.props)||void 0===t?void 0:t.children)||[];Array.isArray(o)||(o=[o]);var a=[s.createElement(b,{key:0,initial:{clip:{right:0}},animate:{clip:{left:1},duration:i/2}},s.createElement("div",{style:{position:"absolute",inset:0,backgroundColor:n}}))].concat(d(o));return s.createElement(b,{whileViewport:!0,animate:{clip:{right:0},duration:i/2},initial:{clip:{right:1}}},u(r,{},a))}function C(e){var t,r=e.children,n=e.amount,i=g(),o=f();return s.createElement(b,{ref:o,animate:{position:i((function(e){if(void 0===t){var r,i=null===(r=o.current)||void 0===r?void 0:r.elements[0];i&&(t=Math.max(i.getBoundingClientRect().y+window.scrollY-window.innerHeight/2,0))}return{x:0,y:(e-(t||0))*n}}))}},r)}l(k,"defaultProps",{levels:1,stagger:.1,viewportMargin:.25,animations:[h,y]}),E.defaultProps={style:{},className:"",duration:1.6},A.defaultProps={color:"grey",duration:1.6},C.defaultProps={amount:.5};export{k as Animate,A as ColorWipe,C as Parallax,E as WriteOn};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import t from"@babel/runtime/helpers/slicedToArray";import e from"@babel/runtime/helpers/objectWithoutProperties";import i from"@babel/runtime/helpers/classCallCheck";import n from"@babel/runtime/helpers/createClass";import{i as r,l as a}from"./helper-6ed90764.js";import o from"@babel/runtime/helpers/asyncToGenerator";import s from"@babel/runtime/regenerator";var u={opacity:1,scale:{x:1,y:1},position:{x:0,y:0},rotation:0,clip:{left:0,top:0,right:0,bottom:0},borderRadius:0,padding:0,fontSize:"1rem",backgroundColor:{r:127,g:127,b:127,a:255},color:{r:127,g:127,b:127,a:255},active:!0,interact:!0,zIndex:0};function l(t,e){var i="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!i){if(Array.isArray(t)||(i=function(t,e){if(!t)return;if("string"==typeof t)return c(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return c(t,e)}(t))||e&&t&&"number"==typeof t.length){i&&(t=i);var n=0,r=function(){};return{s:r,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,o=!0,s=!1;return{s:function(){i=i.call(t)},n:function(){var t=i.next();return o=t.done,t},e:function(t){s=!0,a=t},f:function(){try{o||null==i.return||i.return()}finally{if(s)throw a}}}}function c(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}var h=function(e){var i=e.match(/^#([\da-f]{1,2})([\da-f]{1,2})([\da-f]{1,2})([\da-f]{2})?/i),n=t(i,5);n[0];var r=n[1],a=n[2],o=n[3],s=n[4];return{r:parseInt(r.padStart(2,r),16),g:parseInt(a.padStart(2,a),16),b:parseInt(o.padStart(2,o),16),a:void 0!==s?parseInt(s,16):255}},d=function(e){var i=e.match(/^rgba?\((\d+)\D+(\d+)\D+(\d+)\D*(\d+)?\)/i),n=t(i,5);n[0];var r=n[1],a=n[2],o=n[3],s=n[4];return{r:parseInt(r),g:parseInt(a),b:parseInt(o),a:void 0!==s?parseInt(s):255}},f=function(t){var e=.5,i=.5;if(r(t))e=t.x,i=t.y;else if("string"==typeof t)switch(t){case"left":e=0;break;case"right":e=1;break;case"top":i=0;break;case"bottom":i=1}else e=i=t;return"".concat(100*e,"% ").concat(100*i,"%")},v=function t(e,i){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if("string"==typeof i){if(i.match(/^#[0-9a-f]{3,8}$/i))return h(i);if(i.match(/^rgba?\(.*\)$/i))return d(i);var a=(i.match(/[^0-9\.]*$/i)||["px"])[0];return i=parseFloat(i),isNaN(i)?u[e]:("%"===a&&(i/=100),a?[i,a]:i)}if(r(i)){var o=Object.keys(i),s=i;("x"in i||"y"in i)&&(o=["x","y"]),("r"in i||"g"in i||"b"in i||"a"in i)&&(o=["r","g","b","a"]),("left"in i||"right"in i||"top"in i||"bottom"in i)&&(o=["left","right","top","bottom"]),i={};var c,f=l(o);try{for(f.s();!(c=f.n()).done;){var v=c.value;i[v]=t(e,s[v],v)}}catch(t){f.e(t)}finally{f.f()}}if(void 0!==i)return i;var y=u[e];return n in y?y[n]:y},y=function(t,e){return Array.isArray(t)&&(e=t[1],t=t[0]),t*("%"===e?100:1)+e},p=function(t){return Array.isArray(t)&&(t="px"===t[1]?t[0]+"px":t[0]),t},m=function t(e,i,n){if(r(e)){var a={};for(var o in e)a[o]=t(e[o],r(i)?i[o]:i,n);return a}var s;if(Array.isArray(e)&&(s=e[1],e=e[0]),Array.isArray(i)&&(s=i[1],i=i[0]),"number"!=typeof e||"number"!=typeof i)return n>.5?i:e;var u=e*(1-n)+i*n;return s?[u,s]:u},g=function(t,e,i){if(t.length===i)return t[e];var n=e*((t.length-1)/(i-1)),r=Math.floor(n);return r===t.length-1?t[r]:m(t[r],t[r+1],n-r)},b=function(){function t(){i(this,t),this.queue=[],this.tick()}var e;return n(t,[{key:"uuid",value:function(){return Math.floor(1e6*Math.random()).toString(16).padStart("0",6)}},{key:"tick",value:(e=o(s.mark((function t(){var e,i,n;return s.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=Date.now(),i=0;case 2:if(!(i<this.queue.length+1)){t.next=13;break}if(n=this.queue[i],!(this.queue.length===i||n.timestamp>e)){t.next=7;break}return this.queue.splice(0,i),t.abrupt("break",13);case 7:n.callback(),delete n.cancel,delete n.store[n.id+n.timestamp];case 10:i++,t.next=2;break;case 13:requestAnimationFrame(this.tick.bind(this));case 14:case"end":return t.stop()}}),t,this)}))),function(){return e.apply(this,arguments)})},{key:"search",value:function(t){for(var e,i,n=0,r=this.queue.length-1;n<=r;)if(e=n+r>>>1,(i=this.queue[e].timestamp-t.timestamp)<0)n=e+1;else{if(!(i>0))return e;r=e-1}return n}},{key:"insert",value:function(t){var e=this.search(t);this.queue.splice(e,0,t)}},{key:"cancel",value:function(t){for(var e=this.search(t);e>0&&this.queue[e].timestamp>=t.timestamp;)e--;for(;e<this.queue.length&&this.queue[e].timestamp<=t.timestamp;){if(this.queue[e].id===t.id){this.queue.splice(e,1);break}e++}delete t.cancel}},{key:"delay",value:function(t,e){var i=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(t instanceof Function){var r={timestamp:Date.now()+1e3*e,id:this.uuid(),cancel:function(){return i.cancel(r)},callback:t,store:n};return this.insert(r),n[r.id+r.timestamp]=r,r}}}],[{key:"get",value:function(){return a("AnimationQueue",new t),window.Lively.AnimationQueue}},{key:"cancelAll",value:function(t){for(var e in t)t[e].cancel(),delete t[e]}},{key:"delay",value:function(t,e,i){return this.get().delay(t,e,i)}},{key:"sleep",value:function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return new Promise((function(i){t.delay(i,e)}))}}]),t}(),k=["duration","interpolate","origin","useLayout"],x=function(){function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=n.duration,a=void 0===r?0:r,o=n.interpolate,s=void 0===o?"ease":o,u=n.origin,l=void 0===u?{x:.5,y:.5}:u,c=n.useLayout,h=void 0!==c&&c,d=e(n,k);i(this,t),this.style=d,this.start={},this.end={},this.duration=a,this.interpolate="spring"===s?"cubic-bezier(0.65, 0.34, 0.7, 1.42)":s,this.origin=f(l),this.useLayout=h}return n(t,[{key:"addProperty",value:function(t,e){if(!r(e)||!("start"in e||"end"in e||"set"in e))return this.style[t]=e;"start"in e&&(this.start[t]=e.start),"end"in e&&(this.end[t]=e.end),"set"in e&&(this.style[t]=e.set)}},{key:"compile",value:function(){return this.style=this.interpret(this.style),this.start=this.interpret(this.start),this.end=this.interpret(this.end),this}},{key:"interpret",value:function(t){if(!Object.keys(t).length)return null;var e={transform:""};for(var i in t){var n=t[i];if(n instanceof Function){if(null===(n=n()))continue;n=v(i,n)}switch(i){case"position":e.transform+="translate(".concat(y(n.x,"px"),", ").concat(y(n.y,"px"),") ");break;case"scale":if("number"==typeof n&&(n={x:n,y:n}),this.useLayout){e.width=p(n.x),e.height=p(n.y);break}e.transform+="scale(".concat(y(n.x,"%"),", ").concat(y(n.y,"%"),") ");break;case"rotation":e.transform+="rotate(".concat(y(n,"deg"),") ");break;case"clip":e.clipPath="inset(".concat(y(n.top,"%")," ").concat(y(n.right,"%")," ").concat(y(n.bottom,"%")," ").concat(y(n.left,"%"),")"),e.webkitClipPath=e.clipPath;break;case"borderRadius":case"padding":case"fontSize":e[i]=y(n,"px");break;case"backgroundColor":case"color":e[i]="rgba(".concat(n.r,", ").concat(n.g,", ").concat(n.b,", ").concat(n.a,")");break;case"interact":e.pointerEvents=n?"all":"none";break;case"opacity":case"active":case"zIndex":e[i]=n}}return e}},{key:"initial",value:function(t){t.style.transitionTimingFunction=this.interpolate,t.style.transformOrigin=this.origin,this.apply(t,{duration:0})}},{key:"apply",value:function(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=i.duration,r=void 0===n?this.duration:n,a=i.reverse,o=void 0!==a&&a,s=t.setStyle.bind(t,e,this.style,r);this[o?"end":"start"]?(t.setStyle(e,this[o?"end":"start"],0),b.delay(s,.001)):s(),this[o?"start":"end"]&&b.delay(t.setStyle.bind(t,e,this[o?"start":"end"],0),r,e.Lively.timeouts)}},{key:"update",value:function(e){e.style.transitionTimingFunction=this.interpolate,e.style.transformOrigin=this.origin;var i=this.interpret(this.style);t.setStyle(e,i,this.duration)}}],[{key:"setStyle",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;for(var n in t.style.transitionDuration="".concat(i,"s"),e)"width"!==n?"height"!==n?"padding"===n&&(e.width||e.height)||"start"===n||"end"===n||(t.style[n]=e[n]):this.setLength(t,e,"height","paddingTop","paddingBottom"):this.setLength(t,e,"width","paddingLeft","paddingRight")}},{key:"setLength",value:function(t,e,i,n,r){var a=t.Lively.initials[i],o=parseInt(t.Lively.initials[n]),s=parseInt(t.Lively.initials[r]),u=e[i],l=e.padding?1:o/(0===s?1e-6:s);"string"==typeof u&&(u="calc(".concat(u," / ").concat(a,")"));var c=e.padding?e.padding:o+s+"px";t.style[i]="max(calc(".concat(a," * ").concat(u," - ").concat("border-box"!==t.style.boxSizing?"0px":c,"), 0px)");var h="calc(min(calc(".concat(a," * ").concat(u,"), ").concat(c,") * ");t.style[n]=h+.5*l,t.style[r]=h+1/(0===l?1e-6:l)*.5}}]),t}(),L=["delay","duration","repeat"],A=["interpolate","origin","useLayout"],w=function(){function r(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.delay,a=void 0===n?0:n,o=t.duration,s=void 0===o?1:o,u=t.repeat,l=void 0===u?1:u,c=e(t,L),h=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};i(this,r),this.length=0,this.delay=a,this.duration=s,this.repeat=l,this.keyframes=this.parse(c,h)}return n(r,[{key:"initial",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.keyframes[0];e&&e.initial(t)}},{key:"restore",value:function(t){var e,i,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];(n||null!==(e=t.Lively)&&void 0!==e&&e.keyframe)&&this.initial(t,null===(i=t.Lively)||void 0===i?void 0:i.keyframe)}},{key:"parse",value:function(t,i){var n=this,r=t.interpolate,a=t.origin,o=t.useLayout,s=e(t,A),l=function(t){Array.isArray(s[t])||(s[t]=[s[t]]),s[t].length<2&&s[t].unshift(t in i?i[t]:u[t]),s[t]=s[t].map((function(e){return v(t,e)})),n.length=Math.max(s[t].length,n.length)};for(var c in s)l(c);return new Array(this.length).fill(0).map((function(t,e){var i=new x({interpolate:r,origin:a,useLayout:o,duration:n.duration/(n.length-1)});for(var l in s)l in u&&i.addProperty(l,g(s[l],e,n.length));return i.compile()}))}},{key:"start",value:function(t){var e=this,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=i.immediate,r=void 0!==n&&n,a=i.reverse,o=void 0!==a&&a,s=i.repeat,u=void 0===s?this.repeat:s;!t.Lively.animating||r?(this.initial(t,o?this.keyframes[this.length-1]:this.keyframes[0]),t.Lively.index=1,t.Lively.animating=!0,requestAnimationFrame((function(){return e.getNext(t,o,u)}))):t.Lively.queue.push([this,{reverse:o,repeat:u}])}},{key:"play",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=e.delay,n=void 0===i?0:i,r=e.immediate,a=void 0!==r&&r,o=e.reverse,s=void 0!==o&&o;if(t.style&&this.length){a&&(t.Lively.queue=[],b.cancelAll(t.Lively.timeouts));var u=this.start.bind(this,t,{immediate:a,reverse:s});this.delay||n?b.delay(u,this.delay+n,t.Lively.timeouts):u()}}},{key:"getNext",value:function(e){var i=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(e.Lively.index===this.length){e.Lively.animating=!1;var a=e.Lively.queue.shift()||[],o=t(a,2),s=o[0],u=o[1];return s?s.start(e,u):void(r>1&&this.start(e,{reverse:n,repeat:r-1}))}var l=e.Lively.index;n&&(l=this.length-1-l),this.keyframes[l].apply(e,{reverse:n}),e.Lively.keyframe=this.keyframes[l],e.Lively.index++,b.delay((function(){return i.getNext(e,n,r)}),this.duration/(this.length-1),e.Lively.timeouts)}}]),r}(),q={create:function(e){var i=function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return t.use=t.use.bind(t,e),t};return i.use=function(){var i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=e(i),r=t(n,2),a=r[0],o=r[1];return new w(a,o)},i},isAnimation:function(t){return t instanceof Function&&"use"in t}};export{b as A,x as K,w as a,q as b};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import i from"@babel/runtime/helpers/typeof";var n=function(i,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:window;"Lively"in e||(e.Lively={}),i in e.Lively||(e.Lively[i]=n)},e=function(n){return n&&"object"===i(n)&&!Array.isArray(n)},t=function(i,n){return new Array(n).fill(0).map((function(n,e){return e<i.length?i[e]:i[i.length-1]}))},o=function(i,e){if(e instanceof Function){n("Events",{}),i in window.Lively.Events||(window.Lively.Events[i]={unique:0},window.addEventListener(i,(function(n){Object.values(window.Lively.Events[i]).forEach((function(i){i instanceof Function&&i(n)}))})));var t=window.Lively.Events[i];e.Lively={ListenerID:t.unique},t[t.unique++]=e}},l=function(i,n){var e,t;"undefined"!=typeof window&&null!==(e=window.Lively)&&void 0!==e&&null!==(t=e.Events)&&void 0!==t&&t[i]&&null!=n&&n.Lively&&"ListenerID"in n.Lively&&delete window.Lively.Events[i][n.Lively.ListenerID]},r=function(i){n("queue",[],i),n("timeouts",{},i),i.Lively.style||(i.Lively.style=function(i){for(var n={},e=0;e<i.style.length;e++)n[i.style[e]]=i.style[i.style[e]];return n}(i),i.Lively.style.transitionProperty="transform, opacity, clip-path, border-radius, font-size, background-color, color, width, height, padding",i.Lively.style.willChange="transform"),function(i,n){for(var e in i.style={},n)i.style[e]=n[e]}(i,i.Lively.style);var e=getComputedStyle(i),t=e.paddingLeft,o=e.paddingRight,l=e.paddingTop,r=e.paddingBottom,d=e.backgroundColor,a=e.color,s=e.borderRadius,u=e.padding,y=e.fontSize,v=e.zIndex,p=i.getBoundingClientRect(),c=p.x,f=p.y,g=p.width,L=p.height;i.Lively.initials={x:c,y:f,paddingLeft:t,paddingRight:o,paddingTop:l,paddingBottom:r,backgroundColor:d,color:a,fontSize:y,zIndex:"auto"===v?0:parseInt(v),width:g+"px",height:L+"px",borderRadius:s.split(" ")[0],padding:u.split(" ")[0]}};export{o as a,r as c,e as i,n as l,t as p,l as r};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function n(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,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 u,a=!0,c=!1;return{s:function(){e=e.call(n)},n:function(){var n=e.next();return a=n.done,n},e:function(n){c=!0,u=n},f:function(){try{a||null==e.return||e.return()}finally{if(c)throw u}}}}function t(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}function r(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(n){return n};return n.isBound?"undefined"!=typeof window?n(this.value):null:(n.isBound=!0,r.construct(this,n))}r.construct=function(t){for(var e=arguments.length,o=new Array(e>1?e-1:0),i=1;i<e;i++)o[i-1]=arguments[i];var u=r.bind.apply(r,[t].concat(o));return u.set=function(n){return t.value=n},u.link=function(n){return t.linked.push(n),u},u.feed=function(r){t.value=r;var e,o=n(t.linked);try{for(o.s();!(e=o.n()).done;){(0,e.value)()}}catch(n){o.e(n)}finally{o.f()}},u},r.create=function(n){return r.construct({value:n,linked:[]})},r.isLink=function(n){return n instanceof Function&&"link"in n};export{r as L};
|
package/dist/esm/pop-ee3fdaef.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/defineProperty";import r from"@babel/runtime/helpers/objectWithoutProperties";import{b as t}from"./animation-9ea0228d.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({position:{x:0,y:0},opacity:1,duration:.5},i),{position:{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 +0,0 @@
|
|
|
1
|
-
import{useEffect as r}from"react";import{L as o}from"./link-67981677.js";import{a as n,r as t}from"./helper-6ed90764.js";function e(){var e=o.create(0);return r((function(){var r=function(){return e.feed(window.scrollY)};return e.set(window.scrollY),n("scroll",r),function(){return t("scroll",r)}}),[]),e}export{e as u};
|