scrollreveal
Advanced tools
Comparing version 4.0.0-beta.20 to 4.0.0-beta.21
@@ -1,2 +0,2 @@ | ||
/*! @license ScrollReveal v4.0.0-beta.20 | ||
/*! @license ScrollReveal v4.0.0-beta.21 | ||
@@ -1316,3 +1316,6 @@ Copyright 2017 Fisssion LLC. | ||
var polyfill = (function () { | ||
var polyfill = function (x) { return (x > 0) - (x < 0) || +x; }; | ||
var mathSign = Math.sign || polyfill; | ||
var polyfill$1 = (function () { | ||
var clock = Date.now(); | ||
@@ -1326,3 +1329,3 @@ | ||
} else { | ||
setTimeout(function () { return polyfill(callback); }, 0); | ||
setTimeout(function () { return polyfill$1(callback); }, 0); | ||
} | ||
@@ -1332,8 +1335,7 @@ } | ||
// prettier-ignore | ||
var requestAnimationFrame = | ||
window.requestAnimationFrame | ||
|| window.webkitRequestAnimationFrame | ||
|| window.mozRequestAnimationFrame | ||
|| polyfill; | ||
window.requestAnimationFrame || | ||
window.webkitRequestAnimationFrame || | ||
window.mozRequestAnimationFrame || | ||
polyfill$1; | ||
@@ -1355,4 +1357,4 @@ function delegate (event, elements) { | ||
container.direction = { | ||
x: Math.sign(scroll.left - container.scroll.left), | ||
y: Math.sign(scroll.top - container.scroll.top), | ||
x: mathSign(scroll.left - container.scroll.left), | ||
y: mathSign(scroll.top - container.scroll.top), | ||
}; | ||
@@ -1388,3 +1390,3 @@ } | ||
var version = "4.0.0-beta.20"; | ||
var version = "4.0.0-beta.21"; | ||
@@ -1391,0 +1393,0 @@ var _config; |
@@ -1,2 +0,2 @@ | ||
/*! @license ScrollReveal v4.0.0-beta.20 | ||
/*! @license ScrollReveal v4.0.0-beta.21 | ||
@@ -1322,3 +1322,6 @@ Copyright 2017 Fisssion LLC. | ||
var polyfill = (function () { | ||
var polyfill = function (x) { return (x > 0) - (x < 0) || +x; }; | ||
var mathSign = Math.sign || polyfill; | ||
var polyfill$1 = (function () { | ||
var clock = Date.now(); | ||
@@ -1332,3 +1335,3 @@ | ||
} else { | ||
setTimeout(function () { return polyfill(callback); }, 0); | ||
setTimeout(function () { return polyfill$1(callback); }, 0); | ||
} | ||
@@ -1338,8 +1341,7 @@ } | ||
// prettier-ignore | ||
var requestAnimationFrame = | ||
window.requestAnimationFrame | ||
|| window.webkitRequestAnimationFrame | ||
|| window.mozRequestAnimationFrame | ||
|| polyfill; | ||
window.requestAnimationFrame || | ||
window.webkitRequestAnimationFrame || | ||
window.mozRequestAnimationFrame || | ||
polyfill$1; | ||
@@ -1361,4 +1363,4 @@ function delegate (event, elements) { | ||
container.direction = { | ||
x: Math.sign(scroll.left - container.scroll.left), | ||
y: Math.sign(scroll.top - container.scroll.top), | ||
x: mathSign(scroll.left - container.scroll.left), | ||
y: mathSign(scroll.top - container.scroll.top), | ||
}; | ||
@@ -1394,3 +1396,3 @@ } | ||
var version = "4.0.0-beta.20"; | ||
var version = "4.0.0-beta.21"; | ||
@@ -1397,0 +1399,0 @@ var _config; |
@@ -1,2 +0,2 @@ | ||
/*! @license ScrollReveal v4.0.0-beta.20 | ||
/*! @license ScrollReveal v4.0.0-beta.21 | ||
@@ -34,2 +34,2 @@ Copyright 2017 Fisssion LLC. | ||
*/ | ||
function v(e){if(e.constructor!==Array)throw new TypeError("Expected array.");if(16===e.length)return e;if(6===e.length){var t=g();return t[0]=e[0],t[1]=e[1],t[4]=e[2],t[5]=e[3],t[12]=e[4],t[13]=e[5],t}throw new RangeError("Expected array with either 6 or 16 values.")}function g(){for(var e=[],t=0;t<16;t++)t%5==0?e.push(1):e.push(0);return e}function b(e,t){for(var n=v(e),i=v(t),r=[],o=0;o<4;o++)for(var s=[n[o],n[o+4],n[o+8],n[o+12]],a=0;a<4;a++){var l=4*a,c=[i[l],i[l+1],i[l+2],i[l+3]],d=s[0]*c[0]+s[1]*c[1]+s[2]*c[2]+s[3]*c[3];r[o+l]=d}return r}function w(e){if("string"==typeof e){var t=e.match(/matrix(3d)?\(([^)]+)\)/);if(t){return v(t[2].split(", ").map(parseFloat))}}return g()}function E(e){var t=Math.PI/180*e,n=g();return n[5]=n[10]=Math.cos(t),n[6]=n[9]=Math.sin(t),n[9]*=-1,n}function j(e){var t=Math.PI/180*e,n=g();return n[0]=n[10]=Math.cos(t),n[2]=n[8]=Math.sin(t),n[2]*=-1,n}function k(e){var t=Math.PI/180*e,n=g();return n[0]=n[5]=Math.cos(t),n[1]=n[4]=Math.sin(t),n[4]*=-1,n}function T(e,t){var n=g();return n[0]=e,n[5]="number"==typeof t?t:e,n}function x(e){var t=g();return t[12]=e,t}function R(e){var t=g();return t[13]=e,t}function A(e){var t=window.getComputedStyle(e.node),n=t.position,i=e.config,r={},o=e.node.getAttribute("style")||"",s=o.match(/[\w-]+\s*:\s*[^;]+\s*/gi)||[];r.computed=s?s.map(function(e){return e.trim()}).join("; ")+";":"",r.generated=s.some(function(e){return e.match(/visibility\:\s?visible/i)})?r.computed:s.concat(["visibility: visible"]).map(function(e){return e.trim()}).join("; ")+";";var a=parseFloat(t.opacity),l=isNaN(parseFloat(i.opacity))?parseFloat(t.opacity):parseFloat(i.opacity),c={computed:a!==l?"opacity: "+a+";":"",generated:a!==l?"opacity: "+l+";":""},d=[];if(parseFloat(i.distance)){var u="top"===i.origin||"bottom"===i.origin?"Y":"X",f=i.distance;"top"!==i.origin&&"left"!==i.origin||(f=/^-/.test(f)?f.substr(1):"-"+f);var h=f.match(/(^-?\d+\.?\d?)|(em$|px$|\%$)/g),p=h[0];switch(h[1]){case"em":f=parseInt(t.fontSize)*p;break;case"px":f=p;break;case"%":f="Y"===u?e.node.getBoundingClientRect().height*p/100:e.node.getBoundingClientRect().width*p/100;break;default:throw new RangeError("Unrecognized or missing distance unit.")}"Y"===u?d.push(R(f)):d.push(x(f))}i.rotate.x&&d.push(E(i.rotate.x)),i.rotate.y&&d.push(j(i.rotate.y)),i.rotate.z&&d.push(k(i.rotate.z)),1!==i.scale&&(0===i.scale?d.push(T(2e-4)):d.push(T(i.scale)));var m={};if(d.length){m.property=J("transform"),m.computed={raw:t[m.property],matrix:w(t[m.property])},d.unshift(m.computed.matrix);var y=d.reduce(b);m.generated={initial:m.property+": matrix3d("+y.join(", ")+");",final:m.property+": matrix3d("+m.computed.matrix.join(", ")+");"}}else m.generated={initial:"",final:""};var v={};if(c.generated||m.generated.initial){v.property=J("transition"),v.computed=t[v.property],v.fragments=[];var g=i.delay,A=i.duration,O=i.easing;c.generated&&v.fragments.push({delayed:"opacity "+A/1e3+"s "+O+" "+g/1e3+"s",instant:"opacity "+A/1e3+"s "+O+" 0s"}),m.generated.initial&&v.fragments.push({delayed:m.property+" "+A/1e3+"s "+O+" "+g/1e3+"s",instant:m.property+" "+A/1e3+"s "+O+" 0s"}),v.computed&&!v.computed.match(/all 0s/)&&v.fragments.unshift({delayed:v.computed,instant:v.computed});var L=v.fragments.reduce(function(e,t,n){return e.delayed+=0===n?t.delayed:", "+t.delayed,e.instant+=0===n?t.instant:", "+t.instant,e},{delayed:"",instant:""});v.generated={delayed:v.property+": "+L.delayed+";",instant:v.property+": "+L.instant+";"}}else v.generated={delayed:"",instant:""};return{inline:r,opacity:c,position:n,transform:m,transition:v}}function O(){var e=this;p.call(this),n(this.store.elements,function(e){var t=[e.styles.inline.generated];e.visible?(t.push(e.styles.opacity.computed),t.push(e.styles.transform.generated.final)):(t.push(e.styles.opacity.generated),t.push(e.styles.transform.generated.initial)),e.node.setAttribute("style",t.filter(function(e){return""!==e}).join(" "))}),n(this.store.containers,function(t){t.node===document.documentElement?(window.addEventListener("scroll",e.delegate),window.addEventListener("resize",e.delegate)):(t.node.addEventListener("scroll",e.delegate),t.node.addEventListener("resize",e.delegate))}),this.delegate(),this.initTimeout=null}function L(e,t){void 0===t&&(t={});var n=t.pristine||this.pristine,i="always"===e.config.useDelay||"onload"===e.config.useDelay&&n||"once"===e.config.useDelay&&!e.seen,r=e.visible&&!e.revealed,o=!e.visible&&e.revealed&&e.config.reset;return r||t.reveal?q.call(this,e,i):o||t.reset?I.call(this,e):void 0}function q(e,t){var n=[e.styles.inline.generated,e.styles.opacity.computed,e.styles.transform.generated.final];t?n.push(e.styles.transition.generated.delayed):n.push(e.styles.transition.generated.instant),e.revealed=e.seen=!0,e.node.setAttribute("style",n.filter(function(e){return""!==e}).join(" ")),M.call(this,e,t)}function I(e){var t=[e.styles.inline.generated,e.styles.opacity.generated,e.styles.transform.generated.initial,e.styles.transition.generated.instant];e.revealed=!1,e.node.setAttribute("style",t.filter(function(e){return""!==e}).join(" ")),M.call(this,e)}function M(e,t){var n=this,i=t?e.config.duration+e.config.delay:e.config.duration,r=e.revealed?e.config.beforeReveal:e.config.beforeReset,o=e.revealed?e.config.afterReveal:e.config.afterReset,s=0;e.callbackTimer&&(s=Date.now()-e.callbackTimer.start,window.clearTimeout(e.callbackTimer.clock)),r(e.node),e.callbackTimer={start:Date.now(),clock:window.setTimeout(function(){o(e.node),e.callbackTimer=null,e.revealed&&!e.config.reset&&m.call(n,e.node)},i-s)}}function P(e,t){void 0===t&&(t=this.pristine);var n=this.store.sequences[e.sequence.id],i=e.sequence.index;if(n){var r=new N("visible",n,this.store),o=new N("revealed",n,this.store);if(n.models={visible:r,revealed:o},!o.body.length){var s=n.members[r.body[0]],a=this.store.elements[s];return a?(F.call(this,n,r.body[0],-1,t),F.call(this,n,r.body[0],1,t),n.lastReveal=r.body[0],L.call(this,a,{reveal:!0,pristine:t})):L.call(this,e)}if(!e.visible&&e.revealed&&e.config.reset)return n.lastReset=i,L.call(this,e,{reset:!0});if(!n.headblocked&&i===[].concat(o.head).pop()&&i>=[].concat(r.body).shift())return F.call(this,n,i,-1,t),n.lastReveal=i,L.call(this,e,{reveal:!0,pristine:t});if(!n.footblocked&&i===[].concat(o.foot).shift()&&i<=[].concat(r.body).pop())return F.call(this,n,i,1,t),n.lastReveal=i,L.call(this,e,{reveal:!0,pristine:t})}}function z(e){if("number"!=typeof e)return null;if(!(e>=16))throw new RangeError("Sequence interval must be at least 16ms.");this.id=G(),this.interval=e,this.members=[],this.headblocked=!0,this.footblocked=!0,this.lastReveal=null,this.lastReset=null,this.models={}}function N(e,t,i){var r=this;this.head=[],this.body=[],this.foot=[],n(t.members,function(t,n){var o=i.elements[t];o&&o[e]&&r.body.push(n)}),this.body.length&&n(t.members,function(t,n){var o=i.elements[t];o&&!o[e]&&(n<r.body[0]?r.head.push(n):r.foot.push(n))})}function F(e,t,n,i){var r=this,o=["headblocked",null,"footblocked"][1+n],s=e.members[t+n],a=this.store.elements[s];e[o]=!0,setTimeout(function(){e[o]=!1,a&&P.call(r,a,i)},e.interval)}function S(t,r,o,s){var a=this,l=[];"number"==typeof r?(o=parseInt(r),r={}):(o=parseInt(o),r=r||{});var c,f;try{c=u(t),f=o?new z(o):null}catch(e){return h.call(this,"Reveal failed.",e.stack||e.message)}try{n(c.reduce(function(t,n){var o={},s=n.getAttribute("data-sr-id");s?(e(o,a.store.elements[s]),o.node.setAttribute("style",o.styles.inline.computed)):(o.id=G(),o.node=n,o.seen=!1,o.revealed=!1,o.visible=!1);var c,u=e({},o.config||a.defaults,r);if(null==c&&(c=!u.mobile&&i()||!u.desktop&&!i()),c)return s&&m.call(a,o),t;var h,p=d(u.container);if(!p)throw new Error("Invalid container.");return p.contains(n)?(null==(h=D(p,l,a.store.containers))&&(h=G(),l.push({id:h,node:p})),o.config=u,o.containerId=h,o.styles=A(o),f&&(o.sequence={id:f.id,index:f.members.length},f.members.push(o.id)),t.push(o),t):t},[]),function(e){a.store.elements[e.id]=e,e.node.setAttribute("data-sr-id",e.id)})}catch(e){return h.call(this,"Reveal failed.",e.stack||e.message)}n(l,function(e){a.store.containers[e.id]={id:e.id,node:e.node}}),f&&(this.store.sequences[f.id]=f),s||(this.store.history.push({target:t,options:r,interval:o}),this.initTimeout&&window.clearTimeout(this.initTimeout),this.initTimeout=window.setTimeout(O.bind(this),0))}function D(e){for(var t=[],i=arguments.length-1;i-- >0;)t[i]=arguments[i+1];var r=null;return n(t,function(t){n(t,function(t){null===r&&t.node===e&&(r=t.id)})}),r}function C(){var e=this;n(this.store.history,function(t){S.call(e,t.target,t.options,t.interval,!0)}),O.call(this)}function W(e,t){var i=this;void 0===e&&(e={type:"init"}),void 0===t&&(t=this.store.elements),Q(function(){var r="init"===e.type||"resize"===e.type;n(i.store.containers,function(e){r&&(e.geometry=c.call(i,e,!0));var t=f.call(i,e);e.scroll&&(e.direction={x:Math.sign(t.left-e.scroll.left),y:Math.sign(t.top-e.scroll.top)}),e.scroll=t}),n(t,function(e){r&&(e.geometry=c.call(i,e)),e.visible=l.call(i,e)}),n(t,function(e){e.sequence?P.call(i,e):L.call(i,e)}),i.pristine=!1})}function Y(t){var n=this;if(void 0===t&&(t={}),void 0===this||Object.getPrototypeOf(this)!==Y.prototype)return new Y(t);if(!Y.isSupported())return h.call(this,"Instantiation aborted.","This browser is not supported."),X;var r;try{r=$?e({},$,t):e({},U,t)}catch(e){return h.call(this,"Instantiation failed.","Invalid configuration.",e.message),X}try{if(!d(r.container))throw new Error("Invalid container.")}catch(e){return h.call(this,"Instantiation failed.",e.message),X}return $=r,Object.defineProperty(this,"defaults",{get:function(){return $}}),this.defaults.mobile!==i()&&this.defaults.desktop!==!i()||(document.documentElement.classList.add("sr"),document.body?document.body.style.height="100%":document.addEventListener("DOMContentLoaded",function(){document.body.style.height="100%"})),this.store={containers:{},elements:{},history:[],sequences:{}},this.pristine=!0,Object.defineProperty(this,"delegate",{get:function(){return W.bind(n)}}),Object.defineProperty(this,"version",{get:function(){return V}}),Object.defineProperty(this,"noop",{get:function(){return!1}}),B||(B=this)}var $,H,B,U={delay:0,distance:"0",duration:600,easing:"cubic-bezier(0.6, 0.2, 0.1, 1)",opacity:0,origin:"bottom",rotate:{x:0,y:0,z:0},scale:1,container:document.documentElement,desktop:!0,mobile:!0,reset:!1,useDelay:"always",viewFactor:0,viewOffset:{top:0,right:0,bottom:0,left:0},afterReset:function(){},afterReveal:function(){},beforeReset:function(){},beforeReveal:function(){}},X={clean:function(){},destroy:function(){},reveal:function(){},sync:function(){},get noop(){return!0}},G=function(){var e=0;return function(){return e++}}(),J=function(){function e(e,i){if(void 0===i&&(i=n),e&&"string"==typeof e){if(t[e])return t[e];if("string"==typeof i[e])return t[e]=e;if("string"==typeof i["-webkit-"+e])return t[e]="-webkit-"+e;throw new RangeError('Unable to find "'+e+'" style property.')}throw new TypeError("Expected a string.")}var t={},n=document.documentElement.style;return e.clearCache=function(){return t={}},e}(),K=function(){var e=Date.now();return function(t){var n=Date.now();n-e>16?(e=n,t(n)):setTimeout(function(){return K(t)},0)}}(),Q=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||K,V="4.0.0-beta.20";return Y.isSupported=function(){return s()&&a()},Object.defineProperty(Y,"debug",{get:function(){return H||!1},set:function(e){"boolean"==typeof e&&(H=e)}}),Y.prototype.clean=m,Y.prototype.destroy=y,Y.prototype.reveal=S,Y.prototype.sync=C,Y}(); | ||
function v(e){if(e.constructor!==Array)throw new TypeError("Expected array.");if(16===e.length)return e;if(6===e.length){var t=g();return t[0]=e[0],t[1]=e[1],t[4]=e[2],t[5]=e[3],t[12]=e[4],t[13]=e[5],t}throw new RangeError("Expected array with either 6 or 16 values.")}function g(){for(var e=[],t=0;t<16;t++)t%5==0?e.push(1):e.push(0);return e}function b(e,t){for(var n=v(e),i=v(t),r=[],o=0;o<4;o++)for(var s=[n[o],n[o+4],n[o+8],n[o+12]],a=0;a<4;a++){var l=4*a,c=[i[l],i[l+1],i[l+2],i[l+3]],d=s[0]*c[0]+s[1]*c[1]+s[2]*c[2]+s[3]*c[3];r[o+l]=d}return r}function w(e){if("string"==typeof e){var t=e.match(/matrix(3d)?\(([^)]+)\)/);if(t){return v(t[2].split(", ").map(parseFloat))}}return g()}function E(e){var t=Math.PI/180*e,n=g();return n[5]=n[10]=Math.cos(t),n[6]=n[9]=Math.sin(t),n[9]*=-1,n}function j(e){var t=Math.PI/180*e,n=g();return n[0]=n[10]=Math.cos(t),n[2]=n[8]=Math.sin(t),n[2]*=-1,n}function k(e){var t=Math.PI/180*e,n=g();return n[0]=n[5]=Math.cos(t),n[1]=n[4]=Math.sin(t),n[4]*=-1,n}function T(e,t){var n=g();return n[0]=e,n[5]="number"==typeof t?t:e,n}function x(e){var t=g();return t[12]=e,t}function R(e){var t=g();return t[13]=e,t}function A(e){var t=window.getComputedStyle(e.node),n=t.position,i=e.config,r={},o=e.node.getAttribute("style")||"",s=o.match(/[\w-]+\s*:\s*[^;]+\s*/gi)||[];r.computed=s?s.map(function(e){return e.trim()}).join("; ")+";":"",r.generated=s.some(function(e){return e.match(/visibility\:\s?visible/i)})?r.computed:s.concat(["visibility: visible"]).map(function(e){return e.trim()}).join("; ")+";";var a=parseFloat(t.opacity),l=isNaN(parseFloat(i.opacity))?parseFloat(t.opacity):parseFloat(i.opacity),c={computed:a!==l?"opacity: "+a+";":"",generated:a!==l?"opacity: "+l+";":""},d=[];if(parseFloat(i.distance)){var u="top"===i.origin||"bottom"===i.origin?"Y":"X",f=i.distance;"top"!==i.origin&&"left"!==i.origin||(f=/^-/.test(f)?f.substr(1):"-"+f);var h=f.match(/(^-?\d+\.?\d?)|(em$|px$|\%$)/g),p=h[0];switch(h[1]){case"em":f=parseInt(t.fontSize)*p;break;case"px":f=p;break;case"%":f="Y"===u?e.node.getBoundingClientRect().height*p/100:e.node.getBoundingClientRect().width*p/100;break;default:throw new RangeError("Unrecognized or missing distance unit.")}"Y"===u?d.push(R(f)):d.push(x(f))}i.rotate.x&&d.push(E(i.rotate.x)),i.rotate.y&&d.push(j(i.rotate.y)),i.rotate.z&&d.push(k(i.rotate.z)),1!==i.scale&&(0===i.scale?d.push(T(2e-4)):d.push(T(i.scale)));var m={};if(d.length){m.property=J("transform"),m.computed={raw:t[m.property],matrix:w(t[m.property])},d.unshift(m.computed.matrix);var y=d.reduce(b);m.generated={initial:m.property+": matrix3d("+y.join(", ")+");",final:m.property+": matrix3d("+m.computed.matrix.join(", ")+");"}}else m.generated={initial:"",final:""};var v={};if(c.generated||m.generated.initial){v.property=J("transition"),v.computed=t[v.property],v.fragments=[];var g=i.delay,A=i.duration,O=i.easing;c.generated&&v.fragments.push({delayed:"opacity "+A/1e3+"s "+O+" "+g/1e3+"s",instant:"opacity "+A/1e3+"s "+O+" 0s"}),m.generated.initial&&v.fragments.push({delayed:m.property+" "+A/1e3+"s "+O+" "+g/1e3+"s",instant:m.property+" "+A/1e3+"s "+O+" 0s"}),v.computed&&!v.computed.match(/all 0s/)&&v.fragments.unshift({delayed:v.computed,instant:v.computed});var L=v.fragments.reduce(function(e,t,n){return e.delayed+=0===n?t.delayed:", "+t.delayed,e.instant+=0===n?t.instant:", "+t.instant,e},{delayed:"",instant:""});v.generated={delayed:v.property+": "+L.delayed+";",instant:v.property+": "+L.instant+";"}}else v.generated={delayed:"",instant:""};return{inline:r,opacity:c,position:n,transform:m,transition:v}}function O(){var e=this;p.call(this),n(this.store.elements,function(e){var t=[e.styles.inline.generated];e.visible?(t.push(e.styles.opacity.computed),t.push(e.styles.transform.generated.final)):(t.push(e.styles.opacity.generated),t.push(e.styles.transform.generated.initial)),e.node.setAttribute("style",t.filter(function(e){return""!==e}).join(" "))}),n(this.store.containers,function(t){t.node===document.documentElement?(window.addEventListener("scroll",e.delegate),window.addEventListener("resize",e.delegate)):(t.node.addEventListener("scroll",e.delegate),t.node.addEventListener("resize",e.delegate))}),this.delegate(),this.initTimeout=null}function L(e,t){void 0===t&&(t={});var n=t.pristine||this.pristine,i="always"===e.config.useDelay||"onload"===e.config.useDelay&&n||"once"===e.config.useDelay&&!e.seen,r=e.visible&&!e.revealed,o=!e.visible&&e.revealed&&e.config.reset;return r||t.reveal?q.call(this,e,i):o||t.reset?I.call(this,e):void 0}function q(e,t){var n=[e.styles.inline.generated,e.styles.opacity.computed,e.styles.transform.generated.final];t?n.push(e.styles.transition.generated.delayed):n.push(e.styles.transition.generated.instant),e.revealed=e.seen=!0,e.node.setAttribute("style",n.filter(function(e){return""!==e}).join(" ")),M.call(this,e,t)}function I(e){var t=[e.styles.inline.generated,e.styles.opacity.generated,e.styles.transform.generated.initial,e.styles.transition.generated.instant];e.revealed=!1,e.node.setAttribute("style",t.filter(function(e){return""!==e}).join(" ")),M.call(this,e)}function M(e,t){var n=this,i=t?e.config.duration+e.config.delay:e.config.duration,r=e.revealed?e.config.beforeReveal:e.config.beforeReset,o=e.revealed?e.config.afterReveal:e.config.afterReset,s=0;e.callbackTimer&&(s=Date.now()-e.callbackTimer.start,window.clearTimeout(e.callbackTimer.clock)),r(e.node),e.callbackTimer={start:Date.now(),clock:window.setTimeout(function(){o(e.node),e.callbackTimer=null,e.revealed&&!e.config.reset&&m.call(n,e.node)},i-s)}}function P(e,t){void 0===t&&(t=this.pristine);var n=this.store.sequences[e.sequence.id],i=e.sequence.index;if(n){var r=new N("visible",n,this.store),o=new N("revealed",n,this.store);if(n.models={visible:r,revealed:o},!o.body.length){var s=n.members[r.body[0]],a=this.store.elements[s];return a?(F.call(this,n,r.body[0],-1,t),F.call(this,n,r.body[0],1,t),n.lastReveal=r.body[0],L.call(this,a,{reveal:!0,pristine:t})):L.call(this,e)}if(!e.visible&&e.revealed&&e.config.reset)return n.lastReset=i,L.call(this,e,{reset:!0});if(!n.headblocked&&i===[].concat(o.head).pop()&&i>=[].concat(r.body).shift())return F.call(this,n,i,-1,t),n.lastReveal=i,L.call(this,e,{reveal:!0,pristine:t});if(!n.footblocked&&i===[].concat(o.foot).shift()&&i<=[].concat(r.body).pop())return F.call(this,n,i,1,t),n.lastReveal=i,L.call(this,e,{reveal:!0,pristine:t})}}function z(e){if("number"!=typeof e)return null;if(!(e>=16))throw new RangeError("Sequence interval must be at least 16ms.");this.id=G(),this.interval=e,this.members=[],this.headblocked=!0,this.footblocked=!0,this.lastReveal=null,this.lastReset=null,this.models={}}function N(e,t,i){var r=this;this.head=[],this.body=[],this.foot=[],n(t.members,function(t,n){var o=i.elements[t];o&&o[e]&&r.body.push(n)}),this.body.length&&n(t.members,function(t,n){var o=i.elements[t];o&&!o[e]&&(n<r.body[0]?r.head.push(n):r.foot.push(n))})}function F(e,t,n,i){var r=this,o=["headblocked",null,"footblocked"][1+n],s=e.members[t+n],a=this.store.elements[s];e[o]=!0,setTimeout(function(){e[o]=!1,a&&P.call(r,a,i)},e.interval)}function S(t,r,o,s){var a=this,l=[];"number"==typeof r?(o=parseInt(r),r={}):(o=parseInt(o),r=r||{});var c,f;try{c=u(t),f=o?new z(o):null}catch(e){return h.call(this,"Reveal failed.",e.stack||e.message)}try{n(c.reduce(function(t,n){var o={},s=n.getAttribute("data-sr-id");s?(e(o,a.store.elements[s]),o.node.setAttribute("style",o.styles.inline.computed)):(o.id=G(),o.node=n,o.seen=!1,o.revealed=!1,o.visible=!1);var c,u=e({},o.config||a.defaults,r);if(null==c&&(c=!u.mobile&&i()||!u.desktop&&!i()),c)return s&&m.call(a,o),t;var h,p=d(u.container);if(!p)throw new Error("Invalid container.");return p.contains(n)?(null==(h=D(p,l,a.store.containers))&&(h=G(),l.push({id:h,node:p})),o.config=u,o.containerId=h,o.styles=A(o),f&&(o.sequence={id:f.id,index:f.members.length},f.members.push(o.id)),t.push(o),t):t},[]),function(e){a.store.elements[e.id]=e,e.node.setAttribute("data-sr-id",e.id)})}catch(e){return h.call(this,"Reveal failed.",e.stack||e.message)}n(l,function(e){a.store.containers[e.id]={id:e.id,node:e.node}}),f&&(this.store.sequences[f.id]=f),s||(this.store.history.push({target:t,options:r,interval:o}),this.initTimeout&&window.clearTimeout(this.initTimeout),this.initTimeout=window.setTimeout(O.bind(this),0))}function D(e){for(var t=[],i=arguments.length-1;i-- >0;)t[i]=arguments[i+1];var r=null;return n(t,function(t){n(t,function(t){null===r&&t.node===e&&(r=t.id)})}),r}function C(){var e=this;n(this.store.history,function(t){S.call(e,t.target,t.options,t.interval,!0)}),O.call(this)}function W(e,t){var i=this;void 0===e&&(e={type:"init"}),void 0===t&&(t=this.store.elements),Z(function(){var r="init"===e.type||"resize"===e.type;n(i.store.containers,function(e){r&&(e.geometry=c.call(i,e,!0));var t=f.call(i,e);e.scroll&&(e.direction={x:Q(t.left-e.scroll.left),y:Q(t.top-e.scroll.top)}),e.scroll=t}),n(t,function(e){r&&(e.geometry=c.call(i,e)),e.visible=l.call(i,e)}),n(t,function(e){e.sequence?P.call(i,e):L.call(i,e)}),i.pristine=!1})}function Y(t){var n=this;if(void 0===t&&(t={}),void 0===this||Object.getPrototypeOf(this)!==Y.prototype)return new Y(t);if(!Y.isSupported())return h.call(this,"Instantiation aborted.","This browser is not supported."),X;var r;try{r=$?e({},$,t):e({},U,t)}catch(e){return h.call(this,"Instantiation failed.","Invalid configuration.",e.message),X}try{if(!d(r.container))throw new Error("Invalid container.")}catch(e){return h.call(this,"Instantiation failed.",e.message),X}return $=r,Object.defineProperty(this,"defaults",{get:function(){return $}}),this.defaults.mobile!==i()&&this.defaults.desktop!==!i()||(document.documentElement.classList.add("sr"),document.body?document.body.style.height="100%":document.addEventListener("DOMContentLoaded",function(){document.body.style.height="100%"})),this.store={containers:{},elements:{},history:[],sequences:{}},this.pristine=!0,Object.defineProperty(this,"delegate",{get:function(){return W.bind(n)}}),Object.defineProperty(this,"version",{get:function(){return _}}),Object.defineProperty(this,"noop",{get:function(){return!1}}),B||(B=this)}var $,H,B,U={delay:0,distance:"0",duration:600,easing:"cubic-bezier(0.6, 0.2, 0.1, 1)",opacity:0,origin:"bottom",rotate:{x:0,y:0,z:0},scale:1,container:document.documentElement,desktop:!0,mobile:!0,reset:!1,useDelay:"always",viewFactor:0,viewOffset:{top:0,right:0,bottom:0,left:0},afterReset:function(){},afterReveal:function(){},beforeReset:function(){},beforeReveal:function(){}},X={clean:function(){},destroy:function(){},reveal:function(){},sync:function(){},get noop(){return!0}},G=function(){var e=0;return function(){return e++}}(),J=function(){function e(e,i){if(void 0===i&&(i=n),e&&"string"==typeof e){if(t[e])return t[e];if("string"==typeof i[e])return t[e]=e;if("string"==typeof i["-webkit-"+e])return t[e]="-webkit-"+e;throw new RangeError('Unable to find "'+e+'" style property.')}throw new TypeError("Expected a string.")}var t={},n=document.documentElement.style;return e.clearCache=function(){return t={}},e}(),K=function(e){return(e>0)-(e<0)||+e},Q=Math.sign||K,V=function(){var e=Date.now();return function(t){var n=Date.now();n-e>16?(e=n,t(n)):setTimeout(function(){return V(t)},0)}}(),Z=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||V,_="4.0.0-beta.21";return Y.isSupported=function(){return s()&&a()},Object.defineProperty(Y,"debug",{get:function(){return H||!1},set:function(e){"boolean"==typeof e&&(H=e)}}),Y.prototype.clean=m,Y.prototype.destroy=y,Y.prototype.reveal=S,Y.prototype.sync=C,Y}(); |
{ | ||
"name": "scrollreveal", | ||
"version": "4.0.0-beta.20", | ||
"version": "4.0.0-beta.21", | ||
"description": "Animate elements as they scroll into view", | ||
@@ -5,0 +5,0 @@ "homepage": "https://scrollrevealjs.org", |
@@ -20,3 +20,3 @@ | ||
</a> | ||
<img src="https://img.shields.io/badge/min+gzip-5.3KB-blue.svg" alt="5.3KB min+gzip"> | ||
<img src="https://img.shields.io/badge/min+gzip-5.4KB-blue.svg" alt="5.4KB min+gzip"> | ||
<a href="https://opensource.org/licenses/GPL-3.0"> | ||
@@ -23,0 +23,0 @@ <img src="https://img.shields.io/badge/license-GPLv3-1283c3.svg" alt="GPLv3 License"> |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
119119
2678