CoreFiles by mySites.guru
toast.es6.min.js1 lines, 3,618 bytes, from Joomla_4.0.0-beta7-Beta-Full_Package.zip
Raw History Compare with 4.0.0-beta6
md5
d67ffc423b7d7ae2eeae6eab189391e7
sha1
837ef5a2595771ef0dcee394e735eac0ac64511b
sha256
ec0cc925255d781c53c61e4359974bf49a8890259cadcc61bed9b7ac506bca9f
import{B as BaseComponent,E as EventHandler,r as reflow,a as getTransitionDurationFromElement,T as TRANSITION_END,e as emulateTransitionEnd,M as Manipulator,c as typeCheckConfig,D as Data,o as onDOMContentLoaded,b as getjQuery}from"./dom-8eef6b5f.js";const NAME="toast",DATA_KEY="bs.toast",EVENT_KEY=".bs.toast",EVENT_CLICK_DISMISS="click.dismiss.bs.toast",EVENT_HIDE="hide.bs.toast",EVENT_HIDDEN="hidden.bs.toast",EVENT_SHOW="show.bs.toast",EVENT_SHOWN="shown.bs.toast",CLASS_NAME_FADE="fade",CLASS_NAME_HIDE="hide",CLASS_NAME_SHOW="show",CLASS_NAME_SHOWING="showing",DefaultType={animation:"boolean",autohide:"boolean",delay:"number"},Default={animation:!0,autohide:!0,delay:5e3},SELECTOR_DATA_DISMISS='[data-bs-dismiss="toast"]';class Toast extends BaseComponent{constructor(t,e){super(t),this._config=this._getConfig(e),this._timeout=null,this._setListeners()}static get DefaultType(){return DefaultType}static get Default(){return Default}static get DATA_KEY(){return DATA_KEY}show(){if(EventHandler.trigger(this._element,EVENT_SHOW).defaultPrevented)return;this._clearTimeout(),this._config.animation&&this._element.classList.add("fade");const t=()=>{this._element.classList.remove("showing"),this._element.classList.add("show"),EventHandler.trigger(this._element,EVENT_SHOWN),this._config.autohide&&(this._timeout=setTimeout((()=>{this.hide()}),this._config.delay))};if(this._element.classList.remove("hide"),reflow(this._element),this._element.classList.add("showing"),this._config.animation){const e=getTransitionDurationFromElement(this._element);EventHandler.one(this._element,TRANSITION_END,t),emulateTransitionEnd(this._element,e)}else t()}hide(){if(!this._element.classList.contains("show"))return;if(EventHandler.trigger(this._element,EVENT_HIDE).defaultPrevented)return;const t=()=>{this._element.classList.add("hide"),EventHandler.trigger(this._element,EVENT_HIDDEN)};if(this._element.classList.remove("show"),this._config.animation){const e=getTransitionDurationFromElement(this._element);EventHandler.one(this._element,TRANSITION_END,t),emulateTransitionEnd(this._element,e)}else t()}dispose(){this._clearTimeout(),this._element.classList.contains("show")&&this._element.classList.remove("show"),EventHandler.off(this._element,EVENT_CLICK_DISMISS),super.dispose(),this._config=null}_getConfig(t){return t={...Default,...Manipulator.getDataAttributes(this._element),..."object"==typeof t&&t?t:{}},typeCheckConfig(NAME,t,this.constructor.DefaultType),t}_setListeners(){EventHandler.on(this._element,EVENT_CLICK_DISMISS,SELECTOR_DATA_DISMISS,(()=>this.hide()))}_clearTimeout(){clearTimeout(this._timeout),this._timeout=null}static jQueryInterface(t){return this.each((function(){let e=Data.getData(this,DATA_KEY);if(e||(e=new Toast(this,"object"==typeof t&&t)),"string"==typeof t){if(void 0===e[t])throw new TypeError(`No method named "${t}"`);e[t](this)}}))}}if(onDOMContentLoaded((()=>{const t=getjQuery();if(t){const e=t.fn.toast;t.fn.toast=Toast.jQueryInterface,t.fn.toast.Constructor=Toast,t.fn.toast.noConflict=()=>(t.fn.toast=e,Toast.jQueryInterface)}})),window.bootstrap=window.bootstrap||{},window.bootstrap.Toast=Toast,Object.prototype.hasOwnProperty.call(document.body.dataset,"bsNoJquery")||(document.body.dataset.bsNoJquery=""),Joomla&&Joomla.getOptions){const t=Joomla.getOptions("bootstrap.toast");"object"==typeof t&&null!==t&&Object.keys(t).forEach((e=>{const s=t[e],o={animation:!s.animation||s.animation,autohide:!s.autohide||s.autohide,delay:s.delay?s.delay:5e3},n=Array.from(document.querySelectorAll(e));n.length&&n.map((t=>new window.bootstrap.Toast(t,o)))}))}export{Toast as T};

No other release has this exact content. See every version of this file.