@lrnwebcomponents/simple-toast
Advanced tools
Comparing version 2.0.9 to 2.0.10
@@ -19,3 +19,3 @@ { | ||
}, | ||
"version": "2.0.9", | ||
"version": "2.0.10", | ||
"description": "A singular toast / message for conistency", | ||
@@ -46,10 +46,10 @@ "repository": { | ||
"@polymer/paper-toast": "^3.0.1", | ||
"@polymer/polymer": "^3.0.5" | ||
"@polymer/polymer": "^3.2.0" | ||
}, | ||
"devDependencies": { | ||
"@lrnwebcomponents/deduping-fix": "^2.0.9", | ||
"@lrnwebcomponents/storybook-utilities": "^2.0.9", | ||
"@lrnwebcomponents/storybook-utilities": "^2.0.10", | ||
"@polymer/iron-component-page": "github:PolymerElements/iron-component-page", | ||
"@polymer/iron-demo-helpers": "3.0.2", | ||
"@webcomponents/webcomponentsjs": "2.2.4", | ||
"@polymer/iron-demo-helpers": "^3.1.0", | ||
"@webcomponents/webcomponentsjs": "^2.2.9", | ||
"concurrently": "4.1.0", | ||
@@ -59,4 +59,3 @@ "gulp-babel": "8.0.0", | ||
"lodash": "4.17.11", | ||
"polymer-build": "3.1.1", | ||
"polymer-cli": "1.9.5", | ||
"polymer-cli": "1.9.8", | ||
"wct-browser-legacy": "1.0.2", | ||
@@ -73,3 +72,3 @@ "web-animations-js": "2.3.1" | ||
], | ||
"gitHead": "3ba5daaa4388a0e09b103784f482d49b14fb52d5" | ||
"gitHead": "8571f08ce381877be732c2b5407233bcc3c58d99" | ||
} |
@@ -1,1 +0,44 @@ | ||
define(["exports","./node_modules/@polymer/polymer/polymer-element.js","./node_modules/@polymer/paper-toast/paper-toast.js","./node_modules/@polymer/paper-button/paper-button.js","./node_modules/@polymer/polymer/lib/legacy/polymer.dom.js","./node_modules/@polymer/polymer/lib/utils/async.js"],function(_exports,_polymerElement,_paperToast,_paperButton,_polymerDom,async){"use strict";Object.defineProperty(_exports,"__esModule",{value:!0});_exports.SimpleToast=void 0;async=babelHelpers.interopRequireWildcard(async);function _templateObject_9d7a23c0459211e99826211239af48d6(){var data=babelHelpers.taggedTemplateLiteral(["\n<style>:host {\n display: block;\n}\n\n:host([hidden]) {\n display: none;\n}\n</style>\n<paper-toast id=\"toast\" text=\"[[text]]\" duration$=\"[[duration]]\" opened=\"{{opened}}\" class$=\"[[classStyle]]\">\n <slot></slot>\n <paper-button hidden$=\"[[!closeButton]]\" on-tap=\"hide\">[[closeText]]</paper-button>\n</paper-toast>"]);_templateObject_9d7a23c0459211e99826211239af48d6=function _templateObject_9d7a23c0459211e99826211239af48d6(){return data};return data}window.SimpleToast=window.SimpleToast||{};window.SimpleToast.requestAvailability=function(){if(!window.SimpleToast.instance){window.SimpleToast.instance=document.createElement("simple-toast");document.body.appendChild(window.SimpleToast.instance)}return window.SimpleToast.instance};var SimpleToast=function(_PolymerElement){babelHelpers.inherits(SimpleToast,_PolymerElement);function SimpleToast(){babelHelpers.classCallCheck(this,SimpleToast);return babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(SimpleToast).apply(this,arguments))}babelHelpers.createClass(SimpleToast,[{key:"connectedCallback",value:function connectedCallback(){babelHelpers.get(babelHelpers.getPrototypeOf(SimpleToast.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 disconnectedCallback(){babelHelpers.get(babelHelpers.getPrototypeOf(SimpleToast.prototype),"connectedCallback",this).call(this);window.removeEventListener("simple-toast-hide",this.hideSimpleToast.bind(this));window.removeEventListener("simple-toast-show",this.showSimpleToast.bind(this))}},{key:"hideSimpleToast",value:function hideSimpleToast(e){this.hide()}},{key:"showSimpleToast",value:function showSimpleToast(e){var _this=this;if(e.detail.duration){this.duration=e.detail.duration}if(e.detail.text){this.text=e.detail.text}if(e.detail.classStyle){this.classStyle=e.detail.classStyle}if(e.detail.closeText){this.closeText=e.detail.closeText}if(e.detail.closeButton){this.closeButton=e.detail.closeButton}if(e.detail.eventCallback){this.eventCallback=e.detail.eventCallback}while(null!==(0,_polymerDom.dom)(this).firstChild){(0,_polymerDom.dom)(this).removeChild((0,_polymerDom.dom)(this).firstChild)}if(e.detail.slot){(0,_polymerDom.dom)(this).appendChild(e.detail.slot)}async.microTask.run(function(){setTimeout(function(){_this.show()},50)})}},{key:"show",value:function show(){this.$.toast.show()}},{key:"hide",value:function hide(){if(this.eventCallback){var evt=new CustomEvent(this.eventCallback,{bubbles:!0,cancelable:!0,detail:!0});this.dispatchEvent(evt)}this.$.toast.hide()}}],[{key:"template",get:function get(){return(0,_polymerElement.html)(_templateObject_9d7a23c0459211e99826211239af48d6())}},{key:"properties",get:function get(){return{opened:{name:"opened",type:"Boolean",value:!1,reflectToAttribute:!0},text:{name:"text",type:"String",value:"Saved"},classStyle:{name:"classStyle",type:"String",value:""},closeText:{name:"closeText",type:"String",value:"Close"},duration:{name:"duration",type:"Number",value:4e3},eventCallback:{name:"eventCallback",type:"String"},closeButton:{name:"closeButton",type:"Boolean",value:!0,reflectToAttribute:!0}}}},{key:"tag",get:function get(){return"simple-toast"}}]);return SimpleToast}(_polymerElement.PolymerElement);_exports.SimpleToast=SimpleToast;window.customElements.define(SimpleToast.tag,SimpleToast)}); | ||
define(["exports","./node_modules/@polymer/polymer/polymer-element.js","./node_modules/@polymer/paper-toast/paper-toast.js","./node_modules/@polymer/paper-button/paper-button.js","./node_modules/@polymer/polymer/lib/legacy/polymer.dom.js","./node_modules/@polymer/polymer/lib/utils/async.js"],function(_exports,_polymerElement,_paperToast,_paperButton,_polymerDom,async){"use strict";Object.defineProperty(_exports,"__esModule",{value:!0});_exports.SimpleToast=void 0;async=babelHelpers.interopRequireWildcard(async);function _templateObject_63b866406a8311e9bcea9bed8df7d7d7(){var data=babelHelpers.taggedTemplateLiteral(["\n<style>:host {\n display: block;\n}\n\n:host([hidden]) {\n display: none;\n}\n</style>\n<paper-toast id=\"toast\" text=\"[[text]]\" duration$=\"[[duration]]\" opened=\"{{opened}}\" class$=\"[[classStyle]]\">\n <slot></slot>\n <paper-button hidden$=\"[[!closeButton]]\" on-tap=\"hide\">[[closeText]]</paper-button>\n</paper-toast>"]);_templateObject_63b866406a8311e9bcea9bed8df7d7d7=function _templateObject_63b866406a8311e9bcea9bed8df7d7d7(){return data};return data}// register globally so we can make sure there is only one | ||
window.SimpleToast=window.SimpleToast||{};// request if this exists. This helps invoke the element existing in the dom | ||
// as well as that there is only one of them. That way we can ensure everything | ||
// is rendered through the same simple-toast element, making it a singleton. | ||
window.SimpleToast.requestAvailability=function(){// if there is no single instance, generate one and append it to end of the document | ||
if(!window.SimpleToast.instance){window.SimpleToast.instance=document.createElement("simple-toast");document.body.appendChild(window.SimpleToast.instance)}return window.SimpleToast.instance};/** | ||
* `simple-toast` | ||
* `A singular toast / message for conistency` | ||
* | ||
* @microcopy - language worth noting: | ||
* - | ||
* | ||
* @customElement | ||
* @polymer | ||
* @demo demo/index.html | ||
*/var SimpleToast=/*#__PURE__*/function(_PolymerElement){babelHelpers.inherits(SimpleToast,_PolymerElement);function SimpleToast(){babelHelpers.classCallCheck(this,SimpleToast);return babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(SimpleToast).apply(this,arguments))}babelHelpers.createClass(SimpleToast,[{key:"connectedCallback",/** | ||
* life cycle, element is afixed to the DOM | ||
*/value:function connectedCallback(){babelHelpers.get(babelHelpers.getPrototypeOf(SimpleToast.prototype),"connectedCallback",this).call(this);window.addEventListener("simple-toast-hide",this.hideSimpleToast.bind(this));window.addEventListener("simple-toast-show",this.showSimpleToast.bind(this))}/** | ||
* life cycle, element is removed from the DOM | ||
*/},{key:"disconnectedCallback",value:function disconnectedCallback(){babelHelpers.get(babelHelpers.getPrototypeOf(SimpleToast.prototype),"connectedCallback",this).call(this);window.removeEventListener("simple-toast-hide",this.hideSimpleToast.bind(this));window.removeEventListener("simple-toast-show",this.showSimpleToast.bind(this))}/** | ||
* Hide callback | ||
*/},{key:"hideSimpleToast",value:function hideSimpleToast(e){this.hide()}/** | ||
* Show / available callback | ||
*/},{key:"showSimpleToast",value:function showSimpleToast(e){var _this=this;// add your code to run when the singleton is called for | ||
if(e.detail.duration){this.duration=e.detail.duration}if(e.detail.text){this.text=e.detail.text}if(e.detail.classStyle){this.classStyle=e.detail.classStyle}if(e.detail.closeText){this.closeText=e.detail.closeText}if(e.detail.closeButton){this.closeButton=e.detail.closeButton}if(e.detail.eventCallback){this.eventCallback=e.detail.eventCallback}while(null!==(0,_polymerDom.dom)(this).firstChild){(0,_polymerDom.dom)(this).removeChild((0,_polymerDom.dom)(this).firstChild)}if(e.detail.slot){(0,_polymerDom.dom)(this).appendChild(e.detail.slot)}async.microTask.run(function(){setTimeout(function(){_this.show()},50)})}},{key:"show",value:function show(){this.$.toast.show()}},{key:"hide",value:function hide(){if(this.eventCallback){var evt=new CustomEvent(this.eventCallback,{bubbles:!0,cancelable:!0,detail:!0});this.dispatchEvent(evt)}this.$.toast.hide()}}],[{key:"template",// render function | ||
get:function get(){return(0,_polymerElement.html)(_templateObject_63b866406a8311e9bcea9bed8df7d7d7())}// properties available to the custom element for data binding | ||
},{key:"properties",get:function get(){return{/** | ||
* Opened state of the toast, use event to change | ||
*/opened:{name:"opened",type:"Boolean",value:!1,reflectToAttribute:!0},/** | ||
* Plain text based message to display | ||
*/text:{name:"text",type:"String",value:"Saved"},/** | ||
* Class name, fit-bottom being a useful one | ||
*/classStyle:{name:"classStyle",type:"String",value:""},/** | ||
* Text for the close button | ||
*/closeText:{name:"closeText",type:"String",value:"Close"},/** | ||
* How long the toast message should be displayed | ||
*/duration:{name:"duration",type:"Number",value:4e3},/** | ||
* Event callback when hide is called | ||
*/eventCallback:{name:"eventCallback",type:"String"},/** | ||
* If there should be a close button shown | ||
*/closeButton:{name:"closeButton",type:"Boolean",value:!0,reflectToAttribute:!0}}}/** | ||
* Store the tag name to make it easier to obtain directly. | ||
* @notice function name must be here for tooling to operate correctly | ||
*/},{key:"tag",get:function get(){return"simple-toast"}}]);return SimpleToast}(_polymerElement.PolymerElement);_exports.SimpleToast=SimpleToast;window.customElements.define(SimpleToast.tag,SimpleToast)}); |
@@ -1,2 +0,21 @@ | ||
import{html,PolymerElement}from"./node_modules/@polymer/polymer/polymer-element.js";import"./node_modules/@polymer/paper-toast/paper-toast.js";import"./node_modules/@polymer/paper-button/paper-button.js";import{dom}from"./node_modules/@polymer/polymer/lib/legacy/polymer.dom.js";import*as async from"./node_modules/@polymer/polymer/lib/utils/async.js";window.SimpleToast=window.SimpleToast||{};window.SimpleToast.requestAvailability=()=>{if(!window.SimpleToast.instance){window.SimpleToast.instance=document.createElement("simple-toast");document.body.appendChild(window.SimpleToast.instance)}return window.SimpleToast.instance};class SimpleToast extends PolymerElement{static get template(){return html` | ||
/** | ||
* Copyright 2018 The Pennsylvania State University | ||
* @license Apache-2.0, see License.md for full text. | ||
*/import{html,PolymerElement}from"./node_modules/@polymer/polymer/polymer-element.js";import"./node_modules/@polymer/paper-toast/paper-toast.js";import"./node_modules/@polymer/paper-button/paper-button.js";import{dom}from"./node_modules/@polymer/polymer/lib/legacy/polymer.dom.js";import*as async from"./node_modules/@polymer/polymer/lib/utils/async.js";// register globally so we can make sure there is only one | ||
window.SimpleToast=window.SimpleToast||{};// request if this exists. This helps invoke the element existing in the dom | ||
// as well as that there is only one of them. That way we can ensure everything | ||
// is rendered through the same simple-toast element, making it a singleton. | ||
window.SimpleToast.requestAvailability=()=>{// if there is no single instance, generate one and append it to end of the document | ||
if(!window.SimpleToast.instance){window.SimpleToast.instance=document.createElement("simple-toast");document.body.appendChild(window.SimpleToast.instance)}return window.SimpleToast.instance};/** | ||
* `simple-toast` | ||
* `A singular toast / message for conistency` | ||
* | ||
* @microcopy - language worth noting: | ||
* - | ||
* | ||
* @customElement | ||
* @polymer | ||
* @demo demo/index.html | ||
*/class SimpleToast extends PolymerElement{// render function | ||
static get template(){return html` | ||
<style>:host { | ||
@@ -13,2 +32,29 @@ display: block; | ||
<paper-button hidden$="[[!closeButton]]" on-tap="hide">[[closeText]]</paper-button> | ||
</paper-toast>`}static get properties(){return{opened:{name:"opened",type:"Boolean",value:!1,reflectToAttribute:!0},text:{name:"text",type:"String",value:"Saved"},classStyle:{name:"classStyle",type:"String",value:""},closeText:{name:"closeText",type:"String",value:"Close"},duration:{name:"duration",type:"Number",value:4e3},eventCallback:{name:"eventCallback",type:"String"},closeButton:{name:"closeButton",type:"Boolean",value:!0,reflectToAttribute:!0}}}static get tag(){return"simple-toast"}connectedCallback(){super.connectedCallback();window.addEventListener("simple-toast-hide",this.hideSimpleToast.bind(this));window.addEventListener("simple-toast-show",this.showSimpleToast.bind(this))}disconnectedCallback(){super.connectedCallback();window.removeEventListener("simple-toast-hide",this.hideSimpleToast.bind(this));window.removeEventListener("simple-toast-show",this.showSimpleToast.bind(this))}hideSimpleToast(e){this.hide()}showSimpleToast(e){if(e.detail.duration){this.duration=e.detail.duration}if(e.detail.text){this.text=e.detail.text}if(e.detail.classStyle){this.classStyle=e.detail.classStyle}if(e.detail.closeText){this.closeText=e.detail.closeText}if(e.detail.closeButton){this.closeButton=e.detail.closeButton}if(e.detail.eventCallback){this.eventCallback=e.detail.eventCallback}while(null!==dom(this).firstChild){dom(this).removeChild(dom(this).firstChild)}if(e.detail.slot){dom(this).appendChild(e.detail.slot)}async.microTask.run(()=>{setTimeout(()=>{this.show()},50)})}show(){this.$.toast.show()}hide(){if(this.eventCallback){const evt=new CustomEvent(this.eventCallback,{bubbles:!0,cancelable:!0,detail:!0});this.dispatchEvent(evt)}this.$.toast.hide()}}window.customElements.define(SimpleToast.tag,SimpleToast);export{SimpleToast}; | ||
</paper-toast>`}// properties available to the custom element for data binding | ||
static get properties(){return{/** | ||
* Opened state of the toast, use event to change | ||
*/opened:{name:"opened",type:"Boolean",value:!1,reflectToAttribute:!0},/** | ||
* Plain text based message to display | ||
*/text:{name:"text",type:"String",value:"Saved"},/** | ||
* Class name, fit-bottom being a useful one | ||
*/classStyle:{name:"classStyle",type:"String",value:""},/** | ||
* Text for the close button | ||
*/closeText:{name:"closeText",type:"String",value:"Close"},/** | ||
* How long the toast message should be displayed | ||
*/duration:{name:"duration",type:"Number",value:4e3},/** | ||
* Event callback when hide is called | ||
*/eventCallback:{name:"eventCallback",type:"String"},/** | ||
* If there should be a close button shown | ||
*/closeButton:{name:"closeButton",type:"Boolean",value:!0,reflectToAttribute:!0}}}/** | ||
* Store the tag name to make it easier to obtain directly. | ||
* @notice function name must be here for tooling to operate correctly | ||
*/static get tag(){return"simple-toast"}/** | ||
* life cycle, element is afixed to the DOM | ||
*/connectedCallback(){super.connectedCallback();window.addEventListener("simple-toast-hide",this.hideSimpleToast.bind(this));window.addEventListener("simple-toast-show",this.showSimpleToast.bind(this))}/** | ||
* life cycle, element is removed from the DOM | ||
*/disconnectedCallback(){super.connectedCallback();window.removeEventListener("simple-toast-hide",this.hideSimpleToast.bind(this));window.removeEventListener("simple-toast-show",this.showSimpleToast.bind(this))}/** | ||
* Hide callback | ||
*/hideSimpleToast(e){this.hide()}/** | ||
* Show / available callback | ||
*/showSimpleToast(e){// add your code to run when the singleton is called for | ||
if(e.detail.duration){this.duration=e.detail.duration}if(e.detail.text){this.text=e.detail.text}if(e.detail.classStyle){this.classStyle=e.detail.classStyle}if(e.detail.closeText){this.closeText=e.detail.closeText}if(e.detail.closeButton){this.closeButton=e.detail.closeButton}if(e.detail.eventCallback){this.eventCallback=e.detail.eventCallback}while(null!==dom(this).firstChild){dom(this).removeChild(dom(this).firstChild)}if(e.detail.slot){dom(this).appendChild(e.detail.slot)}async.microTask.run(()=>{setTimeout(()=>{this.show()},50)})}show(){this.$.toast.show()}hide(){if(this.eventCallback){const evt=new CustomEvent(this.eventCallback,{bubbles:!0,cancelable:!0,detail:!0});this.dispatchEvent(evt)}this.$.toast.hide()}}window.customElements.define(SimpleToast.tag,SimpleToast);export{SimpleToast}; |
@@ -7,7 +7,7 @@ import { SimpleToast } from "./simple-toast.js"; | ||
/** | ||
* add to the pattern library | ||
* add to the pattern library | ||
*/ | ||
/*const Pattern = { | ||
"of": "Pattern Library/Molecules/Layout", //Patter library path | ||
"name": "Collapse" //Pattern name | ||
"of": "Pattern Library/Molecules/Layout", //Pattern library path | ||
"name": "Collapse", //Pattern name | ||
"file": require("raw-loader!./demo/index.html"), | ||
@@ -22,4 +22,4 @@ "replacements": [] | ||
/*const Story = { | ||
"of": "a11y-collpase", //component folder | ||
"name": "a11y-collpase", //component tag | ||
"of": "Web Components", //component folder | ||
"name": "a11y-collapse", //component tag | ||
"props": A11yCollapse.properties, //component properties that will become knobs | ||
@@ -37,2 +37,2 @@ "slots": { //slots that will become knobs | ||
} | ||
window.StorybookUtilities.instance.addLiveDemo(Story);*/ | ||
window.StorybookUtilities.instance.addLiveDemo(Story);*/ |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
205416
12
4984
3
Updated@polymer/polymer@^3.2.0