Socket
Socket
Sign inDemoInstall

sweet-scroll

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sweet-scroll - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

11

CHANGELOG.md

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

## 3.0.1
### Bugfixes
* Fix bug that did not scroll when opening devtools [#44](https://github.com/tsuyoshiwada/sweet-scroll/pull/44) (Resolves [#38](https://github.com/tsuyoshiwada/sweet-scroll/issues/38))
- Big thanks :pray:
- [@adamkarminski](https://github.com/adamkarminski)
- [@amritk](https://github.com/amritk)
- [@h6ah4i](https://github.com/h6ah4i)
## 3.0.0

@@ -2,0 +13,0 @@

31

package.json
{
"name": "sweet-scroll",
"version": "3.0.0",
"version": "3.0.1",
"description": "Modern and the sweet smooth scroll library.",

@@ -8,4 +8,4 @@ "main": "sweet-scroll.js",

"scripts": {
"start": "npm run build:watch & npm run docs",
"build": "npm run build:bundle && npm run build:minify && npm run build:decls",
"start": "npm-run-all -p build:watch docs",
"build": "npm-run-all build:bundle build:minify build:decls",
"build:bundle": "rollup -c",

@@ -17,10 +17,10 @@ "build:minify": "uglifyjs -c -m --comments -o sweet-scroll.min.js -- sweet-scroll.js",

"clean": "rm -rf decls .rpt2_cache",
"test": "npm run test:lint && npm run test:unit",
"test:unit": "npm run test:browser && npm run test:node",
"test": "npm-run-all test:lint test:unit",
"test:unit": "npm-run-all test:browser test:node",
"test:browser": "jest --setupTestFrameworkScriptFile=./jest/setup-for-browser.js --testPathPattern \"browser.spec.ts\"",
"test:browser:watch": "npm run test:browser -- --watch",
"test:node": "jest --env=node \"**/__tests__/*.node.spec.ts\" --testPathPattern \"node.spec.ts\"",
"test:node": "jest --env=node --testPathPattern \"node.spec.ts\"",
"test:node:watch": "npm run test:node -- --watch",
"test:lint": "tslint -c tslint.json \"src/**/*.ts\"",
"docs": "npm run docs:server & npm run docs:watch",
"docs": "npm-run-all -p docs:server docs:watch",
"docs:server": "browser-sync start -s docs -f \"docs/**/*\" --no-notify --no-ghost-mode --no-open",

@@ -57,14 +57,15 @@ "docs:build": "cpx sweet-scroll.js docs",

"devDependencies": {
"@types/jest": "^21.1.8",
"browser-sync": "^2.18.13",
"@types/jest": "^22.2.2",
"browser-sync": "^2.23.6",
"cpx": "^1.5.0",
"dts-bundle": "^0.7.3",
"gh-pages": "^1.1.0",
"jest": "^21.2.1",
"rollup": "^0.52.1",
"rollup-plugin-typescript2": "^0.8.2",
"jest": "^22.4.3",
"npm-run-all": "^4.1.2",
"rollup": "^0.57.1",
"rollup-plugin-typescript2": "^0.12.0",
"rollup-watch": "^4.3.1",
"tslint": "^5.8.0",
"typescript": "^2.6.1",
"uglify-es": "^3.2.0"
"tslint": "^5.9.1",
"typescript": "^2.7.2",
"uglify-es": "^3.3.9"
},

@@ -71,0 +72,0 @@ "jest": {

@@ -1,696 +0,689 @@

/*! @preserve sweet-scroll v3.0.0 - tsuyoshiwada | MIT License */
/*! @preserve sweet-scroll v3.0.1 - tsuyoshiwada | MIT License */
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.SweetScroll = factory());
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
typeof define === 'function' && define.amd ? define(factory) :
(global.SweetScroll = factory());
}(this, (function () { 'use strict';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
var __assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
var __assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
// @link https://github.com/JedWatson/exenv/blob/master/index.js
var canUseDOM = !!(typeof window !== 'undefined' &&
window.document &&
window.document.createElement);
var canUseHistory = !canUseDOM
? false
: (window.history &&
'pushState' in window.history &&
window.location.protocol !== 'file:');
var canUsePassiveOption = (function () {
var support = false;
if (!canUseDOM) {
// @link https://github.com/JedWatson/exenv/blob/master/index.js
var canUseDOM = !!(typeof window !== 'undefined' &&
window.document &&
window.document.createElement);
var canUseHistory = !canUseDOM
? false
: (window.history &&
'pushState' in window.history &&
window.location.protocol !== 'file:');
var canUsePassiveOption = (function () {
var support = false;
if (!canUseDOM) {
return support;
}
/* tslint:disable:no-empty */
try {
window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
get: function () {
support = true;
},
}));
}
catch (e) { }
/* tslint:enable */
return support;
}
/* tslint:disable:no-empty */
try {
window.addEventListener('test', null, Object.defineProperty({}, 'passive', {
get: function () {
support = true;
},
}));
}
catch (e) { }
/* tslint:enable */
return support;
})();
})();
var isString = function (obj) { return typeof obj === 'string'; };
var isFunction = function (obj) { return typeof obj === 'function'; };
var isArray = function (obj) { return Array.isArray(obj); };
var isNumeric = function (obj) { return !isArray(obj) && ((obj - parseFloat(obj)) + 1) >= 0; };
var isElement = function (obj) { return obj instanceof Element; };
var hasProp = function (obj, key) { return (obj && obj.hasOwnProperty(key)); };
var isString = function (obj) { return typeof obj === 'string'; };
var isFunction = function (obj) { return typeof obj === 'function'; };
var isArray = function (obj) { return Array.isArray(obj); };
var isNumeric = function (obj) { return !isArray(obj) && ((obj - parseFloat(obj)) + 1) >= 0; };
var isElement = function (obj) { return obj instanceof Element; };
var hasProp = function (obj, key) { return (obj && obj.hasOwnProperty(key)); };
var raf = canUseDOM ? window.requestAnimationFrame.bind(window) : null;
var caf = canUseDOM ? window.cancelAnimationFrame.bind(window) : null;
var raf = canUseDOM ? window.requestAnimationFrame.bind(window) : null;
var caf = canUseDOM ? window.cancelAnimationFrame.bind(window) : null;
/* tslint:disable:curly */
/* tslint:disable:no-conditional-assignment */
var cos = Math.cos;
var sin = Math.sin;
var pow = Math.pow;
var sqrt = Math.sqrt;
var PI = Math.PI;
var easings = {
linear: function (p) { return p; },
easeInQuad: function (_, t, b, c, d) { return (c * (t /= d) * t + b); },
easeOutQuad: function (_, t, b, c, d) { return (-c * (t /= d) * (t - 2) + b); },
easeInOutQuad: function (_, t, b, c, d) { return ((t /= d / 2) < 1 ? c / 2 * t * t + b : -c / 2 * ((--t) * (t - 2) - 1) + b); },
easeInCubic: function (_, t, b, c, d) { return (c * (t /= d) * t * t + b); },
easeOutCubic: function (_, t, b, c, d) { return (c * ((t = t / d - 1) * t * t + 1) + b); },
easeInOutCubic: function (_, t, b, c, d) { return ((t /= d / 2) < 1 ? c / 2 * t * t * t + b : c / 2 * ((t -= 2) * t * t + 2) + b); },
easeInQuart: function (_, t, b, c, d) { return (c * (t /= d) * t * t * t + b); },
easeOutQuart: function (_, t, b, c, d) { return (-c * ((t = t / d - 1) * t * t * t - 1) + b); },
easeInOutQuart: function (_, t, b, c, d) { return ((t /= d / 2) < 1 ? c / 2 * t * t * t * t + b : -c / 2 * ((t -= 2) * t * t * t - 2) + b); },
easeInQuint: function (_, t, b, c, d) { return (c * (t /= d) * t * t * t * t + b); },
easeOutQuint: function (_, t, b, c, d) { return (c * ((t = t / d - 1) * t * t * t * t + 1) + b); },
easeInOutQuint: function (_, t, b, c, d) { return ((t /= d / 2) < 1 ? c / 2 * t * t * t * t * t + b : c / 2 * ((t -= 2) * t * t * t * t + 2) + b); },
easeInSine: function (_, t, b, c, d) { return (-c * cos(t / d * (PI / 2)) + c + b); },
easeOutSine: function (_, t, b, c, d) { return (c * sin(t / d * (PI / 2)) + b); },
easeInOutSine: function (_, t, b, c, d) { return (-c / 2 * (cos(PI * t / d) - 1) + b); },
easeInExpo: function (_, t, b, c, d) { return ((t === 0) ? b : c * pow(2, 10 * (t / d - 1)) + b); },
easeOutExpo: function (_, t, b, c, d) { return ((t === d) ? b + c : c * (-pow(2, -10 * t / d) + 1) + b); },
easeInOutExpo: function (_, t, b, c, d) {
if (t === 0)
return b;
if (t === d)
return b + c;
if ((t /= d / 2) < 1)
return c / 2 * pow(2, 10 * (t - 1)) + b;
return c / 2 * (-pow(2, -10 * --t) + 2) + b;
},
easeInCirc: function (_, t, b, c, d) { return (-c * (sqrt(1 - (t /= d) * t) - 1) + b); },
easeOutCirc: function (_, t, b, c, d) { return (c * sqrt(1 - (t = t / d - 1) * t) + b); },
easeInOutCirc: function (_, t, b, c, d) { return ((t /= d / 2) < 1 ? -c / 2 * (sqrt(1 - t * t) - 1) + b : c / 2 * (sqrt(1 - (t -= 2) * t) + 1) + b); },
};
/* tslint:disable:curly */
/* tslint:disable:no-conditional-assignment */
var cos = Math.cos, sin = Math.sin, pow = Math.pow, sqrt = Math.sqrt, PI = Math.PI;
var easings = {
linear: function (p) { return p; },
easeInQuad: function (_, t, b, c, d) { return (c * (t /= d) * t + b); },
easeOutQuad: function (_, t, b, c, d) { return (-c * (t /= d) * (t - 2) + b); },
easeInOutQuad: function (_, t, b, c, d) { return ((t /= d / 2) < 1 ? c / 2 * t * t + b : -c / 2 * ((--t) * (t - 2) - 1) + b); },
easeInCubic: function (_, t, b, c, d) { return (c * (t /= d) * t * t + b); },
easeOutCubic: function (_, t, b, c, d) { return (c * ((t = t / d - 1) * t * t + 1) + b); },
easeInOutCubic: function (_, t, b, c, d) { return ((t /= d / 2) < 1 ? c / 2 * t * t * t + b : c / 2 * ((t -= 2) * t * t + 2) + b); },
easeInQuart: function (_, t, b, c, d) { return (c * (t /= d) * t * t * t + b); },
easeOutQuart: function (_, t, b, c, d) { return (-c * ((t = t / d - 1) * t * t * t - 1) + b); },
easeInOutQuart: function (_, t, b, c, d) { return ((t /= d / 2) < 1 ? c / 2 * t * t * t * t + b : -c / 2 * ((t -= 2) * t * t * t - 2) + b); },
easeInQuint: function (_, t, b, c, d) { return (c * (t /= d) * t * t * t * t + b); },
easeOutQuint: function (_, t, b, c, d) { return (c * ((t = t / d - 1) * t * t * t * t + 1) + b); },
easeInOutQuint: function (_, t, b, c, d) { return ((t /= d / 2) < 1 ? c / 2 * t * t * t * t * t + b : c / 2 * ((t -= 2) * t * t * t * t + 2) + b); },
easeInSine: function (_, t, b, c, d) { return (-c * cos(t / d * (PI / 2)) + c + b); },
easeOutSine: function (_, t, b, c, d) { return (c * sin(t / d * (PI / 2)) + b); },
easeInOutSine: function (_, t, b, c, d) { return (-c / 2 * (cos(PI * t / d) - 1) + b); },
easeInExpo: function (_, t, b, c, d) { return ((t === 0) ? b : c * pow(2, 10 * (t / d - 1)) + b); },
easeOutExpo: function (_, t, b, c, d) { return ((t === d) ? b + c : c * (-pow(2, -10 * t / d) + 1) + b); },
easeInOutExpo: function (_, t, b, c, d) {
if (t === 0)
return b;
if (t === d)
return b + c;
if ((t /= d / 2) < 1)
return c / 2 * pow(2, 10 * (t - 1)) + b;
return c / 2 * (-pow(2, -10 * --t) + 2) + b;
},
easeInCirc: function (_, t, b, c, d) { return (-c * (sqrt(1 - (t /= d) * t) - 1) + b); },
easeOutCirc: function (_, t, b, c, d) { return (c * sqrt(1 - (t = t / d - 1) * t) + b); },
easeInOutCirc: function (_, t, b, c, d) { return ((t /= d / 2) < 1 ? -c / 2 * (sqrt(1 - t * t) - 1) + b : c / 2 * (sqrt(1 - (t -= 2) * t) + 1) + b); },
};
var directionMethodMap = {
y: 'scrollTop',
x: 'scrollLeft',
};
var directionPropMap = {
y: 'pageYOffset',
x: 'pageXOffset',
};
var getScroll = function ($el, direction) { return ($el[directionMethodMap[direction]]); };
var setScroll = function ($el, offset, direction) {
$el[directionMethodMap[direction]] = offset;
};
var getOffset = function ($el, $context) {
var rect = $el.getBoundingClientRect();
if (rect.width || rect.height) {
var scroll_1 = { top: 0, left: 0 };
var $ctx = void 0;
if (isRootContainer($context)) {
$ctx = document.documentElement;
scroll_1.top = window[directionPropMap.y];
scroll_1.left = window[directionPropMap.x];
var directionMethodMap = {
y: 'scrollTop',
x: 'scrollLeft',
};
var directionPropMap = {
y: 'pageYOffset',
x: 'pageXOffset',
};
var getScroll = function ($el, direction) { return ($el[directionMethodMap[direction]]); };
var setScroll = function ($el, offset, direction) {
$el[directionMethodMap[direction]] = offset;
};
var getOffset = function ($el, $context) {
var rect = $el.getBoundingClientRect();
if (rect.width || rect.height) {
var scroll_1 = { top: 0, left: 0 };
var $ctx = void 0;
if (isRootContainer($context)) {
$ctx = document.documentElement;
scroll_1.top = window[directionPropMap.y];
scroll_1.left = window[directionPropMap.x];
}
else {
$ctx = $context;
var cRect = $ctx.getBoundingClientRect();
scroll_1.top = (cRect.top * -1) + $ctx[directionMethodMap.y];
scroll_1.left = (cRect.left * -1) + $ctx[directionMethodMap.x];
}
return {
top: (rect.top + scroll_1.top) - $ctx.clientTop,
left: (rect.left + scroll_1.left) - $ctx.clientLeft,
};
}
else {
$ctx = $context;
var cRect = $ctx.getBoundingClientRect();
scroll_1.top = (cRect.top * -1) + $ctx[directionMethodMap.y];
scroll_1.left = (cRect.left * -1) + $ctx[directionMethodMap.x];
}
return {
top: (rect.top + scroll_1.top) - $ctx.clientTop,
left: (rect.left + scroll_1.left) - $ctx.clientLeft,
};
}
return rect;
};
return rect;
};
var $$ = function (selector) { return (Array.prototype.slice.call((!selector ? [] : document.querySelectorAll(selector)))); };
var $ = function (selector) { return ($$(selector).shift() || null); };
var matches = function ($el, selector) {
if (isElement(selector)) {
return $el === selector;
}
var results = $$(selector);
var i = results.length;
// tslint:disable-next-line no-empty
while (--i >= 0 && results[i] !== $el) { }
return i > -1;
};
var isRootContainer = function ($el) { return ($el === document.documentElement || $el === document.body); };
var findScrollable = function (selectors, direction) {
var method = directionMethodMap[direction];
var $elements = isElement(selectors) ? [selectors] : $$(selectors);
var $div = document.createElement('div');
for (var i = 0; i < $elements.length; i += 1) {
var $el = $elements[i];
var $result = null;
if ($el[method] > 0) {
$result = $el;
var $$ = function (selector) { return (Array.prototype.slice.call((!selector ? [] : document.querySelectorAll(selector)))); };
var $ = function (selector) { return ($$(selector).shift() || null); };
var matches = function ($el, selector) {
if (isElement(selector)) {
return $el === selector;
}
else {
var outerWidth_1 = window.outerWidth, innerWidth_1 = window.innerWidth;
var zoom = outerWidth_1 ? outerWidth_1 / innerWidth_1 : 1;
$div.style.width = $el.clientWidth + 1 + "px";
$div.style.height = $el.clientHeight + 1 + "px";
$el.appendChild($div);
$el[method] = 1.5 / zoom;
var results = $$(selector);
var i = results.length;
// tslint:disable-next-line no-empty
while (--i >= 0 && results[i] !== $el) { }
return i > -1;
};
var isRootContainer = function ($el) { return ($el === document.documentElement || $el === document.body); };
var findScrollable = function (selectors, direction) {
var method = directionMethodMap[direction];
var $elements = isElement(selectors) ? [selectors] : $$(selectors);
var $div = document.createElement('div');
for (var i = 0; i < $elements.length; i += 1) {
var $el = $elements[i];
var $result = null;
if ($el[method] > 0) {
$result = $el;
}
$el[method] = 0;
$el.removeChild($div);
else {
var outerWidth_1 = window.outerWidth, innerWidth_1 = window.innerWidth;
var zoom = outerWidth_1 ? outerWidth_1 / innerWidth_1 : 1;
$div.style.width = $el.clientWidth + 1 + "px";
$div.style.height = $el.clientHeight + 1 + "px";
$el.appendChild($div);
$el[method] = Math.max(1, 1.5 / zoom);
if ($el[method] > 0) {
$result = $el;
}
$el[method] = 0;
$el.removeChild($div);
}
if ($result) {
return $result;
}
}
if ($result) {
return $result;
}
}
return null;
};
return null;
};
var getHeight = function ($el) { return (Math.max($el.scrollHeight, $el.clientHeight, $el.offsetHeight)); };
var getWidth = function ($el) { return (Math.max($el.scrollWidth, $el.clientWidth, $el.offsetWidth)); };
var getSize = function ($el) { return ({
width: getWidth($el),
height: getHeight($el),
}); };
var getViewportAndElementSizes = function ($el) {
var isRoot = isRootContainer($el);
return {
viewport: {
width: isRoot
? Math.min(window.innerWidth, document.documentElement.clientWidth)
: $el.clientWidth,
height: isRoot ? window.innerHeight : $el.clientHeight,
},
size: isRoot
? {
width: Math.max(getWidth(document.body), getWidth(document.documentElement)),
height: Math.max(getHeight(document.body), getHeight(document.documentElement)),
}
: getSize($el),
var getHeight = function ($el) { return (Math.max($el.scrollHeight, $el.clientHeight, $el.offsetHeight)); };
var getWidth = function ($el) { return (Math.max($el.scrollWidth, $el.clientWidth, $el.offsetWidth)); };
var getSize = function ($el) { return ({
width: getWidth($el),
height: getHeight($el),
}); };
var getViewportAndElementSizes = function ($el) {
var isRoot = isRootContainer($el);
return {
viewport: {
width: isRoot
? Math.min(window.innerWidth, document.documentElement.clientWidth)
: $el.clientWidth,
height: isRoot ? window.innerHeight : $el.clientHeight,
},
size: isRoot
? {
width: Math.max(getWidth(document.body), getWidth(document.documentElement)),
height: Math.max(getHeight(document.body), getHeight(document.documentElement)),
}
: getSize($el),
};
};
};
var wheelEventName = (function () {
if (!canUseDOM) {
return 'wheel';
}
return 'onwheel' in document ? 'wheel' : 'mousewheel';
})();
var eventName = function (name) { return (name === 'wheel' ? wheelEventName : name); };
var apply = function ($el, method, event, listener, passive) {
event.split(' ').forEach(function (name) {
$el[method](eventName(name), listener, canUsePassiveOption ? { passive: passive } : false);
});
};
var addEvent = function ($el, event, listener, passive) {
apply($el, 'addEventListener', event, listener, passive);
};
var removeEvent = function ($el, event, listener, passive) {
apply($el, 'removeEventListener', event, listener, passive);
};
var wheelEventName = (function () {
if (!canUseDOM) {
return 'wheel';
}
return 'onwheel' in document ? 'wheel' : 'mousewheel';
})();
var eventName = function (name) { return (name === 'wheel' ? wheelEventName : name); };
var apply = function ($el, method, event, listener, passive) {
event.split(' ').forEach(function (name) {
$el[method](eventName(name), listener, canUsePassiveOption ? { passive: passive } : false);
});
};
var addEvent = function ($el, event, listener, passive) {
apply($el, 'addEventListener', event, listener, passive);
};
var removeEvent = function ($el, event, listener, passive) {
apply($el, 'removeEventListener', event, listener, passive);
};
var reRelativeToken = /^(\+|-)=(\d+(?:\.\d+)?)$/;
var parseCoordinate = function (coordinate, enableVertical) {
var res = { top: 0, left: 0, relative: false };
// Object ({ top: {n}, left: {n} })
if (hasProp(coordinate, 'top') || hasProp(coordinate, 'left')) {
res = __assign({}, res, coordinate);
// Array ([{n}, [{n}])
}
else if (isArray(coordinate)) {
if (coordinate.length > 1) {
res.top = coordinate[0];
res.left = coordinate[1];
var reRelativeToken = /^(\+|-)=(\d+(?:\.\d+)?)$/;
var parseCoordinate = function (coordinate, enableVertical) {
var res = { top: 0, left: 0, relative: false };
// Object ({ top: {n}, left: {n} })
if (hasProp(coordinate, 'top') || hasProp(coordinate, 'left')) {
res = __assign({}, res, coordinate);
// Array ([{n}, [{n}])
}
else if (coordinate.length === 1) {
res.top = enableVertical ? coordinate[0] : 0;
res.left = !enableVertical ? coordinate[0] : 0;
else if (isArray(coordinate)) {
if (coordinate.length > 1) {
res.top = coordinate[0];
res.left = coordinate[1];
}
else if (coordinate.length === 1) {
res.top = enableVertical ? coordinate[0] : 0;
res.left = !enableVertical ? coordinate[0] : 0;
}
else {
return null;
}
// Number
}
else {
return null;
else if (isNumeric(coordinate)) {
if (enableVertical) {
res.top = coordinate;
}
else {
res.left = coordinate;
}
// String ('+={n}', '-={n}')
}
// Number
}
else if (isNumeric(coordinate)) {
if (enableVertical) {
res.top = coordinate;
else if (isString(coordinate)) {
var m = coordinate.trim().match(reRelativeToken);
if (!m) {
return null;
}
var op = m[1];
var val = parseInt(m[2], 10);
if (op === '+') {
res.top = enableVertical ? val : 0;
res.left = !enableVertical ? val : 0;
}
else {
res.top = enableVertical ? -val : 0;
res.left = !enableVertical ? -val : 0;
}
res.relative = true;
}
else {
res.left = coordinate;
}
// String ('+={n}', '-={n}')
}
else if (isString(coordinate)) {
var m = coordinate.trim().match(reRelativeToken);
if (!m) {
return null;
}
var op = m[1];
var val = parseInt(m[2], 10);
if (op === '+') {
res.top = enableVertical ? val : 0;
res.left = !enableVertical ? val : 0;
}
else {
res.top = enableVertical ? -val : 0;
res.left = !enableVertical ? -val : 0;
}
res.relative = true;
}
else {
return null;
}
return res;
};
return res;
};
var defaultOptions = {
trigger: '[data-scroll]',
header: '[data-scroll-header]',
duration: 1000,
easing: 'easeOutQuint',
offset: 0,
vertical: true,
horizontal: false,
cancellable: true,
updateURL: false,
preventDefault: true,
stopPropagation: true,
quickMode: false,
// Callbacks
before: null,
after: null,
cancel: null,
complete: null,
step: null,
};
var defaultOptions = {
trigger: '[data-scroll]',
header: '[data-scroll-header]',
duration: 1000,
easing: 'easeOutQuint',
offset: 0,
vertical: true,
horizontal: false,
cancellable: true,
updateURL: false,
preventDefault: true,
stopPropagation: true,
quickMode: false,
// Callbacks
before: null,
after: null,
cancel: null,
complete: null,
step: null,
};
var CONTAINER_CLICK_EVENT = 'click';
var CONTAINER_STOP_EVENT = 'wheel touchstart touchmove';
var SweetScroll = /** @class */ (function () {
/**
* Constructor
*/
function SweetScroll(options, container) {
var _this = this;
this.ctx = {
$trigger: null,
opts: null,
progress: false,
pos: null,
startPos: null,
easing: null,
start: 0,
id: 0,
cancel: false,
hash: null,
var CONTAINER_CLICK_EVENT = 'click';
var CONTAINER_STOP_EVENT = 'wheel touchstart touchmove';
var SweetScroll = /** @class */ (function () {
/**
* Constructor
*/
function SweetScroll(options, container) {
var _this = this;
this.ctx = {
$trigger: null,
opts: null,
progress: false,
pos: null,
startPos: null,
easing: null,
start: 0,
id: 0,
cancel: false,
hash: null,
};
/**
* Handle each frame of the animation.
*/
this.loop = function (time) {
var _a = _this, $el = _a.$el, ctx = _a.ctx;
if (!ctx.start) {
ctx.start = time;
}
if (!ctx.progress || !$el) {
_this.stop();
return;
}
var options = ctx.opts;
var offset = ctx.pos;
var start = ctx.start;
var startOffset = ctx.startPos;
var easing = ctx.easing;
var duration = options.duration;
var directionMap = { top: 'y', left: 'x' };
var timeElapsed = time - start;
var t = Math.min(1, Math.max(timeElapsed / duration, 0));
Object.keys(offset).forEach(function (key) {
var value = offset[key];
var initial = startOffset[key];
var delta = value - initial;
if (delta !== 0) {
var val = easing(t, duration * t, 0, 1, duration);
setScroll($el, Math.round(initial + delta * val), directionMap[key]);
}
});
if (timeElapsed <= duration) {
_this.hook(options, 'step', t);
ctx.id = SweetScroll.raf(_this.loop);
}
else {
_this.stop(true);
}
};
/**
* Handling of container click event.
*/
this.handleClick = function (e) {
var opts = _this.opts;
var $el = e.target;
for (; $el && $el !== document; $el = $el.parentNode) {
if (!matches($el, opts.trigger)) {
continue;
}
var dataOptions = JSON.parse($el.getAttribute('data-scroll-options') || '{}');
var data = $el.getAttribute('data-scroll');
var to = data || $el.getAttribute('href');
var options = __assign({}, opts, dataOptions);
var preventDefault = options.preventDefault, stopPropagation = options.stopPropagation, vertical = options.vertical, horizontal = options.horizontal;
if (preventDefault) {
e.preventDefault();
}
if (stopPropagation) {
e.stopPropagation();
}
// Passes the trigger element to callback
_this.ctx.$trigger = $el;
if (horizontal && vertical) {
_this.to(to, options);
}
else if (vertical) {
_this.toTop(to, options);
}
else if (horizontal) {
_this.toLeft(to, options);
}
}
};
/**
* Handling of container stop events.
*/
this.handleStop = function (e) {
var ctx = _this.ctx;
var opts = ctx.opts;
if (opts && opts.cancellable) {
ctx.cancel = true;
_this.stop();
}
else {
e.preventDefault();
}
};
var opts = __assign({}, defaultOptions, (options || {}));
var vertical = opts.vertical, horizontal = opts.horizontal;
var selector = container === undefined ? 'body,html' : container;
var $container = null;
if (canUseDOM) {
if (vertical) {
$container = findScrollable(selector, 'y');
}
if (!$container && horizontal) {
$container = findScrollable(selector, 'x');
}
}
if ($container) {
this.opts = opts;
this.$el = $container;
this.bind(true, false);
}
}
/**
* SweetScroll instance factory.
*/
SweetScroll.create = function (options, container) {
return new SweetScroll(options, container);
};
/**
* Handle each frame of the animation.
* Scroll animation to the specified position.
*/
this.loop = function (time) {
var _a = _this, $el = _a.$el, ctx = _a.ctx;
if (!ctx.start) {
ctx.start = time;
SweetScroll.prototype.to = function (distance, options) {
if (!canUseDOM) {
return;
}
if (!ctx.progress || !$el) {
_this.stop();
var _a = this, $el = _a.$el, ctx = _a.ctx, currentOptions = _a.opts;
var $trigger = ctx.$trigger;
var opts = __assign({}, currentOptions, options || {});
var optOffset = opts.offset, vertical = opts.vertical, horizontal = opts.horizontal;
var $header = isElement(opts.header) ? opts.header : $(opts.header);
var hash = isString(distance) && /^#/.test(distance) ? distance : null;
ctx.opts = opts; // Temporary options
ctx.cancel = false; // Disable the call flag of `cancel`
ctx.hash = hash;
// Stop current animation
this.stop();
// Does not move if the container is not found
if (!$el) {
return;
}
var options = ctx.opts;
var offset = ctx.pos;
var start = ctx.start;
var startOffset = ctx.startPos;
var easing = ctx.easing;
var duration = options.duration;
var directionMap = { top: 'y', left: 'x' };
var timeElapsed = time - start;
var t = Math.min(1, Math.max(timeElapsed / duration, 0));
Object.keys(offset).forEach(function (key) {
var value = offset[key];
var initial = startOffset[key];
var delta = value - initial;
if (delta !== 0) {
var val = easing(t, duration * t, 0, 1, duration);
setScroll($el, Math.round(initial + delta * val), directionMap[key]);
// Get scroll offset
var offset = parseCoordinate(optOffset, vertical);
var coordinate = parseCoordinate(distance, vertical);
var scroll = { top: 0, left: 0 };
if (coordinate) {
if (coordinate.relative) {
var current = getScroll($el, vertical ? 'y' : 'x');
scroll.top = vertical ? current + coordinate.top : coordinate.top;
scroll.left = !vertical ? current + coordinate.left : coordinate.left;
}
});
if (timeElapsed <= duration) {
_this.hook(options, 'step', t);
ctx.id = SweetScroll.raf(_this.loop);
else {
scroll = coordinate;
}
}
else {
_this.stop(true);
else if (isString(distance) && distance !== '#') {
var $target = $(distance);
if (!$target) {
return;
}
scroll = getOffset($target, $el);
}
if (offset) {
scroll.top += offset.top;
scroll.left += offset.left;
}
if ($header) {
scroll.top = Math.max(0, scroll.top - getSize($header).height);
}
// Normalize scroll offset
var _b = getViewportAndElementSizes($el), viewport = _b.viewport, size = _b.size;
scroll.top = vertical
? Math.max(0, Math.min(size.height - viewport.height, scroll.top))
: getScroll($el, 'y');
scroll.left = horizontal
? Math.max(0, Math.min(size.width - viewport.width, scroll.left))
: getScroll($el, 'x');
// Call `before`
// Stop scrolling when it returns false
if (this.hook(opts, 'before', scroll, $trigger) === false) {
ctx.opts = null;
return;
}
// Set offset
ctx.pos = scroll;
// Run animation!!
this.start(opts);
// Bind stop events
this.bind(false, true);
};
/**
* Handling of container click event.
* Scroll animation to specified left position.
*/
this.handleClick = function (e) {
var opts = _this.opts;
var $el = e.target;
for (; $el && $el !== document; $el = $el.parentNode) {
if (!matches($el, opts.trigger)) {
continue;
}
var dataOptions = JSON.parse($el.getAttribute('data-scroll-options') || '{}');
var data = $el.getAttribute('data-scroll');
var to = data || $el.getAttribute('href');
var options = __assign({}, opts, dataOptions);
var preventDefault = options.preventDefault, stopPropagation = options.stopPropagation, vertical = options.vertical, horizontal = options.horizontal;
if (preventDefault) {
e.preventDefault();
}
if (stopPropagation) {
e.stopPropagation();
}
// Passes the trigger element to callback
_this.ctx.$trigger = $el;
if (horizontal && vertical) {
_this.to(to, options);
}
else if (vertical) {
_this.toTop(to, options);
}
else if (horizontal) {
_this.toLeft(to, options);
}
SweetScroll.prototype.toTop = function (distance, options) {
this.to(distance, __assign({}, options || {}, { vertical: true, horizontal: false }));
};
/**
* Scroll animation to specified top position.
*/
SweetScroll.prototype.toLeft = function (distance, options) {
this.to(distance, __assign({}, options || {}, { vertical: false, horizontal: true }));
};
/**
* Scroll animation to specified element.
*/
SweetScroll.prototype.toElement = function ($element, options) {
var $el = this.$el;
if (!canUseDOM || !$el) {
return;
}
this.to(getOffset($element, $el), options || {});
};
/**
* Handling of container stop events.
* Stop the current scroll animation.
*/
this.handleStop = function (e) {
var ctx = _this.ctx;
var opts = ctx.opts;
if (opts && opts.cancellable) {
ctx.cancel = true;
_this.stop();
SweetScroll.prototype.stop = function (gotoEnd) {
if (gotoEnd === void 0) { gotoEnd = false; }
var _a = this, $el = _a.$el, ctx = _a.ctx;
var pos = ctx.pos;
if (!$el || !ctx.progress) {
return;
}
else {
e.preventDefault();
SweetScroll.caf(ctx.id);
ctx.progress = false;
ctx.start = 0;
ctx.id = 0;
if (gotoEnd && pos) {
setScroll($el, pos.left, 'x');
setScroll($el, pos.top, 'y');
}
this.complete();
};
var opts = __assign({}, defaultOptions, (options || {}));
var vertical = opts.vertical, horizontal = opts.horizontal;
var selector = container === undefined ? 'body,html' : container;
var $container = null;
if (canUseDOM) {
if (vertical) {
$container = findScrollable(selector, 'y');
/**
* Update options.
*/
SweetScroll.prototype.update = function (options) {
if (this.$el) {
var opts = __assign({}, this.opts, options);
this.stop();
this.unbind(true, true);
this.opts = opts;
this.bind(true, false);
}
if (!$container && horizontal) {
$container = findScrollable(selector, 'x');
};
/**
* Destroy instance.
*/
SweetScroll.prototype.destroy = function () {
if (this.$el) {
this.stop();
this.unbind(true, true);
this.$el = null;
}
}
if ($container) {
this.opts = opts;
this.$el = $container;
this.bind(true, false);
}
}
/**
* SweetScroll instance factory.
*/
SweetScroll.create = function (options, container) {
return new SweetScroll(options, container);
};
/**
* Scroll animation to the specified position.
*/
SweetScroll.prototype.to = function (distance, options) {
if (!canUseDOM) {
return;
}
var _a = this, $el = _a.$el, ctx = _a.ctx, currentOptions = _a.opts;
var $trigger = ctx.$trigger;
var opts = __assign({}, currentOptions, options || {});
var optOffset = opts.offset, vertical = opts.vertical, horizontal = opts.horizontal;
var $header = isElement(opts.header) ? opts.header : $(opts.header);
var hash = isString(distance) && /^#/.test(distance) ? distance : null;
ctx.opts = opts; // Temporary options
ctx.cancel = false; // Disable the call flag of `cancel`
ctx.hash = hash;
// Stop current animation
this.stop();
// Does not move if the container is not found
if (!$el) {
return;
}
// Get scroll offset
var offset = parseCoordinate(optOffset, vertical);
var coordinate = parseCoordinate(distance, vertical);
var scroll = { top: 0, left: 0 };
if (coordinate) {
if (coordinate.relative) {
var current = getScroll($el, vertical ? 'y' : 'x');
scroll.top = vertical ? current + coordinate.top : coordinate.top;
scroll.left = !vertical ? current + coordinate.left : coordinate.left;
};
/**
* Callback methods.
*/
/* tslint:disable:no-empty */
SweetScroll.prototype.onBefore = function (_, __) { return true; };
SweetScroll.prototype.onStep = function (_) { };
SweetScroll.prototype.onAfter = function (_, __) { };
SweetScroll.prototype.onCancel = function () { };
SweetScroll.prototype.onComplete = function (_) { };
/* tslint:enable */
/**
* Start scrolling animation.
*/
SweetScroll.prototype.start = function (opts) {
var ctx = this.ctx;
ctx.opts = opts;
ctx.progress = true;
ctx.easing = isFunction(opts.easing)
? opts.easing
: easings[opts.easing];
// Update start offset.
var $container = this.$el;
var offset = ctx.pos;
var start = {
top: getScroll($container, 'y'),
left: getScroll($container, 'x'),
};
if (opts.quickMode) {
var _a = getViewportAndElementSizes($container).viewport, width = _a.width, height = _a.height;
if (Math.abs(start.top - offset.top) > height) {
start.top = start.top > offset.top ? offset.top + height : offset.top - height;
}
if (Math.abs(start.left - offset.left) > width) {
start.left = start.left > offset.left ? offset.left + width : offset.left - width;
}
}
else {
scroll = coordinate;
}
}
else if (isString(distance) && distance !== '#') {
var $target = $(distance);
if (!$target) {
ctx.startPos = start;
// Loop
ctx.id = SweetScroll.raf(this.loop);
};
/**
* Handle the completion of scrolling animation.
*/
SweetScroll.prototype.complete = function () {
var _a = this, $el = _a.$el, ctx = _a.ctx;
var hash = ctx.hash, cancel = ctx.cancel, opts = ctx.opts, pos = ctx.pos, $trigger = ctx.$trigger;
if (!$el || !opts) {
return;
}
scroll = getOffset($target, $el);
}
if (offset) {
scroll.top += offset.top;
scroll.left += offset.left;
}
if ($header) {
scroll.top = Math.max(0, scroll.top - getSize($header).height);
}
// Normalize scroll offset
var _b = getViewportAndElementSizes($el), viewport = _b.viewport, size = _b.size;
scroll.top = vertical
? Math.max(0, Math.min(size.height - viewport.height, scroll.top))
: getScroll($el, 'y');
scroll.left = horizontal
? Math.max(0, Math.min(size.width - viewport.width, scroll.left))
: getScroll($el, 'x');
// Call `before`
// Stop scrolling when it returns false
if (this.hook(opts, 'before', scroll, $trigger) === false) {
if (hash != null && hash !== window.location.hash) {
var updateURL = opts.updateURL;
if (canUseDOM && canUseHistory && updateURL !== false) {
window.history[updateURL === 'replace' ? 'replaceState' : 'pushState'](null, '', hash);
}
}
this.unbind(false, true);
ctx.opts = null;
return;
}
// Set offset
ctx.pos = scroll;
// Run animation!!
this.start(opts);
// Bind stop events
this.bind(false, true);
};
/**
* Scroll animation to specified left position.
*/
SweetScroll.prototype.toTop = function (distance, options) {
this.to(distance, __assign({}, options || {}, { vertical: true, horizontal: false }));
};
/**
* Scroll animation to specified top position.
*/
SweetScroll.prototype.toLeft = function (distance, options) {
this.to(distance, __assign({}, options || {}, { vertical: false, horizontal: true }));
};
/**
* Scroll animation to specified element.
*/
SweetScroll.prototype.toElement = function ($element, options) {
var $el = this.$el;
if (!canUseDOM || !$el) {
return;
}
this.to(getOffset($element, $el), options || {});
};
/**
* Stop the current scroll animation.
*/
SweetScroll.prototype.stop = function (gotoEnd) {
if (gotoEnd === void 0) { gotoEnd = false; }
var _a = this, $el = _a.$el, ctx = _a.ctx;
var pos = ctx.pos;
if (!$el || !ctx.progress) {
return;
}
SweetScroll.caf(ctx.id);
ctx.progress = false;
ctx.start = 0;
ctx.id = 0;
if (gotoEnd && pos) {
setScroll($el, pos.left, 'x');
setScroll($el, pos.top, 'y');
}
this.complete();
};
/**
* Update options.
*/
SweetScroll.prototype.update = function (options) {
if (this.$el) {
var opts = __assign({}, this.opts, options);
this.stop();
this.unbind(true, true);
this.opts = opts;
this.bind(true, false);
}
};
/**
* Destroy instance.
*/
SweetScroll.prototype.destroy = function () {
if (this.$el) {
this.stop();
this.unbind(true, true);
this.$el = null;
}
};
/**
* Callback methods.
*/
/* tslint:disable:no-empty */
SweetScroll.prototype.onBefore = function (_, __) { return true; };
SweetScroll.prototype.onStep = function (_) { };
SweetScroll.prototype.onAfter = function (_, __) { };
SweetScroll.prototype.onCancel = function () { };
SweetScroll.prototype.onComplete = function (_) { };
/* tslint:enable */
/**
* Start scrolling animation.
*/
SweetScroll.prototype.start = function (opts) {
var ctx = this.ctx;
ctx.opts = opts;
ctx.progress = true;
ctx.easing = isFunction(opts.easing)
? opts.easing
: easings[opts.easing];
// Update start offset.
var $container = this.$el;
var offset = ctx.pos;
var start = {
top: getScroll($container, 'y'),
left: getScroll($container, 'x'),
};
if (opts.quickMode) {
var _a = getViewportAndElementSizes($container).viewport, width = _a.width, height = _a.height;
if (Math.abs(start.top - offset.top) > height) {
start.top = start.top > offset.top ? offset.top + height : offset.top - height;
ctx.$trigger = null;
if (cancel) {
this.hook(opts, 'cancel');
}
if (Math.abs(start.left - offset.left) > width) {
start.left = start.left > offset.left ? offset.left + width : offset.left - width;
else {
this.hook(opts, 'after', pos, $trigger);
}
}
ctx.startPos = start;
// Loop
ctx.id = SweetScroll.raf(this.loop);
};
/**
* Handle the completion of scrolling animation.
*/
SweetScroll.prototype.complete = function () {
var _a = this, $el = _a.$el, ctx = _a.ctx;
var hash = ctx.hash, cancel = ctx.cancel, opts = ctx.opts, pos = ctx.pos, $trigger = ctx.$trigger;
if (!$el || !opts) {
return;
}
if (hash != null && hash !== window.location.hash) {
var updateURL = opts.updateURL;
if (canUseDOM && canUseHistory && updateURL !== false) {
window.history[updateURL === 'replace' ? 'replaceState' : 'pushState'](null, '', hash);
this.hook(opts, 'complete', cancel);
};
/**
* Callback function and method call.
*/
SweetScroll.prototype.hook = function (options, type) {
var args = [];
for (var _i = 2; _i < arguments.length; _i++) {
args[_i - 2] = arguments[_i];
}
}
this.unbind(false, true);
ctx.opts = null;
ctx.$trigger = null;
if (cancel) {
this.hook(opts, 'cancel');
}
else {
this.hook(opts, 'after', pos, $trigger);
}
this.hook(opts, 'complete', cancel);
};
/**
* Callback function and method call.
*/
SweetScroll.prototype.hook = function (options, type) {
var args = [];
for (var _i = 2; _i < arguments.length; _i++) {
args[_i - 2] = arguments[_i];
}
var callback = options[type];
var callbackResult;
var methodResult;
// callback
if (isFunction(callback)) {
callbackResult = callback.apply(this, args.concat([this]));
}
// method
methodResult = this["on" + (type[0].toUpperCase() + type.slice(1))].apply(this, args);
return callbackResult !== undefined ? callbackResult : methodResult;
};
/**
* Bind events of container element.
*/
SweetScroll.prototype.bind = function (click, stop) {
var _a = this, $el = _a.$el, opts = _a.ctx.opts;
if ($el) {
if (click) {
addEvent($el, CONTAINER_CLICK_EVENT, this.handleClick, false);
var callback = options[type];
var callbackResult;
var methodResult;
// callback
if (isFunction(callback)) {
callbackResult = callback.apply(this, args.concat([this]));
}
if (stop) {
addEvent($el, CONTAINER_STOP_EVENT, this.handleStop, opts ? opts.cancellable : true);
// method
methodResult = this["on" + (type[0].toUpperCase() + type.slice(1))].apply(this, args);
return callbackResult !== undefined ? callbackResult : methodResult;
};
/**
* Bind events of container element.
*/
SweetScroll.prototype.bind = function (click, stop) {
var _a = this, $el = _a.$el, opts = _a.ctx.opts;
if ($el) {
if (click) {
addEvent($el, CONTAINER_CLICK_EVENT, this.handleClick, false);
}
if (stop) {
addEvent($el, CONTAINER_STOP_EVENT, this.handleStop, opts ? opts.cancellable : true);
}
}
}
};
/**
* Unbind events of container element.
*/
SweetScroll.prototype.unbind = function (click, stop) {
var _a = this, $el = _a.$el, opts = _a.ctx.opts;
if ($el) {
if (click) {
removeEvent($el, CONTAINER_CLICK_EVENT, this.handleClick, false);
};
/**
* Unbind events of container element.
*/
SweetScroll.prototype.unbind = function (click, stop) {
var _a = this, $el = _a.$el, opts = _a.ctx.opts;
if ($el) {
if (click) {
removeEvent($el, CONTAINER_CLICK_EVENT, this.handleClick, false);
}
if (stop) {
removeEvent($el, CONTAINER_STOP_EVENT, this.handleStop, opts ? opts.cancellable : true);
}
}
if (stop) {
removeEvent($el, CONTAINER_STOP_EVENT, this.handleStop, opts ? opts.cancellable : true);
}
}
};
/**
* You can set Polyfill (or Ponyfill) for browsers that do not support requestAnimationFrame.
*/
SweetScroll.raf = raf;
SweetScroll.caf = caf;
};
/**
* You can set Polyfill (or Ponyfill) for browsers that do not support requestAnimationFrame.
*/
SweetScroll.raf = raf;
SweetScroll.caf = caf;
return SweetScroll;
}());
return SweetScroll;
}());
return SweetScroll;
})));

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

/*! @preserve sweet-scroll v3.0.0 - tsuyoshiwada | MIT License */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.SweetScroll=e()}(this,function(){"use strict";var t=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},e=!("undefined"==typeof window||!window.document||!window.document.createElement),n=!!e&&(window.history&&"pushState"in window.history&&"file:"!==window.location.protocol),o=function(){var t=!1;if(!e)return t;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){t=!0}}))}catch(t){}return t}(),i=function(t){return"string"==typeof t},r=function(t){return"function"==typeof t},u=function(t){return Array.isArray(t)},l=function(t){return!u(t)&&t-parseFloat(t)+1>=0},a=function(t){return t instanceof Element},c=function(t,e){return t&&t.hasOwnProperty(e)},s=e?window.requestAnimationFrame.bind(window):null,f=e?window.cancelAnimationFrame.bind(window):null,p=Math.cos,h=Math.sin,d=Math.pow,v=Math.sqrt,g=Math.PI,w={linear:function(t){return t},easeInQuad:function(t,e,n,o,i){return o*(e/=i)*e+n},easeOutQuad:function(t,e,n,o,i){return-o*(e/=i)*(e-2)+n},easeInOutQuad:function(t,e,n,o,i){return(e/=i/2)<1?o/2*e*e+n:-o/2*(--e*(e-2)-1)+n},easeInCubic:function(t,e,n,o,i){return o*(e/=i)*e*e+n},easeOutCubic:function(t,e,n,o,i){return o*((e=e/i-1)*e*e+1)+n},easeInOutCubic:function(t,e,n,o,i){return(e/=i/2)<1?o/2*e*e*e+n:o/2*((e-=2)*e*e+2)+n},easeInQuart:function(t,e,n,o,i){return o*(e/=i)*e*e*e+n},easeOutQuart:function(t,e,n,o,i){return-o*((e=e/i-1)*e*e*e-1)+n},easeInOutQuart:function(t,e,n,o,i){return(e/=i/2)<1?o/2*e*e*e*e+n:-o/2*((e-=2)*e*e*e-2)+n},easeInQuint:function(t,e,n,o,i){return o*(e/=i)*e*e*e*e+n},easeOutQuint:function(t,e,n,o,i){return o*((e=e/i-1)*e*e*e*e+1)+n},easeInOutQuint:function(t,e,n,o,i){return(e/=i/2)<1?o/2*e*e*e*e*e+n:o/2*((e-=2)*e*e*e*e+2)+n},easeInSine:function(t,e,n,o,i){return-o*p(e/i*(g/2))+o+n},easeOutSine:function(t,e,n,o,i){return o*h(e/i*(g/2))+n},easeInOutSine:function(t,e,n,o,i){return-o/2*(p(g*e/i)-1)+n},easeInExpo:function(t,e,n,o,i){return 0===e?n:o*d(2,10*(e/i-1))+n},easeOutExpo:function(t,e,n,o,i){return e===i?n+o:o*(1-d(2,-10*e/i))+n},easeInOutExpo:function(t,e,n,o,i){return 0===e?n:e===i?n+o:(e/=i/2)<1?o/2*d(2,10*(e-1))+n:o/2*(2-d(2,-10*--e))+n},easeInCirc:function(t,e,n,o,i){return-o*(v(1-(e/=i)*e)-1)+n},easeOutCirc:function(t,e,n,o,i){return o*v(1-(e=e/i-1)*e)+n},easeInOutCirc:function(t,e,n,o,i){return(e/=i/2)<1?-o/2*(v(1-e*e)-1)+n:o/2*(v(1-(e-=2)*e)+1)+n}},m={y:"scrollTop",x:"scrollLeft"},y={y:"pageYOffset",x:"pageXOffset"},x=function(t,e){return t[m[e]]},b=function(t,e,n){t[m[n]]=e},O=function(t,e){var n=t.getBoundingClientRect();if(n.width||n.height){var o={top:0,left:0},i=void 0;if(C(e))i=document.documentElement,o.top=window[y.y],o.left=window[y.x];else{i=e;var r=i.getBoundingClientRect();o.top=-1*r.top+i[m.y],o.left=-1*r.left+i[m.x]}return{top:n.top+o.top-i.clientTop,left:n.left+o.left-i.clientLeft}}return n},M=function(t){return Array.prototype.slice.call(t?document.querySelectorAll(t):[])},$=function(t){return M(t).shift()||null},E=function(t,e){if(a(e))return t===e;for(var n=M(e),o=n.length;--o>=0&&n[o]!==t;);return o>-1},C=function(t){return t===document.documentElement||t===document.body},I=function(t,e){for(var n=m[e],o=a(t)?[t]:M(t),i=document.createElement("div"),r=0;r<o.length;r+=1){var u=o[r],l=null;if(u[n]>0)l=u;else{var c=window.outerWidth,s=window.innerWidth,f=c?c/s:1;i.style.width=u.clientWidth+1+"px",i.style.height=u.clientHeight+1+"px",u.appendChild(i),u[n]=1.5/f,u[n]>0&&(l=u),u[n]=0,u.removeChild(i)}if(l)return l}return null},k=function(t){return Math.max(t.scrollHeight,t.clientHeight,t.offsetHeight)},S=function(t){return Math.max(t.scrollWidth,t.clientWidth,t.offsetWidth)},A=function(t){return{width:S(t),height:k(t)}},P=function(t){var e=C(t);return{viewport:{width:e?Math.min(window.innerWidth,document.documentElement.clientWidth):t.clientWidth,height:e?window.innerHeight:t.clientHeight},size:e?{width:Math.max(S(document.body),S(document.documentElement)),height:Math.max(k(document.body),k(document.documentElement))}:A(t)}},Q=function(){return e?"onwheel"in document?"wheel":"mousewheel":"wheel"}(),L=function(t){return"wheel"===t?Q:t},W=function(t,e,n,i,r){n.split(" ").forEach(function(n){t[e](L(n),i,!!o&&{passive:r})})},z=function(t,e,n,o){W(t,"addEventListener",e,n,o)},H=function(t,e,n,o){W(t,"removeEventListener",e,n,o)},j=/^(\+|-)=(\d+(?:\.\d+)?)$/,q=function(e,n){var o={top:0,left:0,relative:!1};if(c(e,"top")||c(e,"left"))o=t({},o,e);else if(u(e))if(e.length>1)o.top=e[0],o.left=e[1];else{if(1!==e.length)return null;o.top=n?e[0]:0,o.left=n?0:e[0]}else if(l(e))n?o.top=e:o.left=e;else{if(!i(e))return null;var r=e.trim().match(j);if(!r)return null;var a=r[1],s=parseInt(r[2],10);"+"===a?(o.top=n?s:0,o.left=n?0:s):(o.top=n?-s:0,o.left=n?0:-s),o.relative=!0}return o},D={trigger:"[data-scroll]",header:"[data-scroll-header]",duration:1e3,easing:"easeOutQuint",offset:0,vertical:!0,horizontal:!1,cancellable:!0,updateURL:!1,preventDefault:!0,stopPropagation:!0,quickMode:!1,before:null,after:null,cancel:null,complete:null,step:null};return function(){function o(n,i){var r=this;this.ctx={$trigger:null,opts:null,progress:!1,pos:null,startPos:null,easing:null,start:0,id:0,cancel:!1,hash:null},this.loop=function(t){var e=r,n=e.$el,i=e.ctx;if(i.start||(i.start=t),!i.progress||!n)return void r.stop();var u=i.opts,l=i.pos,a=i.start,c=i.startPos,s=i.easing,f=u.duration,p={top:"y",left:"x"},h=t-a,d=Math.min(1,Math.max(h/f,0));Object.keys(l).forEach(function(t){var e=l[t],o=c[t],i=e-o;if(0!==i){var r=s(d,f*d,0,1,f);b(n,Math.round(o+i*r),p[t])}}),h<=f?(r.hook(u,"step",d),i.id=o.raf(r.loop)):r.stop(!0)},this.handleClick=function(e){for(var n=r.opts,o=e.target;o&&o!==document;o=o.parentNode)if(E(o,n.trigger)){var i=JSON.parse(o.getAttribute("data-scroll-options")||"{}"),u=o.getAttribute("data-scroll"),l=u||o.getAttribute("href"),a=t({},n,i),c=a.preventDefault,s=a.stopPropagation,f=a.vertical,p=a.horizontal;c&&e.preventDefault(),s&&e.stopPropagation(),r.ctx.$trigger=o,p&&f?r.to(l,a):f?r.toTop(l,a):p&&r.toLeft(l,a)}},this.handleStop=function(t){var e=r.ctx,n=e.opts;n&&n.cancellable?(e.cancel=!0,r.stop()):t.preventDefault()};var u=t({},D,n||{}),l=u.vertical,a=u.horizontal,c=void 0===i?"body,html":i,s=null;e&&(l&&(s=I(c,"y")),!s&&a&&(s=I(c,"x"))),s&&(this.opts=u,this.$el=s,this.bind(!0,!1))}return o.create=function(t,e){return new o(t,e)},o.prototype.to=function(n,o){if(e){var r=this,u=r.$el,l=r.ctx,c=r.opts,s=l.$trigger,f=t({},c,o||{}),p=f.offset,h=f.vertical,d=f.horizontal,v=a(f.header)?f.header:$(f.header),g=i(n)&&/^#/.test(n)?n:null;if(l.opts=f,l.cancel=!1,l.hash=g,this.stop(),u){var w=q(p,h),m=q(n,h),y={top:0,left:0};if(m)if(m.relative){var b=x(u,h?"y":"x");y.top=h?b+m.top:m.top,y.left=h?m.left:b+m.left}else y=m;else if(i(n)&&"#"!==n){var M=$(n);if(!M)return;y=O(M,u)}w&&(y.top+=w.top,y.left+=w.left),v&&(y.top=Math.max(0,y.top-A(v).height));var E=P(u),C=E.viewport,I=E.size;if(y.top=h?Math.max(0,Math.min(I.height-C.height,y.top)):x(u,"y"),y.left=d?Math.max(0,Math.min(I.width-C.width,y.left)):x(u,"x"),!1===this.hook(f,"before",y,s))return void(l.opts=null);l.pos=y,this.start(f),this.bind(!1,!0)}}},o.prototype.toTop=function(e,n){this.to(e,t({},n||{},{vertical:!0,horizontal:!1}))},o.prototype.toLeft=function(e,n){this.to(e,t({},n||{},{vertical:!1,horizontal:!0}))},o.prototype.toElement=function(t,n){var o=this.$el;e&&o&&this.to(O(t,o),n||{})},o.prototype.stop=function(t){void 0===t&&(t=!1);var e=this,n=e.$el,i=e.ctx,r=i.pos;n&&i.progress&&(o.caf(i.id),i.progress=!1,i.start=0,i.id=0,t&&r&&(b(n,r.left,"x"),b(n,r.top,"y")),this.complete())},o.prototype.update=function(e){if(this.$el){var n=t({},this.opts,e);this.stop(),this.unbind(!0,!0),this.opts=n,this.bind(!0,!1)}},o.prototype.destroy=function(){this.$el&&(this.stop(),this.unbind(!0,!0),this.$el=null)},o.prototype.onBefore=function(t,e){return!0},o.prototype.onStep=function(t){},o.prototype.onAfter=function(t,e){},o.prototype.onCancel=function(){},o.prototype.onComplete=function(t){},o.prototype.start=function(t){var e=this.ctx;e.opts=t,e.progress=!0,e.easing=r(t.easing)?t.easing:w[t.easing];var n=this.$el,i=e.pos,u={top:x(n,"y"),left:x(n,"x")};if(t.quickMode){var l=P(n).viewport,a=l.width,c=l.height;Math.abs(u.top-i.top)>c&&(u.top=u.top>i.top?i.top+c:i.top-c),Math.abs(u.left-i.left)>a&&(u.left=u.left>i.left?i.left+a:i.left-a)}e.startPos=u,e.id=o.raf(this.loop)},o.prototype.complete=function(){var t=this,o=t.$el,i=t.ctx,r=i.hash,u=i.cancel,l=i.opts,a=i.pos,c=i.$trigger;if(o&&l){if(null!=r&&r!==window.location.hash){var s=l.updateURL;e&&n&&!1!==s&&window.history["replace"===s?"replaceState":"pushState"](null,"",r)}this.unbind(!1,!0),i.opts=null,i.$trigger=null,u?this.hook(l,"cancel"):this.hook(l,"after",a,c),this.hook(l,"complete",u)}},o.prototype.hook=function(t,e){for(var n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];var i,u,l=t[e];return r(l)&&(i=l.apply(this,n.concat([this]))),u=this["on"+(e[0].toUpperCase()+e.slice(1))].apply(this,n),void 0!==i?i:u},o.prototype.bind=function(t,e){var n=this,o=n.$el,i=n.ctx.opts;o&&(t&&z(o,"click",this.handleClick,!1),e&&z(o,"wheel touchstart touchmove",this.handleStop,!i||i.cancellable))},o.prototype.unbind=function(t,e){var n=this,o=n.$el,i=n.ctx.opts;o&&(t&&H(o,"click",this.handleClick,!1),e&&H(o,"wheel touchstart touchmove",this.handleStop,!i||i.cancellable))},o.raf=s,o.caf=f,o}()});
/*! @preserve sweet-scroll v3.0.1 - tsuyoshiwada | MIT License */
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.SweetScroll=e()}(this,function(){"use strict";var t=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i]);return t},e=!("undefined"==typeof window||!window.document||!window.document.createElement),n=!!e&&(window.history&&"pushState"in window.history&&"file:"!==window.location.protocol),o=function(){var t=!1;if(!e)return t;try{window.addEventListener("test",null,Object.defineProperty({},"passive",{get:function(){t=!0}}))}catch(t){}return t}(),i=function(t){return"string"==typeof t},r=function(t){return"function"==typeof t},l=function(t){return Array.isArray(t)},a=function(t){return t instanceof Element},u=function(t,e){return t&&t.hasOwnProperty(e)},s=e?window.requestAnimationFrame.bind(window):null,c=e?window.cancelAnimationFrame.bind(window):null,f=Math.cos,h=Math.sin,p=Math.pow,d=Math.sqrt,v=Math.PI,g={linear:function(t){return t},easeInQuad:function(t,e,n,o,i){return o*(e/=i)*e+n},easeOutQuad:function(t,e,n,o,i){return-o*(e/=i)*(e-2)+n},easeInOutQuad:function(t,e,n,o,i){return(e/=i/2)<1?o/2*e*e+n:-o/2*(--e*(e-2)-1)+n},easeInCubic:function(t,e,n,o,i){return o*(e/=i)*e*e+n},easeOutCubic:function(t,e,n,o,i){return o*((e=e/i-1)*e*e+1)+n},easeInOutCubic:function(t,e,n,o,i){return(e/=i/2)<1?o/2*e*e*e+n:o/2*((e-=2)*e*e+2)+n},easeInQuart:function(t,e,n,o,i){return o*(e/=i)*e*e*e+n},easeOutQuart:function(t,e,n,o,i){return-o*((e=e/i-1)*e*e*e-1)+n},easeInOutQuart:function(t,e,n,o,i){return(e/=i/2)<1?o/2*e*e*e*e+n:-o/2*((e-=2)*e*e*e-2)+n},easeInQuint:function(t,e,n,o,i){return o*(e/=i)*e*e*e*e+n},easeOutQuint:function(t,e,n,o,i){return o*((e=e/i-1)*e*e*e*e+1)+n},easeInOutQuint:function(t,e,n,o,i){return(e/=i/2)<1?o/2*e*e*e*e*e+n:o/2*((e-=2)*e*e*e*e+2)+n},easeInSine:function(t,e,n,o,i){return-o*f(e/i*(v/2))+o+n},easeOutSine:function(t,e,n,o,i){return o*h(e/i*(v/2))+n},easeInOutSine:function(t,e,n,o,i){return-o/2*(f(v*e/i)-1)+n},easeInExpo:function(t,e,n,o,i){return 0===e?n:o*p(2,10*(e/i-1))+n},easeOutExpo:function(t,e,n,o,i){return e===i?n+o:o*(1-p(2,-10*e/i))+n},easeInOutExpo:function(t,e,n,o,i){return 0===e?n:e===i?n+o:(e/=i/2)<1?o/2*p(2,10*(e-1))+n:o/2*(2-p(2,-10*--e))+n},easeInCirc:function(t,e,n,o,i){return-o*(d(1-(e/=i)*e)-1)+n},easeOutCirc:function(t,e,n,o,i){return o*d(1-(e=e/i-1)*e)+n},easeInOutCirc:function(t,e,n,o,i){return(e/=i/2)<1?-o/2*(d(1-e*e)-1)+n:o/2*(d(1-(e-=2)*e)+1)+n}},m={y:"scrollTop",x:"scrollLeft"},w="pageYOffset",y="pageXOffset",x=function(t,e){return t[m[e]]},b=function(t,e,n){t[m[n]]=e},O=function(t,e){var n=t.getBoundingClientRect();if(n.width||n.height){var o={top:0,left:0},i=void 0;if(C(e))i=document.documentElement,o.top=window[w],o.left=window[y];else{var r=(i=e).getBoundingClientRect();o.top=-1*r.top+i[m.y],o.left=-1*r.left+i[m.x]}return{top:n.top+o.top-i.clientTop,left:n.left+o.left-i.clientLeft}}return n},M=function(t){return Array.prototype.slice.call(t?document.querySelectorAll(t):[])},$=function(t){return M(t).shift()||null},E=function(t,e){if(a(e))return t===e;for(var n=M(e),o=n.length;--o>=0&&n[o]!==t;);return o>-1},C=function(t){return t===document.documentElement||t===document.body},I=function(t,e){for(var n=m[e],o=a(t)?[t]:M(t),i=document.createElement("div"),r=0;r<o.length;r+=1){var l=o[r],u=null;if(l[n]>0)u=l;else{var s=window.outerWidth,c=window.innerWidth,f=s?s/c:1;i.style.width=l.clientWidth+1+"px",i.style.height=l.clientHeight+1+"px",l.appendChild(i),l[n]=Math.max(1,1.5/f),l[n]>0&&(u=l),l[n]=0,l.removeChild(i)}if(u)return u}return null},k=function(t){return Math.max(t.scrollHeight,t.clientHeight,t.offsetHeight)},S=function(t){return Math.max(t.scrollWidth,t.clientWidth,t.offsetWidth)},A=function(t){return{width:S(t),height:k(t)}},P=function(t){var e=C(t);return{viewport:{width:e?Math.min(window.innerWidth,document.documentElement.clientWidth):t.clientWidth,height:e?window.innerHeight:t.clientHeight},size:e?{width:Math.max(S(document.body),S(document.documentElement)),height:Math.max(k(document.body),k(document.documentElement))}:A(t)}},Q=e?"onwheel"in document?"wheel":"mousewheel":"wheel",L=function(t,e,n,i,r){n.split(" ").forEach(function(n){t[e](function(t){return"wheel"===t?Q:t}(n),i,!!o&&{passive:r})})},W=function(t,e,n,o){L(t,"addEventListener",e,n,o)},z=function(t,e,n,o){L(t,"removeEventListener",e,n,o)},H=/^(\+|-)=(\d+(?:\.\d+)?)$/,j=function(e,n){var o,r={top:0,left:0,relative:!1};if(u(e,"top")||u(e,"left"))r=t({},r,e);else if(l(e))if(e.length>1)r.top=e[0],r.left=e[1];else{if(1!==e.length)return null;r.top=n?e[0]:0,r.left=n?0:e[0]}else if(!l(o=e)&&o-parseFloat(o)+1>=0)n?r.top=e:r.left=e;else{if(!i(e))return null;var a=e.trim().match(H);if(!a)return null;var s=a[1],c=parseInt(a[2],10);"+"===s?(r.top=n?c:0,r.left=n?0:c):(r.top=n?-c:0,r.left=n?0:-c),r.relative=!0}return r},q={trigger:"[data-scroll]",header:"[data-scroll-header]",duration:1e3,easing:"easeOutQuint",offset:0,vertical:!0,horizontal:!1,cancellable:!0,updateURL:!1,preventDefault:!0,stopPropagation:!0,quickMode:!1,before:null,after:null,cancel:null,complete:null,step:null};return function(){function o(n,i){var r=this;this.ctx={$trigger:null,opts:null,progress:!1,pos:null,startPos:null,easing:null,start:0,id:0,cancel:!1,hash:null},this.loop=function(t){var e=r,n=e.$el,i=e.ctx;if(i.start||(i.start=t),i.progress&&n){var l=i.opts,a=i.pos,u=i.start,s=i.startPos,c=i.easing,f=l.duration,h={top:"y",left:"x"},p=t-u,d=Math.min(1,Math.max(p/f,0));Object.keys(a).forEach(function(t){var e=a[t],o=s[t],i=e-o;if(0!==i){var r=c(d,f*d,0,1,f);b(n,Math.round(o+i*r),h[t])}}),p<=f?(r.hook(l,"step",d),i.id=o.raf(r.loop)):r.stop(!0)}else r.stop()},this.handleClick=function(e){for(var n=r.opts,o=e.target;o&&o!==document;o=o.parentNode)if(E(o,n.trigger)){var i=JSON.parse(o.getAttribute("data-scroll-options")||"{}"),l=o.getAttribute("data-scroll")||o.getAttribute("href"),a=t({},n,i),u=a.preventDefault,s=a.stopPropagation,c=a.vertical,f=a.horizontal;u&&e.preventDefault(),s&&e.stopPropagation(),r.ctx.$trigger=o,f&&c?r.to(l,a):c?r.toTop(l,a):f&&r.toLeft(l,a)}},this.handleStop=function(t){var e=r.ctx,n=e.opts;n&&n.cancellable?(e.cancel=!0,r.stop()):t.preventDefault()};var l=t({},q,n||{}),a=l.vertical,u=l.horizontal,s=void 0===i?"body,html":i,c=null;e&&(a&&(c=I(s,"y")),!c&&u&&(c=I(s,"x"))),c&&(this.opts=l,this.$el=c,this.bind(!0,!1))}return o.create=function(t,e){return new o(t,e)},o.prototype.to=function(n,o){if(e){var r=this.$el,l=this.ctx,u=this.opts,s=l.$trigger,c=t({},u,o||{}),f=c.offset,h=c.vertical,p=c.horizontal,d=a(c.header)?c.header:$(c.header),v=i(n)&&/^#/.test(n)?n:null;if(l.opts=c,l.cancel=!1,l.hash=v,this.stop(),r){var g=j(f,h),m=j(n,h),w={top:0,left:0};if(m)if(m.relative){var y=x(r,h?"y":"x");w.top=h?y+m.top:m.top,w.left=h?m.left:y+m.left}else w=m;else if(i(n)&&"#"!==n){var b=$(n);if(!b)return;w=O(b,r)}g&&(w.top+=g.top,w.left+=g.left),d&&(w.top=Math.max(0,w.top-A(d).height));var M=P(r),E=M.viewport,C=M.size;w.top=h?Math.max(0,Math.min(C.height-E.height,w.top)):x(r,"y"),w.left=p?Math.max(0,Math.min(C.width-E.width,w.left)):x(r,"x"),!1!==this.hook(c,"before",w,s)?(l.pos=w,this.start(c),this.bind(!1,!0)):l.opts=null}}},o.prototype.toTop=function(e,n){this.to(e,t({},n||{},{vertical:!0,horizontal:!1}))},o.prototype.toLeft=function(e,n){this.to(e,t({},n||{},{vertical:!1,horizontal:!0}))},o.prototype.toElement=function(t,n){var o=this.$el;e&&o&&this.to(O(t,o),n||{})},o.prototype.stop=function(t){void 0===t&&(t=!1);var e=this.$el,n=this.ctx,i=n.pos;e&&n.progress&&(o.caf(n.id),n.progress=!1,n.start=0,n.id=0,t&&i&&(b(e,i.left,"x"),b(e,i.top,"y")),this.complete())},o.prototype.update=function(e){if(this.$el){var n=t({},this.opts,e);this.stop(),this.unbind(!0,!0),this.opts=n,this.bind(!0,!1)}},o.prototype.destroy=function(){this.$el&&(this.stop(),this.unbind(!0,!0),this.$el=null)},o.prototype.onBefore=function(t,e){return!0},o.prototype.onStep=function(t){},o.prototype.onAfter=function(t,e){},o.prototype.onCancel=function(){},o.prototype.onComplete=function(t){},o.prototype.start=function(t){var e=this.ctx;e.opts=t,e.progress=!0,e.easing=r(t.easing)?t.easing:g[t.easing];var n=this.$el,i=e.pos,l={top:x(n,"y"),left:x(n,"x")};if(t.quickMode){var a=P(n).viewport,u=a.width,s=a.height;Math.abs(l.top-i.top)>s&&(l.top=l.top>i.top?i.top+s:i.top-s),Math.abs(l.left-i.left)>u&&(l.left=l.left>i.left?i.left+u:i.left-u)}e.startPos=l,e.id=o.raf(this.loop)},o.prototype.complete=function(){var t=this.$el,o=this.ctx,i=o.hash,r=o.cancel,l=o.opts,a=o.pos,u=o.$trigger;if(t&&l){if(null!=i&&i!==window.location.hash){var s=l.updateURL;e&&n&&!1!==s&&window.history["replace"===s?"replaceState":"pushState"](null,"",i)}this.unbind(!1,!0),o.opts=null,o.$trigger=null,r?this.hook(l,"cancel"):this.hook(l,"after",a,u),this.hook(l,"complete",r)}},o.prototype.hook=function(t,e){for(var n=[],o=2;o<arguments.length;o++)n[o-2]=arguments[o];var i,l,a=t[e];return r(a)&&(i=a.apply(this,n.concat([this]))),l=this["on"+(e[0].toUpperCase()+e.slice(1))].apply(this,n),void 0!==i?i:l},o.prototype.bind=function(t,e){var n=this.$el,o=this.ctx.opts;n&&(t&&W(n,"click",this.handleClick,!1),e&&W(n,"wheel touchstart touchmove",this.handleStop,!o||o.cancellable))},o.prototype.unbind=function(t,e){var n=this.$el,o=this.ctx.opts;n&&(t&&z(n,"click",this.handleClick,!1),e&&z(n,"wheel touchstart touchmove",this.handleStop,!o||o.cancellable))},o.raf=s,o.caf=c,o}()});
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