aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/twbs/bootstrap/js/dist/toast.js
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2023-01-20 11:05:15 +0000
committerMario <mario@mariovavti.com>2023-01-20 11:05:15 +0000
commit9dc949b62c6b5e3c8872211f71b11714d9d22b22 (patch)
tree38c06e7a128742e219eb74d6adb035f2f106918a /vendor/twbs/bootstrap/js/dist/toast.js
parent40394b94d7c8a8bf1f61f5482195164fff434b90 (diff)
downloadvolse-hubzilla-9dc949b62c6b5e3c8872211f71b11714d9d22b22.tar.gz
volse-hubzilla-9dc949b62c6b5e3c8872211f71b11714d9d22b22.tar.bz2
volse-hubzilla-9dc949b62c6b5e3c8872211f71b11714d9d22b22.zip
native dark theme initial checkin
Diffstat (limited to 'vendor/twbs/bootstrap/js/dist/toast.js')
-rw-r--r--vendor/twbs/bootstrap/js/dist/toast.js97
1 files changed, 27 insertions, 70 deletions
diff --git a/vendor/twbs/bootstrap/js/dist/toast.js b/vendor/twbs/bootstrap/js/dist/toast.js
index bf0705e7e..af6e8e914 100644
--- a/vendor/twbs/bootstrap/js/dist/toast.js
+++ b/vendor/twbs/bootstrap/js/dist/toast.js
@@ -1,25 +1,21 @@
/*!
- * Bootstrap toast.js v5.2.2 (https://getbootstrap.com/)
+ * Bootstrap toast.js v5.3.0-alpha1 (https://getbootstrap.com/)
* Copyright 2011-2022 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./util/index'), require('./dom/event-handler'), require('./base-component'), require('./util/component-functions')) :
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('./util/index.js'), require('./dom/event-handler.js'), require('./base-component.js'), require('./util/component-functions.js')) :
typeof define === 'function' && define.amd ? define(['./util/index', './dom/event-handler', './base-component', './util/component-functions'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Toast = factory(global.Index, global.EventHandler, global.BaseComponent, global.ComponentFunctions));
-})(this, (function (index, EventHandler, BaseComponent, componentFunctions) { 'use strict';
-
- const _interopDefaultLegacy = e => e && typeof e === 'object' && 'default' in e ? e : { default: e };
-
- const EventHandler__default = /*#__PURE__*/_interopDefaultLegacy(EventHandler);
- const BaseComponent__default = /*#__PURE__*/_interopDefaultLegacy(BaseComponent);
+})(this, (function (index_js, EventHandler, BaseComponent, componentFunctions_js) { 'use strict';
/**
* --------------------------------------------------------------------------
- * Bootstrap (v5.2.2): toast.js
+ * Bootstrap (v5.3.0-alpha1): toast.js
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
* --------------------------------------------------------------------------
*/
+
/**
* Constants
*/
@@ -37,7 +33,6 @@
const EVENT_SHOWN = `shown${EVENT_KEY}`;
const CLASS_NAME_FADE = 'fade';
const CLASS_NAME_HIDE = 'hide'; // @deprecated - kept here only for backwards compatibility
-
const CLASS_NAME_SHOW = 'show';
const CLASS_NAME_SHOWING = 'showing';
const DefaultType = {
@@ -50,119 +45,91 @@
autohide: true,
delay: 5000
};
+
/**
* Class definition
*/
- class Toast extends BaseComponent__default.default {
+ class Toast extends BaseComponent {
constructor(element, config) {
super(element, config);
this._timeout = null;
this._hasMouseInteraction = false;
this._hasKeyboardInteraction = false;
-
this._setListeners();
- } // Getters
-
+ }
+ // Getters
static get Default() {
return Default;
}
-
static get DefaultType() {
return DefaultType;
}
-
static get NAME() {
return NAME;
- } // Public
-
+ }
+ // Public
show() {
- const showEvent = EventHandler__default.default.trigger(this._element, EVENT_SHOW);
-
+ const showEvent = EventHandler.trigger(this._element, EVENT_SHOW);
if (showEvent.defaultPrevented) {
return;
}
-
this._clearTimeout();
-
if (this._config.animation) {
this._element.classList.add(CLASS_NAME_FADE);
}
-
const complete = () => {
this._element.classList.remove(CLASS_NAME_SHOWING);
-
- EventHandler__default.default.trigger(this._element, EVENT_SHOWN);
-
+ EventHandler.trigger(this._element, EVENT_SHOWN);
this._maybeScheduleHide();
};
-
this._element.classList.remove(CLASS_NAME_HIDE); // @deprecated
-
-
- index.reflow(this._element);
-
+ index_js.reflow(this._element);
this._element.classList.add(CLASS_NAME_SHOW, CLASS_NAME_SHOWING);
-
this._queueCallback(complete, this._element, this._config.animation);
}
-
hide() {
if (!this.isShown()) {
return;
}
-
- const hideEvent = EventHandler__default.default.trigger(this._element, EVENT_HIDE);
-
+ const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE);
if (hideEvent.defaultPrevented) {
return;
}
-
const complete = () => {
this._element.classList.add(CLASS_NAME_HIDE); // @deprecated
-
-
this._element.classList.remove(CLASS_NAME_SHOWING, CLASS_NAME_SHOW);
-
- EventHandler__default.default.trigger(this._element, EVENT_HIDDEN);
+ EventHandler.trigger(this._element, EVENT_HIDDEN);
};
-
this._element.classList.add(CLASS_NAME_SHOWING);
-
this._queueCallback(complete, this._element, this._config.animation);
}
-
dispose() {
this._clearTimeout();
-
if (this.isShown()) {
this._element.classList.remove(CLASS_NAME_SHOW);
}
-
super.dispose();
}
-
isShown() {
return this._element.classList.contains(CLASS_NAME_SHOW);
- } // Private
+ }
+ // Private
_maybeScheduleHide() {
if (!this._config.autohide) {
return;
}
-
if (this._hasMouseInteraction || this._hasKeyboardInteraction) {
return;
}
-
this._timeout = setTimeout(() => {
this.hide();
}, this._config.delay);
}
-
_onInteraction(event, isInteracting) {
switch (event.type) {
case 'mouseover':
@@ -171,7 +138,6 @@
this._hasMouseInteraction = isInteracting;
break;
}
-
case 'focusin':
case 'focusout':
{
@@ -179,61 +145,52 @@
break;
}
}
-
if (isInteracting) {
this._clearTimeout();
-
return;
}
-
const nextElement = event.relatedTarget;
-
if (this._element === nextElement || this._element.contains(nextElement)) {
return;
}
-
this._maybeScheduleHide();
}
-
_setListeners() {
- EventHandler__default.default.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true));
- EventHandler__default.default.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false));
- EventHandler__default.default.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true));
- EventHandler__default.default.on(this._element, EVENT_FOCUSOUT, event => this._onInteraction(event, false));
+ EventHandler.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true));
+ EventHandler.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false));
+ EventHandler.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true));
+ EventHandler.on(this._element, EVENT_FOCUSOUT, event => this._onInteraction(event, false));
}
-
_clearTimeout() {
clearTimeout(this._timeout);
this._timeout = null;
- } // Static
-
+ }
+ // Static
static jQueryInterface(config) {
return this.each(function () {
const data = Toast.getOrCreateInstance(this, config);
-
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError(`No method named "${config}"`);
}
-
data[config](this);
}
});
}
-
}
+
/**
* Data API implementation
*/
+ componentFunctions_js.enableDismissTrigger(Toast);
- componentFunctions.enableDismissTrigger(Toast);
/**
* jQuery
*/
- index.defineJQueryPlugin(Toast);
+ index_js.defineJQueryPlugin(Toast);
return Toast;