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

@better-scroll/scroll-bar

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/scroll-bar - npm Package Compare versions

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

208

dist/scroll-bar.esm.js
/*!
* better-scroll / scroll-bar
* (c) 2016-2019 ustbhuangyi
* (c) 2016-2020 ustbhuangyi
* Released under the MIT License.
*/
var Direction;
(function (Direction) {
Direction["Horizontal"] = "horizontal";
Direction["Vertical"] = "vertical";
})(Direction || (Direction = {}));
function warn(msg) {
console.error("[BScroll warn]: " + msg);
}

@@ -50,2 +48,13 @@ // ssr support

}
function addEvent(el, type, fn, capture) {
el.addEventListener(type, fn, {
passive: false,
capture: !!capture
});
}
function removeEvent(el, type, fn, capture) {
el.removeEventListener(type, fn, {
capture: !!capture
});
}
var cssVendor = vendor && vendor !== 'standard' ? '-' + vendor.toLowerCase() + '-' : '';

@@ -65,74 +74,7 @@ var transform = prefixStyle('transform');

function warn(msg) {
console.error("[BScroll warn]: " + msg);
}
// ssr support
var inBrowser$1 = typeof window !== 'undefined';
var ua$1 = inBrowser$1 && navigator.userAgent.toLowerCase();
var isWeChatDevTools$1 = ua$1 && /wechatdevtools/.test(ua$1);
var isAndroid$1 = ua$1 && ua$1.indexOf('android') > 0;
var elementStyle$1 = (inBrowser$1 &&
document.createElement('div').style);
var vendor$1 = (function () {
if (!inBrowser$1) {
return false;
}
var transformNames = {
webkit: 'webkitTransform',
Moz: 'MozTransform',
O: 'OTransform',
ms: 'msTransform',
standard: 'transform'
};
for (var key in transformNames) {
if (elementStyle$1[transformNames[key]] !== undefined) {
return key;
}
}
return false;
})();
function prefixStyle$1(style) {
if (vendor$1 === false) {
return style;
}
if (vendor$1 === 'standard') {
if (style === 'transitionEnd') {
return 'transitionend';
}
return style;
}
return vendor$1 + style.charAt(0).toUpperCase() + style.substr(1);
}
function addEvent(el, type, fn, capture) {
el.addEventListener(type, fn, {
passive: false,
capture: !!capture
});
}
function removeEvent(el, type, fn, capture) {
el.removeEventListener(type, fn, {
capture: !!capture
});
}
var cssVendor$1 = vendor$1 && vendor$1 !== 'standard' ? '-' + vendor$1.toLowerCase() + '-' : '';
var transform$1 = prefixStyle$1('transform');
var transition$1 = prefixStyle$1('transition');
var hasPerspective$1 = inBrowser$1 && prefixStyle$1('perspective') in elementStyle$1;
var style$1 = {
transform: transform$1,
transition: transition$1,
transitionTimingFunction: prefixStyle$1('transitionTimingFunction'),
transitionDuration: prefixStyle$1('transitionDuration'),
transitionDelay: prefixStyle$1('transitionDelay'),
transformOrigin: prefixStyle$1('transformOrigin'),
transitionEnd: prefixStyle$1('transitionEnd')
};
var DEFAULT_INTERVAL = 100 / 60;
var windowCompat = inBrowser$1 && window;
var windowCompat = inBrowser && window;
function noop() { }
var requestAnimationFrame = (function () {
if (!inBrowser$1) {
if (!inBrowser) {
/* istanbul ignore if */

@@ -151,3 +93,3 @@ return noop;

var cancelAnimationFrame = (function () {
if (!inBrowser$1) {
if (!inBrowser) {
/* istanbul ignore if */

@@ -165,38 +107,2 @@ return noop;

var EventRegister = /** @class */ (function () {
function EventRegister(wrapper, events) {
this.wrapper = wrapper;
this.events = events;
this.addDOMEvents();
}
EventRegister.prototype.destroy = function () {
this.removeDOMEvents();
this.events = [];
};
EventRegister.prototype.addDOMEvents = function () {
this.handleDOMEvents(addEvent);
};
EventRegister.prototype.removeDOMEvents = function () {
this.handleDOMEvents(removeEvent);
};
EventRegister.prototype.handleDOMEvents = function (eventOperation) {
var _this = this;
var wrapper = this.wrapper;
this.events.forEach(function (event) {
eventOperation(wrapper, event.name, _this, !!event.capture);
});
};
EventRegister.prototype.handleEvent = function (e) {
var eventType = e.type;
this.events.some(function (event) {
if (event.name === eventType) {
event.handler(e);
return true;
}
return false;
});
};
return EventRegister;
}());
var EventEmitter = /** @class */ (function () {

@@ -210,3 +116,3 @@ function EventEmitter(names) {

if (context === void 0) { context = this; }
this._checkInTypes(type);
this.hasType(type);
if (!this.events[type]) {

@@ -221,3 +127,3 @@ this.events[type] = [];

if (context === void 0) { context = this; }
this._checkInTypes(type);
this.hasType(type);
var magic = function () {

@@ -241,3 +147,3 @@ var args = [];

if (type) {
this._checkInTypes(type);
this.hasType(type);
if (!fn) {

@@ -266,3 +172,3 @@ this.events[type] = [];

}
this._checkInTypes(type);
this.hasType(type);
var events = this.events[type];

@@ -296,7 +202,9 @@ if (!events) {

};
EventEmitter.prototype._checkInTypes = function (type) {
EventEmitter.prototype.hasType = function (type) {
var types = this.eventTypes;
var inTypes = types[type] === type;
if (!inTypes) {
warn("EventEmitter has used unknown event type: \"" + type + "\", should be oneof [" + Object.keys(types) + "]");
var isType = types[type] === type;
if (!isType) {
warn("EventEmitter has used unknown event type: \"" + type + "\", should be oneof [" +
("" + Object.keys(types).map(function (_) { return JSON.stringify(_); })) +
"]");
}

@@ -306,2 +214,37 @@ };

}());
var EventRegister = /** @class */ (function () {
function EventRegister(wrapper, events) {
this.wrapper = wrapper;
this.events = events;
this.addDOMEvents();
}
EventRegister.prototype.destroy = function () {
this.removeDOMEvents();
this.events = [];
};
EventRegister.prototype.addDOMEvents = function () {
this.handleDOMEvents(addEvent);
};
EventRegister.prototype.removeDOMEvents = function () {
this.handleDOMEvents(removeEvent);
};
EventRegister.prototype.handleDOMEvents = function (eventOperation) {
var _this = this;
var wrapper = this.wrapper;
this.events.forEach(function (event) {
eventOperation(wrapper, event.name, _this, !!event.capture);
});
};
EventRegister.prototype.handleEvent = function (e) {
var eventType = e.type;
this.events.some(function (event) {
if (event.name === eventType) {
event.handler(e);
return true;
}
return false;
});
};
return EventRegister;
}());

@@ -446,3 +389,3 @@ var EventHandler = /** @class */ (function () {

Indicator.prototype._getKeysMap = function () {
if (this.direction === Direction.Vertical) {
if (this.direction === "vertical" /* Vertical */) {
return {

@@ -554,3 +497,3 @@ hasScroll: 'hasVerticalScroll',

// TODO freeScroll ?
if (this.direction === Direction.Vertical) {
if (this.direction === "vertical" /* Vertical */) {
this.bscroll.scrollTo(this.bscroll.x, newScrollPos);

@@ -614,2 +557,3 @@ }

ScrollBar.prototype._initIndicators = function (bscroll) {
var _this = this;
var _a = bscroll.options

@@ -619,11 +563,11 @@ .scrollbar, _b = _a.fade, fade = _b === void 0 ? true : _b, _c = _a.interactive, interactive = _c === void 0 ? false : _c;

var scrolls = {
scrollX: Direction.Horizontal,
scrollY: Direction.Vertical
scrollX: "horizontal" /* Horizontal */,
scrollY: "vertical" /* Vertical */
};
var indicators = [];
for (var _i = 0, _d = Object.entries(scrolls); _i < _d.length; _i++) {
var _e = _d[_i], scroll_1 = _e[0], direction = _e[1];
if (bscroll.options[scroll_1]) {
Object.keys(scrolls).forEach(function (key) {
var direction = scrolls[key];
if (bscroll.options[key]) {
indicatorOption = {
wrapper: this._createIndicatorElement(direction),
wrapper: _this._createIndicatorElement(direction),
direction: direction,

@@ -636,3 +580,3 @@ fade: fade,

}
}
});
return indicators;

@@ -662,8 +606,2 @@ };

};
ScrollBar.prototype._insertIndicatorsTo = function (bscroll) {
for (var _i = 0, _a = this.indicators; _i < _a.length; _i++) {
var indicator = _a[_i];
bscroll.wrapper.appendChild(indicator.wrapper);
}
};
ScrollBar.prototype.destroy = function () {

@@ -670,0 +608,0 @@ for (var _i = 0, _a = this.indicators; _i < _a.length; _i++) {

/*!
* better-scroll / scroll-bar
* (c) 2016-2019 ustbhuangyi
* (c) 2016-2020 ustbhuangyi
* Released under the MIT License.

@@ -12,7 +12,5 @@ */

var Direction;
(function (Direction) {
Direction["Horizontal"] = "horizontal";
Direction["Vertical"] = "vertical";
})(Direction || (Direction = {}));
function warn(msg) {
console.error("[BScroll warn]: " + msg);
}

@@ -57,2 +55,13 @@ // ssr support

}
function addEvent(el, type, fn, capture) {
el.addEventListener(type, fn, {
passive: false,
capture: !!capture
});
}
function removeEvent(el, type, fn, capture) {
el.removeEventListener(type, fn, {
capture: !!capture
});
}
var cssVendor = vendor && vendor !== 'standard' ? '-' + vendor.toLowerCase() + '-' : '';

@@ -72,74 +81,7 @@ var transform = prefixStyle('transform');

function warn(msg) {
console.error("[BScroll warn]: " + msg);
}
// ssr support
var inBrowser$1 = typeof window !== 'undefined';
var ua$1 = inBrowser$1 && navigator.userAgent.toLowerCase();
var isWeChatDevTools$1 = ua$1 && /wechatdevtools/.test(ua$1);
var isAndroid$1 = ua$1 && ua$1.indexOf('android') > 0;
var elementStyle$1 = (inBrowser$1 &&
document.createElement('div').style);
var vendor$1 = (function () {
if (!inBrowser$1) {
return false;
}
var transformNames = {
webkit: 'webkitTransform',
Moz: 'MozTransform',
O: 'OTransform',
ms: 'msTransform',
standard: 'transform'
};
for (var key in transformNames) {
if (elementStyle$1[transformNames[key]] !== undefined) {
return key;
}
}
return false;
})();
function prefixStyle$1(style) {
if (vendor$1 === false) {
return style;
}
if (vendor$1 === 'standard') {
if (style === 'transitionEnd') {
return 'transitionend';
}
return style;
}
return vendor$1 + style.charAt(0).toUpperCase() + style.substr(1);
}
function addEvent(el, type, fn, capture) {
el.addEventListener(type, fn, {
passive: false,
capture: !!capture
});
}
function removeEvent(el, type, fn, capture) {
el.removeEventListener(type, fn, {
capture: !!capture
});
}
var cssVendor$1 = vendor$1 && vendor$1 !== 'standard' ? '-' + vendor$1.toLowerCase() + '-' : '';
var transform$1 = prefixStyle$1('transform');
var transition$1 = prefixStyle$1('transition');
var hasPerspective$1 = inBrowser$1 && prefixStyle$1('perspective') in elementStyle$1;
var style$1 = {
transform: transform$1,
transition: transition$1,
transitionTimingFunction: prefixStyle$1('transitionTimingFunction'),
transitionDuration: prefixStyle$1('transitionDuration'),
transitionDelay: prefixStyle$1('transitionDelay'),
transformOrigin: prefixStyle$1('transformOrigin'),
transitionEnd: prefixStyle$1('transitionEnd')
};
var DEFAULT_INTERVAL = 100 / 60;
var windowCompat = inBrowser$1 && window;
var windowCompat = inBrowser && window;
function noop() { }
var requestAnimationFrame = (function () {
if (!inBrowser$1) {
if (!inBrowser) {
/* istanbul ignore if */

@@ -158,3 +100,3 @@ return noop;

var cancelAnimationFrame = (function () {
if (!inBrowser$1) {
if (!inBrowser) {
/* istanbul ignore if */

@@ -172,38 +114,2 @@ return noop;

var EventRegister = /** @class */ (function () {
function EventRegister(wrapper, events) {
this.wrapper = wrapper;
this.events = events;
this.addDOMEvents();
}
EventRegister.prototype.destroy = function () {
this.removeDOMEvents();
this.events = [];
};
EventRegister.prototype.addDOMEvents = function () {
this.handleDOMEvents(addEvent);
};
EventRegister.prototype.removeDOMEvents = function () {
this.handleDOMEvents(removeEvent);
};
EventRegister.prototype.handleDOMEvents = function (eventOperation) {
var _this = this;
var wrapper = this.wrapper;
this.events.forEach(function (event) {
eventOperation(wrapper, event.name, _this, !!event.capture);
});
};
EventRegister.prototype.handleEvent = function (e) {
var eventType = e.type;
this.events.some(function (event) {
if (event.name === eventType) {
event.handler(e);
return true;
}
return false;
});
};
return EventRegister;
}());
var EventEmitter = /** @class */ (function () {

@@ -217,3 +123,3 @@ function EventEmitter(names) {

if (context === void 0) { context = this; }
this._checkInTypes(type);
this.hasType(type);
if (!this.events[type]) {

@@ -228,3 +134,3 @@ this.events[type] = [];

if (context === void 0) { context = this; }
this._checkInTypes(type);
this.hasType(type);
var magic = function () {

@@ -248,3 +154,3 @@ var args = [];

if (type) {
this._checkInTypes(type);
this.hasType(type);
if (!fn) {

@@ -273,3 +179,3 @@ this.events[type] = [];

}
this._checkInTypes(type);
this.hasType(type);
var events = this.events[type];

@@ -303,7 +209,9 @@ if (!events) {

};
EventEmitter.prototype._checkInTypes = function (type) {
EventEmitter.prototype.hasType = function (type) {
var types = this.eventTypes;
var inTypes = types[type] === type;
if (!inTypes) {
warn("EventEmitter has used unknown event type: \"" + type + "\", should be oneof [" + Object.keys(types) + "]");
var isType = types[type] === type;
if (!isType) {
warn("EventEmitter has used unknown event type: \"" + type + "\", should be oneof [" +
("" + Object.keys(types).map(function (_) { return JSON.stringify(_); })) +
"]");
}

@@ -313,2 +221,37 @@ };

}());
var EventRegister = /** @class */ (function () {
function EventRegister(wrapper, events) {
this.wrapper = wrapper;
this.events = events;
this.addDOMEvents();
}
EventRegister.prototype.destroy = function () {
this.removeDOMEvents();
this.events = [];
};
EventRegister.prototype.addDOMEvents = function () {
this.handleDOMEvents(addEvent);
};
EventRegister.prototype.removeDOMEvents = function () {
this.handleDOMEvents(removeEvent);
};
EventRegister.prototype.handleDOMEvents = function (eventOperation) {
var _this = this;
var wrapper = this.wrapper;
this.events.forEach(function (event) {
eventOperation(wrapper, event.name, _this, !!event.capture);
});
};
EventRegister.prototype.handleEvent = function (e) {
var eventType = e.type;
this.events.some(function (event) {
if (event.name === eventType) {
event.handler(e);
return true;
}
return false;
});
};
return EventRegister;
}());

@@ -453,3 +396,3 @@ var EventHandler = /** @class */ (function () {

Indicator.prototype._getKeysMap = function () {
if (this.direction === Direction.Vertical) {
if (this.direction === "vertical" /* Vertical */) {
return {

@@ -561,3 +504,3 @@ hasScroll: 'hasVerticalScroll',

// TODO freeScroll ?
if (this.direction === Direction.Vertical) {
if (this.direction === "vertical" /* Vertical */) {
this.bscroll.scrollTo(this.bscroll.x, newScrollPos);

@@ -621,2 +564,3 @@ }

ScrollBar.prototype._initIndicators = function (bscroll) {
var _this = this;
var _a = bscroll.options

@@ -626,11 +570,11 @@ .scrollbar, _b = _a.fade, fade = _b === void 0 ? true : _b, _c = _a.interactive, interactive = _c === void 0 ? false : _c;

var scrolls = {
scrollX: Direction.Horizontal,
scrollY: Direction.Vertical
scrollX: "horizontal" /* Horizontal */,
scrollY: "vertical" /* Vertical */
};
var indicators = [];
for (var _i = 0, _d = Object.entries(scrolls); _i < _d.length; _i++) {
var _e = _d[_i], scroll_1 = _e[0], direction = _e[1];
if (bscroll.options[scroll_1]) {
Object.keys(scrolls).forEach(function (key) {
var direction = scrolls[key];
if (bscroll.options[key]) {
indicatorOption = {
wrapper: this._createIndicatorElement(direction),
wrapper: _this._createIndicatorElement(direction),
direction: direction,

@@ -643,3 +587,3 @@ fade: fade,

}
}
});
return indicators;

@@ -669,8 +613,2 @@ };

};
ScrollBar.prototype._insertIndicatorsTo = function (bscroll) {
for (var _i = 0, _a = this.indicators; _i < _a.length; _i++) {
var indicator = _a[_i];
bscroll.wrapper.appendChild(indicator.wrapper);
}
};
ScrollBar.prototype.destroy = function () {

@@ -677,0 +615,0 @@ for (var _i = 0, _a = this.indicators; _i < _a.length; _i++) {

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

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).ScrollBar=e()}(this,function(){"use strict";var f,t;(t=f||(f={})).Horizontal="horizontal",t.Vertical="vertical";var i="undefined"!=typeof window,e=i&&navigator.userAgent.toLowerCase(),s=(e&&/wechatdevtools/.test(e),e&&e.indexOf("android"),i&&document.createElement("div").style),o=function(){if(!i)return!1;var t={webkit:"webkitTransform",Moz:"MozTransform",O:"OTransform",ms:"msTransform",standard:"transform"};for(var e in t)if(void 0!==s[t[e]])return e;return!1}();function r(t){return!1===o?t:"standard"===o?"transitionEnd"===t?"transitionend":t:o+t.charAt(0).toUpperCase()+t.substr(1)}o&&"standard"!==o&&o.toLowerCase();var n=r("transform"),a=(r("transition"),i&&r("perspective"),n),h=r("transitionTimingFunction"),l=r("transitionDuration");r("transitionDelay"),r("transformOrigin"),r("transitionEnd");var c="undefined"!=typeof window,p=c&&navigator.userAgent.toLowerCase(),d=(p&&/wechatdevtools/.test(p),p&&p.indexOf("android"),c&&document.createElement("div").style),u=function(){if(!c)return!1;var t={webkit:"webkitTransform",Moz:"MozTransform",O:"OTransform",ms:"msTransform",standard:"transform"};for(var e in t)if(void 0!==d[t[e]])return e;return!1}();function v(t){return!1===u?t:"standard"===u?"transitionEnd"===t?"transitionend":t:u+t.charAt(0).toUpperCase()+t.substr(1)}function y(t,e,i,s){t.addEventListener(e,i,{passive:!1,capture:!!s})}function m(t,e,i,s){t.removeEventListener(e,i,{capture:!!s})}u&&"standard"!==u&&u.toLowerCase();var b=v("transform"),g=v("transition"),w=(c&&v("perspective"),v("transitionTimingFunction"),v("transitionDuration"),v("transitionDelay"),v("transformOrigin"),v("transitionEnd"),c&&window);function S(){}c&&(w.requestAnimationFrame||w.webkitRequestAnimationFrame||w.mozRequestAnimationFrame||w.oRequestAnimationFrame),c&&(w.cancelAnimationFrame||w.webkitCancelAnimationFrame||w.mozCancelAnimationFrame||w.oCancelAnimationFrame);var x=(_.prototype.destroy=function(){this.removeDOMEvents(),this.events=[]},_.prototype.addDOMEvents=function(){this.handleDOMEvents(y)},_.prototype.removeDOMEvents=function(){this.handleDOMEvents(m)},_.prototype.handleDOMEvents=function(e){var i=this,s=this.wrapper;this.events.forEach(function(t){e(s,t.name,i,!!t.capture)})},_.prototype.handleEvent=function(e){var i=e.type;this.events.some(function(t){return t.name===i&&(t.handler(e),!0)})},_);function _(t,e){this.wrapper=t,this.events=e,this.addDOMEvents()}var E=(T.prototype.on=function(t,e,i){return void 0===i&&(i=this),this._checkInTypes(t),this.events[t]||(this.events[t]=[]),this.events[t].push([e,i]),this},T.prototype.once=function(i,s,o){var r=this;void 0===o&&(o=this),this._checkInTypes(i);var n=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];r.off(i,n),s.apply(o,t)};return n.fn=s,this.on(i,n),this},T.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 i=this.events[t];if(!i)return this;for(var s=i.length;s--;)(i[s][0]===e||i[s][0]&&i[s][0].fn===e)&&i.splice(s,1);return this}},T.prototype.trigger=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];this._checkInTypes(t);var s=this.events[t];if(s)for(var o,r=s.length,n=s.slice(),a=0;a<r;a++){var h=n[a],l=h[0],c=h[1];if(l&&!0===(o=l.apply(c,e)))return o}},T.prototype.registerType=function(t){var e=this;t.forEach(function(t){e.eventTypes[t]=t})},T.prototype.destroy=function(){this.events={},this.eventTypes={}},T.prototype._checkInTypes=function(t){var e=this.eventTypes;e[t]===t||function(t){console.error("[BScroll warn]: "+t)}('EventEmitter has used unknown event type: "'+t+'", should be oneof ['+Object.keys(e)+"]")},T);function T(t){this.events={},this.eventTypes={},this.registerType(t)}var k=(z.prototype._start=function(t){var e=t.touches?t.touches[0]:t;t.preventDefault(),t.stopPropagation(),this.initiated=!0,this.moved=!1,this.lastPoint=e[this.indicator.keysMap.pointPos];var i=this.bscroll.options.disableMouse;this.moveEventRegister=new x(window,[{name:i?"touchmove":"mousemove",handler:this._move.bind(this)}]),this.hooks.trigger("touchStart")},z.prototype._move=function(t){var e=(t.touches?t.touches[0]:t)[this.indicator.keysMap.pointPos];t.preventDefault(),t.stopPropagation();var i=e-this.lastPoint;if(this.lastPoint=e,!this.moved)return this.hooks.trigger("touchMove",this.moved,i),void(this.moved=!0);this.hooks.trigger("touchMove",this.moved,i)},z.prototype._end=function(t){this.initiated&&(this.initiated=!1,t.preventDefault(),t.stopPropagation(),this.moveEventRegister.destroy(),this.hooks.trigger("touchEnd",this.moved))},z.prototype.destroy=function(){this.startEventRegister.destroy(),this.moveEventRegister&&this.moveEventRegister.destroy(),this.endEventRegister.destroy()},z);function z(t,e){this.indicator=t,this.options=e,this.bscroll=t.bscroll,this.startEventRegister=new x(this.indicator.el,[{name:e.disableMouse?"touchstart":"mousedown",handler:this._start.bind(this)}]),this.endEventRegister=new x(window,[{name:e.disableMouse?"touchend":"mouseup",handler:this._end.bind(this)}]),this.hooks=new E(["touchStart","touchMove","touchEnd"])}var M=(P.prototype._listenHooks=function(t,e){var i=this,s=this.bscroll,o=s,r=s.scroller.translater.hooks,n=s.scroller.animater.hooks;if(this._listen(o,"refresh",this.refresh),this._listen(r,"translate",this.updatePosAndSize),this._listen(n,"time",function(t){i.setTransitionTime(t)}),this._listen(n,"timeFunction",function(t){i.setTransitionTimingFunction(t)}),t&&(this._listen(o,"scrollEnd",function(){i.fade()}),this._listen(o,"scrollStart",function(){i.fade(!0)}),s.eventTypes.mousewheelStart&&s.eventTypes.mousewheelEnd&&(this._listen(o,"mousewheelStart",function(){i.fade(!0)}),this._listen(o,"mousewheelEnd",function(){i.fade()}))),e){var a=this.bscroll.options.disableMouse;this.eventHandler=new k(this,{disableMouse:a});var h=this.eventHandler.hooks;this._listen(h,"touchStart",this.startHandler),this._listen(h,"touchMove",this.moveHandler),this._listen(h,"touchEnd",this.endHandler)}},P.prototype._getKeysMap=function(){return this.direction===f.Vertical?{hasScroll:"hasVerticalScroll",size:"height",wrapperSize:"clientHeight",scrollerSize:"scrollerHeight",maxScroll:"maxScrollY",pos:"y",pointPos:"pageY",translate:"translateY"}:{hasScroll:"hasHorizontalScroll",size:"width",wrapperSize:"clientWidth",scrollerSize:"scrollerWidth",maxScroll:"maxScrollX",pos:"x",pointPos:"pageX",translate:"translateX"}},P.prototype.fade=function(t){var e=t?250:500;this.wrapperStyle[l]=e+"ms",this.wrapperStyle.opacity=t?"1":"0",this.visible=t?1:0},P.prototype.refresh=function(){var t=this.keysMap.hasScroll;if(this._setShowBy(this.bscroll[t])){var e=this.keysMap,i=e.wrapperSize,s=e.scrollerSize,o=e.maxScroll;this.keyVals=this._refreshKeyValues(this.wrapper[i],this.bscroll[s],this.bscroll[o]),this.updatePosAndSize({x:this.bscroll.x,y:this.bscroll.y})}},P.prototype._setShowBy=function(t){return t?!(this.wrapper.style.display=""):!(this.wrapper.style.display="none")},P.prototype._refreshKeyValues=function(t,e,i){var s=Math.max(Math.round(t*t/(e||t||1)),8),o=t-s;return{initialSize:s,maxPos:o,sizeRatio:o/i}},P.prototype.updatePosAndSize=function(t){var e=this._refreshPosAndSizeValue(t,this.keyVals),i=e.pos,s=e.size;this.curPos=i,this._refreshPosAndSizeStyle(s,i)},P.prototype._refreshPosAndSizeValue=function(t,e){var i,s=this.keysMap.pos,o=e.sizeRatio,r=e.initialSize,n=e.maxPos,a=Math.round(o*t[s]);return a<0?(i=Math.max(r+3*a,8),a=0):n<a?a=n+r-(i=Math.max(r-3*(a-n),8)):i=r,{pos:a,size:i}},P.prototype._refreshPosAndSizeStyle=function(t,e){var i=this.keysMap,s=i.translate,o=i.size;this.elStyle[o]=t+"px",this.elStyle[a]=s+"("+e+"px)"+this.bscroll.options.translateZ},P.prototype.setTransitionTime=function(t){void 0===t&&(t=0),this.elStyle[l]=t+"ms"},P.prototype.setTransitionTimingFunction=function(t){this.elStyle[h]=t},P.prototype.startHandler=function(){this.setTransitionTime(),this.bscroll.trigger("beforeScrollStart")},P.prototype.moveHandler=function(t,e){t||this.bscroll.trigger("scrollStart");var i=this._calScrollDesPos(this.curPos,e,this.keyVals);this.direction===f.Vertical?this.bscroll.scrollTo(this.bscroll.x,i):this.bscroll.scrollTo(i,this.bscroll.y),this.bscroll.trigger("scroll",{x:this.bscroll.x,y:this.bscroll.y})},P.prototype._calScrollDesPos=function(t,e,i){var s=i.maxPos,o=i.sizeRatio,r=t+e;return r<0?r=0:s<r&&(r=s),Math.round(r/o)},P.prototype.endHandler=function(t){t&&this.bscroll.trigger("scrollEnd",{x:this.bscroll.x,y:this.bscroll.y})},P.prototype.destroy=function(){this.options.interactive&&this.eventHandler.destroy(),this.wrapper.parentNode.removeChild(this.wrapper),this.hooksHandlers.forEach(function(t){var e=t[0],i=t[1],s=t[2];e.off(i,s)}),this.hooksHandlers.length=0},P.prototype._listen=function(t,e,i){t.on(e,i,this),this.hooksHandlers.push([t,e,i])},P);function P(t,e){this.bscroll=t,this.options=e,this.keyVals={sizeRatio:1,maxPos:0,initialSize:0},this.curPos=0,this.hooksHandlers=[],this.wrapper=e.wrapper,this.wrapperStyle=this.wrapper.style,this.el=this.wrapper.children[0],this.elStyle=this.el.style,this.bscroll=t,this.direction=e.direction,this.keysMap=this._getKeysMap(),e.fade?(this.visible=0,this.wrapperStyle.opacity="0"):this.visible=1,this._listenHooks(e.fade,e.interactive),this.refresh()}function H(t){this.indicators=[],t.options.scrollbar&&(this.indicators=this._initIndicators(t),t.on("destroy",this.destroy,this))}return H.prototype._initIndicators=function(t){for(var e,i=t.options.scrollbar,s=i.fade,o=void 0===s||s,r=i.interactive,n=void 0!==r&&r,a={scrollX:f.Horizontal,scrollY:f.Vertical},h=[],l=0,c=Object.entries(a);l<c.length;l++){var p=c[l],d=p[0],u=p[1];t.options[d]&&(e={wrapper:this._createIndicatorElement(u),direction:u,fade:o,interactive:n},t.wrapper.appendChild(e.wrapper),h.push(new M(t,e)))}return h},H.prototype._createIndicatorElement=function(t){var e=document.createElement("div"),i=document.createElement("div");return e.style.cssText="position:absolute;z-index:9999;pointerEvents:none",i.style.cssText="box-sizing:border-box;position:absolute;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);border-radius:3px;",i.className="bscroll-indicator","horizontal"===t?(e.style.cssText+=";height:7px;left:2px;right:2px;bottom:0",i.style.height="100%",e.className="bscroll-horizontal-scrollbar"):(e.style.cssText+=";width:7px;bottom:2px;top:2px;right:1px",i.style.width="100%",e.className="bscroll-vertical-scrollbar"),e.style.cssText+=";overflow:hidden",e.appendChild(i),e},H.prototype._insertIndicatorsTo=function(t){for(var e=0,i=this.indicators;e<i.length;e++){var s=i[e];t.wrapper.appendChild(s.wrapper)}},H.prototype.destroy=function(){for(var t=0,e=this.indicators;t<e.length;t++)e[t].destroy()},H.pluginName="scrollbar",H});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t=t||self).ScrollBar=e()}(this,function(){"use strict";var i="undefined"!=typeof window,t=i&&navigator.userAgent.toLowerCase(),s=(t&&/wechatdevtools/.test(t),t&&t.indexOf("android"),i&&document.createElement("div").style),e=function(){if(!i)return!1;var t={webkit:"webkitTransform",Moz:"MozTransform",O:"OTransform",ms:"msTransform",standard:"transform"};for(var e in t)if(void 0!==s[t[e]])return e;return!1}();function o(t){return!1===e?t:"standard"===e?"transitionEnd"===t?"transitionend":t:e+t.charAt(0).toUpperCase()+t.substr(1)}function r(t,e,i,s){t.addEventListener(e,i,{passive:!1,capture:!!s})}function n(t,e,i,s){t.removeEventListener(e,i,{capture:!!s})}e&&"standard"!==e&&e.toLowerCase();var a=o("transform"),h=(o("transition"),i&&o("perspective"),a),l=o("transitionTimingFunction"),c=o("transitionDuration"),p=(o("transitionDelay"),o("transformOrigin"),o("transitionEnd"),i&&window);function d(){}i&&(p.requestAnimationFrame||p.webkitRequestAnimationFrame||p.mozRequestAnimationFrame||p.oRequestAnimationFrame),i&&(p.cancelAnimationFrame||p.webkitCancelAnimationFrame||p.mozCancelAnimationFrame||p.oCancelAnimationFrame);var u=(v.prototype.on=function(t,e,i){return void 0===i&&(i=this),this.hasType(t),this.events[t]||(this.events[t]=[]),this.events[t].push([e,i]),this},v.prototype.once=function(i,s,o){var r=this;void 0===o&&(o=this),this.hasType(i);var n=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];r.off(i,n),s.apply(o,t)};return n.fn=s,this.on(i,n),this},v.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 i=this.events[t];if(!i)return this;for(var s=i.length;s--;)(i[s][0]===e||i[s][0]&&i[s][0].fn===e)&&i.splice(s,1);return this}},v.prototype.trigger=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];this.hasType(t);var s=this.events[t];if(s)for(var o,r=s.length,n=s.slice(),a=0;a<r;a++){var h=n[a],l=h[0],c=h[1];if(l&&!0===(o=l.apply(c,e)))return o}},v.prototype.registerType=function(t){var e=this;t.forEach(function(t){e.eventTypes[t]=t})},v.prototype.destroy=function(){this.events={},this.eventTypes={}},v.prototype.hasType=function(t){var e=this.eventTypes;e[t]===t||function(t){console.error("[BScroll warn]: "+t)}('EventEmitter has used unknown event type: "'+t+'", should be oneof ['+Object.keys(e).map(function(t){return JSON.stringify(t)})+"]")},v);function v(t){this.events={},this.eventTypes={},this.registerType(t)}var f=(y.prototype.destroy=function(){this.removeDOMEvents(),this.events=[]},y.prototype.addDOMEvents=function(){this.handleDOMEvents(r)},y.prototype.removeDOMEvents=function(){this.handleDOMEvents(n)},y.prototype.handleDOMEvents=function(e){var i=this,s=this.wrapper;this.events.forEach(function(t){e(s,t.name,i,!!t.capture)})},y.prototype.handleEvent=function(e){var i=e.type;this.events.some(function(t){return t.name===i&&(t.handler(e),!0)})},y);function y(t,e){this.wrapper=t,this.events=e,this.addDOMEvents()}var m=(b.prototype._start=function(t){var e=t.touches?t.touches[0]:t;t.preventDefault(),t.stopPropagation(),this.initiated=!0,this.moved=!1,this.lastPoint=e[this.indicator.keysMap.pointPos];var i=this.bscroll.options.disableMouse;this.moveEventRegister=new f(window,[{name:i?"touchmove":"mousemove",handler:this._move.bind(this)}]),this.hooks.trigger("touchStart")},b.prototype._move=function(t){var e=(t.touches?t.touches[0]:t)[this.indicator.keysMap.pointPos];t.preventDefault(),t.stopPropagation();var i=e-this.lastPoint;if(this.lastPoint=e,!this.moved)return this.hooks.trigger("touchMove",this.moved,i),void(this.moved=!0);this.hooks.trigger("touchMove",this.moved,i)},b.prototype._end=function(t){this.initiated&&(this.initiated=!1,t.preventDefault(),t.stopPropagation(),this.moveEventRegister.destroy(),this.hooks.trigger("touchEnd",this.moved))},b.prototype.destroy=function(){this.startEventRegister.destroy(),this.moveEventRegister&&this.moveEventRegister.destroy(),this.endEventRegister.destroy()},b);function b(t,e){this.indicator=t,this.options=e,this.bscroll=t.bscroll,this.startEventRegister=new f(this.indicator.el,[{name:e.disableMouse?"touchstart":"mousedown",handler:this._start.bind(this)}]),this.endEventRegister=new f(window,[{name:e.disableMouse?"touchend":"mouseup",handler:this._end.bind(this)}]),this.hooks=new u(["touchStart","touchMove","touchEnd"])}var g=(w.prototype._listenHooks=function(t,e){var i=this,s=this.bscroll,o=s,r=s.scroller.translater.hooks,n=s.scroller.animater.hooks;if(this._listen(o,"refresh",this.refresh),this._listen(r,"translate",this.updatePosAndSize),this._listen(n,"time",function(t){i.setTransitionTime(t)}),this._listen(n,"timeFunction",function(t){i.setTransitionTimingFunction(t)}),t&&(this._listen(o,"scrollEnd",function(){i.fade()}),this._listen(o,"scrollStart",function(){i.fade(!0)}),s.eventTypes.mousewheelStart&&s.eventTypes.mousewheelEnd&&(this._listen(o,"mousewheelStart",function(){i.fade(!0)}),this._listen(o,"mousewheelEnd",function(){i.fade()}))),e){var a=this.bscroll.options.disableMouse;this.eventHandler=new m(this,{disableMouse:a});var h=this.eventHandler.hooks;this._listen(h,"touchStart",this.startHandler),this._listen(h,"touchMove",this.moveHandler),this._listen(h,"touchEnd",this.endHandler)}},w.prototype._getKeysMap=function(){return"vertical"===this.direction?{hasScroll:"hasVerticalScroll",size:"height",wrapperSize:"clientHeight",scrollerSize:"scrollerHeight",maxScroll:"maxScrollY",pos:"y",pointPos:"pageY",translate:"translateY"}:{hasScroll:"hasHorizontalScroll",size:"width",wrapperSize:"clientWidth",scrollerSize:"scrollerWidth",maxScroll:"maxScrollX",pos:"x",pointPos:"pageX",translate:"translateX"}},w.prototype.fade=function(t){var e=t?250:500;this.wrapperStyle[c]=e+"ms",this.wrapperStyle.opacity=t?"1":"0",this.visible=t?1:0},w.prototype.refresh=function(){var t=this.keysMap.hasScroll;if(this._setShowBy(this.bscroll[t])){var e=this.keysMap,i=e.wrapperSize,s=e.scrollerSize,o=e.maxScroll;this.keyVals=this._refreshKeyValues(this.wrapper[i],this.bscroll[s],this.bscroll[o]),this.updatePosAndSize({x:this.bscroll.x,y:this.bscroll.y})}},w.prototype._setShowBy=function(t){return t?!(this.wrapper.style.display=""):!(this.wrapper.style.display="none")},w.prototype._refreshKeyValues=function(t,e,i){var s=Math.max(Math.round(t*t/(e||t||1)),8),o=t-s;return{initialSize:s,maxPos:o,sizeRatio:o/i}},w.prototype.updatePosAndSize=function(t){var e=this._refreshPosAndSizeValue(t,this.keyVals),i=e.pos,s=e.size;this.curPos=i,this._refreshPosAndSizeStyle(s,i)},w.prototype._refreshPosAndSizeValue=function(t,e){var i,s=this.keysMap.pos,o=e.sizeRatio,r=e.initialSize,n=e.maxPos,a=Math.round(o*t[s]);return a<0?(i=Math.max(r+3*a,8),a=0):n<a?a=n+r-(i=Math.max(r-3*(a-n),8)):i=r,{pos:a,size:i}},w.prototype._refreshPosAndSizeStyle=function(t,e){var i=this.keysMap,s=i.translate,o=i.size;this.elStyle[o]=t+"px",this.elStyle[h]=s+"("+e+"px)"+this.bscroll.options.translateZ},w.prototype.setTransitionTime=function(t){void 0===t&&(t=0),this.elStyle[c]=t+"ms"},w.prototype.setTransitionTimingFunction=function(t){this.elStyle[l]=t},w.prototype.startHandler=function(){this.setTransitionTime(),this.bscroll.trigger("beforeScrollStart")},w.prototype.moveHandler=function(t,e){t||this.bscroll.trigger("scrollStart");var i=this._calScrollDesPos(this.curPos,e,this.keyVals);"vertical"===this.direction?this.bscroll.scrollTo(this.bscroll.x,i):this.bscroll.scrollTo(i,this.bscroll.y),this.bscroll.trigger("scroll",{x:this.bscroll.x,y:this.bscroll.y})},w.prototype._calScrollDesPos=function(t,e,i){var s=i.maxPos,o=i.sizeRatio,r=t+e;return r<0?r=0:s<r&&(r=s),Math.round(r/o)},w.prototype.endHandler=function(t){t&&this.bscroll.trigger("scrollEnd",{x:this.bscroll.x,y:this.bscroll.y})},w.prototype.destroy=function(){this.options.interactive&&this.eventHandler.destroy(),this.wrapper.parentNode.removeChild(this.wrapper),this.hooksHandlers.forEach(function(t){var e=t[0],i=t[1],s=t[2];e.off(i,s)}),this.hooksHandlers.length=0},w.prototype._listen=function(t,e,i){t.on(e,i,this),this.hooksHandlers.push([t,e,i])},w);function w(t,e){this.bscroll=t,this.options=e,this.keyVals={sizeRatio:1,maxPos:0,initialSize:0},this.curPos=0,this.hooksHandlers=[],this.wrapper=e.wrapper,this.wrapperStyle=this.wrapper.style,this.el=this.wrapper.children[0],this.elStyle=this.el.style,this.bscroll=t,this.direction=e.direction,this.keysMap=this._getKeysMap(),e.fade?(this.visible=0,this.wrapperStyle.opacity="0"):this.visible=1,this._listenHooks(e.fade,e.interactive),this.refresh()}function S(t){this.indicators=[],t.options.scrollbar&&(this.indicators=this._initIndicators(t),t.on("destroy",this.destroy,this))}return S.prototype._initIndicators=function(i){var s,o=this,t=i.options.scrollbar,e=t.fade,r=void 0===e||e,n=t.interactive,a=void 0!==n&&n,h={scrollX:"horizontal",scrollY:"vertical"},l=[];return Object.keys(h).forEach(function(t){var e=h[t];i.options[t]&&(s={wrapper:o._createIndicatorElement(e),direction:e,fade:r,interactive:a},i.wrapper.appendChild(s.wrapper),l.push(new g(i,s)))}),l},S.prototype._createIndicatorElement=function(t){var e=document.createElement("div"),i=document.createElement("div");return e.style.cssText="position:absolute;z-index:9999;pointerEvents:none",i.style.cssText="box-sizing:border-box;position:absolute;background:rgba(0,0,0,0.5);border:1px solid rgba(255,255,255,0.9);border-radius:3px;",i.className="bscroll-indicator","horizontal"===t?(e.style.cssText+=";height:7px;left:2px;right:2px;bottom:0",i.style.height="100%",e.className="bscroll-horizontal-scrollbar"):(e.style.cssText+=";width:7px;bottom:2px;top:2px;right:1px",i.style.width="100%",e.className="bscroll-vertical-scrollbar"),e.style.cssText+=";overflow:hidden",e.appendChild(i),e},S.prototype.destroy=function(){for(var t=0,e=this.indicators;t<e.length;t++)e[t].destroy()},S.pluginName="scrollbar",S});

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

import EventRegister from '@better-scroll/core/src/base/EventRegister';
import EventEmitter from '@better-scroll/core/src/base/EventEmitter';
import BScroll from '@better-scroll/core';
import { EventRegister, EventEmitter } from '@better-scroll/shared-utils';
import Indicator from './indicator';

@@ -5,0 +4,0 @@ interface EventHandlerOptions {

import BScroll from '@better-scroll/core';
import Indicator from './indicator';
export declare const enum Direction {
Horizontal = "horizontal",
Vertical = "vertical"
}
export declare type scrollbarOptions = Partial<ScrollbarConfig> | boolean;

@@ -19,4 +23,3 @@ export interface ScrollbarConfig {

private _createIndicatorElement;
private _insertIndicatorsTo;
destroy(): void;
}

@@ -1,5 +0,4 @@

import BScroll from '@better-scroll/core';
import { Direction } from './const';
import BScroll, { TranslaterPoint } from '@better-scroll/core';
import EventHandler from './event-handler';
import { TranslaterPoint } from '@better-scroll/core/src/translater';
import { Direction } from './index';
export interface IndicatorOption {

@@ -6,0 +5,0 @@ wrapper: HTMLElement;

{
"name": "@better-scroll/scroll-bar",
"version": "2.0.0-beta.2",
"version": "2.0.0-beta.4",
"description": "scrollbar is used to BetterScroll, which behaves like browser scrollbar",

@@ -30,5 +30,5 @@ "author": "huangyi <ustbhuangyi@gmail.com>",

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

@@ -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 EventHandler = jest.fn().mockImplementation(() => {

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

import Indicator from '@better-scroll/scroll-bar/src/indicator'
import { Options } from '@better-scroll/core/src/Options'
import BScroll from '@better-scroll/core'
import Indicator from '../indicator'
import BScroll, { Options } from '@better-scroll/core'
jest.mock('@better-scroll/core')
jest.mock('@better-scroll/core/src/Options')
jest.mock('@better-scroll/scroll-bar/src/indicator')
jest.mock('../indicator')
import ScrollBar from '@better-scroll/scroll-bar'
import ScrollBar from '../index'

@@ -11,0 +9,0 @@ describe('scroll-bar unit tests', () => {

import BScroll from '@better-scroll/core'
import EventHandler from '@better-scroll/scroll-bar/src/event-handler'
import EventHandler from '../event-handler'
import { style } from '@better-scroll/shared-utils'
jest.mock('@better-scroll/core')
jest.mock('@better-scroll/core/src/Options')
jest.mock('@better-scroll/shared-utils/src/dom')
jest.mock('@better-scroll/scroll-bar/src/event-handler')
jest.mock('../event-handler')
import Indicator, {
IndicatorOption
} from '@better-scroll/scroll-bar/src/indicator'
import { Direction } from '@better-scroll/scroll-bar/src/const'
import Indicator, { IndicatorOption } from '../indicator'
import { Direction } from '../index'
import { mockDomClient } from '@better-scroll/core/src/__tests__/__utils__/layout'

@@ -73,3 +70,3 @@

expect(indicator.el.style.width).toBe('50px')
expect(indicator.el.style.transform).toBe('translateX(5px)')
expect(indicator.el.style[style.transform as any]).toBe('translateX(5px)')
})

@@ -85,3 +82,3 @@

expect(indicator.el.style.height).toBe('50px')
expect(indicator.el.style.transform).toBe('translateY(5px)')
expect(indicator.el.style[style.transform as any]).toBe('translateY(5px)')
})

@@ -143,3 +140,5 @@ })

expect(indicator.wrapperStyle.opacity).toBe('1')
expect(indicator.wrapperStyle.transitionDuration).toBe('250ms')
expect(indicator.wrapperStyle[style.transitionDuration as any]).toBe(
'250ms'
)
})

@@ -154,3 +153,5 @@

expect(indicator.wrapperStyle.opacity).toBe('0')
expect(indicator.wrapperStyle.transitionDuration).toBe('500ms')
expect(indicator.wrapperStyle[style.transitionDuration as any]).toBe(
'500ms'
)
})

@@ -157,0 +158,0 @@ })

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

import EventRegister from '@better-scroll/core/src/base/EventRegister'
import EventEmitter from '@better-scroll/core/src/base/EventEmitter'
import BScroll from '@better-scroll/core'
import { TouchEvent } from '@better-scroll/shared-utils/src/Touch'
import {
TouchEvent,
EventRegister,
EventEmitter
} from '@better-scroll/shared-utils'
import Indicator from './indicator'

@@ -6,0 +8,0 @@

import BScroll from '@better-scroll/core'
import Indicator, { IndicatorOption } from './indicator'
import { Direction } from './const'
export const enum Direction {
Horizontal = 'horizontal',
Vertical = 'vertical'
}
// augmentation for Options

@@ -36,10 +40,11 @@ export type scrollbarOptions = Partial<ScrollbarConfig> | boolean

let scrolls = {
let scrolls: { [key: string]: Direction } = {
scrollX: Direction.Horizontal,
scrollY: Direction.Vertical
}
const indicators = []
const indicators: Indicator[] = []
for (let [scroll, direction] of Object.entries(scrolls)) {
if (bscroll.options[scroll]) {
Object.keys(scrolls).forEach((key: string) => {
const direction: Direction = scrolls[key]
if (bscroll.options[key]) {
indicatorOption = {

@@ -54,4 +59,3 @@ wrapper: this._createIndicatorElement(direction),

}
}
})
return indicators

@@ -87,8 +91,2 @@ }

private _insertIndicatorsTo(bscroll: BScroll): void {
for (let indicator of this.indicators) {
bscroll.wrapper.appendChild(indicator.wrapper)
}
}
destroy(): void {

@@ -95,0 +93,0 @@ for (let indicator of this.indicators) {

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

import BScroll from '@better-scroll/core'
import { Direction } from './const'
import { style } from '@better-scroll/shared-utils/src/dom'
import BScroll, { TranslaterPoint } from '@better-scroll/core'
import { style, EventEmitter } from '@better-scroll/shared-utils'
import EventHandler from './event-handler'
import { TranslaterPoint } from '@better-scroll/core/src/translater'
import EventEmitter from '@better-scroll/core/src/base/EventEmitter'
import { Direction } from './index'

@@ -8,0 +6,0 @@ export interface IndicatorOption {

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