0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00
Bootstrap/js/dist/scrollspy.js.map
2019-11-08 10:11:23 +02:00

1 line
27 KiB
Plaintext

{"version":3,"file":"scrollspy.js","sources":["../src/util/index.js","../src/scrollspy.js"],"sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.3.1): util/index.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst MAX_UID = 1000000\nconst MILLISECONDS_MULTIPLIER = 1000\nconst TRANSITION_END = 'transitionend'\n\n// Shoutout AngusCroll (https://goo.gl/pxwQGp)\nconst toType = obj => ({}.toString.call(obj).match(/\\s([a-z]+)/i)[1].toLowerCase())\n\n/**\n * --------------------------------------------------------------------------\n * Public Util Api\n * --------------------------------------------------------------------------\n */\n\nconst getUID = prefix => {\n do {\n prefix += ~~(Math.random() * MAX_UID) // \"~~\" acts like a faster Math.floor() here\n } while (document.getElementById(prefix))\n\n return prefix\n}\n\nconst getSelector = element => {\n let selector = element.getAttribute('data-target')\n\n if (!selector || selector === '#') {\n const hrefAttr = element.getAttribute('href')\n\n selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null\n }\n\n return selector\n}\n\nconst getSelectorFromElement = element => {\n const selector = getSelector(element)\n\n if (selector) {\n return document.querySelector(selector) ? selector : null\n }\n\n return null\n}\n\nconst getElementFromSelector = element => {\n const selector = getSelector(element)\n\n return selector ? document.querySelector(selector) : null\n}\n\nconst getTransitionDurationFromElement = element => {\n if (!element) {\n return 0\n }\n\n // Get transition-duration of the element\n let {\n transitionDuration,\n transitionDelay\n } = window.getComputedStyle(element)\n\n const floatTransitionDuration = parseFloat(transitionDuration)\n const floatTransitionDelay = parseFloat(transitionDelay)\n\n // Return 0 if element or transition duration is not found\n if (!floatTransitionDuration && !floatTransitionDelay) {\n return 0\n }\n\n // If multiple durations are defined, take the first\n transitionDuration = transitionDuration.split(',')[0]\n transitionDelay = transitionDelay.split(',')[0]\n\n return (parseFloat(transitionDuration) + parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER\n}\n\nconst triggerTransitionEnd = element => {\n const evt = document.createEvent('HTMLEvents')\n\n evt.initEvent(TRANSITION_END, true, true)\n element.dispatchEvent(evt)\n}\n\nconst isElement = obj => (obj[0] || obj).nodeType\n\nconst emulateTransitionEnd = (element, duration) => {\n let called = false\n const durationPadding = 5\n const emulatedDuration = duration + durationPadding\n function listener() {\n called = true\n element.removeEventListener(TRANSITION_END, listener)\n }\n\n element.addEventListener(TRANSITION_END, listener)\n setTimeout(() => {\n if (!called) {\n triggerTransitionEnd(element)\n }\n }, emulatedDuration)\n}\n\nconst typeCheckConfig = (componentName, config, configTypes) => {\n Object.keys(configTypes)\n .forEach(property => {\n const expectedTypes = configTypes[property]\n const value = config[property]\n const valueType = value && isElement(value) ?\n 'element' :\n toType(value)\n\n if (!new RegExp(expectedTypes).test(valueType)) {\n throw new Error(\n `${componentName.toUpperCase()}: ` +\n `Option \"${property}\" provided type \"${valueType}\" ` +\n `but expected type \"${expectedTypes}\".`)\n }\n })\n}\n\nconst makeArray = nodeList => {\n if (!nodeList) {\n return []\n }\n\n return [].slice.call(nodeList)\n}\n\nconst isVisible = element => {\n if (!element) {\n return false\n }\n\n if (element.style && element.parentNode && element.parentNode.style) {\n const elementStyle = getComputedStyle(element)\n const parentNodeStyle = getComputedStyle(element.parentNode)\n\n return elementStyle.display !== 'none' &&\n parentNodeStyle.display !== 'none' &&\n elementStyle.visibility !== 'hidden'\n }\n\n return false\n}\n\nconst findShadowRoot = element => {\n if (!document.documentElement.attachShadow) {\n return null\n }\n\n // Can find the shadow root otherwise it'll return the document\n if (typeof element.getRootNode === 'function') {\n const root = element.getRootNode()\n return root instanceof ShadowRoot ? root : null\n }\n\n if (element instanceof ShadowRoot) {\n return element\n }\n\n // when we don't find a shadow root\n if (!element.parentNode) {\n return null\n }\n\n return findShadowRoot(element.parentNode)\n}\n\nconst noop = () => function () {}\n\nconst reflow = element => element.offsetHeight\n\nconst getjQuery = () => {\n const { jQuery } = window\n\n if (jQuery && !document.body.hasAttribute('data-no-jquery')) {\n return jQuery\n }\n\n return null\n}\n\nexport {\n getjQuery,\n TRANSITION_END,\n getUID,\n getSelectorFromElement,\n getElementFromSelector,\n getTransitionDurationFromElement,\n triggerTransitionEnd,\n isElement,\n emulateTransitionEnd,\n typeCheckConfig,\n makeArray,\n isVisible,\n findShadowRoot,\n noop,\n reflow\n}\n","/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.3.1): scrollspy.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport {\n getjQuery,\n getSelectorFromElement,\n getUID,\n makeArray,\n typeCheckConfig\n} from './util/index'\nimport Data from './dom/data'\nimport EventHandler from './dom/event-handler'\nimport Manipulator from './dom/manipulator'\nimport SelectorEngine from './dom/selector-engine'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NAME = 'scrollspy'\nconst VERSION = '4.3.1'\nconst DATA_KEY = 'bs.scrollspy'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\n\nconst Default = {\n offset: 10,\n method: 'auto',\n target: ''\n}\n\nconst DefaultType = {\n offset: 'number',\n method: 'string',\n target: '(string|element)'\n}\n\nconst Event = {\n ACTIVATE: `activate${EVENT_KEY}`,\n SCROLL: `scroll${EVENT_KEY}`,\n LOAD_DATA_API: `load${EVENT_KEY}${DATA_API_KEY}`\n}\n\nconst ClassName = {\n DROPDOWN_ITEM: 'dropdown-item',\n ACTIVE: 'active'\n}\n\nconst Selector = {\n DATA_SPY: '[data-spy=\"scroll\"]',\n NAV_LIST_GROUP: '.nav, .list-group',\n NAV_LINKS: '.nav-link',\n NAV_ITEMS: '.nav-item',\n LIST_ITEMS: '.list-group-item',\n DROPDOWN: '.dropdown',\n DROPDOWN_TOGGLE: '.dropdown-toggle'\n}\n\nconst OffsetMethod = {\n OFFSET: 'offset',\n POSITION: 'position'\n}\n\n/**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\nclass ScrollSpy {\n constructor(element, config) {\n this._element = element\n this._scrollElement = element.tagName === 'BODY' ? window : element\n this._config = this._getConfig(config)\n this._selector = `${this._config.target} ${Selector.NAV_LINKS},` +\n `${this._config.target} ${Selector.LIST_ITEMS},` +\n `${this._config.target} .${ClassName.DROPDOWN_ITEM}`\n this._offsets = []\n this._targets = []\n this._activeTarget = null\n this._scrollHeight = 0\n\n EventHandler.on(this._scrollElement, Event.SCROLL, event => this._process(event))\n\n this.refresh()\n this._process()\n\n Data.setData(element, DATA_KEY, this)\n }\n\n // Getters\n\n static get VERSION() {\n return VERSION\n }\n\n static get Default() {\n return Default\n }\n\n // Public\n\n refresh() {\n const autoMethod = this._scrollElement === this._scrollElement.window ?\n OffsetMethod.OFFSET :\n OffsetMethod.POSITION\n\n const offsetMethod = this._config.method === 'auto' ?\n autoMethod :\n this._config.method\n\n const offsetBase = offsetMethod === OffsetMethod.POSITION ?\n this._getScrollTop() :\n 0\n\n this._offsets = []\n this._targets = []\n\n this._scrollHeight = this._getScrollHeight()\n\n const targets = makeArray(SelectorEngine.find(this._selector))\n\n targets\n .map(element => {\n let target\n const targetSelector = getSelectorFromElement(element)\n\n if (targetSelector) {\n target = SelectorEngine.findOne(targetSelector)\n }\n\n if (target) {\n const targetBCR = target.getBoundingClientRect()\n if (targetBCR.width || targetBCR.height) {\n return [\n Manipulator[offsetMethod](target).top + offsetBase,\n targetSelector\n ]\n }\n }\n\n return null\n })\n .filter(item => item)\n .sort((a, b) => a[0] - b[0])\n .forEach(item => {\n this._offsets.push(item[0])\n this._targets.push(item[1])\n })\n }\n\n dispose() {\n Data.removeData(this._element, DATA_KEY)\n EventHandler.off(this._scrollElement, EVENT_KEY)\n\n this._element = null\n this._scrollElement = null\n this._config = null\n this._selector = null\n this._offsets = null\n this._targets = null\n this._activeTarget = null\n this._scrollHeight = null\n }\n\n // Private\n\n _getConfig(config) {\n config = {\n ...Default,\n ...typeof config === 'object' && config ? config : {}\n }\n\n if (typeof config.target !== 'string') {\n let { id } = config.target\n if (!id) {\n id = getUID(NAME)\n config.target.id = id\n }\n\n config.target = `#${id}`\n }\n\n typeCheckConfig(NAME, config, DefaultType)\n\n return config\n }\n\n _getScrollTop() {\n return this._scrollElement === window ?\n this._scrollElement.pageYOffset :\n this._scrollElement.scrollTop\n }\n\n _getScrollHeight() {\n return this._scrollElement.scrollHeight || Math.max(\n document.body.scrollHeight,\n document.documentElement.scrollHeight\n )\n }\n\n _getOffsetHeight() {\n return this._scrollElement === window ?\n window.innerHeight :\n this._scrollElement.getBoundingClientRect().height\n }\n\n _process() {\n const scrollTop = this._getScrollTop() + this._config.offset\n const scrollHeight = this._getScrollHeight()\n const maxScroll = this._config.offset +\n scrollHeight -\n this._getOffsetHeight()\n\n if (this._scrollHeight !== scrollHeight) {\n this.refresh()\n }\n\n if (scrollTop >= maxScroll) {\n const target = this._targets[this._targets.length - 1]\n\n if (this._activeTarget !== target) {\n this._activate(target)\n }\n\n return\n }\n\n if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) {\n this._activeTarget = null\n this._clear()\n return\n }\n\n const offsetLength = this._offsets.length\n for (let i = offsetLength; i--;) {\n const isActiveTarget = this._activeTarget !== this._targets[i] &&\n scrollTop >= this._offsets[i] &&\n (typeof this._offsets[i + 1] === 'undefined' ||\n scrollTop < this._offsets[i + 1])\n\n if (isActiveTarget) {\n this._activate(this._targets[i])\n }\n }\n }\n\n _activate(target) {\n this._activeTarget = target\n\n this._clear()\n\n const queries = this._selector.split(',')\n .map(selector => `${selector}[data-target=\"${target}\"],${selector}[href=\"${target}\"]`)\n\n const link = SelectorEngine.findOne(queries.join(','))\n\n if (link.classList.contains(ClassName.DROPDOWN_ITEM)) {\n SelectorEngine\n .findOne(Selector.DROPDOWN_TOGGLE, SelectorEngine.closest(link, Selector.DROPDOWN))\n .classList.add(ClassName.ACTIVE)\n\n link.classList.add(ClassName.ACTIVE)\n } else {\n // Set triggered link as active\n link.classList.add(ClassName.ACTIVE)\n\n SelectorEngine\n .parents(link, Selector.NAV_LIST_GROUP)\n .forEach(listGroup => {\n // Set triggered links parents as active\n // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor\n SelectorEngine.prev(listGroup, `${Selector.NAV_LINKS}, ${Selector.LIST_ITEMS}`)\n .forEach(item => item.classList.add(ClassName.ACTIVE))\n\n // Handle special case when .nav-link is inside .nav-item\n SelectorEngine.prev(listGroup, Selector.NAV_ITEMS)\n .forEach(navItem => {\n SelectorEngine.children(navItem, Selector.NAV_LINKS)\n .forEach(item => item.classList.add(ClassName.ACTIVE))\n })\n })\n }\n\n EventHandler.trigger(this._scrollElement, Event.ACTIVATE, {\n relatedTarget: target\n })\n }\n\n _clear() {\n makeArray(SelectorEngine.find(this._selector))\n .filter(node => node.classList.contains(ClassName.ACTIVE))\n .forEach(node => node.classList.remove(ClassName.ACTIVE))\n }\n\n // Static\n\n static jQueryInterface(config) {\n return this.each(function () {\n let data = Data.getData(this, DATA_KEY)\n const _config = typeof config === 'object' && config\n\n if (!data) {\n data = new ScrollSpy(this, _config)\n }\n\n if (typeof config === 'string') {\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config]()\n }\n })\n }\n\n static getInstance(element) {\n return Data.getData(element, DATA_KEY)\n }\n}\n\n/**\n * ------------------------------------------------------------------------\n * Data Api implementation\n * ------------------------------------------------------------------------\n */\n\nEventHandler.on(window, Event.LOAD_DATA_API, () => {\n makeArray(SelectorEngine.find(Selector.DATA_SPY))\n .forEach(spy => new ScrollSpy(spy, Manipulator.getDataAttributes(spy)))\n})\n\nconst $ = getjQuery()\n\n/**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n */\n/* istanbul ignore if */\nif ($) {\n const JQUERY_NO_CONFLICT = $.fn[NAME]\n $.fn[NAME] = ScrollSpy.jQueryInterface\n $.fn[NAME].Constructor = ScrollSpy\n $.fn[NAME].noConflict = () => {\n $.fn[NAME] = JQUERY_NO_CONFLICT\n return ScrollSpy.jQueryInterface\n }\n}\n\nexport default ScrollSpy\n"],"names":["MAX_UID","toType","obj","toString","call","match","toLowerCase","getUID","prefix","Math","random","document","getElementById","getSelector","element","selector","getAttribute","hrefAttr","trim","getSelectorFromElement","querySelector","isElement","nodeType","typeCheckConfig","componentName","config","configTypes","Object","keys","forEach","property","expectedTypes","value","valueType","RegExp","test","Error","toUpperCase","makeArray","nodeList","slice","getjQuery","window","jQuery","body","hasAttribute","NAME","VERSION","DATA_KEY","EVENT_KEY","DATA_API_KEY","Default","offset","method","target","DefaultType","Event","ACTIVATE","SCROLL","LOAD_DATA_API","ClassName","DROPDOWN_ITEM","ACTIVE","Selector","DATA_SPY","NAV_LIST_GROUP","NAV_LINKS","NAV_ITEMS","LIST_ITEMS","DROPDOWN","DROPDOWN_TOGGLE","OffsetMethod","OFFSET","POSITION","ScrollSpy","_element","_scrollElement","tagName","_config","_getConfig","_selector","_offsets","_targets","_activeTarget","_scrollHeight","EventHandler","on","event","_process","refresh","Data","setData","autoMethod","offsetMethod","offsetBase","_getScrollTop","_getScrollHeight","targets","SelectorEngine","find","map","targetSelector","findOne","targetBCR","getBoundingClientRect","width","height","Manipulator","top","filter","item","sort","a","b","push","dispose","removeData","off","id","pageYOffset","scrollTop","scrollHeight","max","documentElement","_getOffsetHeight","innerHeight","maxScroll","length","_activate","_clear","offsetLength","i","isActiveTarget","queries","split","link","join","classList","contains","closest","add","parents","listGroup","prev","navItem","children","trigger","relatedTarget","node","remove","jQueryInterface","each","data","getData","TypeError","getInstance","spy","getDataAttributes","$","JQUERY_NO_CONFLICT","fn","Constructor","noConflict"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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