New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ha-template

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ha-template - npm Package Compare versions

Comparing version

to
1.2.2

8

dist/index.d.ts
import { HomeAssistant } from 'custom-card-helpers';
import { LitElement, nothing } from 'lit';
import { LitElement, TemplateResult, nothing } from 'lit';
type Template = TemplateResult | string | typeof nothing;
export declare class HATemplate extends LitElement {

@@ -11,4 +12,5 @@ hass: HomeAssistant;

disconnectedCallback(): Promise<void>;
protected render(): string | typeof nothing;
protected render(): Template;
}
export default function register(component?: string): void;
export default function register(componentName?: string): void;
export {};

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

import{LitElement as e,nothing as t}from"lit";import{property as s,customElement as r}from"lit/decorators.js";function o(e,t,s,r){var o,i=arguments.length,a=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,s,r);else for(var n=e.length-1;n>=0;n--)(o=e[n])&&(a=(i<3?o(a):i>3?o(t,s,a):o(t,s))||a);return i>3&&a&&Object.defineProperty(t,s,a),a}let i=class extends e{constructor(){super(...arguments),this.template="",this.variables={},this.value=null,this.unsubscribePromise=null}connectedCallback(){super.connectedCallback(),this.hass?this.unsubscribePromise||this.template&&(this.unsubscribePromise=this.hass.connection.subscribeMessage((e=>{this.value=e.result}),{type:"render_template",template:this.template,variables:this.variables})):console.warn("hass object is not provided")}async disconnectedCallback(){if(super.disconnectedCallback(),this.unsubscribePromise)try{const e=await this.unsubscribePromise;return this.unsubscribePromise=null,e()}catch(e){if("not_found"!==e.code)throw e}}render(){var e;return null!==(e=this.value)&&void 0!==e?e:t}};function a(e="ha-template"){customElements.get(e)||customElements.define(e,i)}o([s()],i.prototype,"hass",void 0),o([s()],i.prototype,"template",void 0),o([s()],i.prototype,"variables",void 0),o([s()],i.prototype,"value",void 0),o([s({attribute:!1})],i.prototype,"unsubscribePromise",void 0),i=o([r("ha-template")],i);export{i as HATemplate,a as default};
import{LitElement as e,nothing as t}from"lit";import{property as s,state as r}from"lit/decorators.js";function o(e,t,s,r){var o,i=arguments.length,n=i<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,s):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,s,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(n=(i<3?o(n):i>3?o(t,s,n):o(t,s))||n);return i>3&&n&&Object.defineProperty(t,s,n),n}class i extends e{constructor(){super(...arguments),this.template="",this.variables={},this.value=null,this.unsubscribePromise=null}connectedCallback(){super.connectedCallback(),this.hass?this.unsubscribePromise||this.template&&(this.unsubscribePromise=this.hass.connection.subscribeMessage((e=>{this.value=e.result}),{type:"render_template",template:this.template,variables:this.variables})):console.warn("hass object is not provided")}async disconnectedCallback(){if(super.disconnectedCallback(),this.unsubscribePromise)try{const e=await this.unsubscribePromise;return this.unsubscribePromise=null,e()}catch(e){if("not_found"!==e.code)throw e}}render(){var e;return null!==(e=this.value)&&void 0!==e?e:t}}function n(e="ha-template"){customElements.get(e)||customElements.define(e,i)}o([s()],i.prototype,"hass",void 0),o([s()],i.prototype,"template",void 0),o([s()],i.prototype,"variables",void 0),o([s()],i.prototype,"value",void 0),o([r()],i.prototype,"unsubscribePromise",void 0);export{i as HATemplate,n as default};
{
"name": "ha-template",
"version": "1.2.1",
"version": "1.2.2",
"description": "A tiny (<2kB) lit component for rendering templates in Home Assistant custom cards",

@@ -5,0 +5,0 @@ "main": "dist/index.js",