Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/bootstrap.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'js/dist/carousel.js')
-rw-r--r--js/dist/carousel.js120
1 files changed, 35 insertions, 85 deletions
diff --git a/js/dist/carousel.js b/js/dist/carousel.js
index 91d1437b68..0c0282c0c8 100644
--- a/js/dist/carousel.js
+++ b/js/dist/carousel.js
@@ -1,29 +1,22 @@
/*!
- * Bootstrap carousel.js v5.0.0 (https://getbootstrap.com/)
+ * Bootstrap carousel.js v5.0.1 (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/data.js'), 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/data', './dom/event-handler', './dom/manipulator', './dom/selector-engine', './base-component'], factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Carousel = factory(global.Data, global.EventHandler, global.Manipulator, global.SelectorEngine, global.Base));
-}(this, (function (Data, EventHandler, Manipulator, SelectorEngine, BaseComponent) { 'use strict';
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./dom/selector-engine.js'), require('./dom/data.js'), require('./dom/event-handler.js'), require('./dom/manipulator.js'), require('./base-component.js')) :
+ typeof define === 'function' && define.amd ? define(['./dom/selector-engine', './dom/data', './dom/event-handler', './dom/manipulator', './base-component'], factory) :
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Carousel = factory(global.SelectorEngine, global.Data, global.EventHandler, global.Manipulator, global.Base));
+}(this, (function (SelectorEngine, Data, EventHandler, Manipulator, BaseComponent) { 'use strict';
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
+ var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
var Data__default = /*#__PURE__*/_interopDefaultLegacy(Data);
var EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
var Manipulator__default = /*#__PURE__*/_interopDefaultLegacy(Manipulator);
- var SelectorEngine__default = /*#__PURE__*/_interopDefaultLegacy(SelectorEngine);
var BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
- /**
- * --------------------------------------------------------------------------
- * Bootstrap (v5.0.0): util/index.js
- * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
- * --------------------------------------------------------------------------
- */
- const MILLISECONDS_MULTIPLIER = 1000;
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp)
const toType = obj => {
@@ -63,51 +56,20 @@
return selector ? document.querySelector(selector) : null;
};
- const getTransitionDurationFromElement = element => {
- if (!element) {
- return 0;
- } // Get transition-duration of the element
-
-
- let {
- transitionDuration,
- transitionDelay
- } = window.getComputedStyle(element);
- const floatTransitionDuration = Number.parseFloat(transitionDuration);
- const floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found
-
- if (!floatTransitionDuration && !floatTransitionDelay) {
- return 0;
- } // If multiple durations are defined, take the first
-
-
- transitionDuration = transitionDuration.split(',')[0];
- transitionDelay = transitionDelay.split(',')[0];
- return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
- };
-
const triggerTransitionEnd = element => {
element.dispatchEvent(new Event(TRANSITION_END));
};
- const isElement = obj => (obj[0] || obj).nodeType;
-
- const emulateTransitionEnd = (element, duration) => {
- let called = false;
- const durationPadding = 5;
- const emulatedDuration = duration + durationPadding;
+ const isElement = obj => {
+ if (!obj || typeof obj !== 'object') {
+ return false;
+ }
- function listener() {
- called = true;
- element.removeEventListener(TRANSITION_END, listener);
+ if (typeof obj.jquery !== 'undefined') {
+ obj = obj[0];
}
- element.addEventListener(TRANSITION_END, listener);
- setTimeout(() => {
- if (!called) {
- triggerTransitionEnd(element);
- }
- }, emulatedDuration);
+ return typeof obj.nodeType !== 'undefined';
};
const typeCheckConfig = (componentName, config, configTypes) => {
@@ -160,12 +122,13 @@
const isRTL = () => document.documentElement.dir === 'rtl';
- const defineJQueryPlugin = (name, plugin) => {
+ const defineJQueryPlugin = plugin => {
onDOMContentLoaded(() => {
const $ = getjQuery();
/* istanbul ignore if */
if ($) {
+ const name = plugin.NAME;
const JQUERY_NO_CONFLICT = $.fn[name];
$.fn[name] = plugin.jQueryInterface;
$.fn[name].Constructor = plugin;
@@ -180,7 +143,7 @@
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.0.0): carousel.js
+ * Bootstrap (v5.0.1): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -281,8 +244,8 @@
return Default;
}
- static get DATA_KEY() {
- return DATA_KEY;
+ static get NAME() {
+ return NAME;
} // Public
@@ -360,17 +323,6 @@
const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV;
this._slide(order, this._items[index]);
- }
-
- dispose() {
- this._items = null;
- this._config = null;
- this._interval = null;
- this._isPaused = null;
- this._isSliding = null;
- this._activeElement = null;
- this._indicatorsElement = null;
- super.dispose();
} // Private
@@ -599,37 +551,35 @@
this._activeElement = nextElement;
+ const triggerSlidEvent = () => {
+ EventHandler__default['default'].trigger(this._element, EVENT_SLID, {
+ relatedTarget: nextElement,
+ direction: eventDirectionName,
+ from: activeElementIndex,
+ to: nextElementIndex
+ });
+ };
+
if (this._element.classList.contains(CLASS_NAME_SLIDE)) {
nextElement.classList.add(orderClassName);
reflow(nextElement);
activeElement.classList.add(directionalClassName);
nextElement.classList.add(directionalClassName);
- const transitionDuration = getTransitionDurationFromElement(activeElement);
- EventHandler__default['default'].one(activeElement, 'transitionend', () => {
+
+ const completeCallBack = () => {
nextElement.classList.remove(directionalClassName, orderClassName);
nextElement.classList.add(CLASS_NAME_ACTIVE);
activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName);
this._isSliding = false;
- setTimeout(() => {
- EventHandler__default['default'].trigger(this._element, EVENT_SLID, {
- relatedTarget: nextElement,
- direction: eventDirectionName,
- from: activeElementIndex,
- to: nextElementIndex
- });
- }, 0);
- });
- emulateTransitionEnd(activeElement, transitionDuration);
+ setTimeout(triggerSlidEvent, 0);
+ };
+
+ this._queueCallback(completeCallBack, activeElement, true);
} else {
activeElement.classList.remove(CLASS_NAME_ACTIVE);
nextElement.classList.add(CLASS_NAME_ACTIVE);
this._isSliding = false;
- EventHandler__default['default'].trigger(this._element, EVENT_SLID, {
- relatedTarget: nextElement,
- direction: eventDirectionName,
- from: activeElementIndex,
- to: nextElementIndex
- });
+ triggerSlidEvent();
}
if (isCycling) {
@@ -748,7 +698,7 @@
* add .Carousel to jQuery only if jQuery is present
*/
- defineJQueryPlugin(NAME, Carousel);
+ defineJQueryPlugin(Carousel);
return Carousel;