@lrnwebcomponents/schema-behaviors
Advanced tools
Comparing version 2.0.8 to 2.0.9
@@ -13,3 +13,3 @@ { | ||
"name": "schemaResourceID", | ||
"type": "string | null | undefined", | ||
"type": "string", | ||
"description": "Unique Resource ID, generated when schemaMap processes.", | ||
@@ -28,5 +28,3 @@ "privacy": "public", | ||
"metadata": { | ||
"polymer": { | ||
"attributeType": "String" | ||
} | ||
"polymer": {} | ||
}, | ||
@@ -37,3 +35,3 @@ "defaultValue": "\"\"" | ||
"name": "schemaMap", | ||
"type": "Object | null | undefined", | ||
"type": "Object", | ||
"description": "Schema Map for this element.", | ||
@@ -53,7 +51,5 @@ "privacy": "public", | ||
"polymer": { | ||
"observer": "\"_schemaMapChanged\"", | ||
"attributeType": "Object" | ||
"observer": "\"_schemaMapChanged\"" | ||
} | ||
}, | ||
"defaultValue": "{\"prefix\":{\"oer\":\"http://oerschema.org/\",\"schema\":\"http://schema.org/\",\"dc\":\"http://purl.org/dc/terms/\",\"foaf\":\"http://xmlns.com/foaf/0.1/\",\"cc\":\"http://creativecommons.org/ns#\",\"bib\":\"http://bib.schema.org\"}}" | ||
} | ||
} | ||
@@ -101,6 +97,3 @@ ], | ||
} | ||
], | ||
"return": { | ||
"type": "void" | ||
} | ||
] | ||
} | ||
@@ -138,3 +131,3 @@ ], | ||
"metadata": {}, | ||
"type": "string | null | undefined" | ||
"type": "string" | ||
}, | ||
@@ -155,3 +148,3 @@ { | ||
"metadata": {}, | ||
"type": "Object | null | undefined" | ||
"type": "Object" | ||
} | ||
@@ -158,0 +151,0 @@ ], |
@@ -14,3 +14,3 @@ { | ||
}, | ||
"version": "2.0.8", | ||
"version": "2.0.9", | ||
"description": "Apply schema helper behaviors to existing Polymer (Legacy) based elements", | ||
@@ -42,4 +42,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", | ||
@@ -64,3 +64,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 { SchemaBehaviors } from "./schema-behaviors.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("Behaviors", module); | ||
stories.addDecorator(storybookBridge.withKnobs); | ||
stories.add("schema-behaviors", () => { | ||
var binding = {}; | ||
// start of tag for demo | ||
let elementDemo = `<schema-behaviors`; | ||
// mix in properties defined on the class | ||
for (var key in SchemaBehaviors.properties) { | ||
// skip prototype | ||
if (!SchemaBehaviors.properties.hasOwnProperty(key)) continue; | ||
// convert typed props | ||
if (SchemaBehaviors.properties[key].type.name) { | ||
let method = "text"; | ||
switch (SchemaBehaviors.properties[key].type.name) { | ||
case "Boolean": | ||
case "Number": | ||
case "Object": | ||
case "Array": | ||
case "Date": | ||
method = SchemaBehaviors.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, | ||
SchemaBehaviors.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", "Behaviors"); | ||
elementDemo += `> ${innerText}</schema-behaviors>`; | ||
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
22
624
44198