Socket
Socket
Sign inDemoInstall

basicscroll

Package Overview
Dependencies
3
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.0 to 2.0.0-0

13

CHANGELOG.md

@@ -7,2 +7,15 @@ # Changelog

## [Unreleased]
### New
- [Track window size changes](README.md#track-window-size-changes) and recalculate and update instances when the size changes (#7)
- `track` option to disable [window size tracking](README.md#track-window-size-changes) for each instance individually (#7)
### Changed
- The `props` callback parameter is now nicely formatted
- The `update` method returns a nicely formatted object of props
- [Direct mode](README.md#data) must now be defined globally per instance instead of setting it on each prop individually
## [1.3.0] - 2018-02-24

@@ -9,0 +22,0 @@

2

dist/basicScroll.min.js

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

!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).basicScroll=t()}}(function(){return function t(n,e,r){function o(i,c){if(!e[i]){if(!n[i]){var a="function"==typeof require&&require;if(!c&&a)return a(i,!0);if(u)return u(i,!0);var s=new Error("Cannot find module '"+i+"'");throw s.code="MODULE_NOT_FOUND",s}var f=e[i]={exports:{}};n[i][0].call(f.exports,function(t){var e=n[i][1][t];return o(e||t)},f,f.exports,t,n,e,r)}return e[i].exports}for(var u="function"==typeof require&&require,i=0;i<r.length;i++)o(r[i]);return o}({1:[function(t,n,e){"use strict";n.exports=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)}},{}],2:[function(t,n,e){"use strict";n.exports=function(t){var n=1.70158;return t*t*((n+1)*t-n)}},{}],3:[function(t,n,e){"use strict";n.exports=function(t){var n=1.70158;return--t*t*((n+1)*t+n)+1}},{}],4:[function(t,n,e){"use strict";var r=t("./bounce-out");n.exports=function(t){return t<.5?.5*(1-r(1-2*t)):.5*r(2*t-1)+.5}},{"./bounce-out":6}],5:[function(t,n,e){"use strict";var r=t("./bounce-out");n.exports=function(t){return 1-r(1-t)}},{"./bounce-out":6}],6:[function(t,n,e){"use strict";n.exports=function(t){var n=t*t;return t<4/11?7.5625*n:t<8/11?9.075*n-9.9*t+3.4:t<.9?4356/361*n-35442/1805*t+16061/1805:10.8*t*t-20.52*t+10.72}},{}],7:[function(t,n,e){"use strict";n.exports=function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},{}],8:[function(t,n,e){"use strict";n.exports=function(t){return 1-Math.sqrt(1-t*t)}},{}],9:[function(t,n,e){"use strict";n.exports=function(t){return Math.sqrt(1- --t*t)}},{}],10:[function(t,n,e){"use strict";n.exports=function(t){return t<.5?4*t*t*t:.5*Math.pow(2*t-2,3)+1}},{}],11:[function(t,n,e){"use strict";n.exports=function(t){return t*t*t}},{}],12:[function(t,n,e){"use strict";n.exports=function(t){var n=t-1;return n*n*n+1}},{}],13:[function(t,n,e){"use strict";n.exports=function(t){return t<.5?.5*Math.sin(13*Math.PI/2*2*t)*Math.pow(2,10*(2*t-1)):.5*Math.sin(-13*Math.PI/2*(2*t-1+1))*Math.pow(2,-10*(2*t-1))+1}},{}],14:[function(t,n,e){"use strict";n.exports=function(t){return Math.sin(13*t*Math.PI/2)*Math.pow(2,10*(t-1))}},{}],15:[function(t,n,e){"use strict";n.exports=function(t){return Math.sin(-13*(t+1)*Math.PI/2)*Math.pow(2,-10*t)+1}},{}],16:[function(t,n,e){"use strict";n.exports=function(t){return 0===t||1===t?t:t<.5?.5*Math.pow(2,20*t-10):-.5*Math.pow(2,10-20*t)+1}},{}],17:[function(t,n,e){"use strict";n.exports=function(t){return 0===t?t:Math.pow(2,10*(t-1))}},{}],18:[function(t,n,e){"use strict";n.exports=function(t){return 1===t?t:1-Math.pow(2,-10*t)}},{}],19:[function(t,n,e){"use strict";n.exports={backInOut:t("./back-in-out"),backIn:t("./back-in"),backOut:t("./back-out"),bounceInOut:t("./bounce-in-out"),bounceIn:t("./bounce-in"),bounceOut:t("./bounce-out"),circInOut:t("./circ-in-out"),circIn:t("./circ-in"),circOut:t("./circ-out"),cubicInOut:t("./cubic-in-out"),cubicIn:t("./cubic-in"),cubicOut:t("./cubic-out"),elasticInOut:t("./elastic-in-out"),elasticIn:t("./elastic-in"),elasticOut:t("./elastic-out"),expoInOut:t("./expo-in-out"),expoIn:t("./expo-in"),expoOut:t("./expo-out"),linear:t("./linear"),quadInOut:t("./quad-in-out"),quadIn:t("./quad-in"),quadOut:t("./quad-out"),quartInOut:t("./quart-in-out"),quartIn:t("./quart-in"),quartOut:t("./quart-out"),quintInOut:t("./quint-in-out"),quintIn:t("./quint-in"),quintOut:t("./quint-out"),sineInOut:t("./sine-in-out"),sineIn:t("./sine-in"),sineOut:t("./sine-out")}},{"./back-in":2,"./back-in-out":1,"./back-out":3,"./bounce-in":5,"./bounce-in-out":4,"./bounce-out":6,"./circ-in":8,"./circ-in-out":7,"./circ-out":9,"./cubic-in":11,"./cubic-in-out":10,"./cubic-out":12,"./elastic-in":14,"./elastic-in-out":13,"./elastic-out":15,"./expo-in":17,"./expo-in-out":16,"./expo-out":18,"./linear":20,"./quad-in":22,"./quad-in-out":21,"./quad-out":23,"./quart-in":25,"./quart-in-out":24,"./quart-out":26,"./quint-in":28,"./quint-in-out":27,"./quint-out":29,"./sine-in":31,"./sine-in-out":30,"./sine-out":32}],20:[function(t,n,e){"use strict";n.exports=function(t){return t}},{}],21:[function(t,n,e){"use strict";n.exports=function(t){return(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1)}},{}],22:[function(t,n,e){"use strict";n.exports=function(t){return t*t}},{}],23:[function(t,n,e){"use strict";n.exports=function(t){return-t*(t-2)}},{}],24:[function(t,n,e){"use strict";n.exports=function(t){return t<.5?8*Math.pow(t,4):-8*Math.pow(t-1,4)+1}},{}],25:[function(t,n,e){"use strict";n.exports=function(t){return Math.pow(t,4)}},{}],26:[function(t,n,e){"use strict";n.exports=function(t){return Math.pow(t-1,3)*(1-t)+1}},{}],27:[function(t,n,e){"use strict";n.exports=function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},{}],28:[function(t,n,e){"use strict";n.exports=function(t){return t*t*t*t*t}},{}],29:[function(t,n,e){"use strict";n.exports=function(t){return--t*t*t*t*t+1}},{}],30:[function(t,n,e){"use strict";n.exports=function(t){return-.5*(Math.cos(Math.PI*t)-1)}},{}],31:[function(t,n,e){"use strict";n.exports=function(t){var n=Math.cos(t*Math.PI*.5);return Math.abs(n)<1e-14?1:1-n}},{}],32:[function(t,n,e){"use strict";n.exports=function(t){return Math.sin(t*Math.PI/2)}},{}],33:[function(t,n,e){(function(t){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=200,u="__lodash_hash_undefined__",i=9007199254740991,c="[object Arguments]",a="[object Boolean]",s="[object Date]",f="[object Function]",l="[object GeneratorFunction]",p="[object Map]",d="[object Number]",h="[object Object]",v="[object Promise]",b="[object RegExp]",y="[object Set]",_="[object String]",m="[object Symbol]",g="[object WeakMap]",w="[object ArrayBuffer]",x="[object DataView]",j="[object Float32Array]",O="[object Float64Array]",M="[object Int8Array]",q="[object Int16Array]",I="[object Int32Array]",A="[object Uint8Array]",E="[object Uint8ClampedArray]",P="[object Uint16Array]",k="[object Uint32Array]",S=/\w*$/,$=/^\[object .+?Constructor\]$/,F=/^(?:0|[1-9]\d*)$/,U={};U[c]=U["[object Array]"]=U[w]=U[x]=U[a]=U[s]=U[j]=U[O]=U[M]=U[q]=U[I]=U[p]=U[d]=U[h]=U[b]=U[y]=U[_]=U[m]=U[A]=U[E]=U[P]=U[k]=!0,U["[object Error]"]=U[f]=U[g]=!1;var D="object"==(void 0===t?"undefined":r(t))&&t&&t.Object===Object&&t,z="object"==("undefined"==typeof self?"undefined":r(self))&&self&&self.Object===Object&&self,B=D||z||Function("return this")(),N="object"==(void 0===e?"undefined":r(e))&&e&&!e.nodeType&&e,T=N&&"object"==(void 0===n?"undefined":r(n))&&n&&!n.nodeType&&n,C=T&&T.exports===N;function R(t,n){return t.set(n[0],n[1]),t}function L(t,n){return t.add(n),t}function H(t,n,e,r){var o=-1,u=t?t.length:0;for(r&&u&&(e=t[++o]);++o<u;)e=n(e,t[o],o,t);return e}function V(t){var n=!1;if(null!=t&&"function"!=typeof t.toString)try{n=!!(t+"")}catch(t){}return n}function W(t){var n=-1,e=Array(t.size);return t.forEach(function(t,r){e[++n]=[r,t]}),e}function G(t,n){return function(e){return t(n(e))}}function J(t){var n=-1,e=Array(t.size);return t.forEach(function(t){e[++n]=t}),e}var K,Q=Array.prototype,X=Function.prototype,Y=Object.prototype,Z=B["__core-js_shared__"],tt=(K=/[^.]+$/.exec(Z&&Z.keys&&Z.keys.IE_PROTO||""))?"Symbol(src)_1."+K:"",nt=X.toString,et=Y.hasOwnProperty,rt=Y.toString,ot=RegExp("^"+nt.call(et).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ut=C?B.Buffer:void 0,it=B.Symbol,ct=B.Uint8Array,at=G(Object.getPrototypeOf,Object),st=Object.create,ft=Y.propertyIsEnumerable,lt=Q.splice,pt=Object.getOwnPropertySymbols,dt=ut?ut.isBuffer:void 0,ht=G(Object.keys,Object),vt=Tt(B,"DataView"),bt=Tt(B,"Map"),yt=Tt(B,"Promise"),_t=Tt(B,"Set"),mt=Tt(B,"WeakMap"),gt=Tt(Object,"create"),wt=Vt(vt),xt=Vt(bt),jt=Vt(yt),Ot=Vt(_t),Mt=Vt(mt),qt=it?it.prototype:void 0,It=qt?qt.valueOf:void 0;function At(t){var n=-1,e=t?t.length:0;for(this.clear();++n<e;){var r=t[n];this.set(r[0],r[1])}}function Et(t){var n=-1,e=t?t.length:0;for(this.clear();++n<e;){var r=t[n];this.set(r[0],r[1])}}function Pt(t){var n=-1,e=t?t.length:0;for(this.clear();++n<e;){var r=t[n];this.set(r[0],r[1])}}function kt(t){this.__data__=new Et(t)}function St(t,n){var e,o,u,i=Gt(t)||(u=o=e=t)&&"object"==(void 0===u?"undefined":r(u))&&Jt(o)&&et.call(e,"callee")&&(!ft.call(e,"callee")||rt.call(e)==c)?function(t,n){for(var e=-1,r=Array(t);++e<t;)r[e]=n(e);return r}(t.length,String):[],a=i.length,s=!!a;for(var f in t)!n&&!et.call(t,f)||s&&("length"==f||Lt(f,a))||i.push(f);return i}function $t(t,n,e){var r=t[n];et.call(t,n)&&Wt(r,e)&&(void 0!==e||n in t)||(t[n]=e)}function Ft(t,n){for(var e=t.length;e--;)if(Wt(t[e][0],n))return e;return-1}function Ut(t,n,e,r,o,u,i){var v;if(r&&(v=u?r(t,o,u,i):r(t)),void 0!==v)return v;if(!Xt(t))return t;var g,$,F,D,z,B,N=Gt(t);if(N){if(v=function(t){var n=t.length,e=t.constructor(n);n&&"string"==typeof t[0]&&et.call(t,"index")&&(e.index=t.index,e.input=t.input);return e}(t),!n)return function(t,n){var e=-1,r=t.length;n||(n=Array(r));for(;++e<r;)n[e]=t[e];return n}(t,v)}else{var T=Rt(t),C=T==f||T==l;if(Kt(t))return function(t,n){if(n)return t.slice();var e=new t.constructor(t.length);return t.copy(e),e}(t,n);if(T==h||T==c||C&&!u){if(V(t))return u?t:{};if(v="function"!=typeof(z=C?{}:t).constructor||Ht(z)?{}:Xt(B=at(z))?st(B):{},!n)return g=t,D=t,$=(F=v)&&Bt(D,Yt(D),F),Bt(g,Ct(g),$)}else{if(!U[T])return u?t:{};v=function(t,n,e,r){var o=t.constructor;switch(n){case w:return zt(t);case a:case s:return new o(+t);case x:return F=t,U=r?zt(F.buffer):F.buffer,new F.constructor(U,F.byteOffset,F.byteLength);case j:case O:case M:case q:case I:case A:case E:case P:case k:return g=t,$=r?zt(g.buffer):g.buffer,new g.constructor($,g.byteOffset,g.length);case p:return h=t,v=e,H(r?v(W(h),!0):W(h),R,new h.constructor);case d:case _:return new o(t);case b:return(l=new(f=t).constructor(f.source,S.exec(f))).lastIndex=f.lastIndex,l;case y:return i=t,c=e,H(r?c(J(i),!0):J(i),L,new i.constructor);case m:return u=t,It?Object(It.call(u)):{}}var u;var i,c;var f,l;var h,v;var g,$;var F,U}(t,T,Ut,n)}}i||(i=new kt);var G,K,Q,X=i.get(t);if(X)return X;if(i.set(t,v),!N)var Y=e?(K=Ct,Q=Yt(G=t),Gt(G)?Q:function(t,n){for(var e=-1,r=n.length,o=t.length;++e<r;)t[o+e]=n[e];return t}(Q,K(G))):Yt(t);return function(t,n){for(var e=-1,r=t?t.length:0;++e<r&&!1!==n(t[e],e,t););}(Y||t,function(o,u){Y&&(o=t[u=o]),$t(v,u,Ut(o,n,e,r,u,t,i))}),v}function Dt(t){return!(!Xt(t)||(n=t,tt&&tt in n))&&(Qt(t)||V(t)?ot:$).test(Vt(t));var n}function zt(t){var n=new t.constructor(t.byteLength);return new ct(n).set(new ct(t)),n}function Bt(t,n,e,r){e||(e={});for(var o=-1,u=n.length;++o<u;){var i=n[o],c=r?r(e[i],t[i],i,e,t):void 0;$t(e,i,void 0===c?t[i]:c)}return e}function Nt(t,n){var e,o,u=t.__data__;return("string"==(o=void 0===(e=n)?"undefined":r(e))||"number"==o||"symbol"==o||"boolean"==o?"__proto__"!==e:null===e)?u["string"==typeof n?"string":"hash"]:u.map}function Tt(t,n){var e,r,o=(r=n,null==(e=t)?void 0:e[r]);return Dt(o)?o:void 0}At.prototype.clear=function(){this.__data__=gt?gt(null):{}},At.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},At.prototype.get=function(t){var n=this.__data__;if(gt){var e=n[t];return e===u?void 0:e}return et.call(n,t)?n[t]:void 0},At.prototype.has=function(t){var n=this.__data__;return gt?void 0!==n[t]:et.call(n,t)},At.prototype.set=function(t,n){return this.__data__[t]=gt&&void 0===n?u:n,this},Et.prototype.clear=function(){this.__data__=[]},Et.prototype.delete=function(t){var n=this.__data__,e=Ft(n,t);return!(e<0||(e==n.length-1?n.pop():lt.call(n,e,1),0))},Et.prototype.get=function(t){var n=this.__data__,e=Ft(n,t);return e<0?void 0:n[e][1]},Et.prototype.has=function(t){return Ft(this.__data__,t)>-1},Et.prototype.set=function(t,n){var e=this.__data__,r=Ft(e,t);return r<0?e.push([t,n]):e[r][1]=n,this},Pt.prototype.clear=function(){this.__data__={hash:new At,map:new(bt||Et),string:new At}},Pt.prototype.delete=function(t){return Nt(this,t).delete(t)},Pt.prototype.get=function(t){return Nt(this,t).get(t)},Pt.prototype.has=function(t){return Nt(this,t).has(t)},Pt.prototype.set=function(t,n){return Nt(this,t).set(t,n),this},kt.prototype.clear=function(){this.__data__=new Et},kt.prototype.delete=function(t){return this.__data__.delete(t)},kt.prototype.get=function(t){return this.__data__.get(t)},kt.prototype.has=function(t){return this.__data__.has(t)},kt.prototype.set=function(t,n){var e=this.__data__;if(e instanceof Et){var r=e.__data__;if(!bt||r.length<o-1)return r.push([t,n]),this;e=this.__data__=new Pt(r)}return e.set(t,n),this};var Ct=pt?G(pt,Object):function(){return[]},Rt=function(t){return rt.call(t)};function Lt(t,n){return!!(n=null==n?i:n)&&("number"==typeof t||F.test(t))&&t>-1&&t%1==0&&t<n}function Ht(t){var n=t&&t.constructor;return t===("function"==typeof n&&n.prototype||Y)}function Vt(t){if(null!=t){try{return nt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Wt(t,n){return t===n||t!=t&&n!=n}(vt&&Rt(new vt(new ArrayBuffer(1)))!=x||bt&&Rt(new bt)!=p||yt&&Rt(yt.resolve())!=v||_t&&Rt(new _t)!=y||mt&&Rt(new mt)!=g)&&(Rt=function(t){var n=rt.call(t),e=n==h?t.constructor:void 0,r=e?Vt(e):void 0;if(r)switch(r){case wt:return x;case xt:return p;case jt:return v;case Ot:return y;case Mt:return g}return n});var Gt=Array.isArray;function Jt(t){return null!=t&&("number"==typeof(n=t.length)&&n>-1&&n%1==0&&n<=i)&&!Qt(t);var n}var Kt=dt||function(){return!1};function Qt(t){var n=Xt(t)?rt.call(t):"";return n==f||n==l}function Xt(t){var n=void 0===t?"undefined":r(t);return!!t&&("object"==n||"function"==n)}function Yt(t){return Jt(t)?St(t):function(t){if(!Ht(t))return ht(t);var n=[];for(var e in Object(t))et.call(t,e)&&"constructor"!=e&&n.push(e);return n}(t)}n.exports=function(t){return Ut(t,!0,!0)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],34:[function(t,n,e){"use strict";n.exports=function(t,n){n||(n=[0,""]),t=String(t);var e=parseFloat(t,10);return n[0]=e,n[1]=t.match(/[\d.\-\+]*\s*(.*)/)[1]||"",n}},{}],35:[function(t,n,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.create=void 0;var r=i(t("parse-unit")),o=i(t("lodash.clonedeep")),u=i(t("eases"));function i(t){return t&&t.__esModule?t:{default:t}}var c=[],a=function(){return(document.scrollingElement||document.documentElement).scrollTop},s=function(t){return!1===isNaN((0,r.default)(t)[0])},f=function(t){var n=(0,r.default)(t);return{value:n[0],unit:n[1]}},l=function(t){return null!==String(t).match(/^[a-z]+-[a-z]+$/)},p=function(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:a(),r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:window.innerHeight||window.outerHeight,o=n.getBoundingClientRect(),u=t.match(/^[a-z]+/)[0],i=t.match(/[a-z]+$/)[0],c=0;return"top"===i&&(c-=0),"middle"===i&&(c-=r/2),"bottom"===i&&(c-=r),"top"===u&&(c+=o.top+e),"middle"===u&&(c+=o.top+e+o.height/2),"bottom"===u&&(c+=o.top+e+o.height),c+"px"},d=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:a(),e=t.getData(),r=e.to.value-e.from.value,o=(n-e.from.value)/(r/100),u=Math.min(Math.max(o,0),100),i=Object.keys(e.props).map(function(t){var n=e.props[t],r=!0===n.direct?e.elem:document.documentElement,o=n.from.unit||n.to.unit,i=n.from.value-n.to.value,c=n.timing(u/100),a=n.from.value-i*c;return{elem:r,key:t,value:Math.round(100*a)/100+o}}),c=o<0||o>100;return!0===(o>=0&&o<=100)&&e.inside(t,o,i),!0===c&&e.outside(t,o,i),i},h=function(t,n){t.style.setProperty(n.key,n.value)};e.create=function(t){var n=null,e=!1,r={isActive:function(){return e},getData:function(){return n},calculate:function(){n=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(null==(t=(0,o.default)(t)).from)throw new Error("Missing property `from`");if(null==t.to)throw new Error("Missing property `to`");if(null==t.inside&&(t.inside=function(){}),null==t.outside&&(t.outside=function(){}),"function"!=typeof t.inside)throw new Error("Property `inside` must be a function");if("function"!=typeof t.outside)throw new Error("Property `outside` must be a function");if(null==t.elem){if(!1===s(t.from))throw new Error("Property `from` must be a absolute value when no `elem` has been provided");if(!1===s(t.to))throw new Error("Property `to` must be a absolute value when no `elem` has been provided")}else!0===l(t.from)&&(t.from=p(t.from,t.elem)),!0===l(t.to)&&(t.to=p(t.to,t.elem));return t.from=f(t.from),t.to=f(t.to),null==t.props&&(t.props={}),Object.keys(t.props).forEach(function(n){var e=t.props[n];if(!1===s(e.from))throw new Error("Property `from` of prop must be a absolute value");if(!1===s(e.to))throw new Error("Property `from` of prop must be a absolute value");if(e.from=f(e.from),e.to=f(e.to),"string"==typeof e.timing&&null==u.default[e.timing])throw new Error("Unknown timing for property `timing` of prop");if(null==e.timing&&(e.timing=u.default.linear),"string"==typeof e.timing&&(e.timing=u.default[e.timing]),!0===e.direct&&null==t.elem)throw new Error("Property `elem` required when `direct` is true");!0!==e.direct&&(e.direct=!1)}),t}(t)},update:function(){var t=d(r);return t.forEach(function(t){return h(t.elem,t)}),t},start:function(){e=!0},stop:function(){e=!1},destroy:function(){c[i]=void 0}},i=c.push(r)-1;return r.calculate(),r};!function t(n,e){var r,o=function(){requestAnimationFrame(function(){return t(n,e)})},u=c.filter(function(t){return null!=t&&t.isActive()});if(0===u.length)return o();var i=a();if(e===i)return o();e=i;var s=u.map(function(t){return d(t,i)});(r=[]).concat.apply(r,function(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)}(s)).forEach(function(t){return h(t.elem,t)}),o()}()},{eases:19,"lodash.clonedeep":33,"parse-unit":34}]},{},[35])(35)});
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).basicScroll=t()}}(function(){return function t(n,e,r){function o(i,c){if(!e[i]){if(!n[i]){var a="function"==typeof require&&require;if(!c&&a)return a(i,!0);if(u)return u(i,!0);var s=new Error("Cannot find module '"+i+"'");throw s.code="MODULE_NOT_FOUND",s}var f=e[i]={exports:{}};n[i][0].call(f.exports,function(t){var e=n[i][1][t];return o(e||t)},f,f.exports,t,n,e,r)}return e[i].exports}for(var u="function"==typeof require&&require,i=0;i<r.length;i++)o(r[i]);return o}({1:[function(t,n,e){"use strict";n.exports=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)}},{}],2:[function(t,n,e){"use strict";n.exports=function(t){var n=1.70158;return t*t*((n+1)*t-n)}},{}],3:[function(t,n,e){"use strict";n.exports=function(t){var n=1.70158;return--t*t*((n+1)*t+n)+1}},{}],4:[function(t,n,e){"use strict";var r=t("./bounce-out");n.exports=function(t){return t<.5?.5*(1-r(1-2*t)):.5*r(2*t-1)+.5}},{"./bounce-out":6}],5:[function(t,n,e){"use strict";var r=t("./bounce-out");n.exports=function(t){return 1-r(1-t)}},{"./bounce-out":6}],6:[function(t,n,e){"use strict";n.exports=function(t){var n=t*t;return t<4/11?7.5625*n:t<8/11?9.075*n-9.9*t+3.4:t<.9?4356/361*n-35442/1805*t+16061/1805:10.8*t*t-20.52*t+10.72}},{}],7:[function(t,n,e){"use strict";n.exports=function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}},{}],8:[function(t,n,e){"use strict";n.exports=function(t){return 1-Math.sqrt(1-t*t)}},{}],9:[function(t,n,e){"use strict";n.exports=function(t){return Math.sqrt(1- --t*t)}},{}],10:[function(t,n,e){"use strict";n.exports=function(t){return t<.5?4*t*t*t:.5*Math.pow(2*t-2,3)+1}},{}],11:[function(t,n,e){"use strict";n.exports=function(t){return t*t*t}},{}],12:[function(t,n,e){"use strict";n.exports=function(t){var n=t-1;return n*n*n+1}},{}],13:[function(t,n,e){"use strict";n.exports=function(t){return t<.5?.5*Math.sin(13*Math.PI/2*2*t)*Math.pow(2,10*(2*t-1)):.5*Math.sin(-13*Math.PI/2*(2*t-1+1))*Math.pow(2,-10*(2*t-1))+1}},{}],14:[function(t,n,e){"use strict";n.exports=function(t){return Math.sin(13*t*Math.PI/2)*Math.pow(2,10*(t-1))}},{}],15:[function(t,n,e){"use strict";n.exports=function(t){return Math.sin(-13*(t+1)*Math.PI/2)*Math.pow(2,-10*t)+1}},{}],16:[function(t,n,e){"use strict";n.exports=function(t){return 0===t||1===t?t:t<.5?.5*Math.pow(2,20*t-10):-.5*Math.pow(2,10-20*t)+1}},{}],17:[function(t,n,e){"use strict";n.exports=function(t){return 0===t?t:Math.pow(2,10*(t-1))}},{}],18:[function(t,n,e){"use strict";n.exports=function(t){return 1===t?t:1-Math.pow(2,-10*t)}},{}],19:[function(t,n,e){"use strict";n.exports={backInOut:t("./back-in-out"),backIn:t("./back-in"),backOut:t("./back-out"),bounceInOut:t("./bounce-in-out"),bounceIn:t("./bounce-in"),bounceOut:t("./bounce-out"),circInOut:t("./circ-in-out"),circIn:t("./circ-in"),circOut:t("./circ-out"),cubicInOut:t("./cubic-in-out"),cubicIn:t("./cubic-in"),cubicOut:t("./cubic-out"),elasticInOut:t("./elastic-in-out"),elasticIn:t("./elastic-in"),elasticOut:t("./elastic-out"),expoInOut:t("./expo-in-out"),expoIn:t("./expo-in"),expoOut:t("./expo-out"),linear:t("./linear"),quadInOut:t("./quad-in-out"),quadIn:t("./quad-in"),quadOut:t("./quad-out"),quartInOut:t("./quart-in-out"),quartIn:t("./quart-in"),quartOut:t("./quart-out"),quintInOut:t("./quint-in-out"),quintIn:t("./quint-in"),quintOut:t("./quint-out"),sineInOut:t("./sine-in-out"),sineIn:t("./sine-in"),sineOut:t("./sine-out")}},{"./back-in":2,"./back-in-out":1,"./back-out":3,"./bounce-in":5,"./bounce-in-out":4,"./bounce-out":6,"./circ-in":8,"./circ-in-out":7,"./circ-out":9,"./cubic-in":11,"./cubic-in-out":10,"./cubic-out":12,"./elastic-in":14,"./elastic-in-out":13,"./elastic-out":15,"./expo-in":17,"./expo-in-out":16,"./expo-out":18,"./linear":20,"./quad-in":22,"./quad-in-out":21,"./quad-out":23,"./quart-in":25,"./quart-in-out":24,"./quart-out":26,"./quint-in":28,"./quint-in-out":27,"./quint-out":29,"./sine-in":31,"./sine-in-out":30,"./sine-out":32}],20:[function(t,n,e){"use strict";n.exports=function(t){return t}},{}],21:[function(t,n,e){"use strict";n.exports=function(t){return(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1)}},{}],22:[function(t,n,e){"use strict";n.exports=function(t){return t*t}},{}],23:[function(t,n,e){"use strict";n.exports=function(t){return-t*(t-2)}},{}],24:[function(t,n,e){"use strict";n.exports=function(t){return t<.5?8*Math.pow(t,4):-8*Math.pow(t-1,4)+1}},{}],25:[function(t,n,e){"use strict";n.exports=function(t){return Math.pow(t,4)}},{}],26:[function(t,n,e){"use strict";n.exports=function(t){return Math.pow(t-1,3)*(1-t)+1}},{}],27:[function(t,n,e){"use strict";n.exports=function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)}},{}],28:[function(t,n,e){"use strict";n.exports=function(t){return t*t*t*t*t}},{}],29:[function(t,n,e){"use strict";n.exports=function(t){return--t*t*t*t*t+1}},{}],30:[function(t,n,e){"use strict";n.exports=function(t){return-.5*(Math.cos(Math.PI*t)-1)}},{}],31:[function(t,n,e){"use strict";n.exports=function(t){var n=Math.cos(t*Math.PI*.5);return Math.abs(n)<1e-14?1:1-n}},{}],32:[function(t,n,e){"use strict";n.exports=function(t){return Math.sin(t*Math.PI/2)}},{}],33:[function(t,n,e){(function(t){"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o=200,u="__lodash_hash_undefined__",i=9007199254740991,c="[object Arguments]",a="[object Boolean]",s="[object Date]",f="[object Function]",l="[object GeneratorFunction]",p="[object Map]",d="[object Number]",h="[object Object]",v="[object Promise]",b="[object RegExp]",y="[object Set]",_="[object String]",m="[object Symbol]",w="[object WeakMap]",g="[object ArrayBuffer]",x="[object DataView]",j="[object Float32Array]",O="[object Float64Array]",M="[object Int8Array]",q="[object Int16Array]",I="[object Int32Array]",E="[object Uint8Array]",A="[object Uint8ClampedArray]",k="[object Uint16Array]",P="[object Uint32Array]",S=/\w*$/,$=/^\[object .+?Constructor\]$/,F=/^(?:0|[1-9]\d*)$/,D={};D[c]=D["[object Array]"]=D[g]=D[x]=D[a]=D[s]=D[j]=D[O]=D[M]=D[q]=D[I]=D[p]=D[d]=D[h]=D[b]=D[y]=D[_]=D[m]=D[E]=D[A]=D[k]=D[P]=!0,D["[object Error]"]=D[f]=D[w]=!1;var U="object"==(void 0===t?"undefined":r(t))&&t&&t.Object===Object&&t,z="object"==("undefined"==typeof self?"undefined":r(self))&&self&&self.Object===Object&&self,T=U||z||Function("return this")(),B="object"==(void 0===e?"undefined":r(e))&&e&&!e.nodeType&&e,N=B&&"object"==(void 0===n?"undefined":r(n))&&n&&!n.nodeType&&n,C=N&&N.exports===B;function L(t,n){return t.set(n[0],n[1]),t}function R(t,n){return t.add(n),t}function H(t,n,e,r){var o=-1,u=t?t.length:0;for(r&&u&&(e=t[++o]);++o<u;)e=n(e,t[o],o,t);return e}function V(t){var n=!1;if(null!=t&&"function"!=typeof t.toString)try{n=!!(t+"")}catch(t){}return n}function W(t){var n=-1,e=Array(t.size);return t.forEach(function(t,r){e[++n]=[r,t]}),e}function G(t,n){return function(e){return t(n(e))}}function J(t){var n=-1,e=Array(t.size);return t.forEach(function(t){e[++n]=t}),e}var K,Q=Array.prototype,X=Function.prototype,Y=Object.prototype,Z=T["__core-js_shared__"],tt=(K=/[^.]+$/.exec(Z&&Z.keys&&Z.keys.IE_PROTO||""))?"Symbol(src)_1."+K:"",nt=X.toString,et=Y.hasOwnProperty,rt=Y.toString,ot=RegExp("^"+nt.call(et).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ut=C?T.Buffer:void 0,it=T.Symbol,ct=T.Uint8Array,at=G(Object.getPrototypeOf,Object),st=Object.create,ft=Y.propertyIsEnumerable,lt=Q.splice,pt=Object.getOwnPropertySymbols,dt=ut?ut.isBuffer:void 0,ht=G(Object.keys,Object),vt=Nt(T,"DataView"),bt=Nt(T,"Map"),yt=Nt(T,"Promise"),_t=Nt(T,"Set"),mt=Nt(T,"WeakMap"),wt=Nt(Object,"create"),gt=Vt(vt),xt=Vt(bt),jt=Vt(yt),Ot=Vt(_t),Mt=Vt(mt),qt=it?it.prototype:void 0,It=qt?qt.valueOf:void 0;function Et(t){var n=-1,e=t?t.length:0;for(this.clear();++n<e;){var r=t[n];this.set(r[0],r[1])}}function At(t){var n=-1,e=t?t.length:0;for(this.clear();++n<e;){var r=t[n];this.set(r[0],r[1])}}function kt(t){var n=-1,e=t?t.length:0;for(this.clear();++n<e;){var r=t[n];this.set(r[0],r[1])}}function Pt(t){this.__data__=new At(t)}function St(t,n){var e,o,u,i=Gt(t)||(u=o=e=t)&&"object"==(void 0===u?"undefined":r(u))&&Jt(o)&&et.call(e,"callee")&&(!ft.call(e,"callee")||rt.call(e)==c)?function(t,n){for(var e=-1,r=Array(t);++e<t;)r[e]=n(e);return r}(t.length,String):[],a=i.length,s=!!a;for(var f in t)!n&&!et.call(t,f)||s&&("length"==f||Rt(f,a))||i.push(f);return i}function $t(t,n,e){var r=t[n];et.call(t,n)&&Wt(r,e)&&(void 0!==e||n in t)||(t[n]=e)}function Ft(t,n){for(var e=t.length;e--;)if(Wt(t[e][0],n))return e;return-1}function Dt(t,n,e,r,o,u,i){var v;if(r&&(v=u?r(t,o,u,i):r(t)),void 0!==v)return v;if(!Xt(t))return t;var w,$,F,U,z,T,B=Gt(t);if(B){if(v=function(t){var n=t.length,e=t.constructor(n);n&&"string"==typeof t[0]&&et.call(t,"index")&&(e.index=t.index,e.input=t.input);return e}(t),!n)return function(t,n){var e=-1,r=t.length;n||(n=Array(r));for(;++e<r;)n[e]=t[e];return n}(t,v)}else{var N=Lt(t),C=N==f||N==l;if(Kt(t))return function(t,n){if(n)return t.slice();var e=new t.constructor(t.length);return t.copy(e),e}(t,n);if(N==h||N==c||C&&!u){if(V(t))return u?t:{};if(v="function"!=typeof(z=C?{}:t).constructor||Ht(z)?{}:Xt(T=at(z))?st(T):{},!n)return w=t,U=t,$=(F=v)&&Tt(U,Yt(U),F),Tt(w,Ct(w),$)}else{if(!D[N])return u?t:{};v=function(t,n,e,r){var o=t.constructor;switch(n){case g:return zt(t);case a:case s:return new o(+t);case x:return F=t,D=r?zt(F.buffer):F.buffer,new F.constructor(D,F.byteOffset,F.byteLength);case j:case O:case M:case q:case I:case E:case A:case k:case P:return w=t,$=r?zt(w.buffer):w.buffer,new w.constructor($,w.byteOffset,w.length);case p:return h=t,v=e,H(r?v(W(h),!0):W(h),L,new h.constructor);case d:case _:return new o(t);case b:return(l=new(f=t).constructor(f.source,S.exec(f))).lastIndex=f.lastIndex,l;case y:return i=t,c=e,H(r?c(J(i),!0):J(i),R,new i.constructor);case m:return u=t,It?Object(It.call(u)):{}}var u;var i,c;var f,l;var h,v;var w,$;var F,D}(t,N,Dt,n)}}i||(i=new Pt);var G,K,Q,X=i.get(t);if(X)return X;if(i.set(t,v),!B)var Y=e?(K=Ct,Q=Yt(G=t),Gt(G)?Q:function(t,n){for(var e=-1,r=n.length,o=t.length;++e<r;)t[o+e]=n[e];return t}(Q,K(G))):Yt(t);return function(t,n){for(var e=-1,r=t?t.length:0;++e<r&&!1!==n(t[e],e,t););}(Y||t,function(o,u){Y&&(o=t[u=o]),$t(v,u,Dt(o,n,e,r,u,t,i))}),v}function Ut(t){return!(!Xt(t)||(n=t,tt&&tt in n))&&(Qt(t)||V(t)?ot:$).test(Vt(t));var n}function zt(t){var n=new t.constructor(t.byteLength);return new ct(n).set(new ct(t)),n}function Tt(t,n,e,r){e||(e={});for(var o=-1,u=n.length;++o<u;){var i=n[o],c=r?r(e[i],t[i],i,e,t):void 0;$t(e,i,void 0===c?t[i]:c)}return e}function Bt(t,n){var e,o,u=t.__data__;return("string"==(o=void 0===(e=n)?"undefined":r(e))||"number"==o||"symbol"==o||"boolean"==o?"__proto__"!==e:null===e)?u["string"==typeof n?"string":"hash"]:u.map}function Nt(t,n){var e,r,o=(r=n,null==(e=t)?void 0:e[r]);return Ut(o)?o:void 0}Et.prototype.clear=function(){this.__data__=wt?wt(null):{}},Et.prototype.delete=function(t){return this.has(t)&&delete this.__data__[t]},Et.prototype.get=function(t){var n=this.__data__;if(wt){var e=n[t];return e===u?void 0:e}return et.call(n,t)?n[t]:void 0},Et.prototype.has=function(t){var n=this.__data__;return wt?void 0!==n[t]:et.call(n,t)},Et.prototype.set=function(t,n){return this.__data__[t]=wt&&void 0===n?u:n,this},At.prototype.clear=function(){this.__data__=[]},At.prototype.delete=function(t){var n=this.__data__,e=Ft(n,t);return!(e<0||(e==n.length-1?n.pop():lt.call(n,e,1),0))},At.prototype.get=function(t){var n=this.__data__,e=Ft(n,t);return e<0?void 0:n[e][1]},At.prototype.has=function(t){return Ft(this.__data__,t)>-1},At.prototype.set=function(t,n){var e=this.__data__,r=Ft(e,t);return r<0?e.push([t,n]):e[r][1]=n,this},kt.prototype.clear=function(){this.__data__={hash:new Et,map:new(bt||At),string:new Et}},kt.prototype.delete=function(t){return Bt(this,t).delete(t)},kt.prototype.get=function(t){return Bt(this,t).get(t)},kt.prototype.has=function(t){return Bt(this,t).has(t)},kt.prototype.set=function(t,n){return Bt(this,t).set(t,n),this},Pt.prototype.clear=function(){this.__data__=new At},Pt.prototype.delete=function(t){return this.__data__.delete(t)},Pt.prototype.get=function(t){return this.__data__.get(t)},Pt.prototype.has=function(t){return this.__data__.has(t)},Pt.prototype.set=function(t,n){var e=this.__data__;if(e instanceof At){var r=e.__data__;if(!bt||r.length<o-1)return r.push([t,n]),this;e=this.__data__=new kt(r)}return e.set(t,n),this};var Ct=pt?G(pt,Object):function(){return[]},Lt=function(t){return rt.call(t)};function Rt(t,n){return!!(n=null==n?i:n)&&("number"==typeof t||F.test(t))&&t>-1&&t%1==0&&t<n}function Ht(t){var n=t&&t.constructor;return t===("function"==typeof n&&n.prototype||Y)}function Vt(t){if(null!=t){try{return nt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Wt(t,n){return t===n||t!=t&&n!=n}(vt&&Lt(new vt(new ArrayBuffer(1)))!=x||bt&&Lt(new bt)!=p||yt&&Lt(yt.resolve())!=v||_t&&Lt(new _t)!=y||mt&&Lt(new mt)!=w)&&(Lt=function(t){var n=rt.call(t),e=n==h?t.constructor:void 0,r=e?Vt(e):void 0;if(r)switch(r){case gt:return x;case xt:return p;case jt:return v;case Ot:return y;case Mt:return w}return n});var Gt=Array.isArray;function Jt(t){return null!=t&&("number"==typeof(n=t.length)&&n>-1&&n%1==0&&n<=i)&&!Qt(t);var n}var Kt=dt||function(){return!1};function Qt(t){var n=Xt(t)?rt.call(t):"";return n==f||n==l}function Xt(t){var n=void 0===t?"undefined":r(t);return!!t&&("object"==n||"function"==n)}function Yt(t){return Jt(t)?St(t):function(t){if(!Ht(t))return ht(t);var n=[];for(var e in Object(t))et.call(t,e)&&"constructor"!=e&&n.push(e);return n}(t)}n.exports=function(t){return Dt(t,!0,!0)}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],34:[function(t,n,e){"use strict";n.exports=function(t,n){n||(n=[0,""]),t=String(t);var e=parseFloat(t,10);return n[0]=e,n[1]=t.match(/[\d.\-\+]*\s*(.*)/)[1]||"",n}},{}],35:[function(t,n,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.create=void 0;var r=i(t("parse-unit")),o=i(t("lodash.clonedeep")),u=i(t("eases"));function i(t){return t&&t.__esModule?t:{default:t}}var c,a,s,f=[],l=function(){return(document.scrollingElement||document.documentElement).scrollTop},p=function(t){return!1===isNaN((0,r.default)(t)[0])},d=function(t){var n=(0,r.default)(t);return{value:n[0],unit:n[1]}},h=function(t){return null!==String(t).match(/^[a-z]+-[a-z]+$/)},v=function(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:l(),r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:window.innerHeight||window.outerHeight,o=n.getBoundingClientRect(),u=t.match(/^[a-z]+/)[0],i=t.match(/[a-z]+$/)[0],c=0;return"top"===i&&(c-=0),"middle"===i&&(c-=r/2),"bottom"===i&&(c-=r),"top"===u&&(c+=o.top+e),"middle"===u&&(c+=o.top+e+o.height/2),"bottom"===u&&(c+=o.top+e+o.height),c+"px"},b=function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l(),e=t.getData(),r=e.to.value-e.from.value,o=(n-e.from.value)/(r/100),u=Math.min(Math.max(o,0),100),i=!0===e.direct?e.elem:document.documentElement,c=Object.keys(e.props).reduce(function(t,n){var r=e.props[n],o=r.from.unit||r.to.unit,i=r.from.value-r.to.value,c=r.timing(u/100),a=r.from.value-i*c,s=Math.round(100*a)/100;return t[n]=s+o,t},{}),a=o<0||o>100;return!0===(o>=0&&o<=100)&&e.inside(t,o,c),!0===a&&e.outside(t,o,c),{elem:i,props:c}},y=function(t,n){Object.keys(n).forEach(function(e){return r=t,o={key:e,value:n[e]},void r.style.setProperty(o.key,o.value);var r,o})};e.create=function(t){var n=null,e=!1,r={isActive:function(){return e},getData:function(){return n},calculate:function(){n=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(null==(t=(0,o.default)(t)).from)throw new Error("Missing property `from`");if(null==t.to)throw new Error("Missing property `to`");if(null==t.inside&&(t.inside=function(){}),null==t.outside&&(t.outside=function(){}),!0===t.direct&&null==t.elem)throw new Error("Property `elem` required when `direct` is true");if(!0!==t.direct&&(t.direct=!1),!1!==t.track&&(t.track=!0),"function"!=typeof t.inside)throw new Error("Property `inside` must be a function");if("function"!=typeof t.outside)throw new Error("Property `outside` must be a function");if(null==t.elem){if(!1===p(t.from))throw new Error("Property `from` must be a absolute value when no `elem` has been provided");if(!1===p(t.to))throw new Error("Property `to` must be a absolute value when no `elem` has been provided")}else!0===h(t.from)&&(t.from=v(t.from,t.elem)),!0===h(t.to)&&(t.to=v(t.to,t.elem));return t.from=d(t.from),t.to=d(t.to),null==t.props&&(t.props={}),Object.keys(t.props).forEach(function(n){var e=t.props[n];if(!1===p(e.from))throw new Error("Property `from` of prop must be a absolute value");if(!1===p(e.to))throw new Error("Property `from` of prop must be a absolute value");if(e.from=d(e.from),e.to=d(e.to),"string"==typeof e.timing&&null==u.default[e.timing])throw new Error("Unknown timing for property `timing` of prop");null==e.timing&&(e.timing=u.default.linear),"string"==typeof e.timing&&(e.timing=u.default[e.timing])}),t}(t)},update:function(){var t=b(r),n=t.elem,e=t.props;return y(n,e),e},start:function(){e=!0},stop:function(){e=!1},destroy:function(){f[i]=void 0}},i=f.push(r)-1;return r.calculate(),r};!function t(n,e){var r=function(){requestAnimationFrame(function(){return t(n,e)})},o=f.filter(function(t){return null!=t&&t.isActive()});if(0===o.length)return r();var u=l();if(e===u)return r();e=u,o.map(function(t){return b(t,u)}).forEach(function(t){var n=t.elem,e=t.props;return y(n,e)}),r()}(),window.addEventListener("resize",(c=function(){f.filter(function(t){return null!=t&&t.getData().track}).forEach(function(t){t.calculate(),t.update()})},a=50,s=null,function(){for(var t=arguments.length,n=Array(t),e=0;e<t;e++)n[e]=arguments[e];clearTimeout(s),s=setTimeout(function(){return c.apply(void 0,n)},a)}))},{eases:19,"lodash.clonedeep":33,"parse-unit":34}]},{},[35])(35)});
{
"name": "basicscroll",
"moduleName": "basicScroll",
"version": "1.3.0",
"version": "2.0.0-0",
"authors": [

@@ -6,0 +6,0 @@ "Tobias Reich <tobias@electerious.com>"

@@ -212,3 +212,3 @@ # basicScroll

```js
instance.update()
const props = instance.update()
```

@@ -218,3 +218,3 @@

- `{Array}` New props. An array of objects, each with a key and value.
- `{Object}` Applied props.

@@ -275,2 +275,10 @@ ### .calculate()

/*
* Direct mode.
*/
direct: false,
/*
* Track window size changes.
*/
track: true,
/*
* Callback functions.

@@ -296,7 +304,3 @@ */

*/
timing: 'ease',
/*
* Direct mode.
*/
direct: false
timing: 'ease'
}

@@ -365,2 +369,58 @@ }

### Direct mode
Type: `Boolean` Default: `false` Optional: `true`
basicScroll applies all [props](#props) globally by default. This way you can use variables everywhere in your CSS, even when the instance tracks just one element. Set `direct` to `true` to apply all styles directly to the [DOM Element/Node](#dom-elementnode). Setting `direct` to `true` also allows you to animate CSS properties, not just CSS variables.
Examples:
```html
<!-- direct: false -->
<html style="--name: 0;">
<div class="element"></div>
</html>
```
```html
<!-- direct: true -->
<html>
<div class="element" style="--name: 0;"></div>
</html>
```
### Track window size changes
Type: `Boolean` Default: `true` Optional: `true`
basicScroll automatically recalculates and updates instances when the size of the window changes. You can disable the tracking for each instance individually when you want to take care of it by yourself.
Note: basicScroll only tracks the window size. You still must recalculate and update your instances manually when you modify your site. Each modification that changes the layout of the page should trigger such an update in your code.
Example:
```js
const instance = basicScroll.create({
elem: document.querySelector('.element'),
from: 'top-bottom',
to: 'bottom-top',
track: false,
props: {
'--opacity': {
from: 0,
to: 1
}
}
})
// Recalculate and update your instance manually when the tracking is disabled.
// Debounce this function in production to avoid unnecessary calculations.
window.onresize = function() {
instance.calculate()
instance.update()
}
```
### Callback functions

@@ -472,24 +532,2 @@

### Direct mode
Type: `Boolean` Default: `false` Optional: `true`
basicScroll applies all [props](#props) globally by default. This way you can use variables everywhere in your CSS, even when the instance tracks just one element. Set `direct` to `true` to apply styles directly to the [DOM Element/Node](#dom-elementnode). Setting `direct` to `true` also allows you to animate CSS properties, not just CSS variables.
Examples:
```html
<!-- direct: false -->
<html style="--name: 0;">
<div class="element"></div>
</html>
```
```html
<!-- direct: true -->
<html>
<div class="element" style="--name: 0;"></div>
</html>
```
## Tips

@@ -496,0 +534,0 @@

@@ -8,2 +8,22 @@ import parseUnit from 'parse-unit'

/**
* Debounces a function that will be triggered many times.
* @param {Function} fn
* @param {Integer} duration
* @returns {Function}
*/
const debounce = function(fn, duration) {
let timeout = null
return (...args) => {
clearTimeout(timeout)
timeout = setTimeout(() => fn(...args), duration)
}
}
/**
* Returns all active instances from an array.

@@ -20,2 +40,14 @@ * @param {Array} instances

/**
* Returns all tracked instances from an array.
* @param {Array} instances
* @returns {Array} instances - Tracked instances.
*/
const getTrackedInstances = function(instances) {
return instances.filter((instance) => instance!=null && instance.getData().track)
}
/**
* Returns the number of scrolled pixels.

@@ -126,2 +158,7 @@ * @returns {Integer} scrollTop

if (data.direct===true && data.elem==null) throw new Error('Property `elem` required when `direct` is true')
if (data.direct!==true) data.direct = false
if (data.track!==false) data.track = true
if (typeof data.inside!=='function') throw new Error('Property `inside` must be a function')

@@ -162,6 +199,2 @@ if (typeof data.outside!=='function') throw new Error('Property `outside` must be a function')

if (prop.direct===true && data.elem==null) throw new Error('Property `elem` required when `direct` is true')
if (prop.direct!==true) prop.direct = false
})

@@ -174,8 +207,8 @@

/**
* Updates instance props and their values.
* Calculates the props of an instance.
* @param {Object} instance
* @param {?Integer} scrollTop - Pixels scrolled in document.
* @returns {Array} props - Updated props.
* @returns {Object} Calculated props and the element to apply styles to.
*/
const update = function(instance, scrollTop = getScrollTop()) {
const getProps = function(instance, scrollTop = getScrollTop()) {

@@ -194,11 +227,11 @@ const data = instance.getData()

// Generate an array with all updated props
const props = Object.keys(data.props).map((key) => {
// Apply styles directly to element when direct is true.
// Apply them globally when direct is false.
const elem = data.direct===true ? data.elem : document.documentElement
// Generate an array with all new props
const props = Object.keys(data.props).reduce((acc, key) => {
const prop = data.props[key]
// Apply styles directly to element when direct is true.
// Apply them globally when direct is false.
const elem = prop.direct===true ? data.elem : document.documentElement
// Use the unit of from OR to. It's valid to animate from '0' to '100px' and

@@ -222,10 +255,8 @@ // '0' should be treated as 'px', too. Unit will be an empty string when no unit given.

return {
elem: elem,
key: key,
value: rounded + unit
}
acc[key] = rounded + unit
})
return acc
}, {})
// Use precise percentage to check if the viewport is between from and to.

@@ -240,3 +271,6 @@ // Would always return true when using the normalized percentage.

return props
return {
elem,
props
}

@@ -257,2 +291,16 @@ }

/**
* Adds properties to a given style object.
* @param {Node} elem - Styles will be applied to this element.
* @param {Object} props - Object of props.
*/
const setProps = function(elem, props) {
Object.keys(props).forEach((key) => setProp(elem, {
key: key,
value: props[key]
}))
}
/**
* Gets and sets new props when the user has scrolled and when there are active instances.

@@ -287,11 +335,7 @@ * This part get executed with every frame. Make sure it's performant as hell.

// Get new props of each instance
const newProps = activeInstances.map((instance) => update(instance, scrollTop))
// Get and set new props of each instance
activeInstances
.map((instance) => getProps(instance, scrollTop))
.forEach(({ elem, props }) => setProps(elem, props))
// Flatten props because each update can return multiple props
const flattedProps = [].concat(...newProps)
// Set new props
flattedProps.forEach((prop) => setProp(prop.elem, prop))
repeat()

@@ -338,9 +382,9 @@

// Get new props of each instance
const newProps = update(instance)
// Get new props
const { elem, props } = getProps(instance)
// Set new props
newProps.forEach((prop) => setProp(prop.elem, prop))
setProps(elem, props)
return newProps
return props

@@ -395,2 +439,17 @@ }

// Start to loop
loop()
loop()
// Recalculate and update instances when the window size changes
window.addEventListener('resize', debounce(() => {
// Get all tracked instances
const trackedInstances = getTrackedInstances(instances)
trackedInstances.forEach((instance) => {
instance.calculate()
instance.update()
})
}, 50))
SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc