Limmat/assets/libs/simplebar/dist/simplebar.esm.js.map

1 line
70 KiB
Plaintext
Raw Permalink Normal View History

2025-01-07 03:45:35 +01:00
{"version":3,"file":"simplebar.esm.js","sources":["../src/helpers.js","../src/scrollbar-width.js","../src/simplebar.js","../src/index.js"],"sourcesContent":["// Helper function to retrieve options from element attributes\nexport const getOptions = function(obj) {\n const options = Array.prototype.reduce.call(\n obj,\n (acc, attribute) => {\n const option = attribute.name.match(/data-simplebar-(.+)/);\n if (option) {\n const key = option[1].replace(/\\W+(.)/g, (x, chr) => chr.toUpperCase());\n switch (attribute.value) {\n case 'true':\n acc[key] = true;\n break;\n case 'false':\n acc[key] = false;\n break;\n case undefined:\n acc[key] = true;\n break;\n default:\n acc[key] = attribute.value;\n }\n }\n return acc;\n },\n {}\n );\n return options;\n};\n\nexport function getElementWindow(element) {\n if (\n !element ||\n !element.ownerDocument ||\n !element.ownerDocument.defaultView\n ) {\n return window;\n }\n return element.ownerDocument.defaultView;\n}\n\nexport function getElementDocument(element) {\n if (!element || !element.ownerDocument) {\n return document;\n }\n return element.ownerDocument;\n}\n","import canUseDOM from 'can-use-dom';\nimport { getElementDocument } from \"./helpers\";\n\nlet cachedScrollbarWidth = null;\nlet cachedDevicePixelRatio = null;\n\nif (canUseDOM) {\n window.addEventListener('resize', () => {\n if (cachedDevicePixelRatio !== window.devicePixelRatio) {\n cachedDevicePixelRatio = window.devicePixelRatio;\n cachedScrollbarWidth = null;\n }\n });\n}\n\nexport default function scrollbarWidth(el) {\n if (cachedScrollbarWidth === null) {\n \n const document = getElementDocument(el);\n \n if (typeof document === 'undefined') {\n cachedScrollbarWidth = 0;\n return cachedScrollbarWidth;\n }\n const body = document.body;\n const box = document.createElement('div');\n\n box.classList.add('simplebar-hide-scrollbar');\n\n body.appendChild(box);\n\n const width = box.getBoundingClientRect().right;\n\n body.removeChild(box);\n\n cachedScrollbarWidth = width;\n }\n\n return cachedScrollbarWidth;\n}\n","import throttle from 'lodash.throttle';\nimport debounce from 'lodash.debounce';\nimport memoize from 'lodash.memoize';\nimport { ResizeObserver } from '@juggle/resize-observer';\nimport canUseDOM from 'can-use-dom';\nimport scrollbarWidth from './scrollbar-width';\nimport { getElementWindow, getElementDocument } from './helpers';\n\nexport default class SimpleBar {\n constructor(element, options) {\n this.el = element;\n this.minScrollbarWidth = 20;\n this.options = { ...SimpleBar.defaultOptions, ...options };\n this.classNames = {\n ...SimpleBar.defaultOptions.classNames,\n ...this.options.classNames\n };\n this.axis = {\n x: {\n scrollOffsetAttr: 'scrollLeft',\n sizeAttr: 'width',\n scrollSizeAttr: 'scrollWidth',\n offsetSizeAttr: 'offsetWidth',\n offsetAttr: 'left',\n overflowAttr: 'overflowX',\n dragOffset: 0,\n isOverflowing: true,\n isVisible: false,\n forceVisible: false,\n track: {},\n scrollbar: {}\n },\n y: {\n scrollOffsetAttr: 'scrollTop',\n sizeAttr: 'height',\n scrollSizeAttr: 'scrollHeight',\n offsetSizeAttr: 'offsetHeight',\n offsetAttr: 'top',\n overflowAttr: 'overflowY',\n dragOffset: 0,\n isOverflowing: true,\n isVisible: false,\n forceVisible: false,\n track: {},\n scrollbar: {}\n }\n };\n this.removePreventClickId = null;\n\n // Don't re-instantiate over an existing one\n if (SimpleBar.instances.has(this.el)) {\n return;\n }\n\n this.recalculate = throttle(this.recalculate.bind(this), 64);\n this.onMouseMove = throttle(this.onMouseMove.bind(this), 64);\n this.hideScrollbars = debounce(\n