You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
10 KiB
1 lines
10 KiB
{"version":3,"sources":["../../src/bootstrap/toast.js"],"names":["DATA_KEY","EVENT_KEY","JQUERY_NO_CONFLICT","$","fn","EVENT_CLICK_DISMISS","EVENT_HIDE","EVENT_HIDDEN","EVENT_SHOW","EVENT_SHOWN","CLASS_NAME_HIDE","CLASS_NAME_SHOW","CLASS_NAME_SHOWING","DefaultType","animation","autohide","delay","Default","Toast","element","config","_element","_config","_getConfig","_timeout","_setListeners","showEvent","Event","trigger","isDefaultPrevented","_clearTimeout","classList","add","complete","remove","setTimeout","hide","Util","reflow","transitionDuration","getTransitionDurationFromElement","one","TRANSITION_END","emulateTransitionEnd","contains","hideEvent","_close","off","removeData","data","typeCheckConfig","constructor","on","clearTimeout","each","$element","TypeError","_jQueryInterface","Constructor","noConflict"],"mappings":"mKAOA,OACA,O,60CAUMA,CAAAA,CAAQ,CAAG,U,CACXC,CAAS,YAAOD,CAAP,C,CACTE,CAAkB,CAAGC,UAAEC,EAAF,M,CAErBC,CAAmB,wBAAmBJ,CAAnB,C,CACnBK,CAAU,eAAUL,CAAV,C,CACVM,CAAY,iBAAYN,CAAZ,C,CACZO,CAAU,eAAUP,CAAV,C,CACVQ,CAAW,gBAAWR,CAAX,C,CAGXS,CAAe,CAAG,M,CAClBC,CAAe,CAAG,M,CAClBC,CAAkB,CAAG,S,CAErBC,CAAW,CAAG,CAClBC,SAAS,CAAE,SADO,CAElBC,QAAQ,CAAE,SAFQ,CAGlBC,KAAK,CAAE,QAHW,C,CAMdC,CAAO,CAAG,CACdH,SAAS,GADK,CAEdC,QAAQ,GAFM,CAGdC,KAAK,CAAE,GAHO,C,CAcVE,C,YACJ,WAAYC,CAAZ,CAAqBC,CAArB,CAA6B,WAC3B,KAAKC,QAAL,CAAgBF,CAAhB,CACA,KAAKG,OAAL,CAAe,KAAKC,UAAL,CAAgBH,CAAhB,CAAf,CACA,KAAKI,Q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UAAEC,EAAF,OAAac,CAAK,CAACuC,gBAAnB,CACAtD,UAAEC,EAAF,OAAWsD,WAAX,CAAyBxC,CAAzB,CACAf,UAAEC,EAAF,OAAWuD,UAAX,CAAwB,UAAM,CAC5BxD,UAAEC,EAAF,OAAaF,CAAb,CACA,MAAOgB,CAAAA,CAAK,CAACuC,gBACd,CAHD,C,UAKevC,C","sourcesContent":["/**\n * --------------------------------------------------------------------------\n * Bootstrap (v4.6.0): toast.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport $ from 'jquery'\nimport Util from './util'\n\n/**\n * ------------------------------------------------------------------------\n * Constants\n * ------------------------------------------------------------------------\n */\n\nconst NAME = 'toast'\nconst VERSION = '4.6.0'\nconst DATA_KEY = 'bs.toast'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst JQUERY_NO_CONFLICT = $.fn[NAME]\n\nconst EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`\nconst EVENT_HIDE = `hide${EVENT_KEY}`\nconst EVENT_HIDDEN = `hidden${EVENT_KEY}`\nconst EVENT_SHOW = `show${EVENT_KEY}`\nconst EVENT_SHOWN = `shown${EVENT_KEY}`\n\nconst CLASS_NAME_FADE = 'fade'\nconst CLASS_NAME_HIDE = 'hide'\nconst CLASS_NAME_SHOW = 'show'\nconst CLASS_NAME_SHOWING = 'showing'\n\nconst DefaultType = {\n animation: 'boolean',\n autohide: 'boolean',\n delay: 'number'\n}\n\nconst Default = {\n animation: true,\n autohide: true,\n delay: 500\n}\n\nconst SELECTOR_DATA_DISMISS = '[data-dismiss=\"toast\"]'\n\n/**\n * ------------------------------------------------------------------------\n * Class Definition\n * ------------------------------------------------------------------------\n */\n\nclass Toast {\n constructor(element, config) {\n this._element = element\n this._config = this._getConfig(config)\n this._timeout = null\n this._setListeners()\n }\n\n // Getters\n\n static get VERSION() {\n return VERSION\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get Default() {\n return Default\n }\n\n // Public\n\n show() {\n const showEvent = $.Event(EVENT_SHOW)\n\n $(this._element).trigger(showEvent)\n if (showEvent.isDefaultPrevented()) {\n return\n }\n\n this._clearTimeout()\n\n if (this._config.animation) {\n this._element.classList.add(CLASS_NAME_FADE)\n }\n\n const complete = () => {\n this._element.classList.remove(CLASS_NAME_SHOWING)\n this._element.classList.add(CLASS_NAME_SHOW)\n\n $(this._element).trigger(EVENT_SHOWN)\n\n if (this._config.autohide) {\n this._timeout = setTimeout(() => {\n this.hide()\n }, this._config.delay)\n }\n }\n\n this._element.classList.remove(CLASS_NAME_HIDE)\n Util.reflow(this._element)\n this._element.classList.add(CLASS_NAME_SHOWING)\n if (this._config.animation) {\n const transitionDuration = Util.getTransitionDurationFromElement(this._element)\n\n $(this._element)\n .one(Util.TRANSITION_END, complete)\n .emulateTransitionEnd(transitionDuration)\n } else {\n complete()\n }\n }\n\n hide() {\n if (!this._element.classList.contains(CLASS_NAME_SHOW)) {\n return\n }\n\n const hideEvent = $.Event(EVENT_HIDE)\n\n $(this._element).trigger(hideEvent)\n if (hideEvent.isDefaultPrevented()) {\n return\n }\n\n this._close()\n }\n\n dispose() {\n this._clearTimeout()\n\n if (this._element.classList.contains(CLASS_NAME_SHOW)) {\n this._element.classList.remove(CLASS_NAME_SHOW)\n }\n\n $(this._element).off(EVENT_CLICK_DISMISS)\n\n $.removeData(this._element, DATA_KEY)\n this._element = null\n this._config = null\n }\n\n // Private\n\n _getConfig(config) {\n config = {\n ...Default,\n ...$(this._element).data(),\n ...(typeof config === 'object' && config ? config : {})\n }\n\n Util.typeCheckConfig(\n NAME,\n config,\n this.constructor.DefaultType\n )\n\n return config\n }\n\n _setListeners() {\n $(this._element).on(EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, () => this.hide())\n }\n\n _close() {\n const complete = () => {\n this._element.classList.add(CLASS_NAME_HIDE)\n $(this._element).trigger(EVENT_HIDDEN)\n }\n\n this._element.classList.remove(CLASS_NAME_SHOW)\n if (this._config.animation) {\n const transitionDuration = Util.getTransitionDurationFromElement(this._element)\n\n $(this._element)\n .one(Util.TRANSITION_END, complete)\n .emulateTransitionEnd(transitionDuration)\n } else {\n complete()\n }\n }\n\n _clearTimeout() {\n clearTimeout(this._timeout)\n this._timeout = null\n }\n\n // Static\n\n static _jQueryInterface(config) {\n return this.each(function () {\n const $element = $(this)\n let data = $element.data(DATA_KEY)\n const _config = typeof config === 'object' && config\n\n if (!data) {\n data = new Toast(this, _config)\n $element.data(DATA_KEY, data)\n }\n\n if (typeof config === 'string') {\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config](this)\n }\n })\n }\n}\n\n/**\n * ------------------------------------------------------------------------\n * jQuery\n * ------------------------------------------------------------------------\n */\n\n$.fn[NAME] = Toast._jQueryInterface\n$.fn[NAME].Constructor = Toast\n$.fn[NAME].noConflict = () => {\n $.fn[NAME] = JQUERY_NO_CONFLICT\n return Toast._jQueryInterface\n}\n\nexport default Toast\n"],"file":"toast.min.js"}
|