Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

animate-css-grid

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

animate-css-grid - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

2

dist/main.js

@@ -1,1 +0,1 @@

!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.animateCSSGrid=n():t.animateCSSGrid=n()}(window,function(){return function(t){var n={};function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}return e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=4)}([function(t,n){var e;e=function(){return this}();try{e=e||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(e=window)}t.exports=e},function(t,n,e){(function(n){var e="Expected a function",i=NaN,r="[object Symbol]",o=/^\s+|\s+$/g,a=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,s=/^0o[0-7]+$/i,c=parseInt,l="object"==typeof n&&n&&n.Object===Object&&n,h="object"==typeof self&&self&&self.Object===Object&&self,f=l||h||Function("return this")(),d=Object.prototype.toString,p=Math.max,_=Math.min,v=function(){return f.Date.now()};function w(t,n,i){var r,o,a,u,s,c,l=0,h=!1,f=!1,d=!0;if("function"!=typeof t)throw new TypeError(e);function w(n){var e=r,i=o;return r=o=void 0,l=n,u=t.apply(i,e)}function y(t){var e=t-c;return void 0===c||e>=n||e<0||f&&t-l>=a}function b(){var t=v();if(y(t))return T(t);s=setTimeout(b,function(t){var e=n-(t-c);return f?_(e,a-(t-l)):e}(t))}function T(t){return s=void 0,d&&r?w(t):(r=o=void 0,u)}function I(){var t=v(),e=y(t);if(r=arguments,o=this,c=t,e){if(void 0===s)return function(t){return l=t,s=setTimeout(b,n),h?w(t):u}(c);if(f)return s=setTimeout(b,n),w(c)}return void 0===s&&(s=setTimeout(b,n)),u}return n=g(n)||0,m(i)&&(h=!!i.leading,a=(f="maxWait"in i)?p(g(i.maxWait)||0,n):a,d="trailing"in i?!!i.trailing:d),I.cancel=function(){void 0!==s&&clearTimeout(s),l=0,r=c=o=s=void 0},I.flush=function(){return void 0===s?u:T(v())},I}function m(t){var n=typeof t;return!!t&&("object"==n||"function"==n)}function g(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&d.call(t)==r}(t))return i;if(m(t)){var n="function"==typeof t.valueOf?t.valueOf():t;t=m(n)?n+"":n}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(o,"");var e=u.test(t);return e||s.test(t)?c(t.slice(2),e?2:8):a.test(t)?i:+t}t.exports=function(t,n,i){var r=!0,o=!0;if("function"!=typeof t)throw new TypeError(e);return m(i)&&(r="leading"in i?!!i.leading:r,o="trailing"in i?!!i.trailing:o),w(t,n,{leading:r,maxWait:n,trailing:o})}}).call(this,e(0))},function(t,n){var e,i,r=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(t){if(e===setTimeout)return setTimeout(t,0);if((e===o||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(n){try{return e.call(null,t,0)}catch(n){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:o}catch(t){e=o}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(t){i=a}}();var s,c=[],l=!1,h=-1;function f(){l&&s&&(l=!1,s.length?c=s.concat(c):h=-1,c.length&&d())}function d(){if(!l){var t=u(f);l=!0;for(var n=c.length;n;){for(s=c,c=[];++h<n;)s&&s[h].run();h=-1,n=c.length}s=null,l=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===a||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{i(t)}catch(n){try{return i.call(null,t)}catch(n){return i.call(this,t)}}}(t)}}function p(t,n){this.fun=t,this.array=n}function _(){}r.nextTick=function(t){var n=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)n[e-1]=arguments[e];c.push(new p(t,n)),1!==c.length||l||u(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=_,r.addListener=_,r.once=_,r.off=_,r.removeListener=_,r.removeAllListeners=_,r.emit=_,r.prependListener=_,r.prependOnceListener=_,r.listeners=function(t){return[]},r.binding=function(t){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(t){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(t,n,e){(function(e){var i,r=function(){this._tweens={},this._tweensAddedDuringUpdate={}};r.prototype={getAll:function(){return Object.keys(this._tweens).map(function(t){return this._tweens[t]}.bind(this))},removeAll:function(){this._tweens={}},add:function(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t},remove:function(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]},update:function(t,n){var e=Object.keys(this._tweens);if(0===e.length)return!1;for(t=void 0!==t?t:a.now();e.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<e.length;i++){var r=this._tweens[e[i]];r&&!1===r.update(t)&&(r._isPlaying=!1,n||delete this._tweens[e[i]])}e=Object.keys(this._tweensAddedDuringUpdate)}return!0}};var o,a=new r;a.Group=r,a._nextId=0,a.nextId=function(){return a._nextId++},"undefined"==typeof window&&void 0!==e?a.now=function(){var t=e.hrtime();return 1e3*t[0]+t[1]/1e6}:"undefined"!=typeof window&&void 0!==window.performance&&void 0!==window.performance.now?a.now=window.performance.now.bind(window.performance):void 0!==Date.now?a.now=Date.now:a.now=function(){return(new Date).getTime()},a.Tween=function(t,n){this._object=t,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._repeat=0,this._repeatDelayTime=void 0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=null,this._easingFunction=a.Easing.Linear.None,this._interpolationFunction=a.Interpolation.Linear,this._chainedTweens=[],this._onStartCallback=null,this._onStartCallbackFired=!1,this._onUpdateCallback=null,this._onCompleteCallback=null,this._onStopCallback=null,this._group=n||a,this._id=a.nextId()},a.Tween.prototype={getId:function(){return this._id},isPlaying:function(){return this._isPlaying},to:function(t,n){return this._valuesEnd=t,void 0!==n&&(this._duration=n),this},start:function(t){for(var n in this._group.add(this),this._isPlaying=!0,this._onStartCallbackFired=!1,this._startTime=void 0!==t?"string"==typeof t?a.now()+parseFloat(t):t:a.now(),this._startTime+=this._delayTime,this._valuesEnd){if(this._valuesEnd[n]instanceof Array){if(0===this._valuesEnd[n].length)continue;this._valuesEnd[n]=[this._object[n]].concat(this._valuesEnd[n])}void 0!==this._object[n]&&(this._valuesStart[n]=this._object[n],this._valuesStart[n]instanceof Array==!1&&(this._valuesStart[n]*=1),this._valuesStartRepeat[n]=this._valuesStart[n]||0)}return this},stop:function(){return this._isPlaying?(this._group.remove(this),this._isPlaying=!1,null!==this._onStopCallback&&this._onStopCallback(this._object),this.stopChainedTweens(),this):this},end:function(){return this.update(this._startTime+this._duration),this},stopChainedTweens:function(){for(var t=0,n=this._chainedTweens.length;t<n;t++)this._chainedTweens[t].stop()},group:function(t){return this._group=t,this},delay:function(t){return this._delayTime=t,this},repeat:function(t){return this._repeat=t,this},repeatDelay:function(t){return this._repeatDelayTime=t,this},yoyo:function(t){return this._yoyo=t,this},easing:function(t){return this._easingFunction=t,this},interpolation:function(t){return this._interpolationFunction=t,this},chain:function(){return this._chainedTweens=arguments,this},onStart:function(t){return this._onStartCallback=t,this},onUpdate:function(t){return this._onUpdateCallback=t,this},onComplete:function(t){return this._onCompleteCallback=t,this},onStop:function(t){return this._onStopCallback=t,this},update:function(t){var n,e,i;if(t<this._startTime)return!0;for(n in!1===this._onStartCallbackFired&&(null!==this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),e=(t-this._startTime)/this._duration,e=0===this._duration||e>1?1:e,i=this._easingFunction(e),this._valuesEnd)if(void 0!==this._valuesStart[n]){var r=this._valuesStart[n]||0,o=this._valuesEnd[n];o instanceof Array?this._object[n]=this._interpolationFunction(o,i):("string"==typeof o&&(o="+"===o.charAt(0)||"-"===o.charAt(0)?r+parseFloat(o):parseFloat(o)),"number"==typeof o&&(this._object[n]=r+(o-r)*i))}if(null!==this._onUpdateCallback&&this._onUpdateCallback(this._object),1===e){if(this._repeat>0){for(n in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat){if("string"==typeof this._valuesEnd[n]&&(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo){var a=this._valuesStartRepeat[n];this._valuesStartRepeat[n]=this._valuesEnd[n],this._valuesEnd[n]=a}this._valuesStart[n]=this._valuesStartRepeat[n]}return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=t+this._repeatDelayTime:this._startTime=t+this._delayTime,!0}null!==this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var u=0,s=this._chainedTweens.length;u<s;u++)this._chainedTweens[u].start(this._startTime+this._duration);return!1}return!0}},a.Easing={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1}},Back:{In:function(t){var n=1.70158;return t*t*((n+1)*t-n)},Out:function(t){var n=1.70158;return--t*t*((n+1)*t+n)+1},InOut:function(t){var n=2.5949095;return(t*=2)<1?t*t*((n+1)*t-n)*.5:.5*((t-=2)*t*((n+1)*t+n)+2)}},Bounce:{In:function(t){return 1-a.Easing.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*a.Easing.Bounce.In(2*t):.5*a.Easing.Bounce.Out(2*t-1)+.5}}},a.Interpolation={Linear:function(t,n){var e=t.length-1,i=e*n,r=Math.floor(i),o=a.Interpolation.Utils.Linear;return n<0?o(t[0],t[1],i):n>1?o(t[e],t[e-1],e-i):o(t[r],t[r+1>e?e:r+1],i-r)},Bezier:function(t,n){for(var e=0,i=t.length-1,r=Math.pow,o=a.Interpolation.Utils.Bernstein,u=0;u<=i;u++)e+=r(1-n,i-u)*r(n,u)*t[u]*o(i,u);return e},CatmullRom:function(t,n){var e=t.length-1,i=e*n,r=Math.floor(i),o=a.Interpolation.Utils.CatmullRom;return t[0]===t[e]?(n<0&&(r=Math.floor(i=e*(1+n))),o(t[(r-1+e)%e],t[r],t[(r+1)%e],t[(r+2)%e],i-r)):n<0?t[0]-(o(t[0],t[0],t[1],t[1],-i)-t[0]):n>1?t[e]-(o(t[e],t[e],t[e-1],t[e-1],i-e)-t[e]):o(t[r?r-1:0],t[r],t[e<r+1?e:r+1],t[e<r+2?e:r+2],i-r)},Utils:{Linear:function(t,n,e){return(n-t)*e+t},Bernstein:function(t,n){var e=a.Interpolation.Utils.Factorial;return e(t)/e(n)/e(t-n)},Factorial:(o=[1],function(t){var n=1;if(o[t])return o[t];for(var e=t;e>1;e--)n*=e;return o[t]=n,n}),CatmullRom:function(t,n,e,i,r){var o=.5*(e-t),a=.5*(i-n),u=r*r;return(2*n-2*e+o+a)*(r*u)+(-3*n+3*e-2*o-a)*u+o*r+n}}},void 0===(i=function(){return a}.apply(n,[]))||(t.exports=i)}).call(this,e(2))},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.wrapGrid=void 0;var i=o(e(3)),r=o(e(1));function o(t){return t&&t.__esModule?t:{default:t}}function a(t){if(Array.isArray(t)){for(var n=0,e=Array(t.length);n<t.length;n++)e[n]=t[n];return e}return Array.from(t)}var u=function(t,n){var e=n.getBoundingClientRect(),i={top:e.top,left:e.left,width:e.width,height:e.height};return i.top-=t.top,i.left-=t.left,i},s=function(t,n){var e=t.left,i=t.top+n.top,r=e+t.width;return i+t.height>0&&i<window.innerHeight&&r>0&&e<window.innerWidth};n.wrapGrid=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=n.duration,o=void 0===e?250:e,c=n.stagger,l=n.easing,h=void 0===l?"Quadratic.InOut":l,f={},d=function(n){var e=t.getBoundingClientRect();[].concat(a(n)).forEach(function(t){if("function"==typeof t.getBoundingClientRect){if(!t.dataset.animateGridId){var n=Math.random();t.dataset.animateGridId=n,f[n]={}}var i=t.dataset.animateGridId,r=u(e,t);f[i].rect=r}})};d(t.children);var p=(0,r.default)(function(){d(t.children)},250);window.addEventListener("resize",p);var _=function(n){if("forceGridAnimation"!==n&&!n.filter(function(t){return"class"===t.attributeName||t.addedNodes.length||t.removedNodes.length}).length)return;var e=t.getBoundingClientRect(),r=[].concat(a(t.children));r.filter(function(t){var n=f[t.dataset.animateGridId];if(n&&n.tween)return n.tween.stop(),delete n.tween,!0}).forEach(function(t){t.style.transform="",t.children[0].style.transform=""});r.map(function(t){return{el:t,boundingClientRect:u(e,t)}}).filter(function(t){var n=t.el,i=t.boundingClientRect,r=f[n.dataset.animateGridId];return r?i.top===r.rect.top&&i.left===r.rect.left&&i.width===r.rect.width&&i.height===r.rect.height||!(!s(i,e)&&!s(r.rect,e)):(d([n]),!1)}).forEach(function(t,n,e){var r=t.el,u=t.boundingClientRect;if([].concat(a(r.children)).length>1)throw new Error("Make sure every grid item has a single container element surrounding its children");var s=f[r.dataset.animateGridId],l=u.top,p=u.left,_=u.width,v=u.height,w={};w.scaleX=s.rect.width/_,w.scaleY=s.rect.height/v,w.translateX=s.rect.left-p,w.translateY=s.rect.top-l,r.style.transform="translate("+w.translateX+"px, "+w.translateY+"px) scale("+w.scaleX+", "+w.scaleY+")",r.style.transformOrigin="0 0",r.children[0].style.transform="scale("+1/w.scaleX+","+1/w.scaleY+")";var m=new i.default.Tween(w).to({translateX:0,translateY:0,scaleX:1,scaleY:1},o).easing(i.default.Easing[h.split(".")[0]][h.split(".")[1]]).onUpdate(function(){requestAnimationFrame(function(){d([r])}),r.style.transform="translate("+w.translateX+"px, "+w.translateY+"px) scale("+w.scaleX+", "+w.scaleY+")",r.children[0].style.transform="scale("+1/w.scaleX+","+1/w.scaleY+")",0===w.translateX&&0===w.translateY&&1===w.scaleX&&1===w.scaleY&&delete s.tween});c&&m.delay(o/e.length*n),m.start(),s.tween=m});requestAnimationFrame(function t(n){i.default.getAll().every(function(t){return!t.isPlaying()})||(requestAnimationFrame(t),i.default.update(n))})},v=(0,r.default)(_,100),w=new MutationObserver(v);w.observe(t,{childList:!0,attributes:!0,subtree:!0,attributeFilter:["class"]});return{unwrapGrid:function(){window.removeEventListener("resize",p),w.disconnect()},forceGridAnimation:function(){return _("forceGridAnimation")}}}}])});
!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define([],n):"object"==typeof exports?exports.animateCSSGrid=n():t.animateCSSGrid=n()}(window,function(){return function(t){var n={};function e(i){if(n[i])return n[i].exports;var r=n[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,e),r.l=!0,r.exports}return e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=4)}([function(t,n){var e;e=function(){return this}();try{e=e||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(e=window)}t.exports=e},function(t,n,e){(function(n){var e="Expected a function",i=NaN,r="[object Symbol]",o=/^\s+|\s+$/g,a=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,s=/^0o[0-7]+$/i,c=parseInt,l="object"==typeof n&&n&&n.Object===Object&&n,h="object"==typeof self&&self&&self.Object===Object&&self,f=l||h||Function("return this")(),d=Object.prototype.toString,p=Math.max,_=Math.min,v=function(){return f.Date.now()};function w(t,n,i){var r,o,a,u,s,c,l=0,h=!1,f=!1,d=!0;if("function"!=typeof t)throw new TypeError(e);function w(n){var e=r,i=o;return r=o=void 0,l=n,u=t.apply(i,e)}function y(t){var e=t-c;return void 0===c||e>=n||e<0||f&&t-l>=a}function b(){var t=v();if(y(t))return T(t);s=setTimeout(b,function(t){var e=n-(t-c);return f?_(e,a-(t-l)):e}(t))}function T(t){return s=void 0,d&&r?w(t):(r=o=void 0,u)}function I(){var t=v(),e=y(t);if(r=arguments,o=this,c=t,e){if(void 0===s)return function(t){return l=t,s=setTimeout(b,n),h?w(t):u}(c);if(f)return s=setTimeout(b,n),w(c)}return void 0===s&&(s=setTimeout(b,n)),u}return n=g(n)||0,m(i)&&(h=!!i.leading,a=(f="maxWait"in i)?p(g(i.maxWait)||0,n):a,d="trailing"in i?!!i.trailing:d),I.cancel=function(){void 0!==s&&clearTimeout(s),l=0,r=c=o=s=void 0},I.flush=function(){return void 0===s?u:T(v())},I}function m(t){var n=typeof t;return!!t&&("object"==n||"function"==n)}function g(t){if("number"==typeof t)return t;if(function(t){return"symbol"==typeof t||function(t){return!!t&&"object"==typeof t}(t)&&d.call(t)==r}(t))return i;if(m(t)){var n="function"==typeof t.valueOf?t.valueOf():t;t=m(n)?n+"":n}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(o,"");var e=u.test(t);return e||s.test(t)?c(t.slice(2),e?2:8):a.test(t)?i:+t}t.exports=function(t,n,i){var r=!0,o=!0;if("function"!=typeof t)throw new TypeError(e);return m(i)&&(r="leading"in i?!!i.leading:r,o="trailing"in i?!!i.trailing:o),w(t,n,{leading:r,maxWait:n,trailing:o})}}).call(this,e(0))},function(t,n){var e,i,r=t.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(t){if(e===setTimeout)return setTimeout(t,0);if((e===o||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(n){try{return e.call(null,t,0)}catch(n){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:o}catch(t){e=o}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(t){i=a}}();var s,c=[],l=!1,h=-1;function f(){l&&s&&(l=!1,s.length?c=s.concat(c):h=-1,c.length&&d())}function d(){if(!l){var t=u(f);l=!0;for(var n=c.length;n;){for(s=c,c=[];++h<n;)s&&s[h].run();h=-1,n=c.length}s=null,l=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===a||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{i(t)}catch(n){try{return i.call(null,t)}catch(n){return i.call(this,t)}}}(t)}}function p(t,n){this.fun=t,this.array=n}function _(){}r.nextTick=function(t){var n=new Array(arguments.length-1);if(arguments.length>1)for(var e=1;e<arguments.length;e++)n[e-1]=arguments[e];c.push(new p(t,n)),1!==c.length||l||u(d)},p.prototype.run=function(){this.fun.apply(null,this.array)},r.title="browser",r.browser=!0,r.env={},r.argv=[],r.version="",r.versions={},r.on=_,r.addListener=_,r.once=_,r.off=_,r.removeListener=_,r.removeAllListeners=_,r.emit=_,r.prependListener=_,r.prependOnceListener=_,r.listeners=function(t){return[]},r.binding=function(t){throw new Error("process.binding is not supported")},r.cwd=function(){return"/"},r.chdir=function(t){throw new Error("process.chdir is not supported")},r.umask=function(){return 0}},function(t,n,e){(function(e){var i,r=function(){this._tweens={},this._tweensAddedDuringUpdate={}};r.prototype={getAll:function(){return Object.keys(this._tweens).map(function(t){return this._tweens[t]}.bind(this))},removeAll:function(){this._tweens={}},add:function(t){this._tweens[t.getId()]=t,this._tweensAddedDuringUpdate[t.getId()]=t},remove:function(t){delete this._tweens[t.getId()],delete this._tweensAddedDuringUpdate[t.getId()]},update:function(t,n){var e=Object.keys(this._tweens);if(0===e.length)return!1;for(t=void 0!==t?t:a.now();e.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<e.length;i++){var r=this._tweens[e[i]];r&&!1===r.update(t)&&(r._isPlaying=!1,n||delete this._tweens[e[i]])}e=Object.keys(this._tweensAddedDuringUpdate)}return!0}};var o,a=new r;a.Group=r,a._nextId=0,a.nextId=function(){return a._nextId++},"undefined"==typeof window&&void 0!==e?a.now=function(){var t=e.hrtime();return 1e3*t[0]+t[1]/1e6}:"undefined"!=typeof window&&void 0!==window.performance&&void 0!==window.performance.now?a.now=window.performance.now.bind(window.performance):void 0!==Date.now?a.now=Date.now:a.now=function(){return(new Date).getTime()},a.Tween=function(t,n){this._object=t,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._repeat=0,this._repeatDelayTime=void 0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=null,this._easingFunction=a.Easing.Linear.None,this._interpolationFunction=a.Interpolation.Linear,this._chainedTweens=[],this._onStartCallback=null,this._onStartCallbackFired=!1,this._onUpdateCallback=null,this._onCompleteCallback=null,this._onStopCallback=null,this._group=n||a,this._id=a.nextId()},a.Tween.prototype={getId:function(){return this._id},isPlaying:function(){return this._isPlaying},to:function(t,n){return this._valuesEnd=t,void 0!==n&&(this._duration=n),this},start:function(t){for(var n in this._group.add(this),this._isPlaying=!0,this._onStartCallbackFired=!1,this._startTime=void 0!==t?"string"==typeof t?a.now()+parseFloat(t):t:a.now(),this._startTime+=this._delayTime,this._valuesEnd){if(this._valuesEnd[n]instanceof Array){if(0===this._valuesEnd[n].length)continue;this._valuesEnd[n]=[this._object[n]].concat(this._valuesEnd[n])}void 0!==this._object[n]&&(this._valuesStart[n]=this._object[n],this._valuesStart[n]instanceof Array==!1&&(this._valuesStart[n]*=1),this._valuesStartRepeat[n]=this._valuesStart[n]||0)}return this},stop:function(){return this._isPlaying?(this._group.remove(this),this._isPlaying=!1,null!==this._onStopCallback&&this._onStopCallback(this._object),this.stopChainedTweens(),this):this},end:function(){return this.update(this._startTime+this._duration),this},stopChainedTweens:function(){for(var t=0,n=this._chainedTweens.length;t<n;t++)this._chainedTweens[t].stop()},group:function(t){return this._group=t,this},delay:function(t){return this._delayTime=t,this},repeat:function(t){return this._repeat=t,this},repeatDelay:function(t){return this._repeatDelayTime=t,this},yoyo:function(t){return this._yoyo=t,this},easing:function(t){return this._easingFunction=t,this},interpolation:function(t){return this._interpolationFunction=t,this},chain:function(){return this._chainedTweens=arguments,this},onStart:function(t){return this._onStartCallback=t,this},onUpdate:function(t){return this._onUpdateCallback=t,this},onComplete:function(t){return this._onCompleteCallback=t,this},onStop:function(t){return this._onStopCallback=t,this},update:function(t){var n,e,i;if(t<this._startTime)return!0;for(n in!1===this._onStartCallbackFired&&(null!==this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),e=(t-this._startTime)/this._duration,e=0===this._duration||e>1?1:e,i=this._easingFunction(e),this._valuesEnd)if(void 0!==this._valuesStart[n]){var r=this._valuesStart[n]||0,o=this._valuesEnd[n];o instanceof Array?this._object[n]=this._interpolationFunction(o,i):("string"==typeof o&&(o="+"===o.charAt(0)||"-"===o.charAt(0)?r+parseFloat(o):parseFloat(o)),"number"==typeof o&&(this._object[n]=r+(o-r)*i))}if(null!==this._onUpdateCallback&&this._onUpdateCallback(this._object),1===e){if(this._repeat>0){for(n in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat){if("string"==typeof this._valuesEnd[n]&&(this._valuesStartRepeat[n]=this._valuesStartRepeat[n]+parseFloat(this._valuesEnd[n])),this._yoyo){var a=this._valuesStartRepeat[n];this._valuesStartRepeat[n]=this._valuesEnd[n],this._valuesEnd[n]=a}this._valuesStart[n]=this._valuesStartRepeat[n]}return this._yoyo&&(this._reversed=!this._reversed),void 0!==this._repeatDelayTime?this._startTime=t+this._repeatDelayTime:this._startTime=t+this._delayTime,!0}null!==this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var u=0,s=this._chainedTweens.length;u<s;u++)this._chainedTweens[u].start(this._startTime+this._duration);return!1}return!0}},a.Easing={Linear:{None:function(t){return t}},Quadratic:{In:function(t){return t*t},Out:function(t){return t*(2-t)},InOut:function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)}},Cubic:{In:function(t){return t*t*t},Out:function(t){return--t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)}},Quartic:{In:function(t){return t*t*t*t},Out:function(t){return 1- --t*t*t*t},InOut:function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)}},Quintic:{In:function(t){return t*t*t*t*t},Out:function(t){return--t*t*t*t*t+1},InOut:function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},Sinusoidal:{In:function(t){return 1-Math.cos(t*Math.PI/2)},Out:function(t){return Math.sin(t*Math.PI/2)},InOut:function(t){return.5*(1-Math.cos(Math.PI*t))}},Exponential:{In:function(t){return 0===t?0:Math.pow(1024,t-1)},Out:function(t){return 1===t?1:1-Math.pow(2,-10*t)},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(2-Math.pow(2,-10*(t-1)))}},Circular:{In:function(t){return 1-Math.sqrt(1-t*t)},Out:function(t){return Math.sqrt(1- --t*t)},InOut:function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},Elastic:{In:function(t){return 0===t?0:1===t?1:-Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)},Out:function(t){return 0===t?0:1===t?1:Math.pow(2,-10*t)*Math.sin(5*(t-.1)*Math.PI)+1},InOut:function(t){return 0===t?0:1===t?1:(t*=2)<1?-.5*Math.pow(2,10*(t-1))*Math.sin(5*(t-1.1)*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin(5*(t-1.1)*Math.PI)+1}},Back:{In:function(t){var n=1.70158;return t*t*((n+1)*t-n)},Out:function(t){var n=1.70158;return--t*t*((n+1)*t+n)+1},InOut:function(t){var n=2.5949095;return(t*=2)<1?t*t*((n+1)*t-n)*.5:.5*((t-=2)*t*((n+1)*t+n)+2)}},Bounce:{In:function(t){return 1-a.Easing.Bounce.Out(1-t)},Out:function(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},InOut:function(t){return t<.5?.5*a.Easing.Bounce.In(2*t):.5*a.Easing.Bounce.Out(2*t-1)+.5}}},a.Interpolation={Linear:function(t,n){var e=t.length-1,i=e*n,r=Math.floor(i),o=a.Interpolation.Utils.Linear;return n<0?o(t[0],t[1],i):n>1?o(t[e],t[e-1],e-i):o(t[r],t[r+1>e?e:r+1],i-r)},Bezier:function(t,n){for(var e=0,i=t.length-1,r=Math.pow,o=a.Interpolation.Utils.Bernstein,u=0;u<=i;u++)e+=r(1-n,i-u)*r(n,u)*t[u]*o(i,u);return e},CatmullRom:function(t,n){var e=t.length-1,i=e*n,r=Math.floor(i),o=a.Interpolation.Utils.CatmullRom;return t[0]===t[e]?(n<0&&(r=Math.floor(i=e*(1+n))),o(t[(r-1+e)%e],t[r],t[(r+1)%e],t[(r+2)%e],i-r)):n<0?t[0]-(o(t[0],t[0],t[1],t[1],-i)-t[0]):n>1?t[e]-(o(t[e],t[e],t[e-1],t[e-1],i-e)-t[e]):o(t[r?r-1:0],t[r],t[e<r+1?e:r+1],t[e<r+2?e:r+2],i-r)},Utils:{Linear:function(t,n,e){return(n-t)*e+t},Bernstein:function(t,n){var e=a.Interpolation.Utils.Factorial;return e(t)/e(n)/e(t-n)},Factorial:(o=[1],function(t){var n=1;if(o[t])return o[t];for(var e=t;e>1;e--)n*=e;return o[t]=n,n}),CatmullRom:function(t,n,e,i,r){var o=.5*(e-t),a=.5*(i-n),u=r*r;return(2*n-2*e+o+a)*(r*u)+(-3*n+3*e-2*o-a)*u+o*r+n}}},void 0===(i=function(){return a}.apply(n,[]))||(t.exports=i)}).call(this,e(2))},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.wrapGrid=void 0;var i=o(e(3)),r=o(e(1));function o(t){return t&&t.__esModule?t:{default:t}}function a(t){if(Array.isArray(t)){for(var n=0,e=Array(t.length);n<t.length;n++)e[n]=t[n];return e}return Array.from(t)}var u=function(t,n){var e=n.getBoundingClientRect(),i={top:e.top,left:e.left,width:e.width,height:e.height};return i.top-=t.top,i.left-=t.left,i},s=function(t,n){var e=t.left,i=t.top+n.top,r=e+t.width;return i+t.height>0&&i<window.innerHeight&&r>0&&e<window.innerWidth};n.wrapGrid=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=n.duration,o=void 0===e?250:e,c=n.stagger,l=n.easing,h=void 0===l?"Quadratic.InOut":l,f={},d=function(n){var e=t.getBoundingClientRect();[].concat(a(n)).forEach(function(t){if("function"==typeof t.getBoundingClientRect){if(!t.dataset.animateGridId){var n=Math.random();t.dataset.animateGridId=n,f[n]={}}var i=t.dataset.animateGridId,r=u(e,t);f[i].rect=r}})};d(t.children);var p=(0,r.default)(function(){d(t.children)},250);window.addEventListener("resize",p);var _=function(n){if("forceGridAnimation"!==n&&!n.filter(function(t){return"class"===t.attributeName||t.addedNodes.length||t.removedNodes.length}).length)return;var e=t.getBoundingClientRect(),r=[].concat(a(t.children));r.filter(function(t){var n=f[t.dataset.animateGridId];if(n&&n.tween)return n.tween.stop(),delete n.tween,!0}).forEach(function(t){t.style.transform="",t.children[0].style.transform=""});r.map(function(t){return{el:t,boundingClientRect:u(e,t)}}).filter(function(t){var n=t.el,i=t.boundingClientRect,r=f[n.dataset.animateGridId];return r?i.top===r.rect.top&&i.left===r.rect.left&&i.width===r.rect.width&&i.height===r.rect.height||!(!s(i,e)&&!s(r.rect,e)):(d([n]),!1)}).forEach(function(t,n,e){var r=t.el,u=t.boundingClientRect;if([].concat(a(r.children)).length>1)throw new Error("Make sure every grid item has a single container element surrounding its children");var s=f[r.dataset.animateGridId],l=u.top,p=u.left,_=u.width,v=u.height,w={};w.scaleX=s.rect.width/_,w.scaleY=s.rect.height/v,w.translateX=s.rect.left-p,w.translateY=s.rect.top-l,r.style.transform="translate("+w.translateX+"px, "+w.translateY+"px) scale("+w.scaleX+", "+w.scaleY+")",r.style.transformOrigin="0 0",r.children[0].style.transform="scale("+1/w.scaleX+","+1/w.scaleY+")";var m=new i.default.Tween(w).to({translateX:0,translateY:0,scaleX:1,scaleY:1},o).easing(i.default.Easing[h.split(".")[0]][h.split(".")[1]]).onUpdate(function(){requestAnimationFrame(function(){d([r])}),r.style.transform="translate("+w.translateX+"px, "+w.translateY+"px) scale("+w.scaleX+", "+w.scaleY+")",r.children[0].style.transform="scale("+1/w.scaleX+","+1/w.scaleY+")",0===w.translateX&&0===w.translateY&&1===w.scaleX&&1===w.scaleY&&delete s.tween});c&&m.delay(o/e.length*n),m.start(),s.tween=m});requestAnimationFrame(function t(n){i.default.getAll().every(function(t){return!t.isPlaying()})||(requestAnimationFrame(t),i.default.update(n))})},v=new MutationObserver(_);v.observe(t,{childList:!0,attributes:!0,subtree:!0,attributeFilter:["class"]});return{unwrapGrid:function(){window.removeEventListener("resize",p),v.disconnect()},forceGridAnimation:function(){return _("forceGridAnimation")}}}}])});
{
"name": "animate-css-grid",
"version": "0.4.0",
"version": "0.4.1",
"description": "Easy, smooth transitions for CSS grid",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/aholachek/animate-css-grid",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc