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

home-assistant-styles-manager

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

home-assistant-styles-manager - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0

2

dist/esm/index.d.ts

@@ -7,2 +7,3 @@ type RootElement = Element | ShadowRoot;

namespace?: string;
throwWarnings?: boolean;
}

@@ -13,2 +14,3 @@ declare class HomeAssistantStylesManager {

private _namespace;
private _throwWarnings;
getStyleElement(root: RootElement): HTMLStyleElement | null;

@@ -15,0 +17,0 @@ addStyle(css: string | CSSInJs | CSSInJs[], root: RootElement): void;

2

dist/esm/index.js

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

var e=/([A-Z])([a-z0-9_-]+)/g,n=function(){return n=Object.assign||function(e){for(var n,t=1,r=arguments.length;t<r;t++)for(var o in n=arguments[t])Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o]);return e},n.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var t=function(n){return Object.entries(n).map((function(n){var t=n[0],r=n[1];return"".concat(function(n){return n.replace(e,(function(e,n,t,r){var o=n.toLocaleLowerCase();return r?"-".concat(o).concat(t):"--".concat(o).concat(t)}))}(t),":").concat(r)})).join(";")+";"},r=function(e){var r=Array.isArray(e)?e.reduce((function(e,t){return n(n({},e),t)}),{}):e;return Object.entries(r).map((function(e){var n=e[0],r=e[1];return!1===r?"".concat(n,"{display: none !important}"):"".concat(n,"{").concat(t(r),"}")})).join("")},o=function(e,n){return"".concat(n,"_").concat(e)},a=function(e){return e instanceof ShadowRoot?e.host.localName:e.localName},c=function(e,n){var t=o(a(e),n);return e.querySelector("#".concat(t))},i=function(){function e(e){var n,t;void 0===e&&(e={}),this._prefix=null!==(n=e.prefix)&&void 0!==n?n:"ha-styles-manager",this._namespace=null!==(t=e.namespace)&&void 0!==t?t:"home-assistant-styles-manager"}return e.prototype.getStyleElement=function(e){return c(e,this._prefix)},e.prototype.addStyle=function(e,n){!function(e,n,t,i){if(n){var s=c(n,t);if(!s){var u=o(a(n),t);(s=document.createElement("style")).setAttribute("id",u),n.appendChild(s)}s.innerHTML="string"==typeof e?e:r(e)}else console.warn("".concat(i,': no element has been provided in "addStyle"'))}(e,n,this._prefix,this._namespace)},e.prototype.removeStyle=function(e){!function(e,n,t){if(e){var r=c(e,n);r&&r.remove()}else console.warn("".concat(t,': no element has been provided in "removeStyle"'))}(e,this._prefix,this._namespace)},e}();export{i as HomeAssistantStylesManager,r as getCSSRulesString,t as getCSSString};
var n=/([A-Z])([a-z0-9_-]+)/g,e=function(){return e=Object.assign||function(n){for(var e,t=1,r=arguments.length;t<r;t++)for(var o in e=arguments[t])Object.prototype.hasOwnProperty.call(e,o)&&(n[o]=e[o]);return n},e.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var t=function(e){return Object.entries(e).map((function(e){var t=e[0],r=e[1];return"".concat(function(e){return e.replace(n,(function(n,e,t,r){var o=e.toLocaleLowerCase();return r?"-".concat(o).concat(t):"--".concat(o).concat(t)}))}(t),":").concat(r)})).join(";")+";"},r=function(n){var r=Array.isArray(n)?n.reduce((function(n,t){return e(e({},n),t)}),{}):n;return Object.entries(r).map((function(n){var e=n[0],r=n[1];return!1===r?"".concat(e,"{display: none !important}"):"".concat(e,"{").concat(t(r),"}")})).join("")},o=function(n,e){return"".concat(e,"_").concat(n)},a=function(n){return n instanceof ShadowRoot?n.host.localName:n.localName},c=function(n,e){var t=o(a(n),e);return n.querySelector("#".concat(t))},i=function(){function n(n){var e,t,r;void 0===n&&(n={}),this._prefix=null!==(e=n.prefix)&&void 0!==e?e:"ha-styles-manager",this._namespace=null!==(t=n.namespace)&&void 0!==t?t:"home-assistant-styles-manager",this._throwWarnings=null===(r=n.throwWarnings)||void 0===r||r}return n.prototype.getStyleElement=function(n){return c(n,this._prefix)},n.prototype.addStyle=function(n,e){!function(n,e,t,i,s){if(e){var l=c(e,t);if(!l){var u=o(a(e),t);(l=document.createElement("style")).setAttribute("id",u),e.appendChild(l)}l.innerHTML="string"==typeof n?n:r(n)}else s&&console.warn("".concat(i,': no element has been provided calling "addStyle"'))}(n,e,this._prefix,this._namespace,this._throwWarnings)},n.prototype.removeStyle=function(n){!function(n,e,t,r){if(n){var o=c(n,e);o?o.remove():r&&console.warn("".concat(t,': no style to remove calling "removeStyle"'))}else r&&console.warn("".concat(t,': no element has been provided calling "removeStyle"'))}(n,this._prefix,this._namespace,this._throwWarnings)},n}();export{i as HomeAssistantStylesManager,r as getCSSRulesString,t as getCSSString};

@@ -7,2 +7,3 @@ type RootElement = Element | ShadowRoot;

namespace?: string;
throwWarnings?: boolean;
}

@@ -13,2 +14,3 @@ declare class HomeAssistantStylesManager {

private _namespace;
private _throwWarnings;
getStyleElement(root: RootElement): HTMLStyleElement | null;

@@ -15,0 +17,0 @@ addStyle(css: string | CSSInJs | CSSInJs[], root: RootElement): void;

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

"use strict";var e=/([A-Z])([a-z0-9_-]+)/g,t=function(){return t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},t.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var n=function(t){return Object.entries(t).map((function(t){var n=t[0],r=t[1];return"".concat(function(t){return t.replace(e,(function(e,t,n,r){var o=t.toLocaleLowerCase();return r?"-".concat(o).concat(n):"--".concat(o).concat(n)}))}(n),":").concat(r)})).join(";")+";"},r=function(e){var r=Array.isArray(e)?e.reduce((function(e,n){return t(t({},e),n)}),{}):e;return Object.entries(r).map((function(e){var t=e[0],r=e[1];return!1===r?"".concat(t,"{display: none !important}"):"".concat(t,"{").concat(n(r),"}")})).join("")},o=function(e,t){return"".concat(t,"_").concat(e)},a=function(e){return e instanceof ShadowRoot?e.host.localName:e.localName},c=function(e,t){var n=o(a(e),t);return e.querySelector("#".concat(n))},i=function(){function e(e){var t,n;void 0===e&&(e={}),this._prefix=null!==(t=e.prefix)&&void 0!==t?t:"ha-styles-manager",this._namespace=null!==(n=e.namespace)&&void 0!==n?n:"home-assistant-styles-manager"}return e.prototype.getStyleElement=function(e){return c(e,this._prefix)},e.prototype.addStyle=function(e,t){!function(e,t,n,i){if(t){var s=c(t,n);if(!s){var u=o(a(t),n);(s=document.createElement("style")).setAttribute("id",u),t.appendChild(s)}s.innerHTML="string"==typeof e?e:r(e)}else console.warn("".concat(i,': no element has been provided in "addStyle"'))}(e,t,this._prefix,this._namespace)},e.prototype.removeStyle=function(e){!function(e,t,n){if(e){var r=c(e,t);r&&r.remove()}else console.warn("".concat(n,': no element has been provided in "removeStyle"'))}(e,this._prefix,this._namespace)},e}();exports.HomeAssistantStylesManager=i,exports.getCSSRulesString=r,exports.getCSSString=n;
"use strict";var n=/([A-Z])([a-z0-9_-]+)/g,t=function(){return t=Object.assign||function(n){for(var t,e=1,r=arguments.length;e<r;e++)for(var o in t=arguments[e])Object.prototype.hasOwnProperty.call(t,o)&&(n[o]=t[o]);return n},t.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError;var e=function(t){return Object.entries(t).map((function(t){var e=t[0],r=t[1];return"".concat(function(t){return t.replace(n,(function(n,t,e,r){var o=t.toLocaleLowerCase();return r?"-".concat(o).concat(e):"--".concat(o).concat(e)}))}(e),":").concat(r)})).join(";")+";"},r=function(n){var r=Array.isArray(n)?n.reduce((function(n,e){return t(t({},n),e)}),{}):n;return Object.entries(r).map((function(n){var t=n[0],r=n[1];return!1===r?"".concat(t,"{display: none !important}"):"".concat(t,"{").concat(e(r),"}")})).join("")},o=function(n,t){return"".concat(t,"_").concat(n)},a=function(n){return n instanceof ShadowRoot?n.host.localName:n.localName},c=function(n,t){var e=o(a(n),t);return n.querySelector("#".concat(e))},i=function(){function n(n){var t,e,r;void 0===n&&(n={}),this._prefix=null!==(t=n.prefix)&&void 0!==t?t:"ha-styles-manager",this._namespace=null!==(e=n.namespace)&&void 0!==e?e:"home-assistant-styles-manager",this._throwWarnings=null===(r=n.throwWarnings)||void 0===r||r}return n.prototype.getStyleElement=function(n){return c(n,this._prefix)},n.prototype.addStyle=function(n,t){!function(n,t,e,i,s){if(t){var l=c(t,e);if(!l){var u=o(a(t),e);(l=document.createElement("style")).setAttribute("id",u),t.appendChild(l)}l.innerHTML="string"==typeof n?n:r(n)}else s&&console.warn("".concat(i,': no element has been provided calling "addStyle"'))}(n,t,this._prefix,this._namespace,this._throwWarnings)},n.prototype.removeStyle=function(n){!function(n,t,e,r){if(n){var o=c(n,t);o?o.remove():r&&console.warn("".concat(e,': no style to remove calling "removeStyle"'))}else r&&console.warn("".concat(e,': no element has been provided calling "removeStyle"'))}(n,this._prefix,this._namespace,this._throwWarnings)},n}();exports.HomeAssistantStylesManager=i,exports.getCSSRulesString=r,exports.getCSSString=e;
{
"name": "home-assistant-styles-manager",
"version": "2.0.0",
"version": "3.0.0",
"description": "Manage Home Assistant styles per DOM elements",

@@ -5,0 +5,0 @@ "keywords": [

@@ -43,6 +43,7 @@ # home-assistant-styles-manager

| Parameter | Optional | Description |
| -------------- | ------------- | --------------------------------------------------- |
| prefix | yes | prefix that will be used for the styles ids |
| namespace | yes | namespace that will be used for the warnings |
| Parameter | Optional | Default | Description |
| -------------- | ------------- | ------------------------------- | --------------------------------------------------- |
| prefix | yes | `ha-styles-manager` | prefix that will be used for the styles ids |
| namespace | yes | `home-assistant-styles-manager` | namespace that will be used for the warnings |
| throwWarnings | yes | true | indicates if the library should throw warnings |

@@ -65,3 +66,3 @@ ### Public methods

addStyle(
css: | CSSInJs | CSSInJs[],
css: string | CSSInJs | CSSInJs[],
root: HTMLElement | ShadowRoot

@@ -71,3 +72,3 @@ ): void

The `css` property can be a CSS string but also a CSS-in-JS object or an array of CSS-in-JS objects. Any rule with a `false` value will be get hidden.
The `css` property can be a CSS string but also a CSS-in-JS object or an array of CSS-in-JS objects. Any rule with a `false` value will get hidden.

@@ -74,0 +75,0 @@ For eaxample, the next CSS-in-JS object:

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