@lrnwebcomponents/simple-toast
Advanced tools
Comparing version 2.0.8 to 2.0.9
@@ -19,3 +19,3 @@ { | ||
}, | ||
"version": "2.0.8", | ||
"version": "2.0.9", | ||
"description": "A singular toast / message for conistency", | ||
@@ -49,4 +49,4 @@ "repository": { | ||
"devDependencies": { | ||
"@lrnwebcomponents/deduping-fix": "^2.0.8", | ||
"@lrnwebcomponents/storybook-utilities": "^2.0.8", | ||
"@lrnwebcomponents/deduping-fix": "^2.0.9", | ||
"@lrnwebcomponents/storybook-utilities": "^2.0.9", | ||
"@polymer/iron-component-page": "github:PolymerElements/iron-component-page", | ||
@@ -72,3 +72,3 @@ "@polymer/iron-demo-helpers": "3.0.2", | ||
], | ||
"gitHead": "e32dcb0831ec951b08cedb01a8f9b5c2e3bcfdaf" | ||
"gitHead": "3ba5daaa4388a0e09b103784f482d49b14fb52d5" | ||
} |
@@ -1,57 +0,35 @@ | ||
import { storiesOf } from "@storybook/polymer"; | ||
import * as storybookBridge from "@storybook/addon-knobs/polymer"; | ||
import { SimpleToast } from "./simple-toast.js"; | ||
import { StorybookUtilities } from "@lrnwebcomponents/storybook-utilities/storybook-utilities.js"; | ||
// need to account for polymer goofiness when webpack rolls this up | ||
var template = require("raw-loader!./demo/index.html"); | ||
let pattern = /<body[^>]*>((.|[\n\r])*)<\/body>/im; | ||
var array_matches = pattern.exec(template); | ||
// now template is just the body contents | ||
template = array_matches[1]; | ||
const stories = storiesOf("Toast", module); | ||
stories.addDecorator(storybookBridge.withKnobs); | ||
stories.add("simple-toast", () => { | ||
var binding = {}; | ||
// start of tag for demo | ||
let elementDemo = `<simple-toast`; | ||
// mix in properties defined on the class | ||
for (var key in SimpleToast.properties) { | ||
// skip prototype | ||
if (!SimpleToast.properties.hasOwnProperty(key)) continue; | ||
// convert typed props | ||
if (SimpleToast.properties[key].type.name) { | ||
let method = "text"; | ||
switch (SimpleToast.properties[key].type.name) { | ||
case "Boolean": | ||
case "Number": | ||
case "Object": | ||
case "Array": | ||
case "Date": | ||
method = SimpleToast.properties[key].type.name.toLowerCase(); | ||
break; | ||
default: | ||
method = "text"; | ||
break; | ||
window.StorybookUtilities.requestAvailability(); | ||
/** | ||
* add to the pattern library | ||
*/ | ||
/*const Pattern = { | ||
"of": "Pattern Library/Molecules/Layout", //Patter library path | ||
"name": "Collapse" //Pattern name | ||
"file": require("raw-loader!./demo/index.html"), | ||
"replacements": [] | ||
}; | ||
window.StorybookUtilities.instance.addPattern(Pattern);*/ | ||
/** | ||
* add the live demo | ||
*/ | ||
/*const Story = { | ||
"of": "a11y-collpase", //component folder | ||
"name": "a11y-collpase", //component tag | ||
"props": A11yCollapse.properties, //component properties that will become knobs | ||
"slots": { //slots that will become knobs | ||
"heading": | ||
{ | ||
"name": "heading", //slot name | ||
"type": "String", //slot type | ||
"value": `Click to expand me.` //slot content | ||
} | ||
binding[key] = storybookBridge[method]( | ||
key, | ||
SimpleToast.properties[key].value | ||
); | ||
// ensure ke-bab case | ||
let kebab = key.replace(/[A-Z\u00C0-\u00D6\u00D8-\u00DE]/g, function( | ||
match | ||
) { | ||
return "-" + match.toLowerCase(); | ||
}); | ||
elementDemo += ` ${kebab}="${binding[key]}"`; | ||
} | ||
} | ||
const innerText = storybookBridge.text("Inner contents", "Toast"); | ||
elementDemo += `> ${innerText}</simple-toast>`; | ||
return ` | ||
<h1>Live demo</h1> | ||
${elementDemo} | ||
<h1>Additional examples</h1> | ||
${template} | ||
`; | ||
}); | ||
}, | ||
"attr": ``, //attributes that won't become knobs | ||
"slotted": `` //slots that won't become knobs | ||
} | ||
window.StorybookUtilities.instance.addLiveDemo(Story);*/ |
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
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
195835
26
4874