@lrnwebcomponents/schema-behaviors
Advanced tools
Comparing version 2.4.0 to 2.4.1
@@ -15,3 +15,3 @@ { | ||
"end": { | ||
"line": 109, | ||
"line": 92, | ||
"column": 1 | ||
@@ -65,3 +65,3 @@ } | ||
"end": { | ||
"line": 86, | ||
"line": 90, | ||
"column": 5 | ||
@@ -82,19 +82,2 @@ } | ||
} | ||
}, | ||
{ | ||
"name": "generateResourceID", | ||
"description": "Generate a uinque ID", | ||
"privacy": "public", | ||
"sourceRange": { | ||
"start": { | ||
"line": 90, | ||
"column": 4 | ||
}, | ||
"end": { | ||
"line": 107, | ||
"column": 5 | ||
} | ||
}, | ||
"metadata": {}, | ||
"params": [] | ||
} | ||
@@ -111,3 +94,3 @@ ], | ||
"end": { | ||
"line": 108, | ||
"line": 91, | ||
"column": 3 | ||
@@ -114,0 +97,0 @@ } |
@@ -63,21 +63,3 @@ const gulp = require("gulp"); | ||
} | ||
let styleRegex = /\/\*[\s]*LIST SHARED STYLES BELOW[\s]*((?:(?:\w+)[\s,]*)*)\*\//g, | ||
styleArray = | ||
cssResult.match(styleRegex) && | ||
cssResult.match(styleRegex).length > 0 | ||
? cssResult | ||
.match(styleRegex)[0] | ||
.replace(styleRegex, "$1") | ||
.match(/(\w+)[\s,]*/g) | ||
: []; | ||
sharedStyles = | ||
styleArray && styleArray.length > 0 | ||
? styleArray.map(style => | ||
style.replace( | ||
/(\w+)[\s,]*/g, | ||
` | ||
$1` | ||
) | ||
) | ||
: ``; | ||
cssResult = stripCssComments(cssResult).trim(); | ||
@@ -90,3 +72,9 @@ let litResult = | ||
static get styles() { | ||
return [${sharedStyles ? `${sharedStyles},` : ``} | ||
return [ | ||
${ | ||
packageJson.wcfactory.sharedStyles && | ||
packageJson.wcfactory.sharedStyles.length > 0 | ||
? `${packageJson.wcfactory.sharedStyles.join(",")},` | ||
: `` | ||
} | ||
css\` | ||
@@ -93,0 +81,0 @@ ${cssResult} |
@@ -12,5 +12,6 @@ { | ||
"js": "src/schema-behaviors.js" | ||
} | ||
}, | ||
"sharedStyles": [] | ||
}, | ||
"version": "2.4.0", | ||
"version": "2.4.1", | ||
"description": "Apply schema helper behaviors to existing Polymer (Legacy) based elements", | ||
@@ -29,5 +30,5 @@ "repository": { | ||
"build": "../../node_modules/.bin/gulp && ../../node_modules/.bin/rollup -c && ../../node_modules/.bin/prettier --ignore-path ../../.prettierignore --write '**/*.{js,json}' && wca analyze \"**/*.js\" --format vscode --outFile vscode-html-custom-data.json", | ||
"dev": "concurrently --kill-others \"yarn run watch\" \"yarn run serve\"", | ||
"dev": "../../node_modules/.bin/concurrently --kill-others \"yarn run watch\" \"yarn run serve\"", | ||
"watch": "../../node_modules/.bin/gulp dev", | ||
"serve": "polymer serve --npm --module-resolution=node --open", | ||
"serve": "../../node_modules/.bin/es-dev-server -c ../../es-dev-server.config.js", | ||
"lighthouse": "../../node_modules/.bin/gulp lighthouse" | ||
@@ -44,3 +45,3 @@ }, | ||
"@lrnwebcomponents/deduping-fix": "^2.4.0", | ||
"@lrnwebcomponents/storybook-utilities": "^2.4.0", | ||
"@lrnwebcomponents/storybook-utilities": "^2.4.1", | ||
"@polymer/iron-component-page": "github:PolymerElements/iron-component-page", | ||
@@ -64,3 +65,3 @@ "@polymer/iron-demo-helpers": "3.1.0", | ||
], | ||
"gitHead": "d3bc01d12a0d042ba1fdb4f0dda36cfa5824047f" | ||
"gitHead": "27af689f6d96197fba00cc508a953cdd008f21b1" | ||
} |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
import { generateResourceID } from "@lrnwebcomponents/utils/utils.js"; | ||
export const SchemaBehaviors = function(SuperClass) { | ||
@@ -71,4 +71,8 @@ return class extends SuperClass { | ||
// if it still doesn't have one then we have to check | ||
if (this.schemaResourceID == "" || this.schemaResourceID == null) { | ||
this.schemaResourceID = this.generateResourceID(); | ||
if ( | ||
this.schemaResourceID == "" || | ||
this.schemaResourceID == null || | ||
this.schemaResourceID == "null" | ||
) { | ||
this.schemaResourceID = generateResourceID(); | ||
this.setAttribute("resource", this.schemaResourceID); | ||
@@ -90,24 +94,3 @@ } | ||
} | ||
/** | ||
* Generate a uinque ID | ||
*/ | ||
generateResourceID() { | ||
function idPart() { | ||
return Math.floor((1 + Math.random()) * 0x10000) | ||
.toString(16) | ||
.substring(1); | ||
} | ||
return ( | ||
"#" + | ||
idPart() + | ||
idPart() + | ||
"-" + | ||
idPart() + | ||
"-" + | ||
idPart() + | ||
"-" + | ||
idPart() | ||
); | ||
} | ||
}; | ||
}; |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
import { generateResourceID } from "@lrnwebcomponents/utils/utils.js"; | ||
export const SchemaBehaviors = function(SuperClass) { | ||
@@ -71,4 +71,8 @@ return class extends SuperClass { | ||
// if it still doesn't have one then we have to check | ||
if (this.schemaResourceID == "" || this.schemaResourceID == null) { | ||
this.schemaResourceID = this.generateResourceID(); | ||
if ( | ||
this.schemaResourceID == "" || | ||
this.schemaResourceID == null || | ||
this.schemaResourceID == "null" | ||
) { | ||
this.schemaResourceID = generateResourceID(); | ||
this.setAttribute("resource", this.schemaResourceID); | ||
@@ -90,24 +94,3 @@ } | ||
} | ||
/** | ||
* 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 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,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)}return r}function c(e){return(c=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 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 a(e,t,r){return(a="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var o=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=c(e)););return e}(e,t);if(o){var n=Object.getOwnPropertyDescriptor(o,t);return n.get?n.get.call(r):n.value}})(e,t,r||e)}e.SchemaBehaviors=function(e){return function(s){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=u(this,c(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 p,h,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&&i(e,t)}(f,e),p=f,l=[{key:"properties",get:function(){return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach(function(t){o(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},a(c(f),"properties",this),{schemaResourceID:{type:String,attribute:"schema-resource-id"},schemaMap:{type:Object,readOnly:!0,observer:"_schemaMapChanged"}})}}],(h=[{key:"updated",value:function(e){var t=this;a(c(f.prototype),"updated",this)&&a(c(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 o=e.prefix,n="";for(var c in o)o.hasOwnProperty(c)&&(n+=c+":"+o[c]+" ");""!=n&&this.setAttribute("prefix",n)}}},{key:"generateResourceID",value:function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return"#"+e()+e()+"-"+e()+"-"+e()+"-"+e()}}])&&r(p.prototype,h),l&&r(p,l),f}()},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@lrnwebcomponents/utils/utils.js")):"function"==typeof define&&define.amd?define(["exports","@lrnwebcomponents/utils/utils.js"],t):t((e=e||self).SchemaBehaviors={},e.utils_js)}(this,function(e,t){"use strict";function r(e){return(r="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 o(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 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 c(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,o)}return r}function i(e){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function s(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,r){return(a="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,r){var o=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=i(e)););return e}(e,t);if(o){var n=Object.getOwnPropertyDescriptor(o,t);return n.get?n.get.call(r):n.value}})(e,t,r||e)}e.SchemaBehaviors=function(e){return function(f){function p(){var e;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,p),(e=s(this,i(p).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 l,h,b;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&&u(e,t)}(p,e),l=p,b=[{key:"properties",get:function(){return function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?c(Object(r),!0).forEach(function(t){n(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):c(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}({},a(i(p),"properties",this),{schemaResourceID:{type:String,attribute:"schema-resource-id"},schemaMap:{type:Object,readOnly:!0,observer:"_schemaMapChanged"}})}}],(h=[{key:"updated",value:function(e){var t=this;a(i(p.prototype),"updated",this)&&a(i(p.prototype),"updated",this).call(this,e),e.forEach(function(e,r){"schemaMap"==r&&t._schemaMapChanged(t[r],e)})}},{key:"_schemaMapChanged",value:function(e,o){if("undefined"!==r(e)){this.schemaResourceID=this.getAttribute("resource"),""!=this.schemaResourceID&&null!=this.schemaResourceID&&"null"!=this.schemaResourceID||(this.schemaResourceID=t.generateResourceID(),this.setAttribute("resource",this.schemaResourceID));var n=e.prefix,c="";for(var i in n)n.hasOwnProperty(i)&&(c+=i+":"+n[i]+" ");""!=c&&this.setAttribute("prefix",c)}}}])&&o(l.prototype,h),b&&o(l,b),p}()},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=schema-behaviors.umd.js.map |
@@ -5,3 +5,3 @@ /** | ||
*/ | ||
import { generateResourceID } from "@lrnwebcomponents/utils/utils.js"; | ||
export const SchemaBehaviors = function(SuperClass) { | ||
@@ -71,4 +71,8 @@ return class extends SuperClass { | ||
// if it still doesn't have one then we have to check | ||
if (this.schemaResourceID == "" || this.schemaResourceID == null) { | ||
this.schemaResourceID = this.generateResourceID(); | ||
if ( | ||
this.schemaResourceID == "" || | ||
this.schemaResourceID == null || | ||
this.schemaResourceID == "null" | ||
) { | ||
this.schemaResourceID = generateResourceID(); | ||
this.setAttribute("resource", this.schemaResourceID); | ||
@@ -90,24 +94,3 @@ } | ||
} | ||
/** | ||
* 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
Sorry, the diff of this file is not supported yet
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
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
44591
635
2