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.2.4 to 0.2.5

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]",a=/^\s+|\s+$/g,o=/^[-+]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 g(t,n,i){var r,a,o,u,s,c,l=0,h=!1,f=!1,d=!0;if("function"!=typeof t)throw new TypeError(e);function g(n){var e=r,i=a;return r=a=void 0,l=n,u=t.apply(i,e)}function m(t){var e=t-c;return void 0===c||e>=n||e<0||f&&t-l>=o}function b(){var t=v();if(m(t))return T(t);s=setTimeout(b,function(t){var e=n-(t-c);return f?_(e,o-(t-l)):e}(t))}function T(t){return s=void 0,d&&r?g(t):(r=a=void 0,u)}function I(){var t=v(),e=m(t);if(r=arguments,a=this,c=t,e){if(void 0===s)return function(t){return l=t,s=setTimeout(b,n),h?g(t):u}(c);if(f)return s=setTimeout(b,n),g(c)}return void 0===s&&(s=setTimeout(b,n)),u}return n=y(n)||0,w(i)&&(h=!!i.leading,o=(f="maxWait"in i)?p(y(i.maxWait)||0,n):o,d="trailing"in i?!!i.trailing:d),I.cancel=function(){void 0!==s&&clearTimeout(s),l=0,r=c=a=s=void 0},I.flush=function(){return void 0===s?u:T(v())},I}function w(t){var n=typeof t;return!!t&&("object"==n||"function"==n)}function y(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(w(t)){var n="function"==typeof t.valueOf?t.valueOf():t;t=w(n)?n+"":n}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(a,"");var e=u.test(t);return e||s.test(t)?c(t.slice(2),e?2:8):o.test(t)?i:+t}t.exports=function(t,n,i){var r=!0,a=!0;if("function"!=typeof t)throw new TypeError(e);return w(i)&&(r="leading"in i?!!i.leading:r,a="trailing"in i?!!i.trailing:a),g(t,n,{leading:r,maxWait:n,trailing:a})}}).call(this,e(0))},function(t,n){var e,i,r=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function u(t){if(e===setTimeout)return setTimeout(t,0);if((e===a||!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:a}catch(t){e=a}try{i="function"==typeof clearTimeout?clearTimeout:o}catch(t){i=o}}();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===o||!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:o.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 a,o=new r;o.Group=r,o._nextId=0,o.nextId=function(){return o._nextId++},"undefined"==typeof window&&void 0!==e?o.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?o.now=window.performance.now.bind(window.performance):void 0!==Date.now?o.now=Date.now:o.now=function(){return(new Date).getTime()},o.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=o.Easing.Linear.None,this._interpolationFunction=o.Interpolation.Linear,this._chainedTweens=[],this._onStartCallback=null,this._onStartCallbackFired=!1,this._onUpdateCallback=null,this._onCompleteCallback=null,this._onStopCallback=null,this._group=n||o,this._id=o.nextId()},o.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?o.now()+parseFloat(t):t:o.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,a=this._valuesEnd[n];a instanceof Array?this._object[n]=this._interpolationFunction(a,i):("string"==typeof a&&(a="+"===a.charAt(0)||"-"===a.charAt(0)?r+parseFloat(a):parseFloat(a)),"number"==typeof a&&(this._object[n]=r+(a-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 o=this._valuesStartRepeat[n];this._valuesStartRepeat[n]=this._valuesEnd[n],this._valuesEnd[n]=o}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}},o.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-o.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*o.Easing.Bounce.In(2*t):.5*o.Easing.Bounce.Out(2*t-1)+.5}}},o.Interpolation={Linear:function(t,n){var e=t.length-1,i=e*n,r=Math.floor(i),a=o.Interpolation.Utils.Linear;return n<0?a(t[0],t[1],i):n>1?a(t[e],t[e-1],e-i):a(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,a=o.Interpolation.Utils.Bernstein,u=0;u<=i;u++)e+=r(1-n,i-u)*r(n,u)*t[u]*a(i,u);return e},CatmullRom:function(t,n){var e=t.length-1,i=e*n,r=Math.floor(i),a=o.Interpolation.Utils.CatmullRom;return t[0]===t[e]?(n<0&&(r=Math.floor(i=e*(1+n))),a(t[(r-1+e)%e],t[r],t[(r+1)%e],t[(r+2)%e],i-r)):n<0?t[0]-(a(t[0],t[0],t[1],t[1],-i)-t[0]):n>1?t[e]-(a(t[e],t[e],t[e-1],t[e-1],i-e)-t[e]):a(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=o.Interpolation.Utils.Factorial;return e(t)/e(n)/e(t-n)},Factorial:(a=[1],function(t){var n=1;if(a[t])return a[t];for(var e=t;e>1;e--)n*=e;return a[t]=n,n}),CatmullRom:function(t,n,e,i,r){var a=.5*(e-t),o=.5*(i-n),u=r*r;return(2*n-2*e+a+o)*(r*u)+(-3*n+3*e-2*a-o)*u+a*r+n}}},void 0===(i=function(){return o}.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=a(e(3)),r=a(e(1));function a(t){return t&&t.__esModule?t:{default:t}}function o(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};n.wrapGrid=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=n.duration,a=void 0===e?250:e,s=n.stagger,c=n.easing,l=void 0===c?"Quadratic.InOut":c,h=function(n){var e=t.getBoundingClientRect();[].concat(o(n)).forEach(function(t){if("function"==typeof t.getBoundingClientRect){var n=u(e,t);["top","left","width","height"].forEach(function(e){return t.dataset["cached"+e[0].toUpperCase()+e.slice(1)]=n[e]})}})};h(t.children);var f=(0,r.default)(function(){h(t.children)},250);window.addEventListener("resize",f);var d=(0,r.default)(function(n){if(n.filter(function(t){return"childList"===t.type}).length&&h(t.children),n.filter(function(t){return"class"===t.attributeName}).length){var e=t.getBoundingClientRect();[].concat(o(t.children)).map(function(t){return{el:t,boundingClientRect:u(e,t)}}).filter(function(t){var n=t.el,e=t.boundingClientRect;return e.top!==parseFloat(n.dataset.cachedTop)||e.left!==parseFloat(n.dataset.cachedLeft)||e.width!==parseFloat(n.dataset.cachedWidth)||e.height!==parseFloat(n.dataset.cachedHeight)}).forEach(function(t,n,e){var r=t.el,u=t.boundingClientRect;if([].concat(o(r.children)).length>1)throw new Error("Make sure every grid item has a single container element surrounding its children");var c=u.top,f=u.left,d=u.width,p=u.height,_=r.dataset,v=_.cachedTop,g=_.cachedLeft,w=_.cachedWidth,y=_.cachedHeight,m={};m.scaleX=parseFloat(w)/d,m.scaleY=parseFloat(y)/p,m.translateX=parseFloat(g)-f,m.translateY=parseFloat(v)-c,r.style.transform="translate("+m.translateX+"px, "+m.translateY+"px) scale("+m.scaleX+", "+m.scaleY+")",r.style.transformOrigin="0 0",r.children[0].style.transform="scale("+1/m.scaleX+","+1/m.scaleY+")";var b=new i.default.Tween(m).to({translateX:0,translateY:0,scaleX:1,scaleY:1},a).easing(i.default.Easing[l.split(".")[0]][l.split(".")[1]]).onUpdate(function(){r.style.transform="translate("+m.translateX+"px, "+m.translateY+"px) scale("+m.scaleX+", "+m.scaleY+")",r.children[0].style.transform="scale("+1/m.scaleX+","+1/m.scaleY+")",0===m.translateX&&0===m.translateY&&1===m.scaleX&&1===m.scaleY&&h([r])});s&&b.delay(a/e.length*n),b.start(),requestAnimationFrame(function t(n){b.isPlaying()&&(requestAnimationFrame(t),i.default.update(n))})})}},100),p=new MutationObserver(d);p.observe(t,{childList:!0,attributes:!0,subtree:!0});return{unwrapGrid:function(){window.removeEventListener(null,f),p.disconnect()}}}}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.animateCSSGrid=e():t.animateCSSGrid=e()}(window,function(){return function(t){var e={};function n(i){if(e[i])return e[i].exports;var r=e[i]={i:i,l:!1,exports:{}};return t[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{configurable:!1,enumerable:!0,get:i})},n.r=function(t){Object.defineProperty(t,"__esModule",{value:!0})},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=4)}([function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){(function(e){var n="Expected a function",i=NaN,r="[object Symbol]",a=/^\s+|\s+$/g,o=/^[-+]0x[0-9a-f]+$/i,u=/^0b[01]+$/i,s=/^0o[0-7]+$/i,c=parseInt,l="object"==typeof e&&e&&e.Object===Object&&e,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 g(t,e,i){var r,a,o,u,s,c,l=0,h=!1,f=!1,d=!0;if("function"!=typeof t)throw new TypeError(n);function g(e){var n=r,i=a;return r=a=void 0,l=e,u=t.apply(i,n)}function y(t){var n=t-c;return void 0===c||n>=e||n<0||f&&t-l>=o}function b(){var t=v();if(y(t))return T(t);s=setTimeout(b,function(t){var n=e-(t-c);return f?_(n,o-(t-l)):n}(t))}function T(t){return s=void 0,d&&r?g(t):(r=a=void 0,u)}function I(){var t=v(),n=y(t);if(r=arguments,a=this,c=t,n){if(void 0===s)return function(t){return l=t,s=setTimeout(b,e),h?g(t):u}(c);if(f)return s=setTimeout(b,e),g(c)}return void 0===s&&(s=setTimeout(b,e)),u}return e=m(e)||0,w(i)&&(h=!!i.leading,o=(f="maxWait"in i)?p(m(i.maxWait)||0,e):o,d="trailing"in i?!!i.trailing:d),I.cancel=function(){void 0!==s&&clearTimeout(s),l=0,r=c=a=s=void 0},I.flush=function(){return void 0===s?u:T(v())},I}function w(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function m(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(w(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=w(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(a,"");var n=u.test(t);return n||s.test(t)?c(t.slice(2),n?2:8):o.test(t)?i:+t}t.exports=function(t,e,i){var r=!0,a=!0;if("function"!=typeof t)throw new TypeError(n);return w(i)&&(r="leading"in i?!!i.leading:r,a="trailing"in i?!!i.trailing:a),g(t,e,{leading:r,maxWait:e,trailing:a})}}).call(this,n(0))},function(t,e){var n,i,r=t.exports={};function a(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function u(t){if(n===setTimeout)return setTimeout(t,0);if((n===a||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:a}catch(t){n=a}try{i="function"==typeof clearTimeout?clearTimeout:o}catch(t){i=o}}();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 e=c.length;e;){for(s=c,c=[];++h<e;)s&&s[h].run();h=-1,e=c.length}s=null,l=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===o||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{i(t)}catch(e){try{return i.call(null,t)}catch(e){return i.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function _(){}r.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];c.push(new p(t,e)),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,e,n){(function(n){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,e){var n=Object.keys(this._tweens);if(0===n.length)return!1;for(t=void 0!==t?t:o.now();n.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<n.length;i++){var r=this._tweens[n[i]];r&&!1===r.update(t)&&(r._isPlaying=!1,e||delete this._tweens[n[i]])}n=Object.keys(this._tweensAddedDuringUpdate)}return!0}};var a,o=new r;o.Group=r,o._nextId=0,o.nextId=function(){return o._nextId++},"undefined"==typeof window&&void 0!==n?o.now=function(){var t=n.hrtime();return 1e3*t[0]+t[1]/1e6}:"undefined"!=typeof window&&void 0!==window.performance&&void 0!==window.performance.now?o.now=window.performance.now.bind(window.performance):void 0!==Date.now?o.now=Date.now:o.now=function(){return(new Date).getTime()},o.Tween=function(t,e){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=o.Easing.Linear.None,this._interpolationFunction=o.Interpolation.Linear,this._chainedTweens=[],this._onStartCallback=null,this._onStartCallbackFired=!1,this._onUpdateCallback=null,this._onCompleteCallback=null,this._onStopCallback=null,this._group=e||o,this._id=o.nextId()},o.Tween.prototype={getId:function(){return this._id},isPlaying:function(){return this._isPlaying},to:function(t,e){return this._valuesEnd=t,void 0!==e&&(this._duration=e),this},start:function(t){for(var e in this._group.add(this),this._isPlaying=!0,this._onStartCallbackFired=!1,this._startTime=void 0!==t?"string"==typeof t?o.now()+parseFloat(t):t:o.now(),this._startTime+=this._delayTime,this._valuesEnd){if(this._valuesEnd[e]instanceof Array){if(0===this._valuesEnd[e].length)continue;this._valuesEnd[e]=[this._object[e]].concat(this._valuesEnd[e])}void 0!==this._object[e]&&(this._valuesStart[e]=this._object[e],this._valuesStart[e]instanceof Array==!1&&(this._valuesStart[e]*=1),this._valuesStartRepeat[e]=this._valuesStart[e]||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,e=this._chainedTweens.length;t<e;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 e,n,i;if(t<this._startTime)return!0;for(e in!1===this._onStartCallbackFired&&(null!==this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),n=(t-this._startTime)/this._duration,n=0===this._duration||n>1?1:n,i=this._easingFunction(n),this._valuesEnd)if(void 0!==this._valuesStart[e]){var r=this._valuesStart[e]||0,a=this._valuesEnd[e];a instanceof Array?this._object[e]=this._interpolationFunction(a,i):("string"==typeof a&&(a="+"===a.charAt(0)||"-"===a.charAt(0)?r+parseFloat(a):parseFloat(a)),"number"==typeof a&&(this._object[e]=r+(a-r)*i))}if(null!==this._onUpdateCallback&&this._onUpdateCallback(this._object),1===n){if(this._repeat>0){for(e in isFinite(this._repeat)&&this._repeat--,this._valuesStartRepeat){if("string"==typeof this._valuesEnd[e]&&(this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(this._valuesEnd[e])),this._yoyo){var o=this._valuesStartRepeat[e];this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=o}this._valuesStart[e]=this._valuesStartRepeat[e]}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}},o.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 e=1.70158;return t*t*((e+1)*t-e)},Out:function(t){var e=1.70158;return--t*t*((e+1)*t+e)+1},InOut:function(t){var e=2.5949095;return(t*=2)<1?t*t*((e+1)*t-e)*.5:.5*((t-=2)*t*((e+1)*t+e)+2)}},Bounce:{In:function(t){return 1-o.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*o.Easing.Bounce.In(2*t):.5*o.Easing.Bounce.Out(2*t-1)+.5}}},o.Interpolation={Linear:function(t,e){var n=t.length-1,i=n*e,r=Math.floor(i),a=o.Interpolation.Utils.Linear;return e<0?a(t[0],t[1],i):e>1?a(t[n],t[n-1],n-i):a(t[r],t[r+1>n?n:r+1],i-r)},Bezier:function(t,e){for(var n=0,i=t.length-1,r=Math.pow,a=o.Interpolation.Utils.Bernstein,u=0;u<=i;u++)n+=r(1-e,i-u)*r(e,u)*t[u]*a(i,u);return n},CatmullRom:function(t,e){var n=t.length-1,i=n*e,r=Math.floor(i),a=o.Interpolation.Utils.CatmullRom;return t[0]===t[n]?(e<0&&(r=Math.floor(i=n*(1+e))),a(t[(r-1+n)%n],t[r],t[(r+1)%n],t[(r+2)%n],i-r)):e<0?t[0]-(a(t[0],t[0],t[1],t[1],-i)-t[0]):e>1?t[n]-(a(t[n],t[n],t[n-1],t[n-1],i-n)-t[n]):a(t[r?r-1:0],t[r],t[n<r+1?n:r+1],t[n<r+2?n:r+2],i-r)},Utils:{Linear:function(t,e,n){return(e-t)*n+t},Bernstein:function(t,e){var n=o.Interpolation.Utils.Factorial;return n(t)/n(e)/n(t-e)},Factorial:(a=[1],function(t){var e=1;if(a[t])return a[t];for(var n=t;n>1;n--)e*=n;return a[t]=e,e}),CatmullRom:function(t,e,n,i,r){var a=.5*(n-t),o=.5*(i-e),u=r*r;return(2*e-2*n+a+o)*(r*u)+(-3*e+3*n-2*a-o)*u+a*r+e}}},void 0===(i=function(){return o}.apply(e,[]))||(t.exports=i)}).call(this,n(2))},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.wrapGrid=void 0;var i=a(n(3)),r=a(n(1));function a(t){return t&&t.__esModule?t:{default:t}}function o(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}var u=function(t,e){var n=e.getBoundingClientRect(),i={top:n.top,left:n.left,width:n.width,height:n.height};return i.top-=t.top,i.left-=t.left,i};e.wrapGrid=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.duration,a=void 0===n?250:n,s=e.stagger,c=e.easing,l=void 0===c?"Quadratic.InOut":c,h=function(e){var n=t.getBoundingClientRect();[].concat(o(e)).forEach(function(t){if("function"==typeof t.getBoundingClientRect){var e=u(n,t);["top","left","width","height"].forEach(function(n){return t.dataset["cached"+n[0].toUpperCase()+n.slice(1)]=e[n]})}})};h(t.children);var f=(0,r.default)(function(){h(t.children)},250);window.addEventListener("resize",f);var d=(0,r.default)(function(e){if(e.filter(function(t){return"class"===t.attributeName||t.addedNodes.length||t.removedNodes.length}).length){var n=t.getBoundingClientRect();[].concat(o(t.children)).map(function(t){return{el:t,boundingClientRect:u(n,t)}}).filter(function(t){var e=t.el,n=t.boundingClientRect;return e.dataset.cachedHeight||e.dataset.cachedHeight?n.top!==parseFloat(e.dataset.cachedTop)||n.left!==parseFloat(e.dataset.cachedLeft)||n.width!==parseFloat(e.dataset.cachedWidth)||n.height!==parseFloat(e.dataset.cachedHeight):(h([e]),!1)}).forEach(function(t,e,n){var r=t.el,u=t.boundingClientRect;if([].concat(o(r.children)).length>1)throw new Error("Make sure every grid item has a single container element surrounding its children");var c=u.top,f=u.left,d=u.width,p=u.height,_=r.dataset,v=_.cachedTop,g=_.cachedLeft,w=_.cachedWidth,m=_.cachedHeight,y={};y.scaleX=parseFloat(w)/d,y.scaleY=parseFloat(m)/p,y.translateX=parseFloat(g)-f,y.translateY=parseFloat(v)-c,r.style.transform="translate("+y.translateX+"px, "+y.translateY+"px) scale("+y.scaleX+", "+y.scaleY+")",r.style.transformOrigin="0 0",r.children[0].style.transform="scale("+1/y.scaleX+","+1/y.scaleY+")";var b=new i.default.Tween(y).to({translateX:0,translateY:0,scaleX:1,scaleY:1},a).easing(i.default.Easing[l.split(".")[0]][l.split(".")[1]]).onUpdate(function(){r.style.transform="translate("+y.translateX+"px, "+y.translateY+"px) scale("+y.scaleX+", "+y.scaleY+")",r.children[0].style.transform="scale("+1/y.scaleX+","+1/y.scaleY+")",0===y.translateX&&0===y.translateY&&1===y.scaleX&&1===y.scaleY&&h([r])});s&&b.delay(a/n.length*e),b.start(),requestAnimationFrame(function t(e){b.isPlaying()&&(requestAnimationFrame(t),i.default.update(e))})})}},100),p=new MutationObserver(d);p.observe(t,{childList:!0,attributes:!0,subtree:!0,attributeFilter:["class"]});return{unwrapGrid:function(){window.removeEventListener("resize",f),p.disconnect()}}}}])});
{
"name": "animate-css-grid",
"version": "0.2.4",
"version": "0.2.5",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/main.js",

@@ -6,12 +6,10 @@ # Animate CSS Grid

This small script makes it super easy to make sure your CSS grid transitions gracefully from one state to another.
When the grid container, or one of its immediate children, is updated via the addition or removal of a class, the grid will smoothly transition its children to their new positions and sizes.
If the content of the grid changes, or if the grid or one of its children is updated with the addition or removal of a class, the grid will smoothly transition to its new configuration.
[Example on Codepen](https://codepen.io/aholachek/pen/VXjOPB)
[Examples on Codepen](https://codepen.io/collection/XGWeaG/)
## How to use it
Just call the `wrapGrid` method on your grid container.
Just call the `wrapGrid` method on your grid container, and optionally provide a config object as a second argument.
The optional config object allows you to control duration, staggering, and easing.
ES6 Module:

@@ -43,16 +41,15 @@

[Available easing functions](https://sole.github.io/tween.js/examples/03_graphs.html).
Example optional config object:
Example options object:
```js
{
// create a stagger effect (default is false)
// default is false
stagger: true,
// specify a duration in ms (default is 250 ms)
// default is 250 ms
duration: 500
// specify an easing as a string. default is 'Quadratic.InOut'
// default is 'Quadratic.InOut'
easing: 'Sinusoidal.InOut'
}
```
[Available easing functions](https://sole.github.io/tween.js/examples/03_graphs.html).

@@ -59,0 +56,0 @@ ## How it works

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