Socket
Socket
Sign inDemoInstall

@lrnwebcomponents/schema-behaviors

Package Overview
Dependencies
Maintainers
2
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 0.0.24 to 0.0.27

lrnwebcomponents-schema-behaviors-0.0.26.tgz

155

build/es5-amd/schema-behaviors.js

@@ -1,102 +0,57 @@

define([
"exports",
"./node_modules/@polymer/polymer/polymer-element.js",
"./node_modules/@lrnwebcomponents/hax-body-behaviors/lib/HAXWiring.js"
], function(_exports, _polymerElement, _HAXWiring) {
"use strict";
Object.defineProperty(_exports, "__esModule", { value: !0 });
_exports.SchemaBehaviors = void 0;
function _templateObject_6e4e0cd0d70411e8919023f8494e2c4e() {
var data = babelHelpers.taggedTemplateLiteral([
"\n<style>:host {\n display: block;\n}\n\n:host([hidden]) {\n display: none;\n}\n</style>\n<slot></slot>"
]);
_templateObject_6e4e0cd0d70411e8919023f8494e2c4e = function() {
return data;
};
return data;
}
var SchemaBehaviors = (function(_PolymerElement) {
babelHelpers.inherits(SchemaBehaviors, _PolymerElement);
function SchemaBehaviors() {
babelHelpers.classCallCheck(this, SchemaBehaviors);
return babelHelpers.possibleConstructorReturn(
this,
(
SchemaBehaviors.__proto__ || Object.getPrototypeOf(SchemaBehaviors)
).apply(this, arguments)
);
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"
}
babelHelpers.createClass(
SchemaBehaviors,
[
{
key: "connectedCallback",
value: function connectedCallback() {
babelHelpers
.get(
SchemaBehaviors.prototype.__proto__ ||
Object.getPrototypeOf(SchemaBehaviors.prototype),
"connectedCallback",
this
)
.call(this);
this.HAXWiring = new _HAXWiring.HAXWiring();
this.HAXWiring.setHaxProperties(
SchemaBehaviors.haxProperties,
SchemaBehaviors.tag,
this
);
}
},
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) {
if (babelHelpers.typeof(newValue) !== "undefined") {
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] + " ";
}
],
[
{
key: "template",
get: function get() {
return (0, _polymerElement.html)(
_templateObject_6e4e0cd0d70411e8919023f8494e2c4e()
);
}
},
{
key: "haxProperties",
get: function get() {
return {
canScale: !0,
canPosition: !0,
canEditSource: !1,
gizmo: {
title: "Schema behaviors",
description: "Automated conversion of schema-behaviors/",
icon: "icons:android",
color: "green",
groups: ["Behaviors"],
handles: [{ type: "todo:read-the-docs-for-usage" }],
meta: {
author: "btopro",
owner: "The Pennsylvania State University"
}
},
settings: { quick: [], configure: [], advanced: [] }
};
}
},
{
key: "properties",
get: function get() {
return {};
}
},
{
key: "tag",
get: function get() {
return "schema-behaviors";
}
}
]
);
return SchemaBehaviors;
})(_polymerElement.PolymerElement);
_exports.SchemaBehaviors = SchemaBehaviors;
window.customElements.define(SchemaBehaviors.tag, SchemaBehaviors);
});
}
if ("" != prefix) {
this.setAttribute("prefix", prefix);
}
}
}
};

@@ -1,53 +0,57 @@

import {
html,
PolymerElement
} from "./node_modules/@polymer/polymer/polymer-element.js";
import { HAXWiring } from "./node_modules/@lrnwebcomponents/hax-body-behaviors/lib/HAXWiring.js";
export { SchemaBehaviors };
class SchemaBehaviors extends PolymerElement {
static get template() {
return html`
<style>:host {
display: block;
}
:host([hidden]) {
display: none;
}
</style>
<slot></slot>`;
}
static get haxProperties() {
return {
canScale: !0,
canPosition: !0,
canEditSource: !1,
gizmo: {
title: "Schema behaviors",
description: "Automated conversion of schema-behaviors/",
icon: "icons:android",
color: "green",
groups: ["Behaviors"],
handles: [{ type: "todo:read-the-docs-for-usage" }],
meta: { author: "btopro", owner: "The Pennsylvania State University" }
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"
}
},
settings: { quick: [], configure: [], advanced: [] }
};
}
static get properties() {
return {};
}
static get tag() {
return "schema-behaviors";
}
connectedCallback() {
super.connectedCallback();
this.HAXWiring = new HAXWiring();
this.HAXWiring.setHaxProperties(
SchemaBehaviors.haxProperties,
SchemaBehaviors.tag,
this
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) {
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);
}
}
}
}
window.customElements.define(SchemaBehaviors.tag, SchemaBehaviors);
};

@@ -8,15 +8,10 @@ {

"generator-wcfactory-version": "0.3.2",
"useHAX": true,
"useHAX": false,
"useSass": false,
"files": {
"css": "src/schema-behaviors.css",
"scss": "src/schema-behaviors.scss",
"html": "src/schema-behaviors.html",
"js": "src/schema-behaviors.js",
"properties": "src/schema-behaviors-properties.json",
"hax": "src/schema-behaviors-hax.json"
"js": "src/schema-behaviors.js"
}
},
"version": "0.0.24",
"description": "Automated conversion of schema-behaviors/",
"version": "0.0.27",
"description": "Apply schema helper behaviors to existing Polymer (Legacy) based elements",
"repository": {

@@ -44,3 +39,2 @@ "type": "git",

"dependencies": {
"@lrnwebcomponents/hax-body-behaviors": "^0.0.20",
"@polymer/polymer": "^3.0.5"

@@ -68,3 +62,3 @@ },

],
"gitHead": "b19e8d229705ebabcddaf694e2d346776c6c745e"
"gitHead": "55758f290ae5fd50931819f4b953300c8bec4f9a"
}

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

define(["exports","./node_modules/@polymer/polymer/polymer-element.js","./node_modules/@lrnwebcomponents/hax-body-behaviors/lib/HAXWiring.js"],function(_exports,_polymerElement,_HAXWiring){"use strict";Object.defineProperty(_exports,"__esModule",{value:!0});_exports.SchemaBehaviors=void 0;function _templateObject_6e4e0cd0d70411e8919023f8494e2c4e(){var data=babelHelpers.taggedTemplateLiteral(["\n<style>:host {\n display: block;\n}\n\n:host([hidden]) {\n display: none;\n}\n</style>\n<slot></slot>"]);_templateObject_6e4e0cd0d70411e8919023f8494e2c4e=function(){return data};return data}var SchemaBehaviors=function(_PolymerElement){babelHelpers.inherits(SchemaBehaviors,_PolymerElement);function SchemaBehaviors(){babelHelpers.classCallCheck(this,SchemaBehaviors);return babelHelpers.possibleConstructorReturn(this,(SchemaBehaviors.__proto__||Object.getPrototypeOf(SchemaBehaviors)).apply(this,arguments))}babelHelpers.createClass(SchemaBehaviors,[{key:"connectedCallback",value:function connectedCallback(){babelHelpers.get(SchemaBehaviors.prototype.__proto__||Object.getPrototypeOf(SchemaBehaviors.prototype),"connectedCallback",this).call(this);this.HAXWiring=new _HAXWiring.HAXWiring;this.HAXWiring.setHaxProperties(SchemaBehaviors.haxProperties,SchemaBehaviors.tag,this)}}],[{key:"template",get:function get(){return(0,_polymerElement.html)(_templateObject_6e4e0cd0d70411e8919023f8494e2c4e())}},{key:"haxProperties",get:function get(){return{canScale:!0,canPosition:!0,canEditSource:!1,gizmo:{title:"Schema behaviors",description:"Automated conversion of schema-behaviors/",icon:"icons:android",color:"green",groups:["Behaviors"],handles:[{type:"todo:read-the-docs-for-usage"}],meta:{author:"btopro",owner:"The Pennsylvania State University"}},settings:{quick:[],configure:[],advanced:[]}}}},{key:"properties",get:function get(){return{}}},{key:"tag",get:function get(){return"schema-behaviors"}}]);return SchemaBehaviors}(_polymerElement.PolymerElement);_exports.SchemaBehaviors=SchemaBehaviors;window.customElements.define(SchemaBehaviors.tag,SchemaBehaviors)});
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){if(babelHelpers.typeof(newValue)!=="undefined"){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)}}}};

@@ -1,10 +0,1 @@

import{html,PolymerElement}from"./node_modules/@polymer/polymer/polymer-element.js";import{HAXWiring}from"./node_modules/@lrnwebcomponents/hax-body-behaviors/lib/HAXWiring.js";export{SchemaBehaviors};class SchemaBehaviors extends PolymerElement{static get template(){return html`
<style>:host {
display: block;
}
:host([hidden]) {
display: none;
}
</style>
<slot></slot>`}static get haxProperties(){return{canScale:!0,canPosition:!0,canEditSource:!1,gizmo:{title:"Schema behaviors",description:"Automated conversion of schema-behaviors/",icon:"icons:android",color:"green",groups:["Behaviors"],handles:[{type:"todo:read-the-docs-for-usage"}],meta:{author:"btopro",owner:"The Pennsylvania State University"}},settings:{quick:[],configure:[],advanced:[]}}}static get properties(){return{}}static get tag(){return"schema-behaviors"}connectedCallback(){super.connectedCallback();this.HAXWiring=new HAXWiring;this.HAXWiring.setHaxProperties(SchemaBehaviors.haxProperties,SchemaBehaviors.tag,this)}}window.customElements.define(SchemaBehaviors.tag,SchemaBehaviors);
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){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)}}}};

@@ -5,89 +5,93 @@ /**

*/
import { html, PolymerElement } from "@polymer/polymer/polymer-element.js";
import { HAXWiring } from "@lrnwebcomponents/hax-body-behaviors/lib/HAXWiring.js";
export { SchemaBehaviors };
// ensure SchemaBehaviors exists
window.SchemaBehaviors = window.SchemaBehaviors || {};
/**
* `schema-behaviors`
* `Automated conversion of schema-behaviors/`
* `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:
* -
*
* @customElement
* @polymer
* @demo demo/index.html
* @polymerBehavior SchemaBehaviors.Schema
*/
class SchemaBehaviors extends PolymerElement {
// render function
static get template() {
return html`
<style>:host {
display: block;
}
:host([hidden]) {
display: none;
}
</style>
<slot></slot>`;
}
// haxProperty definition
static get haxProperties() {
return {
canScale: true,
canPosition: true,
canEditSource: false,
gizmo: {
title: "Schema behaviors",
description: "Automated conversion of schema-behaviors/",
icon: "icons:android",
color: "green",
groups: ["Behaviors"],
handles: [
{
type: "todo:read-the-docs-for-usage"
}
],
meta: {
author: "btopro",
owner: "The Pennsylvania State University"
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"
}
},
settings: {
quick: [],
configure: [],
advanced: []
}
};
}
// properties available to the custom element for data binding
static get properties() {
return {};
}
observer: "_schemaMapChanged"
}
},
/**
* Store the tag name to make it easier to obtain directly.
* @notice function name must be here for tooling to operate correctly
* Generate a uinque ID
*/
static get tag() {
return "schema-behaviors";
}
generateResourceID: function() {
function idPart() {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
}
return (
"#" +
idPart() +
idPart() +
"-" +
idPart() +
"-" +
idPart() +
"-" +
idPart()
);
},
/**
* life cycle, element is afixed to the DOM
* Notice the schema map has changed, reprocess attributes.
*/
connectedCallback() {
super.connectedCallback();
this.HAXWiring = new HAXWiring();
this.HAXWiring.setHaxProperties(
SchemaBehaviors.haxProperties,
SchemaBehaviors.tag,
this
);
_schemaMapChanged: function(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);
}
}
}
/**
* life cycle, element is removed from the DOM
*/
//disconnectedCallback() {}
}
window.customElements.define(SchemaBehaviors.tag, SchemaBehaviors);
};

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@polymer/polymer/polymer-element.js"),require("@lrnwebcomponents/hax-body-behaviors/lib/HAXWiring.js")):"function"==typeof define&&define.amd?define(["exports","@polymer/polymer/polymer-element.js","@lrnwebcomponents/hax-body-behaviors/lib/HAXWiring.js"],t):t(e.SchemaBehaviors={},e.polymerElement_js,e.HAXWiring_js)}(this,function(e,t,n){"use strict";function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function i(e,t){return(i=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}function a(e,t,n){return(a="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=o(e)););return e}(e,t);if(r){var i=Object.getOwnPropertyDescriptor(r,t);return i.get?i.get.call(n):i.value}})(e,t,n||e)}function s(){var e,t,n=(e=["\n<style>:host {\n display: block;\n}\n\n:host([hidden]) {\n display: none;\n}\n</style>\n<slot></slot>"],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return s=function(){return n},n}var u=function(e){function u(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,u),c(this,o(u).apply(this,arguments))}var l,f,p;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&&i(e,t)}(u,t.PolymerElement),l=u,p=[{key:"template",get:function(){return t.html(s())}},{key:"haxProperties",get:function(){return{canScale:!0,canPosition:!0,canEditSource:!1,gizmo:{title:"Schema behaviors",description:"Automated conversion of schema-behaviors/",icon:"icons:android",color:"green",groups:["Behaviors"],handles:[{type:"todo:read-the-docs-for-usage"}],meta:{author:"btopro",owner:"The Pennsylvania State University"}},settings:{quick:[],configure:[],advanced:[]}}}},{key:"properties",get:function(){return{}}},{key:"tag",get:function(){return"schema-behaviors"}}],(f=[{key:"connectedCallback",value:function(){a(o(u.prototype),"connectedCallback",this).call(this),this.HAXWiring=new n.HAXWiring,this.HAXWiring.setHaxProperties(u.haxProperties,u.tag,this)}}])&&r(l.prototype,f),p&&r(l,p),u}();window.customElements.define(u.tag,u),e.SchemaBehaviors=u,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t():"function"==typeof define&&define.amd?define(t):t()}(0,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,n="";for(var s in r)r.hasOwnProperty(s)&&(n+=s+":"+r[s]+" ");""!=n&&this.setAttribute("prefix",n)}}}});
//# sourceMappingURL=schema-behaviors.umd.js.map

@@ -5,43 +5,93 @@ /**

*/
import { html, PolymerElement } from "@polymer/polymer/polymer-element.js";
import { HAXWiring } from "@lrnwebcomponents/hax-body-behaviors/lib/HAXWiring.js";
export { SchemaBehaviors };
// ensure SchemaBehaviors exists
window.SchemaBehaviors = window.SchemaBehaviors || {};
/**
* `schema-behaviors`
* `Automated conversion of schema-behaviors/`
* `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:
* -
*
* @customElement
* @polymer
* @demo demo/index.html
* @polymerBehavior SchemaBehaviors.Schema
*/
class SchemaBehaviors extends PolymerElement {
/* REQUIRED FOR TOOLING DO NOT TOUCH */
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"
}
},
/**
* Store the tag name to make it easier to obtain directly.
* @notice function name must be here for tooling to operate correctly
* Generate a uinque ID
*/
static get tag() {
return "schema-behaviors";
}
generateResourceID: function() {
function idPart() {
return Math.floor((1 + Math.random()) * 0x10000)
.toString(16)
.substring(1);
}
return (
"#" +
idPart() +
idPart() +
"-" +
idPart() +
"-" +
idPart() +
"-" +
idPart()
);
},
/**
* life cycle, element is afixed to the DOM
* Notice the schema map has changed, reprocess attributes.
*/
connectedCallback() {
super.connectedCallback();
this.HAXWiring = new HAXWiring();
this.HAXWiring.setHaxProperties(
SchemaBehaviors.haxProperties,
SchemaBehaviors.tag,
this
);
_schemaMapChanged: function(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);
}
}
}
/**
* life cycle, element is removed from the DOM
*/
//disconnectedCallback() {}
}
window.customElements.define(SchemaBehaviors.tag, SchemaBehaviors);
};

Sorry, the diff of this file is too big to display

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