Socket
Socket
Sign inDemoInstall

@lrnwebcomponents/schema-behaviors

Package Overview
Dependencies
Maintainers
4
Versions
104
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lrnwebcomponents/schema-behaviors - npm Package Compare versions

Comparing version 2.1.1 to 2.1.2

25

gulpfile.js

@@ -79,10 +79,3 @@ const gulp = require("gulp");

});
// run polymer build to generate everything fully
gulp.task("build", () => {
const spawn = require("child_process").spawn;
let child = spawn("polymer", ["build"]);
return child.on("close", function(code) {
console.log("child process exited with code " + code);
});
});
// run polymer analyze to generate documentation

@@ -104,3 +97,3 @@ gulp.task("analyze", () => {

gulp
.src("./build/es6/" + packageJson.wcfactory.elementName + ".js")
.src("./" + packageJson.wcfactory.elementName + ".js")
.pipe(

@@ -112,10 +105,3 @@ rename({

.pipe(gulp.dest("./"));
gulp
.src("./build/es5-amd/" + packageJson.wcfactory.elementName + ".js")
.pipe(
rename({
suffix: ".amd"
})
)
.pipe(gulp.dest("./"));
return gulp

@@ -151,5 +137,2 @@ .src("./" + packageJson.wcfactory.elementName + ".js")

gulp.task(
"default",
gulp.series("merge", "analyze", "build", "compile", "sourcemaps")
);
gulp.task("default", gulp.series("merge", "analyze", "compile", "sourcemaps"));

7

package.json

@@ -14,3 +14,3 @@ {

},
"version": "2.1.1",
"version": "2.1.2",
"description": "Apply schema helper behaviors to existing Polymer (Legacy) based elements",

@@ -24,3 +24,2 @@ "repository": {

"umd": "schema-behaviors.umd.js",
"amd": "schema-behaviors.amd.js",
"scripts": {

@@ -44,3 +43,3 @@ "test": "../../node_modules/.bin/wct --configFile ../../wct.conf.json node_modules/@lrnwebcomponents/schema-behaviors/test/",

"@lrnwebcomponents/deduping-fix": "^2.1.1",
"@lrnwebcomponents/storybook-utilities": "^2.1.1",
"@lrnwebcomponents/storybook-utilities": "^2.1.2",
"@polymer/iron-component-page": "github:PolymerElements/iron-component-page",

@@ -64,3 +63,3 @@ "@polymer/iron-demo-helpers": "^3.1.0",

],
"gitHead": "377805ee041d6205232182b01f8e05a177ef3bf7"
"gitHead": "d857f1d834ec0bd10fee57ad11f60eb37416db07"
}
/**
* Copyright 2018 The Pennsylvania State University
* @license Apache-2.0, see License.md for full text.
*/export const SchemaBehaviors=function(SuperClass){return class extends SuperClass{static get properties(){let props={/**
*/
export const SchemaBehaviors = function(SuperClass) {
return class extends SuperClass {
static get properties() {
let props = {
/**
* Unique Resource ID, generated when schemaMap processes.
*/schemaResourceID:{type:String,value:""},/**
*/
schemaResourceID: {
type: String,
value: ""
},
/**
* Schema Map for the element, used to generate a valid prefix on the fly
*/schemaMap:{type:Object,readOnly:!0,value:{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"}},observer:"_schemaMapChanged"}};if(super.properties){props=Object.assign(props,super.properties)}return props}/**
*/
schemaMap: {
type: Object,
readOnly: true,
value: {
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"
}
},
observer: "_schemaMapChanged"
}
};
if (super.properties) {
props = Object.assign(props, super.properties);
}
return props;
}
/**
* Generate a uinque ID
*/generateResourceID(){function idPart(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return"#"+idPart()+idPart()+"-"+idPart()+"-"+idPart()+"-"+idPart()}/**
*/
generateResourceID() {
function idPart() {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
}
return (
"#" +
idPart() +
idPart() +
"-" +
idPart() +
"-" +
idPart() +
"-" +
idPart()
);
}
/**
* Notice the schema map has changed, reprocess attributes.
*/_schemaMapChanged(newValue,oldValue){if(typeof newValue!==typeof void 0){// use this to tie into schemaResourceID build
this.schemaResourceID=this.getAttribute("resource");// if it still doesn't have one then we have to check
if(""==this.schemaResourceID||null==this.schemaResourceID){this.schemaResourceID=this.generateResourceID();this.setAttribute("resource",this.schemaResourceID)}let prefixes=newValue.prefix,prefix="";// build prefix string
for(var property in prefixes){if(prefixes.hasOwnProperty(property)){prefix+=property+":"+prefixes[property]+" "}}// set prefix on the main element itself
if(""!=prefix){this.setAttribute("prefix",prefix)}}}}};
*/
_schemaMapChanged(newValue, oldValue) {
if (typeof newValue !== typeof undefined) {
// use this to tie into schemaResourceID build
this.schemaResourceID = this.getAttribute("resource");
// if it still doesn't have one then we have to check
if (this.schemaResourceID == "" || this.schemaResourceID == null) {
this.schemaResourceID = this.generateResourceID();
this.setAttribute("resource", this.schemaResourceID);
}
let prefixes = newValue.prefix;
let prefix = "";
// build prefix string
for (var property in prefixes) {
if (prefixes.hasOwnProperty(property)) {
prefix += property + ":" + prefixes[property] + " ";
}
}
// set prefix on the main element itself
if (prefix != "") {
this.setAttribute("prefix", prefix);
}
}
}
};
};
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