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

@better-scroll/core

Package Overview
Dependencies
Maintainers
3
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@better-scroll/core - npm Package Compare versions

Comparing version 2.0.0-beta.2 to 2.0.0-beta.4

2

dist/core.min.js

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).BScroll={})}(this,function(t){"use strict";var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(t,e)};function e(t,e){function o(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}var l=function(){return(l=Object.assign||function(t){for(var e,o=1,i=arguments.length;o<i;o++)for(var s in e=arguments[o])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t}).apply(this,arguments)};function s(t){console.error("[BScroll warn]: "+t)}var o="undefined"!=typeof window,n=o&&navigator.userAgent.toLowerCase(),r=n&&/wechatdevtools/.test(n),h=n&&0<n.indexOf("android");function p(){return window.performance&&window.performance.now?window.performance.now()+window.performance.timing.navigationStart:+new Date}function a(t){for(var e=[],o=1;o<arguments.length;o++)e[o-1]=arguments[o];for(var i=0;i<e.length;i++){var s=e[i];for(var n in s)t[n]=s[n]}return t}function c(t){return null==t}var u=o&&document.createElement("div").style,f=function(){if(!o)return!1;var t={webkit:"webkitTransform",Moz:"MozTransform",O:"OTransform",ms:"msTransform",standard:"transform"};for(var e in t)if(void 0!==u[t[e]])return e;return!1}();function d(t){return!1===f?t:"standard"===f?"transitionEnd"===t?"transitionend":t:f+t.charAt(0).toUpperCase()+t.substr(1)}function v(t){return"string"==typeof t?document.querySelector(t):t}function m(t,e,o,i){t.addEventListener(e,o,{passive:!1,capture:!!i})}function y(t,e,o,i){t.removeEventListener(e,o,{capture:!!i})}function g(t){for(var e=0,o=0;t;)e-=t.offsetLeft,o-=t.offsetTop,t=t.offsetParent;return{left:e,top:o}}f&&"standard"!==f&&f.toLowerCase();var k=d("transform"),T=d("transition"),b=o&&d("perspective")in u,P=o&&("ontouchstart"in window||r),w=o&&T in u,S={transform:k,transition:T,transitionTimingFunction:d("transitionTimingFunction"),transitionDuration:d("transitionDuration"),transitionDelay:d("transitionDelay"),transformOrigin:d("transformOrigin"),transitionEnd:d("transitionEnd")},E={touchstart:1,touchmove:1,touchend:1,mousedown:2,mousemove:2,mouseup:2};function B(t){if(t instanceof window.SVGElement){var e=t.getBoundingClientRect();return{top:e.top,left:e.left,width:e.width,height:e.height}}return{top:t.offsetTop,left:t.offsetLeft,width:t.offsetWidth,height:t.offsetHeight}}function D(t,e){for(var o in e)if(e[o].test(t[o]))return!0;return!1}var Y=D;function X(t,e){var o;void 0===e&&(e="click"),"mouseup"===t.type?o=t:"touchend"!==t.type&&"touchcancel"!==t.type||(o=t.changedTouches[0]);var i,s={};o&&(s.screenX=o.screenX||0,s.screenY=o.screenY||0,s.clientX=o.clientX||0,s.clientY=o.clientY||0);var n=!0,r=!0;if("undefined"!=typeof MouseEvent)try{i=new MouseEvent(e,a({bubbles:n,cancelable:r},s))}catch(t){h()}else h();function h(){(i=document.createEvent("Event")).initEvent(e,n,r),a(i,s)}i.forwardedTouchEvent=!0,i._constructed=!0,t.target.dispatchEvent(i)}var x={swipe:{style:"cubic-bezier(0.23, 1, 0.32, 1)",fn:function(t){return 1+--t*t*t*t*t}},swipeBounce:{style:"cubic-bezier(0.25, 0.46, 0.45, 0.94)",fn:function(t){return t*(2-t)}},bounce:{style:"cubic-bezier(0.165, 0.84, 0.44, 1)",fn:function(t){return 1- --t*t*t*t}}},L=o&&window;function M(){}function C(t){}var O=o?L.requestAnimationFrame||L.webkitRequestAnimationFrame||L.mozRequestAnimationFrame||L.oRequestAnimationFrame||function(t){return window.setTimeout(t,(t.interval||100/60)/2)}:M,z=o?L.cancelAnimationFrame||L.webkitCancelAnimationFrame||L.mozCancelAnimationFrame||L.oCancelAnimationFrame||function(t){window.clearTimeout(t)}:M,H={enumerable:!0,configurable:!0,get:C,set:C};var A,F,N,R,K,_,j,I,V,W,q,U,Z=($.prototype.on=function(t,e,o){return void 0===o&&(o=this),this._checkInTypes(t),this.events[t]||(this.events[t]=[]),this.events[t].push([e,o]),this},$.prototype.once=function(o,i,s){var n=this;void 0===s&&(s=this),this._checkInTypes(o);var r=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];n.off(o,r),i.apply(s,t)};return r.fn=i,this.on(o,r),this},$.prototype.off=function(t,e){if(!t&&!e)return this.events={},this;if(t){if(this._checkInTypes(t),!e)return this.events[t]=[],this;var o=this.events[t];if(!o)return this;for(var i=o.length;i--;)(o[i][0]===e||o[i][0]&&o[i][0].fn===e)&&o.splice(i,1);return this}},$.prototype.trigger=function(t){for(var e=[],o=1;o<arguments.length;o++)e[o-1]=arguments[o];this._checkInTypes(t);var i=this.events[t];if(i)for(var s,n=i.length,r=i.slice(),h=0;h<n;h++){var a=r[h],c=a[0],l=a[1];if(c&&!0===(s=c.apply(l,e)))return s}},$.prototype.registerType=function(t){var e=this;t.forEach(function(t){e.eventTypes[t]=t})},$.prototype.destroy=function(){this.events={},this.eventTypes={}},$.prototype._checkInTypes=function(t){var e=this.eventTypes;e[t]===t||s('EventEmitter has used unknown event type: "'+t+'", should be oneof ['+Object.keys(e)+"]")},$);function $(t){this.events={},this.eventTypes={},this.registerType(t)}(F=A||(A={}))[F.Positive=1]="Positive",F[F.Negative=-1]="Negative",F[F.Default=0]="Default",(R=N||(N={})).Default="",R.Horizontal="horizontal",R.Vertical="vertical",R.None="none",(_=K||(K={})).None="",_.Horizontal="horizontal",_.Vertical="vertical",(I=j||(j={}))[I.Touch=1]="Touch",I[I.Mouse=2]="Mouse",(W=V||(V={}))[W.Left=0]="Left",W[W.Middle=1]="Middle",W[W.Right=2]="Right",(U=q||(q={}))[U.Default=0]="Default",U[U.Throttle=1]="Throttle",U[U.Normal=2]="Normal",U[U.Realtime=3]="Realtime";var G=(J.prototype.merge=function(t){if(!t)return this;for(var e in t)this[e]=t[e];return this},J.prototype.process=function(){return this.translateZ=this.HWCompositing&&b?" translateZ(0)":"",this.useTransition=this.useTransition&&w,this.preventDefault=!this.eventPassthrough&&this.preventDefault,this.scrollX=this.eventPassthrough!==K.Horizontal&&this.scrollX,this.scrollY=this.eventPassthrough!==K.Vertical&&this.scrollY,this.freeScroll=this.freeScroll&&!this.eventPassthrough,this.scrollX=!!this.freeScroll||this.scrollX,this.scrollY=!!this.freeScroll||this.scrollY,this.directionLockThreshold=this.eventPassthrough?0:this.directionLockThreshold,this},J);function J(){this.startX=0,this.startY=0,this.scrollX=!1,this.scrollY=!0,this.freeScroll=!1,this.directionLockThreshold=5,this.eventPassthrough=K.None,this.click=!1,this.dblclick=!1,this.tap="",this.bounce={top:!0,bottom:!0,left:!0,right:!0},this.bounceTime=800,this.momentum=!0,this.momentumLimitTime=300,this.momentumLimitDistance=15,this.swipeTime=2500,this.swipeBounceTime=500,this.deceleration=.0015,this.flickLimitTime=200,this.flickLimitDistance=100,this.resizePolling=60,this.probeType=q.Default,this.stopPropagation=!1,this.preventDefault=!0,this.preventDefaultException={tagName:/^(INPUT|TEXTAREA|BUTTON|SELECT|AUDIO)$/},this.tagException={tagName:/^TEXTAREA$/},this.HWCompositing=!0,this.useTransition=!0,this.bindToWrapper=!1,this.disableMouse=P,this.disableTouch=!P,this.autoBlur=!0}var Q=(tt.prototype.destroy=function(){this.removeDOMEvents(),this.events=[]},tt.prototype.addDOMEvents=function(){this.handleDOMEvents(m)},tt.prototype.removeDOMEvents=function(){this.handleDOMEvents(y)},tt.prototype.handleDOMEvents=function(e){var o=this,i=this.wrapper;this.events.forEach(function(t){e(i,t.name,o,!!t.capture)})},tt.prototype.handleEvent=function(e){var o=e.type;this.events.some(function(t){return t.name===o&&(t.handler(e),!0)})},tt);function tt(t,e){this.wrapper=t,this.events=e,this.addDOMEvents()}var et=(ot.prototype.handleDOMEvents=function(){var t=this.options,e=t.bindToWrapper,o=t.disableMouse,i=t.disableTouch,s=t.click,n=this.wrapper,r=e?n:window,h=[],a=[],c=P&&!i,l=!o;s&&h.push({name:"click",handler:this.click.bind(this),capture:!0}),c&&(h.push({name:"touchstart",handler:this.start.bind(this)}),a.push({name:"touchmove",handler:this.move.bind(this)},{name:"touchend",handler:this.end.bind(this)},{name:"touchcancel",handler:this.end.bind(this)})),l&&(h.push({name:"mousedown",handler:this.start.bind(this)}),a.push({name:"mousemove",handler:this.move.bind(this)},{name:"mouseup",handler:this.end.bind(this)})),this.wrapperEventRegister=new Q(n,h),this.targetEventRegister=new Q(r,a)},ot.prototype.beforeHandler=function(t,e){var o=this.options,i=o.preventDefault,s=o.stopPropagation,n=o.preventDefaultException;!{start:function(){return i&&!D(t.target,n)},end:function(){return i&&!D(t.target,n)},move:function(){return i}}[e]()||t.preventDefault(),s&&t.stopPropagation()},ot.prototype.setInitiated=function(t){void 0===t&&(t=0),this.initiated=t},ot.prototype.start=function(t){var e=E[t.type];if(!this.initiated||this.initiated===e)if(this.setInitiated(e),Y(t.target,this.options.tagException))this.setInitiated();else if((e!==j.Mouse||t.button===V.Left)&&!this.hooks.trigger(this.hooks.eventTypes.beforeStart,t)){this.beforeHandler(t,"start");var o=t.touches?t.touches[0]:t;this.pointX=o.pageX,this.pointY=o.pageY,this.hooks.trigger(this.hooks.eventTypes.start,t)}},ot.prototype.move=function(t){if(E[t.type]===this.initiated){this.beforeHandler(t,"move");var e=t.touches?t.touches[0]:t,o=e.pageX-this.pointX,i=e.pageY-this.pointY;if(this.pointX=e.pageX,this.pointY=e.pageY,!this.hooks.trigger(this.hooks.eventTypes.move,{deltaX:o,deltaY:i,e:t})){var s=document.documentElement.scrollLeft||window.pageXOffset||document.body.scrollLeft,n=document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop,r=this.pointX-s,h=this.pointY-n;(r>document.documentElement.clientWidth-this.options.momentumLimitDistance||r<this.options.momentumLimitDistance||h<this.options.momentumLimitDistance||h>document.documentElement.clientHeight-this.options.momentumLimitDistance)&&this.end(t)}}},ot.prototype.end=function(t){E[t.type]===this.initiated&&(this.setInitiated(),this.beforeHandler(t,"end"),this.hooks.trigger(this.hooks.eventTypes.end,t))},ot.prototype.click=function(t){this.hooks.trigger(this.hooks.eventTypes.click,t)},ot.prototype.destroy=function(){this.wrapperEventRegister.destroy(),this.targetEventRegister.destroy(),this.hooks.destroy()},ot);function ot(t,e){this.wrapper=t,this.options=e,this.hooks=new Z(["beforeStart","start","move","end","click"]),this.handleDOMEvents()}var it={x:["translateX","px"],y:["translateY","px"]},st=(nt.prototype.getComputedPosition=function(){var t=window.getComputedStyle(this.content,null)[S.transform].split(")")[0].split(", ");return{x:+(t[12]||t[4]),y:+(t[13]||t[5])}},nt.prototype.translate=function(s){var n=[];Object.keys(s).forEach(function(t){if(it[t]){var e=it[t][0];if(e){var o=it[t][1],i=s[t];n.push(e+"("+i+o+")")}}}),this.hooks.trigger(this.hooks.eventTypes.beforeTranslate,n,s),this.style[S.transform]=""+n.join(" "),this.hooks.trigger(this.hooks.eventTypes.translate,s)},nt.prototype.destroy=function(){this.hooks.destroy()},nt);function nt(t){this.content=t,this.style=t.style,this.hooks=new Z(["beforeTranslate","translate"])}var rt=(ht.prototype.translate=function(t){this.translater.translate(t)},ht.prototype.setPending=function(t){this.pending=t},ht.prototype.setForceStopped=function(t){this.forceStopped=t},ht.prototype.destroy=function(){this.hooks.destroy(),z(this.timer)},ht);function ht(t,e,o){this.content=t,this.translater=e,this.options=o,this.hooks=new Z(["move","end","beforeForceStop","forceStop","time","timeFunction"]),this.style=t.style}var at,ct=(e(lt,at=rt),lt.prototype.startProbe=function(){var e=this,o=function(){var t=e.translater.getComputedPosition();e.hooks.trigger(e.hooks.eventTypes.move,t),e.pending?e.timer=O(o):e.hooks.trigger(e.hooks.eventTypes.end,t)};z(this.timer),this.timer=O(o)},lt.prototype.transitionTime=function(t){void 0===t&&(t=0),this.style[S.transitionDuration]=t+"ms",this.hooks.trigger(this.hooks.eventTypes.time,t)},lt.prototype.transitionTimingFunction=function(t){this.style[S.transitionTimingFunction]=t,this.hooks.trigger(this.hooks.eventTypes.timeFunction,t)},lt.prototype.move=function(t,e,o,i,s){this.setPending(0<o&&(t.x!==e.x||t.y!==e.y)),this.transitionTimingFunction(i),this.transitionTime(o),this.translate(e),o&&this.options.probeType===q.Realtime&&this.startProbe(),o||(this._reflow=this.content.offsetHeight),o||s||(this.hooks.trigger(this.hooks.eventTypes.move,e),this.hooks.trigger(this.hooks.eventTypes.end,e))},lt.prototype.stop=function(){if(this.pending){this.setPending(!1),z(this.timer);var t=this.translater.getComputedPosition(),e=t.x,o=t.y;if(this.transitionTime(),this.translate({x:e,y:o}),this.setForceStopped(!0),this.hooks.trigger(this.hooks.eventTypes.beforeForceStop,{x:e,y:o}))return;this.hooks.trigger(this.hooks.eventTypes.forceStop,{x:e,y:o})}},lt);function lt(){return null!==at&&at.apply(this,arguments)||this}var pt,ut=(e(ft,pt=rt),ft.prototype.move=function(t,e,o,i,s){if(!o){if(this.translate(e),this._reflow=this.content.offsetHeight,s)return;return this.hooks.trigger(this.hooks.eventTypes.move,e),void this.hooks.trigger(this.hooks.eventTypes.end,e)}this.animate(t,e,o,i)},ft.prototype.animate=function(n,r,e,o){var h=this,a=p(),c=a+e,l=function(){var t=p();if(c<=t)return h.translate(r),h.hooks.trigger(h.hooks.eventTypes.move,r),void h.hooks.trigger(h.hooks.eventTypes.end,r);var i=o(t=(t-a)/e),s={};Object.keys(r).forEach(function(t){var e=n[t],o=r[t];s[t]=(o-e)*i+e}),h.translate(s),h.pending&&(h.timer=O(l)),h.options.probeType===q.Realtime&&h.hooks.trigger(h.hooks.eventTypes.move,s)};this.setPending(!0),z(this.timer),l()},ft.prototype.stop=function(){if(this.pending){this.setPending(!1),z(this.timer);var t=this.translater.getComputedPosition();if(this.setForceStopped(!0),this.hooks.trigger(this.hooks.eventTypes.beforeForceStop,t))return;this.hooks.trigger(this.hooks.eventTypes.forceStop,t)}},ft);function ft(){return null!==pt&&pt.apply(this,arguments)||this}var dt,vt,mt,yt,gt,kt,Tt=(bt.prototype.start=function(){this.direction=A.Default,this.movingDirection=A.Default,this.dist=0},bt.prototype.move=function(t){t=this.hasScroll?t:0,this.movingDirection=0<t?A.Negative:t<0?A.Positive:A.Default;var e=this.currentPos+t;return(e>this.minScrollPos||e<this.maxScrollPos)&&(e=e>this.minScrollPos&&this.options.bounces[0]||e<this.maxScrollPos&&this.options.bounces[1]?this.currentPos+t/3:e>this.minScrollPos?this.minScrollPos:this.maxScrollPos),e},bt.prototype.end=function(t){var e={duration:0},o=Math.abs(this.currentPos-this.startPos);if(this.options.momentum&&t<this.options.momentumLimitTime&&o>this.options.momentumLimitDistance){var i=this.direction===A.Negative&&this.options.bounces[0]||this.direction===A.Positive&&this.options.bounces[1]?this.wrapperSize:0;e=this.hasScroll?this.momentum(this.currentPos,this.startPos,t,this.maxScrollPos,this.minScrollPos,i,this.options):{destination:this.currentPos,duration:0}}else this.hooks.trigger(this.hooks.eventTypes.end,e);return e},bt.prototype.momentum=function(t,e,o,i,s,n,r){void 0===r&&(r=this.options);var h=t-e,a=Math.abs(h)/o,c=r.deceleration,l=r.swipeBounceTime,p={destination:t+a/c*(h<0?-1:1),duration:r.swipeTime,rate:15};return this.hooks.trigger(this.hooks.eventTypes.momentum,p,h),p.destination<i?(p.destination=n?Math.max(i-n/4,i-n/p.rate*a):i,p.duration=l):p.destination>s&&(p.destination=n?Math.min(s+n/4,s+n/p.rate*a):s,p.duration=l),p.destination=Math.round(p.destination),p},bt.prototype.updateDirection=function(){var t=Math.round(this.currentPos)-this.absStartPos;this.direction=0<t?A.Negative:t<0?A.Positive:A.Default},bt.prototype.refresh=function(){var t=this.options.rect,e=t.size,o=t.position,i="static"===window.getComputedStyle(this.wrapper,null).position,s=B(this.wrapper);this.wrapperSize=s[e];var n=B(this.content);this.contentSize=n[e],this.relativeOffset=n[o],i&&(this.relativeOffset-=s[o]),this.minScrollPos=0,this.maxScrollPos=this.wrapperSize-this.contentSize,this.maxScrollPos<0&&(this.maxScrollPos-=this.relativeOffset,this.minScrollPos=-this.relativeOffset),this.hasScroll=this.options.scrollable&&this.maxScrollPos<this.minScrollPos,this.hasScroll||(this.maxScrollPos=this.minScrollPos,this.contentSize=this.wrapperSize),this.direction=0},bt.prototype.updatePosition=function(t){this.currentPos=t},bt.prototype.getCurrentPos=function(){return Math.round(this.currentPos)},bt.prototype.checkInBoundary=function(){var t=this.adjustPosition(this.currentPos);return{position:t,inBoundary:t===this.getCurrentPos()}},bt.prototype.adjustPosition=function(t){var e=Math.round(t);return!this.hasScroll||e>this.minScrollPos?e=this.minScrollPos:e<this.maxScrollPos&&(e=this.maxScrollPos),e},bt.prototype.updateStartPos=function(){this.startPos=this.currentPos},bt.prototype.updateAbsStartPos=function(){this.absStartPos=this.currentPos},bt.prototype.resetStartPos=function(){this.updateStartPos(),this.updateAbsStartPos()},bt.prototype.getAbsDist=function(t){return this.dist+=t,Math.abs(this.dist)},bt.prototype.destroy=function(){this.hooks.destroy()},bt);function bt(t,e){this.wrapper=t,this.options=e,this.hooks=new Z(["momentum","end"]),this.content=this.wrapper.children[0],this.currentPos=0,this.startPos=0}(kt=gt||(gt={})).Yes="yes",kt.No="no";var Pt=((dt={})[gt.Yes]=function(t){return!0},dt[gt.No]=function(t){return t.preventDefault(),!1},dt),wt=((vt={})[N.Horizontal]=((mt={})[gt.Yes]=K.Horizontal,mt[gt.No]=K.Vertical,mt),vt[N.Vertical]=((yt={})[gt.Yes]=K.Vertical,yt[gt.No]=K.Horizontal,yt),vt),St=(Et.prototype.reset=function(){this.directionLocked=N.Default},Et.prototype.checkMovingDirection=function(t,e,o){return this.computeDirectionLock(t,e),this.handleEventPassthrough(o)},Et.prototype.adjustDelta=function(t,e){return this.directionLocked===N.Horizontal?e=0:this.directionLocked===N.Vertical&&(t=0),{deltaX:t,deltaY:e}},Et.prototype.computeDirectionLock=function(t,e){this.directionLocked!==N.Default||this.freeScroll||(t>e+this.directionLockThreshold?this.directionLocked=N.Horizontal:e>=t+this.directionLockThreshold?this.directionLocked=N.Vertical:this.directionLocked=N.None)},Et.prototype.handleEventPassthrough=function(t){var e=wt[this.directionLocked];if(e){if(this.eventPassthrough===e[gt.Yes])return Pt[gt.Yes](t);if(this.eventPassthrough===e[gt.No])return Pt[gt.No](t)}return!1},Et);function Et(t,e,o){this.directionLockThreshold=t,this.freeScroll=e,this.eventPassthrough=o,this.reset()}var Bt=(Dt.prototype.bindActionsHandler=function(){var s=this;this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.start,function(t){return!s.enabled||s.handleStart(t)}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.move,function(t){var e=t.deltaX,o=t.deltaY,i=t.e;return!s.enabled||s.handleMove(e,o,i)}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.end,function(t){return!s.enabled||s.handleEnd(t)}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.click,function(t){s.enabled&&!t._constructed&&s.handleClick(t)})},Dt.prototype.handleStart=function(t){var e=p();this.moved=!1,this.startTime=e,this.directionLockAction.reset(),this.scrollBehaviorX.start(),this.scrollBehaviorY.start(),this.animater.stop(),this.scrollBehaviorX.resetStartPos(),this.scrollBehaviorY.resetStartPos(),this.hooks.trigger(this.hooks.eventTypes.start,t)},Dt.prototype.handleMove=function(t,e,o){if(!this.hooks.trigger(this.hooks.eventTypes.beforeMove,o)){var i=this.scrollBehaviorX.getAbsDist(t),s=this.scrollBehaviorY.getAbsDist(e),n=p();if(this.checkMomentum(i,s,n))return!0;if(this.directionLockAction.checkMovingDirection(i,s,o))return this.actionsHandler.setInitiated(),!0;var r=this.directionLockAction.adjustDelta(t,e),h=this.scrollBehaviorX.move(r.deltaX),a=this.scrollBehaviorY.move(r.deltaY);this.moved||(this.moved=!0,this.hooks.trigger(this.hooks.eventTypes.scrollStart)),this.animater.translate({x:h,y:a}),this.dispatchScroll(n)}},Dt.prototype.dispatchScroll=function(t){t-this.startTime>this.options.momentumLimitTime&&(this.startTime=t,this.scrollBehaviorX.updateStartPos(),this.scrollBehaviorY.updateStartPos(),this.options.probeType===q.Throttle&&this.hooks.trigger(this.hooks.eventTypes.scroll,this.getCurrentPos())),this.options.probeType>q.Throttle&&this.hooks.trigger(this.hooks.eventTypes.scroll,this.getCurrentPos())},Dt.prototype.checkMomentum=function(t,e,o){return o-this.endTime>this.options.momentumLimitTime&&e<this.options.momentumLimitDistance&&t<this.options.momentumLimitDistance},Dt.prototype.handleEnd=function(t){if(!this.hooks.trigger(this.hooks.eventTypes.beforeEnd,t)){var e=this.getCurrentPos();if(this.scrollBehaviorX.updateDirection(),this.scrollBehaviorY.updateDirection(),this.hooks.trigger(this.hooks.eventTypes.end,t,e))return!0;this.animater.translate(e),this.endTime=p();var o=this.endTime-this.startTime;this.hooks.trigger(this.hooks.eventTypes.scrollEnd,e,o)}},Dt.prototype.handleClick=function(t){D(t.target,this.options.preventDefaultException)||(t.preventDefault(),t.stopPropagation())},Dt.prototype.getCurrentPos=function(){return{x:this.scrollBehaviorX.getCurrentPos(),y:this.scrollBehaviorY.getCurrentPos()}},Dt.prototype.refresh=function(){this.endTime=0},Dt.prototype.destroy=function(){this.hooks.destroy()},Dt);function Dt(t,e,o,i,s){this.hooks=new Z(["start","beforeMove","scrollStart","scroll","beforeEnd","end","scrollEnd"]),this.scrollBehaviorX=t,this.scrollBehaviorY=e,this.actionsHandler=o,this.animater=i,this.options=s,this.directionLockAction=new St(s.directionLockThreshold,s.freeScroll,s.eventPassthrough),this.enabled=!0,this.bindActionsHandler()}function Yt(o,t,e,i){var s=["momentum","momentumLimitTime","momentumLimitDistance","deceleration","swipeBounceTime","swipeTime"].reduce(function(t,e){return t[e]=o[e],t},{});return s.scrollable=o[t],s.bounces=e,s.rect=i,s}function Xt(i,s,t){t.forEach(function(t){var e,o;"string"==typeof t?e=o=t:(e=t.source,o=t.target),i.on(e,function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return s.trigger.apply(s,[o].concat(t))})})}var xt=(Lt.prototype.init=function(){var t=this;this.bindTranslater(),this.bindAnimater(),this.bindActions(),this.hooks.on(this.hooks.eventTypes.scrollEnd,function(){t.togglePointerEvents(!0)})},Lt.prototype.bindTranslater=function(){var e=this,t=this.translater.hooks;t.on(t.eventTypes.beforeTranslate,function(t){e.options.translateZ&&t.push(e.options.translateZ)}),t.on(t.eventTypes.translate,function(t){e.updatePositions(t),e.togglePointerEvents(!1)})},Lt.prototype.bindAnimater=function(){var e=this;this.animater.hooks.on(this.animater.hooks.eventTypes.end,function(t){e.resetPosition(e.options.bounceTime)||(e.animater.setPending(!1),e.hooks.trigger(e.hooks.eventTypes.scrollEnd,t))}),Xt(this.animater.hooks,this.hooks,[{source:this.animater.hooks.eventTypes.move,target:this.hooks.eventTypes.scroll},{source:this.animater.hooks.eventTypes.forceStop,target:this.hooks.eventTypes.scrollEnd}])},Lt.prototype.bindActions=function(){var s=this,o=this.actions;Xt(o.hooks,this.hooks,[{source:o.hooks.eventTypes.start,target:this.hooks.eventTypes.beforeStart},{source:o.hooks.eventTypes.start,target:this.hooks.eventTypes.beforeScrollStart},{source:o.hooks.eventTypes.beforeMove,target:this.hooks.eventTypes.beforeMove},{source:o.hooks.eventTypes.scrollStart,target:this.hooks.eventTypes.scrollStart},{source:o.hooks.eventTypes.scroll,target:this.hooks.eventTypes.scroll},{source:o.hooks.eventTypes.beforeEnd,target:this.hooks.eventTypes.beforeEnd}]),o.hooks.on(o.hooks.eventTypes.end,function(t,e){return s.hooks.trigger(s.hooks.eventTypes.touchEnd,e),!!s.hooks.trigger(s.hooks.eventTypes.end,e)||(!o.moved&&s.checkClick(t)?(s.animater.setForceStopped(!1),s.hooks.trigger(s.hooks.eventTypes.scrollCancel),!0):(s.animater.setForceStopped(!1),!!s.resetPosition(s.options.bounceTime,x.bounce)||void 0))}),o.hooks.on(o.hooks.eventTypes.scrollEnd,function(t,e){var o=Math.abs(t.x-s.scrollBehaviorX.startPos),i=Math.abs(t.y-s.scrollBehaviorY.startPos);s.checkFlick(e,o,i)?s.hooks.trigger(s.hooks.eventTypes.flick):s.momentum(t,e)||s.hooks.trigger(s.hooks.eventTypes.scrollEnd,t)})},Lt.prototype.checkFlick=function(t,e,o){if(1<this.hooks.events.flick.length&&t<this.options.flickLimitTime&&e<this.options.flickLimitDistance&&o<this.options.flickLimitDistance)return!0},Lt.prototype.momentum=function(t,e){var o={time:0,easing:x.swiper,newX:t.x,newY:t.y},i=this.scrollBehaviorX.end(e),s=this.scrollBehaviorY.end(e);if(o.newX=c(i.destination)?o.newX:i.destination,o.newY=c(s.destination)?o.newY:s.destination,o.time=Math.max(i.duration,s.duration),this.hooks.trigger(this.hooks.eventTypes.momentum,o,this),o.newX!==t.x||o.newY!==t.y)return(o.newX>this.scrollBehaviorX.minScrollPos||o.newX<this.scrollBehaviorX.maxScrollPos||o.newY>this.scrollBehaviorY.minScrollPos||o.newY<this.scrollBehaviorY.maxScrollPos)&&(o.easing=x.swipeBounce),this.scrollTo(o.newX,o.newY,o.time,o.easing),!0},Lt.prototype.checkClick=function(t){var e=this.animater.forceStopped;if(this.hooks.trigger(this.hooks.eventTypes.checkClick))return!0;if(e)return!1;var o=this.options.dblclick,i=!1;if(o&&this.lastClickTime){var s=o.delay,n=void 0===s?300:s;p()-this.lastClickTime<n&&(i=!0,function(t){X(t,"dblclick")}(t))}return this.options.tap&&function(t,e){var o=document.createEvent("Event");o.initEvent(e,!0,!0),o.pageX=t.pageX,o.pageY=t.pageY,t.target.dispatchEvent(o)}(t,this.options.tap),this.options.click&&!D(t.target,this.options.preventDefaultException)&&X(t),this.lastClickTime=i?null:p(),!0},Lt.prototype.resize=function(){var t=this;this.actions.enabled&&(h&&(this.wrapper.scrollTop=0),clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(function(){t.refresh()},this.options.resizePolling))},Lt.prototype.transitionEnd=function(t){t.target===this.content&&this.animater.pending&&(this.animater.transitionTime(),this.resetPosition(this.options.bounceTime,x.bounce)||(this.animater.setPending(!1),this.options.probeType!==q.Realtime&&this.hooks.trigger(this.hooks.eventTypes.scrollEnd,this.getCurrentPos())))},Lt.prototype.togglePointerEvents=function(t){void 0===t&&(t=!0);for(var e=this.content.children.length?this.content.children:[this.content],o=t?"auto":"none",i=0;i<e.length;i++){var s=e[i];s.isBScroll||(s.style.pointerEvents=o)}},Lt.prototype.refresh=function(){this.scrollBehaviorX.refresh(),this.scrollBehaviorY.refresh(),this.actions.refresh(),this.wrapperOffset=g(this.wrapper)},Lt.prototype.scrollBy=function(t,e,o,i){void 0===o&&(o=0);var s=this.getCurrentPos(),n=s.x,r=s.y;i=i||x.bounce,t+=n,e+=r,this.scrollTo(t,e,o,i)},Lt.prototype.scrollTo=function(t,e,o,i,s,n){void 0===o&&(o=0),void 0===s&&(s={start:{},end:{}}),i=i||x.bounce;var r=this.options.useTransition?i.style:i.fn,h=this.getCurrentPos(),a=l({x:h.x,y:h.y},s.start),c=l({x:t,y:e},s.end);this.hooks.trigger(this.hooks.eventTypes.scrollTo,c),!this.hooks.trigger(this.hooks.eventTypes.ignoreDisMoveForSamePos)&&a.x===c.x&&a.y===c.y||this.animater.move(a,c,o,r,n)},Lt.prototype.scrollToElement=function(t,e,o,i,s){function n(t,e,o){return"number"==typeof t?t:t?Math.round(e/2-o/2):0}var r=v(t),h=g(r);function a(t,e,o,i){return t-=e,t=i.adjustPosition(t-o)}o=n(o,r.offsetWidth,this.wrapper.offsetWidth),i=n(i,r.offsetHeight,this.wrapper.offsetHeight),h.left=a(h.left,this.wrapperOffset.left,o,this.scrollBehaviorX),h.top=a(h.top,this.wrapperOffset.top,i,this.scrollBehaviorY),this.hooks.trigger(this.hooks.eventTypes.scrollToElement,r,h)||this.scrollTo(h.left,h.top,e,s)},Lt.prototype.resetPosition=function(t,e){void 0===t&&(t=0),e=e||x.bounce;var o=this.scrollBehaviorX.checkInBoundary(),i=o.position,s=o.inBoundary,n=this.scrollBehaviorY.checkInBoundary(),r=n.position,h=n.inBoundary;return!(s&&h||(this.scrollTo(i,r,t,e),0))},Lt.prototype.updatePositions=function(t){this.scrollBehaviorX.updatePosition(t.x),this.scrollBehaviorY.updatePosition(t.y)},Lt.prototype.getCurrentPos=function(){return this.actions.getCurrentPos()},Lt.prototype.enable=function(){this.actions.enabled=!0},Lt.prototype.disable=function(){z(this.animater.timer),this.actions.enabled=!1},Lt.prototype.destroy=function(){var e=this;["resizeRegister","transitionEndRegister","actionsHandler","actions","hooks","animater","translater","scrollBehaviorX","scrollBehaviorY"].forEach(function(t){return e[t].destroy()})},Lt);function Lt(t,e){this.hooks=new Z(["beforeStart","beforeMove","beforeScrollStart","scrollStart","scroll","beforeEnd","scrollEnd","refresh","touchEnd","end","flick","scrollCancel","momentum","scrollTo","ignoreDisMoveForSamePos","scrollToElement"]),this.wrapper=t,this.content=t.children[0],this.options=e;var o=this.options.bounce,i=o.left,s=void 0===i||i,n=o.right,r=void 0===n||n,h=o.top,a=void 0===h||h,c=o.bottom,l=void 0===c||c;this.scrollBehaviorX=new Tt(t,Yt(e,"scrollX",[s,r],{size:"width",position:"left"})),this.scrollBehaviorY=new Tt(t,Yt(e,"scrollY",[a,l],{size:"height",position:"top"})),this.translater=new st(this.content),this.animater=function(t,e,o){var i=o.useTransition,s={};return Object.defineProperty(s,"probeType",{enumerable:!0,configurable:!1,get:function(){return o.probeType}}),i?new ct(t,e,s):new ut(t,e,s)}(this.content,this.translater,this.options),this.actionsHandler=new et(t,function(o){return["click","bindToWrapper","disableMouse","disableTouch","preventDefault","stopPropagation","tagException","preventDefaultException"].reduce(function(t,e){return t[e]=o[e],t},{})}(this.options)),this.actions=new Bt(this.scrollBehaviorX,this.scrollBehaviorY,this.actionsHandler,this.animater,this.options);var p=this.resize.bind(this);this.resizeRegister=new Q(window,[{name:"orientationchange",handler:p},{name:"resize",handler:p}]),this.transitionEndRegister=new Q(this.content,[{name:S.transitionEnd,handler:this.transitionEnd.bind(this)}]),this.init()}var Mt,Ct,Ot=[{sourceKey:"scroller.scrollBehaviorX.currentPos",key:"x"},{sourceKey:"scroller.scrollBehaviorY.currentPos",key:"y"},{sourceKey:"scroller.scrollBehaviorX.hasScroll",key:"hasHorizontalScroll"},{sourceKey:"scroller.scrollBehaviorY.hasScroll",key:"hasVerticalScroll"},{sourceKey:"scroller.scrollBehaviorX.contentSize",key:"scrollerWidth"},{sourceKey:"scroller.scrollBehaviorY.contentSize",key:"scrollerHeight"},{sourceKey:"scroller.scrollBehaviorX.maxScrollPos",key:"maxScrollX"},{sourceKey:"scroller.scrollBehaviorY.maxScrollPos",key:"maxScrollY"},{sourceKey:"scroller.scrollBehaviorX.minScrollPos",key:"minScrollX"},{sourceKey:"scroller.scrollBehaviorY.minScrollPos",key:"minScrollY"},{sourceKey:"scroller.scrollBehaviorX.movingDirection",key:"movingDirectionX"},{sourceKey:"scroller.scrollBehaviorY.movingDirection",key:"movingDirectionY"},{sourceKey:"scroller.scrollBehaviorX.direction",key:"directionX"},{sourceKey:"scroller.scrollBehaviorY.direction",key:"directionY"},{sourceKey:"scroller.actions.enabled",key:"enabled"},{sourceKey:"scroller.animater.pending",key:"pending"},{sourceKey:"scroller.animater.stop",key:"stop"},{sourceKey:"scroller.scrollTo",key:"scrollTo"},{sourceKey:"scroller.scrollBy",key:"scrollBy"},{sourceKey:"scroller.scrollToElement",key:"scrollToElement"},{sourceKey:"scroller.resetPosition",key:"resetPosition"}];(Ct=Mt||(Mt={})).Pre="pre",Ct.Post="post";var zt,Ht=(e(At,zt=Z),At.use=function(e){var t=e.pluginName;return this.plugins.some(function(t){return e===t.ctor})||(c(t)?s("Plugin Class must specify plugin's name in static property by 'pluginName' field."):this.pluginsMap[t]?s("This plugin has been registered, maybe you need change plugin's name"):(this.pluginsMap[t]=!0,this.plugins.push({name:t,enforce:e.enforce,ctor:e}))),this},At.prototype.init=function(t){(this.wrapper=t).isBScroll=!0,this.scroller=new xt(t,this.options),this.eventBubbling(),this.handleAutoBlur(),this.innerRefresh(),this.scroller.scrollTo(this.options.startX,this.options.startY),this.enable(),this.proxy(Ot),this.applyPlugins()},At.prototype.applyPlugins=function(){var o=this,i=this.options;this.constructor.plugins.sort(function(t,e){var o,i=((o={})[Mt.Pre]=-1,o[Mt.Post]=1,o);return(t.enforce?i[t.enforce]:0)-(e.enforce?i[e.enforce]:0)}).forEach(function(t){var e=t.ctor;i[t.name]&&"function"==typeof e&&(o.plugins[t.name]=new e(o))})},At.prototype.handleAutoBlur=function(){this.options.autoBlur&&this.on(this.eventTypes.beforeScrollStart,function(){var t=document.activeElement;!t||"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName||t.blur()})},At.prototype.eventBubbling=function(){Xt(this.scroller.hooks,this,["beforeScrollStart","scrollStart","scroll","scrollEnd","scrollCancel","touchEnd","flick"])},At.prototype.innerRefresh=function(){this.scroller.refresh(),this.hooks.trigger(this.hooks.eventTypes.refresh),this.trigger(this.eventTypes.refresh)},At.prototype.proxy=function(t){var i=this;t.forEach(function(t){var e=t.key,o=t.sourceKey;!function(t,e,o){H.get=function(){return function(t,e){for(var o=e.split("."),i=0;i<o.length-1;i++)if("object"!=typeof(t=t[o[i]])||!t)return;var s=o.pop();return"function"==typeof t[s]?function(){return t[s].apply(t,arguments)}:t[s]}(this,e)},H.set=function(t){!function(t,e,o){for(var i,s=e.split("."),n=0;n<s.length-1;n++)t[i=s[n]]||(t[i]={}),t=t[i];t[s.pop()]=o}(this,e,t)},Object.defineProperty(t,o,H)}(i,o,e)})},At.prototype.refresh=function(){this.innerRefresh(),this.scroller.resetPosition()},At.prototype.enable=function(){this.scroller.enable(),this.hooks.trigger(this.hooks.eventTypes.enable),this.trigger(this.eventTypes.enable)},At.prototype.disable=function(){this.scroller.disable(),this.hooks.trigger(this.hooks.eventTypes.disable),this.trigger(this.eventTypes.disable)},At.prototype.destroy=function(){this.hooks.trigger(this.hooks.eventTypes.destroy),this.trigger(this.eventTypes.destroy),this.scroller.destroy()},At.prototype.eventRegister=function(t){this.registerType(t)},At.plugins=[],At.pluginsMap={},At);function At(t,e){var o=zt.call(this,["refresh","enable","disable","beforeScrollStart","scrollStart","scroll","scrollEnd","scrollCancel","touchEnd","flick","destroy"])||this,i=v(t);return i?i.children[0]?(o.plugins={},o.options=(new G).merge(e).process(),o.hooks=new Z(["init","refresh","enable","disable","destroy"]),o.init(i)):s("The wrapper need at least one child element to be scroller."):s("Can not resolve the wrapper DOM."),o}t.Options=G,t.default=Ht,Object.defineProperty(t,"__esModule",{value:!0})}),"undefined"!=typeof window&&window.BScroll&&(window.BScroll=window.BScroll.default);
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t=t||self).BScroll={})}(this,function(t){"use strict";var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var o in e)e.hasOwnProperty(o)&&(t[o]=e[o])})(t,e)};function e(t,e){function o(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(o.prototype=e.prototype,new o)}var l=function(){return(l=Object.assign||function(t){for(var e,o=1,i=arguments.length;o<i;o++)for(var s in e=arguments[o])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t}).apply(this,arguments)};function s(t){console.error("[BScroll warn]: "+t)}var o="undefined"!=typeof window,n=o&&navigator.userAgent.toLowerCase(),r=n&&/wechatdevtools/.test(n),h=n&&0<n.indexOf("android");function p(){return window.performance&&window.performance.now&&window.performance.timing?window.performance.now()+window.performance.timing.navigationStart:+new Date}function a(t){for(var e=[],o=1;o<arguments.length;o++)e[o-1]=arguments[o];for(var i=0;i<e.length;i++){var s=e[i];for(var n in s)t[n]=s[n]}return t}function c(t){return null==t}var u=o&&document.createElement("div").style,f=function(){if(!o)return!1;var t={webkit:"webkitTransform",Moz:"MozTransform",O:"OTransform",ms:"msTransform",standard:"transform"};for(var e in t)if(void 0!==u[t[e]])return e;return!1}();function d(t){return!1===f?t:"standard"===f?"transitionEnd"===t?"transitionend":t:f+t.charAt(0).toUpperCase()+t.substr(1)}function v(t){return"string"==typeof t?document.querySelector(t):t}function m(t,e,o,i){t.addEventListener(e,o,{passive:!1,capture:!!i})}function y(t,e,o,i){t.removeEventListener(e,o,{capture:!!i})}function g(t){for(var e=0,o=0;t;)e-=t.offsetLeft,o-=t.offsetTop,t=t.offsetParent;return{left:e,top:o}}f&&"standard"!==f&&f.toLowerCase();var k=d("transform"),T=d("transition"),b=o&&d("perspective")in u,w=o&&("ontouchstart"in window||r),P=o&&T in u,S={transform:k,transition:T,transitionTimingFunction:d("transitionTimingFunction"),transitionDuration:d("transitionDuration"),transitionDelay:d("transitionDelay"),transformOrigin:d("transformOrigin"),transitionEnd:d("transitionEnd")},E={touchstart:1,touchmove:1,touchend:1,mousedown:2,mousemove:2,mouseup:2};function B(t){if(t instanceof window.SVGElement){var e=t.getBoundingClientRect();return{top:e.top,left:e.left,width:e.width,height:e.height}}return{top:t.offsetTop,left:t.offsetLeft,width:t.offsetWidth,height:t.offsetHeight}}function X(t,e){for(var o in e)if(e[o].test(t[o]))return!0;return!1}var Y=X;function D(t,e){var o;void 0===e&&(e="click"),"mouseup"===t.type?o=t:"touchend"!==t.type&&"touchcancel"!==t.type||(o=t.changedTouches[0]);var i,s={};o&&(s.screenX=o.screenX||0,s.screenY=o.screenY||0,s.clientX=o.clientX||0,s.clientY=o.clientY||0);var n=!0,r=!0;if("undefined"!=typeof MouseEvent)try{i=new MouseEvent(e,a({bubbles:n,cancelable:r},s))}catch(t){h()}else h();function h(){(i=document.createEvent("Event")).initEvent(e,n,r),a(i,s)}i.forwardedTouchEvent=!0,i._constructed=!0,t.target.dispatchEvent(i)}var x={swipe:{style:"cubic-bezier(0.23, 1, 0.32, 1)",fn:function(t){return 1+--t*t*t*t*t}},swipeBounce:{style:"cubic-bezier(0.25, 0.46, 0.45, 0.94)",fn:function(t){return t*(2-t)}},bounce:{style:"cubic-bezier(0.165, 0.84, 0.44, 1)",fn:function(t){return 1- --t*t*t*t}}},L=o&&window;function M(){}function O(t){}var C=o?L.requestAnimationFrame||L.webkitRequestAnimationFrame||L.mozRequestAnimationFrame||L.oRequestAnimationFrame||function(t){return window.setTimeout(t,(t.interval||100/60)/2)}:M,z=o?L.cancelAnimationFrame||L.webkitCancelAnimationFrame||L.mozCancelAnimationFrame||L.oCancelAnimationFrame||function(t){window.clearTimeout(t)}:M,A={enumerable:!0,configurable:!0,get:O,set:O};var H=(F.prototype.on=function(t,e,o){return void 0===o&&(o=this),this.hasType(t),this.events[t]||(this.events[t]=[]),this.events[t].push([e,o]),this},F.prototype.once=function(o,i,s){var n=this;void 0===s&&(s=this),this.hasType(o);var r=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];n.off(o,r),i.apply(s,t)};return r.fn=i,this.on(o,r),this},F.prototype.off=function(t,e){if(!t&&!e)return this.events={},this;if(t){if(this.hasType(t),!e)return this.events[t]=[],this;var o=this.events[t];if(!o)return this;for(var i=o.length;i--;)(o[i][0]===e||o[i][0]&&o[i][0].fn===e)&&o.splice(i,1);return this}},F.prototype.trigger=function(t){for(var e=[],o=1;o<arguments.length;o++)e[o-1]=arguments[o];this.hasType(t);var i=this.events[t];if(i)for(var s,n=i.length,r=i.slice(),h=0;h<n;h++){var a=r[h],c=a[0],l=a[1];if(c&&!0===(s=c.apply(l,e)))return s}},F.prototype.registerType=function(t){var e=this;t.forEach(function(t){e.eventTypes[t]=t})},F.prototype.destroy=function(){this.events={},this.eventTypes={}},F.prototype.hasType=function(t){var e=this.eventTypes;e[t]===t||s('EventEmitter has used unknown event type: "'+t+'", should be oneof ['+Object.keys(e).map(function(t){return JSON.stringify(t)})+"]")},F);function F(t){this.events={},this.eventTypes={},this.registerType(t)}var K=(R.prototype.destroy=function(){this.removeDOMEvents(),this.events=[]},R.prototype.addDOMEvents=function(){this.handleDOMEvents(m)},R.prototype.removeDOMEvents=function(){this.handleDOMEvents(y)},R.prototype.handleDOMEvents=function(e){var o=this,i=this.wrapper;this.events.forEach(function(t){e(i,t.name,o,!!t.capture)})},R.prototype.handleEvent=function(e){var o=e.type;this.events.some(function(t){return t.name===o&&(t.handler(e),!0)})},R);function R(t,e){this.wrapper=t,this.events=e,this.addDOMEvents()}var j=(_.prototype.merge=function(t){if(!t)return this;for(var e in t)this[e]=t[e];return this},_.prototype.process=function(){return this.translateZ=this.HWCompositing&&b?" translateZ(0)":"",this.useTransition=this.useTransition&&P,this.preventDefault=!this.eventPassthrough&&this.preventDefault,this.resolveBounce(),this.scrollX="horizontal"!==this.eventPassthrough&&this.scrollX,this.scrollY="vertical"!==this.eventPassthrough&&this.scrollY,this.freeScroll=this.freeScroll&&!this.eventPassthrough,this.scrollX=!!this.freeScroll||this.scrollX,this.scrollY=!!this.freeScroll||this.scrollY,this.directionLockThreshold=this.eventPassthrough?0:this.directionLockThreshold,this},_.prototype.resolveBounce=function(){var t=this.bounce;!1!==t&&!0!==t||(this.bounce=function(t,e){void 0===e&&(e=!0);var o={};return t.forEach(function(t){o[t]=e}),o}(["top","right","bottom","left"],t))},_);function _(){this.startX=0,this.startY=0,this.scrollX=!1,this.scrollY=!0,this.freeScroll=!1,this.directionLockThreshold=5,this.eventPassthrough="",this.click=!1,this.dblclick=!1,this.tap="",this.bounce={top:!0,bottom:!0,left:!0,right:!0},this.bounceTime=800,this.momentum=!0,this.momentumLimitTime=300,this.momentumLimitDistance=15,this.swipeTime=2500,this.swipeBounceTime=500,this.deceleration=.0015,this.flickLimitTime=200,this.flickLimitDistance=100,this.resizePolling=60,this.probeType=0,this.stopPropagation=!1,this.preventDefault=!0,this.preventDefaultException={tagName:/^(INPUT|TEXTAREA|BUTTON|SELECT|AUDIO)$/},this.tagException={tagName:/^TEXTAREA$/},this.HWCompositing=!0,this.useTransition=!0,this.bindToWrapper=!1,this.disableMouse=w,this.disableTouch=!w,this.autoBlur=!0}var I=(N.prototype.handleDOMEvents=function(){var t=this.options,e=t.bindToWrapper,o=t.disableMouse,i=t.disableTouch,s=t.click,n=this.wrapper,r=e?n:window,h=[],a=[],c=w&&!i,l=!o;s&&h.push({name:"click",handler:this.click.bind(this),capture:!0}),c&&(h.push({name:"touchstart",handler:this.start.bind(this)}),a.push({name:"touchmove",handler:this.move.bind(this)},{name:"touchend",handler:this.end.bind(this)},{name:"touchcancel",handler:this.end.bind(this)})),l&&(h.push({name:"mousedown",handler:this.start.bind(this)}),a.push({name:"mousemove",handler:this.move.bind(this)},{name:"mouseup",handler:this.end.bind(this)})),this.wrapperEventRegister=new K(n,h),this.targetEventRegister=new K(r,a)},N.prototype.beforeHandler=function(t,e){var o=this.options,i=o.preventDefault,s=o.stopPropagation,n=o.preventDefaultException;!{start:function(){return i&&!X(t.target,n)},end:function(){return i&&!X(t.target,n)},move:function(){return i}}[e]()||t.preventDefault(),s&&t.stopPropagation()},N.prototype.setInitiated=function(t){void 0===t&&(t=0),this.initiated=t},N.prototype.start=function(t){var e=E[t.type];if(!this.initiated||this.initiated===e)if(this.setInitiated(e),Y(t.target,this.options.tagException))this.setInitiated();else if((2!==e||0===t.button)&&!this.hooks.trigger(this.hooks.eventTypes.beforeStart,t)){this.beforeHandler(t,"start");var o=t.touches?t.touches[0]:t;this.pointX=o.pageX,this.pointY=o.pageY,this.hooks.trigger(this.hooks.eventTypes.start,t)}},N.prototype.move=function(t){if(E[t.type]===this.initiated){this.beforeHandler(t,"move");var e=t.touches?t.touches[0]:t,o=e.pageX-this.pointX,i=e.pageY-this.pointY;if(this.pointX=e.pageX,this.pointY=e.pageY,!this.hooks.trigger(this.hooks.eventTypes.move,{deltaX:o,deltaY:i,e:t})){var s=document.documentElement.scrollLeft||window.pageXOffset||document.body.scrollLeft,n=document.documentElement.scrollTop||window.pageYOffset||document.body.scrollTop,r=this.pointX-s,h=this.pointY-n;(r>document.documentElement.clientWidth-this.options.momentumLimitDistance||r<this.options.momentumLimitDistance||h<this.options.momentumLimitDistance||h>document.documentElement.clientHeight-this.options.momentumLimitDistance)&&this.end(t)}}},N.prototype.end=function(t){E[t.type]===this.initiated&&(this.setInitiated(),this.beforeHandler(t,"end"),this.hooks.trigger(this.hooks.eventTypes.end,t))},N.prototype.click=function(t){this.hooks.trigger(this.hooks.eventTypes.click,t)},N.prototype.destroy=function(){this.wrapperEventRegister.destroy(),this.targetEventRegister.destroy(),this.hooks.destroy()},N);function N(t,e){this.wrapper=t,this.options=e,this.hooks=new H(["beforeStart","start","move","end","click"]),this.handleDOMEvents()}var W={x:["translateX","px"],y:["translateY","px"]},q=(U.prototype.getComputedPosition=function(){var t=window.getComputedStyle(this.content,null)[S.transform].split(")")[0].split(", ");return{x:+(t[12]||t[4]),y:+(t[13]||t[5])}},U.prototype.translate=function(s){var n=[];Object.keys(s).forEach(function(t){if(W[t]){var e=W[t][0];if(e){var o=W[t][1],i=s[t];n.push(e+"("+i+o+")")}}}),this.hooks.trigger(this.hooks.eventTypes.beforeTranslate,n,s),this.style[S.transform]=n.join(" "),this.hooks.trigger(this.hooks.eventTypes.translate,s)},U.prototype.destroy=function(){this.hooks.destroy()},U);function U(t){this.content=t,this.style=t.style,this.hooks=new H(["beforeTranslate","translate"])}var Z=(V.prototype.translate=function(t){this.translater.translate(t)},V.prototype.setPending=function(t){this.pending=t},V.prototype.setForceStopped=function(t){this.forceStopped=t},V.prototype.destroy=function(){this.hooks.destroy(),z(this.timer)},V);function V(t,e,o){this.content=t,this.translater=e,this.options=o,this.hooks=new H(["move","end","beforeForceStop","forceStop","time","timeFunction"]),this.style=t.style}var $,G=(e(J,$=Z),J.prototype.startProbe=function(){var e=this,o=function(){var t=e.translater.getComputedPosition();e.hooks.trigger(e.hooks.eventTypes.move,t),e.pending?e.timer=C(o):e.hooks.trigger(e.hooks.eventTypes.end,t)};z(this.timer),this.timer=C(o)},J.prototype.transitionTime=function(t){void 0===t&&(t=0),this.style[S.transitionDuration]=t+"ms",this.hooks.trigger(this.hooks.eventTypes.time,t)},J.prototype.transitionTimingFunction=function(t){this.style[S.transitionTimingFunction]=t,this.hooks.trigger(this.hooks.eventTypes.timeFunction,t)},J.prototype.move=function(t,e,o,i,s){this.setPending(0<o&&(t.x!==e.x||t.y!==e.y)),this.transitionTimingFunction(i),this.transitionTime(o),this.translate(e),o&&3===this.options.probeType&&this.startProbe(),o||(this._reflow=this.content.offsetHeight),o||s||(this.hooks.trigger(this.hooks.eventTypes.move,e),this.hooks.trigger(this.hooks.eventTypes.end,e))},J.prototype.stop=function(){if(this.pending){this.setPending(!1),z(this.timer);var t=this.translater.getComputedPosition(),e=t.x,o=t.y;if(this.transitionTime(),this.translate({x:e,y:o}),this.setForceStopped(!0),this.hooks.trigger(this.hooks.eventTypes.beforeForceStop,{x:e,y:o}))return;this.hooks.trigger(this.hooks.eventTypes.forceStop,{x:e,y:o})}},J);function J(){return null!==$&&$.apply(this,arguments)||this}var Q,tt=(e(et,Q=Z),et.prototype.move=function(t,e,o,i,s){if(!o){if(this.translate(e),this._reflow=this.content.offsetHeight,s)return;return this.hooks.trigger(this.hooks.eventTypes.move,e),void this.hooks.trigger(this.hooks.eventTypes.end,e)}this.animate(t,e,o,i)},et.prototype.animate=function(n,r,e,o){var h=this,a=p(),c=a+e,l=function(){var t=p();if(c<=t)return h.translate(r),h.hooks.trigger(h.hooks.eventTypes.move,r),void h.hooks.trigger(h.hooks.eventTypes.end,r);var i=o(t=(t-a)/e),s={};Object.keys(r).forEach(function(t){var e=n[t],o=r[t];s[t]=(o-e)*i+e}),h.translate(s),h.pending&&(h.timer=C(l)),3===h.options.probeType&&h.hooks.trigger(h.hooks.eventTypes.move,s)};this.setPending(!0),z(this.timer),l()},et.prototype.stop=function(){if(this.pending){this.setPending(!1),z(this.timer);var t=this.translater.getComputedPosition();if(this.setForceStopped(!0),this.hooks.trigger(this.hooks.eventTypes.beforeForceStop,t))return;this.hooks.trigger(this.hooks.eventTypes.forceStop,t)}},et);function et(){return null!==Q&&Q.apply(this,arguments)||this}var ot,it,st,nt,rt=(ht.prototype.start=function(){this.direction=0,this.movingDirection=0,this.dist=0},ht.prototype.move=function(t){t=this.hasScroll?t:0,this.movingDirection=0<t?-1:t<0?1:0;var e=this.currentPos+t;return(e>this.minScrollPos||e<this.maxScrollPos)&&(e=e>this.minScrollPos&&this.options.bounces[0]||e<this.maxScrollPos&&this.options.bounces[1]?this.currentPos+t/3:e>this.minScrollPos?this.minScrollPos:this.maxScrollPos),e},ht.prototype.end=function(t){var e={duration:0},o=Math.abs(this.currentPos-this.startPos);if(this.options.momentum&&t<this.options.momentumLimitTime&&o>this.options.momentumLimitDistance){var i=-1===this.direction&&this.options.bounces[0]||1===this.direction&&this.options.bounces[1]?this.wrapperSize:0;e=this.hasScroll?this.momentum(this.currentPos,this.startPos,t,this.maxScrollPos,this.minScrollPos,i,this.options):{destination:this.currentPos,duration:0}}else this.hooks.trigger(this.hooks.eventTypes.end,e);return e},ht.prototype.momentum=function(t,e,o,i,s,n,r){void 0===r&&(r=this.options);var h=t-e,a=Math.abs(h)/o,c=r.deceleration,l=r.swipeBounceTime,p={destination:t+a/c*(h<0?-1:1),duration:r.swipeTime,rate:15};return this.hooks.trigger(this.hooks.eventTypes.momentum,p,h),p.destination<i?(p.destination=n?Math.max(i-n/4,i-n/p.rate*a):i,p.duration=l):p.destination>s&&(p.destination=n?Math.min(s+n/4,s+n/p.rate*a):s,p.duration=l),p.destination=Math.round(p.destination),p},ht.prototype.updateDirection=function(){var t=Math.round(this.currentPos)-this.absStartPos;this.direction=0<t?-1:t<0?1:0},ht.prototype.refresh=function(){var t=this.options.rect,e=t.size,o=t.position,i="static"===window.getComputedStyle(this.wrapper,null).position,s=B(this.wrapper);this.wrapperSize=s[e];var n=B(this.content);this.contentSize=n[e],this.relativeOffset=n[o],i&&(this.relativeOffset-=s[o]),this.minScrollPos=0,this.maxScrollPos=this.wrapperSize-this.contentSize,this.maxScrollPos<0&&(this.maxScrollPos-=this.relativeOffset,this.minScrollPos=-this.relativeOffset),this.hasScroll=this.options.scrollable&&this.maxScrollPos<this.minScrollPos,this.hasScroll||(this.maxScrollPos=this.minScrollPos,this.contentSize=this.wrapperSize),this.direction=0},ht.prototype.updatePosition=function(t){this.currentPos=t},ht.prototype.getCurrentPos=function(){return Math.round(this.currentPos)},ht.prototype.checkInBoundary=function(){var t=this.adjustPosition(this.currentPos);return{position:t,inBoundary:t===this.getCurrentPos()}},ht.prototype.adjustPosition=function(t){var e=Math.round(t);return!this.hasScroll||e>this.minScrollPos?e=this.minScrollPos:e<this.maxScrollPos&&(e=this.maxScrollPos),e},ht.prototype.updateStartPos=function(){this.startPos=this.currentPos},ht.prototype.updateAbsStartPos=function(){this.absStartPos=this.currentPos},ht.prototype.resetStartPos=function(){this.updateStartPos(),this.updateAbsStartPos()},ht.prototype.getAbsDist=function(t){return this.dist+=t,Math.abs(this.dist)},ht.prototype.destroy=function(){this.hooks.destroy()},ht);function ht(t,e){this.wrapper=t,this.options=e,this.hooks=new H(["momentum","end"]),this.content=this.wrapper.children[0],this.currentPos=0,this.startPos=0}var at=((ot={}).yes=function(t){return!0},ot.no=function(t){return t.preventDefault(),!1},ot),ct=((it={}).horizontal=((st={}).yes="horizontal",st.no="vertical",st),it.vertical=((nt={}).yes="vertical",nt.no="horizontal",nt),it),lt=(pt.prototype.reset=function(){this.directionLocked=""},pt.prototype.checkMovingDirection=function(t,e,o){return this.computeDirectionLock(t,e),this.handleEventPassthrough(o)},pt.prototype.adjustDelta=function(t,e){return"horizontal"===this.directionLocked?e=0:"vertical"===this.directionLocked&&(t=0),{deltaX:t,deltaY:e}},pt.prototype.computeDirectionLock=function(t,e){""!==this.directionLocked||this.freeScroll||(t>e+this.directionLockThreshold?this.directionLocked="horizontal":e>=t+this.directionLockThreshold?this.directionLocked="vertical":this.directionLocked="none")},pt.prototype.handleEventPassthrough=function(t){var e=ct[this.directionLocked];if(e){if(this.eventPassthrough===e.yes)return at.yes(t);if(this.eventPassthrough===e.no)return at.no(t)}return!1},pt);function pt(t,e,o){this.directionLockThreshold=t,this.freeScroll=e,this.eventPassthrough=o,this.reset()}var ut=(ft.prototype.bindActionsHandler=function(){var s=this;this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.start,function(t){return!s.enabled||s.handleStart(t)}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.move,function(t){var e=t.deltaX,o=t.deltaY,i=t.e;return!s.enabled||s.handleMove(e,o,i)}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.end,function(t){return!s.enabled||s.handleEnd(t)}),this.actionsHandler.hooks.on(this.actionsHandler.hooks.eventTypes.click,function(t){s.enabled&&!t._constructed&&s.handleClick(t)})},ft.prototype.handleStart=function(t){var e=p();this.moved=!1,this.startTime=e,this.directionLockAction.reset(),this.scrollBehaviorX.start(),this.scrollBehaviorY.start(),this.animater.stop(),this.scrollBehaviorX.resetStartPos(),this.scrollBehaviorY.resetStartPos(),this.hooks.trigger(this.hooks.eventTypes.start,t)},ft.prototype.handleMove=function(t,e,o){if(!this.hooks.trigger(this.hooks.eventTypes.beforeMove,o)){var i=this.scrollBehaviorX.getAbsDist(t),s=this.scrollBehaviorY.getAbsDist(e),n=p();if(this.checkMomentum(i,s,n))return!0;if(this.directionLockAction.checkMovingDirection(i,s,o))return this.actionsHandler.setInitiated(),!0;var r=this.directionLockAction.adjustDelta(t,e),h=this.scrollBehaviorX.move(r.deltaX),a=this.scrollBehaviorY.move(r.deltaY);this.moved||(this.moved=!0,this.hooks.trigger(this.hooks.eventTypes.scrollStart)),this.animater.translate({x:h,y:a}),this.dispatchScroll(n)}},ft.prototype.dispatchScroll=function(t){t-this.startTime>this.options.momentumLimitTime&&(this.startTime=t,this.scrollBehaviorX.updateStartPos(),this.scrollBehaviorY.updateStartPos(),1===this.options.probeType&&this.hooks.trigger(this.hooks.eventTypes.scroll,this.getCurrentPos())),1<this.options.probeType&&this.hooks.trigger(this.hooks.eventTypes.scroll,this.getCurrentPos())},ft.prototype.checkMomentum=function(t,e,o){return o-this.endTime>this.options.momentumLimitTime&&e<this.options.momentumLimitDistance&&t<this.options.momentumLimitDistance},ft.prototype.handleEnd=function(t){if(!this.hooks.trigger(this.hooks.eventTypes.beforeEnd,t)){var e=this.getCurrentPos();if(this.scrollBehaviorX.updateDirection(),this.scrollBehaviorY.updateDirection(),this.hooks.trigger(this.hooks.eventTypes.end,t,e))return!0;this.animater.translate(e),this.endTime=p();var o=this.endTime-this.startTime;this.hooks.trigger(this.hooks.eventTypes.scrollEnd,e,o)}},ft.prototype.handleClick=function(t){X(t.target,this.options.preventDefaultException)||(t.preventDefault(),t.stopPropagation())},ft.prototype.getCurrentPos=function(){return{x:this.scrollBehaviorX.getCurrentPos(),y:this.scrollBehaviorY.getCurrentPos()}},ft.prototype.refresh=function(){this.endTime=0},ft.prototype.destroy=function(){this.hooks.destroy()},ft);function ft(t,e,o,i,s){this.hooks=new H(["start","beforeMove","scrollStart","scroll","beforeEnd","end","scrollEnd"]),this.scrollBehaviorX=t,this.scrollBehaviorY=e,this.actionsHandler=o,this.animater=i,this.options=s,this.directionLockAction=new lt(s.directionLockThreshold,s.freeScroll,s.eventPassthrough),this.enabled=!0,this.bindActionsHandler()}function dt(o,t,e,i){var s=["momentum","momentumLimitTime","momentumLimitDistance","deceleration","swipeBounceTime","swipeTime"].reduce(function(t,e){return t[e]=o[e],t},{});return s.scrollable=o[t],s.bounces=e,s.rect=i,s}function vt(i,s,t){t.forEach(function(t){var e,o;"string"==typeof t?e=o=t:(e=t.source,o=t.target),i.on(e,function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return s.trigger.apply(s,[o].concat(t))})})}var mt=(yt.prototype.init=function(){var t=this;this.bindTranslater(),this.bindAnimater(),this.bindActions(),this.hooks.on(this.hooks.eventTypes.scrollEnd,function(){t.togglePointerEvents(!0)})},yt.prototype.bindTranslater=function(){var e=this,t=this.translater.hooks;t.on(t.eventTypes.beforeTranslate,function(t){e.options.translateZ&&t.push(e.options.translateZ)}),t.on(t.eventTypes.translate,function(t){e.updatePositions(t),e.togglePointerEvents(!1)})},yt.prototype.bindAnimater=function(){var e=this;this.animater.hooks.on(this.animater.hooks.eventTypes.end,function(t){e.resetPosition(e.options.bounceTime)||(e.animater.setPending(!1),e.hooks.trigger(e.hooks.eventTypes.scrollEnd,t))}),vt(this.animater.hooks,this.hooks,[{source:this.animater.hooks.eventTypes.move,target:this.hooks.eventTypes.scroll},{source:this.animater.hooks.eventTypes.forceStop,target:this.hooks.eventTypes.scrollEnd}])},yt.prototype.bindActions=function(){var s=this,o=this.actions;vt(o.hooks,this.hooks,[{source:o.hooks.eventTypes.start,target:this.hooks.eventTypes.beforeStart},{source:o.hooks.eventTypes.start,target:this.hooks.eventTypes.beforeScrollStart},{source:o.hooks.eventTypes.beforeMove,target:this.hooks.eventTypes.beforeMove},{source:o.hooks.eventTypes.scrollStart,target:this.hooks.eventTypes.scrollStart},{source:o.hooks.eventTypes.scroll,target:this.hooks.eventTypes.scroll},{source:o.hooks.eventTypes.beforeEnd,target:this.hooks.eventTypes.beforeEnd}]),o.hooks.on(o.hooks.eventTypes.end,function(t,e){return s.hooks.trigger(s.hooks.eventTypes.touchEnd,e),!!s.hooks.trigger(s.hooks.eventTypes.end,e)||(!o.moved&&s.checkClick(t)?(s.animater.setForceStopped(!1),s.hooks.trigger(s.hooks.eventTypes.scrollCancel),!0):(s.animater.setForceStopped(!1),!!s.resetPosition(s.options.bounceTime,x.bounce)||void 0))}),o.hooks.on(o.hooks.eventTypes.scrollEnd,function(t,e){var o=Math.abs(t.x-s.scrollBehaviorX.startPos),i=Math.abs(t.y-s.scrollBehaviorY.startPos);s.checkFlick(e,o,i)?s.hooks.trigger(s.hooks.eventTypes.flick):s.momentum(t,e)||s.hooks.trigger(s.hooks.eventTypes.scrollEnd,t)})},yt.prototype.checkFlick=function(t,e,o){if(1<this.hooks.events.flick.length&&t<this.options.flickLimitTime&&e<this.options.flickLimitDistance&&o<this.options.flickLimitDistance)return!0},yt.prototype.momentum=function(t,e){var o={time:0,easing:x.swiper,newX:t.x,newY:t.y},i=this.scrollBehaviorX.end(e),s=this.scrollBehaviorY.end(e);if(o.newX=c(i.destination)?o.newX:i.destination,o.newY=c(s.destination)?o.newY:s.destination,o.time=Math.max(i.duration,s.duration),this.hooks.trigger(this.hooks.eventTypes.momentum,o,this),o.newX!==t.x||o.newY!==t.y)return(o.newX>this.scrollBehaviorX.minScrollPos||o.newX<this.scrollBehaviorX.maxScrollPos||o.newY>this.scrollBehaviorY.minScrollPos||o.newY<this.scrollBehaviorY.maxScrollPos)&&(o.easing=x.swipeBounce),this.scrollTo(o.newX,o.newY,o.time,o.easing),!0},yt.prototype.checkClick=function(t){var e=this.animater.forceStopped;if(this.hooks.trigger(this.hooks.eventTypes.checkClick))return!0;if(e)return!1;var o=this.options.dblclick,i=!1;if(o&&this.lastClickTime){var s=o.delay,n=void 0===s?300:s;p()-this.lastClickTime<n&&(i=!0,function(t){D(t,"dblclick")}(t))}return this.options.tap&&function(t,e){var o=document.createEvent("Event");o.initEvent(e,!0,!0),o.pageX=t.pageX,o.pageY=t.pageY,t.target.dispatchEvent(o)}(t,this.options.tap),this.options.click&&!X(t.target,this.options.preventDefaultException)&&D(t),this.lastClickTime=i?null:p(),!0},yt.prototype.resize=function(){var t=this;this.actions.enabled&&(h&&(this.wrapper.scrollTop=0),clearTimeout(this.resizeTimeout),this.resizeTimeout=window.setTimeout(function(){t.refresh()},this.options.resizePolling))},yt.prototype.transitionEnd=function(t){t.target===this.content&&this.animater.pending&&(this.animater.transitionTime(),this.resetPosition(this.options.bounceTime,x.bounce)||(this.animater.setPending(!1),3!==this.options.probeType&&this.hooks.trigger(this.hooks.eventTypes.scrollEnd,this.getCurrentPos())))},yt.prototype.togglePointerEvents=function(t){void 0===t&&(t=!0);for(var e=this.content.children.length?this.content.children:[this.content],o=t?"auto":"none",i=0;i<e.length;i++){var s=e[i];s.isBScrollContainer||(s.style.pointerEvents=o)}},yt.prototype.refresh=function(){this.scrollBehaviorX.refresh(),this.scrollBehaviorY.refresh(),this.actions.refresh(),this.wrapperOffset=g(this.wrapper)},yt.prototype.scrollBy=function(t,e,o,i){void 0===o&&(o=0);var s=this.getCurrentPos(),n=s.x,r=s.y;i=i||x.bounce,t+=n,e+=r,this.scrollTo(t,e,o,i)},yt.prototype.scrollTo=function(t,e,o,i,s,n){void 0===o&&(o=0),void 0===s&&(s={start:{},end:{}}),i=i||x.bounce;var r=this.options.useTransition?i.style:i.fn,h=this.getCurrentPos(),a=l({x:h.x,y:h.y},s.start),c=l({x:t,y:e},s.end);this.hooks.trigger(this.hooks.eventTypes.scrollTo,c),!this.hooks.trigger(this.hooks.eventTypes.ignoreDisMoveForSamePos)&&a.x===c.x&&a.y===c.y||this.animater.move(a,c,o,r,n)},yt.prototype.scrollToElement=function(t,e,o,i,s){function n(t,e,o){return"number"==typeof t?t:t?Math.round(e/2-o/2):0}var r=v(t),h=g(r);function a(t,e,o,i){return t-=e,t=i.adjustPosition(t-o)}o=n(o,r.offsetWidth,this.wrapper.offsetWidth),i=n(i,r.offsetHeight,this.wrapper.offsetHeight),h.left=a(h.left,this.wrapperOffset.left,o,this.scrollBehaviorX),h.top=a(h.top,this.wrapperOffset.top,i,this.scrollBehaviorY),this.hooks.trigger(this.hooks.eventTypes.scrollToElement,r,h)||this.scrollTo(h.left,h.top,e,s)},yt.prototype.resetPosition=function(t,e){void 0===t&&(t=0),e=e||x.bounce;var o=this.scrollBehaviorX.checkInBoundary(),i=o.position,s=o.inBoundary,n=this.scrollBehaviorY.checkInBoundary(),r=n.position,h=n.inBoundary;return!(s&&h||(this.scrollTo(i,r,t,e),0))},yt.prototype.updatePositions=function(t){this.scrollBehaviorX.updatePosition(t.x),this.scrollBehaviorY.updatePosition(t.y)},yt.prototype.getCurrentPos=function(){return this.actions.getCurrentPos()},yt.prototype.enable=function(){this.actions.enabled=!0},yt.prototype.disable=function(){z(this.animater.timer),this.actions.enabled=!1},yt.prototype.destroy=function(){var e=this;["resizeRegister","transitionEndRegister","actionsHandler","actions","hooks","animater","translater","scrollBehaviorX","scrollBehaviorY"].forEach(function(t){return e[t].destroy()})},yt);function yt(t,e){this.hooks=new H(["beforeStart","beforeMove","beforeScrollStart","scrollStart","scroll","beforeEnd","scrollEnd","refresh","touchEnd","end","flick","scrollCancel","momentum","scrollTo","ignoreDisMoveForSamePos","scrollToElement"]),this.wrapper=t,this.content=t.children[0],this.options=e;var o=this.options.bounce,i=o.left,s=void 0===i||i,n=o.right,r=void 0===n||n,h=o.top,a=void 0===h||h,c=o.bottom,l=void 0===c||c;this.scrollBehaviorX=new rt(t,dt(e,"scrollX",[s,r],{size:"width",position:"left"})),this.scrollBehaviorY=new rt(t,dt(e,"scrollY",[a,l],{size:"height",position:"top"})),this.translater=new q(this.content),this.animater=function(t,e,o){var i=o.useTransition,s={};return Object.defineProperty(s,"probeType",{enumerable:!0,configurable:!1,get:function(){return o.probeType}}),i?new G(t,e,s):new tt(t,e,s)}(this.content,this.translater,this.options),this.actionsHandler=new I(t,function(o){return["click","bindToWrapper","disableMouse","disableTouch","preventDefault","stopPropagation","tagException","preventDefaultException"].reduce(function(t,e){return t[e]=o[e],t},{})}(this.options)),this.actions=new ut(this.scrollBehaviorX,this.scrollBehaviorY,this.actionsHandler,this.animater,this.options);var p=this.resize.bind(this);this.resizeRegister=new K(window,[{name:"orientationchange",handler:p},{name:"resize",handler:p}]),this.transitionEndRegister=new K(this.content,[{name:S.transitionEnd,handler:this.transitionEnd.bind(this)}]),this.init()}var gt,kt=[{sourceKey:"scroller.scrollBehaviorX.currentPos",key:"x"},{sourceKey:"scroller.scrollBehaviorY.currentPos",key:"y"},{sourceKey:"scroller.scrollBehaviorX.hasScroll",key:"hasHorizontalScroll"},{sourceKey:"scroller.scrollBehaviorY.hasScroll",key:"hasVerticalScroll"},{sourceKey:"scroller.scrollBehaviorX.contentSize",key:"scrollerWidth"},{sourceKey:"scroller.scrollBehaviorY.contentSize",key:"scrollerHeight"},{sourceKey:"scroller.scrollBehaviorX.maxScrollPos",key:"maxScrollX"},{sourceKey:"scroller.scrollBehaviorY.maxScrollPos",key:"maxScrollY"},{sourceKey:"scroller.scrollBehaviorX.minScrollPos",key:"minScrollX"},{sourceKey:"scroller.scrollBehaviorY.minScrollPos",key:"minScrollY"},{sourceKey:"scroller.scrollBehaviorX.movingDirection",key:"movingDirectionX"},{sourceKey:"scroller.scrollBehaviorY.movingDirection",key:"movingDirectionY"},{sourceKey:"scroller.scrollBehaviorX.direction",key:"directionX"},{sourceKey:"scroller.scrollBehaviorY.direction",key:"directionY"},{sourceKey:"scroller.actions.enabled",key:"enabled"},{sourceKey:"scroller.animater.pending",key:"pending"},{sourceKey:"scroller.animater.stop",key:"stop"},{sourceKey:"scroller.scrollTo",key:"scrollTo"},{sourceKey:"scroller.scrollBy",key:"scrollBy"},{sourceKey:"scroller.scrollToElement",key:"scrollToElement"},{sourceKey:"scroller.resetPosition",key:"resetPosition"}],Tt=(e(bt,gt=H),bt.use=function(e){var t=e.pluginName;return this.plugins.some(function(t){return e===t.ctor})||(c(t)?s("Plugin Class must specify plugin's name in static property by 'pluginName' field."):this.pluginsMap[t]?s("This plugin has been registered, maybe you need change plugin's name"):(this.pluginsMap[t]=!0,this.plugins.push({name:t,applyOrder:e.applyOrder,ctor:e}))),this},bt.prototype.init=function(t){(this.wrapper=t).isBScrollContainer=!0,this.scroller=new mt(t,this.options),this.eventBubbling(),this.handleAutoBlur(),this.innerRefresh(),this.scroller.scrollTo(this.options.startX,this.options.startY),this.enable(),this.proxy(kt),this.applyPlugins()},bt.prototype.applyPlugins=function(){var o=this,i=this.options;this.constructor.plugins.sort(function(t,e){var o,i=((o={}).pre=-1,o.post=1,o);return(t.applyOrder?i[t.applyOrder]:0)-(e.applyOrder?i[e.applyOrder]:0)}).forEach(function(t){var e=t.ctor;i[t.name]&&"function"==typeof e&&(o.plugins[t.name]=new e(o))})},bt.prototype.handleAutoBlur=function(){this.options.autoBlur&&this.on(this.eventTypes.beforeScrollStart,function(){var t=document.activeElement;!t||"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName||t.blur()})},bt.prototype.eventBubbling=function(){vt(this.scroller.hooks,this,["beforeScrollStart","scrollStart","scroll","scrollEnd","scrollCancel","touchEnd","flick"])},bt.prototype.innerRefresh=function(){this.scroller.refresh(),this.hooks.trigger(this.hooks.eventTypes.refresh),this.trigger(this.eventTypes.refresh)},bt.prototype.proxy=function(t){var i=this;t.forEach(function(t){var e=t.key,o=t.sourceKey;!function(t,e,o){A.get=function(){return function(t,e){for(var o=e.split("."),i=0;i<o.length-1;i++)if("object"!=typeof(t=t[o[i]])||!t)return;var s=o.pop();return"function"==typeof t[s]?function(){return t[s].apply(t,arguments)}:t[s]}(this,e)},A.set=function(t){!function(t,e,o){for(var i,s=e.split("."),n=0;n<s.length-1;n++)t[i=s[n]]||(t[i]={}),t=t[i];t[s.pop()]=o}(this,e,t)},Object.defineProperty(t,o,A)}(i,o,e)})},bt.prototype.refresh=function(){this.innerRefresh(),this.scroller.resetPosition()},bt.prototype.enable=function(){this.scroller.enable(),this.hooks.trigger(this.hooks.eventTypes.enable),this.trigger(this.eventTypes.enable)},bt.prototype.disable=function(){this.scroller.disable(),this.hooks.trigger(this.hooks.eventTypes.disable),this.trigger(this.eventTypes.disable)},bt.prototype.destroy=function(){this.hooks.trigger(this.hooks.eventTypes.destroy),this.trigger(this.eventTypes.destroy),this.scroller.destroy()},bt.prototype.eventRegister=function(t){this.registerType(t)},bt.plugins=[],bt.pluginsMap={},bt);function bt(t,e){var o=gt.call(this,["refresh","enable","disable","beforeScrollStart","scrollStart","scroll","scrollEnd","scrollCancel","touchEnd","flick","destroy"])||this,i=v(t);return i?i.children[0]?(o.plugins={},o.options=(new j).merge(e).process(),o.hooks=new H(["init","refresh","enable","disable","destroy"]),o.init(i)):s("The wrapper need at least one child element to be scroller."):s("Can not resolve the wrapper DOM."),o}t.Behavior=rt,t.Options=j,t.default=Tt,Object.defineProperty(t,"__esModule",{value:!0})}),"undefined"!=typeof window&&window.BScroll&&(window.BScroll=window.BScroll.default);

@@ -1,3 +0,2 @@

import EventEmitter from '../base/EventEmitter';
import { EaseFn, safeCSSStyleDeclaration } from '@better-scroll/shared-utils';
import { EaseFn, safeCSSStyleDeclaration, EventEmitter } from '@better-scroll/shared-utils';
import Translater, { TranslaterPoint } from '../translater';

@@ -4,0 +3,0 @@ export declare type Displacement = [number, number];

@@ -1,3 +0,2 @@

import EventEmitter from './EventEmitter';
import EventRegister from './EventRegister';
import { EventRegister, EventEmitter } from '@better-scroll/shared-utils';
declare type Exception = {

@@ -4,0 +3,0 @@ tagName?: RegExp;

@@ -1,8 +0,7 @@

import EventEmitter from './base/EventEmitter';
import { Options } from './Options';
import Scroller from './scroller/Scroller';
import { EnforceOrder } from './enums/enforce-order';
import Scroller, { MountedBScrollHTMLElement } from './scroller/Scroller';
import { ApplyOrder, EventEmitter } from '@better-scroll/shared-utils';
interface PluginCtor {
pluginName: string;
enforce?: EnforceOrder;
applyOrder?: ApplyOrder;
new (scroll: BScroll): any;

@@ -12,3 +11,3 @@ }

name: string;
enforce?: EnforceOrder.Pre | EnforceOrder.Post;
applyOrder?: ApplyOrder.Pre | ApplyOrder.Post;
ctor: PluginCtor;

@@ -48,2 +47,4 @@ }

}
export { Options };
export { Options, MountedBScrollHTMLElement };
export { TranslaterPoint } from './translater';
export { default as Behavior } from './scroller/Behavior';

@@ -59,2 +59,3 @@ export declare type tap = 'tap' | '';

process(): this;
resolveBounce(): void;
}

@@ -5,5 +5,5 @@ import ActionsHandler from '../base/ActionsHandler';

import { Animater } from '../animater';
import EventEmitter from '../base/EventEmitter';
import { Options as BScrollOptions } from '../Options';
import { TranslaterPoint } from '../translater';
import { EventEmitter } from '@better-scroll/shared-utils';
export default class ScrollerActions {

@@ -10,0 +10,0 @@ hooks: EventEmitter;

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

import EventEmitter from '../base/EventEmitter';
import { EventEmitter } from '@better-scroll/shared-utils';
export declare type Bounces = [boolean, boolean];

@@ -3,0 +3,0 @@ export declare type Rect = {

@@ -1,3 +0,2 @@

import { DirectionLock } from '../enums';
import { TouchEvent } from '@better-scroll/shared-utils';
import { TouchEvent, DirectionLock } from '@better-scroll/shared-utils';
export default class DirectionLockAction {

@@ -4,0 +3,0 @@ directionLockThreshold: number;

import ActionsHandler from '../base/ActionsHandler';
import EventEmitter from '../base/EventEmitter';
import EventRegister from '../base/EventRegister';
import Translater, { TranslaterPoint } from '../translater';

@@ -9,3 +7,6 @@ import { Animater } from '../animater';

import ScrollerActions from './Actions';
import { EaseItem } from '@better-scroll/shared-utils';
import { EaseItem, EventEmitter, EventRegister } from '@better-scroll/shared-utils';
export interface MountedBScrollHTMLElement extends HTMLElement {
isBScrollContainer?: boolean;
}
export default class Scroller {

@@ -12,0 +13,0 @@ wrapper: HTMLElement;

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

import EventEmitter from '../base/EventEmitter';
import { EventEmitter } from '@better-scroll/shared-utils';
export interface TranslaterPoint {

@@ -3,0 +3,0 @@ x: number;

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

import EventEmitter from '../base/EventEmitter';
import { EventEmitter } from '@better-scroll/shared-utils';
interface BubblingEventMap {

@@ -3,0 +3,0 @@ source: string;

{
"name": "@better-scroll/core",
"version": "2.0.0-beta.2",
"version": "2.0.0-beta.4",
"description": "Minimalistic core scrolling for BetterScroll, it is pure and tiny",

@@ -34,5 +34,5 @@ "author": {

"dependencies": {
"@better-scroll/shared-utils": "^2.0.0-beta.2"
"@better-scroll/shared-utils": "^2.0.0-beta.4"
},
"gitHead": "ddcf90c659bacf2b85787c23300bec06e2d9ff01"
"gitHead": "c9d93c7cf446debfbbec2a13219786594a63729f"
}

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

import Scroller from '@better-scroll/core/src/scroller/Scroller'
import EventEmitter from '@better-scroll/core/src/base/EventEmitter'
import { Options } from '@better-scroll/core/src/Options'
import Scroller from '../scroller/Scroller'
import { Options } from '../Options'
import { EventEmitter } from '@better-scroll/shared-utils'
jest.mock('@better-scroll/core/src/scroller/Scroller')
jest.mock('@better-scroll/core/src/Options')
jest.mock('../scroller/Scroller')
jest.mock('../Options')

@@ -8,0 +8,0 @@ const BScroll = jest.fn().mockImplementation((wrapper, options) => {

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

import BScroll from '@better-scroll/core'
import BScroll from '../index'

@@ -3,0 +3,0 @@ describe('BetterScroll Core', () => {

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

import { Options } from '@better-scroll/core/src/Options'
import { Options } from '../Options'

@@ -154,2 +154,30 @@ describe('BetterScroll Options', () => {

})
it('should resolve bounce when calling process', () => {
options
.merge({
bounce: false
})
.process()
expect(options.bounce).toEqual({
bottom: false,
left: false,
right: false,
top: false
})
options
.merge({
bounce: true
})
.process()
expect(options.bounce).toEqual({
bottom: true,
left: true,
right: true,
top: true
})
})
})

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

import EventEmitter from '@better-scroll/core/src/base/EventEmitter'
import { EventEmitter } from '@better-scroll/shared-utils'

@@ -3,0 +3,0 @@ const Animation = jest

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

import Transition from '@better-scroll/core/src/animater/Transition'
import Animation from '@better-scroll/core/src/animater/Animation'
import Transition from '../Transition'
import Animation from '../Animation'
jest.mock('@better-scroll/core/src/animater/Transition')
jest.mock('@better-scroll/core/src/animater/Animation')
jest.mock('../Transition')
jest.mock('../Animation')

@@ -7,0 +7,0 @@ const createAnimater = jest

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

import EventEmitter from '@better-scroll/core/src/base/EventEmitter'
import { EventEmitter } from '@better-scroll/shared-utils'

@@ -3,0 +3,0 @@ const Transition = jest

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

import Translater from '@better-scroll/core/src/translater/index'
jest.mock('@better-scroll/core/src/translater/index')
import Translater from '../../translater'
jest.mock('../../translater')

@@ -20,3 +20,3 @@ let mockRequestAnimationFrame = jest.fn()

import Animation from '@better-scroll/core/src/animater/Animation'
import Animation from '../Animation'

@@ -23,0 +23,0 @@ function createTransition(probeType: number) {

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

import Translater from '@better-scroll/core/src/translater/index'
import Transition from '@better-scroll/core/src/animater/Transition'
import Animation from '@better-scroll/core/src/animater/Animation'
import { Options } from '@better-scroll/core/src/Options'
jest.mock('@better-scroll/core/src/animater/Animation')
jest.mock('@better-scroll/core/src/animater/Transition')
jest.mock('@better-scroll/core/src/animater/Base')
jest.mock('@better-scroll/core/src/translater/index')
jest.mock('@better-scroll/core/src/Options')
import Translater from '../../translater/index'
import Transition from '../Transition'
import Animation from '../Animation'
import { Options } from '../../Options'
jest.mock('../Animation')
jest.mock('../Transition')
jest.mock('../Base')
jest.mock('../../translater/index')
jest.mock('../../Options')

@@ -11,0 +11,0 @@ import createAnimater from '../index'

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

import Translater from '@better-scroll/core/src/translater/index'
jest.mock('@better-scroll/core/src/translater/index')
import Translater from '../../translater/index'
jest.mock('../../translater/index')

@@ -4,0 +4,0 @@ let mockRequestAnimationFrame = jest.fn()

@@ -7,5 +7,5 @@ import Base from './Base'

cancelAnimationFrame,
EaseFn
EaseFn,
Probe
} from '@better-scroll/shared-utils'
import { Probe } from '../enums/probe'

@@ -12,0 +12,0 @@ export default class Animation extends Base {

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

import EventEmitter from '../base/EventEmitter'
import {
EaseFn,
safeCSSStyleDeclaration,
cancelAnimationFrame
cancelAnimationFrame,
EventEmitter
} from '@better-scroll/shared-utils'

@@ -7,0 +7,0 @@ import Translater, { TranslaterPoint } from '../translater'

@@ -5,5 +5,5 @@ import {

cancelAnimationFrame,
EaseFn
EaseFn,
Probe
} from '@better-scroll/shared-utils'
import { Probe } from '../enums/probe'
import Base from './Base'

@@ -10,0 +10,0 @@ import { TranslaterPoint } from '../translater'

@@ -1,3 +0,2 @@

import EventEmitter from '@better-scroll/core/src/base/EventEmitter'
import EventRegister from '@better-scroll/core/src/base/EventRegister'
import { EventRegister, EventEmitter } from '@better-scroll/shared-utils'

@@ -4,0 +3,0 @@ const ActionsHandler = jest

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

import EventEmitter from './EventEmitter'
import EventRegister from './EventRegister'
import {

@@ -9,7 +7,9 @@ TouchEvent,

eventTypeMap,
hasTouch
hasTouch,
EventType,
MouseButton,
EventRegister,
EventEmitter
} from '@better-scroll/shared-utils'
import { EventType, MouseButton } from '../enums'
type Exception = {

@@ -57,4 +57,4 @@ tagName?: RegExp

const targetEvents = []
const shouldRegiserTouch = hasTouch && !disableTouch
const sholdRegisterMouse = !disableMouse
const shouldRegisterTouch = hasTouch && !disableTouch
const shouldRegisterMouse = !disableMouse

@@ -69,3 +69,3 @@ if (click) {

if (shouldRegiserTouch) {
if (shouldRegisterTouch) {
wrapperEvents.push({

@@ -92,3 +92,3 @@ name: 'touchstart',

if (sholdRegisterMouse) {
if (shouldRegisterMouse) {
wrapperEvents.push({

@@ -95,0 +95,0 @@ name: 'mousedown',

@@ -1,4 +0,3 @@

import EventEmitter from './base/EventEmitter'
import { Options } from './Options'
import Scroller from './scroller/Scroller'
import Scroller, { MountedBScrollHTMLElement } from './scroller/Scroller'
import {

@@ -8,11 +7,12 @@ getElement,

isUndef,
propertiesProxy
propertiesProxy,
ApplyOrder,
EventEmitter
} from '@better-scroll/shared-utils'
import { bubbling } from './utils/bubbling'
import { propertiesConfig } from './propertiesConfig'
import { EnforceOrder } from './enums/enforce-order'
interface PluginCtor {
pluginName: string
enforce?: EnforceOrder
applyOrder?: ApplyOrder
new (scroll: BScroll): any

@@ -23,3 +23,3 @@ }

name: string
enforce?: EnforceOrder.Pre | EnforceOrder.Post
applyOrder?: ApplyOrder.Pre | ApplyOrder.Post
ctor: PluginCtor

@@ -64,3 +64,3 @@ }

name,
enforce: ctor.enforce,
applyOrder: ctor.applyOrder,
ctor

@@ -113,3 +113,3 @@ })

// mark wrapper to recognize bs instance by DOM attribute
;(wrapper as any).isBScroll = true
;(wrapper as any).isBScrollContainer = true
this.scroller = new Scroller(wrapper as HTMLElement, this.options)

@@ -134,8 +134,8 @@

.sort((a, b) => {
const enforeOrderMap = {
[EnforceOrder.Pre]: -1,
[EnforceOrder.Post]: 1
const applyOrderMap = {
[ApplyOrder.Pre]: -1,
[ApplyOrder.Post]: 1
}
const aOrder = a.enforce ? enforeOrderMap[a.enforce] : 0
const bOrder = b.enforce ? enforeOrderMap[b.enforce] : 0
const aOrder = a.applyOrder ? applyOrderMap[a.applyOrder] : 0
const bOrder = b.applyOrder ? applyOrderMap[b.applyOrder] : 0
return aOrder - bOrder

@@ -216,2 +216,4 @@ })

export { Options }
export { Options, MountedBScrollHTMLElement }
export { TranslaterPoint } from './translater'
export { default as Behavior } from './scroller/Behavior'
import {
hasTransition,
hasPerspective,
hasTouch
hasTouch,
Probe,
EventPassthrough
} from '@better-scroll/shared-utils'
import { Probe, EventPassthrough } from './enums'
// type

@@ -133,2 +134,4 @@ export type tap = 'tap' | ''

this.resolveBounce()
// If you want eventPassthrough I have to lock one of the axes

@@ -155,2 +158,18 @@ this.scrollX =

}
resolveBounce() {
const directions = ['top', 'right', 'bottom', 'left']
const bounce = this.bounce
if (bounce === false || bounce === true) {
this.bounce = makeMap(directions, bounce as boolean)
}
}
}
function makeMap(keys: string[], val: boolean = true) {
const ret: { [key: string]: boolean } = {}
keys.forEach(key => {
ret[key] = val
})
return ret
}

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

import DirectionLock from '@better-scroll/core/src/scroller/DirectionLock'
import DirectionLock from '../DirectionLock'
jest.mock('@better-scroll/core/src/scroller/DirectionLock')
jest.mock('../DirectionLock')
import EventEmitter from '@better-scroll/core/src/base/EventEmitter'
import { EventEmitter } from '@better-scroll/shared-utils'

@@ -7,0 +7,0 @@ const ScrollerActions = jest

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

import EventEmitter from '@better-scroll/core/src/base/EventEmitter'
import { EventEmitter } from '@better-scroll/shared-utils'

@@ -3,0 +3,0 @@ const Behavior = jest.fn().mockImplementation((content, bscrollOptions) => {

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

import EventEmitter from '@better-scroll/core/src/base/EventEmitter'
const DirectionLock = jest

@@ -4,0 +2,0 @@ .fn()

@@ -1,15 +0,14 @@

import createAnimater from '@better-scroll/core/src/animater/index'
import Translater from '@better-scroll/core/src/translater'
import Behavior from '@better-scroll/core/src/scroller/Behavior'
import ActionsHandler from '@better-scroll/core/src/base/ActionsHandler'
import Actions from '@better-scroll/core/src/scroller/Actions'
import createAnimater from '../../animater'
import Translater from '../../translater'
import Behavior from '../Behavior'
import ActionsHandler from '../../base/ActionsHandler'
import Actions from '../Actions'
jest.mock('@better-scroll/core/src/animater/index')
jest.mock('@better-scroll/core/src/translater')
jest.mock('@better-scroll/core/src/scroller/Behavior')
jest.mock('@better-scroll/core/src/base/ActionsHandler')
jest.mock('@better-scroll/core/src/scroller/Actions')
jest.mock('../../animater')
jest.mock('../../translater')
jest.mock('../Behavior')
jest.mock('../../base/ActionsHandler')
jest.mock('../Actions')
import EventEmitter from '@better-scroll/core/src/base/EventEmitter'
import EventRegister from '@better-scroll/core/src/base/EventRegister'
import { EventEmitter, EventRegister } from '@better-scroll/shared-utils'

@@ -16,0 +15,0 @@ const Scroller = jest.fn().mockImplementation((wrapper, bscrollOptions) => {

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

import Behavior from '@better-scroll/core/src/scroller/Behavior'
import createAnimater from '@better-scroll/core/src/animater'
import Translater from '@better-scroll/core/src/translater'
import { Options } from '@better-scroll/core/src/Options'
import ActionsHandler from '@better-scroll/core/src/base/ActionsHandler'
import Behavior from '../Behavior'
import createAnimater from '../../animater'
import Translater from '../../translater'
import { Options } from '../../Options'
import ActionsHandler from '../../base/ActionsHandler'
jest.mock('@better-scroll/core/src/scroller/Behavior')
jest.mock('@better-scroll/core/src/animater')
jest.mock('@better-scroll/core/src/translater')
jest.mock('@better-scroll/core/src/Options')
jest.mock('@better-scroll/core/src/base/ActionsHandler')
jest.mock('../Behavior')
jest.mock('../../animater')
jest.mock('../../translater')
jest.mock('../../Options')
jest.mock('../../base/ActionsHandler')
import Actions from '@better-scroll/core/src/scroller/Actions'
import Actions from '../Actions'

@@ -15,0 +15,0 @@ describe('Actions Class tests', () => {

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

import Behavior from '@better-scroll/core/src/scroller/Behavior'
import { createDiv } from '@better-scroll/core/src/__tests__/__utils__/layout'
import Behavior from '../Behavior'
import { createDiv } from '../../__tests__/__utils__/layout'

@@ -4,0 +4,0 @@ describe('Behavior Class tests', () => {

import {
createActionsHandlerOptions,
createBehaviorOptions
} from '@better-scroll/core/src/scroller/createOptions'
import { Options } from '@better-scroll/core/src/Options'
} from '../createOptions'
import { Options } from '../../Options'
jest.mock('@better-scroll/core/src/Options')
jest.mock('../../Options')

@@ -9,0 +9,0 @@ describe('createOptions helper function tests', () => {

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

import DirectionLock from '@better-scroll/core/src/scroller/DirectionLock'
import DirectionLock from '../DirectionLock'

@@ -3,0 +3,0 @@ describe('DirectionLock Class tests', () => {

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

import Behavior from '@better-scroll/core/src/scroller/Behavior'
import createAnimater from '@better-scroll/core/src/animater'
import Translater from '@better-scroll/core/src/translater'
import { Options } from '@better-scroll/core/src/Options'
import ActionsHandler from '@better-scroll/core/src/base/ActionsHandler'
import Actions from '@better-scroll/core/src/scroller/Actions'
import Behavior from '../Behavior'
import createAnimater from '../../animater'
import Translater from '../../translater'
import { Options } from '../../Options'
import ActionsHandler from '../../base/ActionsHandler'
import Actions from '../Actions'
jest.mock('@better-scroll/core/src/scroller/Behavior')
jest.mock('@better-scroll/core/src/animater')
jest.mock('@better-scroll/core/src/translater')
jest.mock('@better-scroll/core/src/Options')
jest.mock('@better-scroll/core/src/base/ActionsHandler')
jest.mock('@better-scroll/core/src/scroller/Actions')
jest.mock('../Behavior')
jest.mock('../../animater')
jest.mock('../../translater')
jest.mock('../../Options')
jest.mock('../../base/ActionsHandler')
jest.mock('../Actions')
import Scroller from '@better-scroll/core/src/scroller/Scroller'
import { createDiv } from '@better-scroll/core/src/__tests__/__utils__/layout'
import Scroller from '../Scroller'
import { createDiv } from '../../__tests__/__utils__/layout'

@@ -18,0 +18,0 @@ describe('Scroller Class tests', () => {

@@ -5,5 +5,3 @@ import ActionsHandler from '../base/ActionsHandler'

import { Animater } from '../animater'
import EventEmitter from '../base/EventEmitter'
import { Options as BScrollOptions } from '../Options'
import { Probe } from '../enums'
import { TranslaterPoint } from '../translater'

@@ -13,3 +11,5 @@ import {

TouchEvent,
getNow
getNow,
Probe,
EventEmitter
} from '@better-scroll/shared-utils'

@@ -16,0 +16,0 @@

@@ -1,4 +0,2 @@

import { getRect } from '@better-scroll/shared-utils'
import { Direction } from '../enums/direction'
import EventEmitter from '../base/EventEmitter'
import { getRect, Direction, EventEmitter } from '@better-scroll/shared-utils'

@@ -5,0 +3,0 @@ export type Bounces = [boolean, boolean]

@@ -1,5 +0,8 @@

import { DirectionLock, EventPassthrough } from '../enums'
import { TouchEvent } from '@better-scroll/shared-utils'
import {
TouchEvent,
DirectionLock,
EventPassthrough
} from '@better-scroll/shared-utils'
enum Passthrough {
const enum Passthrough {
Yes = 'yes',

@@ -6,0 +9,0 @@ No = 'no'

import ActionsHandler from '../base/ActionsHandler'
import EventEmitter from '../base/EventEmitter'
import EventRegister from '../base/EventRegister'
import Translater, { TranslaterPoint } from '../translater'

@@ -13,3 +11,2 @@ import createAnimater, { Animater, Transition } from '../animater'

} from './createOptions'
import { Probe } from '../enums'
import {

@@ -29,5 +26,11 @@ getElement,

cancelAnimationFrame,
EaseItem
EaseItem,
Probe,
EventEmitter,
EventRegister
} from '@better-scroll/shared-utils'
import { bubbling } from '../utils/bubbling'
export interface MountedBScrollHTMLElement extends HTMLElement {
isBScrollContainer?: boolean
}

@@ -381,5 +384,5 @@ export default class Scroller {

for (let i = 0; i < el.length; i++) {
let node = el[i] as HTMLElement
let node = el[i] as MountedBScrollHTMLElement
// ignore BetterScroll instance's wrapper DOM
if (node.isBScroll) {
if (node.isBScrollContainer) {
continue

@@ -386,0 +389,0 @@ }

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

import EventEmitter from '@better-scroll/core/src/base/EventEmitter'
import { EventEmitter } from '@better-scroll/shared-utils'

@@ -3,0 +3,0 @@ const Translater = jest.fn().mockImplementation(content => {

@@ -1,3 +0,6 @@

import { style, safeCSSStyleDeclaration } from '@better-scroll/shared-utils'
import EventEmitter from '../base/EventEmitter'
import {
style,
safeCSSStyleDeclaration,
EventEmitter
} from '@better-scroll/shared-utils'
export interface TranslaterPoint {

@@ -65,3 +68,3 @@ x: number

)
this.style[style.transform as any] = `${transformStyle.join(' ')}`
this.style[style.transform as any] = transformStyle.join(' ')
this.hooks.trigger(this.hooks.eventTypes.translate, point)

@@ -68,0 +71,0 @@ }

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

import { bubbling } from '@better-scroll/core/src/utils/bubbling'
import EventEmitter from '@better-scroll/core/src/base/EventEmitter'
import { bubbling } from '../bubbling'
import { EventEmitter } from '@better-scroll/shared-utils'

@@ -4,0 +4,0 @@ describe('bubbling', () => {

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

import EventEmitter from '../base/EventEmitter'
import { EventEmitter } from '@better-scroll/shared-utils'

@@ -3,0 +3,0 @@ interface BubblingEventMap {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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