diff options
author | Mario <mario@mariovavti.com> | 2021-11-09 09:10:19 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-11-09 09:10:19 +0000 |
commit | fe7ecede700fe04631d23f36473e697ce2b364dc (patch) | |
tree | e713fc39dba500a25cb2acf8561e286fb8b41ff0 /vendor/twbs/bootstrap/js/dist/carousel.js | |
parent | 42de18d96d201d74e5df3ed1b8f6132cb00357b6 (diff) | |
parent | 089708ab9f90309a0c27ae633cf8f2604fce1170 (diff) | |
download | volse-hubzilla-fe7ecede700fe04631d23f36473e697ce2b364dc.tar.gz volse-hubzilla-fe7ecede700fe04631d23f36473e697ce2b364dc.tar.bz2 volse-hubzilla-fe7ecede700fe04631d23f36473e697ce2b364dc.zip |
Merge branch '6.4RC'6.4
Diffstat (limited to 'vendor/twbs/bootstrap/js/dist/carousel.js')
-rw-r--r-- | vendor/twbs/bootstrap/js/dist/carousel.js | 110 |
1 files changed, 66 insertions, 44 deletions
diff --git a/vendor/twbs/bootstrap/js/dist/carousel.js b/vendor/twbs/bootstrap/js/dist/carousel.js index 53e9a9687..94fb272a1 100644 --- a/vendor/twbs/bootstrap/js/dist/carousel.js +++ b/vendor/twbs/bootstrap/js/dist/carousel.js @@ -1,21 +1,27 @@ /*! - * Bootstrap carousel.js v5.0.2 (https://getbootstrap.com/) + * Bootstrap carousel.js v5.1.3 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/selector-engine.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./base-component.js')) : - typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './dom/event-handler', './dom/manipulator', './base-component'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Carousel = factory(global.SelectorEngine, global.EventHandler, global.Manipulator, global.Base)); -}(this, (function (SelectorEngine, EventHandler, Manipulator, BaseComponent) { 'use strict'; + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./dom/selector-engine.js'), require('./base-component.js')) : + typeof define === 'function' && define.amd ? define(['./dom/event-handler', './dom/manipulator', './dom/selector-engine', './base-component'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Carousel = factory(global.EventHandler, global.Manipulator, global.SelectorEngine, global.Base)); +})(this, (function (EventHandler, Manipulator, SelectorEngine, BaseComponent) { 'use strict'; - function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e }; - var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine); - var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler); - var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator); - var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent); + const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler); + const Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator); + const SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine); + const BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent); + /** + * -------------------------------------------------------------------------- + * Bootstrap (v5.1.3): util/index.js + * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) + * -------------------------------------------------------------------------- + */ const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp) const toType = obj => { @@ -90,8 +96,20 @@ return getComputedStyle(element).getPropertyValue('visibility') === 'visible'; }; + /** + * Trick to restart an element's animation + * + * @param {HTMLElement} element + * @return void + * + * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation + */ + - const reflow = element => element.offsetHeight; + const reflow = element => { + // eslint-disable-next-line no-unused-expressions + element.offsetHeight; + }; const getjQuery = () => { const { @@ -172,7 +190,7 @@ /** * -------------------------------------------------------------------------- - * Bootstrap (v5.0.2): carousel.js + * Bootstrap (v5.1.3): carousel.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ @@ -253,7 +271,7 @@ * ------------------------------------------------------------------------ */ - class Carousel extends BaseComponent__default['default'] { + class Carousel extends BaseComponent__default.default { constructor(element, config) { super(element); this._items = null; @@ -265,7 +283,7 @@ this.touchStartX = 0; this.touchDeltaX = 0; this._config = this._getConfig(config); - this._indicatorsElement = SelectorEngine__default['default'].findOne(SELECTOR_INDICATORS, this._element); + this._indicatorsElement = SelectorEngine__default.default.findOne(SELECTOR_INDICATORS, this._element); this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; this._pointerEvent = Boolean(window.PointerEvent); @@ -303,7 +321,7 @@ this._isPaused = true; } - if (SelectorEngine__default['default'].findOne(SELECTOR_NEXT_PREV, this._element)) { + if (SelectorEngine__default.default.findOne(SELECTOR_NEXT_PREV, this._element)) { triggerTransitionEnd(this._element); this.cycle(true); } @@ -330,7 +348,7 @@ } to(index) { - this._activeElement = SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE_ITEM, this._element); + this._activeElement = SelectorEngine__default.default.findOne(SELECTOR_ACTIVE_ITEM, this._element); const activeIndex = this._getItemIndex(this._activeElement); @@ -339,7 +357,7 @@ } if (this._isSliding) { - EventHandler__default['default'].one(this._element, EVENT_SLID, () => this.to(index)); + EventHandler__default.default.one(this._element, EVENT_SLID, () => this.to(index)); return; } @@ -357,7 +375,7 @@ _getConfig(config) { config = { ...Default, - ...Manipulator__default['default'].getDataAttributes(this._element), + ...Manipulator__default.default.getDataAttributes(this._element), ...(typeof config === 'object' ? config : {}) }; typeCheckConfig(NAME, config, DefaultType); @@ -383,12 +401,12 @@ _addEventListeners() { if (this._config.keyboard) { - EventHandler__default['default'].on(this._element, EVENT_KEYDOWN, event => this._keydown(event)); + EventHandler__default.default.on(this._element, EVENT_KEYDOWN, event => this._keydown(event)); } if (this._config.pause === 'hover') { - EventHandler__default['default'].on(this._element, EVENT_MOUSEENTER, event => this.pause(event)); - EventHandler__default['default'].on(this._element, EVENT_MOUSELEAVE, event => this.cycle(event)); + EventHandler__default.default.on(this._element, EVENT_MOUSEENTER, event => this.pause(event)); + EventHandler__default.default.on(this._element, EVENT_MOUSELEAVE, event => this.cycle(event)); } if (this._config.touch && this._touchSupported) { @@ -397,8 +415,12 @@ } _addTouchEventListeners() { + const hasPointerPenTouch = event => { + return this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH); + }; + const start = event => { - if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) { + if (hasPointerPenTouch(event)) { this.touchStartX = event.clientX; } else if (!this._pointerEvent) { this.touchStartX = event.touches[0].clientX; @@ -411,7 +433,7 @@ }; const end = event => { - if (this._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) { + if (hasPointerPenTouch(event)) { this.touchDeltaX = event.clientX - this.touchStartX; } @@ -435,19 +457,19 @@ } }; - SelectorEngine__default['default'].find(SELECTOR_ITEM_IMG, this._element).forEach(itemImg => { - EventHandler__default['default'].on(itemImg, EVENT_DRAG_START, e => e.preventDefault()); + SelectorEngine__default.default.find(SELECTOR_ITEM_IMG, this._element).forEach(itemImg => { + EventHandler__default.default.on(itemImg, EVENT_DRAG_START, event => event.preventDefault()); }); if (this._pointerEvent) { - EventHandler__default['default'].on(this._element, EVENT_POINTERDOWN, event => start(event)); - EventHandler__default['default'].on(this._element, EVENT_POINTERUP, event => end(event)); + EventHandler__default.default.on(this._element, EVENT_POINTERDOWN, event => start(event)); + EventHandler__default.default.on(this._element, EVENT_POINTERUP, event => end(event)); this._element.classList.add(CLASS_NAME_POINTER_EVENT); } else { - EventHandler__default['default'].on(this._element, EVENT_TOUCHSTART, event => start(event)); - EventHandler__default['default'].on(this._element, EVENT_TOUCHMOVE, event => move(event)); - EventHandler__default['default'].on(this._element, EVENT_TOUCHEND, event => end(event)); + EventHandler__default.default.on(this._element, EVENT_TOUCHSTART, event => start(event)); + EventHandler__default.default.on(this._element, EVENT_TOUCHMOVE, event => move(event)); + EventHandler__default.default.on(this._element, EVENT_TOUCHEND, event => end(event)); } } @@ -466,7 +488,7 @@ } _getItemIndex(element) { - this._items = element && element.parentNode ? SelectorEngine__default['default'].find(SELECTOR_ITEM, element.parentNode) : []; + this._items = element && element.parentNode ? SelectorEngine__default.default.find(SELECTOR_ITEM, element.parentNode) : []; return this._items.indexOf(element); } @@ -478,9 +500,9 @@ _triggerSlideEvent(relatedTarget, eventDirectionName) { const targetIndex = this._getItemIndex(relatedTarget); - const fromIndex = this._getItemIndex(SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE_ITEM, this._element)); + const fromIndex = this._getItemIndex(SelectorEngine__default.default.findOne(SELECTOR_ACTIVE_ITEM, this._element)); - return EventHandler__default['default'].trigger(this._element, EVENT_SLIDE, { + return EventHandler__default.default.trigger(this._element, EVENT_SLIDE, { relatedTarget, direction: eventDirectionName, from: fromIndex, @@ -490,10 +512,10 @@ _setActiveIndicatorElement(element) { if (this._indicatorsElement) { - const activeIndicator = SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE, this._indicatorsElement); + const activeIndicator = SelectorEngine__default.default.findOne(SELECTOR_ACTIVE, this._indicatorsElement); activeIndicator.classList.remove(CLASS_NAME_ACTIVE); activeIndicator.removeAttribute('aria-current'); - const indicators = SelectorEngine__default['default'].find(SELECTOR_INDICATOR, this._indicatorsElement); + const indicators = SelectorEngine__default.default.find(SELECTOR_INDICATOR, this._indicatorsElement); for (let i = 0; i < indicators.length; i++) { if (Number.parseInt(indicators[i].getAttribute('data-bs-slide-to'), 10) === this._getItemIndex(element)) { @@ -506,7 +528,7 @@ } _updateInterval() { - const element = this._activeElement || SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE_ITEM, this._element); + const element = this._activeElement || SelectorEngine__default.default.findOne(SELECTOR_ACTIVE_ITEM, this._element); if (!element) { return; @@ -525,7 +547,7 @@ _slide(directionOrOrder, element) { const order = this._directionToOrder(directionOrOrder); - const activeElement = SelectorEngine__default['default'].findOne(SELECTOR_ACTIVE_ITEM, this._element); + const activeElement = SelectorEngine__default.default.findOne(SELECTOR_ACTIVE_ITEM, this._element); const activeElementIndex = this._getItemIndex(activeElement); @@ -571,7 +593,7 @@ this._activeElement = nextElement; const triggerSlidEvent = () => { - EventHandler__default['default'].trigger(this._element, EVENT_SLID, { + EventHandler__default.default.trigger(this._element, EVENT_SLID, { relatedTarget: nextElement, direction: eventDirectionName, from: activeElementIndex, @@ -672,8 +694,8 @@ return; } - const config = { ...Manipulator__default['default'].getDataAttributes(target), - ...Manipulator__default['default'].getDataAttributes(this) + const config = { ...Manipulator__default.default.getDataAttributes(target), + ...Manipulator__default.default.getDataAttributes(this) }; const slideIndex = this.getAttribute('data-bs-slide-to'); @@ -698,9 +720,9 @@ */ - EventHandler__default['default'].on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler); - EventHandler__default['default'].on(window, EVENT_LOAD_DATA_API, () => { - const carousels = SelectorEngine__default['default'].find(SELECTOR_DATA_RIDE); + EventHandler__default.default.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler); + EventHandler__default.default.on(window, EVENT_LOAD_DATA_API, () => { + const carousels = SelectorEngine__default.default.find(SELECTOR_DATA_RIDE); for (let i = 0, len = carousels.length; i < len; i++) { Carousel.carouselInterface(carousels[i], Carousel.getInstance(carousels[i])); @@ -717,5 +739,5 @@ return Carousel; -}))); +})); //# sourceMappingURL=carousel.js.map |