1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-08-21 12:51:52 +02:00

Release v5.2.1 (#37098)

* Bump version to v5.2.1.

* Dist
This commit is contained in:
XhmikosR
2022-09-07 18:31:39 +03:00
committed by GitHub
parent 23fb7a7915
commit 23e50829f9
131 changed files with 644 additions and 567 deletions

View File

@@ -1,5 +1,5 @@
/*!
* Bootstrap v5.2.0 (https://getbootstrap.com/)
* Bootstrap v5.2.1 (https://getbootstrap.com/)
* Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
@@ -11,7 +11,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.0): util/index.js
* Bootstrap (v5.2.1): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -326,7 +326,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.0): dom/event-handler.js
* Bootstrap (v5.2.1): dom/event-handler.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -595,7 +595,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.0): dom/data.js
* Bootstrap (v5.2.1): dom/data.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -647,7 +647,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.0): dom/manipulator.js
* Bootstrap (v5.2.1): dom/manipulator.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -717,7 +717,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.0): util/config.js
* Bootstrap (v5.2.1): util/config.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -778,7 +778,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.0): base-component.js
* Bootstrap (v5.2.1): base-component.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -786,7 +786,7 @@
* Constants
*/
const VERSION = '5.2.0';
const VERSION = '5.2.1';
/**
* Class definition
*/
@@ -857,7 +857,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.0): util/component-functions.js
* Bootstrap (v5.2.1): util/component-functions.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -883,7 +883,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.0): alert.js
* Bootstrap (v5.2.1): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -963,7 +963,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.0): button.js
* Bootstrap (v5.2.1): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -1025,7 +1025,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.0): dom/selector-engine.js
* Bootstrap (v5.2.1): dom/selector-engine.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -1096,7 +1096,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.0): util/swipe.js
* Bootstrap (v5.2.1): util/swipe.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -1232,7 +1232,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.0): carousel.js
* Bootstrap (v5.2.1): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -1680,7 +1680,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.0): collapse.js
* Bootstrap (v5.2.1): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -2128,38 +2128,57 @@
var min = Math.min;
var round = Math.round;
function getBoundingClientRect(element, includeScale) {
function getUAString() {
var uaData = navigator.userAgentData;
if (uaData != null && uaData.brands) {
return uaData.brands.map(function (item) {
return item.brand + "/" + item.version;
}).join(' ');
}
return navigator.userAgent;
}
function isLayoutViewport() {
return !/^((?!chrome|android).)*safari/i.test(getUAString());
}
function getBoundingClientRect(element, includeScale, isFixedStrategy) {
if (includeScale === void 0) {
includeScale = false;
}
var rect = element.getBoundingClientRect();
if (isFixedStrategy === void 0) {
isFixedStrategy = false;
}
var clientRect = element.getBoundingClientRect();
var scaleX = 1;
var scaleY = 1;
if (isHTMLElement(element) && includeScale) {
var offsetHeight = element.offsetHeight;
var offsetWidth = element.offsetWidth; // Do not attempt to divide by 0, otherwise we get `Infinity` as scale
// Fallback to 1 in case both values are `0`
if (offsetWidth > 0) {
scaleX = round(rect.width) / offsetWidth || 1;
}
if (offsetHeight > 0) {
scaleY = round(rect.height) / offsetHeight || 1;
}
if (includeScale && isHTMLElement(element)) {
scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
}
var _ref = isElement(element) ? getWindow(element) : window,
visualViewport = _ref.visualViewport;
var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
var width = clientRect.width / scaleX;
var height = clientRect.height / scaleY;
return {
width: rect.width / scaleX,
height: rect.height / scaleY,
top: rect.top / scaleY,
right: rect.right / scaleX,
bottom: rect.bottom / scaleY,
left: rect.left / scaleX,
x: rect.left / scaleX,
y: rect.top / scaleY
width: width,
height: height,
top: y,
right: x + width,
bottom: y + height,
left: x,
x: x,
y: y
};
}
@@ -2254,8 +2273,8 @@
function getContainingBlock(element) {
var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') !== -1;
var isIE = navigator.userAgent.indexOf('Trident') !== -1;
var isFirefox = /firefox/i.test(getUAString());
var isIE = /Trident/i.test(getUAString());
if (isIE && isHTMLElement(element)) {
// In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
@@ -2676,31 +2695,21 @@
return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
}
function getViewportRect(element) {
function getViewportRect(element, strategy) {
var win = getWindow(element);
var html = getDocumentElement(element);
var visualViewport = win.visualViewport;
var width = html.clientWidth;
var height = html.clientHeight;
var x = 0;
var y = 0; // NB: This isn't supported on iOS <= 12. If the keyboard is open, the popper
// can be obscured underneath it.
// Also, `html.clientHeight` adds the bottom bar height in Safari iOS, even
// if it isn't open, so if this isn't available, the popper will be detected
// to overflow the bottom of the screen too early.
var y = 0;
if (visualViewport) {
width = visualViewport.width;
height = visualViewport.height; // Uses Layout Viewport (like Chrome; Safari does not currently)
// In Chrome, it returns a value very close to 0 (+/-) but contains rounding
// errors due to floating point numbers, so we need to check precision.
// Safari returns a number <= 0, usually < -1 when pinch-zoomed
// Feature detection fails in mobile emulation mode in Chrome.
// Math.abs(win.innerWidth / visualViewport.scale - visualViewport.width) <
// 0.001
// Fallback here: "Not Safari" userAgent
height = visualViewport.height;
var layoutViewport = isLayoutViewport();
if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
if (layoutViewport || !layoutViewport && strategy === 'fixed') {
x = visualViewport.offsetLeft;
y = visualViewport.offsetTop;
}
@@ -2794,8 +2803,8 @@
});
}
function getInnerBoundingClientRect(element) {
var rect = getBoundingClientRect(element);
function getInnerBoundingClientRect(element, strategy) {
var rect = getBoundingClientRect(element, false, strategy === 'fixed');
rect.top = rect.top + element.clientTop;
rect.left = rect.left + element.clientLeft;
rect.bottom = rect.top + element.clientHeight;
@@ -2807,8 +2816,8 @@
return rect;
}
function getClientRectFromMixedType(element, clippingParent) {
return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
function getClientRectFromMixedType(element, clippingParent, strategy) {
return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
} // A "clipping parent" is an overflowable container with the characteristic of
// clipping (or hiding) overflowing elements with a position different from
// `initial`
@@ -2831,18 +2840,18 @@
// clipping parents
function getClippingRect(element, boundary, rootBoundary) {
function getClippingRect(element, boundary, rootBoundary, strategy) {
var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
var firstClippingParent = clippingParents[0];
var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
var rect = getClientRectFromMixedType(element, clippingParent);
var rect = getClientRectFromMixedType(element, clippingParent, strategy);
accRect.top = max(rect.top, accRect.top);
accRect.right = min(rect.right, accRect.right);
accRect.bottom = min(rect.bottom, accRect.bottom);
accRect.left = max(rect.left, accRect.left);
return accRect;
}, getClientRectFromMixedType(element, firstClippingParent));
}, getClientRectFromMixedType(element, firstClippingParent, strategy));
clippingRect.width = clippingRect.right - clippingRect.left;
clippingRect.height = clippingRect.bottom - clippingRect.top;
clippingRect.x = clippingRect.left;
@@ -2923,6 +2932,8 @@
var _options = options,
_options$placement = _options.placement,
placement = _options$placement === void 0 ? state.placement : _options$placement,
_options$strategy = _options.strategy,
strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,
_options$boundary = _options.boundary,
boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
_options$rootBoundary = _options.rootBoundary,
@@ -2937,7 +2948,7 @@
var altContext = elementContext === popper ? reference : popper;
var popperRect = state.rects.popper;
var element = state.elements[altBoundary ? altContext : elementContext];
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
var referenceClientRect = getBoundingClientRect(state.elements.reference);
var popperOffsets = computeOffsets({
reference: referenceClientRect,
@@ -3451,7 +3462,7 @@
var isOffsetParentAnElement = isHTMLElement(offsetParent);
var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
var documentElement = getDocumentElement(offsetParent);
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
var scroll = {
scrollLeft: 0,
scrollTop: 0
@@ -3805,7 +3816,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.0): dropdown.js
* Bootstrap (v5.2.1): dropdown.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -3875,8 +3886,9 @@
super(element, config);
this._popper = null;
this._parent = this._element.parentNode; // dropdown wrapper
// todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.2/forms/input-group/
this._menu = SelectorEngine.findOne(SELECTOR_MENU, this._parent);
this._menu = SelectorEngine.next(this._element, SELECTOR_MENU)[0] || SelectorEngine.prev(this._element, SELECTOR_MENU)[0];
this._inNavbar = this._detectNavbar();
} // Getters
@@ -4192,8 +4204,9 @@
return;
}
event.preventDefault();
const getToggleButton = SelectorEngine.findOne(SELECTOR_DATA_TOGGLE$3, event.delegateTarget.parentNode);
event.preventDefault(); // todo: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.2/forms/input-group/
const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0] || SelectorEngine.next(this, SELECTOR_DATA_TOGGLE$3)[0];
const instance = Dropdown.getOrCreateInstance(getToggleButton);
if (isUpOrDownEvent) {
@@ -4235,7 +4248,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.0): util/scrollBar.js
* Bootstrap (v5.2.1): util/scrollBar.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -4354,7 +4367,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.0): util/backdrop.js
* Bootstrap (v5.2.1): util/backdrop.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -4500,7 +4513,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.0): util/focustrap.js
* Bootstrap (v5.2.1): util/focustrap.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -4609,7 +4622,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.0): modal.js
* Bootstrap (v5.2.1): modal.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -4628,6 +4641,7 @@
const EVENT_SHOW$4 = `show${EVENT_KEY$4}`;
const EVENT_SHOWN$4 = `shown${EVENT_KEY$4}`;
const EVENT_RESIZE$1 = `resize${EVENT_KEY$4}`;
const EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY$4}`;
const EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY$4}`;
const EVENT_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$4}`;
const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$4}${DATA_API_KEY$2}`;
@@ -4820,20 +4834,22 @@
}
});
EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, event => {
if (event.target !== event.currentTarget) {
// click is inside modal-dialog
return;
}
EventHandler.one(this._element, EVENT_CLICK_DISMISS, event2 => {
// a bad trick to segregate clicks that may start inside dialog but end outside, and avoid listen to scrollbar clicks
if (this._dialog.contains(event.target) || this._dialog.contains(event2.target)) {
return;
}
if (this._config.backdrop === 'static') {
this._triggerBackdropTransition();
if (this._config.backdrop === 'static') {
this._triggerBackdropTransition();
return;
}
return;
}
if (this._config.backdrop) {
this.hide();
}
if (this._config.backdrop) {
this.hide();
}
});
});
}
@@ -4982,7 +4998,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.0): offcanvas.js
* Bootstrap (v5.2.1): offcanvas.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -5256,7 +5272,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.0): util/sanitizer.js
* Bootstrap (v5.2.1): util/sanitizer.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -5361,7 +5377,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.0): util/template-factory.js
* Bootstrap (v5.2.1): util/template-factory.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -5519,7 +5535,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.0): tooltip.js
* Bootstrap (v5.2.1): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -5608,7 +5624,7 @@
this._isEnabled = true;
this._timeout = 0;
this._isHovered = false;
this._isHovered = null;
this._activeTrigger = {};
this._popper = null;
this._templateFactory = null;
@@ -5681,6 +5697,10 @@
this.tip.remove();
}
if (this._config.originalTitle) {
this._element.setAttribute('title', this._config.originalTitle);
}
this._disposePopper();
super.dispose();
@@ -5741,13 +5761,13 @@
}
const complete = () => {
const previousHoverState = this._isHovered;
this._isHovered = false;
EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN$2));
if (previousHoverState) {
if (this._isHovered === false) {
this._leave();
}
this._isHovered = false;
};
this._queueCallback(complete, this.tip, this._isAnimated());
@@ -5778,7 +5798,7 @@
this._activeTrigger[TRIGGER_CLICK] = false;
this._activeTrigger[TRIGGER_FOCUS] = false;
this._activeTrigger[TRIGGER_HOVER] = false;
this._isHovered = false;
this._isHovered = null; // it is a trick to support manual triggering
const complete = () => {
if (this._isWithActiveTrigger()) {
@@ -6141,7 +6161,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.0): popover.js
* Bootstrap (v5.2.1): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -6224,7 +6244,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.0): scrollspy.js
* Bootstrap (v5.2.1): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -6255,14 +6275,16 @@
// TODO: v6 @deprecated, keep it for backwards compatibility reasons
rootMargin: '0px 0px -25%',
smoothScroll: false,
target: null
target: null,
threshold: [0.1, 0.5, 1]
};
const DefaultType$1 = {
offset: '(number|null)',
// TODO v6 @deprecated, keep it for backwards compatibility reasons
rootMargin: 'string',
smoothScroll: 'boolean',
target: 'element'
target: 'element',
threshold: 'array'
};
/**
* Class definition
@@ -6323,7 +6345,14 @@
_configAfterMerge(config) {
// TODO: on v6 target should be given explicitly & remove the {target: 'ss-target'} case
config.target = getElement(config.target) || document.body;
config.target = getElement(config.target) || document.body; // TODO: v6 Only for backwards compatibility reasons. Use rootMargin only
config.rootMargin = config.offset ? `${config.offset}px 0px -30%` : config.rootMargin;
if (typeof config.threshold === 'string') {
config.threshold = config.threshold.split(',').map(value => Number.parseFloat(value));
}
return config;
}
@@ -6359,8 +6388,8 @@
_getNewObserver() {
const options = {
root: this._rootElement,
threshold: [0.1, 0.5, 1],
rootMargin: this._getRootMargin()
threshold: this._config.threshold,
rootMargin: this._config.rootMargin
};
return new IntersectionObserver(entries => this._observerCallback(entries), options);
} // The logic of selection
@@ -6405,11 +6434,6 @@
activate(entry);
}
}
} // TODO: v6 Only for backwards compatibility reasons. Use rootMargin only
_getRootMargin() {
return this._config.offset ? `${this._config.offset}px 0px -30%` : this._config.rootMargin;
}
_initializeTargetsAndObservables() {
@@ -6511,7 +6535,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.0): tab.js
* Bootstrap (v5.2.1): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -6824,7 +6848,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.0): toast.js
* Bootstrap (v5.2.1): toast.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
@@ -7041,7 +7065,7 @@
/**
* --------------------------------------------------------------------------
* Bootstrap (v5.2.0): index.umd.js
* Bootstrap (v5.2.1): index.umd.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/