@lrnwebcomponents/schema-behaviors
Advanced tools
Comparing version 2.2.3 to 2.3.0
@@ -15,3 +15,3 @@ { | ||
"end": { | ||
"line": 86, | ||
"line": 108, | ||
"column": 1 | ||
@@ -32,12 +32,12 @@ } | ||
{ | ||
"name": "generateResourceID", | ||
"description": "Generate a uinque ID", | ||
"name": "updated", | ||
"description": "LitElement support", | ||
"privacy": "public", | ||
"sourceRange": { | ||
"start": { | ||
"line": 41, | ||
"line": 50, | ||
"column": 4 | ||
}, | ||
"end": { | ||
"line": 58, | ||
"line": 59, | ||
"column": 5 | ||
@@ -47,3 +47,10 @@ } | ||
"metadata": {}, | ||
"params": [] | ||
"params": [ | ||
{ | ||
"name": "changedProperties" | ||
} | ||
], | ||
"return": { | ||
"type": "void" | ||
} | ||
}, | ||
@@ -56,7 +63,7 @@ { | ||
"start": { | ||
"line": 62, | ||
"line": 63, | ||
"column": 4 | ||
}, | ||
"end": { | ||
"line": 84, | ||
"line": 85, | ||
"column": 5 | ||
@@ -77,2 +84,19 @@ } | ||
} | ||
}, | ||
{ | ||
"name": "generateResourceID", | ||
"description": "Generate a uinque ID", | ||
"privacy": "public", | ||
"sourceRange": { | ||
"start": { | ||
"line": 89, | ||
"column": 4 | ||
}, | ||
"end": { | ||
"line": 106, | ||
"column": 5 | ||
} | ||
}, | ||
"metadata": {}, | ||
"params": [] | ||
} | ||
@@ -89,3 +113,3 @@ ], | ||
"end": { | ||
"line": 85, | ||
"line": 107, | ||
"column": 3 | ||
@@ -92,0 +116,0 @@ } |
@@ -14,3 +14,3 @@ { | ||
}, | ||
"version": "2.2.3", | ||
"version": "2.3.0", | ||
"description": "Apply schema helper behaviors to existing Polymer (Legacy) based elements", | ||
@@ -27,3 +27,3 @@ "repository": { | ||
"start": "yarn run dev", | ||
"build": "../../node_modules/.bin/gulp && ../../node_modules/.bin/rollup -c && ../../node_modules/.bin/prettier --ignore-path ../../.prettierignore --write '**/*.{js,json}'", | ||
"build": "../../node_modules/.bin/gulp && ../../node_modules/.bin/rollup -c && ../../node_modules/.bin/prettier --ignore-path ../../.prettierignore --write '**/*.{js,json}' && wca analyze \"**/*.js\" --outFile custom-elements.json", | ||
"dev": "concurrently --kill-others \"yarn run watch\" \"yarn run serve\"", | ||
@@ -43,3 +43,3 @@ "watch": "../../node_modules/.bin/gulp dev", | ||
"@lrnwebcomponents/deduping-fix": "^2.1.1", | ||
"@lrnwebcomponents/storybook-utilities": "^2.2.3", | ||
"@lrnwebcomponents/storybook-utilities": "^2.3.0", | ||
"@polymer/iron-component-page": "github:PolymerElements/iron-component-page", | ||
@@ -63,3 +63,3 @@ "@polymer/iron-demo-helpers": "3.1.0", | ||
], | ||
"gitHead": "053bbb0a6336005e4fe5cbb41a5422b1f5856f11" | ||
"gitHead": "2e6809d848b36976043b7ea740a7254ca018adae" | ||
} |
@@ -8,6 +8,25 @@ /** | ||
return class extends SuperClass { | ||
/** | ||
* HTMLElement | ||
*/ | ||
constructor() { | ||
super(); | ||
this.schemaResourceID = ""; | ||
this.schemaMap = { | ||
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" | ||
} | ||
}; | ||
} | ||
/** | ||
* Popular convention across libraries | ||
*/ | ||
static get properties() { | ||
return { | ||
...super.properties, | ||
/** | ||
@@ -17,7 +36,7 @@ * Unique Resource ID, generated when schemaMap processes. | ||
schemaResourceID: { | ||
type: String, | ||
value: "" | ||
type: String | ||
}, | ||
/** | ||
* Schema Map for the element, used to generate a valid prefix on the fly | ||
* Props set for Polymer compatibility | ||
*/ | ||
@@ -27,12 +46,2 @@ schemaMap: { | ||
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" | ||
@@ -43,21 +52,13 @@ } | ||
/** | ||
* Generate a uinque ID | ||
* LitElement support | ||
*/ | ||
generateResourceID() { | ||
function idPart() { | ||
return Math.floor((1 + Math.random()) * 0x10000) | ||
.toString(16) | ||
.substring(1); | ||
updated(changedProperties) { | ||
if (super.updated) { | ||
super.updated(changedProperties); | ||
} | ||
return ( | ||
"#" + | ||
idPart() + | ||
idPart() + | ||
"-" + | ||
idPart() + | ||
"-" + | ||
idPart() + | ||
"-" + | ||
idPart() | ||
); | ||
changedProperties.forEach((oldValue, propName) => { | ||
if (propName == "schemaMap") { | ||
this._schemaMapChanged(this[propName], oldValue); | ||
} | ||
}); | ||
} | ||
@@ -90,3 +91,24 @@ /** | ||
} | ||
/** | ||
* Generate a uinque ID | ||
*/ | ||
generateResourceID() { | ||
function idPart() { | ||
return Math.floor((1 + Math.random()) * 0x10000) | ||
.toString(16) | ||
.substring(1); | ||
} | ||
return ( | ||
"#" + | ||
idPart() + | ||
idPart() + | ||
"-" + | ||
idPart() + | ||
"-" + | ||
idPart() + | ||
"-" + | ||
idPart() | ||
); | ||
} | ||
}; | ||
}; |
@@ -8,6 +8,25 @@ /** | ||
return class extends SuperClass { | ||
/** | ||
* HTMLElement | ||
*/ | ||
constructor() { | ||
super(); | ||
this.schemaResourceID = ""; | ||
this.schemaMap = { | ||
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" | ||
} | ||
}; | ||
} | ||
/** | ||
* Popular convention across libraries | ||
*/ | ||
static get properties() { | ||
return { | ||
...super.properties, | ||
/** | ||
@@ -17,7 +36,7 @@ * Unique Resource ID, generated when schemaMap processes. | ||
schemaResourceID: { | ||
type: String, | ||
value: "" | ||
type: String | ||
}, | ||
/** | ||
* Schema Map for the element, used to generate a valid prefix on the fly | ||
* Props set for Polymer compatibility | ||
*/ | ||
@@ -27,12 +46,2 @@ schemaMap: { | ||
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" | ||
@@ -43,21 +52,13 @@ } | ||
/** | ||
* Generate a uinque ID | ||
* LitElement support | ||
*/ | ||
generateResourceID() { | ||
function idPart() { | ||
return Math.floor((1 + Math.random()) * 0x10000) | ||
.toString(16) | ||
.substring(1); | ||
updated(changedProperties) { | ||
if (super.updated) { | ||
super.updated(changedProperties); | ||
} | ||
return ( | ||
"#" + | ||
idPart() + | ||
idPart() + | ||
"-" + | ||
idPart() + | ||
"-" + | ||
idPart() + | ||
"-" + | ||
idPart() | ||
); | ||
changedProperties.forEach((oldValue, propName) => { | ||
if (propName == "schemaMap") { | ||
this._schemaMapChanged(this[propName], oldValue); | ||
} | ||
}); | ||
} | ||
@@ -90,3 +91,24 @@ /** | ||
} | ||
/** | ||
* Generate a uinque ID | ||
*/ | ||
generateResourceID() { | ||
function idPart() { | ||
return Math.floor((1 + Math.random()) * 0x10000) | ||
.toString(16) | ||
.substring(1); | ||
} | ||
return ( | ||
"#" + | ||
idPart() + | ||
idPart() + | ||
"-" + | ||
idPart() + | ||
"-" + | ||
idPart() + | ||
"-" + | ||
idPart() | ||
); | ||
} | ||
}; | ||
}; |
@@ -1,2 +0,2 @@ | ||
!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 n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(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 i(e,t,r){return(i="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=o(e)););return e}(e,t);if(n){var c=Object.getOwnPropertyDescriptor(n,t);return c.get?c.get.call(r):c.value}})(e,t,r||e)}e.SchemaBehaviors=function(e){return function(f){function s(){return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),u(this,o(s).apply(this,arguments))}var a,p,l;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&&c(e,t)}(s,e),a=s,l=[{key:"properties",get:function(){return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){n(e,t,r[t])})}return e}({},i(o(s),"properties",this),{schemaResourceID:{type:String,value:""},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"}})}}],(p=[{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 n=e.prefix,o="";for(var c in n)n.hasOwnProperty(c)&&(o+=c+":"+n[c]+" ");""!=o&&this.setAttribute("prefix",o)}}}])&&r(a.prototype,p),l&&r(a,l),s}()},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!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 n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function n(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e){return(o=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function i(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 u(e,t,r){return(u="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=o(e)););return e}(e,t);if(n){var c=Object.getOwnPropertyDescriptor(n,t);return c.get?c.get.call(r):c.value}})(e,t,r||e)}e.SchemaBehaviors=function(e){return function(a){function f(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,f),(e=i(this,o(f).call(this))).schemaResourceID="",e.schemaMap={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"}},e}var s,p,l;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&&c(e,t)}(f,e),s=f,l=[{key:"properties",get:function(){return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{},o=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(o=o.concat(Object.getOwnPropertySymbols(r).filter(function(e){return Object.getOwnPropertyDescriptor(r,e).enumerable}))),o.forEach(function(t){n(e,t,r[t])})}return e}({},u(o(f),"properties",this),{schemaResourceID:{type:String},schemaMap:{type:Object,readOnly:!0,observer:"_schemaMapChanged"}})}}],(p=[{key:"updated",value:function(e){var t=this;u(o(f.prototype),"updated",this)&&u(o(f.prototype),"updated",this).call(this,e),e.forEach(function(e,r){"schemaMap"==r&&t._schemaMapChanged(t[r],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 n=e.prefix,o="";for(var c in n)n.hasOwnProperty(c)&&(o+=c+":"+n[c]+" ");""!=o&&this.setAttribute("prefix",o)}}},{key:"generateResourceID",value:function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return"#"+e()+e()+"-"+e()+"-"+e()+"-"+e()}}])&&r(s.prototype,p),l&&r(s,l),f}()},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=schema-behaviors.umd.js.map |
@@ -8,6 +8,25 @@ /** | ||
return class extends SuperClass { | ||
/** | ||
* HTMLElement | ||
*/ | ||
constructor() { | ||
super(); | ||
this.schemaResourceID = ""; | ||
this.schemaMap = { | ||
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" | ||
} | ||
}; | ||
} | ||
/** | ||
* Popular convention across libraries | ||
*/ | ||
static get properties() { | ||
return { | ||
...super.properties, | ||
/** | ||
@@ -17,7 +36,7 @@ * Unique Resource ID, generated when schemaMap processes. | ||
schemaResourceID: { | ||
type: String, | ||
value: "" | ||
type: String | ||
}, | ||
/** | ||
* Schema Map for the element, used to generate a valid prefix on the fly | ||
* Props set for Polymer compatibility | ||
*/ | ||
@@ -27,12 +46,2 @@ schemaMap: { | ||
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" | ||
@@ -43,21 +52,13 @@ } | ||
/** | ||
* Generate a uinque ID | ||
* LitElement support | ||
*/ | ||
generateResourceID() { | ||
function idPart() { | ||
return Math.floor((1 + Math.random()) * 0x10000) | ||
.toString(16) | ||
.substring(1); | ||
updated(changedProperties) { | ||
if (super.updated) { | ||
super.updated(changedProperties); | ||
} | ||
return ( | ||
"#" + | ||
idPart() + | ||
idPart() + | ||
"-" + | ||
idPart() + | ||
"-" + | ||
idPart() + | ||
"-" + | ||
idPart() | ||
); | ||
changedProperties.forEach((oldValue, propName) => { | ||
if (propName == "schemaMap") { | ||
this._schemaMapChanged(this[propName], oldValue); | ||
} | ||
}); | ||
} | ||
@@ -90,3 +91,24 @@ /** | ||
} | ||
/** | ||
* Generate a uinque ID | ||
*/ | ||
generateResourceID() { | ||
function idPart() { | ||
return Math.floor((1 + Math.random()) * 0x10000) | ||
.toString(16) | ||
.substring(1); | ||
} | ||
return ( | ||
"#" + | ||
idPart() + | ||
idPart() + | ||
"-" + | ||
idPart() + | ||
"-" + | ||
idPart() + | ||
"-" + | ||
idPart() | ||
); | ||
} | ||
}; | ||
}; |
Sorry, the diff of this file is not supported yet
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
58534
23
709