Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bulma-toast

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bulma-toast - npm Package Compare versions

Comparing version 1.5.3 to 1.5.4

4

dist/bulma-toast.cjs.js
/*!
* bulma-toast 1.5.3
* bulma-toast 1.5.4
* (c) 2018-present @rfoel <rafaelfr@outlook.com>
* Released under the MIT License.
*/
'use strict';Object.defineProperty(exports,"__esModule",{value:!0});const defaults={message:"Your message here",duration:2e3,position:"top-right",closeOnClick:!0,opacity:1};let initialized=!1,containers={},positions={},doc=document;function init(){containers={noticesTopLeft:doc.createElement("div"),noticesTopRight:doc.createElement("div"),noticesBottomLeft:doc.createElement("div"),noticesBottomRight:doc.createElement("div"),noticesTopCenter:doc.createElement("div"),noticesBottomCenter:doc.createElement("div"),noticesCenter:doc.createElement("div")};for(let a in containers.noticesTopLeft.setAttribute("style",`${"width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;"}left:0;top:0;text-align:left;align-items:flex-start;`),containers.noticesTopRight.setAttribute("style",`${"width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;"}right:0;top:0;text-align:right;align-items:flex-end;`),containers.noticesBottomLeft.setAttribute("style",`${"width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;"}left:0;bottom:0;text-align:left;align-items:flex-start;`),containers.noticesBottomRight.setAttribute("style",`${"width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;"}right:0;bottom:0;text-align:right;align-items:flex-end;`),containers.noticesTopCenter.setAttribute("style",`${"width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;"}top:0;left:0;right:0;text-align:center;align-items:center;`),containers.noticesBottomCenter.setAttribute("style",`${"width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;"}bottom:0;left:0;right:0;text-align:center;align-items:center;`),containers.noticesCenter.setAttribute("style",`${"width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;"}top:0;left:0;right:0;bottom:0;flex-flow:column;justify-content:center;align-items:center;`),containers)doc.body.appendChild(containers[a]);positions={"top-left":containers.noticesTopLeft,"top-right":containers.noticesTopRight,"top-center":containers.noticesTopCenter,"bottom-left":containers.noticesBottomLeft,"bottom-right":containers.noticesBottomRight,"bottom-center":containers.noticesBottomCenter,center:containers.noticesCenter},initialized=!0}function toast(a){initialized||init();let b=Object.assign({},defaults,a);const c=new Toast(b),d=positions[b.position]||positions[defaults.position];d.appendChild(c.element)}function setDoc(a){for(let b in containers){let a=containers[b];a.parentNode.removeChild(a)}doc=a,init()}class Toast{constructor(a){this.element=doc.createElement("div"),this.opacity=a.opacity,this.type=a.type,this.animate=a.animate,this.dismissible=a.dismissible,this.closeOnClick=a.closeOnClick,this.message=a.message,this.duration=a.duration,this.pauseOnHover=a.pauseOnHover;let b=`width:auto;pointer-events:auto;display:inline-flex;white-space:pre-wrap;opacity:${this.opacity};`,c=["notification"];if(this.type&&c.push(this.type),this.animate&&this.animate.in&&(c.push(`animated ${this.animate.in}`),this.onAnimationEnd(()=>this.element.classList.remove(this.animate.in))),this.element.className=c.join(" "),this.dismissible){let a=doc.createElement("button");a.className="delete",a.addEventListener("click",()=>{this.destroy()}),this.element.insertAdjacentElement("afterbegin",a)}else b+="padding: 1.25rem 1.5rem";this.closeOnClick&&this.element.addEventListener("click",()=>{this.destroy()}),this.element.setAttribute("style",b),"string"==typeof this.message?this.element.insertAdjacentHTML("beforeend",this.message):this.element.appendChild(this.message);const d=new Timer(()=>{this.destroy()},this.duration);this.pauseOnHover&&(this.element.addEventListener("mouseover",()=>{d.pause()}),this.element.addEventListener("mouseout",()=>{d.resume()}))}destroy(){this.animate&&this.animate.out?(this.element.classList.add(this.animate.out),this.onAnimationEnd(()=>this.removeChild(this.element))):this.removeChild(this.element)}removeChild(a){a.parentNode&&a.parentNode.removeChild(a)}onAnimationEnd(a=()=>{}){const b={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"mozAnimationEnd",WebkitAnimation:"webkitAnimationEnd"};for(const c in b)if(this.element.style[c]!==void 0){this.element.addEventListener(b[c],()=>a());break}}}class Timer{constructor(a,b){this.timer,this.start,this.remaining=b,this.callback=a,this.resume()}pause(){window.clearTimeout(this.timer),this.remaining-=new Date-this.start}resume(){this.start=new Date,window.clearTimeout(this.timer),this.timer=window.setTimeout(this.callback,this.remaining)}}exports.setDoc=setDoc,exports.toast=toast;
'use strict';Object.defineProperty(exports,"__esModule",{value:!0});function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),a}var defaults={message:"Your message here",duration:2e3,position:"top-right",closeOnClick:!0,opacity:1},initialized=!1,containers={},positions={},doc=document;function init(){containers={noticesTopLeft:doc.createElement("div"),noticesTopRight:doc.createElement("div"),noticesBottomLeft:doc.createElement("div"),noticesBottomRight:doc.createElement("div"),noticesTopCenter:doc.createElement("div"),noticesBottomCenter:doc.createElement("div"),noticesCenter:doc.createElement("div")};for(var a in containers.noticesTopLeft.setAttribute("style","".concat("width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;","left:0;top:0;text-align:left;align-items:flex-start;")),containers.noticesTopRight.setAttribute("style","".concat("width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;","right:0;top:0;text-align:right;align-items:flex-end;")),containers.noticesBottomLeft.setAttribute("style","".concat("width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;","left:0;bottom:0;text-align:left;align-items:flex-start;")),containers.noticesBottomRight.setAttribute("style","".concat("width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;","right:0;bottom:0;text-align:right;align-items:flex-end;")),containers.noticesTopCenter.setAttribute("style","".concat("width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;","top:0;left:0;right:0;text-align:center;align-items:center;")),containers.noticesBottomCenter.setAttribute("style","".concat("width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;","bottom:0;left:0;right:0;text-align:center;align-items:center;")),containers.noticesCenter.setAttribute("style","".concat("width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;","top:0;left:0;right:0;bottom:0;flex-flow:column;justify-content:center;align-items:center;")),containers)doc.body.appendChild(containers[a]);positions={"top-left":containers.noticesTopLeft,"top-right":containers.noticesTopRight,"top-center":containers.noticesTopCenter,"bottom-left":containers.noticesBottomLeft,"bottom-right":containers.noticesBottomRight,"bottom-center":containers.noticesBottomCenter,center:containers.noticesCenter},initialized=!0}function toast(a){initialized||init();var b=Object.assign({},defaults,a),c=new Toast(b),d=positions[b.position]||positions[defaults.position];d.appendChild(c.element)}function setDoc(a){for(var b in containers){var c=containers[b];c.parentNode.removeChild(c)}doc=a,init()}var Toast=/*#__PURE__*/function(){function a(b){var c=this;_classCallCheck(this,a),this.element=doc.createElement("div"),this.opacity=b.opacity,this.type=b.type,this.animate=b.animate,this.dismissible=b.dismissible,this.closeOnClick=b.closeOnClick,this.message=b.message,this.duration=b.duration,this.pauseOnHover=b.pauseOnHover;var d="width:auto;pointer-events:auto;display:inline-flex;white-space:pre-wrap;opacity:".concat(this.opacity,";"),e=["notification"];if(this.type&&e.push(this.type),this.animate&&this.animate["in"]&&(e.push("animated ".concat(this.animate["in"])),this.onAnimationEnd(function(){return c.element.classList.remove(c.animate["in"])})),this.element.className=e.join(" "),this.dismissible){var f=doc.createElement("button");f.className="delete",f.addEventListener("click",function(){c.destroy()}),this.element.insertAdjacentElement("afterbegin",f)}else d+="padding: 1.25rem 1.5rem";this.closeOnClick&&this.element.addEventListener("click",function(){c.destroy()}),this.element.setAttribute("style",d),"string"==typeof this.message?this.element.insertAdjacentHTML("beforeend",this.message):this.element.appendChild(this.message);var g=new Timer(function(){c.destroy()},this.duration);this.pauseOnHover&&(this.element.addEventListener("mouseover",function(){g.pause()}),this.element.addEventListener("mouseout",function(){g.resume()}))}return _createClass(a,[{key:"destroy",value:function(){var a=this;this.animate&&this.animate.out?(this.element.classList.add(this.animate.out),this.onAnimationEnd(function(){return a.removeChild(a.element)})):this.removeChild(this.element)}},{key:"removeChild",value:function(a){a.parentNode&&a.parentNode.removeChild(a)}},{key:"onAnimationEnd",value:function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:function(){},b={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"mozAnimationEnd",WebkitAnimation:"webkitAnimationEnd"};for(var c in b)if(void 0!==this.element.style[c]){this.element.addEventListener(b[c],function(){return a()});break}}}]),a}(),Timer=/*#__PURE__*/function(){function a(b,c){_classCallCheck(this,a),this.timer,this.start,this.remaining=c,this.callback=b,this.resume()}return _createClass(a,[{key:"pause",value:function(){window.clearTimeout(this.timer),this.remaining-=new Date-this.start}},{key:"resume",value:function(){this.start=new Date,window.clearTimeout(this.timer),this.timer=window.setTimeout(this.callback,this.remaining)}}]),a}();exports.setDoc=setDoc,exports.toast=toast;
/*!
* bulma-toast 1.5.3
* bulma-toast 1.5.4
* (c) 2018-present @rfoel <rafaelfr@outlook.com>
* Released under the MIT License.
*/
const defaults={message:"Your message here",duration:2e3,position:"top-right",closeOnClick:!0,opacity:1};let initialized=!1,containers={},positions={},doc=document;function init(){containers={noticesTopLeft:doc.createElement("div"),noticesTopRight:doc.createElement("div"),noticesBottomLeft:doc.createElement("div"),noticesBottomRight:doc.createElement("div"),noticesTopCenter:doc.createElement("div"),noticesBottomCenter:doc.createElement("div"),noticesCenter:doc.createElement("div")};for(let a in containers.noticesTopLeft.setAttribute("style",`${"width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;"}left:0;top:0;text-align:left;align-items:flex-start;`),containers.noticesTopRight.setAttribute("style",`${"width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;"}right:0;top:0;text-align:right;align-items:flex-end;`),containers.noticesBottomLeft.setAttribute("style",`${"width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;"}left:0;bottom:0;text-align:left;align-items:flex-start;`),containers.noticesBottomRight.setAttribute("style",`${"width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;"}right:0;bottom:0;text-align:right;align-items:flex-end;`),containers.noticesTopCenter.setAttribute("style",`${"width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;"}top:0;left:0;right:0;text-align:center;align-items:center;`),containers.noticesBottomCenter.setAttribute("style",`${"width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;"}bottom:0;left:0;right:0;text-align:center;align-items:center;`),containers.noticesCenter.setAttribute("style",`${"width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;"}top:0;left:0;right:0;bottom:0;flex-flow:column;justify-content:center;align-items:center;`),containers)doc.body.appendChild(containers[a]);positions={"top-left":containers.noticesTopLeft,"top-right":containers.noticesTopRight,"top-center":containers.noticesTopCenter,"bottom-left":containers.noticesBottomLeft,"bottom-right":containers.noticesBottomRight,"bottom-center":containers.noticesBottomCenter,center:containers.noticesCenter},initialized=!0}function toast(a){initialized||init();let b=Object.assign({},defaults,a);const c=new Toast(b),d=positions[b.position]||positions[defaults.position];d.appendChild(c.element)}function setDoc(a){for(let b in containers){let a=containers[b];a.parentNode.removeChild(a)}doc=a,init()}class Toast{constructor(a){this.element=doc.createElement("div"),this.opacity=a.opacity,this.type=a.type,this.animate=a.animate,this.dismissible=a.dismissible,this.closeOnClick=a.closeOnClick,this.message=a.message,this.duration=a.duration,this.pauseOnHover=a.pauseOnHover;let b=`width:auto;pointer-events:auto;display:inline-flex;white-space:pre-wrap;opacity:${this.opacity};`,c=["notification"];if(this.type&&c.push(this.type),this.animate&&this.animate.in&&(c.push(`animated ${this.animate.in}`),this.onAnimationEnd(()=>this.element.classList.remove(this.animate.in))),this.element.className=c.join(" "),this.dismissible){let a=doc.createElement("button");a.className="delete",a.addEventListener("click",()=>{this.destroy()}),this.element.insertAdjacentElement("afterbegin",a)}else b+="padding: 1.25rem 1.5rem";this.closeOnClick&&this.element.addEventListener("click",()=>{this.destroy()}),this.element.setAttribute("style",b),"string"==typeof this.message?this.element.insertAdjacentHTML("beforeend",this.message):this.element.appendChild(this.message);const d=new Timer(()=>{this.destroy()},this.duration);this.pauseOnHover&&(this.element.addEventListener("mouseover",()=>{d.pause()}),this.element.addEventListener("mouseout",()=>{d.resume()}))}destroy(){this.animate&&this.animate.out?(this.element.classList.add(this.animate.out),this.onAnimationEnd(()=>this.removeChild(this.element))):this.removeChild(this.element)}removeChild(a){a.parentNode&&a.parentNode.removeChild(a)}onAnimationEnd(a=()=>{}){const b={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"mozAnimationEnd",WebkitAnimation:"webkitAnimationEnd"};for(const c in b)if(this.element.style[c]!==void 0){this.element.addEventListener(b[c],()=>a());break}}}class Timer{constructor(a,b){this.timer,this.start,this.remaining=b,this.callback=a,this.resume()}pause(){window.clearTimeout(this.timer),this.remaining-=new Date-this.start}resume(){this.start=new Date,window.clearTimeout(this.timer),this.timer=window.setTimeout(this.callback,this.remaining)}}export{setDoc,toast};
function _classCallCheck(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function _defineProperties(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function _createClass(a,b,c){return b&&_defineProperties(a.prototype,b),c&&_defineProperties(a,c),a}var defaults={message:"Your message here",duration:2e3,position:"top-right",closeOnClick:!0,opacity:1},initialized=!1,containers={},positions={},doc=document;function init(){containers={noticesTopLeft:doc.createElement("div"),noticesTopRight:doc.createElement("div"),noticesBottomLeft:doc.createElement("div"),noticesBottomRight:doc.createElement("div"),noticesTopCenter:doc.createElement("div"),noticesBottomCenter:doc.createElement("div"),noticesCenter:doc.createElement("div")};for(var a in containers.noticesTopLeft.setAttribute("style","".concat("width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;","left:0;top:0;text-align:left;align-items:flex-start;")),containers.noticesTopRight.setAttribute("style","".concat("width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;","right:0;top:0;text-align:right;align-items:flex-end;")),containers.noticesBottomLeft.setAttribute("style","".concat("width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;","left:0;bottom:0;text-align:left;align-items:flex-start;")),containers.noticesBottomRight.setAttribute("style","".concat("width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;","right:0;bottom:0;text-align:right;align-items:flex-end;")),containers.noticesTopCenter.setAttribute("style","".concat("width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;","top:0;left:0;right:0;text-align:center;align-items:center;")),containers.noticesBottomCenter.setAttribute("style","".concat("width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;","bottom:0;left:0;right:0;text-align:center;align-items:center;")),containers.noticesCenter.setAttribute("style","".concat("width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;","top:0;left:0;right:0;bottom:0;flex-flow:column;justify-content:center;align-items:center;")),containers)doc.body.appendChild(containers[a]);positions={"top-left":containers.noticesTopLeft,"top-right":containers.noticesTopRight,"top-center":containers.noticesTopCenter,"bottom-left":containers.noticesBottomLeft,"bottom-right":containers.noticesBottomRight,"bottom-center":containers.noticesBottomCenter,center:containers.noticesCenter},initialized=!0}function toast(a){initialized||init();var b=Object.assign({},defaults,a),c=new Toast(b),d=positions[b.position]||positions[defaults.position];d.appendChild(c.element)}function setDoc(a){for(var b in containers){var c=containers[b];c.parentNode.removeChild(c)}doc=a,init()}var Toast=/*#__PURE__*/function(){function a(b){var c=this;_classCallCheck(this,a),this.element=doc.createElement("div"),this.opacity=b.opacity,this.type=b.type,this.animate=b.animate,this.dismissible=b.dismissible,this.closeOnClick=b.closeOnClick,this.message=b.message,this.duration=b.duration,this.pauseOnHover=b.pauseOnHover;var d="width:auto;pointer-events:auto;display:inline-flex;white-space:pre-wrap;opacity:".concat(this.opacity,";"),e=["notification"];if(this.type&&e.push(this.type),this.animate&&this.animate["in"]&&(e.push("animated ".concat(this.animate["in"])),this.onAnimationEnd(function(){return c.element.classList.remove(c.animate["in"])})),this.element.className=e.join(" "),this.dismissible){var f=doc.createElement("button");f.className="delete",f.addEventListener("click",function(){c.destroy()}),this.element.insertAdjacentElement("afterbegin",f)}else d+="padding: 1.25rem 1.5rem";this.closeOnClick&&this.element.addEventListener("click",function(){c.destroy()}),this.element.setAttribute("style",d),"string"==typeof this.message?this.element.insertAdjacentHTML("beforeend",this.message):this.element.appendChild(this.message);var g=new Timer(function(){c.destroy()},this.duration);this.pauseOnHover&&(this.element.addEventListener("mouseover",function(){g.pause()}),this.element.addEventListener("mouseout",function(){g.resume()}))}return _createClass(a,[{key:"destroy",value:function(){var a=this;this.animate&&this.animate.out?(this.element.classList.add(this.animate.out),this.onAnimationEnd(function(){return a.removeChild(a.element)})):this.removeChild(this.element)}},{key:"removeChild",value:function(a){a.parentNode&&a.parentNode.removeChild(a)}},{key:"onAnimationEnd",value:function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:function(){},b={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"mozAnimationEnd",WebkitAnimation:"webkitAnimationEnd"};for(var c in b)if(void 0!==this.element.style[c]){this.element.addEventListener(b[c],function(){return a()});break}}}]),a}(),Timer=/*#__PURE__*/function(){function a(b,c){_classCallCheck(this,a),this.timer,this.start,this.remaining=c,this.callback=b,this.resume()}return _createClass(a,[{key:"pause",value:function(){window.clearTimeout(this.timer),this.remaining-=new Date-this.start}},{key:"resume",value:function(){this.start=new Date,window.clearTimeout(this.timer),this.timer=window.setTimeout(this.callback,this.remaining)}}]),a}();export{setDoc,toast};
/*!
* bulma-toast 1.5.3
* bulma-toast 1.5.4
* (c) 2018-present @rfoel <rafaelfr@outlook.com>
* Released under the MIT License.
*/
(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(exports):"function"==typeof define&&define.amd?define(["exports"],b):(a=a||self,b(a.bulmaToast={}))})(this,function(a){'use strict';function b(){g={noticesTopLeft:i.createElement("div"),noticesTopRight:i.createElement("div"),noticesBottomLeft:i.createElement("div"),noticesBottomRight:i.createElement("div"),noticesTopCenter:i.createElement("div"),noticesBottomCenter:i.createElement("div"),noticesCenter:i.createElement("div")};for(let a in g.noticesTopLeft.setAttribute("style",`${"width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;"}left:0;top:0;text-align:left;align-items:flex-start;`),g.noticesTopRight.setAttribute("style",`${"width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;"}right:0;top:0;text-align:right;align-items:flex-end;`),g.noticesBottomLeft.setAttribute("style",`${"width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;"}left:0;bottom:0;text-align:left;align-items:flex-start;`),g.noticesBottomRight.setAttribute("style",`${"width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;"}right:0;bottom:0;text-align:right;align-items:flex-end;`),g.noticesTopCenter.setAttribute("style",`${"width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;"}top:0;left:0;right:0;text-align:center;align-items:center;`),g.noticesBottomCenter.setAttribute("style",`${"width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;"}bottom:0;left:0;right:0;text-align:center;align-items:center;`),g.noticesCenter.setAttribute("style",`${"width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;"}top:0;left:0;right:0;bottom:0;flex-flow:column;justify-content:center;align-items:center;`),g)i.body.appendChild(g[a]);h={"top-left":g.noticesTopLeft,"top-right":g.noticesTopRight,"top-center":g.noticesTopCenter,"bottom-left":g.noticesBottomLeft,"bottom-right":g.noticesBottomRight,"bottom-center":g.noticesBottomCenter,center:g.noticesCenter},f=!0}function c(a){f||b();let c=Object.assign({},e,a);const d=new j(c),g=h[c.position]||h[e.position];g.appendChild(d.element)}function d(a){for(let b in g){let a=g[b];a.parentNode.removeChild(a)}i=a,b()}const e={message:"Your message here",duration:2e3,position:"top-right",closeOnClick:!0,opacity:1};let f=!1,g={},h={},i=document;class j{constructor(a){this.element=i.createElement("div"),this.opacity=a.opacity,this.type=a.type,this.animate=a.animate,this.dismissible=a.dismissible,this.closeOnClick=a.closeOnClick,this.message=a.message,this.duration=a.duration,this.pauseOnHover=a.pauseOnHover;let b=`width:auto;pointer-events:auto;display:inline-flex;white-space:pre-wrap;opacity:${this.opacity};`,c=["notification"];if(this.type&&c.push(this.type),this.animate&&this.animate.in&&(c.push(`animated ${this.animate.in}`),this.onAnimationEnd(()=>this.element.classList.remove(this.animate.in))),this.element.className=c.join(" "),this.dismissible){let a=i.createElement("button");a.className="delete",a.addEventListener("click",()=>{this.destroy()}),this.element.insertAdjacentElement("afterbegin",a)}else b+="padding: 1.25rem 1.5rem";this.closeOnClick&&this.element.addEventListener("click",()=>{this.destroy()}),this.element.setAttribute("style",b),"string"==typeof this.message?this.element.insertAdjacentHTML("beforeend",this.message):this.element.appendChild(this.message);const d=new k(()=>{this.destroy()},this.duration);this.pauseOnHover&&(this.element.addEventListener("mouseover",()=>{d.pause()}),this.element.addEventListener("mouseout",()=>{d.resume()}))}destroy(){this.animate&&this.animate.out?(this.element.classList.add(this.animate.out),this.onAnimationEnd(()=>this.removeChild(this.element))):this.removeChild(this.element)}removeChild(a){a.parentNode&&a.parentNode.removeChild(a)}onAnimationEnd(a=()=>{}){const b={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"mozAnimationEnd",WebkitAnimation:"webkitAnimationEnd"};for(const c in b)if(this.element.style[c]!==void 0){this.element.addEventListener(b[c],()=>a());break}}}class k{constructor(a,b){this.timer,this.start,this.remaining=b,this.callback=a,this.resume()}pause(){window.clearTimeout(this.timer),this.remaining-=new Date-this.start}resume(){this.start=new Date,window.clearTimeout(this.timer),this.timer=window.setTimeout(this.callback,this.remaining)}}a.setDoc=d,a.toast=c,Object.defineProperty(a,"__esModule",{value:!0})});
(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(exports):"function"==typeof define&&define.amd?define(["exports"],b):(a=a||self,b(a.bulmaToast={}))})(this,function(a){'use strict';function b(a,b){if(!(a instanceof b))throw new TypeError("Cannot call a class as a function")}function c(a,b){for(var c,d=0;d<b.length;d++)c=b[d],c.enumerable=c.enumerable||!1,c.configurable=!0,"value"in c&&(c.writable=!0),Object.defineProperty(a,c.key,c)}function d(a,b,d){return b&&c(a.prototype,b),d&&c(a,d),a}function e(){j={noticesTopLeft:l.createElement("div"),noticesTopRight:l.createElement("div"),noticesBottomLeft:l.createElement("div"),noticesBottomRight:l.createElement("div"),noticesTopCenter:l.createElement("div"),noticesBottomCenter:l.createElement("div"),noticesCenter:l.createElement("div")};for(var a in j.noticesTopLeft.setAttribute("style","".concat("width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;","left:0;top:0;text-align:left;align-items:flex-start;")),j.noticesTopRight.setAttribute("style","".concat("width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;","right:0;top:0;text-align:right;align-items:flex-end;")),j.noticesBottomLeft.setAttribute("style","".concat("width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;","left:0;bottom:0;text-align:left;align-items:flex-start;")),j.noticesBottomRight.setAttribute("style","".concat("width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;","right:0;bottom:0;text-align:right;align-items:flex-end;")),j.noticesTopCenter.setAttribute("style","".concat("width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;","top:0;left:0;right:0;text-align:center;align-items:center;")),j.noticesBottomCenter.setAttribute("style","".concat("width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;","bottom:0;left:0;right:0;text-align:center;align-items:center;")),j.noticesCenter.setAttribute("style","".concat("width:100%;z-index:99999;position:fixed;pointer-events:none;display:flex;flex-direction:column;padding:15px;","top:0;left:0;right:0;bottom:0;flex-flow:column;justify-content:center;align-items:center;")),j)l.body.appendChild(j[a]);k={"top-left":j.noticesTopLeft,"top-right":j.noticesTopRight,"top-center":j.noticesTopCenter,"bottom-left":j.noticesBottomLeft,"bottom-right":j.noticesBottomRight,"bottom-center":j.noticesBottomCenter,center:j.noticesCenter},i=!0}function f(a){i||e();var b=Object.assign({},h,a),c=new m(b),d=k[b.position]||k[h.position];d.appendChild(c.element)}function g(a){for(var b in j){var c=j[b];c.parentNode.removeChild(c)}l=a,e()}var h={message:"Your message here",duration:2e3,position:"top-right",closeOnClick:!0,opacity:1},i=!1,j={},k={},l=document,m=/*#__PURE__*/function(){function a(c){var d=this;b(this,a),this.element=l.createElement("div"),this.opacity=c.opacity,this.type=c.type,this.animate=c.animate,this.dismissible=c.dismissible,this.closeOnClick=c.closeOnClick,this.message=c.message,this.duration=c.duration,this.pauseOnHover=c.pauseOnHover;var e="width:auto;pointer-events:auto;display:inline-flex;white-space:pre-wrap;opacity:".concat(this.opacity,";"),f=["notification"];if(this.type&&f.push(this.type),this.animate&&this.animate["in"]&&(f.push("animated ".concat(this.animate["in"])),this.onAnimationEnd(function(){return d.element.classList.remove(d.animate["in"])})),this.element.className=f.join(" "),this.dismissible){var g=l.createElement("button");g.className="delete",g.addEventListener("click",function(){d.destroy()}),this.element.insertAdjacentElement("afterbegin",g)}else e+="padding: 1.25rem 1.5rem";this.closeOnClick&&this.element.addEventListener("click",function(){d.destroy()}),this.element.setAttribute("style",e),"string"==typeof this.message?this.element.insertAdjacentHTML("beforeend",this.message):this.element.appendChild(this.message);var h=new n(function(){d.destroy()},this.duration);this.pauseOnHover&&(this.element.addEventListener("mouseover",function(){h.pause()}),this.element.addEventListener("mouseout",function(){h.resume()}))}return d(a,[{key:"destroy",value:function(){var a=this;this.animate&&this.animate.out?(this.element.classList.add(this.animate.out),this.onAnimationEnd(function(){return a.removeChild(a.element)})):this.removeChild(this.element)}},{key:"removeChild",value:function(a){a.parentNode&&a.parentNode.removeChild(a)}},{key:"onAnimationEnd",value:function(){var a=0<arguments.length&&void 0!==arguments[0]?arguments[0]:function(){},b={animation:"animationend",OAnimation:"oAnimationEnd",MozAnimation:"mozAnimationEnd",WebkitAnimation:"webkitAnimationEnd"};for(var c in b)if(void 0!==this.element.style[c]){this.element.addEventListener(b[c],function(){return a()});break}}}]),a}(),n=/*#__PURE__*/function(){function a(c,d){b(this,a),this.timer,this.start,this.remaining=d,this.callback=c,this.resume()}return d(a,[{key:"pause",value:function(){window.clearTimeout(this.timer),this.remaining-=new Date-this.start}},{key:"resume",value:function(){this.start=new Date,window.clearTimeout(this.timer),this.timer=window.setTimeout(this.callback,this.remaining)}}]),a}();a.setDoc=g,a.toast=f,Object.defineProperty(a,"__esModule",{value:!0})});
{
"name": "bulma-toast",
"version": "1.5.3",
"version": "1.5.4",
"description": "Bulma's pure JavaScript extension to display toasts",

@@ -11,3 +11,4 @@ "main": "dist/bulma-toast.cjs.js",

"build": "rollup -c",
"test": "jest"
"test": "jest",
"coverage": "jest --coverage"
},

@@ -31,4 +32,8 @@ "repository": {

"devDependencies": {
"@babel/preset-env": "^7.6.3",
"jest": "^24.9.0",
"jest-environment-jsdom-fourteen": "^0.1.0",
"rollup": "^1.23.1",
"rollup-jest": "^0.0.2",
"rollup-plugin-babel": "^4.3.3",
"rollup-plugin-babel-minify": "^9.1.0"

@@ -43,3 +48,12 @@ },

],
"types": "index.d.ts"
"types": "index.d.ts",
"jest": {
"collectCoverageFrom": [
"src/index.js",
"!**/node_modules/**",
"!**/dist/**"
],
"preset": "rollup-jest",
"testEnvironment": "jest-environment-jsdom-fourteen"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc