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

@lrnwebcomponents/responsive-utility

Package Overview
Dependencies
Maintainers
4
Versions
111
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@lrnwebcomponents/responsive-utility - npm Package Compare versions

Comparing version 2.1.4 to 2.2.0

14

analysis.json

@@ -16,7 +16,7 @@ {

"start": {
"line": 40,
"line": 38,
"column": 2
},
"end": {
"line": 45,
"line": 43,
"column": 3

@@ -37,7 +37,7 @@ }

"start": {
"line": 46,
"line": 44,
"column": 2
},
"end": {
"line": 96,
"line": 94,
"column": 3

@@ -58,7 +58,7 @@ }

"start": {
"line": 176,
"line": 174,
"column": 2
},
"end": {
"line": 180,
"line": 178,
"column": 3

@@ -83,3 +83,3 @@ }

"end": {
"line": 181,
"line": 179,
"column": 1

@@ -86,0 +86,0 @@ }

@@ -40,5 +40,12 @@ const gulp = require("gulp");

);
let props = `${rawprops}`;
props = props.replace(/\"type\": \"(\w+)\"/g, '"type": $1');
let cssResult = "<style>";
let props = `${rawprops}`,
comma = props
.replace(/\/\*[\s\S]*?\*\//g, "")
.replace(/\/\/.*/g, "")
.replace(/[\{\s\n\}]/g, "");
(props = props.replace(/\"type\": \"(\w+)\"/g, '"type": $1')),
(superprops =
comma === "" ? `...super.properties` : `...super.properties,`);
props = props.replace(/\{([\s\n]*)/, `{$1$1${superprops}$1$1`);
let cssResult = "";
if (

@@ -57,9 +64,46 @@ packageJson.wcfactory.useSass &&

}
cssResult += "</style>";
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();
return `
let litResult =
packageJson.wcfactory.customElementClass !== "LitElement"
? ``
: `
//styles function
static get styles() {
return [${sharedStyles ? `${sharedStyles},` : ``}
css\`
${cssResult}
\`
];
}`,
styleResult =
packageJson.wcfactory.customElementClass !== "LitElement"
? `<style>
${cssResult}
</style>`
: ``;
return `${litResult}
// render function
static get template() {
return html\`
${cssResult}
${styleResult}
${html}\`;

@@ -70,7 +114,3 @@ }

static get properties() {
let props = ${props};
if (super.properties) {
props = Object.assign(props, super.properties);
}
return props;
return ${props};
}`;

@@ -77,0 +117,0 @@ }

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

},
"version": "2.1.4",
"version": "2.2.0",
"description": "Automated conversion of responsive-utility/",

@@ -43,3 +43,3 @@ "repository": {

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

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

],
"gitHead": "ff737f87266a717930bde80432ceb95c1d64c6e8"
"gitHead": "d8dfc961c1e93dbe8c38b40c82e288af057d6477"
}

@@ -27,3 +27,5 @@ import { html, PolymerElement } from "@polymer/polymer/polymer-element.js";

static get properties() {
let props = {
return {
...super.properties,
/**

@@ -37,6 +39,2 @@ * Stores

};
if (super.properties) {
props = Object.assign(props, super.properties);
}
return props;
}

@@ -43,0 +41,0 @@ connectedCallback() {

@@ -27,3 +27,5 @@ import { html, PolymerElement } from "@polymer/polymer/polymer-element.js";

static get properties() {
let props = {
return {
...super.properties,
/**

@@ -37,6 +39,2 @@ * Stores

};
if (super.properties) {
props = Object.assign(props, super.properties);
}
return props;
}

@@ -43,0 +41,0 @@ connectedCallback() {

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@polymer/polymer/polymer-element.js"),require("@polymer/polymer/lib/utils/render-status.js"),require("@polymer/polymer/lib/utils/async.js"),require("@polymer/iron-resizable-behavior/iron-resizable-behavior.js"),require("@polymer/polymer/lib/legacy/class.js")):"function"==typeof define&&define.amd?define(["exports","@polymer/polymer/polymer-element.js","@polymer/polymer/lib/utils/render-status.js","@polymer/polymer/lib/utils/async.js","@polymer/iron-resizable-behavior/iron-resizable-behavior.js","@polymer/polymer/lib/legacy/class.js"],t):t((e=e||self).ResponsiveUtility={},e.polymerElement_js,e.renderStatus_js,null,e.ironResizableBehavior_js,e.class_js)}(this,function(e,t,i,n,l,o){"use strict";function r(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function s(e,t,i){return t&&r(e.prototype,t),i&&r(e,i),e}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t,i){return(p="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=a(e)););return e}(e,t);if(n){var l=Object.getOwnPropertyDescriptor(n,t);return l.get?l.get.call(i):l.value}})(e,t,i||e)}function c(){var e,t,i=(e=["\n <style>\n :host {\n display: inline;\n }\n </style>\n <slot></slot>\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return c=function(){return i},i}window.ResponsiveUtility={},window.ResponsiveUtility.instance=null;var v=function(e){function n(){var e,t,i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),t=this,i=a(n).call(this),e=!i||"object"!=typeof i&&"function"!=typeof i?u(t):i;var l=u(e);return null==window.ResponsiveUtility.instance&&(window.ResponsiveUtility.instance=l),window.addEventListener("responsive-element",function(e){var t={element:e.detail.element,attribute:void 0!==e.detail.attribute&&null!==e.detail.attribute?e.detail.attribute:"responsive-size",relativeToParent:void 0===e.detail.relativeToParent||null===e.detail.relativeToParent||e.detail.relativeToParent,sm:void 0!==e.detail.sm&&null!==e.detail.sm?e.detail.sm:900,md:void 0!==e.detail.md&&null!==e.detail.md?e.detail.md:1200,lg:void 0!==e.detail.lg&&null!==e.detail.lg?e.detail.lg:1500,xl:void 0!==e.detail.xl&&null!==e.detail.xl?e.detail.lg:1800};if("ResizeObserver"in window&&!0===t.relativeToParent){var i=new ResizeObserver(function(){window.ResponsiveUtility.setSize(t)}),n=void 0!==e.detail.parentNode&&null!==e.detail.parentNode?e.detail.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE?e.detail.element.parentNode.host:e.detail.element.parentNode:e.detail.element;i.observe(n)}l.push("details",t),window.ResponsiveUtility.setSize(t)}),window.addEventListener("delete-responsive-element",function(t){for(var i=0;i<e.details.length;i++)t.detail===detail[i]&&l.splice("details",i,1)}),e}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&&d(e,t)}(n,o.mixinBehaviors([l.IronResizableBehavior],t.PolymerElement)),s(n,[{key:"connectedCallback",value:function(){p(a(n.prototype),"connectedCallback",this).call(this),i.afterNextRender(this,function(){this.addEventListener("iron-resize",this._onIronResize.bind(this))})}},{key:"disconnectedCallback",value:function(){var e=this,t=this;this.removeEventListener("iron-resize",this._onIronResize.bind(this)),window.removeEventListener("responsive-element",function(e){var i={element:e.detail.element,attribute:void 0!==e.detail.attribute&&null!==e.detail.attribute?e.detail.attribute:"responsive-size",relativeToParent:void 0===e.detail.relativeToParent||null===e.detail.relativeToParent||e.detail.relativeToParent,sm:void 0!==e.detail.sm&&null!==e.detail.sm?e.detail.sm:900,md:void 0!==e.detail.md&&null!==e.detail.md?e.detail.md:1200,lg:void 0!==e.detail.lg&&null!==e.detail.lg?e.detail.lg:1500,xl:void 0!==e.detail.xl&&null!==e.detail.xl?e.detail.lg:1800};if("ResizeObserver"in window&&!0===i.relativeToParent){var n=new ResizeObserver(function(){window.ResponsiveUtility.setSize(i)}),l=void 0!==e.detail.parentNode&&null!==e.detail.parentNode?e.detail.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE?e.detail.element.parentNode.host:e.detail.element.parentNode:e.detail.element;n.observe(l)}t.push("details",i),window.ResponsiveUtility.setSize(i)}),window.removeEventListener("delete-responsive-element",function(i){for(var n=0;n<e.details.length;n++)i.detail===detail[n]&&t.splice("details",n,1)}),p(a(n.prototype),"disconnectedCallback",this).call(this)}}],[{key:"template",get:function(){return t.html(c())}},{key:"tag",get:function(){return"responsive-utility"}},{key:"properties",get:function(){var e={details:{type:Array,value:[]}};return p(a(n),"properties",this)&&(e=Object.assign(e,p(a(n),"properties",this))),e}}]),s(n,[{key:"_onIronResize",value:function(){for(var e=0;e<this.details.length;e++)window.ResponsiveUtility.setSize(this.details[e])}}]),n}();window.customElements.define(v.tag,v),window.ResponsiveUtility.requestAvailability=function(){null==window.ResponsiveUtility.instance&&(window.ResponsiveUtility.instance=document.createElement("responsive-utility")),document.body.appendChild(window.ResponsiveUtility.instance)},window.ResponsiveUtility.setSize=function(e){var t,i=window.ResponsiveUtility._getWidth(e);t=i<e.sm?"xs":i<e.md?"sm":i<e.lg?"md":i<e.xl?"lg":"xl",void 0!==e.element.getAttribute(e.attribute)&&t===e.element.getAttribute(e.attribute)||e.element.setAttribute(e.attribute,t)},window.ResponsiveUtility._getWidth=function(e){var t=e.element;if(!0===e.relativeToParent){if(void 0!==t.offsetWidth&&null!==t.offsetWidth&&t.offsetWidth>0)return t.offsetWidth;if(null!==t.parentNode)return t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE?t.parentNode.host.offsetWidth:t.parentNode.offsetWidth}return window.outerWidth},e.ResponsiveUtility=v,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@polymer/polymer/polymer-element.js"),require("@polymer/polymer/lib/utils/render-status.js"),require("@polymer/polymer/lib/utils/async.js"),require("@polymer/iron-resizable-behavior/iron-resizable-behavior.js"),require("@polymer/polymer/lib/legacy/class.js")):"function"==typeof define&&define.amd?define(["exports","@polymer/polymer/polymer-element.js","@polymer/polymer/lib/utils/render-status.js","@polymer/polymer/lib/utils/async.js","@polymer/iron-resizable-behavior/iron-resizable-behavior.js","@polymer/polymer/lib/legacy/class.js"],t):t((e=e||self).ResponsiveUtility={},e.polymerElement_js,e.renderStatus_js,null,e.ironResizableBehavior_js,e.class_js)}(this,function(e,t,i,n,l,r){"use strict";function o(e,t){for(var i=0;i<t.length;i++){var n=t[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function a(e,t,i){return t&&o(e.prototype,t),i&&o(e,i),e}function s(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function d(e){return(d=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 p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function c(e,t,i){return(c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,i){var n=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=d(e)););return e}(e,t);if(n){var l=Object.getOwnPropertyDescriptor(n,t);return l.get?l.get.call(i):l.value}})(e,t,i||e)}function f(){var e,t,i=(e=["\n <style>\n :host {\n display: inline;\n }\n </style>\n <slot></slot>\n "],t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}})));return f=function(){return i},i}window.ResponsiveUtility={},window.ResponsiveUtility.instance=null;var v=function(e){function n(){var e,t,i;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),t=this,i=d(n).call(this),e=!i||"object"!=typeof i&&"function"!=typeof i?p(t):i;var l=p(e);return null==window.ResponsiveUtility.instance&&(window.ResponsiveUtility.instance=l),window.addEventListener("responsive-element",function(e){var t={element:e.detail.element,attribute:void 0!==e.detail.attribute&&null!==e.detail.attribute?e.detail.attribute:"responsive-size",relativeToParent:void 0===e.detail.relativeToParent||null===e.detail.relativeToParent||e.detail.relativeToParent,sm:void 0!==e.detail.sm&&null!==e.detail.sm?e.detail.sm:900,md:void 0!==e.detail.md&&null!==e.detail.md?e.detail.md:1200,lg:void 0!==e.detail.lg&&null!==e.detail.lg?e.detail.lg:1500,xl:void 0!==e.detail.xl&&null!==e.detail.xl?e.detail.lg:1800};if("ResizeObserver"in window&&!0===t.relativeToParent){var i=new ResizeObserver(function(){window.ResponsiveUtility.setSize(t)}),n=void 0!==e.detail.parentNode&&null!==e.detail.parentNode?e.detail.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE?e.detail.element.parentNode.host:e.detail.element.parentNode:e.detail.element;i.observe(n)}l.push("details",t),window.ResponsiveUtility.setSize(t)}),window.addEventListener("delete-responsive-element",function(t){for(var i=0;i<e.details.length;i++)t.detail===detail[i]&&l.splice("details",i,1)}),e}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)}(n,r.mixinBehaviors([l.IronResizableBehavior],t.PolymerElement)),a(n,[{key:"connectedCallback",value:function(){c(d(n.prototype),"connectedCallback",this).call(this),i.afterNextRender(this,function(){this.addEventListener("iron-resize",this._onIronResize.bind(this))})}},{key:"disconnectedCallback",value:function(){var e=this,t=this;this.removeEventListener("iron-resize",this._onIronResize.bind(this)),window.removeEventListener("responsive-element",function(e){var i={element:e.detail.element,attribute:void 0!==e.detail.attribute&&null!==e.detail.attribute?e.detail.attribute:"responsive-size",relativeToParent:void 0===e.detail.relativeToParent||null===e.detail.relativeToParent||e.detail.relativeToParent,sm:void 0!==e.detail.sm&&null!==e.detail.sm?e.detail.sm:900,md:void 0!==e.detail.md&&null!==e.detail.md?e.detail.md:1200,lg:void 0!==e.detail.lg&&null!==e.detail.lg?e.detail.lg:1500,xl:void 0!==e.detail.xl&&null!==e.detail.xl?e.detail.lg:1800};if("ResizeObserver"in window&&!0===i.relativeToParent){var n=new ResizeObserver(function(){window.ResponsiveUtility.setSize(i)}),l=void 0!==e.detail.parentNode&&null!==e.detail.parentNode?e.detail.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE?e.detail.element.parentNode.host:e.detail.element.parentNode:e.detail.element;n.observe(l)}t.push("details",i),window.ResponsiveUtility.setSize(i)}),window.removeEventListener("delete-responsive-element",function(i){for(var n=0;n<e.details.length;n++)i.detail===detail[n]&&t.splice("details",n,1)}),c(d(n.prototype),"disconnectedCallback",this).call(this)}}],[{key:"template",get:function(){return t.html(f())}},{key:"tag",get:function(){return"responsive-utility"}},{key:"properties",get:function(){return function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{},n=Object.keys(i);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(i).filter(function(e){return Object.getOwnPropertyDescriptor(i,e).enumerable}))),n.forEach(function(t){s(e,t,i[t])})}return e}({},c(d(n),"properties",this),{details:{type:Array,value:[]}})}}]),a(n,[{key:"_onIronResize",value:function(){for(var e=0;e<this.details.length;e++)window.ResponsiveUtility.setSize(this.details[e])}}]),n}();window.customElements.define(v.tag,v),window.ResponsiveUtility.requestAvailability=function(){null==window.ResponsiveUtility.instance&&(window.ResponsiveUtility.instance=document.createElement("responsive-utility")),document.body.appendChild(window.ResponsiveUtility.instance)},window.ResponsiveUtility.setSize=function(e){var t,i=window.ResponsiveUtility._getWidth(e);t=i<e.sm?"xs":i<e.md?"sm":i<e.lg?"md":i<e.xl?"lg":"xl",void 0!==e.element.getAttribute(e.attribute)&&t===e.element.getAttribute(e.attribute)||e.element.setAttribute(e.attribute,t)},window.ResponsiveUtility._getWidth=function(e){var t=e.element;if(!0===e.relativeToParent){if(void 0!==t.offsetWidth&&null!==t.offsetWidth&&t.offsetWidth>0)return t.offsetWidth;if(null!==t.parentNode)return t.parentNode.nodeType===Node.DOCUMENT_FRAGMENT_NODE?t.parentNode.host.offsetWidth:t.parentNode.offsetWidth}return window.outerWidth},e.ResponsiveUtility=v,Object.defineProperty(e,"__esModule",{value:!0})});
//# sourceMappingURL=responsive-utility.umd.js.map

@@ -27,3 +27,5 @@ import { html, PolymerElement } from "@polymer/polymer/polymer-element.js";

static get properties() {
let props = {
return {
...super.properties,
/**

@@ -37,6 +39,2 @@ * Stores

};
if (super.properties) {
props = Object.assign(props, super.properties);
}
return props;
}

@@ -43,0 +41,0 @@ connectedCallback() {

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