You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

1 line
3.7 KiB

  1. {"ast":null,"code":"import { __extends } from \"tslib\";\nimport './polyfills';\nimport { scrollbarMap, Scrollbar } from './scrollbar';\nimport { addPlugins, ScrollbarPlugin } from './plugin';\nimport { attachStyle, detachStyle } from './style';\nexport { ScrollbarPlugin };\n/*!\n * cast `I.Scrollbar` to `Scrollbar` to avoid error\n *\n * `I.Scrollbar` is not assignable to `Scrollbar`:\n * \"privateProp\" is missing in `I.Scrollbar`\n *\n * @see https://github.com/Microsoft/TypeScript/issues/2672\n */\n\nvar SmoothScrollbar =\n/** @class */\nfunction (_super) {\n __extends(SmoothScrollbar, _super);\n\n function SmoothScrollbar() {\n return _super !== null && _super.apply(this, arguments) || this;\n }\n /**\n * Initializes a scrollbar on the given element.\n *\n * @param elem The DOM element that you want to initialize scrollbar to\n * @param [options] Initial options\n */\n\n\n SmoothScrollbar.init = function (elem, options) {\n if (!elem || elem.nodeType !== 1) {\n throw new TypeError(\"expect element to be DOM Element, but got \" + elem);\n } // attach stylesheet\n\n\n attachStyle();\n\n if (scrollbarMap.has(elem)) {\n return scrollbarMap.get(elem);\n }\n\n return new Scrollbar(elem, options);\n };\n /**\n * Automatically init scrollbar on all elements base on the selector `[data-scrollbar]`\n *\n * @param options Initial options\n */\n\n\n SmoothScrollbar.initAll = function (options) {\n return Array.from(document.querySelectorAll('[data-scrollbar]'), function (elem) {\n return SmoothScrollbar.init(elem, options);\n });\n };\n /**\n * Check if there is a scrollbar on given element\n *\n * @param elem The DOM element that you want to check\n */\n\n\n SmoothScrollbar.has = function (elem) {\n return scrollbarMap.has(elem);\n };\n /**\n * Gets scrollbar on the given element.\n * If no scrollbar instance exsits, returns `undefined`\n *\n * @param elem The DOM element that you want to check.\n */\n\n\n SmoothScrollbar.get = function (elem) {\n return scrollbarMap.get(elem);\n };\n /**\n * Returns an array that contains all scrollbar instances\n */\n\n\n SmoothScrollbar.getAll = function () {\n return Array.from(scrollbarMap.values());\n };\n /**\n * Removes scrollbar on the given element\n */\n\n\n SmoothScrollbar.destroy = function (elem) {\n var scrollbar = scrollbarMap.get(elem);\n\n if (scrollbar) {\n scrollbar.destroy();\n }\n };\n /**\n * Removes all scrollbar instances from current document\n */\n\n\n SmoothScrollbar.destroyAll = function () {\n scrollbarMap.forEach(function (scrollbar) {\n scrollbar.destroy();\n });\n };\n /**\n * Attaches plugins to scrollbars\n *\n * @param ...Plugins Scrollbar plugin classes\n */\n\n\n SmoothScrollbar.use = function () {\n var Plugins = [];\n\n for (var _i = 0; _i < arguments.length; _i++) {\n Plugins[_i] = arguments[_i];\n }\n\n return addPlugins.apply(void 0, Plugins);\n };\n /**\n * Attaches default style sheets to current document.\n * You don't need to call this method manually unless\n * you removed the default styles via `Scrollbar.detachStyle()`\n */\n\n\n SmoothScrollbar.attachStyle = function () {\n return attachStyle();\n };\n /**\n * Removes default styles from current document.\n * Use this method when you want to use your own css for scrollbars.\n */\n\n\n SmoothScrollbar.detachStyle = function () {\n return detachStyle();\n };\n\n SmoothScrollbar.version = \"8.5.2\";\n SmoothScrollbar.ScrollbarPlugin = ScrollbarPlugin;\n return SmoothScrollbar;\n}(Scrollbar);\n\nexport default SmoothScrollbar;","map":null,"metadata":{},"sourceType":"module"}