Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@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.0.9 to 2.0.10

.DS_Store

114

analysis.json
{
"schema_version": "1.0.0",
"functions": [
{
"name": "SchemaBehaviors",
"description": "",
"summary": "",
"sourceRange": {
"file": "schema-behaviors.js",
"start": {
"line": 97,
"column": 31
},
"end": {
"line": 175,
"column": 1
}
},
"privacy": "public",
"params": []
}
],
"metadata": {

@@ -13,3 +33,3 @@ "polymer": {

"name": "schemaResourceID",
"type": "string",
"type": "string | null | undefined",
"description": "Unique Resource ID, generated when schemaMap processes.",

@@ -28,3 +48,5 @@ "privacy": "public",

"metadata": {
"polymer": {}
"polymer": {
"attributeType": "String"
}
},

@@ -35,3 +57,3 @@ "defaultValue": "\"\""

"name": "schemaMap",
"type": "Object",
"type": "Object | null | undefined",
"description": "Schema Map for this element.",

@@ -51,5 +73,7 @@ "privacy": "public",

"polymer": {
"observer": "\"_schemaMapChanged\""
"observer": "\"_schemaMapChanged\"",
"attributeType": "Object"
}
}
},
"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\"}}"
}

@@ -97,3 +121,6 @@ ],

}
]
],
"return": {
"type": "void"
}
}

@@ -131,3 +158,3 @@ ],

"metadata": {},
"type": "string"
"type": "string | null | undefined"
},

@@ -148,3 +175,3 @@ {

"metadata": {},
"type": "Object"
"type": "Object | null | undefined"
}

@@ -161,3 +188,72 @@ ],

}
}
},
"classes": [
{
"description": "",
"summary": "",
"path": "schema-behaviors.js",
"properties": [],
"methods": [
{
"name": "generateResourceID",
"description": "Generate a uinque ID",
"privacy": "public",
"sourceRange": {
"start": {
"line": 130,
"column": 4
},
"end": {
"line": 147,
"column": 5
}
},
"metadata": {},
"params": []
},
{
"name": "_schemaMapChanged",
"description": "Notice the schema map has changed, reprocess attributes.",
"privacy": "protected",
"sourceRange": {
"start": {
"line": 151,
"column": 4
},
"end": {
"line": 173,
"column": 5
}
},
"metadata": {},
"params": [
{
"name": "newValue"
},
{
"name": "oldValue"
}
],
"return": {
"type": "void"
}
}
],
"staticMethods": [],
"demos": [],
"metadata": {},
"sourceRange": {
"start": {
"line": 98,
"column": 9
},
"end": {
"line": 174,
"column": 3
}
},
"privacy": "public",
"superclass": "SuperClass"
}
]
}

15

package.json

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

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

@@ -39,10 +39,10 @@ "repository": {

"dependencies": {
"@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",

@@ -52,4 +52,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"

@@ -65,3 +64,3 @@ },

],
"gitHead": "3ba5daaa4388a0e09b103784f482d49b14fb52d5"
"gitHead": "8571f08ce381877be732c2b5407233bcc3c58d99"
}

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

window.SchemaBehaviors=window.SchemaBehaviors||{};window.SchemaBehaviors.Schema={properties:{schemaResourceID:{type:String,value:""},schemaMap:{type:Object,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"}},generateResourceID:function generateResourceID(){function idPart(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return"#"+idPart()+idPart()+"-"+idPart()+"-"+idPart()+"-"+idPart()},_schemaMapChanged:function _schemaMapChanged(newValue,oldValue){if(babelHelpers.typeof(newValue)!==("undefined"===typeof void 0?"undefined":babelHelpers.typeof(void 0))){this.schemaResourceID=this.getAttribute("resource");if(""==this.schemaResourceID||null==this.schemaResourceID){this.schemaResourceID=this.generateResourceID();this.setAttribute("resource",this.schemaResourceID)}var prefixes=newValue.prefix,prefix="";for(var property in prefixes){if(prefixes.hasOwnProperty(property)){prefix+=property+":"+prefixes[property]+" "}}if(""!=prefix){this.setAttribute("prefix",prefix)}}}};
define(["exports"],function(_exports){"use strict";Object.defineProperty(_exports,"__esModule",{value:!0});_exports.SchemaBehaviors=void 0;/**
* Copyright 2018 The Pennsylvania State University
* @license Apache-2.0, see License.md for full text.
*/ // ensure SchemaBehaviors exists
window.SchemaBehaviors=window.SchemaBehaviors||{};/**
* `SchemaBehaviors`
*
* makes it easier to wire custom elements for
* schematic metadata by allowing prefixes to be defined in an object
* structure. This makes it easier to add and remove them then working
* against the attribute directly. It also helps with generating
* resource IDs automatically if they don't already exist on the element.
*
* @microcopy - language worth noting:
* -
*
* @polymer
* @polymerBehavior SchemaBehaviors.Schema
*/window.SchemaBehaviors.Schema={properties:{/**
* Unique Resource ID, generated when schemaMap processes.
*/schemaResourceID:{type:String,value:""},/**
* Schema Map for this element.
*/schemaMap:{type:Object,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"}},/**
* Generate a uinque ID
*/generateResourceID:function generateResourceID(){function idPart(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return"#"+idPart()+idPart()+"-"+idPart()+"-"+idPart()+"-"+idPart()},/**
* Notice the schema map has changed, reprocess attributes.
*/_schemaMapChanged:function _schemaMapChanged(newValue,oldValue){if(babelHelpers.typeof(newValue)!==("undefined"===typeof void 0?"undefined":babelHelpers.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)}var 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)}}}};var SchemaBehaviors=function SchemaBehaviors(SuperClass){return(/*#__PURE__*/function(_SuperClass){babelHelpers.inherits(_class,_SuperClass);function _class(){babelHelpers.classCallCheck(this,_class);return babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(_class).apply(this,arguments))}babelHelpers.createClass(_class,[{key:"generateResourceID",/**
* Generate a uinque ID
*/value:function generateResourceID(){function idPart(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return"#"+idPart()+idPart()+"-"+idPart()+"-"+idPart()+"-"+idPart()}/**
* Notice the schema map has changed, reprocess attributes.
*/},{key:"_schemaMapChanged",value:function _schemaMapChanged(newValue,oldValue){if(babelHelpers.typeof(newValue)!==("undefined"===typeof void 0?"undefined":babelHelpers.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)}var 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)}}}}],[{key:"properties",get:function get(){return{/**
* Unique Resource ID, generated when schemaMap processes.
*/schemaResourceID:{type:String,value:""},/**
* Schema Map for this element.
*/schemaMap:{type:Object,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"}}}}]);return _class}(SuperClass))};_exports.SchemaBehaviors=SchemaBehaviors});

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

window.SchemaBehaviors=window.SchemaBehaviors||{};window.SchemaBehaviors.Schema={properties:{schemaResourceID:{type:String,value:""},schemaMap:{type:Object,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"}},generateResourceID:function(){function idPart(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return"#"+idPart()+idPart()+"-"+idPart()+"-"+idPart()+"-"+idPart()},_schemaMapChanged:function(newValue,oldValue){if(typeof newValue!==typeof void 0){this.schemaResourceID=this.getAttribute("resource");if(""==this.schemaResourceID||null==this.schemaResourceID){this.schemaResourceID=this.generateResourceID();this.setAttribute("resource",this.schemaResourceID)}let prefixes=newValue.prefix,prefix="";for(var property in prefixes){if(prefixes.hasOwnProperty(property)){prefix+=property+":"+prefixes[property]+" "}}if(""!=prefix){this.setAttribute("prefix",prefix)}}}};
/**
* Copyright 2018 The Pennsylvania State University
* @license Apache-2.0, see License.md for full text.
*/ // ensure SchemaBehaviors exists
window.SchemaBehaviors=window.SchemaBehaviors||{};/**
* `SchemaBehaviors`
*
* makes it easier to wire custom elements for
* schematic metadata by allowing prefixes to be defined in an object
* structure. This makes it easier to add and remove them then working
* against the attribute directly. It also helps with generating
* resource IDs automatically if they don't already exist on the element.
*
* @microcopy - language worth noting:
* -
*
* @polymer
* @polymerBehavior SchemaBehaviors.Schema
*/window.SchemaBehaviors.Schema={properties:{/**
* Unique Resource ID, generated when schemaMap processes.
*/schemaResourceID:{type:String,value:""},/**
* Schema Map for this element.
*/schemaMap:{type:Object,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"}},/**
* Generate a uinque ID
*/generateResourceID:function(){function idPart(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return"#"+idPart()+idPart()+"-"+idPart()+"-"+idPart()+"-"+idPart()},/**
* Notice the schema map has changed, reprocess attributes.
*/_schemaMapChanged:function(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)}}}};export const SchemaBehaviors=function(SuperClass){return class extends SuperClass{static get properties(){return{/**
* Unique Resource ID, generated when schemaMap processes.
*/schemaResourceID:{type:String,value:""},/**
* Schema Map for this element.
*/schemaMap:{type:Object,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"}}}/**
* Generate a uinque ID
*/generateResourceID(){function idPart(){return Math.floor(65536*(1+Math.random())).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)}}}}};

@@ -97,1 +97,81 @@ /**

};
export const SchemaBehaviors = function(SuperClass) {
return class extends SuperClass {
static get properties() {
return {
/**
* Unique Resource ID, generated when schemaMap processes.
*/
schemaResourceID: {
type: String,
value: ""
},
/**
* Schema Map for this element.
*/
schemaMap: {
type: Object,
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"
}
};
}
/**
* Generate a uinque ID
*/
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 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);
}
}
}
};
};

@@ -7,7 +7,7 @@ import { SchemaBehaviors } from "./schema-behaviors.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);*/

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

!function(e){"function"==typeof define&&define.amd?define(e):e()}(function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}window.SchemaBehaviors=window.SchemaBehaviors||{},window.SchemaBehaviors.Schema={properties:{schemaResourceID:{type:String,value:""},schemaMap:{type:Object,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"}},generateResourceID:function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return"#"+e()+e()+"-"+e()+"-"+e()+"-"+e()},_schemaMapChanged:function(t,o){if("undefined"!==e(t)){this.schemaResourceID=this.getAttribute("resource"),""!=this.schemaResourceID&&null!=this.schemaResourceID||(this.schemaResourceID=this.generateResourceID(),this.setAttribute("resource",this.schemaResourceID));var r=t.prefix,s="";for(var n in r)r.hasOwnProperty(n)&&(s+=n+":"+r[n]+" ");""!=s&&this.setAttribute("prefix",s)}}}});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).SchemaBehaviors={})}(this,function(e){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function n(e,t){return(n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function c(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}window.SchemaBehaviors=window.SchemaBehaviors||{},window.SchemaBehaviors.Schema={properties:{schemaResourceID:{type:String,value:""},schemaMap:{type:Object,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"}},generateResourceID:function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return"#"+e()+e()+"-"+e()+"-"+e()+"-"+e()},_schemaMapChanged:function(e,r){if("undefined"!==t(e)){this.schemaResourceID=this.getAttribute("resource"),""!=this.schemaResourceID&&null!=this.schemaResourceID||(this.schemaResourceID=this.generateResourceID(),this.setAttribute("resource",this.schemaResourceID));var o=e.prefix,n="";for(var c in o)o.hasOwnProperty(c)&&(n+=c+":"+o[c]+" ");""!=n&&this.setAttribute("prefix",n)}}};e.SchemaBehaviors=function(e){return function(s){function i(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),c(this,o(i).apply(this,arguments))}var u,a,h;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&n(e,t)}(i,e),u=i,h=[{key:"properties",get:function(){return{schemaResourceID:{type:String,value:""},schemaMap:{type:Object,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"}}}}],(a=[{key:"generateResourceID",value:function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return"#"+e()+e()+"-"+e()+"-"+e()+"-"+e()}},{key:"_schemaMapChanged",value:function(e,r){if("undefined"!==t(e)){this.schemaResourceID=this.getAttribute("resource"),""!=this.schemaResourceID&&null!=this.schemaResourceID||(this.schemaResourceID=this.generateResourceID(),this.setAttribute("resource",this.schemaResourceID));var o=e.prefix,n="";for(var c in o)o.hasOwnProperty(c)&&(n+=c+":"+o[c]+" ");""!=n&&this.setAttribute("prefix",n)}}}])&&r(u.prototype,a),h&&r(u,h),i}()},Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=schema-behaviors.umd.js.map

@@ -97,1 +97,81 @@ /**

};
export const SchemaBehaviors = function(SuperClass) {
return class extends SuperClass {
static get properties() {
return {
/**
* Unique Resource ID, generated when schemaMap processes.
*/
schemaResourceID: {
type: String,
value: ""
},
/**
* Schema Map for this element.
*/
schemaMap: {
type: Object,
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"
}
};
}
/**
* Generate a uinque ID
*/
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 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);
}
}
}
};
};

Sorry, the diff of this file is not supported yet

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