diff options
author | Mario <mario@mariovavti.com> | 2023-03-19 13:55:18 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2023-03-19 13:55:18 +0000 |
commit | 89285f1408d21091bb80d45b391ddcbe06ba8d0f (patch) | |
tree | b2eb07d9f3d91d77f89a4565a58e6e5231b20c1c /vendor/twbs/bootstrap/js/dist/toast.js | |
parent | 0a679e503ef367eda3085c44af103ee53869a94f (diff) | |
parent | 17c0bb2069dcfe35d3febc5bfdb3a7295f15d49c (diff) | |
download | volse-hubzilla-89285f1408d21091bb80d45b391ddcbe06ba8d0f.tar.gz volse-hubzilla-89285f1408d21091bb80d45b391ddcbe06ba8d0f.tar.bz2 volse-hubzilla-89285f1408d21091bb80d45b391ddcbe06ba8d0f.zip |
Merge branch '8.2RC'8.2
Diffstat (limited to 'vendor/twbs/bootstrap/js/dist/toast.js')
-rw-r--r-- | vendor/twbs/bootstrap/js/dist/toast.js | 97 |
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; |