New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@lrnwebcomponents/simple-toast

Package Overview
Dependencies
Maintainers
4
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lrnwebcomponents/simple-toast - npm Package Compare versions

Comparing version 3.0.6 to 4.0.0

rollup.config.mjs

2

lib/simple-toast-el.js

@@ -1,2 +0,2 @@

import { html, css } from "lit-element";
import { html, css } from "lit";
import { SimpleColors } from "@lrnwebcomponents/simple-colors/simple-colors.js";

@@ -3,0 +3,0 @@

@@ -22,3 +22,3 @@ {

},
"version": "3.0.6",
"version": "4.0.0",
"description": "A singular toast / message for conistency",

@@ -34,9 +34,11 @@ "repository": {

"scripts": {
"test": "wct --configFile ../../wct.conf.json node_modules/@lrnwebcomponents/simple-toast/test/",
"start": "yarn run dev",
"build": "gulp --gulpfile=gulpfile.cjs && rollup -c && prettier --ignore-path ../../.prettierignore --write \"**/*.{js,json}\" && wca analyze \"**/*.js\" --format vscode --outFile vscode-html-custom-data.json",
"build": "gulp --gulpfile=gulpfile.cjs && node --experimental-json-modules ../../node_modules/.bin/rollup --config && prettier --ignore-path ../../.prettierignore --write \"**/*.{js,json}\" && wca analyze \"**/*.js\" --format vscode --outFile vscode-html-custom-data.json",
"dev": "concurrently --kill-others \"yarn run watch\" \"yarn run serve\"",
"watch": "gulp dev --gulpfile=gulpfile.cjs",
"serve": "es-dev-server -c ../../es-dev-server.config.js",
"lighthouse": "gulp lighthouse --gulpfile=gulpfile.cjs"
"lighthouse": "gulp lighthouse --gulpfile=gulpfile.cjs",
"test": "web-test-runner \"test/**/*.test.js\" --node-resolve --config=../../web-test-runner.config.mjs",
"test:watch": "web-test-runner \"test/**/*.test.js\" --node-resolve --config=../../web-test-runner.config.mjs --watch",
"test:browsers": "web-test-runner \"test/**/*.test.js\" --node-resolve --config=../../web-test-runner.config.mjs --playwright --browsers chromium firefox webkit"
},

@@ -48,14 +50,19 @@ "author": {

"dependencies": {
"@lrnwebcomponents/simple-colors": "^3.0.6",
"lit-element": "2.4.0"
"@lrnwebcomponents/simple-colors": "^4.0.0",
"lit": "2.0.0-rc.2"
},
"devDependencies": {
"@lrnwebcomponents/deduping-fix": "^3.0.0",
"@lrnwebcomponents/storybook-utilities": "^3.0.6",
"@lrnwebcomponents/deduping-fix": "^4.0.0",
"@lrnwebcomponents/storybook-utilities": "^4.0.0",
"@open-wc/testing": "2.5.33",
"@polymer/iron-component-page": "github:PolymerElements/iron-component-page",
"@polymer/iron-demo-helpers": "3.1.0",
"@web/test-runner": "0.13.5",
"@web/test-runner-commands": "0.4.5",
"@web/test-runner-playwright": "0.8.6",
"@web/test-runner-puppeteer": "0.10.0",
"@webcomponents/webcomponentsjs": "2.5.0",
"concurrently": "5.3.0",
"gulp-babel": "8.0.0",
"lodash": "4.17.19",
"lodash": "^4.17.21",
"polymer-cli": "1.9.11",

@@ -73,3 +80,3 @@ "wct-browser-legacy": "1.0.2",

],
"gitHead": "ce5d24bc5829a7d5ea73218759db007619359682"
"gitHead": "e877f54ece91fb0b2f7aba62f9f9fd15060600f2"
}

@@ -5,3 +5,3 @@ /**

*/
import { html, css } from "lit-element/lit-element.js";
import { html, css } from "lit";
import { SimpleColors } from "@lrnwebcomponents/simple-colors/simple-colors.js";

@@ -8,0 +8,0 @@ import "./lib/simple-toast-el.js";

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("lit-element/lit-element.js"),require("@lrnwebcomponents/simple-colors/simple-colors.js"),require("lit-element")):"function"==typeof define&&define.amd?define(["exports","lit-element/lit-element.js","@lrnwebcomponents/simple-colors/simple-colors.js","lit-element"],e):e((t=t||self).SimpleToast={},t.litElement_js,t.simpleColors_js,t.litElement)}(this,function(t,e,n,o){"use strict";function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function s(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),t}function a(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function l(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,o)}return n}function c(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?l(Object(n),!0).forEach(function(e){a(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):l(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function u(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&d(t,e)}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function d(t,e){return(d=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function h(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(t){return!1}}();return function(){var n,o=p(t);if(e){var i=p(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return f(this,n)}}function m(t,e,n){return(m="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var o=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=p(t)););return t}(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function y(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}function b(t){return function(t){if(Array.isArray(t))return v(t)}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return v(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return v(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function v(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}function w(){var t=y(["<span><span>","</span><slot></slot></span>"]);return w=function(){return t},t}function g(){var t=y(["\n :host {\n display: none;\n justify-content: center;\n position: fixed;\n min-width: 100px;\n text-align: center;\n color: var(--simple-colors-default-theme-accent-1, white);\n background-color: var(--simple-colors-default-theme-accent-12, black);\n border-radius: var(--simple-toast-border-radius, 2px);\n border: var(--simple-toast-border, none);\n font-size: var(--simple-toast-font-size, 1em);\n font-family: var(--simple-toast-font-family, sans-serif);\n }\n :host(.show) {\n display: flex;\n }\n @-webkit-keyframes fadein {\n from {\n bottom: 0;\n opacity: 0;\n }\n to {\n bottom: var(--simple-toast-bottom, 40px);\n opacity: 1;\n }\n }\n @keyframes fadein {\n from {\n bottom: 0;\n opacity: 0;\n }\n to {\n bottom: var(--simple-toast-bottom, 40px);\n opacity: 1;\n }\n }\n @-webkit-keyframes fadeout {\n from {\n bottom: var(--simple-toast-bottom, 40px);\n opacity: 1;\n }\n to {\n bottom: 0;\n opacity: 0;\n }\n }\n @keyframes fadeout {\n from {\n bottom: var(--simple-toast-bottom, 40px);\n opacity: 1;\n }\n to {\n bottom: 0;\n opacity: 0;\n }\n }\n "]);return g=function(){return t},t}var k=function(t){u(r,n.SimpleColors);var e=h(r);function r(){var t;return i(this,r),(t=e.call(this)).text="",t.duration=3e3,t.opened=!1,t.addEventListener("animationend",function(e){"fadeout"==e.animationName&&(t.opened=!1)}),t}return s(r,null,[{key:"tag",get:function(){return"simple-toast-el"}},{key:"styles",get:function(){return[].concat(b(m(p(r),"styles",this)),[o.css(g())])}},{key:"properties",get:function(){return c(c({},m(p(r),"properties",this)),{},{text:{type:String},duration:{type:Number},opened:{type:Boolean}})}}]),s(r,[{key:"updated",value:function(t){var e=this;m(p(r.prototype),"updated",this).call(this,t),t.forEach(function(t,n){"opened"===n&&(e.dispatchEvent(new CustomEvent("opened-changed",{detail:{value:e[n]}})),e[n]?e.show(e.text):e.hide()),"duration"===n&&e[n]&&(e.style.animation="fadein 0.2s, fadeout 0.2s "+e[n]/1e3+"s")})}},{key:"render",value:function(){return o.html(w(),this.text)}},{key:"firstUpdated",value:function(t){m(p(r.prototype),"updated",this).call(this,t),this.style.setProperty("aria-live","assertive"),this.style.setProperty("role","alert"),this.style.setProperty("aria-atomic","true"),this.style.setProperty("aria-relevant","all")}},{key:"hide",value:function(){this.classList.remove("show")}},{key:"show",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.text=t,this.classList.add("show")}}]),r}();function x(){var t=y(["\n:host {\n display: block;\n}\n\n:host([hidden]) {\n display: none;\n}\n\nsimple-toast-el {\n box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);\n width: var(--simple-toast-width, auto);\n color: var(--simple-toast-color, var(--simple-colors-default-theme-accent-1, white));\n background-color: var(--simple-toast-bg, var(--simple-colors-default-theme-accent-12, black));\n top: var(--simple-toast-top);\n margin: var(--simple-toast-margin, 8px);\n padding: var(--simple-toast-padding, 16px);\n left: var(--simple-toast-left, 36px);\n bottom: var(--simple-toast-bottom, 36px);\n right: var(--simple-toast-right);\n border: var(--simple-toast-border);\n z-index: var(--simple-toast-z-index, 1000);\n font-size: var(--simple-toast-font-size);\n}\n\nbutton {\n margin-left: 8px;\n}\n "]);return x=function(){return t},t}function S(){var t=y(['\n\n<simple-toast-el\nid="toast"\naccent-color="','"\n?dark="','"\ntext="','"\nduration="','"\n?opened="','"\n@opened-changed="','"\n.class="','">\n <slot></slot>\n <button .hidden="','" @click="','">',"</button>\n</simple-toast-el>"]);return S=function(){return t},t}customElements.define(k.tag,k),window.SimpleToast=window.SimpleToast||{},window.SimpleToast.requestAvailability=function(){return window.SimpleToast.instance||(window.SimpleToast.instance=document.createElement("simple-toast"),document.body.appendChild(window.SimpleToast.instance)),window.SimpleToast.instance};var O=window.SimpleToast.requestAvailability(),j=function(t){u(r,n.SimpleColors);var o=h(r);function r(){var t;return i(this,r),(t=o.call(this)).setDefaultToast(),t}return s(r,[{key:"render",value:function(){return e.html(S(),this.accentColor,this.dark,this.text,this.duration,this.opened,this.openedChanged,this.classStyle,!this.closeButton,this.hide,this.closeText)}}],[{key:"styles",get:function(){return[].concat(b(m(p(r),"styles",this)),[e.css(x())])}},{key:"properties",get:function(){return c(c({},m(p(r),"properties",this)),{},{opened:{type:Boolean,reflect:!0},text:{type:String},classStyle:{type:String,attribute:"class-style"},closeText:{type:String,attribute:"close-text"},duration:{type:Number},eventCallback:{type:String,attribute:"event-callback"},closeButton:{type:Boolean,reflect:!0,attribute:"close-button"}})}},{key:"tag",get:function(){return"simple-toast"}}]),s(r,[{key:"connectedCallback",value:function(){m(p(r.prototype),"connectedCallback",this).call(this),window.addEventListener("simple-toast-hide",this.hideSimpleToast.bind(this)),window.addEventListener("simple-toast-show",this.showSimpleToast.bind(this))}},{key:"disconnectedCallback",value:function(){window.removeEventListener("simple-toast-hide",this.hideSimpleToast.bind(this)),window.removeEventListener("simple-toast-show",this.showSimpleToast.bind(this)),m(p(r.prototype),"disconnectedCallback",this).call(this)}},{key:"hideSimpleToast",value:function(t){this.hide()}},{key:"openedChanged",value:function(t){this.opened=t.detail.value}},{key:"setDefaultToast",value:function(){for(this.opened=!1,this.text="Saved",this.classStyle="",this.closeText="Close",this.duration=3e3,this.accentColor="grey",this.dark=!1,this.eventCallback=null,this.closeButton=!0;null!==this.firstChild;)this.removeChild(this.firstChild)}},{key:"showSimpleToast",value:function(t){this.setDefaultToast(),t.detail.duration&&(this.duration=t.detail.duration),t.detail.text&&(this.text=t.detail.text),t.detail.classStyle&&(this.classStyle=t.detail.classStyle),t.detail.closeText&&(this.closeText=t.detail.closeText),t.detail.closeButton&&(this.closeButton=t.detail.closeButton),t.detail.eventCallback&&(this.eventCallback=t.detail.eventCallback),t.detail.slot&&this.appendChild(t.detail.slot),t.detail.accentColor&&(this.accentColor=t.detail.accentColor),t.detail.dark&&(this.dark=t.detail.dark),this.show()}},{key:"show",value:function(t){this.opened=!0}},{key:"hide",value:function(t){if(this.eventCallback){var e=new CustomEvent(this.eventCallback,{bubbles:!0,cancelable:!0,detail:!0,composed:!0});this.dispatchEvent(e)}this.opened=!1}}]),r}();window.customElements.define(j.tag,j),t.SimpleToast=j,t.SimpleToastStore=O,Object.defineProperty(t,"__esModule",{value:!0})});
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("lit"),require("@lrnwebcomponents/simple-colors/simple-colors.js")):"function"==typeof define&&define.amd?define(["exports","lit","@lrnwebcomponents/simple-colors/simple-colors.js"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).SimpleToast={},t.lit,t.simpleColors_js)}(this,(function(t,e,n){"use strict";function o(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function i(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?o(Object(n),!0).forEach((function(e){l(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function s(t,e){for(var n=0;n<e.length;n++){var o=e[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function a(t,e,n){return e&&s(t.prototype,e),n&&s(t,n),t}function l(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function c(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&p(t,e)}function u(t){return(u=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function p(t,e){return(p=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function d(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function f(t){var e=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var n,o=u(t);if(e){var i=u(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return d(this,n)}}function h(t,e,n){return(h="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var o=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=u(t)););return t}(t,e);if(o){var i=Object.getOwnPropertyDescriptor(o,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function m(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}function y(t){return function(t){if(Array.isArray(t))return b(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return b(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return b(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}var v,w,g,k,x=function(t){c(o,t);var n=f(o);function o(){var t;return r(this,o),(t=n.call(this)).text="",t.duration=3e3,t.opened=!1,t.addEventListener("animationend",(function(e){"fadeout"==e.animationName&&(t.opened=!1)})),t}return a(o,[{key:"updated",value:function(t){var e=this;h(u(o.prototype),"updated",this).call(this,t),t.forEach((function(t,n){"opened"===n&&(e.dispatchEvent(new CustomEvent("opened-changed",{detail:{value:e[n]}})),e[n]?e.show(e.text):e.hide()),"duration"===n&&e[n]&&(e.style.animation="fadein 0.2s, fadeout 0.2s "+e[n]/1e3+"s")}))}},{key:"render",value:function(){return e.html(v||(v=m(["<span><span>","</span><slot></slot></span>"])),this.text)}},{key:"firstUpdated",value:function(t){h(u(o.prototype),"updated",this).call(this,t),this.style.setProperty("aria-live","assertive"),this.style.setProperty("role","alert"),this.style.setProperty("aria-atomic","true"),this.style.setProperty("aria-relevant","all")}},{key:"hide",value:function(){this.classList.remove("show")}},{key:"show",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.text=t,this.classList.add("show")}}],[{key:"tag",get:function(){return"simple-toast-el"}},{key:"styles",get:function(){return[].concat(y(h(u(o),"styles",this)),[e.css(w||(w=m(["\n :host {\n display: none;\n justify-content: center;\n position: fixed;\n min-width: 100px;\n text-align: center;\n color: var(--simple-colors-default-theme-accent-1, white);\n background-color: var(--simple-colors-default-theme-accent-12, black);\n border-radius: var(--simple-toast-border-radius, 2px);\n border: var(--simple-toast-border, none);\n font-size: var(--simple-toast-font-size, 1em);\n font-family: var(--simple-toast-font-family, sans-serif);\n }\n :host(.show) {\n display: flex;\n }\n @-webkit-keyframes fadein {\n from {\n bottom: 0;\n opacity: 0;\n }\n to {\n bottom: var(--simple-toast-bottom, 40px);\n opacity: 1;\n }\n }\n @keyframes fadein {\n from {\n bottom: 0;\n opacity: 0;\n }\n to {\n bottom: var(--simple-toast-bottom, 40px);\n opacity: 1;\n }\n }\n @-webkit-keyframes fadeout {\n from {\n bottom: var(--simple-toast-bottom, 40px);\n opacity: 1;\n }\n to {\n bottom: 0;\n opacity: 0;\n }\n }\n @keyframes fadeout {\n from {\n bottom: var(--simple-toast-bottom, 40px);\n opacity: 1;\n }\n to {\n bottom: 0;\n opacity: 0;\n }\n }\n "])))])}},{key:"properties",get:function(){return i(i({},h(u(o),"properties",this)),{},{text:{type:String},duration:{type:Number},opened:{type:Boolean}})}}]),o}(n.SimpleColors);customElements.define(x.tag,x),window.SimpleToast=window.SimpleToast||{},window.SimpleToast.requestAvailability=function(){return window.SimpleToast.instance||(window.SimpleToast.instance=document.createElement("simple-toast"),document.body.appendChild(window.SimpleToast.instance)),window.SimpleToast.instance};var S=window.SimpleToast.requestAvailability(),O=function(t){c(o,t);var n=f(o);function o(){var t;return r(this,o),(t=n.call(this)).setDefaultToast(),t}return a(o,[{key:"render",value:function(){return e.html(g||(g=m(['\n\n<simple-toast-el\nid="toast"\naccent-color="','"\n?dark="','"\ntext="','"\nduration="','"\n?opened="','"\n@opened-changed="','"\n.class="','">\n <slot></slot>\n <button .hidden="','" @click="','">',"</button>\n</simple-toast-el>"])),this.accentColor,this.dark,this.text,this.duration,this.opened,this.openedChanged,this.classStyle,!this.closeButton,this.hide,this.closeText)}},{key:"connectedCallback",value:function(){h(u(o.prototype),"connectedCallback",this).call(this),window.addEventListener("simple-toast-hide",this.hideSimpleToast.bind(this)),window.addEventListener("simple-toast-show",this.showSimpleToast.bind(this))}},{key:"disconnectedCallback",value:function(){window.removeEventListener("simple-toast-hide",this.hideSimpleToast.bind(this)),window.removeEventListener("simple-toast-show",this.showSimpleToast.bind(this)),h(u(o.prototype),"disconnectedCallback",this).call(this)}},{key:"hideSimpleToast",value:function(t){this.hide()}},{key:"openedChanged",value:function(t){this.opened=t.detail.value}},{key:"setDefaultToast",value:function(){for(this.opened=!1,this.text="Saved",this.classStyle="",this.closeText="Close",this.duration=3e3,this.accentColor="grey",this.dark=!1,this.eventCallback=null,this.closeButton=!0;null!==this.firstChild;)this.removeChild(this.firstChild)}},{key:"showSimpleToast",value:function(t){this.setDefaultToast(),t.detail.duration&&(this.duration=t.detail.duration),t.detail.text&&(this.text=t.detail.text),t.detail.classStyle&&(this.classStyle=t.detail.classStyle),t.detail.closeText&&(this.closeText=t.detail.closeText),t.detail.closeButton&&(this.closeButton=t.detail.closeButton),t.detail.eventCallback&&(this.eventCallback=t.detail.eventCallback),t.detail.slot&&this.appendChild(t.detail.slot),t.detail.accentColor&&(this.accentColor=t.detail.accentColor),t.detail.dark&&(this.dark=t.detail.dark),this.show()}},{key:"show",value:function(t){this.opened=!0}},{key:"hide",value:function(t){if(this.eventCallback){var e=new CustomEvent(this.eventCallback,{bubbles:!0,cancelable:!0,detail:!0,composed:!0});this.dispatchEvent(e)}this.opened=!1}}],[{key:"styles",get:function(){return[].concat(y(h(u(o),"styles",this)),[e.css(k||(k=m(["\n:host {\n display: block;\n}\n\n:host([hidden]) {\n display: none;\n}\n\nsimple-toast-el {\n box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);\n width: var(--simple-toast-width, auto);\n color: var(--simple-toast-color, var(--simple-colors-default-theme-accent-1, white));\n background-color: var(--simple-toast-bg, var(--simple-colors-default-theme-accent-12, black));\n top: var(--simple-toast-top);\n margin: var(--simple-toast-margin, 8px);\n padding: var(--simple-toast-padding, 16px);\n left: var(--simple-toast-left, 36px);\n bottom: var(--simple-toast-bottom, 36px);\n right: var(--simple-toast-right);\n border: var(--simple-toast-border);\n z-index: var(--simple-toast-z-index, 1000);\n font-size: var(--simple-toast-font-size);\n}\n\nbutton {\n margin-left: 8px;\n}\n "])))])}},{key:"properties",get:function(){return i(i({},h(u(o),"properties",this)),{},{opened:{type:Boolean,reflect:!0},text:{type:String},classStyle:{type:String,attribute:"class-style"},closeText:{type:String,attribute:"close-text"},duration:{type:Number},eventCallback:{type:String,attribute:"event-callback"},closeButton:{type:Boolean,reflect:!0,attribute:"close-button"}})}},{key:"tag",get:function(){return"simple-toast"}}]),o}(n.SimpleColors);window.customElements.define(O.tag,O),t.SimpleToast=O,t.SimpleToastStore=S,Object.defineProperty(t,"__esModule",{value:!0})}));

@@ -5,3 +5,3 @@ /**

*/
import { html, css } from "lit-element/lit-element.js";
import { html, css } from "lit";
import { SimpleColors } from "@lrnwebcomponents/simple-colors/simple-colors.js";

@@ -8,0 +8,0 @@ import "./lib/simple-toast-el.js";

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