Add and fix stylistic eslint rules (#23735)

* Fix stylistic eslint rules

* Fix eslint issues
pull/23737/head^2
Wendelin 2025-01-14 21:00:14 +01:00 committed by GitHub
parent 69a93ddb6e
commit e703750136
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
582 changed files with 12485 additions and 13451 deletions

View File

@ -3,7 +3,7 @@ import "@material/mwc-list/mwc-list";
import type { ActionDetail } from "@material/mwc-list/mwc-list"; import type { ActionDetail } from "@material/mwc-list/mwc-list";
import { mdiCast, mdiCastConnected, mdiViewDashboard } from "@mdi/js"; import { mdiCast, mdiCastConnected, mdiViewDashboard } from "@mdi/js";
import type { Auth, Connection } from "home-assistant-js-websocket"; import type { Auth, Connection } from "home-assistant-js-websocket";
import type { CSSResultGroup, TemplateResult } from "lit"; import type { TemplateResult } from "lit";
import { LitElement, css, html } from "lit"; import { LitElement, css, html } from "lit";
import { customElement, property, state } from "lit/decorators"; import { customElement, property, state } from "lit/decorators";
import type { CastManager } from "../../../../src/cast/cast_manager"; import type { CastManager } from "../../../../src/cast/cast_manager";
@ -208,8 +208,7 @@ class HcCast extends LitElement {
} }
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
.center-item { .center-item {
display: flex; display: flex;
justify-content: space-around; justify-content: space-around;
@ -270,7 +269,6 @@ class HcCast extends LitElement {
color: var(--primary-color); color: var(--primary-color);
} }
`; `;
}
} }
declare global { declare global {

View File

@ -13,7 +13,7 @@ import {
ERR_INVALID_HTTPS_TO_HTTP, ERR_INVALID_HTTPS_TO_HTTP,
getAuth, getAuth,
} from "home-assistant-js-websocket"; } from "home-assistant-js-websocket";
import type { CSSResultGroup, TemplateResult } from "lit"; import type { TemplateResult } from "lit";
import { css, html, LitElement } from "lit"; import { css, html, LitElement } from "lit";
import { customElement, state } from "lit/decorators"; import { customElement, state } from "lit/decorators";
import type { CastManager } from "../../../../src/cast/cast_manager"; import type { CastManager } from "../../../../src/cast/cast_manager";
@ -293,8 +293,7 @@ export class HcConnect extends LitElement {
} }
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
.card-content a { .card-content a {
color: var(--primary-color); color: var(--primary-color);
} }
@ -322,7 +321,6 @@ export class HcConnect extends LitElement {
width: 100%; width: 100%;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -1,6 +1,6 @@
import type { Auth, Connection, HassUser } from "home-assistant-js-websocket"; import type { Auth, Connection, HassUser } from "home-assistant-js-websocket";
import { getUser } from "home-assistant-js-websocket"; import { getUser } from "home-assistant-js-websocket";
import type { CSSResultGroup, TemplateResult } from "lit"; import type { TemplateResult } from "lit";
import { css, html, LitElement } from "lit"; import { css, html, LitElement } from "lit";
import { customElement, property } from "lit/decorators"; import { customElement, property } from "lit/decorators";
import "../../../../src/components/ha-card"; import "../../../../src/components/ha-card";
@ -63,8 +63,7 @@ class HcLayout extends LitElement {
} }
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
:host { :host {
display: flex; display: flex;
min-height: 100%; min-height: 100%;
@ -152,7 +151,6 @@ class HcLayout extends LitElement {
} }
} }
`; `;
}
} }
declare global { declare global {

View File

@ -1,4 +1,4 @@
import type { CSSResultGroup, TemplateResult } from "lit"; import type { TemplateResult } from "lit";
import { css, html, LitElement } from "lit"; import { css, html, LitElement } from "lit";
import { customElement, property } from "lit/decorators"; import { customElement, property } from "lit/decorators";
import type { HomeAssistant } from "../../../../src/types"; import type { HomeAssistant } from "../../../../src/types";
@ -24,8 +24,7 @@ class HcLaunchScreen extends LitElement {
`; `;
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
:host { :host {
display: block; display: block;
height: 100vh; height: 100vh;
@ -48,7 +47,6 @@ class HcLaunchScreen extends LitElement {
color: #1d2126; color: #1d2126;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -1,10 +1,4 @@
import { import { css, html, LitElement, type TemplateResult } from "lit";
css,
type CSSResultGroup,
html,
LitElement,
type TemplateResult,
} from "lit";
import { customElement, property } from "lit/decorators"; import { customElement, property } from "lit/decorators";
import { fireEvent } from "../../../../src/common/dom/fire_event"; import { fireEvent } from "../../../../src/common/dom/fire_event";
import type { LovelaceConfig } from "../../../../src/data/lovelace/config/types"; import type { LovelaceConfig } from "../../../../src/data/lovelace/config/types";
@ -117,8 +111,7 @@ class HcLovelace extends LitElement {
return undefined; return undefined;
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
hui-view-container { hui-view-container {
display: flex; display: flex;
position: relative; position: relative;
@ -130,7 +123,6 @@ class HcLovelace extends LitElement {
max-width: 100%; max-width: 100%;
} }
`; `;
}
} }
export interface CastViewChanged { export interface CastViewChanged {

View File

@ -3,7 +3,7 @@ import type { Lovelace } from "../../../src/panels/lovelace/types";
import { energyEntities } from "../stubs/entities"; import { energyEntities } from "../stubs/entities";
import type { DemoConfig } from "./types"; import type { DemoConfig } from "./types";
export const demoConfigs: Array<() => Promise<DemoConfig>> = [ export const demoConfigs: (() => Promise<DemoConfig>)[] = [
() => import("./sections").then((mod) => mod.demoSections), () => import("./sections").then((mod) => mod.demoSections),
() => import("./arsaboo").then((mod) => mod.demoArsaboo), () => import("./arsaboo").then((mod) => mod.demoArsaboo),
() => import("./teachingbirds").then((mod) => mod.demoTeachingbirds), () => import("./teachingbirds").then((mod) => mod.demoTeachingbirds),

View File

@ -1,5 +1,4 @@
import { mdiTelevision } from "@mdi/js"; import { mdiTelevision } from "@mdi/js";
import type { CSSResultGroup } from "lit";
import { css, html, LitElement, nothing } from "lit"; import { css, html, LitElement, nothing } from "lit";
import { customElement, state } from "lit/decorators"; import { customElement, state } from "lit/decorators";
import type { CastManager } from "../../../src/cast/cast_manager"; import type { CastManager } from "../../../src/cast/cast_manager";
@ -67,8 +66,7 @@ class CastDemoRow extends LitElement implements LovelaceRow {
this.style.display = this._castManager ? "" : "none"; this.style.display = this._castManager ? "" : "none";
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
:host { :host {
display: flex; display: flex;
align-items: center; align-items: center;
@ -97,7 +95,6 @@ class CastDemoRow extends LitElement implements LovelaceRow {
width: 24px; width: 24px;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -32,6 +32,7 @@ export class HADemoCard extends LitElement implements LovelaceCard {
return this._hidden ? 0 : 2; return this._hidden ? 0 : 2;
} }
// eslint-disable-next-line @typescript-eslint/no-empty-function
public setConfig(_config: LovelaceCardConfig) {} public setConfig(_config: LovelaceCardConfig) {}
protected render() { protected render() {

View File

@ -131,6 +131,7 @@ export const mockHistory = (mockHass: MockHomeAssistant) => {
}); });
}, 1); }, 1);
// eslint-disable-next-line @typescript-eslint/no-empty-function
return () => {}; return () => {};
} }
); );

View File

@ -15,6 +15,7 @@ export const mockPersistentNotification = (hass: MockHomeAssistant) => {
}, },
}, },
} as PersistentNotificationMessage); } as PersistentNotificationMessage);
// eslint-disable-next-line @typescript-eslint/no-empty-function
return () => {}; return () => {};
}); });
}; };

View File

@ -11,6 +11,7 @@ export const mockTemplate = (hass: MockHomeAssistant) => {
result: msg.template, result: msg.template,
listeners: { all: false, domains: [], entities: [], time: false }, listeners: { all: false, domains: [], entities: [], time: false },
}); });
// eslint-disable-next-line @typescript-eslint/no-empty-function
return () => {}; return () => {};
}); });
}; };

View File

@ -22,5 +22,6 @@ export const mockTodo = (hass: MockHomeAssistant) => {
}, },
] as TodoItem[], ] as TodoItem[],
})); }));
// eslint-disable-next-line @typescript-eslint/no-empty-function
hass.mockWS("todo/item/subscribe", (_msg, _hass) => () => {}); hass.mockWS("todo/item/subscribe", (_msg, _hass) => () => {});
}; };

View File

@ -20,6 +20,7 @@ export default [
"airbnb-base", "airbnb-base",
"plugin:@typescript-eslint/recommended", "plugin:@typescript-eslint/recommended",
"plugin:@typescript-eslint/strict", "plugin:@typescript-eslint/strict",
"plugin:@typescript-eslint/stylistic",
"plugin:wc/recommended", "plugin:wc/recommended",
"plugin:lit/all", "plugin:lit/all",
"plugin:lit-a11y/recommended", "plugin:lit-a11y/recommended",

View File

@ -177,8 +177,7 @@ export class DemoAutomationDescribeAction extends LitElement {
this._action = ev.detail.isValid ? ev.detail.value : undefined; this._action = ev.detail.isValid ? ev.detail.value : undefined;
} }
static get styles() { static styles = css`
return css`
ha-card { ha-card {
max-width: 600px; max-width: 600px;
margin: 24px auto; margin: 24px auto;
@ -196,7 +195,6 @@ export class DemoAutomationDescribeAction extends LitElement {
width: 50%; width: 50%;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -98,8 +98,7 @@ export class DemoAutomationDescribeCondition extends LitElement {
this._condition = ev.detail.isValid ? ev.detail.value : undefined; this._condition = ev.detail.isValid ? ev.detail.value : undefined;
} }
static get styles() { static styles = css`
return css`
ha-card { ha-card {
max-width: 600px; max-width: 600px;
margin: 24px auto; margin: 24px auto;
@ -117,7 +116,6 @@ export class DemoAutomationDescribeCondition extends LitElement {
width: 50%; width: 50%;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -121,8 +121,7 @@ export class DemoAutomationDescribeTrigger extends LitElement {
this._trigger = ev.detail.isValid ? ev.detail.value : undefined; this._trigger = ev.detail.isValid ? ev.detail.value : undefined;
} }
static get styles() { static styles = css`
return css`
ha-card { ha-card {
max-width: 600px; max-width: 600px;
margin: 24px auto; margin: 24px auto;
@ -140,7 +139,6 @@ export class DemoAutomationDescribeTrigger extends LitElement {
width: 50%; width: 50%;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -58,8 +58,7 @@ export class DemoAutomationTraceTimeline extends LitElement {
hass.updateTranslations("config", "en"); hass.updateTranslations("config", "en");
} }
static get styles() { static styles = css`
return css`
ha-card { ha-card {
max-width: 600px; max-width: 600px;
margin: 24px; margin: 24px;
@ -73,7 +72,6 @@ export class DemoAutomationTraceTimeline extends LitElement {
right: 0; right: 0;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -68,8 +68,7 @@ export class DemoAutomationTrace extends LitElement {
this._selected = { ...this._selected, [sampleIdx]: ev.detail.path }; this._selected = { ...this._selected, [sampleIdx]: ev.detail.path };
} }
static get styles() { static styles = css`
return css`
ha-card { ha-card {
max-width: 600px; max-width: 600px;
margin: 24px; margin: 24px;
@ -89,7 +88,6 @@ export class DemoAutomationTrace extends LitElement {
right: 0; right: 0;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -177,8 +177,7 @@ export class DemoHaAlert extends LitElement {
); );
} }
static get styles() { static styles = css`
return css`
:host { :host {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -216,7 +215,6 @@ export class DemoHaAlert extends LitElement {
--mdc-theme-primary: var(--primary-text-color); --mdc-theme-primary: var(--primary-text-color);
} }
`; `;
}
} }
declare global { declare global {

View File

@ -63,8 +63,7 @@ export class DemoHaBar extends LitElement {
`; `;
} }
static get styles() { static styles = css`
return css`
ha-card { ha-card {
max-width: 600px; max-width: 600px;
margin: 24px auto; margin: 24px auto;
@ -76,7 +75,6 @@ export class DemoHaBar extends LitElement {
--ha-bar-primary-color: var(--error-color); --ha-bar-primary-color: var(--error-color);
} }
`; `;
}
} }
declare global { declare global {

View File

@ -103,8 +103,7 @@ export class DemoHaChips extends LitElement {
`; `;
} }
static get styles() { static styles = css`
return css`
ha-card { ha-card {
max-width: 600px; max-width: 600px;
margin: 24px auto; margin: 24px auto;
@ -115,7 +114,6 @@ export class DemoHaChips extends LitElement {
align-items: flex-start; align-items: flex-start;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -48,14 +48,12 @@ export class DemoHaCircularProgress extends LitElement {
></ha-card>`; ></ha-card>`;
} }
static get styles() { static styles = css`
return css`
ha-card { ha-card {
max-width: 600px; max-width: 600px;
margin: 24px auto; margin: 24px auto;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -14,12 +14,12 @@ import "../../../../src/components/ha-card";
import "../../../../src/components/ha-svg-icon"; import "../../../../src/components/ha-svg-icon";
import "../../../../src/components/ha-control-button-group"; import "../../../../src/components/ha-control-button-group";
type Button = { interface Button {
label: string; label: string;
icon?: string; icon?: string;
class?: string; class?: string;
disabled?: boolean; disabled?: boolean;
}; }
const buttons: Button[] = [ const buttons: Button[] = [
{ {
@ -35,10 +35,10 @@ const buttons: Button[] = [
}, },
]; ];
type ButtonGroup = { interface ButtonGroup {
vertical?: boolean; vertical?: boolean;
class?: string; class?: string;
}; }
const buttonGroups: ButtonGroup[] = [ const buttonGroups: ButtonGroup[] = [
{}, {},
@ -137,8 +137,7 @@ export class DemoHaBarButton extends LitElement {
`; `;
} }
static get styles() { static styles = css`
return css`
ha-card { ha-card {
max-width: 600px; max-width: 600px;
margin: 24px auto; margin: 24px auto;
@ -183,7 +182,6 @@ export class DemoHaBarButton extends LitElement {
margin-right: 4px; margin-right: 4px;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -133,8 +133,7 @@ export class DemoHaCircularSlider extends LitElement {
`; `;
} }
static get styles() { static styles = css`
return css`
ha-card { ha-card {
max-width: 600px; max-width: 600px;
margin: 24px auto; margin: 24px auto;
@ -165,7 +164,6 @@ export class DemoHaCircularSlider extends LitElement {
align-items: center; align-items: center;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -73,8 +73,7 @@ export class DemoHarControlNumberButtons extends LitElement {
`; `;
} }
static get styles() { static styles = css`
return css`
ha-card { ha-card {
max-width: 600px; max-width: 600px;
margin: 24px auto; margin: 24px auto;
@ -98,7 +97,6 @@ export class DemoHarControlNumberButtons extends LitElement {
--control-number-buttons-border-radius: 36px; --control-number-buttons-border-radius: 36px;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -8,19 +8,19 @@ import "../../../../src/components/ha-control-select-menu";
import "../../../../src/components/ha-list-item"; import "../../../../src/components/ha-list-item";
import "../../../../src/components/ha-svg-icon"; import "../../../../src/components/ha-svg-icon";
type SelectMenuOptions = { interface SelectMenuOptions {
label: string; label: string;
value: string; value: string;
icon?: string; icon?: string;
}; }
type SelectMenu = { interface SelectMenu {
label: string; label: string;
icon: string; icon: string;
class?: string; class?: string;
disabled?: boolean; disabled?: boolean;
options: SelectMenuOptions[]; options: SelectMenuOptions[];
}; }
const selects: SelectMenu[] = [ const selects: SelectMenu[] = [
{ {
@ -112,8 +112,7 @@ export class DemoHaControlSelectMenu extends LitElement {
`; `;
} }
static get styles() { static styles = css`
return css`
ha-card { ha-card {
max-width: 600px; max-width: 600px;
margin: 24px auto; margin: 24px auto;
@ -137,7 +136,6 @@ export class DemoHaControlSelectMenu extends LitElement {
width: 100px; width: 100px;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -168,8 +168,7 @@ export class DemoHaControlSelect extends LitElement {
`; `;
} }
static get styles() { static styles = css`
return css`
ha-card { ha-card {
max-width: 600px; max-width: 600px;
margin: 24px auto; margin: 24px auto;
@ -203,7 +202,6 @@ export class DemoHaControlSelect extends LitElement {
margin-right: 4px; margin-right: 4px;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -131,8 +131,7 @@ export class DemoHaBarSlider extends LitElement {
`; `;
} }
static get styles() { static styles = css`
return css`
ha-card { ha-card {
max-width: 600px; max-width: 600px;
margin: 24px auto; margin: 24px auto;
@ -167,7 +166,6 @@ export class DemoHaBarSlider extends LitElement {
margin-right: 4px; margin-right: 4px;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -99,8 +99,7 @@ export class DemoHaControlSwitch extends LitElement {
`; `;
} }
static get styles() { static styles = css`
return css`
ha-card { ha-card {
max-width: 600px; max-width: 600px;
margin: 24px auto; margin: 24px auto;
@ -136,7 +135,6 @@ export class DemoHaControlSwitch extends LitElement {
margin-right: 4px; margin-right: 4px;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -143,13 +143,11 @@ export class DemoHaExpansionPanel extends LitElement {
`; `;
} }
static get styles() { static styles = css`
return css`
ha-expansion-panel { ha-expansion-panel {
margin: -16px; margin: -16px;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -61,14 +61,12 @@ export class DemoHaFaded extends LitElement {
`; `;
} }
static get styles() { static styles = css`
return css`
ha-card { ha-card {
max-width: 600px; max-width: 600px;
margin: 24px auto; margin: 24px auto;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -91,8 +91,7 @@ export class DemoHaHsColorPicker extends LitElement {
`; `;
} }
static get styles() { static styles = css`
return css`
ha-card { ha-card {
max-width: 600px; max-width: 600px;
margin: 24px auto; margin: 24px auto;
@ -111,7 +110,6 @@ export class DemoHaHsColorPicker extends LitElement {
margin: 0 0 12px 0; margin: 0 0 12px 0;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -95,8 +95,7 @@ export class DemoHaLabelBadge extends LitElement {
`; `;
} }
static get styles() { static styles = css`
return css`
ha-card { ha-card {
max-width: 600px; max-width: 600px;
margin: 24px auto; margin: 24px auto;
@ -113,7 +112,6 @@ export class DemoHaLabelBadge extends LitElement {
align-items: center; align-items: center;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -48,8 +48,7 @@ export class DemoHaTip extends LitElement {
); );
} }
static get styles() { static styles = css`
return css`
:host { :host {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -68,7 +67,6 @@ export class DemoHaTip extends LitElement {
margin: 24px auto; margin: 24px auto;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -100,8 +100,7 @@ export class DemoDateTimeDateTimeNumeric extends LitElement {
`; `;
} }
static get styles() { static styles = css`
return css`
ha-control-select { ha-control-select {
max-width: 800px; max-width: 800px;
margin: 12px auto; margin: 12px auto;
@ -125,7 +124,6 @@ export class DemoDateTimeDateTimeNumeric extends LitElement {
width: 20%; width: 20%;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -100,8 +100,7 @@ export class DemoDateTimeDateTimeSeconds extends LitElement {
`; `;
} }
static get styles() { static styles = css`
return css`
ha-control-select { ha-control-select {
max-width: 800px; max-width: 800px;
margin: 12px auto; margin: 12px auto;
@ -125,7 +124,6 @@ export class DemoDateTimeDateTimeSeconds extends LitElement {
width: 20%; width: 20%;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -100,8 +100,7 @@ export class DemoDateTimeDateTimeShortYear extends LitElement {
`; `;
} }
static get styles() { static styles = css`
return css`
ha-control-select { ha-control-select {
max-width: 800px; max-width: 800px;
margin: 12px auto; margin: 12px auto;
@ -125,7 +124,6 @@ export class DemoDateTimeDateTimeShortYear extends LitElement {
width: 20%; width: 20%;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -100,8 +100,7 @@ export class DemoDateTimeDateTimeShort extends LitElement {
`; `;
} }
static get styles() { static styles = css`
return css`
ha-control-select { ha-control-select {
max-width: 800px; max-width: 800px;
margin: 12px auto; margin: 12px auto;
@ -125,7 +124,6 @@ export class DemoDateTimeDateTimeShort extends LitElement {
width: 20%; width: 20%;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -100,8 +100,7 @@ export class DemoDateTimeDateTime extends LitElement {
`; `;
} }
static get styles() { static styles = css`
return css`
ha-control-select { ha-control-select {
max-width: 800px; max-width: 800px;
margin: 12px auto; margin: 12px auto;
@ -125,7 +124,6 @@ export class DemoDateTimeDateTime extends LitElement {
width: 20%; width: 20%;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -90,8 +90,7 @@ export class DemoDateTimeDate extends LitElement {
`; `;
} }
static get styles() { static styles = css`
return css`
.header { .header {
font-weight: bold; font-weight: bold;
} }
@ -111,7 +110,6 @@ export class DemoDateTimeDate extends LitElement {
width: 20%; width: 20%;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -100,8 +100,7 @@ export class DemoDateTimeTimeSeconds extends LitElement {
`; `;
} }
static get styles() { static styles = css`
return css`
ha-control-select { ha-control-select {
max-width: 800px; max-width: 800px;
margin: 12px auto; margin: 12px auto;
@ -125,7 +124,6 @@ export class DemoDateTimeTimeSeconds extends LitElement {
width: 20%; width: 20%;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -100,8 +100,7 @@ export class DemoDateTimeTimeWeekday extends LitElement {
`; `;
} }
static get styles() { static styles = css`
return css`
ha-control-select { ha-control-select {
max-width: 800px; max-width: 800px;
margin: 12px auto; margin: 12px auto;
@ -125,7 +124,6 @@ export class DemoDateTimeTimeWeekday extends LitElement {
width: 20%; width: 20%;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -100,8 +100,7 @@ export class DemoDateTimeTime extends LitElement {
`; `;
} }
static get styles() { static styles = css`
return css`
ha-control-select { ha-control-select {
max-width: 800px; max-width: 800px;
margin: 12px auto; margin: 12px auto;
@ -125,7 +124,6 @@ export class DemoDateTimeTime extends LitElement {
width: 20%; width: 20%;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -321,13 +321,13 @@ function createEntity(
}; };
} }
type EntityRowData = { interface EntityRowData {
stateObj: HassEntity; stateObj: HassEntity;
entity_id: string; entity_id: string;
state: string; state: string;
device_class?: string; device_class?: string;
domain: string; domain: string;
}; }
function createRowData(stateObj: HassEntity): EntityRowData { function createRowData(stateObj: HassEntity): EntityRowData {
return { return {
@ -429,8 +429,7 @@ export class DemoEntityState extends LitElement {
`; `;
} }
static get styles() { static styles = css`
return css`
.color { .color {
display: block; display: block;
height: 20px; height: 20px;
@ -439,7 +438,6 @@ export class DemoEntityState extends LitElement {
background-color: rgb(--color); background-color: rgb(--color);
} }
`; `;
}
} }
declare global { declare global {

View File

@ -76,14 +76,12 @@ export class DemoMiscMarkdown extends LitElement {
`; `;
} }
static get styles() { static styles = css`
return css`
ha-card { ha-card {
margin: 12px; margin: 12px;
padding: 12px; padding: 12px;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -135,12 +135,12 @@ const configFlows: DataEntryFlowProgressExtended[] = [
}, },
]; ];
const configEntries: Array<{ const configEntries: {
items: ConfigEntryExtended[]; items: ConfigEntryExtended[];
is_custom?: boolean; is_custom?: boolean;
disabled?: boolean; disabled?: boolean;
highlight?: string; highlight?: string;
}> = [ }[] = [
{ items: [loadedEntry] }, { items: [loadedEntry] },
{ items: [configPanelEntry] }, { items: [configPanelEntry] },
{ items: [optionsFlowEntry] }, { items: [optionsFlowEntry] },
@ -349,8 +349,7 @@ export class DemoIntegrationCard extends LitElement {
this.isCloud = !this.isCloud; this.isCloud = !this.isCloud;
} }
static get styles() { static styles = css`
return css`
.container { .container {
display: grid; display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
@ -368,7 +367,6 @@ export class DemoIntegrationCard extends LitElement {
display: block; display: block;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -1,7 +1,7 @@
import type { ActionDetail } from "@material/mwc-list/mwc-list-foundation"; import type { ActionDetail } from "@material/mwc-list/mwc-list-foundation";
import "@material/mwc-list/mwc-list-item"; import "@material/mwc-list/mwc-list-item";
import { mdiDotsVertical } from "@mdi/js"; import { mdiDotsVertical } from "@mdi/js";
import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; import type { PropertyValues, TemplateResult } from "lit";
import { css, html, LitElement, nothing } from "lit"; import { css, html, LitElement, nothing } from "lit";
import { customElement, property, state } from "lit/decorators"; import { customElement, property, state } from "lit/decorators";
import memoizeOne from "memoize-one"; import memoizeOne from "memoize-one";
@ -211,8 +211,7 @@ export class HassioAddonStore extends LitElement {
this._filter = e.detail.value; this._filter = e.detail.value;
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
hassio-addon-repository { hassio-addon-repository {
margin-top: 24px; margin-top: 24px;
} }
@ -239,7 +238,6 @@ export class HassioAddonStore extends LitElement {
color: var(--primary-color); color: var(--primary-color);
} }
`; `;
}
} }
declare global { declare global {

View File

@ -299,7 +299,7 @@ class HassioAddonConfig extends LitElement {
if (this.addon.schema && this._canShowSchema && !this._yamlMode) { if (this.addon.schema && this._canShowSchema && !this._yamlMode) {
this._valid = true; this._valid = true;
this._configHasChanged = true; this._configHasChanged = true;
this._options! = ev.detail.value; this._options = ev.detail.value;
} else { } else {
this._configHasChanged = true; this._configHasChanged = true;
this._valid = ev.detail.isValid; this._valid = ev.detail.isValid;

View File

@ -151,7 +151,7 @@ class HassioAddonNetwork extends LitElement {
private async _configChanged(ev: CustomEvent): Promise<void> { private async _configChanged(ev: CustomEvent): Promise<void> {
this._configHasChanged = true; this._configHasChanged = true;
this._config! = ev.detail.value; this._config = ev.detail.value;
} }
private async _resetTapped(ev: CustomEvent): Promise<void> { private async _resetTapped(ev: CustomEvent): Promise<void> {

View File

@ -1,5 +1,5 @@
import { mdiHelpCircle } from "@mdi/js"; import { mdiHelpCircle } from "@mdi/js";
import type { CSSResultGroup, TemplateResult } from "lit"; import type { TemplateResult } from "lit";
import { css, html, LitElement } from "lit"; import { css, html, LitElement } from "lit";
import { customElement, property } from "lit/decorators"; import { customElement, property } from "lit/decorators";
import "../../../src/components/ha-svg-icon"; import "../../../src/components/ha-svg-icon";
@ -64,8 +64,7 @@ class HassioCardContent extends LitElement {
`; `;
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
:host { :host {
direction: ltr; direction: ltr;
} }
@ -143,7 +142,6 @@ class HassioCardContent extends LitElement {
background-color: var(--error-color); background-color: var(--error-color);
} }
`; `;
}
} }
declare global { declare global {

View File

@ -1,5 +1,5 @@
import { mdiFolder, mdiPuzzle } from "@mdi/js"; import { mdiFolder, mdiPuzzle } from "@mdi/js";
import type { CSSResultGroup, TemplateResult } from "lit"; import type { TemplateResult } from "lit";
import { LitElement, css, html, nothing } from "lit"; import { LitElement, css, html, nothing } from "lit";
import { customElement, property, query } from "lit/decorators"; import { customElement, property, query } from "lit/decorators";
import { atLeastVersion } from "../../../src/common/config/version"; import { atLeastVersion } from "../../../src/common/config/version";
@ -283,8 +283,7 @@ export class SupervisorBackupContent extends LitElement {
this.homeAssistant = !this.homeAssistant; this.homeAssistant = !this.homeAssistant;
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
.partial-picker ha-formfield { .partial-picker ha-formfield {
display: block; display: block;
} }
@ -328,7 +327,6 @@ export class SupervisorBackupContent extends LitElement {
margin-top: 8px; margin-top: 8px;
} }
`; `;
}
public backupDetails(): public backupDetails():
| HassioPartialBackupCreateParams | HassioPartialBackupCreateParams

View File

@ -1,4 +1,4 @@
import type { CSSResultGroup, TemplateResult } from "lit"; import type { TemplateResult } from "lit";
import { css, html, LitElement } from "lit"; import { css, html, LitElement } from "lit";
import { customElement, property } from "lit/decorators"; import { customElement, property } from "lit/decorators";
import "../../../src/components/ha-svg-icon"; import "../../../src/components/ha-svg-icon";
@ -30,8 +30,7 @@ class SupervisorFormfieldLabel extends LitElement {
`; `;
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
:host { :host {
display: flex; display: flex;
align-items: center; align-items: center;
@ -52,7 +51,6 @@ class SupervisorFormfieldLabel extends LitElement {
margin-inline-start: initial; margin-inline-start: initial;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -1,4 +1,4 @@
import type { CSSResultGroup, TemplateResult } from "lit"; import type { TemplateResult } from "lit";
import { css, html, LitElement } from "lit"; import { css, html, LitElement } from "lit";
import { customElement, property } from "lit/decorators"; import { customElement, property } from "lit/decorators";
import { classMap } from "lit/directives/class-map"; import { classMap } from "lit/directives/class-map";
@ -31,8 +31,7 @@ class SupervisorMetric extends LitElement {
</ha-settings-row>`; </ha-settings-row>`;
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
ha-settings-row { ha-settings-row {
padding: 0; padding: 0;
height: 54px; height: 54px;
@ -45,10 +44,7 @@ class SupervisorMetric extends LitElement {
justify-content: space-between; justify-content: space-between;
} }
ha-bar { ha-bar {
--ha-bar-primary-color: var( --ha-bar-primary-color: var(--hassio-bar-ok-color, var(--success-color));
--hassio-bar-ok-color,
var(--success-color)
);
} }
.target-warning { .target-warning {
--ha-bar-primary-color: var( --ha-bar-primary-color: var(
@ -70,7 +66,6 @@ class SupervisorMetric extends LitElement {
flex-shrink: 0; flex-shrink: 0;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -1,4 +1,4 @@
import type { CSSResultGroup, TemplateResult } from "lit"; import type { TemplateResult } from "lit";
import { css, html, LitElement } from "lit"; import { css, html, LitElement } from "lit";
import { customElement, property } from "lit/decorators"; import { customElement, property } from "lit/decorators";
import type { Supervisor } from "../../src/data/supervisor/supervisor"; import type { Supervisor } from "../../src/data/supervisor/supervisor";
@ -39,15 +39,13 @@ class HassioPanel extends LitElement {
`; `;
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
:host { :host {
--app-header-background-color: var(--sidebar-background-color); --app-header-background-color: var(--sidebar-background-color);
--app-header-text-color: var(--sidebar-text-color); --app-header-text-color: var(--sidebar-text-color);
--app-header-border-bottom: 1px solid var(--divider-color); --app-header-border-bottom: 1px solid var(--divider-color);
} }
`; `;
}
} }
declare global { declare global {

View File

@ -1,5 +1,5 @@
import { mdiMenu } from "@mdi/js"; import { mdiMenu } from "@mdi/js";
import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; import type { PropertyValues, TemplateResult } from "lit";
import { css, html, LitElement } from "lit"; import { css, html, LitElement } from "lit";
import { customElement, property, state } from "lit/decorators"; import { customElement, property, state } from "lit/decorators";
import { fireEvent } from "../../../src/common/dom/fire_event"; import { fireEvent } from "../../../src/common/dom/fire_event";
@ -325,8 +325,7 @@ class HassioIngressView extends LitElement {
fireEvent(this, "hass-toggle-menu"); fireEvent(this, "hass-toggle-menu");
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
iframe { iframe {
display: block; display: block;
width: 100%; width: 100%;
@ -369,7 +368,6 @@ class HassioIngressView extends LitElement {
--app-header-border-bottom: 1px solid var(--divider-color); --app-header-border-bottom: 1px solid var(--divider-color);
} }
`; `;
}
} }
declare global { declare global {

View File

@ -1,4 +1,4 @@
import type { CSSResultGroup, TemplateResult } from "lit"; import type { TemplateResult } from "lit";
import { css, html, LitElement } from "lit"; import { css, html, LitElement } from "lit";
import { customElement, property } from "lit/decorators"; import { customElement, property } from "lit/decorators";
import type { Supervisor } from "../../../src/data/supervisor/supervisor"; import type { Supervisor } from "../../../src/data/supervisor/supervisor";
@ -38,8 +38,7 @@ class UpdateAvailableDashboard extends LitElement {
history.back(); history.back();
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
hass-subpage { hass-subpage {
--app-header-background-color: var(--primary-background-color); --app-header-background-color: var(--primary-background-color);
--app-header-text-color: var(--sidebar-text-color); --app-header-text-color: var(--sidebar-text-color);
@ -51,7 +50,6 @@ class UpdateAvailableDashboard extends LitElement {
max-width: 600px; max-width: 600px;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -32,7 +32,7 @@ export class CastManager {
// If the cast connection is connected to our Hass. // If the cast connection is connected to our Hass.
public status?: ReceiverStatusMessage; public status?: ReceiverStatusMessage;
private _eventListeners: { [event: string]: CastEventListener[] } = {}; private _eventListeners: Record<string, CastEventListener[]> = {};
constructor(auth?: Auth) { constructor(auth?: Auth) {
this.auth = auth; this.auth = auth;

View File

@ -4,6 +4,6 @@ import type { HomeAssistant } from "../../types";
export const componentsWithService = ( export const componentsWithService = (
hass: HomeAssistant, hass: HomeAssistant,
service: string service: string
): Array<string> => ): string[] =>
hass && hass &&
Object.keys(hass.services).filter((key) => service in hass.services[key]); Object.keys(hass.services).filter((key) => service in hass.services[key]);

View File

@ -31,11 +31,9 @@ class StorageClass {
public storage: globalThis.Storage; public storage: globalThis.Storage;
private _storage: { [storageKey: string]: any } = {}; private _storage: Record<string, any> = {};
private _listeners: { private _listeners: Record<string, Callback[]> = {};
[storageKey: string]: Callback[];
} = {};
public addFromStorage(storageKey: any): void { public addFromStorage(storageKey: any): void {
if (!this._storage[storageKey]) { if (!this._storage[storageKey]) {

View File

@ -5,9 +5,7 @@ import { shallowEqual } from "../util/shallow-equal";
/** /**
* Transform function type. * Transform function type.
*/ */
export interface Transformer<T = any, V = any> { export type Transformer<T = any, V = any> = (value: V) => T;
(value: V): T;
}
type ReactiveTransformElement = ReactiveElement & { type ReactiveTransformElement = ReactiveElement & {
_transformers: Map<PropertyKey, Transformer>; _transformers: Map<PropertyKey, Transformer>;

View File

@ -32,7 +32,7 @@ export const ancestorsWithProperty = (
property: string | symbol, property: string | symbol,
own = DEFAULT_OWN own = DEFAULT_OWN
) => { ) => {
const ancestors: Set<Element> = new Set(); const ancestors = new Set<Element>();
while (element) { while (element) {
ancestors.add(element); ancestors.add(element);
element = closestWithProperty(element, property, own); element = closestWithProperty(element, property, own);

View File

@ -13,7 +13,7 @@ import { labBrighten, labDarken } from "../color/lab";
import { rgbContrast } from "../color/rgb"; import { rgbContrast } from "../color/rgb";
interface ProcessedTheme { interface ProcessedTheme {
keys: { [key: string]: "" }; keys: Record<string, "">;
styles: Record<string, string>; styles: Record<string, string>;
} }

View File

@ -3,7 +3,7 @@ import { computeObjectId } from "./compute_object_id";
export const computeStateNameFromEntityAttributes = ( export const computeStateNameFromEntityAttributes = (
entityId: string, entityId: string,
attributes: { [key: string]: any } attributes: Record<string, any>
): string => ): string =>
attributes.friendly_name === undefined attributes.friendly_name === undefined
? computeObjectId(entityId).replace(/_/g, " ") ? computeObjectId(entityId).replace(/_/g, " ")

View File

@ -6,9 +6,7 @@ export const supportsFeature = (
): boolean => supportsFeatureFromAttributes(stateObj.attributes, feature); ): boolean => supportsFeatureFromAttributes(stateObj.attributes, feature);
export const supportsFeatureFromAttributes = ( export const supportsFeatureFromAttributes = (
attributes: { attributes: Record<string, any>,
[key: string]: any;
},
feature: number feature: number
): boolean => ): boolean =>
// eslint-disable-next-line no-bitwise // eslint-disable-next-line no-bitwise

View File

@ -130,7 +130,7 @@ enum Arrow {
* 4. `<match_pos_0>` etc * 4. `<match_pos_0>` etc
*/ */
// export type FuzzyScore = [score: number, wordStart: number, ...matches: number[]];// [number, number, number]; // export type FuzzyScore = [score: number, wordStart: number, ...matches: number[]];// [number, number, number];
export type FuzzyScore = Array<number>; export type FuzzyScore = number[];
export function fuzzyScore( export function fuzzyScore(
pattern: string, pattern: string,
@ -469,7 +469,7 @@ const _minWordMatchPos = initArr(2 * _maxLen); // min word position for a certai
const _maxWordMatchPos = initArr(2 * _maxLen); // max word position for a certain pattern position const _maxWordMatchPos = initArr(2 * _maxLen); // max word position for a certain pattern position
const _diag = initTable(); // the length of a contiguous diagonal match const _diag = initTable(); // the length of a contiguous diagonal match
const _table = initTable(); const _table = initTable();
const _arrows = <Arrow[][]>initTable(); const _arrows = initTable() as Arrow[][];
function initArr(maxLen: number) { function initArr(maxLen: number) {
const row: number[] = []; const row: number[] = [];
@ -498,8 +498,7 @@ function _fillInMaxWordMatchPos(
} }
} }
export interface FuzzyScorer { export type FuzzyScorer = (
(
pattern: string, pattern: string,
lowPattern: string, lowPattern: string,
patternPos: number, patternPos: number,
@ -507,8 +506,7 @@ export interface FuzzyScorer {
lowWord: string, lowWord: string,
wordPos: number, wordPos: number,
firstMatchCanBeWeak: boolean firstMatchCanBeWeak: boolean
): FuzzyScore | undefined; ) => FuzzyScore | undefined;
}
export function createMatches(score: undefined | FuzzyScore): Match[] { export function createMatches(score: undefined | FuzzyScore): Match[] {
if (typeof score === "undefined") { if (typeof score === "undefined") {

View File

@ -56,9 +56,7 @@ export type LocalizeFunc<Keys extends string = LocalizeKeys> = (
> >
) => string; ) => string;
interface FormatType { type FormatType = Record<string, any>;
[format: string]: any;
}
export interface FormatsType { export interface FormatsType {
number: FormatType; number: FormatType;
date: FormatType; date: FormatType;

View File

@ -1,7 +1,7 @@
export const groupBy = <T>( export const groupBy = <T>(
list: T[], list: T[],
keySelector: (item: T) => string keySelector: (item: T) => string
): { [key: string]: T[] } => { ): Record<string, T[]> => {
const result = {}; const result = {};
for (const item of list) { for (const item of list) {
const key = keySelector(item); const key = keySelector(item);

View File

@ -1,8 +1,6 @@
import type { HomeAssistant } from "../../types"; import type { HomeAssistant } from "../../types";
interface ResultCache<T> { type ResultCache<T> = Record<string, Promise<T> | undefined>;
[entityId: string]: Promise<T> | undefined;
}
/** /**
* Call a function with result caching per entity. * Call a function with result caching per entity.

View File

@ -1,6 +1,6 @@
import "@material/mwc-button"; import "@material/mwc-button";
import { mdiAlertOctagram, mdiCheckBold } from "@mdi/js"; import { mdiAlertOctagram, mdiCheckBold } from "@mdi/js";
import type { CSSResultGroup, TemplateResult } from "lit"; import type { TemplateResult } from "lit";
import { css, html, LitElement, nothing } from "lit"; import { css, html, LitElement, nothing } from "lit";
import { customElement, property, state } from "lit/decorators"; import { customElement, property, state } from "lit/decorators";
import "../ha-circular-progress"; import "../ha-circular-progress";
@ -62,8 +62,7 @@ export class HaProgressButton extends LitElement {
}, 2000); }, 2000);
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
:host { :host {
outline: none; outline: none;
display: inline-block; display: inline-block;
@ -119,7 +118,6 @@ export class HaProgressButton extends LitElement {
visibility: hidden; visibility: hidden;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -6,7 +6,7 @@ import type {
TooltipModel, TooltipModel,
UpdateMode, UpdateMode,
} from "chart.js"; } from "chart.js";
import type { CSSResultGroup, PropertyValues } from "lit"; import type { PropertyValues } from "lit";
import { css, html, nothing, LitElement } from "lit"; import { css, html, nothing, LitElement } from "lit";
import { customElement, property, state } from "lit/decorators"; import { customElement, property, state } from "lit/decorators";
import { classMap } from "lit/directives/class-map"; import { classMap } from "lit/directives/class-map";
@ -60,7 +60,7 @@ export class HaChartBase extends LitElement {
@state() private _tooltip?: Tooltip; @state() private _tooltip?: Tooltip;
@state() private _hiddenDatasets: Set<number> = new Set(); @state() private _hiddenDatasets = new Set<number>();
@state() private _showZoomHint = false; @state() private _showZoomHint = false;
@ -526,8 +526,7 @@ export class HaChartBase extends LitElement {
this._tooltip = undefined; this._tooltip = undefined;
}; };
static get styles(): CSSResultGroup { static styles = css`
return css`
:host { :host {
display: block; display: block;
position: relative; position: relative;
@ -664,7 +663,6 @@ export class HaChartBase extends LitElement {
border: 1px solid var(--divider-color); border: 1px solid var(--divider-color);
} }
`; `;
}
} }
declare global { declare global {

View File

@ -4,7 +4,7 @@ import { ResizeController } from "@lit-labs/observers/resize-controller";
import memoizeOne from "memoize-one"; import memoizeOne from "memoize-one";
import type { HomeAssistant } from "../../types"; import type { HomeAssistant } from "../../types";
export type Node = { export interface Node {
id: string; id: string;
value: number; value: number;
index: number; // like z-index but for x/y index: number; // like z-index but for x/y
@ -12,13 +12,17 @@ export type Node = {
tooltip?: string; tooltip?: string;
color?: string; color?: string;
passThrough?: boolean; passThrough?: boolean;
}; }
export type Link = { source: string; target: string; value?: number }; export interface Link {
source: string;
target: string;
value?: number;
}
export type SankeyChartData = { export interface SankeyChartData {
nodes: Node[]; nodes: Node[];
links: Link[]; links: Link[];
}; }
type ProcessedNode = Node & { type ProcessedNode = Node & {
x: number; x: number;
@ -35,13 +39,13 @@ type ProcessedLink = Link & {
passThroughNodeIds: string[]; passThroughNodeIds: string[];
}; };
type Section = { interface Section {
nodes: ProcessedNode[]; nodes: ProcessedNode[];
offset: number; offset: number;
index: number; index: number;
totalValue: number; totalValue: number;
statePerPixel: number; statePerPixel: number;
}; }
const MIN_SIZE = 3; const MIN_SIZE = 3;
const DEFAULT_COLOR = "var(--primary-color)"; const DEFAULT_COLOR = "var(--primary-color)";

View File

@ -553,11 +553,11 @@ export class StateHistoryChartLine extends LitElement {
!states.states || states.states.length === 0 !states.states || states.states.length === 0
? 0 ? 0
: states.states[0].last_changed; : states.states[0].last_changed;
for (let i = 0; i < states.statistics.length; i++) { for (const statistic of states.statistics) {
if (stopTime && states.statistics[i].last_changed >= stopTime) { if (stopTime && statistic.last_changed >= stopTime) {
break; break;
} }
processData(states.statistics[i]); processData(statistic);
} }
} }
states.states.forEach((entityState) => { states.states.forEach((entityState) => {

View File

@ -1,6 +1,6 @@
import type { ChartData, ChartDataset, ChartOptions } from "chart.js"; import type { ChartData, ChartDataset, ChartOptions } from "chart.js";
import { getRelativePosition } from "chart.js/helpers"; import { getRelativePosition } from "chart.js/helpers";
import type { CSSResultGroup, PropertyValues } from "lit"; import type { PropertyValues } from "lit";
import { css, html, LitElement } from "lit"; import { css, html, LitElement } from "lit";
import { customElement, property, state } from "lit/decorators"; import { customElement, property, state } from "lit/decorators";
import { formatDateTimeWithSeconds } from "../../common/datetime/format_date_time"; import { formatDateTimeWithSeconds } from "../../common/datetime/format_date_time";
@ -319,13 +319,11 @@ export class StateHistoryChartTimeline extends LitElement {
}; };
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
ha-chart-base { ha-chart-base {
--chart-max-height: none; --chart-max-height: none;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -1,4 +1,4 @@
import type { CSSResultGroup, PropertyValues } from "lit"; import type { PropertyValues } from "lit";
import { css, html, LitElement } from "lit"; import { css, html, LitElement } from "lit";
import { customElement, eventOptions, property, state } from "lit/decorators"; import { customElement, eventOptions, property, state } from "lit/decorators";
import type { RenderItemFunction } from "@lit-labs/virtualizer/virtualize"; import type { RenderItemFunction } from "@lit-labs/virtualizer/virtualize";
@ -272,8 +272,7 @@ export class StateHistoryCharts extends LitElement {
this._savedScrollPos = (e.target as HTMLDivElement).scrollTop; this._savedScrollPos = (e.target as HTMLDivElement).scrollTop;
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
:host { :host {
display: block; display: block;
/* height of single timeline chart = 60px */ /* height of single timeline chart = 60px */
@ -329,7 +328,6 @@ export class StateHistoryCharts extends LitElement {
width: 100%; width: 100%;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -4,7 +4,7 @@ import type {
ChartOptions, ChartOptions,
ChartType, ChartType,
} from "chart.js"; } from "chart.js";
import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; import type { PropertyValues, TemplateResult } from "lit";
import { css, html, LitElement } from "lit"; import { css, html, LitElement } from "lit";
import { customElement, property, state } from "lit/decorators"; import { customElement, property, state } from "lit/decorators";
import memoizeOne from "memoize-one"; import memoizeOne from "memoize-one";
@ -60,7 +60,7 @@ export class StatisticsChart extends LitElement {
@property({ attribute: false }) public endTime?: Date; @property({ attribute: false }) public endTime?: Date;
@property({ attribute: false, type: Array }) @property({ attribute: false, type: Array })
public statTypes: Array<StatisticType> = ["sum", "min", "mean", "max"]; public statTypes: StatisticType[] = ["sum", "min", "mean", "max"];
@property({ attribute: false }) public chartType: ChartType = "line"; @property({ attribute: false }) public chartType: ChartType = "line";
@ -372,7 +372,7 @@ export class StatisticsChart extends LitElement {
} }
// array containing [value1, value2, etc] // array containing [value1, value2, etc]
let prevValues: Array<number | null> | null = null; let prevValues: (number | null)[] | null = null;
let prevEndTime: Date | undefined; let prevEndTime: Date | undefined;
// The datasets for the current statistic // The datasets for the current statistic
@ -382,7 +382,7 @@ export class StatisticsChart extends LitElement {
const pushData = ( const pushData = (
start: Date, start: Date,
end: Date, end: Date,
dataValues: Array<number | null> | null dataValues: (number | null)[] | null
) => { ) => {
if (!dataValues) return; if (!dataValues) return;
if (start > end) { if (start > end) {
@ -494,7 +494,7 @@ export class StatisticsChart extends LitElement {
return; return;
} }
prevDate = startDate; prevDate = startDate;
const dataValues: Array<number | null> = []; const dataValues: (number | null)[] = [];
statTypes.forEach((type) => { statTypes.forEach((type) => {
let val: number | null | undefined; let val: number | null | undefined;
if (type === "sum") { if (type === "sum") {
@ -528,8 +528,7 @@ export class StatisticsChart extends LitElement {
this._statisticIds = statisticIds; this._statisticIds = statisticIds;
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
:host { :host {
display: block; display: block;
min-height: 60px; min-height: 60px;
@ -540,7 +539,6 @@ export class StatisticsChart extends LitElement {
color: var(--secondary-text-color); color: var(--secondary-text-color);
} }
`; `;
}
} }
declare global { declare global {

View File

@ -49,7 +49,7 @@ function computeTimelineStateColor(
} }
let colorIndex = 0; let colorIndex = 0;
const stateColorMap: Map<string, string> = new Map(); const stateColorMap = new Map<string, string>();
function computeTimeLineGenericColor( function computeTimeLineGenericColor(
state: string, state: string,

View File

@ -218,8 +218,8 @@ export class DialogDataTableSettings extends LitElement {
// Array.findLastIndex when supported or core-js polyfill // Array.findLastIndex when supported or core-js polyfill
const findLastIndex = ( const findLastIndex = (
arr: Array<any>, arr: any[],
fn: (item: any, index: number, arr: Array<any>) => boolean fn: (item: any, index: number, arr: any[]) => boolean
) => { ) => {
for (let i = arr.length - 1; i >= 0; i--) { for (let i = arr.length - 1; i >= 0; i--) {
if (fn(arr[i], i, arr)) return i; if (fn(arr[i], i, arr)) return i;

View File

@ -33,8 +33,7 @@ class HaDataTableIcon extends LitElement {
this.addEventListener("tap", hide); this.addEventListener("tap", hide);
} }
static get styles() { static styles = css`
return css`
:host { :host {
display: inline-block; display: inline-block;
position: relative; position: relative;
@ -57,7 +56,6 @@ class HaDataTableIcon extends LitElement {
border-radius: 2px; border-radius: 2px;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -98,8 +98,7 @@ class HaDataTableLabels extends LitElement {
} }
} }
static get styles() { static styles = css`
return css`
:host { :host {
display: block; display: block;
flex-grow: 1; flex-grow: 1;
@ -122,7 +121,6 @@ class HaDataTableLabels extends LitElement {
border: 1px solid var(--divider-color); border: 1px solid var(--divider-color);
} }
`; `;
}
} }
declare global { declare global {

View File

@ -48,9 +48,10 @@ export interface SortingChangedEvent {
export type SortingDirection = "desc" | "asc" | null; export type SortingDirection = "desc" | "asc" | null;
export interface DataTableColumnContainer<T = any> { export type DataTableColumnContainer<T = any> = Record<
[key: string]: DataTableColumnData<T>; string,
} DataTableColumnData<T>
>;
export interface DataTableSortColumnData { export interface DataTableSortColumnData {
sortable?: boolean; sortable?: boolean;
@ -94,9 +95,7 @@ export interface DataTableRowData {
selectable?: boolean; selectable?: boolean;
} }
export interface SortableColumnContainer { export type SortableColumnContainer = Record<string, ClonedDataTableColumnData>;
[key: string]: ClonedDataTableColumnData;
}
const UNDEFINED_GROUP_KEY = "zzzzz_undefined"; const UNDEFINED_GROUP_KEY = "zzzzz_undefined";
@ -694,9 +693,9 @@ export class HaDataTable extends LitElement {
grouped[UNDEFINED_GROUP_KEY] = grouped.undefined; grouped[UNDEFINED_GROUP_KEY] = grouped.undefined;
delete grouped.undefined; delete grouped.undefined;
} }
const sorted: { const sorted: Record<string, DataTableRowData[]> = Object.keys(
[key: string]: DataTableRowData[]; grouped
} = Object.keys(grouped) )
.sort((a, b) => { .sort((a, b) => {
const orderA = groupOrder?.indexOf(a) ?? -1; const orderA = groupOrder?.indexOf(a) ?? -1;
const orderB = groupOrder?.indexOf(b) ?? -1; const orderB = groupOrder?.indexOf(b) ?? -1;

View File

@ -1,6 +1,5 @@
import { consume } from "@lit-labs/context"; import { consume } from "@lit-labs/context";
import "@material/mwc-list/mwc-list-item"; import "@material/mwc-list/mwc-list-item";
import type { CSSResultGroup } from "lit";
import { css, html, LitElement, nothing } from "lit"; import { css, html, LitElement, nothing } from "lit";
import { property, state } from "lit/decorators"; import { property, state } from "lit/decorators";
import { fireEvent } from "../../common/dom/fire_event"; import { fireEvent } from "../../common/dom/fire_event";
@ -185,11 +184,9 @@ export abstract class HaDeviceAutomationPicker<
fireEvent(this, "value-changed", { value }); fireEvent(this, "value-changed", { value });
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
ha-select { ha-select {
display: block; display: block;
} }
`; `;
}
} }

View File

@ -1,6 +1,6 @@
import { mdiFlash, mdiFlashOff } from "@mdi/js"; import { mdiFlash, mdiFlashOff } from "@mdi/js";
import type { HassEntity } from "home-assistant-js-websocket"; import type { HassEntity } from "home-assistant-js-websocket";
import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; import type { PropertyValues, TemplateResult } from "lit";
import { LitElement, css, html } from "lit"; import { LitElement, css, html } from "lit";
import { customElement, property, state } from "lit/decorators"; import { customElement, property, state } from "lit/decorators";
import { STATES_OFF } from "../../common/const"; import { STATES_OFF } from "../../common/const";
@ -152,8 +152,7 @@ export class HaEntityToggle extends LitElement {
}, 2000); }, 2000);
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
:host { :host {
white-space: nowrap; white-space: nowrap;
min-width: 38px; min-width: 38px;
@ -170,7 +169,6 @@ export class HaEntityToggle extends LitElement {
padding: 13px 5px; padding: 13px 5px;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -1,6 +1,6 @@
import { mdiAlert } from "@mdi/js"; import { mdiAlert } from "@mdi/js";
import type { HassEntity } from "home-assistant-js-websocket"; import type { HassEntity } from "home-assistant-js-websocket";
import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; import type { PropertyValues, TemplateResult } from "lit";
import { css, html, LitElement } from "lit"; import { css, html, LitElement } from "lit";
import { customElement, property, state } from "lit/decorators"; import { customElement, property, state } from "lit/decorators";
import { classMap } from "lit/directives/class-map"; import { classMap } from "lit/directives/class-map";
@ -26,7 +26,7 @@ const TRUNCATED_DOMAINS = [
"alarm_control_panel", "alarm_control_panel",
"device_tracker", "device_tracker",
"person", "person",
] as const satisfies ReadonlyArray<keyof typeof FIXED_DOMAIN_STATES>; ] as const satisfies readonly (keyof typeof FIXED_DOMAIN_STATES)[];
type TruncatedDomain = (typeof TRUNCATED_DOMAINS)[number]; type TruncatedDomain = (typeof TRUNCATED_DOMAINS)[number];
type TruncatedKey = { type TruncatedKey = {
@ -262,8 +262,7 @@ export class HaStateLabelBadge extends LitElement {
this._timerTimeRemaining = timerTimeRemaining(stateObj); this._timerTimeRemaining = timerTimeRemaining(stateObj);
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
:host { :host {
cursor: pointer; cursor: pointer;
} }
@ -305,7 +304,6 @@ export class HaStateLabelBadge extends LitElement {
--ha-label-badge-color: var(--label-badge-yellow); --ha-label-badge-color: var(--label-badge-yellow);
} }
`; `;
}
} }
declare global { declare global {

View File

@ -1,4 +1,3 @@
import type { CSSResultGroup } from "lit";
import { css, html, LitElement, nothing } from "lit"; import { css, html, LitElement, nothing } from "lit";
import { customElement, property } from "lit/decorators"; import { customElement, property } from "lit/decorators";
import { repeat } from "lit/directives/repeat"; import { repeat } from "lit/directives/repeat";
@ -172,8 +171,7 @@ class HaStatisticsPicker extends LitElement {
this._updateStatistics([...currentEntities, toAdd]); this._updateStatistics([...currentEntities, toAdd]);
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
:host { :host {
width: 200px; width: 200px;
display: block; display: block;
@ -184,7 +182,6 @@ class HaStatisticsPicker extends LitElement {
margin-top: 8px; margin-top: 8px;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -35,7 +35,7 @@ export class StateBadge extends LitElement {
// @todo Consider reworking to eliminate need for attribute since it is manipulated internally // @todo Consider reworking to eliminate need for attribute since it is manipulated internally
@property({ type: Boolean, reflect: true }) public icon = true; @property({ type: Boolean, reflect: true }) public icon = true;
@state() private _iconStyle: { [name: string]: string | undefined } = {}; @state() private _iconStyle: Record<string, string | undefined> = {};
connectedCallback(): void { connectedCallback(): void {
super.connectedCallback(); super.connectedCallback();
@ -108,7 +108,7 @@ export class StateBadge extends LitElement {
} }
const stateObj = this.stateObj; const stateObj = this.stateObj;
const iconStyle: { [name: string]: string } = {}; const iconStyle: Record<string, string> = {};
let backgroundImage = ""; let backgroundImage = "";
this.icon = true; this.icon = true;

View File

@ -1,6 +1,5 @@
import "@lrnwebcomponents/simple-tooltip/simple-tooltip"; import "@lrnwebcomponents/simple-tooltip/simple-tooltip";
import type { HassEntity } from "home-assistant-js-websocket"; import type { HassEntity } from "home-assistant-js-websocket";
import type { CSSResultGroup } from "lit";
import { css, html, LitElement, nothing } from "lit"; import { css, html, LitElement, nothing } from "lit";
import { customElement, property } from "lit/decorators"; import { customElement, property } from "lit/decorators";
import { computeStateName } from "../../common/entity/compute_state_name"; import { computeStateName } from "../../common/entity/compute_state_name";
@ -75,8 +74,7 @@ class StateInfo extends LitElement {
</div>`; </div>`;
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
:host { :host {
min-width: 120px; min-width: 120px;
white-space: nowrap; white-space: nowrap;
@ -135,7 +133,6 @@ class StateInfo extends LitElement {
margin-bottom: 0px; margin-bottom: 0px;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -1,6 +1,5 @@
import { import {
css, css,
type CSSResultGroup,
html, html,
LitElement, LitElement,
type PropertyValues, type PropertyValues,
@ -47,8 +46,7 @@ export class HaAnsiToHtml extends LitElement {
} }
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
pre { pre {
overflow-x: auto; overflow-x: auto;
margin: 0; margin: 0;
@ -123,7 +121,6 @@ export class HaAnsiToHtml extends LitElement {
color: var(--text-primary-color); color: var(--text-primary-color);
} }
`; `;
}
/** /**
* add new lines to the log * add new lines to the log

View File

@ -1,5 +1,5 @@
import { mdiTextureBox } from "@mdi/js"; import { mdiTextureBox } from "@mdi/js";
import type { CSSResultGroup, TemplateResult } from "lit"; import type { TemplateResult } from "lit";
import { LitElement, css, html } from "lit"; import { LitElement, css, html } from "lit";
import { customElement, property } from "lit/decorators"; import { customElement, property } from "lit/decorators";
import { fireEvent } from "../common/dom/fire_event"; import { fireEvent } from "../common/dom/fire_event";
@ -9,10 +9,10 @@ import "./ha-icon-next";
import "./ha-svg-icon"; import "./ha-svg-icon";
import "./ha-textfield"; import "./ha-textfield";
export type AreaFilterValue = { export interface AreaFilterValue {
hidden?: string[]; hidden?: string[];
order?: string[]; order?: string[];
}; }
@customElement("ha-area-filter") @customElement("ha-area-filter")
export class HaAreaPicker extends LitElement { export class HaAreaPicker extends LitElement {
@ -80,14 +80,12 @@ export class HaAreaPicker extends LitElement {
fireEvent(this, "value-changed", { value }); fireEvent(this, "value-changed", { value });
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
ha-list-item { ha-list-item {
--mdc-list-side-padding-left: 8px; --mdc-list-side-padding-left: 8px;
--mdc-list-side-padding-right: 8px; --mdc-list-side-padding-right: 8px;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -345,9 +345,10 @@ export class HaAreaFloorPicker extends LitElement {
); );
// @ts-ignore // @ts-ignore
const floorAreaEntries: Array< const floorAreaEntries: [
[FloorRegistryEntry | undefined, AreaRegistryEntry[]] FloorRegistryEntry | undefined,
> = Object.entries(floorAreaLookup) AreaRegistryEntry[],
][] = Object.entries(floorAreaLookup)
.map(([floorId, floorAreas]) => { .map(([floorId, floorAreas]) => {
const floor = floors.find((fl) => fl.floor_id === floorId)!; const floor = floors.find((fl) => fl.floor_id === floorId)!;
return [floor, floorAreas] as const; return [floor, floorAreas] as const;

View File

@ -1,4 +1,4 @@
import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; import type { PropertyValues, TemplateResult } from "lit";
import { css, LitElement, html, nothing } from "lit"; import { css, LitElement, html, nothing } from "lit";
import { mdiAlertCircle, mdiMicrophone, mdiSend } from "@mdi/js"; import { mdiAlertCircle, mdiMicrophone, mdiSend } from "@mdi/js";
import { customElement, property, query, state } from "lit/decorators"; import { customElement, property, query, state } from "lit/decorators";
@ -475,8 +475,7 @@ export class HaAssistChat extends LitElement {
} }
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
:host { :host {
flex: 1; flex: 1;
display: flex; display: flex;
@ -629,7 +628,6 @@ export class HaAssistChat extends LitElement {
top: 0px; top: 0px;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -1,4 +1,4 @@
import type { CSSResultGroup, PropertyValueMap } from "lit"; import type { PropertyValueMap } from "lit";
import { css, html, LitElement, nothing } from "lit"; import { css, html, LitElement, nothing } from "lit";
import { customElement, property, state } from "lit/decorators"; import { customElement, property, state } from "lit/decorators";
import { fireEvent } from "../common/dom/fire_event"; import { fireEvent } from "../common/dom/fire_event";
@ -90,13 +90,11 @@ export class HaAssistPipelinePicker extends LitElement {
}); });
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
ha-select { ha-select {
width: 100%; width: 100%;
} }
`; `;
}
private _changed(ev): void { private _changed(ev): void {
const target = ev.target as HaSelect; const target = ev.target as HaSelect;

View File

@ -1,4 +1,3 @@
import type { CSSResultGroup } from "lit";
import { css, html, LitElement, nothing } from "lit"; import { css, html, LitElement, nothing } from "lit";
import { customElement, property } from "lit/decorators"; import { customElement, property } from "lit/decorators";
import { classMap } from "lit/directives/class-map"; import { classMap } from "lit/directives/class-map";
@ -38,8 +37,7 @@ export class HaBadge extends LitElement {
`; `;
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
:host { :host {
--badge-color: var(--secondary-text-color); --badge-color: var(--secondary-text-color);
-webkit-tap-highlight-color: transparent; -webkit-tap-highlight-color: transparent;
@ -75,10 +73,7 @@ export class HaBadge extends LitElement {
border-width: var(--ha-card-border-width, 1px); border-width: var(--ha-card-border-width, 1px);
box-shadow: var(--ha-card-box-shadow, none); box-shadow: var(--ha-card-box-shadow, none);
border-style: solid; border-style: solid;
border-color: var( border-color: var(--ha-card-border-color, var(--divider-color, #e0e0e0));
--ha-card-border-color,
var(--divider-color, #e0e0e0)
);
} }
.badge:focus-visible { .badge:focus-visible {
--shadow-default: var(--ha-card-box-shadow, 0 0 0 0 transparent); --shadow-default: var(--ha-card-box-shadow, 0 0 0 0 transparent);
@ -145,7 +140,6 @@ export class HaBadge extends LitElement {
margin-inline-end: 0; margin-inline-end: 0;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -1,4 +1,4 @@
import type { CSSResultGroup, TemplateResult } from "lit"; import type { TemplateResult } from "lit";
import { css, LitElement, svg } from "lit"; import { css, LitElement, svg } from "lit";
import { customElement, property } from "lit/decorators"; import { customElement, property } from "lit/decorators";
import { import {
@ -34,8 +34,7 @@ export class HaBar extends LitElement {
`; `;
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
rect { rect {
height: 100%; height: 100%;
} }
@ -52,7 +51,6 @@ export class HaBar extends LitElement {
width: 100%; width: 100%;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -1,5 +1,4 @@
import "@material/mwc-list/mwc-list-item"; import "@material/mwc-list/mwc-list-item";
import type { CSSResultGroup } from "lit";
import { css, html, LitElement, nothing } from "lit"; import { css, html, LitElement, nothing } from "lit";
import { customElement, property } from "lit/decorators"; import { customElement, property } from "lit/decorators";
import memoizeOne from "memoize-one"; import memoizeOne from "memoize-one";
@ -95,8 +94,7 @@ class HaBluePrintPicker extends LitElement {
} }
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
:host { :host {
display: inline-block; display: inline-block;
} }
@ -106,7 +104,6 @@ class HaBluePrintPicker extends LitElement {
display: block; display: block;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -1,7 +1,7 @@
import type { Button } from "@material/mwc-button"; import type { Button } from "@material/mwc-button";
import "@material/mwc-menu"; import "@material/mwc-menu";
import type { Corner, Menu, MenuCorner } from "@material/mwc-menu"; import type { Corner, Menu, MenuCorner } from "@material/mwc-menu";
import type { CSSResultGroup, TemplateResult } from "lit"; import type { TemplateResult } from "lit";
import { css, html, LitElement } from "lit"; import { css, html, LitElement } from "lit";
import { customElement, property, query } from "lit/decorators"; import { customElement, property, query } from "lit/decorators";
import { mainWindow } from "../common/dom/get_main_window"; import { mainWindow } from "../common/dom/get_main_window";
@ -103,8 +103,7 @@ export class HaButtonMenu extends LitElement {
} }
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
:host { :host {
display: inline-block; display: inline-block;
position: relative; position: relative;
@ -113,7 +112,6 @@ export class HaButtonMenu extends LitElement {
color: var(--disabled-text-color); color: var(--disabled-text-color);
} }
`; `;
}
} }
declare global { declare global {

View File

@ -1,6 +1,6 @@
import "@material/mwc-button/mwc-button"; import "@material/mwc-button/mwc-button";
import type { Button } from "@material/mwc-button/mwc-button"; import type { Button } from "@material/mwc-button/mwc-button";
import type { CSSResultGroup, TemplateResult } from "lit"; import type { TemplateResult } from "lit";
import { css, html, LitElement } from "lit"; import { css, html, LitElement } from "lit";
import { customElement, property, queryAll } from "lit/decorators"; import { customElement, property, queryAll } from "lit/decorators";
import { styleMap } from "lit/directives/style-map"; import { styleMap } from "lit/directives/style-map";
@ -66,8 +66,7 @@ export class HaButtonToggleGroup extends LitElement {
fireEvent(this, "value-changed", { value: this.active }); fireEvent(this, "value-changed", { value: this.active });
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
div { div {
display: flex; display: flex;
--mdc-icon-button-size: var(--button-toggle-size, 36px); --mdc-icon-button-size: var(--button-toggle-size, 36px);
@ -139,7 +138,6 @@ export class HaButtonToggleGroup extends LitElement {
border-right-width: 1px; border-right-width: 1px;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -1,11 +1,4 @@
import { import { css, html, LitElement, nothing, type PropertyValues } from "lit";
css,
type CSSResultGroup,
html,
LitElement,
nothing,
type PropertyValues,
} from "lit";
import { customElement, property, state } from "lit/decorators"; import { customElement, property, state } from "lit/decorators";
import { repeat } from "lit/directives/repeat"; import { repeat } from "lit/directives/repeat";
import memoizeOne from "memoize-one"; import memoizeOne from "memoize-one";
@ -28,10 +21,10 @@ import "./ha-web-rtc-player";
const MJPEG_STREAM = "mjpeg"; const MJPEG_STREAM = "mjpeg";
type Stream = { interface Stream {
type: StreamType | typeof MJPEG_STREAM; type: StreamType | typeof MJPEG_STREAM;
visible: boolean; visible: boolean;
}; }
@customElement("ha-camera-stream") @customElement("ha-camera-stream")
export class HaCameraStream extends LitElement { export class HaCameraStream extends LitElement {
@ -256,8 +249,7 @@ export class HaCameraStream extends LitElement {
} }
); );
static get styles(): CSSResultGroup { static styles = css`
return css`
:host, :host,
img { img {
display: block; display: block;
@ -271,7 +263,6 @@ export class HaCameraStream extends LitElement {
display: none; display: none;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -1,4 +1,3 @@
import type { CSSResultGroup } from "lit";
import { css, html, LitElement, nothing } from "lit"; import { css, html, LitElement, nothing } from "lit";
import { customElement, property } from "lit/decorators"; import { customElement, property } from "lit/decorators";
@ -8,8 +7,7 @@ export class HaCard extends LitElement {
@property({ type: Boolean, reflect: true }) public raised = false; @property({ type: Boolean, reflect: true }) public raised = false;
static get styles(): CSSResultGroup { static styles = css`
return css`
:host { :host {
background: var( background: var(
--ha-card-background, --ha-card-background,
@ -22,10 +20,7 @@ export class HaCard extends LitElement {
border-radius: var(--ha-card-border-radius, 12px); border-radius: var(--ha-card-border-radius, 12px);
border-width: var(--ha-card-border-width, 1px); border-width: var(--ha-card-border-width, 1px);
border-style: solid; border-style: solid;
border-color: var( border-color: var(--ha-card-border-color, var(--divider-color, #e0e0e0));
--ha-card-border-color,
var(--divider-color, #e0e0e0)
);
color: var(--primary-text-color); color: var(--primary-text-color);
display: block; display: block;
transition: all 0.3s ease-out; transition: all 0.3s ease-out;
@ -71,7 +66,6 @@ export class HaCard extends LitElement {
padding: 5px 16px; padding: 5px 16px;
} }
`; `;
}
protected render() { protected render() {
return html` return html`

View File

@ -1,4 +1,4 @@
import type { CSSResultGroup, TemplateResult } from "lit"; import type { TemplateResult } from "lit";
import { css, html, LitElement, nothing } from "lit"; import { css, html, LitElement, nothing } from "lit";
import { customElement, property } from "lit/decorators"; import { customElement, property } from "lit/decorators";
import type { ClimateEntity } from "../data/climate"; import type { ClimateEntity } from "../data/climate";
@ -136,8 +136,7 @@ class HaClimateState extends LitElement {
return stateString; return stateString;
} }
static get styles(): CSSResultGroup { static styles = css`
return css`
:host { :host {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@ -163,7 +162,6 @@ class HaClimateState extends LitElement {
direction: ltr; direction: ltr;
} }
`; `;
}
} }
declare global { declare global {

View File

@ -7,7 +7,7 @@ import type {
import type { Extension, TransactionSpec } from "@codemirror/state"; import type { Extension, TransactionSpec } from "@codemirror/state";
import type { EditorView, KeyBinding, ViewUpdate } from "@codemirror/view"; import type { EditorView, KeyBinding, ViewUpdate } from "@codemirror/view";
import type { HassEntities } from "home-assistant-js-websocket"; import type { HassEntities } from "home-assistant-js-websocket";
import type { CSSResultGroup, PropertyValues } from "lit"; import type { PropertyValues } from "lit";
import { css, ReactiveElement } from "lit"; import { css, ReactiveElement } from "lit";
import { customElement, property, state } from "lit/decorators"; import { customElement, property, state } from "lit/decorators";
import memoizeOne from "memoize-one"; import memoizeOne from "memoize-one";
@ -339,13 +339,11 @@ export class HaCodeEditor extends ReactiveElement {
return []; return [];
}; };
static get styles(): CSSResultGroup { static styles = css`
return css`
:host(.error-state) .cm-gutters { :host(.error-state) .cm-gutters {
border-color: var(--error-state-color, red); border-color: var(--error-state-color, red);
} }
`; `;
}
} }
declare global { declare global {

Some files were not shown because too many files have changed in this diff Show More