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 3.0.0 to 3.1.0

4

dist/esm/index.d.ts

@@ -15,8 +15,8 @@ type RootElement = Element | ShadowRoot;

getStyleElement(root: RootElement): HTMLStyleElement | null;
addStyle(css: string | CSSInJs | CSSInJs[], root: RootElement): void;
addStyle(css: string | CSSInJs | (string | CSSInJs)[], root: RootElement): void;
removeStyle(root: RootElement): void;
}
declare const getCSSString: (cssInJs: DeclarationTree) => string;
declare const getCSSRulesString: (cssRulesInJs: CSSInJs | CSSInJs[]) => string;
declare const getCSSRulesString: (cssRulesInJs: CSSInJs | (string | CSSInJs)[]) => string;
export { HomeAssistantStylesManager, getCSSRulesString, getCSSString };
export type { RootElement, CSSInJs };

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

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

@@ -15,8 +15,8 @@ type RootElement = Element | ShadowRoot;

getStyleElement(root: RootElement): HTMLStyleElement | null;
addStyle(css: string | CSSInJs | CSSInJs[], root: RootElement): void;
addStyle(css: string | CSSInJs | (string | CSSInJs)[], root: RootElement): void;
removeStyle(root: RootElement): void;
}
declare const getCSSString: (cssInJs: DeclarationTree) => string;
declare const getCSSRulesString: (cssRulesInJs: CSSInJs | CSSInJs[]) => string;
declare const getCSSRulesString: (cssRulesInJs: CSSInJs | (string | CSSInJs)[]) => string;
export { HomeAssistantStylesManager, getCSSRulesString, getCSSString };
export type { RootElement, CSSInJs };

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

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

@@ -54,4 +54,4 @@ "keywords": [

"@types/jest": "^29.5.14",
"@types/node": "^22.5.4",
"eslint": "^9.10.0",
"@types/node": "^22.9.3",
"eslint": "^9.15.0",
"eslint-plugin-jest": "^28.8.3",

@@ -61,9 +61,9 @@ "globals": "^15.9.0",

"jest-environment-jsdom": "^29.7.0",
"rollup": "4.21.2",
"rollup": "4.27.4",
"rollup-plugin-ts": "^3.4.5",
"ts-jest": "^29.2.5",
"tslib": "^2.8.1",
"typescript": "^5.6.2",
"typescript-eslint": "^8.4.0"
"typescript": "^5.7.2",
"typescript-eslint": "^8.15.0"
}
}

@@ -65,3 +65,3 @@ # home-assistant-styles-manager

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

@@ -71,3 +71,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 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 and strings. Any rule with a `false` value will get hidden.

@@ -74,0 +74,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