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.3 to 0.2.4

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 w(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 w(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?w(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?w(t):u}(c);if(f)return s=setTimeout(b,n),w(c)}return void 0===s&&(s=setTimeout(b,n)),u}return n=y(n)||0,g(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 g(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(g(t)){var n="function"==typeof t.valueOf?t.valueOf():t;t=g(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 g(i)&&(r="leading"in i?!!i.leading:r,a="trailing"in i?!!i.trailing:a),w(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){var n=t.getBoundingClientRect(),e={top:n.top,left:n.left,width:n.width,height:n.height};return e.top+=window.scrollY,e.left+=window.scrollX,e};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(t){[].concat(o(t)).forEach(function(t){if("function"==typeof t.getBoundingClientRect){var n=u(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=new MutationObserver(function(n){n.filter(function(t){return"childList"===t.type}).length&&h(t.children),n.filter(function(t){return"class"===t.attributeName}).length&&[].concat(o(t.children)).map(function(t){return{el:t,boundingClientRect:u(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,w=_.cachedLeft,g=_.cachedWidth,y=_.cachedHeight,m={};m.scaleX=parseFloat(g)/d,m.scaleY=parseFloat(y)/p,m.translateX=parseFloat(w)-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))})})});d.observe(t,{childList:!0,attributes:!0,subtree:!0});return{unwrapGrid:function(){window.removeEventListener(null,f),d.disconnect()}}}}])});
!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()}}}}])});
{
"name": "animate-css-grid",
"version": "0.2.3",
"version": "0.2.4",
"description": "",

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

@@ -5,3 +5,3 @@ # Animate CSS Grid

This small script wraps a CSS grid (or really, any container element) and animates updates to its children.
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.

@@ -13,21 +13,6 @@

Call the `wrapGrid` method on your grid container.
Just call the `wrapGrid` method on your grid container.
The optional config object allows you to control duration, staggering, and easing.
[Available easing functions](https://sole.github.io/tween.js/examples/03_graphs.html).
Example options object:
```js
{
// create a stagger effect (default is false)
stagger: true,
// specify a duration in ms (default is 250 ms)
duration: 500
// specify an easing as a string. default is 'Quadratic.InOut'
easing: 'Sinusoidal.InOut'
}
```
ES6 Module:

@@ -59,2 +44,17 @@

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

@@ -61,0 +61,0 @@

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