2
0
mirror of https://github.com/tenrok/bootstrap.git synced 2026-06-20 20:00:36 +03:00

Add v5.2.0 docs (#36769)

This commit is contained in:
XhmikosR
2022-07-19 18:48:29 +03:00
committed by GitHub
parent 5ff226f10a
commit 5672349e4a
208 changed files with 10405 additions and 13485 deletions
+12 -11
View File
@@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="The most popular HTML, CSS, and JS library in the world."> <meta name="description" content="The most popular HTML, CSS, and JS library in the world.">
<meta name="author" content="Mark Otto, Jacob Thornton, and Bootstrap contributors"> <meta name="author" content="Mark Otto, Jacob Thornton, and Bootstrap contributors">
<meta name="generator" content="Hugo 0.98.0"> <meta name="generator" content="Hugo 0.101.0">
<meta name="docsearch:language" content="en"> <meta name="docsearch:language" content="en">
<meta name="docsearch:version" content="5.2"> <meta name="docsearch:version" content="5.2">
@@ -18,7 +18,7 @@
<link href="/docs/5.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous"> <link href="/docs/5.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-gH2yIJqKdNHPEq0n4Mqa/HGKIhSkIHeL5AyhkYV8i59U5AR6csBvApHHNl/vI1Bx" crossorigin="anonymous">
<link href="/docs/5.2/assets/css/docs.css" rel="stylesheet"> <link href="/docs/5.2/assets/css/docs.css" rel="stylesheet">
@@ -151,11 +151,11 @@
<svg xmlns="http://www.w3.org/2000/svg" width="40" height="32" class="d-block my-1" viewBox="0 0 118 94" role="img"><title>Bootstrap</title><path fill-rule="evenodd" clip-rule="evenodd" d="M24.509 0c-6.733 0-11.715 5.893-11.492 12.284.214 6.14-.064 14.092-2.066 20.577C8.943 39.365 5.547 43.485 0 44.014v5.972c5.547.529 8.943 4.649 10.951 11.153 2.002 6.485 2.28 14.437 2.066 20.577C12.794 88.106 17.776 94 24.51 94H93.5c6.733 0 11.714-5.893 11.491-12.284-.214-6.14.064-14.092 2.066-20.577 2.009-6.504 5.396-10.624 10.943-11.153v-5.972c-5.547-.529-8.934-4.649-10.943-11.153-2.002-6.484-2.28-14.437-2.066-20.577C105.214 5.894 100.233 0 93.5 0H24.508zM80 57.863C80 66.663 73.436 72 62.543 72H44a2 2 0 01-2-2V24a2 2 0 012-2h18.437c9.083 0 15.044 4.92 15.044 12.474 0 5.302-4.01 10.049-9.119 10.88v.277C75.317 46.394 80 51.21 80 57.863zM60.521 28.34H49.948v14.934h8.905c6.884 0 10.68-2.772 10.68-7.727 0-4.643-3.264-7.207-9.012-7.207zM49.948 49.2v16.458H60.91c7.167 0 10.964-2.876 10.964-8.281 0-5.406-3.903-8.178-11.425-8.178H49.948z" fill="currentColor"/></svg> <svg xmlns="http://www.w3.org/2000/svg" width="40" height="32" class="d-block my-1" viewBox="0 0 118 94" role="img"><title>Bootstrap</title><path fill-rule="evenodd" clip-rule="evenodd" d="M24.509 0c-6.733 0-11.715 5.893-11.492 12.284.214 6.14-.064 14.092-2.066 20.577C8.943 39.365 5.547 43.485 0 44.014v5.972c5.547.529 8.943 4.649 10.951 11.153 2.002 6.485 2.28 14.437 2.066 20.577C12.794 88.106 17.776 94 24.51 94H93.5c6.733 0 11.714-5.893 11.491-12.284-.214-6.14.064-14.092 2.066-20.577 2.009-6.504 5.396-10.624 10.943-11.153v-5.972c-5.547-.529-8.934-4.649-10.943-11.153-2.002-6.484-2.28-14.437-2.066-20.577C105.214 5.894 100.233 0 93.5 0H24.508zM80 57.863C80 66.663 73.436 72 62.543 72H44a2 2 0 01-2-2V24a2 2 0 012-2h18.437c9.083 0 15.044 4.92 15.044 12.474 0 5.302-4.01 10.049-9.119 10.88v.277C75.317 46.394 80 51.21 80 57.863zM60.521 28.34H49.948v14.934h8.905c6.884 0 10.68-2.772 10.68-7.727 0-4.643-3.264-7.207-9.012-7.207zM49.948 49.2v16.458H60.91c7.167 0 10.964-2.876 10.964-8.281 0-5.406-3.903-8.178-11.425-8.178H49.948z" fill="currentColor"/></svg>
</a> </a>
<button class="navbar-toggler d-flex d-lg-none order-3 p-2" type="button" data-bs-toggle="offcanvas" data-bs-target="#bdNavbar" aria-controls="bdNavbar" aria-expanded="false" aria-label="Toggle navigation"> <button class="navbar-toggler d-flex d-lg-none order-3 p-2" type="button" data-bs-toggle="offcanvas" data-bs-target="#bdNavbar" aria-controls="bdNavbar" aria-label="Toggle navigation">
<svg class="bi" width="24" height="24" aria-hidden="true"><use xlink:href="#three-dots"></use></svg> <svg class="bi" aria-hidden="true"><use xlink:href="#three-dots"></use></svg>
</button> </button>
<div class="offcanvas-lg offcanvas-end flex-grow-1" id="bdNavbar" aria-labelledby="bdNavbarOffcanvasLabel" data-bs-scroll="true"> <div class="offcanvas-lg offcanvas-end flex-grow-1" tabindex="-1" id="bdNavbar" aria-labelledby="bdNavbarOffcanvasLabel" data-bs-scroll="true">
<div class="offcanvas-header px-4 pb-0"> <div class="offcanvas-header px-4 pb-0">
<h5 class="offcanvas-title text-white" id="bdNavbarOffcanvasLabel">Bootstrap</h5> <h5 class="offcanvas-title text-white" id="bdNavbarOffcanvasLabel">Bootstrap</h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="offcanvas" aria-label="Close" data-bs-target="#bdNavbar"></button> <button type="button" class="btn-close btn-close-white" data-bs-dismiss="offcanvas" aria-label="Close" data-bs-target="#bdNavbar"></button>
@@ -217,10 +217,10 @@
<li class="nav-item dropdown"> <li class="nav-item dropdown">
<button class="btn btn-link nav-link py-2 px-0 px-lg-2 dropdown-toggle" id="bd-versions" data-bs-toggle="dropdown" aria-expanded="false" data-bs-display="static"> <button type="button" class="btn btn-link nav-link py-2 px-0 px-lg-2 dropdown-toggle" data-bs-toggle="dropdown" aria-expanded="false" data-bs-display="static">
<span class="d-lg-none">Bootstrap</span> v5.2 <span class="d-lg-none" aria-hidden="true">Bootstrap</span><span class="visually-hidden">Bootstrap&nbsp;</span> v5.2 <span class="visually-hidden">(switch to other versions)</span>
</button> </button>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="bd-versions"> <ul class="dropdown-menu dropdown-menu-end">
<li><h6 class="dropdown-header">v5 releases</h6></li> <li><h6 class="dropdown-header">v5 releases</h6></li>
<li> <li>
<a class="dropdown-item current" aria-current="true" href="/docs/5.2/"> <a class="dropdown-item current" aria-current="true" href="/docs/5.2/">
@@ -271,8 +271,7 @@
<ul class="list-unstyled small text-muted"> <ul class="list-unstyled small text-muted">
<li class="mb-2">Designed and built with all the love in the world by the <a href="/docs/5.2/about/team/">Bootstrap team</a> with the help of <a href="https://github.com/twbs/bootstrap/graphs/contributors">our contributors</a>.</li> <li class="mb-2">Designed and built with all the love in the world by the <a href="/docs/5.2/about/team/">Bootstrap team</a> with the help of <a href="https://github.com/twbs/bootstrap/graphs/contributors">our contributors</a>.</li>
<li class="mb-2">Code licensed <a href="https://github.com/twbs/bootstrap/blob/main/LICENSE" target="_blank" rel="license noopener">MIT</a>, docs <a href="https://creativecommons.org/licenses/by/3.0/" target="_blank" rel="license noopener">CC BY 3.0</a>.</li> <li class="mb-2">Code licensed <a href="https://github.com/twbs/bootstrap/blob/main/LICENSE" target="_blank" rel="license noopener">MIT</a>, docs <a href="https://creativecommons.org/licenses/by/3.0/" target="_blank" rel="license noopener">CC BY 3.0</a>.</li>
<li class="mb-2">Currently v5.2.0-beta1.</li> <li class="mb-2">Currently v5.2.0.</li>
<li class="mb-2">Analytics by <a href="https://usefathom.com/ref/ADZSBE" target="_blank" rel="noopener">Fathom</a>.</li>
</ul> </ul>
</div> </div>
<div class="col-6 col-lg-2 offset-lg-1 mb-3"> <div class="col-6 col-lg-2 offset-lg-1 mb-3">
@@ -281,6 +280,7 @@
<li class="mb-2"><a href="/">Home</a></li> <li class="mb-2"><a href="/">Home</a></li>
<li class="mb-2"><a href="/docs/5.2/">Docs</a></li> <li class="mb-2"><a href="/docs/5.2/">Docs</a></li>
<li class="mb-2"><a href="/docs/5.2/examples/">Examples</a></li> <li class="mb-2"><a href="/docs/5.2/examples/">Examples</a></li>
<li class="mb-2"><a href="https://icons.getbootstrap.com/">Icons</a></li>
<li class="mb-2"><a href="https://themes.getbootstrap.com/">Themes</a></li> <li class="mb-2"><a href="https://themes.getbootstrap.com/">Themes</a></li>
<li class="mb-2"><a href="https://blog.getbootstrap.com/">Blog</a></li> <li class="mb-2"><a href="https://blog.getbootstrap.com/">Blog</a></li>
<li class="mb-2"><a href="https://cottonbureau.com/people/bootstrap">Swag Store</a></li> <li class="mb-2"><a href="https://cottonbureau.com/people/bootstrap">Swag Store</a></li>
@@ -293,6 +293,7 @@
<li class="mb-2"><a href="/docs/5.2/examples/starter-template/">Starter template</a></li> <li class="mb-2"><a href="/docs/5.2/examples/starter-template/">Starter template</a></li>
<li class="mb-2"><a href="/docs/5.2/getting-started/webpack/">Webpack</a></li> <li class="mb-2"><a href="/docs/5.2/getting-started/webpack/">Webpack</a></li>
<li class="mb-2"><a href="/docs/5.2/getting-started/parcel/">Parcel</a></li> <li class="mb-2"><a href="/docs/5.2/getting-started/parcel/">Parcel</a></li>
<li class="mb-2"><a href="/docs/5.2/getting-started/vite/">Vite</a></li>
</ul> </ul>
</div> </div>
<div class="col-6 col-lg-2 mb-3"> <div class="col-6 col-lg-2 mb-3">
@@ -320,7 +321,7 @@
</div> </div>
</footer> </footer>
<script src="/docs/5.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqktiwsUTF55Jfv3qYSDhgCecCxMW52nD2" crossorigin="anonymous"></script> <script src="/docs/5.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-A3rJD856KowSb7dwlZdYEkO39Gagi7vIsF0jrRAoQmDKKtQBHUuLZ9AsSv4jD4Xa" crossorigin="anonymous"></script>
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 529 B

After

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 552 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 165 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 545 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 559 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

+2 -2
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -946
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2 -5
View File
@@ -1,9 +1,8 @@
/*! /*!
* Bootstrap Reboot v5.2.0-beta1 (https://getbootstrap.com/) * Bootstrap Reboot v5.2.0 (https://getbootstrap.com/)
* Copyright 2011-2022 The Bootstrap Authors * Copyright 2011-2022 The Bootstrap Authors
* Copyright 2011-2022 Twitter, Inc. * Copyright 2011-2022 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/ */
:root { :root {
--bs-blue: #0d6efd; --bs-blue: #0d6efd;
@@ -68,7 +67,6 @@
--bs-border-radius-xl: 1rem; --bs-border-radius-xl: 1rem;
--bs-border-radius-2xl: 2rem; --bs-border-radius-2xl: 2rem;
--bs-border-radius-pill: 50rem; --bs-border-radius-pill: 50rem;
--bs-heading-color: ;
--bs-link-color: #0d6efd; --bs-link-color: #0d6efd;
--bs-link-hover-color: #0a58ca; --bs-link-hover-color: #0a58ca;
--bs-code-color: #d63384; --bs-code-color: #d63384;
@@ -113,7 +111,6 @@ h6, h5, h4, h3, h2, h1 {
margin-bottom: 0.5rem; margin-bottom: 0.5rem;
font-weight: 500; font-weight: 500;
line-height: 1.2; line-height: 1.2;
color: var(--bs-heading-color);
} }
h1 { h1 {
@@ -313,7 +310,7 @@ table {
caption { caption {
padding-top: 0.5rem; padding-top: 0.5rem;
padding-bottom: 0.5rem; padding-bottom: 0.5rem;
color: rgba(var(--bs-body-color-rgb), 0.75); color: #6c757d;
text-align: left; text-align: left;
} }
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2 -5
View File
@@ -1,9 +1,8 @@
/*! /*!
* Bootstrap Reboot v5.2.0-beta1 (https://getbootstrap.com/) * Bootstrap Reboot v5.2.0 (https://getbootstrap.com/)
* Copyright 2011-2022 The Bootstrap Authors * Copyright 2011-2022 The Bootstrap Authors
* Copyright 2011-2022 Twitter, Inc. * Copyright 2011-2022 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* Forked from Normalize.css, licensed MIT (https://github.com/necolas/normalize.css/blob/master/LICENSE.md)
*/ */
:root { :root {
--bs-blue: #0d6efd; --bs-blue: #0d6efd;
@@ -68,7 +67,6 @@
--bs-border-radius-xl: 1rem; --bs-border-radius-xl: 1rem;
--bs-border-radius-2xl: 2rem; --bs-border-radius-2xl: 2rem;
--bs-border-radius-pill: 50rem; --bs-border-radius-pill: 50rem;
--bs-heading-color: ;
--bs-link-color: #0d6efd; --bs-link-color: #0d6efd;
--bs-link-hover-color: #0a58ca; --bs-link-hover-color: #0a58ca;
--bs-code-color: #d63384; --bs-code-color: #d63384;
@@ -113,7 +111,6 @@ h6, h5, h4, h3, h2, h1 {
margin-bottom: 0.5rem; margin-bottom: 0.5rem;
font-weight: 500; font-weight: 500;
line-height: 1.2; line-height: 1.2;
color: var(--bs-heading-color);
} }
h1 { h1 {
@@ -313,7 +310,7 @@ table {
caption { caption {
padding-top: 0.5rem; padding-top: 0.5rem;
padding-bottom: 0.5rem; padding-bottom: 0.5rem;
color: rgba(var(--bs-body-color-rgb), 0.75); color: #6c757d;
text-align: right; text-align: right;
} }
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+120 -1103
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+120 -1103
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+179 -187
View File
@@ -1,5 +1,5 @@
/*! /*!
* Bootstrap v5.2.0-beta1 (https://getbootstrap.com/) * Bootstrap v5.2.0 (https://getbootstrap.com/)
* Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
@@ -11,13 +11,13 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): util/index.js * Bootstrap (v5.2.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
const MAX_UID = 1000000; const MAX_UID = 1000000;
const MILLISECONDS_MULTIPLIER = 1000; const MILLISECONDS_MULTIPLIER = 1000;
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp) const TRANSITION_END = 'transitionend'; // Shout-out Angus Croll (https://goo.gl/pxwQGp)
const toType = object => { const toType = object => {
if (object === null || object === undefined) { if (object === null || object === undefined) {
@@ -326,7 +326,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): dom/event-handler.js * Bootstrap (v5.2.0): dom/event-handler.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -349,12 +349,12 @@
* Private methods * Private methods
*/ */
function getUidEvent(element, uid) { function makeEventUid(element, uid) {
return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++; return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++;
} }
function getEvent(element) { function getElementEvents(element) {
const uid = getUidEvent(element); const uid = makeEventUid(element);
element.uidEvent = uid; element.uidEvent = uid;
eventRegistry[uid] = eventRegistry[uid] || {}; eventRegistry[uid] = eventRegistry[uid] || {};
return eventRegistry[uid]; return eventRegistry[uid];
@@ -362,7 +362,9 @@
function bootstrapHandler(element, fn) { function bootstrapHandler(element, fn) {
return function handler(event) { return function handler(event) {
event.delegateTarget = element; hydrateObj(event, {
delegateTarget: element
});
if (handler.oneOff) { if (handler.oneOff) {
EventHandler.off(element, event.type, fn); EventHandler.off(element, event.type, fn);
@@ -384,7 +386,9 @@
continue; continue;
} }
event.delegateTarget = target; hydrateObj(event, {
delegateTarget: target
});
if (handler.oneOff) { if (handler.oneOff) {
EventHandler.off(element, event.type, selector, fn); EventHandler.off(element, event.type, selector, fn);
@@ -396,20 +400,21 @@
}; };
} }
function findHandler(events, handler, delegationSelector = null) { function findHandler(events, callable, delegationSelector = null) {
return Object.values(events).find(event => event.originalHandler === handler && event.delegationSelector === delegationSelector); return Object.values(events).find(event => event.callable === callable && event.delegationSelector === delegationSelector);
} }
function normalizeParameters(originalTypeEvent, handler, delegationFunction) { function normalizeParameters(originalTypeEvent, handler, delegationFunction) {
const delegation = typeof handler === 'string'; const isDelegated = typeof handler === 'string'; // todo: tooltip passes `false` instead of selector, so we need to check
const originalHandler = delegation ? delegationFunction : handler;
const callable = isDelegated ? delegationFunction : handler || delegationFunction;
let typeEvent = getTypeEvent(originalTypeEvent); let typeEvent = getTypeEvent(originalTypeEvent);
if (!nativeEvents.has(typeEvent)) { if (!nativeEvents.has(typeEvent)) {
typeEvent = originalTypeEvent; typeEvent = originalTypeEvent;
} }
return [delegation, originalHandler, typeEvent]; return [isDelegated, callable, typeEvent];
} }
function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) { function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) {
@@ -417,13 +422,9 @@
return; return;
} }
if (!handler) { let [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction); // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position
handler = delegationFunction;
delegationFunction = null;
} // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position
// this prevents the handler from being dispatched the same way as mouseover or mouseout does // this prevents the handler from being dispatched the same way as mouseover or mouseout does
if (originalTypeEvent in customEvents) { if (originalTypeEvent in customEvents) {
const wrapFunction = fn => { const wrapFunction = fn => {
return function (event) { return function (event) {
@@ -433,31 +434,26 @@
}; };
}; };
if (delegationFunction) { callable = wrapFunction(callable);
delegationFunction = wrapFunction(delegationFunction);
} else {
handler = wrapFunction(handler);
}
} }
const [delegation, originalHandler, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction); const events = getElementEvents(element);
const events = getEvent(element);
const handlers = events[typeEvent] || (events[typeEvent] = {}); const handlers = events[typeEvent] || (events[typeEvent] = {});
const previousFunction = findHandler(handlers, originalHandler, delegation ? handler : null); const previousFunction = findHandler(handlers, callable, isDelegated ? handler : null);
if (previousFunction) { if (previousFunction) {
previousFunction.oneOff = previousFunction.oneOff && oneOff; previousFunction.oneOff = previousFunction.oneOff && oneOff;
return; return;
} }
const uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, '')); const uid = makeEventUid(callable, originalTypeEvent.replace(namespaceRegex, ''));
const fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFunction) : bootstrapHandler(element, handler); const fn = isDelegated ? bootstrapDelegationHandler(element, handler, callable) : bootstrapHandler(element, callable);
fn.delegationSelector = delegation ? handler : null; fn.delegationSelector = isDelegated ? handler : null;
fn.originalHandler = originalHandler; fn.callable = callable;
fn.oneOff = oneOff; fn.oneOff = oneOff;
fn.uidEvent = uid; fn.uidEvent = uid;
handlers[uid] = fn; handlers[uid] = fn;
element.addEventListener(typeEvent, fn, delegation); element.addEventListener(typeEvent, fn, isDelegated);
} }
function removeHandler(element, events, typeEvent, handler, delegationSelector) { function removeHandler(element, events, typeEvent, handler, delegationSelector) {
@@ -477,7 +473,7 @@
for (const handlerKey of Object.keys(storeElementEvent)) { for (const handlerKey of Object.keys(storeElementEvent)) {
if (handlerKey.includes(namespace)) { if (handlerKey.includes(namespace)) {
const event = storeElementEvent[handlerKey]; const event = storeElementEvent[handlerKey];
removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector); removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
} }
} }
} }
@@ -502,18 +498,19 @@
return; return;
} }
const [delegation, originalHandler, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction); const [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
const inNamespace = typeEvent !== originalTypeEvent; const inNamespace = typeEvent !== originalTypeEvent;
const events = getEvent(element); const events = getElementEvents(element);
const storeElementEvent = events[typeEvent] || {};
const isNamespace = originalTypeEvent.startsWith('.'); const isNamespace = originalTypeEvent.startsWith('.');
if (typeof originalHandler !== 'undefined') { if (typeof callable !== 'undefined') {
// Simplest case: handler is passed, remove that listener ONLY. // Simplest case: handler is passed, remove that listener ONLY.
if (!events || !events[typeEvent]) { if (!Object.keys(storeElementEvent).length) {
return; return;
} }
removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null); removeHandler(element, events, typeEvent, callable, isDelegated ? handler : null);
return; return;
} }
@@ -523,14 +520,12 @@
} }
} }
const storeElementEvent = events[typeEvent] || {};
for (const keyHandlers of Object.keys(storeElementEvent)) { for (const keyHandlers of Object.keys(storeElementEvent)) {
const handlerKey = keyHandlers.replace(stripUidRegex, ''); const handlerKey = keyHandlers.replace(stripUidRegex, '');
if (!inNamespace || originalTypeEvent.includes(handlerKey)) { if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
const event = storeElementEvent[keyHandlers]; const event = storeElementEvent[keyHandlers];
removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector); removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
} }
} }
}, },
@@ -556,21 +551,11 @@
defaultPrevented = jQueryEvent.isDefaultPrevented(); defaultPrevented = jQueryEvent.isDefaultPrevented();
} }
const evt = new Event(event, { let evt = new Event(event, {
bubbles, bubbles,
cancelable: true cancelable: true
}); // merge custom information in our event });
evt = hydrateObj(evt, args);
if (typeof args !== 'undefined') {
for (const key of Object.keys(args)) {
Object.defineProperty(evt, key, {
get() {
return args[key];
}
});
}
}
if (defaultPrevented) { if (defaultPrevented) {
evt.preventDefault(); evt.preventDefault();
@@ -589,9 +574,28 @@
}; };
function hydrateObj(obj, meta) {
for (const [key, value] of Object.entries(meta || {})) {
try {
obj[key] = value;
} catch (_unused) {
Object.defineProperty(obj, key, {
configurable: true,
get() {
return value;
}
});
}
}
return obj;
}
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): dom/data.js * Bootstrap (v5.2.0): dom/data.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -643,7 +647,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): dom/manipulator.js * Bootstrap (v5.2.0): dom/manipulator.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -713,7 +717,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): util/config.js * Bootstrap (v5.2.0): util/config.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -774,7 +778,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): base-component.js * Bootstrap (v5.2.0): base-component.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -782,7 +786,7 @@
* Constants * Constants
*/ */
const VERSION = '5.2.0-beta1'; const VERSION = '5.2.0';
/** /**
* Class definition * Class definition
*/ */
@@ -853,7 +857,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): util/component-functions.js * Bootstrap (v5.2.0): util/component-functions.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -879,7 +883,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): alert.js * Bootstrap (v5.2.0): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -959,7 +963,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): button.js * Bootstrap (v5.2.0): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -1021,7 +1025,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): dom/selector-engine.js * Bootstrap (v5.2.0): dom/selector-engine.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -1092,7 +1096,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): util/swipe.js * Bootstrap (v5.2.0): util/swipe.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -1112,14 +1116,14 @@
const CLASS_NAME_POINTER_EVENT = 'pointer-event'; const CLASS_NAME_POINTER_EVENT = 'pointer-event';
const SWIPE_THRESHOLD = 40; const SWIPE_THRESHOLD = 40;
const Default$c = { const Default$c = {
endCallback: null,
leftCallback: null, leftCallback: null,
rightCallback: null, rightCallback: null
endCallback: null
}; };
const DefaultType$c = { const DefaultType$c = {
endCallback: '(function|null)',
leftCallback: '(function|null)', leftCallback: '(function|null)',
rightCallback: '(function|null)', rightCallback: '(function|null)'
endCallback: '(function|null)'
}; };
/** /**
* Class definition * Class definition
@@ -1228,7 +1232,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): carousel.js * Bootstrap (v5.2.0): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -1284,9 +1288,10 @@
}; };
const DefaultType$b = { const DefaultType$b = {
interval: '(number|boolean)', interval: '(number|boolean)',
// TODO:v6 remove boolean support
keyboard: 'boolean', keyboard: 'boolean',
ride: '(boolean|string)',
pause: '(string|boolean)', pause: '(string|boolean)',
ride: '(boolean|string)',
touch: 'boolean', touch: 'boolean',
wrap: 'boolean' wrap: 'boolean'
}; };
@@ -1675,7 +1680,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): collapse.js * Bootstrap (v5.2.0): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -1703,12 +1708,12 @@
const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing'; const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing';
const SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]'; const SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]';
const Default$a = { const Default$a = {
toggle: true, parent: null,
parent: null toggle: true
}; };
const DefaultType$a = { const DefaultType$a = {
toggle: 'boolean', parent: '(null|element)',
parent: '(null|element)' toggle: 'boolean'
}; };
/** /**
* Class definition * Class definition
@@ -3800,7 +3805,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): dropdown.js * Bootstrap (v5.2.0): dropdown.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -3846,20 +3851,20 @@
const PLACEMENT_TOPCENTER = 'top'; const PLACEMENT_TOPCENTER = 'top';
const PLACEMENT_BOTTOMCENTER = 'bottom'; const PLACEMENT_BOTTOMCENTER = 'bottom';
const Default$9 = { const Default$9 = {
offset: [0, 2], autoClose: true,
boundary: 'clippingParents', boundary: 'clippingParents',
reference: 'toggle',
display: 'dynamic', display: 'dynamic',
offset: [0, 2],
popperConfig: null, popperConfig: null,
autoClose: true reference: 'toggle'
}; };
const DefaultType$9 = { const DefaultType$9 = {
offset: '(array|string|function)', autoClose: '(boolean|string)',
boundary: '(string|element)', boundary: '(string|element)',
reference: '(string|element|object)',
display: 'string', display: 'string',
offset: '(array|string|function)',
popperConfig: '(null|object|function)', popperConfig: '(null|object|function)',
autoClose: '(boolean|string)' reference: '(string|element|object)'
}; };
/** /**
* Class definition * Class definition
@@ -4230,7 +4235,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): util/scrollBar.js * Bootstrap (v5.2.0): util/scrollBar.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -4349,7 +4354,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): util/backdrop.js * Bootstrap (v5.2.0): util/backdrop.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -4363,19 +4368,19 @@
const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$9}`; const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$9}`;
const Default$8 = { const Default$8 = {
className: 'modal-backdrop', className: 'modal-backdrop',
clickCallback: null,
isAnimated: false,
isVisible: true, isVisible: true,
// if false, we use the backdrop helper without adding any element to the dom // if false, we use the backdrop helper without adding any element to the dom
isAnimated: false, rootElement: 'body' // give the choice to place backdrop under different elements
rootElement: 'body',
// give the choice to place backdrop under different elements
clickCallback: null
}; };
const DefaultType$8 = { const DefaultType$8 = {
className: 'string', className: 'string',
isVisible: 'boolean', clickCallback: '(function|null)',
isAnimated: 'boolean', isAnimated: 'boolean',
rootElement: '(element|string)', isVisible: 'boolean',
clickCallback: '(function|null)' rootElement: '(element|string)'
}; };
/** /**
* Class definition * Class definition
@@ -4495,7 +4500,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): util/focustrap.js * Bootstrap (v5.2.0): util/focustrap.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -4512,13 +4517,13 @@
const TAB_NAV_FORWARD = 'forward'; const TAB_NAV_FORWARD = 'forward';
const TAB_NAV_BACKWARD = 'backward'; const TAB_NAV_BACKWARD = 'backward';
const Default$7 = { const Default$7 = {
trapElement: null, autofocus: true,
// The element to trap focus inside of trapElement: null // The element to trap focus inside of
autofocus: true
}; };
const DefaultType$7 = { const DefaultType$7 = {
trapElement: 'element', autofocus: 'boolean',
autofocus: 'boolean' trapElement: 'element'
}; };
/** /**
* Class definition * Class definition
@@ -4604,7 +4609,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): modal.js * Bootstrap (v5.2.0): modal.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -4623,7 +4628,7 @@
const EVENT_SHOW$4 = `show${EVENT_KEY$4}`; const EVENT_SHOW$4 = `show${EVENT_KEY$4}`;
const EVENT_SHOWN$4 = `shown${EVENT_KEY$4}`; const EVENT_SHOWN$4 = `shown${EVENT_KEY$4}`;
const EVENT_RESIZE$1 = `resize${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_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$4}`;
const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$4}${DATA_API_KEY$2}`; const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$4}${DATA_API_KEY$2}`;
const CLASS_NAME_OPEN = 'modal-open'; const CLASS_NAME_OPEN = 'modal-open';
@@ -4636,13 +4641,13 @@
const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]'; const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]';
const Default$6 = { const Default$6 = {
backdrop: true, backdrop: true,
keyboard: true, focus: true,
focus: true keyboard: true
}; };
const DefaultType$6 = { const DefaultType$6 = {
backdrop: '(boolean|string)', backdrop: '(boolean|string)',
keyboard: 'boolean', focus: 'boolean',
focus: 'boolean' keyboard: 'boolean'
}; };
/** /**
* Class definition * Class definition
@@ -4814,7 +4819,7 @@
this._adjustDialog(); this._adjustDialog();
} }
}); });
EventHandler.on(this._element, EVENT_CLICK_DISMISS, event => { EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, event => {
if (event.target !== event.currentTarget) { if (event.target !== event.currentTarget) {
// click is inside modal-dialog // click is inside modal-dialog
return; return;
@@ -4977,7 +4982,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): offcanvas.js * Bootstrap (v5.2.0): offcanvas.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -5075,7 +5080,7 @@
this._element.classList.add(CLASS_NAME_SHOWING$1); this._element.classList.add(CLASS_NAME_SHOWING$1);
const completeCallBack = () => { const completeCallBack = () => {
if (!this._config.scroll) { if (!this._config.scroll || this._config.backdrop) {
this._focustrap.activate(); this._focustrap.activate();
} }
@@ -5251,7 +5256,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): util/sanitizer.js * Bootstrap (v5.2.0): util/sanitizer.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -5260,14 +5265,14 @@
/** /**
* A pattern that recognizes a commonly useful subset of URLs that are safe. * A pattern that recognizes a commonly useful subset of URLs that are safe.
* *
* Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts * Shout-out to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
*/ */
const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i; const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i;
/** /**
* A pattern that matches safe data URLs. Only matches image, video and audio types. * A pattern that matches safe data URLs. Only matches image, video and audio types.
* *
* Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts * Shout-out to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
*/ */
const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i; const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i;
@@ -5356,7 +5361,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): util/template-factory.js * Bootstrap (v5.2.0): util/template-factory.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -5366,27 +5371,27 @@
const NAME$5 = 'TemplateFactory'; const NAME$5 = 'TemplateFactory';
const Default$4 = { const Default$4 = {
extraClass: '', allowList: DefaultAllowlist,
template: '<div></div>',
content: {}, content: {},
// { selector : text , selector2 : text2 , } // { selector : text , selector2 : text2 , }
extraClass: '',
html: false, html: false,
sanitize: true, sanitize: true,
sanitizeFn: null, sanitizeFn: null,
allowList: DefaultAllowlist template: '<div></div>'
}; };
const DefaultType$4 = { const DefaultType$4 = {
extraClass: '(string|function)', allowList: 'object',
template: 'string',
content: 'object', content: 'object',
extraClass: '(string|function)',
html: 'boolean', html: 'boolean',
sanitize: 'boolean', sanitize: 'boolean',
sanitizeFn: '(null|function)', sanitizeFn: '(null|function)',
allowList: 'object' template: 'string'
}; };
const DefaultContentType = { const DefaultContentType = {
selector: '(string|element)', entry: '(string|element|function|null)',
entry: '(string|element|function|null)' selector: '(string|element)'
}; };
/** /**
* Class definition * Class definition
@@ -5514,7 +5519,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): tooltip.js * Bootstrap (v5.2.0): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -5552,42 +5557,42 @@
LEFT: isRTL() ? 'right' : 'left' LEFT: isRTL() ? 'right' : 'left'
}; };
const Default$3 = { const Default$3 = {
allowList: DefaultAllowlist,
animation: true, animation: true,
template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>',
trigger: 'hover focus',
title: '',
delay: 0,
html: false,
selector: false,
placement: 'top',
offset: [0, 0],
container: false,
fallbackPlacements: ['top', 'right', 'bottom', 'left'],
boundary: 'clippingParents', boundary: 'clippingParents',
container: false,
customClass: '', customClass: '',
delay: 0,
fallbackPlacements: ['top', 'right', 'bottom', 'left'],
html: false,
offset: [0, 0],
placement: 'top',
popperConfig: null,
sanitize: true, sanitize: true,
sanitizeFn: null, sanitizeFn: null,
allowList: DefaultAllowlist, selector: false,
popperConfig: null template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>',
title: '',
trigger: 'hover focus'
}; };
const DefaultType$3 = { const DefaultType$3 = {
allowList: 'object',
animation: 'boolean', animation: 'boolean',
template: 'string',
title: '(string|element|function)',
trigger: 'string',
delay: '(number|object)',
html: 'boolean',
selector: '(string|boolean)',
placement: '(string|function)',
offset: '(array|string|function)',
container: '(string|element|boolean)',
fallbackPlacements: 'array',
boundary: '(string|element)', boundary: '(string|element)',
container: '(string|element|boolean)',
customClass: '(string|function)', customClass: '(string|function)',
delay: '(number|object)',
fallbackPlacements: 'array',
html: 'boolean',
offset: '(array|string|function)',
placement: '(string|function)',
popperConfig: '(null|object|function)',
sanitize: 'boolean', sanitize: 'boolean',
sanitizeFn: '(null|function)', sanitizeFn: '(null|function)',
allowList: 'object', selector: '(string|boolean)',
popperConfig: '(null|object|function)' template: 'string',
title: '(string|element|function)',
trigger: 'string'
}; };
/** /**
* Class definition * Class definition
@@ -5606,7 +5611,8 @@
this._isHovered = false; this._isHovered = false;
this._activeTrigger = {}; this._activeTrigger = {};
this._popper = null; this._popper = null;
this._templateFactory = null; // Protected this._templateFactory = null;
this._newContent = null; // Protected
this.tip = null; this.tip = null;
@@ -5696,6 +5702,12 @@
if (showEvent.defaultPrevented || !isInTheDom) { if (showEvent.defaultPrevented || !isInTheDom) {
return; return;
} // todo v6 remove this OR make it optional
if (this.tip) {
this.tip.remove();
this.tip = null;
} }
const tip = this._getTipElement(); const tip = this._getTipElement();
@@ -5714,7 +5726,7 @@
if (this._popper) { if (this._popper) {
this._popper.update(); this._popper.update();
} else { } else {
this._createPopper(tip); this._popper = this._createPopper(tip);
} }
tip.classList.add(CLASS_NAME_SHOW$2); // If this is a touch-enabled device we add extra tip.classList.add(CLASS_NAME_SHOW$2); // If this is a touch-enabled device we add extra
@@ -5800,7 +5812,7 @@
_getTipElement() { _getTipElement() {
if (!this.tip) { if (!this.tip) {
this.tip = this._createTipElement(this._getContentForTemplate()); this.tip = this._createTipElement(this._newContent || this._getContentForTemplate());
} }
return this.tip; return this.tip;
@@ -5828,19 +5840,11 @@
} }
setContent(content) { setContent(content) {
let isShown = false; this._newContent = content;
if (this.tip) { if (this._isShown()) {
isShown = this._isShown(); this._disposePopper();
this.tip.remove();
this.tip = null;
}
this._disposePopper();
this.tip = this._createTipElement(content);
if (isShown) {
this.show(); this.show();
} }
} }
@@ -5867,7 +5871,7 @@
} }
_getTitle() { _getTitle() {
return this._config.title; return this._resolvePossibleFunction(this._config.title) || this._config.originalTitle;
} // Private } // Private
@@ -5886,7 +5890,7 @@
_createPopper(tip) { _createPopper(tip) {
const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement; const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement;
const attachment = AttachmentMap[placement.toUpperCase()]; const attachment = AttachmentMap[placement.toUpperCase()];
this._popper = createPopper(this._element, tip, this._getPopperConfig(attachment)); return createPopper(this._element, tip, this._getPopperConfig(attachment));
} }
_getOffset() { _getOffset() {
@@ -5999,7 +6003,7 @@
return; return;
} }
if (!this._element.getAttribute('aria-label') && !this._element.textContent) { if (!this._element.getAttribute('aria-label') && !this._element.textContent.trim()) {
this._element.setAttribute('aria-label', title); this._element.setAttribute('aria-label', title);
} }
@@ -6075,7 +6079,6 @@
} }
config.originalTitle = this._element.getAttribute('title') || ''; config.originalTitle = this._element.getAttribute('title') || '';
config.title = this._resolvePossibleFunction(config.title) || config.originalTitle;
if (typeof config.title === 'number') { if (typeof config.title === 'number') {
config.title = config.title.toString(); config.title = config.title.toString();
@@ -6138,7 +6141,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): popover.js * Bootstrap (v5.2.0): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -6150,11 +6153,11 @@
const SELECTOR_TITLE = '.popover-header'; const SELECTOR_TITLE = '.popover-header';
const SELECTOR_CONTENT = '.popover-body'; const SELECTOR_CONTENT = '.popover-body';
const Default$2 = { ...Tooltip.Default, const Default$2 = { ...Tooltip.Default,
placement: 'right',
offset: [0, 8],
trigger: 'click',
content: '', content: '',
template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>' offset: [0, 8],
placement: 'right',
template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>',
trigger: 'click'
}; };
const DefaultType$2 = { ...Tooltip.DefaultType, const DefaultType$2 = { ...Tooltip.DefaultType,
content: '(null|string|element|function)' content: '(null|string|element|function)'
@@ -6221,7 +6224,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): scrollspy.js * Bootstrap (v5.2.0): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -6341,7 +6344,8 @@
if (root.scrollTo) { if (root.scrollTo) {
root.scrollTo({ root.scrollTo({
top: height top: height,
behavior: 'smooth'
}); });
return; return;
} // Chrome 60 doesn't support `scrollTo` } // Chrome 60 doesn't support `scrollTo`
@@ -6507,7 +6511,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): tab.js * Bootstrap (v5.2.0): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -6608,15 +6612,9 @@
this._activate(getElementFromSelector(element)); // Search and activate/show the proper section this._activate(getElementFromSelector(element)); // Search and activate/show the proper section
const isAnimated = element.classList.contains(CLASS_NAME_FADE$1);
const complete = () => { const complete = () => {
if (isAnimated) {
// todo: maybe is redundant
element.classList.add(CLASS_NAME_SHOW$1);
}
if (element.getAttribute('role') !== 'tab') { if (element.getAttribute('role') !== 'tab') {
element.classList.add(CLASS_NAME_SHOW$1);
return; return;
} }
@@ -6631,7 +6629,7 @@
}); });
}; };
this._queueCallback(complete, element, isAnimated); this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
} }
_deactivate(element, relatedElem) { _deactivate(element, relatedElem) {
@@ -6645,15 +6643,9 @@
this._deactivate(getElementFromSelector(element)); // Search and deactivate the shown section too this._deactivate(getElementFromSelector(element)); // Search and deactivate the shown section too
const isAnimated = element.classList.contains(CLASS_NAME_FADE$1);
const complete = () => { const complete = () => {
if (isAnimated) {
// todo maybe is redundant
element.classList.remove(CLASS_NAME_SHOW$1);
}
if (element.getAttribute('role') !== 'tab') { if (element.getAttribute('role') !== 'tab') {
element.classList.remove(CLASS_NAME_SHOW$1);
return; return;
} }
@@ -6667,7 +6659,7 @@
}); });
}; };
this._queueCallback(complete, element, isAnimated); this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
} }
_keydown(event) { _keydown(event) {
@@ -6832,7 +6824,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): toast.js * Bootstrap (v5.2.0): toast.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -7049,7 +7041,7 @@
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): index.umd.js * Bootstrap (v5.2.0): index.umd.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+178 -186
View File
@@ -1,5 +1,5 @@
/*! /*!
* Bootstrap v5.2.0-beta1 (https://getbootstrap.com/) * Bootstrap v5.2.0 (https://getbootstrap.com/)
* Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/ */
@@ -7,13 +7,13 @@ import * as Popper from '@popperjs/core';
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): util/index.js * Bootstrap (v5.2.0): util/index.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
const MAX_UID = 1000000; const MAX_UID = 1000000;
const MILLISECONDS_MULTIPLIER = 1000; const MILLISECONDS_MULTIPLIER = 1000;
const TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp) const TRANSITION_END = 'transitionend'; // Shout-out Angus Croll (https://goo.gl/pxwQGp)
const toType = object => { const toType = object => {
if (object === null || object === undefined) { if (object === null || object === undefined) {
@@ -322,7 +322,7 @@ const getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): dom/event-handler.js * Bootstrap (v5.2.0): dom/event-handler.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -345,12 +345,12 @@ const nativeEvents = new Set(['click', 'dblclick', 'mouseup', 'mousedown', 'cont
* Private methods * Private methods
*/ */
function getUidEvent(element, uid) { function makeEventUid(element, uid) {
return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++; return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++;
} }
function getEvent(element) { function getElementEvents(element) {
const uid = getUidEvent(element); const uid = makeEventUid(element);
element.uidEvent = uid; element.uidEvent = uid;
eventRegistry[uid] = eventRegistry[uid] || {}; eventRegistry[uid] = eventRegistry[uid] || {};
return eventRegistry[uid]; return eventRegistry[uid];
@@ -358,7 +358,9 @@ function getEvent(element) {
function bootstrapHandler(element, fn) { function bootstrapHandler(element, fn) {
return function handler(event) { return function handler(event) {
event.delegateTarget = element; hydrateObj(event, {
delegateTarget: element
});
if (handler.oneOff) { if (handler.oneOff) {
EventHandler.off(element, event.type, fn); EventHandler.off(element, event.type, fn);
@@ -380,7 +382,9 @@ function bootstrapDelegationHandler(element, selector, fn) {
continue; continue;
} }
event.delegateTarget = target; hydrateObj(event, {
delegateTarget: target
});
if (handler.oneOff) { if (handler.oneOff) {
EventHandler.off(element, event.type, selector, fn); EventHandler.off(element, event.type, selector, fn);
@@ -392,20 +396,21 @@ function bootstrapDelegationHandler(element, selector, fn) {
}; };
} }
function findHandler(events, handler, delegationSelector = null) { function findHandler(events, callable, delegationSelector = null) {
return Object.values(events).find(event => event.originalHandler === handler && event.delegationSelector === delegationSelector); return Object.values(events).find(event => event.callable === callable && event.delegationSelector === delegationSelector);
} }
function normalizeParameters(originalTypeEvent, handler, delegationFunction) { function normalizeParameters(originalTypeEvent, handler, delegationFunction) {
const delegation = typeof handler === 'string'; const isDelegated = typeof handler === 'string'; // todo: tooltip passes `false` instead of selector, so we need to check
const originalHandler = delegation ? delegationFunction : handler;
const callable = isDelegated ? delegationFunction : handler || delegationFunction;
let typeEvent = getTypeEvent(originalTypeEvent); let typeEvent = getTypeEvent(originalTypeEvent);
if (!nativeEvents.has(typeEvent)) { if (!nativeEvents.has(typeEvent)) {
typeEvent = originalTypeEvent; typeEvent = originalTypeEvent;
} }
return [delegation, originalHandler, typeEvent]; return [isDelegated, callable, typeEvent];
} }
function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) { function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) {
@@ -413,13 +418,9 @@ function addHandler(element, originalTypeEvent, handler, delegationFunction, one
return; return;
} }
if (!handler) { let [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction); // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position
handler = delegationFunction;
delegationFunction = null;
} // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position
// this prevents the handler from being dispatched the same way as mouseover or mouseout does // this prevents the handler from being dispatched the same way as mouseover or mouseout does
if (originalTypeEvent in customEvents) { if (originalTypeEvent in customEvents) {
const wrapFunction = fn => { const wrapFunction = fn => {
return function (event) { return function (event) {
@@ -429,31 +430,26 @@ function addHandler(element, originalTypeEvent, handler, delegationFunction, one
}; };
}; };
if (delegationFunction) { callable = wrapFunction(callable);
delegationFunction = wrapFunction(delegationFunction);
} else {
handler = wrapFunction(handler);
}
} }
const [delegation, originalHandler, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction); const events = getElementEvents(element);
const events = getEvent(element);
const handlers = events[typeEvent] || (events[typeEvent] = {}); const handlers = events[typeEvent] || (events[typeEvent] = {});
const previousFunction = findHandler(handlers, originalHandler, delegation ? handler : null); const previousFunction = findHandler(handlers, callable, isDelegated ? handler : null);
if (previousFunction) { if (previousFunction) {
previousFunction.oneOff = previousFunction.oneOff && oneOff; previousFunction.oneOff = previousFunction.oneOff && oneOff;
return; return;
} }
const uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, '')); const uid = makeEventUid(callable, originalTypeEvent.replace(namespaceRegex, ''));
const fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFunction) : bootstrapHandler(element, handler); const fn = isDelegated ? bootstrapDelegationHandler(element, handler, callable) : bootstrapHandler(element, callable);
fn.delegationSelector = delegation ? handler : null; fn.delegationSelector = isDelegated ? handler : null;
fn.originalHandler = originalHandler; fn.callable = callable;
fn.oneOff = oneOff; fn.oneOff = oneOff;
fn.uidEvent = uid; fn.uidEvent = uid;
handlers[uid] = fn; handlers[uid] = fn;
element.addEventListener(typeEvent, fn, delegation); element.addEventListener(typeEvent, fn, isDelegated);
} }
function removeHandler(element, events, typeEvent, handler, delegationSelector) { function removeHandler(element, events, typeEvent, handler, delegationSelector) {
@@ -473,7 +469,7 @@ function removeNamespacedHandlers(element, events, typeEvent, namespace) {
for (const handlerKey of Object.keys(storeElementEvent)) { for (const handlerKey of Object.keys(storeElementEvent)) {
if (handlerKey.includes(namespace)) { if (handlerKey.includes(namespace)) {
const event = storeElementEvent[handlerKey]; const event = storeElementEvent[handlerKey];
removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector); removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
} }
} }
} }
@@ -498,18 +494,19 @@ const EventHandler = {
return; return;
} }
const [delegation, originalHandler, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction); const [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
const inNamespace = typeEvent !== originalTypeEvent; const inNamespace = typeEvent !== originalTypeEvent;
const events = getEvent(element); const events = getElementEvents(element);
const storeElementEvent = events[typeEvent] || {};
const isNamespace = originalTypeEvent.startsWith('.'); const isNamespace = originalTypeEvent.startsWith('.');
if (typeof originalHandler !== 'undefined') { if (typeof callable !== 'undefined') {
// Simplest case: handler is passed, remove that listener ONLY. // Simplest case: handler is passed, remove that listener ONLY.
if (!events || !events[typeEvent]) { if (!Object.keys(storeElementEvent).length) {
return; return;
} }
removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null); removeHandler(element, events, typeEvent, callable, isDelegated ? handler : null);
return; return;
} }
@@ -519,14 +516,12 @@ const EventHandler = {
} }
} }
const storeElementEvent = events[typeEvent] || {};
for (const keyHandlers of Object.keys(storeElementEvent)) { for (const keyHandlers of Object.keys(storeElementEvent)) {
const handlerKey = keyHandlers.replace(stripUidRegex, ''); const handlerKey = keyHandlers.replace(stripUidRegex, '');
if (!inNamespace || originalTypeEvent.includes(handlerKey)) { if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
const event = storeElementEvent[keyHandlers]; const event = storeElementEvent[keyHandlers];
removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector); removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
} }
} }
}, },
@@ -552,21 +547,11 @@ const EventHandler = {
defaultPrevented = jQueryEvent.isDefaultPrevented(); defaultPrevented = jQueryEvent.isDefaultPrevented();
} }
const evt = new Event(event, { let evt = new Event(event, {
bubbles, bubbles,
cancelable: true cancelable: true
}); // merge custom information in our event });
evt = hydrateObj(evt, args);
if (typeof args !== 'undefined') {
for (const key of Object.keys(args)) {
Object.defineProperty(evt, key, {
get() {
return args[key];
}
});
}
}
if (defaultPrevented) { if (defaultPrevented) {
evt.preventDefault(); evt.preventDefault();
@@ -585,9 +570,28 @@ const EventHandler = {
}; };
function hydrateObj(obj, meta) {
for (const [key, value] of Object.entries(meta || {})) {
try {
obj[key] = value;
} catch (_unused) {
Object.defineProperty(obj, key, {
configurable: true,
get() {
return value;
}
});
}
}
return obj;
}
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): dom/data.js * Bootstrap (v5.2.0): dom/data.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -639,7 +643,7 @@ const Data = {
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): dom/manipulator.js * Bootstrap (v5.2.0): dom/manipulator.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -709,7 +713,7 @@ const Manipulator = {
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): util/config.js * Bootstrap (v5.2.0): util/config.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -770,7 +774,7 @@ class Config {
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): base-component.js * Bootstrap (v5.2.0): base-component.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -778,7 +782,7 @@ class Config {
* Constants * Constants
*/ */
const VERSION = '5.2.0-beta1'; const VERSION = '5.2.0';
/** /**
* Class definition * Class definition
*/ */
@@ -849,7 +853,7 @@ class BaseComponent extends Config {
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): util/component-functions.js * Bootstrap (v5.2.0): util/component-functions.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -875,7 +879,7 @@ const enableDismissTrigger = (component, method = 'hide') => {
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): alert.js * Bootstrap (v5.2.0): alert.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -955,7 +959,7 @@ defineJQueryPlugin(Alert);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): button.js * Bootstrap (v5.2.0): button.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -1017,7 +1021,7 @@ defineJQueryPlugin(Button);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): dom/selector-engine.js * Bootstrap (v5.2.0): dom/selector-engine.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -1088,7 +1092,7 @@ const SelectorEngine = {
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): util/swipe.js * Bootstrap (v5.2.0): util/swipe.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -1108,14 +1112,14 @@ const POINTER_TYPE_PEN = 'pen';
const CLASS_NAME_POINTER_EVENT = 'pointer-event'; const CLASS_NAME_POINTER_EVENT = 'pointer-event';
const SWIPE_THRESHOLD = 40; const SWIPE_THRESHOLD = 40;
const Default$c = { const Default$c = {
endCallback: null,
leftCallback: null, leftCallback: null,
rightCallback: null, rightCallback: null
endCallback: null
}; };
const DefaultType$c = { const DefaultType$c = {
endCallback: '(function|null)',
leftCallback: '(function|null)', leftCallback: '(function|null)',
rightCallback: '(function|null)', rightCallback: '(function|null)'
endCallback: '(function|null)'
}; };
/** /**
* Class definition * Class definition
@@ -1224,7 +1228,7 @@ class Swipe extends Config {
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): carousel.js * Bootstrap (v5.2.0): carousel.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -1280,9 +1284,10 @@ const Default$b = {
}; };
const DefaultType$b = { const DefaultType$b = {
interval: '(number|boolean)', interval: '(number|boolean)',
// TODO:v6 remove boolean support
keyboard: 'boolean', keyboard: 'boolean',
ride: '(boolean|string)',
pause: '(string|boolean)', pause: '(string|boolean)',
ride: '(boolean|string)',
touch: 'boolean', touch: 'boolean',
wrap: 'boolean' wrap: 'boolean'
}; };
@@ -1671,7 +1676,7 @@ defineJQueryPlugin(Carousel);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): collapse.js * Bootstrap (v5.2.0): collapse.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -1699,12 +1704,12 @@ const HEIGHT = 'height';
const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing'; const SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing';
const SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]'; const SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]';
const Default$a = { const Default$a = {
toggle: true, parent: null,
parent: null toggle: true
}; };
const DefaultType$a = { const DefaultType$a = {
toggle: 'boolean', parent: '(null|element)',
parent: '(null|element)' toggle: 'boolean'
}; };
/** /**
* Class definition * Class definition
@@ -1961,7 +1966,7 @@ defineJQueryPlugin(Collapse);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): dropdown.js * Bootstrap (v5.2.0): dropdown.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -2007,20 +2012,20 @@ const PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start';
const PLACEMENT_TOPCENTER = 'top'; const PLACEMENT_TOPCENTER = 'top';
const PLACEMENT_BOTTOMCENTER = 'bottom'; const PLACEMENT_BOTTOMCENTER = 'bottom';
const Default$9 = { const Default$9 = {
offset: [0, 2], autoClose: true,
boundary: 'clippingParents', boundary: 'clippingParents',
reference: 'toggle',
display: 'dynamic', display: 'dynamic',
offset: [0, 2],
popperConfig: null, popperConfig: null,
autoClose: true reference: 'toggle'
}; };
const DefaultType$9 = { const DefaultType$9 = {
offset: '(array|string|function)', autoClose: '(boolean|string)',
boundary: '(string|element)', boundary: '(string|element)',
reference: '(string|element|object)',
display: 'string', display: 'string',
offset: '(array|string|function)',
popperConfig: '(null|object|function)', popperConfig: '(null|object|function)',
autoClose: '(boolean|string)' reference: '(string|element|object)'
}; };
/** /**
* Class definition * Class definition
@@ -2391,7 +2396,7 @@ defineJQueryPlugin(Dropdown);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): util/scrollBar.js * Bootstrap (v5.2.0): util/scrollBar.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -2510,7 +2515,7 @@ class ScrollBarHelper {
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): util/backdrop.js * Bootstrap (v5.2.0): util/backdrop.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -2524,19 +2529,19 @@ const CLASS_NAME_SHOW$5 = 'show';
const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$9}`; const EVENT_MOUSEDOWN = `mousedown.bs.${NAME$9}`;
const Default$8 = { const Default$8 = {
className: 'modal-backdrop', className: 'modal-backdrop',
clickCallback: null,
isAnimated: false,
isVisible: true, isVisible: true,
// if false, we use the backdrop helper without adding any element to the dom // if false, we use the backdrop helper without adding any element to the dom
isAnimated: false, rootElement: 'body' // give the choice to place backdrop under different elements
rootElement: 'body',
// give the choice to place backdrop under different elements
clickCallback: null
}; };
const DefaultType$8 = { const DefaultType$8 = {
className: 'string', className: 'string',
isVisible: 'boolean', clickCallback: '(function|null)',
isAnimated: 'boolean', isAnimated: 'boolean',
rootElement: '(element|string)', isVisible: 'boolean',
clickCallback: '(function|null)' rootElement: '(element|string)'
}; };
/** /**
* Class definition * Class definition
@@ -2656,7 +2661,7 @@ class Backdrop extends Config {
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): util/focustrap.js * Bootstrap (v5.2.0): util/focustrap.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -2673,13 +2678,13 @@ const TAB_KEY = 'Tab';
const TAB_NAV_FORWARD = 'forward'; const TAB_NAV_FORWARD = 'forward';
const TAB_NAV_BACKWARD = 'backward'; const TAB_NAV_BACKWARD = 'backward';
const Default$7 = { const Default$7 = {
trapElement: null, autofocus: true,
// The element to trap focus inside of trapElement: null // The element to trap focus inside of
autofocus: true
}; };
const DefaultType$7 = { const DefaultType$7 = {
trapElement: 'element', autofocus: 'boolean',
autofocus: 'boolean' trapElement: 'element'
}; };
/** /**
* Class definition * Class definition
@@ -2765,7 +2770,7 @@ class FocusTrap extends Config {
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): modal.js * Bootstrap (v5.2.0): modal.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -2784,7 +2789,7 @@ const EVENT_HIDDEN$4 = `hidden${EVENT_KEY$4}`;
const EVENT_SHOW$4 = `show${EVENT_KEY$4}`; const EVENT_SHOW$4 = `show${EVENT_KEY$4}`;
const EVENT_SHOWN$4 = `shown${EVENT_KEY$4}`; const EVENT_SHOWN$4 = `shown${EVENT_KEY$4}`;
const EVENT_RESIZE$1 = `resize${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_KEYDOWN_DISMISS$1 = `keydown.dismiss${EVENT_KEY$4}`;
const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$4}${DATA_API_KEY$2}`; const EVENT_CLICK_DATA_API$2 = `click${EVENT_KEY$4}${DATA_API_KEY$2}`;
const CLASS_NAME_OPEN = 'modal-open'; const CLASS_NAME_OPEN = 'modal-open';
@@ -2797,13 +2802,13 @@ const SELECTOR_MODAL_BODY = '.modal-body';
const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]'; const SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]';
const Default$6 = { const Default$6 = {
backdrop: true, backdrop: true,
keyboard: true, focus: true,
focus: true keyboard: true
}; };
const DefaultType$6 = { const DefaultType$6 = {
backdrop: '(boolean|string)', backdrop: '(boolean|string)',
keyboard: 'boolean', focus: 'boolean',
focus: 'boolean' keyboard: 'boolean'
}; };
/** /**
* Class definition * Class definition
@@ -2975,7 +2980,7 @@ class Modal extends BaseComponent {
this._adjustDialog(); this._adjustDialog();
} }
}); });
EventHandler.on(this._element, EVENT_CLICK_DISMISS, event => { EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, event => {
if (event.target !== event.currentTarget) { if (event.target !== event.currentTarget) {
// click is inside modal-dialog // click is inside modal-dialog
return; return;
@@ -3138,7 +3143,7 @@ defineJQueryPlugin(Modal);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): offcanvas.js * Bootstrap (v5.2.0): offcanvas.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -3236,7 +3241,7 @@ class Offcanvas extends BaseComponent {
this._element.classList.add(CLASS_NAME_SHOWING$1); this._element.classList.add(CLASS_NAME_SHOWING$1);
const completeCallBack = () => { const completeCallBack = () => {
if (!this._config.scroll) { if (!this._config.scroll || this._config.backdrop) {
this._focustrap.activate(); this._focustrap.activate();
} }
@@ -3412,7 +3417,7 @@ defineJQueryPlugin(Offcanvas);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): util/sanitizer.js * Bootstrap (v5.2.0): util/sanitizer.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -3421,14 +3426,14 @@ const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
/** /**
* A pattern that recognizes a commonly useful subset of URLs that are safe. * A pattern that recognizes a commonly useful subset of URLs that are safe.
* *
* Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts * Shout-out to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
*/ */
const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i; const SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file|sms):|[^#&/:?]*(?:[#/?]|$))/i;
/** /**
* A pattern that matches safe data URLs. Only matches image, video and audio types. * A pattern that matches safe data URLs. Only matches image, video and audio types.
* *
* Shoutout to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts * Shout-out to Angular https://github.com/angular/angular/blob/12.2.x/packages/core/src/sanitization/url_sanitizer.ts
*/ */
const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i; const DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i;
@@ -3517,7 +3522,7 @@ function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): util/template-factory.js * Bootstrap (v5.2.0): util/template-factory.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -3527,27 +3532,27 @@ function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {
const NAME$5 = 'TemplateFactory'; const NAME$5 = 'TemplateFactory';
const Default$4 = { const Default$4 = {
extraClass: '', allowList: DefaultAllowlist,
template: '<div></div>',
content: {}, content: {},
// { selector : text , selector2 : text2 , } // { selector : text , selector2 : text2 , }
extraClass: '',
html: false, html: false,
sanitize: true, sanitize: true,
sanitizeFn: null, sanitizeFn: null,
allowList: DefaultAllowlist template: '<div></div>'
}; };
const DefaultType$4 = { const DefaultType$4 = {
extraClass: '(string|function)', allowList: 'object',
template: 'string',
content: 'object', content: 'object',
extraClass: '(string|function)',
html: 'boolean', html: 'boolean',
sanitize: 'boolean', sanitize: 'boolean',
sanitizeFn: '(null|function)', sanitizeFn: '(null|function)',
allowList: 'object' template: 'string'
}; };
const DefaultContentType = { const DefaultContentType = {
selector: '(string|element)', entry: '(string|element|function|null)',
entry: '(string|element|function|null)' selector: '(string|element)'
}; };
/** /**
* Class definition * Class definition
@@ -3675,7 +3680,7 @@ class TemplateFactory extends Config {
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): tooltip.js * Bootstrap (v5.2.0): tooltip.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -3713,42 +3718,42 @@ const AttachmentMap = {
LEFT: isRTL() ? 'right' : 'left' LEFT: isRTL() ? 'right' : 'left'
}; };
const Default$3 = { const Default$3 = {
allowList: DefaultAllowlist,
animation: true, animation: true,
template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>',
trigger: 'hover focus',
title: '',
delay: 0,
html: false,
selector: false,
placement: 'top',
offset: [0, 0],
container: false,
fallbackPlacements: ['top', 'right', 'bottom', 'left'],
boundary: 'clippingParents', boundary: 'clippingParents',
container: false,
customClass: '', customClass: '',
delay: 0,
fallbackPlacements: ['top', 'right', 'bottom', 'left'],
html: false,
offset: [0, 0],
placement: 'top',
popperConfig: null,
sanitize: true, sanitize: true,
sanitizeFn: null, sanitizeFn: null,
allowList: DefaultAllowlist, selector: false,
popperConfig: null template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>',
title: '',
trigger: 'hover focus'
}; };
const DefaultType$3 = { const DefaultType$3 = {
allowList: 'object',
animation: 'boolean', animation: 'boolean',
template: 'string',
title: '(string|element|function)',
trigger: 'string',
delay: '(number|object)',
html: 'boolean',
selector: '(string|boolean)',
placement: '(string|function)',
offset: '(array|string|function)',
container: '(string|element|boolean)',
fallbackPlacements: 'array',
boundary: '(string|element)', boundary: '(string|element)',
container: '(string|element|boolean)',
customClass: '(string|function)', customClass: '(string|function)',
delay: '(number|object)',
fallbackPlacements: 'array',
html: 'boolean',
offset: '(array|string|function)',
placement: '(string|function)',
popperConfig: '(null|object|function)',
sanitize: 'boolean', sanitize: 'boolean',
sanitizeFn: '(null|function)', sanitizeFn: '(null|function)',
allowList: 'object', selector: '(string|boolean)',
popperConfig: '(null|object|function)' template: 'string',
title: '(string|element|function)',
trigger: 'string'
}; };
/** /**
* Class definition * Class definition
@@ -3767,7 +3772,8 @@ class Tooltip extends BaseComponent {
this._isHovered = false; this._isHovered = false;
this._activeTrigger = {}; this._activeTrigger = {};
this._popper = null; this._popper = null;
this._templateFactory = null; // Protected this._templateFactory = null;
this._newContent = null; // Protected
this.tip = null; this.tip = null;
@@ -3857,6 +3863,12 @@ class Tooltip extends BaseComponent {
if (showEvent.defaultPrevented || !isInTheDom) { if (showEvent.defaultPrevented || !isInTheDom) {
return; return;
} // todo v6 remove this OR make it optional
if (this.tip) {
this.tip.remove();
this.tip = null;
} }
const tip = this._getTipElement(); const tip = this._getTipElement();
@@ -3875,7 +3887,7 @@ class Tooltip extends BaseComponent {
if (this._popper) { if (this._popper) {
this._popper.update(); this._popper.update();
} else { } else {
this._createPopper(tip); this._popper = this._createPopper(tip);
} }
tip.classList.add(CLASS_NAME_SHOW$2); // If this is a touch-enabled device we add extra tip.classList.add(CLASS_NAME_SHOW$2); // If this is a touch-enabled device we add extra
@@ -3961,7 +3973,7 @@ class Tooltip extends BaseComponent {
_getTipElement() { _getTipElement() {
if (!this.tip) { if (!this.tip) {
this.tip = this._createTipElement(this._getContentForTemplate()); this.tip = this._createTipElement(this._newContent || this._getContentForTemplate());
} }
return this.tip; return this.tip;
@@ -3989,19 +4001,11 @@ class Tooltip extends BaseComponent {
} }
setContent(content) { setContent(content) {
let isShown = false; this._newContent = content;
if (this.tip) { if (this._isShown()) {
isShown = this._isShown(); this._disposePopper();
this.tip.remove();
this.tip = null;
}
this._disposePopper();
this.tip = this._createTipElement(content);
if (isShown) {
this.show(); this.show();
} }
} }
@@ -4028,7 +4032,7 @@ class Tooltip extends BaseComponent {
} }
_getTitle() { _getTitle() {
return this._config.title; return this._resolvePossibleFunction(this._config.title) || this._config.originalTitle;
} // Private } // Private
@@ -4047,7 +4051,7 @@ class Tooltip extends BaseComponent {
_createPopper(tip) { _createPopper(tip) {
const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement; const placement = typeof this._config.placement === 'function' ? this._config.placement.call(this, tip, this._element) : this._config.placement;
const attachment = AttachmentMap[placement.toUpperCase()]; const attachment = AttachmentMap[placement.toUpperCase()];
this._popper = Popper.createPopper(this._element, tip, this._getPopperConfig(attachment)); return Popper.createPopper(this._element, tip, this._getPopperConfig(attachment));
} }
_getOffset() { _getOffset() {
@@ -4160,7 +4164,7 @@ class Tooltip extends BaseComponent {
return; return;
} }
if (!this._element.getAttribute('aria-label') && !this._element.textContent) { if (!this._element.getAttribute('aria-label') && !this._element.textContent.trim()) {
this._element.setAttribute('aria-label', title); this._element.setAttribute('aria-label', title);
} }
@@ -4236,7 +4240,6 @@ class Tooltip extends BaseComponent {
} }
config.originalTitle = this._element.getAttribute('title') || ''; config.originalTitle = this._element.getAttribute('title') || '';
config.title = this._resolvePossibleFunction(config.title) || config.originalTitle;
if (typeof config.title === 'number') { if (typeof config.title === 'number') {
config.title = config.title.toString(); config.title = config.title.toString();
@@ -4299,7 +4302,7 @@ defineJQueryPlugin(Tooltip);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): popover.js * Bootstrap (v5.2.0): popover.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -4311,11 +4314,11 @@ const NAME$3 = 'popover';
const SELECTOR_TITLE = '.popover-header'; const SELECTOR_TITLE = '.popover-header';
const SELECTOR_CONTENT = '.popover-body'; const SELECTOR_CONTENT = '.popover-body';
const Default$2 = { ...Tooltip.Default, const Default$2 = { ...Tooltip.Default,
placement: 'right',
offset: [0, 8],
trigger: 'click',
content: '', content: '',
template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>' offset: [0, 8],
placement: 'right',
template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>',
trigger: 'click'
}; };
const DefaultType$2 = { ...Tooltip.DefaultType, const DefaultType$2 = { ...Tooltip.DefaultType,
content: '(null|string|element|function)' content: '(null|string|element|function)'
@@ -4382,7 +4385,7 @@ defineJQueryPlugin(Popover);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): scrollspy.js * Bootstrap (v5.2.0): scrollspy.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -4502,7 +4505,8 @@ class ScrollSpy extends BaseComponent {
if (root.scrollTo) { if (root.scrollTo) {
root.scrollTo({ root.scrollTo({
top: height top: height,
behavior: 'smooth'
}); });
return; return;
} // Chrome 60 doesn't support `scrollTo` } // Chrome 60 doesn't support `scrollTo`
@@ -4668,7 +4672,7 @@ defineJQueryPlugin(ScrollSpy);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): tab.js * Bootstrap (v5.2.0): tab.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
@@ -4769,15 +4773,9 @@ class Tab extends BaseComponent {
this._activate(getElementFromSelector(element)); // Search and activate/show the proper section this._activate(getElementFromSelector(element)); // Search and activate/show the proper section
const isAnimated = element.classList.contains(CLASS_NAME_FADE$1);
const complete = () => { const complete = () => {
if (isAnimated) {
// todo: maybe is redundant
element.classList.add(CLASS_NAME_SHOW$1);
}
if (element.getAttribute('role') !== 'tab') { if (element.getAttribute('role') !== 'tab') {
element.classList.add(CLASS_NAME_SHOW$1);
return; return;
} }
@@ -4792,7 +4790,7 @@ class Tab extends BaseComponent {
}); });
}; };
this._queueCallback(complete, element, isAnimated); this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
} }
_deactivate(element, relatedElem) { _deactivate(element, relatedElem) {
@@ -4806,15 +4804,9 @@ class Tab extends BaseComponent {
this._deactivate(getElementFromSelector(element)); // Search and deactivate the shown section too this._deactivate(getElementFromSelector(element)); // Search and deactivate the shown section too
const isAnimated = element.classList.contains(CLASS_NAME_FADE$1);
const complete = () => { const complete = () => {
if (isAnimated) {
// todo maybe is redundant
element.classList.remove(CLASS_NAME_SHOW$1);
}
if (element.getAttribute('role') !== 'tab') { if (element.getAttribute('role') !== 'tab') {
element.classList.remove(CLASS_NAME_SHOW$1);
return; return;
} }
@@ -4828,7 +4820,7 @@ class Tab extends BaseComponent {
}); });
}; };
this._queueCallback(complete, element, isAnimated); this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE$1));
} }
_keydown(event) { _keydown(event) {
@@ -4993,7 +4985,7 @@ defineJQueryPlugin(Tab);
/** /**
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
* Bootstrap (v5.2.0-beta1): toast.js * Bootstrap (v5.2.0): toast.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* -------------------------------------------------------------------------- * --------------------------------------------------------------------------
*/ */
File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More