diff --git a/.eslintrc.json b/.eslintrc.json index 92943aa598ed..97a5f9f6a9b2 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -124,7 +124,9 @@ "lit-a11y/no-autofocus": "off", "lit-a11y/alt-text": "warn", "lit-a11y/anchor-is-valid": "warn", - "lit-a11y/role-has-required-aria-attrs": "warn" + "lit-a11y/role-has-required-aria-attrs": "warn", + "@typescript-eslint/consistent-type-imports": "error", + "@typescript-eslint/no-import-type-side-effects": "error" }, "plugins": ["unused-imports"] } diff --git a/build-scripts/gulp/download-translations.js b/build-scripts/gulp/download-translations.js index 70a3cc12f18c..b9f2c9758397 100644 --- a/build-scripts/gulp/download-translations.js +++ b/build-scripts/gulp/download-translations.js @@ -13,7 +13,7 @@ const srcMeta = "src/translations/translationMetadata.json"; const encoding = "utf8"; function hasHtml(data) { - return /<[a-z][\s\S]*>/i.test(data); + return /<\S*>/i.test(data); } function recursiveCheckHasHtml(file, data, errors, recKey) { diff --git a/cast/src/launcher/layout/hc-cast.ts b/cast/src/launcher/layout/hc-cast.ts index b8c2b9bf7ec4..8a1e66ca1bac 100644 --- a/cast/src/launcher/layout/hc-cast.ts +++ b/cast/src/launcher/layout/hc-cast.ts @@ -2,10 +2,11 @@ import "@material/mwc-button/mwc-button"; import "@material/mwc-list/mwc-list"; import type { ActionDetail } from "@material/mwc-list/mwc-list"; import { mdiCast, mdiCastConnected, mdiViewDashboard } from "@mdi/js"; -import { Auth, Connection } from "home-assistant-js-websocket"; -import { CSSResultGroup, LitElement, TemplateResult, css, html } from "lit"; +import type { Auth, Connection } from "home-assistant-js-websocket"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { CastManager } from "../../../../src/cast/cast_manager"; +import type { CastManager } from "../../../../src/cast/cast_manager"; import { castSendShowLovelaceView, ensureConnectedCastSession, @@ -24,7 +25,7 @@ import { getLovelaceCollection, } from "../../../../src/data/lovelace"; import { isStrategyDashboard } from "../../../../src/data/lovelace/config/types"; -import { LovelaceViewConfig } from "../../../../src/data/lovelace/config/view"; +import type { LovelaceViewConfig } from "../../../../src/data/lovelace/config/view"; import "../../../../src/layouts/hass-loading-screen"; import { generateDefaultViewConfig } from "../../../../src/panels/lovelace/common/generate-lovelace-config"; import "./hc-layout"; diff --git a/cast/src/launcher/layout/hc-connect.ts b/cast/src/launcher/layout/hc-connect.ts index fa209cf9d6f1..207b0dfa536d 100644 --- a/cast/src/launcher/layout/hc-connect.ts +++ b/cast/src/launcher/layout/hc-connect.ts @@ -1,19 +1,23 @@ import "@material/mwc-button"; import { mdiCastConnected, mdiCast } from "@mdi/js"; -import { +import type { Auth, Connection, + getAuthOptions, +} from "home-assistant-js-websocket"; +import { createConnection, ERR_CANNOT_CONNECT, ERR_HASS_HOST_REQUIRED, ERR_INVALID_AUTH, ERR_INVALID_HTTPS_TO_HTTP, getAuth, - getAuthOptions, } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, state } from "lit/decorators"; -import { CastManager, getCastManager } from "../../../../src/cast/cast_manager"; +import type { CastManager } from "../../../../src/cast/cast_manager"; +import { getCastManager } from "../../../../src/cast/cast_manager"; import { castSendShowDemo } from "../../../../src/cast/receiver_messages"; import { loadTokens, diff --git a/cast/src/launcher/layout/hc-layout.ts b/cast/src/launcher/layout/hc-layout.ts index ec9796475e25..1b8b85e58722 100644 --- a/cast/src/launcher/layout/hc-layout.ts +++ b/cast/src/launcher/layout/hc-layout.ts @@ -1,10 +1,7 @@ -import { - Auth, - Connection, - getUser, - HassUser, -} from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { Auth, Connection, HassUser } from "home-assistant-js-websocket"; +import { getUser } from "home-assistant-js-websocket"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../../src/components/ha-card"; diff --git a/cast/src/receiver/demo/cast-demo-entities.ts b/cast/src/receiver/demo/cast-demo-entities.ts index ff8956804c22..58010af0a864 100644 --- a/cast/src/receiver/demo/cast-demo-entities.ts +++ b/cast/src/receiver/demo/cast-demo-entities.ts @@ -1,4 +1,5 @@ -import { convertEntities, Entity } from "../../../../src/fake_data/entity"; +import type { Entity } from "../../../../src/fake_data/entity"; +import { convertEntities } from "../../../../src/fake_data/entity"; export const castDemoEntities: () => Entity[] = () => convertEntities({ diff --git a/cast/src/receiver/demo/cast-demo-lovelace.ts b/cast/src/receiver/demo/cast-demo-lovelace.ts index aa09f2b49b36..5594e6d1ae7d 100644 --- a/cast/src/receiver/demo/cast-demo-lovelace.ts +++ b/cast/src/receiver/demo/cast-demo-lovelace.ts @@ -1,5 +1,5 @@ -import { LovelaceCardConfig } from "../../../../src/data/lovelace/config/card"; -import { LovelaceConfig } from "../../../../src/data/lovelace/config/types"; +import type { LovelaceCardConfig } from "../../../../src/data/lovelace/config/card"; +import type { LovelaceConfig } from "../../../../src/data/lovelace/config/types"; import { castContext } from "../cast_context"; export const castDemoLovelace: () => LovelaceConfig = () => { diff --git a/cast/src/receiver/entrypoint.ts b/cast/src/receiver/entrypoint.ts index ee45ba55dcb2..afdb19a36ac1 100644 --- a/cast/src/receiver/entrypoint.ts +++ b/cast/src/receiver/entrypoint.ts @@ -1,10 +1,10 @@ import { framework } from "./cast_framework"; import { CAST_NS } from "../../../src/cast/const"; -import { HassMessage } from "../../../src/cast/receiver_messages"; +import type { HassMessage } from "../../../src/cast/receiver_messages"; import "../../../src/resources/custom-card-support"; import { castContext } from "./cast_context"; import { HcMain } from "./layout/hc-main"; -import { ReceivedMessage } from "./types"; +import type { ReceivedMessage } from "./types"; const lovelaceController = new HcMain(); document.body.append(lovelaceController); diff --git a/cast/src/receiver/layout/hc-demo.ts b/cast/src/receiver/layout/hc-demo.ts index 8f53375bd080..6ab8c05ce30c 100644 --- a/cast/src/receiver/layout/hc-demo.ts +++ b/cast/src/receiver/layout/hc-demo.ts @@ -1,13 +1,11 @@ import { html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { mockHistory } from "../../../../demo/src/stubs/history"; -import { LovelaceConfig } from "../../../../src/data/lovelace/config/types"; -import { - MockHomeAssistant, - provideHass, -} from "../../../../src/fake_data/provide_hass"; +import type { LovelaceConfig } from "../../../../src/data/lovelace/config/types"; +import type { MockHomeAssistant } from "../../../../src/fake_data/provide_hass"; +import { provideHass } from "../../../../src/fake_data/provide_hass"; import { HassElement } from "../../../../src/state/hass-element"; -import { HomeAssistant } from "../../../../src/types"; +import type { HomeAssistant } from "../../../../src/types"; import { castDemoEntities } from "../demo/cast-demo-entities"; import { castDemoLovelace } from "../demo/cast-demo-lovelace"; import "./hc-lovelace"; diff --git a/cast/src/receiver/layout/hc-launch-screen.ts b/cast/src/receiver/layout/hc-launch-screen.ts index b2fe7d7e95d4..b8e738e6c797 100644 --- a/cast/src/receiver/layout/hc-launch-screen.ts +++ b/cast/src/receiver/layout/hc-launch-screen.ts @@ -1,6 +1,7 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; -import { HomeAssistant } from "../../../../src/types"; +import type { HomeAssistant } from "../../../../src/types"; @customElement("hc-launch-screen") class HcLaunchScreen extends LitElement { diff --git a/cast/src/receiver/layout/hc-lovelace.ts b/cast/src/receiver/layout/hc-lovelace.ts index 6df50c6109bb..7591f55121d2 100644 --- a/cast/src/receiver/layout/hc-lovelace.ts +++ b/cast/src/receiver/layout/hc-lovelace.ts @@ -1,12 +1,18 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { + css, + type CSSResultGroup, + html, + LitElement, + type TemplateResult, +} from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../../../src/common/dom/fire_event"; -import { LovelaceConfig } from "../../../../src/data/lovelace/config/types"; +import type { LovelaceConfig } from "../../../../src/data/lovelace/config/types"; import { getPanelTitleFromUrlPath } from "../../../../src/data/panel"; -import { Lovelace } from "../../../../src/panels/lovelace/types"; +import type { Lovelace } from "../../../../src/panels/lovelace/types"; import "../../../../src/panels/lovelace/views/hui-view"; import "../../../../src/panels/lovelace/views/hui-view-container"; -import { HomeAssistant } from "../../../../src/types"; +import type { HomeAssistant } from "../../../../src/types"; import "./hc-launch-screen"; (window as any).loadCardHelpers = () => diff --git a/cast/src/receiver/layout/hc-main.ts b/cast/src/receiver/layout/hc-main.ts index e21225d54365..cd7c81fa334a 100644 --- a/cast/src/receiver/layout/hc-main.ts +++ b/cast/src/receiver/layout/hc-main.ts @@ -1,35 +1,33 @@ -import { - createConnection, - getAuth, - UnsubscribeFunc, -} from "home-assistant-js-websocket"; -import { html, TemplateResult } from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import { createConnection, getAuth } from "home-assistant-js-websocket"; +import type { TemplateResult } from "lit"; +import { html } from "lit"; import { customElement, state } from "lit/decorators"; import { CAST_NS } from "../../../../src/cast/const"; -import { +import type { ConnectMessage, GetStatusMessage, HassMessage, ShowDemoMessage, ShowLovelaceViewMessage, } from "../../../../src/cast/receiver_messages"; -import { - ReceiverErrorCode, +import type { ReceiverErrorMessage, ReceiverStatusMessage, } from "../../../../src/cast/sender_messages"; +import { ReceiverErrorCode } from "../../../../src/cast/sender_messages"; import { atLeastVersion } from "../../../../src/common/config/version"; import { isNavigationClick } from "../../../../src/common/dom/is-navigation-click"; import { getLegacyLovelaceCollection, getLovelaceCollection, } from "../../../../src/data/lovelace"; -import { - isStrategyDashboard, +import type { LegacyLovelaceConfig, LovelaceConfig, LovelaceDashboardStrategyConfig, } from "../../../../src/data/lovelace/config/types"; +import { isStrategyDashboard } from "../../../../src/data/lovelace/config/types"; import { fetchResources } from "../../../../src/data/lovelace/resource"; import { loadLovelaceResources } from "../../../../src/panels/lovelace/common/load-resources"; import { HassElement } from "../../../../src/state/hass-element"; diff --git a/demo/src/configs/arsaboo/entities.ts b/demo/src/configs/arsaboo/entities.ts index f656f4fca0ae..594cfa1f8b9e 100644 --- a/demo/src/configs/arsaboo/entities.ts +++ b/demo/src/configs/arsaboo/entities.ts @@ -1,5 +1,5 @@ import { convertEntities } from "../../../../src/fake_data/entity"; -import { DemoConfig } from "../types"; +import type { DemoConfig } from "../types"; export const demoEntitiesArsaboo: DemoConfig["entities"] = (localize) => convertEntities({ diff --git a/demo/src/configs/arsaboo/index.ts b/demo/src/configs/arsaboo/index.ts index 991c0605fee1..7ff6f7b52d88 100644 --- a/demo/src/configs/arsaboo/index.ts +++ b/demo/src/configs/arsaboo/index.ts @@ -1,4 +1,4 @@ -import { DemoConfig } from "../types"; +import type { DemoConfig } from "../types"; import { demoEntitiesArsaboo } from "./entities"; import { demoLovelaceArsaboo } from "./lovelace"; import { demoThemeArsaboo } from "./theme"; diff --git a/demo/src/configs/arsaboo/lovelace.ts b/demo/src/configs/arsaboo/lovelace.ts index e6195d20f485..0c50123acef4 100644 --- a/demo/src/configs/arsaboo/lovelace.ts +++ b/demo/src/configs/arsaboo/lovelace.ts @@ -1,4 +1,4 @@ -import { DemoConfig } from "../types"; +import type { DemoConfig } from "../types"; export const demoLovelaceArsaboo: DemoConfig["lovelace"] = (localize) => ({ title: "Home Assistant", diff --git a/demo/src/configs/demo-configs.ts b/demo/src/configs/demo-configs.ts index dacddf0944dc..dc062ddfcfd3 100644 --- a/demo/src/configs/demo-configs.ts +++ b/demo/src/configs/demo-configs.ts @@ -1,7 +1,7 @@ -import { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; -import { Lovelace } from "../../../src/panels/lovelace/types"; +import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; +import type { Lovelace } from "../../../src/panels/lovelace/types"; import { energyEntities } from "../stubs/entities"; -import { DemoConfig } from "./types"; +import type { DemoConfig } from "./types"; export const demoConfigs: Array<() => Promise> = [ () => import("./sections").then((mod) => mod.demoSections), diff --git a/demo/src/configs/jimpower/entities.ts b/demo/src/configs/jimpower/entities.ts index e2c09636a3e5..68404befa376 100644 --- a/demo/src/configs/jimpower/entities.ts +++ b/demo/src/configs/jimpower/entities.ts @@ -1,5 +1,5 @@ import { convertEntities } from "../../../../src/fake_data/entity"; -import { DemoConfig } from "../types"; +import type { DemoConfig } from "../types"; export const demoEntitiesJimpower: DemoConfig["entities"] = () => convertEntities({ diff --git a/demo/src/configs/jimpower/index.ts b/demo/src/configs/jimpower/index.ts index f0c8e24abf2d..78bf0f2444cc 100644 --- a/demo/src/configs/jimpower/index.ts +++ b/demo/src/configs/jimpower/index.ts @@ -1,4 +1,4 @@ -import { DemoConfig } from "../types"; +import type { DemoConfig } from "../types"; import { demoEntitiesJimpower } from "./entities"; import { demoLovelaceJimpower } from "./lovelace"; import { demoThemeJimpower } from "./theme"; diff --git a/demo/src/configs/jimpower/lovelace.ts b/demo/src/configs/jimpower/lovelace.ts index 2caf0d5bb01a..37aa6b49d304 100644 --- a/demo/src/configs/jimpower/lovelace.ts +++ b/demo/src/configs/jimpower/lovelace.ts @@ -1,5 +1,5 @@ import "../../custom-cards/card-modder"; -import { DemoConfig } from "../types"; +import type { DemoConfig } from "../types"; export const demoLovelaceJimpower: DemoConfig["lovelace"] = () => ({ name: "Kingia Castle", diff --git a/demo/src/configs/kernehed/entities.ts b/demo/src/configs/kernehed/entities.ts index 092498b9bb0f..a7f07d51c6bd 100644 --- a/demo/src/configs/kernehed/entities.ts +++ b/demo/src/configs/kernehed/entities.ts @@ -1,5 +1,5 @@ import { convertEntities } from "../../../../src/fake_data/entity"; -import { DemoConfig } from "../types"; +import type { DemoConfig } from "../types"; export const demoEntitiesKernehed: DemoConfig["entities"] = () => convertEntities({ diff --git a/demo/src/configs/kernehed/index.ts b/demo/src/configs/kernehed/index.ts index 3c20f5a7a869..72f4a39d606d 100644 --- a/demo/src/configs/kernehed/index.ts +++ b/demo/src/configs/kernehed/index.ts @@ -1,4 +1,4 @@ -import { DemoConfig } from "../types"; +import type { DemoConfig } from "../types"; import { demoEntitiesKernehed } from "./entities"; import { demoLovelaceKernehed } from "./lovelace"; import { demoThemeKernehed } from "./theme"; diff --git a/demo/src/configs/kernehed/lovelace.ts b/demo/src/configs/kernehed/lovelace.ts index 5d8cc442e45c..a9d0f1f7d02f 100644 --- a/demo/src/configs/kernehed/lovelace.ts +++ b/demo/src/configs/kernehed/lovelace.ts @@ -1,4 +1,4 @@ -import { DemoConfig } from "../types"; +import type { DemoConfig } from "../types"; export const demoLovelaceKernehed: DemoConfig["lovelace"] = () => ({ name: "Hem", diff --git a/demo/src/configs/sections/description.ts b/demo/src/configs/sections/description.ts index b5762739acaf..e90b78b173a5 100644 --- a/demo/src/configs/sections/description.ts +++ b/demo/src/configs/sections/description.ts @@ -1,5 +1,5 @@ import { html } from "lit"; -import { DemoConfig } from "../types"; +import type { DemoConfig } from "../types"; export const demoLovelaceDescription: DemoConfig["description"] = ( localize diff --git a/demo/src/configs/sections/entities.ts b/demo/src/configs/sections/entities.ts index b1b50f04ee37..87163776e793 100644 --- a/demo/src/configs/sections/entities.ts +++ b/demo/src/configs/sections/entities.ts @@ -1,5 +1,5 @@ import { convertEntities } from "../../../../src/fake_data/entity"; -import { DemoConfig } from "../types"; +import type { DemoConfig } from "../types"; export const demoEntitiesSections: DemoConfig["entities"] = (localize) => convertEntities({ diff --git a/demo/src/configs/sections/index.ts b/demo/src/configs/sections/index.ts index 993feece9701..248a053cd724 100644 --- a/demo/src/configs/sections/index.ts +++ b/demo/src/configs/sections/index.ts @@ -1,4 +1,4 @@ -import { DemoConfig } from "../types"; +import type { DemoConfig } from "../types"; import { demoLovelaceDescription } from "./description"; import { demoEntitiesSections } from "./entities"; import { demoLovelaceSections } from "./lovelace"; diff --git a/demo/src/configs/sections/lovelace.ts b/demo/src/configs/sections/lovelace.ts index 22c564ed7233..c06af2ee5ecd 100644 --- a/demo/src/configs/sections/lovelace.ts +++ b/demo/src/configs/sections/lovelace.ts @@ -1,5 +1,5 @@ import { isFrontpageEmbed } from "../../util/is_frontpage"; -import { DemoConfig } from "../types"; +import type { DemoConfig } from "../types"; export const demoLovelaceSections: DemoConfig["lovelace"] = (localize) => ({ title: "Home Assistant Demo", diff --git a/demo/src/configs/teachingbirds/entities.ts b/demo/src/configs/teachingbirds/entities.ts index 4adaaf331c4b..2349ccb8cbc0 100644 --- a/demo/src/configs/teachingbirds/entities.ts +++ b/demo/src/configs/teachingbirds/entities.ts @@ -1,5 +1,5 @@ import { convertEntities } from "../../../../src/fake_data/entity"; -import { DemoConfig } from "../types"; +import type { DemoConfig } from "../types"; export const demoEntitiesTeachingbirds: DemoConfig["entities"] = () => convertEntities({ diff --git a/demo/src/configs/teachingbirds/index.ts b/demo/src/configs/teachingbirds/index.ts index ce1a743dcbea..e7d4865e836d 100644 --- a/demo/src/configs/teachingbirds/index.ts +++ b/demo/src/configs/teachingbirds/index.ts @@ -1,4 +1,4 @@ -import { DemoConfig } from "../types"; +import type { DemoConfig } from "../types"; import { demoEntitiesTeachingbirds } from "./entities"; import { demoLovelaceTeachingbirds } from "./lovelace"; import { demoThemeTeachingbirds } from "./theme"; diff --git a/demo/src/configs/teachingbirds/lovelace.ts b/demo/src/configs/teachingbirds/lovelace.ts index 28333fce9bed..5976da51f1c2 100644 --- a/demo/src/configs/teachingbirds/lovelace.ts +++ b/demo/src/configs/teachingbirds/lovelace.ts @@ -1,4 +1,4 @@ -import { DemoConfig } from "../types"; +import type { DemoConfig } from "../types"; export const demoLovelaceTeachingbirds: DemoConfig["lovelace"] = () => ({ title: "Home", diff --git a/demo/src/configs/types.ts b/demo/src/configs/types.ts index ee2959ab460a..cb4e405d7781 100644 --- a/demo/src/configs/types.ts +++ b/demo/src/configs/types.ts @@ -1,7 +1,7 @@ -import { TemplateResult } from "lit"; -import { LocalizeFunc } from "../../../src/common/translations/localize"; -import { LovelaceConfig } from "../../../src/data/lovelace/config/types"; -import { Entity } from "../../../src/fake_data/entity"; +import type { TemplateResult } from "lit"; +import type { LocalizeFunc } from "../../../src/common/translations/localize"; +import type { LovelaceConfig } from "../../../src/data/lovelace/config/types"; +import type { Entity } from "../../../src/fake_data/entity"; export interface DemoConfig { index?: number; diff --git a/demo/src/custom-cards/cast-demo-row.ts b/demo/src/custom-cards/cast-demo-row.ts index 72aff6663c2c..e948d85a7c28 100644 --- a/demo/src/custom-cards/cast-demo-row.ts +++ b/demo/src/custom-cards/cast-demo-row.ts @@ -1,14 +1,15 @@ import { mdiTelevision } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, state } from "lit/decorators"; -import { CastManager } from "../../../src/cast/cast_manager"; +import type { CastManager } from "../../../src/cast/cast_manager"; import { castSendShowDemo } from "../../../src/cast/receiver_messages"; import "../../../src/components/ha-icon"; -import { +import type { CastConfig, LovelaceRow, } from "../../../src/panels/lovelace/entity-rows/types"; -import { HomeAssistant } from "../../../src/types"; +import type { HomeAssistant } from "../../../src/types"; @customElement("cast-demo-row") class CastDemoRow extends LitElement implements LovelaceRow { diff --git a/demo/src/custom-cards/ha-demo-card.ts b/demo/src/custom-cards/ha-demo-card.ts index f3c37cb975ca..999aff5afc33 100644 --- a/demo/src/custom-cards/ha-demo-card.ts +++ b/demo/src/custom-cards/ha-demo-card.ts @@ -1,13 +1,17 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { until } from "lit/directives/until"; import { fireEvent } from "../../../src/common/dom/fire_event"; import "../../../src/components/ha-card"; import "../../../src/components/ha-button"; import "../../../src/components/ha-circular-progress"; -import { LovelaceCardConfig } from "../../../src/data/lovelace/config/card"; -import { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; -import { Lovelace, LovelaceCard } from "../../../src/panels/lovelace/types"; +import type { LovelaceCardConfig } from "../../../src/data/lovelace/config/card"; +import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; +import type { + Lovelace, + LovelaceCard, +} from "../../../src/panels/lovelace/types"; import { demoConfigs, selectedDemoConfig, diff --git a/demo/src/ha-demo.ts b/demo/src/ha-demo.ts index 8d2fe2b0e490..d133aaa5248f 100644 --- a/demo/src/ha-demo.ts +++ b/demo/src/ha-demo.ts @@ -3,12 +3,10 @@ import "../../src/resources/compatibility"; import { customElement } from "lit/decorators"; import { isNavigationClick } from "../../src/common/dom/is-navigation-click"; import { navigate } from "../../src/common/navigate"; -import { - MockHomeAssistant, - provideHass, -} from "../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../src/fake_data/provide_hass"; +import { provideHass } from "../../src/fake_data/provide_hass"; import { HomeAssistantAppEl } from "../../src/layouts/home-assistant"; -import { HomeAssistant } from "../../src/types"; +import type { HomeAssistant } from "../../src/types"; import { selectedDemoConfig } from "./configs/demo-configs"; import { mockAreaRegistry } from "./stubs/area_registry"; import { mockAuth } from "./stubs/auth"; diff --git a/demo/src/stubs/area_registry.ts b/demo/src/stubs/area_registry.ts index 59dd77ffe810..99c5ede11e45 100644 --- a/demo/src/stubs/area_registry.ts +++ b/demo/src/stubs/area_registry.ts @@ -1,4 +1,4 @@ -import { AreaRegistryEntry } from "../../../src/data/area_registry"; +import type { AreaRegistryEntry } from "../../../src/data/area_registry"; import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; export const mockAreaRegistry = ( diff --git a/demo/src/stubs/auth.ts b/demo/src/stubs/auth.ts index be10a020a572..748689b57e71 100644 --- a/demo/src/stubs/auth.ts +++ b/demo/src/stubs/auth.ts @@ -1,4 +1,4 @@ -import { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; export const mockAuth = (hass: MockHomeAssistant) => { hass.mockWS("config/auth/list", () => []); diff --git a/demo/src/stubs/config.ts b/demo/src/stubs/config.ts index 73beb19e1edb..f6ea8570f628 100644 --- a/demo/src/stubs/config.ts +++ b/demo/src/stubs/config.ts @@ -1,4 +1,4 @@ -import { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; export const mockConfig = (hass: MockHomeAssistant) => { hass.mockWS("validate_config", () => ({ diff --git a/demo/src/stubs/config_entries.ts b/demo/src/stubs/config_entries.ts index 7891d08db5c7..583ab7d773e2 100644 --- a/demo/src/stubs/config_entries.ts +++ b/demo/src/stubs/config_entries.ts @@ -1,4 +1,4 @@ -import { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; export const mockConfigEntries = (hass: MockHomeAssistant) => { hass.mockWS("config_entries/get", () => ({ diff --git a/demo/src/stubs/device_registry.ts b/demo/src/stubs/device_registry.ts index d1ab8025ee4d..d7c43bd6f680 100644 --- a/demo/src/stubs/device_registry.ts +++ b/demo/src/stubs/device_registry.ts @@ -1,4 +1,4 @@ -import { DeviceRegistryEntry } from "../../../src/data/device_registry"; +import type { DeviceRegistryEntry } from "../../../src/data/device_registry"; import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; export const mockDeviceRegistry = ( diff --git a/demo/src/stubs/energy.ts b/demo/src/stubs/energy.ts index 57b07d096848..6df7bde7fbb8 100644 --- a/demo/src/stubs/energy.ts +++ b/demo/src/stubs/energy.ts @@ -1,11 +1,11 @@ import { format, startOfToday, startOfTomorrow } from "date-fns"; -import { +import type { EnergyInfo, EnergyPreferences, EnergySolarForecasts, FossilEnergyConsumption, } from "../../../src/data/energy"; -import { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; export const mockEnergy = (hass: MockHomeAssistant) => { hass.mockWS( diff --git a/demo/src/stubs/entity_registry.ts b/demo/src/stubs/entity_registry.ts index 422702b646e5..0a157b768354 100644 --- a/demo/src/stubs/entity_registry.ts +++ b/demo/src/stubs/entity_registry.ts @@ -1,4 +1,4 @@ -import { EntityRegistryEntry } from "../../../src/data/entity_registry"; +import type { EntityRegistryEntry } from "../../../src/data/entity_registry"; import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; export const mockEntityRegistry = ( diff --git a/demo/src/stubs/events.ts b/demo/src/stubs/events.ts index 2e371bdeb1c5..00ac8b2bc538 100644 --- a/demo/src/stubs/events.ts +++ b/demo/src/stubs/events.ts @@ -1,4 +1,4 @@ -import { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; export const mockEvents = (hass: MockHomeAssistant) => { hass.mockAPI("events", () => []); diff --git a/demo/src/stubs/floor_registry.ts b/demo/src/stubs/floor_registry.ts index c962f07a5c16..f48ff74688b5 100644 --- a/demo/src/stubs/floor_registry.ts +++ b/demo/src/stubs/floor_registry.ts @@ -1,4 +1,4 @@ -import { FloorRegistryEntry } from "../../../src/data/floor_registry"; +import type { FloorRegistryEntry } from "../../../src/data/floor_registry"; import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; export const mockFloorRegistry = ( diff --git a/demo/src/stubs/frontend.ts b/demo/src/stubs/frontend.ts index a7254b25f4bf..ae4ac073fdce 100644 --- a/demo/src/stubs/frontend.ts +++ b/demo/src/stubs/frontend.ts @@ -1,4 +1,4 @@ -import { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; export const mockFrontend = (hass: MockHomeAssistant) => { hass.mockWS("frontend/get_user_data", () => ({ diff --git a/demo/src/stubs/hassio_supervisor.ts b/demo/src/stubs/hassio_supervisor.ts index 6b75b020b736..c3ee8ce760b5 100644 --- a/demo/src/stubs/hassio_supervisor.ts +++ b/demo/src/stubs/hassio_supervisor.ts @@ -1,4 +1,4 @@ -import { HassioSupervisorInfo } from "../../../src/data/hassio/supervisor"; +import type { HassioSupervisorInfo } from "../../../src/data/hassio/supervisor"; import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; export const mockHassioSupervisor = (hass: MockHomeAssistant) => { diff --git a/demo/src/stubs/history.ts b/demo/src/stubs/history.ts index b7c660d2ea89..83cb895e8839 100644 --- a/demo/src/stubs/history.ts +++ b/demo/src/stubs/history.ts @@ -1,6 +1,6 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { HistoryStates } from "../../../src/data/history"; -import { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { HistoryStates } from "../../../src/data/history"; +import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; const generateStateHistory = ( state: HassEntity, diff --git a/demo/src/stubs/icons.ts b/demo/src/stubs/icons.ts index 930a245d525b..fa806cef7363 100644 --- a/demo/src/stubs/icons.ts +++ b/demo/src/stubs/icons.ts @@ -1,6 +1,6 @@ -import { IconCategory } from "../../../src/data/icons"; +import type { IconCategory } from "../../../src/data/icons"; import { ENTITY_COMPONENT_ICONS } from "../../../src/fake_data/entity_component_icons"; -import { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; export const mockIcons = (hass: MockHomeAssistant) => { hass.mockWS( diff --git a/demo/src/stubs/label_registry.ts b/demo/src/stubs/label_registry.ts index 27ca8fdc8e9a..0d953dc79c70 100644 --- a/demo/src/stubs/label_registry.ts +++ b/demo/src/stubs/label_registry.ts @@ -1,4 +1,4 @@ -import { LabelRegistryEntry } from "../../../src/data/label_registry"; +import type { LabelRegistryEntry } from "../../../src/data/label_registry"; import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; export const mockLabelRegistry = ( diff --git a/demo/src/stubs/media_player.ts b/demo/src/stubs/media_player.ts index c40f38755b28..26982d28e53e 100644 --- a/demo/src/stubs/media_player.ts +++ b/demo/src/stubs/media_player.ts @@ -1,4 +1,4 @@ -import { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; export const mockMediaPlayer = (hass: MockHomeAssistant) => { hass.mockWS("media_player_thumbnail", () => Promise.reject()); diff --git a/demo/src/stubs/persistent_notification.ts b/demo/src/stubs/persistent_notification.ts index 04b46e5f9726..060e660ee2c9 100644 --- a/demo/src/stubs/persistent_notification.ts +++ b/demo/src/stubs/persistent_notification.ts @@ -1,5 +1,5 @@ -import { PersistentNotificationMessage } from "../../../src/data/persistent_notification"; -import { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; +import type { PersistentNotificationMessage } from "../../../src/data/persistent_notification"; +import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; export const mockPersistentNotification = (hass: MockHomeAssistant) => { hass.mockWS("persistent_notification/subscribe", (_msg, _hass, onChange) => { diff --git a/demo/src/stubs/recorder.ts b/demo/src/stubs/recorder.ts index 14b3c348edcf..e5f3adfd89b4 100644 --- a/demo/src/stubs/recorder.ts +++ b/demo/src/stubs/recorder.ts @@ -5,12 +5,12 @@ import { differenceInHours, endOfDay, } from "date-fns"; -import { +import type { Statistics, StatisticsMetaData, StatisticValue, } from "../../../src/data/recorder"; -import { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; const generateMeanStatistics = ( start: Date, diff --git a/demo/src/stubs/sensor.ts b/demo/src/stubs/sensor.ts index 19c9f2e3441b..20adaec816a6 100644 --- a/demo/src/stubs/sensor.ts +++ b/demo/src/stubs/sensor.ts @@ -1,4 +1,4 @@ -import { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; export const mockSensor = (hass: MockHomeAssistant) => { hass.mockWS("sensor/numeric_device_classes", () => [ diff --git a/demo/src/stubs/system_log.ts b/demo/src/stubs/system_log.ts index a056d6ad7952..e033b4812625 100644 --- a/demo/src/stubs/system_log.ts +++ b/demo/src/stubs/system_log.ts @@ -1,4 +1,4 @@ -import { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; export const mockSystemLog = (hass: MockHomeAssistant) => { hass.mockAPI("error/all", () => []); diff --git a/demo/src/stubs/tags.ts b/demo/src/stubs/tags.ts index 0634d4009333..dd9d83a44cb4 100644 --- a/demo/src/stubs/tags.ts +++ b/demo/src/stubs/tags.ts @@ -1,5 +1,5 @@ -import { Tag } from "../../../src/data/tag"; -import { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; +import type { Tag } from "../../../src/data/tag"; +import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; export const mockTags = (hass: MockHomeAssistant) => { hass.mockWS("tag/list", () => [{ id: "my-tag", name: "My Tag" }] as Tag[]); diff --git a/demo/src/stubs/template.ts b/demo/src/stubs/template.ts index fc47a08393db..091cff24886a 100644 --- a/demo/src/stubs/template.ts +++ b/demo/src/stubs/template.ts @@ -1,4 +1,4 @@ -import { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; export const mockTemplate = (hass: MockHomeAssistant) => { hass.mockAPI("template", () => diff --git a/demo/src/stubs/todo.ts b/demo/src/stubs/todo.ts index 71d49cdede68..e9daab28744e 100644 --- a/demo/src/stubs/todo.ts +++ b/demo/src/stubs/todo.ts @@ -1,5 +1,6 @@ -import { TodoItem, TodoItemStatus } from "../../../src/data/todo"; -import { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; +import type { TodoItem } from "../../../src/data/todo"; +import { TodoItemStatus } from "../../../src/data/todo"; +import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; export const mockTodo = (hass: MockHomeAssistant) => { hass.mockWS("todo/item/list", () => ({ diff --git a/demo/src/stubs/translations.ts b/demo/src/stubs/translations.ts index 7eced853f03a..ffe9f6417431 100644 --- a/demo/src/stubs/translations.ts +++ b/demo/src/stubs/translations.ts @@ -1,4 +1,4 @@ -import { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; export const mockTranslations = (hass: MockHomeAssistant) => { hass.mockWS( diff --git a/gallery/src/components/demo-black-white-row.ts b/gallery/src/components/demo-black-white-row.ts index 851cb5bb7147..d043136abba7 100644 --- a/gallery/src/components/demo-black-white-row.ts +++ b/gallery/src/components/demo-black-white-row.ts @@ -1,5 +1,7 @@ -import { Button } from "@material/mwc-button"; -import { html, LitElement, css, TemplateResult, nothing } from "lit"; +import "@material/mwc-button/mwc-button"; +import type { Button } from "@material/mwc-button"; +import type { TemplateResult } from "lit"; +import { html, LitElement, css, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { applyThemesOnElement } from "../../../src/common/dom/apply_themes_on_element"; import { fireEvent } from "../../../src/common/dom/fire_event"; diff --git a/gallery/src/components/demo-card.ts b/gallery/src/components/demo-card.ts index 50048f081afb..968b7cb273e4 100644 --- a/gallery/src/components/demo-card.ts +++ b/gallery/src/components/demo-card.ts @@ -1,10 +1,11 @@ import { load } from "js-yaml"; -import { LitElement, PropertyValueMap, css, html, nothing } from "lit"; +import type { PropertyValueMap } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import "../../../src/panels/lovelace/cards/hui-card"; import type { HuiCard } from "../../../src/panels/lovelace/cards/hui-card"; -import { HomeAssistant } from "../../../src/types"; +import type { HomeAssistant } from "../../../src/types"; export interface DemoCardConfig { heading: string; diff --git a/gallery/src/components/demo-cards.ts b/gallery/src/components/demo-cards.ts index c2e117ceeb5d..5571e1c09f25 100644 --- a/gallery/src/components/demo-cards.ts +++ b/gallery/src/components/demo-cards.ts @@ -3,7 +3,7 @@ import { customElement, property, query, state } from "lit/decorators"; import { applyThemesOnElement } from "../../../src/common/dom/apply_themes_on_element"; import "../../../src/components/ha-formfield"; import "../../../src/components/ha-switch"; -import { HomeAssistant } from "../../../src/types"; +import type { HomeAssistant } from "../../../src/types"; import "./demo-card"; import type { DemoCardConfig } from "./demo-card"; import "../ha-demo-options"; diff --git a/gallery/src/components/demo-more-info.ts b/gallery/src/components/demo-more-info.ts index dd1b03781634..c1dd5d091eb8 100644 --- a/gallery/src/components/demo-more-info.ts +++ b/gallery/src/components/demo-more-info.ts @@ -4,7 +4,7 @@ import "../../../src/components/ha-card"; import "../../../src/dialogs/more-info/more-info-content"; import "../../../src/state-summary/state-card-content"; import "../ha-demo-options"; -import { HomeAssistant } from "../../../src/types"; +import type { HomeAssistant } from "../../../src/types"; @customElement("demo-more-info") class DemoMoreInfo extends LitElement { diff --git a/gallery/src/components/demo-more-infos.ts b/gallery/src/components/demo-more-infos.ts index af7703050c0c..19f16cf8cf82 100644 --- a/gallery/src/components/demo-more-infos.ts +++ b/gallery/src/components/demo-more-infos.ts @@ -3,7 +3,7 @@ import { customElement, property, state } from "lit/decorators"; import { applyThemesOnElement } from "../../../src/common/dom/apply_themes_on_element"; import "../../../src/components/ha-formfield"; import "../../../src/components/ha-switch"; -import { HomeAssistant } from "../../../src/types"; +import type { HomeAssistant } from "../../../src/types"; import "../ha-demo-options"; import "./demo-more-info"; diff --git a/gallery/src/data/traces/basic_trace.ts b/gallery/src/data/traces/basic_trace.ts index 22613244d775..04e75af74b07 100644 --- a/gallery/src/data/traces/basic_trace.ts +++ b/gallery/src/data/traces/basic_trace.ts @@ -1,4 +1,4 @@ -import { DemoTrace } from "./types"; +import type { DemoTrace } from "./types"; export const basicTrace: DemoTrace = { trace: { diff --git a/gallery/src/data/traces/mock-demo-trace.ts b/gallery/src/data/traces/mock-demo-trace.ts index 797c4430a5b1..f23a5e58f9f5 100644 --- a/gallery/src/data/traces/mock-demo-trace.ts +++ b/gallery/src/data/traces/mock-demo-trace.ts @@ -1,6 +1,6 @@ -import { LogbookEntry } from "../../../../src/data/logbook"; -import { AutomationTraceExtended } from "../../../../src/data/trace"; -import { DemoTrace } from "./types"; +import type { LogbookEntry } from "../../../../src/data/logbook"; +import type { AutomationTraceExtended } from "../../../../src/data/trace"; +import type { DemoTrace } from "./types"; export const mockDemoTrace = ( tracePartial: Partial, diff --git a/gallery/src/data/traces/motion-light-trace.ts b/gallery/src/data/traces/motion-light-trace.ts index 371cd7056a05..ee117af4c2c4 100644 --- a/gallery/src/data/traces/motion-light-trace.ts +++ b/gallery/src/data/traces/motion-light-trace.ts @@ -1,4 +1,4 @@ -import { DemoTrace } from "./types"; +import type { DemoTrace } from "./types"; export const motionLightTrace: DemoTrace = { trace: { diff --git a/gallery/src/data/traces/types.ts b/gallery/src/data/traces/types.ts index eb99350ebf53..c06cea33e5cc 100644 --- a/gallery/src/data/traces/types.ts +++ b/gallery/src/data/traces/types.ts @@ -1,5 +1,5 @@ -import { AutomationTraceExtended } from "../../../../src/data/trace"; -import { LogbookEntry } from "../../../../src/data/logbook"; +import type { AutomationTraceExtended } from "../../../../src/data/trace"; +import type { LogbookEntry } from "../../../../src/data/logbook"; export interface DemoTrace { trace: AutomationTraceExtended; diff --git a/gallery/src/ha-gallery.ts b/gallery/src/ha-gallery.ts index eec45d2b525a..1f079497a059 100644 --- a/gallery/src/ha-gallery.ts +++ b/gallery/src/ha-gallery.ts @@ -1,7 +1,8 @@ import "@material/mwc-drawer"; import "@material/mwc-top-app-bar-fixed"; import { mdiMenu } from "@mdi/js"; -import { LitElement, PropertyValues, css, html } from "lit"; +import type { PropertyValues } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, query, state } from "lit/decorators"; import { dynamicElement } from "../../src/common/dom/dynamic-element-directive"; import { HaExpansionPanel } from "../../src/components/ha-expansion-panel"; diff --git a/gallery/src/pages/automation/describe-action.ts b/gallery/src/pages/automation/describe-action.ts index 57bd649d5400..9ea22d5f74d8 100644 --- a/gallery/src/pages/automation/describe-action.ts +++ b/gallery/src/pages/automation/describe-action.ts @@ -3,11 +3,11 @@ import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../../src/components/ha-card"; import "../../../../src/components/ha-yaml-editor"; -import { Action } from "../../../../src/data/script"; +import type { Action } from "../../../../src/data/script"; import { describeAction } from "../../../../src/data/script_i18n"; import { getEntity } from "../../../../src/fake_data/entity"; import { provideHass } from "../../../../src/fake_data/provide_hass"; -import { HomeAssistant } from "../../../../src/types"; +import type { HomeAssistant } from "../../../../src/types"; const ENTITIES = [ getEntity("scene", "kitchen_morning", "scening", { diff --git a/gallery/src/pages/automation/describe-condition.ts b/gallery/src/pages/automation/describe-condition.ts index 6ec74c67949d..36b6673f3a86 100644 --- a/gallery/src/pages/automation/describe-condition.ts +++ b/gallery/src/pages/automation/describe-condition.ts @@ -3,11 +3,11 @@ import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../../src/components/ha-card"; import "../../../../src/components/ha-yaml-editor"; -import { Condition } from "../../../../src/data/automation"; +import type { Condition } from "../../../../src/data/automation"; import { describeCondition } from "../../../../src/data/automation_i18n"; import { getEntity } from "../../../../src/fake_data/entity"; import { provideHass } from "../../../../src/fake_data/provide_hass"; -import { HomeAssistant } from "../../../../src/types"; +import type { HomeAssistant } from "../../../../src/types"; const ENTITIES = [ getEntity("light", "kitchen", "on", { diff --git a/gallery/src/pages/automation/describe-trigger.ts b/gallery/src/pages/automation/describe-trigger.ts index 8c462060b06d..6e3186911c6f 100644 --- a/gallery/src/pages/automation/describe-trigger.ts +++ b/gallery/src/pages/automation/describe-trigger.ts @@ -3,11 +3,11 @@ import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../../src/components/ha-card"; import "../../../../src/components/ha-yaml-editor"; -import { Trigger } from "../../../../src/data/automation"; +import type { Trigger } from "../../../../src/data/automation"; import { describeTrigger } from "../../../../src/data/automation_i18n"; import { getEntity } from "../../../../src/fake_data/entity"; import { provideHass } from "../../../../src/fake_data/provide_hass"; -import { HomeAssistant } from "../../../../src/types"; +import type { HomeAssistant } from "../../../../src/types"; const ENTITIES = [ getEntity("light", "kitchen", "on", { diff --git a/gallery/src/pages/automation/editor-action.ts b/gallery/src/pages/automation/editor-action.ts index fb7ab5fc2bed..7f45fc83adad 100644 --- a/gallery/src/pages/automation/editor-action.ts +++ b/gallery/src/pages/automation/editor-action.ts @@ -1,5 +1,6 @@ /* eslint-disable lit/no-template-arrow */ -import { LitElement, TemplateResult, html, css } from "lit"; +import type { TemplateResult } from "lit"; +import { LitElement, html, css } from "lit"; import { customElement, state } from "lit/decorators"; import { provideHass } from "../../../../src/fake_data/provide_hass"; import type { HomeAssistant } from "../../../../src/types"; @@ -18,7 +19,7 @@ import { HaSceneAction } from "../../../../src/panels/config/automation/action/t import { HaServiceAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-service"; import { HaWaitForTriggerAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-wait_for_trigger"; import { HaWaitAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-wait_template"; -import { Action } from "../../../../src/data/script"; +import type { Action } from "../../../../src/data/script"; import { HaConditionAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-condition"; import { HaSequenceAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-sequence"; import { HaParallelAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-parallel"; diff --git a/gallery/src/pages/automation/editor-condition.ts b/gallery/src/pages/automation/editor-condition.ts index 9095461c69f5..e30a1044043f 100644 --- a/gallery/src/pages/automation/editor-condition.ts +++ b/gallery/src/pages/automation/editor-condition.ts @@ -1,5 +1,6 @@ /* eslint-disable lit/no-template-arrow */ -import { LitElement, TemplateResult, html, css } from "lit"; +import type { TemplateResult } from "lit"; +import { LitElement, html, css } from "lit"; import { customElement, state } from "lit/decorators"; import { provideHass } from "../../../../src/fake_data/provide_hass"; import type { HomeAssistant } from "../../../../src/types"; diff --git a/gallery/src/pages/automation/editor-trigger.ts b/gallery/src/pages/automation/editor-trigger.ts index 1d94c5676c78..c8f8bab70aea 100644 --- a/gallery/src/pages/automation/editor-trigger.ts +++ b/gallery/src/pages/automation/editor-trigger.ts @@ -1,5 +1,6 @@ /* eslint-disable lit/no-template-arrow */ -import { LitElement, TemplateResult, html, css } from "lit"; +import type { TemplateResult } from "lit"; +import { LitElement, html, css } from "lit"; import { customElement, state } from "lit/decorators"; import { provideHass } from "../../../../src/fake_data/provide_hass"; import type { HomeAssistant } from "../../../../src/types"; diff --git a/gallery/src/pages/automation/trace-timeline.ts b/gallery/src/pages/automation/trace-timeline.ts index 4f5692b7da0f..d33b577c77b6 100644 --- a/gallery/src/pages/automation/trace-timeline.ts +++ b/gallery/src/pages/automation/trace-timeline.ts @@ -5,9 +5,9 @@ import { customElement, property } from "lit/decorators"; import "../../../../src/components/ha-card"; import "../../../../src/components/trace/hat-trace-timeline"; import { provideHass } from "../../../../src/fake_data/provide_hass"; -import { HomeAssistant } from "../../../../src/types"; +import type { HomeAssistant } from "../../../../src/types"; import { mockDemoTrace } from "../../data/traces/mock-demo-trace"; -import { DemoTrace } from "../../data/traces/types"; +import type { DemoTrace } from "../../data/traces/types"; const traces: DemoTrace[] = [ mockDemoTrace({ state: "running" }), diff --git a/gallery/src/pages/automation/trace.ts b/gallery/src/pages/automation/trace.ts index 4d346095f81b..573ab49be0d8 100644 --- a/gallery/src/pages/automation/trace.ts +++ b/gallery/src/pages/automation/trace.ts @@ -6,10 +6,10 @@ import "../../../../src/components/ha-card"; import "../../../../src/components/trace/hat-script-graph"; import "../../../../src/components/trace/hat-trace-timeline"; import { provideHass } from "../../../../src/fake_data/provide_hass"; -import { HomeAssistant } from "../../../../src/types"; +import type { HomeAssistant } from "../../../../src/types"; import { basicTrace } from "../../data/traces/basic_trace"; import { motionLightTrace } from "../../data/traces/motion-light-trace"; -import { DemoTrace } from "../../data/traces/types"; +import type { DemoTrace } from "../../data/traces/types"; const traces: DemoTrace[] = [basicTrace, motionLightTrace]; diff --git a/gallery/src/pages/components/ha-alert.ts b/gallery/src/pages/components/ha-alert.ts index a0d3f309fb31..aa1c30465205 100644 --- a/gallery/src/pages/components/ha-alert.ts +++ b/gallery/src/pages/components/ha-alert.ts @@ -1,5 +1,6 @@ import "@material/mwc-button/mwc-button"; -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement } from "lit/decorators"; import { applyThemesOnElement } from "../../../../src/common/dom/apply_themes_on_element"; import "../../../../src/components/ha-alert"; diff --git a/gallery/src/pages/components/ha-bar.ts b/gallery/src/pages/components/ha-bar.ts index 797e3ff30676..31aa5e6f51ed 100644 --- a/gallery/src/pages/components/ha-bar.ts +++ b/gallery/src/pages/components/ha-bar.ts @@ -1,4 +1,5 @@ -import { html, css, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { html, css, LitElement } from "lit"; import { customElement } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import "../../../../src/components/ha-bar"; diff --git a/gallery/src/pages/components/ha-chips.ts b/gallery/src/pages/components/ha-chips.ts index 677f0c7bf9c7..04ea2002ec18 100644 --- a/gallery/src/pages/components/ha-chips.ts +++ b/gallery/src/pages/components/ha-chips.ts @@ -1,4 +1,5 @@ -import { css, html, LitElement, TemplateResult, nothing } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement } from "lit/decorators"; import "../../../../src/components/ha-card"; import "../../../../src/components/chips/ha-chip-set"; diff --git a/gallery/src/pages/components/ha-circular-progress.ts b/gallery/src/pages/components/ha-circular-progress.ts index 20347353da0c..a3a6763cfd16 100644 --- a/gallery/src/pages/components/ha-circular-progress.ts +++ b/gallery/src/pages/components/ha-circular-progress.ts @@ -1,10 +1,11 @@ -import { html, css, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { html, css, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../../src/components/ha-bar"; import "../../../../src/components/ha-card"; import "../../../../src/components/ha-circular-progress"; import "@material/web/progress/circular-progress"; -import { HomeAssistant } from "../../../../src/types"; +import type { HomeAssistant } from "../../../../src/types"; @customElement("demo-components-ha-circular-progress") export class DemoHaCircularProgress extends LitElement { diff --git a/gallery/src/pages/components/ha-control-button.ts b/gallery/src/pages/components/ha-control-button.ts index 2c5cfd2e21a2..247d273988ca 100644 --- a/gallery/src/pages/components/ha-control-button.ts +++ b/gallery/src/pages/components/ha-control-button.ts @@ -4,7 +4,8 @@ import { mdiFanSpeed3, mdiLightbulb, } from "@mdi/js"; -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { repeat } from "lit/directives/repeat"; diff --git a/gallery/src/pages/components/ha-control-circular-slider.ts b/gallery/src/pages/components/ha-control-circular-slider.ts index 4a856fe31b15..ec1561c2fdbd 100644 --- a/gallery/src/pages/components/ha-control-circular-slider.ts +++ b/gallery/src/pages/components/ha-control-circular-slider.ts @@ -1,4 +1,5 @@ -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, state } from "lit/decorators"; import "../../../../src/components/ha-card"; import "../../../../src/components/ha-control-circular-slider"; diff --git a/gallery/src/pages/components/ha-control-number-buttons.ts b/gallery/src/pages/components/ha-control-number-buttons.ts index 9b9dcc68048c..43c4ccc6228c 100644 --- a/gallery/src/pages/components/ha-control-number-buttons.ts +++ b/gallery/src/pages/components/ha-control-number-buttons.ts @@ -1,4 +1,5 @@ -import { LitElement, TemplateResult, css, html } from "lit"; +import type { TemplateResult } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, state } from "lit/decorators"; import "../../../../src/components/ha-card"; import "../../../../src/components/ha-control-number-buttons"; diff --git a/gallery/src/pages/components/ha-control-select-menu.ts b/gallery/src/pages/components/ha-control-select-menu.ts index c3e15cddaf24..30ae5f63e15c 100644 --- a/gallery/src/pages/components/ha-control-select-menu.ts +++ b/gallery/src/pages/components/ha-control-select-menu.ts @@ -1,5 +1,6 @@ import { mdiFan, mdiFanSpeed1, mdiFanSpeed2, mdiFanSpeed3 } from "@mdi/js"; -import { LitElement, TemplateResult, css, html, nothing } from "lit"; +import type { TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement } from "lit/decorators"; import { repeat } from "lit/directives/repeat"; import "../../../../src/components/ha-card"; diff --git a/gallery/src/pages/components/ha-control-select.ts b/gallery/src/pages/components/ha-control-select.ts index 8ab5f0ea891a..11cc4632082c 100644 --- a/gallery/src/pages/components/ha-control-select.ts +++ b/gallery/src/pages/components/ha-control-select.ts @@ -1,5 +1,6 @@ import { mdiFanOff, mdiFanSpeed1, mdiFanSpeed2, mdiFanSpeed3 } from "@mdi/js"; -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { repeat } from "lit/directives/repeat"; diff --git a/gallery/src/pages/components/ha-control-slider.ts b/gallery/src/pages/components/ha-control-slider.ts index ee1ef8a66288..1202137e762f 100644 --- a/gallery/src/pages/components/ha-control-slider.ts +++ b/gallery/src/pages/components/ha-control-slider.ts @@ -1,4 +1,5 @@ -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { repeat } from "lit/directives/repeat"; diff --git a/gallery/src/pages/components/ha-control-switch.ts b/gallery/src/pages/components/ha-control-switch.ts index dc154b725d7e..206155490a36 100644 --- a/gallery/src/pages/components/ha-control-switch.ts +++ b/gallery/src/pages/components/ha-control-switch.ts @@ -4,7 +4,8 @@ import { mdiLightbulb, mdiLightbulbOff, } from "@mdi/js"; -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { repeat } from "lit/directives/repeat"; diff --git a/gallery/src/pages/components/ha-expansion-panel.ts b/gallery/src/pages/components/ha-expansion-panel.ts index e739ee7ab13d..5896ba08ffae 100644 --- a/gallery/src/pages/components/ha-expansion-panel.ts +++ b/gallery/src/pages/components/ha-expansion-panel.ts @@ -1,5 +1,6 @@ import { mdiPacMan } from "@mdi/js"; -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement } from "lit/decorators"; import "../../../../src/components/ha-card"; import "../../../../src/components/ha-expansion-panel"; diff --git a/gallery/src/pages/components/ha-faded.ts b/gallery/src/pages/components/ha-faded.ts index ad9970fadfd8..d053a8f662f7 100644 --- a/gallery/src/pages/components/ha-faded.ts +++ b/gallery/src/pages/components/ha-faded.ts @@ -1,4 +1,5 @@ -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement } from "lit/decorators"; import "../../../../src/components/ha-card"; import "../../../../src/components/ha-faded"; diff --git a/gallery/src/pages/components/ha-form.ts b/gallery/src/pages/components/ha-form.ts index e33b7f87802a..61495e4f785d 100644 --- a/gallery/src/pages/components/ha-form.ts +++ b/gallery/src/pages/components/ha-form.ts @@ -1,6 +1,7 @@ /* eslint-disable lit/no-template-arrow */ import "@material/mwc-button"; -import { html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, state } from "lit/decorators"; import { mockAreaRegistry } from "../../../../demo/src/stubs/area_registry"; import { mockConfigEntries } from "../../../../demo/src/stubs/config_entries"; @@ -13,9 +14,9 @@ import type { HaFormSchema } from "../../../../src/components/ha-form/types"; import type { AreaRegistryEntry } from "../../../../src/data/area_registry"; import { getEntity } from "../../../../src/fake_data/entity"; import { provideHass } from "../../../../src/fake_data/provide_hass"; -import { HomeAssistant } from "../../../../src/types"; +import type { HomeAssistant } from "../../../../src/types"; import "../../components/demo-black-white-row"; -import { DeviceRegistryEntry } from "../../../../src/data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../src/data/device_registry"; const ENTITIES = [ getEntity("alarm_control_panel", "alarm", "disarmed", { diff --git a/gallery/src/pages/components/ha-hs-color-picker.ts b/gallery/src/pages/components/ha-hs-color-picker.ts index 7092c399e8fc..005ab06c091a 100644 --- a/gallery/src/pages/components/ha-hs-color-picker.ts +++ b/gallery/src/pages/components/ha-hs-color-picker.ts @@ -1,6 +1,7 @@ import "../../../../src/components/ha-hs-color-picker"; -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, state } from "lit/decorators"; import "../../../../src/components/ha-card"; diff --git a/gallery/src/pages/components/ha-label-badge.ts b/gallery/src/pages/components/ha-label-badge.ts index 7a164dc87ea6..7bce55ef5646 100644 --- a/gallery/src/pages/components/ha-label-badge.ts +++ b/gallery/src/pages/components/ha-label-badge.ts @@ -1,4 +1,5 @@ -import { html, css, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { html, css, LitElement } from "lit"; import { customElement } from "lit/decorators"; import "../../../../src/components/ha-label-badge"; import "../../../../src/components/ha-card"; diff --git a/gallery/src/pages/components/ha-selector.ts b/gallery/src/pages/components/ha-selector.ts index 8230fceccf24..08556fc12c0e 100644 --- a/gallery/src/pages/components/ha-selector.ts +++ b/gallery/src/pages/components/ha-selector.ts @@ -1,6 +1,7 @@ /* eslint-disable lit/no-template-arrow */ import "@material/mwc-button"; -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, state } from "lit/decorators"; import { mockAreaRegistry } from "../../../../demo/src/stubs/area_registry"; import { mockConfigEntries } from "../../../../demo/src/stubs/config_entries"; @@ -10,18 +11,18 @@ import { mockHassioSupervisor } from "../../../../demo/src/stubs/hassio_supervis import "../../../../src/components/ha-selector/ha-selector"; import "../../../../src/components/ha-settings-row"; import type { AreaRegistryEntry } from "../../../../src/data/area_registry"; -import { BlueprintInput } from "../../../../src/data/blueprint"; +import type { BlueprintInput } from "../../../../src/data/blueprint"; import { showDialog } from "../../../../src/dialogs/make-dialog-manager"; import { getEntity } from "../../../../src/fake_data/entity"; import { provideHass } from "../../../../src/fake_data/provide_hass"; -import { ProvideHassElement } from "../../../../src/mixins/provide-hass-lit-mixin"; +import type { ProvideHassElement } from "../../../../src/mixins/provide-hass-lit-mixin"; import type { HomeAssistant } from "../../../../src/types"; import "../../components/demo-black-white-row"; -import { FloorRegistryEntry } from "../../../../src/data/floor_registry"; -import { LabelRegistryEntry } from "../../../../src/data/label_registry"; +import type { FloorRegistryEntry } from "../../../../src/data/floor_registry"; +import type { LabelRegistryEntry } from "../../../../src/data/label_registry"; import { mockFloorRegistry } from "../../../../demo/src/stubs/floor_registry"; import { mockLabelRegistry } from "../../../../demo/src/stubs/label_registry"; -import { DeviceRegistryEntry } from "../../../../src/data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../src/data/device_registry"; const ENTITIES = [ getEntity("alarm_control_panel", "alarm", "disarmed", { diff --git a/gallery/src/pages/components/ha-tip.ts b/gallery/src/pages/components/ha-tip.ts index b9e9e5fc73a0..b9d7bdfa7f1b 100644 --- a/gallery/src/pages/components/ha-tip.ts +++ b/gallery/src/pages/components/ha-tip.ts @@ -1,4 +1,5 @@ -import { html, css, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { html, css, LitElement } from "lit"; import { customElement } from "lit/decorators"; import "../../../../src/components/ha-tip"; import "../../../../src/components/ha-card"; diff --git a/gallery/src/pages/date-time/date-time-numeric.ts b/gallery/src/pages/date-time/date-time-numeric.ts index 25f2db7c4571..5bb37c758d85 100644 --- a/gallery/src/pages/date-time/date-time-numeric.ts +++ b/gallery/src/pages/date-time/date-time-numeric.ts @@ -4,10 +4,10 @@ import { customElement, state } from "lit/decorators"; import { formatDateTimeNumeric } from "../../../../src/common/datetime/format_date_time"; import "../../../../src/components/ha-card"; import "../../../../src/components/ha-control-select"; +import type { FrontendLocaleData } from "../../../../src/data/translation"; import { DateFormat, FirstWeekday, - FrontendLocaleData, NumberFormat, TimeFormat, TimeZone, diff --git a/gallery/src/pages/date-time/date-time-seconds.ts b/gallery/src/pages/date-time/date-time-seconds.ts index 3cd5b4518bd4..3e21900722ed 100644 --- a/gallery/src/pages/date-time/date-time-seconds.ts +++ b/gallery/src/pages/date-time/date-time-seconds.ts @@ -4,10 +4,10 @@ import { customElement, state } from "lit/decorators"; import { formatDateTimeWithSeconds } from "../../../../src/common/datetime/format_date_time"; import "../../../../src/components/ha-card"; import "../../../../src/components/ha-control-select"; +import type { FrontendLocaleData } from "../../../../src/data/translation"; import { DateFormat, FirstWeekday, - FrontendLocaleData, NumberFormat, TimeFormat, TimeZone, diff --git a/gallery/src/pages/date-time/date-time-short-year.ts b/gallery/src/pages/date-time/date-time-short-year.ts index ecd50c369bd5..f344d0c927c1 100644 --- a/gallery/src/pages/date-time/date-time-short-year.ts +++ b/gallery/src/pages/date-time/date-time-short-year.ts @@ -4,10 +4,10 @@ import { customElement, state } from "lit/decorators"; import { formatShortDateTimeWithYear } from "../../../../src/common/datetime/format_date_time"; import "../../../../src/components/ha-card"; import "../../../../src/components/ha-control-select"; +import type { FrontendLocaleData } from "../../../../src/data/translation"; import { DateFormat, FirstWeekday, - FrontendLocaleData, NumberFormat, TimeFormat, TimeZone, diff --git a/gallery/src/pages/date-time/date-time-short.ts b/gallery/src/pages/date-time/date-time-short.ts index 67bde5a50db3..40784702106a 100644 --- a/gallery/src/pages/date-time/date-time-short.ts +++ b/gallery/src/pages/date-time/date-time-short.ts @@ -4,10 +4,10 @@ import { customElement, state } from "lit/decorators"; import { formatShortDateTime } from "../../../../src/common/datetime/format_date_time"; import "../../../../src/components/ha-card"; import "../../../../src/components/ha-control-select"; +import type { FrontendLocaleData } from "../../../../src/data/translation"; import { DateFormat, FirstWeekday, - FrontendLocaleData, NumberFormat, TimeFormat, TimeZone, diff --git a/gallery/src/pages/date-time/date-time.ts b/gallery/src/pages/date-time/date-time.ts index 31b2e03bd267..cbdaf51366b8 100644 --- a/gallery/src/pages/date-time/date-time.ts +++ b/gallery/src/pages/date-time/date-time.ts @@ -4,10 +4,10 @@ import { customElement, state } from "lit/decorators"; import { formatDateTime } from "../../../../src/common/datetime/format_date_time"; import "../../../../src/components/ha-card"; import "../../../../src/components/ha-control-select"; +import type { FrontendLocaleData } from "../../../../src/data/translation"; import { DateFormat, FirstWeekday, - FrontendLocaleData, NumberFormat, TimeFormat, TimeZone, diff --git a/gallery/src/pages/date-time/date.ts b/gallery/src/pages/date-time/date.ts index 0015d1e5661b..805460720f3b 100644 --- a/gallery/src/pages/date-time/date.ts +++ b/gallery/src/pages/date-time/date.ts @@ -3,10 +3,10 @@ import { css, html, LitElement } from "lit"; import { customElement } from "lit/decorators"; import { formatDateNumeric } from "../../../../src/common/datetime/format_date"; import "../../../../src/components/ha-card"; +import type { FrontendLocaleData } from "../../../../src/data/translation"; import { DateFormat, FirstWeekday, - FrontendLocaleData, NumberFormat, TimeFormat, TimeZone, diff --git a/gallery/src/pages/date-time/time-seconds.ts b/gallery/src/pages/date-time/time-seconds.ts index d4c08ab64393..2faaed001027 100644 --- a/gallery/src/pages/date-time/time-seconds.ts +++ b/gallery/src/pages/date-time/time-seconds.ts @@ -4,10 +4,10 @@ import { customElement, state } from "lit/decorators"; import { formatTimeWithSeconds } from "../../../../src/common/datetime/format_time"; import "../../../../src/components/ha-card"; import "../../../../src/components/ha-control-select"; +import type { FrontendLocaleData } from "../../../../src/data/translation"; import { DateFormat, FirstWeekday, - FrontendLocaleData, NumberFormat, TimeFormat, TimeZone, diff --git a/gallery/src/pages/date-time/time-weekday.ts b/gallery/src/pages/date-time/time-weekday.ts index 55f01368c5df..93c63939ac84 100644 --- a/gallery/src/pages/date-time/time-weekday.ts +++ b/gallery/src/pages/date-time/time-weekday.ts @@ -4,10 +4,10 @@ import { customElement, state } from "lit/decorators"; import { formatTimeWeekday } from "../../../../src/common/datetime/format_time"; import "../../../../src/components/ha-card"; import "../../../../src/components/ha-control-select"; +import type { FrontendLocaleData } from "../../../../src/data/translation"; import { DateFormat, FirstWeekday, - FrontendLocaleData, NumberFormat, TimeFormat, TimeZone, diff --git a/gallery/src/pages/date-time/time.ts b/gallery/src/pages/date-time/time.ts index db15fc3d4f90..83df510a7aad 100644 --- a/gallery/src/pages/date-time/time.ts +++ b/gallery/src/pages/date-time/time.ts @@ -4,10 +4,10 @@ import { customElement, state } from "lit/decorators"; import { formatTime } from "../../../../src/common/datetime/format_time"; import "../../../../src/components/ha-card"; import "../../../../src/components/ha-control-select"; +import type { FrontendLocaleData } from "../../../../src/data/translation"; import { DateFormat, FirstWeekday, - FrontendLocaleData, NumberFormat, TimeFormat, TimeZone, diff --git a/gallery/src/pages/lovelace/alarm-panel-card.ts b/gallery/src/pages/lovelace/alarm-panel-card.ts index 45a4c20b689e..d2a596f2e1ab 100644 --- a/gallery/src/pages/lovelace/alarm-panel-card.ts +++ b/gallery/src/pages/lovelace/alarm-panel-card.ts @@ -1,4 +1,5 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, query } from "lit/decorators"; import { getEntity } from "../../../../src/fake_data/entity"; import { provideHass } from "../../../../src/fake_data/provide_hass"; diff --git a/gallery/src/pages/lovelace/area-card.ts b/gallery/src/pages/lovelace/area-card.ts index ea7afd7db912..75f77ac7a606 100644 --- a/gallery/src/pages/lovelace/area-card.ts +++ b/gallery/src/pages/lovelace/area-card.ts @@ -1,4 +1,5 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, query } from "lit/decorators"; import { getEntity } from "../../../../src/fake_data/entity"; import { provideHass } from "../../../../src/fake_data/provide_hass"; diff --git a/gallery/src/pages/lovelace/conditional-card.ts b/gallery/src/pages/lovelace/conditional-card.ts index b59d5b3bad26..1943e525105e 100644 --- a/gallery/src/pages/lovelace/conditional-card.ts +++ b/gallery/src/pages/lovelace/conditional-card.ts @@ -1,4 +1,5 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, query } from "lit/decorators"; import { getEntity } from "../../../../src/fake_data/entity"; import { provideHass } from "../../../../src/fake_data/provide_hass"; diff --git a/gallery/src/pages/lovelace/entities-card.ts b/gallery/src/pages/lovelace/entities-card.ts index 45842de2a64c..39e756623bea 100644 --- a/gallery/src/pages/lovelace/entities-card.ts +++ b/gallery/src/pages/lovelace/entities-card.ts @@ -1,4 +1,5 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, query } from "lit/decorators"; import { getEntity } from "../../../../src/fake_data/entity"; import { provideHass } from "../../../../src/fake_data/provide_hass"; diff --git a/gallery/src/pages/lovelace/entity-button-card.ts b/gallery/src/pages/lovelace/entity-button-card.ts index daa607157127..3a7a270999b3 100644 --- a/gallery/src/pages/lovelace/entity-button-card.ts +++ b/gallery/src/pages/lovelace/entity-button-card.ts @@ -1,4 +1,5 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, query } from "lit/decorators"; import { getEntity } from "../../../../src/fake_data/entity"; import { provideHass } from "../../../../src/fake_data/provide_hass"; diff --git a/gallery/src/pages/lovelace/entity-filter-card.ts b/gallery/src/pages/lovelace/entity-filter-card.ts index 45dc70881d45..6d28383acca9 100644 --- a/gallery/src/pages/lovelace/entity-filter-card.ts +++ b/gallery/src/pages/lovelace/entity-filter-card.ts @@ -1,4 +1,5 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, query } from "lit/decorators"; import { getEntity } from "../../../../src/fake_data/entity"; import { provideHass } from "../../../../src/fake_data/provide_hass"; diff --git a/gallery/src/pages/lovelace/gauge-card.ts b/gallery/src/pages/lovelace/gauge-card.ts index 43d3e60d19e0..4c74ee556628 100644 --- a/gallery/src/pages/lovelace/gauge-card.ts +++ b/gallery/src/pages/lovelace/gauge-card.ts @@ -1,4 +1,5 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, query } from "lit/decorators"; import { getEntity } from "../../../../src/fake_data/entity"; import { provideHass } from "../../../../src/fake_data/provide_hass"; diff --git a/gallery/src/pages/lovelace/glance-card.ts b/gallery/src/pages/lovelace/glance-card.ts index ab2f29d9748a..f10b758aa973 100644 --- a/gallery/src/pages/lovelace/glance-card.ts +++ b/gallery/src/pages/lovelace/glance-card.ts @@ -1,4 +1,5 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, query } from "lit/decorators"; import { getEntity } from "../../../../src/fake_data/entity"; import { provideHass } from "../../../../src/fake_data/provide_hass"; diff --git a/gallery/src/pages/lovelace/grid-and-stack-card.ts b/gallery/src/pages/lovelace/grid-and-stack-card.ts index bac8a6f157e2..79048043bfd5 100644 --- a/gallery/src/pages/lovelace/grid-and-stack-card.ts +++ b/gallery/src/pages/lovelace/grid-and-stack-card.ts @@ -1,4 +1,5 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, query } from "lit/decorators"; import { mockHistory } from "../../../../demo/src/stubs/history"; import { getEntity } from "../../../../src/fake_data/entity"; diff --git a/gallery/src/pages/lovelace/iframe-card.ts b/gallery/src/pages/lovelace/iframe-card.ts index 72800f64070c..6fc35f0493e8 100644 --- a/gallery/src/pages/lovelace/iframe-card.ts +++ b/gallery/src/pages/lovelace/iframe-card.ts @@ -1,4 +1,5 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, query } from "lit/decorators"; import { provideHass } from "../../../../src/fake_data/provide_hass"; import "../../components/demo-cards"; diff --git a/gallery/src/pages/lovelace/light-card.ts b/gallery/src/pages/lovelace/light-card.ts index 1590edce0fce..cc6783291078 100644 --- a/gallery/src/pages/lovelace/light-card.ts +++ b/gallery/src/pages/lovelace/light-card.ts @@ -1,4 +1,5 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, query } from "lit/decorators"; import { getEntity } from "../../../../src/fake_data/entity"; import { provideHass } from "../../../../src/fake_data/provide_hass"; diff --git a/gallery/src/pages/lovelace/map-card.ts b/gallery/src/pages/lovelace/map-card.ts index db83496bf745..8debc6d991e0 100644 --- a/gallery/src/pages/lovelace/map-card.ts +++ b/gallery/src/pages/lovelace/map-card.ts @@ -1,4 +1,5 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, query } from "lit/decorators"; import { getEntity } from "../../../../src/fake_data/entity"; import { provideHass } from "../../../../src/fake_data/provide_hass"; diff --git a/gallery/src/pages/lovelace/markdown-card.ts b/gallery/src/pages/lovelace/markdown-card.ts index aa47310b52bf..b8e7f95c7312 100644 --- a/gallery/src/pages/lovelace/markdown-card.ts +++ b/gallery/src/pages/lovelace/markdown-card.ts @@ -1,4 +1,5 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, query } from "lit/decorators"; import { mockTemplate } from "../../../../demo/src/stubs/template"; import { provideHass } from "../../../../src/fake_data/provide_hass"; diff --git a/gallery/src/pages/lovelace/media-control-card.ts b/gallery/src/pages/lovelace/media-control-card.ts index 9fb7ab7b5bc8..ecbe7c2ed6c2 100644 --- a/gallery/src/pages/lovelace/media-control-card.ts +++ b/gallery/src/pages/lovelace/media-control-card.ts @@ -1,4 +1,5 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, query } from "lit/decorators"; import { provideHass } from "../../../../src/fake_data/provide_hass"; import "../../components/demo-cards"; diff --git a/gallery/src/pages/lovelace/media-player-row.ts b/gallery/src/pages/lovelace/media-player-row.ts index eeba128c0630..5562f7d8e051 100644 --- a/gallery/src/pages/lovelace/media-player-row.ts +++ b/gallery/src/pages/lovelace/media-player-row.ts @@ -1,4 +1,5 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, query } from "lit/decorators"; import { provideHass } from "../../../../src/fake_data/provide_hass"; import "../../components/demo-cards"; diff --git a/gallery/src/pages/lovelace/picture-card.ts b/gallery/src/pages/lovelace/picture-card.ts index 5ad709e46fe2..3d4c5ed0b1f2 100644 --- a/gallery/src/pages/lovelace/picture-card.ts +++ b/gallery/src/pages/lovelace/picture-card.ts @@ -1,4 +1,5 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, query } from "lit/decorators"; import { getEntity } from "../../../../src/fake_data/entity"; import { provideHass } from "../../../../src/fake_data/provide_hass"; diff --git a/gallery/src/pages/lovelace/picture-elements-card.ts b/gallery/src/pages/lovelace/picture-elements-card.ts index 117e6c6beec6..8312def27d20 100644 --- a/gallery/src/pages/lovelace/picture-elements-card.ts +++ b/gallery/src/pages/lovelace/picture-elements-card.ts @@ -1,4 +1,5 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, query } from "lit/decorators"; import { getEntity } from "../../../../src/fake_data/entity"; import { provideHass } from "../../../../src/fake_data/provide_hass"; diff --git a/gallery/src/pages/lovelace/picture-entity-card.ts b/gallery/src/pages/lovelace/picture-entity-card.ts index d97f41774659..e0d9836c444b 100644 --- a/gallery/src/pages/lovelace/picture-entity-card.ts +++ b/gallery/src/pages/lovelace/picture-entity-card.ts @@ -1,4 +1,5 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, query } from "lit/decorators"; import { getEntity } from "../../../../src/fake_data/entity"; import { provideHass } from "../../../../src/fake_data/provide_hass"; diff --git a/gallery/src/pages/lovelace/picture-glance-card.ts b/gallery/src/pages/lovelace/picture-glance-card.ts index 91f2e4dca5ac..0cb0c9d52962 100644 --- a/gallery/src/pages/lovelace/picture-glance-card.ts +++ b/gallery/src/pages/lovelace/picture-glance-card.ts @@ -1,4 +1,5 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, query } from "lit/decorators"; import { getEntity } from "../../../../src/fake_data/entity"; import { provideHass } from "../../../../src/fake_data/provide_hass"; diff --git a/gallery/src/pages/lovelace/plant-card.ts b/gallery/src/pages/lovelace/plant-card.ts index 6f04b474b3cc..d2bdb2650960 100644 --- a/gallery/src/pages/lovelace/plant-card.ts +++ b/gallery/src/pages/lovelace/plant-card.ts @@ -1,4 +1,5 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, query } from "lit/decorators"; import { provideHass } from "../../../../src/fake_data/provide_hass"; import "../../components/demo-cards"; diff --git a/gallery/src/pages/lovelace/thermostat-card.ts b/gallery/src/pages/lovelace/thermostat-card.ts index a826a3489b0b..b8d40d25e5e2 100644 --- a/gallery/src/pages/lovelace/thermostat-card.ts +++ b/gallery/src/pages/lovelace/thermostat-card.ts @@ -1,4 +1,5 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, query } from "lit/decorators"; import { getEntity } from "../../../../src/fake_data/entity"; import { provideHass } from "../../../../src/fake_data/provide_hass"; diff --git a/gallery/src/pages/lovelace/tile-card.ts b/gallery/src/pages/lovelace/tile-card.ts index 59d2b612f52e..59ba3a150eae 100644 --- a/gallery/src/pages/lovelace/tile-card.ts +++ b/gallery/src/pages/lovelace/tile-card.ts @@ -1,4 +1,5 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, query } from "lit/decorators"; import { CoverEntityFeature } from "../../../../src/data/cover"; import { LightColorMode } from "../../../../src/data/light"; diff --git a/gallery/src/pages/lovelace/todo-list-card.ts b/gallery/src/pages/lovelace/todo-list-card.ts index b03ffd1a9376..2ed2d68ddd09 100644 --- a/gallery/src/pages/lovelace/todo-list-card.ts +++ b/gallery/src/pages/lovelace/todo-list-card.ts @@ -1,4 +1,5 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, query } from "lit/decorators"; import { provideHass } from "../../../../src/fake_data/provide_hass"; import "../../components/demo-cards"; diff --git a/gallery/src/pages/misc/entity-state.ts b/gallery/src/pages/misc/entity-state.ts index 68375c60d85f..edf541b9b3f5 100644 --- a/gallery/src/pages/misc/entity-state.ts +++ b/gallery/src/pages/misc/entity-state.ts @@ -1,4 +1,4 @@ -import { +import type { HassEntity, HassEntityAttributeBase, } from "home-assistant-js-websocket"; @@ -12,7 +12,7 @@ import type { DataTableColumnContainer } from "../../../../src/components/data-t import "../../../../src/components/entity/state-badge"; import { provideHass } from "../../../../src/fake_data/provide_hass"; import { mockIcons } from "../../../../demo/src/stubs/icons"; -import { HomeAssistant } from "../../../../src/types"; +import type { HomeAssistant } from "../../../../src/types"; const SENSOR_DEVICE_CLASSES = [ "apparent_power", diff --git a/gallery/src/pages/misc/integration-card.ts b/gallery/src/pages/misc/integration-card.ts index ac8978844039..bf71736163a3 100644 --- a/gallery/src/pages/misc/integration-card.ts +++ b/gallery/src/pages/misc/integration-card.ts @@ -4,10 +4,10 @@ import "../../../../src/components/ha-switch"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; -import { IntegrationManifest } from "../../../../src/data/integration"; +import type { IntegrationManifest } from "../../../../src/data/integration"; -import { DeviceRegistryEntry } from "../../../../src/data/device_registry"; -import { EntityRegistryEntry } from "../../../../src/data/entity_registry"; +import type { DeviceRegistryEntry } from "../../../../src/data/device_registry"; +import type { EntityRegistryEntry } from "../../../../src/data/entity_registry"; import { provideHass } from "../../../../src/fake_data/provide_hass"; import "../../../../src/panels/config/integrations/ha-config-flow-card"; import type { @@ -16,7 +16,7 @@ import type { } from "../../../../src/panels/config/integrations/ha-config-integrations"; import "../../../../src/panels/config/integrations/ha-ignored-config-entry-card"; import "../../../../src/panels/config/integrations/ha-integration-card"; -import { HomeAssistant } from "../../../../src/types"; +import type { HomeAssistant } from "../../../../src/types"; const createConfigEntry = ( title: string, diff --git a/gallery/src/pages/misc/util-long-press.ts b/gallery/src/pages/misc/util-long-press.ts index 05b4f6291e33..e111919bb5a4 100644 --- a/gallery/src/pages/misc/util-long-press.ts +++ b/gallery/src/pages/misc/util-long-press.ts @@ -1,8 +1,9 @@ import "@material/mwc-button"; -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement } from "lit/decorators"; import "../../../../src/components/ha-card"; -import { ActionHandlerEvent } from "../../../../src/data/lovelace/action_handler"; +import type { ActionHandlerEvent } from "../../../../src/data/lovelace/action_handler"; import { actionHandler } from "../../../../src/panels/lovelace/common/directives/action-handler-directive"; @customElement("demo-misc-util-long-press") diff --git a/gallery/src/pages/more-info/climate.ts b/gallery/src/pages/more-info/climate.ts index b4f61bae3293..c6c44ea59d34 100644 --- a/gallery/src/pages/more-info/climate.ts +++ b/gallery/src/pages/more-info/climate.ts @@ -1,12 +1,11 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import "../../../../src/components/ha-card"; import "../../../../src/dialogs/more-info/more-info-content"; import { getEntity } from "../../../../src/fake_data/entity"; -import { - MockHomeAssistant, - provideHass, -} from "../../../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../../../src/fake_data/provide_hass"; +import { provideHass } from "../../../../src/fake_data/provide_hass"; import "../../components/demo-more-infos"; import { ClimateEntityFeature } from "../../../../src/data/climate"; diff --git a/gallery/src/pages/more-info/cover.ts b/gallery/src/pages/more-info/cover.ts index 6f1f0a4e97ff..06f7563adb3e 100644 --- a/gallery/src/pages/more-info/cover.ts +++ b/gallery/src/pages/more-info/cover.ts @@ -1,13 +1,12 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import "../../../../src/components/ha-card"; import { CoverEntityFeature } from "../../../../src/data/cover"; import "../../../../src/dialogs/more-info/more-info-content"; import { getEntity } from "../../../../src/fake_data/entity"; -import { - MockHomeAssistant, - provideHass, -} from "../../../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../../../src/fake_data/provide_hass"; +import { provideHass } from "../../../../src/fake_data/provide_hass"; import "../../components/demo-more-infos"; const ENTITIES = [ diff --git a/gallery/src/pages/more-info/humidifier.ts b/gallery/src/pages/more-info/humidifier.ts index c95b4433d2df..d2562039982e 100644 --- a/gallery/src/pages/more-info/humidifier.ts +++ b/gallery/src/pages/more-info/humidifier.ts @@ -1,12 +1,11 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import "../../../../src/components/ha-card"; import "../../../../src/dialogs/more-info/more-info-content"; import { getEntity } from "../../../../src/fake_data/entity"; -import { - MockHomeAssistant, - provideHass, -} from "../../../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../../../src/fake_data/provide_hass"; +import { provideHass } from "../../../../src/fake_data/provide_hass"; import "../../components/demo-more-infos"; const ENTITIES = [ diff --git a/gallery/src/pages/more-info/input-number.ts b/gallery/src/pages/more-info/input-number.ts index af8c1b5be635..cca595138e8c 100644 --- a/gallery/src/pages/more-info/input-number.ts +++ b/gallery/src/pages/more-info/input-number.ts @@ -1,12 +1,11 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import "../../../../src/components/ha-card"; import "../../../../src/dialogs/more-info/more-info-content"; import { getEntity } from "../../../../src/fake_data/entity"; -import { - MockHomeAssistant, - provideHass, -} from "../../../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../../../src/fake_data/provide_hass"; +import { provideHass } from "../../../../src/fake_data/provide_hass"; import "../../components/demo-more-infos"; const ENTITIES = [ diff --git a/gallery/src/pages/more-info/input-text.ts b/gallery/src/pages/more-info/input-text.ts index f82549004e2e..f3bfb4c852df 100644 --- a/gallery/src/pages/more-info/input-text.ts +++ b/gallery/src/pages/more-info/input-text.ts @@ -1,12 +1,11 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import "../../../../src/components/ha-card"; import "../../../../src/dialogs/more-info/more-info-content"; import { getEntity } from "../../../../src/fake_data/entity"; -import { - MockHomeAssistant, - provideHass, -} from "../../../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../../../src/fake_data/provide_hass"; +import { provideHass } from "../../../../src/fake_data/provide_hass"; import "../../components/demo-more-infos"; const ENTITIES = [ diff --git a/gallery/src/pages/more-info/light.ts b/gallery/src/pages/more-info/light.ts index 47aa0bf5a86f..91d8fd1429db 100644 --- a/gallery/src/pages/more-info/light.ts +++ b/gallery/src/pages/more-info/light.ts @@ -1,13 +1,12 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import "../../../../src/components/ha-card"; import { LightColorMode, LightEntityFeature } from "../../../../src/data/light"; import "../../../../src/dialogs/more-info/more-info-content"; import { getEntity } from "../../../../src/fake_data/entity"; -import { - MockHomeAssistant, - provideHass, -} from "../../../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../../../src/fake_data/provide_hass"; +import { provideHass } from "../../../../src/fake_data/provide_hass"; import "../../components/demo-more-infos"; const ENTITIES = [ diff --git a/gallery/src/pages/more-info/lock.ts b/gallery/src/pages/more-info/lock.ts index 03f0fb808713..cca5e729e1d5 100644 --- a/gallery/src/pages/more-info/lock.ts +++ b/gallery/src/pages/more-info/lock.ts @@ -1,12 +1,11 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import "../../../../src/components/ha-card"; import "../../../../src/dialogs/more-info/more-info-content"; import { getEntity } from "../../../../src/fake_data/entity"; -import { - MockHomeAssistant, - provideHass, -} from "../../../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../../../src/fake_data/provide_hass"; +import { provideHass } from "../../../../src/fake_data/provide_hass"; import "../../components/demo-more-infos"; const ENTITIES = [ diff --git a/gallery/src/pages/more-info/media-player.ts b/gallery/src/pages/more-info/media-player.ts index 4df86741826d..9af2d92a3204 100644 --- a/gallery/src/pages/more-info/media-player.ts +++ b/gallery/src/pages/more-info/media-player.ts @@ -1,11 +1,10 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import "../../../../src/components/ha-card"; import "../../../../src/dialogs/more-info/more-info-content"; -import { - MockHomeAssistant, - provideHass, -} from "../../../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../../../src/fake_data/provide_hass"; +import { provideHass } from "../../../../src/fake_data/provide_hass"; import "../../components/demo-more-infos"; import { createMediaPlayerEntities } from "../../data/media_players"; diff --git a/gallery/src/pages/more-info/number.ts b/gallery/src/pages/more-info/number.ts index 29766c8a03b6..4cf8cdc66350 100644 --- a/gallery/src/pages/more-info/number.ts +++ b/gallery/src/pages/more-info/number.ts @@ -1,12 +1,11 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import "../../../../src/components/ha-card"; import "../../../../src/dialogs/more-info/more-info-content"; import { getEntity } from "../../../../src/fake_data/entity"; -import { - MockHomeAssistant, - provideHass, -} from "../../../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../../../src/fake_data/provide_hass"; +import { provideHass } from "../../../../src/fake_data/provide_hass"; import "../../components/demo-more-infos"; const ENTITIES = [ diff --git a/gallery/src/pages/more-info/scene.ts b/gallery/src/pages/more-info/scene.ts index 2449c251fa43..b3a5c13580be 100644 --- a/gallery/src/pages/more-info/scene.ts +++ b/gallery/src/pages/more-info/scene.ts @@ -1,12 +1,11 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import "../../../../src/components/ha-card"; import "../../../../src/dialogs/more-info/more-info-content"; import { getEntity } from "../../../../src/fake_data/entity"; -import { - MockHomeAssistant, - provideHass, -} from "../../../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../../../src/fake_data/provide_hass"; +import { provideHass } from "../../../../src/fake_data/provide_hass"; import "../../components/demo-more-infos"; const ENTITIES = [ diff --git a/gallery/src/pages/more-info/timer.ts b/gallery/src/pages/more-info/timer.ts index 3dad8d48e7ea..19506eacfe14 100644 --- a/gallery/src/pages/more-info/timer.ts +++ b/gallery/src/pages/more-info/timer.ts @@ -1,12 +1,11 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import "../../../../src/components/ha-card"; import "../../../../src/dialogs/more-info/more-info-content"; import { getEntity } from "../../../../src/fake_data/entity"; -import { - MockHomeAssistant, - provideHass, -} from "../../../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../../../src/fake_data/provide_hass"; +import { provideHass } from "../../../../src/fake_data/provide_hass"; import "../../components/demo-more-infos"; const ENTITIES = [ diff --git a/gallery/src/pages/more-info/update.ts b/gallery/src/pages/more-info/update.ts index 1d9056e95ecd..7507f3fcd5ad 100644 --- a/gallery/src/pages/more-info/update.ts +++ b/gallery/src/pages/more-info/update.ts @@ -1,12 +1,11 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import "../../../../src/components/ha-card"; import "../../../../src/dialogs/more-info/more-info-content"; import { getEntity } from "../../../../src/fake_data/entity"; -import { - MockHomeAssistant, - provideHass, -} from "../../../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../../../src/fake_data/provide_hass"; +import { provideHass } from "../../../../src/fake_data/provide_hass"; import "../../components/demo-more-infos"; import { LONG_TEXT } from "../../data/text"; import { UpdateEntityFeature } from "../../../../src/data/update"; diff --git a/gallery/src/pages/more-info/vacuum.ts b/gallery/src/pages/more-info/vacuum.ts index 3282dd59d5a6..036cc078189c 100644 --- a/gallery/src/pages/more-info/vacuum.ts +++ b/gallery/src/pages/more-info/vacuum.ts @@ -1,12 +1,11 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import "../../../../src/components/ha-card"; import "../../../../src/dialogs/more-info/more-info-content"; import { getEntity } from "../../../../src/fake_data/entity"; -import { - MockHomeAssistant, - provideHass, -} from "../../../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../../../src/fake_data/provide_hass"; +import { provideHass } from "../../../../src/fake_data/provide_hass"; import "../../components/demo-more-infos"; import { VacuumEntityFeature } from "../../../../src/data/vacuum"; diff --git a/gallery/src/pages/more-info/water-heater.ts b/gallery/src/pages/more-info/water-heater.ts index a6f7b6f335b0..31615b2c1a29 100644 --- a/gallery/src/pages/more-info/water-heater.ts +++ b/gallery/src/pages/more-info/water-heater.ts @@ -1,13 +1,12 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import "../../../../src/components/ha-card"; import { WaterHeaterEntityFeature } from "../../../../src/data/water_heater"; import "../../../../src/dialogs/more-info/more-info-content"; import { getEntity } from "../../../../src/fake_data/entity"; -import { - MockHomeAssistant, - provideHass, -} from "../../../../src/fake_data/provide_hass"; +import type { MockHomeAssistant } from "../../../../src/fake_data/provide_hass"; +import { provideHass } from "../../../../src/fake_data/provide_hass"; import "../../components/demo-more-infos"; const ENTITIES = [ diff --git a/hassio/src/addon-store/hassio-addon-repository.ts b/hassio/src/addon-store/hassio-addon-repository.ts index 3c7ee0156608..59ceab999075 100644 --- a/hassio/src/addon-store/hassio-addon-repository.ts +++ b/hassio/src/addon-store/hassio-addon-repository.ts @@ -1,15 +1,16 @@ import { mdiArrowUpBoldCircle, mdiPuzzle } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; import { atLeastVersion } from "../../../src/common/config/version"; import { navigate } from "../../../src/common/navigate"; import { caseInsensitiveStringCompare } from "../../../src/common/string/compare"; import "../../../src/components/ha-card"; -import { HassioAddonRepository } from "../../../src/data/hassio/addon"; -import { StoreAddon } from "../../../src/data/supervisor/store"; -import { Supervisor } from "../../../src/data/supervisor/supervisor"; -import { HomeAssistant } from "../../../src/types"; +import type { HassioAddonRepository } from "../../../src/data/hassio/addon"; +import type { StoreAddon } from "../../../src/data/supervisor/store"; +import type { Supervisor } from "../../../src/data/supervisor/supervisor"; +import type { HomeAssistant } from "../../../src/types"; import "../components/hassio-card-content"; import { filterAndSort } from "../components/hassio-filter-addons"; import { hassioStyle } from "../resources/hassio-style"; diff --git a/hassio/src/addon-store/hassio-addon-store.ts b/hassio/src/addon-store/hassio-addon-store.ts index 76f0639e4961..0ff3075ec3d2 100644 --- a/hassio/src/addon-store/hassio-addon-store.ts +++ b/hassio/src/addon-store/hassio-addon-store.ts @@ -1,15 +1,8 @@ -import { 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 { mdiDotsVertical } from "@mdi/js"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { atLeastVersion } from "../../../src/common/config/version"; @@ -19,17 +12,15 @@ import { extractSearchParam } from "../../../src/common/url/search-params"; import "../../../src/components/ha-button-menu"; import "../../../src/components/ha-icon-button"; import "../../../src/components/search-input"; -import { - HassioAddonRepository, - reloadHassioAddons, -} from "../../../src/data/hassio/addon"; +import type { HassioAddonRepository } from "../../../src/data/hassio/addon"; +import { reloadHassioAddons } from "../../../src/data/hassio/addon"; import { extractApiErrorMessage } from "../../../src/data/hassio/common"; -import { StoreAddon } from "../../../src/data/supervisor/store"; -import { Supervisor } from "../../../src/data/supervisor/supervisor"; +import type { StoreAddon } from "../../../src/data/supervisor/store"; +import type { Supervisor } from "../../../src/data/supervisor/supervisor"; import { showAlertDialog } from "../../../src/dialogs/generic/show-dialog-box"; import "../../../src/layouts/hass-loading-screen"; import "../../../src/layouts/hass-subpage"; -import { HomeAssistant, Route } from "../../../src/types"; +import type { HomeAssistant, Route } from "../../../src/types"; import { showRegistriesDialog } from "../dialogs/registries/show-dialog-registries"; import { showRepositoriesDialog } from "../dialogs/repositories/show-dialog-repositories"; import "./hassio-addon-repository"; diff --git a/hassio/src/addon-view/config/hassio-addon-audio.ts b/hassio/src/addon-view/config/hassio-addon-audio.ts index c36d93b21047..9146f5924a8f 100644 --- a/hassio/src/addon-view/config/hassio-addon-audio.ts +++ b/hassio/src/addon-view/config/hassio-addon-audio.ts @@ -1,31 +1,23 @@ import "@material/mwc-button"; import "@material/mwc-list/mwc-list-item"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { stopPropagation } from "../../../../src/common/dom/stop_propagation"; import "../../../../src/components/buttons/ha-progress-button"; import "../../../../src/components/ha-alert"; import "../../../../src/components/ha-card"; import "../../../../src/components/ha-select"; -import { +import type { HassioAddonDetails, HassioAddonSetOptionParams, - setHassioAddonOption, } from "../../../../src/data/hassio/addon"; -import { - fetchHassioHardwareAudio, - HassioHardwareAudioDevice, -} from "../../../../src/data/hassio/hardware"; -import { Supervisor } from "../../../../src/data/supervisor/supervisor"; +import { setHassioAddonOption } from "../../../../src/data/hassio/addon"; +import type { HassioHardwareAudioDevice } from "../../../../src/data/hassio/hardware"; +import { fetchHassioHardwareAudio } from "../../../../src/data/hassio/hardware"; +import type { Supervisor } from "../../../../src/data/supervisor/supervisor"; import { haStyle } from "../../../../src/resources/styles"; -import { HomeAssistant } from "../../../../src/types"; +import type { HomeAssistant } from "../../../../src/types"; import { suggestAddonRestart } from "../../dialogs/suggestAddonRestart"; import { hassioStyle } from "../../resources/hassio-style"; diff --git a/hassio/src/addon-view/config/hassio-addon-config-tab.ts b/hassio/src/addon-view/config/hassio-addon-config-tab.ts index 849b8c0821a7..451f289dd29a 100644 --- a/hassio/src/addon-view/config/hassio-addon-config-tab.ts +++ b/hassio/src/addon-view/config/hassio-addon-config-tab.ts @@ -1,10 +1,11 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../../src/components/ha-circular-progress"; -import { HassioAddonDetails } from "../../../../src/data/hassio/addon"; -import { Supervisor } from "../../../../src/data/supervisor/supervisor"; +import type { HassioAddonDetails } from "../../../../src/data/hassio/addon"; +import type { Supervisor } from "../../../../src/data/supervisor/supervisor"; import { haStyle } from "../../../../src/resources/styles"; -import { HomeAssistant } from "../../../../src/types"; +import type { HomeAssistant } from "../../../../src/types"; import { hassioStyle } from "../../resources/hassio-style"; import "./hassio-addon-audio"; import "./hassio-addon-config"; diff --git a/hassio/src/addon-view/config/hassio-addon-config.ts b/hassio/src/addon-view/config/hassio-addon-config.ts index fe66b25bb704..27eddac31c70 100644 --- a/hassio/src/addon-view/config/hassio-addon-config.ts +++ b/hassio/src/addon-view/config/hassio-addon-config.ts @@ -1,16 +1,10 @@ import "@material/mwc-button"; -import { ActionDetail } from "@material/mwc-list"; +import type { ActionDetail } from "@material/mwc-list"; import "@material/mwc-list/mwc-list-item"; import { mdiDotsVertical } from "@mdi/js"; import { DEFAULT_SCHEMA, Type } from "js-yaml"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../src/common/dom/fire_event"; @@ -25,14 +19,16 @@ import "../../../../src/components/ha-icon-button"; import "../../../../src/components/ha-switch"; import "../../../../src/components/ha-yaml-editor"; import type { HaYamlEditor } from "../../../../src/components/ha-yaml-editor"; -import { +import type { HassioAddonDetails, HassioAddonSetOptionParams, +} from "../../../../src/data/hassio/addon"; +import { setHassioAddonOption, validateHassioAddonOption, } from "../../../../src/data/hassio/addon"; import { extractApiErrorMessage } from "../../../../src/data/hassio/common"; -import { Supervisor } from "../../../../src/data/supervisor/supervisor"; +import type { Supervisor } from "../../../../src/data/supervisor/supervisor"; import { showConfirmationDialog } from "../../../../src/dialogs/generic/show-dialog-box"; import { haStyle } from "../../../../src/resources/styles"; import type { HomeAssistant } from "../../../../src/types"; diff --git a/hassio/src/addon-view/config/hassio-addon-network.ts b/hassio/src/addon-view/config/hassio-addon-network.ts index 56173ab5f55e..5cad242dfcfc 100644 --- a/hassio/src/addon-view/config/hassio-addon-network.ts +++ b/hassio/src/addon-view/config/hassio-addon-network.ts @@ -1,11 +1,5 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../src/common/dom/fire_event"; @@ -14,15 +8,15 @@ import "../../../../src/components/ha-alert"; import "../../../../src/components/ha-card"; import "../../../../src/components/ha-form/ha-form"; import type { HaFormSchema } from "../../../../src/components/ha-form/types"; -import { +import type { HassioAddonDetails, HassioAddonSetOptionParams, - setHassioAddonOption, } from "../../../../src/data/hassio/addon"; +import { setHassioAddonOption } from "../../../../src/data/hassio/addon"; import { extractApiErrorMessage } from "../../../../src/data/hassio/common"; -import { Supervisor } from "../../../../src/data/supervisor/supervisor"; +import type { Supervisor } from "../../../../src/data/supervisor/supervisor"; import { haStyle } from "../../../../src/resources/styles"; -import { HomeAssistant } from "../../../../src/types"; +import type { HomeAssistant } from "../../../../src/types"; import { suggestAddonRestart } from "../../dialogs/suggestAddonRestart"; import { hassioStyle } from "../../resources/hassio-style"; diff --git a/hassio/src/addon-view/documentation/hassio-addon-documentation-tab.ts b/hassio/src/addon-view/documentation/hassio-addon-documentation-tab.ts index 1c9e79c01db7..64abf00abe04 100644 --- a/hassio/src/addon-view/documentation/hassio-addon-documentation-tab.ts +++ b/hassio/src/addon-view/documentation/hassio-addon-documentation-tab.ts @@ -1,19 +1,18 @@ import "../../../../src/components/ha-card"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import "../../../../src/components/ha-alert"; import "../../../../src/components/ha-circular-progress"; import "../../../../src/components/ha-markdown"; import { customElement, property, state } from "lit/decorators"; -import { - fetchHassioAddonDocumentation, - HassioAddonDetails, -} from "../../../../src/data/hassio/addon"; +import type { HassioAddonDetails } from "../../../../src/data/hassio/addon"; +import { fetchHassioAddonDocumentation } from "../../../../src/data/hassio/addon"; import { extractApiErrorMessage } from "../../../../src/data/hassio/common"; import "../../../../src/layouts/hass-loading-screen"; import { haStyle } from "../../../../src/resources/styles"; -import { HomeAssistant } from "../../../../src/types"; +import type { HomeAssistant } from "../../../../src/types"; import { hassioStyle } from "../../resources/hassio-style"; -import { Supervisor } from "../../../../src/data/supervisor/supervisor"; +import type { Supervisor } from "../../../../src/data/supervisor/supervisor"; @customElement("hassio-addon-documentation-tab") class HassioAddonDocumentationDashboard extends LitElement { diff --git a/hassio/src/addon-view/hassio-addon-dashboard.ts b/hassio/src/addon-view/hassio-addon-dashboard.ts index e4b0c5f3a758..f245edd109ec 100644 --- a/hassio/src/addon-view/hassio-addon-dashboard.ts +++ b/hassio/src/addon-view/hassio-addon-dashboard.ts @@ -4,33 +4,34 @@ import { mdiInformationVariant, mdiMathLog, } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../src/common/dom/fire_event"; import { navigate } from "../../../src/common/navigate"; import { extractSearchParam } from "../../../src/common/url/search-params"; import "../../../src/components/ha-circular-progress"; +import type { HassioAddonDetails } from "../../../src/data/hassio/addon"; import { fetchAddonInfo, fetchHassioAddonInfo, fetchHassioAddonsInfo, - HassioAddonDetails, } from "../../../src/data/hassio/addon"; import { extractApiErrorMessage } from "../../../src/data/hassio/common"; +import type { StoreAddonDetails } from "../../../src/data/supervisor/store"; import { addStoreRepository, fetchSupervisorStore, - StoreAddonDetails, } from "../../../src/data/supervisor/store"; -import { Supervisor } from "../../../src/data/supervisor/supervisor"; +import type { Supervisor } from "../../../src/data/supervisor/supervisor"; import { showConfirmationDialog } from "../../../src/dialogs/generic/show-dialog-box"; import "../../../src/layouts/hass-error-screen"; import "../../../src/layouts/hass-loading-screen"; import "../../../src/layouts/hass-tabs-subpage"; import type { PageNavigation } from "../../../src/layouts/hass-tabs-subpage"; import { haStyle } from "../../../src/resources/styles"; -import { HomeAssistant, Route } from "../../../src/types"; +import type { HomeAssistant, Route } from "../../../src/types"; import { hassioStyle } from "../resources/hassio-style"; import "./config/hassio-addon-audio"; import "./config/hassio-addon-config"; diff --git a/hassio/src/addon-view/hassio-addon-router.ts b/hassio/src/addon-view/hassio-addon-router.ts index 66cf1fb8afe3..de2c5aa1fdc8 100644 --- a/hassio/src/addon-view/hassio-addon-router.ts +++ b/hassio/src/addon-view/hassio-addon-router.ts @@ -1,12 +1,10 @@ import { customElement, property } from "lit/decorators"; -import { HassioAddonDetails } from "../../../src/data/hassio/addon"; -import { StoreAddonDetails } from "../../../src/data/supervisor/store"; -import { Supervisor } from "../../../src/data/supervisor/supervisor"; -import { - HassRouterPage, - RouterOptions, -} from "../../../src/layouts/hass-router-page"; -import { HomeAssistant } from "../../../src/types"; +import type { HassioAddonDetails } from "../../../src/data/hassio/addon"; +import type { StoreAddonDetails } from "../../../src/data/supervisor/store"; +import type { Supervisor } from "../../../src/data/supervisor/supervisor"; +import type { RouterOptions } from "../../../src/layouts/hass-router-page"; +import { HassRouterPage } from "../../../src/layouts/hass-router-page"; +import type { HomeAssistant } from "../../../src/types"; import "./config/hassio-addon-config-tab"; import "./documentation/hassio-addon-documentation-tab"; // Don't codesplit the others, because it breaks the UI when pushed to a Pi diff --git a/hassio/src/addon-view/info/hassio-addon-info-tab.ts b/hassio/src/addon-view/info/hassio-addon-info-tab.ts index fa8333d9f733..c05a2466247e 100644 --- a/hassio/src/addon-view/info/hassio-addon-info-tab.ts +++ b/hassio/src/addon-view/info/hassio-addon-info-tab.ts @@ -1,10 +1,11 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../../src/components/ha-circular-progress"; -import { HassioAddonDetails } from "../../../../src/data/hassio/addon"; -import { Supervisor } from "../../../../src/data/supervisor/supervisor"; +import type { HassioAddonDetails } from "../../../../src/data/hassio/addon"; +import type { Supervisor } from "../../../../src/data/supervisor/supervisor"; import { haStyle } from "../../../../src/resources/styles"; -import { HomeAssistant, Route } from "../../../../src/types"; +import type { HomeAssistant, Route } from "../../../../src/types"; import { hassioStyle } from "../../resources/hassio-style"; import "./hassio-addon-info"; diff --git a/hassio/src/addon-view/info/hassio-addon-info.ts b/hassio/src/addon-view/info/hassio-addon-info.ts index 770ca68fc666..8f854404993a 100644 --- a/hassio/src/addon-view/info/hassio-addon-info.ts +++ b/hassio/src/addon-view/info/hassio-addon-info.ts @@ -22,7 +22,8 @@ import { mdiPound, mdiShield, } from "@mdi/js"; -import { CSSResultGroup, LitElement, TemplateResult, css, html } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; @@ -38,12 +39,15 @@ import "../../../../src/components/ha-markdown"; import "../../../../src/components/ha-settings-row"; import "../../../../src/components/ha-svg-icon"; import "../../../../src/components/ha-switch"; +import "../../../../src/components/ha-formfield"; import type { HaSwitch } from "../../../../src/components/ha-switch"; -import { +import type { AddonCapability, HassioAddonDetails, HassioAddonSetOptionParams, HassioAddonSetSecurityParams, +} from "../../../../src/data/hassio/addon"; +import { fetchHassioAddonChangelog, fetchHassioAddonInfo, installHassioAddon, @@ -56,23 +60,23 @@ import { uninstallHassioAddon, validateHassioAddonOption, } from "../../../../src/data/hassio/addon"; +import type { HassioStats } from "../../../../src/data/hassio/common"; import { - HassioStats, extractApiErrorMessage, fetchHassioStats, } from "../../../../src/data/hassio/common"; -import { +import type { StoreAddon, StoreAddonDetails, } from "../../../../src/data/supervisor/store"; -import { Supervisor } from "../../../../src/data/supervisor/supervisor"; +import type { Supervisor } from "../../../../src/data/supervisor/supervisor"; import { showAlertDialog, showConfirmationDialog, } from "../../../../src/dialogs/generic/show-dialog-box"; import { mdiHomeAssistant } from "../../../../src/resources/home-assistant-logo-svg"; import { haStyle } from "../../../../src/resources/styles"; -import { HomeAssistant, Route } from "../../../../src/types"; +import type { HomeAssistant, Route } from "../../../../src/types"; import { bytesToString } from "../../../../src/util/bytes-to-string"; import "../../components/hassio-card-content"; import "../../components/supervisor-metric"; diff --git a/hassio/src/addon-view/log/hassio-addon-log-tab.ts b/hassio/src/addon-view/log/hassio-addon-log-tab.ts index 04ce803dfc5b..9f52d3e83296 100644 --- a/hassio/src/addon-view/log/hassio-addon-log-tab.ts +++ b/hassio/src/addon-view/log/hassio-addon-log-tab.ts @@ -1,10 +1,16 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { + css, + type CSSResultGroup, + html, + LitElement, + type TemplateResult, +} from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../../src/components/ha-circular-progress"; -import { HassioAddonDetails } from "../../../../src/data/hassio/addon"; -import { Supervisor } from "../../../../src/data/supervisor/supervisor"; +import type { HassioAddonDetails } from "../../../../src/data/hassio/addon"; +import type { Supervisor } from "../../../../src/data/supervisor/supervisor"; import { haStyle } from "../../../../src/resources/styles"; -import { HomeAssistant } from "../../../../src/types"; +import type { HomeAssistant } from "../../../../src/types"; import { hassioStyle } from "../../resources/hassio-style"; import "../../../../src/panels/config/logs/error-log-card"; import "../../../../src/components/search-input"; diff --git a/hassio/src/backups/hassio-backups.ts b/hassio/src/backups/hassio-backups.ts index 3512dd8bd863..c089d395bfd8 100644 --- a/hassio/src/backups/hassio-backups.ts +++ b/hassio/src/backups/hassio-backups.ts @@ -1,22 +1,16 @@ import "@material/mwc-button"; -import { ActionDetail } from "@material/mwc-list"; +import type { ActionDetail } from "@material/mwc-list"; import "@material/mwc-list/mwc-list-item"; import { mdiBackupRestore, mdiDelete, mdiDotsVertical, mdiPlus } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; import { atLeastVersion } from "../../../src/common/config/version"; import { relativeTime } from "../../../src/common/datetime/relative_time"; -import { HASSDomEvent } from "../../../src/common/dom/fire_event"; -import { +import type { HASSDomEvent } from "../../../src/common/dom/fire_event"; +import type { DataTableColumnContainer, RowClickedEvent, SelectionChangedEvent, @@ -25,15 +19,15 @@ import "../../../src/components/ha-button-menu"; import "../../../src/components/ha-fab"; import "../../../src/components/ha-icon-button"; import "../../../src/components/ha-svg-icon"; +import type { HassioBackup } from "../../../src/data/hassio/backup"; import { - HassioBackup, fetchHassioBackups, friendlyFolderName, reloadHassioBackups, removeBackup, } from "../../../src/data/hassio/backup"; import { extractApiErrorMessage } from "../../../src/data/hassio/common"; -import { Supervisor } from "../../../src/data/supervisor/supervisor"; +import type { Supervisor } from "../../../src/data/supervisor/supervisor"; import { showAlertDialog, showConfirmationDialog, @@ -41,7 +35,7 @@ import { import "../../../src/layouts/hass-tabs-subpage-data-table"; import type { HaTabsSubpageDataTable } from "../../../src/layouts/hass-tabs-subpage-data-table"; import { haStyle } from "../../../src/resources/styles"; -import { HomeAssistant, Route } from "../../../src/types"; +import type { HomeAssistant, Route } from "../../../src/types"; import { showBackupUploadDialog } from "../dialogs/backup/show-dialog-backup-upload"; import { showHassioBackupLocationDialog } from "../dialogs/backup/show-dialog-hassio-backu-location"; import { showHassioBackupDialog } from "../dialogs/backup/show-dialog-hassio-backup"; diff --git a/hassio/src/components/hassio-card-content.ts b/hassio/src/components/hassio-card-content.ts index 3222525dd543..7943d65e5fe0 100644 --- a/hassio/src/components/hassio-card-content.ts +++ b/hassio/src/components/hassio-card-content.ts @@ -1,8 +1,9 @@ import { mdiHelpCircle } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../src/components/ha-svg-icon"; -import { HomeAssistant } from "../../../src/types"; +import type { HomeAssistant } from "../../../src/types"; @customElement("hassio-card-content") class HassioCardContent extends LitElement { diff --git a/hassio/src/components/hassio-filter-addons.ts b/hassio/src/components/hassio-filter-addons.ts index 1970aa54951f..b77c5346d3d0 100644 --- a/hassio/src/components/hassio-filter-addons.ts +++ b/hassio/src/components/hassio-filter-addons.ts @@ -1,7 +1,7 @@ import type { IFuseOptions } from "fuse.js"; import Fuse from "fuse.js"; import { stripDiacritics } from "../../../src/common/string/strip-diacritics"; -import { StoreAddon } from "../../../src/data/supervisor/store"; +import type { StoreAddon } from "../../../src/data/supervisor/store"; import { getStripDiacriticsFn } from "../../../src/util/fuse"; export function filterAndSort(addons: StoreAddon[], filter: string) { diff --git a/hassio/src/components/hassio-upload-backup.ts b/hassio/src/components/hassio-upload-backup.ts index 3cc379438ed9..dddcc68147c8 100644 --- a/hassio/src/components/hassio-upload-backup.ts +++ b/hassio/src/components/hassio-upload-backup.ts @@ -1,13 +1,15 @@ import { mdiFolderUpload } from "@mdi/js"; -import { html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, state } from "lit/decorators"; import { fireEvent } from "../../../src/common/dom/fire_event"; import "../../../src/components/ha-circular-progress"; import "../../../src/components/ha-file-upload"; -import { HassioBackup, uploadBackup } from "../../../src/data/hassio/backup"; +import type { HassioBackup } from "../../../src/data/hassio/backup"; +import { uploadBackup } from "../../../src/data/hassio/backup"; import { extractApiErrorMessage } from "../../../src/data/hassio/common"; import { showAlertDialog } from "../../../src/dialogs/generic/show-dialog-box"; -import { HomeAssistant } from "../../../src/types"; +import type { HomeAssistant } from "../../../src/types"; declare global { interface HASSDomEvents { diff --git a/hassio/src/components/supervisor-backup-content.ts b/hassio/src/components/supervisor-backup-content.ts index 31d2f3b78892..c94234611b91 100644 --- a/hassio/src/components/supervisor-backup-content.ts +++ b/hassio/src/components/supervisor-backup-content.ts @@ -1,31 +1,25 @@ import { mdiFolder, mdiPuzzle } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query } from "lit/decorators"; import { atLeastVersion } from "../../../src/common/config/version"; import { formatDate } from "../../../src/common/datetime/format_date"; import { formatDateTime } from "../../../src/common/datetime/format_date_time"; -import { LocalizeFunc } from "../../../src/common/translations/localize"; +import type { LocalizeFunc } from "../../../src/common/translations/localize"; import "../../../src/components/ha-checkbox"; import "../../../src/components/ha-formfield"; import "../../../src/components/ha-textfield"; import "../../../src/components/ha-password-field"; import "../../../src/components/ha-radio"; import type { HaRadio } from "../../../src/components/ha-radio"; -import { +import type { HassioBackupDetail, HassioFullBackupCreateParams, HassioPartialBackupCreateParams, } from "../../../src/data/hassio/backup"; -import { Supervisor } from "../../../src/data/supervisor/supervisor"; +import type { Supervisor } from "../../../src/data/supervisor/supervisor"; import { mdiHomeAssistant } from "../../../src/resources/home-assistant-logo-svg"; -import { HomeAssistant, TranslationDict } from "../../../src/types"; +import type { HomeAssistant, TranslationDict } from "../../../src/types"; import "./supervisor-formfield-label"; import type { HaTextField } from "../../../src/components/ha-textfield"; diff --git a/hassio/src/components/supervisor-formfield-label.ts b/hassio/src/components/supervisor-formfield-label.ts index 8f740185f622..875e4535b780 100644 --- a/hassio/src/components/supervisor-formfield-label.ts +++ b/hassio/src/components/supervisor-formfield-label.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../src/components/ha-svg-icon"; diff --git a/hassio/src/components/supervisor-metric.ts b/hassio/src/components/supervisor-metric.ts index 7db487da6982..b960d9bb90a4 100644 --- a/hassio/src/components/supervisor-metric.ts +++ b/hassio/src/components/supervisor-metric.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import "../../../src/components/ha-bar"; diff --git a/hassio/src/dashboard/hassio-addons.ts b/hassio/src/dashboard/hassio-addons.ts index eb9c1f00c18d..d83c8a0f0bb1 100644 --- a/hassio/src/dashboard/hassio-addons.ts +++ b/hassio/src/dashboard/hassio-addons.ts @@ -1,5 +1,6 @@ import { mdiArrowUpBoldCircle, mdiPuzzle } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { atLeastVersion } from "../../../src/common/config/version"; @@ -7,10 +8,10 @@ import { navigate } from "../../../src/common/navigate"; import { caseInsensitiveStringCompare } from "../../../src/common/string/compare"; import "../../../src/components/ha-card"; import "../../../src/components/search-input"; -import { HassioAddonInfo } from "../../../src/data/hassio/addon"; -import { Supervisor } from "../../../src/data/supervisor/supervisor"; +import type { HassioAddonInfo } from "../../../src/data/hassio/addon"; +import type { Supervisor } from "../../../src/data/supervisor/supervisor"; import { haStyle } from "../../../src/resources/styles"; -import { HomeAssistant } from "../../../src/types"; +import type { HomeAssistant } from "../../../src/types"; import "../components/hassio-card-content"; import { hassioStyle } from "../resources/hassio-style"; diff --git a/hassio/src/dashboard/hassio-dashboard.ts b/hassio/src/dashboard/hassio-dashboard.ts index 1eaf53947ddc..9eaa76a9a4e6 100644 --- a/hassio/src/dashboard/hassio-dashboard.ts +++ b/hassio/src/dashboard/hassio-dashboard.ts @@ -1,17 +1,18 @@ import { mdiRefresh, mdiStorePlus } from "@mdi/js"; -import { CSSResultGroup, LitElement, TemplateResult, css, html } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, property } from "lit/decorators"; import { atLeastVersion } from "../../../src/common/config/version"; import { fireEvent } from "../../../src/common/dom/fire_event"; import "../../../src/components/ha-fab"; import { reloadHassioAddons } from "../../../src/data/hassio/addon"; import { extractApiErrorMessage } from "../../../src/data/hassio/common"; -import { Supervisor } from "../../../src/data/supervisor/supervisor"; +import type { Supervisor } from "../../../src/data/supervisor/supervisor"; import { showAlertDialog } from "../../../src/dialogs/generic/show-dialog-box"; import "../../../src/layouts/hass-subpage"; import "../../../src/layouts/hass-tabs-subpage"; import { haStyle } from "../../../src/resources/styles"; -import { HomeAssistant, Route } from "../../../src/types"; +import type { HomeAssistant, Route } from "../../../src/types"; import { supervisorTabs } from "../hassio-tabs"; import "./hassio-addons"; diff --git a/hassio/src/dashboard/hassio-update.ts b/hassio/src/dashboard/hassio-update.ts index b79aa14f18aa..4c0a43666281 100644 --- a/hassio/src/dashboard/hassio-update.ts +++ b/hassio/src/dashboard/hassio-update.ts @@ -1,20 +1,21 @@ import "@material/mwc-button"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; import "../../../src/components/buttons/ha-progress-button"; import "../../../src/components/ha-card"; import "../../../src/components/ha-settings-row"; import "../../../src/components/ha-svg-icon"; -import { HassioHassOSInfo } from "../../../src/data/hassio/host"; -import { +import type { HassioHassOSInfo } from "../../../src/data/hassio/host"; +import type { HassioHomeAssistantInfo, HassioSupervisorInfo, } from "../../../src/data/hassio/supervisor"; -import { Supervisor } from "../../../src/data/supervisor/supervisor"; +import type { Supervisor } from "../../../src/data/supervisor/supervisor"; import { mdiHomeAssistant } from "../../../src/resources/home-assistant-logo-svg"; import { haStyle } from "../../../src/resources/styles"; -import { HomeAssistant } from "../../../src/types"; +import type { HomeAssistant } from "../../../src/types"; import { hassioStyle } from "../resources/hassio-style"; const computeVersion = (key: string, version: string): string => diff --git a/hassio/src/dialogs/backup/dialog-hassio-backup-location.ts b/hassio/src/dialogs/backup/dialog-hassio-backup-location.ts index c5bdde32e5c8..aaa176019c8f 100644 --- a/hassio/src/dialogs/backup/dialog-hassio-backup-location.ts +++ b/hassio/src/dialogs/backup/dialog-hassio-backup-location.ts @@ -1,5 +1,6 @@ import "@material/mwc-button/mwc-button"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../src/common/dom/fire_event"; @@ -9,8 +10,8 @@ import type { SchemaUnion } from "../../../../src/components/ha-form/types"; import { extractApiErrorMessage } from "../../../../src/data/hassio/common"; import { changeMountOptions } from "../../../../src/data/supervisor/mounts"; import { haStyle, haStyleDialog } from "../../../../src/resources/styles"; -import { HomeAssistant } from "../../../../src/types"; -import { HassioBackupLocationDialogParams } from "./show-dialog-hassio-backu-location"; +import type { HomeAssistant } from "../../../../src/types"; +import type { HassioBackupLocationDialogParams } from "./show-dialog-hassio-backu-location"; const SCHEMA = memoizeOne( () => diff --git a/hassio/src/dialogs/backup/dialog-hassio-backup-upload.ts b/hassio/src/dialogs/backup/dialog-hassio-backup-upload.ts index 8718a359bc96..dd83c23a7b22 100644 --- a/hassio/src/dialogs/backup/dialog-hassio-backup-upload.ts +++ b/hassio/src/dialogs/backup/dialog-hassio-backup-upload.ts @@ -1,14 +1,16 @@ import { mdiClose } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../src/common/dom/fire_event"; import "../../../../src/components/ha-header-bar"; import "../../../../src/components/ha-icon-button"; -import { HassDialog } from "../../../../src/dialogs/make-dialog-manager"; +import "../../../../src/components/ha-dialog"; +import type { HassDialog } from "../../../../src/dialogs/make-dialog-manager"; import { haStyleDialog } from "../../../../src/resources/styles"; import type { HomeAssistant } from "../../../../src/types"; import "../../components/hassio-upload-backup"; -import { HassioBackupUploadDialogParams } from "./show-dialog-backup-upload"; +import type { HassioBackupUploadDialogParams } from "./show-dialog-backup-upload"; @customElement("dialog-hassio-backup-upload") export class DialogHassioBackupUpload diff --git a/hassio/src/dialogs/backup/dialog-hassio-backup.ts b/hassio/src/dialogs/backup/dialog-hassio-backup.ts index 6414c2932e79..0b97cb87eac5 100644 --- a/hassio/src/dialogs/backup/dialog-hassio-backup.ts +++ b/hassio/src/dialogs/backup/dialog-hassio-backup.ts @@ -1,7 +1,8 @@ -import { ActionDetail } from "@material/mwc-list"; +import type { ActionDetail } from "@material/mwc-list"; import "@material/mwc-list/mwc-list-item"; import { mdiClose, mdiDotsVertical } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { atLeastVersion } from "../../../../src/common/config/version"; import { fireEvent } from "../../../../src/common/dom/fire_event"; @@ -14,9 +15,9 @@ import "../../../../src/components/ha-button-menu"; import "../../../../src/components/ha-header-bar"; import "../../../../src/components/ha-icon-button"; import { getSignedPath } from "../../../../src/data/auth"; +import type { HassioBackupDetail } from "../../../../src/data/hassio/backup"; import { fetchHassioBackupInfo, - HassioBackupDetail, removeBackup, } from "../../../../src/data/hassio/backup"; import { extractApiErrorMessage } from "../../../../src/data/hassio/common"; @@ -24,14 +25,14 @@ import { showAlertDialog, showConfirmationDialog, } from "../../../../src/dialogs/generic/show-dialog-box"; -import { HassDialog } from "../../../../src/dialogs/make-dialog-manager"; +import type { HassDialog } from "../../../../src/dialogs/make-dialog-manager"; import { haStyle, haStyleDialog } from "../../../../src/resources/styles"; -import { HomeAssistant } from "../../../../src/types"; +import type { HomeAssistant } from "../../../../src/types"; import { fileDownload } from "../../../../src/util/file_download"; import "../../components/supervisor-backup-content"; import type { SupervisorBackupContent } from "../../components/supervisor-backup-content"; -import { HassioBackupDialogParams } from "./show-dialog-hassio-backup"; -import { BackupOrRestoreKey } from "../../util/translations"; +import type { HassioBackupDialogParams } from "./show-dialog-hassio-backup"; +import type { BackupOrRestoreKey } from "../../util/translations"; @customElement("dialog-hassio-backup") class HassioBackupDialog diff --git a/hassio/src/dialogs/backup/dialog-hassio-create-backup.ts b/hassio/src/dialogs/backup/dialog-hassio-create-backup.ts index b00904307938..d4a5cc9fcc7f 100644 --- a/hassio/src/dialogs/backup/dialog-hassio-create-backup.ts +++ b/hassio/src/dialogs/backup/dialog-hassio-create-backup.ts @@ -1,5 +1,6 @@ import "@material/mwc-button"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { fireEvent } from "../../../../src/common/dom/fire_event"; import "../../../../src/components/buttons/ha-progress-button"; @@ -12,10 +13,10 @@ import { import { extractApiErrorMessage } from "../../../../src/data/hassio/common"; import { showAlertDialog } from "../../../../src/dialogs/generic/show-dialog-box"; import { haStyle, haStyleDialog } from "../../../../src/resources/styles"; -import { HomeAssistant } from "../../../../src/types"; +import type { HomeAssistant } from "../../../../src/types"; import "../../components/supervisor-backup-content"; import type { SupervisorBackupContent } from "../../components/supervisor-backup-content"; -import { HassioCreateBackupDialogParams } from "./show-dialog-hassio-create-backup"; +import type { HassioCreateBackupDialogParams } from "./show-dialog-hassio-create-backup"; @customElement("dialog-hassio-create-backup") class HassioCreateBackupDialog extends LitElement { diff --git a/hassio/src/dialogs/backup/show-dialog-hassio-backu-location.ts b/hassio/src/dialogs/backup/show-dialog-hassio-backu-location.ts index 43a82f114132..12ac69bc8213 100644 --- a/hassio/src/dialogs/backup/show-dialog-hassio-backu-location.ts +++ b/hassio/src/dialogs/backup/show-dialog-hassio-backu-location.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../../src/common/dom/fire_event"; -import { Supervisor } from "../../../../src/data/supervisor/supervisor"; +import type { Supervisor } from "../../../../src/data/supervisor/supervisor"; export interface HassioBackupLocationDialogParams { supervisor: Supervisor; diff --git a/hassio/src/dialogs/backup/show-dialog-hassio-backup.ts b/hassio/src/dialogs/backup/show-dialog-hassio-backup.ts index 42f00da445d4..eef9a22f5e11 100644 --- a/hassio/src/dialogs/backup/show-dialog-hassio-backup.ts +++ b/hassio/src/dialogs/backup/show-dialog-hassio-backup.ts @@ -1,6 +1,6 @@ import { fireEvent } from "../../../../src/common/dom/fire_event"; -import { LocalizeFunc } from "../../../../src/common/translations/localize"; -import { Supervisor } from "../../../../src/data/supervisor/supervisor"; +import type { LocalizeFunc } from "../../../../src/common/translations/localize"; +import type { Supervisor } from "../../../../src/data/supervisor/supervisor"; export interface HassioBackupDialogParams { slug: string; diff --git a/hassio/src/dialogs/backup/show-dialog-hassio-create-backup.ts b/hassio/src/dialogs/backup/show-dialog-hassio-create-backup.ts index 4fbcf0435c91..aada29d19617 100644 --- a/hassio/src/dialogs/backup/show-dialog-hassio-create-backup.ts +++ b/hassio/src/dialogs/backup/show-dialog-hassio-create-backup.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../../src/common/dom/fire_event"; -import { Supervisor } from "../../../../src/data/supervisor/supervisor"; +import type { Supervisor } from "../../../../src/data/supervisor/supervisor"; export interface HassioCreateBackupDialogParams { supervisor: Supervisor; diff --git a/hassio/src/dialogs/datadisk/dialog-hassio-datadisk.ts b/hassio/src/dialogs/datadisk/dialog-hassio-datadisk.ts index 4dcfde2ec2b4..8ede6209c39b 100644 --- a/hassio/src/dialogs/datadisk/dialog-hassio-datadisk.ts +++ b/hassio/src/dialogs/datadisk/dialog-hassio-datadisk.ts @@ -1,24 +1,23 @@ import "@material/mwc-list/mwc-list-item"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../src/common/dom/fire_event"; import "../../../../src/components/ha-circular-progress"; import "../../../../src/components/ha-select"; +import "../../../../src/components/ha-dialog"; import { extractApiErrorMessage, ignoreSupervisorError, } from "../../../../src/data/hassio/common"; -import { - DatadiskList, - listDatadisks, - moveDatadisk, -} from "../../../../src/data/hassio/host"; -import { Supervisor } from "../../../../src/data/supervisor/supervisor"; +import type { DatadiskList } from "../../../../src/data/hassio/host"; +import { listDatadisks, moveDatadisk } from "../../../../src/data/hassio/host"; +import type { Supervisor } from "../../../../src/data/supervisor/supervisor"; import { showAlertDialog } from "../../../../src/dialogs/generic/show-dialog-box"; import { haStyle, haStyleDialog } from "../../../../src/resources/styles"; -import { HomeAssistant } from "../../../../src/types"; -import { HassioDatatiskDialogParams } from "./show-dialog-hassio-datadisk"; +import type { HomeAssistant } from "../../../../src/types"; +import type { HassioDatatiskDialogParams } from "./show-dialog-hassio-datadisk"; const calculateMoveTime = memoizeOne((supervisor: Supervisor): number => { const speed = supervisor.host.disk_life_time !== "" ? 30 : 10; diff --git a/hassio/src/dialogs/datadisk/show-dialog-hassio-datadisk.ts b/hassio/src/dialogs/datadisk/show-dialog-hassio-datadisk.ts index c7a7d92b8571..bef5dd64c8ee 100644 --- a/hassio/src/dialogs/datadisk/show-dialog-hassio-datadisk.ts +++ b/hassio/src/dialogs/datadisk/show-dialog-hassio-datadisk.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../../src/common/dom/fire_event"; -import { Supervisor } from "../../../../src/data/supervisor/supervisor"; +import type { Supervisor } from "../../../../src/data/supervisor/supervisor"; export interface HassioDatatiskDialogParams { supervisor: Supervisor; diff --git a/hassio/src/dialogs/hardware/dialog-hassio-hardware.ts b/hassio/src/dialogs/hardware/dialog-hassio-hardware.ts index 62298180aef8..1056760be8aa 100644 --- a/hassio/src/dialogs/hardware/dialog-hassio-hardware.ts +++ b/hassio/src/dialogs/hardware/dialog-hassio-hardware.ts @@ -1,6 +1,7 @@ import { mdiClose } from "@mdi/js"; import { dump } from "js-yaml"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../src/common/dom/fire_event"; @@ -9,10 +10,10 @@ import "../../../../src/components/ha-dialog"; import "../../../../src/components/ha-expansion-panel"; import "../../../../src/components/ha-icon-button"; import "../../../../src/components/search-input"; -import { HassioHardwareInfo } from "../../../../src/data/hassio/hardware"; +import type { HassioHardwareInfo } from "../../../../src/data/hassio/hardware"; import { haStyle, haStyleDialog } from "../../../../src/resources/styles"; -import { HomeAssistant } from "../../../../src/types"; -import { HassioHardwareDialogParams } from "./show-dialog-hassio-hardware"; +import type { HomeAssistant } from "../../../../src/types"; +import type { HassioHardwareDialogParams } from "./show-dialog-hassio-hardware"; const _filterDevices = memoizeOne( ( diff --git a/hassio/src/dialogs/hardware/show-dialog-hassio-hardware.ts b/hassio/src/dialogs/hardware/show-dialog-hassio-hardware.ts index 4ca15734e8d1..b43410bb650d 100644 --- a/hassio/src/dialogs/hardware/show-dialog-hassio-hardware.ts +++ b/hassio/src/dialogs/hardware/show-dialog-hassio-hardware.ts @@ -1,6 +1,6 @@ import { fireEvent } from "../../../../src/common/dom/fire_event"; -import { HassioHardwareInfo } from "../../../../src/data/hassio/hardware"; -import { Supervisor } from "../../../../src/data/supervisor/supervisor"; +import type { HassioHardwareInfo } from "../../../../src/data/hassio/hardware"; +import type { Supervisor } from "../../../../src/data/supervisor/supervisor"; export interface HassioHardwareDialogParams { supervisor: Supervisor; diff --git a/hassio/src/dialogs/markdown/dialog-hassio-markdown.ts b/hassio/src/dialogs/markdown/dialog-hassio-markdown.ts index 3791ffd2e093..e52b7a79e499 100644 --- a/hassio/src/dialogs/markdown/dialog-hassio-markdown.ts +++ b/hassio/src/dialogs/markdown/dialog-hassio-markdown.ts @@ -1,11 +1,12 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { createCloseHeading } from "../../../../src/components/ha-dialog"; import "../../../../src/components/ha-markdown"; import { haStyleDialog } from "../../../../src/resources/styles"; -import { HomeAssistant } from "../../../../src/types"; +import type { HomeAssistant } from "../../../../src/types"; import { hassioStyle } from "../../resources/hassio-style"; -import { HassioMarkdownDialogParams } from "./show-dialog-hassio-markdown"; +import type { HassioMarkdownDialogParams } from "./show-dialog-hassio-markdown"; @customElement("dialog-hassio-markdown") class HassioMarkdownDialog extends LitElement { diff --git a/hassio/src/dialogs/network/dialog-hassio-network.ts b/hassio/src/dialogs/network/dialog-hassio-network.ts index 4def6de2a12a..088b3454ffdf 100644 --- a/hassio/src/dialogs/network/dialog-hassio-network.ts +++ b/hassio/src/dialogs/network/dialog-hassio-network.ts @@ -4,7 +4,8 @@ import "@material/mwc-list/mwc-list-item"; import "@material/mwc-tab"; import "@material/mwc-tab-bar"; import { mdiClose } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { cache } from "lit/directives/cache"; import { fireEvent } from "../../../../src/common/dom/fire_event"; @@ -20,22 +21,24 @@ import "../../../../src/components/ha-radio"; import "../../../../src/components/ha-textfield"; import type { HaTextField } from "../../../../src/components/ha-textfield"; import { extractApiErrorMessage } from "../../../../src/data/hassio/common"; -import { +import type { AccessPoints, - accesspointScan, NetworkInterface, - updateNetworkInterface, WifiConfiguration, } from "../../../../src/data/hassio/network"; -import { Supervisor } from "../../../../src/data/supervisor/supervisor"; +import { + accesspointScan, + updateNetworkInterface, +} from "../../../../src/data/hassio/network"; +import type { Supervisor } from "../../../../src/data/supervisor/supervisor"; import { showAlertDialog, showConfirmationDialog, } from "../../../../src/dialogs/generic/show-dialog-box"; -import { HassDialog } from "../../../../src/dialogs/make-dialog-manager"; +import type { HassDialog } from "../../../../src/dialogs/make-dialog-manager"; import { haStyleDialog } from "../../../../src/resources/styles"; import type { HomeAssistant } from "../../../../src/types"; -import { HassioNetworkDialogParams } from "./show-dialog-network"; +import type { HassioNetworkDialogParams } from "./show-dialog-network"; const IP_VERSIONS = ["ipv4", "ipv6"]; diff --git a/hassio/src/dialogs/network/show-dialog-network.ts b/hassio/src/dialogs/network/show-dialog-network.ts index edf21edff5c0..507b4938d365 100644 --- a/hassio/src/dialogs/network/show-dialog-network.ts +++ b/hassio/src/dialogs/network/show-dialog-network.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../../src/common/dom/fire_event"; -import { Supervisor } from "../../../../src/data/supervisor/supervisor"; +import type { Supervisor } from "../../../../src/data/supervisor/supervisor"; import "./dialog-hassio-network"; export interface HassioNetworkDialogParams { diff --git a/hassio/src/dialogs/registries/dialog-hassio-registries.ts b/hassio/src/dialogs/registries/dialog-hassio-registries.ts index 0f670d2bc9d8..4c4129a1e44f 100644 --- a/hassio/src/dialogs/registries/dialog-hassio-registries.ts +++ b/hassio/src/dialogs/registries/dialog-hassio-registries.ts @@ -1,6 +1,7 @@ import "@material/mwc-button/mwc-button"; import { mdiDelete } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { createCloseHeading } from "../../../../src/components/ha-dialog"; import "../../../../src/components/ha-form/ha-form"; @@ -13,11 +14,11 @@ import { fetchHassioDockerRegistries, removeHassioDockerRegistry, } from "../../../../src/data/hassio/docker"; -import { Supervisor } from "../../../../src/data/supervisor/supervisor"; +import type { Supervisor } from "../../../../src/data/supervisor/supervisor"; import { showAlertDialog } from "../../../../src/dialogs/generic/show-dialog-box"; import { haStyle, haStyleDialog } from "../../../../src/resources/styles"; import type { HomeAssistant } from "../../../../src/types"; -import { RegistriesDialogParams } from "./show-dialog-registries"; +import type { RegistriesDialogParams } from "./show-dialog-registries"; const SCHEMA = [ { diff --git a/hassio/src/dialogs/registries/show-dialog-registries.ts b/hassio/src/dialogs/registries/show-dialog-registries.ts index fd62edc7a773..0ca9bf67dc8d 100644 --- a/hassio/src/dialogs/registries/show-dialog-registries.ts +++ b/hassio/src/dialogs/registries/show-dialog-registries.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../../src/common/dom/fire_event"; -import { Supervisor } from "../../../../src/data/supervisor/supervisor"; +import type { Supervisor } from "../../../../src/data/supervisor/supervisor"; import "./dialog-hassio-registries"; export interface RegistriesDialogParams { diff --git a/hassio/src/dialogs/repositories/dialog-hassio-repositories.ts b/hassio/src/dialogs/repositories/dialog-hassio-repositories.ts index c37bcf217986..9d616d68c315 100644 --- a/hassio/src/dialogs/repositories/dialog-hassio-repositories.ts +++ b/hassio/src/dialogs/repositories/dialog-hassio-repositories.ts @@ -1,7 +1,8 @@ import "@material/mwc-button/mwc-button"; import { mdiDelete, mdiDeleteOff } from "@mdi/js"; import "@lrnwebcomponents/simple-tooltip/simple-tooltip"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../src/common/dom/fire_event"; @@ -10,7 +11,7 @@ import "../../../../src/components/ha-alert"; import "../../../../src/components/ha-circular-progress"; import { createCloseHeading } from "../../../../src/components/ha-dialog"; import "../../../../src/components/ha-icon-button"; -import { +import type { HassioAddonInfo, HassioAddonRepository, } from "../../../../src/data/hassio/addon"; @@ -22,7 +23,7 @@ import { } from "../../../../src/data/supervisor/store"; import { haStyle, haStyleDialog } from "../../../../src/resources/styles"; import type { HomeAssistant } from "../../../../src/types"; -import { HassioRepositoryDialogParams } from "./show-dialog-repositories"; +import type { HassioRepositoryDialogParams } from "./show-dialog-repositories"; import type { HaTextField } from "../../../../src/components/ha-textfield"; import "../../../../src/components/ha-textfield"; import "../../../../src/components/ha-md-list"; diff --git a/hassio/src/dialogs/repositories/show-dialog-repositories.ts b/hassio/src/dialogs/repositories/show-dialog-repositories.ts index 50b0a4f578b7..1b540c883cf9 100644 --- a/hassio/src/dialogs/repositories/show-dialog-repositories.ts +++ b/hassio/src/dialogs/repositories/show-dialog-repositories.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../../src/common/dom/fire_event"; -import { Supervisor } from "../../../../src/data/supervisor/supervisor"; +import type { Supervisor } from "../../../../src/data/supervisor/supervisor"; import "./dialog-hassio-repositories"; export interface HassioRepositoryDialogParams { diff --git a/hassio/src/dialogs/suggestAddonRestart.ts b/hassio/src/dialogs/suggestAddonRestart.ts index 56a7bb8a0e5f..74165ced94f6 100644 --- a/hassio/src/dialogs/suggestAddonRestart.ts +++ b/hassio/src/dialogs/suggestAddonRestart.ts @@ -1,15 +1,13 @@ import type { LitElement } from "lit"; -import { - HassioAddonDetails, - restartHassioAddon, -} from "../../../src/data/hassio/addon"; +import type { HassioAddonDetails } from "../../../src/data/hassio/addon"; +import { restartHassioAddon } from "../../../src/data/hassio/addon"; import { extractApiErrorMessage } from "../../../src/data/hassio/common"; -import { Supervisor } from "../../../src/data/supervisor/supervisor"; +import type { Supervisor } from "../../../src/data/supervisor/supervisor"; import { showAlertDialog, showConfirmationDialog, } from "../../../src/dialogs/generic/show-dialog-box"; -import { HomeAssistant } from "../../../src/types"; +import type { HomeAssistant } from "../../../src/types"; export const suggestAddonRestart = async ( element: LitElement, diff --git a/hassio/src/hassio-main.ts b/hassio/src/hassio-main.ts index 04f2dbf3c05b..7afbf5d33363 100644 --- a/hassio/src/hassio-main.ts +++ b/hassio/src/hassio-main.ts @@ -1,4 +1,5 @@ -import { html, PropertyValues } from "lit"; +import type { PropertyValues } from "lit"; +import { html } from "lit"; import { customElement, property } from "lit/decorators"; import { atLeastVersion } from "../../src/common/config/version"; import { applyThemesOnElement } from "../../src/common/dom/apply_themes_on_element"; @@ -6,10 +7,10 @@ import { fireEvent } from "../../src/common/dom/fire_event"; import { mainWindow } from "../../src/common/dom/get_main_window"; import { isNavigationClick } from "../../src/common/dom/is-navigation-click"; import { navigate } from "../../src/common/navigate"; -import { HassioPanelInfo } from "../../src/data/hassio/supervisor"; -import { Supervisor } from "../../src/data/supervisor/supervisor"; +import type { HassioPanelInfo } from "../../src/data/hassio/supervisor"; +import type { Supervisor } from "../../src/data/supervisor/supervisor"; import { makeDialogManager } from "../../src/dialogs/make-dialog-manager"; -import { HomeAssistant } from "../../src/types"; +import type { HomeAssistant } from "../../src/types"; import "./hassio-router"; import { SupervisorBaseElement } from "./supervisor-base-element"; diff --git a/hassio/src/hassio-my-redirect.ts b/hassio/src/hassio-my-redirect.ts index 0640d4820fca..019823083fee 100644 --- a/hassio/src/hassio-my-redirect.ts +++ b/hassio/src/hassio-my-redirect.ts @@ -1,19 +1,20 @@ import { sanitizeUrl } from "@braintree/sanitize-url"; -import { html, LitElement, TemplateResult, nothing } from "lit"; +import type { TemplateResult } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { navigate } from "../../src/common/navigate"; import { createSearchParam, extractSearchParamsObject, } from "../../src/common/url/search-params"; -import { Supervisor } from "../../src/data/supervisor/supervisor"; +import type { Supervisor } from "../../src/data/supervisor/supervisor"; import "../../src/layouts/hass-error-screen"; -import { +import type { ParamType, Redirect, Redirects, } from "../../src/panels/my/ha-panel-my"; -import { HomeAssistant, Route } from "../../src/types"; +import type { HomeAssistant, Route } from "../../src/types"; export const REDIRECTS: Redirects = { supervisor: { diff --git a/hassio/src/hassio-panel-router.ts b/hassio/src/hassio-panel-router.ts index 310f191e61e8..42eff379f57f 100644 --- a/hassio/src/hassio-panel-router.ts +++ b/hassio/src/hassio-panel-router.ts @@ -1,10 +1,8 @@ import { customElement, property } from "lit/decorators"; -import { Supervisor } from "../../src/data/supervisor/supervisor"; -import { - HassRouterPage, - RouterOptions, -} from "../../src/layouts/hass-router-page"; -import { HomeAssistant, Route } from "../../src/types"; +import type { Supervisor } from "../../src/data/supervisor/supervisor"; +import type { RouterOptions } from "../../src/layouts/hass-router-page"; +import { HassRouterPage } from "../../src/layouts/hass-router-page"; +import type { HomeAssistant, Route } from "../../src/types"; // Don't codesplit it, that way the dashboard always loads fast. import "./dashboard/hassio-dashboard"; diff --git a/hassio/src/hassio-panel.ts b/hassio/src/hassio-panel.ts index 36f570fdb3be..cc2b4c206f16 100644 --- a/hassio/src/hassio-panel.ts +++ b/hassio/src/hassio-panel.ts @@ -1,11 +1,10 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; -import { - Supervisor, - supervisorCollection, -} from "../../src/data/supervisor/supervisor"; +import type { Supervisor } from "../../src/data/supervisor/supervisor"; +import { supervisorCollection } from "../../src/data/supervisor/supervisor"; import "../../src/layouts/hass-loading-screen"; -import { HomeAssistant, Route } from "../../src/types"; +import type { HomeAssistant, Route } from "../../src/types"; import "./hassio-panel-router"; @customElement("hassio-panel") diff --git a/hassio/src/hassio-router.ts b/hassio/src/hassio-router.ts index a56f8088d550..a886fe2ae421 100644 --- a/hassio/src/hassio-router.ts +++ b/hassio/src/hassio-router.ts @@ -1,12 +1,10 @@ import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; -import { HassioPanelInfo } from "../../src/data/hassio/supervisor"; -import { Supervisor } from "../../src/data/supervisor/supervisor"; -import { - HassRouterPage, - RouterOptions, -} from "../../src/layouts/hass-router-page"; -import { HomeAssistant } from "../../src/types"; +import type { HassioPanelInfo } from "../../src/data/hassio/supervisor"; +import type { Supervisor } from "../../src/data/supervisor/supervisor"; +import type { RouterOptions } from "../../src/layouts/hass-router-page"; +import { HassRouterPage } from "../../src/layouts/hass-router-page"; +import type { HomeAssistant } from "../../src/types"; // Don't codesplit it, that way the dashboard always loads fast. import "./hassio-panel"; diff --git a/hassio/src/hassio-tabs.ts b/hassio/src/hassio-tabs.ts index 4bbc79c8e05e..a66646ee17db 100644 --- a/hassio/src/hassio-tabs.ts +++ b/hassio/src/hassio-tabs.ts @@ -6,7 +6,7 @@ import { } from "@mdi/js"; import { atLeastVersion } from "../../src/common/config/version"; import type { PageNavigation } from "../../src/layouts/hass-tabs-subpage"; -import { HomeAssistant } from "../../src/types"; +import type { HomeAssistant } from "../../src/types"; export const supervisorTabs = (hass: HomeAssistant): PageNavigation[] => atLeastVersion(hass.config.version, 2022, 5) diff --git a/hassio/src/ingress-view/hassio-ingress-view.ts b/hassio/src/ingress-view/hassio-ingress-view.ts index 1dd895bdfe0f..93a366cb4e34 100644 --- a/hassio/src/ingress-view/hassio-ingress-view.ts +++ b/hassio/src/ingress-view/hassio-ingress-view.ts @@ -1,21 +1,15 @@ import { mdiMenu } from "@mdi/js"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../src/common/dom/fire_event"; import { navigate } from "../../../src/common/navigate"; import { extractSearchParam } from "../../../src/common/url/search-params"; import { nextRender } from "../../../src/common/util/render-status"; import "../../../src/components/ha-icon-button"; +import type { HassioAddonDetails } from "../../../src/data/hassio/addon"; import { fetchHassioAddonInfo, - HassioAddonDetails, startHassioAddon, } from "../../../src/data/hassio/addon"; import { extractApiErrorMessage } from "../../../src/data/hassio/common"; @@ -23,14 +17,14 @@ import { createHassioSession, validateHassioSession, } from "../../../src/data/hassio/ingress"; -import { Supervisor } from "../../../src/data/supervisor/supervisor"; +import type { Supervisor } from "../../../src/data/supervisor/supervisor"; import { showAlertDialog, showConfirmationDialog, } from "../../../src/dialogs/generic/show-dialog-box"; import "../../../src/layouts/hass-loading-screen"; import "../../../src/layouts/hass-subpage"; -import { HomeAssistant, Route } from "../../../src/types"; +import type { HomeAssistant, Route } from "../../../src/types"; @customElement("hassio-ingress-view") class HassioIngressView extends LitElement { diff --git a/hassio/src/supervisor-base-element.ts b/hassio/src/supervisor-base-element.ts index 86dc81998887..c1b826762c84 100644 --- a/hassio/src/supervisor-base-element.ts +++ b/hassio/src/supervisor-base-element.ts @@ -1,10 +1,11 @@ -import { Collection, UnsubscribeFunc } from "home-assistant-js-websocket"; -import { LitElement, PropertyValues } from "lit"; +import type { Collection, UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { PropertyValues } from "lit"; +import { LitElement } from "lit"; import { property, state } from "lit/decorators"; import { atLeastVersion } from "../../src/common/config/version"; import { computeLocalize } from "../../src/common/translations/localize"; import { fetchHassioAddonsInfo } from "../../src/data/hassio/addon"; -import { HassioResponse } from "../../src/data/hassio/common"; +import type { HassioResponse } from "../../src/data/hassio/common"; import { fetchHassioHassOsInfo, fetchHassioHostInfo, @@ -17,17 +18,19 @@ import { fetchHassioSupervisorInfo, } from "../../src/data/hassio/supervisor"; import { fetchSupervisorStore } from "../../src/data/supervisor/store"; -import { - getSupervisorEventCollection, +import type { Supervisor, SupervisorObject, - supervisorCollection, SupervisorKeys, +} from "../../src/data/supervisor/supervisor"; +import { + getSupervisorEventCollection, + supervisorCollection, cleanupSupervisorCollection, } from "../../src/data/supervisor/supervisor"; import { ProvideHassLitMixin } from "../../src/mixins/provide-hass-lit-mixin"; import { urlSyncMixin } from "../../src/state/url-sync-mixin"; -import { HomeAssistant, Route } from "../../src/types"; +import type { HomeAssistant, Route } from "../../src/types"; import { getTranslation } from "../../src/util/common-translation"; import { computeRTLDirection, diff --git a/hassio/src/system/hassio-core-info.ts b/hassio/src/system/hassio-core-info.ts index f005700b17cc..be00774d54c3 100644 --- a/hassio/src/system/hassio-core-info.ts +++ b/hassio/src/system/hassio-core-info.ts @@ -1,25 +1,26 @@ import "@material/mwc-button"; import "@material/mwc-list/mwc-list-item"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { atLeastVersion } from "../../../src/common/config/version"; import "../../../src/components/buttons/ha-progress-button"; import "../../../src/components/ha-button-menu"; import "../../../src/components/ha-card"; import "../../../src/components/ha-settings-row"; +import type { HassioStats } from "../../../src/data/hassio/common"; import { extractApiErrorMessage, fetchHassioStats, - HassioStats, } from "../../../src/data/hassio/common"; import { restartCore } from "../../../src/data/supervisor/core"; -import { Supervisor } from "../../../src/data/supervisor/supervisor"; +import type { Supervisor } from "../../../src/data/supervisor/supervisor"; import { showAlertDialog, showConfirmationDialog, } from "../../../src/dialogs/generic/show-dialog-box"; import { haStyle } from "../../../src/resources/styles"; -import { HomeAssistant } from "../../../src/types"; +import type { HomeAssistant } from "../../../src/types"; import { bytesToString } from "../../../src/util/bytes-to-string"; import "../components/supervisor-metric"; import { hassioStyle } from "../resources/hassio-style"; diff --git a/hassio/src/system/hassio-host-info.ts b/hassio/src/system/hassio-host-info.ts index 4e84c0f23fd5..6ae9e7ee6497 100644 --- a/hassio/src/system/hassio-host-info.ts +++ b/hassio/src/system/hassio-host-info.ts @@ -1,7 +1,8 @@ import "@material/mwc-button"; import "@material/mwc-list/mwc-list-item"; import { mdiDotsVertical } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; import { atLeastVersion } from "../../../src/common/config/version"; @@ -22,18 +23,16 @@ import { rebootHost, shutdownHost, } from "../../../src/data/hassio/host"; -import { - fetchNetworkInfo, - NetworkInfo, -} from "../../../src/data/hassio/network"; -import { Supervisor } from "../../../src/data/supervisor/supervisor"; +import type { NetworkInfo } from "../../../src/data/hassio/network"; +import { fetchNetworkInfo } from "../../../src/data/hassio/network"; +import type { Supervisor } from "../../../src/data/supervisor/supervisor"; import { showAlertDialog, showConfirmationDialog, showPromptDialog, } from "../../../src/dialogs/generic/show-dialog-box"; import { haStyle } from "../../../src/resources/styles"; -import { HomeAssistant } from "../../../src/types"; +import type { HomeAssistant } from "../../../src/types"; import { getValueInPercentage, roundWithOneDecimal, diff --git a/hassio/src/system/hassio-supervisor-info.ts b/hassio/src/system/hassio-supervisor-info.ts index 69ef2a64f3b6..15fb03d4dd4e 100644 --- a/hassio/src/system/hassio-supervisor-info.ts +++ b/hassio/src/system/hassio-supervisor-info.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { atLeastVersion } from "../../../src/common/config/version"; import { fireEvent } from "../../../src/common/dom/fire_event"; @@ -7,18 +8,18 @@ import "../../../src/components/ha-alert"; import "../../../src/components/ha-card"; import "../../../src/components/ha-settings-row"; import "../../../src/components/ha-switch"; +import type { HassioStats } from "../../../src/data/hassio/common"; import { extractApiErrorMessage, fetchHassioStats, - HassioStats, } from "../../../src/data/hassio/common"; +import type { SupervisorOptions } from "../../../src/data/hassio/supervisor"; import { reloadSupervisor, restartSupervisor, setSupervisorOption, - SupervisorOptions, } from "../../../src/data/hassio/supervisor"; -import { Supervisor } from "../../../src/data/supervisor/supervisor"; +import type { Supervisor } from "../../../src/data/supervisor/supervisor"; import { showAlertDialog, showConfirmationDialog, @@ -29,7 +30,7 @@ import { UNSUPPORTED_REASON_URL, } from "../../../src/panels/config/repairs/dialog-system-information"; import { haStyle } from "../../../src/resources/styles"; -import { HomeAssistant } from "../../../src/types"; +import type { HomeAssistant } from "../../../src/types"; import { bytesToString } from "../../../src/util/bytes-to-string"; import { documentationUrl } from "../../../src/util/documentation-url"; import "../components/supervisor-metric"; diff --git a/hassio/src/system/hassio-supervisor-log.ts b/hassio/src/system/hassio-supervisor-log.ts index f64f5f8f8530..91b2a9a19e75 100644 --- a/hassio/src/system/hassio-supervisor-log.ts +++ b/hassio/src/system/hassio-supervisor-log.ts @@ -1,6 +1,7 @@ import "@material/mwc-button"; import "@material/mwc-list/mwc-list-item"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../src/components/buttons/ha-progress-button"; import "../../../src/components/ha-alert"; @@ -9,10 +10,10 @@ import "../../../src/components/ha-card"; import "../../../src/components/ha-select"; import { extractApiErrorMessage } from "../../../src/data/hassio/common"; import { fetchHassioLogs } from "../../../src/data/hassio/supervisor"; -import { Supervisor } from "../../../src/data/supervisor/supervisor"; +import type { Supervisor } from "../../../src/data/supervisor/supervisor"; import "../../../src/layouts/hass-loading-screen"; import { haStyle } from "../../../src/resources/styles"; -import { HomeAssistant } from "../../../src/types"; +import type { HomeAssistant } from "../../../src/types"; import { hassioStyle } from "../resources/hassio-style"; interface LogProvider { diff --git a/hassio/src/system/hassio-system.ts b/hassio/src/system/hassio-system.ts index 1f64271017e0..0eacf50f120a 100644 --- a/hassio/src/system/hassio-system.ts +++ b/hassio/src/system/hassio-system.ts @@ -1,10 +1,11 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { atLeastVersion } from "../../../src/common/config/version"; -import { Supervisor } from "../../../src/data/supervisor/supervisor"; +import type { Supervisor } from "../../../src/data/supervisor/supervisor"; import "../../../src/layouts/hass-tabs-subpage"; import { haStyle } from "../../../src/resources/styles"; -import { HomeAssistant, Route } from "../../../src/types"; +import type { HomeAssistant, Route } from "../../../src/types"; import { supervisorTabs } from "../hassio-tabs"; import { hassioStyle } from "../resources/hassio-style"; import "./hassio-core-info"; diff --git a/hassio/src/update-available/update-available-card.ts b/hassio/src/update-available/update-available-card.ts index e00035b987a0..f69bcf9b1d8e 100644 --- a/hassio/src/update-available/update-available-card.ts +++ b/hassio/src/update-available/update-available-card.ts @@ -1,10 +1,11 @@ +import "@material/mwc-list/mwc-list-item"; import { css, - CSSResultGroup, + type CSSResultGroup, html, LitElement, nothing, - PropertyValues, + type PropertyValues, } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; @@ -21,10 +22,10 @@ import "../../../src/components/ha-settings-row"; import "../../../src/components/ha-svg-icon"; import "../../../src/components/ha-switch"; import type { HaSwitch } from "../../../src/components/ha-switch"; +import type { HassioAddonDetails } from "../../../src/data/hassio/addon"; import { fetchHassioAddonChangelog, fetchHassioAddonInfo, - HassioAddonDetails, updateHassioAddon, } from "../../../src/data/hassio/addon"; import { @@ -38,11 +39,11 @@ import { updateSupervisor, } from "../../../src/data/hassio/supervisor"; import { updateCore } from "../../../src/data/supervisor/core"; -import { StoreAddon } from "../../../src/data/supervisor/store"; -import { Supervisor } from "../../../src/data/supervisor/supervisor"; +import type { StoreAddon } from "../../../src/data/supervisor/store"; +import type { Supervisor } from "../../../src/data/supervisor/supervisor"; import { showAlertDialog } from "../../../src/dialogs/generic/show-dialog-box"; import { haStyle } from "../../../src/resources/styles"; -import { HomeAssistant, Route } from "../../../src/types"; +import type { HomeAssistant, Route } from "../../../src/types"; import { addonArchIsSupported, extractChangelog } from "../util/addon"; declare global { diff --git a/hassio/src/update-available/update-available-dashboard.ts b/hassio/src/update-available/update-available-dashboard.ts index 9ebb25a4cd9b..11b35b6d248c 100644 --- a/hassio/src/update-available/update-available-dashboard.ts +++ b/hassio/src/update-available/update-available-dashboard.ts @@ -1,8 +1,9 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; -import { Supervisor } from "../../../src/data/supervisor/supervisor"; +import type { Supervisor } from "../../../src/data/supervisor/supervisor"; import "../../../src/layouts/hass-subpage"; -import { HomeAssistant, Route } from "../../../src/types"; +import type { HomeAssistant, Route } from "../../../src/types"; import "./update-available-card"; @customElement("update-available-dashboard") diff --git a/hassio/src/util/addon.ts b/hassio/src/util/addon.ts index ec15a50c4901..fe9f5f9a9cff 100644 --- a/hassio/src/util/addon.ts +++ b/hassio/src/util/addon.ts @@ -1,6 +1,6 @@ import memoizeOne from "memoize-one"; -import { HassioAddonDetails } from "../../../src/data/hassio/addon"; -import { SupervisorArch } from "../../../src/data/supervisor/supervisor"; +import type { HassioAddonDetails } from "../../../src/data/hassio/addon"; +import type { SupervisorArch } from "../../../src/data/supervisor/supervisor"; export const addonArchIsSupported = memoizeOne( (supported_archs: SupervisorArch[], addon_archs: SupervisorArch[]) => diff --git a/src/auth/ha-auth-flow.ts b/src/auth/ha-auth-flow.ts index db5b233073bf..668beb4685a6 100644 --- a/src/auth/ha-auth-flow.ts +++ b/src/auth/ha-auth-flow.ts @@ -1,22 +1,23 @@ /* eslint-disable lit/prefer-static-styles */ import "@material/mwc-button"; import { genClientId } from "home-assistant-js-websocket"; -import { html, LitElement, nothing, PropertyValues } from "lit"; +import type { PropertyValues } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { LocalizeFunc } from "../common/translations/localize"; +import type { LocalizeFunc } from "../common/translations/localize"; import "../components/ha-alert"; import "../components/ha-checkbox"; import { computeInitialHaFormData } from "../components/ha-form/compute-initial-ha-form-data"; import "../components/ha-formfield"; +import type { AuthProvider } from "../data/auth"; import { - AuthProvider, autocompleteLoginFields, createLoginFlow, deleteLoginFlow, redirectWithAuthCode, submitLoginFlow, } from "../data/auth"; -import { +import type { DataEntryFlowStep, DataEntryFlowStepForm, } from "../data/data_entry_flow"; diff --git a/src/auth/ha-auth-form-string.ts b/src/auth/ha-auth-form-string.ts index da47353aa628..77de5c495ad8 100644 --- a/src/auth/ha-auth-form-string.ts +++ b/src/auth/ha-auth-form-string.ts @@ -1,5 +1,6 @@ /* eslint-disable lit/prefer-static-styles */ -import { TemplateResult, html } from "lit"; +import type { TemplateResult } from "lit"; +import { html } from "lit"; import { customElement } from "lit/decorators"; import { HaFormString } from "../components/ha-form/ha-form-string"; import "../components/ha-icon-button"; diff --git a/src/auth/ha-auth-form.ts b/src/auth/ha-auth-form.ts index 7d8a99f31eaf..bffa1e79a134 100644 --- a/src/auth/ha-auth-form.ts +++ b/src/auth/ha-auth-form.ts @@ -3,7 +3,7 @@ import { html } from "lit"; import { customElement, property } from "lit/decorators"; import { HaForm } from "../components/ha-form/ha-form"; import "./ha-auth-form-string"; -import { LocalizeFunc } from "../common/translations/localize"; +import type { LocalizeFunc } from "../common/translations/localize"; const localizeBaseKey = "ui.panel.page-authorize.form"; diff --git a/src/auth/ha-auth-textfield.ts b/src/auth/ha-auth-textfield.ts index 20d5e66174c8..ca4f8e1f1904 100644 --- a/src/auth/ha-auth-textfield.ts +++ b/src/auth/ha-auth-textfield.ts @@ -1,7 +1,8 @@ /* eslint-disable lit/value-after-constraints */ /* eslint-disable lit/prefer-static-styles */ import { floatingLabel } from "@material/mwc-floating-label/mwc-floating-label-directive"; -import { TemplateResult, html } from "lit"; +import type { TemplateResult } from "lit"; +import { html } from "lit"; import { customElement } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { live } from "lit/directives/live"; diff --git a/src/auth/ha-authorize.ts b/src/auth/ha-authorize.ts index 1e950af53698..7da3c57e588e 100644 --- a/src/auth/ha-authorize.ts +++ b/src/auth/ha-authorize.ts @@ -1,15 +1,13 @@ /* eslint-disable lit/prefer-static-styles */ -import { html, LitElement, nothing, PropertyValues } from "lit"; +import type { PropertyValues } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import punycode from "punycode"; import { applyThemesOnElement } from "../common/dom/apply_themes_on_element"; import { extractSearchParamsObject } from "../common/url/search-params"; import "../components/ha-alert"; -import { - AuthProvider, - AuthUrlSearchParams, - fetchAuthProviders, -} from "../data/auth"; +import type { AuthProvider, AuthUrlSearchParams } from "../data/auth"; +import { fetchAuthProviders } from "../data/auth"; import { litLocalizeLiteMixin } from "../mixins/lit-localize-lite-mixin"; import { registerServiceWorker } from "../util/register-service-worker"; import "./ha-auth-flow"; diff --git a/src/auth/ha-pick-auth-provider.ts b/src/auth/ha-pick-auth-provider.ts index a814788b0a30..2ee93fb2e471 100644 --- a/src/auth/ha-pick-auth-provider.ts +++ b/src/auth/ha-pick-auth-provider.ts @@ -2,10 +2,10 @@ import "@material/mwc-list"; import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; -import { LocalizeFunc } from "../common/translations/localize"; +import type { LocalizeFunc } from "../common/translations/localize"; import "../components/ha-icon-next"; import "../components/ha-list-item"; -import { AuthProvider } from "../data/auth"; +import type { AuthProvider } from "../data/auth"; declare global { interface HTMLElementTagNameMap { diff --git a/src/cast/cast_manager.ts b/src/cast/cast_manager.ts index 9d8747543af8..1407ba845fdc 100644 --- a/src/cast/cast_manager.ts +++ b/src/cast/cast_manager.ts @@ -1,14 +1,12 @@ /* eslint-disable no-console */ -import { Auth } from "home-assistant-js-websocket"; +import type { Auth } from "home-assistant-js-websocket"; import { castApiAvailable } from "./cast_framework"; import { CAST_APP_ID, CAST_DEV, CAST_NS } from "./const"; import { CAST_DEV_HASS_URL } from "./dev_const"; -import { - castSendAuth, - HassMessage as ReceiverMessage, -} from "./receiver_messages"; -import { ReceiverStatusMessage, SenderMessage } from "./sender_messages"; +import type { HassMessage as ReceiverMessage } from "./receiver_messages"; +import { castSendAuth } from "./receiver_messages"; +import type { ReceiverStatusMessage, SenderMessage } from "./sender_messages"; let managerProm: Promise | undefined; diff --git a/src/cast/receiver_messages.ts b/src/cast/receiver_messages.ts index 8b59962538c2..58de177773a1 100644 --- a/src/cast/receiver_messages.ts +++ b/src/cast/receiver_messages.ts @@ -1,10 +1,10 @@ // Nessages to be processed inside the Cast Receiver app -import { Auth } from "home-assistant-js-websocket"; -import { CastManager } from "./cast_manager"; +import type { Auth } from "home-assistant-js-websocket"; +import type { CastManager } from "./cast_manager"; import { CAST_DEV } from "./const"; import { CAST_DEV_HASS_URL } from "./dev_const"; -import { BaseCastMessage } from "./types"; +import type { BaseCastMessage } from "./types"; export interface GetStatusMessage extends BaseCastMessage { type: "get_status"; diff --git a/src/cast/sender_messages.ts b/src/cast/sender_messages.ts index 4706a0d1aebb..3f1adff65914 100644 --- a/src/cast/sender_messages.ts +++ b/src/cast/sender_messages.ts @@ -1,4 +1,4 @@ -import { BaseCastMessage } from "./types"; +import type { BaseCastMessage } from "./types"; // Messages to be processed inside the Home Assistant UI diff --git a/src/common/auth/token_storage.ts b/src/common/auth/token_storage.ts index 302da3d7fd08..4bfe18981c90 100644 --- a/src/common/auth/token_storage.ts +++ b/src/common/auth/token_storage.ts @@ -1,4 +1,4 @@ -import { AuthData } from "home-assistant-js-websocket"; +import type { AuthData } from "home-assistant-js-websocket"; import { extractSearchParam } from "../url/search-params"; const storage = window.localStorage || {}; diff --git a/src/common/config/can_show_page.ts b/src/common/config/can_show_page.ts index d73ebc5e2e38..48ceec7b65d5 100644 --- a/src/common/config/can_show_page.ts +++ b/src/common/config/can_show_page.ts @@ -1,5 +1,5 @@ -import { PageNavigation } from "../../layouts/hass-tabs-subpage"; -import { HomeAssistant } from "../../types"; +import type { PageNavigation } from "../../layouts/hass-tabs-subpage"; +import type { HomeAssistant } from "../../types"; import { ensureArray } from "../array/ensure-array"; import { isComponentLoaded } from "./is_component_loaded"; diff --git a/src/common/config/components_with_service.ts b/src/common/config/components_with_service.ts index 9775b8c6f695..dab10f244154 100644 --- a/src/common/config/components_with_service.ts +++ b/src/common/config/components_with_service.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; /** Return an array of domains with the service. */ export const componentsWithService = ( diff --git a/src/common/config/is_component_loaded.ts b/src/common/config/is_component_loaded.ts index 1d212f3ff543..3f0b4411b734 100644 --- a/src/common/config/is_component_loaded.ts +++ b/src/common/config/is_component_loaded.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; /** Return if a component is loaded. */ export const isComponentLoaded = ( diff --git a/src/common/config/is_service_loaded.ts b/src/common/config/is_service_loaded.ts index c8a7824a5a47..9556ed07939b 100644 --- a/src/common/config/is_service_loaded.ts +++ b/src/common/config/is_service_loaded.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; /** Return if a service is loaded. */ export const isServiceLoaded = ( diff --git a/src/common/config/location_name.ts b/src/common/config/location_name.ts index d198951b2450..857190fb8280 100644 --- a/src/common/config/location_name.ts +++ b/src/common/config/location_name.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; /** Get the location name from a hass object. */ export default function computeLocationName(hass: HomeAssistant): string { diff --git a/src/common/datetime/absolute_time.ts b/src/common/datetime/absolute_time.ts index 261c78ff83fb..3016aa0ea8d5 100644 --- a/src/common/datetime/absolute_time.ts +++ b/src/common/datetime/absolute_time.ts @@ -1,6 +1,6 @@ import { isSameDay, isSameYear } from "date-fns"; -import { HassConfig } from "home-assistant-js-websocket"; -import { FrontendLocaleData } from "../../data/translation"; +import type { HassConfig } from "home-assistant-js-websocket"; +import type { FrontendLocaleData } from "../../data/translation"; import { formatShortDateTime, formatShortDateTimeWithYear, diff --git a/src/common/datetime/calc_date.ts b/src/common/datetime/calc_date.ts index 3c8635fdc048..c6b51dd9aa04 100644 --- a/src/common/datetime/calc_date.ts +++ b/src/common/datetime/calc_date.ts @@ -1,6 +1,7 @@ import { toZonedTime, fromZonedTime } from "date-fns-tz"; -import { HassConfig } from "home-assistant-js-websocket"; -import { FrontendLocaleData, TimeZone } from "../../data/translation"; +import type { HassConfig } from "home-assistant-js-websocket"; +import type { FrontendLocaleData } from "../../data/translation"; +import { TimeZone } from "../../data/translation"; const calcZonedDate = ( date: Date, diff --git a/src/common/datetime/first_weekday.ts b/src/common/datetime/first_weekday.ts index 3c34eb7c142c..c5099702c1dd 100644 --- a/src/common/datetime/first_weekday.ts +++ b/src/common/datetime/first_weekday.ts @@ -1,5 +1,6 @@ import { getWeekStartByLocale } from "weekstart"; -import { FrontendLocaleData, FirstWeekday } from "../../data/translation"; +import type { FrontendLocaleData } from "../../data/translation"; +import { FirstWeekday } from "../../data/translation"; export const weekdays = [ "sunday", diff --git a/src/common/datetime/format_date.ts b/src/common/datetime/format_date.ts index c48c9b049e1a..53b30f1deb3b 100644 --- a/src/common/datetime/format_date.ts +++ b/src/common/datetime/format_date.ts @@ -1,6 +1,7 @@ -import { HassConfig } from "home-assistant-js-websocket"; +import type { HassConfig } from "home-assistant-js-websocket"; import memoizeOne from "memoize-one"; -import { DateFormat, FrontendLocaleData } from "../../data/translation"; +import type { FrontendLocaleData } from "../../data/translation"; +import { DateFormat } from "../../data/translation"; import { resolveTimeZone } from "./resolve-time-zone"; // Tuesday, August 10 diff --git a/src/common/datetime/format_date_time.ts b/src/common/datetime/format_date_time.ts index a04408284ef5..880c625712da 100644 --- a/src/common/datetime/format_date_time.ts +++ b/src/common/datetime/format_date_time.ts @@ -1,6 +1,6 @@ -import { HassConfig } from "home-assistant-js-websocket"; +import type { HassConfig } from "home-assistant-js-websocket"; import memoizeOne from "memoize-one"; -import { FrontendLocaleData } from "../../data/translation"; +import type { FrontendLocaleData } from "../../data/translation"; import { formatDateNumeric } from "./format_date"; import { formatTime } from "./format_time"; import { resolveTimeZone } from "./resolve-time-zone"; diff --git a/src/common/datetime/format_duration.ts b/src/common/datetime/format_duration.ts index bd258fe095b5..c530a20d4aba 100644 --- a/src/common/datetime/format_duration.ts +++ b/src/common/datetime/format_duration.ts @@ -1,5 +1,5 @@ -import { HaDurationData } from "../../components/ha-duration-input"; -import { FrontendLocaleData } from "../../data/translation"; +import type { HaDurationData } from "../../components/ha-duration-input"; +import type { FrontendLocaleData } from "../../data/translation"; const leftPad = (num: number) => (num < 10 ? `0${num}` : num); diff --git a/src/common/datetime/format_time.ts b/src/common/datetime/format_time.ts index 669dcaf8a611..5a124c154008 100644 --- a/src/common/datetime/format_time.ts +++ b/src/common/datetime/format_time.ts @@ -1,6 +1,6 @@ -import { HassConfig } from "home-assistant-js-websocket"; +import type { HassConfig } from "home-assistant-js-websocket"; import memoizeOne from "memoize-one"; -import { FrontendLocaleData } from "../../data/translation"; +import type { FrontendLocaleData } from "../../data/translation"; import { resolveTimeZone } from "./resolve-time-zone"; import { useAmPm } from "./use_am_pm"; diff --git a/src/common/datetime/relative_time.ts b/src/common/datetime/relative_time.ts index 8be9a65119ed..bf3722a977f2 100644 --- a/src/common/datetime/relative_time.ts +++ b/src/common/datetime/relative_time.ts @@ -1,5 +1,5 @@ import memoizeOne from "memoize-one"; -import { FrontendLocaleData } from "../../data/translation"; +import type { FrontendLocaleData } from "../../data/translation"; import { selectUnit } from "../util/select-unit"; const formatRelTimeMem = memoizeOne( diff --git a/src/common/datetime/use_am_pm.ts b/src/common/datetime/use_am_pm.ts index 4510fee522d0..904654789856 100644 --- a/src/common/datetime/use_am_pm.ts +++ b/src/common/datetime/use_am_pm.ts @@ -1,5 +1,6 @@ import memoizeOne from "memoize-one"; -import { FrontendLocaleData, TimeFormat } from "../../data/translation"; +import type { FrontendLocaleData } from "../../data/translation"; +import { TimeFormat } from "../../data/translation"; export const useAmPm = memoizeOne((locale: FrontendLocaleData): boolean => { if ( diff --git a/src/common/decorators/storage.ts b/src/common/decorators/storage.ts index 261a43aa497a..c8e26212c0b9 100644 --- a/src/common/decorators/storage.ts +++ b/src/common/decorators/storage.ts @@ -1,6 +1,6 @@ -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { ReactiveElement } from "lit"; -import { InternalPropertyDeclaration } from "lit/decorators"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { ReactiveElement } from "lit"; +import type { InternalPropertyDeclaration } from "lit/decorators"; import type { ClassElement } from "../../types"; type Callback = (oldValue: any, newValue: any) => void; diff --git a/src/common/decorators/transform.ts b/src/common/decorators/transform.ts index 312dac5bd15b..94e8413aa5b8 100644 --- a/src/common/decorators/transform.ts +++ b/src/common/decorators/transform.ts @@ -1,5 +1,5 @@ -import { PropertyDeclaration, PropertyValues, ReactiveElement } from "lit"; -import { ClassElement } from "../../types"; +import type { PropertyDeclaration, PropertyValues, ReactiveElement } from "lit"; +import type { ClassElement } from "../../types"; import { shallowEqual } from "../util/shallow-equal"; /** diff --git a/src/common/dom/apply_themes_on_element.ts b/src/common/dom/apply_themes_on_element.ts index cf431b6cb8ad..4ae79e0020c3 100644 --- a/src/common/dom/apply_themes_on_element.ts +++ b/src/common/dom/apply_themes_on_element.ts @@ -1,4 +1,4 @@ -import { ThemeVars } from "../../data/ws-themes"; +import type { ThemeVars } from "../../data/ws-themes"; import { darkStyles, derivedStyles } from "../../resources/styles-data"; import type { HomeAssistant } from "../../types"; import { diff --git a/src/common/dom/dynamic-element-directive.ts b/src/common/dom/dynamic-element-directive.ts index a1ffb33ff373..58d9bdc36ef5 100644 --- a/src/common/dom/dynamic-element-directive.ts +++ b/src/common/dom/dynamic-element-directive.ts @@ -1,12 +1,6 @@ import { noChange } from "lit"; -import { - ChildPart, - Directive, - directive, - DirectiveParameters, - PartInfo, - PartType, -} from "lit/directive"; +import type { ChildPart, DirectiveParameters, PartInfo } from "lit/directive"; +import { Directive, directive, PartType } from "lit/directive"; export const dynamicElement = directive( class extends Directive { diff --git a/src/common/dom/setup-leaflet-map.ts b/src/common/dom/setup-leaflet-map.ts index 444e12f47242..21de1f050b78 100644 --- a/src/common/dom/setup-leaflet-map.ts +++ b/src/common/dom/setup-leaflet-map.ts @@ -1,7 +1,9 @@ import type { Map, TileLayer } from "leaflet"; // Sets up a Leaflet map on the provided DOM element +// eslint-disable-next-line @typescript-eslint/consistent-type-imports export type LeafletModuleType = typeof import("leaflet"); +// eslint-disable-next-line @typescript-eslint/consistent-type-imports export type LeafletDrawModuleType = typeof import("leaflet-draw"); export const setupLeafletMap = async ( diff --git a/src/common/entity/attribute_class_names.ts b/src/common/entity/attribute_class_names.ts index 34225bafb658..571a43db5c0a 100644 --- a/src/common/entity/attribute_class_names.ts +++ b/src/common/entity/attribute_class_names.ts @@ -1,4 +1,4 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; export const attributeClassNames = ( stateObj: HassEntity, diff --git a/src/common/entity/battery_icon.ts b/src/common/entity/battery_icon.ts index 75509b5d8b27..2083364eb29b 100644 --- a/src/common/entity/battery_icon.ts +++ b/src/common/entity/battery_icon.ts @@ -1,4 +1,4 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; const BATTERY_ICONS = { 10: "mdi:battery-10", diff --git a/src/common/entity/compute_attribute_display.ts b/src/common/entity/compute_attribute_display.ts index 5e66ae757f9b..c6a43a6d5818 100644 --- a/src/common/entity/compute_attribute_display.ts +++ b/src/common/entity/compute_attribute_display.ts @@ -1,13 +1,14 @@ -import { HassConfig, HassEntity } from "home-assistant-js-websocket"; +import type { HassConfig, HassEntity } from "home-assistant-js-websocket"; import { DOMAIN_ATTRIBUTES_FORMATERS, DOMAIN_ATTRIBUTES_UNITS, TEMPERATURE_ATTRIBUTES, } from "../../data/entity_attributes"; -import { EntityRegistryDisplayEntry } from "../../data/entity_registry"; -import { FrontendLocaleData } from "../../data/translation"; -import { WeatherEntity, getWeatherUnit } from "../../data/weather"; -import { HomeAssistant } from "../../types"; +import type { EntityRegistryDisplayEntry } from "../../data/entity_registry"; +import type { FrontendLocaleData } from "../../data/translation"; +import type { WeatherEntity } from "../../data/weather"; +import { getWeatherUnit } from "../../data/weather"; +import type { HomeAssistant } from "../../types"; import checkValidDate from "../datetime/check_valid_date"; import { formatDate } from "../datetime/format_date"; import { formatDateTimeWithSeconds } from "../datetime/format_date_time"; @@ -16,7 +17,7 @@ import { capitalizeFirstLetter } from "../string/capitalize-first-letter"; import { isDate } from "../string/is_date"; import { isTimestamp } from "../string/is_timestamp"; import { blankBeforeUnit } from "../translations/blank_before_unit"; -import { LocalizeFunc } from "../translations/localize"; +import type { LocalizeFunc } from "../translations/localize"; import { computeDomain } from "./compute_domain"; import { computeStateDomain } from "./compute_state_domain"; diff --git a/src/common/entity/compute_state_display.ts b/src/common/entity/compute_state_display.ts index 3eac20c40195..badeea813791 100644 --- a/src/common/entity/compute_state_display.ts +++ b/src/common/entity/compute_state_display.ts @@ -1,8 +1,9 @@ -import { HassConfig, HassEntity } from "home-assistant-js-websocket"; +import type { HassConfig, HassEntity } from "home-assistant-js-websocket"; import { UNAVAILABLE, UNKNOWN } from "../../data/entity"; -import { EntityRegistryDisplayEntry } from "../../data/entity_registry"; -import { FrontendLocaleData, TimeZone } from "../../data/translation"; -import { HomeAssistant } from "../../types"; +import type { EntityRegistryDisplayEntry } from "../../data/entity_registry"; +import type { FrontendLocaleData } from "../../data/translation"; +import { TimeZone } from "../../data/translation"; +import type { HomeAssistant } from "../../types"; import { UNIT_TO_MILLISECOND_CONVERT, formatDuration, @@ -16,7 +17,7 @@ import { isNumericFromAttributes, } from "../number/format_number"; import { blankBeforeUnit } from "../translations/blank_before_unit"; -import { LocalizeFunc } from "../translations/localize"; +import type { LocalizeFunc } from "../translations/localize"; import { computeDomain } from "./compute_domain"; export const computeStateDisplay = ( diff --git a/src/common/entity/compute_state_name.ts b/src/common/entity/compute_state_name.ts index dc599caa0aaa..9fbe2713a2b1 100644 --- a/src/common/entity/compute_state_name.ts +++ b/src/common/entity/compute_state_name.ts @@ -1,4 +1,4 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { computeObjectId } from "./compute_object_id"; export const computeStateNameFromEntityAttributes = ( diff --git a/src/common/entity/cover_icon.ts b/src/common/entity/cover_icon.ts index 53a30db752ca..facc7688ed4b 100644 --- a/src/common/entity/cover_icon.ts +++ b/src/common/entity/cover_icon.ts @@ -5,7 +5,7 @@ import { mdiArrowExpandHorizontal, mdiArrowUp, } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; export const computeOpenIcon = (stateObj: HassEntity): string => { switch (stateObj.attributes.device_class) { diff --git a/src/common/entity/device_tracker_icon.ts b/src/common/entity/device_tracker_icon.ts index 02789242391f..2feb21580c42 100644 --- a/src/common/entity/device_tracker_icon.ts +++ b/src/common/entity/device_tracker_icon.ts @@ -1,4 +1,4 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; export const deviceTrackerIcon = (stateObj: HassEntity, state?: string) => { const compareState = state ?? stateObj.state; diff --git a/src/common/entity/extract_views.ts b/src/common/entity/extract_views.ts index e0ed98cb2519..9c23130f33a3 100644 --- a/src/common/entity/extract_views.ts +++ b/src/common/entity/extract_views.ts @@ -1,4 +1,4 @@ -import { HassEntities } from "home-assistant-js-websocket"; +import type { HassEntities } from "home-assistant-js-websocket"; import type { GroupEntity } from "../../data/group"; import { DEFAULT_VIEW_ENTITY_ID } from "../const"; diff --git a/src/common/entity/feature_class_names.ts b/src/common/entity/feature_class_names.ts index 7898e9d8726f..4398a467fcba 100644 --- a/src/common/entity/feature_class_names.ts +++ b/src/common/entity/feature_class_names.ts @@ -1,4 +1,4 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { supportsFeature } from "./supports-feature"; export type FeatureClassNames = Partial< diff --git a/src/common/entity/get_group_entities.ts b/src/common/entity/get_group_entities.ts index 10334146e008..4996f4aafa91 100644 --- a/src/common/entity/get_group_entities.ts +++ b/src/common/entity/get_group_entities.ts @@ -1,5 +1,5 @@ -import { HassEntities } from "home-assistant-js-websocket"; -import { GroupEntity } from "../../data/group"; +import type { HassEntities } from "home-assistant-js-websocket"; +import type { GroupEntity } from "../../data/group"; export const getGroupEntities = ( entities: HassEntities, diff --git a/src/common/entity/get_states.ts b/src/common/entity/get_states.ts index 59e1355c873a..dae16401e9bc 100644 --- a/src/common/entity/get_states.ts +++ b/src/common/entity/get_states.ts @@ -1,4 +1,4 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { computeStateDomain } from "./compute_state_domain"; import { UNAVAILABLE_STATES } from "../../data/entity"; diff --git a/src/common/entity/get_view_entities.ts b/src/common/entity/get_view_entities.ts index 4b28e48e9ed9..91c556b7a80f 100644 --- a/src/common/entity/get_view_entities.ts +++ b/src/common/entity/get_view_entities.ts @@ -1,5 +1,5 @@ -import { HassEntities } from "home-assistant-js-websocket"; -import { GroupEntity } from "../../data/group"; +import type { HassEntities } from "home-assistant-js-websocket"; +import type { GroupEntity } from "../../data/group"; import { computeDomain } from "./compute_domain"; import { getGroupEntities } from "./get_group_entities"; diff --git a/src/common/entity/has_location.ts b/src/common/entity/has_location.ts index a8da14236aba..8ae746273ab5 100644 --- a/src/common/entity/has_location.ts +++ b/src/common/entity/has_location.ts @@ -1,4 +1,4 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; export const hasLocation = (stateObj: HassEntity) => "latitude" in stateObj.attributes && "longitude" in stateObj.attributes; diff --git a/src/common/entity/split_by_groups.ts b/src/common/entity/split_by_groups.ts index c7af4bdbd93f..d884916bf52b 100644 --- a/src/common/entity/split_by_groups.ts +++ b/src/common/entity/split_by_groups.ts @@ -1,5 +1,5 @@ -import { HassEntities } from "home-assistant-js-websocket"; -import { GroupEntity } from "../../data/group"; +import type { HassEntities } from "home-assistant-js-websocket"; +import type { GroupEntity } from "../../data/group"; import { computeDomain } from "./compute_domain"; // Split a collection into a list of groups and a 'rest' list of ungrouped diff --git a/src/common/entity/state_active.ts b/src/common/entity/state_active.ts index 16ca41c9c19f..4f4c928fac19 100644 --- a/src/common/entity/state_active.ts +++ b/src/common/entity/state_active.ts @@ -1,4 +1,4 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { isUnavailableState, OFF, UNAVAILABLE } from "../../data/entity"; import { computeDomain } from "./compute_domain"; diff --git a/src/common/entity/state_card_type.ts b/src/common/entity/state_card_type.ts index a1f2aa561e2d..df6a17b1d9da 100644 --- a/src/common/entity/state_card_type.ts +++ b/src/common/entity/state_card_type.ts @@ -1,6 +1,6 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { UNAVAILABLE } from "../../data/entity"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import { DOMAINS_WITH_CARD } from "../const"; import { canToggleState } from "./can_toggle_state"; import { computeStateDomain } from "./compute_state_domain"; diff --git a/src/common/entity/state_color.ts b/src/common/entity/state_color.ts index 09145eed83c7..e64d2612c8ee 100644 --- a/src/common/entity/state_color.ts +++ b/src/common/entity/state_color.ts @@ -1,7 +1,8 @@ /** Return an color representing a state. */ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { UNAVAILABLE } from "../../data/entity"; -import { computeGroupDomain, GroupEntity } from "../../data/group"; +import type { GroupEntity } from "../../data/group"; +import { computeGroupDomain } from "../../data/group"; import { computeCssVariable } from "../../resources/css-variables"; import { slugify } from "../string/slugify"; import { batteryStateColorProperty } from "./color/battery_color"; diff --git a/src/common/entity/state_icon.ts b/src/common/entity/state_icon.ts index b26f4e3267d7..58a63e881e66 100644 --- a/src/common/entity/state_icon.ts +++ b/src/common/entity/state_icon.ts @@ -1,4 +1,4 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { computeStateDomain } from "./compute_state_domain"; import { updateIcon } from "./update_icon"; import { deviceTrackerIcon } from "./device_tracker_icon"; diff --git a/src/common/entity/states_sort_by_name.ts b/src/common/entity/states_sort_by_name.ts index bb04b4a7b8d1..06701a8c0c55 100644 --- a/src/common/entity/states_sort_by_name.ts +++ b/src/common/entity/states_sort_by_name.ts @@ -5,7 +5,7 @@ * const states = [state1, state2] * states.sort(statessortStatesByName); */ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { computeStateName } from "./compute_state_name"; export const sortStatesByName = (entityA: HassEntity, entityB: HassEntity) => { diff --git a/src/common/entity/supports-feature.ts b/src/common/entity/supports-feature.ts index 18bf3cd891ce..c34062926700 100644 --- a/src/common/entity/supports-feature.ts +++ b/src/common/entity/supports-feature.ts @@ -1,4 +1,4 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; export const supportsFeature = ( stateObj: HassEntity, diff --git a/src/common/entity/update_icon.ts b/src/common/entity/update_icon.ts index 4e1915d7fcad..4c8010166721 100644 --- a/src/common/entity/update_icon.ts +++ b/src/common/entity/update_icon.ts @@ -1,5 +1,6 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { UpdateEntity, updateIsInstalling } from "../../data/update"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { UpdateEntity } from "../../data/update"; +import { updateIsInstalling } from "../../data/update"; export const updateIcon = (stateObj: HassEntity, state?: string) => { const compareState = state ?? stateObj.state; diff --git a/src/common/language/format_language.ts b/src/common/language/format_language.ts index 7230d0991f1e..e91e5990b78f 100644 --- a/src/common/language/format_language.ts +++ b/src/common/language/format_language.ts @@ -1,5 +1,5 @@ import memoizeOne from "memoize-one"; -import { FrontendLocaleData } from "../../data/translation"; +import type { FrontendLocaleData } from "../../data/translation"; export const formatLanguageCode = ( languageCode: string, diff --git a/src/common/mwc/handle-request-selected-event.ts b/src/common/mwc/handle-request-selected-event.ts index 239f53e5c3ca..0c48879acbdf 100644 --- a/src/common/mwc/handle-request-selected-event.ts +++ b/src/common/mwc/handle-request-selected-event.ts @@ -1,4 +1,4 @@ -import { +import type { ListItem, RequestSelectedDetail, } from "@material/mwc-list/mwc-list-item"; diff --git a/src/common/number/format_number.ts b/src/common/number/format_number.ts index b97c4b71fd70..706d89eec591 100644 --- a/src/common/number/format_number.ts +++ b/src/common/number/format_number.ts @@ -1,9 +1,10 @@ -import { +import type { HassEntity, HassEntityAttributeBase, } from "home-assistant-js-websocket"; -import { EntityRegistryDisplayEntry } from "../../data/entity_registry"; -import { FrontendLocaleData, NumberFormat } from "../../data/translation"; +import type { EntityRegistryDisplayEntry } from "../../data/entity_registry"; +import type { FrontendLocaleData } from "../../data/translation"; +import { NumberFormat } from "../../data/translation"; import { round } from "./round"; /** diff --git a/src/common/string/format-list.ts b/src/common/string/format-list.ts index 952ffca9349e..7b420a26fa4e 100644 --- a/src/common/string/format-list.ts +++ b/src/common/string/format-list.ts @@ -1,5 +1,5 @@ import memoizeOne from "memoize-one"; -import { FrontendLocaleData } from "../../data/translation"; +import type { FrontendLocaleData } from "../../data/translation"; export const formatListWithAnds = ( locale: FrontendLocaleData, diff --git a/src/common/translations/blank_before_percent.ts b/src/common/translations/blank_before_percent.ts index 4c489c96c82f..9ef5afc8c7d3 100644 --- a/src/common/translations/blank_before_percent.ts +++ b/src/common/translations/blank_before_percent.ts @@ -1,4 +1,4 @@ -import { FrontendLocaleData } from "../../data/translation"; +import type { FrontendLocaleData } from "../../data/translation"; // Logic based on https://en.wikipedia.org/wiki/Percent_sign#Form_and_spacing export const blankBeforePercent = ( diff --git a/src/common/translations/blank_before_unit.ts b/src/common/translations/blank_before_unit.ts index 32a430430a6e..94fc381a6da7 100644 --- a/src/common/translations/blank_before_unit.ts +++ b/src/common/translations/blank_before_unit.ts @@ -1,4 +1,4 @@ -import { FrontendLocaleData } from "../../data/translation"; +import type { FrontendLocaleData } from "../../data/translation"; import { blankBeforePercent } from "./blank_before_percent"; export const blankBeforeUnit = ( diff --git a/src/common/translations/day_names.ts b/src/common/translations/day_names.ts index 885cd8402928..2dae22823a93 100644 --- a/src/common/translations/day_names.ts +++ b/src/common/translations/day_names.ts @@ -1,7 +1,7 @@ import { addDays, startOfWeek } from "date-fns"; -import { HassConfig } from "home-assistant-js-websocket"; +import type { HassConfig } from "home-assistant-js-websocket"; import memoizeOne from "memoize-one"; -import { FrontendLocaleData } from "../../data/translation"; +import type { FrontendLocaleData } from "../../data/translation"; import { formatDateWeekday } from "../datetime/format_date"; export const dayNames = memoizeOne( diff --git a/src/common/translations/localize.ts b/src/common/translations/localize.ts index ebbdc97e7b9e..49d813c7a054 100644 --- a/src/common/translations/localize.ts +++ b/src/common/translations/localize.ts @@ -1,7 +1,7 @@ import type { IntlMessageFormat } from "intl-messageformat"; import type { HTMLTemplateResult } from "lit"; import { polyfillLocaleData } from "../../resources/polyfills/locale-data-polyfill"; -import { Resources, TranslationDict } from "../../types"; +import type { Resources, TranslationDict } from "../../types"; import { fireEvent } from "../dom/fire_event"; // Exclude some patterns from key type checking for now diff --git a/src/common/translations/month_names.ts b/src/common/translations/month_names.ts index 4df4236d2839..0121a6d9a672 100644 --- a/src/common/translations/month_names.ts +++ b/src/common/translations/month_names.ts @@ -1,7 +1,7 @@ import { addMonths, startOfYear } from "date-fns"; -import { HassConfig } from "home-assistant-js-websocket"; +import type { HassConfig } from "home-assistant-js-websocket"; import memoizeOne from "memoize-one"; -import { FrontendLocaleData } from "../../data/translation"; +import type { FrontendLocaleData } from "../../data/translation"; import { formatDateMonth } from "../datetime/format_date"; export const monthNames = memoizeOne( diff --git a/src/common/util/array-move.ts b/src/common/util/array-move.ts deleted file mode 100644 index 33ce6bb8e016..000000000000 --- a/src/common/util/array-move.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { ItemPath } from "../../types"; - -function findNestedItem( - obj: any, - path: ItemPath, - createNonExistingPath?: boolean -): any { - return path.reduce((ac, p, index, array) => { - if (ac === undefined) return undefined; - if (!ac[p] && createNonExistingPath) { - const nextP = array[index + 1]; - // Create object or array depending on next path - if (nextP === undefined || typeof nextP === "number") { - ac[p] = []; - } else { - ac[p] = {}; - } - } - return ac[p]; - }, obj); -} - -function updateNestedItem(obj: any, path: ItemPath): any { - const lastKey = path.pop()!; - const parent = findNestedItem(obj, path); - parent[lastKey] = Array.isArray(parent[lastKey]) - ? [...parent[lastKey]] - : [parent[lastKey]]; - return obj; -} - -export function nestedArrayMove( - obj: A, - oldIndex: number, - newIndex: number, - oldPath?: ItemPath, - newPath?: ItemPath -): A { - let newObj = (Array.isArray(obj) ? [...obj] : { ...obj }) as A; - - if (oldPath) { - newObj = updateNestedItem(newObj, [...oldPath]); - } - if (newPath) { - newObj = updateNestedItem(newObj, [...newPath]); - } - - const from = oldPath ? findNestedItem(newObj, oldPath) : newObj; - const to = newPath ? findNestedItem(newObj, newPath, true) : newObj; - - const item = from.splice(oldIndex, 1)[0]; - to.splice(newIndex, 0, item); - - return newObj; -} - -export function arrayMove( - array: T[], - oldIndex: number, - newIndex: number -): T[] { - const newArray = [...array]; - const [item] = newArray.splice(oldIndex, 1); - newArray.splice(newIndex, 0, item); - return newArray; -} diff --git a/src/common/util/compute_rtl.ts b/src/common/util/compute_rtl.ts index b0b8b20cf555..b5bebfbc7db8 100644 --- a/src/common/util/compute_rtl.ts +++ b/src/common/util/compute_rtl.ts @@ -1,5 +1,5 @@ -import { LitElement } from "lit"; -import { HomeAssistant } from "../../types"; +import type { LitElement } from "lit"; +import type { HomeAssistant } from "../../types"; export function computeRTL(hass: HomeAssistant) { const lang = hass.language || "en"; diff --git a/src/common/util/select-unit.ts b/src/common/util/select-unit.ts index 8e49c463d4fb..48d18c70fb7b 100644 --- a/src/common/util/select-unit.ts +++ b/src/common/util/select-unit.ts @@ -1,5 +1,5 @@ import { differenceInDays, differenceInWeeks, startOfWeek } from "date-fns"; -import { FrontendLocaleData } from "../../data/translation"; +import type { FrontendLocaleData } from "../../data/translation"; import { firstWeekdayIndex } from "../datetime/first_weekday"; export type Unit = diff --git a/src/common/util/subscribe-one.ts b/src/common/util/subscribe-one.ts index 51bfa1081df8..afef348d9f1d 100644 --- a/src/common/util/subscribe-one.ts +++ b/src/common/util/subscribe-one.ts @@ -1,4 +1,4 @@ -import { Connection, UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { Connection, UnsubscribeFunc } from "home-assistant-js-websocket"; export const subscribeOne = async ( conn: Connection, diff --git a/src/common/util/subscribe-polling.ts b/src/common/util/subscribe-polling.ts index e4770be8ece1..f1b00068f871 100644 --- a/src/common/util/subscribe-polling.ts +++ b/src/common/util/subscribe-polling.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; export const subscribePollingCollection = ( hass: HomeAssistant, diff --git a/src/common/util/time-cache-entity-promise-func.ts b/src/common/util/time-cache-entity-promise-func.ts index 0b3cc5a29343..053b2f9b0e1a 100644 --- a/src/common/util/time-cache-entity-promise-func.ts +++ b/src/common/util/time-cache-entity-promise-func.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; interface ResultCache { [entityId: string]: Promise | undefined; diff --git a/src/common/util/time-cache-function-promise.ts b/src/common/util/time-cache-function-promise.ts index daa4b730b545..f0386acf976d 100644 --- a/src/common/util/time-cache-function-promise.ts +++ b/src/common/util/time-cache-function-promise.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; interface CacheResult { result: T; diff --git a/src/components/buttons/ha-call-service-button.ts b/src/components/buttons/ha-call-service-button.ts index 3fc835e14a38..b90e35b6b92d 100644 --- a/src/components/buttons/ha-call-service-button.ts +++ b/src/components/buttons/ha-call-service-button.ts @@ -1,9 +1,10 @@ -import { LitElement, TemplateResult, html } from "lit"; +import type { TemplateResult } from "lit"; +import { LitElement, html } from "lit"; import { customElement, property } from "lit/decorators"; -import { HassServiceTarget } from "home-assistant-js-websocket"; +import type { HassServiceTarget } from "home-assistant-js-websocket"; import { showConfirmationDialog } from "../../dialogs/generic/show-dialog-box"; import "./ha-progress-button"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import { fireEvent } from "../../common/dom/fire_event"; @customElement("ha-call-service-button") diff --git a/src/components/buttons/ha-progress-button.ts b/src/components/buttons/ha-progress-button.ts index b37bfa9ae7a5..357eec1cf95f 100644 --- a/src/components/buttons/ha-progress-button.ts +++ b/src/components/buttons/ha-progress-button.ts @@ -1,13 +1,7 @@ import "@material/mwc-button"; import { mdiAlertOctagram, mdiCheckBold } from "@mdi/js"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../ha-circular-progress"; import "../ha-svg-icon"; diff --git a/src/components/chart/ha-chart-base.ts b/src/components/chart/ha-chart-base.ts index 6f8ec22da3b9..049f4b6091ed 100644 --- a/src/components/chart/ha-chart-base.ts +++ b/src/components/chart/ha-chart-base.ts @@ -5,20 +5,14 @@ import type { ChartOptions, TooltipModel, } from "chart.js"; -import { - css, - CSSResultGroup, - html, - nothing, - LitElement, - PropertyValues, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, nothing, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { styleMap } from "lit/directives/style-map"; import { fireEvent } from "../../common/dom/fire_event"; import { clamp } from "../../common/number/clamp"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import { debounce } from "../../common/util/debounce"; export const MIN_TIME_BETWEEN_UPDATES = 60 * 5 * 1000; diff --git a/src/components/chart/state-history-chart-line.ts b/src/components/chart/state-history-chart-line.ts index 1a72d69ac35a..d244f91a0e6b 100644 --- a/src/components/chart/state-history-chart-line.ts +++ b/src/components/chart/state-history-chart-line.ts @@ -1,5 +1,6 @@ import type { ChartData, ChartDataset, ChartOptions } from "chart.js"; -import { html, LitElement, PropertyValues } from "lit"; +import type { PropertyValues } from "lit"; +import { html, LitElement } from "lit"; import { property, query, state } from "lit/decorators"; import { getGraphColorByIndex } from "../../common/color/colors"; import { fireEvent } from "../../common/dom/fire_event"; @@ -9,13 +10,10 @@ import { numberFormatToLocale, getNumberFormatOptions, } from "../../common/number/format_number"; -import { LineChartEntity, LineChartState } from "../../data/history"; -import { HomeAssistant } from "../../types"; -import { - ChartResizeOptions, - HaChartBase, - MIN_TIME_BETWEEN_UPDATES, -} from "./ha-chart-base"; +import type { LineChartEntity, LineChartState } from "../../data/history"; +import type { HomeAssistant } from "../../types"; +import type { ChartResizeOptions, HaChartBase } from "./ha-chart-base"; +import { MIN_TIME_BETWEEN_UPDATES } from "./ha-chart-base"; import { clickIsTouch } from "./click_is_touch"; const safeParseFloat = (value) => { diff --git a/src/components/chart/state-history-chart-timeline.ts b/src/components/chart/state-history-chart-timeline.ts index 6d7e6178a6dc..2cdb9c6b3c5e 100644 --- a/src/components/chart/state-history-chart-timeline.ts +++ b/src/components/chart/state-history-chart-timeline.ts @@ -1,19 +1,17 @@ import type { ChartData, ChartDataset, ChartOptions } from "chart.js"; import { getRelativePosition } from "chart.js/helpers"; -import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { formatDateTimeWithSeconds } from "../../common/datetime/format_date_time"; import millisecondsToDuration from "../../common/datetime/milliseconds_to_duration"; import { fireEvent } from "../../common/dom/fire_event"; import { numberFormatToLocale } from "../../common/number/format_number"; import { computeRTL } from "../../common/util/compute_rtl"; -import { TimelineEntity } from "../../data/history"; -import { HomeAssistant } from "../../types"; -import { - ChartResizeOptions, - HaChartBase, - MIN_TIME_BETWEEN_UPDATES, -} from "./ha-chart-base"; +import type { TimelineEntity } from "../../data/history"; +import type { HomeAssistant } from "../../types"; +import type { ChartResizeOptions, HaChartBase } from "./ha-chart-base"; +import { MIN_TIME_BETWEEN_UPDATES } from "./ha-chart-base"; import type { TimeLineData } from "./timeline-chart/const"; import { computeTimelineColor } from "./timeline-chart/timeline-color"; import { clickIsTouch } from "./click_is_touch"; diff --git a/src/components/chart/state-history-charts.ts b/src/components/chart/state-history-charts.ts index eb47c5b31a74..5920964dedb6 100644 --- a/src/components/chart/state-history-charts.ts +++ b/src/components/chart/state-history-charts.ts @@ -1,11 +1,5 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, eventOptions, @@ -15,7 +9,7 @@ import { } from "lit/decorators"; import { isComponentLoaded } from "../../common/config/is_component_loaded"; import { restoreScroll } from "../../common/decorators/restore-scroll"; -import { +import type { HistoryResult, LineChartUnit, TimelineEntity, @@ -26,7 +20,7 @@ import "./state-history-chart-line"; import "./state-history-chart-timeline"; import type { StateHistoryChartLine } from "./state-history-chart-line"; import type { StateHistoryChartTimeline } from "./state-history-chart-timeline"; -import { ChartResizeOptions } from "./ha-chart-base"; +import type { ChartResizeOptions } from "./ha-chart-base"; const CANVAS_TIMELINE_ROWS_CHUNK = 10; // Split up the canvases to avoid hitting the render limit diff --git a/src/components/chart/statistics-chart.ts b/src/components/chart/statistics-chart.ts index 959d32e36dc5..154f04e7d870 100644 --- a/src/components/chart/statistics-chart.ts +++ b/src/components/chart/statistics-chart.ts @@ -4,14 +4,8 @@ import type { ChartOptions, ChartType, } from "chart.js"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state, query } from "lit/decorators"; import memoizeOne from "memoize-one"; import { getGraphColorByIndex } from "../../common/color/colors"; @@ -22,15 +16,17 @@ import { numberFormatToLocale, getNumberFormatOptions, } from "../../common/number/format_number"; +import type { + Statistics, + StatisticsMetaData, + StatisticType, +} from "../../data/recorder"; import { getDisplayUnit, getStatisticLabel, getStatisticMetadata, isExternalStatistic, - Statistics, statisticsHaveType, - StatisticsMetaData, - StatisticType, } from "../../data/recorder"; import type { HomeAssistant } from "../../types"; import "./ha-chart-base"; diff --git a/src/components/chart/timeline-chart/textbar-element.ts b/src/components/chart/timeline-chart/textbar-element.ts index a9a26b1b4076..2750869f5670 100644 --- a/src/components/chart/timeline-chart/textbar-element.ts +++ b/src/components/chart/timeline-chart/textbar-element.ts @@ -1,4 +1,5 @@ -import { BarElement, BarOptions, BarProps } from "chart.js"; +import type { BarOptions, BarProps } from "chart.js"; +import { BarElement } from "chart.js"; import { hex2rgb } from "../../../common/color/convert-color"; import { luminosity } from "../../../common/color/rgb"; diff --git a/src/components/chart/timeline-chart/timeline-color.ts b/src/components/chart/timeline-chart/timeline-color.ts index 3a08adea4d15..897c8ac96f04 100644 --- a/src/components/chart/timeline-chart/timeline-color.ts +++ b/src/components/chart/timeline-chart/timeline-color.ts @@ -1,4 +1,4 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { getGraphColorByIndex } from "../../../common/color/colors"; import { hex2rgb, lab2hex, rgb2lab } from "../../../common/color/convert-color"; import { labBrighten } from "../../../common/color/lab"; diff --git a/src/components/chart/timeline-chart/timeline-controller.ts b/src/components/chart/timeline-chart/timeline-controller.ts index b6b1d88af31c..18bfd5887642 100644 --- a/src/components/chart/timeline-chart/timeline-controller.ts +++ b/src/components/chart/timeline-chart/timeline-controller.ts @@ -1,6 +1,7 @@ -import { BarController, BarElement } from "chart.js"; -import { TimeLineData } from "./const"; -import { TextBarProps } from "./textbar-element"; +import type { BarElement } from "chart.js"; +import { BarController } from "chart.js"; +import type { TimeLineData } from "./const"; +import type { TextBarProps } from "./textbar-element"; function borderProps(properties) { let reverse; diff --git a/src/components/chart/timeline-chart/timeline-scale.ts b/src/components/chart/timeline-chart/timeline-scale.ts index e987456f8e31..9c41609bbf58 100644 --- a/src/components/chart/timeline-chart/timeline-scale.ts +++ b/src/components/chart/timeline-chart/timeline-scale.ts @@ -1,5 +1,5 @@ import { TimeScale } from "chart.js"; -import { TimeLineData } from "./const"; +import type { TimeLineData } from "./const"; export class TimeLineScale extends TimeScale { static id = "timeline"; diff --git a/src/components/data-table/dialog-data-table-settings.ts b/src/components/data-table/dialog-data-table-settings.ts index ef751acc4a6c..d47b2abc2ace 100644 --- a/src/components/data-table/dialog-data-table-settings.ts +++ b/src/components/data-table/dialog-data-table-settings.ts @@ -1,18 +1,22 @@ import "@material/mwc-list"; import { mdiDrag, mdiEye, mdiEyeOff } from "@mdi/js"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { repeat } from "lit/directives/repeat"; import memoizeOne from "memoize-one"; import { haStyleDialog } from "../../resources/styles"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import { createCloseHeading } from "../ha-dialog"; import "../ha-list-item"; import "../ha-sortable"; import "../ha-button"; -import { DataTableColumnContainer, DataTableColumnData } from "./ha-data-table"; -import { DataTableSettingsDialogParams } from "./show-dialog-data-table-settings"; +import type { + DataTableColumnContainer, + DataTableColumnData, +} from "./ha-data-table"; +import type { DataTableSettingsDialogParams } from "./show-dialog-data-table-settings"; import { fireEvent } from "../../common/dom/fire_event"; @customElement("dialog-data-table-settings") diff --git a/src/components/data-table/ha-data-table-icon.ts b/src/components/data-table/ha-data-table-icon.ts index 8724b41fbbc4..0b9757e0e7f0 100644 --- a/src/components/data-table/ha-data-table-icon.ts +++ b/src/components/data-table/ha-data-table-icon.ts @@ -1,4 +1,5 @@ -import { css, html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../ha-svg-icon"; diff --git a/src/components/data-table/ha-data-table-labels.ts b/src/components/data-table/ha-data-table-labels.ts index e87ac80ea241..31dc5be18535 100644 --- a/src/components/data-table/ha-data-table-labels.ts +++ b/src/components/data-table/ha-data-table-labels.ts @@ -1,11 +1,16 @@ -import { css, html, LitElement, nothing, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { repeat } from "lit/directives/repeat"; -import { LabelRegistryEntry } from "../../data/label_registry"; +import type { LabelRegistryEntry } from "../../data/label_registry"; import { computeCssColor } from "../../common/color/compute-color"; import { fireEvent } from "../../common/dom/fire_event"; import "../ha-label"; import { stringCompare } from "../../common/string/compare"; +import "../chips/ha-chip-set"; +import "../ha-button-menu"; +import "../ha-icon"; +import "../ha-list-item"; @customElement("ha-data-table-labels") class HaDataTableLabels extends LitElement { diff --git a/src/components/data-table/ha-data-table.ts b/src/components/data-table/ha-data-table.ts index 453d8707e6fa..f698f4f3ec9a 100644 --- a/src/components/data-table/ha-data-table.ts +++ b/src/components/data-table/ha-data-table.ts @@ -1,14 +1,7 @@ import { mdiArrowDown, mdiArrowUp, mdiChevronUp } from "@mdi/js"; import deepClone from "deep-clone-simple"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, eventOptions, @@ -27,13 +20,13 @@ import { debounce } from "../../common/util/debounce"; import { groupBy } from "../../common/util/group-by"; import { haStyleScrollbar } from "../../resources/styles"; import { loadVirtualizer } from "../../resources/virtualizer"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import "../ha-checkbox"; import type { HaCheckbox } from "../ha-checkbox"; import "../ha-svg-icon"; import "../search-input"; import { filterData, sortData } from "./sort-filter"; -import { LocalizeFunc } from "../../common/translations/localize"; +import type { LocalizeFunc } from "../../common/translations/localize"; import { nextRender } from "../../common/util/render-status"; export interface RowClickedEvent { diff --git a/src/components/data-table/show-dialog-data-table-settings.ts b/src/components/data-table/show-dialog-data-table-settings.ts index 954dd871bb26..d4fc995a08d7 100644 --- a/src/components/data-table/show-dialog-data-table-settings.ts +++ b/src/components/data-table/show-dialog-data-table-settings.ts @@ -1,6 +1,6 @@ import { fireEvent } from "../../common/dom/fire_event"; -import { LocalizeFunc } from "../../common/translations/localize"; -import { DataTableColumnContainer } from "./ha-data-table"; +import type { LocalizeFunc } from "../../common/translations/localize"; +import type { DataTableColumnContainer } from "./ha-data-table"; export interface DataTableSettingsDialogParams { columns: DataTableColumnContainer; diff --git a/src/components/data-table/sort-filter.ts b/src/components/data-table/sort-filter.ts index b6d531066545..0fbcba56faea 100644 --- a/src/components/data-table/sort-filter.ts +++ b/src/components/data-table/sort-filter.ts @@ -1,4 +1,5 @@ -import { Remote, wrap } from "comlink"; +import type { Remote } from "comlink"; +import { wrap } from "comlink"; import type { Api } from "./sort-filter-worker"; type FilterDataType = Api["filterData"]; diff --git a/src/components/device/ha-device-action-picker.ts b/src/components/device/ha-device-action-picker.ts index 3dbeae27a65e..7e6dea1acb77 100644 --- a/src/components/device/ha-device-action-picker.ts +++ b/src/components/device/ha-device-action-picker.ts @@ -1,6 +1,6 @@ import { customElement } from "lit/decorators"; +import type { DeviceAction } from "../../data/device_automation"; import { - DeviceAction, fetchDeviceActions, localizeDeviceAutomationAction, } from "../../data/device_automation"; diff --git a/src/components/device/ha-device-automation-picker.ts b/src/components/device/ha-device-automation-picker.ts index c430e20134df..eefd710e5cc6 100644 --- a/src/components/device/ha-device-automation-picker.ts +++ b/src/components/device/ha-device-automation-picker.ts @@ -1,16 +1,17 @@ import { consume } from "@lit-labs/context"; import "@material/mwc-list/mwc-list-item"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { property, state } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import { fullEntitiesContext } from "../../data/context"; +import type { DeviceAutomation } from "../../data/device_automation"; import { - DeviceAutomation, deviceAutomationsEqual, sortDeviceAutomations, } from "../../data/device_automation"; -import { EntityRegistryEntry } from "../../data/entity_registry"; -import { HomeAssistant } from "../../types"; +import type { EntityRegistryEntry } from "../../data/entity_registry"; +import type { HomeAssistant } from "../../types"; import "../ha-select"; const NO_AUTOMATION_KEY = "NO_AUTOMATION"; diff --git a/src/components/device/ha-device-condition-picker.ts b/src/components/device/ha-device-condition-picker.ts index f6ca89d0124f..af59d0a4c6fc 100644 --- a/src/components/device/ha-device-condition-picker.ts +++ b/src/components/device/ha-device-condition-picker.ts @@ -1,6 +1,6 @@ import { customElement } from "lit/decorators"; +import type { DeviceCondition } from "../../data/device_automation"; import { - DeviceCondition, fetchDeviceConditions, localizeDeviceAutomationCondition, } from "../../data/device_automation"; diff --git a/src/components/device/ha-device-picker.ts b/src/components/device/ha-device-picker.ts index cfcd2e2d7092..724dcbbf0683 100644 --- a/src/components/device/ha-device-picker.ts +++ b/src/components/device/ha-device-picker.ts @@ -1,23 +1,24 @@ -import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; -import { HassEntity } from "home-assistant-js-websocket"; -import { LitElement, PropertyValues, TemplateResult, html } from "lit"; +import type { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues, TemplateResult } from "lit"; +import { LitElement, html } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../common/dom/fire_event"; import { computeDomain } from "../../common/entity/compute_domain"; import { stringCompare } from "../../common/string/compare"; -import { - ScorableTextItem, - fuzzyFilterSort, -} from "../../common/string/filter/sequence-matching"; -import { +import type { ScorableTextItem } from "../../common/string/filter/sequence-matching"; +import { fuzzyFilterSort } from "../../common/string/filter/sequence-matching"; +import type { DeviceEntityDisplayLookup, DeviceRegistryEntry, +} from "../../data/device_registry"; +import { computeDeviceName, getDeviceEntityDisplayLookup, } from "../../data/device_registry"; -import { EntityRegistryDisplayEntry } from "../../data/entity_registry"; -import { HomeAssistant, ValueChangedEvent } from "../../types"; +import type { EntityRegistryDisplayEntry } from "../../data/entity_registry"; +import type { HomeAssistant, ValueChangedEvent } from "../../types"; import "../ha-combo-box"; import type { HaComboBox } from "../ha-combo-box"; import "../ha-list-item"; diff --git a/src/components/device/ha-device-trigger-picker.ts b/src/components/device/ha-device-trigger-picker.ts index 9d3f41fdf869..a57ab1c8fc25 100644 --- a/src/components/device/ha-device-trigger-picker.ts +++ b/src/components/device/ha-device-trigger-picker.ts @@ -1,6 +1,6 @@ import { customElement } from "lit/decorators"; +import type { DeviceTrigger } from "../../data/device_automation"; import { - DeviceTrigger, fetchDeviceTriggers, localizeDeviceAutomationTrigger, } from "../../data/device_automation"; diff --git a/src/components/device/ha-devices-picker.ts b/src/components/device/ha-devices-picker.ts index 1133d0f5e3db..8c6a2fb57037 100644 --- a/src/components/device/ha-devices-picker.ts +++ b/src/components/device/ha-devices-picker.ts @@ -1,7 +1,7 @@ import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; -import { ValueChangedEvent, HomeAssistant } from "../../types"; +import type { ValueChangedEvent, HomeAssistant } from "../../types"; import "./ha-device-picker"; import type { HaDevicePickerDeviceFilterFunc, diff --git a/src/components/entity/ha-battery-icon.ts b/src/components/entity/ha-battery-icon.ts index 41f6a464f507..e0f40d9068a4 100644 --- a/src/components/entity/ha-battery-icon.ts +++ b/src/components/entity/ha-battery-icon.ts @@ -1,4 +1,4 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { batteryLevelIcon } from "../../common/entity/battery_icon"; diff --git a/src/components/entity/ha-entity-attribute-picker.ts b/src/components/entity/ha-entity-attribute-picker.ts index e746999d2115..0339d3f9fd3c 100644 --- a/src/components/entity/ha-entity-attribute-picker.ts +++ b/src/components/entity/ha-entity-attribute-picker.ts @@ -1,8 +1,9 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { LitElement, PropertyValues, html, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues } from "lit"; +import { LitElement, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { computeAttributeNameDisplay } from "../../common/entity/compute_attribute_display"; -import { HomeAssistant, ValueChangedEvent } from "../../types"; +import type { HomeAssistant, ValueChangedEvent } from "../../types"; import "../ha-combo-box"; import type { HaComboBox } from "../ha-combo-box"; diff --git a/src/components/entity/ha-entity-picker.ts b/src/components/entity/ha-entity-picker.ts index b169b7b605d8..854406065bf0 100644 --- a/src/components/entity/ha-entity-picker.ts +++ b/src/components/entity/ha-entity-picker.ts @@ -1,17 +1,16 @@ import "../ha-list-item"; -import { HassEntity } from "home-assistant-js-websocket"; -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; -import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; +import type { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; import { customElement, property, query, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../common/dom/fire_event"; import { computeDomain } from "../../common/entity/compute_domain"; import { computeStateName } from "../../common/entity/compute_state_name"; -import { - fuzzyFilterSort, - ScorableTextItem, -} from "../../common/string/filter/sequence-matching"; -import { ValueChangedEvent, HomeAssistant } from "../../types"; +import type { ScorableTextItem } from "../../common/string/filter/sequence-matching"; +import { fuzzyFilterSort } from "../../common/string/filter/sequence-matching"; +import type { ValueChangedEvent, HomeAssistant } from "../../types"; import "../ha-combo-box"; import type { HaComboBox } from "../ha-combo-box"; import "../ha-icon-button"; @@ -20,10 +19,8 @@ import "./state-badge"; import { caseInsensitiveStringCompare } from "../../common/string/compare"; import { showHelperDetailDialog } from "../../panels/config/helpers/show-dialog-helper-detail"; import { domainToName } from "../../data/integration"; -import { - isHelperDomain, - HelperDomain, -} from "../../panels/config/helpers/const"; +import type { HelperDomain } from "../../panels/config/helpers/const"; +import { isHelperDomain } from "../../panels/config/helpers/const"; interface HassEntityWithCachedName extends HassEntity, ScorableTextItem { friendly_name: string; diff --git a/src/components/entity/ha-entity-state-content-picker.ts b/src/components/entity/ha-entity-state-content-picker.ts index f80df1679fcb..819b154d06fe 100644 --- a/src/components/entity/ha-entity-state-content-picker.ts +++ b/src/components/entity/ha-entity-state-content-picker.ts @@ -1,6 +1,7 @@ import { mdiDrag } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; -import { LitElement, PropertyValues, css, html, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { repeat } from "lit/directives/repeat"; import memoizeOne from "memoize-one"; @@ -11,8 +12,11 @@ import { STATE_DISPLAY_SPECIAL_CONTENT, STATE_DISPLAY_SPECIAL_CONTENT_DOMAINS, } from "../../state-display/state-display"; -import { HomeAssistant, ValueChangedEvent } from "../../types"; +import type { HomeAssistant, ValueChangedEvent } from "../../types"; import "../ha-combo-box"; +import "../ha-sortable"; +import "../chips/ha-input-chip"; +import "../chips/ha-chip-set"; import type { HaComboBox } from "../ha-combo-box"; const HIDDEN_ATTRIBUTES = [ diff --git a/src/components/entity/ha-entity-state-picker.ts b/src/components/entity/ha-entity-state-picker.ts index 0c918845735d..6dac27a354cf 100644 --- a/src/components/entity/ha-entity-state-picker.ts +++ b/src/components/entity/ha-entity-state-picker.ts @@ -1,9 +1,10 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { LitElement, PropertyValues, html, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues } from "lit"; +import { LitElement, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import { getStates } from "../../common/entity/get_states"; -import { HomeAssistant, ValueChangedEvent } from "../../types"; +import type { HomeAssistant, ValueChangedEvent } from "../../types"; import "../ha-combo-box"; import type { HaComboBox } from "../ha-combo-box"; diff --git a/src/components/entity/ha-entity-toggle.ts b/src/components/entity/ha-entity-toggle.ts index 5c4c07afc55a..f5b6ccee8bbc 100644 --- a/src/components/entity/ha-entity-toggle.ts +++ b/src/components/entity/ha-entity-toggle.ts @@ -1,20 +1,14 @@ import { mdiFlash, mdiFlashOff } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - css, - html, -} from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, property, state } from "lit/decorators"; import { STATES_OFF } from "../../common/const"; import { computeStateDomain } from "../../common/entity/compute_state_domain"; import { computeStateName } from "../../common/entity/compute_state_name"; import { UNAVAILABLE, UNKNOWN, isUnavailableState } from "../../data/entity"; import { forwardHaptic } from "../../data/haptics"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import "../ha-formfield"; import "../ha-icon-button"; import "../ha-switch"; diff --git a/src/components/entity/ha-state-label-badge.ts b/src/components/entity/ha-state-label-badge.ts index b4d11875223e..7c95b71cfcd3 100644 --- a/src/components/entity/ha-state-label-badge.ts +++ b/src/components/entity/ha-state-label-badge.ts @@ -1,13 +1,7 @@ import { mdiAlert } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, -} from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { arrayLiteralIncludes } from "../../common/array/literal-includes"; @@ -21,9 +15,9 @@ import { isNumericState, } from "../../common/number/format_number"; import { isUnavailableState, UNAVAILABLE, UNKNOWN } from "../../data/entity"; -import { EntityRegistryDisplayEntry } from "../../data/entity_registry"; +import type { EntityRegistryDisplayEntry } from "../../data/entity_registry"; import { timerTimeRemaining } from "../../data/timer"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import "../ha-label-badge"; import "../ha-state-icon"; diff --git a/src/components/entity/ha-statistic-picker.ts b/src/components/entity/ha-statistic-picker.ts index a592937d3734..6361270910a9 100644 --- a/src/components/entity/ha-statistic-picker.ts +++ b/src/components/entity/ha-statistic-picker.ts @@ -1,26 +1,23 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { html, LitElement, nothing, PropertyValues, TemplateResult } from "lit"; -import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; +import "@material/mwc-list/mwc-list-item"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement, nothing } from "lit"; +import type { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; import { customElement, property, query, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { ensureArray } from "../../common/array/ensure-array"; import { fireEvent } from "../../common/dom/fire_event"; import { stringCompare } from "../../common/string/compare"; -import { - getStatisticIds, - getStatisticLabel, - StatisticsMetaData, -} from "../../data/recorder"; -import { ValueChangedEvent, HomeAssistant } from "../../types"; +import type { StatisticsMetaData } from "../../data/recorder"; +import { getStatisticIds, getStatisticLabel } from "../../data/recorder"; +import type { ValueChangedEvent, HomeAssistant } from "../../types"; import { documentationUrl } from "../../util/documentation-url"; import "../ha-combo-box"; import type { HaComboBox } from "../ha-combo-box"; import "../ha-svg-icon"; import "./state-badge"; -import { - fuzzyFilterSort, - ScorableTextItem, -} from "../../common/string/filter/sequence-matching"; +import type { ScorableTextItem } from "../../common/string/filter/sequence-matching"; +import { fuzzyFilterSort } from "../../common/string/filter/sequence-matching"; interface StatisticItem extends ScorableTextItem { id: string; diff --git a/src/components/entity/ha-statistics-picker.ts b/src/components/entity/ha-statistics-picker.ts index 115335094f91..f5fa02a54011 100644 --- a/src/components/entity/ha-statistics-picker.ts +++ b/src/components/entity/ha-statistics-picker.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { repeat } from "lit/directives/repeat"; import { fireEvent } from "../../common/dom/fire_event"; diff --git a/src/components/entity/state-badge.ts b/src/components/entity/state-badge.ts index 13b874a5e4c9..2e336f62ac2f 100644 --- a/src/components/entity/state-badge.ts +++ b/src/components/entity/state-badge.ts @@ -1,13 +1,7 @@ import { mdiAlert } from "@mdi/js"; import type { HassEntity } from "home-assistant-js-websocket"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { property, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { styleMap } from "lit/directives/style-map"; diff --git a/src/components/entity/state-info.ts b/src/components/entity/state-info.ts index 18bc50068c13..3dc06d154c75 100644 --- a/src/components/entity/state-info.ts +++ b/src/components/entity/state-info.ts @@ -1,6 +1,7 @@ import "@lrnwebcomponents/simple-tooltip/simple-tooltip"; import type { HassEntity } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { computeStateName } from "../../common/entity/compute_state_name"; import type { HomeAssistant } from "../../types"; diff --git a/src/components/ha-absolute-time.ts b/src/components/ha-absolute-time.ts index 528c65851400..935c4e8ff095 100644 --- a/src/components/ha-absolute-time.ts +++ b/src/components/ha-absolute-time.ts @@ -1,5 +1,6 @@ import { addDays, differenceInMilliseconds, startOfDay } from "date-fns"; -import { PropertyValues, ReactiveElement } from "lit"; +import type { PropertyValues } from "lit"; +import { ReactiveElement } from "lit"; import { customElement, property } from "lit/decorators"; import { absoluteTime } from "../common/datetime/absolute_time"; import type { HomeAssistant } from "../types"; diff --git a/src/components/ha-addon-picker.ts b/src/components/ha-addon-picker.ts index c169ecc532c6..116b774d71a4 100644 --- a/src/components/ha-addon-picker.ts +++ b/src/components/ha-addon-picker.ts @@ -1,11 +1,12 @@ -import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; +import type { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; import { html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { isComponentLoaded } from "../common/config/is_component_loaded"; import { fireEvent } from "../common/dom/fire_event"; import { stringCompare } from "../common/string/compare"; -import { fetchHassioAddonsInfo, HassioAddonInfo } from "../data/hassio/addon"; -import { HomeAssistant, ValueChangedEvent } from "../types"; +import type { HassioAddonInfo } from "../data/hassio/addon"; +import { fetchHassioAddonsInfo } from "../data/hassio/addon"; +import type { HomeAssistant, ValueChangedEvent } from "../types"; import "./ha-alert"; import "./ha-combo-box"; import type { HaComboBox } from "./ha-combo-box"; diff --git a/src/components/ha-aliases-editor.ts b/src/components/ha-aliases-editor.ts index 8f45409ba789..66722935980b 100644 --- a/src/components/ha-aliases-editor.ts +++ b/src/components/ha-aliases-editor.ts @@ -1,7 +1,7 @@ import { LitElement, html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-multi-textfield"; @customElement("ha-aliases-editor") diff --git a/src/components/ha-analytics.ts b/src/components/ha-analytics.ts index 15e356582da2..097c685d3dca 100644 --- a/src/components/ha-analytics.ts +++ b/src/components/ha-analytics.ts @@ -1,8 +1,9 @@ import "@lrnwebcomponents/simple-tooltip/simple-tooltip"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; -import { LocalizeFunc } from "../common/translations/localize"; +import type { LocalizeFunc } from "../common/translations/localize"; import type { Analytics, AnalyticsPreferences } from "../data/analytics"; import { haStyle } from "../resources/styles"; import "./ha-settings-row"; diff --git a/src/components/ha-ansi-to-html.ts b/src/components/ha-ansi-to-html.ts index 68f9d12aba5c..ed0b3773e3dd 100644 --- a/src/components/ha-ansi-to-html.ts +++ b/src/components/ha-ansi-to-html.ts @@ -1,10 +1,10 @@ import { css, - CSSResultGroup, + type CSSResultGroup, html, LitElement, - PropertyValues, - TemplateResult, + type PropertyValues, + type TemplateResult, } from "lit"; import { customElement, diff --git a/src/components/ha-area-filter.ts b/src/components/ha-area-filter.ts index 504b4bf9f4f1..83b9c2aa52d4 100644 --- a/src/components/ha-area-filter.ts +++ b/src/components/ha-area-filter.ts @@ -1,9 +1,10 @@ import { mdiTextureBox } from "@mdi/js"; -import { CSSResultGroup, LitElement, TemplateResult, css, html } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; import { showAreaFilterDialog } from "../dialogs/area-filter/show-area-filter-dialog"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-icon-next"; import "./ha-svg-icon"; import "./ha-textfield"; diff --git a/src/components/ha-area-floor-picker.ts b/src/components/ha-area-floor-picker.ts index a9fe503f10cf..490b73ff80d6 100644 --- a/src/components/ha-area-floor-picker.ts +++ b/src/components/ha-area-floor-picker.ts @@ -1,27 +1,27 @@ import { mdiTextureBox } from "@mdi/js"; -import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; -import { HassEntity } from "home-assistant-js-websocket"; -import { LitElement, PropertyValues, TemplateResult, html, nothing } from "lit"; +import type { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues, TemplateResult } from "lit"; +import { LitElement, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import memoizeOne from "memoize-one"; import { fireEvent } from "../common/dom/fire_event"; import { computeDomain } from "../common/entity/compute_domain"; import { stringCompare } from "../common/string/compare"; -import { - ScorableTextItem, - fuzzyFilterSort, -} from "../common/string/filter/sequence-matching"; +import type { ScorableTextItem } from "../common/string/filter/sequence-matching"; +import { fuzzyFilterSort } from "../common/string/filter/sequence-matching"; import { computeRTL } from "../common/util/compute_rtl"; -import { AreaRegistryEntry } from "../data/area_registry"; -import { +import type { AreaRegistryEntry } from "../data/area_registry"; +import type { DeviceEntityDisplayLookup, DeviceRegistryEntry, - getDeviceEntityDisplayLookup, } from "../data/device_registry"; -import { EntityRegistryDisplayEntry } from "../data/entity_registry"; -import { FloorRegistryEntry, getFloorAreaLookup } from "../data/floor_registry"; -import { HomeAssistant, ValueChangedEvent } from "../types"; +import { getDeviceEntityDisplayLookup } from "../data/device_registry"; +import type { EntityRegistryDisplayEntry } from "../data/entity_registry"; +import type { FloorRegistryEntry } from "../data/floor_registry"; +import { getFloorAreaLookup } from "../data/floor_registry"; +import type { HomeAssistant, ValueChangedEvent } from "../types"; import type { HaDevicePickerDeviceFilterFunc } from "./device/ha-device-picker"; import "./ha-combo-box"; import type { HaComboBox } from "./ha-combo-box"; diff --git a/src/components/ha-area-picker.ts b/src/components/ha-area-picker.ts index 9001e71eb217..9b0c6cd31f3d 100644 --- a/src/components/ha-area-picker.ts +++ b/src/components/ha-area-picker.ts @@ -1,29 +1,26 @@ import { mdiTextureBox } from "@mdi/js"; -import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; -import { HassEntity } from "home-assistant-js-websocket"; -import { LitElement, PropertyValues, TemplateResult, html } from "lit"; +import type { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues, TemplateResult } from "lit"; +import { LitElement, html } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; import { fireEvent } from "../common/dom/fire_event"; import { computeDomain } from "../common/entity/compute_domain"; -import { - ScorableTextItem, - fuzzyFilterSort, -} from "../common/string/filter/sequence-matching"; -import { - AreaRegistryEntry, - createAreaRegistryEntry, -} from "../data/area_registry"; -import { +import type { ScorableTextItem } from "../common/string/filter/sequence-matching"; +import { fuzzyFilterSort } from "../common/string/filter/sequence-matching"; +import type { AreaRegistryEntry } from "../data/area_registry"; +import { createAreaRegistryEntry } from "../data/area_registry"; +import type { DeviceEntityDisplayLookup, DeviceRegistryEntry, - getDeviceEntityDisplayLookup, } from "../data/device_registry"; -import { EntityRegistryDisplayEntry } from "../data/entity_registry"; +import { getDeviceEntityDisplayLookup } from "../data/device_registry"; +import type { EntityRegistryDisplayEntry } from "../data/entity_registry"; import { showAlertDialog } from "../dialogs/generic/show-dialog-box"; import { showAreaRegistryDetailDialog } from "../panels/config/areas/show-dialog-area-registry-detail"; -import { HomeAssistant, ValueChangedEvent } from "../types"; +import type { HomeAssistant, ValueChangedEvent } from "../types"; import type { HaDevicePickerDeviceFilterFunc } from "./device/ha-device-picker"; import "./ha-combo-box"; import type { HaComboBox } from "./ha-combo-box"; diff --git a/src/components/ha-areas-picker.ts b/src/components/ha-areas-picker.ts index 12defd8611d5..088a9dcde3c9 100644 --- a/src/components/ha-areas-picker.ts +++ b/src/components/ha-areas-picker.ts @@ -1,4 +1,4 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; diff --git a/src/components/ha-assist-pipeline-picker.ts b/src/components/ha-assist-pipeline-picker.ts index d6cb6c30bbe5..9c6e461733ac 100644 --- a/src/components/ha-assist-pipeline-picker.ts +++ b/src/components/ha-assist-pipeline-picker.ts @@ -1,17 +1,12 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValueMap, -} from "lit"; +import type { CSSResultGroup, PropertyValueMap } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; import { stopPropagation } from "../common/dom/stop_propagation"; import { formatLanguageCode } from "../common/language/format_language"; -import { AssistPipeline, listAssistPipelines } from "../data/assist_pipeline"; -import { HomeAssistant } from "../types"; +import type { AssistPipeline } from "../data/assist_pipeline"; +import { listAssistPipelines } from "../data/assist_pipeline"; +import type { HomeAssistant } from "../types"; import "./ha-list-item"; import "./ha-select"; import type { HaSelect } from "./ha-select"; diff --git a/src/components/ha-attribute-icon.ts b/src/components/ha-attribute-icon.ts index ae84900ac549..ac462938d013 100644 --- a/src/components/ha-attribute-icon.ts +++ b/src/components/ha-attribute-icon.ts @@ -1,9 +1,9 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { until } from "lit/directives/until"; import { attributeIcon } from "../data/icons"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-icon"; import "./ha-svg-icon"; diff --git a/src/components/ha-attribute-value.ts b/src/components/ha-attribute-value.ts index a56bd7d399d1..a419c6b99e4b 100644 --- a/src/components/ha-attribute-value.ts +++ b/src/components/ha-attribute-value.ts @@ -1,9 +1,9 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { until } from "lit/directives/until"; import { formatNumber } from "../common/number/format_number"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; @customElement("ha-attribute-value") class HaAttributeValue extends LitElement { diff --git a/src/components/ha-attributes.ts b/src/components/ha-attributes.ts index 326866a5e27d..da9df95ddd94 100644 --- a/src/components/ha-attributes.ts +++ b/src/components/ha-attributes.ts @@ -1,17 +1,11 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { computeAttributeNameDisplay } from "../common/entity/compute_attribute_display"; import { STATE_ATTRIBUTES } from "../data/entity_attributes"; import { haStyle } from "../resources/styles"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-attribute-value"; import "./ha-expansion-panel"; diff --git a/src/components/ha-badge.ts b/src/components/ha-badge.ts index 66a56b63fc21..8b2160f24ef0 100644 --- a/src/components/ha-badge.ts +++ b/src/components/ha-badge.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { ifDefined } from "lit/directives/if-defined"; diff --git a/src/components/ha-bar.ts b/src/components/ha-bar.ts index 29140bd082d1..fc27d61a9913 100644 --- a/src/components/ha-bar.ts +++ b/src/components/ha-bar.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, LitElement, svg, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, LitElement, svg } from "lit"; import { customElement, property } from "lit/decorators"; import { getValueInPercentage, diff --git a/src/components/ha-base-time-input.ts b/src/components/ha-base-time-input.ts index 71870d27490d..91250e7adda9 100644 --- a/src/components/ha-base-time-input.ts +++ b/src/components/ha-base-time-input.ts @@ -1,5 +1,6 @@ import "@material/mwc-list/mwc-list-item"; -import { css, html, LitElement, TemplateResult, nothing } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { mdiClose } from "@mdi/js"; import { ifDefined } from "lit/directives/if-defined"; @@ -7,7 +8,8 @@ import { fireEvent } from "../common/dom/fire_event"; import { stopPropagation } from "../common/dom/stop_propagation"; import "./ha-select"; import "./ha-icon-button"; -import { HaTextField } from "./ha-textfield"; +import "./ha-textfield"; +import type { HaTextField } from "./ha-textfield"; import "./ha-input-helper-text"; export interface TimeChangedEvent { diff --git a/src/components/ha-big-number.ts b/src/components/ha-big-number.ts index f9e3d8e62d33..e4474dc88078 100644 --- a/src/components/ha-big-number.ts +++ b/src/components/ha-big-number.ts @@ -1,9 +1,10 @@ -import { CSSResultGroup, LitElement, css, html } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { formatNumber } from "../common/number/format_number"; import { blankBeforeUnit } from "../common/translations/blank_before_unit"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; @customElement("ha-big-number") export class HaBigNumber extends LitElement { diff --git a/src/components/ha-blueprint-picker.ts b/src/components/ha-blueprint-picker.ts index 7ddbd3c0c8ea..436ecacf30c8 100644 --- a/src/components/ha-blueprint-picker.ts +++ b/src/components/ha-blueprint-picker.ts @@ -1,17 +1,14 @@ import "@material/mwc-list/mwc-list-item"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../common/dom/fire_event"; import { stopPropagation } from "../common/dom/stop_propagation"; import { stringCompare } from "../common/string/compare"; -import { - Blueprint, - BlueprintDomain, - Blueprints, - fetchBlueprints, -} from "../data/blueprint"; -import { HomeAssistant } from "../types"; +import type { Blueprint, BlueprintDomain, Blueprints } from "../data/blueprint"; +import { fetchBlueprints } from "../data/blueprint"; +import type { HomeAssistant } from "../types"; import "./ha-select"; @customElement("ha-blueprint-picker") diff --git a/src/components/ha-button-menu.ts b/src/components/ha-button-menu.ts index eb6426bd63a4..77866ee94292 100644 --- a/src/components/ha-button-menu.ts +++ b/src/components/ha-button-menu.ts @@ -1,7 +1,8 @@ import type { Button } from "@material/mwc-button"; import "@material/mwc-menu"; import type { Corner, Menu, MenuCorner } from "@material/mwc-menu"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import { mainWindow } from "../common/dom/get_main_window"; import { FOCUS_TARGET } from "../dialogs/make-dialog-manager"; diff --git a/src/components/ha-button-toggle-group.ts b/src/components/ha-button-toggle-group.ts index 9fc426a99176..ef81220d24d4 100644 --- a/src/components/ha-button-toggle-group.ts +++ b/src/components/ha-button-toggle-group.ts @@ -1,5 +1,7 @@ -import { Button } from "@material/mwc-button/mwc-button"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import "@material/mwc-button/mwc-button"; +import type { Button } from "@material/mwc-button/mwc-button"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, queryAll } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import { fireEvent } from "../common/dom/fire_event"; diff --git a/src/components/ha-camera-stream.ts b/src/components/ha-camera-stream.ts index d17ca1f2c498..52a182d7a20a 100644 --- a/src/components/ha-camera-stream.ts +++ b/src/components/ha-camera-stream.ts @@ -1,25 +1,26 @@ import { css, - CSSResultGroup, + type CSSResultGroup, html, LitElement, - PropertyValues, nothing, + type PropertyValues, } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { isComponentLoaded } from "../common/config/is_component_loaded"; import { computeStateName } from "../common/entity/compute_state_name"; import { supportsFeature } from "../common/entity/supports-feature"; import { - CameraEntity, CAMERA_SUPPORT_STREAM, + type CameraCapabilities, + type CameraEntity, computeMJPEGStreamUrl, - fetchStreamUrl, + fetchCameraCapabilities, fetchThumbnailUrlWithCache, STREAM_TYPE_HLS, STREAM_TYPE_WEB_RTC, + type StreamType, } from "../data/camera"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-hls-player"; import "./ha-web-rtc-player"; @@ -41,13 +42,15 @@ export class HaCameraStream extends LitElement { // Video background image before its loaded @state() private _posterUrl?: string; - // We keep track if we should force MJPEG if there was a failure - // to get the HLS stream url. This is reset if we change entities. - @state() private _forceMJPEG?: string; + @state() private _connected = false; - @state() private _url?: string; + @state() private _capabilities?: CameraCapabilities; - @state() private _connected = false; + @state() private _streamType?: StreamType; + + @state() private _hlsStreams?: { hasAudio: boolean; hasVideo: boolean }; + + @state() private _webRtcStreams?: { hasAudio: boolean; hasVideo: boolean }; public willUpdate(changedProps: PropertyValues): void { if ( @@ -57,12 +60,8 @@ export class HaCameraStream extends LitElement { (changedProps.get("stateObj") as CameraEntity | undefined)?.entity_id !== this.stateObj.entity_id ) { + this._getCapabilities(); this._getPosterUrl(); - if (this.stateObj!.attributes.frontend_stream_type === STREAM_TYPE_HLS) { - this._forceMJPEG = undefined; - this._url = undefined; - this._getStreamUrl(); - } } } @@ -87,54 +86,79 @@ export class HaCameraStream extends LitElement { : this._connected ? computeMJPEGStreamUrl(this.stateObj) : ""} - .alt=${`Preview of the ${computeStateName(this.stateObj)} camera.`} + alt=${`Preview of the ${computeStateName(this.stateObj)} camera.`} />`; } - if (this.stateObj.attributes.frontend_stream_type === STREAM_TYPE_HLS) { - return this._url - ? html`` - : nothing; + return html`${this._streamType === STREAM_TYPE_HLS || + (!this._streamType && + this._capabilities?.frontend_stream_types.includes(STREAM_TYPE_HLS)) + ? html`` + : nothing} + ${this._streamType === STREAM_TYPE_WEB_RTC || + (!this._streamType && + this._capabilities?.frontend_stream_types.includes(STREAM_TYPE_WEB_RTC)) + ? html`` + : nothing}`; + } + + private async _getCapabilities() { + this._capabilities = undefined; + this._hlsStreams = undefined; + this._webRtcStreams = undefined; + if (!supportsFeature(this.stateObj!, CAMERA_SUPPORT_STREAM)) { + return; } - if (this.stateObj.attributes.frontend_stream_type === STREAM_TYPE_WEB_RTC) { - return html``; + this._capabilities = await fetchCameraCapabilities( + this.hass!, + this.stateObj!.entity_id + ); + if (this._capabilities.frontend_stream_types.length === 1) { + this._streamType = this._capabilities.frontend_stream_types[0]; } - return nothing; } private get _shouldRenderMJPEG() { - if (this._forceMJPEG === this.stateObj!.entity_id) { - // Fallback when unable to fetch stream url - return true; - } if (!supportsFeature(this.stateObj!, CAMERA_SUPPORT_STREAM)) { // Steaming is not supported by the camera so fallback to MJPEG stream return true; } if ( - this.stateObj!.attributes.frontend_stream_type === STREAM_TYPE_WEB_RTC + this._capabilities && + (!this._capabilities.frontend_stream_types.includes(STREAM_TYPE_HLS) || + this._hlsStreams?.hasVideo === false) && + (!this._capabilities.frontend_stream_types.includes( + STREAM_TYPE_WEB_RTC + ) || + this._webRtcStreams?.hasVideo === false) ) { - // Browser support required for WebRTC - return typeof RTCPeerConnection === "undefined"; + // No video in HLS stream and no video in WebRTC stream + return true; } - // Server side stream component required for HLS - return !isComponentLoaded(this.hass!, "stream"); + return false; } private async _getPosterUrl(): Promise { @@ -151,20 +175,28 @@ export class HaCameraStream extends LitElement { } } - private async _getStreamUrl(): Promise { - try { - const { url } = await fetchStreamUrl( - this.hass!, - this.stateObj!.entity_id - ); + private _handleHlsStreams(ev: CustomEvent) { + this._hlsStreams = ev.detail; + this._pickStreamType(); + } - this._url = url; - } catch (err: any) { - // Fails if we were unable to get a stream - // eslint-disable-next-line - console.error(err); + private _handleWebRtcStreams(ev: CustomEvent) { + this._webRtcStreams = ev.detail; + this._pickStreamType(); + } - this._forceMJPEG = this.stateObj!.entity_id; + private _pickStreamType() { + if (!this._hlsStreams || !this._webRtcStreams) { + return; + } + if ( + this._hlsStreams.hasVideo && + this._hlsStreams.hasAudio && + !this._webRtcStreams.hasAudio + ) { + this._streamType = STREAM_TYPE_HLS; + } else if (this._webRtcStreams.hasVideo) { + this._streamType = STREAM_TYPE_WEB_RTC; } } @@ -178,6 +210,10 @@ export class HaCameraStream extends LitElement { img { width: 100%; } + + .hidden { + display: none; + } `; } } @@ -186,4 +222,12 @@ declare global { interface HTMLElementTagNameMap { "ha-camera-stream": HaCameraStream; } + interface HASSDomEvents { + load: undefined; + streams: { + hasAudio: boolean; + hasVideo: boolean; + codecs?: string[]; + }; + } } diff --git a/src/components/ha-card.ts b/src/components/ha-card.ts index a4c34b7ac05a..0d5a45130c91 100644 --- a/src/components/ha-card.ts +++ b/src/components/ha-card.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; @customElement("ha-card") diff --git a/src/components/ha-circular-progress.ts b/src/components/ha-circular-progress.ts index 890693429722..91fd45e9a10d 100644 --- a/src/components/ha-circular-progress.ts +++ b/src/components/ha-circular-progress.ts @@ -1,5 +1,6 @@ import { MdCircularProgress } from "@material/web/progress/circular-progress"; -import { PropertyValues, css } from "lit"; +import type { PropertyValues } from "lit"; +import { css } from "lit"; import { customElement, property } from "lit/decorators"; @customElement("ha-circular-progress") diff --git a/src/components/ha-clickable-list-item.ts b/src/components/ha-clickable-list-item.ts index 536d347fdc11..38c39a410375 100644 --- a/src/components/ha-clickable-list-item.ts +++ b/src/components/ha-clickable-list-item.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html } from "lit"; import { customElement, property, query } from "lit/decorators"; import { HaListItem } from "./ha-list-item"; diff --git a/src/components/ha-climate-state.ts b/src/components/ha-climate-state.ts index c2f35979e82a..23a957c8a88e 100644 --- a/src/components/ha-climate-state.ts +++ b/src/components/ha-climate-state.ts @@ -1,13 +1,8 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; -import { CLIMATE_PRESET_NONE, ClimateEntity } from "../data/climate"; +import type { ClimateEntity } from "../data/climate"; +import { CLIMATE_PRESET_NONE } from "../data/climate"; import { isUnavailableState, OFF } from "../data/entity"; import type { HomeAssistant } from "../types"; diff --git a/src/components/ha-code-editor.ts b/src/components/ha-code-editor.ts index e07ab07330a7..c9651ef45859 100644 --- a/src/components/ha-code-editor.ts +++ b/src/components/ha-code-editor.ts @@ -6,13 +6,14 @@ import type { } from "@codemirror/autocomplete"; import type { Extension, TransactionSpec } from "@codemirror/state"; import type { EditorView, KeyBinding, ViewUpdate } from "@codemirror/view"; -import { HassEntities } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, PropertyValues, ReactiveElement } from "lit"; +import type { HassEntities } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, ReactiveElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../common/dom/fire_event"; import { stopPropagation } from "../common/dom/stop_propagation"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-icon"; declare global { @@ -59,6 +60,7 @@ export class HaCodeEditor extends ReactiveElement { @state() private _value = ""; + // eslint-disable-next-line @typescript-eslint/consistent-type-imports private _loadedCodeMirror?: typeof import("../resources/codemirror"); private _iconList?: Completion[]; diff --git a/src/components/ha-color-picker.ts b/src/components/ha-color-picker.ts index a126982e444b..801f17088552 100644 --- a/src/components/ha-color-picker.ts +++ b/src/components/ha-color-picker.ts @@ -5,8 +5,8 @@ import { styleMap } from "lit/directives/style-map"; import { computeCssColor, THEME_COLORS } from "../common/color/compute-color"; import { fireEvent } from "../common/dom/fire_event"; import { stopPropagation } from "../common/dom/stop_propagation"; -import { LocalizeKeys } from "../common/translations/localize"; -import { HomeAssistant } from "../types"; +import type { LocalizeKeys } from "../common/translations/localize"; +import type { HomeAssistant } from "../types"; import "./ha-list-item"; import "./ha-md-divider"; import "./ha-select"; diff --git a/src/components/ha-combo-box.ts b/src/components/ha-combo-box.ts index 01b33c9a0634..ad0a0032d5a2 100644 --- a/src/components/ha-combo-box.ts +++ b/src/components/ha-combo-box.ts @@ -1,5 +1,6 @@ import { mdiClose, mdiMenuDown, mdiMenuUp } from "@mdi/js"; -import { ComboBoxLitRenderer, comboBoxRenderer } from "@vaadin/combo-box/lit"; +import type { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; +import { comboBoxRenderer } from "@vaadin/combo-box/lit"; import "@vaadin/combo-box/theme/material/vaadin-combo-box-light"; import type { ComboBoxDataProvider, @@ -9,11 +10,12 @@ import type { ComboBoxLightValueChangedEvent, } from "@vaadin/combo-box/vaadin-combo-box-light"; import { registerStyles } from "@vaadin/vaadin-themable-mixin/register-styles"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { fireEvent } from "../common/dom/fire_event"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-icon-button"; import "./ha-list-item"; import "./ha-textfield"; diff --git a/src/components/ha-config-entry-picker.ts b/src/components/ha-config-entry-picker.ts index 4d8e9f885952..ce39a4b21074 100644 --- a/src/components/ha-config-entry-picker.ts +++ b/src/components/ha-config-entry-picker.ts @@ -1,12 +1,13 @@ import "@material/mwc-list/mwc-list-item"; -import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; +import type { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; import { html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; import { caseInsensitiveStringCompare } from "../common/string/compare"; -import { ConfigEntry, getConfigEntries } from "../data/config_entries"; +import type { ConfigEntry } from "../data/config_entries"; +import { getConfigEntries } from "../data/config_entries"; import { domainToName } from "../data/integration"; -import { ValueChangedEvent, HomeAssistant } from "../types"; +import type { ValueChangedEvent, HomeAssistant } from "../types"; import { brandsUrl } from "../util/brands-url"; import "./ha-combo-box"; import type { HaComboBox } from "./ha-combo-box"; diff --git a/src/components/ha-control-button-group.ts b/src/components/ha-control-button-group.ts index 3a3df1c9457f..dad718d6936c 100644 --- a/src/components/ha-control-button-group.ts +++ b/src/components/ha-control-button-group.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; @customElement("ha-control-button-group") diff --git a/src/components/ha-control-button.ts b/src/components/ha-control-button.ts index 6b90c06ac12a..1135ccc2c994 100644 --- a/src/components/ha-control-button.ts +++ b/src/components/ha-control-button.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import "./ha-ripple"; diff --git a/src/components/ha-control-circular-slider.ts b/src/components/ha-control-circular-slider.ts index 9ba2a3d8b7fe..e3b962a0ad0d 100644 --- a/src/components/ha-control-circular-slider.ts +++ b/src/components/ha-control-circular-slider.ts @@ -6,16 +6,8 @@ import { Tap, TouchMouseInput, } from "@egjs/hammerjs"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, - svg, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing, svg } from "lit"; import { customElement, property, diff --git a/src/components/ha-control-number-buttons.ts b/src/components/ha-control-number-buttons.ts index 7e2fb7ce84e9..df3daece9423 100644 --- a/src/components/ha-control-number-buttons.ts +++ b/src/components/ha-control-number-buttons.ts @@ -1,20 +1,14 @@ import { ResizeController } from "@lit-labs/observers/resize-controller"; import { mdiMinus, mdiPlus } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { fireEvent } from "../common/dom/fire_event"; import { conditionalClamp } from "../common/number/clamp"; import { formatNumber } from "../common/number/format_number"; import { blankBeforeUnit } from "../common/translations/blank_before_unit"; -import { FrontendLocaleData } from "../data/translation"; +import type { FrontendLocaleData } from "../data/translation"; import "./ha-svg-icon"; const A11Y_KEY_CODES = new Set([ diff --git a/src/components/ha-control-select.ts b/src/components/ha-control-select.ts index 4cacb34fd21f..dbd7e5709aaf 100644 --- a/src/components/ha-control-select.ts +++ b/src/components/ha-control-select.ts @@ -1,12 +1,5 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { ifDefined } from "lit/directives/if-defined"; diff --git a/src/components/ha-control-slider.ts b/src/components/ha-control-slider.ts index 290e061ae3d2..17380736eef9 100644 --- a/src/components/ha-control-slider.ts +++ b/src/components/ha-control-slider.ts @@ -1,18 +1,11 @@ import { DIRECTION_ALL, Manager, Pan, Tap } from "@egjs/hammerjs"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { styleMap } from "lit/directives/style-map"; import { fireEvent } from "../common/dom/fire_event"; -import { FrontendLocaleData } from "../data/translation"; +import type { FrontendLocaleData } from "../data/translation"; import { formatNumber } from "../common/number/format_number"; import { blankBeforeUnit } from "../common/translations/blank_before_unit"; diff --git a/src/components/ha-control-switch.ts b/src/components/ha-control-switch.ts index 0e75b665490e..d7ecd799f1f1 100644 --- a/src/components/ha-control-switch.ts +++ b/src/components/ha-control-switch.ts @@ -5,14 +5,8 @@ import { Swipe, Tap, } from "@egjs/hammerjs"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; import "./ha-svg-icon"; diff --git a/src/components/ha-conversation-agent-picker.ts b/src/components/ha-conversation-agent-picker.ts index cccd6e76f8f8..8e421f8f6e3c 100644 --- a/src/components/ha-conversation-agent-picker.ts +++ b/src/components/ha-conversation-agent-picker.ts @@ -1,21 +1,17 @@ import { mdiCog } from "@mdi/js"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; import { stopPropagation } from "../common/dom/stop_propagation"; import { debounce } from "../common/util/debounce"; -import { ConfigEntry, getConfigEntry } from "../data/config_entries"; -import { Agent, listAgents } from "../data/conversation"; +import type { ConfigEntry } from "../data/config_entries"; +import { getConfigEntry } from "../data/config_entries"; +import type { Agent } from "../data/conversation"; +import { listAgents } from "../data/conversation"; import { fetchIntegrationManifest } from "../data/integration"; import { showOptionsFlowDialog } from "../dialogs/config-flow/show-dialog-options-flow"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-list-item"; import "./ha-select"; import type { HaSelect } from "./ha-select"; diff --git a/src/components/ha-country-picker.ts b/src/components/ha-country-picker.ts index ac6553c74dc7..8f54e0256dac 100644 --- a/src/components/ha-country-picker.ts +++ b/src/components/ha-country-picker.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../common/dom/fire_event"; diff --git a/src/components/ha-cover-controls.ts b/src/components/ha-cover-controls.ts index 72251de26cba..71371a6e11f4 100644 --- a/src/components/ha-cover-controls.ts +++ b/src/components/ha-cover-controls.ts @@ -1,16 +1,12 @@ import { mdiStop } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { computeCloseIcon, computeOpenIcon } from "../common/entity/cover_icon"; import { supportsFeature } from "../common/entity/supports-feature"; -import { - canClose, - canOpen, - canStop, - CoverEntity, - CoverEntityFeature, -} from "../data/cover"; +import type { CoverEntity } from "../data/cover"; +import { canClose, canOpen, canStop, CoverEntityFeature } from "../data/cover"; import type { HomeAssistant } from "../types"; import "./ha-icon-button"; diff --git a/src/components/ha-cover-tilt-controls.ts b/src/components/ha-cover-tilt-controls.ts index 78133de0634b..a3ae976b4ebf 100644 --- a/src/components/ha-cover-tilt-controls.ts +++ b/src/components/ha-cover-tilt-controls.ts @@ -1,16 +1,17 @@ import { mdiArrowBottomLeft, mdiArrowTopRight, mdiStop } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { supportsFeature } from "../common/entity/supports-feature"; +import type { CoverEntity } from "../data/cover"; import { canCloseTilt, canOpenTilt, canStopTilt, - CoverEntity, CoverEntityFeature, } from "../data/cover"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-icon-button"; @customElement("ha-cover-tilt-controls") diff --git a/src/components/ha-currency-picker.ts b/src/components/ha-currency-picker.ts index 04b9cd8cba3f..06aeb50de701 100644 --- a/src/components/ha-currency-picker.ts +++ b/src/components/ha-currency-picker.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../common/dom/fire_event"; diff --git a/src/components/ha-date-input.ts b/src/components/ha-date-input.ts index 80237bd3aa23..50c91f3dcfa2 100644 --- a/src/components/ha-date-input.ts +++ b/src/components/ha-date-input.ts @@ -1,12 +1,13 @@ import { mdiCalendar } from "@mdi/js"; -import { HassConfig } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement } from "lit"; +import type { HassConfig } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { firstWeekdayIndex } from "../common/datetime/first_weekday"; import { formatDateNumeric } from "../common/datetime/format_date"; import { fireEvent } from "../common/dom/fire_event"; import { TimeZone } from "../data/translation"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-svg-icon"; import "./ha-textfield"; diff --git a/src/components/ha-date-range-picker.ts b/src/components/ha-date-range-picker.ts index 1bb96721fc0d..4e541e0a7efa 100644 --- a/src/components/ha-date-range-picker.ts +++ b/src/components/ha-date-range-picker.ts @@ -1,6 +1,6 @@ import "@material/mwc-button/mwc-button"; import "@material/mwc-list/mwc-list"; -import { 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 { mdiCalendar } from "@mdi/js"; import { @@ -16,15 +16,8 @@ import { startOfWeek, startOfYear, } from "date-fns"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { calcDate } from "../common/datetime/calc_date"; @@ -32,7 +25,7 @@ import { firstWeekdayIndex } from "../common/datetime/first_weekday"; import { formatDate } from "../common/datetime/format_date"; import { formatDateTime } from "../common/datetime/format_date_time"; import { useAmPm } from "../common/datetime/use_am_pm"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./date-range-picker"; import "./ha-icon-button"; import "./ha-svg-icon"; diff --git a/src/components/ha-dialog-date-picker.ts b/src/components/ha-dialog-date-picker.ts index 63d78f3155d8..020293b3a2d4 100644 --- a/src/components/ha-dialog-date-picker.ts +++ b/src/components/ha-dialog-date-picker.ts @@ -6,8 +6,8 @@ import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; import { nextRender } from "../common/util/render-status"; import { haStyleDialog } from "../resources/styles"; -import { HomeAssistant } from "../types"; -import { datePickerDialogParams } from "./ha-date-input"; +import type { HomeAssistant } from "../types"; +import type { datePickerDialogParams } from "./ha-date-input"; import "./ha-dialog"; @customElement("ha-dialog-date-picker") diff --git a/src/components/ha-dialog.ts b/src/components/ha-dialog.ts index 5beea10a8a18..6ed262426de3 100644 --- a/src/components/ha-dialog.ts +++ b/src/components/ha-dialog.ts @@ -1,7 +1,8 @@ import { DialogBase } from "@material/mwc-dialog/mwc-dialog-base"; import { styles } from "@material/mwc-dialog/mwc-dialog.css"; import { mdiClose } from "@mdi/js"; -import { css, html, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html } from "lit"; import { customElement } from "lit/decorators"; import { FOCUS_TARGET } from "../dialogs/make-dialog-manager"; import type { HomeAssistant } from "../types"; diff --git a/src/components/ha-domain-icon.ts b/src/components/ha-domain-icon.ts index 15659cb8c2d6..f23b0fb3e799 100644 --- a/src/components/ha-domain-icon.ts +++ b/src/components/ha-domain-icon.ts @@ -1,9 +1,10 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { until } from "lit/directives/until"; import { DEFAULT_DOMAIN_ICON, FIXED_DOMAIN_ICONS } from "../common/const"; import { domainIcon } from "../data/icons"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import { brandsUrl } from "../util/brands-url"; import "./ha-icon"; diff --git a/src/components/ha-drawer.ts b/src/components/ha-drawer.ts index 8887d722af0b..3e563cd60baf 100644 --- a/src/components/ha-drawer.ts +++ b/src/components/ha-drawer.ts @@ -1,6 +1,7 @@ import { DrawerBase } from "@material/mwc-drawer/mwc-drawer-base"; import { styles } from "@material/mwc-drawer/mwc-drawer.css"; -import { css, PropertyValues } from "lit"; +import type { PropertyValues } from "lit"; +import { css } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; diff --git a/src/components/ha-duration-input.ts b/src/components/ha-duration-input.ts index 7d35fe160f03..3c5077708ed4 100644 --- a/src/components/ha-duration-input.ts +++ b/src/components/ha-duration-input.ts @@ -1,4 +1,5 @@ -import { html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; import "./ha-base-time-input"; diff --git a/src/components/ha-expansion-panel.ts b/src/components/ha-expansion-panel.ts index 64a564c454ea..02f767e8301d 100644 --- a/src/components/ha-expansion-panel.ts +++ b/src/components/ha-expansion-panel.ts @@ -1,12 +1,6 @@ import { mdiChevronDown } from "@mdi/js"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { fireEvent } from "../common/dom/fire_event"; diff --git a/src/components/ha-faded.ts b/src/components/ha-faded.ts index 648bf847fb9b..0e635351a42c 100644 --- a/src/components/ha-faded.ts +++ b/src/components/ha-faded.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; diff --git a/src/components/ha-file-upload.ts b/src/components/ha-file-upload.ts index 8b03bb8417a6..bd55538ef9bb 100644 --- a/src/components/ha-file-upload.ts +++ b/src/components/ha-file-upload.ts @@ -1,10 +1,11 @@ import "@material/mwc-linear-progress/mwc-linear-progress"; import { mdiDelete, mdiFileUpload } from "@mdi/js"; -import { LitElement, PropertyValues, TemplateResult, css, html } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { fireEvent } from "../common/dom/fire_event"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-button"; import "./ha-icon-button"; import { blankBeforePercent } from "../common/translations/blank_before_percent"; diff --git a/src/components/ha-filter-blueprints.ts b/src/components/ha-filter-blueprints.ts index 7d438dc76aa7..37ef0c8fafca 100644 --- a/src/components/ha-filter-blueprints.ts +++ b/src/components/ha-filter-blueprints.ts @@ -1,20 +1,20 @@ -import { SelectedDetail } from "@material/mwc-list"; +import "@material/mwc-list/mwc-list"; +import type { SelectedDetail } from "@material/mwc-list"; import "@material/mwc-menu/mwc-menu-surface"; import { mdiFilterVariantRemove } from "@mdi/js"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; -import { Blueprints, fetchBlueprints } from "../data/blueprint"; -import { findRelated, RelatedResult } from "../data/search"; +import type { Blueprints } from "../data/blueprint"; +import { fetchBlueprints } from "../data/blueprint"; +import type { RelatedResult } from "../data/search"; +import { findRelated } from "../data/search"; import { haStyleScrollbar } from "../resources/styles"; import type { HomeAssistant } from "../types"; +import "./ha-expansion-panel"; +import "./ha-icon-button"; +import "./ha-check-list-item"; @customElement("ha-filter-blueprints") export class HaFilterBlueprints extends LitElement { diff --git a/src/components/ha-filter-categories.ts b/src/components/ha-filter-categories.ts index 40dac92a85c6..c5da1e383e0b 100644 --- a/src/components/ha-filter-categories.ts +++ b/src/components/ha-filter-categories.ts @@ -1,4 +1,6 @@ -import { ActionDetail, SelectedDetail } from "@material/mwc-list"; +import "@material/mwc-list/mwc-list"; +import "@material/mwc-list/mwc-list-item"; +import type { ActionDetail, SelectedDetail } from "@material/mwc-list"; import { mdiDelete, mdiDotsVertical, @@ -7,12 +9,13 @@ import { mdiPlus, mdiTag, } from "@mdi/js"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; +import type { CategoryRegistryEntry } from "../data/category_registry"; import { - CategoryRegistryEntry, createCategoryRegistryEntry, deleteCategoryRegistryEntry, subscribeCategoryRegistry, @@ -25,6 +28,7 @@ import { haStyleScrollbar } from "../resources/styles"; import type { HomeAssistant } from "../types"; import "./ha-expansion-panel"; import "./ha-icon"; +import "./ha-button-menu"; import "./ha-list-item"; import { stopPropagation } from "../common/dom/stop_propagation"; diff --git a/src/components/ha-filter-devices.ts b/src/components/ha-filter-devices.ts index 8cde8b1f040c..e56fe07469d6 100644 --- a/src/components/ha-filter-devices.ts +++ b/src/components/ha-filter-devices.ts @@ -1,18 +1,14 @@ +import "@material/mwc-list/mwc-list"; import { mdiFilterVariantRemove } from "@mdi/js"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../common/dom/fire_event"; import { stringCompare } from "../common/string/compare"; import { computeDeviceName } from "../data/device_registry"; -import { findRelated, RelatedResult } from "../data/search"; +import type { RelatedResult } from "../data/search"; +import { findRelated } from "../data/search"; import { haStyleScrollbar } from "../resources/styles"; import { loadVirtualizer } from "../resources/virtualizer"; import type { HomeAssistant } from "../types"; diff --git a/src/components/ha-filter-domains.ts b/src/components/ha-filter-domains.ts index 88bd03399857..b6e892bbbfce 100644 --- a/src/components/ha-filter-domains.ts +++ b/src/components/ha-filter-domains.ts @@ -1,5 +1,7 @@ +import "@material/mwc-list/mwc-list"; import { mdiFilterVariantRemove } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { repeat } from "lit/directives/repeat"; import memoizeOne from "memoize-one"; @@ -9,6 +11,8 @@ import { domainToName } from "../data/integration"; import { haStyleScrollbar } from "../resources/styles"; import type { HomeAssistant } from "../types"; import "./ha-domain-icon"; +import "./ha-expansion-panel"; +import "./ha-check-list-item"; import "./search-input-outlined"; import { computeDomain } from "../common/entity/compute_domain"; diff --git a/src/components/ha-filter-entities.ts b/src/components/ha-filter-entities.ts index 31eaccde2545..daf5b57f03e1 100644 --- a/src/components/ha-filter-entities.ts +++ b/src/components/ha-filter-entities.ts @@ -1,24 +1,21 @@ +import "@material/mwc-list/mwc-list"; import { mdiFilterVariantRemove } from "@mdi/js"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../common/dom/fire_event"; import { computeStateDomain } from "../common/entity/compute_state_domain"; import { computeStateName } from "../common/entity/compute_state_name"; import { stringCompare } from "../common/string/compare"; -import { findRelated, RelatedResult } from "../data/search"; +import type { RelatedResult } from "../data/search"; +import { findRelated } from "../data/search"; import { haStyleScrollbar } from "../resources/styles"; import { loadVirtualizer } from "../resources/virtualizer"; import type { HomeAssistant } from "../types"; import "./ha-check-list-item"; import "./ha-state-icon"; +import "./ha-expansion-panel"; import "./search-input-outlined"; @customElement("ha-filter-entities") diff --git a/src/components/ha-filter-floor-areas.ts b/src/components/ha-filter-floor-areas.ts index 6585a10af31a..cda53b37e648 100644 --- a/src/components/ha-filter-floor-areas.ts +++ b/src/components/ha-filter-floor-areas.ts @@ -1,13 +1,8 @@ +import "@material/mwc-list/mwc-list"; import "@material/mwc-menu/mwc-menu-surface"; import { mdiFilterVariantRemove, mdiTextureBox } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { repeat } from "lit/directives/repeat"; @@ -15,7 +10,8 @@ import memoizeOne from "memoize-one"; import { fireEvent } from "../common/dom/fire_event"; import { computeRTL } from "../common/util/compute_rtl"; import { getFloorAreaLookup } from "../data/floor_registry"; -import { RelatedResult, findRelated } from "../data/search"; +import type { RelatedResult } from "../data/search"; +import { findRelated } from "../data/search"; import { haStyleScrollbar } from "../resources/styles"; import type { HomeAssistant } from "../types"; import "./ha-check-list-item"; @@ -23,6 +19,8 @@ import "./ha-floor-icon"; import "./ha-icon"; import "./ha-svg-icon"; import "./ha-tree-indicator"; +import "./ha-icon-button"; +import "./ha-expansion-panel"; @customElement("ha-filter-floor-areas") export class HaFilterFloorAreas extends LitElement { diff --git a/src/components/ha-filter-integrations.ts b/src/components/ha-filter-integrations.ts index 36e079acba0a..11e10d52442e 100644 --- a/src/components/ha-filter-integrations.ts +++ b/src/components/ha-filter-integrations.ts @@ -1,18 +1,20 @@ +import "@material/mwc-list/mwc-list"; import { mdiFilterVariantRemove } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { repeat } from "lit/directives/repeat"; import memoizeOne from "memoize-one"; import { fireEvent } from "../common/dom/fire_event"; import { stringCompare } from "../common/string/compare"; -import { - fetchIntegrationManifests, - IntegrationManifest, -} from "../data/integration"; +import type { IntegrationManifest } from "../data/integration"; +import { fetchIntegrationManifests } from "../data/integration"; import { haStyleScrollbar } from "../resources/styles"; import type { HomeAssistant } from "../types"; import "./ha-domain-icon"; import "./search-input-outlined"; +import "./ha-expansion-panel"; +import "./ha-check-list-item"; @customElement("ha-filter-integrations") export class HaFilterIntegrations extends LitElement { diff --git a/src/components/ha-filter-labels.ts b/src/components/ha-filter-labels.ts index eef52f52de99..6f5e8f5f3bb0 100644 --- a/src/components/ha-filter-labels.ts +++ b/src/components/ha-filter-labels.ts @@ -1,17 +1,17 @@ -import { SelectedDetail } from "@material/mwc-list"; +import "@material/mwc-list/mwc-list"; +import type { SelectedDetail } from "@material/mwc-list"; import "@material/mwc-menu/mwc-menu-surface"; import { mdiCog, mdiFilterVariantRemove } from "@mdi/js"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { repeat } from "lit/directives/repeat"; import { computeCssColor } from "../common/color/compute-color"; import { fireEvent } from "../common/dom/fire_event"; import { navigate } from "../common/navigate"; -import { - LabelRegistryEntry, - subscribeLabelRegistry, -} from "../data/label_registry"; +import type { LabelRegistryEntry } from "../data/label_registry"; +import { subscribeLabelRegistry } from "../data/label_registry"; import { SubscribeMixin } from "../mixins/subscribe-mixin"; import { haStyleScrollbar } from "../resources/styles"; import type { HomeAssistant } from "../types"; @@ -19,6 +19,8 @@ import "./ha-check-list-item"; import "./ha-expansion-panel"; import "./ha-icon"; import "./ha-label"; +import "./ha-icon-button"; +import "./ha-list-item"; @customElement("ha-filter-labels") export class HaFilterLabels extends SubscribeMixin(LitElement) { diff --git a/src/components/ha-filter-states.ts b/src/components/ha-filter-states.ts index ac13aa176d5c..cb454ba7ab1d 100644 --- a/src/components/ha-filter-states.ts +++ b/src/components/ha-filter-states.ts @@ -1,6 +1,8 @@ -import { SelectedDetail } from "@material/mwc-list"; +import "@material/mwc-list/mwc-list"; +import type { SelectedDetail } from "@material/mwc-list"; import { mdiFilterVariantRemove } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; import { haStyleScrollbar } from "../resources/styles"; @@ -8,6 +10,7 @@ import type { HomeAssistant } from "../types"; import "./ha-check-list-item"; import "./ha-expansion-panel"; import "./ha-icon"; +import "./ha-icon-button"; @customElement("ha-filter-states") export class HaFilterStates extends LitElement { diff --git a/src/components/ha-floor-icon.ts b/src/components/ha-floor-icon.ts index edb840a57c58..595f8add1a3d 100644 --- a/src/components/ha-floor-icon.ts +++ b/src/components/ha-floor-icon.ts @@ -8,7 +8,7 @@ import { } from "@mdi/js"; import { LitElement, html } from "lit"; import { customElement, property } from "lit/decorators"; -import { FloorRegistryEntry } from "../data/floor_registry"; +import type { FloorRegistryEntry } from "../data/floor_registry"; import "./ha-icon"; import "./ha-svg-icon"; diff --git a/src/components/ha-floor-picker.ts b/src/components/ha-floor-picker.ts index 17a958936e15..cfa5678591e3 100644 --- a/src/components/ha-floor-picker.ts +++ b/src/components/ha-floor-picker.ts @@ -1,33 +1,30 @@ -import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; -import { HassEntity } from "home-assistant-js-websocket"; -import { LitElement, PropertyValues, TemplateResult, html } from "lit"; +import type { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues, TemplateResult } from "lit"; +import { LitElement, html } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; import { fireEvent } from "../common/dom/fire_event"; import { computeDomain } from "../common/entity/compute_domain"; -import { - ScorableTextItem, - fuzzyFilterSort, -} from "../common/string/filter/sequence-matching"; -import { - AreaRegistryEntry, - updateAreaRegistryEntry, -} from "../data/area_registry"; -import { +import type { ScorableTextItem } from "../common/string/filter/sequence-matching"; +import { fuzzyFilterSort } from "../common/string/filter/sequence-matching"; +import type { AreaRegistryEntry } from "../data/area_registry"; +import { updateAreaRegistryEntry } from "../data/area_registry"; +import type { DeviceEntityDisplayLookup, DeviceRegistryEntry, - getDeviceEntityDisplayLookup, } from "../data/device_registry"; -import { EntityRegistryDisplayEntry } from "../data/entity_registry"; +import { getDeviceEntityDisplayLookup } from "../data/device_registry"; +import type { EntityRegistryDisplayEntry } from "../data/entity_registry"; +import type { FloorRegistryEntry } from "../data/floor_registry"; import { - FloorRegistryEntry, createFloorRegistryEntry, getFloorAreaLookup, } from "../data/floor_registry"; import { showAlertDialog } from "../dialogs/generic/show-dialog-box"; import { showFloorRegistryDetailDialog } from "../panels/config/areas/show-dialog-floor-registry-detail"; -import { HomeAssistant, ValueChangedEvent } from "../types"; +import type { HomeAssistant, ValueChangedEvent } from "../types"; import type { HaDevicePickerDeviceFilterFunc } from "./device/ha-device-picker"; import "./ha-combo-box"; import type { HaComboBox } from "./ha-combo-box"; diff --git a/src/components/ha-floors-picker.ts b/src/components/ha-floors-picker.ts index e5f0e39655fc..86086e695950 100644 --- a/src/components/ha-floors-picker.ts +++ b/src/components/ha-floors-picker.ts @@ -1,4 +1,4 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; diff --git a/src/components/ha-form/ha-form-boolean.ts b/src/components/ha-form/ha-form-boolean.ts index 171739e844ca..b56ccd2d2481 100644 --- a/src/components/ha-form/ha-form-boolean.ts +++ b/src/components/ha-form/ha-form-boolean.ts @@ -1,5 +1,6 @@ import "@material/mwc-formfield"; -import { html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import type { diff --git a/src/components/ha-form/ha-form-constant.ts b/src/components/ha-form/ha-form-constant.ts index c1b6c67e9e1f..9ba8073de9d5 100644 --- a/src/components/ha-form/ha-form-constant.ts +++ b/src/components/ha-form/ha-form-constant.ts @@ -1,6 +1,7 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; -import { HaFormConstantSchema, HaFormElement } from "./types"; +import type { HaFormConstantSchema, HaFormElement } from "./types"; @customElement("ha-form-constant") export class HaFormConstant extends LitElement implements HaFormElement { diff --git a/src/components/ha-form/ha-form-expandable.ts b/src/components/ha-form/ha-form-expandable.ts index a751a5acd244..0f9b838342cc 100644 --- a/src/components/ha-form/ha-form-expandable.ts +++ b/src/components/ha-form/ha-form-expandable.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import type { HomeAssistant } from "../../types"; import "./ha-form"; diff --git a/src/components/ha-form/ha-form-float.ts b/src/components/ha-form/ha-form-float.ts index cfee72ebe19c..af62ff7c447c 100644 --- a/src/components/ha-form/ha-form-float.ts +++ b/src/components/ha-form/ha-form-float.ts @@ -1,10 +1,15 @@ -import { css, html, LitElement, TemplateResult, PropertyValues } from "lit"; +import type { TemplateResult, PropertyValues } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import type { HaTextField } from "../ha-textfield"; import "../ha-textfield"; -import { HaFormElement, HaFormFloatData, HaFormFloatSchema } from "./types"; -import { LocalizeFunc } from "../../common/translations/localize"; +import type { + HaFormElement, + HaFormFloatData, + HaFormFloatSchema, +} from "./types"; +import type { LocalizeFunc } from "../../common/translations/localize"; @customElement("ha-form-float") export class HaFormFloat extends LitElement implements HaFormElement { diff --git a/src/components/ha-form/ha-form-grid.ts b/src/components/ha-form/ha-form-grid.ts index 4eefedf4691c..37a89b2443e8 100644 --- a/src/components/ha-form/ha-form-grid.ts +++ b/src/components/ha-form/ha-form-grid.ts @@ -1,12 +1,6 @@ import "./ha-form"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import type { HaFormGridSchema, diff --git a/src/components/ha-form/ha-form-integer.ts b/src/components/ha-form/ha-form-integer.ts index 2ce103b6bdd9..ed2d8a0708cc 100644 --- a/src/components/ha-form/ha-form-integer.ts +++ b/src/components/ha-form/ha-form-integer.ts @@ -1,18 +1,19 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; -import { HaCheckbox } from "../ha-checkbox"; +import type { HaCheckbox } from "../ha-checkbox"; import "../ha-slider"; -import { HaTextField } from "../ha-textfield"; -import { HaFormElement, HaFormIntegerData, HaFormIntegerSchema } from "./types"; -import { LocalizeFunc } from "../../common/translations/localize"; +import "../ha-checkbox"; +import "../ha-input-helper-text"; +import "../ha-textfield"; +import type { HaTextField } from "../ha-textfield"; +import type { + HaFormElement, + HaFormIntegerData, + HaFormIntegerSchema, +} from "./types"; +import type { LocalizeFunc } from "../../common/translations/localize"; @customElement("ha-form-integer") export class HaFormInteger extends LitElement implements HaFormElement { diff --git a/src/components/ha-form/ha-form-multi_select.ts b/src/components/ha-form/ha-form-multi_select.ts index 3a76d87f77f8..067840fc5c30 100644 --- a/src/components/ha-form/ha-form-multi_select.ts +++ b/src/components/ha-form/ha-form-multi_select.ts @@ -1,12 +1,6 @@ import { mdiMenuDown, mdiMenuUp } from "@mdi/js"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import "../ha-button-menu"; @@ -17,7 +11,7 @@ import type { HaCheckbox } from "../ha-checkbox"; import "../ha-formfield"; import "../ha-svg-icon"; import "../ha-textfield"; -import { +import type { HaFormElement, HaFormMultiSelectData, HaFormMultiSelectSchema, diff --git a/src/components/ha-form/ha-form-positive_time_period_dict.ts b/src/components/ha-form/ha-form-positive_time_period_dict.ts index ea2d56b11471..8e6220581384 100644 --- a/src/components/ha-form/ha-form-positive_time_period_dict.ts +++ b/src/components/ha-form/ha-form-positive_time_period_dict.ts @@ -1,7 +1,8 @@ -import { html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import "../ha-duration-input"; -import { HaFormElement, HaFormTimeData, HaFormTimeSchema } from "./types"; +import type { HaFormElement, HaFormTimeData, HaFormTimeSchema } from "./types"; @customElement("ha-form-positive_time_period_dict") export class HaFormTimePeriod extends LitElement implements HaFormElement { diff --git a/src/components/ha-form/ha-form-select.ts b/src/components/ha-form/ha-form-select.ts index 83a2c7525a8b..8451b21a6ce7 100644 --- a/src/components/ha-form/ha-form-select.ts +++ b/src/components/ha-form/ha-form-select.ts @@ -1,5 +1,6 @@ import memoizeOne from "memoize-one"; -import { html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import type { HomeAssistant } from "../../types"; diff --git a/src/components/ha-form/ha-form-string.ts b/src/components/ha-form/ha-form-string.ts index dc9c4305e211..18cf44a0a894 100644 --- a/src/components/ha-form/ha-form-string.ts +++ b/src/components/ha-form/ha-form-string.ts @@ -1,14 +1,7 @@ /* eslint-disable lit/prefer-static-styles */ import { mdiEye, mdiEyeOff } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import "../ha-icon-button"; @@ -19,7 +12,10 @@ import type { HaFormStringData, HaFormStringSchema, } from "./types"; -import { LocalizeFunc, LocalizeKeys } from "../../common/translations/localize"; +import type { + LocalizeFunc, + LocalizeKeys, +} from "../../common/translations/localize"; const MASKED_FIELDS = ["password", "secret", "token"]; diff --git a/src/components/ha-form/ha-form.ts b/src/components/ha-form/ha-form.ts index b3e0e21de7ff..540be73a71b0 100644 --- a/src/components/ha-form/ha-form.ts +++ b/src/components/ha-form/ha-form.ts @@ -1,20 +1,13 @@ /* eslint-disable lit/prefer-static-styles */ -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - ReactiveElement, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement, ReactiveElement } from "lit"; import { customElement, property } from "lit/decorators"; import { dynamicElement } from "../../common/dom/dynamic-element-directive"; import { fireEvent } from "../../common/dom/fire_event"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import "../ha-alert"; import "../ha-selector/ha-selector"; -import { HaFormDataContainer, HaFormElement, HaFormSchema } from "./types"; +import type { HaFormDataContainer, HaFormElement, HaFormSchema } from "./types"; const LOAD_ELEMENTS = { boolean: () => import("./ha-form-boolean"), diff --git a/src/components/ha-form/types.ts b/src/components/ha-form/types.ts index 53a51313a104..437ffd17ea73 100644 --- a/src/components/ha-form/types.ts +++ b/src/components/ha-form/types.ts @@ -1,5 +1,5 @@ import type { LitElement } from "lit"; -import { Selector } from "../../data/selector"; +import type { Selector } from "../../data/selector"; import type { HaDurationData } from "../ha-duration-input"; export type HaFormSchema = diff --git a/src/components/ha-gauge.ts b/src/components/ha-gauge.ts index 9ec23558ffec..eeddd6c75070 100644 --- a/src/components/ha-gauge.ts +++ b/src/components/ha-gauge.ts @@ -1,10 +1,11 @@ -import { css, LitElement, PropertyValues, svg, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { css, LitElement, svg } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import { formatNumber } from "../common/number/format_number"; import { blankBeforePercent } from "../common/translations/blank_before_percent"; import { afterNextRender } from "../common/util/render-status"; -import { FrontendLocaleData } from "../data/translation"; +import type { FrontendLocaleData } from "../data/translation"; import { getValueInPercentage, normalize } from "../util/calculate"; const getAngle = (value: number, min: number, max: number) => { diff --git a/src/components/ha-grid-size-picker.ts b/src/components/ha-grid-size-picker.ts index ae48870760fa..f3b5607c21d1 100644 --- a/src/components/ha-grid-size-picker.ts +++ b/src/components/ha-grid-size-picker.ts @@ -8,11 +8,9 @@ import { classMap } from "lit/directives/class-map"; import { styleMap } from "lit/directives/style-map"; import { fireEvent } from "../common/dom/fire_event"; import { conditionalClamp } from "../common/number/clamp"; -import { - CardGridSize, - DEFAULT_GRID_SIZE, -} from "../panels/lovelace/common/compute-card-grid-size"; -import { HomeAssistant } from "../types"; +import type { CardGridSize } from "../panels/lovelace/common/compute-card-grid-size"; +import { DEFAULT_GRID_SIZE } from "../panels/lovelace/common/compute-card-grid-size"; +import type { HomeAssistant } from "../types"; @customElement("ha-grid-size-picker") export class HaGridSizeEditor extends LitElement { diff --git a/src/components/ha-heading-badge.ts b/src/components/ha-heading-badge.ts index adfa5dd79a2d..5fff177a2ab1 100644 --- a/src/components/ha-heading-badge.ts +++ b/src/components/ha-heading-badge.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; diff --git a/src/components/ha-help-tooltip.ts b/src/components/ha-help-tooltip.ts index d8964b0044b9..dc8e9ff9cf1e 100644 --- a/src/components/ha-help-tooltip.ts +++ b/src/components/ha-help-tooltip.ts @@ -1,6 +1,7 @@ import { mdiHelpCircle } from "@mdi/js"; import "@lrnwebcomponents/simple-tooltip/simple-tooltip"; -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import "./ha-svg-icon"; diff --git a/src/components/ha-hls-player.ts b/src/components/ha-hls-player.ts index cf3ed5a526a1..b552a7a52ee0 100644 --- a/src/components/ha-hls-player.ts +++ b/src/components/ha-hls-player.ts @@ -1,17 +1,13 @@ import type HlsType from "hls.js"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; import { nextRender } from "../common/util/render-status"; import type { HomeAssistant } from "../types"; import "./ha-alert"; +import { fetchStreamUrl } from "../data/camera"; +import { isComponentLoaded } from "../common/config/is_component_loaded"; type HlsLite = Omit< HlsType, @@ -22,9 +18,9 @@ type HlsLite = Omit< class HaHLSPlayer extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; - @property() public url!: string; + @property() public entityid?: string; - @property() public posterUrl!: string; + @property({ attribute: "poster-url" }) public posterUrl?: string; @property({ type: Boolean, attribute: "controls" }) public controls = false; @@ -48,6 +44,8 @@ class HaHLSPlayer extends LitElement { @state() private _errorIsFatal = false; + @state() private _url!: string; + private _hlsPolyfillInstance?: HlsLite; private _exoPlayer = false; @@ -95,19 +93,44 @@ class HaHLSPlayer extends LitElement { protected updated(changedProps: PropertyValues) { super.updated(changedProps); - const urlChanged = changedProps.has("url"); + const entityChanged = changedProps.has("entityid"); - if (!urlChanged) { + if (!entityChanged) { return; } + this._getStreamUrl(); + } + private async _getStreamUrl(): Promise { this._cleanUp(); this._resetError(); - this._startHls(); + + if (!isComponentLoaded(this.hass!, "stream")) { + this._setFatalError("Streaming component is not loaded."); + return; + } + + if (!this.entityid) { + return; + } + try { + const { url } = await fetchStreamUrl(this.hass!, this.entityid); + + this._url = url; + this._cleanUp(); + this._resetError(); + this._startHls(); + } catch (err: any) { + // Fails if we were unable to get a stream + // eslint-disable-next-line + console.error(err); + + fireEvent(this, "streams", { hasAudio: false, hasVideo: false }); + } } private async _startHls(): Promise { - const masterPlaylistPromise = fetch(this.url); + const masterPlaylistPromise = fetch(this._url); const Hls: typeof HlsType = (await import("hls.js/dist/hls.light.mjs")) .default; @@ -138,10 +161,10 @@ class HaHLSPlayer extends LitElement { return; } - // Parse playlist assuming it is a master playlist. Match group 1 is whether hevc, match group 2 is regular playlist url + // Parse playlist assuming it is a master playlist. Match group 1 and 2 are codec, match group 3 is regular playlist url // See https://tools.ietf.org/html/rfc8216 for HLS spec details const playlistRegexp = - /#EXT-X-STREAM-INF:.*?(?:CODECS=".*?(hev1|hvc1)?\..*?".*?)?(?:\n|\r\n)(.+)/g; + /#EXT-X-STREAM-INF:.*?(?:CODECS=".*?([^.]*)?\..*?,([^.]*)?\..*?".*?)?(?:\n|\r\n)(.+)/g; const match = playlistRegexp.exec(masterPlaylist); const matchTwice = playlistRegexp.exec(masterPlaylist); @@ -150,13 +173,20 @@ class HaHLSPlayer extends LitElement { let playlist_url: string; if (match !== null && matchTwice === null) { // Only send the regular playlist url if we match exactly once - playlist_url = new URL(match[2], this.url).href; + playlist_url = new URL(match[3], this._url).href; } else { - playlist_url = this.url; + playlist_url = this._url; } + const codecs = match ? `${match[1]},${match[2]}` : undefined; + + this._reportStreams(codecs); + // If codec is HEVC and ExoPlayer is supported, use ExoPlayer. - if (useExoPlayer && match !== null && match[1] !== undefined) { + if ( + useExoPlayer && + (codecs?.includes("hevc") || codecs?.includes("hev1")) + ) { this._renderHLSExoPlayer(playlist_url); } else if (Hls.isSupported()) { this._renderHLSPolyfill(this._videoEl, Hls, playlist_url); @@ -313,15 +343,26 @@ class HaHLSPlayer extends LitElement { private _setFatalError(errorMessage: string) { this._error = errorMessage; this._errorIsFatal = true; + fireEvent(this, "streams", { hasAudio: false, hasVideo: false }); } private _setRetryableError(errorMessage: string) { this._error = errorMessage; this._errorIsFatal = false; + fireEvent(this, "streams", { hasAudio: false, hasVideo: false }); + } + + private _reportStreams(codecs?: string) { + const codec = codecs?.split(","); + fireEvent(this, "streams", { + hasAudio: codec?.includes("mp4a") ?? false, + hasVideo: codec?.includes("mp4a") + ? codec?.length > 1 + : Boolean(codec?.length), + }); } private _loadedData() { - // @ts-ignore fireEvent(this, "load"); } diff --git a/src/components/ha-hs-color-picker.ts b/src/components/ha-hs-color-picker.ts index b332e0fd636b..8e77b8ebc965 100644 --- a/src/components/ha-hs-color-picker.ts +++ b/src/components/ha-hs-color-picker.ts @@ -1,5 +1,6 @@ import { DIRECTION_ALL, Manager, Pan, Tap } from "@egjs/hammerjs"; -import { css, html, LitElement, PropertyValues, svg } from "lit"; +import type { PropertyValues } from "lit"; +import { css, html, LitElement, svg } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { styleMap } from "lit/directives/style-map"; diff --git a/src/components/ha-humidifier-state.ts b/src/components/ha-humidifier-state.ts index a2d6dc740b1b..6b74be16538d 100644 --- a/src/components/ha-humidifier-state.ts +++ b/src/components/ha-humidifier-state.ts @@ -1,7 +1,8 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { isUnavailableState, OFF } from "../data/entity"; -import { HumidifierEntity } from "../data/humidifier"; +import type { HumidifierEntity } from "../data/humidifier"; import type { HomeAssistant } from "../types"; @customElement("ha-humidifier-state") diff --git a/src/components/ha-icon-button-arrow-next.ts b/src/components/ha-icon-button-arrow-next.ts index 14ce4d6254c2..9eafcf6f072e 100644 --- a/src/components/ha-icon-button-arrow-next.ts +++ b/src/components/ha-icon-button-arrow-next.ts @@ -1,8 +1,9 @@ import { mdiArrowLeft, mdiArrowRight } from "@mdi/js"; -import { html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { mainWindow } from "../common/dom/get_main_window"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-icon-button"; @customElement("ha-icon-button-arrow-next") diff --git a/src/components/ha-icon-button-arrow-prev.ts b/src/components/ha-icon-button-arrow-prev.ts index 571b9176973f..b0137fc92506 100644 --- a/src/components/ha-icon-button-arrow-prev.ts +++ b/src/components/ha-icon-button-arrow-prev.ts @@ -1,8 +1,9 @@ import { mdiArrowLeft, mdiArrowRight } from "@mdi/js"; -import { html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { mainWindow } from "../common/dom/get_main_window"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-icon-button"; @customElement("ha-icon-button-arrow-prev") diff --git a/src/components/ha-icon-button-group.ts b/src/components/ha-icon-button-group.ts index fe09ae262aa7..17f296700028 100644 --- a/src/components/ha-icon-button-group.ts +++ b/src/components/ha-icon-button-group.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement } from "lit/decorators"; @customElement("ha-icon-button-group") diff --git a/src/components/ha-icon-button-next.ts b/src/components/ha-icon-button-next.ts index 429d0c1e7204..ba40a921a710 100644 --- a/src/components/ha-icon-button-next.ts +++ b/src/components/ha-icon-button-next.ts @@ -1,8 +1,9 @@ import { mdiChevronLeft, mdiChevronRight } from "@mdi/js"; -import { html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { mainWindow } from "../common/dom/get_main_window"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-icon-button"; @customElement("ha-icon-button-next") diff --git a/src/components/ha-icon-button-prev.ts b/src/components/ha-icon-button-prev.ts index b2dc3e0499aa..5f6510bc6456 100644 --- a/src/components/ha-icon-button-prev.ts +++ b/src/components/ha-icon-button-prev.ts @@ -1,8 +1,9 @@ import { mdiChevronLeft, mdiChevronRight } from "@mdi/js"; -import { html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { mainWindow } from "../common/dom/get_main_window"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-icon-button"; @customElement("ha-icon-button-prev") diff --git a/src/components/ha-icon-button-toggle.ts b/src/components/ha-icon-button-toggle.ts index 684a9f4dfe10..00c70949f5e7 100644 --- a/src/components/ha-icon-button-toggle.ts +++ b/src/components/ha-icon-button-toggle.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css } from "lit"; import { customElement, property } from "lit/decorators"; import { HaIconButton } from "./ha-icon-button"; diff --git a/src/components/ha-icon-button.ts b/src/components/ha-icon-button.ts index bfeb122c9012..9d44dbe210a7 100644 --- a/src/components/ha-icon-button.ts +++ b/src/components/ha-icon-button.ts @@ -1,6 +1,7 @@ import "@material/mwc-icon-button"; import type { IconButton } from "@material/mwc-icon-button"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import "./ha-svg-icon"; diff --git a/src/components/ha-icon-overflow-menu.ts b/src/components/ha-icon-overflow-menu.ts index ef682477ec5c..f7ebc3e9e954 100644 --- a/src/components/ha-icon-overflow-menu.ts +++ b/src/components/ha-icon-overflow-menu.ts @@ -1,10 +1,11 @@ import "@lrnwebcomponents/simple-tooltip/simple-tooltip"; import { mdiDotsVertical } from "@mdi/js"; -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { haStyle } from "../resources/styles"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-button-menu"; import "./ha-icon-button"; import "./ha-list-item"; diff --git a/src/components/ha-icon-picker.ts b/src/components/ha-icon-picker.ts index df792a73bb73..77ceb6aba122 100644 --- a/src/components/ha-icon-picker.ts +++ b/src/components/ha-icon-picker.ts @@ -1,14 +1,15 @@ -import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; -import { +import type { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; +import type { ComboBoxDataProviderCallback, ComboBoxDataProviderParams, } from "@vaadin/combo-box/vaadin-combo-box-light"; -import { LitElement, TemplateResult, css, html } from "lit"; +import type { TemplateResult } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../common/dom/fire_event"; import { customIcons } from "../data/custom_icons"; -import { HomeAssistant, ValueChangedEvent } from "../types"; +import type { HomeAssistant, ValueChangedEvent } from "../types"; import "./ha-combo-box"; import "./ha-list-item"; import "./ha-icon"; diff --git a/src/components/ha-icon.ts b/src/components/ha-icon.ts index 4077da8f7bed..41bbe2543342 100644 --- a/src/components/ha-icon.ts +++ b/src/components/ha-icon.ts @@ -1,18 +1,12 @@ -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; import { debounce } from "../common/util/debounce"; -import { CustomIcon, customIcons } from "../data/custom_icons"; +import type { CustomIcon } from "../data/custom_icons"; +import { customIcons } from "../data/custom_icons"; +import type { Chunks, Icons } from "../data/iconsets"; import { - Chunks, - Icons, MDI_PREFIXES, checkCacheVersion, findIconChunk, diff --git a/src/components/ha-input-helper-text.ts b/src/components/ha-input-helper-text.ts index f40bb5332029..4af842ee749e 100644 --- a/src/components/ha-input-helper-text.ts +++ b/src/components/ha-input-helper-text.ts @@ -1,4 +1,5 @@ -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement } from "lit/decorators"; @customElement("ha-input-helper-text") diff --git a/src/components/ha-label-badge.ts b/src/components/ha-label-badge.ts index d5ef9c47525a..225dc4b0006d 100644 --- a/src/components/ha-label-badge.ts +++ b/src/components/ha-label-badge.ts @@ -1,11 +1,5 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; diff --git a/src/components/ha-label-picker.ts b/src/components/ha-label-picker.ts index dba720d94b13..be81ed99943f 100644 --- a/src/components/ha-label-picker.ts +++ b/src/components/ha-label-picker.ts @@ -1,29 +1,28 @@ -import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; -import { HassEntity, UnsubscribeFunc } from "home-assistant-js-websocket"; -import { LitElement, PropertyValues, TemplateResult, html, nothing } from "lit"; +import type { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; +import type { HassEntity, UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { PropertyValues, TemplateResult } from "lit"; +import { LitElement, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; import { fireEvent } from "../common/dom/fire_event"; import { computeDomain } from "../common/entity/compute_domain"; -import { - ScorableTextItem, - fuzzyFilterSort, -} from "../common/string/filter/sequence-matching"; -import { +import type { ScorableTextItem } from "../common/string/filter/sequence-matching"; +import { fuzzyFilterSort } from "../common/string/filter/sequence-matching"; +import type { DeviceEntityDisplayLookup, DeviceRegistryEntry, - getDeviceEntityDisplayLookup, } from "../data/device_registry"; -import { EntityRegistryDisplayEntry } from "../data/entity_registry"; +import { getDeviceEntityDisplayLookup } from "../data/device_registry"; +import type { EntityRegistryDisplayEntry } from "../data/entity_registry"; +import type { LabelRegistryEntry } from "../data/label_registry"; import { - LabelRegistryEntry, createLabelRegistryEntry, subscribeLabelRegistry, } from "../data/label_registry"; import { SubscribeMixin } from "../mixins/subscribe-mixin"; import { showLabelDetailDialog } from "../panels/config/labels/show-dialog-label-detail"; -import { HomeAssistant, ValueChangedEvent } from "../types"; +import type { HomeAssistant, ValueChangedEvent } from "../types"; import type { HaDevicePickerDeviceFilterFunc } from "./device/ha-device-picker"; import "./ha-combo-box"; import type { HaComboBox } from "./ha-combo-box"; diff --git a/src/components/ha-label.ts b/src/components/ha-label.ts index 53749dac82c7..668f28017e51 100644 --- a/src/components/ha-label.ts +++ b/src/components/ha-label.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; @customElement("ha-label") diff --git a/src/components/ha-labeled-slider.ts b/src/components/ha-labeled-slider.ts index 99805f3f8c3d..9e6ffe2f3036 100644 --- a/src/components/ha-labeled-slider.ts +++ b/src/components/ha-labeled-slider.ts @@ -1,4 +1,5 @@ -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; import "./ha-icon"; diff --git a/src/components/ha-labels-picker.ts b/src/components/ha-labels-picker.ts index d05cae721546..c03a698b719d 100644 --- a/src/components/ha-labels-picker.ts +++ b/src/components/ha-labels-picker.ts @@ -1,19 +1,20 @@ -import { HassEntity, UnsubscribeFunc } from "home-assistant-js-websocket"; -import { LitElement, TemplateResult, css, html, nothing } from "lit"; +import type { HassEntity, UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { repeat } from "lit/directives/repeat"; import memoizeOne from "memoize-one"; import { computeCssColor } from "../common/color/compute-color"; import { fireEvent } from "../common/dom/fire_event"; import { stringCompare } from "../common/string/compare"; +import type { LabelRegistryEntry } from "../data/label_registry"; import { - LabelRegistryEntry, subscribeLabelRegistry, updateLabelRegistryEntry, } from "../data/label_registry"; import { SubscribeMixin } from "../mixins/subscribe-mixin"; import { showLabelDetailDialog } from "../panels/config/labels/show-dialog-label-detail"; -import { HomeAssistant, ValueChangedEvent } from "../types"; +import type { HomeAssistant, ValueChangedEvent } from "../types"; import "./chips/ha-chip-set"; import "./chips/ha-input-chip"; import type { HaDevicePickerDeviceFilterFunc } from "./device/ha-device-picker"; diff --git a/src/components/ha-language-picker.ts b/src/components/ha-language-picker.ts index 6a7ba8f1f98e..ee641865b29d 100644 --- a/src/components/ha-language-picker.ts +++ b/src/components/ha-language-picker.ts @@ -1,13 +1,14 @@ -import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../common/dom/fire_event"; import { stopPropagation } from "../common/dom/stop_propagation"; import { formatLanguageCode } from "../common/language/format_language"; import { caseInsensitiveStringCompare } from "../common/string/compare"; -import { FrontendLocaleData } from "../data/translation"; +import type { FrontendLocaleData } from "../data/translation"; import { translationMetadata } from "../resources/translations-metadata"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-list-item"; import "./ha-select"; import type { HaSelect } from "./ha-select"; diff --git a/src/components/ha-lawn_mower-action-button.ts b/src/components/ha-lawn_mower-action-button.ts index 1f4fa6a5edb7..5d5fe9113ce3 100644 --- a/src/components/ha-lawn_mower-action-button.ts +++ b/src/components/ha-lawn_mower-action-button.ts @@ -1,13 +1,11 @@ import "@material/mwc-button"; -import { CSSResultGroup, LitElement, css, html } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, property } from "lit/decorators"; import { supportsFeature } from "../common/entity/supports-feature"; -import { - LawnMowerEntity, - LawnMowerEntityFeature, - LawnMowerEntityState, -} from "../data/lawn_mower"; -import { HomeAssistant } from "../types"; +import type { LawnMowerEntity, LawnMowerEntityState } from "../data/lawn_mower"; +import { LawnMowerEntityFeature } from "../data/lawn_mower"; +import type { HomeAssistant } from "../types"; type LawnMowerAction = { action: string; diff --git a/src/components/ha-list-item.ts b/src/components/ha-list-item.ts index ef30d76e2523..bd405619c28a 100644 --- a/src/components/ha-list-item.ts +++ b/src/components/ha-list-item.ts @@ -1,6 +1,7 @@ import { ListItemBase } from "@material/mwc-list/mwc-list-item-base"; import { styles } from "@material/mwc-list/mwc-list-item.css"; -import { css, CSSResultGroup } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css } from "lit"; import { customElement } from "lit/decorators"; @customElement("ha-list-item") diff --git a/src/components/ha-logo-svg.ts b/src/components/ha-logo-svg.ts index 1f34735ac6e2..bd526e7e8fb7 100644 --- a/src/components/ha-logo-svg.ts +++ b/src/components/ha-logo-svg.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, LitElement, html, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, LitElement, html } from "lit"; import { customElement } from "lit/decorators"; @customElement("ha-logo-svg") diff --git a/src/components/ha-markdown.ts b/src/components/ha-markdown.ts index f66037776bfc..179c3e3521e6 100644 --- a/src/components/ha-markdown.ts +++ b/src/components/ha-markdown.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import "./ha-markdown-element"; diff --git a/src/components/ha-md-button-menu.ts b/src/components/ha-md-button-menu.ts index a9445e0c219e..09a0a7fd9b75 100644 --- a/src/components/ha-md-button-menu.ts +++ b/src/components/ha-md-button-menu.ts @@ -1,5 +1,6 @@ -import { Button } from "@material/mwc-button"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { Button } from "@material/mwc-button"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import { FOCUS_TARGET } from "../dialogs/make-dialog-manager"; import type { HaIconButton } from "./ha-icon-button"; diff --git a/src/components/ha-md-dialog.ts b/src/components/ha-md-dialog.ts index 0b2362acfe4d..0637817f7c79 100644 --- a/src/components/ha-md-dialog.ts +++ b/src/components/ha-md-dialog.ts @@ -41,6 +41,7 @@ MdDialog.addInitializer(async (instance) => { }; }); +// eslint-disable-next-line @typescript-eslint/consistent-type-imports let DIALOG_POLYFILL: Promise; /** diff --git a/src/components/ha-menu-button.ts b/src/components/ha-menu-button.ts index 4c70956dd174..8857413533d9 100644 --- a/src/components/ha-menu-button.ts +++ b/src/components/ha-menu-button.ts @@ -1,10 +1,11 @@ import { mdiMenu } from "@mdi/js"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; import { subscribeNotifications } from "../data/persistent_notification"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-icon-button"; @customElement("ha-menu-button") diff --git a/src/components/ha-metric.ts b/src/components/ha-metric.ts index 9d0fd3431ec7..eae3bf1aca65 100644 --- a/src/components/ha-metric.ts +++ b/src/components/ha-metric.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { roundWithOneDecimal } from "../util/calculate"; diff --git a/src/components/ha-mount-picker.ts b/src/components/ha-mount-picker.ts index 786f4952be51..c61689f195ba 100644 --- a/src/components/ha-mount-picker.ts +++ b/src/components/ha-mount-picker.ts @@ -6,13 +6,13 @@ import { isComponentLoaded } from "../common/config/is_component_loaded"; import { fireEvent } from "../common/dom/fire_event"; import { stopPropagation } from "../common/dom/stop_propagation"; import { caseInsensitiveStringCompare } from "../common/string/compare"; +import type { SupervisorMounts } from "../data/supervisor/mounts"; import { fetchSupervisorMounts, - SupervisorMounts, SupervisorMountType, SupervisorMountUsage, } from "../data/supervisor/mounts"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-alert"; import "./ha-list-item"; import "./ha-select"; diff --git a/src/components/ha-multi-textfield.ts b/src/components/ha-multi-textfield.ts index 1988b46cc948..44d8863855b8 100644 --- a/src/components/ha-multi-textfield.ts +++ b/src/components/ha-multi-textfield.ts @@ -1,5 +1,6 @@ import { mdiDeleteOutline, mdiPlus } from "@mdi/js"; -import { CSSResultGroup, LitElement, css, html } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; import { haStyle } from "../resources/styles"; diff --git a/src/components/ha-navigation-list.ts b/src/components/ha-navigation-list.ts index 5b7b8ebed7dc..4b000bbcdc6b 100644 --- a/src/components/ha-navigation-list.ts +++ b/src/components/ha-navigation-list.ts @@ -1,5 +1,7 @@ -import { ActionDetail } from "@material/mwc-list/mwc-list"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import "@material/mwc-list/mwc-list"; +import type { ActionDetail } from "@material/mwc-list/mwc-list"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { navigate } from "../common/navigate"; diff --git a/src/components/ha-navigation-picker.ts b/src/components/ha-navigation-picker.ts index 105d052d0679..640a036067eb 100644 --- a/src/components/ha-navigation-picker.ts +++ b/src/components/ha-navigation-picker.ts @@ -1,12 +1,13 @@ import "@material/mwc-list/mwc-list-item"; -import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; -import { css, html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; import { titleCase } from "../common/string/title-case"; import { fetchConfig } from "../data/lovelace/config/types"; -import { LovelaceViewRawConfig } from "../data/lovelace/config/view"; -import { HomeAssistant, PanelInfo, ValueChangedEvent } from "../types"; +import type { LovelaceViewRawConfig } from "../data/lovelace/config/view"; +import type { HomeAssistant, PanelInfo, ValueChangedEvent } from "../types"; import "./ha-combo-box"; import type { HaComboBox } from "./ha-combo-box"; import "./ha-icon"; diff --git a/src/components/ha-network.ts b/src/components/ha-network.ts index b365cf3ba390..187a0b41f404 100644 --- a/src/components/ha-network.ts +++ b/src/components/ha-network.ts @@ -1,23 +1,17 @@ import { mdiStar } from "@mdi/js"; import "@lrnwebcomponents/simple-tooltip/simple-tooltip"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; -import { +import type { Adapter, IPv4ConfiguredAddress, IPv6ConfiguredAddress, NetworkConfig, } from "../data/network"; import { haStyle } from "../resources/styles"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-checkbox"; import type { HaCheckbox } from "./ha-checkbox"; import "./ha-settings-row"; diff --git a/src/components/ha-password-field.ts b/src/components/ha-password-field.ts index 6dc794992d6d..f149264fdb8a 100644 --- a/src/components/ha-password-field.ts +++ b/src/components/ha-password-field.ts @@ -1,4 +1,4 @@ -import { TextAreaCharCounter } from "@material/mwc-textfield/mwc-textfield-base"; +import type { TextAreaCharCounter } from "@material/mwc-textfield/mwc-textfield-base"; import { mdiEye, mdiEyeOff } from "@mdi/js"; import { LitElement, css, html } from "lit"; import { @@ -8,7 +8,7 @@ import { query, state, } from "lit/decorators"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-icon-button"; import "./ha-textfield"; import type { HaTextField } from "./ha-textfield"; diff --git a/src/components/ha-picture-upload.ts b/src/components/ha-picture-upload.ts index efb96c1eb239..b3ff842322ce 100644 --- a/src/components/ha-picture-upload.ts +++ b/src/components/ha-picture-upload.ts @@ -1,15 +1,14 @@ import { mdiImagePlus } from "@mdi/js"; -import { LitElement, TemplateResult, css, html } from "lit"; +import type { TemplateResult } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; import { haStyle } from "../resources/styles"; import { createImage, generateImageThumbnailUrl } from "../data/image_upload"; import { showAlertDialog } from "../dialogs/generic/show-dialog-box"; -import { - CropOptions, - showImageCropperDialog, -} from "../dialogs/image-cropper-dialog/show-image-cropper-dialog"; -import { HomeAssistant } from "../types"; +import type { CropOptions } from "../dialogs/image-cropper-dialog/show-image-cropper-dialog"; +import { showImageCropperDialog } from "../dialogs/image-cropper-dialog/show-image-cropper-dialog"; +import type { HomeAssistant } from "../types"; import "./ha-button"; import "./ha-circular-progress"; import "./ha-file-upload"; diff --git a/src/components/ha-push-notifications-toggle.ts b/src/components/ha-push-notifications-toggle.ts index 6c2380b310c0..98a9231b5c14 100644 --- a/src/components/ha-push-notifications-toggle.ts +++ b/src/components/ha-push-notifications-toggle.ts @@ -1,10 +1,12 @@ -import { LitElement, TemplateResult, html } from "lit"; +import type { TemplateResult } from "lit"; +import { LitElement, html } from "lit"; import { customElement, property, state } from "lit/decorators"; import { getAppKey } from "../data/notify_html5"; import { showPromptDialog } from "../dialogs/generic/show-dialog-box"; -import { HaSwitch } from "./ha-switch"; -import { HomeAssistant } from "../types"; +import type { HaSwitch } from "./ha-switch"; +import type { HomeAssistant } from "../types"; import { fireEvent } from "../common/dom/fire_event"; +import "./ha-switch"; export const pushSupported = "serviceWorker" in navigator && diff --git a/src/components/ha-qr-code.ts b/src/components/ha-qr-code.ts index ce9109e1ed1a..d5063a42f481 100644 --- a/src/components/ha-qr-code.ts +++ b/src/components/ha-qr-code.ts @@ -1,4 +1,5 @@ -import { LitElement, PropertyValues, css, html, nothing } from "lit"; +import type { PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import QRCode from "qrcode"; import "./ha-alert"; diff --git a/src/components/ha-qr-scanner.ts b/src/components/ha-qr-scanner.ts index b6fdef9e8984..b38d24ff7c0d 100644 --- a/src/components/ha-qr-scanner.ts +++ b/src/components/ha-qr-scanner.ts @@ -1,14 +1,15 @@ import "@material/mwc-button/mwc-button"; import { mdiCamera } from "@mdi/js"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, html, LitElement, nothing, PropertyValues } from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import type QrScanner from "qr-scanner"; import { fireEvent } from "../common/dom/fire_event"; import { stopPropagation } from "../common/dom/stop_propagation"; -import { LocalizeFunc } from "../common/translations/localize"; +import type { LocalizeFunc } from "../common/translations/localize"; import { addExternalBarCodeListener } from "../external_app/external_app_entrypoint"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-alert"; import "./ha-button-menu"; import "./ha-list-item"; diff --git a/src/components/ha-related-items.ts b/src/components/ha-related-items.ts index 2b4014337af1..c32ac07fb81f 100644 --- a/src/components/ha-related-items.ts +++ b/src/components/ha-related-items.ts @@ -5,24 +5,21 @@ import { mdiPaletteSwatch, mdiSofa, } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import memoizeOne from "memoize-one"; import { fireEvent } from "../common/dom/fire_event"; import { caseInsensitiveStringCompare } from "../common/string/compare"; -import { Blueprints, fetchBlueprints } from "../data/blueprint"; -import { ConfigEntry, getConfigEntries } from "../data/config_entries"; -import { ItemType, RelatedResult, findRelated } from "../data/search"; +import type { Blueprints } from "../data/blueprint"; +import { fetchBlueprints } from "../data/blueprint"; +import type { ConfigEntry } from "../data/config_entries"; +import { getConfigEntries } from "../data/config_entries"; +import type { ItemType, RelatedResult } from "../data/search"; +import { findRelated } from "../data/search"; import { haStyle } from "../resources/styles"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import { brandsUrl } from "../util/brands-url"; import "./ha-icon-next"; import "./ha-list-item"; diff --git a/src/components/ha-relative-time.ts b/src/components/ha-relative-time.ts index b638cf12438e..bb42612dd9ec 100644 --- a/src/components/ha-relative-time.ts +++ b/src/components/ha-relative-time.ts @@ -1,4 +1,5 @@ -import { PropertyValues, ReactiveElement } from "lit"; +import type { PropertyValues } from "lit"; +import { ReactiveElement } from "lit"; import { parseISO } from "date-fns"; import { customElement, property } from "lit/decorators"; import { relativeTime } from "../common/datetime/relative_time"; diff --git a/src/components/ha-selector/ha-selector-action.ts b/src/components/ha-selector/ha-selector-action.ts index 23d93a2a2999..90588aacb60e 100644 --- a/src/components/ha-selector/ha-selector-action.ts +++ b/src/components/ha-selector/ha-selector-action.ts @@ -1,10 +1,12 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; -import { Action, migrateAutomationAction } from "../../data/script"; -import { ActionSelector } from "../../data/selector"; +import type { Action } from "../../data/script"; +import { migrateAutomationAction } from "../../data/script"; +import type { ActionSelector } from "../../data/selector"; import "../../panels/config/automation/action/ha-automation-action"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; @customElement("ha-selector-action") export class HaActionSelector extends LitElement { @@ -32,7 +34,6 @@ export class HaActionSelector extends LitElement { .disabled=${this.disabled} .actions=${this._actions(this.value)} .hass=${this.hass} - .path=${this.selector.action?.path} > `; } diff --git a/src/components/ha-selector/ha-selector-addon.ts b/src/components/ha-selector/ha-selector-addon.ts index ef61da057539..8390c8748fac 100644 --- a/src/components/ha-selector/ha-selector-addon.ts +++ b/src/components/ha-selector/ha-selector-addon.ts @@ -1,7 +1,7 @@ import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; -import { AddonSelector } from "../../data/selector"; -import { HomeAssistant } from "../../types"; +import type { AddonSelector } from "../../data/selector"; +import type { HomeAssistant } from "../../types"; import "../ha-addon-picker"; @customElement("ha-selector-addon") diff --git a/src/components/ha-selector/ha-selector-area-filter.ts b/src/components/ha-selector/ha-selector-area-filter.ts index 460972b6390d..6237aec0ef33 100644 --- a/src/components/ha-selector/ha-selector-area-filter.ts +++ b/src/components/ha-selector/ha-selector-area-filter.ts @@ -1,7 +1,7 @@ import { LitElement, html } from "lit"; import { customElement, property } from "lit/decorators"; import type { AreaFilterSelector } from "../../data/selector"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import "../ha-area-filter"; @customElement("ha-selector-area_filter") diff --git a/src/components/ha-selector/ha-selector-area.ts b/src/components/ha-selector/ha-selector-area.ts index 47230ff88d11..1966214ab36c 100644 --- a/src/components/ha-selector/ha-selector-area.ts +++ b/src/components/ha-selector/ha-selector-area.ts @@ -1,22 +1,22 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { html, LitElement, PropertyValues, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { ensureArray } from "../../common/array/ensure-array"; import type { DeviceRegistryEntry } from "../../data/device_registry"; import { getDeviceIntegrationLookup } from "../../data/device_registry"; import { fireEvent } from "../../common/dom/fire_event"; -import { - EntitySources, - fetchEntitySourcesWithCache, -} from "../../data/entity_sources"; +import type { EntitySources } from "../../data/entity_sources"; +import { fetchEntitySourcesWithCache } from "../../data/entity_sources"; import type { AreaSelector } from "../../data/selector"; -import { ConfigEntry, getConfigEntries } from "../../data/config_entries"; +import type { ConfigEntry } from "../../data/config_entries"; +import { getConfigEntries } from "../../data/config_entries"; import { filterSelectorDevices, filterSelectorEntities, } from "../../data/selector"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import "../ha-area-picker"; import "../ha-areas-picker"; diff --git a/src/components/ha-selector/ha-selector-assist-pipeline.ts b/src/components/ha-selector/ha-selector-assist-pipeline.ts index c84d037769bd..0bcdac4b4d10 100644 --- a/src/components/ha-selector/ha-selector-assist-pipeline.ts +++ b/src/components/ha-selector/ha-selector-assist-pipeline.ts @@ -1,7 +1,7 @@ import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; -import { AssistPipelineSelector } from "../../data/selector"; -import { HomeAssistant } from "../../types"; +import type { AssistPipelineSelector } from "../../data/selector"; +import type { HomeAssistant } from "../../types"; import "../ha-assist-pipeline-picker"; @customElement("ha-selector-assist_pipeline") diff --git a/src/components/ha-selector/ha-selector-attribute.ts b/src/components/ha-selector/ha-selector-attribute.ts index 597792283c4b..5296bc4be4c6 100644 --- a/src/components/ha-selector/ha-selector-attribute.ts +++ b/src/components/ha-selector/ha-selector-attribute.ts @@ -1,8 +1,9 @@ -import { html, LitElement, PropertyValues } from "lit"; +import type { PropertyValues } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; -import { AttributeSelector } from "../../data/selector"; -import { HomeAssistant } from "../../types"; +import type { AttributeSelector } from "../../data/selector"; +import type { HomeAssistant } from "../../types"; import "../entity/ha-entity-attribute-picker"; @customElement("ha-selector-attribute") diff --git a/src/components/ha-selector/ha-selector-backup-location.ts b/src/components/ha-selector/ha-selector-backup-location.ts index 1499c642fc35..934a053f58ea 100644 --- a/src/components/ha-selector/ha-selector-backup-location.ts +++ b/src/components/ha-selector/ha-selector-backup-location.ts @@ -1,7 +1,7 @@ import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; -import { BackupLocationSelector } from "../../data/selector"; -import { HomeAssistant } from "../../types"; +import type { BackupLocationSelector } from "../../data/selector"; +import type { HomeAssistant } from "../../types"; import "../ha-mount-picker"; @customElement("ha-selector-backup_location") diff --git a/src/components/ha-selector/ha-selector-boolean.ts b/src/components/ha-selector/ha-selector-boolean.ts index 5bed88c7269a..94e7ca600f5e 100644 --- a/src/components/ha-selector/ha-selector-boolean.ts +++ b/src/components/ha-selector/ha-selector-boolean.ts @@ -1,7 +1,8 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import "../ha-formfield"; import "../ha-switch"; import "../ha-input-helper-text"; diff --git a/src/components/ha-selector/ha-selector-condition.ts b/src/components/ha-selector/ha-selector-condition.ts index 721cf265ade0..148c5461f104 100644 --- a/src/components/ha-selector/ha-selector-condition.ts +++ b/src/components/ha-selector/ha-selector-condition.ts @@ -1,9 +1,10 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; -import { Condition } from "../../data/automation"; -import { ConditionSelector } from "../../data/selector"; +import type { Condition } from "../../data/automation"; +import type { ConditionSelector } from "../../data/selector"; import "../../panels/config/automation/condition/ha-automation-condition"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; @customElement("ha-selector-condition") export class HaConditionSelector extends LitElement { @@ -24,7 +25,6 @@ export class HaConditionSelector extends LitElement { .disabled=${this.disabled} .conditions=${this.value || []} .hass=${this.hass} - .path=${this.selector.condition?.path} > `; } diff --git a/src/components/ha-selector/ha-selector-config-entry.ts b/src/components/ha-selector/ha-selector-config-entry.ts index 50ae91fc9103..daf9c8a90510 100644 --- a/src/components/ha-selector/ha-selector-config-entry.ts +++ b/src/components/ha-selector/ha-selector-config-entry.ts @@ -1,7 +1,7 @@ import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; -import { ConfigEntrySelector } from "../../data/selector"; -import { HomeAssistant } from "../../types"; +import type { ConfigEntrySelector } from "../../data/selector"; +import type { HomeAssistant } from "../../types"; import "../ha-config-entry-picker"; @customElement("ha-selector-config_entry") diff --git a/src/components/ha-selector/ha-selector-constant.ts b/src/components/ha-selector/ha-selector-constant.ts index 9ea7f1ec2e50..ed5acb6f3feb 100644 --- a/src/components/ha-selector/ha-selector-constant.ts +++ b/src/components/ha-selector/ha-selector-constant.ts @@ -1,6 +1,6 @@ import { LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; -import { ConstantSelector } from "../../data/selector"; +import type { ConstantSelector } from "../../data/selector"; @customElement("ha-selector-constant") export class HaSelectorConstant extends LitElement { diff --git a/src/components/ha-selector/ha-selector-conversation-agent.ts b/src/components/ha-selector/ha-selector-conversation-agent.ts index 8ff2d76f30d7..0c035cdbb351 100644 --- a/src/components/ha-selector/ha-selector-conversation-agent.ts +++ b/src/components/ha-selector/ha-selector-conversation-agent.ts @@ -1,7 +1,7 @@ import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; -import { ConversationAgentSelector } from "../../data/selector"; -import { HomeAssistant } from "../../types"; +import type { ConversationAgentSelector } from "../../data/selector"; +import type { HomeAssistant } from "../../types"; import "../ha-conversation-agent-picker"; @customElement("ha-selector-conversation_agent") diff --git a/src/components/ha-selector/ha-selector-country.ts b/src/components/ha-selector/ha-selector-country.ts index 85ba84d06741..277d16458bf8 100644 --- a/src/components/ha-selector/ha-selector-country.ts +++ b/src/components/ha-selector/ha-selector-country.ts @@ -1,7 +1,7 @@ import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; -import { CountrySelector } from "../../data/selector"; -import { HomeAssistant } from "../../types"; +import type { CountrySelector } from "../../data/selector"; +import type { HomeAssistant } from "../../types"; import "../ha-country-picker"; @customElement("ha-selector-country") diff --git a/src/components/ha-selector/ha-selector-device.ts b/src/components/ha-selector/ha-selector-device.ts index 0131b9b69854..0ae3ca0fc658 100644 --- a/src/components/ha-selector/ha-selector-device.ts +++ b/src/components/ha-selector/ha-selector-device.ts @@ -1,17 +1,17 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { html, LitElement, PropertyValues, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { ensureArray } from "../../common/array/ensure-array"; import { fireEvent } from "../../common/dom/fire_event"; import type { DeviceRegistryEntry } from "../../data/device_registry"; import { getDeviceIntegrationLookup } from "../../data/device_registry"; -import { - EntitySources, - fetchEntitySourcesWithCache, -} from "../../data/entity_sources"; +import type { EntitySources } from "../../data/entity_sources"; +import { fetchEntitySourcesWithCache } from "../../data/entity_sources"; import type { DeviceSelector } from "../../data/selector"; -import { ConfigEntry, getConfigEntries } from "../../data/config_entries"; +import type { ConfigEntry } from "../../data/config_entries"; +import { getConfigEntries } from "../../data/config_entries"; import { filterSelectorDevices, filterSelectorEntities, diff --git a/src/components/ha-selector/ha-selector-entity.ts b/src/components/ha-selector/ha-selector-entity.ts index b63e00884a4e..1aae4adf7803 100644 --- a/src/components/ha-selector/ha-selector-entity.ts +++ b/src/components/ha-selector/ha-selector-entity.ts @@ -1,18 +1,17 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { html, LitElement, PropertyValues, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { ensureArray } from "../../common/array/ensure-array"; import { fireEvent } from "../../common/dom/fire_event"; -import { - EntitySources, - fetchEntitySourcesWithCache, -} from "../../data/entity_sources"; +import type { EntitySources } from "../../data/entity_sources"; +import { fetchEntitySourcesWithCache } from "../../data/entity_sources"; import type { EntitySelector } from "../../data/selector"; import { filterSelectorEntities, computeCreateDomains, } from "../../data/selector"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import "../entity/ha-entities-picker"; import "../entity/ha-entity-picker"; diff --git a/src/components/ha-selector/ha-selector-file.ts b/src/components/ha-selector/ha-selector-file.ts index 3ae286581afa..21ce3bb5516b 100644 --- a/src/components/ha-selector/ha-selector-file.ts +++ b/src/components/ha-selector/ha-selector-file.ts @@ -1,11 +1,12 @@ import { mdiFile } from "@mdi/js"; -import { html, LitElement, PropertyValues } from "lit"; +import type { PropertyValues } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import { removeFile, uploadFile } from "../../data/file_upload"; -import { FileSelector } from "../../data/selector"; +import type { FileSelector } from "../../data/selector"; import { showAlertDialog } from "../../dialogs/generic/show-dialog-box"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import "../ha-file-upload"; @customElement("ha-selector-file") diff --git a/src/components/ha-selector/ha-selector-floor.ts b/src/components/ha-selector/ha-selector-floor.ts index 6d4d0d29c834..f756a774269a 100644 --- a/src/components/ha-selector/ha-selector-floor.ts +++ b/src/components/ha-selector/ha-selector-floor.ts @@ -1,22 +1,22 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { html, LitElement, PropertyValues, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { ensureArray } from "../../common/array/ensure-array"; import type { DeviceRegistryEntry } from "../../data/device_registry"; import { getDeviceIntegrationLookup } from "../../data/device_registry"; import { fireEvent } from "../../common/dom/fire_event"; -import { - EntitySources, - fetchEntitySourcesWithCache, -} from "../../data/entity_sources"; +import type { EntitySources } from "../../data/entity_sources"; +import { fetchEntitySourcesWithCache } from "../../data/entity_sources"; import type { FloorSelector } from "../../data/selector"; -import { ConfigEntry, getConfigEntries } from "../../data/config_entries"; +import type { ConfigEntry } from "../../data/config_entries"; +import { getConfigEntries } from "../../data/config_entries"; import { filterSelectorDevices, filterSelectorEntities, } from "../../data/selector"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import "../ha-floor-picker"; import "../ha-floors-picker"; diff --git a/src/components/ha-selector/ha-selector-icon.ts b/src/components/ha-selector/ha-selector-icon.ts index 3e517d61e48e..c325055911f5 100644 --- a/src/components/ha-selector/ha-selector-icon.ts +++ b/src/components/ha-selector/ha-selector-icon.ts @@ -3,8 +3,8 @@ import { customElement, property } from "lit/decorators"; import { until } from "lit/directives/until"; import { fireEvent } from "../../common/dom/fire_event"; import { entityIcon } from "../../data/icons"; -import { IconSelector } from "../../data/selector"; -import { HomeAssistant } from "../../types"; +import type { IconSelector } from "../../data/selector"; +import type { HomeAssistant } from "../../types"; import "../ha-icon-picker"; import "../ha-state-icon"; diff --git a/src/components/ha-selector/ha-selector-image.ts b/src/components/ha-selector/ha-selector-image.ts index ff337e88102f..382281e3774a 100644 --- a/src/components/ha-selector/ha-selector-image.ts +++ b/src/components/ha-selector/ha-selector-image.ts @@ -1,13 +1,15 @@ -import { css, CSSResultGroup, html, LitElement } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; -import { ImageSelector } from "../../data/selector"; -import { HomeAssistant } from "../../types"; +import type { ImageSelector } from "../../data/selector"; +import type { HomeAssistant } from "../../types"; import "../ha-icon-button"; import "../ha-textarea"; import "../ha-textfield"; import "../ha-picture-upload"; import "../ha-radio"; +import "../ha-formfield"; import type { HaPictureUpload } from "../ha-picture-upload"; import { URL_PREFIX } from "../../data/image_upload"; diff --git a/src/components/ha-selector/ha-selector-label.ts b/src/components/ha-selector/ha-selector-label.ts index f8a091769214..72a5d8ee57b0 100644 --- a/src/components/ha-selector/ha-selector-label.ts +++ b/src/components/ha-selector/ha-selector-label.ts @@ -1,9 +1,10 @@ -import { CSSResultGroup, LitElement, css, html } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, property } from "lit/decorators"; import { ensureArray } from "../../common/array/ensure-array"; import { fireEvent } from "../../common/dom/fire_event"; -import { LabelSelector } from "../../data/selector"; -import { HomeAssistant } from "../../types"; +import type { LabelSelector } from "../../data/selector"; +import type { HomeAssistant } from "../../types"; import "../ha-labels-picker"; @customElement("ha-selector-label") diff --git a/src/components/ha-selector/ha-selector-language.ts b/src/components/ha-selector/ha-selector-language.ts index a4f9727fb88c..361358a903a0 100644 --- a/src/components/ha-selector/ha-selector-language.ts +++ b/src/components/ha-selector/ha-selector-language.ts @@ -1,7 +1,7 @@ import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; -import { LanguageSelector } from "../../data/selector"; -import { HomeAssistant } from "../../types"; +import type { LanguageSelector } from "../../data/selector"; +import type { HomeAssistant } from "../../types"; import "../ha-language-picker"; @customElement("ha-selector-language") diff --git a/src/components/ha-selector/ha-selector-media.ts b/src/components/ha-selector/ha-selector-media.ts index 86fa91335d48..79b2b097e47d 100644 --- a/src/components/ha-selector/ha-selector-media.ts +++ b/src/components/ha-selector/ha-selector-media.ts @@ -1,13 +1,14 @@ import { mdiPlayBox, mdiPlus } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { fireEvent } from "../../common/dom/fire_event"; import { supportsFeature } from "../../common/entity/supports-feature"; import { getSignedPath } from "../../data/auth"; +import type { MediaPickedEvent } from "../../data/media-player"; import { MediaClassBrowserSettings, - MediaPickedEvent, MediaPlayerEntityFeature, } from "../../data/media-player"; import type { MediaSelector, MediaSelectorValue } from "../../data/selector"; diff --git a/src/components/ha-selector/ha-selector-navigation.ts b/src/components/ha-selector/ha-selector-navigation.ts index a3f61fc68dd1..437c6019a6c5 100644 --- a/src/components/ha-selector/ha-selector-navigation.ts +++ b/src/components/ha-selector/ha-selector-navigation.ts @@ -1,8 +1,8 @@ import { html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; -import { NavigationSelector } from "../../data/selector"; -import { HomeAssistant } from "../../types"; +import type { NavigationSelector } from "../../data/selector"; +import type { HomeAssistant } from "../../types"; import "../ha-navigation-picker"; @customElement("ha-selector-navigation") diff --git a/src/components/ha-selector/ha-selector-number.ts b/src/components/ha-selector/ha-selector-number.ts index 8949082cfbcc..760b0ffef80f 100644 --- a/src/components/ha-selector/ha-selector-number.ts +++ b/src/components/ha-selector/ha-selector-number.ts @@ -1,16 +1,10 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { fireEvent } from "../../common/dom/fire_event"; -import { NumberSelector } from "../../data/selector"; -import { HomeAssistant } from "../../types"; +import type { NumberSelector } from "../../data/selector"; +import type { HomeAssistant } from "../../types"; import "../ha-input-helper-text"; import "../ha-slider"; import "../ha-textfield"; diff --git a/src/components/ha-selector/ha-selector-object.ts b/src/components/ha-selector/ha-selector-object.ts index 55737e3ca2c2..e328112f35b6 100644 --- a/src/components/ha-selector/ha-selector-object.ts +++ b/src/components/ha-selector/ha-selector-object.ts @@ -1,7 +1,8 @@ -import { html, LitElement, PropertyValues } from "lit"; +import type { PropertyValues } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import "../ha-yaml-editor"; import "../ha-input-helper-text"; import type { HaYamlEditor } from "../ha-yaml-editor"; diff --git a/src/components/ha-selector/ha-selector-qr-code.ts b/src/components/ha-selector/ha-selector-qr-code.ts index 91361be7c0ef..daa8e1ad14c2 100644 --- a/src/components/ha-selector/ha-selector-qr-code.ts +++ b/src/components/ha-selector/ha-selector-qr-code.ts @@ -1,6 +1,6 @@ import { LitElement, css, html } from "lit"; import { customElement, property } from "lit/decorators"; -import { QRCodeSelector } from "../../data/selector"; +import type { QRCodeSelector } from "../../data/selector"; import "../ha-qr-code"; @customElement("ha-selector-qr_code") diff --git a/src/components/ha-selector/ha-selector-select.ts b/src/components/ha-selector/ha-selector-select.ts index 82ebf8bc1fe0..b32c02c6fd31 100644 --- a/src/components/ha-selector/ha-selector-select.ts +++ b/src/components/ha-selector/ha-selector-select.ts @@ -383,8 +383,13 @@ export class HaSelectSelector extends LitElement { return label.toLowerCase().includes(this._filter?.toLowerCase()); }); - if (this._filter && this.selector.select?.custom_value) { - filteredItems?.unshift({ label: this._filter, value: this._filter }); + if ( + this._filter && + this.selector.select?.custom_value && + filteredItems && + !filteredItems.some((item) => (item.label || item.value) === this._filter) + ) { + filteredItems.unshift({ label: this._filter, value: this._filter }); } this.comboBox.filteredItems = filteredItems; diff --git a/src/components/ha-selector/ha-selector-selector.ts b/src/components/ha-selector/ha-selector-selector.ts index 2602fc675daf..8d6887e09658 100644 --- a/src/components/ha-selector/ha-selector-selector.ts +++ b/src/components/ha-selector/ha-selector-selector.ts @@ -1,8 +1,12 @@ -import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../common/dom/fire_event"; -import { LocalizeFunc, LocalizeKeys } from "../../common/translations/localize"; +import type { + LocalizeFunc, + LocalizeKeys, +} from "../../common/translations/localize"; import type { HomeAssistant } from "../../types"; import "../ha-alert"; import "../ha-form/ha-form"; diff --git a/src/components/ha-selector/ha-selector-state.ts b/src/components/ha-selector/ha-selector-state.ts index e79259dcd68d..8350694a3358 100644 --- a/src/components/ha-selector/ha-selector-state.ts +++ b/src/components/ha-selector/ha-selector-state.ts @@ -1,8 +1,8 @@ import { html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; -import { StateSelector } from "../../data/selector"; +import type { StateSelector } from "../../data/selector"; import { SubscribeMixin } from "../../mixins/subscribe-mixin"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import "../entity/ha-entity-state-picker"; @customElement("ha-selector-state") diff --git a/src/components/ha-selector/ha-selector-statistic.ts b/src/components/ha-selector/ha-selector-statistic.ts index 078e75849e62..affc75107b1a 100644 --- a/src/components/ha-selector/ha-selector-statistic.ts +++ b/src/components/ha-selector/ha-selector-statistic.ts @@ -1,7 +1,7 @@ import { html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import type { StatisticSelector } from "../../data/selector"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import "../entity/ha-statistics-picker"; @customElement("ha-selector-statistic") diff --git a/src/components/ha-selector/ha-selector-stt.ts b/src/components/ha-selector/ha-selector-stt.ts index 03150da3da54..a21c9ef9f588 100644 --- a/src/components/ha-selector/ha-selector-stt.ts +++ b/src/components/ha-selector/ha-selector-stt.ts @@ -1,7 +1,7 @@ import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; -import { STTSelector } from "../../data/selector"; -import { HomeAssistant } from "../../types"; +import type { STTSelector } from "../../data/selector"; +import type { HomeAssistant } from "../../types"; import "../ha-stt-picker"; @customElement("ha-selector-stt") diff --git a/src/components/ha-selector/ha-selector-target.ts b/src/components/ha-selector/ha-selector-target.ts index 9faeaa21b087..613620342016 100644 --- a/src/components/ha-selector/ha-selector-target.ts +++ b/src/components/ha-selector/ha-selector-target.ts @@ -1,27 +1,20 @@ -import { HassEntity, HassServiceTarget } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { + HassEntity, + HassServiceTarget, +} from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { ensureArray } from "../../common/array/ensure-array"; -import { - DeviceRegistryEntry, - getDeviceIntegrationLookup, -} from "../../data/device_registry"; -import { - EntitySources, - fetchEntitySourcesWithCache, -} from "../../data/entity_sources"; +import type { DeviceRegistryEntry } from "../../data/device_registry"; +import { getDeviceIntegrationLookup } from "../../data/device_registry"; +import type { EntitySources } from "../../data/entity_sources"; +import { fetchEntitySourcesWithCache } from "../../data/entity_sources"; +import type { TargetSelector } from "../../data/selector"; import { filterSelectorDevices, filterSelectorEntities, - TargetSelector, computeCreateDomains, } from "../../data/selector"; import type { HomeAssistant } from "../../types"; diff --git a/src/components/ha-selector/ha-selector-template.ts b/src/components/ha-selector/ha-selector-template.ts index d9ea56fe242b..e729d160edb5 100644 --- a/src/components/ha-selector/ha-selector-template.ts +++ b/src/components/ha-selector/ha-selector-template.ts @@ -1,7 +1,7 @@ import { css, html, nothing, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import { documentationUrl } from "../../util/documentation-url"; import "../ha-code-editor"; import "../ha-input-helper-text"; diff --git a/src/components/ha-selector/ha-selector-text.ts b/src/components/ha-selector/ha-selector-text.ts index 8e76aa6bbdc3..ada813f6ac52 100644 --- a/src/components/ha-selector/ha-selector-text.ts +++ b/src/components/ha-selector/ha-selector-text.ts @@ -1,10 +1,11 @@ import { mdiEye, mdiEyeOff } from "@mdi/js"; -import { CSSResultGroup, LitElement, css, html } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, property, state } from "lit/decorators"; import { ensureArray } from "../../common/array/ensure-array"; import { fireEvent } from "../../common/dom/fire_event"; -import { StringSelector } from "../../data/selector"; -import { HomeAssistant } from "../../types"; +import type { StringSelector } from "../../data/selector"; +import type { HomeAssistant } from "../../types"; import "../ha-icon-button"; import "../ha-multi-textfield"; import "../ha-textarea"; diff --git a/src/components/ha-selector/ha-selector-time.ts b/src/components/ha-selector/ha-selector-time.ts index 1f15896d15ff..587540e28df3 100644 --- a/src/components/ha-selector/ha-selector-time.ts +++ b/src/components/ha-selector/ha-selector-time.ts @@ -1,7 +1,7 @@ import { html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; -import { TimeSelector } from "../../data/selector"; -import { HomeAssistant } from "../../types"; +import type { TimeSelector } from "../../data/selector"; +import type { HomeAssistant } from "../../types"; import "../ha-time-input"; @customElement("ha-selector-time") diff --git a/src/components/ha-selector/ha-selector-trigger.ts b/src/components/ha-selector/ha-selector-trigger.ts index 0974a31702cd..71378ff88924 100644 --- a/src/components/ha-selector/ha-selector-trigger.ts +++ b/src/components/ha-selector/ha-selector-trigger.ts @@ -1,10 +1,12 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; -import { migrateAutomationTrigger, Trigger } from "../../data/automation"; -import { TriggerSelector } from "../../data/selector"; +import type { Trigger } from "../../data/automation"; +import { migrateAutomationTrigger } from "../../data/automation"; +import type { TriggerSelector } from "../../data/selector"; import "../../panels/config/automation/trigger/ha-automation-trigger"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; @customElement("ha-selector-trigger") export class HaTriggerSelector extends LitElement { @@ -32,7 +34,6 @@ export class HaTriggerSelector extends LitElement { .disabled=${this.disabled} .triggers=${this._triggers(this.value)} .hass=${this.hass} - .path=${this.selector.trigger?.path} > `; } diff --git a/src/components/ha-selector/ha-selector-tts-voice.ts b/src/components/ha-selector/ha-selector-tts-voice.ts index e5a67c6ef4ed..b4aee1123a2e 100644 --- a/src/components/ha-selector/ha-selector-tts-voice.ts +++ b/src/components/ha-selector/ha-selector-tts-voice.ts @@ -1,7 +1,7 @@ import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; -import { TTSVoiceSelector } from "../../data/selector"; -import { HomeAssistant } from "../../types"; +import type { TTSVoiceSelector } from "../../data/selector"; +import type { HomeAssistant } from "../../types"; import "../ha-tts-voice-picker"; @customElement("ha-selector-tts_voice") diff --git a/src/components/ha-selector/ha-selector-tts.ts b/src/components/ha-selector/ha-selector-tts.ts index 9111047497a5..e23109b484e5 100644 --- a/src/components/ha-selector/ha-selector-tts.ts +++ b/src/components/ha-selector/ha-selector-tts.ts @@ -1,7 +1,7 @@ import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; -import { TTSSelector } from "../../data/selector"; -import { HomeAssistant } from "../../types"; +import type { TTSSelector } from "../../data/selector"; +import type { HomeAssistant } from "../../types"; import "../ha-tts-picker"; @customElement("ha-selector-tts") diff --git a/src/components/ha-selector/ha-selector-ui-action.ts b/src/components/ha-selector/ha-selector-ui-action.ts index b20cb6ed17d7..a0935eb7476b 100644 --- a/src/components/ha-selector/ha-selector-ui-action.ts +++ b/src/components/ha-selector/ha-selector-ui-action.ts @@ -1,10 +1,10 @@ import { html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; -import { ActionConfig } from "../../data/lovelace/config/action"; -import { UiActionSelector } from "../../data/selector"; +import type { ActionConfig } from "../../data/lovelace/config/action"; +import type { UiActionSelector } from "../../data/selector"; import "../../panels/lovelace/components/hui-action-editor"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; @customElement("ha-selector-ui_action") export class HaSelectorUiAction extends LitElement { diff --git a/src/components/ha-selector/ha-selector-ui-color.ts b/src/components/ha-selector/ha-selector-ui-color.ts index 7dfc86483641..c58e466cf581 100644 --- a/src/components/ha-selector/ha-selector-ui-color.ts +++ b/src/components/ha-selector/ha-selector-ui-color.ts @@ -1,9 +1,9 @@ import { html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; -import { UiColorSelector } from "../../data/selector"; +import type { UiColorSelector } from "../../data/selector"; import "../ha-color-picker"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; @customElement("ha-selector-ui_color") export class HaSelectorUiColor extends LitElement { diff --git a/src/components/ha-selector/ha-selector-ui-state-content.ts b/src/components/ha-selector/ha-selector-ui-state-content.ts index 179671e84f94..e17ef7369d2a 100644 --- a/src/components/ha-selector/ha-selector-ui-state-content.ts +++ b/src/components/ha-selector/ha-selector-ui-state-content.ts @@ -1,8 +1,8 @@ import { html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; -import { UiStateContentSelector } from "../../data/selector"; +import type { UiStateContentSelector } from "../../data/selector"; import { SubscribeMixin } from "../../mixins/subscribe-mixin"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import "../entity/ha-entity-state-content-picker"; @customElement("ha-selector-ui_state_content") diff --git a/src/components/ha-selector/ha-selector.ts b/src/components/ha-selector/ha-selector.ts index 11a9136abccf..a41b602b4d64 100644 --- a/src/components/ha-selector/ha-selector.ts +++ b/src/components/ha-selector/ha-selector.ts @@ -1,11 +1,12 @@ -import { html, LitElement, PropertyValues } from "lit"; +import type { PropertyValues } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; import { dynamicElement } from "../../common/dom/dynamic-element-directive"; +import type { Selector } from "../../data/selector"; import { handleLegacyDeviceSelector, handleLegacyEntitySelector, - Selector, } from "../../data/selector"; import type { HomeAssistant } from "../../types"; diff --git a/src/components/ha-service-control.ts b/src/components/ha-service-control.ts index 32f25e702422..3265b2940806 100644 --- a/src/components/ha-service-control.ts +++ b/src/components/ha-service-control.ts @@ -1,17 +1,11 @@ import { mdiHelpCircle } from "@mdi/js"; -import { +import type { HassService, HassServices, HassServiceTarget, } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { ensureArray } from "../common/array/ensure-array"; @@ -19,10 +13,9 @@ import { fireEvent } from "../common/dom/fire_event"; import { computeDomain } from "../common/entity/compute_domain"; import { computeObjectId } from "../common/entity/compute_object_id"; import { supportsFeature } from "../common/entity/supports-feature"; -import { nestedArrayMove } from "../common/util/array-move"; import { fetchIntegrationManifest, - IntegrationManifest, + type IntegrationManifest, } from "../data/integration"; import { areaMeetsTargetSelector, @@ -32,10 +25,10 @@ import { expandDeviceTarget, expandFloorTarget, expandLabelTarget, - Selector, - TargetSelector, + type Selector, + type TargetSelector, } from "../data/selector"; -import { HomeAssistant, ValueChangedEvent } from "../types"; +import type { HomeAssistant, ValueChangedEvent } from "../types"; import { documentationUrl } from "../util/documentation-url"; import "./ha-checkbox"; import "./ha-icon-button"; @@ -597,15 +590,6 @@ export class HaServiceControl extends LitElement { } const selector = dataField?.selector ?? { text: undefined }; - const type = Object.keys(selector)[0]; - const enhancedSelector = ["action", "condition", "trigger"].includes(type) - ? { - [type]: { - ...selector[type], - path: [dataField.key], - }, - } - : selector; const showOptional = showOptionalToggle(dataField); @@ -646,7 +630,7 @@ export class HaServiceControl extends LitElement { (!this._value?.data || this._value.data[dataField.key] === undefined))} .hass=${this.hass} - .selector=${enhancedSelector} + .selector=${selector} .key=${dataField.key} @value-changed=${this._serviceDataChanged} .value=${this._value?.data @@ -654,7 +638,6 @@ export class HaServiceControl extends LitElement { : undefined} .placeholder=${dataField.default} .localizeValue=${this._localizeValueCallback} - @item-moved=${this._itemMoved} > ` : ""; @@ -856,22 +839,6 @@ export class HaServiceControl extends LitElement { }); } - private _itemMoved(ev) { - ev.stopPropagation(); - const { oldIndex, newIndex, oldPath, newPath } = ev.detail; - - const data = this.value?.data ?? {}; - - const newData = nestedArrayMove(data, oldIndex, newIndex, oldPath, newPath); - - fireEvent(this, "value-changed", { - value: { - ...this.value, - data: newData, - }, - }); - } - private _dataChanged(ev: CustomEvent) { ev.stopPropagation(); if (!ev.detail.isValid) { diff --git a/src/components/ha-service-icon.ts b/src/components/ha-service-icon.ts index 663043639edb..54d723acdbbf 100644 --- a/src/components/ha-service-icon.ts +++ b/src/components/ha-service-icon.ts @@ -4,7 +4,7 @@ import { until } from "lit/directives/until"; import { DEFAULT_SERVICE_ICON, FIXED_DOMAIN_ICONS } from "../common/const"; import { computeDomain } from "../common/entity/compute_domain"; import { serviceIcon } from "../data/icons"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-icon"; import "./ha-svg-icon"; diff --git a/src/components/ha-service-picker.ts b/src/components/ha-service-picker.ts index 72cd6c2d21f8..848dde391cbb 100644 --- a/src/components/ha-service-picker.ts +++ b/src/components/ha-service-picker.ts @@ -1,11 +1,11 @@ -import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; +import type { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; import { html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../common/dom/fire_event"; -import { LocalizeFunc } from "../common/translations/localize"; +import type { LocalizeFunc } from "../common/translations/localize"; import { domainToName } from "../data/integration"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-combo-box"; import "./ha-list-item"; import "./ha-service-icon"; diff --git a/src/components/ha-service-section-icon.ts b/src/components/ha-service-section-icon.ts index f8c7fdfbbe23..905d9ab5cb62 100644 --- a/src/components/ha-service-section-icon.ts +++ b/src/components/ha-service-section-icon.ts @@ -1,7 +1,7 @@ import { html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { until } from "lit/directives/until"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-icon"; import "./ha-svg-icon"; import { serviceSectionIcon } from "../data/icons"; diff --git a/src/components/ha-settings-row.ts b/src/components/ha-settings-row.ts index e58bc1f41610..648c4eaf9b91 100644 --- a/src/components/ha-settings-row.ts +++ b/src/components/ha-settings-row.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; @customElement("ha-settings-row") diff --git a/src/components/ha-sidebar.ts b/src/components/ha-sidebar.ts index 750076b5f2dd..1d1166050a6e 100644 --- a/src/components/ha-sidebar.ts +++ b/src/components/ha-sidebar.ts @@ -21,16 +21,9 @@ import "@polymer/paper-item/paper-icon-item"; import type { PaperIconItemElement } from "@polymer/paper-item/paper-icon-item"; import "@polymer/paper-item/paper-item"; import "@polymer/paper-listbox/paper-listbox"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - CSSResult, - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResult, CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, eventOptions, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; @@ -39,13 +32,12 @@ import { fireEvent } from "../common/dom/fire_event"; import { toggleAttribute } from "../common/dom/toggle_attribute"; import { stringCompare } from "../common/string/compare"; import { throttle } from "../common/util/throttle"; -import { ActionHandlerDetail } from "../data/lovelace/action_handler"; -import { - PersistentNotification, - subscribeNotifications, -} from "../data/persistent_notification"; +import type { ActionHandlerDetail } from "../data/lovelace/action_handler"; +import type { PersistentNotification } from "../data/persistent_notification"; +import { subscribeNotifications } from "../data/persistent_notification"; import { subscribeRepairsIssueRegistry } from "../data/repairs"; -import { UpdateEntity, updateCanInstall } from "../data/update"; +import type { UpdateEntity } from "../data/update"; +import { updateCanInstall } from "../data/update"; import { SubscribeMixin } from "../mixins/subscribe-mixin"; import { actionHandler } from "../panels/lovelace/common/directives/action-handler-directive"; import { haStyleScrollbar } from "../resources/styles"; diff --git a/src/components/ha-sortable.ts b/src/components/ha-sortable.ts index 8d784445ad70..2dc997440020 100644 --- a/src/components/ha-sortable.ts +++ b/src/components/ha-sortable.ts @@ -1,18 +1,23 @@ /* eslint-disable lit/prefer-static-styles */ -import { html, LitElement, nothing, PropertyValues } from "lit"; +import type { PropertyValues } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import type { SortableEvent } from "sortablejs"; import { fireEvent } from "../common/dom/fire_event"; import type { SortableInstance } from "../resources/sortable"; -import { ItemPath } from "../types"; declare global { interface HASSDomEvents { "item-moved": { oldIndex: number; newIndex: number; - oldPath?: ItemPath; - newPath?: ItemPath; + }; + "item-added": { + index: number; + data: any; + }; + "item-removed": { + index: number; }; "drag-start": undefined; "drag-end": undefined; @@ -21,7 +26,7 @@ declare global { export type HaSortableOptions = Omit< SortableInstance.SortableOptions, - "onStart" | "onChoose" | "onEnd" + "onStart" | "onChoose" | "onEnd" | "onUpdate" | "onAdd" | "onRemove" >; @customElement("ha-sortable") @@ -31,9 +36,6 @@ export class HaSortable extends LitElement { @property({ type: Boolean }) public disabled = false; - @property({ type: Array }) - public path?: ItemPath; - @property({ type: Boolean, attribute: "no-style" }) public noStyle: boolean = false; @@ -138,6 +140,9 @@ export class HaSortable extends LitElement { onChoose: this._handleChoose, onStart: this._handleStart, onEnd: this._handleEnd, + onUpdate: this._handleUpdate, + onAdd: this._handleAdd, + onRemove: this._handleRemove, }; if (this.draggableSelector) { @@ -159,33 +164,31 @@ export class HaSortable extends LitElement { this._sortable = new Sortable(container, options); } - private _handleEnd = async (evt: SortableEvent) => { + private _handleUpdate = (evt) => { + fireEvent(this, "item-moved", { + newIndex: evt.newIndex, + oldIndex: evt.oldIndex, + }); + }; + + private _handleAdd = (evt) => { + fireEvent(this, "item-added", { + index: evt.newIndex, + data: evt.item.sortableData, + }); + }; + + private _handleRemove = (evt) => { + fireEvent(this, "item-removed", { index: evt.oldIndex }); + }; + + private _handleEnd = async (evt) => { fireEvent(this, "drag-end"); // put back in original location if (this.rollback && (evt.item as any).placeholder) { (evt.item as any).placeholder.replaceWith(evt.item); delete (evt.item as any).placeholder; } - - const oldIndex = evt.oldIndex; - const oldPath = (evt.from.parentElement as HaSortable).path; - const newIndex = evt.newIndex; - const newPath = (evt.to.parentElement as HaSortable).path; - - if ( - oldIndex === undefined || - newIndex === undefined || - (oldIndex === newIndex && oldPath?.join(".") === newPath?.join(".")) - ) { - return; - } - - fireEvent(this, "item-moved", { - oldIndex, - newIndex, - oldPath, - newPath, - }); }; private _handleStart = () => { diff --git a/src/components/ha-state-icon.ts b/src/components/ha-state-icon.ts index aa6371ec706b..41421db68fb5 100644 --- a/src/components/ha-state-icon.ts +++ b/src/components/ha-state-icon.ts @@ -1,11 +1,11 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { until } from "lit/directives/until"; import { DEFAULT_DOMAIN_ICON, FIXED_DOMAIN_ICONS } from "../common/const"; import { computeStateDomain } from "../common/entity/compute_state_domain"; import { entityIcon } from "../data/icons"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-icon"; import "./ha-svg-icon"; diff --git a/src/components/ha-stt-picker.ts b/src/components/ha-stt-picker.ts index d4b87e1cc751..47ce2ca6b18f 100644 --- a/src/components/ha-stt-picker.ts +++ b/src/components/ha-stt-picker.ts @@ -1,18 +1,13 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; import { stopPropagation } from "../common/dom/stop_propagation"; import { computeStateName } from "../common/entity/compute_state_name"; import { debounce } from "../common/util/debounce"; -import { listSTTEngines, STTEngine } from "../data/stt"; -import { HomeAssistant } from "../types"; +import type { STTEngine } from "../data/stt"; +import { listSTTEngines } from "../data/stt"; +import type { HomeAssistant } from "../types"; import "./ha-list-item"; import "./ha-select"; import type { HaSelect } from "./ha-select"; diff --git a/src/components/ha-svg-icon.ts b/src/components/ha-svg-icon.ts index 2c9405e9e2f2..a6d0e1c2f265 100644 --- a/src/components/ha-svg-icon.ts +++ b/src/components/ha-svg-icon.ts @@ -1,11 +1,5 @@ -import { - css, - CSSResultGroup, - LitElement, - nothing, - svg, - SVGTemplateResult, -} from "lit"; +import type { CSSResultGroup, SVGTemplateResult } from "lit"; +import { css, LitElement, nothing, svg } from "lit"; import { customElement, property } from "lit/decorators"; @customElement("ha-svg-icon") diff --git a/src/components/ha-tab.ts b/src/components/ha-tab.ts index 77a4b777d940..89419a740b44 100644 --- a/src/components/ha-tab.ts +++ b/src/components/ha-tab.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import "./ha-ripple"; diff --git a/src/components/ha-tabs.ts b/src/components/ha-tabs.ts index 887bbc231ac0..c7abfda56943 100644 --- a/src/components/ha-tabs.ts +++ b/src/components/ha-tabs.ts @@ -3,7 +3,7 @@ import type { PaperTabElement } from "@polymer/paper-tabs/paper-tab"; import "@polymer/paper-tabs/paper-tabs"; import type { PaperTabsElement } from "@polymer/paper-tabs/paper-tabs"; import { customElement } from "lit/decorators"; -import { Constructor } from "../types"; +import type { Constructor } from "../types"; const PaperTabs = customElements.get( "paper-tabs" diff --git a/src/components/ha-target-picker.ts b/src/components/ha-target-picker.ts index 527de786acd9..460e8740dac6 100644 --- a/src/components/ha-target-picker.ts +++ b/src/components/ha-target-picker.ts @@ -12,13 +12,14 @@ import { mdiTextureBox, mdiUnfoldMoreVertical, } from "@mdi/js"; -import { ComboBoxLightOpenedChangedEvent } from "@vaadin/combo-box/vaadin-combo-box-light"; -import { +import type { ComboBoxLightOpenedChangedEvent } from "@vaadin/combo-box/vaadin-combo-box-light"; +import type { HassEntity, HassServiceTarget, UnsubscribeFunc, } from "home-assistant-js-websocket"; -import { CSSResultGroup, LitElement, css, html, nothing, unsafeCSS } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing, unsafeCSS } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { ensureArray } from "../common/array/ensure-array"; @@ -29,18 +30,14 @@ import { stopPropagation } from "../common/dom/stop_propagation"; import { computeDomain } from "../common/entity/compute_domain"; import { computeStateName } from "../common/entity/compute_state_name"; import { isValidEntityId } from "../common/entity/valid_entity_id"; -import { AreaRegistryEntry } from "../data/area_registry"; -import { - DeviceRegistryEntry, - computeDeviceName, -} from "../data/device_registry"; -import { EntityRegistryDisplayEntry } from "../data/entity_registry"; -import { - LabelRegistryEntry, - subscribeLabelRegistry, -} from "../data/label_registry"; +import type { AreaRegistryEntry } from "../data/area_registry"; +import type { DeviceRegistryEntry } from "../data/device_registry"; +import { computeDeviceName } from "../data/device_registry"; +import type { EntityRegistryDisplayEntry } from "../data/entity_registry"; +import type { LabelRegistryEntry } from "../data/label_registry"; +import { subscribeLabelRegistry } from "../data/label_registry"; import { SubscribeMixin } from "../mixins/subscribe-mixin"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./device/ha-device-picker"; import type { HaDevicePickerDeviceFilterFunc } from "./device/ha-device-picker"; import "./entity/ha-entity-picker"; diff --git a/src/components/ha-textarea.ts b/src/components/ha-textarea.ts index 0fef6fe5a0b3..7d10e3800d05 100644 --- a/src/components/ha-textarea.ts +++ b/src/components/ha-textarea.ts @@ -1,7 +1,8 @@ import { TextAreaBase } from "@material/mwc-textarea/mwc-textarea-base"; import { styles as textfieldStyles } from "@material/mwc-textfield/mwc-textfield.css"; import { styles as textareaStyles } from "@material/mwc-textarea/mwc-textarea.css"; -import { css, PropertyValues } from "lit"; +import type { PropertyValues } from "lit"; +import { css } from "lit"; import { customElement, property } from "lit/decorators"; @customElement("ha-textarea") diff --git a/src/components/ha-textfield.ts b/src/components/ha-textfield.ts index 4b2df4c09fea..5e68bed7a1e0 100644 --- a/src/components/ha-textfield.ts +++ b/src/components/ha-textfield.ts @@ -1,6 +1,7 @@ import { TextFieldBase } from "@material/mwc-textfield/mwc-textfield-base"; import { styles } from "@material/mwc-textfield/mwc-textfield.css"; -import { TemplateResult, html, PropertyValues, css } from "lit"; +import type { TemplateResult, PropertyValues } from "lit"; +import { html, css } from "lit"; import { customElement, property, query } from "lit/decorators"; import { mainWindow } from "../common/dom/get_main_window"; diff --git a/src/components/ha-theme-picker.ts b/src/components/ha-theme-picker.ts index 425b1a7227c6..91d0ffccff07 100644 --- a/src/components/ha-theme-picker.ts +++ b/src/components/ha-theme-picker.ts @@ -1,16 +1,10 @@ import "@material/mwc-list/mwc-list-item"; -import { - css, - CSSResultGroup, - html, - nothing, - LitElement, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, nothing, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; import { stopPropagation } from "../common/dom/stop_propagation"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-select"; const DEFAULT_THEME = "default"; diff --git a/src/components/ha-time-input.ts b/src/components/ha-time-input.ts index 696dbef4aac5..7d5508296000 100644 --- a/src/components/ha-time-input.ts +++ b/src/components/ha-time-input.ts @@ -2,7 +2,7 @@ import { html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { useAmPm } from "../common/datetime/use_am_pm"; import { fireEvent } from "../common/dom/fire_event"; -import { FrontendLocaleData } from "../data/translation"; +import type { FrontendLocaleData } from "../data/translation"; import "./ha-base-time-input"; import type { TimeChangedEvent } from "./ha-base-time-input"; diff --git a/src/components/ha-timezone-picker.ts b/src/components/ha-timezone-picker.ts index 8388f8ac8ce0..88ffdabab051 100644 --- a/src/components/ha-timezone-picker.ts +++ b/src/components/ha-timezone-picker.ts @@ -1,5 +1,6 @@ import timezones from "google-timezones-json"; -import { css, CSSResultGroup, html, LitElement } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; import { stopPropagation } from "../common/dom/stop_propagation"; diff --git a/src/components/ha-tip.ts b/src/components/ha-tip.ts index 3448882db360..8962543ba515 100644 --- a/src/components/ha-tip.ts +++ b/src/components/ha-tip.ts @@ -1,7 +1,7 @@ import { mdiLightbulbOutline } from "@mdi/js"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-svg-icon"; diff --git a/src/components/ha-tree-indicator.ts b/src/components/ha-tree-indicator.ts index 5912d7650c7b..a0a10ce85698 100644 --- a/src/components/ha-tree-indicator.ts +++ b/src/components/ha-tree-indicator.ts @@ -1,4 +1,5 @@ -import { LitElement, TemplateResult, css, html } from "lit"; +import type { TemplateResult } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, property } from "lit/decorators"; @customElement("ha-tree-indicator") diff --git a/src/components/ha-tts-picker.ts b/src/components/ha-tts-picker.ts index 90bca8bf891f..37867ef08b24 100644 --- a/src/components/ha-tts-picker.ts +++ b/src/components/ha-tts-picker.ts @@ -1,18 +1,13 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; import { stopPropagation } from "../common/dom/stop_propagation"; import { computeStateName } from "../common/entity/compute_state_name"; import { debounce } from "../common/util/debounce"; -import { listTTSEngines, TTSEngine } from "../data/tts"; -import { HomeAssistant } from "../types"; +import type { TTSEngine } from "../data/tts"; +import { listTTSEngines } from "../data/tts"; +import type { HomeAssistant } from "../types"; import "./ha-list-item"; import "./ha-select"; import type { HaSelect } from "./ha-select"; diff --git a/src/components/ha-tts-voice-picker.ts b/src/components/ha-tts-voice-picker.ts index cfea9c3c5c24..e3c1ce53f467 100644 --- a/src/components/ha-tts-voice-picker.ts +++ b/src/components/ha-tts-voice-picker.ts @@ -1,17 +1,12 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; import { stopPropagation } from "../common/dom/stop_propagation"; import { debounce } from "../common/util/debounce"; -import { listTTSVoices, TTSVoice } from "../data/tts"; -import { HomeAssistant } from "../types"; +import type { TTSVoice } from "../data/tts"; +import { listTTSVoices } from "../data/tts"; +import type { HomeAssistant } from "../types"; import "./ha-list-item"; import "./ha-select"; import type { HaSelect } from "./ha-select"; diff --git a/src/components/ha-two-pane-top-app-bar-fixed.ts b/src/components/ha-two-pane-top-app-bar-fixed.ts index 0c5e1eddd804..eeb71a8e6c0b 100644 --- a/src/components/ha-two-pane-top-app-bar-fixed.ts +++ b/src/components/ha-two-pane-top-app-bar-fixed.ts @@ -3,7 +3,7 @@ import { BaseElement, } from "@material/mwc-base/base-element"; import { supportsPassiveEventListener } from "@material/mwc-base/utils"; -import { MDCTopAppBarAdapter } from "@material/top-app-bar/adapter"; +import type { MDCTopAppBarAdapter } from "@material/top-app-bar/adapter"; import { strings } from "@material/top-app-bar/constants"; import MDCFixedTopAppBarFoundation from "@material/top-app-bar/fixed/foundation"; import { html, css, nothing } from "lit"; diff --git a/src/components/ha-vacuum-state.ts b/src/components/ha-vacuum-state.ts index 52c93b4a174b..bd77997afe58 100644 --- a/src/components/ha-vacuum-state.ts +++ b/src/components/ha-vacuum-state.ts @@ -1,9 +1,10 @@ import "@material/mwc-button"; -import { CSSResultGroup, LitElement, TemplateResult, css, html } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, property } from "lit/decorators"; -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { haStyle } from "../resources/styles"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; const STATES_INTERCEPTABLE: { [state: string]: { diff --git a/src/components/ha-valve-controls.ts b/src/components/ha-valve-controls.ts index ae3779595120..cb58d82c69d0 100644 --- a/src/components/ha-valve-controls.ts +++ b/src/components/ha-valve-controls.ts @@ -1,15 +1,11 @@ import { mdiStop, mdiValveClosed, mdiValveOpen } from "@mdi/js"; -import { CSSResultGroup, LitElement, html, css, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, html, css, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { supportsFeature } from "../common/entity/supports-feature"; -import { - ValveEntity, - ValveEntityFeature, - canClose, - canOpen, - canStop, -} from "../data/valve"; +import type { ValveEntity } from "../data/valve"; +import { ValveEntityFeature, canClose, canOpen, canStop } from "../data/valve"; import type { HomeAssistant } from "../types"; import "./ha-icon-button"; diff --git a/src/components/ha-water_heater-state.ts b/src/components/ha-water_heater-state.ts index 2f47190147b1..43a81faf5148 100644 --- a/src/components/ha-water_heater-state.ts +++ b/src/components/ha-water_heater-state.ts @@ -1,9 +1,10 @@ import { customElement, property } from "lit/decorators"; -import { CSSResultGroup, LitElement, TemplateResult, css, html } from "lit"; -import { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { LitElement, css, html } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; import { formatNumber } from "../common/number/format_number"; import { haStyle } from "../resources/styles"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; @customElement("ha-water_heater-state") export class HaWaterHeaterState extends LitElement { diff --git a/src/components/ha-web-rtc-player.ts b/src/components/ha-web-rtc-player.ts index a2ae49e47299..b2467e28045b 100644 --- a/src/components/ha-web-rtc-player.ts +++ b/src/components/ha-web-rtc-player.ts @@ -1,23 +1,17 @@ /* eslint-disable no-console */ -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import { css, html, LitElement } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { fireEvent } from "../common/dom/fire_event"; import { addWebRtcCandidate, fetchWebRtcClientConfiguration, - WebRtcAnswer, - WebRTCClientConfiguration, + type WebRtcAnswer, + type WebRTCClientConfiguration, webRtcOffer, - WebRtcOfferEvent, + type WebRtcOfferEvent, } from "../data/camera"; import type { HomeAssistant } from "../types"; import "./ha-alert"; @@ -103,6 +97,13 @@ class HaWebRtcPlayer extends LitElement { private async _startWebRtc(): Promise { this._cleanUp(); + // Browser support required for WebRTC + if (typeof RTCPeerConnection === "undefined") { + this._error = "WebRTC is not supported in this browser"; + fireEvent(this, "streams", { hasAudio: false, hasVideo: false }); + return; + } + if (!this.hass || !this.entityid) { return; } @@ -379,11 +380,17 @@ class HaWebRtcPlayer extends LitElement { } private _loadedData() { - // @ts-ignore - fireEvent(this, "load"); - console.timeLog("WebRTC", "loadedData"); console.timeEnd("WebRTC"); + + const video = this._videoEl; + const stream = video.srcObject as MediaStream; + + fireEvent(this, "load"); + fireEvent(this, "streams", { + hasAudio: Boolean(stream?.getAudioTracks().length), + hasVideo: Boolean(stream?.getVideoTracks().length), + }); } static get styles(): CSSResultGroup { diff --git a/src/components/ha-yaml-editor.ts b/src/components/ha-yaml-editor.ts index 4782b4463702..a08a1f49a791 100644 --- a/src/components/ha-yaml-editor.ts +++ b/src/components/ha-yaml-editor.ts @@ -1,12 +1,7 @@ -import { DEFAULT_SCHEMA, dump, load, Schema } from "js-yaml"; -import { - CSSResultGroup, - css, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { Schema } from "js-yaml"; +import { DEFAULT_SCHEMA, dump, load } from "js-yaml"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; import type { HomeAssistant } from "../types"; diff --git a/src/components/map/ha-locations-editor.ts b/src/components/map/ha-locations-editor.ts index db80ec76a920..521793b594de 100644 --- a/src/components/map/ha-locations-editor.ts +++ b/src/components/map/ha-locations-editor.ts @@ -7,14 +7,8 @@ import type { Marker, MarkerOptions, } from "leaflet"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../common/dom/fire_event"; @@ -23,8 +17,8 @@ import type { HomeAssistant, ThemeMode } from "../../types"; import "../ha-input-helper-text"; import "./ha-map"; import type { HaMap } from "./ha-map"; -import { HaIcon } from "../ha-icon"; -import { HaSvgIcon } from "../ha-svg-icon"; +import type { HaIcon } from "../ha-icon"; +import type { HaSvgIcon } from "../ha-svg-icon"; declare global { // for fire event diff --git a/src/components/map/ha-map.ts b/src/components/map/ha-map.ts index 929114dee9e6..e4777b970e97 100644 --- a/src/components/map/ha-map.ts +++ b/src/components/map/ha-map.ts @@ -9,20 +9,19 @@ import type { Marker, Polyline, } from "leaflet"; -import { CSSResultGroup, PropertyValues, ReactiveElement, css } from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { ReactiveElement, css } from "lit"; import { customElement, property, state } from "lit/decorators"; import { formatDateTime } from "../../common/datetime/format_date_time"; import { formatTimeWeekday, formatTimeWithSeconds, } from "../../common/datetime/format_time"; -import { - LeafletModuleType, - setupLeafletMap, -} from "../../common/dom/setup-leaflet-map"; +import type { LeafletModuleType } from "../../common/dom/setup-leaflet-map"; +import { setupLeafletMap } from "../../common/dom/setup-leaflet-map"; import { computeStateDomain } from "../../common/entity/compute_state_domain"; import { computeStateName } from "../../common/entity/compute_state_name"; -import { HomeAssistant, ThemeMode } from "../../types"; +import type { HomeAssistant, ThemeMode } from "../../types"; import { isTouch } from "../../util/is_touch"; import "../ha-icon-button"; import "./ha-entity-marker"; diff --git a/src/components/media-player/dialog-media-manage.ts b/src/components/media-player/dialog-media-manage.ts index 3822d27591ed..ea3341d2f2ae 100644 --- a/src/components/media-player/dialog-media-manage.ts +++ b/src/components/media-player/dialog-media-manage.ts @@ -2,15 +2,14 @@ import { animate } from "@lit-labs/motion"; import "@material/mwc-list/mwc-list"; import "@material/mwc-list/mwc-list-item"; import { mdiClose, mdiDelete } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { repeat } from "lit/directives/repeat"; import { fireEvent } from "../../common/dom/fire_event"; import { computeRTLDirection } from "../../common/util/compute_rtl"; -import { - MediaClassBrowserSettings, - MediaPlayerItem, -} from "../../data/media-player"; +import type { MediaPlayerItem } from "../../data/media-player"; +import { MediaClassBrowserSettings } from "../../data/media-player"; import { browseLocalMediaPlayer, removeLocalMedia, diff --git a/src/components/media-player/dialog-media-player-browse.ts b/src/components/media-player/dialog-media-player-browse.ts index e0a66ae79c2b..93aa4d39d08d 100644 --- a/src/components/media-player/dialog-media-player-browse.ts +++ b/src/components/media-player/dialog-media-player-browse.ts @@ -1,4 +1,4 @@ -import { ActionDetail } from "@material/mwc-list"; +import type { ActionDetail } from "@material/mwc-list"; import { mdiAlphaABoxOutline, mdiArrowLeft, @@ -7,9 +7,11 @@ import { mdiGrid, mdiListBoxOutline, } from "@mdi/js"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; -import { HASSDomEvent, fireEvent } from "../../common/dom/fire_event"; +import type { HASSDomEvent } from "../../common/dom/fire_event"; +import { fireEvent } from "../../common/dom/fire_event"; import type { MediaPickedEvent, MediaPlayerBrowseAction, @@ -26,7 +28,7 @@ import type { HaMediaPlayerBrowse, MediaPlayerItemId, } from "./ha-media-player-browse"; -import { MediaPlayerBrowseDialogParams } from "./show-media-browser-dialog"; +import type { MediaPlayerBrowseDialogParams } from "./show-media-browser-dialog"; import { stopPropagation } from "../../common/dom/stop_propagation"; @customElement("dialog-media-player-browse") diff --git a/src/components/media-player/ha-browse-media-tts.ts b/src/components/media-player/ha-browse-media-tts.ts index 52a43d04d073..8466b633cb9a 100644 --- a/src/components/media-player/ha-browse-media-tts.ts +++ b/src/components/media-player/ha-browse-media-tts.ts @@ -1,22 +1,22 @@ import "@material/mwc-list/mwc-list-item"; -import { css, html, LitElement, nothing, PropertyValues } from "lit"; +import "@material/mwc-button/mwc-button"; +import type { PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { storage } from "../../common/decorators/storage"; import { fireEvent } from "../../common/dom/fire_event"; -import { +import type { MediaPlayerBrowseAction, MediaPlayerItem, } from "../../data/media-player"; -import { - getProviderFromTTSMediaSource, - getTTSEngine, - TTSEngine, -} from "../../data/tts"; +import type { TTSEngine } from "../../data/tts"; +import { getProviderFromTTSMediaSource, getTTSEngine } from "../../data/tts"; import { buttonLinkStyle } from "../../resources/styles"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import "../ha-textarea"; import "../ha-language-picker"; import "../ha-tts-voice-picker"; +import "../ha-card"; import { fetchCloudStatus } from "../../data/cloud"; export interface TtsMediaPickedEvent { diff --git a/src/components/media-player/ha-media-manage-button.ts b/src/components/media-player/ha-media-manage-button.ts index 90a85482dfa4..8dd5ad27134d 100644 --- a/src/components/media-player/ha-media-manage-button.ts +++ b/src/components/media-player/ha-media-manage-button.ts @@ -3,7 +3,7 @@ import { mdiFolderEdit } from "@mdi/js"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; -import { MediaPlayerItem } from "../../data/media-player"; +import type { MediaPlayerItem } from "../../data/media-player"; import { isLocalMediaSourceContentId } from "../../data/media_source"; import type { HomeAssistant } from "../../types"; import "../ha-svg-icon"; diff --git a/src/components/media-player/ha-media-player-browse.ts b/src/components/media-player/ha-media-player-browse.ts index b0ed61efe5f1..c650e81ffeed 100644 --- a/src/components/media-player/ha-media-player-browse.ts +++ b/src/components/media-player/ha-media-player-browse.ts @@ -5,15 +5,8 @@ import "@material/mwc-list/mwc-list"; import "@material/mwc-list/mwc-list-item"; import { mdiArrowUpRight, mdiPlay, mdiPlus } from "@mdi/js"; import "@lrnwebcomponents/simple-tooltip/simple-tooltip"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, eventOptions, @@ -27,14 +20,16 @@ import { until } from "lit/directives/until"; import { fireEvent } from "../../common/dom/fire_event"; import { debounce } from "../../common/util/debounce"; import { isUnavailableState } from "../../data/entity"; -import type { MediaPlayerItem } from "../../data/media-player"; +import type { + MediaPlayerItem, + MediaPickedEvent, + MediaPlayerBrowseAction, + MediaPlayerLayoutType, +} from "../../data/media-player"; import { browseMediaPlayer, BROWSER_PLAYER, MediaClassBrowserSettings, - MediaPickedEvent, - MediaPlayerBrowseAction, - MediaPlayerLayoutType, } from "../../data/media-player"; import { browseLocalMediaPlayer } from "../../data/media_source"; import { isTTSMediaSource } from "../../data/tts"; diff --git a/src/components/media-player/ha-media-upload-button.ts b/src/components/media-player/ha-media-upload-button.ts index 97a92ea17122..d5f49c52c140 100644 --- a/src/components/media-player/ha-media-upload-button.ts +++ b/src/components/media-player/ha-media-upload-button.ts @@ -3,7 +3,7 @@ import { mdiUpload } from "@mdi/js"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; -import { MediaPlayerItem } from "../../data/media-player"; +import type { MediaPlayerItem } from "../../data/media-player"; import { isLocalMediaSourceContentId, uploadLocalMedia, diff --git a/src/components/media-player/show-media-browser-dialog.ts b/src/components/media-player/show-media-browser-dialog.ts index c99e8184b685..e2a11bd55f1d 100644 --- a/src/components/media-player/show-media-browser-dialog.ts +++ b/src/components/media-player/show-media-browser-dialog.ts @@ -1,9 +1,9 @@ import { fireEvent } from "../../common/dom/fire_event"; -import { +import type { MediaPickedEvent, MediaPlayerBrowseAction, } from "../../data/media-player"; -import { MediaPlayerItemId } from "./ha-media-player-browse"; +import type { MediaPlayerItemId } from "./ha-media-player-browse"; export interface MediaPlayerBrowseDialogParams { action: MediaPlayerBrowseAction; diff --git a/src/components/media-player/show-media-manage-dialog.ts b/src/components/media-player/show-media-manage-dialog.ts index efb2c08c2d29..34a192319fc3 100644 --- a/src/components/media-player/show-media-manage-dialog.ts +++ b/src/components/media-player/show-media-manage-dialog.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../common/dom/fire_event"; -import { MediaPlayerItem } from "../../data/media-player"; +import type { MediaPlayerItem } from "../../data/media-player"; export interface MediaManageDialogParams { currentItem: MediaPlayerItem; diff --git a/src/components/search-input-outlined.ts b/src/components/search-input-outlined.ts index 693be1feac8f..629bf5ed8951 100644 --- a/src/components/search-input-outlined.ts +++ b/src/components/search-input-outlined.ts @@ -1,15 +1,9 @@ import { mdiClose, mdiMagnify } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./ha-icon-button"; import "./ha-outlined-text-field"; import type { HaOutlinedTextField } from "./ha-outlined-text-field"; diff --git a/src/components/search-input.ts b/src/components/search-input.ts index 2f4298ecaa5f..532049985115 100644 --- a/src/components/search-input.ts +++ b/src/components/search-input.ts @@ -1,11 +1,12 @@ import { mdiClose, mdiMagnify } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import "./ha-icon-button"; import "./ha-svg-icon"; import "./ha-textfield"; import type { HaTextField } from "./ha-textfield"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import { fireEvent } from "../common/dom/fire_event"; @customElement("search-input") diff --git a/src/components/tile/ha-tile-badge.ts b/src/components/tile/ha-tile-badge.ts index 33aa85fce4d0..8ea4e992dba4 100644 --- a/src/components/tile/ha-tile-badge.ts +++ b/src/components/tile/ha-tile-badge.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement } from "lit/decorators"; import "../ha-icon"; diff --git a/src/components/tile/ha-tile-icon.ts b/src/components/tile/ha-tile-icon.ts index f1cd7ec633ce..5fcb137bcdc5 100644 --- a/src/components/tile/ha-tile-icon.ts +++ b/src/components/tile/ha-tile-icon.ts @@ -1,4 +1,5 @@ -import { CSSResultGroup, LitElement, TemplateResult, css, html } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement } from "lit/decorators"; import "../ha-icon"; import "../ha-svg-icon"; diff --git a/src/components/tile/ha-tile-image.ts b/src/components/tile/ha-tile-image.ts index 143f4c176b1c..6dfc37e7b214 100644 --- a/src/components/tile/ha-tile-image.ts +++ b/src/components/tile/ha-tile-image.ts @@ -1,4 +1,5 @@ -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; diff --git a/src/components/tile/ha-tile-info.ts b/src/components/tile/ha-tile-info.ts index 68123eee6f1e..48910ab13301 100644 --- a/src/components/tile/ha-tile-info.ts +++ b/src/components/tile/ha-tile-info.ts @@ -1,11 +1,5 @@ -import { - CSSResultGroup, - html, - css, - LitElement, - TemplateResult, - nothing, -} from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { html, css, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; @customElement("ha-tile-info") diff --git a/src/components/trace/ha-timeline.ts b/src/components/trace/ha-timeline.ts index 8c4fae44a10f..1853882d2fc5 100644 --- a/src/components/trace/ha-timeline.ts +++ b/src/components/trace/ha-timeline.ts @@ -1,5 +1,6 @@ import { mdiCircleOutline } from "@mdi/js"; -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { buttonLinkStyle } from "../../resources/styles"; import "../ha-svg-icon"; diff --git a/src/components/trace/ha-trace-blueprint-config.ts b/src/components/trace/ha-trace-blueprint-config.ts index ec2a0e5440f6..5d449504cb4a 100644 --- a/src/components/trace/ha-trace-blueprint-config.ts +++ b/src/components/trace/ha-trace-blueprint-config.ts @@ -1,10 +1,11 @@ import { dump } from "js-yaml"; -import { html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import "../ha-code-editor"; import "../ha-icon-button"; -import { TraceExtended } from "../../data/trace"; -import { HomeAssistant } from "../../types"; +import type { TraceExtended } from "../../data/trace"; +import type { HomeAssistant } from "../../types"; @customElement("ha-trace-blueprint-config") export class HaTraceBlueprintConfig extends LitElement { diff --git a/src/components/trace/ha-trace-config.ts b/src/components/trace/ha-trace-config.ts index 64b71f78cd12..e29aca47c676 100644 --- a/src/components/trace/ha-trace-config.ts +++ b/src/components/trace/ha-trace-config.ts @@ -1,10 +1,11 @@ import { dump } from "js-yaml"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import "../ha-code-editor"; import "../ha-icon-button"; -import { TraceExtended } from "../../data/trace"; -import { HomeAssistant } from "../../types"; +import type { TraceExtended } from "../../data/trace"; +import type { HomeAssistant } from "../../types"; @customElement("ha-trace-config") export class HaTraceConfig extends LitElement { diff --git a/src/components/trace/ha-trace-logbook.ts b/src/components/trace/ha-trace-logbook.ts index 391c004a62d2..b0007d28479f 100644 --- a/src/components/trace/ha-trace-logbook.ts +++ b/src/components/trace/ha-trace-logbook.ts @@ -1,10 +1,11 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; -import { LogbookEntry } from "../../data/logbook"; -import { HomeAssistant } from "../../types"; +import type { LogbookEntry } from "../../data/logbook"; +import type { HomeAssistant } from "../../types"; import "./hat-logbook-note"; import "../../panels/logbook/ha-logbook-renderer"; -import { TraceExtended } from "../../data/trace"; +import type { TraceExtended } from "../../data/trace"; @customElement("ha-trace-logbook") export class HaTraceLogbook extends LitElement { diff --git a/src/components/trace/ha-trace-path-details.ts b/src/components/trace/ha-trace-path-details.ts index c895b19c2ea6..2a38ca6504c8 100644 --- a/src/components/trace/ha-trace-path-details.ts +++ b/src/components/trace/ha-trace-path-details.ts @@ -1,28 +1,22 @@ import { dump } from "js-yaml"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { formatDateTimeWithSeconds } from "../../common/datetime/format_date_time"; import "../ha-code-editor"; import "../ha-icon-button"; import "./hat-logbook-note"; -import { LogbookEntry } from "../../data/logbook"; -import { +import type { LogbookEntry } from "../../data/logbook"; +import type { ActionTraceStep, ChooseActionTraceStep, - getDataFromPath, TraceExtended, } from "../../data/trace"; +import { getDataFromPath } from "../../data/trace"; import "../../panels/logbook/ha-logbook-renderer"; import { traceTabStyles } from "./trace-tab-styles"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import type { NodeInfo } from "./hat-script-graph"; const TRACE_PATH_TABS = [ diff --git a/src/components/trace/ha-trace-timeline.ts b/src/components/trace/ha-trace-timeline.ts index 1223732a1448..7c62b3fbb033 100644 --- a/src/components/trace/ha-trace-timeline.ts +++ b/src/components/trace/ha-trace-timeline.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import "./hat-logbook-note"; import "./hat-trace-timeline"; diff --git a/src/components/trace/hat-graph-node.ts b/src/components/trace/hat-graph-node.ts index b6452587be44..dd5fe9e125a5 100644 --- a/src/components/trace/hat-graph-node.ts +++ b/src/components/trace/hat-graph-node.ts @@ -1,13 +1,6 @@ import { mdiExclamationThick } from "@mdi/js"; -import { - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, - svg, -} from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing, svg } from "lit"; import { customElement, property } from "lit/decorators"; import { isSafari } from "../../util/is_safari"; import { NODE_SIZE, SPACING } from "./hat-graph-const"; diff --git a/src/components/trace/hat-script-graph.ts b/src/components/trace/hat-script-graph.ts index 267e046168ec..d0c8596b07c3 100644 --- a/src/components/trace/hat-script-graph.ts +++ b/src/components/trace/hat-script-graph.ts @@ -18,12 +18,14 @@ import { mdiRoomService, mdiShuffleDisabled, } from "@mdi/js"; -import { LitElement, PropertyValues, css, html, nothing } from "lit"; +import type { PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { ensureArray } from "../../common/array/ensure-array"; import { fireEvent } from "../../common/dom/fire_event"; -import { Condition, Trigger, flattenTriggers } from "../../data/automation"; -import { +import type { Condition, Trigger } from "../../data/automation"; +import { flattenTriggers } from "../../data/automation"; +import type { Action, ChooseAction, IfAction, @@ -34,15 +36,15 @@ import { ServiceAction, WaitAction, WaitForTriggerAction, - getActionType, } from "../../data/script"; -import { +import { getActionType } from "../../data/script"; +import type { ChooseActionTraceStep, ConditionTraceStep, IfActionTraceStep, TraceExtended, } from "../../data/trace"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import "../ha-icon-button"; import "../ha-service-icon"; import "./hat-graph-branch"; diff --git a/src/components/trace/hat-trace-timeline.ts b/src/components/trace/hat-trace-timeline.ts index fafbff2fee6f..365dba0f1dd3 100644 --- a/src/components/trace/hat-trace-timeline.ts +++ b/src/components/trace/hat-trace-timeline.ts @@ -7,15 +7,8 @@ import { mdiProgressWrench, mdiRecordCircleOutline, } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { formatDateTimeWithSeconds } from "../../common/datetime/format_date_time"; @@ -27,30 +20,29 @@ import { fullEntitiesContext, labelsContext, } from "../../data/context"; -import { EntityRegistryEntry } from "../../data/entity_registry"; -import { FloorRegistryEntry } from "../../data/floor_registry"; -import { LabelRegistryEntry } from "../../data/label_registry"; -import { LogbookEntry } from "../../data/logbook"; -import { +import type { EntityRegistryEntry } from "../../data/entity_registry"; +import type { FloorRegistryEntry } from "../../data/floor_registry"; +import type { LabelRegistryEntry } from "../../data/label_registry"; +import type { LogbookEntry } from "../../data/logbook"; +import type { ChooseAction, - ChooseActionChoice, + Option, IfAction, ParallelAction, RepeatAction, SequenceAction, - getActionType, } from "../../data/script"; +import { getActionType } from "../../data/script"; import { describeAction } from "../../data/script_i18n"; -import { +import type { ActionTraceStep, AutomationTraceExtended, ChooseActionTraceStep, IfActionTraceStep, TriggerTraceStep, - getDataFromPath, - isTriggerPath, } from "../../data/trace"; -import { HomeAssistant } from "../../types"; +import { getDataFromPath, isTriggerPath } from "../../data/trace"; +import type { HomeAssistant } from "../../types"; import "./ha-timeline"; import type { HaTimeline } from "./ha-timeline"; @@ -413,7 +405,7 @@ class ActionRenderer { : undefined; const choiceConfig = this._getDataFromPath( `${this.keys[index]}/choose/${chooseTrace.result.choice}` - ) as ChooseActionChoice | undefined; + ) as Option | undefined; const choiceName = choiceConfig ? `${ choiceConfig.alias || diff --git a/src/components/user/ha-person-badge.ts b/src/components/user/ha-person-badge.ts index e6b8777f1d2b..9c25ff8e171b 100644 --- a/src/components/user/ha-person-badge.ts +++ b/src/components/user/ha-person-badge.ts @@ -1,8 +1,9 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { styleMap } from "lit/directives/style-map"; -import { BasePerson } from "../../data/person"; +import type { BasePerson } from "../../data/person"; import { computeUserInitials } from "../../data/user"; @customElement("ha-person-badge") diff --git a/src/components/user/ha-user-badge.ts b/src/components/user/ha-user-badge.ts index 6a43f642ee3e..43ea90596f3d 100644 --- a/src/components/user/ha-user-badge.ts +++ b/src/components/user/ha-user-badge.ts @@ -1,17 +1,12 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { styleMap } from "lit/directives/style-map"; import { computeStateDomain } from "../../common/entity/compute_state_domain"; -import { computeUserInitials, User } from "../../data/user"; -import { CurrentUser, HomeAssistant } from "../../types"; +import type { User } from "../../data/user"; +import { computeUserInitials } from "../../data/user"; +import type { CurrentUser, HomeAssistant } from "../../types"; @customElement("ha-user-badge") class UserBadge extends LitElement { diff --git a/src/components/user/ha-user-picker.ts b/src/components/user/ha-user-picker.ts index 3f89ecc10fdb..2b5504a88a51 100644 --- a/src/components/user/ha-user-picker.ts +++ b/src/components/user/ha-user-picker.ts @@ -1,11 +1,13 @@ import "@material/mwc-list/mwc-list-item"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { property } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../common/dom/fire_event"; import { stringCompare } from "../../common/string/compare"; -import { fetchUsers, User } from "../../data/user"; -import { HomeAssistant } from "../../types"; +import type { User } from "../../data/user"; +import { fetchUsers } from "../../data/user"; +import type { HomeAssistant } from "../../types"; import "../ha-select"; import "./ha-user-badge"; import "../ha-list-item"; diff --git a/src/components/user/ha-users-picker.ts b/src/components/user/ha-users-picker.ts index 8bd90c128c21..9c56402a3256 100644 --- a/src/components/user/ha-users-picker.ts +++ b/src/components/user/ha-users-picker.ts @@ -1,10 +1,12 @@ import { mdiClose } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { guard } from "lit/directives/guard"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../common/dom/fire_event"; -import { fetchUsers, User } from "../../data/user"; +import type { User } from "../../data/user"; +import { fetchUsers } from "../../data/user"; import type { ValueChangedEvent, HomeAssistant } from "../../types"; import "../ha-icon-button"; import "./ha-user-picker"; diff --git a/src/data/action.ts b/src/data/action.ts index 69a5f9a8699b..44eb8ca18b41 100644 --- a/src/data/action.ts +++ b/src/data/action.ts @@ -20,7 +20,7 @@ import { mdiTools, mdiTrafficLight, } from "@mdi/js"; -import { AutomationElementGroup } from "./automation"; +import type { AutomationElementGroup } from "./automation"; export const ACTION_ICONS = { condition: mdiAbTesting, diff --git a/src/data/alarm_control_panel.ts b/src/data/alarm_control_panel.ts index acde378a1335..f2378e1951d3 100644 --- a/src/data/alarm_control_panel.ts +++ b/src/data/alarm_control_panel.ts @@ -6,13 +6,13 @@ import { mdiShield, mdiShieldOff, } from "@mdi/js"; -import { +import type { HassEntityAttributeBase, HassEntityBase, } from "home-assistant-js-websocket"; import { supportsFeature } from "../common/entity/supports-feature"; import { showEnterCodeDialog } from "../dialogs/enter-code/show-enter-code-dialog"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import { getExtendedEntityRegistryEntry } from "./entity_registry"; export const FORMAT_TEXT = "text"; diff --git a/src/data/alexa.ts b/src/data/alexa.ts index ea8710e033fa..fa13a1862b8d 100644 --- a/src/data/alexa.ts +++ b/src/data/alexa.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export interface AlexaEntity { entity_id: string; diff --git a/src/data/analytics.ts b/src/data/analytics.ts index a4e3875b5add..bfb5e6af8c1a 100644 --- a/src/data/analytics.ts +++ b/src/data/analytics.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export interface AnalyticsPreferences { base?: boolean; diff --git a/src/data/application_credential.ts b/src/data/application_credential.ts index 4b4cebdac98b..8792d40b0b4c 100644 --- a/src/data/application_credential.ts +++ b/src/data/application_credential.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export interface ApplicationCredentialsDomainConfig { description_placeholders: Record; diff --git a/src/data/area_registry.ts b/src/data/area_registry.ts index 6220d60d624a..9dd2671a5a59 100644 --- a/src/data/area_registry.ts +++ b/src/data/area_registry.ts @@ -1,8 +1,8 @@ import { stringCompare } from "../common/string/compare"; -import { HomeAssistant } from "../types"; -import { DeviceRegistryEntry } from "./device_registry"; -import { EntityRegistryEntry } from "./entity_registry"; -import { RegistryEntry } from "./registry"; +import type { HomeAssistant } from "../types"; +import type { DeviceRegistryEntry } from "./device_registry"; +import type { EntityRegistryEntry } from "./entity_registry"; +import type { RegistryEntry } from "./registry"; export { subscribeAreaRegistry } from "./ws-area_registry"; diff --git a/src/data/assist_satellite.ts b/src/data/assist_satellite.ts index 15c91527b94f..19a0e180b00c 100644 --- a/src/data/assist_satellite.ts +++ b/src/data/assist_satellite.ts @@ -1,5 +1,5 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { HomeAssistant } from "../types"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { HomeAssistant } from "../types"; import { supportsFeature } from "../common/entity/supports-feature"; import { UNAVAILABLE } from "./entity"; diff --git a/src/data/auth.ts b/src/data/auth.ts index 8b68f4c7889f..29c647fe158c 100644 --- a/src/data/auth.ts +++ b/src/data/auth.ts @@ -1,6 +1,6 @@ -import { HaFormSchema } from "../components/ha-form/types"; -import { HomeAssistant } from "../types"; -import { RefreshTokenType } from "./refresh_token"; +import type { HaFormSchema } from "../components/ha-form/types"; +import type { HomeAssistant } from "../types"; +import type { RefreshTokenType } from "./refresh_token"; export interface AuthUrlSearchParams { client_id?: string; diff --git a/src/data/automation.ts b/src/data/automation.ts index 9778a12dda6b..716f1bf9d7eb 100644 --- a/src/data/automation.ts +++ b/src/data/automation.ts @@ -1,13 +1,14 @@ -import { +import type { HassEntityAttributeBase, HassEntityBase, } from "home-assistant-js-websocket"; import { navigate } from "../common/navigate"; import { ensureArray } from "../common/array/ensure-array"; -import { Context, HomeAssistant } from "../types"; -import { BlueprintInput } from "./blueprint"; -import { DeviceCondition, DeviceTrigger } from "./device_automation"; -import { Action, MODES, migrateAutomationAction } from "./script"; +import type { Context, HomeAssistant } from "../types"; +import type { BlueprintInput } from "./blueprint"; +import type { DeviceCondition, DeviceTrigger } from "./device_automation"; +import type { Action, MODES } from "./script"; +import { migrateAutomationAction } from "./script"; import { createSearchParam } from "../common/url/search-params"; export const AUTOMATION_DEFAULT_MODE: (typeof MODES)[number] = "single"; diff --git a/src/data/automation_i18n.ts b/src/data/automation_i18n.ts index 1e4fc0722e71..5f8b9eb95c0c 100644 --- a/src/data/automation_i18n.ts +++ b/src/data/automation_i18n.ts @@ -1,4 +1,4 @@ -import { HassConfig } from "home-assistant-js-websocket"; +import type { HassConfig } from "home-assistant-js-websocket"; import { ensureArray } from "../common/array/ensure-array"; import { formatDuration } from "../common/datetime/format_duration"; import { @@ -10,15 +10,14 @@ import { computeAttributeNameDisplay } from "../common/entity/compute_attribute_ import { computeStateName } from "../common/entity/compute_state_name"; import { isValidEntityId } from "../common/entity/valid_entity_id"; import type { HomeAssistant } from "../types"; -import { Condition, ForDict, Trigger } from "./automation"; +import type { Condition, ForDict, Trigger } from "./automation"; +import type { DeviceCondition, DeviceTrigger } from "./device_automation"; import { - DeviceCondition, - DeviceTrigger, localizeDeviceAutomationCondition, localizeDeviceAutomationTrigger, } from "./device_automation"; -import { EntityRegistryEntry } from "./entity_registry"; -import { FrontendLocaleData } from "./translation"; +import type { EntityRegistryEntry } from "./entity_registry"; +import type { FrontendLocaleData } from "./translation"; import { formatListWithAnds, formatListWithOrs, diff --git a/src/data/backup.ts b/src/data/backup.ts index 129b76726d06..5f93a31f68a1 100644 --- a/src/data/backup.ts +++ b/src/data/backup.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export interface BackupContent { slug: string; diff --git a/src/data/blueprint.ts b/src/data/blueprint.ts index a0e9f2562da3..5b8c816c6674 100644 --- a/src/data/blueprint.ts +++ b/src/data/blueprint.ts @@ -1,7 +1,7 @@ -import { HomeAssistant } from "../types"; -import { ManualAutomationConfig } from "./automation"; -import { ManualScriptConfig } from "./script"; -import { Selector } from "./selector"; +import type { HomeAssistant } from "../types"; +import type { ManualAutomationConfig } from "./automation"; +import type { ManualScriptConfig } from "./script"; +import type { Selector } from "./selector"; export type BlueprintDomain = "automation" | "script"; diff --git a/src/data/bootstrap_integrations.ts b/src/data/bootstrap_integrations.ts index 3ab1c6870ef5..c1a6134736da 100644 --- a/src/data/bootstrap_integrations.ts +++ b/src/data/bootstrap_integrations.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export type BootstrapIntegrationsTimings = { [key: string]: number }; diff --git a/src/data/camera.ts b/src/data/camera.ts index 84df934a74ac..8c3bfe537f1d 100644 --- a/src/data/camera.ts +++ b/src/data/camera.ts @@ -1,9 +1,9 @@ -import { +import type { HassEntityAttributeBase, HassEntityBase, } from "home-assistant-js-websocket"; import { timeCacheEntityPromiseFunc } from "../common/util/time-cache-entity-promise-func"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import { getSignedPath } from "./auth"; export const CAMERA_ORIENTATIONS = [1, 2, 3, 4, 6, 8]; @@ -13,6 +13,8 @@ export const CAMERA_SUPPORT_STREAM = 2; export const STREAM_TYPE_HLS = "hls"; export const STREAM_TYPE_WEB_RTC = "web_rtc"; +export type StreamType = typeof STREAM_TYPE_HLS | typeof STREAM_TYPE_WEB_RTC; + interface CameraEntityAttributes extends HassEntityAttributeBase { model_name: string; access_token: string; @@ -175,6 +177,16 @@ export const isCameraMediaSource = (mediaContentId: string) => export const getEntityIdFromCameraMediaSource = (mediaContentId: string) => mediaContentId.substring(CAMERA_MEDIA_SOURCE_PREFIX.length); +export interface CameraCapabilities { + frontend_stream_types: StreamType[]; +} + +export const fetchCameraCapabilities = async ( + hass: HomeAssistant, + entity_id: string +) => + hass.callWS({ type: "camera/capabilities", entity_id }); + export interface WebRTCClientConfiguration { configuration: RTCConfiguration; dataChannel?: string; diff --git a/src/data/category_registry.ts b/src/data/category_registry.ts index ee771e80cf06..94fe76904f17 100644 --- a/src/data/category_registry.ts +++ b/src/data/category_registry.ts @@ -1,7 +1,8 @@ -import { Connection, createCollection } from "home-assistant-js-websocket"; -import { Store } from "home-assistant-js-websocket/dist/store"; +import type { Connection } from "home-assistant-js-websocket"; +import { createCollection } from "home-assistant-js-websocket"; +import type { Store } from "home-assistant-js-websocket/dist/store"; import { stringCompare } from "../common/string/compare"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import { debounce } from "../common/util/debounce"; export interface CategoryRegistryEntry { diff --git a/src/data/climate.ts b/src/data/climate.ts index 30ee11d2b909..b6e3f3ab6dd0 100644 --- a/src/data/climate.ts +++ b/src/data/climate.ts @@ -8,7 +8,7 @@ import { mdiThermostatAuto, mdiWaterPercent, } from "@mdi/js"; -import { +import type { HassEntityAttributeBase, HassEntityBase, } from "home-assistant-js-websocket"; diff --git a/src/data/cloud.ts b/src/data/cloud.ts index e3d62b513bb6..cde961db034f 100644 --- a/src/data/cloud.ts +++ b/src/data/cloud.ts @@ -1,5 +1,5 @@ -import { EntityFilter } from "../common/entity/entity_filter"; -import { HomeAssistant } from "../types"; +import type { EntityFilter } from "../common/entity/entity_filter"; +import type { HomeAssistant } from "../types"; type StrictConnectionMode = "disabled" | "guard_page" | "drop_connection"; diff --git a/src/data/cloud/tts.ts b/src/data/cloud/tts.ts index e38c65c91144..54dd9cf490b5 100644 --- a/src/data/cloud/tts.ts +++ b/src/data/cloud/tts.ts @@ -1,5 +1,5 @@ import { caseInsensitiveStringCompare } from "../../common/string/compare"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; export interface CloudTTSInfo { languages: Array<[string, string]>; diff --git a/src/data/collection.ts b/src/data/collection.ts index 2a011caeb077..476d416e8690 100644 --- a/src/data/collection.ts +++ b/src/data/collection.ts @@ -1,10 +1,10 @@ -import { +import type { Collection, Connection, - getCollection, UnsubscribeFunc, } from "home-assistant-js-websocket"; -import { Store } from "home-assistant-js-websocket/dist/store"; +import { getCollection } from "home-assistant-js-websocket"; +import type { Store } from "home-assistant-js-websocket/dist/store"; interface OptimisticCollection extends Collection { save(data: T): Promise; diff --git a/src/data/condition.ts b/src/data/condition.ts index 44a0e218609c..0951d6bc541a 100644 --- a/src/data/condition.ts +++ b/src/data/condition.ts @@ -15,7 +15,7 @@ import { mdiStateMachine, mdiWeatherSunny, } from "@mdi/js"; -import { AutomationElementGroup } from "./automation"; +import type { AutomationElementGroup } from "./automation"; export const CONDITION_ICONS = { device: mdiDevices, diff --git a/src/data/config.ts b/src/data/config.ts index 3d058575be6f..adf8f32170c8 100644 --- a/src/data/config.ts +++ b/src/data/config.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; interface ValidConfig { valid: true; diff --git a/src/data/config_flow.ts b/src/data/config_flow.ts index 5c58cf789cf4..3144fea53154 100644 --- a/src/data/config_flow.ts +++ b/src/data/config_flow.ts @@ -1,9 +1,14 @@ -import { Connection, getCollection } from "home-assistant-js-websocket"; -import { LocalizeFunc } from "../common/translations/localize"; +import type { Connection } from "home-assistant-js-websocket"; +import { getCollection } from "home-assistant-js-websocket"; +import type { LocalizeFunc } from "../common/translations/localize"; import { debounce } from "../common/util/debounce"; -import { HomeAssistant } from "../types"; -import { DataEntryFlowProgress, DataEntryFlowStep } from "./data_entry_flow"; -import { domainToName, IntegrationType } from "./integration"; +import type { HomeAssistant } from "../types"; +import type { + DataEntryFlowProgress, + DataEntryFlowStep, +} from "./data_entry_flow"; +import type { IntegrationType } from "./integration"; +import { domainToName } from "./integration"; export const DISCOVERY_SOURCES = [ "bluetooth", diff --git a/src/data/connection-status.ts b/src/data/connection-status.ts index c801ad420868..706830447484 100644 --- a/src/data/connection-status.ts +++ b/src/data/connection-status.ts @@ -2,7 +2,8 @@ * Broadcast connection status updates */ -import { fireEvent, HASSDomEvent } from "../common/dom/fire_event"; +import type { HASSDomEvent } from "../common/dom/fire_event"; +import { fireEvent } from "../common/dom/fire_event"; export type ConnectionStatus = "connected" | "auth-invalid" | "disconnected"; diff --git a/src/data/context.ts b/src/data/context.ts index e424775f3c8b..94be214c5ac9 100644 --- a/src/data/context.ts +++ b/src/data/context.ts @@ -1,8 +1,8 @@ import { createContext } from "@lit-labs/context"; -import { HassConfig } from "home-assistant-js-websocket"; -import { HomeAssistant } from "../types"; -import { EntityRegistryEntry } from "./entity_registry"; -import { LabelRegistryEntry } from "./label_registry"; +import type { HassConfig } from "home-assistant-js-websocket"; +import type { HomeAssistant } from "../types"; +import type { EntityRegistryEntry } from "./entity_registry"; +import type { LabelRegistryEntry } from "./label_registry"; export const connectionContext = createContext("connection"); diff --git a/src/data/conversation.ts b/src/data/conversation.ts index 746fd84b4eef..d9d5b7952626 100644 --- a/src/data/conversation.ts +++ b/src/data/conversation.ts @@ -1,5 +1,5 @@ import { ensureArray } from "../common/array/ensure-array"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export const enum ConversationEntityFeature { CONTROL = 1, diff --git a/src/data/core.ts b/src/data/core.ts index 60dbf556f9ca..cdda3baf1207 100644 --- a/src/data/core.ts +++ b/src/data/core.ts @@ -1,5 +1,5 @@ -import { HassConfig } from "home-assistant-js-websocket"; -import { HomeAssistant } from "../types"; +import type { HassConfig } from "home-assistant-js-websocket"; +import type { HomeAssistant } from "../types"; export interface ConfigUpdateValues { location_name: string; diff --git a/src/data/counter.ts b/src/data/counter.ts index b01bf6586986..cda334f1edd1 100644 --- a/src/data/counter.ts +++ b/src/data/counter.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export interface Counter { id: string; diff --git a/src/data/cover.ts b/src/data/cover.ts index 4916792feed4..1c5a4e5afb19 100644 --- a/src/data/cover.ts +++ b/src/data/cover.ts @@ -1,4 +1,4 @@ -import { +import type { HassEntityAttributeBase, HassEntityBase, } from "home-assistant-js-websocket"; diff --git a/src/data/custom_iconsets.ts b/src/data/custom_iconsets.ts index 3462c8e7a76b..c2e5170d0e4c 100644 --- a/src/data/custom_iconsets.ts +++ b/src/data/custom_iconsets.ts @@ -1,4 +1,4 @@ -import { CustomIcon } from "./custom_icons"; +import type { CustomIcon } from "./custom_icons"; interface CustomIconsetsWindow { customIconsets?: { [key: string]: (name: string) => Promise }; diff --git a/src/data/data_entry_flow.ts b/src/data/data_entry_flow.ts index d60e55beabf5..33b49424e33a 100644 --- a/src/data/data_entry_flow.ts +++ b/src/data/data_entry_flow.ts @@ -1,6 +1,6 @@ -import { Connection } from "home-assistant-js-websocket"; +import type { Connection } from "home-assistant-js-websocket"; import type { HaFormSchema } from "../components/ha-form/types"; -import { ConfigEntry } from "./config_entries"; +import type { ConfigEntry } from "./config_entries"; export type FlowType = "config_flow" | "options_flow" | "repair_flow"; diff --git a/src/data/date.ts b/src/data/date.ts index 4ac5d9bf1522..ea5a8588c8d3 100644 --- a/src/data/date.ts +++ b/src/data/date.ts @@ -1,5 +1,5 @@ -import { HassEntityBase } from "home-assistant-js-websocket"; -import { HomeAssistant } from "../types"; +import type { HassEntityBase } from "home-assistant-js-websocket"; +import type { HomeAssistant } from "../types"; export const stateToIsoDateString = (entityState: HassEntityBase) => `${entityState}T00:00:00`; diff --git a/src/data/datetime.ts b/src/data/datetime.ts index 239bb0051a4d..9ab7c429b1da 100644 --- a/src/data/datetime.ts +++ b/src/data/datetime.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export const setDateTimeValue = ( hass: HomeAssistant, diff --git a/src/data/device_automation.ts b/src/data/device_automation.ts index 677e0a73ead2..e64300a5aadd 100644 --- a/src/data/device_automation.ts +++ b/src/data/device_automation.ts @@ -1,12 +1,13 @@ import { computeStateName } from "../common/entity/compute_state_name"; import type { HaFormSchema } from "../components/ha-form/types"; -import { HomeAssistant } from "../types"; -import { BaseTrigger, migrateAutomationTrigger } from "./automation"; +import type { HomeAssistant } from "../types"; +import type { BaseTrigger } from "./automation"; +import { migrateAutomationTrigger } from "./automation"; +import type { EntityRegistryEntry } from "./entity_registry"; import { computeEntityRegistryName, entityRegistryByEntityId, entityRegistryById, - EntityRegistryEntry, } from "./entity_registry"; export interface DeviceAutomation { diff --git a/src/data/device_registry.ts b/src/data/device_registry.ts index 2a1a334b2a03..958da7c634c1 100644 --- a/src/data/device_registry.ts +++ b/src/data/device_registry.ts @@ -1,13 +1,13 @@ import { computeStateName } from "../common/entity/compute_state_name"; import { caseInsensitiveStringCompare } from "../common/string/compare"; import type { HomeAssistant } from "../types"; -import { ConfigEntry } from "./config_entries"; +import type { ConfigEntry } from "./config_entries"; import type { EntityRegistryDisplayEntry, EntityRegistryEntry, } from "./entity_registry"; import type { EntitySources } from "./entity_sources"; -import { RegistryEntry } from "./registry"; +import type { RegistryEntry } from "./registry"; export { fetchDeviceRegistry, diff --git a/src/data/diagnostics.ts b/src/data/diagnostics.ts index e53324423200..5946f7bc170f 100644 --- a/src/data/diagnostics.ts +++ b/src/data/diagnostics.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export interface DiagnosticInfo { domain: string; diff --git a/src/data/energy.ts b/src/data/energy.ts index fb5d030fe446..5e082ac675fc 100644 --- a/src/data/energy.ts +++ b/src/data/energy.ts @@ -10,7 +10,8 @@ import { isFirstDayOfMonth, isLastDayOfMonth, } from "date-fns"; -import { Collection, getCollection } from "home-assistant-js-websocket"; +import type { Collection } from "home-assistant-js-websocket"; +import { getCollection } from "home-assistant-js-websocket"; import memoizeOne from "memoize-one"; import { calcDate, @@ -19,15 +20,15 @@ import { } from "../common/datetime/calc_date"; import { formatTime24h } from "../common/datetime/format_time"; import { groupBy } from "../common/util/group-by"; -import { HomeAssistant } from "../types"; -import { ConfigEntry, getConfigEntries } from "./config_entries"; -import { - fetchStatistics, - getStatisticMetadata, +import type { HomeAssistant } from "../types"; +import type { ConfigEntry } from "./config_entries"; +import { getConfigEntries } from "./config_entries"; +import type { Statistics, StatisticsMetaData, StatisticsUnitConfiguration, } from "./recorder"; +import { fetchStatistics, getStatisticMetadata } from "./recorder"; const energyCollectionKeys: (string | undefined)[] = []; diff --git a/src/data/entity_attributes.ts b/src/data/entity_attributes.ts index bb1582b5d1bb..ce914ecc98c7 100644 --- a/src/data/entity_attributes.ts +++ b/src/data/entity_attributes.ts @@ -1,5 +1,5 @@ import { formatDuration } from "../common/datetime/duration"; -import { FrontendLocaleData } from "./translation"; +import type { FrontendLocaleData } from "./translation"; export const STATE_ATTRIBUTES = [ "entity_id", diff --git a/src/data/entity_registry.ts b/src/data/entity_registry.ts index ae370892f115..1af01d3575cd 100644 --- a/src/data/entity_registry.ts +++ b/src/data/entity_registry.ts @@ -1,13 +1,14 @@ -import { Connection, createCollection } from "home-assistant-js-websocket"; -import { Store } from "home-assistant-js-websocket/dist/store"; +import type { Connection } from "home-assistant-js-websocket"; +import { createCollection } from "home-assistant-js-websocket"; +import type { Store } from "home-assistant-js-websocket/dist/store"; import memoizeOne from "memoize-one"; import { computeStateName } from "../common/entity/compute_state_name"; import { caseInsensitiveStringCompare } from "../common/string/compare"; import { debounce } from "../common/util/debounce"; -import { HomeAssistant } from "../types"; -import { LightColor } from "./light"; +import type { HomeAssistant } from "../types"; +import type { LightColor } from "./light"; import { computeDomain } from "../common/entity/compute_domain"; -import { RegistryEntry } from "./registry"; +import type { RegistryEntry } from "./registry"; export { subscribeEntityRegistryDisplay } from "./ws-entity_registry_display"; diff --git a/src/data/entity_sources.ts b/src/data/entity_sources.ts index 851a70bfa69b..220201d5bf83 100644 --- a/src/data/entity_sources.ts +++ b/src/data/entity_sources.ts @@ -1,5 +1,5 @@ import { timeCachePromiseFunc } from "../common/util/time-cache-function-promise"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; interface EntitySource { domain: string; diff --git a/src/data/error_log.ts b/src/data/error_log.ts index a8f873b48122..a1628cc01435 100644 --- a/src/data/error_log.ts +++ b/src/data/error_log.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export interface LogProvider { key: string; diff --git a/src/data/expose.ts b/src/data/expose.ts index d8cea10b346e..43198235d8a0 100644 --- a/src/data/expose.ts +++ b/src/data/expose.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export const voiceAssistants = { conversation: { domain: "assist_pipeline", name: "Assist" }, diff --git a/src/data/fan.ts b/src/data/fan.ts index 3320ff5353d8..18d6814e8dda 100644 --- a/src/data/fan.ts +++ b/src/data/fan.ts @@ -5,7 +5,7 @@ import { mdiFanSpeed2, mdiFanSpeed3, } from "@mdi/js"; -import { +import type { HassEntityAttributeBase, HassEntityBase, } from "home-assistant-js-websocket"; diff --git a/src/data/file_upload.ts b/src/data/file_upload.ts index 8ee9a4393bd8..eb19f8a2081a 100644 --- a/src/data/file_upload.ts +++ b/src/data/file_upload.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export const uploadFile = async (hass: HomeAssistant, file: File) => { const fd = new FormData(); diff --git a/src/data/floor_registry.ts b/src/data/floor_registry.ts index d6b657661b1d..c5093255cd23 100644 --- a/src/data/floor_registry.ts +++ b/src/data/floor_registry.ts @@ -1,7 +1,7 @@ import { stringCompare } from "../common/string/compare"; -import { HomeAssistant } from "../types"; -import { AreaRegistryEntry } from "./area_registry"; -import { RegistryEntry } from "./registry"; +import type { HomeAssistant } from "../types"; +import type { AreaRegistryEntry } from "./area_registry"; +import type { RegistryEntry } from "./registry"; export { subscribeAreaRegistry } from "./ws-area_registry"; diff --git a/src/data/frontend.ts b/src/data/frontend.ts index 9e0095e7a911..b8119a1ee446 100644 --- a/src/data/frontend.ts +++ b/src/data/frontend.ts @@ -1,4 +1,4 @@ -import { Connection } from "home-assistant-js-websocket"; +import type { Connection } from "home-assistant-js-websocket"; import { getOptimisticCollection } from "./collection"; export interface CoreFrontendUserData { diff --git a/src/data/google_assistant.ts b/src/data/google_assistant.ts index 03c79e1c14c7..761eaba344e9 100644 --- a/src/data/google_assistant.ts +++ b/src/data/google_assistant.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export interface GoogleEntity { entity_id: string; diff --git a/src/data/group.ts b/src/data/group.ts index cfae3ed85801..6096dd969137 100644 --- a/src/data/group.ts +++ b/src/data/group.ts @@ -1,4 +1,4 @@ -import { +import type { HassEntityAttributeBase, HassEntityBase, } from "home-assistant-js-websocket"; diff --git a/src/data/haptics.ts b/src/data/haptics.ts index d492fb5b3a6a..e4868b2a0d6c 100644 --- a/src/data/haptics.ts +++ b/src/data/haptics.ts @@ -2,7 +2,8 @@ * Broadcast haptic feedback requests */ -import { fireEvent, HASSDomEvent } from "../common/dom/fire_event"; +import type { HASSDomEvent } from "../common/dom/fire_event"; +import { fireEvent } from "../common/dom/fire_event"; // Allowed types are from iOS HIG. // https://developer.apple.com/design/human-interface-guidelines/ios/user-interaction/feedback/#haptics diff --git a/src/data/hassio/addon.ts b/src/data/hassio/addon.ts index b60c31008d68..55dc84dd743b 100644 --- a/src/data/hassio/addon.ts +++ b/src/data/hassio/addon.ts @@ -1,14 +1,11 @@ import { atLeastVersion } from "../../common/config/version"; import type { HaFormSchema } from "../../components/ha-form/types"; -import { HomeAssistant, TranslationDict } from "../../types"; +import type { HomeAssistant, TranslationDict } from "../../types"; import { supervisorApiCall } from "../supervisor/common"; -import { StoreAddonDetails } from "../supervisor/store"; -import { Supervisor, SupervisorArch } from "../supervisor/supervisor"; -import { - extractApiErrorMessage, - hassioApiResultExtractor, - HassioResponse, -} from "./common"; +import type { StoreAddonDetails } from "../supervisor/store"; +import type { Supervisor, SupervisorArch } from "../supervisor/supervisor"; +import type { HassioResponse } from "./common"; +import { extractApiErrorMessage, hassioApiResultExtractor } from "./common"; export type AddonCapability = Exclude< keyof TranslationDict["supervisor"]["addon"]["dashboard"]["capability"], diff --git a/src/data/hassio/backup.ts b/src/data/hassio/backup.ts index b29b45590cb3..f2f3abe1e1ce 100644 --- a/src/data/hassio/backup.ts +++ b/src/data/hassio/backup.ts @@ -1,6 +1,7 @@ import { atLeastVersion } from "../../common/config/version"; -import { HomeAssistant } from "../../types"; -import { hassioApiResultExtractor, HassioResponse } from "./common"; +import type { HomeAssistant } from "../../types"; +import type { HassioResponse } from "./common"; +import { hassioApiResultExtractor } from "./common"; export const friendlyFolderName = { ssl: "SSL", diff --git a/src/data/hassio/common.ts b/src/data/hassio/common.ts index 6c1c254a1c0a..1a937b29ca85 100644 --- a/src/data/hassio/common.ts +++ b/src/data/hassio/common.ts @@ -1,5 +1,5 @@ import { atLeastVersion } from "../../common/config/version"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; export interface HassioResponse { data: T; diff --git a/src/data/hassio/docker.ts b/src/data/hassio/docker.ts index ca7dc31a1978..9c800e4e0d90 100644 --- a/src/data/hassio/docker.ts +++ b/src/data/hassio/docker.ts @@ -1,6 +1,7 @@ import { atLeastVersion } from "../../common/config/version"; -import { HomeAssistant } from "../../types"; -import { hassioApiResultExtractor, HassioResponse } from "./common"; +import type { HomeAssistant } from "../../types"; +import type { HassioResponse } from "./common"; +import { hassioApiResultExtractor } from "./common"; interface HassioDockerRegistries { [key: string]: { username: string; password?: string }; diff --git a/src/data/hassio/hardware.ts b/src/data/hassio/hardware.ts index 888a6609f4a3..eb7f56242834 100644 --- a/src/data/hassio/hardware.ts +++ b/src/data/hassio/hardware.ts @@ -1,6 +1,7 @@ import { atLeastVersion } from "../../common/config/version"; -import { HomeAssistant } from "../../types"; -import { hassioApiResultExtractor, HassioResponse } from "./common"; +import type { HomeAssistant } from "../../types"; +import type { HassioResponse } from "./common"; +import { hassioApiResultExtractor } from "./common"; export interface HassioHardwareAudioDevice { device?: string | null; diff --git a/src/data/hassio/host.ts b/src/data/hassio/host.ts index dd3c8cce3394..f71e8317eb37 100644 --- a/src/data/hassio/host.ts +++ b/src/data/hassio/host.ts @@ -1,6 +1,7 @@ import { atLeastVersion } from "../../common/config/version"; -import { HomeAssistant } from "../../types"; -import { hassioApiResultExtractor, HassioResponse } from "./common"; +import type { HomeAssistant } from "../../types"; +import type { HassioResponse } from "./common"; +import { hassioApiResultExtractor } from "./common"; export type HassioHostInfo = { agent_version: string; diff --git a/src/data/hassio/ingress.ts b/src/data/hassio/ingress.ts index 30a6e68e2390..5ff4b5cfe4ba 100644 --- a/src/data/hassio/ingress.ts +++ b/src/data/hassio/ingress.ts @@ -1,7 +1,7 @@ import { atLeastVersion } from "../../common/config/version"; -import { HomeAssistant } from "../../types"; -import { HassioResponse } from "./common"; -import { CreateSessionResponse } from "./supervisor"; +import type { HomeAssistant } from "../../types"; +import type { HassioResponse } from "./common"; +import type { CreateSessionResponse } from "./supervisor"; function setIngressCookie(session: string): string { document.cookie = `ingress_session=${session};path=/api/hassio_ingress/;SameSite=Strict${ diff --git a/src/data/hassio/network.ts b/src/data/hassio/network.ts index a4d8f7a8541a..022b47194b94 100644 --- a/src/data/hassio/network.ts +++ b/src/data/hassio/network.ts @@ -1,6 +1,7 @@ import { atLeastVersion } from "../../common/config/version"; -import { HomeAssistant } from "../../types"; -import { hassioApiResultExtractor, HassioResponse } from "./common"; +import type { HomeAssistant } from "../../types"; +import type { HassioResponse } from "./common"; +import { hassioApiResultExtractor } from "./common"; interface IpConfiguration { address: string[]; diff --git a/src/data/hassio/resolution.ts b/src/data/hassio/resolution.ts index e6ff08f27478..5b228dc38687 100644 --- a/src/data/hassio/resolution.ts +++ b/src/data/hassio/resolution.ts @@ -1,6 +1,7 @@ import { atLeastVersion } from "../../common/config/version"; -import { HomeAssistant, TranslationDict } from "../../types"; -import { hassioApiResultExtractor, HassioResponse } from "./common"; +import type { HomeAssistant, TranslationDict } from "../../types"; +import type { HassioResponse } from "./common"; +import { hassioApiResultExtractor } from "./common"; export interface HassioResolution { unsupported: (keyof TranslationDict["supervisor"]["system"]["supervisor"]["unsupported_reason"])[]; diff --git a/src/data/hassio/supervisor.ts b/src/data/hassio/supervisor.ts index e16d3220be40..2f34c77f84ce 100644 --- a/src/data/hassio/supervisor.ts +++ b/src/data/hassio/supervisor.ts @@ -1,7 +1,8 @@ import { atLeastVersion } from "../../common/config/version"; -import { HomeAssistant, PanelInfo } from "../../types"; -import { SupervisorArch } from "../supervisor/supervisor"; -import { hassioApiResultExtractor, HassioResponse } from "./common"; +import type { HomeAssistant, PanelInfo } from "../../types"; +import type { SupervisorArch } from "../supervisor/supervisor"; +import type { HassioResponse } from "./common"; +import { hassioApiResultExtractor } from "./common"; export type HassioHomeAssistantInfo = { arch: SupervisorArch; diff --git a/src/data/history.ts b/src/data/history.ts index c1bfd607b05c..29dfa5a285bf 100644 --- a/src/data/history.ts +++ b/src/data/history.ts @@ -1,4 +1,4 @@ -import { +import type { HassConfig, HassEntities, HassEntity, @@ -7,9 +7,9 @@ import { import { computeDomain } from "../common/entity/compute_domain"; import { computeStateDisplayFromEntityAttributes } from "../common/entity/compute_state_display"; import { computeStateNameFromEntityAttributes } from "../common/entity/compute_state_name"; -import { LocalizeFunc } from "../common/translations/localize"; -import { HomeAssistant } from "../types"; -import { FrontendLocaleData } from "./translation"; +import type { LocalizeFunc } from "../common/translations/localize"; +import type { HomeAssistant } from "../types"; +import type { FrontendLocaleData } from "./translation"; const DOMAINS_USE_LAST_UPDATED = ["climate", "humidifier", "water_heater"]; const NEED_ATTRIBUTE_DOMAINS = [ diff --git a/src/data/humidifier.ts b/src/data/humidifier.ts index b0598ea798a0..4a2fb4bb6a87 100644 --- a/src/data/humidifier.ts +++ b/src/data/humidifier.ts @@ -1,4 +1,4 @@ -import { +import type { HassEntityAttributeBase, HassEntityBase, } from "home-assistant-js-websocket"; diff --git a/src/data/icons.ts b/src/data/icons.ts index 90baec19074f..2f22a0850cfc 100644 --- a/src/data/icons.ts +++ b/src/data/icons.ts @@ -1,10 +1,10 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { computeDomain } from "../common/entity/compute_domain"; import { computeObjectId } from "../common/entity/compute_object_id"; import { computeStateDomain } from "../common/entity/compute_state_domain"; import { stateIcon } from "../common/entity/state_icon"; -import { HomeAssistant } from "../types"; -import { +import type { HomeAssistant } from "../types"; +import type { EntityRegistryDisplayEntry, EntityRegistryEntry, } from "./entity_registry"; diff --git a/src/data/iconsets.ts b/src/data/iconsets.ts index c2733641a02c..9cee9041c526 100644 --- a/src/data/iconsets.ts +++ b/src/data/iconsets.ts @@ -1,7 +1,7 @@ import { clear, get, set, createStore, promisifyRequest } from "idb-keyval"; import { promiseTimeout } from "../common/util/promise-timeout"; import { iconMetadata } from "../resources/icon-metadata"; -import { IconMeta } from "../types"; +import type { IconMeta } from "../types"; export interface Icons { [key: string]: string; diff --git a/src/data/image.ts b/src/data/image.ts index f28ea7486026..20fd9b99b312 100644 --- a/src/data/image.ts +++ b/src/data/image.ts @@ -1,4 +1,4 @@ -import { +import type { HassEntityAttributeBase, HassEntityBase, } from "home-assistant-js-websocket"; diff --git a/src/data/image_upload.ts b/src/data/image_upload.ts index d9e93095f50e..37ed69a0ccdc 100644 --- a/src/data/image_upload.ts +++ b/src/data/image_upload.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; interface Image { filesize: number; diff --git a/src/data/input_boolean.ts b/src/data/input_boolean.ts index b0393bbd92c9..8d47dd3dd629 100644 --- a/src/data/input_boolean.ts +++ b/src/data/input_boolean.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export interface InputBoolean { id: string; diff --git a/src/data/input_button.ts b/src/data/input_button.ts index 785a381a4881..d3782d6c7ab8 100644 --- a/src/data/input_button.ts +++ b/src/data/input_button.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export interface InputButton { id: string; diff --git a/src/data/input_datetime.ts b/src/data/input_datetime.ts index 5a5d0182c69d..069f69a1721b 100644 --- a/src/data/input_datetime.ts +++ b/src/data/input_datetime.ts @@ -1,5 +1,5 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { HomeAssistant } from "../types"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { HomeAssistant } from "../types"; export interface InputDateTime { id: string; diff --git a/src/data/input_number.ts b/src/data/input_number.ts index 7efd128c018b..67368881be35 100644 --- a/src/data/input_number.ts +++ b/src/data/input_number.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export interface InputNumber { id: string; diff --git a/src/data/input_select.ts b/src/data/input_select.ts index 2137fd169303..e8f1d22b70bd 100644 --- a/src/data/input_select.ts +++ b/src/data/input_select.ts @@ -1,8 +1,8 @@ -import { +import type { HassEntityAttributeBase, HassEntityBase, } from "home-assistant-js-websocket"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; interface InputSelectEntityAttributes extends HassEntityAttributeBase { options: string[]; diff --git a/src/data/input_text.ts b/src/data/input_text.ts index 5e6c7e1225bc..66577645842a 100644 --- a/src/data/input_text.ts +++ b/src/data/input_text.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export interface InputText { id: string; diff --git a/src/data/integration.ts b/src/data/integration.ts index 78303f7b1c98..5a60b9454c88 100644 --- a/src/data/integration.ts +++ b/src/data/integration.ts @@ -1,6 +1,7 @@ -import { Connection, createCollection } from "home-assistant-js-websocket"; -import { LocalizeFunc } from "../common/translations/localize"; -import { HomeAssistant } from "../types"; +import type { Connection } from "home-assistant-js-websocket"; +import { createCollection } from "home-assistant-js-websocket"; +import type { LocalizeFunc } from "../common/translations/localize"; +import type { HomeAssistant } from "../types"; import { debounce } from "../common/util/debounce"; export const integrationsWithPanel = { diff --git a/src/data/integrations.ts b/src/data/integrations.ts index fdd9c68f317a..a006bdb51cb3 100644 --- a/src/data/integrations.ts +++ b/src/data/integrations.ts @@ -1,5 +1,5 @@ -import { HomeAssistant } from "../types"; -import { IntegrationType } from "./integration"; +import type { HomeAssistant } from "../types"; +import type { IntegrationType } from "./integration"; export type IotStandards = "zwave" | "zigbee" | "homekit" | "matter"; diff --git a/src/data/label_registry.ts b/src/data/label_registry.ts index 8c8f481e5722..1ee1a9e9caae 100644 --- a/src/data/label_registry.ts +++ b/src/data/label_registry.ts @@ -1,9 +1,10 @@ -import { Connection, createCollection } from "home-assistant-js-websocket"; -import { Store } from "home-assistant-js-websocket/dist/store"; +import type { Connection } from "home-assistant-js-websocket"; +import { createCollection } from "home-assistant-js-websocket"; +import type { Store } from "home-assistant-js-websocket/dist/store"; import { stringCompare } from "../common/string/compare"; import { debounce } from "../common/util/debounce"; -import { HomeAssistant } from "../types"; -import { RegistryEntry } from "./registry"; +import type { HomeAssistant } from "../types"; +import type { RegistryEntry } from "./registry"; export interface LabelRegistryEntry extends RegistryEntry { label_id: string; diff --git a/src/data/lawn_mower.ts b/src/data/lawn_mower.ts index a5ab76c9216f..21b0aff59b1b 100644 --- a/src/data/lawn_mower.ts +++ b/src/data/lawn_mower.ts @@ -1,4 +1,4 @@ -import { +import type { HassEntityAttributeBase, HassEntityBase, } from "home-assistant-js-websocket"; diff --git a/src/data/light.ts b/src/data/light.ts index 8c3cfb9a4918..d2b699e5c42c 100644 --- a/src/data/light.ts +++ b/src/data/light.ts @@ -1,4 +1,4 @@ -import { +import type { HassEntityAttributeBase, HassEntityBase, } from "home-assistant-js-websocket"; diff --git a/src/data/lock.ts b/src/data/lock.ts index 17acf134877f..ddf4f89122bf 100644 --- a/src/data/lock.ts +++ b/src/data/lock.ts @@ -1,10 +1,10 @@ -import { +import type { HassEntityAttributeBase, HassEntityBase, } from "home-assistant-js-websocket"; import { getExtendedEntityRegistryEntry } from "./entity_registry"; import { showEnterCodeDialog } from "../dialogs/enter-code/show-enter-code-dialog"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import { UNAVAILABLE } from "./entity"; export const enum LockEntityFeature { diff --git a/src/data/logbook.ts b/src/data/logbook.ts index 80466f42aca1..712680ae9073 100644 --- a/src/data/logbook.ts +++ b/src/data/logbook.ts @@ -1,4 +1,4 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { BINARY_STATE_OFF, BINARY_STATE_ON, @@ -7,9 +7,9 @@ import { import { computeDomain } from "../common/entity/compute_domain"; import { computeStateDomain } from "../common/entity/compute_state_domain"; import { autoCaseNoun } from "../common/translations/auto_case_noun"; -import { LocalizeFunc } from "../common/translations/localize"; -import { HaEntityPickerEntityFilterFunc } from "../components/entity/ha-entity-picker"; -import { HomeAssistant } from "../types"; +import type { LocalizeFunc } from "../common/translations/localize"; +import type { HaEntityPickerEntityFilterFunc } from "../components/entity/ha-entity-picker"; +import type { HomeAssistant } from "../types"; import { UNAVAILABLE, UNKNOWN } from "./entity"; const LOGBOOK_LOCALIZE_PATH = "ui.components.logbook.messages"; diff --git a/src/data/lovelace.ts b/src/data/lovelace.ts index 1b4f47aa3803..98ed39e912fe 100644 --- a/src/data/lovelace.ts +++ b/src/data/lovelace.ts @@ -1,16 +1,14 @@ -import { - Connection, - getCollection, - HassEventBase, -} from "home-assistant-js-websocket"; -import { HuiBadge } from "../panels/lovelace/badges/hui-badge"; +import type { Connection, HassEventBase } from "home-assistant-js-websocket"; +import { getCollection } from "home-assistant-js-websocket"; +import type { HuiBadge } from "../panels/lovelace/badges/hui-badge"; import type { HuiCard } from "../panels/lovelace/cards/hui-card"; import type { HuiSection } from "../panels/lovelace/sections/hui-section"; -import { Lovelace } from "../panels/lovelace/types"; -import { HomeAssistant } from "../types"; -import { LovelaceSectionConfig } from "./lovelace/config/section"; -import { fetchConfig, LegacyLovelaceConfig } from "./lovelace/config/types"; -import { LovelaceViewConfig } from "./lovelace/config/view"; +import type { Lovelace } from "../panels/lovelace/types"; +import type { HomeAssistant } from "../types"; +import type { LovelaceSectionConfig } from "./lovelace/config/section"; +import type { LegacyLovelaceConfig } from "./lovelace/config/types"; +import { fetchConfig } from "./lovelace/config/types"; +import type { LovelaceViewConfig } from "./lovelace/config/view"; export interface LovelacePanelConfig { mode: "yaml" | "storage"; @@ -36,6 +34,7 @@ export interface LovelaceSectionElement extends HTMLElement { index?: number; cards?: HuiCard[]; isStrategy: boolean; + importOnly?: boolean; setConfig(config: LovelaceSectionConfig): void; } diff --git a/src/data/lovelace/action_handler.ts b/src/data/lovelace/action_handler.ts index 5ad2ef2982c5..181d624411c9 100644 --- a/src/data/lovelace/action_handler.ts +++ b/src/data/lovelace/action_handler.ts @@ -1,4 +1,4 @@ -import { HASSDomEvent } from "../../common/dom/fire_event"; +import type { HASSDomEvent } from "../../common/dom/fire_event"; export interface ActionHandlerOptions { hasHold?: boolean; diff --git a/src/data/lovelace/config/badge.ts b/src/data/lovelace/config/badge.ts index ee586b5abfa7..a6b0734b431d 100644 --- a/src/data/lovelace/config/badge.ts +++ b/src/data/lovelace/config/badge.ts @@ -1,4 +1,4 @@ -import { Condition } from "../../../panels/lovelace/common/validate-condition"; +import type { Condition } from "../../../panels/lovelace/common/validate-condition"; export interface LovelaceBadgeConfig { type: string; diff --git a/src/data/matter.ts b/src/data/matter.ts index 10534f181a06..b08cf0dd05cf 100644 --- a/src/data/matter.ts +++ b/src/data/matter.ts @@ -1,6 +1,6 @@ -import { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; import { navigate } from "../common/navigate"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import { subscribeDeviceRegistry } from "./device_registry"; import { isComponentLoaded } from "../common/config/is_component_loaded"; import { getThreadDataSetTLV, listThreadDataSets } from "./thread"; diff --git a/src/data/media-player.ts b/src/data/media-player.ts index 11716181dfdb..a5faaa1c3260 100644 --- a/src/data/media-player.ts +++ b/src/data/media-player.ts @@ -34,7 +34,7 @@ import type { } from "home-assistant-js-websocket"; import { supportsFeature } from "../common/entity/supports-feature"; import { stateActive } from "../common/entity/state_active"; -import { MediaPlayerItemId } from "../components/media-player/ha-media-player-browse"; +import type { MediaPlayerItemId } from "../components/media-player/ha-media-player-browse"; import type { HomeAssistant, TranslationDict } from "../types"; import { isUnavailableState } from "./entity"; import { isTTSMediaSource } from "./tts"; diff --git a/src/data/media_source.ts b/src/data/media_source.ts index a6e93d83cf93..f9950b83d70e 100644 --- a/src/data/media_source.ts +++ b/src/data/media_source.ts @@ -1,5 +1,5 @@ -import { HomeAssistant } from "../types"; -import { MediaPlayerItem } from "./media-player"; +import type { HomeAssistant } from "../types"; +import type { MediaPlayerItem } from "./media-player"; export interface ResolvedMediaSource { url: string; diff --git a/src/data/mqtt.ts b/src/data/mqtt.ts index 151097bdd6a8..a705a928f103 100644 --- a/src/data/mqtt.ts +++ b/src/data/mqtt.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export interface MQTTMessage { topic: string; diff --git a/src/data/network.ts b/src/data/network.ts index 10482557ac1d..55a96c241051 100644 --- a/src/data/network.ts +++ b/src/data/network.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export interface IPv6ConfiguredAddress { address: string; diff --git a/src/data/notify_html5.ts b/src/data/notify_html5.ts index 9aa643168a0a..f252c8928856 100644 --- a/src/data/notify_html5.ts +++ b/src/data/notify_html5.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; function urlBase64ToUint8Array(base64String) { const padding = "=".repeat((4 - (base64String.length % 4)) % 4); diff --git a/src/data/number.ts b/src/data/number.ts index 6f90f612cd9f..5bdfdbc17688 100644 --- a/src/data/number.ts +++ b/src/data/number.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export type NumberDeviceClassUnits = { units: string[] }; diff --git a/src/data/onboarding.ts b/src/data/onboarding.ts index 170bbadee85d..0df2891bbf38 100644 --- a/src/data/onboarding.ts +++ b/src/data/onboarding.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import { handleFetchPromise } from "../util/hass-call-api"; export interface InstallationType { diff --git a/src/data/openstreetmap.ts b/src/data/openstreetmap.ts index 3428d46f74f6..5bd541b088aa 100644 --- a/src/data/openstreetmap.ts +++ b/src/data/openstreetmap.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export interface OpenStreetMapPlace { place_id: number; diff --git a/src/data/options_flow.ts b/src/data/options_flow.ts index 6b710d89a90e..ae489b251256 100644 --- a/src/data/options_flow.ts +++ b/src/data/options_flow.ts @@ -1,5 +1,5 @@ -import { HomeAssistant } from "../types"; -import { DataEntryFlowStep } from "./data_entry_flow"; +import type { HomeAssistant } from "../types"; +import type { DataEntryFlowStep } from "./data_entry_flow"; export const createOptionsFlow = (hass: HomeAssistant, handler: string) => hass.callApi( diff --git a/src/data/otbr.ts b/src/data/otbr.ts index ec831bf67184..3d46bb6a384e 100644 --- a/src/data/otbr.ts +++ b/src/data/otbr.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export interface OTBRInfo { active_dataset_tlvs: string; diff --git a/src/data/panel.ts b/src/data/panel.ts index 76c716e56ca1..e6470e315eb5 100644 --- a/src/data/panel.ts +++ b/src/data/panel.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../common/dom/fire_event"; -import { HomeAssistant, PanelInfo } from "../types"; +import type { HomeAssistant, PanelInfo } from "../types"; /** Panel to show when no panel is picked. */ export const DEFAULT_PANEL = "lovelace"; diff --git a/src/data/panel_custom.ts b/src/data/panel_custom.ts index 0b6472c6d120..f6c31ba10be7 100644 --- a/src/data/panel_custom.ts +++ b/src/data/panel_custom.ts @@ -1,4 +1,4 @@ -import { PanelInfo } from "../types"; +import type { PanelInfo } from "../types"; export interface CustomPanelConfig { name: string; diff --git a/src/data/persistent_notification.ts b/src/data/persistent_notification.ts index 9ae0447537fa..42cd8b81c078 100644 --- a/src/data/persistent_notification.ts +++ b/src/data/persistent_notification.ts @@ -1,4 +1,4 @@ -import { +import type { Connection, HassEntity, UnsubscribeFunc, diff --git a/src/data/person.ts b/src/data/person.ts index e8ee0ba25c2d..62145b875d60 100644 --- a/src/data/person.ts +++ b/src/data/person.ts @@ -1,8 +1,8 @@ -import { +import type { HassEntityAttributeBase, HassEntityBase, } from "home-assistant-js-websocket"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export interface BasePerson { name: string; diff --git a/src/data/preloads.ts b/src/data/preloads.ts index ef2b99a3f31a..26b33b1f25f9 100644 --- a/src/data/preloads.ts +++ b/src/data/preloads.ts @@ -1,6 +1,6 @@ -import { LovelaceRawConfig } from "./lovelace/config/types"; -import { LovelaceResource } from "./lovelace/resource"; -import { RecorderInfo } from "./recorder"; +import type { LovelaceRawConfig } from "./lovelace/config/types"; +import type { LovelaceResource } from "./lovelace/resource"; +import type { RecorderInfo } from "./recorder"; export interface WindowWithPreloads extends Window { llConfProm?: Promise; diff --git a/src/data/preview.ts b/src/data/preview.ts index 1c3a24c7779f..0018f1fe1c46 100644 --- a/src/data/preview.ts +++ b/src/data/preview.ts @@ -1,5 +1,5 @@ -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { HomeAssistant } from "../types"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { HomeAssistant } from "../types"; const HAS_CUSTOM_PREVIEW = ["template"]; diff --git a/src/data/recorder.ts b/src/data/recorder.ts index d6d2b215cff8..e8ca20674755 100644 --- a/src/data/recorder.ts +++ b/src/data/recorder.ts @@ -1,7 +1,7 @@ -import { Connection } from "home-assistant-js-websocket"; +import type { Connection } from "home-assistant-js-websocket"; import { computeStateName } from "../common/entity/compute_state_name"; -import { HaDurationData } from "../components/ha-duration-input"; -import { HomeAssistant } from "../types"; +import type { HaDurationData } from "../components/ha-duration-input"; +import type { HomeAssistant } from "../types"; export interface RecorderInfo { backlog: number | null; diff --git a/src/data/remote.ts b/src/data/remote.ts index 1f87a2038efd..ac298f5a5ef6 100644 --- a/src/data/remote.ts +++ b/src/data/remote.ts @@ -1,4 +1,4 @@ -import { +import type { HassEntityAttributeBase, HassEntityBase, } from "home-assistant-js-websocket"; diff --git a/src/data/scene.ts b/src/data/scene.ts index b9b6fa4d2cf4..ee56c30c2d88 100644 --- a/src/data/scene.ts +++ b/src/data/scene.ts @@ -1,9 +1,9 @@ -import { +import type { HassEntityAttributeBase, HassEntityBase, } from "home-assistant-js-websocket"; import { navigate } from "../common/navigate"; -import { HomeAssistant, ServiceCallResponse } from "../types"; +import type { HomeAssistant, ServiceCallResponse } from "../types"; export const SCENE_IGNORED_DOMAINS = [ "binary_sensor", diff --git a/src/data/schedule.ts b/src/data/schedule.ts index 7de811135420..d69eddfa6384 100644 --- a/src/data/schedule.ts +++ b/src/data/schedule.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export const weekdays = [ "sunday", diff --git a/src/data/script.ts b/src/data/script.ts index c2273d18d576..c7e08fc12911 100644 --- a/src/data/script.ts +++ b/src/data/script.ts @@ -1,8 +1,9 @@ -import { +import type { HassEntityAttributeBase, HassEntityBase, HassServiceTarget, } from "home-assistant-js-websocket"; +import type { Describe } from "superstruct"; import { object, optional, @@ -12,21 +13,20 @@ import { assign, literal, is, - Describe, boolean, } from "superstruct"; import { arrayLiteralIncludes } from "../common/array/literal-includes"; import { navigate } from "../common/navigate"; -import { HomeAssistant } from "../types"; -import { +import type { HomeAssistant } from "../types"; +import type { Condition, - migrateAutomationTrigger, ShorthandAndCondition, ShorthandNotCondition, ShorthandOrCondition, Trigger, } from "./automation"; -import { BlueprintInput } from "./blueprint"; +import { migrateAutomationTrigger } from "./automation"; +import type { BlueprintInput } from "./blueprint"; import { computeObjectId } from "../common/entity/compute_object_id"; import { createSearchParam } from "../common/url/search-params"; @@ -224,13 +224,14 @@ export interface ForEachRepeat extends BaseRepeat { for_each: string | any[]; } -export interface ChooseActionChoice extends BaseAction { +export interface Option { + alias?: string; conditions: string | Condition[]; sequence: Action | Action[]; } export interface ChooseAction extends BaseAction { - choose: ChooseActionChoice | ChooseActionChoice[] | null; + choose: Option | Option[] | null; default?: Action | Action[]; } diff --git a/src/data/script_i18n.ts b/src/data/script_i18n.ts index 15bac4372d3e..03b7f69fd7a0 100644 --- a/src/data/script_i18n.ts +++ b/src/data/script_i18n.ts @@ -4,20 +4,20 @@ import secondsToDuration from "../common/datetime/seconds_to_duration"; import { computeStateName } from "../common/entity/compute_state_name"; import { formatListWithAnds } from "../common/string/format-list"; import { isTemplate } from "../common/string/has-template"; -import { HomeAssistant } from "../types"; -import { Condition } from "./automation"; +import type { HomeAssistant } from "../types"; +import type { Condition } from "./automation"; import { describeCondition } from "./automation_i18n"; import { localizeDeviceAutomationAction } from "./device_automation"; import { computeDeviceName } from "./device_registry"; +import type { EntityRegistryEntry } from "./entity_registry"; import { - EntityRegistryEntry, computeEntityRegistryName, entityRegistryById, } from "./entity_registry"; -import { FloorRegistryEntry } from "./floor_registry"; +import type { FloorRegistryEntry } from "./floor_registry"; import { domainToName } from "./integration"; -import { LabelRegistryEntry } from "./label_registry"; -import { +import type { LabelRegistryEntry } from "./label_registry"; +import type { ActionType, ActionTypes, ChooseAction, @@ -34,8 +34,8 @@ import { StopAction, VariablesAction, WaitForTriggerAction, - getActionType, } from "./script"; +import { getActionType } from "./script"; const actionTranslationBaseKey = "ui.panel.config.automation.editor.actions.type"; diff --git a/src/data/search.ts b/src/data/search.ts index e184f13e7561..1a7dd930ec86 100644 --- a/src/data/search.ts +++ b/src/data/search.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export interface RelatedResult { area?: string[]; diff --git a/src/data/select.ts b/src/data/select.ts index 9d7058d8ceb7..d2c24fc02d50 100644 --- a/src/data/select.ts +++ b/src/data/select.ts @@ -1,8 +1,8 @@ -import { +import type { HassEntityAttributeBase, HassEntityBase, } from "home-assistant-js-websocket"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; interface SelectEntityAttributes extends HassEntityAttributeBase { options: string[]; diff --git a/src/data/selector.ts b/src/data/selector.ts index 6ed4517170e4..c72dacc4f187 100644 --- a/src/data/selector.ts +++ b/src/data/selector.ts @@ -4,17 +4,17 @@ import { computeStateDomain } from "../common/entity/compute_state_domain"; import { supportsFeature } from "../common/entity/supports-feature"; import type { CropOptions } from "../dialogs/image-cropper-dialog/show-image-cropper-dialog"; import { isHelperDomain } from "../panels/config/helpers/const"; -import { UiAction } from "../panels/lovelace/components/hui-action-editor"; -import { HomeAssistant, ItemPath } from "../types"; +import type { UiAction } from "../panels/lovelace/components/hui-action-editor"; +import type { HomeAssistant } from "../types"; import { - DeviceRegistryEntry, + type DeviceRegistryEntry, getDeviceIntegrationLookup, } from "./device_registry"; -import { +import type { EntityRegistryDisplayEntry, EntityRegistryEntry, } from "./entity_registry"; -import { EntitySources } from "./entity_sources"; +import type { EntitySources } from "./entity_sources"; export type Selector = | ActionSelector @@ -68,9 +68,8 @@ export type Selector = | UiStateContentSelector; export interface ActionSelector { - action: { - path?: ItemPath; - } | null; + // eslint-disable-next-line @typescript-eslint/ban-types + action: {} | null; } export interface AddonSelector { @@ -121,9 +120,8 @@ export interface ColorTempSelector { } export interface ConditionSelector { - condition: { - path?: ItemPath; - } | null; + // eslint-disable-next-line @typescript-eslint/ban-types + condition: {} | null; } export interface ConversationAgentSelector { @@ -432,9 +430,8 @@ export interface TimeSelector { } export interface TriggerSelector { - trigger: { - path?: ItemPath; - } | null; + // eslint-disable-next-line @typescript-eslint/ban-types + trigger: {} | null; } export interface TTSSelector { diff --git a/src/data/sensor.ts b/src/data/sensor.ts index 2be4a70024d5..f4ac62a38517 100644 --- a/src/data/sensor.ts +++ b/src/data/sensor.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export const SENSOR_DEVICE_CLASS_BATTERY = "battery"; export const SENSOR_DEVICE_CLASS_TIMESTAMP = "timestamp"; diff --git a/src/data/service.ts b/src/data/service.ts index 70b05a2f14ed..93950a511233 100644 --- a/src/data/service.ts +++ b/src/data/service.ts @@ -1,5 +1,5 @@ -import { Context, HomeAssistant } from "../types"; -import { Action } from "./script"; +import type { Context, HomeAssistant } from "../types"; +import type { Action } from "./script"; export const callExecuteScript = ( hass: HomeAssistant, diff --git a/src/data/stt.ts b/src/data/stt.ts index 58cdff5b5c5c..33fef082954d 100644 --- a/src/data/stt.ts +++ b/src/data/stt.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export interface SpeechMetadata { language: string; diff --git a/src/data/supervisor/common.ts b/src/data/supervisor/common.ts index b47f76bc4d0c..fb4e3a700b63 100644 --- a/src/data/supervisor/common.ts +++ b/src/data/supervisor/common.ts @@ -1,6 +1,7 @@ import { atLeastVersion } from "../../common/config/version"; -import { HomeAssistant } from "../../types"; -import { hassioApiResultExtractor, HassioResponse } from "../hassio/common"; +import type { HomeAssistant } from "../../types"; +import type { HassioResponse } from "../hassio/common"; +import { hassioApiResultExtractor } from "../hassio/common"; export interface SupervisorApiCallOptions { method?: "get" | "post" | "delete"; diff --git a/src/data/supervisor/core.ts b/src/data/supervisor/core.ts index 5e816a882228..c3264e522547 100644 --- a/src/data/supervisor/core.ts +++ b/src/data/supervisor/core.ts @@ -1,6 +1,6 @@ import { atLeastVersion } from "../../common/config/version"; -import { HomeAssistant } from "../../types"; -import { HassioResponse } from "../hassio/common"; +import type { HomeAssistant } from "../../types"; +import type { HassioResponse } from "../hassio/common"; export const restartCore = async (hass: HomeAssistant) => { await hass.callService("homeassistant", "restart"); diff --git a/src/data/supervisor/mounts.ts b/src/data/supervisor/mounts.ts index ea4fc8da6f7f..1f3dae571222 100644 --- a/src/data/supervisor/mounts.ts +++ b/src/data/supervisor/mounts.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; export enum SupervisorMountType { BIND = "bind", diff --git a/src/data/supervisor/store.ts b/src/data/supervisor/store.ts index b777009caa9f..4aff29429662 100644 --- a/src/data/supervisor/store.ts +++ b/src/data/supervisor/store.ts @@ -1,7 +1,7 @@ -import { HomeAssistant } from "../../types"; -import { AddonRole, AddonStage } from "../hassio/addon"; +import type { HomeAssistant } from "../../types"; +import type { AddonRole, AddonStage } from "../hassio/addon"; import { supervisorApiCall } from "./common"; -import { SupervisorArch } from "./supervisor"; +import type { SupervisorArch } from "./supervisor"; export interface StoreAddon { advanced: boolean; diff --git a/src/data/supervisor/supervisor.ts b/src/data/supervisor/supervisor.ts index fd0f19685f03..c047b8ee1e13 100644 --- a/src/data/supervisor/supervisor.ts +++ b/src/data/supervisor/supervisor.ts @@ -1,20 +1,21 @@ -import { Connection, getCollection } from "home-assistant-js-websocket"; -import { Store } from "home-assistant-js-websocket/dist/store"; -import { +import type { Connection } from "home-assistant-js-websocket"; +import { getCollection } from "home-assistant-js-websocket"; +import type { Store } from "home-assistant-js-websocket/dist/store"; +import type { FlattenObjectKeys, LocalizeFunc, } from "../../common/translations/localize"; -import { TranslationDict } from "../../types"; -import { HassioAddonsInfo } from "../hassio/addon"; -import { HassioHassOSInfo, HassioHostInfo } from "../hassio/host"; -import { NetworkInfo } from "../hassio/network"; -import { HassioResolution } from "../hassio/resolution"; -import { +import type { TranslationDict } from "../../types"; +import type { HassioAddonsInfo } from "../hassio/addon"; +import type { HassioHassOSInfo, HassioHostInfo } from "../hassio/host"; +import type { NetworkInfo } from "../hassio/network"; +import type { HassioResolution } from "../hassio/resolution"; +import type { HassioHomeAssistantInfo, HassioInfo, HassioSupervisorInfo, } from "../hassio/supervisor"; -import { SupervisorStore } from "./store"; +import type { SupervisorStore } from "./store"; export const supervisorWSbaseCommand = { type: "supervisor/api", diff --git a/src/data/system_health.ts b/src/data/system_health.ts index a98ef79b4f60..b08f9b779e23 100644 --- a/src/data/system_health.ts +++ b/src/data/system_health.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; interface SystemCheckValueDateObject { type: "date"; diff --git a/src/data/system_log.ts b/src/data/system_log.ts index 593fcba0d685..07176461b171 100644 --- a/src/data/system_log.ts +++ b/src/data/system_log.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export type SystemLogLevel = | "critical" diff --git a/src/data/tag.ts b/src/data/tag.ts index b3d4c7bd8634..297712db0d19 100644 --- a/src/data/tag.ts +++ b/src/data/tag.ts @@ -1,5 +1,5 @@ -import { HassEventBase } from "home-assistant-js-websocket"; -import { HomeAssistant } from "../types"; +import type { HassEventBase } from "home-assistant-js-websocket"; +import type { HomeAssistant } from "../types"; export const EVENT_TAG_SCANNED = "tag_scanned"; diff --git a/src/data/text.ts b/src/data/text.ts index 45b501f4572c..2726cde318f3 100644 --- a/src/data/text.ts +++ b/src/data/text.ts @@ -1,8 +1,8 @@ -import { +import type { HassEntityAttributeBase, HassEntityBase, } from "home-assistant-js-websocket"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; interface TextEntityAttributes extends HassEntityAttributeBase { min?: number; diff --git a/src/data/thread.ts b/src/data/thread.ts index 26bd38fc8424..92391477e7ee 100644 --- a/src/data/thread.ts +++ b/src/data/thread.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export interface ThreadRouter { instance_name: string; diff --git a/src/data/time.ts b/src/data/time.ts index 7bc0e85172ca..e2dd9a5dc62f 100644 --- a/src/data/time.ts +++ b/src/data/time.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export const setTimeValue = ( hass: HomeAssistant, diff --git a/src/data/timer.ts b/src/data/timer.ts index 3290be645d7d..977a3fb486ff 100644 --- a/src/data/timer.ts +++ b/src/data/timer.ts @@ -1,11 +1,11 @@ -import { +import type { HassEntity, HassEntityAttributeBase, HassEntityBase, } from "home-assistant-js-websocket"; import durationToSeconds from "../common/datetime/duration_to_seconds"; import secondsToDuration from "../common/datetime/seconds_to_duration"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export type TimerEntity = HassEntityBase & { attributes: HassEntityAttributeBase & { diff --git a/src/data/todo.ts b/src/data/todo.ts index 659c8d0c3c24..cb1a79447855 100644 --- a/src/data/todo.ts +++ b/src/data/todo.ts @@ -1,4 +1,4 @@ -import { HomeAssistant, ServiceCallResponse } from "../types"; +import type { HomeAssistant, ServiceCallResponse } from "../types"; import { computeDomain } from "../common/entity/compute_domain"; import { computeStateName } from "../common/entity/compute_state_name"; import { isUnavailableState } from "./entity"; diff --git a/src/data/trace.ts b/src/data/trace.ts index 0bdd60f7b5e2..8f2d47488088 100644 --- a/src/data/trace.ts +++ b/src/data/trace.ts @@ -1,11 +1,11 @@ import { strStartsWith } from "../common/string/starts-with"; -import { Context, HomeAssistant } from "../types"; -import { +import type { Context, HomeAssistant } from "../types"; +import type { BlueprintAutomationConfig, ManualAutomationConfig, - flattenTriggers, } from "./automation"; -import { BlueprintScriptConfig, ScriptConfig } from "./script"; +import { flattenTriggers } from "./automation"; +import type { BlueprintScriptConfig, ScriptConfig } from "./script"; interface BaseTraceStep { path: string; diff --git a/src/data/translation.ts b/src/data/translation.ts index e4824b0e636f..5db27ac98708 100644 --- a/src/data/translation.ts +++ b/src/data/translation.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import { fetchFrontendUserData, saveFrontendUserData } from "./frontend"; export enum NumberFormat { diff --git a/src/data/trigger.ts b/src/data/trigger.ts index 88877e722fdc..c6bb2f688a6a 100644 --- a/src/data/trigger.ts +++ b/src/data/trigger.ts @@ -22,7 +22,11 @@ import { } from "@mdi/js"; import { mdiHomeAssistant } from "../resources/home-assistant-logo-svg"; -import { AutomationElementGroup, Trigger, TriggerList } from "./automation"; +import type { + AutomationElementGroup, + Trigger, + TriggerList, +} from "./automation"; export const TRIGGER_ICONS = { calendar: mdiCalendar, diff --git a/src/data/tts.ts b/src/data/tts.ts index b95c12cc3b59..ba03244aa0a8 100644 --- a/src/data/tts.ts +++ b/src/data/tts.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export interface TTSEngine { engine_id: string; diff --git a/src/data/update.ts b/src/data/update.ts index 2a21a0c75bc5..094ba32552d9 100644 --- a/src/data/update.ts +++ b/src/data/update.ts @@ -11,7 +11,7 @@ import { supportsFeature } from "../common/entity/supports-feature"; import { formatNumber } from "../common/number/format_number"; import { caseInsensitiveStringCompare } from "../common/string/compare"; import { showAlertDialog } from "../dialogs/generic/show-dialog-box"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import { showToast } from "../util/toast"; export enum UpdateEntityFeature { diff --git a/src/data/usb.ts b/src/data/usb.ts index 03246a2dadcd..fe7d14e32447 100644 --- a/src/data/usb.ts +++ b/src/data/usb.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export const scanUSBDevices = (hass: HomeAssistant) => hass.callWS({ type: "usb/scan" }); diff --git a/src/data/user.ts b/src/data/user.ts index 9ffc23ba2f44..6c9d5e4c88d9 100644 --- a/src/data/user.ts +++ b/src/data/user.ts @@ -4,8 +4,8 @@ import { mdiHomeCircleOutline, mdiCancel, } from "@mdi/js"; -import { HomeAssistant, TranslationDict } from "../types"; -import { Credential } from "./auth"; +import type { HomeAssistant, TranslationDict } from "../types"; +import type { Credential } from "./auth"; export const SYSTEM_GROUP_ID_ADMIN = "system-admin"; export const SYSTEM_GROUP_ID_USER = "system-users"; diff --git a/src/data/vacuum.ts b/src/data/vacuum.ts index a5828d028a9d..75d447379b2c 100644 --- a/src/data/vacuum.ts +++ b/src/data/vacuum.ts @@ -1,4 +1,4 @@ -import { +import type { HassEntityAttributeBase, HassEntityBase, } from "home-assistant-js-websocket"; diff --git a/src/data/valve.ts b/src/data/valve.ts index 645ca82e4954..b7504f8e3d48 100644 --- a/src/data/valve.ts +++ b/src/data/valve.ts @@ -1,10 +1,10 @@ -import { +import type { HassEntityAttributeBase, HassEntityBase, } from "home-assistant-js-websocket"; import { UNAVAILABLE } from "./entity"; import { stateActive } from "../common/entity/state_active"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export const enum ValveEntityFeature { OPEN = 1, diff --git a/src/data/weather.ts b/src/data/weather.ts index e73b8fd2d663..609f83ba8390 100644 --- a/src/data/weather.ts +++ b/src/data/weather.ts @@ -20,12 +20,13 @@ import { mdiWeatherWindy, mdiWeatherWindyVariant, } from "@mdi/js"; -import { +import type { HassConfig, HassEntityAttributeBase, HassEntityBase, } from "home-assistant-js-websocket"; -import { SVGTemplateResult, TemplateResult, css, html, svg } from "lit"; +import type { SVGTemplateResult, TemplateResult } from "lit"; +import { css, html, svg } from "lit"; import { styleMap } from "lit/directives/style-map"; import { supportsFeature } from "../common/entity/supports-feature"; import { round } from "../common/number/round"; diff --git a/src/data/webhook.ts b/src/data/webhook.ts index 1332de74b2f8..0cc9384eae05 100644 --- a/src/data/webhook.ts +++ b/src/data/webhook.ts @@ -1,4 +1,4 @@ -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export interface Webhook { webhook_id: string; diff --git a/src/data/ws-area_registry.ts b/src/data/ws-area_registry.ts index 550b9a5db803..996de71380e6 100644 --- a/src/data/ws-area_registry.ts +++ b/src/data/ws-area_registry.ts @@ -1,8 +1,9 @@ -import { Connection, createCollection } from "home-assistant-js-websocket"; -import { Store } from "home-assistant-js-websocket/dist/store"; +import type { Connection } from "home-assistant-js-websocket"; +import { createCollection } from "home-assistant-js-websocket"; +import type { Store } from "home-assistant-js-websocket/dist/store"; import { stringCompare } from "../common/string/compare"; import { debounce } from "../common/util/debounce"; -import { AreaRegistryEntry } from "./area_registry"; +import type { AreaRegistryEntry } from "./area_registry"; const fetchAreaRegistry = (conn: Connection) => conn diff --git a/src/data/ws-device_registry.ts b/src/data/ws-device_registry.ts index 85cc26568151..eeef3a357bc1 100644 --- a/src/data/ws-device_registry.ts +++ b/src/data/ws-device_registry.ts @@ -1,6 +1,7 @@ -import { Connection, createCollection } from "home-assistant-js-websocket"; -import { Store } from "home-assistant-js-websocket/dist/store"; -import { DeviceRegistryEntry } from "./device_registry"; +import type { Connection } from "home-assistant-js-websocket"; +import { createCollection } from "home-assistant-js-websocket"; +import type { Store } from "home-assistant-js-websocket/dist/store"; +import type { DeviceRegistryEntry } from "./device_registry"; import { debounce } from "../common/util/debounce"; export const fetchDeviceRegistry = (conn: Connection) => diff --git a/src/data/ws-entity_registry_display.ts b/src/data/ws-entity_registry_display.ts index c57229b6189a..984451a991dc 100644 --- a/src/data/ws-entity_registry_display.ts +++ b/src/data/ws-entity_registry_display.ts @@ -1,9 +1,8 @@ -import { Connection, createCollection } from "home-assistant-js-websocket"; -import { Store } from "home-assistant-js-websocket/dist/store"; -import { - EntityRegistryDisplayEntryResponse, - fetchEntityRegistryDisplay, -} from "./entity_registry"; +import type { Connection } from "home-assistant-js-websocket"; +import { createCollection } from "home-assistant-js-websocket"; +import type { Store } from "home-assistant-js-websocket/dist/store"; +import type { EntityRegistryDisplayEntryResponse } from "./entity_registry"; +import { fetchEntityRegistryDisplay } from "./entity_registry"; import { debounce } from "../common/util/debounce"; const subscribeEntityRegistryDisplayUpdates = ( diff --git a/src/data/ws-floor_registry.ts b/src/data/ws-floor_registry.ts index be9da56e90ae..a46b818f6f97 100644 --- a/src/data/ws-floor_registry.ts +++ b/src/data/ws-floor_registry.ts @@ -1,8 +1,9 @@ -import { Connection, createCollection } from "home-assistant-js-websocket"; -import { Store } from "home-assistant-js-websocket/dist/store"; +import type { Connection } from "home-assistant-js-websocket"; +import { createCollection } from "home-assistant-js-websocket"; +import type { Store } from "home-assistant-js-websocket/dist/store"; import { stringCompare } from "../common/string/compare"; import { debounce } from "../common/util/debounce"; -import { FloorRegistryEntry } from "./floor_registry"; +import type { FloorRegistryEntry } from "./floor_registry"; const fetchFloorRegistry = (conn: Connection) => conn diff --git a/src/data/ws-panels.ts b/src/data/ws-panels.ts index 984b2459cbb7..3086a69f17f2 100644 --- a/src/data/ws-panels.ts +++ b/src/data/ws-panels.ts @@ -1,5 +1,6 @@ -import { Connection, createCollection } from "home-assistant-js-websocket"; -import { Panels } from "../types"; +import type { Connection } from "home-assistant-js-websocket"; +import { createCollection } from "home-assistant-js-websocket"; +import type { Panels } from "../types"; const fetchPanels = (conn) => conn.sendMessagePromise({ diff --git a/src/data/ws-templates.ts b/src/data/ws-templates.ts index ba3bcc41d3e4..754ac1e1c6d9 100644 --- a/src/data/ws-templates.ts +++ b/src/data/ws-templates.ts @@ -1,5 +1,5 @@ -import { Connection, UnsubscribeFunc } from "home-assistant-js-websocket"; -import { HomeAssistant } from "../types"; +import type { Connection, UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { HomeAssistant } from "../types"; export interface RenderTemplateResult { result: string; diff --git a/src/data/ws-themes.ts b/src/data/ws-themes.ts index 619066e8a972..0c04a2382cef 100644 --- a/src/data/ws-themes.ts +++ b/src/data/ws-themes.ts @@ -1,4 +1,5 @@ -import { Connection, createCollection } from "home-assistant-js-websocket"; +import type { Connection } from "home-assistant-js-websocket"; +import { createCollection } from "home-assistant-js-websocket"; export interface ThemeVars { // Incomplete diff --git a/src/data/ws-user.ts b/src/data/ws-user.ts index 8d8f2d178392..60ec28b67ac0 100644 --- a/src/data/ws-user.ts +++ b/src/data/ws-user.ts @@ -1,9 +1,6 @@ -import { - Connection, - getCollection, - getUser, -} from "home-assistant-js-websocket"; -import { CurrentUser } from "../types"; +import type { Connection } from "home-assistant-js-websocket"; +import { getCollection, getUser } from "home-assistant-js-websocket"; +import type { CurrentUser } from "../types"; export const userCollection = (conn: Connection) => getCollection( diff --git a/src/data/zha.ts b/src/data/zha.ts index be61adbf9e29..8aa61c6f2c52 100644 --- a/src/data/zha.ts +++ b/src/data/zha.ts @@ -1,6 +1,6 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import type { HaFormSchema } from "../components/ha-form/types"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export interface ZHAEntityReference extends HassEntity { name: string; diff --git a/src/data/zone.ts b/src/data/zone.ts index 5f0ccb410208..ad64b4a0ce0f 100644 --- a/src/data/zone.ts +++ b/src/data/zone.ts @@ -1,5 +1,5 @@ import { navigate } from "../common/navigate"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; export interface Zone { id: string; diff --git a/src/data/zwave_js.ts b/src/data/zwave_js.ts index af4ef49bed33..af7fe06ae324 100644 --- a/src/data/zwave_js.ts +++ b/src/data/zwave_js.ts @@ -1,5 +1,5 @@ -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { HomeAssistant } from "../types"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { HomeAssistant } from "../types"; export enum InclusionState { /** The controller isn't doing anything regarding inclusion. */ diff --git a/src/dialogs/area-filter/area-filter-dialog.ts b/src/dialogs/area-filter/area-filter-dialog.ts index 1e26064aa0bb..df8be2168d94 100644 --- a/src/dialogs/area-filter/area-filter-dialog.ts +++ b/src/dialogs/area-filter/area-filter-dialog.ts @@ -1,6 +1,7 @@ import "@material/mwc-list/mwc-list"; import { mdiDrag, mdiEye, mdiEyeOff } from "@mdi/js"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { repeat } from "lit/directives/repeat"; @@ -13,9 +14,9 @@ import "../../components/ha-list-item"; import "../../components/ha-sortable"; import { areaCompare } from "../../data/area_registry"; import { haStyleDialog } from "../../resources/styles"; -import { HomeAssistant } from "../../types"; -import { HassDialog } from "../make-dialog-manager"; -import { AreaFilterDialogParams } from "./show-area-filter-dialog"; +import type { HomeAssistant } from "../../types"; +import type { HassDialog } from "../make-dialog-manager"; +import type { AreaFilterDialogParams } from "./show-area-filter-dialog"; @customElement("dialog-area-filter") export class DialogAreaFilter diff --git a/src/dialogs/config-entry-system-options/dialog-config-entry-system-options.ts b/src/dialogs/config-entry-system-options/dialog-config-entry-system-options.ts index da3f8276dfa9..d6334169e5d1 100644 --- a/src/dialogs/config-entry-system-options/dialog-config-entry-system-options.ts +++ b/src/dialogs/config-entry-system-options/dialog-config-entry-system-options.ts @@ -1,19 +1,18 @@ import "@material/mwc-button/mwc-button"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import "../../components/ha-dialog"; import "../../components/ha-formfield"; import "../../components/ha-switch"; import type { HaSwitch } from "../../components/ha-switch"; -import { - ConfigEntryMutableParams, - updateConfigEntry, -} from "../../data/config_entries"; +import type { ConfigEntryMutableParams } from "../../data/config_entries"; +import { updateConfigEntry } from "../../data/config_entries"; import { haStyleDialog } from "../../resources/styles"; import type { HomeAssistant } from "../../types"; import { showAlertDialog } from "../generic/show-dialog-box"; -import { ConfigEntrySystemOptionsDialogParams } from "./show-dialog-config-entry-system-options"; +import type { ConfigEntrySystemOptionsDialogParams } from "./show-dialog-config-entry-system-options"; @customElement("dialog-config-entry-system-options") class DialogConfigEntrySystemOptions extends LitElement { diff --git a/src/dialogs/config-entry-system-options/show-dialog-config-entry-system-options.ts b/src/dialogs/config-entry-system-options/show-dialog-config-entry-system-options.ts index 0ea3b9d966de..59e3a773a224 100644 --- a/src/dialogs/config-entry-system-options/show-dialog-config-entry-system-options.ts +++ b/src/dialogs/config-entry-system-options/show-dialog-config-entry-system-options.ts @@ -1,6 +1,6 @@ import { fireEvent } from "../../common/dom/fire_event"; -import { ConfigEntry } from "../../data/config_entries"; -import { IntegrationManifest } from "../../data/integration"; +import type { ConfigEntry } from "../../data/config_entries"; +import type { IntegrationManifest } from "../../data/integration"; export interface ConfigEntrySystemOptionsDialogParams { entry: ConfigEntry; diff --git a/src/dialogs/config-flow/dialog-data-entry-flow.ts b/src/dialogs/config-flow/dialog-data-entry-flow.ts index 0bed35966538..dfa328a40c5a 100644 --- a/src/dialogs/config-flow/dialog-data-entry-flow.ts +++ b/src/dialogs/config-flow/dialog-data-entry-flow.ts @@ -1,28 +1,21 @@ import "@material/mwc-button"; import { mdiClose, mdiHelpCircle } from "@mdi/js"; import type { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { HASSDomEvent, fireEvent } from "../../common/dom/fire_event"; +import type { HASSDomEvent } from "../../common/dom/fire_event"; +import { fireEvent } from "../../common/dom/fire_event"; import "../../components/ha-circular-progress"; import "../../components/ha-dialog"; import "../../components/ha-icon-button"; -import { - DataEntryFlowStep, - subscribeDataEntryFlowProgressed, -} from "../../data/data_entry_flow"; +import type { DataEntryFlowStep } from "../../data/data_entry_flow"; +import { subscribeDataEntryFlowProgressed } from "../../data/data_entry_flow"; import { haStyleDialog } from "../../resources/styles"; import type { HomeAssistant } from "../../types"; import { documentationUrl } from "../../util/documentation-url"; import { showAlertDialog } from "../generic/show-dialog-box"; -import { +import type { DataEntryFlowDialogParams, LoadingReason, } from "./show-dialog-data-entry-flow"; diff --git a/src/dialogs/config-flow/previews/entity-preview-row.ts b/src/dialogs/config-flow/previews/entity-preview-row.ts index 724e60ebf293..deb00311500c 100644 --- a/src/dialogs/config-flow/previews/entity-preview-row.ts +++ b/src/dialogs/config-flow/previews/entity-preview-row.ts @@ -1,12 +1,13 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { computeStateName } from "../../../common/entity/compute_state_name"; import "../../../components/entity/state-badge"; import { isUnavailableState } from "../../../data/entity"; import { SENSOR_DEVICE_CLASS_TIMESTAMP } from "../../../data/sensor"; import "../../../panels/lovelace/components/hui-timestamp-display"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; @customElement("entity-preview-row") class EntityPreviewRow extends LitElement { diff --git a/src/dialogs/config-flow/previews/flow-preview-generic.ts b/src/dialogs/config-flow/previews/flow-preview-generic.ts index 78209ce3101a..436bf1f35cd6 100644 --- a/src/dialogs/config-flow/previews/flow-preview-generic.ts +++ b/src/dialogs/config-flow/previews/flow-preview-generic.ts @@ -1,12 +1,14 @@ -import { HassEntity, UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { HassEntity, UnsubscribeFunc } from "home-assistant-js-websocket"; import { LitElement, html } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { FlowType } from "../../../data/data_entry_flow"; -import { GenericPreview, subscribePreviewGeneric } from "../../../data/preview"; -import { HomeAssistant } from "../../../types"; +import type { FlowType } from "../../../data/data_entry_flow"; +import type { GenericPreview } from "../../../data/preview"; +import { subscribePreviewGeneric } from "../../../data/preview"; +import type { HomeAssistant } from "../../../types"; import "./entity-preview-row"; import { debounce } from "../../../common/util/debounce"; import { fireEvent } from "../../../common/dom/fire_event"; +import "../../../components/ha-alert"; @customElement("flow-preview-generic") class FlowPreviewGeneric extends LitElement { diff --git a/src/dialogs/config-flow/previews/flow-preview-template.ts b/src/dialogs/config-flow/previews/flow-preview-template.ts index e2f49feb43a8..b6bf8a30c096 100644 --- a/src/dialogs/config-flow/previews/flow-preview-template.ts +++ b/src/dialogs/config-flow/previews/flow-preview-template.ts @@ -1,16 +1,17 @@ -import { HassEntity, UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { HassEntity, UnsubscribeFunc } from "home-assistant-js-websocket"; import { LitElement, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { debounce } from "../../../common/util/debounce"; -import { FlowType } from "../../../data/data_entry_flow"; -import { +import type { FlowType } from "../../../data/data_entry_flow"; +import type { TemplateListeners, TemplatePreview, - subscribePreviewTemplate, } from "../../../data/ws-templates"; -import { HomeAssistant } from "../../../types"; +import { subscribePreviewTemplate } from "../../../data/ws-templates"; +import type { HomeAssistant } from "../../../types"; import "./entity-preview-row"; import { fireEvent } from "../../../common/dom/fire_event"; +import "../../../components/ha-alert"; @customElement("flow-preview-template") class FlowPreviewTemplate extends LitElement { diff --git a/src/dialogs/config-flow/show-dialog-config-flow.ts b/src/dialogs/config-flow/show-dialog-config-flow.ts index 6101e0246631..4b256c82964b 100644 --- a/src/dialogs/config-flow/show-dialog-config-flow.ts +++ b/src/dialogs/config-flow/show-dialog-config-flow.ts @@ -6,8 +6,8 @@ import { handleConfigFlowStep, } from "../../data/config_flow"; import { domainToName } from "../../data/integration"; +import type { DataEntryFlowDialogParams } from "./show-dialog-data-entry-flow"; import { - DataEntryFlowDialogParams, loadDataEntryFlowDialog, showFlowDialog, } from "./show-dialog-data-entry-flow"; diff --git a/src/dialogs/config-flow/show-dialog-data-entry-flow.ts b/src/dialogs/config-flow/show-dialog-data-entry-flow.ts index 62f71eb18453..bb1d2bbba226 100644 --- a/src/dialogs/config-flow/show-dialog-data-entry-flow.ts +++ b/src/dialogs/config-flow/show-dialog-data-entry-flow.ts @@ -1,7 +1,7 @@ -import { TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; import { fireEvent } from "../../common/dom/fire_event"; import type { HaFormSchema } from "../../components/ha-form/types"; -import { +import type { DataEntryFlowStep, DataEntryFlowStepAbort, DataEntryFlowStepCreateEntry, diff --git a/src/dialogs/config-flow/show-dialog-options-flow.ts b/src/dialogs/config-flow/show-dialog-options-flow.ts index a58b304ad716..52a6b0e72e25 100644 --- a/src/dialogs/config-flow/show-dialog-options-flow.ts +++ b/src/dialogs/config-flow/show-dialog-options-flow.ts @@ -1,5 +1,5 @@ import { html } from "lit"; -import { ConfigEntry } from "../../data/config_entries"; +import type { ConfigEntry } from "../../data/config_entries"; import { domainToName } from "../../data/integration"; import { createOptionsFlow, @@ -7,8 +7,8 @@ import { fetchOptionsFlow, handleOptionsFlowStep, } from "../../data/options_flow"; +import type { DataEntryFlowDialogParams } from "./show-dialog-data-entry-flow"; import { - DataEntryFlowDialogParams, loadDataEntryFlowDialog, showFlowDialog, } from "./show-dialog-data-entry-flow"; diff --git a/src/dialogs/config-flow/step-flow-abort.ts b/src/dialogs/config-flow/step-flow-abort.ts index 4ab121e8dcf2..2ceeaae0dc96 100644 --- a/src/dialogs/config-flow/step-flow-abort.ts +++ b/src/dialogs/config-flow/step-flow-abort.ts @@ -1,12 +1,13 @@ import "@material/mwc-button"; -import { CSSResultGroup, html, LitElement, PropertyValues, nothing } from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; -import { DataEntryFlowStepAbort } from "../../data/data_entry_flow"; +import type { DataEntryFlowStepAbort } from "../../data/data_entry_flow"; import { showAddApplicationCredentialDialog } from "../../panels/config/application_credentials/show-dialog-add-application-credential"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import { showConfigFlowDialog } from "./show-dialog-config-flow"; -import { DataEntryFlowDialogParams } from "./show-dialog-data-entry-flow"; +import type { DataEntryFlowDialogParams } from "./show-dialog-data-entry-flow"; import { configFlowContentStyles } from "./styles"; @customElement("step-flow-abort") diff --git a/src/dialogs/config-flow/step-flow-create-entry.ts b/src/dialogs/config-flow/step-flow-create-entry.ts index 095a8af13644..f1897674839b 100644 --- a/src/dialogs/config-flow/step-flow-create-entry.ts +++ b/src/dialogs/config-flow/step-flow-create-entry.ts @@ -1,27 +1,20 @@ import "@material/mwc-button"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../common/dom/fire_event"; import "../../components/ha-area-picker"; -import { DataEntryFlowStepCreateEntry } from "../../data/data_entry_flow"; +import type { DataEntryFlowStepCreateEntry } from "../../data/data_entry_flow"; +import type { DeviceRegistryEntry } from "../../data/device_registry"; import { computeDeviceName, - DeviceRegistryEntry, updateDeviceRegistryEntry, } from "../../data/device_registry"; -import { EntityRegistryDisplayEntry } from "../../data/entity_registry"; -import { HomeAssistant } from "../../types"; +import type { EntityRegistryDisplayEntry } from "../../data/entity_registry"; +import type { HomeAssistant } from "../../types"; import { showAlertDialog } from "../generic/show-dialog-box"; -import { FlowConfig } from "./show-dialog-data-entry-flow"; +import type { FlowConfig } from "./show-dialog-data-entry-flow"; import { configFlowContentStyles } from "./styles"; import { computeDomain } from "../../common/entity/compute_domain"; import { showVoiceAssistantSetupDialog } from "../voice-assistant-setup/show-voice-assistant-setup-dialog"; diff --git a/src/dialogs/config-flow/step-flow-external.ts b/src/dialogs/config-flow/step-flow-external.ts index 27261588da19..4e3b10512cb3 100644 --- a/src/dialogs/config-flow/step-flow-external.ts +++ b/src/dialogs/config-flow/step-flow-external.ts @@ -1,9 +1,10 @@ import "@material/mwc-button"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; -import { DataEntryFlowStepExternal } from "../../data/data_entry_flow"; -import { HomeAssistant } from "../../types"; -import { FlowConfig } from "./show-dialog-data-entry-flow"; +import type { DataEntryFlowStepExternal } from "../../data/data_entry_flow"; +import type { HomeAssistant } from "../../types"; +import type { FlowConfig } from "./show-dialog-data-entry-flow"; import { configFlowContentStyles } from "./styles"; @customElement("step-flow-external") diff --git a/src/dialogs/config-flow/step-flow-form.ts b/src/dialogs/config-flow/step-flow-form.ts index 537c5731dd88..9994ec3faa04 100644 --- a/src/dialogs/config-flow/step-flow-form.ts +++ b/src/dialogs/config-flow/step-flow-form.ts @@ -1,14 +1,7 @@ import "@lrnwebcomponents/simple-tooltip/simple-tooltip"; import "@material/mwc-button"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { dynamicElement } from "../../common/dom/dynamic-element-directive"; import { fireEvent } from "../../common/dom/fire_event"; diff --git a/src/dialogs/config-flow/step-flow-loading.ts b/src/dialogs/config-flow/step-flow-loading.ts index 2fe84bd4634f..d5cbfcb42022 100644 --- a/src/dialogs/config-flow/step-flow-loading.ts +++ b/src/dialogs/config-flow/step-flow-loading.ts @@ -1,9 +1,10 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import "../../components/ha-circular-progress"; -import { DataEntryFlowStep } from "../../data/data_entry_flow"; -import { HomeAssistant } from "../../types"; -import { FlowConfig, LoadingReason } from "./show-dialog-data-entry-flow"; +import type { DataEntryFlowStep } from "../../data/data_entry_flow"; +import type { HomeAssistant } from "../../types"; +import type { FlowConfig, LoadingReason } from "./show-dialog-data-entry-flow"; @customElement("step-flow-loading") class StepFlowLoading extends LitElement { diff --git a/src/dialogs/config-flow/step-flow-menu.ts b/src/dialogs/config-flow/step-flow-menu.ts index 66d0b8d0c656..83ecd2d5d0e1 100644 --- a/src/dialogs/config-flow/step-flow-menu.ts +++ b/src/dialogs/config-flow/step-flow-menu.ts @@ -1,5 +1,6 @@ import "@material/mwc-list/mwc-list-item"; -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import type { DataEntryFlowStepMenu } from "../../data/data_entry_flow"; import type { HomeAssistant } from "../../types"; diff --git a/src/dialogs/config-flow/step-flow-progress.ts b/src/dialogs/config-flow/step-flow-progress.ts index ab4cd80f6d8d..4d6c7364e2f1 100644 --- a/src/dialogs/config-flow/step-flow-progress.ts +++ b/src/dialogs/config-flow/step-flow-progress.ts @@ -1,10 +1,11 @@ import "@material/mwc-button"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import "../../components/ha-circular-progress"; -import { DataEntryFlowStepProgress } from "../../data/data_entry_flow"; -import { HomeAssistant } from "../../types"; -import { FlowConfig } from "./show-dialog-data-entry-flow"; +import type { DataEntryFlowStepProgress } from "../../data/data_entry_flow"; +import type { HomeAssistant } from "../../types"; +import type { FlowConfig } from "./show-dialog-data-entry-flow"; import { configFlowContentStyles } from "./styles"; @customElement("step-flow-progress") diff --git a/src/dialogs/enter-code/dialog-enter-code.ts b/src/dialogs/enter-code/dialog-enter-code.ts index 23cb33834fdc..646ae9373bd2 100644 --- a/src/dialogs/enter-code/dialog-enter-code.ts +++ b/src/dialogs/enter-code/dialog-enter-code.ts @@ -1,5 +1,6 @@ import { mdiCheck, mdiClose } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { fireEvent } from "../../common/dom/fire_event"; @@ -8,9 +9,9 @@ import "../../components/ha-control-button"; import { createCloseHeading } from "../../components/ha-dialog"; import "../../components/ha-textfield"; import type { HaTextField } from "../../components/ha-textfield"; -import { HomeAssistant } from "../../types"; -import { HassDialog } from "../make-dialog-manager"; -import { EnterCodeDialogParams } from "./show-enter-code-dialog"; +import type { HomeAssistant } from "../../types"; +import type { HassDialog } from "../make-dialog-manager"; +import type { EnterCodeDialogParams } from "./show-enter-code-dialog"; const BUTTONS = [ "1", diff --git a/src/dialogs/generic/dialog-box.ts b/src/dialogs/generic/dialog-box.ts index 4d1ebc1c66c3..212c181c27d1 100644 --- a/src/dialogs/generic/dialog-box.ts +++ b/src/dialogs/generic/dialog-box.ts @@ -1,5 +1,6 @@ import { mdiAlertOutline } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { ifDefined } from "lit/directives/if-defined"; @@ -9,9 +10,10 @@ import type { HaMdDialog } from "../../components/ha-md-dialog"; import "../../components/ha-dialog-header"; import "../../components/ha-svg-icon"; import "../../components/ha-button"; -import { HaTextField } from "../../components/ha-textfield"; -import { HomeAssistant } from "../../types"; -import { DialogBoxParams } from "./show-dialog-box"; +import "../../components/ha-textfield"; +import type { HaTextField } from "../../components/ha-textfield"; +import type { HomeAssistant } from "../../types"; +import type { DialogBoxParams } from "./show-dialog-box"; @customElement("dialog-box") class DialogBox extends LitElement { diff --git a/src/dialogs/generic/show-dialog-box.ts b/src/dialogs/generic/show-dialog-box.ts index 7c95283aae9d..b780ddf986a9 100644 --- a/src/dialogs/generic/show-dialog-box.ts +++ b/src/dialogs/generic/show-dialog-box.ts @@ -1,4 +1,4 @@ -import { TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; import { fireEvent } from "../../common/dom/fire_event"; interface BaseDialogBoxParams { diff --git a/src/dialogs/image-cropper-dialog/image-cropper-dialog.ts b/src/dialogs/image-cropper-dialog/image-cropper-dialog.ts index 94b6d22065c7..8084fc421af6 100644 --- a/src/dialogs/image-cropper-dialog/image-cropper-dialog.ts +++ b/src/dialogs/image-cropper-dialog/image-cropper-dialog.ts @@ -2,21 +2,14 @@ import "@material/mwc-button/mwc-button"; import Cropper from "cropperjs"; // @ts-ignore import cropperCss from "cropperjs/dist/cropper.css"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, - unsafeCSS, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement, unsafeCSS } from "lit"; import { customElement, property, state, query } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import "../../components/ha-dialog"; import { haStyleDialog } from "../../resources/styles"; import type { HomeAssistant } from "../../types"; -import { HaImageCropperDialogParams } from "./show-image-cropper-dialog"; +import type { HaImageCropperDialogParams } from "./show-image-cropper-dialog"; @customElement("image-cropper-dialog") export class HaImagecropperDialog extends LitElement { diff --git a/src/dialogs/make-dialog-manager.ts b/src/dialogs/make-dialog-manager.ts index 9cfb685ad053..49da32e15fa7 100644 --- a/src/dialogs/make-dialog-manager.ts +++ b/src/dialogs/make-dialog-manager.ts @@ -1,6 +1,6 @@ -import { HASSDomEvent, ValidHassDomEvent } from "../common/dom/fire_event"; +import type { HASSDomEvent, ValidHassDomEvent } from "../common/dom/fire_event"; import { mainWindow } from "../common/dom/get_main_window"; -import { ProvideHassElement } from "../mixins/provide-hass-lit-mixin"; +import type { ProvideHassElement } from "../mixins/provide-hass-lit-mixin"; import { ancestorsWithProperty } from "../common/dom/ancestors-with-property"; import { deepActiveElement } from "../common/dom/deep-active-element"; import { nextRender } from "../common/util/render-status"; diff --git a/src/dialogs/more-info/components/ha-more-info-control-select-container.ts b/src/dialogs/more-info/components/ha-more-info-control-select-container.ts index 81edf2bbec09..61bebda8d074 100644 --- a/src/dialogs/more-info/components/ha-more-info-control-select-container.ts +++ b/src/dialogs/more-info/components/ha-more-info-control-select-container.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; diff --git a/src/dialogs/more-info/components/ha-more-info-state-header.ts b/src/dialogs/more-info/components/ha-more-info-state-header.ts index 9432eb46b15a..ee65a9d490c3 100644 --- a/src/dialogs/more-info/components/ha-more-info-state-header.ts +++ b/src/dialogs/more-info/components/ha-more-info-state-header.ts @@ -1,12 +1,13 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/ha-absolute-time"; import "../../../components/ha-relative-time"; import { isUnavailableState } from "../../../data/entity"; -import { LightEntity } from "../../../data/light"; +import type { LightEntity } from "../../../data/light"; import { SENSOR_DEVICE_CLASS_TIMESTAMP } from "../../../data/sensor"; import "../../../panels/lovelace/components/hui-timestamp-display"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; @customElement("ha-more-info-state-header") export class HaMoreInfoStateHeader extends LitElement { diff --git a/src/dialogs/more-info/components/lights/dialog-light-color-favorite.ts b/src/dialogs/more-info/components/lights/dialog-light-color-favorite.ts index 101157e6b234..77879f12b18f 100644 --- a/src/dialogs/more-info/components/lights/dialog-light-color-favorite.ts +++ b/src/dialogs/more-info/components/lights/dialog-light-color-favorite.ts @@ -1,5 +1,6 @@ import { mdiClose } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state, query } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { fireEvent } from "../../../../common/dom/fire_event"; @@ -12,10 +13,9 @@ import type { HaMdDialog } from "../../../../components/ha-md-dialog"; import "../../../../components/ha-dialog-header"; import "../../../../components/ha-icon-button-toggle"; import type { EntityRegistryEntry } from "../../../../data/entity_registry"; +import type { LightColor, LightEntity } from "../../../../data/light"; import { - LightColor, LightColorMode, - LightEntity, lightSupportsColor, lightSupportsColorMode, } from "../../../../data/light"; diff --git a/src/dialogs/more-info/components/lights/ha-favorite-color-button.ts b/src/dialogs/more-info/components/lights/ha-favorite-color-button.ts index f631a52beb90..d8bf1be0f175 100644 --- a/src/dialogs/more-info/components/lights/ha-favorite-color-button.ts +++ b/src/dialogs/more-info/components/lights/ha-favorite-color-button.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { styleMap } from "lit/directives/style-map"; @@ -12,7 +13,7 @@ import { luminosity } from "../../../../common/color/rgb"; import type { HaOutlinedIconButton } from "../../../../components/ha-outlined-icon-button"; import "../../../../components/ha-outlined-icon-button"; import "../../../../components/ha-svg-icon"; -import { LightColor, LightEntity } from "../../../../data/light"; +import type { LightColor, LightEntity } from "../../../../data/light"; @customElement("ha-favorite-color-button") class MoreInfoViewLightColorPicker extends LitElement { diff --git a/src/dialogs/more-info/components/lights/ha-more-info-light-favorite-colors.ts b/src/dialogs/more-info/components/lights/ha-more-info-light-favorite-colors.ts index aa9893d000d5..0e69f237434c 100644 --- a/src/dialogs/more-info/components/lights/ha-more-info-light-favorite-colors.ts +++ b/src/dialogs/more-info/components/lights/ha-more-info-light-favorite-colors.ts @@ -1,30 +1,18 @@ import { mdiCheck, mdiMinus, mdiPlus } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-control-slider"; import "../../../../components/ha-sortable"; import { UNAVAILABLE } from "../../../../data/entity"; -import { - ExtEntityRegistryEntry, - updateEntityRegistryEntry, -} from "../../../../data/entity_registry"; -import { - LightColor, - LightEntity, - computeDefaultFavoriteColors, -} from "../../../../data/light"; +import type { ExtEntityRegistryEntry } from "../../../../data/entity_registry"; +import { updateEntityRegistryEntry } from "../../../../data/entity_registry"; +import type { LightColor, LightEntity } from "../../../../data/light"; +import { computeDefaultFavoriteColors } from "../../../../data/light"; import { actionHandler } from "../../../../panels/lovelace/common/directives/action-handler-directive"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; import { showConfirmationDialog } from "../../../generic/show-dialog-box"; import "./ha-favorite-color-button"; import { showLightColorFavoriteDialog } from "./show-dialog-light-color-favorite"; diff --git a/src/dialogs/more-info/components/lights/light-color-rgb-picker.ts b/src/dialogs/more-info/components/lights/light-color-rgb-picker.ts index a38cbe2b2eb1..040effe09c8c 100644 --- a/src/dialogs/more-info/components/lights/light-color-rgb-picker.ts +++ b/src/dialogs/more-info/components/lights/light-color-rgb-picker.ts @@ -1,13 +1,7 @@ import "@material/mwc-button"; import { mdiEyedropper } from "@mdi/js"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { hex2rgb, @@ -24,14 +18,13 @@ import "../../../../components/ha-hs-color-picker"; import "../../../../components/ha-icon"; import "../../../../components/ha-icon-button-prev"; import "../../../../components/ha-labeled-slider"; +import type { LightColor, LightEntity } from "../../../../data/light"; import { getLightCurrentModeRgbColor, - LightColor, LightColorMode, - LightEntity, lightSupportsColorMode, } from "../../../../data/light"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; declare global { interface HASSDomEvents { diff --git a/src/dialogs/more-info/components/lights/light-color-temp-picker.ts b/src/dialogs/more-info/components/lights/light-color-temp-picker.ts index 7c300193e0ec..3f00ab3db71f 100644 --- a/src/dialogs/more-info/components/lights/light-color-temp-picker.ts +++ b/src/dialogs/more-info/components/lights/light-color-temp-picker.ts @@ -1,11 +1,5 @@ -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import memoizeOne from "memoize-one"; @@ -20,12 +14,9 @@ import { stateColorCss } from "../../../../common/entity/state_color"; import { throttle } from "../../../../common/util/throttle"; import "../../../../components/ha-control-slider"; import { UNAVAILABLE } from "../../../../data/entity"; -import { - LightColor, - LightColorMode, - LightEntity, -} from "../../../../data/light"; -import { HomeAssistant } from "../../../../types"; +import type { LightColor, LightEntity } from "../../../../data/light"; +import { LightColorMode } from "../../../../data/light"; +import type { HomeAssistant } from "../../../../types"; import { DOMAIN_ATTRIBUTES_UNITS } from "../../../../data/entity_attributes"; declare global { diff --git a/src/dialogs/more-info/components/lights/show-dialog-light-color-favorite.ts b/src/dialogs/more-info/components/lights/show-dialog-light-color-favorite.ts index 73aea4b81cc2..5377b085ea4f 100644 --- a/src/dialogs/more-info/components/lights/show-dialog-light-color-favorite.ts +++ b/src/dialogs/more-info/components/lights/show-dialog-light-color-favorite.ts @@ -1,6 +1,6 @@ import { fireEvent } from "../../../../common/dom/fire_event"; -import { ExtEntityRegistryEntry } from "../../../../data/entity_registry"; -import { LightColor } from "../../../../data/light"; +import type { ExtEntityRegistryEntry } from "../../../../data/entity_registry"; +import type { LightColor } from "../../../../data/light"; export interface LightColorFavoriteDialogParams { entry: ExtEntityRegistryEntry; diff --git a/src/dialogs/more-info/components/voice/ha-more-info-view-voice-assistants.ts b/src/dialogs/more-info/components/voice/ha-more-info-view-voice-assistants.ts index 0fe5b790c1df..6e289f6af5bd 100644 --- a/src/dialogs/more-info/components/voice/ha-more-info-view-voice-assistants.ts +++ b/src/dialogs/more-info/components/voice/ha-more-info-view-voice-assistants.ts @@ -1,10 +1,12 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; -import { ExtEntityRegistryEntry } from "../../../../data/entity_registry"; -import { ExposeEntitySettings, voiceAssistants } from "../../../../data/expose"; +import type { ExtEntityRegistryEntry } from "../../../../data/entity_registry"; +import type { ExposeEntitySettings } from "../../../../data/expose"; +import { voiceAssistants } from "../../../../data/expose"; import "../../../../panels/config/voice-assistants/entity-voice-settings"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; @customElement("ha-more-info-view-voice-assistants") class MoreInfoViewVoiceAssistants extends LitElement { diff --git a/src/dialogs/more-info/const.ts b/src/dialogs/more-info/const.ts index ef6ef2b28cb4..e75fd38516d8 100644 --- a/src/dialogs/more-info/const.ts +++ b/src/dialogs/more-info/const.ts @@ -1,9 +1,10 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { isComponentLoaded } from "../../common/config/is_component_loaded"; import { computeDomain } from "../../common/entity/compute_domain"; -import { computeGroupDomain, GroupEntity } from "../../data/group"; +import type { GroupEntity } from "../../data/group"; +import { computeGroupDomain } from "../../data/group"; import { CONTINUOUS_DOMAINS } from "../../data/logbook"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; export const DOMAINS_NO_INFO = ["camera", "configurator"]; /** diff --git a/src/dialogs/more-info/controls/more-info-alarm_control_panel.ts b/src/dialogs/more-info/controls/more-info-alarm_control_panel.ts index 430565433ffa..6720a5aede00 100644 --- a/src/dialogs/more-info/controls/more-info-alarm_control_panel.ts +++ b/src/dialogs/more-info/controls/more-info-alarm_control_panel.ts @@ -1,13 +1,12 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import { stateColorCss } from "../../../common/entity/state_color"; import "../../../components/ha-control-button"; import "../../../components/ha-state-icon"; -import { - AlarmControlPanelEntity, - setProtectedAlarmControlPanelMode, -} from "../../../data/alarm_control_panel"; +import type { AlarmControlPanelEntity } from "../../../data/alarm_control_panel"; +import { setProtectedAlarmControlPanelMode } from "../../../data/alarm_control_panel"; import "../../../state-control/alarm_control_panel/ha-state-control-alarm_control_panel-modes"; import type { HomeAssistant } from "../../../types"; import "../components/ha-more-info-state-header"; diff --git a/src/dialogs/more-info/controls/more-info-automation.ts b/src/dialogs/more-info/controls/more-info-automation.ts index 17c726982727..fb31a1d27c17 100644 --- a/src/dialogs/more-info/controls/more-info-automation.ts +++ b/src/dialogs/more-info/controls/more-info-automation.ts @@ -1,11 +1,12 @@ import "@material/mwc-button"; -import { HassEntity } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../components/ha-relative-time"; import { triggerAutomationActions } from "../../../data/automation"; import { isUnavailableState } from "../../../data/entity"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; @customElement("more-info-automation") class MoreInfoAutomation extends LitElement { diff --git a/src/dialogs/more-info/controls/more-info-camera.ts b/src/dialogs/more-info/controls/more-info-camera.ts index 38c9846a30aa..d532b5861c38 100644 --- a/src/dialogs/more-info/controls/more-info-camera.ts +++ b/src/dialogs/more-info/controls/more-info-camera.ts @@ -1,7 +1,8 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { property, state } from "lit/decorators"; import "../../../components/ha-camera-stream"; -import { CameraEntity } from "../../../data/camera"; +import type { CameraEntity } from "../../../data/camera"; import type { HomeAssistant } from "../../../types"; class MoreInfoCamera extends LitElement { diff --git a/src/dialogs/more-info/controls/more-info-climate.ts b/src/dialogs/more-info/controls/more-info-climate.ts index 7b5e4190c0ee..450092c4caa6 100644 --- a/src/dialogs/more-info/controls/more-info-climate.ts +++ b/src/dialogs/more-info/controls/more-info-climate.ts @@ -6,14 +6,8 @@ import { mdiTuneVariant, mdiWaterPercent, } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { property, state } from "lit/decorators"; import { stopPropagation } from "../../../common/dom/stop_propagation"; import { supportsFeature } from "../../../common/entity/supports-feature"; @@ -24,8 +18,8 @@ import "../../../components/ha-icon-button-toggle"; import "../../../components/ha-list-item"; import "../../../components/ha-select"; import "../../../components/ha-switch"; +import type { ClimateEntity } from "../../../data/climate"; import { - ClimateEntity, ClimateEntityFeature, climateHvacModeIcon, compareClimateHvacModes, @@ -33,7 +27,7 @@ import { import { UNAVAILABLE } from "../../../data/entity"; import "../../../state-control/climate/ha-state-control-climate-humidity"; import "../../../state-control/climate/ha-state-control-climate-temperature"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import "../components/ha-more-info-control-select-container"; import { moreInfoControlStyle } from "../components/more-info-control-style"; diff --git a/src/dialogs/more-info/controls/more-info-counter.ts b/src/dialogs/more-info/controls/more-info-counter.ts index d7d5d95c6e9a..ef78c455eddb 100644 --- a/src/dialogs/more-info/controls/more-info-counter.ts +++ b/src/dialogs/more-info/controls/more-info-counter.ts @@ -1,9 +1,10 @@ import "@material/mwc-button"; -import { HassEntity } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { isUnavailableState } from "../../../data/entity"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; @customElement("more-info-counter") class MoreInfoCounter extends LitElement { diff --git a/src/dialogs/more-info/controls/more-info-cover.ts b/src/dialogs/more-info/controls/more-info-cover.ts index bf96995fcfe8..166d5367a6ca 100644 --- a/src/dialogs/more-info/controls/more-info-cover.ts +++ b/src/dialogs/more-info/controls/more-info-cover.ts @@ -1,19 +1,13 @@ import { mdiMenu, mdiSwapVertical } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { supportsFeature } from "../../../common/entity/supports-feature"; import "../../../components/ha-attributes"; import "../../../components/ha-icon-button-group"; import "../../../components/ha-icon-button-toggle"; +import type { CoverEntity } from "../../../data/cover"; import { - CoverEntity, CoverEntityFeature, computeCoverPositionStateDisplay, } from "../../../data/cover"; diff --git a/src/dialogs/more-info/controls/more-info-date.ts b/src/dialogs/more-info/controls/more-info-date.ts index 6d489fe22fc1..3faed61f49af 100644 --- a/src/dialogs/more-info/controls/more-info-date.ts +++ b/src/dialogs/more-info/controls/more-info-date.ts @@ -1,5 +1,6 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../components/ha-date-input"; import "../../../components/ha-time-input"; diff --git a/src/dialogs/more-info/controls/more-info-datetime.ts b/src/dialogs/more-info/controls/more-info-datetime.ts index 88020df8a88c..5389d3dbae70 100644 --- a/src/dialogs/more-info/controls/more-info-datetime.ts +++ b/src/dialogs/more-info/controls/more-info-datetime.ts @@ -1,6 +1,7 @@ import { format } from "date-fns"; -import { HassEntity } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../components/ha-date-input"; import "../../../components/ha-time-input"; diff --git a/src/dialogs/more-info/controls/more-info-default.ts b/src/dialogs/more-info/controls/more-info-default.ts index c7993fa47fa0..b013e30ba3b1 100644 --- a/src/dialogs/more-info/controls/more-info-default.ts +++ b/src/dialogs/more-info/controls/more-info-default.ts @@ -1,8 +1,8 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../components/ha-attributes"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; @customElement("more-info-default") class MoreInfoDefault extends LitElement { diff --git a/src/dialogs/more-info/controls/more-info-fan.ts b/src/dialogs/more-info/controls/more-info-fan.ts index d26a4defda5e..2a263e58c92c 100644 --- a/src/dialogs/more-info/controls/more-info-fan.ts +++ b/src/dialogs/more-info/controls/more-info-fan.ts @@ -6,7 +6,8 @@ import { mdiPower, mdiTuneVariant, } from "@mdi/js"; -import { CSSResultGroup, LitElement, PropertyValues, html, nothing } from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { stopPropagation } from "../../../common/dom/stop_propagation"; import { stateActive } from "../../../common/entity/state_active"; @@ -16,9 +17,9 @@ import "../../../components/ha-control-select-menu"; import "../../../components/ha-list-item"; import "../../../components/ha-outlined-icon-button"; import { UNAVAILABLE } from "../../../data/entity"; +import type { FanEntity } from "../../../data/fan"; import { FAN_SPEED_COUNT_MAX_FOR_BUTTONS, - FanEntity, FanEntityFeature, computeFanSpeedCount, computeFanSpeedStateDisplay, diff --git a/src/dialogs/more-info/controls/more-info-group.ts b/src/dialogs/more-info/controls/more-info-group.ts index b6cfc47d2305..0a4cf2f3ab82 100644 --- a/src/dialogs/more-info/controls/more-info-group.ts +++ b/src/dialogs/more-info/controls/more-info-group.ts @@ -1,17 +1,12 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { property, state } from "lit/decorators"; import { dynamicElement } from "../../../common/dom/dynamic-element-directive"; -import { GroupEntity, computeGroupDomain } from "../../../data/group"; +import type { GroupEntity } from "../../../data/group"; +import { computeGroupDomain } from "../../../data/group"; import "../../../state-summary/state-card-content"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { moreInfoControlStyle } from "../components/more-info-control-style"; import { domainMoreInfoType, diff --git a/src/dialogs/more-info/controls/more-info-humidifier.ts b/src/dialogs/more-info/controls/more-info-humidifier.ts index 28d2ab3de01f..77f5556413cf 100644 --- a/src/dialogs/more-info/controls/more-info-humidifier.ts +++ b/src/dialogs/more-info/controls/more-info-humidifier.ts @@ -1,12 +1,6 @@ import { mdiPower, mdiTuneVariant } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { property, state } from "lit/decorators"; import { stopPropagation } from "../../../common/dom/stop_propagation"; import { supportsFeature } from "../../../common/entity/supports-feature"; @@ -14,12 +8,10 @@ import "../../../components/ha-control-select-menu"; import "../../../components/ha-list-item"; import "../../../components/ha-attribute-icon"; import { UNAVAILABLE } from "../../../data/entity"; -import { - HumidifierEntity, - HumidifierEntityFeature, -} from "../../../data/humidifier"; +import type { HumidifierEntity } from "../../../data/humidifier"; +import { HumidifierEntityFeature } from "../../../data/humidifier"; import "../../../state-control/humidifier/ha-state-control-humidifier-humidity"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import "../components/ha-more-info-control-select-container"; import { moreInfoControlStyle } from "../components/more-info-control-style"; diff --git a/src/dialogs/more-info/controls/more-info-image.ts b/src/dialogs/more-info/controls/more-info-image.ts index d54ed0cf435b..a7cc5ab85718 100644 --- a/src/dialogs/more-info/controls/more-info-image.ts +++ b/src/dialogs/more-info/controls/more-info-image.ts @@ -1,7 +1,9 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../components/ha-camera-stream"; -import { computeImageUrl, ImageEntity } from "../../../data/image"; +import type { ImageEntity } from "../../../data/image"; +import { computeImageUrl } from "../../../data/image"; import type { HomeAssistant } from "../../../types"; @customElement("more-info-image") diff --git a/src/dialogs/more-info/controls/more-info-input_boolean.ts b/src/dialogs/more-info/controls/more-info-input_boolean.ts index 607d26ca6708..9decbd55c22d 100644 --- a/src/dialogs/more-info/controls/more-info-input_boolean.ts +++ b/src/dialogs/more-info/controls/more-info-input_boolean.ts @@ -1,6 +1,7 @@ import { mdiPower, mdiPowerOff } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; -import { CSSResultGroup, LitElement, html, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { LitElement, html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../components/ha-attributes"; import "../../../state-control/ha-state-control-toggle"; diff --git a/src/dialogs/more-info/controls/more-info-input_datetime.ts b/src/dialogs/more-info/controls/more-info-input_datetime.ts index 8f1ae7273dd6..22be070cd929 100644 --- a/src/dialogs/more-info/controls/more-info-input_datetime.ts +++ b/src/dialogs/more-info/controls/more-info-input_datetime.ts @@ -1,5 +1,6 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../components/ha-date-input"; import "../../../components/ha-time-input"; diff --git a/src/dialogs/more-info/controls/more-info-lawn_mower.ts b/src/dialogs/more-info/controls/more-info-lawn_mower.ts index 309f089971f1..e3b25e455da9 100644 --- a/src/dialogs/more-info/controls/more-info-lawn_mower.ts +++ b/src/dialogs/more-info/controls/more-info-lawn_mower.ts @@ -1,5 +1,6 @@ import { mdiHomeImportOutline, mdiPause, mdiPlay } from "@mdi/js"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; import { computeStateDomain } from "../../../common/entity/compute_state_domain"; @@ -8,16 +9,14 @@ import { blankBeforePercent } from "../../../common/translations/blank_before_pe import "../../../components/entity/ha-battery-icon"; import "../../../components/ha-icon-button"; import { UNAVAILABLE } from "../../../data/entity"; +import type { EntityRegistryDisplayEntry } from "../../../data/entity_registry"; import { - EntityRegistryDisplayEntry, findBatteryChargingEntity, findBatteryEntity, } from "../../../data/entity_registry"; -import { - LawnMowerEntity, - LawnMowerEntityFeature, -} from "../../../data/lawn_mower"; -import { HomeAssistant } from "../../../types"; +import type { LawnMowerEntity } from "../../../data/lawn_mower"; +import { LawnMowerEntityFeature } from "../../../data/lawn_mower"; +import type { HomeAssistant } from "../../../types"; interface LawnMowerCommand { translationKey: string; diff --git a/src/dialogs/more-info/controls/more-info-light.ts b/src/dialogs/more-info/controls/more-info-light.ts index 5754e27c7163..30b3fa1d4fb3 100644 --- a/src/dialogs/more-info/controls/more-info-light.ts +++ b/src/dialogs/more-info/controls/more-info-light.ts @@ -7,14 +7,8 @@ import { mdiLightbulbOff, mdiPower, } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { stopPropagation } from "../../../common/dom/stop_propagation"; import { supportsFeature } from "../../../common/entity/supports-feature"; @@ -25,11 +19,11 @@ import "../../../components/ha-icon-button-group"; import "../../../components/ha-icon-button-toggle"; import "../../../components/ha-list-item"; import { UNAVAILABLE } from "../../../data/entity"; -import { ExtEntityRegistryEntry } from "../../../data/entity_registry"; +import type { ExtEntityRegistryEntry } from "../../../data/entity_registry"; import { forwardHaptic } from "../../../data/haptics"; +import type { LightEntity } from "../../../data/light"; import { LightColorMode, - LightEntity, LightEntityFeature, lightSupportsBrightness, lightSupportsColor, diff --git a/src/dialogs/more-info/controls/more-info-lock.ts b/src/dialogs/more-info/controls/more-info-lock.ts index 233a3df6cde0..287199cc06cf 100644 --- a/src/dialogs/more-info/controls/more-info-lock.ts +++ b/src/dialogs/more-info/controls/more-info-lock.ts @@ -1,5 +1,6 @@ import { mdiCheck } from "@mdi/js"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import { stateColorCss } from "../../../common/entity/state_color"; @@ -9,8 +10,8 @@ import "../../../components/ha-control-button"; import "../../../components/ha-control-button-group"; import "../../../components/ha-outlined-icon-button"; import "../../../components/ha-state-icon"; +import type { LockEntity } from "../../../data/lock"; import { - LockEntity, LockEntityFeature, callProtectedLockService, canOpen, diff --git a/src/dialogs/more-info/controls/more-info-media_player.ts b/src/dialogs/more-info/controls/more-info-media_player.ts index 1cd8c228120d..694b190d0488 100644 --- a/src/dialogs/more-info/controls/more-info-media_player.ts +++ b/src/dialogs/more-info/controls/more-info-media_player.ts @@ -9,7 +9,8 @@ import { mdiVolumeOff, mdiVolumePlus, } from "@mdi/js"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { stopPropagation } from "../../../common/dom/stop_propagation"; import { stateActive } from "../../../common/entity/state_active"; @@ -20,15 +21,17 @@ import "../../../components/ha-slider"; import "../../../components/ha-svg-icon"; import { showMediaBrowserDialog } from "../../../components/media-player/show-media-browser-dialog"; import { isUnavailableState } from "../../../data/entity"; -import { +import type { MediaPickedEvent, MediaPlayerEntity, +} from "../../../data/media-player"; +import { MediaPlayerEntityFeature, computeMediaControls, handleMediaControlClick, mediaPlayerPlayMedia, } from "../../../data/media-player"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; @customElement("more-info-media_player") class MoreInfoMediaPlayer extends LitElement { diff --git a/src/dialogs/more-info/controls/more-info-person.ts b/src/dialogs/more-info/controls/more-info-person.ts index be00a04095be..76aa1b7e3bf3 100644 --- a/src/dialogs/more-info/controls/more-info-person.ts +++ b/src/dialogs/more-info/controls/more-info-person.ts @@ -1,13 +1,14 @@ import "@material/mwc-button"; -import { HassEntity } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../common/dom/fire_event"; import "../../../components/ha-attributes"; import "../../../components/map/ha-map"; import { showZoneEditor } from "../../../data/zone"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; @customElement("more-info-person") class MoreInfoPerson extends LitElement { diff --git a/src/dialogs/more-info/controls/more-info-remote.ts b/src/dialogs/more-info/controls/more-info-remote.ts index 382fcff7d83e..b3b5d9592afb 100644 --- a/src/dialogs/more-info/controls/more-info-remote.ts +++ b/src/dialogs/more-info/controls/more-info-remote.ts @@ -5,8 +5,9 @@ import { customElement, property } from "lit/decorators"; import { stopPropagation } from "../../../common/dom/stop_propagation"; import { supportsFeature } from "../../../common/entity/supports-feature"; import "../../../components/ha-attributes"; -import { REMOTE_SUPPORT_ACTIVITY, RemoteEntity } from "../../../data/remote"; -import { HomeAssistant } from "../../../types"; +import type { RemoteEntity } from "../../../data/remote"; +import { REMOTE_SUPPORT_ACTIVITY } from "../../../data/remote"; +import type { HomeAssistant } from "../../../types"; const filterExtraAttributes = "activity_list,current_activity"; diff --git a/src/dialogs/more-info/controls/more-info-script.ts b/src/dialogs/more-info/controls/more-info-script.ts index 4b23af136354..b1e84c106676 100644 --- a/src/dialogs/more-info/controls/more-info-script.ts +++ b/src/dialogs/more-info/controls/more-info-script.ts @@ -1,27 +1,22 @@ import { mdiPlay, mdiStop } from "@mdi/js"; import "@material/mwc-button"; -import { HassEntity } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/ha-relative-time"; import "../../../components/ha-service-control"; import "../../../components/ha-control-button"; import "../../../components/ha-control-button-group"; import "../../../components/entity/state-info"; -import { HomeAssistant } from "../../../types"; -import { canRun, ScriptEntity } from "../../../data/script"; +import type { HomeAssistant } from "../../../types"; +import type { ScriptEntity } from "../../../data/script"; +import { canRun } from "../../../data/script"; import { isUnavailableState } from "../../../data/entity"; import { computeObjectId } from "../../../common/entity/compute_object_id"; import { listenMediaQuery } from "../../../common/dom/media_query"; import "../components/ha-more-info-state-header"; -import { ExtEntityRegistryEntry } from "../../../data/entity_registry"; +import type { ExtEntityRegistryEntry } from "../../../data/entity_registry"; @customElement("more-info-script") class MoreInfoScript extends LitElement { diff --git a/src/dialogs/more-info/controls/more-info-siren.ts b/src/dialogs/more-info/controls/more-info-siren.ts index c46dbdfe1d67..c7b8e1a5524f 100644 --- a/src/dialogs/more-info/controls/more-info-siren.ts +++ b/src/dialogs/more-info/controls/more-info-siren.ts @@ -1,6 +1,7 @@ import { mdiVolumeHigh, mdiVolumeOff } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; -import { CSSResultGroup, LitElement, html, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { LitElement, html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../components/ha-attributes"; import "../../../state-control/ha-state-control-toggle"; diff --git a/src/dialogs/more-info/controls/more-info-sun.ts b/src/dialogs/more-info/controls/more-info-sun.ts index ede4d9386746..8eaf1d97bdd7 100644 --- a/src/dialogs/more-info/controls/more-info-sun.ts +++ b/src/dialogs/more-info/controls/more-info-sun.ts @@ -1,9 +1,10 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { formatTime } from "../../../common/datetime/format_time"; import "../../../components/ha-relative-time"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; @customElement("more-info-sun") class MoreInfoSun extends LitElement { diff --git a/src/dialogs/more-info/controls/more-info-switch.ts b/src/dialogs/more-info/controls/more-info-switch.ts index d01005b2e99c..9eb677643ecc 100644 --- a/src/dialogs/more-info/controls/more-info-switch.ts +++ b/src/dialogs/more-info/controls/more-info-switch.ts @@ -1,6 +1,7 @@ import { mdiPower, mdiPowerOff } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; -import { CSSResultGroup, LitElement, html, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { LitElement, html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../components/ha-attributes"; import "../../../state-control/ha-state-control-toggle"; diff --git a/src/dialogs/more-info/controls/more-info-time.ts b/src/dialogs/more-info/controls/more-info-time.ts index 8e5a99bc3430..dd01305c700c 100644 --- a/src/dialogs/more-info/controls/more-info-time.ts +++ b/src/dialogs/more-info/controls/more-info-time.ts @@ -1,5 +1,6 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../components/ha-date-input"; import "../../../components/ha-time-input"; diff --git a/src/dialogs/more-info/controls/more-info-timer.ts b/src/dialogs/more-info/controls/more-info-timer.ts index 5af7aca7b603..4302787ff4b2 100644 --- a/src/dialogs/more-info/controls/more-info-timer.ts +++ b/src/dialogs/more-info/controls/more-info-timer.ts @@ -1,9 +1,10 @@ import "@material/mwc-button"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../components/ha-attributes"; -import { TimerEntity } from "../../../data/timer"; -import { HomeAssistant } from "../../../types"; +import type { TimerEntity } from "../../../data/timer"; +import type { HomeAssistant } from "../../../types"; @customElement("more-info-timer") class MoreInfoTimer extends LitElement { diff --git a/src/dialogs/more-info/controls/more-info-update.ts b/src/dialogs/more-info/controls/more-info-update.ts index 6bea428f808e..38c332cece5d 100644 --- a/src/dialogs/more-info/controls/more-info-update.ts +++ b/src/dialogs/more-info/controls/more-info-update.ts @@ -1,5 +1,6 @@ import "@material/mwc-linear-progress/mwc-linear-progress"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { BINARY_STATE_OFF } from "../../../common/const"; import { supportsFeature } from "../../../common/entity/supports-feature"; @@ -14,8 +15,8 @@ import "../../../components/ha-settings-row"; import "../../../components/ha-switch"; import type { HaSwitch } from "../../../components/ha-switch"; import { isUnavailableState } from "../../../data/entity"; +import type { UpdateEntity } from "../../../data/update"; import { - UpdateEntity, UpdateEntityFeature, updateIsInstalling, updateReleaseNotes, diff --git a/src/dialogs/more-info/controls/more-info-vacuum.ts b/src/dialogs/more-info/controls/more-info-vacuum.ts index a88358786d00..9292a5ca6b9e 100644 --- a/src/dialogs/more-info/controls/more-info-vacuum.ts +++ b/src/dialogs/more-info/controls/more-info-vacuum.ts @@ -9,7 +9,8 @@ import { mdiStop, mdiTargetVariant, } from "@mdi/js"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; import { stopPropagation } from "../../../common/dom/stop_propagation"; @@ -21,13 +22,14 @@ import "../../../components/ha-icon"; import "../../../components/ha-icon-button"; import "../../../components/ha-select"; import { UNAVAILABLE } from "../../../data/entity"; +import type { EntityRegistryDisplayEntry } from "../../../data/entity_registry"; import { - EntityRegistryDisplayEntry, findBatteryChargingEntity, findBatteryEntity, } from "../../../data/entity_registry"; -import { VacuumEntity, VacuumEntityFeature } from "../../../data/vacuum"; -import { HomeAssistant } from "../../../types"; +import type { VacuumEntity } from "../../../data/vacuum"; +import { VacuumEntityFeature } from "../../../data/vacuum"; +import type { HomeAssistant } from "../../../types"; interface VacuumCommand { translationKey: string; diff --git a/src/dialogs/more-info/controls/more-info-valve.ts b/src/dialogs/more-info/controls/more-info-valve.ts index 63e23d737a50..66158025c800 100644 --- a/src/dialogs/more-info/controls/more-info-valve.ts +++ b/src/dialogs/more-info/controls/more-info-valve.ts @@ -1,19 +1,13 @@ import { mdiMenu, mdiSwapVertical } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { supportsFeature } from "../../../common/entity/supports-feature"; import "../../../components/ha-attributes"; import "../../../components/ha-icon-button-group"; import "../../../components/ha-icon-button-toggle"; +import type { ValveEntity } from "../../../data/valve"; import { - ValveEntity, ValveEntityFeature, computeValvePositionStateDisplay, } from "../../../data/valve"; diff --git a/src/dialogs/more-info/controls/more-info-water_heater.ts b/src/dialogs/more-info/controls/more-info-water_heater.ts index 4a5f1d2f044e..28f831e09345 100644 --- a/src/dialogs/more-info/controls/more-info-water_heater.ts +++ b/src/dialogs/more-info/controls/more-info-water_heater.ts @@ -1,19 +1,20 @@ import { mdiAccount, mdiAccountArrowRight, mdiWaterBoiler } from "@mdi/js"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { stopPropagation } from "../../../common/dom/stop_propagation"; import { supportsFeature } from "../../../common/entity/supports-feature"; import "../../../components/ha-control-select-menu"; import "../../../components/ha-list-item"; import { UNAVAILABLE } from "../../../data/entity"; +import type { WaterHeaterEntity } from "../../../data/water_heater"; import { - WaterHeaterEntity, WaterHeaterEntityFeature, compareWaterHeaterOperationMode, computeOperationModeIcon, } from "../../../data/water_heater"; import "../../../state-control/water_heater/ha-state-control-water_heater-temperature"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import "../components/ha-more-info-control-select-container"; import { moreInfoControlStyle } from "../components/more-info-control-style"; diff --git a/src/dialogs/more-info/controls/more-info-weather.ts b/src/dialogs/more-info/controls/more-info-weather.ts index 4b3cd4eba9c4..6dfaeb3ed4df 100644 --- a/src/dialogs/more-info/controls/more-info-weather.ts +++ b/src/dialogs/more-info/controls/more-info-weather.ts @@ -7,23 +7,19 @@ import { mdiWaterPercent, mdiWeatherWindy, } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { formatDateWeekdayDay } from "../../../common/datetime/format_date"; import { formatTimeWeekday } from "../../../common/datetime/format_time"; import "../../../components/ha-svg-icon"; -import { +import type { ForecastEvent, ModernForecastType, WeatherEntity, +} from "../../../data/weather"; +import { getDefaultForecastType, getForecast, getSupportedForecastTypes, @@ -31,7 +27,7 @@ import { subscribeForecast, weatherIcons, } from "../../../data/weather"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; @customElement("more-info-weather") class MoreInfoWeather extends LitElement { diff --git a/src/dialogs/more-info/ha-more-info-dialog.ts b/src/dialogs/more-info/ha-more-info-dialog.ts index 2e629bd5e2bd..fa9d5743f799 100644 --- a/src/dialogs/more-info/ha-more-info-dialog.ts +++ b/src/dialogs/more-info/ha-more-info-dialog.ts @@ -10,7 +10,8 @@ import { mdiPencilOutline, } from "@mdi/js"; import type { HassEntity } from "home-assistant-js-websocket"; -import { LitElement, PropertyValues, css, html, nothing } from "lit"; +import type { PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { cache } from "lit/directives/cache"; import { dynamicElement } from "../../common/dom/dynamic-element-directive"; @@ -27,16 +28,16 @@ import "../../components/ha-icon-button"; import "../../components/ha-icon-button-prev"; import "../../components/ha-list-item"; import "../../components/ha-related-items"; -import { +import type { EntityRegistryEntry, ExtEntityRegistryEntry, - getExtendedEntityRegistryEntry, } from "../../data/entity_registry"; +import { getExtendedEntityRegistryEntry } from "../../data/entity_registry"; import { lightSupportsFavoriteColors } from "../../data/light"; import { SearchableDomains } from "../../data/search"; import { haStyleDialog } from "../../resources/styles"; import "../../state-summary/state-card-content"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import { DOMAINS_WITH_MORE_INFO, EDITABLE_DOMAINS_WITH_ID, diff --git a/src/dialogs/more-info/ha-more-info-history-and-logbook.ts b/src/dialogs/more-info/ha-more-info-history-and-logbook.ts index 89d879f3687a..52a904882434 100644 --- a/src/dialogs/more-info/ha-more-info-history-and-logbook.ts +++ b/src/dialogs/more-info/ha-more-info-history-and-logbook.ts @@ -1,7 +1,8 @@ -import { css, CSSResultGroup, html, LitElement } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; -import { ChartResizeOptions } from "../../components/chart/ha-chart-base"; -import { HomeAssistant } from "../../types"; +import type { ChartResizeOptions } from "../../components/chart/ha-chart-base"; +import type { HomeAssistant } from "../../types"; import { computeShowHistoryComponent, computeShowLogBookComponent, diff --git a/src/dialogs/more-info/ha-more-info-history.ts b/src/dialogs/more-info/ha-more-info-history.ts index 63c86ca07233..fbf5dd56c207 100644 --- a/src/dialogs/more-info/ha-more-info-history.ts +++ b/src/dialogs/more-info/ha-more-info-history.ts @@ -1,29 +1,29 @@ import { startOfYesterday, subHours } from "date-fns"; -import { LitElement, PropertyValues, css, html, nothing } from "lit"; +import type { PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { isComponentLoaded } from "../../common/config/is_component_loaded"; import { fireEvent } from "../../common/dom/fire_event"; import { computeDomain } from "../../common/entity/compute_domain"; import { createSearchParam } from "../../common/url/search-params"; -import { ChartResizeOptions } from "../../components/chart/ha-chart-base"; +import type { ChartResizeOptions } from "../../components/chart/ha-chart-base"; import "../../components/chart/state-history-charts"; import type { StateHistoryCharts } from "../../components/chart/state-history-charts"; import "../../components/chart/statistics-chart"; import type { StatisticsChart } from "../../components/chart/statistics-chart"; +import type { HistoryResult } from "../../data/history"; import { - HistoryResult, computeHistory, subscribeHistoryStatesTimeWindow, } from "../../data/history"; -import { +import type { Statistics, StatisticsMetaData, StatisticsTypes, - fetchStatistics, - getStatisticMetadata, } from "../../data/recorder"; +import { fetchStatistics, getStatisticMetadata } from "../../data/recorder"; import { getSensorNumericDeviceClasses } from "../../data/sensor"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; declare global { interface HASSDomEvents { diff --git a/src/dialogs/more-info/ha-more-info-info.ts b/src/dialogs/more-info/ha-more-info-info.ts index 95394b0206dc..c4f220f2ff01 100644 --- a/src/dialogs/more-info/ha-more-info-info.ts +++ b/src/dialogs/more-info/ha-more-info-info.ts @@ -1,9 +1,9 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query } from "lit/decorators"; import { computeDomain } from "../../common/entity/compute_domain"; -import { ChartResizeOptions } from "../../components/chart/ha-chart-base"; -import { ExtEntityRegistryEntry } from "../../data/entity_registry"; +import type { ChartResizeOptions } from "../../components/chart/ha-chart-base"; +import type { ExtEntityRegistryEntry } from "../../data/entity_registry"; import type { HomeAssistant } from "../../types"; import { computeShowHistoryComponent, diff --git a/src/dialogs/more-info/ha-more-info-logbook.ts b/src/dialogs/more-info/ha-more-info-logbook.ts index 59d81327d1d9..1bb560102d68 100644 --- a/src/dialogs/more-info/ha-more-info-logbook.ts +++ b/src/dialogs/more-info/ha-more-info-logbook.ts @@ -1,5 +1,6 @@ import { startOfYesterday } from "date-fns"; -import { css, html, LitElement, PropertyValues, nothing } from "lit"; +import type { PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; import { isComponentLoaded } from "../../common/config/is_component_loaded"; diff --git a/src/dialogs/more-info/ha-more-info-settings.ts b/src/dialogs/more-info/ha-more-info-settings.ts index 2446da780508..0a25398a0aa6 100644 --- a/src/dialogs/more-info/ha-more-info-settings.ts +++ b/src/dialogs/more-info/ha-more-info-settings.ts @@ -1,15 +1,9 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { dynamicElement } from "../../common/dom/dynamic-element-directive"; import "../../components/ha-alert"; -import { +import type { EntityRegistryEntry, ExtEntityRegistryEntry, } from "../../data/entity_registry"; diff --git a/src/dialogs/more-info/more-info-content.ts b/src/dialogs/more-info/more-info-content.ts index 171354def49f..25d3cfbf84ce 100644 --- a/src/dialogs/more-info/more-info-content.ts +++ b/src/dialogs/more-info/more-info-content.ts @@ -1,9 +1,9 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; -import { ExtEntityRegistryEntry } from "../../data/entity_registry"; +import type { ExtEntityRegistryEntry } from "../../data/entity_registry"; import { importMoreInfoControl } from "../../panels/lovelace/custom-card-helpers"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import { stateMoreInfoType } from "./state_more_info_control"; import { dynamicElement } from "../../common/dom/dynamic-element-directive"; diff --git a/src/dialogs/notifications/configurator-notification-item.ts b/src/dialogs/notifications/configurator-notification-item.ts index 0d87c6fd5fe4..45e289597f04 100644 --- a/src/dialogs/notifications/configurator-notification-item.ts +++ b/src/dialogs/notifications/configurator-notification-item.ts @@ -3,8 +3,8 @@ import { html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import { domainToName } from "../../data/integration"; -import { PersitentNotificationEntity } from "../../data/persistent_notification"; -import { HomeAssistant } from "../../types"; +import type { PersitentNotificationEntity } from "../../data/persistent_notification"; +import type { HomeAssistant } from "../../types"; import "./notification-item-template"; @customElement("configurator-notification-item") diff --git a/src/dialogs/notifications/notification-drawer.ts b/src/dialogs/notifications/notification-drawer.ts index 6a77edb7300f..a3c83bcd69ac 100644 --- a/src/dialogs/notifications/notification-drawer.ts +++ b/src/dialogs/notifications/notification-drawer.ts @@ -1,15 +1,13 @@ import "@material/mwc-button"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; import { LitElement, html, css, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import { computeDomain } from "../../common/entity/compute_domain"; import "../../components/ha-icon-button-prev"; -import { - PersistentNotification, - subscribeNotifications, -} from "../../data/persistent_notification"; -import { HomeAssistant } from "../../types"; +import type { PersistentNotification } from "../../data/persistent_notification"; +import { subscribeNotifications } from "../../data/persistent_notification"; +import type { HomeAssistant } from "../../types"; import "./notification-item"; import "../../components/ha-header-bar"; import "../../components/ha-drawer"; diff --git a/src/dialogs/notifications/notification-item-template.ts b/src/dialogs/notifications/notification-item-template.ts index 8f6528550e93..a86040d3c164 100644 --- a/src/dialogs/notifications/notification-item-template.ts +++ b/src/dialogs/notifications/notification-item-template.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement } from "lit/decorators"; import "../../components/ha-card"; diff --git a/src/dialogs/notifications/notification-item.ts b/src/dialogs/notifications/notification-item.ts index ca92227e1fab..daefcb5f0eda 100644 --- a/src/dialogs/notifications/notification-item.ts +++ b/src/dialogs/notifications/notification-item.ts @@ -1,8 +1,9 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { html, LitElement, PropertyValues, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; -import { PersistentNotification } from "../../data/persistent_notification"; -import { HomeAssistant } from "../../types"; +import type { PersistentNotification } from "../../data/persistent_notification"; +import type { HomeAssistant } from "../../types"; import "./configurator-notification-item"; import "./persistent-notification-item"; diff --git a/src/dialogs/notifications/persistent-notification-item.ts b/src/dialogs/notifications/persistent-notification-item.ts index 45dd3bcfd44c..f549591e67ca 100644 --- a/src/dialogs/notifications/persistent-notification-item.ts +++ b/src/dialogs/notifications/persistent-notification-item.ts @@ -1,12 +1,13 @@ import "@material/mwc-button"; import "@lrnwebcomponents/simple-tooltip/simple-tooltip"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { formatDateTime } from "../../common/datetime/format_date_time"; import "../../components/ha-markdown"; import "../../components/ha-relative-time"; -import { PersistentNotification } from "../../data/persistent_notification"; -import { HomeAssistant } from "../../types"; +import type { PersistentNotification } from "../../data/persistent_notification"; +import type { HomeAssistant } from "../../types"; import "./notification-item-template"; @customElement("persistent-notification-item") diff --git a/src/dialogs/quick-bar/ha-quick-bar.ts b/src/dialogs/quick-bar/ha-quick-bar.ts index da30fb7e9b4b..e96cb6f23704 100644 --- a/src/dialogs/quick-bar/ha-quick-bar.ts +++ b/src/dialogs/quick-bar/ha-quick-bar.ts @@ -8,7 +8,8 @@ import { mdiReload, mdiServerNetwork, } from "@mdi/js"; -import { LitElement, TemplateResult, css, html, nothing } from "lit"; +import type { TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { styleMap } from "lit/directives/style-map"; @@ -20,10 +21,8 @@ import { fireEvent } from "../../common/dom/fire_event"; import { computeStateName } from "../../common/entity/compute_state_name"; import { navigate } from "../../common/navigate"; import { caseInsensitiveStringCompare } from "../../common/string/compare"; -import { - ScorableTextItem, - fuzzyFilterSort, -} from "../../common/string/filter/sequence-matching"; +import type { ScorableTextItem } from "../../common/string/filter/sequence-matching"; +import { fuzzyFilterSort } from "../../common/string/filter/sequence-matching"; import { debounce } from "../../common/util/debounce"; import "../../components/ha-circular-progress"; import "../../components/ha-icon-button"; @@ -33,13 +32,13 @@ import "../../components/ha-textfield"; import { fetchHassioAddonsInfo } from "../../data/hassio/addon"; import { domainToName } from "../../data/integration"; import { getPanelNameTranslationKey } from "../../data/panel"; -import { PageNavigation } from "../../layouts/hass-tabs-subpage"; +import type { PageNavigation } from "../../layouts/hass-tabs-subpage"; import { configSections } from "../../panels/config/ha-panel-config"; import { haStyleDialog, haStyleScrollbar } from "../../resources/styles"; import { loadVirtualizer } from "../../resources/virtualizer"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import { showConfirmationDialog } from "../generic/show-dialog-box"; -import { QuickBarParams } from "./show-dialog-quick-bar"; +import type { QuickBarParams } from "./show-dialog-quick-bar"; interface QuickBarItem extends ScorableTextItem { primaryText: string; diff --git a/src/dialogs/restart/dialog-restart.ts b/src/dialogs/restart/dialog-restart.ts index 9da672f66755..5bb962719986 100644 --- a/src/dialogs/restart/dialog-restart.ts +++ b/src/dialogs/restart/dialog-restart.ts @@ -6,7 +6,8 @@ import { mdiRefresh, mdiClose, } from "@mdi/js"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state, query } from "lit/decorators"; import { isComponentLoaded } from "../../common/config/is_component_loaded"; import { fireEvent } from "../../common/dom/fire_event"; @@ -16,18 +17,20 @@ import type { HaMdDialog } from "../../components/ha-md-dialog"; import "../../components/ha-md-list"; import "../../components/ha-expansion-panel"; import "../../components/ha-md-list-item"; +import "../../components/ha-icon-button"; +import "../../components/ha-icon-next"; import { extractApiErrorMessage, ignoreSupervisorError, } from "../../data/hassio/common"; +import type { HassioHostInfo } from "../../data/hassio/host"; import { - HassioHostInfo, fetchHassioHostInfo, rebootHost, shutdownHost, } from "../../data/hassio/host"; import { haStyle, haStyleDialog } from "../../resources/styles"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import { showToast } from "../../util/toast"; import { showAlertDialog, diff --git a/src/dialogs/tts-try/dialog-tts-try.ts b/src/dialogs/tts-try/dialog-tts-try.ts index 060c59e545d7..c0dacf7219c4 100644 --- a/src/dialogs/tts-try/dialog-tts-try.ts +++ b/src/dialogs/tts-try/dialog-tts-try.ts @@ -1,5 +1,6 @@ import { mdiPlayCircleOutline } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { storage } from "../../common/decorators/storage"; import { fireEvent } from "../../common/dom/fire_event"; @@ -8,9 +9,9 @@ import { createCloseHeading } from "../../components/ha-dialog"; import "../../components/ha-textarea"; import type { HaTextArea } from "../../components/ha-textarea"; import { convertTextToSpeech } from "../../data/tts"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import { showAlertDialog } from "../generic/show-dialog-box"; -import { TTSTryDialogParams } from "./show-dialog-tts-try"; +import type { TTSTryDialogParams } from "./show-dialog-tts-try"; import "../../components/ha-circular-progress"; @customElement("dialog-tts-try") diff --git a/src/dialogs/update_backup/dialog-update-backup.ts b/src/dialogs/update_backup/dialog-update-backup.ts index 5caa9a58417b..e87739568dad 100644 --- a/src/dialogs/update_backup/dialog-update-backup.ts +++ b/src/dialogs/update_backup/dialog-update-backup.ts @@ -1,10 +1,11 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import "../../components/ha-button"; import { createCloseHeading } from "../../components/ha-dialog"; -import { HomeAssistant } from "../../types"; -import { UpdateBackupDialogParams } from "./show-update-backup-dialog"; +import type { HomeAssistant } from "../../types"; +import type { UpdateBackupDialogParams } from "./show-update-backup-dialog"; @customElement("dialog-update-backup") class DialogBox extends LitElement { diff --git a/src/dialogs/voice-assistant-setup/voice-assistant-setup-dialog.ts b/src/dialogs/voice-assistant-setup/voice-assistant-setup-dialog.ts index 858dc0d239f8..3e68ca302925 100644 --- a/src/dialogs/voice-assistant-setup/voice-assistant-setup-dialog.ts +++ b/src/dialogs/voice-assistant-setup/voice-assistant-setup-dialog.ts @@ -1,19 +1,18 @@ import "@material/mwc-button/mwc-button"; import { mdiChevronLeft, mdiClose } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../common/dom/fire_event"; import { computeDomain } from "../../common/entity/compute_domain"; import "../../components/ha-dialog"; -import { - AssistSatelliteConfiguration, - fetchAssistSatelliteConfiguration, -} from "../../data/assist_satellite"; -import { EntityRegistryDisplayEntry } from "../../data/entity_registry"; +import type { AssistSatelliteConfiguration } from "../../data/assist_satellite"; +import { fetchAssistSatelliteConfiguration } from "../../data/assist_satellite"; +import type { EntityRegistryDisplayEntry } from "../../data/entity_registry"; import { haStyleDialog } from "../../resources/styles"; import type { HomeAssistant } from "../../types"; -import { VoiceAssistantSetupDialogParams } from "./show-voice-assistant-setup-dialog"; +import type { VoiceAssistantSetupDialogParams } from "./show-voice-assistant-setup-dialog"; import "./voice-assistant-setup-step-area"; import "./voice-assistant-setup-step-change-wake-word"; import "./voice-assistant-setup-step-check"; diff --git a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-area.ts b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-area.ts index 0da28dfeea46..31c25e178ce4 100644 --- a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-area.ts +++ b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-area.ts @@ -2,9 +2,10 @@ import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import { updateDeviceRegistryEntry } from "../../data/device_registry"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import { showAlertDialog } from "../generic/show-dialog-box"; import { AssistantSetupStyles } from "./styles"; +import "../../components/ha-area-picker"; @customElement("ha-voice-assistant-setup-step-area") export class HaVoiceAssistantSetupStepArea extends LitElement { diff --git a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-change-wake-word.ts b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-change-wake-word.ts index 1c798b53b1c2..1ea24948f1d9 100644 --- a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-change-wake-word.ts +++ b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-change-wake-word.ts @@ -1,11 +1,9 @@ import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; -import { - AssistSatelliteConfiguration, - setWakeWords, -} from "../../data/assist_satellite"; -import { HomeAssistant } from "../../types"; +import type { AssistSatelliteConfiguration } from "../../data/assist_satellite"; +import { setWakeWords } from "../../data/assist_satellite"; +import type { HomeAssistant } from "../../types"; import { STEP } from "./voice-assistant-setup-dialog"; import { AssistantSetupStyles } from "./styles"; import "../../components/ha-md-list"; diff --git a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-check.ts b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-check.ts index d3fa0aa81551..bc0e760e4fde 100644 --- a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-check.ts +++ b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-check.ts @@ -1,9 +1,11 @@ -import { html, LitElement, nothing, PropertyValues } from "lit"; +import { html, LitElement, nothing, type PropertyValues } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import { testAssistSatelliteConnection } from "../../data/assist_satellite"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import { AssistantSetupStyles } from "./styles"; +import "../../components/ha-circular-progress"; +import "../../components/ha-button"; @customElement("ha-voice-assistant-setup-step-check") export class HaVoiceAssistantSetupStepCheck extends LitElement { diff --git a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-cloud.ts b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-cloud.ts index 18962da2572c..ac6201d7ca54 100644 --- a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-cloud.ts +++ b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-cloud.ts @@ -2,9 +2,11 @@ import { mdiEarth, mdiMicrophoneMessage, mdiOpenInNew } from "@mdi/js"; import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import { brandsUrl } from "../../util/brands-url"; import { AssistantSetupStyles } from "./styles"; +import "../../components/ha-button"; +import "../../components/ha-svg-icon"; @customElement("ha-voice-assistant-setup-step-cloud") export class HaVoiceAssistantSetupStepCloud extends LitElement { diff --git a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-pipeline.ts b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-pipeline.ts index b48d00d4b0e3..888df4b9294e 100644 --- a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-pipeline.ts +++ b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-pipeline.ts @@ -1,5 +1,6 @@ import { mdiOpenInNew } from "@mdi/js"; -import { css, html, LitElement, nothing, PropertyValues } from "lit"; +import type { PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { isComponentLoaded } from "../../common/config/is_component_loaded"; import { fireEvent } from "../../common/dom/fire_event"; @@ -8,11 +9,11 @@ import { createAssistPipeline, listAssistPipelines, } from "../../data/assist_pipeline"; -import { AssistSatelliteConfiguration } from "../../data/assist_satellite"; +import type { AssistSatelliteConfiguration } from "../../data/assist_satellite"; import { fetchCloudStatus } from "../../data/cloud"; import { listSTTEngines } from "../../data/stt"; import { listTTSEngines, listTTSVoices } from "../../data/tts"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import { documentationUrl } from "../../util/documentation-url"; import { AssistantSetupStyles } from "./styles"; import { STEP } from "./voice-assistant-setup-dialog"; diff --git a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-success.ts b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-success.ts index c5ed1d708381..f4b171bda773 100644 --- a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-success.ts +++ b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-success.ts @@ -1,26 +1,27 @@ import { mdiCog, mdiMicrophone, mdiPlay } from "@mdi/js"; -import { css, html, LitElement, nothing, PropertyValues } from "lit"; +import type { PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import { stopPropagation } from "../../common/dom/stop_propagation"; import "../../components/ha-select"; import "../../components/ha-tts-voice-picker"; +import type { AssistPipeline } from "../../data/assist_pipeline"; import { - AssistPipeline, listAssistPipelines, updateAssistPipeline, } from "../../data/assist_pipeline"; +import type { AssistSatelliteConfiguration } from "../../data/assist_satellite"; import { assistSatelliteAnnounce, - AssistSatelliteConfiguration, setWakeWords, } from "../../data/assist_satellite"; import { fetchCloudStatus } from "../../data/cloud"; -import { InputSelectEntity } from "../../data/input_select"; +import type { InputSelectEntity } from "../../data/input_select"; import { setSelectOption } from "../../data/select"; import { showVoiceAssistantPipelineDetailDialog } from "../../panels/config/voice-assistants/show-dialog-voice-assistant-pipeline-detail"; import "../../panels/lovelace/entity-rows/hui-select-entity-row"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import { AssistantSetupStyles } from "./styles"; import { STEP } from "./voice-assistant-setup-dialog"; diff --git a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-update.ts b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-update.ts index e6547e123050..9171ff15f013 100644 --- a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-update.ts +++ b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-update.ts @@ -1,15 +1,16 @@ -import { css, html, LitElement, nothing, PropertyValues } from "lit"; +import type { PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import "../../components/ha-circular-progress"; import { ON, UNAVAILABLE } from "../../data/entity"; import { updateCanInstall, - UpdateEntity, + type UpdateEntity, updateIsInstalling, updateUsesProgress, } from "../../data/update"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import { AssistantSetupStyles } from "./styles"; @customElement("ha-voice-assistant-setup-step-update") diff --git a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-wake-word.ts b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-wake-word.ts index bcae8d9f32f5..2515f7ba9cfd 100644 --- a/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-wake-word.ts +++ b/src/dialogs/voice-assistant-setup/voice-assistant-setup-step-wake-word.ts @@ -1,15 +1,14 @@ -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { html, LitElement, nothing, PropertyValues } from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { PropertyValues } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../common/dom/fire_event"; import "../../components/ha-button"; import "../../components/ha-dialog-header"; -import { - AssistSatelliteConfiguration, - interceptWakeWord, -} from "../../data/assist_satellite"; -import { HomeAssistant } from "../../types"; +import type { AssistSatelliteConfiguration } from "../../data/assist_satellite"; +import { interceptWakeWord } from "../../data/assist_satellite"; +import type { HomeAssistant } from "../../types"; import { AssistantSetupStyles } from "./styles"; import { STEP } from "./voice-assistant-setup-dialog"; diff --git a/src/dialogs/voice-command-dialog/ha-voice-command-dialog.ts b/src/dialogs/voice-command-dialog/ha-voice-command-dialog.ts index b735bf289b5b..4b7d02013459 100644 --- a/src/dialogs/voice-command-dialog/ha-voice-command-dialog.ts +++ b/src/dialogs/voice-command-dialog/ha-voice-command-dialog.ts @@ -8,15 +8,8 @@ import { mdiSend, mdiStar, } from "@mdi/js"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { storage } from "../../common/decorators/storage"; import { fireEvent } from "../../common/dom/fire_event"; @@ -28,9 +21,10 @@ import "../../components/ha-dialog-header"; import "../../components/ha-icon-button"; import "../../components/ha-list-item"; import "../../components/ha-textfield"; +import "../../components/ha-alert"; import type { HaTextField } from "../../components/ha-textfield"; +import type { AssistPipeline } from "../../data/assist_pipeline"; import { - AssistPipeline, getAssistPipeline, listAssistPipelines, runAssistPipeline, @@ -40,7 +34,7 @@ import type { HomeAssistant } from "../../types"; import { AudioRecorder } from "../../util/audio-recorder"; import { documentationUrl } from "../../util/documentation-url"; import { showAlertDialog } from "../generic/show-dialog-box"; -import { VoiceCommandDialogParams } from "./show-ha-voice-command-dialog"; +import type { VoiceCommandDialogParams } from "./show-ha-voice-command-dialog"; import { supportsFeature } from "../../common/entity/supports-feature"; import { ConversationEntityFeature } from "../../data/conversation"; diff --git a/src/dialogs/voice-command-dialog/show-ha-voice-command-dialog.ts b/src/dialogs/voice-command-dialog/show-ha-voice-command-dialog.ts index 3c29fb8d1654..2ac41a5d9a73 100644 --- a/src/dialogs/voice-command-dialog/show-ha-voice-command-dialog.ts +++ b/src/dialogs/voice-command-dialog/show-ha-voice-command-dialog.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../common/dom/fire_event"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; const loadVoiceCommandDialog = () => import("./ha-voice-command-dialog"); diff --git a/src/entrypoints/core.ts b/src/entrypoints/core.ts index 7ddc8aa245bd..e8549e265db4 100644 --- a/src/entrypoints/core.ts +++ b/src/entrypoints/core.ts @@ -1,6 +1,5 @@ +import type { Auth, Connection } from "home-assistant-js-websocket"; import { - Auth, - Connection, createConnection, ERR_INVALID_AUTH, getAuth, @@ -15,7 +14,7 @@ import { subscribeFrontendUserData } from "../data/frontend"; import { fetchConfig } from "../data/lovelace/config/types"; import { fetchResources } from "../data/lovelace/resource"; import { MAIN_WINDOW_NAME } from "../data/main_window"; -import { WindowWithPreloads } from "../data/preloads"; +import type { WindowWithPreloads } from "../data/preloads"; import { getRecorderInfo } from "../data/recorder"; import { subscribeRepairsIssueRegistry } from "../data/repairs"; import { subscribeAreaRegistry } from "../data/ws-area_registry"; diff --git a/src/entrypoints/custom-panel.ts b/src/entrypoints/custom-panel.ts index 767855459bf4..651627aba357 100644 --- a/src/entrypoints/custom-panel.ts +++ b/src/entrypoints/custom-panel.ts @@ -1,13 +1,13 @@ // Compat needs to be first import import "../resources/compatibility"; -import { CSSResult } from "lit"; +import type { CSSResult } from "lit"; import { fireEvent } from "../common/dom/fire_event"; import { isNavigationClick } from "../common/dom/is-navigation-click"; import { loadJS } from "../common/dom/load_resource"; import { webComponentsSupported } from "../common/feature-detect/support-web-components"; import { navigate } from "../common/navigate"; -import { CustomPanelInfo } from "../data/panel_custom"; +import type { CustomPanelInfo } from "../data/panel_custom"; import { baseEntrypointStyles } from "../resources/styles"; import { createCustomPanelElement } from "../util/custom-panel/create-custom-panel-element"; import { loadCustomPanel } from "../util/custom-panel/load-custom-panel"; diff --git a/src/entrypoints/service-worker.ts b/src/entrypoints/service-worker.ts index 3b67fee9821d..889efdde1df7 100644 --- a/src/entrypoints/service-worker.ts +++ b/src/entrypoints/service-worker.ts @@ -2,7 +2,8 @@ // eslint-disable-next-line spaced-comment /// /* eslint-env serviceworker */ -import { cacheNames, RouteHandler } from "workbox-core"; +import type { RouteHandler } from "workbox-core"; +import { cacheNames } from "workbox-core"; import { CacheableResponsePlugin } from "workbox-cacheable-response"; import { ExpirationPlugin } from "workbox-expiration"; import { cleanupOutdatedCaches, precacheAndRoute } from "workbox-precaching"; diff --git a/src/external_app/external_app_entrypoint.ts b/src/external_app/external_app_entrypoint.ts index e4c52b3b4b5d..3b4e14e40708 100644 --- a/src/external_app/external_app_entrypoint.ts +++ b/src/external_app/external_app_entrypoint.ts @@ -8,7 +8,7 @@ This is the entry point for providing external app stuff from app entrypoint. import { fireEvent } from "../common/dom/fire_event"; import { mainWindow } from "../common/dom/get_main_window"; import { showAutomationEditor } from "../data/automation"; -import { HomeAssistantMain } from "../layouts/home-assistant-main"; +import type { HomeAssistantMain } from "../layouts/home-assistant-main"; import type { EMIncomingMessageBarCodeScanAborted, EMIncomingMessageBarCodeScanResult, diff --git a/src/external_app/external_auth.ts b/src/external_app/external_auth.ts index c1f06742782b..4bcefac41dc3 100644 --- a/src/external_app/external_auth.ts +++ b/src/external_app/external_auth.ts @@ -2,7 +2,8 @@ * Auth class that connects to a native app for authentication. */ import { Auth } from "home-assistant-js-websocket"; -import { ExternalMessaging, EMMessage } from "./external_messaging"; +import type { EMMessage } from "./external_messaging"; +import { ExternalMessaging } from "./external_messaging"; const CALLBACK_SET_TOKEN = "externalAuthSetToken"; const CALLBACK_REVOKE_TOKEN = "externalAuthRevokeToken"; diff --git a/src/external_app/external_messaging.ts b/src/external_app/external_messaging.ts index 5e0461585b3a..a870b72be2ff 100644 --- a/src/external_app/external_messaging.ts +++ b/src/external_app/external_messaging.ts @@ -1,4 +1,4 @@ -import { AutomationConfig } from "../data/automation"; +import type { AutomationConfig } from "../data/automation"; const CALLBACK_EXTERNAL_BUS = "externalBus"; diff --git a/src/fake_data/demo_config.ts b/src/fake_data/demo_config.ts index 7f36bb537c91..4dd3f34b15d6 100644 --- a/src/fake_data/demo_config.ts +++ b/src/fake_data/demo_config.ts @@ -1,4 +1,5 @@ -import { HassConfig, STATE_RUNNING } from "home-assistant-js-websocket"; +import type { HassConfig } from "home-assistant-js-websocket"; +import { STATE_RUNNING } from "home-assistant-js-websocket"; export const demoConfig: HassConfig = { location_name: "Home", diff --git a/src/fake_data/demo_panels.ts b/src/fake_data/demo_panels.ts index dbf70b4b1df8..ec3154041939 100644 --- a/src/fake_data/demo_panels.ts +++ b/src/fake_data/demo_panels.ts @@ -1,4 +1,4 @@ -import { Panels } from "../types"; +import type { Panels } from "../types"; export const demoPanels: Panels = { lovelace: { diff --git a/src/fake_data/demo_services.ts b/src/fake_data/demo_services.ts index 82b452b74926..04a0e57ef38b 100644 --- a/src/fake_data/demo_services.ts +++ b/src/fake_data/demo_services.ts @@ -1,4 +1,4 @@ -import { HassServices } from "home-assistant-js-websocket"; +import type { HassServices } from "home-assistant-js-websocket"; export const demoServices: HassServices = { homeassistant: { diff --git a/src/fake_data/entity.ts b/src/fake_data/entity.ts index 232b75de1ff5..259a4d1a4dcf 100644 --- a/src/fake_data/entity.ts +++ b/src/fake_data/entity.ts @@ -1,5 +1,5 @@ /* eslint-disable max-classes-per-file */ -import { +import type { HassEntity, HassEntityAttributeBase, } from "home-assistant-js-websocket"; diff --git a/src/fake_data/entity_component_icons.ts b/src/fake_data/entity_component_icons.ts index 242f301516a6..ab59081d8cfc 100644 --- a/src/fake_data/entity_component_icons.ts +++ b/src/fake_data/entity_component_icons.ts @@ -1,4 +1,4 @@ -import { ComponentIcons } from "../data/icons"; +import type { ComponentIcons } from "../data/icons"; export const ENTITY_COMPONENT_ICONS: Record = { person: { diff --git a/src/fake_data/provide_hass.ts b/src/fake_data/provide_hass.ts index 4baa8db8997c..f64e9155232c 100644 --- a/src/fake_data/provide_hass.ts +++ b/src/fake_data/provide_hass.ts @@ -1,4 +1,4 @@ -import { HassEntities, HassEntity } from "home-assistant-js-websocket"; +import type { HassEntities, HassEntity } from "home-assistant-js-websocket"; import { applyThemesOnElement, invalidateThemeCache, @@ -15,12 +15,13 @@ import { TimeZone, } from "../data/translation"; import { translationMetadata } from "../resources/translations-metadata"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import { getLocalLanguage, getTranslation } from "../util/common-translation"; import { demoConfig } from "./demo_config"; import { demoPanels } from "./demo_panels"; import { demoServices } from "./demo_services"; -import { Entity, getEntity } from "./entity"; +import type { Entity } from "./entity"; +import { getEntity } from "./entity"; const ensureArray = (val: T | T[]): T[] => Array.isArray(val) ? val : [val]; diff --git a/src/layouts/ha-init-page.ts b/src/layouts/ha-init-page.ts index 21c7e50fdbbb..34cd4a72bc9c 100644 --- a/src/layouts/ha-init-page.ts +++ b/src/layouts/ha-init-page.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement } from "lit"; import { property, state } from "lit/decorators"; class HaInitPage extends LitElement { diff --git a/src/layouts/hass-error-screen.ts b/src/layouts/hass-error-screen.ts index e668b2a3b069..461bd3fc3c98 100644 --- a/src/layouts/hass-error-screen.ts +++ b/src/layouts/hass-error-screen.ts @@ -1,9 +1,10 @@ import "@material/mwc-button"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import "../components/ha-icon-button-arrow-prev"; import "../components/ha-menu-button"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "../components/ha-alert"; @customElement("hass-error-screen") diff --git a/src/layouts/hass-loading-screen.ts b/src/layouts/hass-loading-screen.ts index 9414e41c406d..9da2b42b99c5 100644 --- a/src/layouts/hass-loading-screen.ts +++ b/src/layouts/hass-loading-screen.ts @@ -1,17 +1,11 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import "../components/ha-circular-progress"; import "../components/ha-icon-button-arrow-prev"; import "../components/ha-menu-button"; import { haStyle } from "../resources/styles"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; @customElement("hass-loading-screen") class HassLoadingScreen extends LitElement { diff --git a/src/layouts/hass-router-page.ts b/src/layouts/hass-router-page.ts index 3751b94341b6..7952c9e5ca3f 100644 --- a/src/layouts/hass-router-page.ts +++ b/src/layouts/hass-router-page.ts @@ -1,8 +1,9 @@ -import { PropertyValues, ReactiveElement } from "lit"; +import type { PropertyValues } from "lit"; +import { ReactiveElement } from "lit"; import { property } from "lit/decorators"; import memoizeOne from "memoize-one"; import { navigate } from "../common/navigate"; -import { Route } from "../types"; +import type { Route } from "../types"; const extractPage = (path: string, defaultPage: string) => { if (path === "") { diff --git a/src/layouts/hass-subpage.ts b/src/layouts/hass-subpage.ts index 0cf5c81f07b0..2c411b0478f2 100644 --- a/src/layouts/hass-subpage.ts +++ b/src/layouts/hass-subpage.ts @@ -1,9 +1,10 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, eventOptions, property } from "lit/decorators"; import { restoreScroll } from "../common/decorators/restore-scroll"; import "../components/ha-icon-button-arrow-prev"; import "../components/ha-menu-button"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import { haStyleScrollbar } from "../resources/styles"; @customElement("hass-subpage") diff --git a/src/layouts/hass-tabs-subpage-data-table.ts b/src/layouts/hass-tabs-subpage-data-table.ts index ad7cf1b760e2..cdc5d9f84551 100644 --- a/src/layouts/hass-tabs-subpage-data-table.ts +++ b/src/layouts/hass-tabs-subpage-data-table.ts @@ -13,18 +13,12 @@ import { mdiUnfoldLessHorizontal, mdiUnfoldMoreHorizontal, } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { fireEvent } from "../common/dom/fire_event"; -import { LocalizeFunc } from "../common/translations/localize"; +import type { LocalizeFunc } from "../common/translations/localize"; import "../components/chips/ha-assist-chip"; import "../components/chips/ha-filter-chip"; import "../components/data-table/ha-data-table"; @@ -36,8 +30,9 @@ import type { } from "../components/data-table/ha-data-table"; import "../components/ha-md-button-menu"; import "../components/ha-dialog"; +import "../components/ha-dialog-header"; import "../components/ha-md-divider"; -import { HaMenu } from "../components/ha-menu"; +import type { HaMenu } from "../components/ha-menu"; import "../components/ha-md-menu-item"; import "../components/search-input-outlined"; import type { HomeAssistant, Route } from "../types"; diff --git a/src/layouts/hass-tabs-subpage.ts b/src/layouts/hass-tabs-subpage.ts index 1f40ab0ca916..b69610b5e3ff 100644 --- a/src/layouts/hass-tabs-subpage.ts +++ b/src/layouts/hass-tabs-subpage.ts @@ -1,22 +1,15 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, eventOptions, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; import { restoreScroll } from "../common/decorators/restore-scroll"; -import { LocalizeFunc } from "../common/translations/localize"; +import type { LocalizeFunc } from "../common/translations/localize"; import "../components/ha-icon-button-arrow-prev"; import "../components/ha-menu-button"; import "../components/ha-svg-icon"; import "../components/ha-tab"; -import { HomeAssistant, Route } from "../types"; +import type { HomeAssistant, Route } from "../types"; import { haStyleScrollbar } from "../resources/styles"; import { canShowPage } from "../common/config/can_show_page"; diff --git a/src/layouts/home-assistant-main.ts b/src/layouts/home-assistant-main.ts index b984910c503d..71b7535e68ba 100644 --- a/src/layouts/home-assistant-main.ts +++ b/src/layouts/home-assistant-main.ts @@ -1,14 +1,9 @@ /* eslint-disable lit/prefer-static-styles */ -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { fireEvent, HASSDomEvent } from "../common/dom/fire_event"; +import type { HASSDomEvent } from "../common/dom/fire_event"; +import { fireEvent } from "../common/dom/fire_event"; import { listenMediaQuery } from "../common/dom/media_query"; import { toggleAttribute } from "../common/dom/toggle_attribute"; import "../components/ha-drawer"; diff --git a/src/layouts/home-assistant.ts b/src/layouts/home-assistant.ts index b7841fada328..ab42380634bb 100644 --- a/src/layouts/home-assistant.ts +++ b/src/layouts/home-assistant.ts @@ -1,14 +1,16 @@ -import { html, PropertyValues } from "lit"; +import type { PropertyValues } from "lit"; +import { html } from "lit"; import { customElement, state } from "lit/decorators"; import { isNavigationClick } from "../common/dom/is-navigation-click"; import { navigate } from "../common/navigate"; import { getStorageDefaultPanelUrlPath } from "../data/panel"; -import { WindowWithPreloads } from "../data/preloads"; -import { getRecorderInfo, RecorderInfo } from "../data/recorder"; +import type { WindowWithPreloads } from "../data/preloads"; +import type { RecorderInfo } from "../data/recorder"; +import { getRecorderInfo } from "../data/recorder"; import "../resources/custom-card-support"; import { HassElement } from "../state/hass-element"; import QuickBarMixin from "../state/quick-bar-mixin"; -import { HomeAssistant, Route } from "../types"; +import type { HomeAssistant, Route } from "../types"; import { storeState } from "../util/ha-pref-storage"; import { removeLaunchScreen, diff --git a/src/layouts/partial-panel-resolver.ts b/src/layouts/partial-panel-resolver.ts index 5c5611744bb7..e425312265de 100644 --- a/src/layouts/partial-panel-resolver.ts +++ b/src/layouts/partial-panel-resolver.ts @@ -3,19 +3,16 @@ import { STATE_RUNNING, STATE_STARTING, } from "home-assistant-js-websocket"; -import { PropertyValues } from "lit"; +import type { PropertyValues } from "lit"; import { customElement, property } from "lit/decorators"; import { deepActiveElement } from "../common/dom/deep-active-element"; import { deepEqual } from "../common/util/deep-equal"; import { getDefaultPanel } from "../data/panel"; -import { CustomPanelInfo } from "../data/panel_custom"; -import { HomeAssistant, Panels } from "../types"; +import type { CustomPanelInfo } from "../data/panel_custom"; +import type { HomeAssistant, Panels } from "../types"; import { removeLaunchScreen } from "../util/launch-screen"; -import { - HassRouterPage, - RouteOptions, - RouterOptions, -} from "./hass-router-page"; +import type { RouteOptions, RouterOptions } from "./hass-router-page"; +import { HassRouterPage } from "./hass-router-page"; const CACHE_URL_PATHS = ["lovelace", "developer-tools"]; const COMPONENTS = { diff --git a/src/layouts/supervisor-error-screen.ts b/src/layouts/supervisor-error-screen.ts index 6d415a7c4338..503fe9a7aa02 100644 --- a/src/layouts/supervisor-error-screen.ts +++ b/src/layouts/supervisor-error-screen.ts @@ -1,18 +1,12 @@ import "@material/mwc-button"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { atLeastVersion } from "../common/config/version"; import { applyThemesOnElement } from "../common/dom/apply_themes_on_element"; import "../components/ha-card"; import { haStyle } from "../resources/styles"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./hass-subpage"; @customElement("supervisor-error-screen") diff --git a/src/managers/notification-manager.ts b/src/managers/notification-manager.ts index 41dbdde058c5..dea25c743bfa 100644 --- a/src/managers/notification-manager.ts +++ b/src/managers/notification-manager.ts @@ -4,6 +4,7 @@ import { property, query, state } from "lit/decorators"; import { computeRTL } from "../common/util/compute_rtl"; import "../components/ha-button"; import "../components/ha-toast"; +import "../components/ha-icon-button"; import type { HaToast } from "../components/ha-toast"; import type { HomeAssistant } from "../types"; diff --git a/src/mixins/keyboard-shortcut-mixin.ts b/src/mixins/keyboard-shortcut-mixin.ts index c319135b94ea..1f92d0e08389 100644 --- a/src/mixins/keyboard-shortcut-mixin.ts +++ b/src/mixins/keyboard-shortcut-mixin.ts @@ -1,5 +1,5 @@ -import { LitElement } from "lit"; -import { Constructor } from "../types"; +import type { LitElement } from "lit"; +import type { Constructor } from "../types"; export const KeyboardShortcutMixin = >( superClass: T diff --git a/src/mixins/lit-localize-lite-mixin.ts b/src/mixins/lit-localize-lite-mixin.ts index 7d4823d73365..8ba189bba75b 100644 --- a/src/mixins/lit-localize-lite-mixin.ts +++ b/src/mixins/lit-localize-lite-mixin.ts @@ -1,7 +1,8 @@ -import { LitElement, PropertyValues } from "lit"; +import type { LitElement, PropertyValues } from "lit"; import { property, state } from "lit/decorators"; -import { computeLocalize, LocalizeFunc } from "../common/translations/localize"; -import { Constructor, Resources } from "../types"; +import type { LocalizeFunc } from "../common/translations/localize"; +import { computeLocalize } from "../common/translations/localize"; +import type { Constructor, Resources } from "../types"; import { getLocalLanguage, getTranslation } from "../util/common-translation"; import { translationMetadata } from "../resources/translations-metadata"; import { computeDirectionStyles } from "../common/util/compute_rtl"; diff --git a/src/mixins/provide-hass-lit-mixin.ts b/src/mixins/provide-hass-lit-mixin.ts index 361d4e281c88..13aab5541b73 100644 --- a/src/mixins/provide-hass-lit-mixin.ts +++ b/src/mixins/provide-hass-lit-mixin.ts @@ -1,5 +1,5 @@ -import { PropertyValues, ReactiveElement } from "lit"; -import { Constructor, HomeAssistant } from "../types"; +import type { PropertyValues, ReactiveElement } from "lit"; +import type { Constructor, HomeAssistant } from "../types"; export interface ProvideHassElement { provideHass(element: HTMLElement); diff --git a/src/mixins/subscribe-mixin.ts b/src/mixins/subscribe-mixin.ts index 66dbd99519bb..5aecc110a965 100644 --- a/src/mixins/subscribe-mixin.ts +++ b/src/mixins/subscribe-mixin.ts @@ -1,7 +1,7 @@ -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { PropertyValues, ReactiveElement } from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { PropertyValues, ReactiveElement } from "lit"; import { property } from "lit/decorators"; -import { Constructor, HomeAssistant } from "../types"; +import type { Constructor, HomeAssistant } from "../types"; export interface HassSubscribeElement { hassSubscribe(): UnsubscribeFunc[]; diff --git a/src/onboarding/dialogs/app-dialog.ts b/src/onboarding/dialogs/app-dialog.ts index 1dd5675cc1c5..d5de77408690 100644 --- a/src/onboarding/dialogs/app-dialog.ts +++ b/src/onboarding/dialogs/app-dialog.ts @@ -1,6 +1,6 @@ import { LitElement, css, html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; -import { LocalizeFunc } from "../../common/translations/localize"; +import type { LocalizeFunc } from "../../common/translations/localize"; import { fireEvent } from "../../common/dom/fire_event"; import { createCloseHeading } from "../../components/ha-dialog"; diff --git a/src/onboarding/dialogs/community-dialog.ts b/src/onboarding/dialogs/community-dialog.ts index b3070e108dcb..7df13b7318a0 100644 --- a/src/onboarding/dialogs/community-dialog.ts +++ b/src/onboarding/dialogs/community-dialog.ts @@ -3,7 +3,7 @@ import { mdiOpenInNew } from "@mdi/js"; import { LitElement, css, html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; -import { LocalizeFunc } from "../../common/translations/localize"; +import type { LocalizeFunc } from "../../common/translations/localize"; import { createCloseHeading } from "../../components/ha-dialog"; import "../../components/ha-list-item"; diff --git a/src/onboarding/dialogs/show-app-dialog.ts b/src/onboarding/dialogs/show-app-dialog.ts index 49dbac520572..21aba8cc6258 100644 --- a/src/onboarding/dialogs/show-app-dialog.ts +++ b/src/onboarding/dialogs/show-app-dialog.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../common/dom/fire_event"; -import { LocalizeFunc } from "../../common/translations/localize"; +import type { LocalizeFunc } from "../../common/translations/localize"; export const loadAppDialog = () => import("./app-dialog"); diff --git a/src/onboarding/dialogs/show-community-dialog.ts b/src/onboarding/dialogs/show-community-dialog.ts index 236df5cc707b..72916daaffc9 100644 --- a/src/onboarding/dialogs/show-community-dialog.ts +++ b/src/onboarding/dialogs/show-community-dialog.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../common/dom/fire_event"; -import { LocalizeFunc } from "../../common/translations/localize"; +import type { LocalizeFunc } from "../../common/translations/localize"; export const loadCommunityDialog = () => import("./community-dialog"); diff --git a/src/onboarding/ha-onboarding.ts b/src/onboarding/ha-onboarding.ts index 7237e4083dcf..29d500480b82 100644 --- a/src/onboarding/ha-onboarding.ts +++ b/src/onboarding/ha-onboarding.ts @@ -1,12 +1,13 @@ import "@material/mwc-linear-progress/mwc-linear-progress"; +import type { Auth } from "home-assistant-js-websocket"; import { - Auth, createConnection, genClientId, getAuth, subscribeConfig, } from "home-assistant-js-websocket"; -import { PropertyValues, css, html, nothing } from "lit"; +import type { PropertyValues } from "lit"; +import { css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { enableWrite, @@ -14,7 +15,7 @@ import { saveTokens, } from "../common/auth/token_storage"; import { applyThemesOnElement } from "../common/dom/apply_themes_on_element"; -import { HASSDomEvent } from "../common/dom/fire_event"; +import type { HASSDomEvent } from "../common/dom/fire_event"; import { addSearchParam, extractSearchParam, @@ -22,10 +23,10 @@ import { } from "../common/url/search-params"; import { subscribeOne } from "../common/util/subscribe-one"; import "../components/ha-card"; -import { AuthUrlSearchParams, hassUrl } from "../data/auth"; +import type { AuthUrlSearchParams } from "../data/auth"; +import { hassUrl } from "../data/auth"; +import type { OnboardingResponses, OnboardingStep } from "../data/onboarding"; import { - OnboardingResponses, - OnboardingStep, fetchInstallationType, fetchOnboardingOverview, onboardIntegrationStep, @@ -33,7 +34,7 @@ import { import { subscribeUser } from "../data/ws-user"; import { litLocalizeLiteMixin } from "../mixins/lit-localize-lite-mixin"; import { HassElement } from "../state/hass-element"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import { storeState } from "../util/ha-pref-storage"; import { registerServiceWorker } from "../util/register-service-worker"; import "./onboarding-analytics"; diff --git a/src/onboarding/integration-badge.ts b/src/onboarding/integration-badge.ts index e42b1b22e657..87d60b9ded74 100644 --- a/src/onboarding/integration-badge.ts +++ b/src/onboarding/integration-badge.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import "../components/ha-svg-icon"; import { brandsUrl } from "../util/brands-url"; diff --git a/src/onboarding/onboarding-analytics.ts b/src/onboarding/onboarding-analytics.ts index 4cce93b6d276..11818f952337 100644 --- a/src/onboarding/onboarding-analytics.ts +++ b/src/onboarding/onboarding-analytics.ts @@ -1,12 +1,14 @@ import "@material/mwc-button/mwc-button"; import { mdiOpenInNew } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; -import { LocalizeFunc } from "../common/translations/localize"; +import type { LocalizeFunc } from "../common/translations/localize"; import "../components/ha-analytics"; import "../components/ha-svg-icon"; -import { Analytics, setAnalyticsPreferences } from "../data/analytics"; +import type { Analytics } from "../data/analytics"; +import { setAnalyticsPreferences } from "../data/analytics"; import { onboardAnalyticsStep } from "../data/onboarding"; import type { HomeAssistant } from "../types"; import { documentationUrl } from "../util/documentation-url"; diff --git a/src/onboarding/onboarding-core-config.ts b/src/onboarding/onboarding-core-config.ts index a45b989c2020..e12201317aa0 100644 --- a/src/onboarding/onboarding-core-config.ts +++ b/src/onboarding/onboarding-core-config.ts @@ -1,13 +1,6 @@ import "@material/mwc-button/mwc-button"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { LOCAL_TIME_ZONE } from "../common/datetime/resolve-time-zone"; import { fireEvent } from "../common/dom/fire_event"; @@ -15,7 +8,8 @@ import type { LocalizeFunc } from "../common/translations/localize"; import "../components/ha-alert"; import "../components/ha-circular-progress"; import "../components/ha-country-picker"; -import { ConfigUpdateValues, saveCoreConfig } from "../data/core"; +import type { ConfigUpdateValues } from "../data/core"; +import { saveCoreConfig } from "../data/core"; import { countryCurrency } from "../data/currency"; import { onboardCoreConfigStep } from "../data/onboarding"; import type { HomeAssistant, ValueChangedEvent } from "../types"; diff --git a/src/onboarding/onboarding-create-user.ts b/src/onboarding/onboarding-create-user.ts index 615d28930c0a..2d843b3b2622 100644 --- a/src/onboarding/onboarding-create-user.ts +++ b/src/onboarding/onboarding-create-user.ts @@ -1,20 +1,18 @@ import "@material/mwc-button"; import { genClientId } from "home-assistant-js-websocket"; -import { - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; -import { LocalizeFunc } from "../common/translations/localize"; +import type { LocalizeFunc } from "../common/translations/localize"; import "../components/ha-form/ha-form"; import type { HaForm } from "../components/ha-form/ha-form"; -import { HaFormDataContainer, HaFormSchema } from "../components/ha-form/types"; +import type { + HaFormDataContainer, + HaFormSchema, +} from "../components/ha-form/types"; import { onboardUserStep } from "../data/onboarding"; -import { ValueChangedEvent } from "../types"; +import type { ValueChangedEvent } from "../types"; import { onBoardingStyles } from "./styles"; import { debounce } from "../common/util/debounce"; diff --git a/src/onboarding/onboarding-integrations.ts b/src/onboarding/onboarding-integrations.ts index 2a9a4b039c59..83961b8523ad 100644 --- a/src/onboarding/onboarding-integrations.ts +++ b/src/onboarding/onboarding-integrations.ts @@ -1,24 +1,19 @@ -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { isComponentLoaded } from "../common/config/is_component_loaded"; import { fireEvent } from "../common/dom/fire_event"; import { stringCompare } from "../common/string/compare"; -import { LocalizeFunc } from "../common/translations/localize"; +import type { LocalizeFunc } from "../common/translations/localize"; import "../components/ha-button"; -import { ConfigEntry, subscribeConfigEntries } from "../data/config_entries"; +import type { ConfigEntry } from "../data/config_entries"; +import { subscribeConfigEntries } from "../data/config_entries"; import { subscribeConfigFlowInProgress } from "../data/config_flow"; import { domainToName } from "../data/integration"; import { scanUSBDevices } from "../data/usb"; import { SubscribeMixin } from "../mixins/subscribe-mixin"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./integration-badge"; import { onBoardingStyles } from "./styles"; diff --git a/src/onboarding/onboarding-loading.ts b/src/onboarding/onboarding-loading.ts index 23f9967d21b8..8670ed98cd8d 100644 --- a/src/onboarding/onboarding-loading.ts +++ b/src/onboarding/onboarding-loading.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement } from "lit/decorators"; @customElement("onboarding-loading") diff --git a/src/onboarding/onboarding-location.ts b/src/onboarding/onboarding-location.ts index f4c8d505b703..16a2c92b1ffa 100644 --- a/src/onboarding/onboarding-location.ts +++ b/src/onboarding/onboarding-location.ts @@ -6,14 +6,8 @@ import { mdiMapMarker, mdiMapSearchOutline, } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../common/dom/fire_event"; @@ -30,12 +24,10 @@ import type { HaLocationsEditor, MarkerLocation, } from "../components/map/ha-locations-editor"; -import { ConfigUpdateValues, detectCoreConfig } from "../data/core"; -import { - OpenStreetMapPlace, - reverseGeocode, - searchPlaces, -} from "../data/openstreetmap"; +import type { ConfigUpdateValues } from "../data/core"; +import { detectCoreConfig } from "../data/core"; +import type { OpenStreetMapPlace } from "../data/openstreetmap"; +import { reverseGeocode, searchPlaces } from "../data/openstreetmap"; import { showConfirmationDialog } from "../dialogs/generic/show-dialog-box"; import type { HomeAssistant } from "../types"; import { onBoardingStyles } from "./styles"; diff --git a/src/onboarding/onboarding-restore-backup.ts b/src/onboarding/onboarding-restore-backup.ts index a9a004ce6c4e..7832cb44ad93 100644 --- a/src/onboarding/onboarding-restore-backup.ts +++ b/src/onboarding/onboarding-restore-backup.ts @@ -1,5 +1,6 @@ import "@material/mwc-button/mwc-button"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { showHassioBackupDialog } from "../../hassio/src/dialogs/backup/show-dialog-hassio-backup"; import "../../hassio/src/components/hassio-upload-backup"; @@ -7,7 +8,7 @@ import type { LocalizeFunc } from "../common/translations/localize"; import "../components/ha-ansi-to-html"; import "../components/ha-card"; import { fetchInstallationType } from "../data/onboarding"; -import { HomeAssistant } from "../types"; +import type { HomeAssistant } from "../types"; import "./onboarding-loading"; import { onBoardingStyles } from "./styles"; import { removeSearchParam } from "../common/url/search-params"; diff --git a/src/onboarding/onboarding-welcome-link.ts b/src/onboarding/onboarding-welcome-link.ts index 6b9f243fa2da..25c605bb7fcd 100644 --- a/src/onboarding/onboarding-welcome-link.ts +++ b/src/onboarding/onboarding-welcome-link.ts @@ -1,4 +1,5 @@ -import { CSSResultGroup, LitElement, TemplateResult, css, html } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, property } from "lit/decorators"; import "../components/ha-card"; import "../components/ha-ripple"; diff --git a/src/onboarding/onboarding-welcome-links.ts b/src/onboarding/onboarding-welcome-links.ts index 9c342e508370..026889a0a91f 100644 --- a/src/onboarding/onboarding-welcome-links.ts +++ b/src/onboarding/onboarding-welcome-links.ts @@ -1,12 +1,6 @@ import { mdiAccountGroup, mdiFileDocument, mdiTabletCellphone } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import type { LocalizeFunc } from "../common/translations/localize"; import "../components/ha-card"; diff --git a/src/onboarding/onboarding-welcome.ts b/src/onboarding/onboarding-welcome.ts index 7b3888a0f0be..a3f0dba05156 100644 --- a/src/onboarding/onboarding-welcome.ts +++ b/src/onboarding/onboarding-welcome.ts @@ -1,11 +1,5 @@ -import { - CSSResultGroup, - LitElement, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import type { LocalizeFunc } from "../common/translations/localize"; import type { HomeAssistant } from "../types"; diff --git a/src/panels/calendar/confirm-event-dialog-box.ts b/src/panels/calendar/confirm-event-dialog-box.ts index 94adc8095477..119a0f33fc99 100644 --- a/src/panels/calendar/confirm-event-dialog-box.ts +++ b/src/panels/calendar/confirm-event-dialog-box.ts @@ -1,13 +1,14 @@ import "@material/mwc-button/mwc-button"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import "../../components/ha-dialog"; import "../../components/ha-svg-icon"; import "../../components/ha-switch"; import { RecurrenceRange } from "../../data/calendar"; -import { HomeAssistant } from "../../types"; -import { ConfirmEventDialogBoxParams } from "./show-confirm-event-dialog-box"; +import type { HomeAssistant } from "../../types"; +import type { ConfirmEventDialogBoxParams } from "./show-confirm-event-dialog-box"; @customElement("confirm-event-dialog-box") class ConfirmEventDialogBox extends LitElement { diff --git a/src/panels/calendar/dialog-calendar-event-detail.ts b/src/panels/calendar/dialog-calendar-event-detail.ts index 8340b79ba054..d154c725f5db 100644 --- a/src/panels/calendar/dialog-calendar-event-detail.ts +++ b/src/panels/calendar/dialog-calendar-event-detail.ts @@ -2,7 +2,8 @@ import "@material/mwc-button"; import { mdiCalendarClock } from "@mdi/js"; import { toDate } from "date-fns-tz"; import { addDays, isSameDay } from "date-fns"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { property, state } from "lit/decorators"; import { formatDate } from "../../common/datetime/format_date"; import { formatDateTime } from "../../common/datetime/format_date_time"; @@ -14,16 +15,14 @@ import "../../components/ha-alert"; import "../../components/ha-date-input"; import { createCloseHeading } from "../../components/ha-dialog"; import "../../components/ha-time-input"; -import { - CalendarEventMutableParams, - deleteCalendarEvent, -} from "../../data/calendar"; +import type { CalendarEventMutableParams } from "../../data/calendar"; +import { deleteCalendarEvent } from "../../data/calendar"; import { haStyleDialog } from "../../resources/styles"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import "../lovelace/components/hui-generic-entity-row"; import { renderRRuleAsText } from "./recurrence"; import { showConfirmEventDialog } from "./show-confirm-event-dialog-box"; -import { CalendarEventDetailDialogParams } from "./show-dialog-calendar-event-detail"; +import type { CalendarEventDetailDialogParams } from "./show-dialog-calendar-event-detail"; import { showCalendarEventEditDialog } from "./show-dialog-calendar-event-editor"; import { resolveTimeZone } from "../../common/datetime/resolve-time-zone"; diff --git a/src/panels/calendar/dialog-calendar-event-editor.ts b/src/panels/calendar/dialog-calendar-event-editor.ts index ad9dfbe9f902..437db6e2b67c 100644 --- a/src/panels/calendar/dialog-calendar-event-editor.ts +++ b/src/panels/calendar/dialog-calendar-event-editor.ts @@ -7,8 +7,9 @@ import { differenceInMilliseconds, startOfHour, } from "date-fns"; -import { HassEntity } from "home-assistant-js-websocket"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { resolveTimeZone } from "../../common/datetime/resolve-time-zone"; @@ -25,20 +26,20 @@ import "../../components/ha-switch"; import "../../components/ha-textarea"; import "../../components/ha-textfield"; import "../../components/ha-time-input"; +import type { CalendarEventMutableParams } from "../../data/calendar"; import { CalendarEntityFeature, - CalendarEventMutableParams, RecurrenceRange, createCalendarEvent, deleteCalendarEvent, updateCalendarEvent, } from "../../data/calendar"; import { haStyleDialog } from "../../resources/styles"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import "../lovelace/components/hui-generic-entity-row"; import "./ha-recurrence-rule-editor"; import { showConfirmEventDialog } from "./show-confirm-event-dialog-box"; -import { CalendarEventEditDialogParams } from "./show-dialog-calendar-event-editor"; +import type { CalendarEventEditDialogParams } from "./show-dialog-calendar-event-editor"; const CALENDAR_DOMAINS = ["calendar"]; diff --git a/src/panels/calendar/ha-full-calendar.ts b/src/panels/calendar/ha-full-calendar.ts index 46ceac93c9ad..49565f1ebfdf 100644 --- a/src/panels/calendar/ha-full-calendar.ts +++ b/src/panels/calendar/ha-full-calendar.ts @@ -13,21 +13,15 @@ import { mdiViewModule, mdiViewWeek, } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoize from "memoize-one"; import { firstWeekdayIndex } from "../../common/datetime/first_weekday"; import { useAmPm } from "../../common/datetime/use_am_pm"; import { fireEvent } from "../../common/dom/fire_event"; import { supportsFeature } from "../../common/entity/supports-feature"; -import { LocalizeFunc } from "../../common/translations/localize"; +import type { LocalizeFunc } from "../../common/translations/localize"; import "../../components/ha-button-toggle-group"; import "../../components/ha-fab"; import "../../components/ha-icon-button-next"; diff --git a/src/panels/calendar/ha-panel-calendar.ts b/src/panels/calendar/ha-panel-calendar.ts index 2b9dfa8c3df9..21583deb7758 100644 --- a/src/panels/calendar/ha-panel-calendar.ts +++ b/src/panels/calendar/ha-panel-calendar.ts @@ -2,19 +2,12 @@ import { ResizeController } from "@lit-labs/observers/resize-controller"; import "@material/mwc-list"; import type { RequestSelectedDetail } from "@material/mwc-list/mwc-list-item"; import { mdiChevronDown, mdiPlus, mdiRefresh } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import { storage } from "../../common/decorators/storage"; -import { HASSDomEvent } from "../../common/dom/fire_event"; +import type { HASSDomEvent } from "../../common/dom/fire_event"; import { computeStateName } from "../../common/entity/compute_state_name"; import "../../components/ha-button"; import "../../components/ha-button-menu"; @@ -26,12 +19,8 @@ import "../../components/ha-menu-button"; import "../../components/ha-state-icon"; import "../../components/ha-svg-icon"; import "../../components/ha-two-pane-top-app-bar-fixed"; -import { - Calendar, - CalendarEvent, - fetchCalendarEvents, - getCalendars, -} from "../../data/calendar"; +import type { Calendar, CalendarEvent } from "../../data/calendar"; +import { fetchCalendarEvents, getCalendars } from "../../data/calendar"; import { fetchIntegrationManifest } from "../../data/integration"; import { showConfigFlowDialog } from "../../dialogs/config-flow/show-dialog-config-flow"; import { haStyle } from "../../resources/styles"; diff --git a/src/panels/calendar/ha-recurrence-rule-editor.ts b/src/panels/calendar/ha-recurrence-rule-editor.ts index 5a1727b43131..348ad6784fb3 100644 --- a/src/panels/calendar/ha-recurrence-rule-editor.ts +++ b/src/panels/calendar/ha-recurrence-rule-editor.ts @@ -1,12 +1,13 @@ import type { SelectedDetail } from "@material/mwc-list"; import { formatInTimeZone, toDate } from "date-fns-tz"; -import { LitElement, PropertyValues, css, html, nothing } from "lit"; +import type { PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; -import type { Options, WeekdayStr } from "rrule"; -import { ByWeekday, RRule, Weekday } from "rrule"; +import type { Options, WeekdayStr, ByWeekday } from "rrule"; +import { RRule, Weekday } from "rrule"; import { firstWeekdayIndex } from "../../common/datetime/first_weekday"; import { stopPropagation } from "../../common/dom/stop_propagation"; -import { LocalizeKeys } from "../../common/translations/localize"; +import type { LocalizeKeys } from "../../common/translations/localize"; import "../../components/chips/ha-chip-set"; import "../../components/chips/ha-filter-chip"; import "../../components/ha-date-input"; @@ -14,12 +15,14 @@ import "../../components/ha-list-item"; import "../../components/ha-select"; import type { HaSelect } from "../../components/ha-select"; import "../../components/ha-textfield"; -import { HomeAssistant } from "../../types"; -import { - DEFAULT_COUNT, +import type { HomeAssistant } from "../../types"; +import type { MonthlyRepeatItem, RepeatEnd, RepeatFrequency, +} from "./recurrence"; +import { + DEFAULT_COUNT, convertFrequency, convertRepeatFrequency, getMonthdayRepeatFromRule, diff --git a/src/panels/calendar/recurrence.ts b/src/panels/calendar/recurrence.ts index 1a502c96785e..a42300c5da08 100644 --- a/src/panels/calendar/recurrence.ts +++ b/src/panels/calendar/recurrence.ts @@ -16,7 +16,7 @@ import { formatDate } from "../../common/datetime/format_date"; import { capitalizeFirstLetter } from "../../common/string/capitalize-first-letter"; import { dayNames } from "../../common/translations/day_names"; import { monthNames } from "../../common/translations/month_names"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; export type RepeatFrequency = | "none" diff --git a/src/panels/calendar/show-confirm-event-dialog-box.ts b/src/panels/calendar/show-confirm-event-dialog-box.ts index f3b377805aac..934e4dfeab39 100644 --- a/src/panels/calendar/show-confirm-event-dialog-box.ts +++ b/src/panels/calendar/show-confirm-event-dialog-box.ts @@ -1,6 +1,6 @@ -import { TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; import { fireEvent } from "../../common/dom/fire_event"; -import { RecurrenceRange } from "../../data/calendar"; +import type { RecurrenceRange } from "../../data/calendar"; export interface ConfirmEventDialogBoxParams { confirmText?: string; diff --git a/src/panels/calendar/show-dialog-calendar-event-detail.ts b/src/panels/calendar/show-dialog-calendar-event-detail.ts index 659db3b1b696..c47676c34341 100644 --- a/src/panels/calendar/show-dialog-calendar-event-detail.ts +++ b/src/panels/calendar/show-dialog-calendar-event-detail.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../common/dom/fire_event"; -import { CalendarEventData } from "../../data/calendar"; +import type { CalendarEventData } from "../../data/calendar"; export interface CalendarEventDetailDialogParams { calendarId: string; diff --git a/src/panels/calendar/show-dialog-calendar-event-editor.ts b/src/panels/calendar/show-dialog-calendar-event-editor.ts index 6f6fddcf2242..96bc910fb495 100644 --- a/src/panels/calendar/show-dialog-calendar-event-editor.ts +++ b/src/panels/calendar/show-dialog-calendar-event-editor.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../common/dom/fire_event"; -import { CalendarEventData } from "../../data/calendar"; +import type { CalendarEventData } from "../../data/calendar"; export interface CalendarEventEditDialogParams { calendarId?: string; diff --git a/src/panels/config/application_credentials/dialog-add-application-credential.ts b/src/panels/config/application_credentials/dialog-add-application-credential.ts index d5e9ca4c8481..386298ff4f70 100644 --- a/src/panels/config/application_credentials/dialog-add-application-credential.ts +++ b/src/panels/config/application_credentials/dialog-add-application-credential.ts @@ -1,7 +1,8 @@ import "@material/mwc-list/mwc-list-item"; import { mdiOpenInNew } from "@mdi/js"; -import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import "../../../components/ha-alert"; @@ -12,17 +13,20 @@ import { createCloseHeading } from "../../../components/ha-dialog"; import "../../../components/ha-markdown"; import "../../../components/ha-password-field"; import "../../../components/ha-textfield"; -import { +import type { ApplicationCredential, ApplicationCredentialsConfig, +} from "../../../data/application_credential"; +import { createApplicationCredential, fetchApplicationCredentialsConfig, } from "../../../data/application_credential"; -import { domainToName, IntegrationManifest } from "../../../data/integration"; +import type { IntegrationManifest } from "../../../data/integration"; +import { domainToName } from "../../../data/integration"; import { haStyleDialog } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { documentationUrl } from "../../../util/documentation-url"; -import { AddApplicationCredentialDialogParams } from "./show-dialog-add-application-credential"; +import type { AddApplicationCredentialDialogParams } from "./show-dialog-add-application-credential"; interface Domain { id: string; diff --git a/src/panels/config/application_credentials/ha-config-application-credentials.ts b/src/panels/config/application_credentials/ha-config-application-credentials.ts index f18966c6f8d7..e27c82deb2ee 100644 --- a/src/panels/config/application_credentials/ha-config-application-credentials.ts +++ b/src/panels/config/application_credentials/ha-config-application-credentials.ts @@ -1,10 +1,11 @@ import { mdiDelete, mdiPlus } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import type { HASSDomEvent } from "../../../common/dom/fire_event"; -import { LocalizeFunc } from "../../../common/translations/localize"; -import { +import type { LocalizeFunc } from "../../../common/translations/localize"; +import type { DataTableColumnContainer, SelectionChangedEvent, SortingChangedEvent, @@ -13,8 +14,8 @@ import "../../../components/ha-fab"; import "../../../components/ha-help-tooltip"; import "../../../components/ha-svg-icon"; import "../../../components/ha-icon-overflow-menu"; +import type { ApplicationCredential } from "../../../data/application_credential"; import { - ApplicationCredential, deleteApplicationCredential, fetchApplicationCredentials, } from "../../../data/application_credential"; @@ -25,7 +26,7 @@ import { } from "../../../dialogs/generic/show-dialog-box"; import "../../../layouts/hass-tabs-subpage-data-table"; import type { HaTabsSubpageDataTable } from "../../../layouts/hass-tabs-subpage-data-table"; -import { HomeAssistant, Route } from "../../../types"; +import type { HomeAssistant, Route } from "../../../types"; import { configSections } from "../ha-panel-config"; import { showAddApplicationCredentialDialog } from "./show-dialog-add-application-credential"; import { storage } from "../../../common/decorators/storage"; diff --git a/src/panels/config/application_credentials/show-dialog-add-application-credential.ts b/src/panels/config/application_credentials/show-dialog-add-application-credential.ts index a02201d01e46..78c1668695eb 100644 --- a/src/panels/config/application_credentials/show-dialog-add-application-credential.ts +++ b/src/panels/config/application_credentials/show-dialog-add-application-credential.ts @@ -1,6 +1,6 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import { ApplicationCredential } from "../../../data/application_credential"; -import { IntegrationManifest } from "../../../data/integration"; +import type { ApplicationCredential } from "../../../data/application_credential"; +import type { IntegrationManifest } from "../../../data/integration"; export interface AddApplicationCredentialDialogParams { applicationCredentialAddedCallback: ( diff --git a/src/panels/config/areas/dialog-area-registry-detail.ts b/src/panels/config/areas/dialog-area-registry-detail.ts index bdbfff68d872..d8375babc442 100644 --- a/src/panels/config/areas/dialog-area-registry-detail.ts +++ b/src/panels/config/areas/dialog-area-registry-detail.ts @@ -1,6 +1,7 @@ import "@material/mwc-button"; import "@material/mwc-list/mwc-list"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { property, state } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import "../../../components/ha-alert"; @@ -13,11 +14,11 @@ import "../../../components/ha-icon-picker"; import "../../../components/ha-floor-picker"; import "../../../components/ha-textfield"; import "../../../components/ha-labels-picker"; -import { AreaRegistryEntryMutableParams } from "../../../data/area_registry"; -import { CropOptions } from "../../../dialogs/image-cropper-dialog/show-image-cropper-dialog"; +import type { AreaRegistryEntryMutableParams } from "../../../data/area_registry"; +import type { CropOptions } from "../../../dialogs/image-cropper-dialog/show-image-cropper-dialog"; import { haStyleDialog } from "../../../resources/styles"; -import { HomeAssistant, ValueChangedEvent } from "../../../types"; -import { AreaRegistryDetailDialogParams } from "./show-dialog-area-registry-detail"; +import type { HomeAssistant, ValueChangedEvent } from "../../../types"; +import type { AreaRegistryDetailDialogParams } from "./show-dialog-area-registry-detail"; const cropOptions: CropOptions = { round: false, diff --git a/src/panels/config/areas/dialog-floor-registry-detail.ts b/src/panels/config/areas/dialog-floor-registry-detail.ts index d59a324f1647..8b4bf29db4ad 100644 --- a/src/panels/config/areas/dialog-floor-registry-detail.ts +++ b/src/panels/config/areas/dialog-floor-registry-detail.ts @@ -1,7 +1,8 @@ import "@material/mwc-button"; import "@material/mwc-list/mwc-list"; import { mdiTextureBox } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { property, state } from "lit/decorators"; import { repeat } from "lit/directives/repeat"; import memoizeOne from "memoize-one"; @@ -16,13 +17,14 @@ import "../../../components/ha-picture-upload"; import "../../../components/ha-settings-row"; import "../../../components/ha-svg-icon"; import "../../../components/ha-textfield"; -import { +import "../../../components/ha-area-picker"; +import type { FloorRegistryEntry, FloorRegistryEntryMutableParams, } from "../../../data/floor_registry"; import { haStyle, haStyleDialog } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; -import { FloorRegistryDetailDialogParams } from "./show-dialog-floor-registry-detail"; +import type { HomeAssistant } from "../../../types"; +import type { FloorRegistryDetailDialogParams } from "./show-dialog-floor-registry-detail"; import { showAreaRegistryDetailDialog } from "./show-dialog-area-registry-detail"; import { updateAreaRegistryEntry } from "../../../data/area_registry"; diff --git a/src/panels/config/areas/ha-config-area-page.ts b/src/panels/config/areas/ha-config-area-page.ts index e329854192ff..e1175dcfe01c 100644 --- a/src/panels/config/areas/ha-config-area-page.ts +++ b/src/panels/config/areas/ha-config-area-page.ts @@ -1,9 +1,11 @@ +import "@material/mwc-list/mwc-list-item"; import { consume } from "@lit-labs/context"; import "@material/mwc-button"; import "@material/mwc-list"; import { mdiDelete, mdiDotsVertical, mdiImagePlus, mdiPencil } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket/dist/types"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket/dist/types"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import memoizeOne from "memoize-one"; @@ -17,32 +19,34 @@ import "../../../components/ha-card"; import "../../../components/ha-icon-button"; import "../../../components/ha-icon-next"; import "../../../components/ha-list-item"; +import "../../../components/ha-button-menu"; +import type { AreaRegistryEntry } from "../../../data/area_registry"; import { - AreaRegistryEntry, deleteAreaRegistryEntry, updateAreaRegistryEntry, } from "../../../data/area_registry"; -import { AutomationEntity } from "../../../data/automation"; +import type { AutomationEntity } from "../../../data/automation"; import { fullEntitiesContext } from "../../../data/context"; +import type { DeviceRegistryEntry } from "../../../data/device_registry"; import { - DeviceRegistryEntry, computeDeviceName, sortDeviceRegistryByName, } from "../../../data/device_registry"; +import type { EntityRegistryEntry } from "../../../data/entity_registry"; import { - EntityRegistryEntry, computeEntityRegistryName, sortEntityRegistryByName, } from "../../../data/entity_registry"; -import { SceneEntity } from "../../../data/scene"; -import { ScriptEntity } from "../../../data/script"; -import { RelatedResult, findRelated } from "../../../data/search"; +import type { SceneEntity } from "../../../data/scene"; +import type { ScriptEntity } from "../../../data/script"; +import type { RelatedResult } from "../../../data/search"; +import { findRelated } from "../../../data/search"; import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box"; import { showMoreInfoDialog } from "../../../dialogs/more-info/show-ha-more-info-dialog"; import "../../../layouts/hass-error-screen"; import "../../../layouts/hass-subpage"; import { haStyle } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import "../../logbook/ha-logbook"; import { loadAreaRegistryDetailDialog, diff --git a/src/panels/config/areas/ha-config-areas-dashboard.ts b/src/panels/config/areas/ha-config-areas-dashboard.ts index 5892abde3a3b..d92f56cb99f3 100644 --- a/src/panels/config/areas/ha-config-areas-dashboard.ts +++ b/src/panels/config/areas/ha-config-areas-dashboard.ts @@ -1,4 +1,4 @@ -import { ActionDetail } from "@material/mwc-list"; +import type { ActionDetail } from "@material/mwc-list"; import { mdiDelete, mdiDotsVertical, @@ -7,14 +7,15 @@ import { mdiPlus, } from "@mdi/js"; import { - CSSResultGroup, + type CSSResultGroup, LitElement, - TemplateResult, + type PropertyValues, + type TemplateResult, css, html, nothing, } from "lit"; -import { customElement, property } from "lit/decorators"; +import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import memoizeOne from "memoize-one"; import { formatListWithAnds } from "../../../common/string/format-list"; @@ -23,13 +24,13 @@ import "../../../components/ha-floor-icon"; import "../../../components/ha-icon-button"; import "../../../components/ha-sortable"; import "../../../components/ha-svg-icon"; +import type { AreaRegistryEntry } from "../../../data/area_registry"; import { - AreaRegistryEntry, createAreaRegistryEntry, updateAreaRegistryEntry, } from "../../../data/area_registry"; +import type { FloorRegistryEntry } from "../../../data/floor_registry"; import { - FloorRegistryEntry, createFloorRegistryEntry, deleteFloorRegistryEntry, getFloorAreaLookup, @@ -40,7 +41,7 @@ import { showConfirmationDialog, } from "../../../dialogs/generic/show-dialog-box"; import "../../../layouts/hass-tabs-subpage"; -import { HomeAssistant, Route } from "../../../types"; +import type { HomeAssistant, Route } from "../../../types"; import "../ha-config-section"; import { configSections } from "../ha-panel-config"; import { @@ -49,7 +50,7 @@ import { } from "./show-dialog-area-registry-detail"; import { showFloorRegistryDetailDialog } from "./show-dialog-floor-registry-detail"; -const UNASSIGNED_PATH = ["__unassigned__"]; +const UNASSIGNED_FLOOR = "__unassigned__"; const SORT_OPTIONS = { sort: false, delay: 500, delayOnTouchOnly: true }; @@ -63,9 +64,11 @@ export class HaConfigAreasDashboard extends LitElement { @property({ attribute: false }) public route!: Route; + @state() private _areas: AreaRegistryEntry[] = []; + private _processAreas = memoizeOne( ( - areas: HomeAssistant["areas"], + areas: AreaRegistryEntry[], devices: HomeAssistant["devices"], entities: HomeAssistant["entities"], floors: HomeAssistant["floors"] @@ -99,8 +102,8 @@ export class HaConfigAreasDashboard extends LitElement { }; }; - const floorAreaLookup = getFloorAreaLookup(Object.values(areas)); - const unassisgnedAreas = Object.values(areas).filter( + const floorAreaLookup = getFloorAreaLookup(areas); + const unassignedAreas = areas.filter( (area) => !area.floor_id || !floorAreaLookup[area.floor_id] ); return { @@ -108,11 +111,21 @@ export class HaConfigAreasDashboard extends LitElement { ...floor, areas: (floorAreaLookup[floor.floor_id] || []).map(processArea), })), - unassisgnedAreas: unassisgnedAreas.map(processArea), + unassignedAreas: unassignedAreas.map(processArea), }; } ); + protected willUpdate(changedProperties: PropertyValues): void { + super.willUpdate(changedProperties); + if (changedProperties.has("hass")) { + const oldHass = changedProperties.get("hass"); + if (this.hass.areas !== oldHass?.areas) { + this._areas = Object.values(this.hass.areas); + } + } + } + protected render(): TemplateResult { const areasAndFloors = !this.hass.areas || @@ -121,7 +134,7 @@ export class HaConfigAreasDashboard extends LitElement { !this.hass.floors ? undefined : this._processAreas( - this.hass.areas, + this._areas, this.hass.devices, this.hass.entities, this.hass.floors @@ -183,10 +196,10 @@ export class HaConfigAreasDashboard extends LitElement {
${floor.areas.map((area) => this._renderArea(area))} @@ -194,7 +207,7 @@ export class HaConfigAreasDashboard extends LitElement {
` )} - ${areasAndFloors?.unassisgnedAreas.length + ${areasAndFloors?.unassignedAreas.length ? html`

@@ -206,13 +219,13 @@ export class HaConfigAreasDashboard extends LitElement {
- ${areasAndFloors?.unassisgnedAreas.map((area) => + ${areasAndFloors?.unassignedAreas.map((area) => this._renderArea(area) )}
@@ -246,7 +259,10 @@ export class HaConfigAreasDashboard extends LitElement { } private _renderArea(area) { - return html`
+ return html`
floor.floor_id === ev.detail.oldPath[0] - ); - area = oldFloor!.areas[ev.detail.oldIndex]; - } + private async _areaAdded(ev) { + ev.stopPropagation(); + const { floor } = ev.currentTarget; + + const newFloorId = floor === UNASSIGNED_FLOOR ? null : floor; + + const { data: area } = ev.detail; + + this._areas = this._areas.map((a) => { + if (a.area_id === area.area_id) { + return { ...a, floor_id: newFloorId }; + } + return a; + }); await updateAreaRegistryEntry(this.hass, area.area_id, { - floor_id: - ev.detail.newPath === UNASSIGNED_PATH ? null : ev.detail.newPath[0], + floor_id: newFloorId, }); } diff --git a/src/panels/config/areas/ha-config-areas.ts b/src/panels/config/areas/ha-config-areas.ts index fd8959f050e2..332b1cbb0875 100644 --- a/src/panels/config/areas/ha-config-areas.ts +++ b/src/panels/config/areas/ha-config-areas.ts @@ -1,9 +1,7 @@ import { customElement, property } from "lit/decorators"; -import { - HassRouterPage, - RouterOptions, -} from "../../../layouts/hass-router-page"; -import { HomeAssistant } from "../../../types"; +import type { RouterOptions } from "../../../layouts/hass-router-page"; +import { HassRouterPage } from "../../../layouts/hass-router-page"; +import type { HomeAssistant } from "../../../types"; import "./ha-config-area-page"; import "./ha-config-areas-dashboard"; diff --git a/src/panels/config/areas/show-dialog-area-registry-detail.ts b/src/panels/config/areas/show-dialog-area-registry-detail.ts index 19d56e52c1fc..ca12d2b87a74 100644 --- a/src/panels/config/areas/show-dialog-area-registry-detail.ts +++ b/src/panels/config/areas/show-dialog-area-registry-detail.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import { +import type { AreaRegistryEntry, AreaRegistryEntryMutableParams, } from "../../../data/area_registry"; diff --git a/src/panels/config/areas/show-dialog-floor-registry-detail.ts b/src/panels/config/areas/show-dialog-floor-registry-detail.ts index d321f6067000..4fe6d0cc4ba6 100644 --- a/src/panels/config/areas/show-dialog-floor-registry-detail.ts +++ b/src/panels/config/areas/show-dialog-floor-registry-detail.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import { +import type { FloorRegistryEntry, FloorRegistryEntryMutableParams, } from "../../../data/floor_registry"; diff --git a/src/panels/config/automation/action/ha-automation-action-row.ts b/src/panels/config/automation/action/ha-automation-action-row.ts index ce4813b29fbb..4edb59acfbeb 100644 --- a/src/panels/config/automation/action/ha-automation-action-row.ts +++ b/src/panels/config/automation/action/ha-automation-action-row.ts @@ -1,5 +1,5 @@ import { consume } from "@lit-labs/context"; -import { 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 { mdiAlertCircleCheck, @@ -17,14 +17,8 @@ import { mdiStopCircleOutline, } from "@mdi/js"; import deepClone from "deep-clone-simple"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { storage } from "../../../../common/decorators/storage"; @@ -41,19 +35,18 @@ import "../../../../components/ha-icon-button"; import "../../../../components/ha-service-icon"; import type { HaYamlEditor } from "../../../../components/ha-yaml-editor"; import { ACTION_ICONS, YAML_ONLY_ACTION_TYPES } from "../../../../data/action"; -import { AutomationClipboard } from "../../../../data/automation"; +import type { AutomationClipboard } from "../../../../data/automation"; import { validateConfig } from "../../../../data/config"; import { floorsContext, fullEntitiesContext, labelsContext, } from "../../../../data/context"; -import { EntityRegistryEntry } from "../../../../data/entity_registry"; -import { FloorRegistryEntry } from "../../../../data/floor_registry"; -import { LabelRegistryEntry } from "../../../../data/label_registry"; +import type { EntityRegistryEntry } from "../../../../data/entity_registry"; +import type { FloorRegistryEntry } from "../../../../data/floor_registry"; +import type { LabelRegistryEntry } from "../../../../data/label_registry"; +import type { Action, NonConditionAction } from "../../../../data/script"; import { - Action, - NonConditionAction, getActionType, migrateAutomationAction, } from "../../../../data/script"; @@ -65,7 +58,7 @@ import { showPromptDialog, } from "../../../../dialogs/generic/show-dialog-box"; import { haStyle } from "../../../../resources/styles"; -import type { HomeAssistant, ItemPath } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; import { showToast } from "../../../../util/toast"; import "./types/ha-automation-action-activate_scene"; import "./types/ha-automation-action-choose"; @@ -137,8 +130,6 @@ export default class HaAutomationActionRow extends LitElement { @property({ type: Boolean }) public disabled = false; - @property({ type: Array }) public path?: ItemPath; - @property({ type: Boolean }) public first?: boolean; @property({ type: Boolean }) public last?: boolean; @@ -432,7 +423,6 @@ export default class HaAutomationActionRow extends LitElement { action: this.action, narrow: this.narrow, disabled: this.disabled, - path: this.path, })}
`} diff --git a/src/panels/config/automation/action/ha-automation-action.ts b/src/panels/config/automation/action/ha-automation-action.ts index 301dc97411eb..19629e1deba1 100644 --- a/src/panels/config/automation/action/ha-automation-action.ts +++ b/src/panels/config/automation/action/ha-automation-action.ts @@ -1,26 +1,20 @@ import { mdiDrag, mdiPlus } from "@mdi/js"; import deepClone from "deep-clone-simple"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { repeat } from "lit/directives/repeat"; import { storage } from "../../../../common/decorators/storage"; import { fireEvent } from "../../../../common/dom/fire_event"; import { listenMediaQuery } from "../../../../common/dom/media_query"; -import { nestedArrayMove } from "../../../../common/util/array-move"; +import { nextRender } from "../../../../common/util/render-status"; import "../../../../components/ha-button"; import "../../../../components/ha-sortable"; import "../../../../components/ha-svg-icon"; import { getService, isService } from "../../../../data/action"; import type { AutomationClipboard } from "../../../../data/automation"; -import { Action } from "../../../../data/script"; -import { HomeAssistant, ItemPath } from "../../../../types"; +import type { Action } from "../../../../data/script"; +import type { HomeAssistant } from "../../../../types"; import { PASTE_VALUE, showAddAutomationElementDialog, @@ -36,8 +30,6 @@ export default class HaAutomationAction extends LitElement { @property({ type: Boolean }) public disabled = false; - @property({ type: Array }) public path?: ItemPath; - @property({ attribute: false }) public actions!: Action[]; @state() private _showReorder: boolean = false; @@ -69,20 +61,17 @@ export default class HaAutomationAction extends LitElement { this._unsubMql = undefined; } - private get nested() { - return this.path !== undefined; - } - protected render() { return html`
${repeat( @@ -90,7 +79,7 @@ export default class HaAutomationAction extends LitElement { (action) => this._getKey(action), (action, idx) => html` { + ev.stopPropagation(); + const { index, data } = ev.detail; + const actions = [ + ...this.actions.slice(0, index), + data, + ...this.actions.slice(index), + ]; + // Add action locally to avoid UI jump + this.actions = actions; + await nextRender(); + fireEvent(this, "value-changed", { value: this.actions }); + } + + private async _actionRemoved(ev: CustomEvent): Promise { + ev.stopPropagation(); + const { index } = ev.detail; + const action = this.actions[index]; + // Remove action locally to avoid UI jump + this.actions = this.actions.filter((a) => a !== action); + await nextRender(); + // Ensure action is removed even after update + const actions = this.actions.filter((a) => a !== action); + fireEvent(this, "value-changed", { value: actions }); } private _actionChanged(ev: CustomEvent) { diff --git a/src/panels/config/automation/action/types/ha-automation-action-activate_scene.ts b/src/panels/config/automation/action/types/ha-automation-action-activate_scene.ts index bd5abb2145db..bf01fce06a77 100644 --- a/src/panels/config/automation/action/types/ha-automation-action-activate_scene.ts +++ b/src/panels/config/automation/action/types/ha-automation-action-activate_scene.ts @@ -2,9 +2,9 @@ import { html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/entity/ha-entity-picker"; -import { SceneAction } from "../../../../../data/script"; -import { ValueChangedEvent, HomeAssistant } from "../../../../../types"; -import { ActionElement } from "../ha-automation-action-row"; +import type { SceneAction } from "../../../../../data/script"; +import type { ValueChangedEvent, HomeAssistant } from "../../../../../types"; +import type { ActionElement } from "../ha-automation-action-row"; const includeDomains = ["scene"]; diff --git a/src/panels/config/automation/action/types/ha-automation-action-choose.ts b/src/panels/config/automation/action/types/ha-automation-action-choose.ts index 1da1e87d464a..07498c4606da 100644 --- a/src/panels/config/automation/action/types/ha-automation-action-choose.ts +++ b/src/panels/config/automation/action/types/ha-automation-action-choose.ts @@ -1,53 +1,14 @@ -import { consume } from "@lit-labs/context"; -import type { ActionDetail } from "@material/mwc-list"; -import { - mdiArrowDown, - mdiArrowUp, - mdiContentDuplicate, - mdiDelete, - mdiDotsVertical, - mdiDrag, - mdiPlus, - mdiRenameBox, -} from "@mdi/js"; -import deepClone from "deep-clone-simple"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import { type CSSResultGroup, LitElement, css, html } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { repeat } from "lit/directives/repeat"; import { ensureArray } from "../../../../../common/array/ensure-array"; import { fireEvent } from "../../../../../common/dom/fire_event"; -import { stopPropagation } from "../../../../../common/dom/stop_propagation"; -import { listenMediaQuery } from "../../../../../common/dom/media_query"; -import { capitalizeFirstLetter } from "../../../../../common/string/capitalize-first-letter"; import "../../../../../components/ha-button"; -import "../../../../../components/ha-button-menu"; -import "../../../../../components/ha-icon-button"; -import "../../../../../components/ha-sortable"; -import { Condition } from "../../../../../data/automation"; -import { describeCondition } from "../../../../../data/automation_i18n"; -import { fullEntitiesContext } from "../../../../../data/context"; -import { EntityRegistryEntry } from "../../../../../data/entity_registry"; -import { - Action, - ChooseAction, - ChooseActionChoice, -} from "../../../../../data/script"; -import { - showConfirmationDialog, - showPromptDialog, -} from "../../../../../dialogs/generic/show-dialog-box"; +import type { Action, ChooseAction, Option } from "../../../../../data/script"; import { haStyle } from "../../../../../resources/styles"; -import { HomeAssistant, ItemPath } from "../../../../../types"; -import { ActionElement } from "../ha-automation-action-row"; - -const preventDefault = (ev) => ev.preventDefault(); +import type { HomeAssistant } from "../../../../../types"; +import "../../option/ha-automation-option"; +import type { ActionElement } from "../ha-automation-action-row"; +import "../ha-automation-action"; @customElement("ha-automation-action-choose") export class HaChooseAction extends LitElement implements ActionElement { @@ -55,245 +16,26 @@ export class HaChooseAction extends LitElement implements ActionElement { @property({ type: Boolean }) public disabled = false; - @property({ attribute: false }) public path?: ItemPath; - @property({ attribute: false }) public action!: ChooseAction; @state() private _showDefault = false; - @state() private _expandedStates: boolean[] = []; - - @state() - @consume({ context: fullEntitiesContext, subscribe: true }) - _entityReg!: EntityRegistryEntry[]; - - @state() private _showReorder: boolean = false; - - private _expandLast = false; - - private _unsubMql?: () => void; - - public connectedCallback() { - super.connectedCallback(); - this._unsubMql = listenMediaQuery("(min-width: 600px)", (matches) => { - this._showReorder = matches; - }); - } - - public disconnectedCallback() { - super.disconnectedCallback(); - this._unsubMql?.(); - this._unsubMql = undefined; - } - public static get defaultConfig(): ChooseAction { return { choose: [{ conditions: [], sequence: [] }] }; } - private _expandedChanged(ev) { - this._expandedStates = this._expandedStates.concat(); - this._expandedStates[ev.target!.index] = ev.detail.expanded; - } - - private _getDescription(option) { - const conditions = ensureArray(option.conditions); - if (!conditions || conditions.length === 0) { - return this.hass.localize( - "ui.panel.config.automation.editor.actions.type.choose.no_conditions" - ); - } - let str = ""; - if (typeof conditions[0] === "string") { - str += conditions[0]; - } else { - str += describeCondition(conditions[0], this.hass, this._entityReg); - } - if (conditions.length > 1) { - str += this.hass.localize( - "ui.panel.config.automation.editor.actions.type.choose.option_description_additional", - { numberOfAdditionalConditions: conditions.length - 1 } - ); - } - return str; - } - protected render() { const action = this.action; - return html` - -
- ${repeat( - action.choose ? ensureArray(action.choose) : [], - (option) => option, - (option, idx) => html` -
- - -

- ${this.hass.localize( - "ui.panel.config.automation.editor.actions.type.choose.option", - { number: idx + 1 } - )}: - ${option.alias || - (this._expandedStates[idx] - ? "" - : this._getDescription(option))} -

- ${this._showReorder && !this.disabled - ? html` -
- -
- ` - : nothing} - - - - - ${this.hass.localize( - "ui.panel.config.automation.editor.actions.rename" - )} - - + const options = action.choose ? ensureArray(action.choose) : []; - - ${this.hass.localize( - "ui.panel.config.automation.editor.actions.duplicate" - )} - - - - - ${this.hass.localize( - "ui.panel.config.automation.editor.move_up" - )} - - - - - ${this.hass.localize( - "ui.panel.config.automation.editor.move_down" - )} - - - - - ${this.hass.localize( - "ui.panel.config.automation.editor.actions.type.choose.remove_option" - )} - - - - -
-

- ${this.hass.localize( - "ui.panel.config.automation.editor.actions.type.choose.conditions" - )}: -

- ( - option.conditions - )} - .disabled=${this.disabled} - .hass=${this.hass} - .idx=${idx} - @value-changed=${this._conditionChanged} - > -

- ${this.hass.localize( - "ui.panel.config.automation.editor.actions.type.choose.sequence" - )}: -

- -
-
-
-
- ` - )} -
- - - -
-
-
+ return html` + ${this._showDefault || action.default ? html` @@ -303,190 +45,39 @@ export class HaChooseAction extends LitElement implements ActionElement { )}:

` - : html``} + : html` + + `} `; } - private async _handleAction(ev: CustomEvent) { - switch (ev.detail.index) { - case 0: - await this._renameAction(ev); - break; - case 1: - this._duplicateOption(ev); - break; - case 2: - this._moveUp(ev); - break; - case 3: - this._moveDown(ev); - break; - case 4: - this._removeOption(ev); - break; - } - } - - private async _renameAction(ev: CustomEvent): Promise { - const index = (ev.target as any).idx; - const choose = this.action.choose - ? [...ensureArray(this.action.choose)] - : []; - const choice = choose[index]; - const alias = await showPromptDialog(this, { - title: this.hass.localize( - "ui.panel.config.automation.editor.actions.type.choose.change_alias" - ), - inputLabel: this.hass.localize( - "ui.panel.config.automation.editor.actions.type.choose.alias" - ), - inputType: "string", - placeholder: capitalizeFirstLetter(this._getDescription(choice)), - defaultValue: choice.alias, - confirmText: this.hass.localize("ui.common.submit"), - }); - if (alias !== null) { - if (alias === "") { - delete choose[index].alias; - } else { - choose[index].alias = alias; - } - fireEvent(this, "value-changed", { - value: { ...this.action, choose }, - }); - } - } - - private _duplicateOption(ev) { - const index = (ev.target as any).idx; - this._createOption(deepClone(ensureArray(this.action.choose)[index])); - } - - protected firstUpdated() { - ensureArray(this.action.choose).forEach(() => - this._expandedStates.push(false) - ); - } - - protected updated(changedProps: PropertyValues) { - super.updated(changedProps); - - if (this._expandLast) { - const nodes = this.shadowRoot!.querySelectorAll("ha-expansion-panel"); - nodes[nodes.length - 1].expanded = true; - this._expandLast = false; - } - } - private _addDefault() { this._showDefault = true; } - private _conditionChanged(ev: CustomEvent) { + private _optionsChanged(ev: CustomEvent) { ev.stopPropagation(); - const value = ev.detail.value as Condition[]; - const index = (ev.target as any).idx; - const choose = this.action.choose - ? [...ensureArray(this.action.choose)] - : []; - choose[index].conditions = value; + const value = ev.detail.value as Option[]; fireEvent(this, "value-changed", { - value: { ...this.action, choose }, - }); - } - - private _actionChanged(ev: CustomEvent) { - ev.stopPropagation(); - const value = ev.detail.value as Action[]; - const index = (ev.target as any).idx; - const choose = this.action.choose - ? [...ensureArray(this.action.choose)] - : []; - choose[index].sequence = value; - fireEvent(this, "value-changed", { - value: { ...this.action, choose }, - }); - } - - private _addOption() { - this._createOption({ conditions: [], sequence: [] }); - } - - private _createOption(opt: ChooseActionChoice) { - const choose = this.action.choose - ? [...ensureArray(this.action.choose)] - : []; - choose.push(opt); - fireEvent(this, "value-changed", { - value: { ...this.action, choose }, - }); - this._expandLast = true; - this._expandedStates[choose.length - 1] = true; - } - - private _moveUp(ev) { - const index = (ev.target as any).idx; - const newIndex = index - 1; - this._move(index, newIndex); - } - - private _moveDown(ev) { - const index = (ev.target as any).idx; - const newIndex = index + 1; - this._move(index, newIndex); - } - - private _move(index: number, newIndex: number) { - const options = ensureArray(this.action.choose)!.concat(); - const item = options.splice(index, 1)[0]; - options.splice(newIndex, 0, item); - - const expanded = this._expandedStates.splice(index, 1)[0]; - this._expandedStates.splice(newIndex, 0, expanded); - - fireEvent(this, "value-changed", { - value: { ...this.action, choose: options }, - }); - } - - private _removeOption(ev: CustomEvent) { - const index = (ev.target as any).idx; - showConfirmationDialog(this, { - title: this.hass.localize( - "ui.panel.config.automation.editor.actions.type.choose.delete_confirm_title" - ), - text: this.hass.localize( - "ui.panel.config.automation.editor.actions.delete_confirm_text" - ), - dismissText: this.hass.localize("ui.common.cancel"), - confirmText: this.hass.localize("ui.common.delete"), - destructive: true, - confirm: () => { - const choose = this.action.choose - ? [...ensureArray(this.action.choose)] - : []; - choose.splice(index, 1); - this._expandedStates.splice(index, 1); - fireEvent(this, "value-changed", { - value: { ...this.action, choose }, - }); + value: { + ...this.action, + choose: value, }, }); } @@ -509,68 +100,9 @@ export class HaChooseAction extends LitElement implements ActionElement { return [ haStyle, css` - .options { - padding: 16px; - margin: -16px; - display: flex; - flex-direction: column; - gap: 16px; - } - .sortable-ghost { - background: none; - border-radius: var(--ha-card-border-radius, 12px); - } - .sortable-drag { - background: none; - } - .add-card mwc-button { - display: block; - text-align: center; - } - ha-expansion-panel { - --expansion-panel-summary-padding: 0 0 0 8px; - --expansion-panel-content-padding: 0; - } - mwc-list-item[disabled] { - --mdc-theme-text-primary-on-background: var(--disabled-text-color); - } - mwc-list-item.hidden { - display: none; - } - h3 { - margin: 0; - font-size: inherit; - font-weight: inherit; - } - ha-icon-button { - inset-inline-start: initial; - inset-inline-end: 0; - direction: var(--direction); - } - ha-svg-icon { - height: 20px; - } .link-button-row { padding: 14px 14px 0 14px; } - .card-content { - padding: 0 16px 16px 16px; - } - .handle { - padding: 12px; - cursor: move; /* fallback if grab cursor is unsupported */ - cursor: grab; - } - .handle ha-svg-icon { - pointer-events: none; - height: 24px; - } - .buttons { - display: flex; - flex-wrap: wrap; - gap: 8px; - order: 1; - } `, ]; } diff --git a/src/panels/config/automation/action/types/ha-automation-action-condition.ts b/src/panels/config/automation/action/types/ha-automation-action-condition.ts index 9fa89e9c9034..a1da3ea45d5f 100644 --- a/src/panels/config/automation/action/types/ha-automation-action-condition.ts +++ b/src/panels/config/automation/action/types/ha-automation-action-condition.ts @@ -8,7 +8,7 @@ import "../../../../../components/ha-select"; import type { HaSelect } from "../../../../../components/ha-select"; import type { Condition } from "../../../../../data/automation"; import { CONDITION_ICONS } from "../../../../../data/condition"; -import { Entries, HomeAssistant } from "../../../../../types"; +import type { Entries, HomeAssistant } from "../../../../../types"; import "../../condition/ha-automation-condition-editor"; import type { ActionElement } from "../ha-automation-action-row"; diff --git a/src/panels/config/automation/action/types/ha-automation-action-delay.ts b/src/panels/config/automation/action/types/ha-automation-action-delay.ts index 0a0a2569a71a..996824c7c5d3 100644 --- a/src/panels/config/automation/action/types/ha-automation-action-delay.ts +++ b/src/panels/config/automation/action/types/ha-automation-action-delay.ts @@ -1,12 +1,13 @@ -import { html, LitElement, PropertyValues } from "lit"; +import type { PropertyValues } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import { hasTemplate } from "../../../../../common/string/has-template"; import type { HaDurationData } from "../../../../../components/ha-duration-input"; import "../../../../../components/ha-duration-input"; -import { DelayAction } from "../../../../../data/script"; -import { HomeAssistant } from "../../../../../types"; -import { ActionElement } from "../ha-automation-action-row"; +import type { DelayAction } from "../../../../../data/script"; +import type { HomeAssistant } from "../../../../../types"; +import type { ActionElement } from "../ha-automation-action-row"; import { createDurationData } from "../../../../../common/datetime/create_duration_data"; @customElement("ha-automation-action-delay") diff --git a/src/panels/config/automation/action/types/ha-automation-action-device_id.ts b/src/panels/config/automation/action/types/ha-automation-action-device_id.ts index 3bbed8fd2540..e5f4f3d9d4b5 100644 --- a/src/panels/config/automation/action/types/ha-automation-action-device_id.ts +++ b/src/panels/config/automation/action/types/ha-automation-action-device_id.ts @@ -1,5 +1,6 @@ import { consume } from "@lit-labs/context"; -import { css, html, LitElement, PropertyValues } from "lit"; +import type { PropertyValues } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../../common/dom/fire_event"; @@ -7,16 +8,18 @@ import "../../../../../components/device/ha-device-action-picker"; import "../../../../../components/device/ha-device-picker"; import "../../../../../components/ha-form/ha-form"; import { fullEntitiesContext } from "../../../../../data/context"; -import { +import type { DeviceAction, - deviceAutomationsEqual, DeviceCapabilities, +} from "../../../../../data/device_automation"; +import { + deviceAutomationsEqual, fetchDeviceActionCapabilities, localizeExtraFieldsComputeLabelCallback, localizeExtraFieldsComputeHelperCallback, } from "../../../../../data/device_automation"; -import { EntityRegistryEntry } from "../../../../../data/entity_registry"; -import { HomeAssistant } from "../../../../../types"; +import type { EntityRegistryEntry } from "../../../../../data/entity_registry"; +import type { HomeAssistant } from "../../../../../types"; @customElement("ha-automation-action-device_id") export class HaDeviceAction extends LitElement { diff --git a/src/panels/config/automation/action/types/ha-automation-action-event.ts b/src/panels/config/automation/action/types/ha-automation-action-event.ts index 15ed85aea434..05c962afa9b0 100644 --- a/src/panels/config/automation/action/types/ha-automation-action-event.ts +++ b/src/panels/config/automation/action/types/ha-automation-action-event.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/entity/ha-entity-picker"; @@ -8,7 +9,8 @@ import "../../../../../components/ha-yaml-editor"; import type { HaYamlEditor } from "../../../../../components/ha-yaml-editor"; import type { EventAction } from "../../../../../data/script"; import type { HomeAssistant } from "../../../../../types"; -import { ActionElement, handleChangeEvent } from "../ha-automation-action-row"; +import type { ActionElement } from "../ha-automation-action-row"; +import { handleChangeEvent } from "../ha-automation-action-row"; @customElement("ha-automation-action-event") export class HaEventAction extends LitElement implements ActionElement { diff --git a/src/panels/config/automation/action/types/ha-automation-action-if.ts b/src/panels/config/automation/action/types/ha-automation-action-if.ts index 975fb03ec32d..2d7b8f1ecfca 100644 --- a/src/panels/config/automation/action/types/ha-automation-action-if.ts +++ b/src/panels/config/automation/action/types/ha-automation-action-if.ts @@ -1,10 +1,11 @@ -import { css, CSSResultGroup, html, LitElement } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-textfield"; -import { Action, IfAction } from "../../../../../data/script"; +import type { Action, IfAction } from "../../../../../data/script"; import { haStyle } from "../../../../../resources/styles"; -import type { HomeAssistant, ItemPath } from "../../../../../types"; +import type { HomeAssistant } from "../../../../../types"; import type { Condition } from "../../../../lovelace/common/validate-condition"; import "../ha-automation-action"; import type { ActionElement } from "../ha-automation-action-row"; @@ -15,8 +16,6 @@ export class HaIfAction extends LitElement implements ActionElement { @property({ type: Boolean }) public disabled = false; - @property({ attribute: false }) public path?: ItemPath; - @property({ attribute: false }) public action!: IfAction; @state() private _showElse = false; @@ -38,7 +37,6 @@ export class HaIfAction extends LitElement implements ActionElement { )}*: + (localize: LocalizeFunc, type: string, template: boolean) => [ { name: "type", @@ -73,9 +67,7 @@ export class HaRepeatAction extends LitElement implements ActionElement { { name: type, selector: { - condition: { - path: [...(path ?? []), "repeat", type], - }, + condition: {}, }, }, ] as const satisfies readonly HaFormSchema[]) @@ -92,9 +84,7 @@ export class HaRepeatAction extends LitElement implements ActionElement { { name: "sequence", selector: { - action: { - path: [...(path ?? []), "repeat", "sequence"], - }, + action: {}, }, }, ] as const satisfies readonly HaFormSchema[] @@ -108,8 +98,7 @@ export class HaRepeatAction extends LitElement implements ActionElement { type ?? "count", "count" in action && typeof action.count === "string" ? isTemplate(action.count) - : false, - this.path + : false ); const data = { ...action, type }; diff --git a/src/panels/config/automation/action/types/ha-automation-action-sequence.ts b/src/panels/config/automation/action/types/ha-automation-action-sequence.ts index a8c16d6bed10..8e3efceb54fd 100644 --- a/src/panels/config/automation/action/types/ha-automation-action-sequence.ts +++ b/src/panels/config/automation/action/types/ha-automation-action-sequence.ts @@ -1,11 +1,11 @@ -import { CSSResultGroup, html, LitElement } from "lit"; +import type { CSSResultGroup } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; -import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-textfield"; -import { Action, SequenceAction } from "../../../../../data/script"; +import type { Action, SequenceAction } from "../../../../../data/script"; import { haStyle } from "../../../../../resources/styles"; -import type { HomeAssistant, ItemPath } from "../../../../../types"; +import type { HomeAssistant } from "../../../../../types"; import "../ha-automation-action"; import type { ActionElement } from "../ha-automation-action-row"; @@ -15,8 +15,6 @@ export class HaSequenceAction extends LitElement implements ActionElement { @property({ type: Boolean }) public disabled = false; - @property({ attribute: false }) public path?: ItemPath; - @property({ attribute: false }) public action!: SequenceAction; public static get defaultConfig(): SequenceAction { @@ -25,17 +23,11 @@ export class HaSequenceAction extends LitElement implements ActionElement { }; } - private _getMemoizedPath = memoizeOne((path: ItemPath | undefined) => [ - ...(path ?? []), - "sequence", - ]); - protected render() { const { action } = this; return html` expandConditionWithShorthand(condition) ); @@ -68,7 +66,6 @@ export default class HaAutomationConditionEditor extends LitElement { hass: this.hass, condition: condition, disabled: this.disabled, - path: this.path, } )}
diff --git a/src/panels/config/automation/condition/ha-automation-condition-row.ts b/src/panels/config/automation/condition/ha-automation-condition-row.ts index b2aa1395b0dc..d95f0dc0ab82 100644 --- a/src/panels/config/automation/condition/ha-automation-condition-row.ts +++ b/src/panels/config/automation/condition/ha-automation-condition-row.ts @@ -1,5 +1,5 @@ import { consume } from "@lit-labs/context"; -import { 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 { mdiArrowDown, @@ -16,7 +16,8 @@ import { mdiStopCircleOutline, } from "@mdi/js"; import deepClone from "deep-clone-simple"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { storage } from "../../../../common/decorators/storage"; @@ -28,20 +29,23 @@ import "../../../../components/ha-button-menu"; import "../../../../components/ha-card"; import "../../../../components/ha-expansion-panel"; import "../../../../components/ha-icon-button"; -import type { AutomationClipboard } from "../../../../data/automation"; -import { Condition, testCondition } from "../../../../data/automation"; +import type { + AutomationClipboard, + Condition, +} from "../../../../data/automation"; +import { testCondition } from "../../../../data/automation"; import { describeCondition } from "../../../../data/automation_i18n"; import { CONDITION_ICONS } from "../../../../data/condition"; import { validateConfig } from "../../../../data/config"; import { fullEntitiesContext } from "../../../../data/context"; -import { EntityRegistryEntry } from "../../../../data/entity_registry"; +import type { EntityRegistryEntry } from "../../../../data/entity_registry"; import { showAlertDialog, showConfirmationDialog, showPromptDialog, } from "../../../../dialogs/generic/show-dialog-box"; import { haStyle } from "../../../../resources/styles"; -import { HomeAssistant, ItemPath } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; import "./ha-automation-condition-editor"; export interface ConditionElement extends LitElement { @@ -83,8 +87,6 @@ export default class HaAutomationConditionRow extends LitElement { @property({ type: Boolean }) public disabled = false; - @property({ type: Array }) public path?: ItemPath; - @property({ type: Boolean }) public first?: boolean; @property({ type: Boolean }) public last?: boolean; @@ -302,7 +304,6 @@ export default class HaAutomationConditionRow extends LitElement { .disabled=${this.disabled} .hass=${this.hass} .condition=${this.condition} - .path=${this.path} >
diff --git a/src/panels/config/automation/condition/ha-automation-condition.ts b/src/panels/config/automation/condition/ha-automation-condition.ts index 481a34eb6e9a..603b6ea7b7c5 100644 --- a/src/panels/config/automation/condition/ha-automation-condition.ts +++ b/src/panels/config/automation/condition/ha-automation-condition.ts @@ -1,19 +1,13 @@ import { mdiDrag, mdiPlus } from "@mdi/js"; import deepClone from "deep-clone-simple"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { repeat } from "lit/directives/repeat"; import { storage } from "../../../../common/decorators/storage"; import { fireEvent } from "../../../../common/dom/fire_event"; import { listenMediaQuery } from "../../../../common/dom/media_query"; -import { nestedArrayMove } from "../../../../common/util/array-move"; +import { nextRender } from "../../../../common/util/render-status"; import "../../../../components/ha-button"; import "../../../../components/ha-button-menu"; import "../../../../components/ha-sortable"; @@ -22,7 +16,7 @@ import type { AutomationClipboard, Condition, } from "../../../../data/automation"; -import type { HomeAssistant, ItemPath } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; import { PASTE_VALUE, showAddAutomationElementDialog, @@ -38,8 +32,6 @@ export default class HaAutomationCondition extends LitElement { @property({ type: Boolean }) public disabled = false; - @property({ type: Array }) public path?: ItemPath; - @state() private _showReorder: boolean = false; @storage({ @@ -115,10 +107,6 @@ export default class HaAutomationCondition extends LitElement { }); } - private get nested() { - return this.path !== undefined; - } - protected render() { if (!Array.isArray(this.conditions)) { return nothing; @@ -128,10 +116,11 @@ export default class HaAutomationCondition extends LitElement { handle-selector=".handle" draggable-selector="ha-automation-condition-row" .disabled=${!this._showReorder || this.disabled} - @item-moved=${this._conditionMoved} group="conditions" - .path=${this.path} invert-swap + @item-moved=${this._conditionMoved} + @item-added=${this._conditionAdded} + @item-removed=${this._conditionRemoved} >
${repeat( @@ -139,7 +128,7 @@ export default class HaAutomationCondition extends LitElement { (condition) => this._getKey(condition), (cond, idx) => html` { + ev.stopPropagation(); + const { index, data } = ev.detail; + const conditions = [ + ...this.conditions.slice(0, index), + data, + ...this.conditions.slice(index), + ]; + // Add condition locally to avoid UI jump + this.conditions = conditions; + await nextRender(); + fireEvent(this, "value-changed", { value: this.conditions }); + } + + private async _conditionRemoved(ev: CustomEvent): Promise { + ev.stopPropagation(); + const { index } = ev.detail; + const condition = this.conditions[index]; + // Remove condition locally to avoid UI jump + this.conditions = this.conditions.filter((c) => c !== condition); + await nextRender(); + // Ensure condition is removed even after update + const conditions = this.conditions.filter((c) => c !== condition); + fireEvent(this, "value-changed", { value: conditions }); } private _conditionChanged(ev: CustomEvent) { diff --git a/src/panels/config/automation/condition/types/ha-automation-condition-and.ts b/src/panels/config/automation/condition/types/ha-automation-condition-and.ts index ee7fa15d90d3..13a06637405a 100644 --- a/src/panels/config/automation/condition/types/ha-automation-condition-and.ts +++ b/src/panels/config/automation/condition/types/ha-automation-condition-and.ts @@ -1,6 +1,6 @@ import { customElement } from "lit/decorators"; import { HaLogicalCondition } from "./ha-automation-condition-logical"; -import { LogicalCondition } from "../../../../../data/automation"; +import type { LogicalCondition } from "../../../../../data/automation"; @customElement("ha-automation-condition-and") export class HaAndCondition extends HaLogicalCondition { diff --git a/src/panels/config/automation/condition/types/ha-automation-condition-device.ts b/src/panels/config/automation/condition/types/ha-automation-condition-device.ts index c69fda0d2da1..70ae2128e171 100644 --- a/src/panels/config/automation/condition/types/ha-automation-condition-device.ts +++ b/src/panels/config/automation/condition/types/ha-automation-condition-device.ts @@ -1,5 +1,6 @@ import { consume } from "@lit-labs/context"; -import { css, html, LitElement, PropertyValues } from "lit"; +import type { PropertyValues } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../../common/dom/fire_event"; @@ -7,15 +8,17 @@ import "../../../../../components/device/ha-device-condition-picker"; import "../../../../../components/device/ha-device-picker"; import "../../../../../components/ha-form/ha-form"; import { fullEntitiesContext } from "../../../../../data/context"; -import { - deviceAutomationsEqual, +import type { DeviceCapabilities, DeviceCondition, +} from "../../../../../data/device_automation"; +import { + deviceAutomationsEqual, fetchDeviceConditionCapabilities, localizeExtraFieldsComputeLabelCallback, localizeExtraFieldsComputeHelperCallback, } from "../../../../../data/device_automation"; -import { EntityRegistryEntry } from "../../../../../data/entity_registry"; +import type { EntityRegistryEntry } from "../../../../../data/entity_registry"; import type { HomeAssistant } from "../../../../../types"; @customElement("ha-automation-condition-device") diff --git a/src/panels/config/automation/condition/types/ha-automation-condition-logical.ts b/src/panels/config/automation/condition/types/ha-automation-condition-logical.ts index caa875377d69..6e61e041e326 100644 --- a/src/panels/config/automation/condition/types/ha-automation-condition-logical.ts +++ b/src/panels/config/automation/condition/types/ha-automation-condition-logical.ts @@ -2,7 +2,7 @@ import { html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import type { LogicalCondition } from "../../../../../data/automation"; -import type { HomeAssistant, ItemPath } from "../../../../../types"; +import type { HomeAssistant } from "../../../../../types"; import "../ha-automation-condition"; import type { ConditionElement } from "../ha-automation-condition-row"; @@ -17,12 +17,9 @@ export abstract class HaLogicalCondition @property({ type: Boolean }) public disabled = false; - @property({ attribute: false }) public path?: ItemPath; - protected render() { return html` @@ -174,7 +166,6 @@ export class HaManualAutomationEditor extends LitElement { .conditions=${this.config.conditions || []} .path=${["conditions"]} @value-changed=${this._conditionChanged} - @item-moved=${this._itemMoved} .hass=${this.hass} .disabled=${this.disabled} > @@ -214,7 +205,6 @@ export class HaManualAutomationEditor extends LitElement { .actions=${this.config.actions || []} .path=${["actions"]} @value-changed=${this._actionChanged} - @item-moved=${this._itemMoved} .hass=${this.hass} .narrow=${this.narrow} .disabled=${this.disabled} @@ -246,21 +236,6 @@ export class HaManualAutomationEditor extends LitElement { }); } - private _itemMoved(ev: CustomEvent): void { - ev.stopPropagation(); - const { oldIndex, newIndex, oldPath, newPath } = ev.detail; - const updatedConfig = nestedArrayMove( - this.config, - oldIndex, - newIndex, - oldPath, - newPath - ); - fireEvent(this, "value-changed", { - value: updatedConfig, - }); - } - private async _enable(): Promise { if (!this.hass || !this.stateObj) { return; diff --git a/src/panels/config/automation/option/ha-automation-option-row.ts b/src/panels/config/automation/option/ha-automation-option-row.ts new file mode 100644 index 000000000000..862adbd9d338 --- /dev/null +++ b/src/panels/config/automation/option/ha-automation-option-row.ts @@ -0,0 +1,338 @@ +import { consume } from "@lit-labs/context"; +import type { ActionDetail } from "@material/mwc-list/mwc-list-foundation"; +import "@material/mwc-list/mwc-list-item"; +import { + mdiArrowDown, + mdiArrowUp, + mdiContentDuplicate, + mdiDelete, + mdiDotsVertical, + mdiRenameBox, +} from "@mdi/js"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; +import { customElement, property, state } from "lit/decorators"; +import { ensureArray } from "../../../../common/array/ensure-array"; +import { fireEvent } from "../../../../common/dom/fire_event"; +import { preventDefault } from "../../../../common/dom/prevent_default"; +import { stopPropagation } from "../../../../common/dom/stop_propagation"; +import { capitalizeFirstLetter } from "../../../../common/string/capitalize-first-letter"; +import "../../../../components/ha-button-menu"; +import "../../../../components/ha-card"; +import "../../../../components/ha-expansion-panel"; +import "../../../../components/ha-icon-button"; +import "../condition/ha-automation-condition"; +import "../action/ha-automation-action"; +import type { Condition } from "../../../../data/automation"; +import { describeCondition } from "../../../../data/automation_i18n"; +import { fullEntitiesContext } from "../../../../data/context"; +import type { EntityRegistryEntry } from "../../../../data/entity_registry"; +import type { Action, Option } from "../../../../data/script"; +import { + showConfirmationDialog, + showPromptDialog, +} from "../../../../dialogs/generic/show-dialog-box"; +import { haStyle } from "../../../../resources/styles"; +import type { HomeAssistant } from "../../../../types"; + +@customElement("ha-automation-option-row") +export default class HaAutomationOptionRow extends LitElement { + @property({ attribute: false }) public hass!: HomeAssistant; + + @property({ attribute: false }) public option!: Option; + + @property({ type: Boolean }) public narrow = false; + + @property({ type: Boolean }) public disabled = false; + + @property({ type: Number }) public index!: number; + + @property({ type: Boolean }) public first = false; + + @property({ type: Boolean }) public last = false; + + @state() private _expanded = false; + + @state() + @consume({ context: fullEntitiesContext, subscribe: true }) + _entityReg!: EntityRegistryEntry[]; + + private _expandedChanged(ev) { + if (ev.currentTarget.id !== "option") { + return; + } + this._expanded = ev.detail.expanded; + } + + private _getDescription() { + const conditions = ensureArray(this.option.conditions); + if (!conditions || conditions.length === 0) { + return this.hass.localize( + "ui.panel.config.automation.editor.actions.type.choose.no_conditions" + ); + } + let str = ""; + if (typeof conditions[0] === "string") { + str += conditions[0]; + } else { + str += describeCondition(conditions[0], this.hass, this._entityReg); + } + if (conditions.length > 1) { + str += this.hass.localize( + "ui.panel.config.automation.editor.actions.type.choose.option_description_additional", + { numberOfAdditionalConditions: conditions.length - 1 } + ); + } + return str; + } + + protected render() { + if (!this.option) return nothing; + + return html` + + +

+ ${this.hass.localize( + "ui.panel.config.automation.editor.actions.type.choose.option", + { number: this.index + 1 } + )}: + ${this.option.alias || + (this._expanded ? "" : this._getDescription())} +

+ + + + + + + ${this.hass.localize( + "ui.panel.config.automation.editor.actions.rename" + )} + + + + + ${this.hass.localize( + "ui.panel.config.automation.editor.actions.duplicate" + )} + + + + + ${this.hass.localize("ui.panel.config.automation.editor.move_up")} + + + + + ${this.hass.localize( + "ui.panel.config.automation.editor.move_down" + )} + + + + + ${this.hass.localize( + "ui.panel.config.automation.editor.actions.type.choose.remove_option" + )} + + + + +
+

+ ${this.hass.localize( + "ui.panel.config.automation.editor.actions.type.choose.conditions" + )}: +

+ ( + this.option.conditions + )} + .disabled=${this.disabled} + .hass=${this.hass} + @value-changed=${this._conditionChanged} + > +

+ ${this.hass.localize( + "ui.panel.config.automation.editor.actions.type.choose.sequence" + )}: +

+ +
+
+
+ `; + } + + private async _handleAction(ev: CustomEvent) { + switch (ev.detail.index) { + case 0: + await this._renameOption(); + break; + case 1: + fireEvent(this, "duplicate"); + break; + case 2: + fireEvent(this, "move-up"); + break; + case 3: + fireEvent(this, "move-down"); + break; + case 4: + this._removeOption(); + break; + } + } + + private _removeOption() { + showConfirmationDialog(this, { + title: this.hass.localize( + "ui.panel.config.automation.editor.actions.type.choose.delete_confirm_title" + ), + text: this.hass.localize( + "ui.panel.config.automation.editor.actions.delete_confirm_text" + ), + dismissText: this.hass.localize("ui.common.cancel"), + confirmText: this.hass.localize("ui.common.delete"), + destructive: true, + confirm: () => + fireEvent(this, "value-changed", { + value: null, + }), + }); + } + + private async _renameOption(): Promise { + const alias = await showPromptDialog(this, { + title: this.hass.localize( + "ui.panel.config.automation.editor.actions.type.choose.change_alias" + ), + inputLabel: this.hass.localize( + "ui.panel.config.automation.editor.actions.type.choose.alias" + ), + inputType: "string", + placeholder: capitalizeFirstLetter(this._getDescription()), + defaultValue: this.option.alias, + confirmText: this.hass.localize("ui.common.submit"), + }); + if (alias !== null) { + const value = { ...this.option }; + if (alias === "") { + delete value.alias; + } else { + value.alias = alias; + } + fireEvent(this, "value-changed", { + value, + }); + } + } + + private _conditionChanged(ev: CustomEvent) { + ev.stopPropagation(); + const conditions = ev.detail.value as Condition[]; + const value = { ...this.option, conditions: conditions }; + fireEvent(this, "value-changed", { + value, + }); + } + + private _actionChanged(ev: CustomEvent) { + ev.stopPropagation(); + const actions = ev.detail.value as Action[]; + const value = { ...this.option, sequence: actions }; + fireEvent(this, "value-changed", { + value, + }); + } + + public expand() { + this.updateComplete.then(() => { + this.shadowRoot!.querySelector("ha-expansion-panel")!.expanded = true; + }); + } + + static get styles(): CSSResultGroup { + return [ + haStyle, + css` + ha-button-menu, + ha-icon-button { + --mdc-theme-text-primary-on-background: var(--primary-text-color); + } + .disabled { + opacity: 0.5; + pointer-events: none; + } + ha-expansion-panel { + --expansion-panel-summary-padding: 0 0 0 8px; + --expansion-panel-content-padding: 0; + } + h3 { + margin: 0; + font-size: inherit; + font-weight: inherit; + } + .card-content { + padding: 16px; + } + + mwc-list-item[disabled] { + --mdc-theme-text-primary-on-background: var(--disabled-text-color); + } + mwc-list-item.hidden { + display: none; + } + .warning ul { + margin: 4px 0; + } + li[role="separator"] { + border-bottom-color: var(--divider-color); + } + `, + ]; + } +} + +declare global { + interface HTMLElementTagNameMap { + "ha-automation-option-row": HaAutomationOptionRow; + } +} diff --git a/src/panels/config/automation/option/ha-automation-option.ts b/src/panels/config/automation/option/ha-automation-option.ts new file mode 100644 index 000000000000..b77006b57d59 --- /dev/null +++ b/src/panels/config/automation/option/ha-automation-option.ts @@ -0,0 +1,284 @@ +import { mdiDrag, mdiPlus } from "@mdi/js"; +import deepClone from "deep-clone-simple"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; +import { customElement, property, state } from "lit/decorators"; +import { repeat } from "lit/directives/repeat"; +import { storage } from "../../../../common/decorators/storage"; +import { fireEvent } from "../../../../common/dom/fire_event"; +import { listenMediaQuery } from "../../../../common/dom/media_query"; +import { nextRender } from "../../../../common/util/render-status"; +import "../../../../components/ha-button"; +import "../../../../components/ha-sortable"; +import "../../../../components/ha-svg-icon"; +import type { AutomationClipboard } from "../../../../data/automation"; +import type { Option } from "../../../../data/script"; +import type { HomeAssistant } from "../../../../types"; +import "./ha-automation-option-row"; +import type HaAutomationOptionRow from "./ha-automation-option-row"; + +@customElement("ha-automation-option") +export default class HaAutomationOption extends LitElement { + @property({ attribute: false }) public hass!: HomeAssistant; + + @property({ type: Boolean }) public narrow = false; + + @property({ type: Boolean }) public disabled = false; + + @property({ attribute: false }) public options!: Option[]; + + @state() private _showReorder: boolean = false; + + @storage({ + key: "automationClipboard", + state: true, + subscribe: true, + storage: "sessionStorage", + }) + public _clipboard?: AutomationClipboard; + + private _focusLastOptionOnChange = false; + + private _optionsKeys = new WeakMap(); + + private _unsubMql?: () => void; + + public connectedCallback() { + super.connectedCallback(); + this._unsubMql = listenMediaQuery("(min-width: 600px)", (matches) => { + this._showReorder = matches; + }); + } + + public disconnectedCallback() { + super.disconnectedCallback(); + this._unsubMql?.(); + this._unsubMql = undefined; + } + + protected render() { + return html` + +
+ ${repeat( + this.options, + (option) => this._getKey(option), + (option, idx) => html` + + ${this._showReorder && !this.disabled + ? html` +
+ +
+ ` + : nothing} +
+ ` + )} +
+ + + +
+
+
+ `; + } + + protected updated(changedProps: PropertyValues) { + super.updated(changedProps); + + if (changedProps.has("options") && this._focusLastOptionOnChange) { + this._focusLastOptionOnChange = false; + + const row = this.shadowRoot!.querySelector( + "ha-automation-option-row:last-of-type" + )!; + row.updateComplete.then(() => { + row.expand(); + row.scrollIntoView(); + row.focus(); + }); + } + } + + public expandAll() { + const rows = this.shadowRoot!.querySelectorAll( + "ha-automation-option-row" + )!; + rows.forEach((row) => { + row.expand(); + }); + } + + private _addOption = () => { + const options = this.options.concat({ conditions: [], sequence: [] }); + this._focusLastOptionOnChange = true; + fireEvent(this, "value-changed", { value: options }); + }; + + private _getKey(option: Option) { + if (!this._optionsKeys.has(option)) { + this._optionsKeys.set(option, Math.random().toString()); + } + + return this._optionsKeys.get(option)!; + } + + private _moveUp(ev) { + ev.stopPropagation(); + const index = (ev.target as any).index; + const newIndex = index - 1; + this._move(index, newIndex); + } + + private _moveDown(ev) { + ev.stopPropagation(); + const index = (ev.target as any).index; + const newIndex = index + 1; + this._move(index, newIndex); + } + + private _move(oldIndex: number, newIndex: number) { + const options = this.options.concat(); + const item = options.splice(oldIndex, 1)[0]; + options.splice(newIndex, 0, item); + this.options = options; + fireEvent(this, "value-changed", { value: options }); + } + + private _optionMoved(ev: CustomEvent): void { + ev.stopPropagation(); + const { oldIndex, newIndex } = ev.detail; + this._move(oldIndex, newIndex); + } + + private async _optionAdded(ev: CustomEvent): Promise { + ev.stopPropagation(); + const { index, data } = ev.detail; + const options = [ + ...this.options.slice(0, index), + data, + ...this.options.slice(index), + ]; + // Add option locally to avoid UI jump + this.options = options; + await nextRender(); + fireEvent(this, "value-changed", { value: this.options }); + } + + private async _optionRemoved(ev: CustomEvent): Promise { + ev.stopPropagation(); + const { index } = ev.detail; + const option = this.options[index]; + // Remove option locally to avoid UI jump + this.options = this.options.filter((o) => o !== option); + await nextRender(); + // Ensure option is removed even after update + const options = this.options.filter((o) => o !== option); + fireEvent(this, "value-changed", { value: options }); + } + + private _optionChanged(ev: CustomEvent) { + ev.stopPropagation(); + const options = [...this.options]; + const newValue = ev.detail.value; + const index = (ev.target as any).index; + + if (newValue === null) { + options.splice(index, 1); + } else { + // Store key on new value. + const key = this._getKey(options[index]); + this._optionsKeys.set(newValue, key); + + options[index] = newValue; + } + + fireEvent(this, "value-changed", { value: options }); + } + + private _duplicateOption(ev: CustomEvent) { + ev.stopPropagation(); + const index = (ev.target as any).index; + fireEvent(this, "value-changed", { + value: this.options.concat(deepClone(this.options[index])), + }); + } + + static get styles(): CSSResultGroup { + return css` + .options { + padding: 16px; + margin: -16px; + display: flex; + flex-direction: column; + gap: 16px; + } + .sortable-ghost { + background: none; + border-radius: var(--ha-card-border-radius, 12px); + } + .sortable-drag { + background: none; + } + ha-automation-option-row { + display: block; + scroll-margin-top: 48px; + } + ha-svg-icon { + height: 20px; + } + .handle { + padding: 12px; + cursor: move; /* fallback if grab cursor is unsupported */ + cursor: grab; + } + .handle ha-svg-icon { + pointer-events: none; + height: 24px; + } + .buttons { + display: flex; + flex-wrap: wrap; + gap: 8px; + order: 1; + } + `; + } +} + +declare global { + interface HTMLElementTagNameMap { + "ha-automation-option": HaAutomationOption; + } +} diff --git a/src/panels/config/automation/trigger/ha-automation-trigger-row.ts b/src/panels/config/automation/trigger/ha-automation-trigger-row.ts index 174233692e2b..fb7a6301917b 100644 --- a/src/panels/config/automation/trigger/ha-automation-trigger-row.ts +++ b/src/panels/config/automation/trigger/ha-automation-trigger-row.ts @@ -1,5 +1,5 @@ import { consume } from "@lit-labs/context"; -import { 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 { mdiArrowDown, @@ -16,14 +16,8 @@ import { mdiStopCircleOutline, } from "@mdi/js"; import type { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { storage } from "../../../../common/decorators/storage"; @@ -40,17 +34,16 @@ import "../../../../components/ha-card"; import "../../../../components/ha-expansion-panel"; import "../../../../components/ha-icon-button"; import "../../../../components/ha-textfield"; -import { HaYamlEditor } from "../../../../components/ha-yaml-editor"; -import type { AutomationClipboard } from "../../../../data/automation"; +import type { HaYamlEditor } from "../../../../components/ha-yaml-editor"; +import type { AutomationClipboard, Trigger } from "../../../../data/automation"; import { - Trigger, migrateAutomationTrigger, subscribeTrigger, } from "../../../../data/automation"; import { describeTrigger } from "../../../../data/automation_i18n"; import { validateConfig } from "../../../../data/config"; import { fullEntitiesContext } from "../../../../data/context"; -import { EntityRegistryEntry } from "../../../../data/entity_registry"; +import type { EntityRegistryEntry } from "../../../../data/entity_registry"; import { TRIGGER_ICONS, isTriggerList } from "../../../../data/trigger"; import { showAlertDialog, @@ -58,7 +51,7 @@ import { showPromptDialog, } from "../../../../dialogs/generic/show-dialog-box"; import { haStyle } from "../../../../resources/styles"; -import type { HomeAssistant, ItemPath } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; import "./types/ha-automation-trigger-calendar"; import "./types/ha-automation-trigger-conversation"; import "./types/ha-automation-trigger-device"; @@ -112,8 +105,6 @@ export default class HaAutomationTriggerRow extends LitElement { @property({ type: Boolean }) public disabled = false; - @property({ type: Array }) public path?: ItemPath; - @property({ type: Boolean }) public first?: boolean; @property({ type: Boolean }) public last?: boolean; @@ -383,7 +374,6 @@ export default class HaAutomationTriggerRow extends LitElement { hass: this.hass, trigger: this.trigger, disabled: this.disabled, - path: this.path, })}
`} diff --git a/src/panels/config/automation/trigger/ha-automation-trigger.ts b/src/panels/config/automation/trigger/ha-automation-trigger.ts index 2a1d25479991..a92f78878fa9 100644 --- a/src/panels/config/automation/trigger/ha-automation-trigger.ts +++ b/src/panels/config/automation/trigger/ha-automation-trigger.ts @@ -1,36 +1,30 @@ import { mdiDrag, mdiPlus } from "@mdi/js"; import deepClone from "deep-clone-simple"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { repeat } from "lit/directives/repeat"; import { storage } from "../../../../common/decorators/storage"; import { fireEvent } from "../../../../common/dom/fire_event"; import { listenMediaQuery } from "../../../../common/dom/media_query"; -import { nestedArrayMove } from "../../../../common/util/array-move"; +import { nextRender } from "../../../../common/util/render-status"; import "../../../../components/ha-button"; import "../../../../components/ha-button-menu"; import "../../../../components/ha-sortable"; import "../../../../components/ha-svg-icon"; -import { +import type { AutomationClipboard, Trigger, TriggerList, } from "../../../../data/automation"; -import { HomeAssistant, ItemPath } from "../../../../types"; +import { isTriggerList } from "../../../../data/trigger"; +import type { HomeAssistant } from "../../../../types"; import { PASTE_VALUE, showAddAutomationElementDialog, } from "../show-add-automation-element-dialog"; import "./ha-automation-trigger-row"; import type HaAutomationTriggerRow from "./ha-automation-trigger-row"; -import { isTriggerList } from "../../../../data/trigger"; @customElement("ha-automation-trigger") export default class HaAutomationTrigger extends LitElement { @@ -40,8 +34,6 @@ export default class HaAutomationTrigger extends LitElement { @property({ type: Boolean }) public disabled = false; - @property({ type: Array }) public path?: ItemPath; - @state() private _showReorder: boolean = false; @storage({ @@ -71,20 +63,17 @@ export default class HaAutomationTrigger extends LitElement { this._unsubMql = undefined; } - private get nested() { - return this.path !== undefined; - } - protected render() { return html`
${repeat( @@ -92,7 +81,7 @@ export default class HaAutomationTrigger extends LitElement { (trigger) => this._getKey(trigger), (trg, idx) => html` { + ev.stopPropagation(); + const { index, data } = ev.detail; + const triggers = [ + ...this.triggers.slice(0, index), + data, + ...this.triggers.slice(index), + ]; + // Add trigger locally to avoid UI jump + this.triggers = triggers; + await nextRender(); + fireEvent(this, "value-changed", { value: this.triggers }); + } + + private async _triggerRemoved(ev: CustomEvent): Promise { + ev.stopPropagation(); + const { index } = ev.detail; + const trigger = this.triggers[index]; + // Remove trigger locally to avoid UI jump + this.triggers = this.triggers.filter((t) => t !== trigger); + await nextRender(); + // Ensure trigger is removed even after update + const triggers = this.triggers.filter((t) => t !== trigger); + fireEvent(this, "value-changed", { value: triggers }); } private _triggerChanged(ev: CustomEvent) { diff --git a/src/panels/config/automation/trigger/types/ha-automation-trigger-conversation.ts b/src/panels/config/automation/trigger/types/ha-automation-trigger-conversation.ts index c0fa1b0dd94f..f9d9590cbc50 100644 --- a/src/panels/config/automation/trigger/types/ha-automation-trigger-conversation.ts +++ b/src/panels/config/automation/trigger/types/ha-automation-trigger-conversation.ts @@ -1,14 +1,16 @@ import { mdiClose } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query } from "lit/decorators"; import { ensureArray } from "../../../../../common/array/ensure-array"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-textfield"; import type { HaTextField } from "../../../../../components/ha-textfield"; -import { ConversationTrigger } from "../../../../../data/automation"; +import "../../../../../components/ha-icon-button"; +import type { ConversationTrigger } from "../../../../../data/automation"; import { showConfirmationDialog } from "../../../../../dialogs/generic/show-dialog-box"; -import { HomeAssistant } from "../../../../../types"; -import { TriggerElement } from "../ha-automation-trigger-row"; +import type { HomeAssistant } from "../../../../../types"; +import type { TriggerElement } from "../ha-automation-trigger-row"; const PATTERN = "^[^.。,,?¿?؟!!;;::]+$"; diff --git a/src/panels/config/automation/trigger/types/ha-automation-trigger-device.ts b/src/panels/config/automation/trigger/types/ha-automation-trigger-device.ts index 6aadb2ceb01b..ad72162fd7b6 100644 --- a/src/panels/config/automation/trigger/types/ha-automation-trigger-device.ts +++ b/src/panels/config/automation/trigger/types/ha-automation-trigger-device.ts @@ -1,5 +1,6 @@ import { consume } from "@lit-labs/context"; -import { css, html, LitElement, PropertyValues } from "lit"; +import type { PropertyValues } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../../common/dom/fire_event"; @@ -9,16 +10,18 @@ import "../../../../../components/device/ha-device-trigger-picker"; import "../../../../../components/ha-form/ha-form"; import { computeInitialHaFormData } from "../../../../../components/ha-form/compute-initial-ha-form-data"; import { fullEntitiesContext } from "../../../../../data/context"; -import { - deviceAutomationsEqual, +import type { DeviceCapabilities, DeviceTrigger, +} from "../../../../../data/device_automation"; +import { + deviceAutomationsEqual, fetchDeviceTriggerCapabilities, localizeExtraFieldsComputeLabelCallback, localizeExtraFieldsComputeHelperCallback, } from "../../../../../data/device_automation"; -import { EntityRegistryEntry } from "../../../../../data/entity_registry"; -import { HomeAssistant } from "../../../../../types"; +import type { EntityRegistryEntry } from "../../../../../data/entity_registry"; +import type { HomeAssistant } from "../../../../../types"; @customElement("ha-automation-trigger-device") export class HaDeviceTrigger extends LitElement { diff --git a/src/panels/config/automation/trigger/types/ha-automation-trigger-event.ts b/src/panels/config/automation/trigger/types/ha-automation-trigger-event.ts index ae8f3405bfad..7b482573c335 100644 --- a/src/panels/config/automation/trigger/types/ha-automation-trigger-event.ts +++ b/src/panels/config/automation/trigger/types/ha-automation-trigger-event.ts @@ -1,15 +1,14 @@ -import { css, CSSResultGroup, html, LitElement } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-textfield"; import "../../../../../components/ha-yaml-editor"; import "../../../../../components/user/ha-users-picker"; -import { EventTrigger } from "../../../../../data/automation"; -import { HomeAssistant } from "../../../../../types"; -import { - handleChangeEvent, - TriggerElement, -} from "../ha-automation-trigger-row"; +import type { EventTrigger } from "../../../../../data/automation"; +import type { HomeAssistant } from "../../../../../types"; +import type { TriggerElement } from "../ha-automation-trigger-row"; +import { handleChangeEvent } from "../ha-automation-trigger-row"; @customElement("ha-automation-trigger-event") export class HaEventTrigger extends LitElement implements TriggerElement { diff --git a/src/panels/config/automation/trigger/types/ha-automation-trigger-list.ts b/src/panels/config/automation/trigger/types/ha-automation-trigger-list.ts index 8a7481390868..8fa59e39de49 100644 --- a/src/panels/config/automation/trigger/types/ha-automation-trigger-list.ts +++ b/src/panels/config/automation/trigger/types/ha-automation-trigger-list.ts @@ -2,12 +2,10 @@ import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { ensureArray } from "../../../../../common/array/ensure-array"; import type { TriggerList } from "../../../../../data/automation"; -import type { HomeAssistant, ItemPath } from "../../../../../types"; +import type { HomeAssistant } from "../../../../../types"; import "../ha-automation-trigger"; -import { - handleChangeEvent, - TriggerElement, -} from "../ha-automation-trigger-row"; +import type { TriggerElement } from "../ha-automation-trigger-row"; +import { handleChangeEvent } from "../ha-automation-trigger-row"; @customElement("ha-automation-trigger-list") export class HaTriggerList extends LitElement implements TriggerElement { @@ -15,8 +13,6 @@ export class HaTriggerList extends LitElement implements TriggerElement { @property({ attribute: false }) public trigger!: TriggerList; - @property({ attribute: false }) public path?: ItemPath; - @property({ type: Boolean }) public disabled = false; public static get defaultConfig(): TriggerList { @@ -30,7 +26,6 @@ export class HaTriggerList extends LitElement implements TriggerElement { return html` ${html``} `; } @@ -237,29 +227,6 @@ export abstract class HaBlueprintGenericEditor extends LitElement { }); } - private _itemMoved(ev) { - ev.stopPropagation(); - const { oldIndex, newIndex, oldPath, newPath } = ev.detail; - - const input = nestedArrayMove( - this._config.use_blueprint.input, - oldIndex, - newIndex, - oldPath, - newPath - ); - - fireEvent(this, "value-changed", { - value: { - ...this._config, - use_blueprint: { - ...this._config.use_blueprint, - input, - }, - }, - }); - } - static get styles(): CSSResultGroup { return [ haStyle, diff --git a/src/panels/config/blueprint/dialog-import-blueprint.ts b/src/panels/config/blueprint/dialog-import-blueprint.ts index 0d0a1acb11a0..51f4444675fc 100644 --- a/src/panels/config/blueprint/dialog-import-blueprint.ts +++ b/src/panels/config/blueprint/dialog-import-blueprint.ts @@ -10,11 +10,8 @@ import "../../../components/ha-markdown"; import "../../../components/ha-alert"; import "../../../components/ha-textfield"; import type { HaTextField } from "../../../components/ha-textfield"; -import { - BlueprintImportResult, - importBlueprint, - saveBlueprint, -} from "../../../data/blueprint"; +import type { BlueprintImportResult } from "../../../data/blueprint"; +import { importBlueprint, saveBlueprint } from "../../../data/blueprint"; import { haStyleDialog } from "../../../resources/styles"; import type { HomeAssistant } from "../../../types"; diff --git a/src/panels/config/blueprint/ha-blueprint-overview.ts b/src/panels/config/blueprint/ha-blueprint-overview.ts index a2c99603a210..0f5c5f28ffe9 100644 --- a/src/panels/config/blueprint/ha-blueprint-overview.ts +++ b/src/panels/config/blueprint/ha-blueprint-overview.ts @@ -8,20 +8,16 @@ import { mdiPlus, mdiShareVariant, } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - html, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, html } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; -import { HASSDomEvent, fireEvent } from "../../../common/dom/fire_event"; +import type { HASSDomEvent } from "../../../common/dom/fire_event"; +import { fireEvent } from "../../../common/dom/fire_event"; import { computeStateName } from "../../../common/entity/compute_state_name"; import { navigate } from "../../../common/navigate"; import { extractSearchParam } from "../../../common/url/search-params"; -import { +import type { DataTableColumnContainer, RowClickedEvent, SortingChangedEvent, @@ -33,10 +29,12 @@ import "../../../components/ha-icon-button"; import "../../../components/ha-icon-overflow-menu"; import "../../../components/ha-svg-icon"; import { showAutomationEditor } from "../../../data/automation"; -import { +import type { BlueprintImportResult, BlueprintMetaData, Blueprints, +} from "../../../data/blueprint"; +import { deleteBlueprint, importBlueprint, saveBlueprint, @@ -49,8 +47,8 @@ import { } from "../../../dialogs/generic/show-dialog-box"; import "../../../layouts/hass-tabs-subpage-data-table"; import { haStyle } from "../../../resources/styles"; -import { HomeAssistant, Route } from "../../../types"; -import { LocalizeFunc } from "../../../common/translations/localize"; +import type { HomeAssistant, Route } from "../../../types"; +import type { LocalizeFunc } from "../../../common/translations/localize"; import { documentationUrl } from "../../../util/documentation-url"; import { showToast } from "../../../util/toast"; import { configSections } from "../ha-panel-config"; diff --git a/src/panels/config/blueprint/ha-config-blueprint.ts b/src/panels/config/blueprint/ha-config-blueprint.ts index 4a371a2cf0d9..0947d6c7db8e 100644 --- a/src/panels/config/blueprint/ha-config-blueprint.ts +++ b/src/panels/config/blueprint/ha-config-blueprint.ts @@ -1,11 +1,10 @@ -import { PropertyValues } from "lit"; +import type { PropertyValues } from "lit"; import { customElement, property } from "lit/decorators"; -import { Blueprints, fetchBlueprints } from "../../../data/blueprint"; -import { - HassRouterPage, - RouterOptions, -} from "../../../layouts/hass-router-page"; -import { HomeAssistant } from "../../../types"; +import type { Blueprints } from "../../../data/blueprint"; +import { fetchBlueprints } from "../../../data/blueprint"; +import type { RouterOptions } from "../../../layouts/hass-router-page"; +import { HassRouterPage } from "../../../layouts/hass-router-page"; +import type { HomeAssistant } from "../../../types"; import "./ha-blueprint-overview"; declare global { diff --git a/src/panels/config/category/dialog-assign-category.ts b/src/panels/config/category/dialog-assign-category.ts index 3847d4b6b3ee..28767f79b3b3 100644 --- a/src/panels/config/category/dialog-assign-category.ts +++ b/src/panels/config/category/dialog-assign-category.ts @@ -1,5 +1,6 @@ import "@material/mwc-button"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import "../../../components/ha-alert"; @@ -9,9 +10,9 @@ import "../../../components/ha-settings-row"; import "../../../components/ha-textfield"; import { updateEntityRegistryEntry } from "../../../data/entity_registry"; import { haStyleDialog } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import "./ha-category-picker"; -import { AssignCategoryDialogParams } from "./show-dialog-assign-category"; +import type { AssignCategoryDialogParams } from "./show-dialog-assign-category"; @customElement("dialog-assign-category") class DialogAssignCategory extends LitElement { diff --git a/src/panels/config/category/dialog-category-registry-detail.ts b/src/panels/config/category/dialog-category-registry-detail.ts index 74f89f0bd7e5..b6c88faa19fb 100644 --- a/src/panels/config/category/dialog-category-registry-detail.ts +++ b/src/panels/config/category/dialog-category-registry-detail.ts @@ -1,5 +1,6 @@ import "@material/mwc-button"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import "../../../components/ha-alert"; @@ -7,13 +8,13 @@ import { createCloseHeading } from "../../../components/ha-dialog"; import "../../../components/ha-icon-picker"; import "../../../components/ha-settings-row"; import "../../../components/ha-textfield"; -import { +import type { CategoryRegistryEntry, CategoryRegistryEntryMutableParams, } from "../../../data/category_registry"; import { haStyleDialog } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; -import { CategoryRegistryDetailDialogParams } from "./show-dialog-category-registry-detail"; +import type { HomeAssistant } from "../../../types"; +import type { CategoryRegistryDetailDialogParams } from "./show-dialog-category-registry-detail"; @customElement("dialog-category-registry-detail") class DialogCategoryDetail extends LitElement { diff --git a/src/panels/config/category/ha-category-picker.ts b/src/panels/config/category/ha-category-picker.ts index 686ed907fb03..25665f9116aa 100644 --- a/src/panels/config/category/ha-category-picker.ts +++ b/src/panels/config/category/ha-category-picker.ts @@ -1,27 +1,26 @@ import { mdiTag } from "@mdi/js"; -import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { html, LitElement, nothing, PropertyValues } from "lit"; +import type { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { PropertyValues } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../common/dom/fire_event"; -import { - fuzzyFilterSort, - ScorableTextItem, -} from "../../../common/string/filter/sequence-matching"; +import type { ScorableTextItem } from "../../../common/string/filter/sequence-matching"; +import { fuzzyFilterSort } from "../../../common/string/filter/sequence-matching"; import "../../../components/ha-combo-box"; import type { HaComboBox } from "../../../components/ha-combo-box"; import "../../../components/ha-icon-button"; import "../../../components/ha-list-item"; import "../../../components/ha-svg-icon"; +import type { CategoryRegistryEntry } from "../../../data/category_registry"; import { - CategoryRegistryEntry, createCategoryRegistryEntry, subscribeCategoryRegistry, } from "../../../data/category_registry"; import { SubscribeMixin } from "../../../mixins/subscribe-mixin"; -import { HomeAssistant, ValueChangedEvent } from "../../../types"; +import type { HomeAssistant, ValueChangedEvent } from "../../../types"; import { showCategoryRegistryDetailDialog } from "./show-dialog-category-registry-detail"; type ScorableCategoryRegistryEntry = ScorableTextItem & CategoryRegistryEntry; diff --git a/src/panels/config/category/show-dialog-assign-category.ts b/src/panels/config/category/show-dialog-assign-category.ts index 3d4a8494b999..edbf91ee83d5 100644 --- a/src/panels/config/category/show-dialog-assign-category.ts +++ b/src/panels/config/category/show-dialog-assign-category.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import { EntityRegistryEntry } from "../../../data/entity_registry"; +import type { EntityRegistryEntry } from "../../../data/entity_registry"; export interface AssignCategoryDialogParams { entityReg: EntityRegistryEntry; diff --git a/src/panels/config/category/show-dialog-category-registry-detail.ts b/src/panels/config/category/show-dialog-category-registry-detail.ts index 7adaff611fe1..3aa62d4162e8 100644 --- a/src/panels/config/category/show-dialog-category-registry-detail.ts +++ b/src/panels/config/category/show-dialog-category-registry-detail.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import { +import type { CategoryRegistryEntry, CategoryRegistryEntryMutableParams, } from "../../../data/category_registry"; diff --git a/src/panels/config/cloud/account/cloud-account.ts b/src/panels/config/cloud/account/cloud-account.ts index 2d458c9c7f7d..2d5244f97466 100644 --- a/src/panels/config/cloud/account/cloud-account.ts +++ b/src/panels/config/cloud/account/cloud-account.ts @@ -9,12 +9,15 @@ import "../../../../components/ha-alert"; import "../../../../components/ha-card"; import "../../../../components/ha-tip"; import "../../../../components/ha-list-item"; +import "../../../../components/ha-button-menu"; +import type { + CloudStatusLoggedIn, + SubscriptionInfo, +} from "../../../../data/cloud"; import { cloudLogout, - CloudStatusLoggedIn, fetchCloudSubscriptionInfo, removeCloudData, - SubscriptionInfo, } from "../../../../data/cloud"; import { showAlertDialog, @@ -23,7 +26,7 @@ import { import "../../../../layouts/hass-subpage"; import { SubscribeMixin } from "../../../../mixins/subscribe-mixin"; import { haStyle } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; import "../../ha-config-section"; import "./cloud-remote-pref"; import "./cloud-tts-pref"; diff --git a/src/panels/config/cloud/account/cloud-remote-pref.ts b/src/panels/config/cloud/account/cloud-remote-pref.ts index 5c036b4c5295..baace154bd14 100644 --- a/src/panels/config/cloud/account/cloud-remote-pref.ts +++ b/src/panels/config/cloud/account/cloud-remote-pref.ts @@ -1,5 +1,6 @@ import { mdiContentCopy, mdiEye, mdiEyeOff, mdiHelpCircle } from "@mdi/js"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import { copyToClipboard } from "../../../../common/util/copy-clipboard"; @@ -11,11 +12,12 @@ import "../../../../components/ha-formfield"; import "../../../../components/ha-radio"; import "../../../../components/ha-settings-row"; import "../../../../components/ha-switch"; +import "../../../../components/ha-textfield"; // eslint-disable-next-line import { formatDate } from "../../../../common/datetime/format_date"; import type { HaSwitch } from "../../../../components/ha-switch"; +import type { CloudStatusLoggedIn } from "../../../../data/cloud"; import { - CloudStatusLoggedIn, connectCloudRemote, disconnectCloudRemote, updateCloudPref, diff --git a/src/panels/config/cloud/account/cloud-tts-pref.ts b/src/panels/config/cloud/account/cloud-tts-pref.ts index 6633737040da..d8abcee53ad0 100644 --- a/src/panels/config/cloud/account/cloud-tts-pref.ts +++ b/src/panels/config/cloud/account/cloud-tts-pref.ts @@ -1,6 +1,7 @@ import "@material/mwc-button"; import "@material/mwc-list/mwc-list-item"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../common/dom/fire_event"; @@ -9,9 +10,10 @@ import "../../../../components/ha-select"; import "../../../../components/ha-svg-icon"; import "../../../../components/ha-switch"; import "../../../../components/ha-language-picker"; -import { CloudStatusLoggedIn, updateCloudPref } from "../../../../data/cloud"; +import type { CloudStatusLoggedIn } from "../../../../data/cloud"; +import { updateCloudPref } from "../../../../data/cloud"; +import type { CloudTTSInfo } from "../../../../data/cloud/tts"; import { - CloudTTSInfo, getCloudTTSInfo, getCloudTtsLanguages, getCloudTtsSupportedVoices, diff --git a/src/panels/config/cloud/account/cloud-webhooks.ts b/src/panels/config/cloud/account/cloud-webhooks.ts index 35b340bda604..0c2a89574e89 100644 --- a/src/panels/config/cloud/account/cloud-webhooks.ts +++ b/src/panels/config/cloud/account/cloud-webhooks.ts @@ -1,19 +1,17 @@ -import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { isComponentLoaded } from "../../../../common/config/is_component_loaded"; import "../../../../components/ha-card"; import "../../../../components/ha-circular-progress"; import "../../../../components/ha-settings-row"; import "../../../../components/ha-switch"; -import { - CloudStatusLoggedIn, - CloudWebhook, - createCloudhook, - deleteCloudhook, -} from "../../../../data/cloud"; -import { fetchWebhooks, Webhook, WebhookError } from "../../../../data/webhook"; +import type { CloudStatusLoggedIn, CloudWebhook } from "../../../../data/cloud"; +import { createCloudhook, deleteCloudhook } from "../../../../data/cloud"; +import type { Webhook, WebhookError } from "../../../../data/webhook"; +import { fetchWebhooks } from "../../../../data/webhook"; import { haStyle } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; import { showManageCloudhookDialog } from "../dialog-manage-cloudhook/show-dialog-manage-cloudhook"; @customElement("cloud-webhooks") diff --git a/src/panels/config/cloud/account/dialog-cloud-tts-try.ts b/src/panels/config/cloud/account/dialog-cloud-tts-try.ts index bf5b8632d78d..c8eaf68a794d 100644 --- a/src/panels/config/cloud/account/dialog-cloud-tts-try.ts +++ b/src/panels/config/cloud/account/dialog-cloud-tts-try.ts @@ -1,7 +1,8 @@ import "@material/mwc-button"; import "@material/mwc-list/mwc-list-item"; import { mdiPlayCircleOutline, mdiRobot } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { storage } from "../../../../common/decorators/storage"; import { fireEvent } from "../../../../common/dom/fire_event"; @@ -18,8 +19,8 @@ import { MediaPlayerEntityFeature } from "../../../../data/media-player"; import { convertTextToSpeech } from "../../../../data/tts"; import { showAlertDialog } from "../../../../dialogs/generic/show-dialog-box"; import { haStyleDialog } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; -import { TryTtsDialogParams } from "./show-dialog-cloud-tts-try"; +import type { HomeAssistant } from "../../../../types"; +import type { TryTtsDialogParams } from "./show-dialog-cloud-tts-try"; @customElement("dialog-cloud-try-tts") export class DialogTryTts extends LitElement { diff --git a/src/panels/config/cloud/dialog-cloud-certificate/dialog-cloud-certificate.ts b/src/panels/config/cloud/dialog-cloud-certificate/dialog-cloud-certificate.ts index 91ee82e24142..d8752ecabb2e 100644 --- a/src/panels/config/cloud/dialog-cloud-certificate/dialog-cloud-certificate.ts +++ b/src/panels/config/cloud/dialog-cloud-certificate/dialog-cloud-certificate.ts @@ -1,5 +1,6 @@ import "@material/mwc-button"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, state } from "lit/decorators"; import { formatDateTime } from "../../../../common/datetime/format_date_time"; import { fireEvent } from "../../../../common/dom/fire_event"; diff --git a/src/panels/config/cloud/dialog-cloud-certificate/show-dialog-cloud-certificate.ts b/src/panels/config/cloud/dialog-cloud-certificate/show-dialog-cloud-certificate.ts index 3aca7d70746a..4146608fb58d 100644 --- a/src/panels/config/cloud/dialog-cloud-certificate/show-dialog-cloud-certificate.ts +++ b/src/panels/config/cloud/dialog-cloud-certificate/show-dialog-cloud-certificate.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../../common/dom/fire_event"; -import { CertificateInformation } from "../../../../data/cloud"; +import type { CertificateInformation } from "../../../../data/cloud"; export interface CloudCertificateParams { certificateInfo: CertificateInformation; diff --git a/src/panels/config/cloud/dialog-manage-cloudhook/dialog-manage-cloudhook.ts b/src/panels/config/cloud/dialog-manage-cloudhook/dialog-manage-cloudhook.ts index 603cec7fe3de..e4358a2b5641 100644 --- a/src/panels/config/cloud/dialog-manage-cloudhook/dialog-manage-cloudhook.ts +++ b/src/panels/config/cloud/dialog-manage-cloudhook/dialog-manage-cloudhook.ts @@ -1,6 +1,7 @@ import "@material/mwc-button"; import { mdiContentCopy, mdiOpenInNew } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { query, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import { copyToClipboard } from "../../../../common/util/copy-clipboard"; @@ -9,10 +10,10 @@ import "../../../../components/ha-textfield"; import type { HaTextField } from "../../../../components/ha-textfield"; import { showConfirmationDialog } from "../../../../dialogs/generic/show-dialog-box"; import { haStyle, haStyleDialog } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; import { documentationUrl } from "../../../../util/documentation-url"; import { showToast } from "../../../../util/toast"; -import { WebhookDialogParams } from "./show-dialog-manage-cloudhook"; +import type { WebhookDialogParams } from "./show-dialog-manage-cloudhook"; export class DialogManageCloudhook extends LitElement { protected hass?: HomeAssistant; diff --git a/src/panels/config/cloud/dialog-manage-cloudhook/show-dialog-manage-cloudhook.ts b/src/panels/config/cloud/dialog-manage-cloudhook/show-dialog-manage-cloudhook.ts index a23dde53938a..d2b8be990eb2 100644 --- a/src/panels/config/cloud/dialog-manage-cloudhook/show-dialog-manage-cloudhook.ts +++ b/src/panels/config/cloud/dialog-manage-cloudhook/show-dialog-manage-cloudhook.ts @@ -1,6 +1,6 @@ import { fireEvent } from "../../../../common/dom/fire_event"; -import { CloudWebhook } from "../../../../data/cloud"; -import { Webhook } from "../../../../data/webhook"; +import type { CloudWebhook } from "../../../../data/cloud"; +import type { Webhook } from "../../../../data/webhook"; export interface WebhookDialogParams { webhook: Webhook; diff --git a/src/panels/config/cloud/forgot-password/cloud-forgot-password.ts b/src/panels/config/cloud/forgot-password/cloud-forgot-password.ts index 229059bcf8e7..f1f723f8dd82 100644 --- a/src/panels/config/cloud/forgot-password/cloud-forgot-password.ts +++ b/src/panels/config/cloud/forgot-password/cloud-forgot-password.ts @@ -1,4 +1,5 @@ -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/buttons/ha-progress-button"; @@ -9,7 +10,7 @@ import "../../../../components/ha-textfield"; import { cloudForgotPassword } from "../../../../data/cloud"; import "../../../../layouts/hass-subpage"; import { haStyle } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; @customElement("cloud-forgot-password") export class CloudForgotPassword extends LitElement { diff --git a/src/panels/config/cloud/ha-config-cloud.ts b/src/panels/config/cloud/ha-config-cloud.ts index 08b4c303c366..e4b0e913ad55 100644 --- a/src/panels/config/cloud/ha-config-cloud.ts +++ b/src/panels/config/cloud/ha-config-cloud.ts @@ -1,11 +1,9 @@ import { customElement, property, state } from "lit/decorators"; import { navigate } from "../../../common/navigate"; -import { CloudStatus } from "../../../data/cloud"; -import { - HassRouterPage, - RouterOptions, -} from "../../../layouts/hass-router-page"; -import { ValueChangedEvent, HomeAssistant, Route } from "../../../types"; +import type { CloudStatus } from "../../../data/cloud"; +import type { RouterOptions } from "../../../layouts/hass-router-page"; +import { HassRouterPage } from "../../../layouts/hass-router-page"; +import type { ValueChangedEvent, HomeAssistant, Route } from "../../../types"; import "./account/cloud-account"; import "./login/cloud-login"; diff --git a/src/panels/config/cloud/login/cloud-login.ts b/src/panels/config/cloud/login/cloud-login.ts index ecc9c56b676b..b59507360141 100644 --- a/src/panels/config/cloud/login/cloud-login.ts +++ b/src/panels/config/cloud/login/cloud-login.ts @@ -1,7 +1,8 @@ import "@material/mwc-button"; import "@material/mwc-list/mwc-list"; import { mdiDeleteForever, mdiDotsVertical } from "@mdi/js"; -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import { navigate } from "../../../../common/navigate"; @@ -11,6 +12,7 @@ import "../../../../components/ha-card"; import "../../../../components/ha-icon-next"; import "../../../../components/ha-list-item"; import "../../../../components/ha-password-field"; +import "../../../../components/ha-button-menu"; import type { HaPasswordField } from "../../../../components/ha-password-field"; import "../../../../components/ha-textfield"; import type { HaTextField } from "../../../../components/ha-textfield"; @@ -22,7 +24,7 @@ import { } from "../../../../dialogs/generic/show-dialog-box"; import "../../../../layouts/hass-subpage"; import { haStyle } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; import "../../ha-config-section"; @customElement("cloud-login") diff --git a/src/panels/config/cloud/register/cloud-register.ts b/src/panels/config/cloud/register/cloud-register.ts index 10964e5cf0fe..debc83afb913 100644 --- a/src/panels/config/cloud/register/cloud-register.ts +++ b/src/panels/config/cloud/register/cloud-register.ts @@ -1,4 +1,5 @@ -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/buttons/ha-progress-button"; @@ -9,7 +10,7 @@ import type { HaTextField } from "../../../../components/ha-textfield"; import { cloudRegister, cloudResendVerification } from "../../../../data/cloud"; import "../../../../layouts/hass-subpage"; import { haStyle } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; import "../../ha-config-section"; import "../../../../components/ha-password-field"; diff --git a/src/panels/config/core/ha-config-analytics.ts b/src/panels/config/core/ha-config-analytics.ts index 3c71aa695893..6af7d5b8b27b 100644 --- a/src/panels/config/core/ha-config-analytics.ts +++ b/src/panels/config/core/ha-config-analytics.ts @@ -1,20 +1,14 @@ import "@material/mwc-button/mwc-button"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import "../../../components/ha-analytics"; import "../../../components/ha-card"; import "../../../components/ha-checkbox"; import "../../../components/ha-settings-row"; +import type { Analytics } from "../../../data/analytics"; import { - Analytics, getAnalyticsDetails, setAnalyticsPreferences, } from "../../../data/analytics"; diff --git a/src/panels/config/core/ha-config-section-analytics.ts b/src/panels/config/core/ha-config-section-analytics.ts index 75658e6a47f9..c64ede995d4f 100644 --- a/src/panels/config/core/ha-config-section-analytics.ts +++ b/src/panels/config/core/ha-config-section-analytics.ts @@ -1,4 +1,5 @@ -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../layouts/hass-subpage"; import type { HomeAssistant, Route } from "../../../types"; diff --git a/src/panels/config/core/ha-config-section-general.ts b/src/panels/config/core/ha-config-section-general.ts index 3ccadf595d8e..c229e5fd52e8 100644 --- a/src/panels/config/core/ha-config-section-general.ts +++ b/src/panels/config/core/ha-config-section-general.ts @@ -1,5 +1,6 @@ import "@material/mwc-list/mwc-list-item"; -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { UNIT_C } from "../../../common/const"; import { stopPropagation } from "../../../common/dom/stop_propagation"; @@ -21,7 +22,8 @@ import "../../../components/ha-settings-row"; import "../../../components/ha-textfield"; import type { HaTextField } from "../../../components/ha-textfield"; import "../../../components/ha-timezone-picker"; -import { ConfigUpdateValues, saveCoreConfig } from "../../../data/core"; +import type { ConfigUpdateValues } from "../../../data/core"; +import { saveCoreConfig } from "../../../data/core"; import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box"; import "../../../layouts/hass-subpage"; import { haStyle } from "../../../resources/styles"; diff --git a/src/panels/config/core/ha-config-section-updates.ts b/src/panels/config/core/ha-config-section-updates.ts index 15a437b742f3..a79c1693f612 100644 --- a/src/panels/config/core/ha-config-section-updates.ts +++ b/src/panels/config/core/ha-config-section-updates.ts @@ -1,7 +1,9 @@ -import { RequestSelectedDetail } from "@material/mwc-list/mwc-list-item"; +import "@material/mwc-list/mwc-list-item"; +import type { RequestSelectedDetail } from "@material/mwc-list/mwc-list-item"; import { mdiDotsVertical, mdiRefresh } from "@mdi/js"; -import { HassEntities } from "home-assistant-js-websocket"; -import { LitElement, TemplateResult, css, html } from "lit"; +import type { HassEntities } from "home-assistant-js-websocket"; +import type { TemplateResult } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; @@ -13,9 +15,11 @@ import "../../../components/ha-card"; import "../../../components/ha-check-list-item"; import "../../../components/ha-metric"; import { extractApiErrorMessage } from "../../../data/hassio/common"; -import { +import type { HassioSupervisorInfo, SupervisorOptions, +} from "../../../data/hassio/supervisor"; +import { fetchHassioSupervisorInfo, reloadSupervisor, setSupervisorOption, diff --git a/src/panels/config/core/ha-config-system-navigation.ts b/src/panels/config/core/ha-config-system-navigation.ts index 9f46770667b9..0585ae400f6f 100644 --- a/src/panels/config/core/ha-config-system-navigation.ts +++ b/src/panels/config/core/ha-config-system-navigation.ts @@ -1,5 +1,6 @@ import { mdiPower } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { canShowPage } from "../../../common/config/can_show_page"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; @@ -8,15 +9,21 @@ import { blankBeforePercent } from "../../../common/translations/blank_before_pe import "../../../components/ha-card"; import "../../../components/ha-icon-button"; import "../../../components/ha-navigation-list"; -import { BackupContent, fetchBackupInfo } from "../../../data/backup"; -import { CloudStatus, fetchCloudStatus } from "../../../data/cloud"; -import { BOARD_NAMES, HardwareInfo } from "../../../data/hardware"; -import { fetchHassioBackups, HassioBackup } from "../../../data/hassio/backup"; +import type { BackupContent } from "../../../data/backup"; +import { fetchBackupInfo } from "../../../data/backup"; +import type { CloudStatus } from "../../../data/cloud"; +import { fetchCloudStatus } from "../../../data/cloud"; +import type { HardwareInfo } from "../../../data/hardware"; +import { BOARD_NAMES } from "../../../data/hardware"; +import type { HassioBackup } from "../../../data/hassio/backup"; +import { fetchHassioBackups } from "../../../data/hassio/backup"; +import type { + HassioHassOSInfo, + HassioHostInfo, +} from "../../../data/hassio/host"; import { fetchHassioHassOsInfo, fetchHassioHostInfo, - HassioHassOSInfo, - HassioHostInfo, } from "../../../data/hassio/host"; import { showRestartDialog } from "../../../dialogs/restart/show-dialog-restart"; import "../../../layouts/hass-subpage"; diff --git a/src/panels/config/core/updates/dialog-join-beta.ts b/src/panels/config/core/updates/dialog-join-beta.ts index 600ac954c977..5a96530f36ca 100644 --- a/src/panels/config/core/updates/dialog-join-beta.ts +++ b/src/panels/config/core/updates/dialog-join-beta.ts @@ -1,15 +1,16 @@ import "@material/mwc-button/mwc-button"; import { mdiOpenInNew } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-alert"; import { createCloseHeading } from "../../../../components/ha-dialog"; -import { HassDialog } from "../../../../dialogs/make-dialog-manager"; +import type { HassDialog } from "../../../../dialogs/make-dialog-manager"; import { haStyleDialog } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; import { documentationUrl } from "../../../../util/documentation-url"; -import { JoinBetaDialogParams } from "./show-dialog-join-beta"; +import type { JoinBetaDialogParams } from "./show-dialog-join-beta"; @customElement("dialog-join-beta") export class DialogJoinBeta diff --git a/src/panels/config/dashboard/dialog-new-dashboard.ts b/src/panels/config/dashboard/dialog-new-dashboard.ts index e6a71ddb9844..41aa27f0137f 100644 --- a/src/panels/config/dashboard/dialog-new-dashboard.ts +++ b/src/panels/config/dashboard/dialog-new-dashboard.ts @@ -1,17 +1,18 @@ import "@material/mwc-list/mwc-list"; import { mdiMap, mdiPencilOutline, mdiShape, mdiWeb } from "@mdi/js"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import { shouldHandleRequestSelectedEvent } from "../../../common/mwc/handle-request-selected-event"; import { createCloseHeading } from "../../../components/ha-dialog"; import "../../../components/ha-icon-next"; import "../../../components/ha-list-item"; -import { LovelaceRawConfig } from "../../../data/lovelace/config/types"; -import { HassDialog } from "../../../dialogs/make-dialog-manager"; +import type { LovelaceRawConfig } from "../../../data/lovelace/config/types"; +import type { HassDialog } from "../../../dialogs/make-dialog-manager"; import { haStyle, haStyleDialog } from "../../../resources/styles"; import type { HomeAssistant } from "../../../types"; -import { NewDashboardDialogParams } from "./show-dialog-new-dashboard"; +import type { NewDashboardDialogParams } from "./show-dialog-new-dashboard"; const EMPTY_CONFIG: LovelaceRawConfig = { views: [{ title: "Home" }] }; diff --git a/src/panels/config/dashboard/ha-config-dashboard.ts b/src/panels/config/dashboard/ha-config-dashboard.ts index 859ef4fdc901..471bb9c09195 100644 --- a/src/panels/config/dashboard/ha-config-dashboard.ts +++ b/src/panels/config/dashboard/ha-config-dashboard.ts @@ -7,14 +7,8 @@ import { mdiRefresh, } from "@mdi/js"; import type { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - css, - html, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; @@ -28,23 +22,23 @@ import "../../../components/ha-menu-button"; import "../../../components/ha-svg-icon"; import "../../../components/ha-tip"; import "../../../components/ha-top-app-bar-fixed"; -import { CloudStatus } from "../../../data/cloud"; +import type { CloudStatus } from "../../../data/cloud"; +import type { RepairsIssue } from "../../../data/repairs"; import { - RepairsIssue, severitySort, subscribeRepairsIssueRegistry, } from "../../../data/repairs"; +import type { UpdateEntity } from "../../../data/update"; import { - UpdateEntity, checkForEntityUpdates, filterUpdateEntitiesWithInstall, } from "../../../data/update"; import { showQuickBar } from "../../../dialogs/quick-bar/show-dialog-quick-bar"; import { showRestartDialog } from "../../../dialogs/restart/show-dialog-restart"; -import { PageNavigation } from "../../../layouts/hass-tabs-subpage"; +import type { PageNavigation } from "../../../layouts/hass-tabs-subpage"; import { SubscribeMixin } from "../../../mixins/subscribe-mixin"; import { haStyle } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { documentationUrl } from "../../../util/documentation-url"; import "../ha-config-section"; import { configSections } from "../ha-panel-config"; diff --git a/src/panels/config/dashboard/ha-config-navigation.ts b/src/panels/config/dashboard/ha-config-navigation.ts index 8bf75aeb4706..fcabf2148e15 100644 --- a/src/panels/config/dashboard/ha-config-navigation.ts +++ b/src/panels/config/dashboard/ha-config-navigation.ts @@ -1,6 +1,7 @@ import "@material/mwc-list/mwc-list"; import "@material/mwc-list/mwc-list-item"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { canShowPage } from "../../../common/config/can_show_page"; import "../../../components/ha-card"; diff --git a/src/panels/config/dashboard/ha-config-updates.ts b/src/panels/config/dashboard/ha-config-updates.ts index 254815b82cab..df9c9c390466 100644 --- a/src/panels/config/dashboard/ha-config-updates.ts +++ b/src/panels/config/dashboard/ha-config-updates.ts @@ -1,7 +1,8 @@ import "@material/mwc-button/mwc-button"; import "@material/mwc-list/mwc-list"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import memoizeOne from "memoize-one"; @@ -11,15 +12,13 @@ import "../../../components/ha-alert"; import "../../../components/ha-circular-progress"; import "../../../components/ha-icon-next"; import "../../../components/ha-list-item"; +import type { DeviceRegistryEntry } from "../../../data/device_registry"; import { computeDeviceName, - DeviceRegistryEntry, subscribeDeviceRegistry, } from "../../../data/device_registry"; -import { - EntityRegistryEntry, - subscribeEntityRegistry, -} from "../../../data/entity_registry"; +import type { EntityRegistryEntry } from "../../../data/entity_registry"; +import { subscribeEntityRegistry } from "../../../data/entity_registry"; import type { UpdateEntity } from "../../../data/update"; import { SubscribeMixin } from "../../../mixins/subscribe-mixin"; import type { HomeAssistant } from "../../../types"; diff --git a/src/panels/config/dashboard/show-dialog-new-dashboard.ts b/src/panels/config/dashboard/show-dialog-new-dashboard.ts index 7011b9e7e3da..237a545e5945 100644 --- a/src/panels/config/dashboard/show-dialog-new-dashboard.ts +++ b/src/panels/config/dashboard/show-dialog-new-dashboard.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import { LovelaceConfig } from "../../../data/lovelace/config/types"; +import type { LovelaceConfig } from "../../../data/lovelace/config/types"; export interface NewDashboardDialogParams { selectConfig: (config: LovelaceConfig | undefined) => any; diff --git a/src/panels/config/devices/device-detail/ha-device-automation-dialog.ts b/src/panels/config/devices/device-detail/ha-device-automation-dialog.ts index c79347c67e79..a3009bfe0a0a 100644 --- a/src/panels/config/devices/device-detail/ha-device-automation-dialog.ts +++ b/src/panels/config/devices/device-detail/ha-device-automation-dialog.ts @@ -1,31 +1,36 @@ +import "@material/mwc-list/mwc-list"; import { mdiAbTesting, mdiGestureTap, mdiPencilOutline, mdiRoomService, } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import { shouldHandleRequestSelectedEvent } from "../../../../common/mwc/handle-request-selected-event"; import { createCloseHeading } from "../../../../components/ha-dialog"; -import { - AutomationConfig, - showAutomationEditor, -} from "../../../../data/automation"; -import { +import "../../../../components/ha-icon-next"; +import "../../../../components/ha-list-item"; +import type { AutomationConfig } from "../../../../data/automation"; +import { showAutomationEditor } from "../../../../data/automation"; +import type { DeviceAction, DeviceCondition, DeviceTrigger, +} from "../../../../data/device_automation"; +import { fetchDeviceActions, fetchDeviceConditions, fetchDeviceTriggers, sortDeviceAutomations, } from "../../../../data/device_automation"; -import { ScriptConfig, showScriptEditor } from "../../../../data/script"; +import type { ScriptConfig } from "../../../../data/script"; +import { showScriptEditor } from "../../../../data/script"; import { haStyle, haStyleDialog } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; -import { DeviceAutomationDialogParams } from "./show-dialog-device-automation"; +import type { HomeAssistant } from "../../../../types"; +import type { DeviceAutomationDialogParams } from "./show-dialog-device-automation"; @customElement("dialog-device-automation") export class DialogDeviceAutomation extends LitElement { diff --git a/src/panels/config/devices/device-detail/ha-device-entities-card.ts b/src/panels/config/devices/device-detail/ha-device-entities-card.ts index 07993cbdb723..3d869428ca3b 100644 --- a/src/panels/config/devices/device-detail/ha-device-entities-card.ts +++ b/src/panels/config/devices/device-detail/ha-device-entities-card.ts @@ -1,12 +1,6 @@ import "@material/mwc-list/mwc-list"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { until } from "lit/directives/until"; import { computeStateName } from "../../../../common/entity/compute_state_name"; @@ -14,19 +8,19 @@ import { stripPrefixFromEntityName } from "../../../../common/entity/strip_prefi import "../../../../components/ha-card"; import "../../../../components/ha-icon"; import "../../../../components/ha-list-item"; -import { - ExtEntityRegistryEntry, - getExtendedEntityRegistryEntry, -} from "../../../../data/entity_registry"; +import type { ExtEntityRegistryEntry } from "../../../../data/entity_registry"; +import { getExtendedEntityRegistryEntry } from "../../../../data/entity_registry"; import { entryIcon } from "../../../../data/icons"; import { showMoreInfoDialog } from "../../../../dialogs/more-info/show-ha-more-info-dialog"; import type { HomeAssistant } from "../../../../types"; import type { HuiErrorCard } from "../../../lovelace/cards/hui-error-card"; import { createRowElement } from "../../../lovelace/create-element/create-row-element"; import { addEntitiesToLovelaceView } from "../../../lovelace/editor/add-entities-to-view"; -import type { LovelaceRowConfig } from "../../../lovelace/entity-rows/types"; -import { LovelaceRow } from "../../../lovelace/entity-rows/types"; -import { EntityRegistryStateEntry } from "../ha-config-device-page"; +import type { + LovelaceRowConfig, + LovelaceRow, +} from "../../../lovelace/entity-rows/types"; +import type { EntityRegistryStateEntry } from "../ha-config-device-page"; import { computeCards, computeSection, @@ -305,6 +299,7 @@ export class HaDeviceEntitiesCard extends LitElement { } ha-list-item { height: 40px; + --mdc-ripple-color: transparent; } `; } diff --git a/src/panels/config/devices/device-detail/ha-device-info-card.ts b/src/panels/config/devices/device-detail/ha-device-info-card.ts index bf69819f87ea..0e6eec2c9887 100644 --- a/src/panels/config/devices/device-detail/ha-device-info-card.ts +++ b/src/panels/config/devices/device-detail/ha-device-info-card.ts @@ -1,13 +1,12 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { titleCase } from "../../../../common/string/title-case"; import "../../../../components/ha-card"; -import { - computeDeviceName, - DeviceRegistryEntry, -} from "../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../data/device_registry"; +import { computeDeviceName } from "../../../../data/device_registry"; import { haStyle } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; @customElement("ha-device-info-card") export class HaDeviceCard extends LitElement { diff --git a/src/panels/config/devices/device-detail/ha-device-via-devices-card.ts b/src/panels/config/devices/device-detail/ha-device-via-devices-card.ts index aa664ce9e0d0..7e74799c1445 100644 --- a/src/panels/config/devices/device-detail/ha-device-via-devices-card.ts +++ b/src/panels/config/devices/device-detail/ha-device-via-devices-card.ts @@ -1,14 +1,13 @@ import "@material/mwc-list/mwc-list-item"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { caseInsensitiveStringCompare } from "../../../../common/string/compare"; import "../../../../components/ha-card"; import "../../../../components/ha-icon-next"; -import { - computeDeviceName, - DeviceRegistryEntry, -} from "../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../data/device_registry"; +import { computeDeviceName } from "../../../../data/device_registry"; import type { HomeAssistant } from "../../../../types"; const MAX_VISIBLE_VIA_DEVICES = 10; diff --git a/src/panels/config/devices/device-detail/integration-elements/matter/device-actions.ts b/src/panels/config/devices/device-detail/integration-elements/matter/device-actions.ts index 2be86b5ee48b..f90c78b9fc12 100644 --- a/src/panels/config/devices/device-detail/integration-elements/matter/device-actions.ts +++ b/src/panels/config/devices/device-detail/integration-elements/matter/device-actions.ts @@ -4,7 +4,7 @@ import { mdiChatQuestion, mdiExportVariant, } from "@mdi/js"; -import { DeviceRegistryEntry } from "../../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../../data/device_registry"; import { NetworkType, getMatterNodeDiagnostics, diff --git a/src/panels/config/devices/device-detail/integration-elements/matter/ha-device-info-matter.ts b/src/panels/config/devices/device-detail/integration-elements/matter/ha-device-info-matter.ts index a2263207bf15..59a9205da961 100644 --- a/src/panels/config/devices/device-detail/integration-elements/matter/ha-device-info-matter.ts +++ b/src/panels/config/devices/device-detail/integration-elements/matter/ha-device-info-matter.ts @@ -1,23 +1,15 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../../../../components/ha-expansion-panel"; -import { DeviceRegistryEntry } from "../../../../../../data/device_registry"; -import { - getMatterNodeDiagnostics, - MatterNodeDiagnostics, -} from "../../../../../../data/matter"; +import type { DeviceRegistryEntry } from "../../../../../../data/device_registry"; +import type { MatterNodeDiagnostics } from "../../../../../../data/matter"; +import { getMatterNodeDiagnostics } from "../../../../../../data/matter"; import "@material/mwc-list"; import "../../../../../../components/ha-list-item"; import { SubscribeMixin } from "../../../../../../mixins/subscribe-mixin"; import { haStyle } from "../../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../../types"; +import type { HomeAssistant } from "../../../../../../types"; @customElement("ha-device-info-matter") export class HaDeviceInfoMatter extends SubscribeMixin(LitElement) { diff --git a/src/panels/config/devices/device-detail/integration-elements/mqtt/dialog-mqtt-device-debug-info.ts b/src/panels/config/devices/device-detail/integration-elements/mqtt/dialog-mqtt-device-debug-info.ts index 3884f65b5d97..8395a57bf90d 100644 --- a/src/panels/config/devices/device-detail/integration-elements/mqtt/dialog-mqtt-device-debug-info.ts +++ b/src/panels/config/devices/device-detail/integration-elements/mqtt/dialog-mqtt-device-debug-info.ts @@ -1,12 +1,6 @@ import "@material/mwc-button/mwc-button"; -import { - css, - CSSResultGroup, - html, - LitElement, - TemplateResult, - nothing, -} from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, state } from "lit/decorators"; import { computeStateName } from "../../../../../../common/entity/compute_state_name"; import "../../../../../../components/ha-dialog"; @@ -14,15 +8,13 @@ import "../../../../../../components/ha-formfield"; import "../../../../../../components/ha-switch"; import type { HaSwitch } from "../../../../../../components/ha-switch"; import { computeDeviceName } from "../../../../../../data/device_registry"; -import { - fetchMQTTDebugInfo, - MQTTDeviceDebugInfo, -} from "../../../../../../data/mqtt"; +import type { MQTTDeviceDebugInfo } from "../../../../../../data/mqtt"; +import { fetchMQTTDebugInfo } from "../../../../../../data/mqtt"; import { haStyleDialog } from "../../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../../types"; +import type { HomeAssistant } from "../../../../../../types"; import "./mqtt-discovery-payload"; import "./mqtt-messages"; -import { MQTTDeviceDebugInfoDialogParams } from "./show-dialog-mqtt-device-debug-info"; +import type { MQTTDeviceDebugInfoDialogParams } from "./show-dialog-mqtt-device-debug-info"; @customElement("dialog-mqtt-device-debug-info") class DialogMQTTDeviceDebugInfo extends LitElement { diff --git a/src/panels/config/devices/device-detail/integration-elements/mqtt/mqtt-discovery-payload.ts b/src/panels/config/devices/device-detail/integration-elements/mqtt/mqtt-discovery-payload.ts index c30d951ad67e..6aab35f0b9bd 100644 --- a/src/panels/config/devices/device-detail/integration-elements/mqtt/mqtt-discovery-payload.ts +++ b/src/panels/config/devices/device-detail/integration-elements/mqtt/mqtt-discovery-payload.ts @@ -1,5 +1,6 @@ import { dump } from "js-yaml"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; diff --git a/src/panels/config/devices/device-detail/integration-elements/mqtt/mqtt-messages.ts b/src/panels/config/devices/device-detail/integration-elements/mqtt/mqtt-messages.ts index fed296c860bb..8589cb6082de 100644 --- a/src/panels/config/devices/device-detail/integration-elements/mqtt/mqtt-messages.ts +++ b/src/panels/config/devices/device-detail/integration-elements/mqtt/mqtt-messages.ts @@ -1,10 +1,11 @@ import { dump } from "js-yaml"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { formatTimeWithSeconds } from "../../../../../../common/datetime/format_time"; -import { MQTTMessage } from "../../../../../../data/mqtt"; -import { HomeAssistant } from "../../../../../../types"; +import type { MQTTMessage } from "../../../../../../data/mqtt"; +import type { HomeAssistant } from "../../../../../../types"; @customElement("mqtt-messages") class MQTTMessages extends LitElement { diff --git a/src/panels/config/devices/device-detail/integration-elements/mqtt/show-dialog-mqtt-device-debug-info.ts b/src/panels/config/devices/device-detail/integration-elements/mqtt/show-dialog-mqtt-device-debug-info.ts index 366f9903b988..25751ba7c53f 100644 --- a/src/panels/config/devices/device-detail/integration-elements/mqtt/show-dialog-mqtt-device-debug-info.ts +++ b/src/panels/config/devices/device-detail/integration-elements/mqtt/show-dialog-mqtt-device-debug-info.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../../../../common/dom/fire_event"; -import { DeviceRegistryEntry } from "../../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../../data/device_registry"; export interface MQTTDeviceDebugInfoDialogParams { device: DeviceRegistryEntry; diff --git a/src/panels/config/devices/device-detail/integration-elements/zha/ha-device-info-zha.ts b/src/panels/config/devices/device-detail/integration-elements/zha/ha-device-info-zha.ts index 07fe9643a850..a682beefe4dd 100644 --- a/src/panels/config/devices/device-detail/integration-elements/zha/ha-device-info-zha.ts +++ b/src/panels/config/devices/device-detail/integration-elements/zha/ha-device-info-zha.ts @@ -1,17 +1,12 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../../../../components/ha-expansion-panel"; -import { DeviceRegistryEntry } from "../../../../../../data/device_registry"; -import { fetchZHADevice, ZHADevice } from "../../../../../../data/zha"; +import type { DeviceRegistryEntry } from "../../../../../../data/device_registry"; +import type { ZHADevice } from "../../../../../../data/zha"; +import { fetchZHADevice } from "../../../../../../data/zha"; import { haStyle } from "../../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../../types"; +import type { HomeAssistant } from "../../../../../../types"; import { formatAsPaddedHex } from "../../../../integrations/integration-panels/zha/functions"; @customElement("ha-device-info-zha") diff --git a/src/panels/config/devices/device-detail/integration-elements/zwave_js/device-actions.ts b/src/panels/config/devices/device-detail/integration-elements/zwave_js/device-actions.ts index 5fcdb6585115..06d8fe55781a 100644 --- a/src/panels/config/devices/device-detail/integration-elements/zwave_js/device-actions.ts +++ b/src/panels/config/devices/device-detail/integration-elements/zwave_js/device-actions.ts @@ -7,7 +7,7 @@ import { mdiUpload, } from "@mdi/js"; import { getConfigEntries } from "../../../../../../data/config_entries"; -import { DeviceRegistryEntry } from "../../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../../data/device_registry"; import { fetchZwaveIsAnyOTAFirmwareUpdateInProgress, fetchZwaveIsNodeFirmwareUpdateInProgress, diff --git a/src/panels/config/devices/device-detail/integration-elements/zwave_js/device-alerts.ts b/src/panels/config/devices/device-detail/integration-elements/zwave_js/device-alerts.ts index b2a92735096f..f69ef5e6bdcd 100644 --- a/src/panels/config/devices/device-detail/integration-elements/zwave_js/device-alerts.ts +++ b/src/panels/config/devices/device-detail/integration-elements/zwave_js/device-alerts.ts @@ -1,7 +1,7 @@ -import { DeviceRegistryEntry } from "../../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../../data/device_registry"; import { fetchZwaveNodeAlerts } from "../../../../../../data/zwave_js"; -import { HomeAssistant } from "../../../../../../types"; -import { DeviceAlert } from "../../../ha-config-device-page"; +import type { HomeAssistant } from "../../../../../../types"; +import type { DeviceAlert } from "../../../ha-config-device-page"; export const getZwaveDeviceAlerts = async ( hass: HomeAssistant, diff --git a/src/panels/config/devices/device-detail/integration-elements/zwave_js/ha-device-info-zwave_js.ts b/src/panels/config/devices/device-detail/integration-elements/zwave_js/ha-device-info-zwave_js.ts index 07671142ba40..bed2ec4872d6 100644 --- a/src/panels/config/devices/device-detail/integration-elements/zwave_js/ha-device-info-zwave_js.ts +++ b/src/panels/config/devices/device-detail/integration-elements/zwave_js/ha-device-info-zwave_js.ts @@ -1,26 +1,18 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../../../../components/ha-expansion-panel"; -import { - ConfigEntry, - getConfigEntries, -} from "../../../../../../data/config_entries"; -import { DeviceRegistryEntry } from "../../../../../../data/device_registry"; +import type { ConfigEntry } from "../../../../../../data/config_entries"; +import { getConfigEntries } from "../../../../../../data/config_entries"; +import type { DeviceRegistryEntry } from "../../../../../../data/device_registry"; +import type { ZWaveJSNodeStatus } from "../../../../../../data/zwave_js"; import { fetchZwaveNodeStatus, SecurityClass, - ZWaveJSNodeStatus, } from "../../../../../../data/zwave_js"; import { SubscribeMixin } from "../../../../../../mixins/subscribe-mixin"; import { haStyle } from "../../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../../types"; +import type { HomeAssistant } from "../../../../../../types"; @customElement("ha-device-info-zwave_js") export class HaDeviceInfoZWaveJS extends SubscribeMixin(LitElement) { diff --git a/src/panels/config/devices/device-detail/show-dialog-device-automation.ts b/src/panels/config/devices/device-detail/show-dialog-device-automation.ts index b57efd7e3c88..7f7a906c39d0 100644 --- a/src/panels/config/devices/device-detail/show-dialog-device-automation.ts +++ b/src/panels/config/devices/device-detail/show-dialog-device-automation.ts @@ -1,6 +1,6 @@ import { fireEvent } from "../../../../common/dom/fire_event"; -import { DeviceRegistryEntry } from "../../../../data/device_registry"; -import { EntityRegistryEntry } from "../../../../data/entity_registry"; +import type { DeviceRegistryEntry } from "../../../../data/device_registry"; +import type { EntityRegistryEntry } from "../../../../data/entity_registry"; export interface DeviceAutomationDialogParams { device: DeviceRegistryEntry; diff --git a/src/panels/config/devices/device-registry-detail/dialog-device-registry-detail.ts b/src/panels/config/devices/device-registry-detail/dialog-device-registry-detail.ts index ff37618fb7e2..7fc4add93f28 100644 --- a/src/panels/config/devices/device-registry-detail/dialog-device-registry-detail.ts +++ b/src/panels/config/devices/device-registry-detail/dialog-device-registry-detail.ts @@ -1,5 +1,6 @@ import "@material/mwc-button/mwc-button"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-alert"; @@ -8,13 +9,11 @@ import "../../../../components/ha-dialog"; import "../../../../components/ha-labels-picker"; import type { HaSwitch } from "../../../../components/ha-switch"; import "../../../../components/ha-textfield"; -import { - computeDeviceName, - DeviceRegistryEntry, -} from "../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../data/device_registry"; +import { computeDeviceName } from "../../../../data/device_registry"; import { haStyle, haStyleDialog } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; -import { DeviceRegistryDetailDialogParams } from "./show-dialog-device-registry-detail"; +import type { HomeAssistant } from "../../../../types"; +import type { DeviceRegistryDetailDialogParams } from "./show-dialog-device-registry-detail"; @customElement("dialog-device-registry-detail") class DialogDeviceRegistryDetail extends LitElement { diff --git a/src/panels/config/devices/device-registry-detail/show-dialog-device-registry-detail.ts b/src/panels/config/devices/device-registry-detail/show-dialog-device-registry-detail.ts index 383446906b04..2a2514f9b34b 100644 --- a/src/panels/config/devices/device-registry-detail/show-dialog-device-registry-detail.ts +++ b/src/panels/config/devices/device-registry-detail/show-dialog-device-registry-detail.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../../common/dom/fire_event"; -import { +import type { DeviceRegistryEntry, DeviceRegistryEntryMutableParams, } from "../../../../data/device_registry"; diff --git a/src/panels/config/devices/ha-config-device-page.ts b/src/panels/config/devices/ha-config-device-page.ts index a959ec67f0f2..0cac44e9dc4c 100644 --- a/src/panels/config/devices/ha-config-device-page.ts +++ b/src/panels/config/devices/ha-config-device-page.ts @@ -10,14 +10,8 @@ import { mdiPencil, mdiPlusCircle, } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import memoizeOne from "memoize-one"; @@ -37,34 +31,39 @@ import "../../../components/ha-icon-next"; import "../../../components/ha-svg-icon"; import "../../../components/ha-expansion-panel"; import { getSignedPath } from "../../../data/auth"; -import { +import type { ConfigEntry, DisableConfigEntryResult, +} from "../../../data/config_entries"; +import { disableConfigEntry, sortConfigEntries, } from "../../../data/config_entries"; import { fullEntitiesContext } from "../../../data/context"; +import type { DeviceRegistryEntry } from "../../../data/device_registry"; import { - DeviceRegistryEntry, computeDeviceName, removeConfigEntryFromDevice, updateDeviceRegistryEntry, } from "../../../data/device_registry"; +import type { DiagnosticInfo } from "../../../data/diagnostics"; import { - DiagnosticInfo, fetchDiagnosticHandler, getConfigEntryDiagnosticsDownloadUrl, getDeviceDiagnosticsDownloadUrl, } from "../../../data/diagnostics"; +import type { EntityRegistryEntry } from "../../../data/entity_registry"; import { - EntityRegistryEntry, findBatteryChargingEntity, findBatteryEntity, updateEntityRegistryEntry, } from "../../../data/entity_registry"; -import { IntegrationManifest, domainToName } from "../../../data/integration"; -import { SceneEntities, showSceneEditor } from "../../../data/scene"; -import { RelatedResult, findRelated } from "../../../data/search"; +import type { IntegrationManifest } from "../../../data/integration"; +import { domainToName } from "../../../data/integration"; +import type { SceneEntities } from "../../../data/scene"; +import { showSceneEditor } from "../../../data/scene"; +import type { RelatedResult } from "../../../data/search"; +import { findRelated } from "../../../data/search"; import { showAlertDialog, showConfirmationDialog, diff --git a/src/panels/config/devices/ha-config-devices-dashboard.ts b/src/panels/config/devices/ha-config-devices-dashboard.ts index 5500750d6561..9d8659d42c40 100644 --- a/src/panels/config/devices/ha-config-devices-dashboard.ts +++ b/src/panels/config/devices/ha-config-devices-dashboard.ts @@ -7,36 +7,29 @@ import { mdiPlus, mdiTextureBox, } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { ResizeController } from "@lit-labs/observers/resize-controller"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { computeCssColor } from "../../../common/color/compute-color"; import { formatShortDateTime } from "../../../common/datetime/format_date_time"; import { storage } from "../../../common/decorators/storage"; -import { HASSDomEvent } from "../../../common/dom/fire_event"; +import type { HASSDomEvent } from "../../../common/dom/fire_event"; import { computeStateDomain } from "../../../common/entity/compute_state_domain"; import { PROTOCOL_INTEGRATIONS, protocolIntegrationPicked, } from "../../../common/integrations/protocolIntegrationPicked"; import { navigate } from "../../../common/navigate"; -import { LocalizeFunc } from "../../../common/translations/localize"; +import type { LocalizeFunc } from "../../../common/translations/localize"; import { hasRejectedItems, rejectedItems, } from "../../../common/util/promise-all-settled-results"; -import { +import type { DataTableColumnContainer, RowClickedEvent, SelectionChangedEvent, @@ -58,27 +51,30 @@ import "../../../components/ha-icon-button"; import "../../../components/ha-md-menu-item"; import "../../../components/ha-sub-menu"; import { createAreaRegistryEntry } from "../../../data/area_registry"; -import { ConfigEntry, sortConfigEntries } from "../../../data/config_entries"; +import type { ConfigEntry } from "../../../data/config_entries"; +import { sortConfigEntries } from "../../../data/config_entries"; import { fullEntitiesContext } from "../../../data/context"; +import type { DataTableFilters } from "../../../data/data_table_filters"; import { - DataTableFilters, deserializeFilters, serializeFilters, } from "../../../data/data_table_filters"; -import { +import type { DeviceEntityLookup, DeviceRegistryEntry, +} from "../../../data/device_registry"; +import { computeDeviceName, updateDeviceRegistryEntry, } from "../../../data/device_registry"; +import type { EntityRegistryEntry } from "../../../data/entity_registry"; import { - EntityRegistryEntry, findBatteryChargingEntity, findBatteryEntity, } from "../../../data/entity_registry"; -import { IntegrationManifest } from "../../../data/integration"; +import type { IntegrationManifest } from "../../../data/integration"; +import type { LabelRegistryEntry } from "../../../data/label_registry"; import { - LabelRegistryEntry, createLabelRegistryEntry, subscribeLabelRegistry, } from "../../../data/label_registry"; @@ -86,7 +82,7 @@ import { showAlertDialog } from "../../../dialogs/generic/show-dialog-box"; import "../../../layouts/hass-tabs-subpage-data-table"; import { SubscribeMixin } from "../../../mixins/subscribe-mixin"; import { haStyle } from "../../../resources/styles"; -import { HomeAssistant, Route } from "../../../types"; +import type { HomeAssistant, Route } from "../../../types"; import { brandsUrl } from "../../../util/brands-url"; import { showAreaRegistryDetailDialog } from "../areas/show-dialog-area-registry-detail"; import { configSections } from "../ha-panel-config"; diff --git a/src/panels/config/devices/ha-config-devices.ts b/src/panels/config/devices/ha-config-devices.ts index bfda9129cb51..4a19a2ed0479 100644 --- a/src/panels/config/devices/ha-config-devices.ts +++ b/src/panels/config/devices/ha-config-devices.ts @@ -1,14 +1,11 @@ import { customElement, property, state } from "lit/decorators"; -import { ConfigEntry, getConfigEntries } from "../../../data/config_entries"; -import { - IntegrationManifest, - fetchIntegrationManifests, -} from "../../../data/integration"; -import { - HassRouterPage, - RouterOptions, -} from "../../../layouts/hass-router-page"; -import { HomeAssistant } from "../../../types"; +import type { ConfigEntry } from "../../../data/config_entries"; +import { getConfigEntries } from "../../../data/config_entries"; +import type { IntegrationManifest } from "../../../data/integration"; +import { fetchIntegrationManifests } from "../../../data/integration"; +import type { RouterOptions } from "../../../layouts/hass-router-page"; +import { HassRouterPage } from "../../../layouts/hass-router-page"; +import type { HomeAssistant } from "../../../types"; import "./ha-config-device-page"; import "./ha-config-devices-dashboard"; diff --git a/src/panels/config/energy/components/ha-energy-battery-settings.ts b/src/panels/config/energy/components/ha-energy-battery-settings.ts index a33d9cd34c57..16e358a7ad2a 100644 --- a/src/panels/config/energy/components/ha-energy-battery-settings.ts +++ b/src/panels/config/energy/components/ha-energy-battery-settings.ts @@ -1,28 +1,27 @@ import "@material/mwc-button/mwc-button"; import { mdiBatteryHigh, mdiDelete, mdiPencil } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-card"; import "../../../../components/ha-icon-button"; import "../../../../components/ha-settings-row"; -import { +import type { BatterySourceTypeEnergyPreference, EnergyPreferences, EnergyPreferencesValidation, EnergyValidationIssue, - saveEnergyPreferences, } from "../../../../data/energy"; -import { - StatisticsMetaData, - getStatisticLabel, -} from "../../../../data/recorder"; +import { saveEnergyPreferences } from "../../../../data/energy"; +import type { StatisticsMetaData } from "../../../../data/recorder"; +import { getStatisticLabel } from "../../../../data/recorder"; import { showAlertDialog, showConfirmationDialog, } from "../../../../dialogs/generic/show-dialog-box"; import { haStyle } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; import { documentationUrl } from "../../../../util/documentation-url"; import { showEnergySettingsBatteryDialog } from "../dialogs/show-dialogs-energy"; import "./ha-energy-validation-result"; diff --git a/src/panels/config/energy/components/ha-energy-device-settings.ts b/src/panels/config/energy/components/ha-energy-device-settings.ts index 8c6d3506e759..87f34188fcf3 100644 --- a/src/panels/config/energy/components/ha-energy-device-settings.ts +++ b/src/panels/config/energy/components/ha-energy-device-settings.ts @@ -1,27 +1,26 @@ import "@material/mwc-button/mwc-button"; import { mdiDelete, mdiDevices, mdiPencil } from "@mdi/js"; -import { CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-card"; import "../../../../components/ha-icon-button"; import "../../../../components/ha-state-icon"; -import { +import type { DeviceConsumptionEnergyPreference, EnergyPreferences, EnergyPreferencesValidation, - saveEnergyPreferences, } from "../../../../data/energy"; -import { - StatisticsMetaData, - getStatisticLabel, -} from "../../../../data/recorder"; +import { saveEnergyPreferences } from "../../../../data/energy"; +import type { StatisticsMetaData } from "../../../../data/recorder"; +import { getStatisticLabel } from "../../../../data/recorder"; import { showAlertDialog, showConfirmationDialog, } from "../../../../dialogs/generic/show-dialog-box"; import { haStyle } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; import { documentationUrl } from "../../../../util/documentation-url"; import { showEnergySettingsDeviceDialog } from "../dialogs/show-dialogs-energy"; import "./ha-energy-validation-result"; diff --git a/src/panels/config/energy/components/ha-energy-gas-settings.ts b/src/panels/config/energy/components/ha-energy-gas-settings.ts index 28fb946eaf8b..463a0bb2ec16 100644 --- a/src/panels/config/energy/components/ha-energy-gas-settings.ts +++ b/src/panels/config/energy/components/ha-energy-gas-settings.ts @@ -1,28 +1,29 @@ import "@material/mwc-button/mwc-button"; import { mdiDelete, mdiFire, mdiPencil } from "@mdi/js"; -import { CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-card"; import "../../../../components/ha-icon-button"; -import { +import type { EnergyPreferences, EnergyPreferencesValidation, EnergyValidationIssue, GasSourceTypeEnergyPreference, +} from "../../../../data/energy"; +import { getEnergyGasUnitClass, saveEnergyPreferences, } from "../../../../data/energy"; -import { - StatisticsMetaData, - getStatisticLabel, -} from "../../../../data/recorder"; +import type { StatisticsMetaData } from "../../../../data/recorder"; +import { getStatisticLabel } from "../../../../data/recorder"; import { showAlertDialog, showConfirmationDialog, } from "../../../../dialogs/generic/show-dialog-box"; import { haStyle } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; import { documentationUrl } from "../../../../util/documentation-url"; import { showEnergySettingsGasDialog } from "../dialogs/show-dialogs-energy"; import "./ha-energy-validation-result"; diff --git a/src/panels/config/energy/components/ha-energy-grid-settings.ts b/src/panels/config/energy/components/ha-energy-grid-settings.ts index fd8dfa2c9e6b..ae58d2679448 100644 --- a/src/panels/config/energy/components/ha-energy-grid-settings.ts +++ b/src/panels/config/energy/components/ha-energy-grid-settings.ts @@ -6,39 +6,40 @@ import { mdiPencil, mdiTransmissionTower, } from "@mdi/js"; -import { CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-card"; import "../../../../components/ha-icon-button"; +import type { ConfigEntry } from "../../../../data/config_entries"; import { - ConfigEntry, deleteConfigEntry, getConfigEntries, } from "../../../../data/config_entries"; -import { - emptyGridSourceEnergyPreference, +import type { EnergyPreferences, EnergyPreferencesValidation, - energySourcesByType, EnergyValidationIssue, EnergySource, FlowFromGridSourceEnergyPreference, FlowToGridSourceEnergyPreference, GridSourceTypeEnergyPreference, - saveEnergyPreferences, } from "../../../../data/energy"; import { - StatisticsMetaData, - getStatisticLabel, -} from "../../../../data/recorder"; + emptyGridSourceEnergyPreference, + energySourcesByType, + saveEnergyPreferences, +} from "../../../../data/energy"; +import type { StatisticsMetaData } from "../../../../data/recorder"; +import { getStatisticLabel } from "../../../../data/recorder"; import { showConfigFlowDialog } from "../../../../dialogs/config-flow/show-dialog-config-flow"; import { showAlertDialog, showConfirmationDialog, } from "../../../../dialogs/generic/show-dialog-box"; import { haStyle } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; import { brandsUrl } from "../../../../util/brands-url"; import { documentationUrl } from "../../../../util/documentation-url"; import { diff --git a/src/panels/config/energy/components/ha-energy-solar-settings.ts b/src/panels/config/energy/components/ha-energy-solar-settings.ts index 4c03fba64597..9a01fa496255 100644 --- a/src/panels/config/energy/components/ha-energy-solar-settings.ts +++ b/src/panels/config/energy/components/ha-energy-solar-settings.ts @@ -1,28 +1,27 @@ import "@material/mwc-button/mwc-button"; import { mdiDelete, mdiPencil, mdiSolarPower } from "@mdi/js"; -import { CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-card"; import "../../../../components/ha-icon-button"; -import { +import type { EnergyInfo, EnergyPreferences, EnergyPreferencesValidation, EnergyValidationIssue, - saveEnergyPreferences, SolarSourceTypeEnergyPreference, } from "../../../../data/energy"; -import { - StatisticsMetaData, - getStatisticLabel, -} from "../../../../data/recorder"; +import { saveEnergyPreferences } from "../../../../data/energy"; +import type { StatisticsMetaData } from "../../../../data/recorder"; +import { getStatisticLabel } from "../../../../data/recorder"; import { showConfirmationDialog, showAlertDialog, } from "../../../../dialogs/generic/show-dialog-box"; import { haStyle } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; import { documentationUrl } from "../../../../util/documentation-url"; import { showEnergySettingsSolarDialog } from "../dialogs/show-dialogs-energy"; import "./ha-energy-validation-result"; diff --git a/src/panels/config/energy/components/ha-energy-validation-result.ts b/src/panels/config/energy/components/ha-energy-validation-result.ts index 982b50f9bf8b..7166a74ed11d 100644 --- a/src/panels/config/energy/components/ha-energy-validation-result.ts +++ b/src/panels/config/energy/components/ha-energy-validation-result.ts @@ -1,8 +1,8 @@ import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../../components/ha-alert"; -import { EnergyValidationIssue } from "../../../../data/energy"; -import { HomeAssistant } from "../../../../types"; +import type { EnergyValidationIssue } from "../../../../data/energy"; +import type { HomeAssistant } from "../../../../types"; @customElement("ha-energy-validation-result") class EnergyValidationMessage extends LitElement { diff --git a/src/panels/config/energy/components/ha-energy-water-settings.ts b/src/panels/config/energy/components/ha-energy-water-settings.ts index 4cba61de2e5e..ddb1bb911c4b 100644 --- a/src/panels/config/energy/components/ha-energy-water-settings.ts +++ b/src/panels/config/energy/components/ha-energy-water-settings.ts @@ -1,27 +1,26 @@ import "@material/mwc-button/mwc-button"; import { mdiDelete, mdiWater, mdiPencil } from "@mdi/js"; -import { CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-card"; import "../../../../components/ha-icon-button"; -import { +import type { EnergyPreferences, EnergyPreferencesValidation, EnergyValidationIssue, WaterSourceTypeEnergyPreference, - saveEnergyPreferences, } from "../../../../data/energy"; -import { - StatisticsMetaData, - getStatisticLabel, -} from "../../../../data/recorder"; +import { saveEnergyPreferences } from "../../../../data/energy"; +import type { StatisticsMetaData } from "../../../../data/recorder"; +import { getStatisticLabel } from "../../../../data/recorder"; import { showAlertDialog, showConfirmationDialog, } from "../../../../dialogs/generic/show-dialog-box"; import { haStyle } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; import { documentationUrl } from "../../../../util/documentation-url"; import { showEnergySettingsWaterDialog } from "../dialogs/show-dialogs-energy"; import "./ha-energy-validation-result"; diff --git a/src/panels/config/energy/dialogs/dialog-energy-battery-settings.ts b/src/panels/config/energy/dialogs/dialog-energy-battery-settings.ts index b7c9d18a2999..8d808b013cf3 100644 --- a/src/panels/config/energy/dialogs/dialog-energy-battery-settings.ts +++ b/src/panels/config/energy/dialogs/dialog-energy-battery-settings.ts @@ -1,20 +1,21 @@ import "@material/mwc-button/mwc-button"; import { mdiBatteryHigh } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/entity/ha-statistic-picker"; import "../../../../components/ha-dialog"; +import type { BatterySourceTypeEnergyPreference } from "../../../../data/energy"; import { - BatterySourceTypeEnergyPreference, emptyBatteryEnergyPreference, energyStatisticHelpUrl, } from "../../../../data/energy"; import { getSensorDeviceClassConvertibleUnits } from "../../../../data/sensor"; -import { HassDialog } from "../../../../dialogs/make-dialog-manager"; +import type { HassDialog } from "../../../../dialogs/make-dialog-manager"; import { haStyle, haStyleDialog } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; -import { EnergySettingsBatteryDialogParams } from "./show-dialogs-energy"; +import type { HomeAssistant } from "../../../../types"; +import type { EnergySettingsBatteryDialogParams } from "./show-dialogs-energy"; const energyUnitClasses = ["energy"]; diff --git a/src/panels/config/energy/dialogs/dialog-energy-device-settings.ts b/src/panels/config/energy/dialogs/dialog-energy-device-settings.ts index 6066c916e150..3852ea6038fb 100644 --- a/src/panels/config/energy/dialogs/dialog-energy-device-settings.ts +++ b/src/panels/config/energy/dialogs/dialog-energy-device-settings.ts @@ -1,6 +1,7 @@ import "@material/mwc-button/mwc-button"; import { mdiDevices } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/entity/ha-entity-picker"; @@ -8,15 +9,13 @@ import "../../../../components/entity/ha-statistic-picker"; import "../../../../components/ha-dialog"; import "../../../../components/ha-formfield"; import "../../../../components/ha-radio"; -import { - DeviceConsumptionEnergyPreference, - energyStatisticHelpUrl, -} from "../../../../data/energy"; +import type { DeviceConsumptionEnergyPreference } from "../../../../data/energy"; +import { energyStatisticHelpUrl } from "../../../../data/energy"; import { getSensorDeviceClassConvertibleUnits } from "../../../../data/sensor"; -import { HassDialog } from "../../../../dialogs/make-dialog-manager"; +import type { HassDialog } from "../../../../dialogs/make-dialog-manager"; import { haStyleDialog } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; -import { EnergySettingsDeviceDialogParams } from "./show-dialogs-energy"; +import type { HomeAssistant } from "../../../../types"; +import type { EnergySettingsDeviceDialogParams } from "./show-dialogs-energy"; const energyUnitClasses = ["energy"]; diff --git a/src/panels/config/energy/dialogs/dialog-energy-gas-settings.ts b/src/panels/config/energy/dialogs/dialog-energy-gas-settings.ts index ca550ec6d272..c680e0c78ad0 100644 --- a/src/panels/config/energy/dialogs/dialog-energy-gas-settings.ts +++ b/src/panels/config/energy/dialogs/dialog-energy-gas-settings.ts @@ -1,6 +1,7 @@ import "@material/mwc-button/mwc-button"; import { mdiFire } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/entity/ha-entity-picker"; @@ -10,9 +11,9 @@ import "../../../../components/ha-formfield"; import "../../../../components/ha-radio"; import type { HaRadio } from "../../../../components/ha-radio"; import "../../../../components/ha-textfield"; +import type { GasSourceTypeEnergyPreference } from "../../../../data/energy"; import { emptyGasEnergyPreference, - GasSourceTypeEnergyPreference, energyStatisticHelpUrl, } from "../../../../data/energy"; import { @@ -21,10 +22,10 @@ import { isExternalStatistic, } from "../../../../data/recorder"; import { getSensorDeviceClassConvertibleUnits } from "../../../../data/sensor"; -import { HassDialog } from "../../../../dialogs/make-dialog-manager"; +import type { HassDialog } from "../../../../dialogs/make-dialog-manager"; import { haStyle, haStyleDialog } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; -import { EnergySettingsGasDialogParams } from "./show-dialogs-energy"; +import type { HomeAssistant } from "../../../../types"; +import type { EnergySettingsGasDialogParams } from "./show-dialogs-energy"; const gasDeviceClasses = ["gas", "energy"]; const gasUnitClasses = ["volume", "energy"]; diff --git a/src/panels/config/energy/dialogs/dialog-energy-grid-flow-settings.ts b/src/panels/config/energy/dialogs/dialog-energy-grid-flow-settings.ts index 647767d6a296..4564d009da65 100644 --- a/src/panels/config/energy/dialogs/dialog-energy-grid-flow-settings.ts +++ b/src/panels/config/energy/dialogs/dialog-energy-grid-flow-settings.ts @@ -1,6 +1,7 @@ import "@material/mwc-button/mwc-button"; import { mdiTransmissionTower } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/entity/ha-entity-picker"; @@ -9,11 +10,13 @@ import "../../../../components/ha-dialog"; import "../../../../components/ha-formfield"; import "../../../../components/ha-radio"; import type { HaRadio } from "../../../../components/ha-radio"; +import type { + FlowFromGridSourceEnergyPreference, + FlowToGridSourceEnergyPreference, +} from "../../../../data/energy"; import { emptyFlowFromGridSourceEnergyPreference, emptyFlowToGridSourceEnergyPreference, - FlowFromGridSourceEnergyPreference, - FlowToGridSourceEnergyPreference, energyStatisticHelpUrl, } from "../../../../data/energy"; import { @@ -22,10 +25,10 @@ import { isExternalStatistic, } from "../../../../data/recorder"; import { getSensorDeviceClassConvertibleUnits } from "../../../../data/sensor"; -import { HassDialog } from "../../../../dialogs/make-dialog-manager"; +import type { HassDialog } from "../../../../dialogs/make-dialog-manager"; import { haStyleDialog } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; -import { EnergySettingsGridFlowDialogParams } from "./show-dialogs-energy"; +import type { HomeAssistant } from "../../../../types"; +import type { EnergySettingsGridFlowDialogParams } from "./show-dialogs-energy"; const energyUnitClasses = ["energy"]; diff --git a/src/panels/config/energy/dialogs/dialog-energy-solar-settings.ts b/src/panels/config/energy/dialogs/dialog-energy-solar-settings.ts index bb90c6cbfb64..c261337a761c 100644 --- a/src/panels/config/energy/dialogs/dialog-energy-solar-settings.ts +++ b/src/panels/config/energy/dialogs/dialog-energy-solar-settings.ts @@ -1,6 +1,7 @@ import "@material/mwc-button/mwc-button"; import { mdiSolarPower } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/entity/ha-statistic-picker"; @@ -10,19 +11,20 @@ import "../../../../components/ha-dialog"; import "../../../../components/ha-formfield"; import "../../../../components/ha-radio"; import type { HaRadio } from "../../../../components/ha-radio"; -import { ConfigEntry, getConfigEntries } from "../../../../data/config_entries"; +import type { ConfigEntry } from "../../../../data/config_entries"; +import { getConfigEntries } from "../../../../data/config_entries"; +import type { SolarSourceTypeEnergyPreference } from "../../../../data/energy"; import { emptySolarEnergyPreference, - SolarSourceTypeEnergyPreference, energyStatisticHelpUrl, } from "../../../../data/energy"; import { getSensorDeviceClassConvertibleUnits } from "../../../../data/sensor"; import { showConfigFlowDialog } from "../../../../dialogs/config-flow/show-dialog-config-flow"; -import { HassDialog } from "../../../../dialogs/make-dialog-manager"; +import type { HassDialog } from "../../../../dialogs/make-dialog-manager"; import { haStyle, haStyleDialog } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; import { brandsUrl } from "../../../../util/brands-url"; -import { EnergySettingsSolarDialogParams } from "./show-dialogs-energy"; +import type { EnergySettingsSolarDialogParams } from "./show-dialogs-energy"; const energyUnitClasses = ["energy"]; diff --git a/src/panels/config/energy/dialogs/dialog-energy-water-settings.ts b/src/panels/config/energy/dialogs/dialog-energy-water-settings.ts index 895bd63ef44d..0fe89688b2b4 100644 --- a/src/panels/config/energy/dialogs/dialog-energy-water-settings.ts +++ b/src/panels/config/energy/dialogs/dialog-energy-water-settings.ts @@ -1,6 +1,7 @@ import "@material/mwc-button/mwc-button"; import { mdiWater } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/entity/ha-entity-picker"; @@ -10,9 +11,9 @@ import "../../../../components/ha-formfield"; import "../../../../components/ha-radio"; import type { HaRadio } from "../../../../components/ha-radio"; import "../../../../components/ha-textfield"; +import type { WaterSourceTypeEnergyPreference } from "../../../../data/energy"; import { emptyWaterEnergyPreference, - WaterSourceTypeEnergyPreference, energyStatisticHelpUrl, } from "../../../../data/energy"; import { @@ -21,10 +22,10 @@ import { isExternalStatistic, } from "../../../../data/recorder"; import { getSensorDeviceClassConvertibleUnits } from "../../../../data/sensor"; -import { HassDialog } from "../../../../dialogs/make-dialog-manager"; +import type { HassDialog } from "../../../../dialogs/make-dialog-manager"; import { haStyle, haStyleDialog } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; -import { EnergySettingsWaterDialogParams } from "./show-dialogs-energy"; +import type { HomeAssistant } from "../../../../types"; +import type { EnergySettingsWaterDialogParams } from "./show-dialogs-energy"; @customElement("dialog-energy-water-settings") export class DialogEnergyWaterSettings diff --git a/src/panels/config/energy/dialogs/show-dialogs-energy.ts b/src/panels/config/energy/dialogs/show-dialogs-energy.ts index 246ac05c2379..55092f461a9f 100644 --- a/src/panels/config/energy/dialogs/show-dialogs-energy.ts +++ b/src/panels/config/energy/dialogs/show-dialogs-energy.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../../common/dom/fire_event"; -import { +import type { BatterySourceTypeEnergyPreference, DeviceConsumptionEnergyPreference, EnergyGasUnitClass, @@ -11,7 +11,7 @@ import { SolarSourceTypeEnergyPreference, WaterSourceTypeEnergyPreference, } from "../../../../data/energy"; -import { StatisticsMetaData } from "../../../../data/recorder"; +import type { StatisticsMetaData } from "../../../../data/recorder"; export interface EnergySettingsGridFlowDialogParams { source?: diff --git a/src/panels/config/energy/ha-config-energy.ts b/src/panels/config/energy/ha-config-energy.ts index 0d448659c385..05d535e03c1f 100644 --- a/src/panels/config/energy/ha-config-energy.ts +++ b/src/panels/config/energy/ha-config-energy.ts @@ -1,19 +1,20 @@ import "../../../layouts/hass-error-screen"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { +import type { EnergyPreferencesValidation, - getEnergyPreferenceValidation, EnergyInfo, EnergyPreferences, +} from "../../../data/energy"; +import { + getEnergyPreferenceValidation, getEnergyInfo, getEnergyPreferences, getReferencedStatisticIds, } from "../../../data/energy"; -import { - getStatisticMetadata, - StatisticsMetaData, -} from "../../../data/recorder"; +import type { StatisticsMetaData } from "../../../data/recorder"; +import { getStatisticMetadata } from "../../../data/recorder"; import "../../../layouts/hass-loading-screen"; import "../../../layouts/hass-subpage"; import { haStyle } from "../../../resources/styles"; diff --git a/src/panels/config/entities/editor-tabs/settings/entity-settings-helper-tab.ts b/src/panels/config/entities/editor-tabs/settings/entity-settings-helper-tab.ts index 59b425b47d7a..fff779c4e9a1 100644 --- a/src/panels/config/entities/editor-tabs/settings/entity-settings-helper-tab.ts +++ b/src/panels/config/entities/editor-tabs/settings/entity-settings-helper-tab.ts @@ -1,19 +1,11 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { isComponentLoaded } from "../../../../../common/config/is_component_loaded"; import { dynamicElement } from "../../../../../common/dom/dynamic-element-directive"; import { fireEvent } from "../../../../../common/dom/fire_event"; -import { - ExtEntityRegistryEntry, - removeEntityRegistryEntry, -} from "../../../../../data/entity_registry"; +import type { ExtEntityRegistryEntry } from "../../../../../data/entity_registry"; +import { removeEntityRegistryEntry } from "../../../../../data/entity_registry"; import { HELPERS_CRUD } from "../../../../../data/helpers_crud"; import { showConfirmationDialog } from "../../../../../dialogs/generic/show-dialog-box"; import { haStyle } from "../../../../../resources/styles"; @@ -100,8 +92,8 @@ export class EntitySettingsHelperTab extends LitElement { .entry=${this.entry} .disabled=${this._submitting} @change=${this._entityRegistryChanged} - hideName - hideIcon + hide-name + hide-icon >
diff --git a/src/panels/config/entities/entity-registry-settings-editor.ts b/src/panels/config/entities/entity-registry-settings-editor.ts index da34ca591b62..2564842ed786 100644 --- a/src/panels/config/entities/entity-registry-settings-editor.ts +++ b/src/panels/config/entities/entity-registry-settings-editor.ts @@ -1,15 +1,9 @@ import "@material/mwc-button/mwc-button"; import "@material/mwc-formfield/mwc-formfield"; import { mdiContentCopy } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { until } from "lit/directives/until"; import memoizeOne from "memoize-one"; @@ -21,7 +15,7 @@ import { computeObjectId } from "../../../common/entity/compute_object_id"; import { supportsFeature } from "../../../common/entity/supports-feature"; import { formatNumber } from "../../../common/number/format_number"; import { stringCompare } from "../../../common/string/compare"; -import { +import type { LocalizeFunc, LocalizeKeys, } from "../../../common/translations/localize"; @@ -43,28 +37,30 @@ import "../../../components/ha-textfield"; import { CAMERA_ORIENTATIONS, CAMERA_SUPPORT_STREAM, - CameraPreferences, + type CameraPreferences, + fetchCameraCapabilities, fetchCameraPrefs, STREAM_TYPE_HLS, updateCameraPrefs, } from "../../../data/camera"; -import { ConfigEntry, deleteConfigEntry } from "../../../data/config_entries"; +import type { ConfigEntry } from "../../../data/config_entries"; +import { deleteConfigEntry } from "../../../data/config_entries"; import { createConfigFlow, handleConfigFlowStep, } from "../../../data/config_flow"; -import { DataEntryFlowStepCreateEntry } from "../../../data/data_entry_flow"; -import { - DeviceRegistryEntry, - updateDeviceRegistryEntry, -} from "../../../data/device_registry"; -import { +import type { DataEntryFlowStepCreateEntry } from "../../../data/data_entry_flow"; +import type { DeviceRegistryEntry } from "../../../data/device_registry"; +import { updateDeviceRegistryEntry } from "../../../data/device_registry"; +import type { AlarmControlPanelEntityOptions, EntityRegistryEntry, EntityRegistryEntryUpdateParams, ExtEntityRegistryEntry, LockEntityOptions, SensorEntityOptions, +} from "../../../data/entity_registry"; +import { subscribeEntityRegistry, updateEntityRegistryEntry, } from "../../../data/entity_registry"; @@ -82,10 +78,8 @@ import { getSensorDeviceClassConvertibleUnits, getSensorNumericDeviceClasses, } from "../../../data/sensor"; -import { - getWeatherConvertibleUnits, - WeatherUnits, -} from "../../../data/weather"; +import type { WeatherUnits } from "../../../data/weather"; +import { getWeatherConvertibleUnits } from "../../../data/weather"; import { showOptionsFlowDialog } from "../../../dialogs/config-flow/show-dialog-options-flow"; import { showAlertDialog, @@ -145,9 +139,9 @@ export class EntityRegistrySettingsEditor extends LitElement { @property({ type: Object }) public entry!: ExtEntityRegistryEntry; - @property({ type: Boolean }) public hideName = false; + @property({ type: Boolean, attribute: "hide-name" }) public hideName = false; - @property({ type: Boolean }) public hideIcon = false; + @property({ type: Boolean, attribute: "hide-icon" }) public hideIcon = false; @property({ type: Boolean }) public disabled = false; @@ -236,13 +230,7 @@ export class EntityRegistrySettingsEditor extends LitElement { if (domain === "camera" && isComponentLoaded(this.hass, "stream")) { const stateObj: HassEntity | undefined = this.hass.states[this.entry.entity_id]; - if ( - stateObj && - supportsFeature(stateObj, CAMERA_SUPPORT_STREAM) && - // The stream component for HLS streams supports a server-side pre-load - // option that client initiated WebRTC streams do not - stateObj.attributes.frontend_stream_type === STREAM_TYPE_HLS - ) { + if (stateObj && supportsFeature(stateObj, CAMERA_SUPPORT_STREAM)) { this._fetchCameraPrefs(); } } @@ -1396,6 +1384,19 @@ export class EntityRegistrySettingsEditor extends LitElement { } private async _fetchCameraPrefs() { + const capabilities = await fetchCameraCapabilities( + this.hass, + this.entry.entity_id + ); + + // The stream component for HLS streams supports a server-side pre-load + // option that client initiated WebRTC streams do not + + if (!capabilities.frontend_stream_types.includes(STREAM_TYPE_HLS)) { + this._cameraPrefs = undefined; + return; + } + this._cameraPrefs = await fetchCameraPrefs(this.hass, this.entry.entity_id); } diff --git a/src/panels/config/entities/entity-registry-settings.ts b/src/panels/config/entities/entity-registry-settings.ts index 875dbabda93f..a4e98a7fd447 100644 --- a/src/panels/config/entities/entity-registry-settings.ts +++ b/src/panels/config/entities/entity-registry-settings.ts @@ -1,19 +1,20 @@ import "@material/mwc-button/mwc-button"; import "@material/mwc-formfield/mwc-formfield"; import "@material/mwc-list/mwc-list-item"; -import { HassEntity } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import "../../../components/ha-alert"; +import type { ConfigEntry } from "../../../data/config_entries"; import { - ConfigEntry, deleteConfigEntry, getConfigEntry, } from "../../../data/config_entries"; import { updateDeviceRegistryEntry } from "../../../data/device_registry"; +import type { ExtEntityRegistryEntry } from "../../../data/entity_registry"; import { - ExtEntityRegistryEntry, removeEntityRegistryEntry, updateEntityRegistryEntry, } from "../../../data/entity_registry"; diff --git a/src/panels/config/entities/ha-config-entities.ts b/src/panels/config/entities/ha-config-entities.ts index 1859f5578d75..3e175b0558d7 100644 --- a/src/panels/config/entities/ha-config-entities.ts +++ b/src/panels/config/entities/ha-config-entities.ts @@ -15,15 +15,9 @@ import { mdiToggleSwitch, mdiToggleSwitchOffOutline, } from "@mdi/js"; -import { HassEntity, UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { HassEntity, UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { styleMap } from "lit/directives/style-map"; @@ -38,7 +32,7 @@ import { PROTOCOL_INTEGRATIONS, protocolIntegrationPicked, } from "../../../common/integrations/protocolIntegrationPicked"; -import { LocalizeFunc } from "../../../common/translations/localize"; +import type { LocalizeFunc } from "../../../common/translations/localize"; import { hasRejectedItems, rejectedItems, @@ -65,27 +59,28 @@ import "../../../components/ha-icon-button"; import "../../../components/ha-md-menu-item"; import "../../../components/ha-sub-menu"; import "../../../components/ha-svg-icon"; -import { ConfigEntry, getConfigEntries } from "../../../data/config_entries"; +import type { ConfigEntry } from "../../../data/config_entries"; +import { getConfigEntries } from "../../../data/config_entries"; import { fullEntitiesContext } from "../../../data/context"; -import { +import type { DataTableFiltersItems, DataTableFiltersValues, } from "../../../data/data_table_filters"; import { UNAVAILABLE } from "../../../data/entity"; -import { +import type { EntityRegistryEntry, UpdateEntityRegistryEntryResult, +} from "../../../data/entity_registry"; +import { computeEntityRegistryName, removeEntityRegistryEntry, updateEntityRegistryEntry, } from "../../../data/entity_registry"; -import { - EntitySources, - fetchEntitySourcesWithCache, -} from "../../../data/entity_sources"; +import type { EntitySources } from "../../../data/entity_sources"; +import { fetchEntitySourcesWithCache } from "../../../data/entity_sources"; import { domainToName } from "../../../data/integration"; +import type { LabelRegistryEntry } from "../../../data/label_registry"; import { - LabelRegistryEntry, createLabelRegistryEntry, subscribeLabelRegistry, } from "../../../data/label_registry"; diff --git a/src/panels/config/ha-panel-config.ts b/src/panels/config/ha-panel-config.ts index 8bdfcd042494..391f89418485 100644 --- a/src/panels/config/ha-panel-config.ts +++ b/src/panels/config/ha-panel-config.ts @@ -29,12 +29,13 @@ import { mdiUpdate, mdiViewDashboard, } from "@mdi/js"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { PropertyValues } from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { PropertyValues } from "lit"; import { customElement, property, state } from "lit/decorators"; import { isComponentLoaded } from "../../common/config/is_component_loaded"; import { listenMediaQuery } from "../../common/dom/media_query"; -import { CloudStatus, fetchCloudStatus } from "../../data/cloud"; +import type { CloudStatus } from "../../data/cloud"; +import { fetchCloudStatus } from "../../data/cloud"; import { fullEntitiesContext, labelsContext } from "../../data/context"; import { entityRegistryByEntityId, @@ -42,10 +43,11 @@ import { subscribeEntityRegistry, } from "../../data/entity_registry"; import { subscribeLabelRegistry } from "../../data/label_registry"; -import { HassRouterPage, RouterOptions } from "../../layouts/hass-router-page"; -import { PageNavigation } from "../../layouts/hass-tabs-subpage"; +import type { RouterOptions } from "../../layouts/hass-router-page"; +import { HassRouterPage } from "../../layouts/hass-router-page"; +import type { PageNavigation } from "../../layouts/hass-tabs-subpage"; import { SubscribeMixin } from "../../mixins/subscribe-mixin"; -import { HomeAssistant, Route } from "../../types"; +import type { HomeAssistant, Route } from "../../types"; declare global { // for fire event diff --git a/src/panels/config/hardware/dialog-hardware-available.ts b/src/panels/config/hardware/dialog-hardware-available.ts index 3dfd60236733..0509bef4bb4a 100644 --- a/src/panels/config/hardware/dialog-hardware-available.ts +++ b/src/panels/config/hardware/dialog-hardware-available.ts @@ -1,6 +1,7 @@ import { mdiClose } from "@mdi/js"; import { dump } from "js-yaml"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../common/dom/fire_event"; @@ -10,10 +11,8 @@ import "../../../components/ha-expansion-panel"; import "../../../components/ha-icon-next"; import "../../../components/search-input"; import { extractApiErrorMessage } from "../../../data/hassio/common"; -import { - fetchHassioHardwareInfo, - HassioHardwareInfo, -} from "../../../data/hassio/hardware"; +import type { HassioHardwareInfo } from "../../../data/hassio/hardware"; +import { fetchHassioHardwareInfo } from "../../../data/hassio/hardware"; import { showAlertDialog } from "../../../dialogs/generic/show-dialog-box"; import type { HassDialog } from "../../../dialogs/make-dialog-manager"; import { haStyle, haStyleDialog } from "../../../resources/styles"; diff --git a/src/panels/config/hardware/ha-config-hardware.ts b/src/panels/config/hardware/ha-config-hardware.ts index dbfc2ddffae6..b4ebbb4afd7b 100644 --- a/src/panels/config/hardware/ha-config-hardware.ts +++ b/src/panels/config/hardware/ha-config-hardware.ts @@ -2,8 +2,9 @@ import "@material/mwc-list/mwc-list"; import "@material/mwc-list/mwc-list-item"; import { mdiPower } from "@mdi/js"; import type { ChartOptions } from "chart.js"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, html, LitElement, nothing, PropertyValues } from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import { numberFormatToLocale } from "../../../common/number/format_number"; @@ -17,19 +18,15 @@ import "../../../components/ha-clickable-list-item"; import "../../../components/ha-icon-button"; import "../../../components/ha-icon-next"; import "../../../components/ha-settings-row"; -import { - ConfigEntry, - subscribeConfigEntries, -} from "../../../data/config_entries"; -import { - BOARD_NAMES, +import type { ConfigEntry } from "../../../data/config_entries"; +import { subscribeConfigEntries } from "../../../data/config_entries"; +import type { HardwareInfo, SystemStatusStreamMessage, } from "../../../data/hardware"; -import { - fetchHassioHassOsInfo, - HassioHassOSInfo, -} from "../../../data/hassio/host"; +import { BOARD_NAMES } from "../../../data/hardware"; +import type { HassioHassOSInfo } from "../../../data/hassio/host"; +import { fetchHassioHassOsInfo } from "../../../data/hassio/host"; import { scanUSBDevices } from "../../../data/usb"; import { showOptionsFlowDialog } from "../../../dialogs/config-flow/show-dialog-options-flow"; import { showRestartDialog } from "../../../dialogs/restart/show-dialog-restart"; diff --git a/src/panels/config/helpers/dialog-helper-detail.ts b/src/panels/config/helpers/dialog-helper-detail.ts index 537874fd33af..7bce02c8a373 100644 --- a/src/panels/config/helpers/dialog-helper-detail.ts +++ b/src/panels/config/helpers/dialog-helper-detail.ts @@ -1,14 +1,8 @@ import "@material/mwc-button/mwc-button"; -import { RequestSelectedDetail } from "@material/mwc-list/mwc-list-item-base"; +import type { RequestSelectedDetail } from "@material/mwc-list/mwc-list-item-base"; import "@lrnwebcomponents/simple-tooltip/simple-tooltip"; -import { - css, - CSSResultGroup, - html, - LitElement, - TemplateResult, - nothing, -} from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; @@ -33,9 +27,10 @@ import { createSchedule } from "../../../data/schedule"; import { createTimer } from "../../../data/timer"; import { showConfigFlowDialog } from "../../../dialogs/config-flow/show-dialog-config-flow"; import { haStyleDialog } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { brandsUrl } from "../../../util/brands-url"; -import { Helper, HelperDomain, isHelperDomain } from "./const"; +import type { Helper, HelperDomain } from "./const"; +import { isHelperDomain } from "./const"; import type { ShowDialogHelperDetailParams } from "./show-dialog-helper-detail"; type HelperCreators = { diff --git a/src/panels/config/helpers/forms/dialog-schedule-block-info.ts b/src/panels/config/helpers/forms/dialog-schedule-block-info.ts index 1e1ddce46700..7063e57ab2a8 100644 --- a/src/panels/config/helpers/forms/dialog-schedule-block-info.ts +++ b/src/panels/config/helpers/forms/dialog-schedule-block-info.ts @@ -1,12 +1,13 @@ -import { CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { html, LitElement, nothing } from "lit"; import { property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import { createCloseHeading } from "../../../../components/ha-dialog"; import "../../../../components/ha-form/ha-form"; import "../../../../components/ha-button"; import { haStyleDialog } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; -import { +import type { HomeAssistant } from "../../../../types"; +import type { ScheduleBlockInfo, ScheduleBlockInfoDialogParams, } from "./show-dialog-schedule-block-info"; diff --git a/src/panels/config/helpers/forms/ha-counter-form.ts b/src/panels/config/helpers/forms/ha-counter-form.ts index 2fb3b049cba3..e0f2e76e4b24 100644 --- a/src/panels/config/helpers/forms/ha-counter-form.ts +++ b/src/panels/config/helpers/forms/ha-counter-form.ts @@ -1,13 +1,14 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-icon-picker"; import "../../../../components/ha-switch"; import type { HaSwitch } from "../../../../components/ha-switch"; import "../../../../components/ha-textfield"; -import { Counter } from "../../../../data/counter"; +import type { Counter } from "../../../../data/counter"; import { haStyle } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; @customElement("ha-counter-form") class HaCounterForm extends LitElement { diff --git a/src/panels/config/helpers/forms/ha-input_boolean-form.ts b/src/panels/config/helpers/forms/ha-input_boolean-form.ts index 65583023507f..51291300ae16 100644 --- a/src/panels/config/helpers/forms/ha-input_boolean-form.ts +++ b/src/panels/config/helpers/forms/ha-input_boolean-form.ts @@ -1,11 +1,12 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-icon-picker"; import "../../../../components/ha-textfield"; -import { InputBoolean } from "../../../../data/input_boolean"; +import type { InputBoolean } from "../../../../data/input_boolean"; import { haStyle } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; @customElement("ha-input_boolean-form") class HaInputBooleanForm extends LitElement { diff --git a/src/panels/config/helpers/forms/ha-input_button-form.ts b/src/panels/config/helpers/forms/ha-input_button-form.ts index e02fbf35e272..3ab2addb8690 100644 --- a/src/panels/config/helpers/forms/ha-input_button-form.ts +++ b/src/panels/config/helpers/forms/ha-input_button-form.ts @@ -1,11 +1,12 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-icon-picker"; import "../../../../components/ha-textfield"; -import { InputButton } from "../../../../data/input_button"; +import type { InputButton } from "../../../../data/input_button"; import { haStyle } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; @customElement("ha-input_button-form") class HaInputButtonForm extends LitElement { diff --git a/src/panels/config/helpers/forms/ha-input_datetime-form.ts b/src/panels/config/helpers/forms/ha-input_datetime-form.ts index 6210bfcfe705..23056b4adeec 100644 --- a/src/panels/config/helpers/forms/ha-input_datetime-form.ts +++ b/src/panels/config/helpers/forms/ha-input_datetime-form.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-formfield"; @@ -6,9 +7,9 @@ import "../../../../components/ha-icon-picker"; import "../../../../components/ha-radio"; import type { HaRadio } from "../../../../components/ha-radio"; import "../../../../components/ha-textfield"; -import { InputDateTime } from "../../../../data/input_datetime"; +import type { InputDateTime } from "../../../../data/input_datetime"; import { haStyle } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; @customElement("ha-input_datetime-form") class HaInputDateTimeForm extends LitElement { diff --git a/src/panels/config/helpers/forms/ha-input_number-form.ts b/src/panels/config/helpers/forms/ha-input_number-form.ts index 461c2b96df24..9987525b59de 100644 --- a/src/panels/config/helpers/forms/ha-input_number-form.ts +++ b/src/panels/config/helpers/forms/ha-input_number-form.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-formfield"; @@ -6,9 +7,9 @@ import "../../../../components/ha-icon-picker"; import "../../../../components/ha-radio"; import type { HaRadio } from "../../../../components/ha-radio"; import "../../../../components/ha-textfield"; -import { InputNumber } from "../../../../data/input_number"; +import type { InputNumber } from "../../../../data/input_number"; import { haStyle } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; @customElement("ha-input_number-form") class HaInputNumberForm extends LitElement { diff --git a/src/panels/config/helpers/forms/ha-input_select-form.ts b/src/panels/config/helpers/forms/ha-input_select-form.ts index 47ebdc6e32ec..213e80a18b04 100644 --- a/src/panels/config/helpers/forms/ha-input_select-form.ts +++ b/src/panels/config/helpers/forms/ha-input_select-form.ts @@ -1,6 +1,7 @@ import "@material/mwc-list/mwc-list"; import { mdiDelete, mdiDrag } from "@mdi/js"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { repeat } from "lit/directives/repeat"; import { fireEvent } from "../../../../common/dom/fire_event"; diff --git a/src/panels/config/helpers/forms/ha-input_text-form.ts b/src/panels/config/helpers/forms/ha-input_text-form.ts index aa46c28f89d2..be979fab0ce3 100644 --- a/src/panels/config/helpers/forms/ha-input_text-form.ts +++ b/src/panels/config/helpers/forms/ha-input_text-form.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-form/ha-form"; @@ -7,9 +8,9 @@ import "../../../../components/ha-icon-picker"; import "../../../../components/ha-radio"; import type { HaRadio } from "../../../../components/ha-radio"; import "../../../../components/ha-textfield"; -import { InputText } from "../../../../data/input_text"; +import type { InputText } from "../../../../data/input_text"; import { haStyle } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; @customElement("ha-input_text-form") class HaInputTextForm extends LitElement { diff --git a/src/panels/config/helpers/forms/ha-schedule-form.ts b/src/panels/config/helpers/forms/ha-schedule-form.ts index c6adbbc4ace2..0d0549b1a64b 100644 --- a/src/panels/config/helpers/forms/ha-schedule-form.ts +++ b/src/panels/config/helpers/forms/ha-schedule-form.ts @@ -1,16 +1,12 @@ -import { Calendar, CalendarOptions } from "@fullcalendar/core"; +import type { CalendarOptions } from "@fullcalendar/core"; +import { Calendar } from "@fullcalendar/core"; import allLocales from "@fullcalendar/core/locales-all"; import interactionPlugin from "@fullcalendar/interaction"; import timeGridPlugin from "@fullcalendar/timegrid"; -import { Day, addDays, isSameDay, isSameWeek, nextDay } from "date-fns"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { Day } from "date-fns"; +import { addDays, isSameDay, isSameWeek, nextDay } from "date-fns"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { firstWeekdayIndex } from "../../../../common/datetime/first_weekday"; import { formatTime24h } from "../../../../common/datetime/format_time"; @@ -18,11 +14,12 @@ import { useAmPm } from "../../../../common/datetime/use_am_pm"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-icon-picker"; import "../../../../components/ha-textfield"; -import { Schedule, ScheduleDay, weekdays } from "../../../../data/schedule"; +import type { Schedule, ScheduleDay } from "../../../../data/schedule"; +import { weekdays } from "../../../../data/schedule"; import { TimeZone } from "../../../../data/translation"; import { showScheduleBlockInfoDialog } from "./show-dialog-schedule-block-info"; import { haStyle } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; const defaultFullCalendarConfig: CalendarOptions = { plugins: [timeGridPlugin, interactionPlugin], diff --git a/src/panels/config/helpers/forms/ha-timer-form.ts b/src/panels/config/helpers/forms/ha-timer-form.ts index c6f9a87ef7ee..d5d8a43762d9 100644 --- a/src/panels/config/helpers/forms/ha-timer-form.ts +++ b/src/panels/config/helpers/forms/ha-timer-form.ts @@ -1,13 +1,14 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-checkbox"; import "../../../../components/ha-formfield"; import "../../../../components/ha-icon-picker"; import "../../../../components/ha-textfield"; -import { DurationDict, Timer } from "../../../../data/timer"; +import type { DurationDict, Timer } from "../../../../data/timer"; import { haStyle } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; @customElement("ha-timer-form") class HaTimerForm extends LitElement { diff --git a/src/panels/config/helpers/ha-config-helpers.ts b/src/panels/config/helpers/ha-config-helpers.ts index 43f08bd16438..e73060c6f386 100644 --- a/src/panels/config/helpers/ha-config-helpers.ts +++ b/src/panels/config/helpers/ha-config-helpers.ts @@ -11,24 +11,17 @@ import { mdiPlus, mdiTag, } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { computeCssColor } from "../../../common/color/compute-color"; import { storage } from "../../../common/decorators/storage"; -import { HASSDomEvent } from "../../../common/dom/fire_event"; +import type { HASSDomEvent } from "../../../common/dom/fire_event"; import { computeStateDomain } from "../../../common/entity/compute_state_domain"; import { navigate } from "../../../common/navigate"; -import { +import type { LocalizeFunc, LocalizeKeys, } from "../../../common/translations/localize"; @@ -37,7 +30,7 @@ import { hasRejectedItems, rejectedItems, } from "../../../common/util/promise-all-settled-results"; -import { +import type { DataTableColumnContainer, RowClickedEvent, SelectionChangedEvent, @@ -55,36 +48,36 @@ import "../../../components/ha-icon-overflow-menu"; import "../../../components/ha-md-divider"; import "../../../components/ha-state-icon"; import "../../../components/ha-svg-icon"; +import type { CategoryRegistryEntry } from "../../../data/category_registry"; import { - CategoryRegistryEntry, createCategoryRegistryEntry, subscribeCategoryRegistry, } from "../../../data/category_registry"; -import { - ConfigEntry, - subscribeConfigEntries, -} from "../../../data/config_entries"; +import type { ConfigEntry } from "../../../data/config_entries"; +import { subscribeConfigEntries } from "../../../data/config_entries"; import { getConfigFlowHandlers } from "../../../data/config_flow"; import { fullEntitiesContext } from "../../../data/context"; -import { +import type { DataTableFiltersItems, DataTableFiltersValues, } from "../../../data/data_table_filters"; -import { +import type { EntityRegistryEntry, UpdateEntityRegistryEntryResult, +} from "../../../data/entity_registry"; +import { subscribeEntityRegistry, updateEntityRegistryEntry, } from "../../../data/entity_registry"; import { fetchEntitySourcesWithCache } from "../../../data/entity_sources"; +import type { IntegrationManifest } from "../../../data/integration"; import { - IntegrationManifest, domainToName, fetchIntegrationManifest, fetchIntegrationManifests, } from "../../../data/integration"; +import type { LabelRegistryEntry } from "../../../data/label_registry"; import { - LabelRegistryEntry, createLabelRegistryEntry, subscribeLabelRegistry, } from "../../../data/label_registry"; @@ -99,7 +92,7 @@ import "../../../layouts/hass-loading-screen"; import "../../../layouts/hass-tabs-subpage-data-table"; import { SubscribeMixin } from "../../../mixins/subscribe-mixin"; import { haStyle } from "../../../resources/styles"; -import { HomeAssistant, Route } from "../../../types"; +import type { HomeAssistant, Route } from "../../../types"; import { showAssignCategoryDialog } from "../category/show-dialog-assign-category"; import { showCategoryRegistryDetailDialog } from "../category/show-dialog-category-registry-detail"; import { configSections } from "../ha-panel-config"; diff --git a/src/panels/config/info/ha-config-info.ts b/src/panels/config/info/ha-config-info.ts index c4c49f3197e3..5deb9bd585a4 100644 --- a/src/panels/config/info/ha-config-info.ts +++ b/src/panels/config/info/ha-config-info.ts @@ -7,24 +7,17 @@ import { mdiNewspaperVariant, mdiTshirtCrew, } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import "../../../components/ha-card"; import "../../../components/ha-clickable-list-item"; import "../../../components/ha-logo-svg"; -import { - HassioHassOSInfo, - fetchHassioHassOsInfo, -} from "../../../data/hassio/host"; -import { HassioInfo, fetchHassioInfo } from "../../../data/hassio/supervisor"; +import type { HassioHassOSInfo } from "../../../data/hassio/host"; +import { fetchHassioHassOsInfo } from "../../../data/hassio/host"; +import type { HassioInfo } from "../../../data/hassio/supervisor"; +import { fetchHassioInfo } from "../../../data/hassio/supervisor"; import "../../../layouts/hass-subpage"; import { mdiHomeAssistant } from "../../../resources/home-assistant-logo-svg"; import { haStyle } from "../../../resources/styles"; diff --git a/src/panels/config/integrations/dialog-add-integration.ts b/src/panels/config/integrations/dialog-add-integration.ts index 7ca0810f4fd5..3c0d4f156cc7 100644 --- a/src/panels/config/integrations/dialog-add-integration.ts +++ b/src/panels/config/integrations/dialog-add-integration.ts @@ -1,15 +1,10 @@ import "@material/mwc-button"; import "@material/mwc-list/mwc-list"; -import Fuse, { IFuseOptions } from "fuse.js"; -import { HassConfig } from "home-assistant-js-websocket"; -import { - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { IFuseOptions } from "fuse.js"; +import Fuse from "fuse.js"; +import type { HassConfig } from "home-assistant-js-websocket"; +import type { PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { styleMap } from "lit/directives/style-map"; @@ -22,21 +17,23 @@ import { } from "../../../common/integrations/protocolIntegrationPicked"; import { navigate } from "../../../common/navigate"; import { caseInsensitiveStringCompare } from "../../../common/string/compare"; -import { LocalizeFunc } from "../../../common/translations/localize"; +import type { LocalizeFunc } from "../../../common/translations/localize"; import { createCloseHeading } from "../../../components/ha-dialog"; import "../../../components/ha-icon-button-prev"; import "../../../components/search-input"; import { fetchConfigFlowInProgress } from "../../../data/config_flow"; -import { DataEntryFlowProgress } from "../../../data/data_entry_flow"; +import type { DataEntryFlowProgress } from "../../../data/data_entry_flow"; import { domainToName, fetchIntegrationManifest, } from "../../../data/integration"; -import { +import type { Brand, Brands, Integration, Integrations, +} from "../../../data/integrations"; +import { findIntegration, getIntegrationDescriptions, } from "../../../data/integrations"; @@ -50,10 +47,8 @@ import { loadVirtualizer } from "../../../resources/virtualizer"; import type { HomeAssistant } from "../../../types"; import "./ha-domain-integrations"; import "./ha-integration-list-item"; -import { - AddIntegrationDialogParams, - showYamlIntegrationDialog, -} from "./show-add-integration-dialog"; +import type { AddIntegrationDialogParams } from "./show-add-integration-dialog"; +import { showYamlIntegrationDialog } from "./show-add-integration-dialog"; import { getConfigEntries } from "../../../data/config_entries"; import { stripDiacritics } from "../../../common/string/strip-diacritics"; import { getStripDiacriticsFn } from "../../../util/fuse"; diff --git a/src/panels/config/integrations/dialog-yaml-integration.ts b/src/panels/config/integrations/dialog-yaml-integration.ts index 4e3a6ad152c4..9b2bc818ee82 100644 --- a/src/panels/config/integrations/dialog-yaml-integration.ts +++ b/src/panels/config/integrations/dialog-yaml-integration.ts @@ -1,10 +1,12 @@ import "@material/mwc-button/mwc-button"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { documentationUrl } from "../../../util/documentation-url"; -import { YamlIntegrationDialogParams } from "./show-add-integration-dialog"; +import type { YamlIntegrationDialogParams } from "./show-add-integration-dialog"; +import "../../../components/ha-dialog"; @customElement("dialog-yaml-integration") export class DialogYamlIntegration extends LitElement { diff --git a/src/panels/config/integrations/ha-config-flow-card.ts b/src/panels/config/integrations/ha-config-flow-card.ts index ca546ad7bbd3..fa830aaf4ec1 100644 --- a/src/panels/config/integrations/ha-config-flow-card.ts +++ b/src/panels/config/integrations/ha-config-flow-card.ts @@ -1,5 +1,6 @@ import { mdiBookshelf, mdiCog, mdiDotsVertical, mdiOpenInNew } from "@mdi/js"; -import { LitElement, TemplateResult, css, html } from "lit"; +import type { TemplateResult } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { fireEvent } from "../../../common/dom/fire_event"; diff --git a/src/panels/config/integrations/ha-config-integration-page.ts b/src/panels/config/integrations/ha-config-integration-page.ts index 881279cd7ee0..7031bc991d33 100644 --- a/src/panels/config/integrations/ha-config-integration-page.ts +++ b/src/panels/config/integrations/ha-config-integration-page.ts @@ -25,16 +25,9 @@ import { mdiStopCircleOutline, mdiWrench, } from "@mdi/js"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { until } from "lit/directives/until"; @@ -56,9 +49,11 @@ import { fetchApplicationCredentialsConfigEntry, } from "../../../data/application_credential"; import { getSignedPath } from "../../../data/auth"; -import { +import type { ConfigEntry, DisableConfigEntryResult, +} from "../../../data/config_entries"; +import { ERROR_STATES, RECOVERABLE_STATES, deleteConfigEntry, @@ -69,21 +64,21 @@ import { updateConfigEntry, } from "../../../data/config_entries"; import { ATTENTION_SOURCES } from "../../../data/config_flow"; -import { DeviceRegistryEntry } from "../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../data/device_registry"; +import type { DiagnosticInfo } from "../../../data/diagnostics"; import { - DiagnosticInfo, fetchDiagnosticHandler, getConfigEntryDiagnosticsDownloadUrl, } from "../../../data/diagnostics"; -import { - EntityRegistryEntry, - subscribeEntityRegistry, -} from "../../../data/entity_registry"; +import type { EntityRegistryEntry } from "../../../data/entity_registry"; +import { subscribeEntityRegistry } from "../../../data/entity_registry"; import { fetchEntitySourcesWithCache } from "../../../data/entity_sources"; import { getErrorLogDownloadUrl } from "../../../data/error_log"; -import { +import type { IntegrationLogInfo, IntegrationManifest, +} from "../../../data/integration"; +import { LogSeverity, domainToName, fetchIntegrationManifest, @@ -104,11 +99,11 @@ import "../../../layouts/hass-error-screen"; import "../../../layouts/hass-subpage"; import { SubscribeMixin } from "../../../mixins/subscribe-mixin"; import { haStyle } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { brandsUrl } from "../../../util/brands-url"; import { documentationUrl } from "../../../util/documentation-url"; import { fileDownload } from "../../../util/file_download"; -import { DataEntryFlowProgressExtended } from "./ha-config-integrations"; +import type { DataEntryFlowProgressExtended } from "./ha-config-integrations"; import { showAddIntegrationDialog } from "./show-add-integration-dialog"; @customElement("ha-config-integration-page") diff --git a/src/panels/config/integrations/ha-config-integrations-dashboard.ts b/src/panels/config/integrations/ha-config-integrations-dashboard.ts index bdb1dce7190a..af99da864d11 100644 --- a/src/panels/config/integrations/ha-config-integrations-dashboard.ts +++ b/src/panels/config/integrations/ha-config-integrations-dashboard.ts @@ -1,16 +1,10 @@ -import { ActionDetail } from "@material/mwc-list"; +import type { ActionDetail } from "@material/mwc-list"; import { mdiFilterVariant, mdiPlus } from "@mdi/js"; import type { IFuseOptions } from "fuse.js"; import Fuse from "fuse.js"; import type { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import memoizeOne from "memoize-one"; @@ -32,16 +26,17 @@ import "../../../components/ha-icon-button"; import "../../../components/ha-svg-icon"; import "../../../components/search-input"; import "../../../components/search-input-outlined"; -import { ConfigEntry, getConfigEntries } from "../../../data/config_entries"; +import type { ConfigEntry } from "../../../data/config_entries"; +import { getConfigEntries } from "../../../data/config_entries"; import { getConfigFlowInProgressCollection } from "../../../data/config_flow"; import { fetchDiagnosticHandlers } from "../../../data/diagnostics"; -import { - EntityRegistryEntry, - subscribeEntityRegistry, -} from "../../../data/entity_registry"; -import { +import type { EntityRegistryEntry } from "../../../data/entity_registry"; +import { subscribeEntityRegistry } from "../../../data/entity_registry"; +import type { IntegrationLogInfo, IntegrationManifest, +} from "../../../data/integration"; +import { domainToName, fetchIntegrationManifest, fetchIntegrationManifests, @@ -66,7 +61,7 @@ import { getStripDiacriticsFn } from "../../../util/fuse"; import { configSections } from "../ha-panel-config"; import { isHelperDomain } from "../helpers/const"; import "./ha-config-flow-card"; -import { DataEntryFlowProgressExtended } from "./ha-config-integrations"; +import type { DataEntryFlowProgressExtended } from "./ha-config-integrations"; import "./ha-disabled-config-entry-card"; import "./ha-ignored-config-entry-card"; import "./ha-integration-card"; diff --git a/src/panels/config/integrations/ha-config-integrations.ts b/src/panels/config/integrations/ha-config-integrations.ts index 4a80dbb80759..ec43279625a6 100644 --- a/src/panels/config/integrations/ha-config-integrations.ts +++ b/src/panels/config/integrations/ha-config-integrations.ts @@ -1,22 +1,18 @@ -import { PropertyValues } from "lit"; +import type { PropertyValues } from "lit"; import { customElement, property, state } from "lit/decorators"; import { navigate } from "../../../common/navigate"; -import { LocalizeFunc } from "../../../common/translations/localize"; -import { - ConfigEntry, - subscribeConfigEntries, -} from "../../../data/config_entries"; +import type { LocalizeFunc } from "../../../common/translations/localize"; +import type { ConfigEntry } from "../../../data/config_entries"; +import { subscribeConfigEntries } from "../../../data/config_entries"; import { localizeConfigFlowTitle, subscribeConfigFlowInProgress, } from "../../../data/config_flow"; -import { DataEntryFlowProgress } from "../../../data/data_entry_flow"; +import type { DataEntryFlowProgress } from "../../../data/data_entry_flow"; import { domainToName } from "../../../data/integration"; import "../../../layouts/hass-loading-screen"; -import { - HassRouterPage, - RouterOptions, -} from "../../../layouts/hass-router-page"; +import type { RouterOptions } from "../../../layouts/hass-router-page"; +import { HassRouterPage } from "../../../layouts/hass-router-page"; import { SubscribeMixin } from "../../../mixins/subscribe-mixin"; import type { HomeAssistant } from "../../../types"; diff --git a/src/panels/config/integrations/ha-disabled-config-entry-card.ts b/src/panels/config/integrations/ha-disabled-config-entry-card.ts index e18baf434183..6e292e913fcf 100644 --- a/src/panels/config/integrations/ha-disabled-config-entry-card.ts +++ b/src/panels/config/integrations/ha-disabled-config-entry-card.ts @@ -1,11 +1,11 @@ import { mdiCog } from "@mdi/js"; -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../components/ha-button"; -import { - DisableConfigEntryResult, - enableConfigEntry, -} from "../../../data/config_entries"; +import "../../../components/ha-icon-button"; +import type { DisableConfigEntryResult } from "../../../data/config_entries"; +import { enableConfigEntry } from "../../../data/config_entries"; import type { IntegrationManifest } from "../../../data/integration"; import { showAlertDialog } from "../../../dialogs/generic/show-dialog-box"; import type { HomeAssistant } from "../../../types"; diff --git a/src/panels/config/integrations/ha-domain-integrations.ts b/src/panels/config/integrations/ha-domain-integrations.ts index 1e02285c6011..74072d722af5 100644 --- a/src/panels/config/integrations/ha-domain-integrations.ts +++ b/src/panels/config/integrations/ha-domain-integrations.ts @@ -1,4 +1,4 @@ -import { RequestSelectedDetail } from "@material/mwc-list/mwc-list-item-base"; +import type { RequestSelectedDetail } from "@material/mwc-list/mwc-list-item-base"; import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; @@ -11,15 +11,15 @@ import { shouldHandleRequestSelectedEvent } from "../../../common/mwc/handle-req import { navigate } from "../../../common/navigate"; import { caseInsensitiveStringCompare } from "../../../common/string/compare"; import { localizeConfigFlowTitle } from "../../../data/config_flow"; -import { DataEntryFlowProgress } from "../../../data/data_entry_flow"; +import type { DataEntryFlowProgress } from "../../../data/data_entry_flow"; import { domainToName, fetchIntegrationManifest, } from "../../../data/integration"; -import { Brand, Integration } from "../../../data/integrations"; +import type { Brand, Integration } from "../../../data/integrations"; import { showConfigFlowDialog } from "../../../dialogs/config-flow/show-dialog-config-flow"; import { haStyle } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { brandsUrl } from "../../../util/brands-url"; import "./ha-integration-list-item"; import { showYamlIntegrationDialog } from "./show-add-integration-dialog"; diff --git a/src/panels/config/integrations/ha-ignored-config-entry-card.ts b/src/panels/config/integrations/ha-ignored-config-entry-card.ts index 919032207306..dc8f441bd1ad 100644 --- a/src/panels/config/integrations/ha-ignored-config-entry-card.ts +++ b/src/panels/config/integrations/ha-ignored-config-entry-card.ts @@ -1,4 +1,5 @@ -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import { deleteConfigEntry } from "../../../data/config_entries"; diff --git a/src/panels/config/integrations/ha-integration-action-card.ts b/src/panels/config/integrations/ha-integration-action-card.ts index ada2e3b76bb0..c27fd84237db 100644 --- a/src/panels/config/integrations/ha-integration-action-card.ts +++ b/src/panels/config/integrations/ha-integration-action-card.ts @@ -1,4 +1,5 @@ -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { domainToName, diff --git a/src/panels/config/integrations/ha-integration-card.ts b/src/panels/config/integrations/ha-integration-card.ts index ebd92decd3db..171d65983844 100644 --- a/src/panels/config/integrations/ha-integration-card.ts +++ b/src/panels/config/integrations/ha-integration-card.ts @@ -1,13 +1,7 @@ import "@lrnwebcomponents/simple-tooltip/simple-tooltip"; import { mdiFileCodeOutline, mdiPackageVariant, mdiWeb } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; @@ -16,14 +10,15 @@ import "../../../components/ha-button"; import "../../../components/ha-card"; import "../../../components/ha-ripple"; import "../../../components/ha-svg-icon"; -import { ConfigEntry, ERROR_STATES } from "../../../data/config_entries"; +import type { ConfigEntry } from "../../../data/config_entries"; +import { ERROR_STATES } from "../../../data/config_entries"; import type { DeviceRegistryEntry } from "../../../data/device_registry"; import type { EntityRegistryEntry } from "../../../data/entity_registry"; -import { +import type { IntegrationLogInfo, IntegrationManifest, - LogSeverity, } from "../../../data/integration"; +import { LogSeverity } from "../../../data/integration"; import { haStyle } from "../../../resources/styles"; import type { HomeAssistant } from "../../../types"; import type { ConfigEntryExtended } from "./ha-config-integrations"; diff --git a/src/panels/config/integrations/ha-integration-header.ts b/src/panels/config/integrations/ha-integration-header.ts index 9d2d40466ce4..170867109985 100644 --- a/src/panels/config/integrations/ha-integration-header.ts +++ b/src/panels/config/integrations/ha-integration-header.ts @@ -1,10 +1,12 @@ import { mdiAlertCircleOutline, mdiAlertOutline } from "@mdi/js"; -import { LitElement, TemplateResult, css, html, nothing } from "lit"; +import type { TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../components/ha-icon-next"; import "../../../components/ha-svg-icon"; -import { IntegrationManifest, domainToName } from "../../../data/integration"; -import { HomeAssistant } from "../../../types"; +import type { IntegrationManifest } from "../../../data/integration"; +import { domainToName } from "../../../data/integration"; +import type { HomeAssistant } from "../../../types"; import { brandsUrl } from "../../../util/brands-url"; @customElement("ha-integration-header") diff --git a/src/panels/config/integrations/ha-integration-list-item.ts b/src/panels/config/integrations/ha-integration-list-item.ts index dd84112ee083..010d2be645f3 100644 --- a/src/panels/config/integrations/ha-integration-list-item.ts +++ b/src/panels/config/integrations/ha-integration-list-item.ts @@ -1,16 +1,17 @@ -import { - GraphicType, - ListItemBase, -} from "@material/mwc-list/mwc-list-item-base"; +import type { GraphicType } from "@material/mwc-list/mwc-list-item-base"; +import { ListItemBase } from "@material/mwc-list/mwc-list-item-base"; import { styles } from "@material/mwc-list/mwc-list-item.css"; import { mdiFileCodeOutline, mdiPackageVariant, mdiWeb } from "@mdi/js"; -import { css, CSSResultGroup, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { domainToName } from "../../../data/integration"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { brandsUrl } from "../../../util/brands-url"; -import { IntegrationListItem } from "./dialog-add-integration"; +import type { IntegrationListItem } from "./dialog-add-integration"; +import "../../../components/ha-svg-icon"; +import "../../../components/ha-icon-next"; @customElement("ha-integration-list-item") export class HaIntegrationListItem extends ListItemBase { diff --git a/src/panels/config/integrations/integration-panels/matter/dialog-matter-add-device.ts b/src/panels/config/integrations/integration-panels/matter/dialog-matter-add-device.ts index 55a5165ffd4b..a5d2fb8edece 100644 --- a/src/panels/config/integrations/integration-panels/matter/dialog-matter-add-device.ts +++ b/src/panels/config/integrations/integration-panels/matter/dialog-matter-add-device.ts @@ -1,5 +1,5 @@ import { mdiClose } from "@mdi/js"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { dynamicElement } from "../../../../../common/dom/dynamic-element-directive"; @@ -7,12 +7,14 @@ import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-dialog-header"; import "../../../../../components/ha-icon-button"; import "../../../../../components/ha-icon-button-arrow-prev"; +import "../../../../../components/ha-button"; +import "../../../../../components/ha-dialog"; import { commissionMatterDevice, redirectOnNewMatterDevice, } from "../../../../../data/matter"; import { haStyleDialog } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; +import type { HomeAssistant } from "../../../../../types"; import "./matter-add-device/matter-add-device-apple-home"; import "./matter-add-device/matter-add-device-existing"; import "./matter-add-device/matter-add-device-generic"; diff --git a/src/panels/config/integrations/integration-panels/matter/dialog-matter-manage-fabrics.ts b/src/panels/config/integrations/integration-panels/matter/dialog-matter-manage-fabrics.ts index 21cf8ed4917f..9e81f43926fc 100644 --- a/src/panels/config/integrations/integration-panels/matter/dialog-matter-manage-fabrics.ts +++ b/src/panels/config/integrations/integration-panels/matter/dialog-matter-manage-fabrics.ts @@ -1,14 +1,19 @@ +import "@material/mwc-list/mwc-list"; import "@material/mwc-button/mwc-button"; import { mdiDelete } from "@mdi/js"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-circular-progress"; +import "../../../../../components/ha-list-item"; import { createCloseHeading } from "../../../../../components/ha-dialog"; import "../../../../../components/ha-qr-code"; -import { +import type { MatterFabricData, MatterNodeDiagnostics, +} from "../../../../../data/matter"; +import { getMatterNodeDiagnostics, removeMatterFabric, } from "../../../../../data/matter"; @@ -17,8 +22,8 @@ import { showConfirmationDialog, } from "../../../../../dialogs/generic/show-dialog-box"; import { haStyleDialog } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; -import { MatterManageFabricsDialogParams } from "./show-dialog-matter-manage-fabrics"; +import type { HomeAssistant } from "../../../../../types"; +import type { MatterManageFabricsDialogParams } from "./show-dialog-matter-manage-fabrics"; @customElement("dialog-matter-manage-fabrics") class DialogMatterManageFabrics extends LitElement { diff --git a/src/panels/config/integrations/integration-panels/matter/dialog-matter-open-commissioning-window.ts b/src/panels/config/integrations/integration-panels/matter/dialog-matter-open-commissioning-window.ts index a346f4a3c6fb..3b54ce9aa899 100644 --- a/src/panels/config/integrations/integration-panels/matter/dialog-matter-open-commissioning-window.ts +++ b/src/panels/config/integrations/integration-panels/matter/dialog-matter-open-commissioning-window.ts @@ -1,20 +1,19 @@ import "@material/mwc-button/mwc-button"; import { mdiCloseCircle } from "@mdi/js"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-circular-progress"; import { createCloseHeading } from "../../../../../components/ha-dialog"; import "../../../../../components/ha-qr-code"; import { domainToName } from "../../../../../data/integration"; -import { - MatterCommissioningParameters, - openMatterCommissioningWindow, -} from "../../../../../data/matter"; +import type { MatterCommissioningParameters } from "../../../../../data/matter"; +import { openMatterCommissioningWindow } from "../../../../../data/matter"; import { haStyleDialog } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; +import type { HomeAssistant } from "../../../../../types"; import { brandsUrl } from "../../../../../util/brands-url"; -import { MatterOpenCommissioningWindowDialogParams } from "./show-dialog-matter-open-commissioning-window"; +import type { MatterOpenCommissioningWindowDialogParams } from "./show-dialog-matter-open-commissioning-window"; import { copyToClipboard } from "../../../../../common/util/copy-clipboard"; @customElement("dialog-matter-open-commissioning-window") diff --git a/src/panels/config/integrations/integration-panels/matter/dialog-matter-ping-node.ts b/src/panels/config/integrations/integration-panels/matter/dialog-matter-ping-node.ts index 7eac7b39d1dd..dff0a6a89cf2 100644 --- a/src/panels/config/integrations/integration-panels/matter/dialog-matter-ping-node.ts +++ b/src/panels/config/integrations/integration-panels/matter/dialog-matter-ping-node.ts @@ -1,14 +1,17 @@ +import "@material/mwc-list/mwc-list"; import "@material/mwc-button/mwc-button"; import { mdiAlertCircle, mdiCheckCircle, mdiCloseCircle } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-circular-progress"; +import "../../../../../components/ha-list-item"; import { createCloseHeading } from "../../../../../components/ha-dialog"; import { pingMatterNode } from "../../../../../data/matter"; import { haStyle, haStyleDialog } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; -import { MatterPingNodeDialogParams } from "./show-dialog-matter-ping-node"; +import type { HomeAssistant } from "../../../../../types"; +import type { MatterPingNodeDialogParams } from "./show-dialog-matter-ping-node"; @customElement("dialog-matter-ping-node") class DialogMatterPingNode extends LitElement { diff --git a/src/panels/config/integrations/integration-panels/matter/dialog-matter-reinterview-node.ts b/src/panels/config/integrations/integration-panels/matter/dialog-matter-reinterview-node.ts index e6a839192470..eecf994a66ae 100644 --- a/src/panels/config/integrations/integration-panels/matter/dialog-matter-reinterview-node.ts +++ b/src/panels/config/integrations/integration-panels/matter/dialog-matter-reinterview-node.ts @@ -1,14 +1,15 @@ import "@material/mwc-button/mwc-button"; import { mdiCheckCircle, mdiCloseCircle } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-circular-progress"; import { createCloseHeading } from "../../../../../components/ha-dialog"; import { interviewMatterNode } from "../../../../../data/matter"; import { haStyleDialog } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; -import { MatterReinterviewNodeDialogParams } from "./show-dialog-matter-reinterview-node"; +import type { HomeAssistant } from "../../../../../types"; +import type { MatterReinterviewNodeDialogParams } from "./show-dialog-matter-reinterview-node"; @customElement("dialog-matter-reinterview-node") class DialogMatterReinterviewNode extends LitElement { diff --git a/src/panels/config/integrations/integration-panels/matter/matter-add-device.ts b/src/panels/config/integrations/integration-panels/matter/matter-add-device.ts index f2cdb9fda670..c677c680aadd 100644 --- a/src/panels/config/integrations/integration-panels/matter/matter-add-device.ts +++ b/src/panels/config/integrations/integration-panels/matter/matter-add-device.ts @@ -1,7 +1,7 @@ /* eslint-disable lit/lifecycle-super */ import { customElement } from "lit/decorators"; import { navigate } from "../../../../../common/navigate"; -import { HomeAssistant } from "../../../../../types"; +import type { HomeAssistant } from "../../../../../types"; import { showMatterAddDeviceDialog } from "./show-dialog-add-matter-device"; @customElement("matter-add-device") diff --git a/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-apple-home.ts b/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-apple-home.ts index 15e4c4d58b9d..5a0c564e81dc 100644 --- a/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-apple-home.ts +++ b/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-apple-home.ts @@ -4,7 +4,8 @@ import { fireEvent } from "../../../../../../common/dom/fire_event"; import "../../../../../../components/ha-icon-next"; import "../../../../../../components/ha-md-list-item"; import "../../../../../../components/ha-md-list"; -import { HomeAssistant } from "../../../../../../types"; +import "../../../../../../components/ha-textfield"; +import type { HomeAssistant } from "../../../../../../types"; import { sharedStyles } from "./matter-add-device-shared-styles"; @customElement("matter-add-device-apple-home") diff --git a/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-commissioning.ts b/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-commissioning.ts index b7825e117488..4d38d8a694f6 100644 --- a/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-commissioning.ts +++ b/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-commissioning.ts @@ -1,6 +1,6 @@ import { LitElement, css, html } from "lit"; import { customElement, property } from "lit/decorators"; -import { HomeAssistant } from "../../../../../../types"; +import type { HomeAssistant } from "../../../../../../types"; import { sharedStyles } from "./matter-add-device-shared-styles"; import "../../../../../../components/ha-circular-progress"; diff --git a/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-existing.ts b/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-existing.ts index 55263bd76add..685ecc91e18b 100644 --- a/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-existing.ts +++ b/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-existing.ts @@ -5,8 +5,8 @@ import { fireEvent } from "../../../../../../common/dom/fire_event"; import "../../../../../../components/ha-icon-next"; import "../../../../../../components/ha-md-list-item"; import "../../../../../../components/ha-md-list"; -import { HomeAssistant } from "../../../../../../types"; -import { MatterAddDeviceStep } from "../dialog-matter-add-device"; +import type { HomeAssistant } from "../../../../../../types"; +import type { MatterAddDeviceStep } from "../dialog-matter-add-device"; import { sharedStyles } from "./matter-add-device-shared-styles"; @customElement("matter-add-device-existing") diff --git a/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-generic.ts b/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-generic.ts index a00e4d3f3369..242bae51e26a 100644 --- a/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-generic.ts +++ b/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-generic.ts @@ -4,7 +4,8 @@ import { fireEvent } from "../../../../../../common/dom/fire_event"; import "../../../../../../components/ha-icon-next"; import "../../../../../../components/ha-md-list-item"; import "../../../../../../components/ha-md-list"; -import { HomeAssistant } from "../../../../../../types"; +import "../../../../../../components/ha-textfield"; +import type { HomeAssistant } from "../../../../../../types"; import { sharedStyles } from "./matter-add-device-shared-styles"; @customElement("matter-add-device-generic") diff --git a/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-google-home-fallback.ts b/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-google-home-fallback.ts index 2bfa12e7305a..887fff894d0e 100644 --- a/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-google-home-fallback.ts +++ b/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-google-home-fallback.ts @@ -4,7 +4,8 @@ import { fireEvent } from "../../../../../../common/dom/fire_event"; import "../../../../../../components/ha-icon-next"; import "../../../../../../components/ha-md-list-item"; import "../../../../../../components/ha-md-list"; -import { HomeAssistant } from "../../../../../../types"; +import "../../../../../../components/ha-textfield"; +import type { HomeAssistant } from "../../../../../../types"; import { sharedStyles } from "./matter-add-device-shared-styles"; @customElement("matter-add-device-google-home-fallback") diff --git a/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-google-home.ts b/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-google-home.ts index ad8b66639357..3f1834ea1c90 100644 --- a/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-google-home.ts +++ b/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-google-home.ts @@ -4,7 +4,7 @@ import { fireEvent } from "../../../../../../common/dom/fire_event"; import "../../../../../../components/ha-icon-next"; import "../../../../../../components/ha-md-list-item"; import "../../../../../../components/ha-md-list"; -import { HomeAssistant } from "../../../../../../types"; +import type { HomeAssistant } from "../../../../../../types"; import { sharedStyles } from "./matter-add-device-shared-styles"; @customElement("matter-add-device-google-home") diff --git a/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-main.ts b/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-main.ts index 4fb5adca9550..528a776459b0 100644 --- a/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-main.ts +++ b/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-main.ts @@ -4,7 +4,7 @@ import { fireEvent } from "../../../../../../common/dom/fire_event"; import "../../../../../../components/ha-icon-next"; import "../../../../../../components/ha-md-list-item"; import "../../../../../../components/ha-md-list"; -import { HomeAssistant } from "../../../../../../types"; +import type { HomeAssistant } from "../../../../../../types"; import { sharedStyles } from "./matter-add-device-shared-styles"; @customElement("matter-add-device-main") diff --git a/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-new.ts b/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-new.ts index f273c4f6854f..e870c8551c37 100644 --- a/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-new.ts +++ b/src/panels/config/integrations/integration-panels/matter/matter-add-device/matter-add-device-new.ts @@ -5,7 +5,7 @@ import { canCommissionMatterExternal, startExternalCommissioning, } from "../../../../../../data/matter"; -import { HomeAssistant } from "../../../../../../types"; +import type { HomeAssistant } from "../../../../../../types"; import { sharedStyles } from "./matter-add-device-shared-styles"; @customElement("matter-add-device-new") diff --git a/src/panels/config/integrations/integration-panels/matter/matter-config-dashboard.ts b/src/panels/config/integrations/integration-panels/matter/matter-config-dashboard.ts index b2ec29a42314..e98845fed6a5 100644 --- a/src/panels/config/integrations/integration-panels/matter/matter-config-dashboard.ts +++ b/src/panels/config/integrations/integration-panels/matter/matter-config-dashboard.ts @@ -1,6 +1,7 @@ import "@material/mwc-button"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, html, LitElement, TemplateResult } from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { isComponentLoaded } from "../../../../../common/config/is_component_loaded"; import "../../../../../components/ha-alert"; @@ -17,7 +18,7 @@ import { import { showPromptDialog } from "../../../../../dialogs/generic/show-dialog-box"; import "../../../../../layouts/hass-subpage"; import { haStyle } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; +import type { HomeAssistant } from "../../../../../types"; @customElement("matter-config-dashboard") export class MatterConfigDashboard extends LitElement { diff --git a/src/panels/config/integrations/integration-panels/matter/matter-config-panel.ts b/src/panels/config/integrations/integration-panels/matter/matter-config-panel.ts index 22a11152c9d1..92c20a1f5bbd 100644 --- a/src/panels/config/integrations/integration-panels/matter/matter-config-panel.ts +++ b/src/panels/config/integrations/integration-panels/matter/matter-config-panel.ts @@ -1,11 +1,9 @@ import { mdiMathLog, mdiServerNetwork } from "@mdi/js"; import { customElement, property } from "lit/decorators"; -import { - HassRouterPage, - RouterOptions, -} from "../../../../../layouts/hass-router-page"; -import { PageNavigation } from "../../../../../layouts/hass-tabs-subpage"; -import { HomeAssistant } from "../../../../../types"; +import type { RouterOptions } from "../../../../../layouts/hass-router-page"; +import { HassRouterPage } from "../../../../../layouts/hass-router-page"; +import type { PageNavigation } from "../../../../../layouts/hass-tabs-subpage"; +import type { HomeAssistant } from "../../../../../types"; export const configTabs: PageNavigation[] = [ { diff --git a/src/panels/config/integrations/integration-panels/mqtt/mqtt-config-panel.ts b/src/panels/config/integrations/integration-panels/mqtt/mqtt-config-panel.ts index df6cd9b9fd90..6fd6dd861c69 100644 --- a/src/panels/config/integrations/integration-panels/mqtt/mqtt-config-panel.ts +++ b/src/panels/config/integrations/integration-panels/mqtt/mqtt-config-panel.ts @@ -1,5 +1,6 @@ import "@material/mwc-button"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { storage } from "../../../../../common/decorators/storage"; import "../../../../../components/ha-card"; @@ -10,7 +11,7 @@ import { getConfigEntries } from "../../../../../data/config_entries"; import { showOptionsFlowDialog } from "../../../../../dialogs/config-flow/show-dialog-options-flow"; import "../../../../../layouts/hass-subpage"; import { haStyle } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; +import type { HomeAssistant } from "../../../../../types"; import "./mqtt-subscribe-card"; const qosLevel = ["0", "1", "2"]; diff --git a/src/panels/config/integrations/integration-panels/mqtt/mqtt-subscribe-card.ts b/src/panels/config/integrations/integration-panels/mqtt/mqtt-subscribe-card.ts index e5bf058a04f0..93ed666da783 100644 --- a/src/panels/config/integrations/integration-panels/mqtt/mqtt-subscribe-card.ts +++ b/src/panels/config/integrations/integration-panels/mqtt/mqtt-subscribe-card.ts @@ -1,12 +1,14 @@ import "@material/mwc-button"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../../../components/ha-card"; import "../../../../../components/ha-select"; import "../../../../../components/ha-textfield"; import { formatTime } from "../../../../../common/datetime/format_time"; -import { MQTTMessage, subscribeMQTTTopic } from "../../../../../data/mqtt"; -import { HomeAssistant } from "../../../../../types"; +import type { MQTTMessage } from "../../../../../data/mqtt"; +import { subscribeMQTTTopic } from "../../../../../data/mqtt"; +import type { HomeAssistant } from "../../../../../types"; import "@material/mwc-list/mwc-list-item"; import { storage } from "../../../../../common/decorators/storage"; import "../../../../../components/ha-formfield"; diff --git a/src/panels/config/integrations/integration-panels/thread/dialog-thread-dataset.ts b/src/panels/config/integrations/integration-panels/thread/dialog-thread-dataset.ts index cf022e842264..4b2d8028bb37 100644 --- a/src/panels/config/integrations/integration-panels/thread/dialog-thread-dataset.ts +++ b/src/panels/config/integrations/integration-panels/thread/dialog-thread-dataset.ts @@ -1,9 +1,9 @@ import { LitElement, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; -import { HassDialog } from "../../../../../dialogs/make-dialog-manager"; -import { HomeAssistant } from "../../../../../types"; -import { DialogThreadDatasetParams } from "./show-dialog-thread-dataset"; +import type { HassDialog } from "../../../../../dialogs/make-dialog-manager"; +import type { HomeAssistant } from "../../../../../types"; +import type { DialogThreadDatasetParams } from "./show-dialog-thread-dataset"; import { createCloseHeading } from "../../../../../components/ha-dialog"; @customElement("ha-dialog-thread-dataset") diff --git a/src/panels/config/integrations/integration-panels/thread/show-dialog-thread-dataset.ts b/src/panels/config/integrations/integration-panels/thread/show-dialog-thread-dataset.ts index c2be30410710..17748c000fe1 100644 --- a/src/panels/config/integrations/integration-panels/thread/show-dialog-thread-dataset.ts +++ b/src/panels/config/integrations/integration-panels/thread/show-dialog-thread-dataset.ts @@ -1,6 +1,6 @@ import { fireEvent } from "../../../../../common/dom/fire_event"; -import { OTBRInfo } from "../../../../../data/otbr"; -import { ThreadNetwork } from "./thread-config-panel"; +import type { OTBRInfo } from "../../../../../data/otbr"; +import type { ThreadNetwork } from "./thread-config-panel"; export interface DialogThreadDatasetParams { network: ThreadNetwork; diff --git a/src/panels/config/integrations/integration-panels/thread/thread-config-panel.ts b/src/panels/config/integrations/integration-panels/thread/thread-config-panel.ts index 365343067c9f..5308c367fa4d 100644 --- a/src/panels/config/integrations/integration-panels/thread/thread-config-panel.ts +++ b/src/panels/config/integrations/integration-panels/thread/thread-config-panel.ts @@ -1,5 +1,5 @@ import "@material/mwc-button"; -import { ActionDetail } from "@material/mwc-list"; +import type { ActionDetail } from "@material/mwc-list"; import { mdiDeleteOutline, mdiDevices, @@ -7,14 +7,8 @@ import { mdiInformationOutline, mdiCellphoneKey, } from "@mdi/js"; -import { - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { isComponentLoaded } from "../../../../../common/config/is_component_loaded"; @@ -25,17 +19,15 @@ import "../../../../../components/ha-list-item"; import "../../../../../components/ha-card"; import { getSignedPath } from "../../../../../data/auth"; import { getConfigEntryDiagnosticsDownloadUrl } from "../../../../../data/diagnostics"; +import type { OTBRInfo, OTBRInfoDict } from "../../../../../data/otbr"; import { OTBRCreateNetwork, - OTBRInfo, - OTBRInfoDict, OTBRSetChannel, OTBRSetNetwork, getOTBRInfo, } from "../../../../../data/otbr"; +import type { ThreadDataSet, ThreadRouter } from "../../../../../data/thread"; import { - ThreadDataSet, - ThreadRouter, addThreadDataSet, getThreadDataSetTLV, listThreadDataSets, @@ -53,7 +45,7 @@ import { import "../../../../../layouts/hass-subpage"; import { SubscribeMixin } from "../../../../../mixins/subscribe-mixin"; import { haStyle } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; +import type { HomeAssistant } from "../../../../../types"; import { brandsUrl } from "../../../../../util/brands-url"; import { fileDownload } from "../../../../../util/file_download"; import { documentationUrl } from "../../../../../util/documentation-url"; diff --git a/src/panels/config/integrations/integration-panels/zha/dialog-zha-change-channel.ts b/src/panels/config/integrations/integration-panels/zha/dialog-zha-change-channel.ts index cc7a8701cf84..2e5cafb7ac0a 100644 --- a/src/panels/config/integrations/integration-panels/zha/dialog-zha-change-channel.ts +++ b/src/panels/config/integrations/integration-panels/zha/dialog-zha-change-channel.ts @@ -1,18 +1,19 @@ -import { html, LitElement, TemplateResult, nothing } from "lit"; +import type { TemplateResult } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import { stopPropagation } from "../../../../../common/dom/stop_propagation"; -import { HassDialog } from "../../../../../dialogs/make-dialog-manager"; +import type { HassDialog } from "../../../../../dialogs/make-dialog-manager"; import { changeZHANetworkChannel } from "../../../../../data/zha"; import { showAlertDialog } from "../../../../../dialogs/generic/show-dialog-box"; import { createCloseHeading } from "../../../../../components/ha-dialog"; -import { HomeAssistant } from "../../../../../types"; +import type { HomeAssistant } from "../../../../../types"; import "../../../../../components/buttons/ha-progress-button"; import "../../../../../components/ha-alert"; import "../../../../../components/ha-button"; import "../../../../../components/ha-select"; import "../../../../../components/ha-list-item"; -import { ZHAChangeChannelDialogParams } from "./show-dialog-zha-change-channel"; +import type { ZHAChangeChannelDialogParams } from "./show-dialog-zha-change-channel"; const VALID_CHANNELS = [ "auto", diff --git a/src/panels/config/integrations/integration-panels/zha/dialog-zha-manage-zigbee-device.ts b/src/panels/config/integrations/integration-panels/zha/dialog-zha-manage-zigbee-device.ts index f34d32ca2bbd..ce07e1e0664c 100644 --- a/src/panels/config/integrations/integration-panels/zha/dialog-zha-manage-zigbee-device.ts +++ b/src/panels/config/integrations/integration-panels/zha/dialog-zha-manage-zigbee-device.ts @@ -1,14 +1,8 @@ import "@material/mwc-tab-bar/mwc-tab-bar"; import "@material/mwc-tab/mwc-tab"; import { mdiClose } from "@mdi/js"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { cache } from "lit/directives/cache"; import memoizeOne from "memoize-one"; @@ -16,16 +10,12 @@ import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-code-editor"; import "../../../../../components/ha-dialog"; import "../../../../../components/ha-dialog-header"; -import { - fetchBindableDevices, - fetchGroups, - ZHADevice, - ZHAGroup, -} from "../../../../../data/zha"; +import type { ZHADevice, ZHAGroup } from "../../../../../data/zha"; +import { fetchBindableDevices, fetchGroups } from "../../../../../data/zha"; import { haStyleDialog } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; +import type { HomeAssistant } from "../../../../../types"; import { sortZHADevices, sortZHAGroups } from "./functions"; -import { +import type { Tab, ZHAManageZigbeeDeviceDialogParams, } from "./show-dialog-zha-manage-zigbee-device"; diff --git a/src/panels/config/integrations/integration-panels/zha/dialog-zha-reconfigure-device.ts b/src/panels/config/integrations/integration-panels/zha/dialog-zha-reconfigure-device.ts index 26a79ee7007f..4592e3289f90 100644 --- a/src/panels/config/integrations/integration-panels/zha/dialog-zha-reconfigure-device.ts +++ b/src/panels/config/integrations/integration-panels/zha/dialog-zha-reconfigure-device.ts @@ -1,18 +1,21 @@ import "@material/mwc-button/mwc-button"; import "@lrnwebcomponents/simple-tooltip/simple-tooltip"; import { mdiCheckCircle, mdiCloseCircle } from "@mdi/js"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-circular-progress"; import { createCloseHeading } from "../../../../../components/ha-dialog"; import "../../../../../components/ha-svg-icon"; -import { +import type { AttributeConfigurationStatus, Cluster, ClusterConfigurationEvent, ClusterConfigurationStatus, +} from "../../../../../data/zha"; +import { fetchClustersForZhaDevice, reconfigureNode, ZHA_CHANNEL_CFG_DONE, @@ -20,8 +23,8 @@ import { ZHA_CHANNEL_MSG_CFG_RPT, } from "../../../../../data/zha"; import { haStyleDialog } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; -import { ZHAReconfigureDeviceDialogParams } from "./show-dialog-zha-reconfigure-device"; +import type { HomeAssistant } from "../../../../../types"; +import type { ZHAReconfigureDeviceDialogParams } from "./show-dialog-zha-reconfigure-device"; @customElement("dialog-zha-reconfigure-device") class DialogZHAReconfigureDevice extends LitElement { diff --git a/src/panels/config/integrations/integration-panels/zha/functions.ts b/src/panels/config/integrations/integration-panels/zha/functions.ts index dd892df867c5..72108ba9049b 100644 --- a/src/panels/config/integrations/integration-panels/zha/functions.ts +++ b/src/panels/config/integrations/integration-panels/zha/functions.ts @@ -1,4 +1,4 @@ -import { Cluster, ZHADevice, ZHAGroup } from "../../../../../data/zha"; +import type { Cluster, ZHADevice, ZHAGroup } from "../../../../../data/zha"; export const formatAsPaddedHex = (value: string | number): string => { let hex = value; diff --git a/src/panels/config/integrations/integration-panels/zha/show-dialog-zha-manage-zigbee-device.ts b/src/panels/config/integrations/integration-panels/zha/show-dialog-zha-manage-zigbee-device.ts index 259e41dbdb99..74e4b9b4a6df 100644 --- a/src/panels/config/integrations/integration-panels/zha/show-dialog-zha-manage-zigbee-device.ts +++ b/src/panels/config/integrations/integration-panels/zha/show-dialog-zha-manage-zigbee-device.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../../../common/dom/fire_event"; -import { ZHADevice } from "../../../../../data/zha"; +import type { ZHADevice } from "../../../../../data/zha"; export type Tab = "clusters" | "bindings" | "signature" | "neighbors"; diff --git a/src/panels/config/integrations/integration-panels/zha/show-dialog-zha-reconfigure-device.ts b/src/panels/config/integrations/integration-panels/zha/show-dialog-zha-reconfigure-device.ts index 58a06ced057e..e6d1f4eab815 100644 --- a/src/panels/config/integrations/integration-panels/zha/show-dialog-zha-reconfigure-device.ts +++ b/src/panels/config/integrations/integration-panels/zha/show-dialog-zha-reconfigure-device.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../../../common/dom/fire_event"; -import { ZHADevice } from "../../../../../data/zha"; +import type { ZHADevice } from "../../../../../data/zha"; export interface ZHAReconfigureDeviceDialogParams { device: ZHADevice; diff --git a/src/panels/config/integrations/integration-panels/zha/types.ts b/src/panels/config/integrations/integration-panels/zha/types.ts index 17ab77279850..234c013ea551 100644 --- a/src/panels/config/integrations/integration-panels/zha/types.ts +++ b/src/panels/config/integrations/integration-panels/zha/types.ts @@ -1,5 +1,5 @@ -import { HaSelect } from "../../../../../components/ha-select"; -import { ZHADevice } from "../../../../../data/zha"; +import type { HaSelect } from "../../../../../components/ha-select"; +import type { ZHADevice } from "../../../../../data/zha"; export interface ItemSelectedEvent { target?: HaSelect; diff --git a/src/panels/config/integrations/integration-panels/zha/zha-add-devices-page.ts b/src/panels/config/integrations/integration-panels/zha/zha-add-devices-page.ts index 17196aa44709..d619d55905bd 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-add-devices-page.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-add-devices-page.ts @@ -1,22 +1,13 @@ import "@material/mwc-button"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../../../components/ha-circular-progress"; -import { - DEVICE_MESSAGE_TYPES, - LOG_OUTPUT, - ZHADevice, -} from "../../../../../data/zha"; +import type { ZHADevice } from "../../../../../data/zha"; +import { DEVICE_MESSAGE_TYPES, LOG_OUTPUT } from "../../../../../data/zha"; import "../../../../../layouts/hass-tabs-subpage"; import { haStyle } from "../../../../../resources/styles"; -import { HomeAssistant, Route } from "../../../../../types"; +import type { HomeAssistant, Route } from "../../../../../types"; import { documentationUrl } from "../../../../../util/documentation-url"; import { zhaTabs } from "./zha-config-dashboard"; import "./zha-device-pairing-status-card"; diff --git a/src/panels/config/integrations/integration-panels/zha/zha-add-group-page.ts b/src/panels/config/integrations/integration-panels/zha/zha-add-group-page.ts index 2eecfdec6068..08972c4a9022 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-add-group-page.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-add-group-page.ts @@ -1,16 +1,13 @@ import "@material/mwc-button"; -import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state, query } from "lit/decorators"; import type { HASSDomEvent } from "../../../../../common/dom/fire_event"; import { navigate } from "../../../../../common/navigate"; import type { SelectionChangedEvent } from "../../../../../components/data-table/ha-data-table"; import "../../../../../components/ha-circular-progress"; -import { - addGroup, - fetchGroupableDevices, - ZHADeviceEndpoint, - ZHAGroup, -} from "../../../../../data/zha"; +import type { ZHADeviceEndpoint, ZHAGroup } from "../../../../../data/zha"; +import { addGroup, fetchGroupableDevices } from "../../../../../data/zha"; import "../../../../../layouts/hass-subpage"; import type { HomeAssistant } from "../../../../../types"; import "../../../ha-config-section"; diff --git a/src/panels/config/integrations/integration-panels/zha/zha-cluster-attributes.ts b/src/panels/config/integrations/integration-panels/zha/zha-cluster-attributes.ts index 9b628d469961..310c27c40f65 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-cluster-attributes.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-cluster-attributes.ts @@ -1,13 +1,6 @@ import "@material/mwc-list/mwc-list-item"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { stopPropagation } from "../../../../../common/dom/stop_propagation"; import "../../../../../components/buttons/ha-call-service-button"; @@ -16,18 +9,20 @@ import "../../../../../components/ha-card"; import "../../../../../components/ha-select"; import "../../../../../components/ha-textfield"; import { forwardHaptic } from "../../../../../data/haptics"; -import { +import type { Attribute, Cluster, - fetchAttributesForCluster, ReadAttributeServiceData, - readAttributeValue, ZHADevice, } from "../../../../../data/zha"; +import { + fetchAttributesForCluster, + readAttributeValue, +} from "../../../../../data/zha"; import { haStyle } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; +import type { HomeAssistant } from "../../../../../types"; import { formatAsPaddedHex } from "./functions"; -import { ItemSelectedEvent, SetAttributeServiceData } from "./types"; +import type { ItemSelectedEvent, SetAttributeServiceData } from "./types"; @customElement("zha-cluster-attributes") export class ZHAClusterAttributes extends LitElement { diff --git a/src/panels/config/integrations/integration-panels/zha/zha-cluster-commands.ts b/src/panels/config/integrations/integration-panels/zha/zha-cluster-commands.ts index 4ea3417261b6..d8fd55f16bab 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-cluster-commands.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-cluster-commands.ts @@ -1,12 +1,6 @@ import "@material/mwc-list/mwc-list-item"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { property, state } from "lit/decorators"; import { stopPropagation } from "../../../../../common/dom/stop_propagation"; import "../../../../../components/buttons/ha-call-service-button"; @@ -14,16 +8,12 @@ import "../../../../../components/ha-card"; import "../../../../../components/ha-form/ha-form"; import "../../../../../components/ha-select"; import "../../../../../components/ha-textfield"; -import { - Cluster, - Command, - fetchCommandsForCluster, - ZHADevice, -} from "../../../../../data/zha"; +import type { Cluster, Command, ZHADevice } from "../../../../../data/zha"; +import { fetchCommandsForCluster } from "../../../../../data/zha"; import { haStyle } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; +import type { HomeAssistant } from "../../../../../types"; import { formatAsPaddedHex } from "./functions"; -import { IssueCommandServiceData } from "./types"; +import type { IssueCommandServiceData } from "./types"; export class ZHAClusterCommands extends LitElement { @property({ attribute: false }) public hass?: HomeAssistant; diff --git a/src/panels/config/integrations/integration-panels/zha/zha-clusters-data-table.ts b/src/panels/config/integrations/integration-panels/zha/zha-clusters-data-table.ts index 2d9771977151..3f49025398c8 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-clusters-data-table.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-clusters-data-table.ts @@ -1,4 +1,5 @@ -import { html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import memoizeOne from "memoize-one"; import "../../../../../components/data-table/ha-data-table"; diff --git a/src/panels/config/integrations/integration-panels/zha/zha-config-dashboard-router.ts b/src/panels/config/integrations/integration-panels/zha/zha-config-dashboard-router.ts index f3104c8a71eb..995f7337fd79 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-config-dashboard-router.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-config-dashboard-router.ts @@ -1,10 +1,8 @@ import { customElement, property } from "lit/decorators"; import { navigate } from "../../../../../common/navigate"; -import { - HassRouterPage, - RouterOptions, -} from "../../../../../layouts/hass-router-page"; -import { HomeAssistant } from "../../../../../types"; +import type { RouterOptions } from "../../../../../layouts/hass-router-page"; +import { HassRouterPage } from "../../../../../layouts/hass-router-page"; +import type { HomeAssistant } from "../../../../../types"; @customElement("zha-config-dashboard-router") class ZHAConfigDashboardRouter extends HassRouterPage { diff --git a/src/panels/config/integrations/integration-panels/zha/zha-config-dashboard.ts b/src/panels/config/integrations/integration-panels/zha/zha-config-dashboard.ts index a8a7ed8a8c07..d97e449cc20b 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-config-dashboard.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-config-dashboard.ts @@ -6,19 +6,11 @@ import { mdiPlus, mdiPencil, } from "@mdi/js"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { - ConfigEntry, - getConfigEntries, -} from "../../../../../data/config_entries"; +import type { ConfigEntry } from "../../../../../data/config_entries"; +import { getConfigEntries } from "../../../../../data/config_entries"; import "../../../../../components/ha-card"; import "../../../../../components/ha-fab"; import "../../../../../components/ha-icon-button"; @@ -34,14 +26,16 @@ import "../../../../../components/ha-form/ha-form"; import "../../../../../components/buttons/ha-progress-button"; import "../../../../../components/ha-settings-row"; import { showZHAChangeChannelDialog } from "./show-dialog-zha-change-channel"; +import type { + ZHAConfiguration, + ZHANetworkSettings, + ZHANetworkBackupAndMetadata, +} from "../../../../../data/zha"; import { fetchZHAConfiguration, updateZHAConfiguration, - ZHAConfiguration, fetchZHANetworkSettings, createZHANetworkBackup, - ZHANetworkSettings, - ZHANetworkBackupAndMetadata, } from "../../../../../data/zha"; import { showAlertDialog } from "../../../../../dialogs/generic/show-dialog-box"; diff --git a/src/panels/config/integrations/integration-panels/zha/zha-device-binding.ts b/src/panels/config/integrations/integration-panels/zha/zha-device-binding.ts index f39622c9f876..466cfbc49ec9 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-device-binding.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-device-binding.ts @@ -1,21 +1,16 @@ import "@material/mwc-list/mwc-list-item"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { stopPropagation } from "../../../../../common/dom/stop_propagation"; import "../../../../../components/buttons/ha-progress-button"; import "../../../../../components/ha-card"; import "../../../../../components/ha-select"; -import { bindDevices, unbindDevices, ZHADevice } from "../../../../../data/zha"; +import type { ZHADevice } from "../../../../../data/zha"; +import { bindDevices, unbindDevices } from "../../../../../data/zha"; import { haStyle } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; -import { ItemSelectedEvent } from "./types"; +import type { HomeAssistant } from "../../../../../types"; +import type { ItemSelectedEvent } from "./types"; @customElement("zha-device-binding-control") export class ZHADeviceBindingControl extends LitElement { diff --git a/src/panels/config/integrations/integration-panels/zha/zha-device-card.ts b/src/panels/config/integrations/integration-panels/zha/zha-device-card.ts index 78a0ae9ef448..0c411f8ad6d5 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-device-card.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-device-card.ts @@ -1,5 +1,6 @@ -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../../common/dom/fire_event"; @@ -11,17 +12,17 @@ import "../../../../../components/ha-area-picker"; import "../../../../../components/ha-card"; import "../../../../../components/ha-textfield"; import { updateDeviceRegistryEntry } from "../../../../../data/device_registry"; +import type { EntityRegistryEntry } from "../../../../../data/entity_registry"; import { - EntityRegistryEntry, subscribeEntityRegistry, updateEntityRegistryEntry, } from "../../../../../data/entity_registry"; -import { ZHADevice } from "../../../../../data/zha"; +import type { ZHADevice } from "../../../../../data/zha"; import { showAlertDialog } from "../../../../../dialogs/generic/show-dialog-box"; import { SubscribeMixin } from "../../../../../mixins/subscribe-mixin"; import { haStyle } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; -import { EntityRegistryStateEntry } from "../../../devices/ha-config-device-page"; +import type { HomeAssistant } from "../../../../../types"; +import type { EntityRegistryStateEntry } from "../../../devices/ha-config-device-page"; import { getIeeeTail } from "./functions"; @customElement("zha-device-card") diff --git a/src/panels/config/integrations/integration-panels/zha/zha-device-endpoint-data-table.ts b/src/panels/config/integrations/integration-panels/zha/zha-device-endpoint-data-table.ts index 18a265c16c99..1167339198d6 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-device-endpoint-data-table.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-device-endpoint-data-table.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query } from "lit/decorators"; import memoizeOne from "memoize-one"; import "../../../../../components/data-table/ha-data-table"; diff --git a/src/panels/config/integrations/integration-panels/zha/zha-device-neighbors.ts b/src/panels/config/integrations/integration-panels/zha/zha-device-neighbors.ts index 98435bae2704..015dc8ba0fa4 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-device-neighbors.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-device-neighbors.ts @@ -1,4 +1,5 @@ -import { html, LitElement, PropertyValues, nothing } from "lit"; +import type { PropertyValues } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import "../../../../../components/data-table/ha-data-table"; @@ -8,8 +9,9 @@ import type { } from "../../../../../components/data-table/ha-data-table"; import "../../../../../components/ha-circular-progress"; import "../../../../../components/ha-code-editor"; -import { fetchDevices, ZHADevice } from "../../../../../data/zha"; -import { HomeAssistant } from "../../../../../types"; +import type { ZHADevice } from "../../../../../data/zha"; +import { fetchDevices } from "../../../../../data/zha"; +import type { HomeAssistant } from "../../../../../types"; export interface DeviceRowData extends DataTableRowData { id: string; diff --git a/src/panels/config/integrations/integration-panels/zha/zha-device-pairing-status-card.ts b/src/panels/config/integrations/integration-panels/zha/zha-device-pairing-status-card.ts index 1c249d950709..37214af066ec 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-device-pairing-status-card.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-device-pairing-status-card.ts @@ -1,16 +1,17 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import "../../../../../components/ha-card"; +import type { ZHADevice } from "../../../../../data/zha"; import { CONFIGURED, INCOMPLETE_PAIRING_STATUSES, INITIALIZED, INTERVIEW_COMPLETE, - ZHADevice, } from "../../../../../data/zha"; import { haStyle } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; +import type { HomeAssistant } from "../../../../../types"; import { formatAsPaddedHex } from "./functions"; import "./zha-device-card"; diff --git a/src/panels/config/integrations/integration-panels/zha/zha-device-signature.ts b/src/panels/config/integrations/integration-panels/zha/zha-device-signature.ts index cd1675bed929..7ddecd68e585 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-device-signature.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-device-signature.ts @@ -1,8 +1,9 @@ -import { html, LitElement, PropertyValues, nothing } from "lit"; +import type { PropertyValues } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../../../components/ha-code-editor"; -import { ZHADevice } from "../../../../../data/zha"; -import { HomeAssistant } from "../../../../../types"; +import type { ZHADevice } from "../../../../../data/zha"; +import type { HomeAssistant } from "../../../../../types"; @customElement("zha-device-zigbee-info") class ZHADeviceZigbeeInfo extends LitElement { diff --git a/src/panels/config/integrations/integration-panels/zha/zha-group-binding.ts b/src/panels/config/integrations/integration-panels/zha/zha-group-binding.ts index 95e6f07f1d68..33547286d141 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-group-binding.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-group-binding.ts @@ -1,28 +1,21 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state, query } from "lit/decorators"; import type { HASSDomEvent } from "../../../../../common/dom/fire_event"; import { stopPropagation } from "../../../../../common/dom/stop_propagation"; import "../../../../../components/buttons/ha-progress-button"; -import { SelectionChangedEvent } from "../../../../../components/data-table/ha-data-table"; +import type { SelectionChangedEvent } from "../../../../../components/data-table/ha-data-table"; import "../../../../../components/ha-card"; +import "../../../../../components/ha-select"; +import type { Cluster, ZHADevice, ZHAGroup } from "../../../../../data/zha"; import { bindDeviceToGroup, - Cluster, fetchClustersForZhaDevice, unbindDeviceFromGroup, - ZHADevice, - ZHAGroup, } from "../../../../../data/zha"; import { haStyle } from "../../../../../resources/styles"; import type { HomeAssistant } from "../../../../../types"; -import { ItemSelectedEvent } from "./types"; +import type { ItemSelectedEvent } from "./types"; import "./zha-clusters-data-table"; import type { ZHAClustersDataTable } from "./zha-clusters-data-table"; import "@material/mwc-list/mwc-list-item"; diff --git a/src/panels/config/integrations/integration-panels/zha/zha-group-page.ts b/src/panels/config/integrations/integration-panels/zha/zha-group-page.ts index 0216d0a0df4b..ebfca8647e96 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-group-page.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-group-page.ts @@ -1,23 +1,16 @@ import "@material/mwc-button"; import { mdiDelete } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; -import { HASSDomEvent } from "../../../../../common/dom/fire_event"; +import type { HASSDomEvent } from "../../../../../common/dom/fire_event"; import { navigate } from "../../../../../common/navigate"; -import { SelectionChangedEvent } from "../../../../../components/data-table/ha-data-table"; +import type { SelectionChangedEvent } from "../../../../../components/data-table/ha-data-table"; import "../../../../../components/ha-card"; import "../../../../../components/ha-circular-progress"; import "../../../../../components/ha-icon-button"; +import type { ZHADeviceEndpoint, ZHAGroup } from "../../../../../data/zha"; import { - ZHADeviceEndpoint, - ZHAGroup, addMembersToGroup, fetchGroup, fetchGroupableDevices, @@ -26,7 +19,7 @@ import { } from "../../../../../data/zha"; import "../../../../../layouts/hass-error-screen"; import "../../../../../layouts/hass-subpage"; -import { HomeAssistant } from "../../../../../types"; +import type { HomeAssistant } from "../../../../../types"; import "../../../ha-config-section"; import { formatAsPaddedHex } from "./functions"; import "./zha-device-endpoint-data-table"; diff --git a/src/panels/config/integrations/integration-panels/zha/zha-groups-dashboard.ts b/src/panels/config/integrations/integration-panels/zha/zha-groups-dashboard.ts index 31674f6a0576..65affd3e310e 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-groups-dashboard.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-groups-dashboard.ts @@ -1,30 +1,25 @@ import "@material/mwc-button"; import { mdiPlus } from "@mdi/js"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; -import { HASSDomEvent } from "../../../../../common/dom/fire_event"; +import type { HASSDomEvent } from "../../../../../common/dom/fire_event"; import { navigate } from "../../../../../common/navigate"; -import { +import type { DataTableColumnContainer, RowClickedEvent, } from "../../../../../components/data-table/ha-data-table"; import "../../../../../components/ha-fab"; import "../../../../../components/ha-icon-button"; -import { fetchGroups, ZHAGroup } from "../../../../../data/zha"; +import type { ZHAGroup } from "../../../../../data/zha"; +import { fetchGroups } from "../../../../../data/zha"; import "../../../../../layouts/hass-tabs-subpage-data-table"; import { haStyle } from "../../../../../resources/styles"; -import { HomeAssistant, Route } from "../../../../../types"; +import type { HomeAssistant, Route } from "../../../../../types"; import { formatAsPaddedHex, sortZHAGroups } from "./functions"; import { zhaTabs } from "./zha-config-dashboard"; -import { LocalizeFunc } from "../../../../../common/translations/localize"; +import type { LocalizeFunc } from "../../../../../common/translations/localize"; export interface GroupRowData extends ZHAGroup { group?: GroupRowData; diff --git a/src/panels/config/integrations/integration-panels/zha/zha-manage-clusters.ts b/src/panels/config/integrations/integration-panels/zha/zha-manage-clusters.ts index 0efd3f83c19b..5c97ee1c3029 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-manage-clusters.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-manage-clusters.ts @@ -1,26 +1,17 @@ import "@material/mwc-list/mwc-list-item"; import "@material/mwc-tab-bar/mwc-tab-bar"; import "@material/mwc-tab/mwc-tab"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { cache } from "lit/directives/cache"; import { stopPropagation } from "../../../../../common/dom/stop_propagation"; import "../../../../../components/ha-card"; import "../../../../../components/ha-select"; -import { - Cluster, - fetchClustersForZhaDevice, - ZHADevice, -} from "../../../../../data/zha"; +import type { Cluster, ZHADevice } from "../../../../../data/zha"; +import { fetchClustersForZhaDevice } from "../../../../../data/zha"; import { haStyle } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; +import type { HomeAssistant } from "../../../../../types"; import { computeClusterKey } from "./functions"; import "./zha-cluster-attributes"; import "./zha-cluster-commands"; diff --git a/src/panels/config/integrations/integration-panels/zha/zha-network-visualization-page.ts b/src/panels/config/integrations/integration-panels/zha/zha-network-visualization-page.ts index be4f2accee26..5283ae348fbe 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-network-visualization-page.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-network-visualization-page.ts @@ -1,12 +1,9 @@ import "@material/mwc-button"; -import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query, state } from "lit/decorators"; -import { - Edge, - EdgeOptions, - Network, - Node, -} from "vis-network/peer/esm/vis-network"; +import type { Edge, EdgeOptions, Node } from "vis-network/peer/esm/vis-network"; +import { Network } from "vis-network/peer/esm/vis-network"; import { navigate } from "../../../../../common/navigate"; import "../../../../../components/search-input"; import "../../../../../components/device/ha-device-picker"; @@ -14,15 +11,15 @@ import "../../../../../components/ha-button-menu"; import "../../../../../components/ha-checkbox"; import type { HaCheckbox } from "../../../../../components/ha-checkbox"; import "../../../../../components/ha-formfield"; -import { DeviceRegistryEntry } from "../../../../../data/device_registry"; -import { - fetchDevices, - refreshTopology, - ZHADevice, -} from "../../../../../data/zha"; +import type { DeviceRegistryEntry } from "../../../../../data/device_registry"; +import type { ZHADevice } from "../../../../../data/zha"; +import { fetchDevices, refreshTopology } from "../../../../../data/zha"; import "../../../../../layouts/hass-tabs-subpage"; -import { ValueChangedEvent } from "../../../../../types"; -import type { HomeAssistant, Route } from "../../../../../types"; +import type { + ValueChangedEvent, + HomeAssistant, + Route, +} from "../../../../../types"; import { formatAsPaddedHex } from "./functions"; import { zhaTabs } from "./zha-config-dashboard"; diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-add-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-add-node.ts index 8955ff5c162c..ad0d87aaf5ab 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-add-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-add-node.ts @@ -1,7 +1,8 @@ import "@material/mwc-button/mwc-button"; import { mdiAlertCircle, mdiCheckCircle, mdiQrcodeScan } from "@mdi/js"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { fireEvent } from "../../../../../common/dom/fire_event"; @@ -16,12 +17,14 @@ import "../../../../../components/ha-radio"; import "../../../../../components/ha-switch"; import "../../../../../components/ha-textfield"; import type { HaTextField } from "../../../../../components/ha-textfield"; +import type { + QRProvisioningInformation, + RequestedGrant, +} from "../../../../../data/zwave_js"; import { InclusionStrategy, MINIMUM_QR_STRING_LENGTH, provisionZwaveSmartStartNode, - QRProvisioningInformation, - RequestedGrant, SecurityClass, stopZwaveInclusion, subscribeAddZwaveNode, @@ -33,8 +36,8 @@ import { zwaveValidateDskAndEnterPin, } from "../../../../../data/zwave_js"; import { haStyle, haStyleDialog } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; -import { ZWaveJSAddNodeDialogParams } from "./show-dialog-zwave_js-add-node"; +import type { HomeAssistant } from "../../../../../types"; +import type { ZWaveJSAddNodeDialogParams } from "./show-dialog-zwave_js-add-node"; export interface ZWaveJSAddNodeDevice { id: string; @@ -846,7 +849,11 @@ class DialogZWaveJSAddNode extends LitElement { undefined, undefined, dsk - ); + ).catch((err) => { + this._error = err.message; + this._status = "failed"; + return () => {}; + }); this._addNodeTimeoutHandle = window.setTimeout(() => { this._unsubscribe(); this._status = "timed_out"; diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-hard-reset-controller.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-hard-reset-controller.ts index 2c3dd9d81dbf..b5dec3687ea2 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-hard-reset-controller.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-hard-reset-controller.ts @@ -1,14 +1,15 @@ import { mdiCheckCircle, mdiDeleteForever, mdiRestore } from "@mdi/js"; import "@material/mwc-button/mwc-button"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import { createCloseHeading } from "../../../../../components/ha-dialog"; import "../../../../../components/ha-svg-icon"; import { hardResetController } from "../../../../../data/zwave_js"; import { haStyleDialog } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; -import { ZWaveJSHardResetControllerDialogParams } from "./show-dialog-zwave_js-hard-reset-controller"; +import type { HomeAssistant } from "../../../../../types"; +import type { ZWaveJSHardResetControllerDialogParams } from "./show-dialog-zwave_js-hard-reset-controller"; import { showConfirmationDialog } from "../../../../../dialogs/generic/show-dialog-box"; import { navigate } from "../../../../../common/navigate"; diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-node-statistics.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-node-statistics.ts index 3ef7290c4c87..f25d61f54ce5 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-node-statistics.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-node-statistics.ts @@ -1,36 +1,32 @@ import "@material/mwc-list/mwc-list"; import "@material/mwc-list/mwc-list-item"; import { mdiSwapHorizontal } from "@mdi/js"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - TemplateResult, - nothing, -} from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import { createCloseHeading } from "../../../../../components/ha-dialog"; import "../../../../../components/ha-expansion-panel"; import "../../../../../components/ha-help-tooltip"; import "../../../../../components/ha-svg-icon"; +import type { DeviceRegistryEntry } from "../../../../../data/device_registry"; import { computeDeviceName, - DeviceRegistryEntry, subscribeDeviceRegistry, } from "../../../../../data/device_registry"; +import type { + ZWaveJSNodeStatisticsUpdatedMessage, + ZWaveJSRouteStatistics, +} from "../../../../../data/zwave_js"; import { ProtocolDataRate, RssiError, subscribeZwaveNodeStatistics, - ZWaveJSNodeStatisticsUpdatedMessage, - ZWaveJSRouteStatistics, } from "../../../../../data/zwave_js"; import { haStyleDialog } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; -import { ZWaveJSNodeStatisticsDialogParams } from "./show-dialog-zwave_js-node-statistics"; +import type { HomeAssistant } from "../../../../../types"; +import type { ZWaveJSNodeStatisticsDialogParams } from "./show-dialog-zwave_js-node-statistics"; type WorkingRouteStatistics = | (ZWaveJSRouteStatistics & { diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-rebuild-network-routes.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-rebuild-network-routes.ts index 8b8b9c328e75..5714df0d730a 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-rebuild-network-routes.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-rebuild-network-routes.ts @@ -1,22 +1,25 @@ import "@material/mwc-button/mwc-button"; import "@material/mwc-linear-progress/mwc-linear-progress"; import { mdiCheckCircle, mdiCloseCircle, mdiStethoscope } from "@mdi/js"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import { createCloseHeading } from "../../../../../components/ha-dialog"; +import type { + ZWaveJSRebuildRoutesStatusMessage, + ZWaveJSNetwork, +} from "../../../../../data/zwave_js"; import { fetchZwaveNetworkStatus, rebuildZwaveNetworkRoutes, stopRebuildingZwaveNetworkRoutes, subscribeRebuildZwaveNetworkRoutesProgress, - ZWaveJSRebuildRoutesStatusMessage, - ZWaveJSNetwork, } from "../../../../../data/zwave_js"; import { haStyleDialog } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; -import { ZWaveJSRebuildNetworkRoutesDialogParams } from "./show-dialog-zwave_js-rebuild-network-routes"; +import type { HomeAssistant } from "../../../../../types"; +import type { ZWaveJSRebuildNetworkRoutesDialogParams } from "./show-dialog-zwave_js-rebuild-network-routes"; @customElement("dialog-zwave_js-rebuild-network-routes") class DialogZWaveJSRebuildNetworkRoutes extends LitElement { diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-rebuild-node-routes.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-rebuild-node-routes.ts index f6589fd647ee..93245be9b374 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-rebuild-node-routes.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-rebuild-node-routes.ts @@ -1,22 +1,21 @@ import "@material/mwc-button/mwc-button"; import { mdiCheckCircle, mdiCloseCircle, mdiStethoscope } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-circular-progress"; import { createCloseHeading } from "../../../../../components/ha-dialog"; -import { - computeDeviceName, - DeviceRegistryEntry, -} from "../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../data/device_registry"; +import { computeDeviceName } from "../../../../../data/device_registry"; +import type { ZWaveJSNetwork } from "../../../../../data/zwave_js"; import { fetchZwaveNetworkStatus, rebuildZwaveNodeRoutes, - ZWaveJSNetwork, } from "../../../../../data/zwave_js"; import { haStyleDialog } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; -import { ZWaveJSRebuildNodeRoutesDialogParams } from "./show-dialog-zwave_js-rebuild-node-routes"; +import type { HomeAssistant } from "../../../../../types"; +import type { ZWaveJSRebuildNodeRoutesDialogParams } from "./show-dialog-zwave_js-rebuild-node-routes"; @customElement("dialog-zwave_js-rebuild-node-routes") class DialogZWaveJSRebuildNodeRoutes extends LitElement { diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-reinterview-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-reinterview-node.ts index a0b4f8dab437..b017673484c0 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-reinterview-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-reinterview-node.ts @@ -1,15 +1,16 @@ import "@material/mwc-button/mwc-button"; import { mdiCheckCircle, mdiCloseCircle } from "@mdi/js"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-circular-progress"; import { createCloseHeading } from "../../../../../components/ha-dialog"; import { reinterviewZwaveNode } from "../../../../../data/zwave_js"; import { haStyleDialog } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; -import { ZWaveJSReinterviewNodeDialogParams } from "./show-dialog-zwave_js-reinterview-node"; +import type { HomeAssistant } from "../../../../../types"; +import type { ZWaveJSReinterviewNodeDialogParams } from "./show-dialog-zwave_js-reinterview-node"; @customElement("dialog-zwave_js-reinterview-node") class DialogZWaveJSReinterviewNode extends LitElement { diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-failed-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-failed-node.ts index e5246ce40e79..9224871b3764 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-failed-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-failed-node.ts @@ -1,18 +1,17 @@ import "@material/mwc-button/mwc-button"; import { mdiCheckCircle, mdiCloseCircle, mdiRobotDead } from "@mdi/js"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-circular-progress"; import { createCloseHeading } from "../../../../../components/ha-dialog"; -import { - removeFailedZwaveNode, - ZWaveJSRemovedNode, -} from "../../../../../data/zwave_js"; +import type { ZWaveJSRemovedNode } from "../../../../../data/zwave_js"; +import { removeFailedZwaveNode } from "../../../../../data/zwave_js"; import { haStyleDialog } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; -import { ZWaveJSRemoveFailedNodeDialogParams } from "./show-dialog-zwave_js-remove-failed-node"; +import type { HomeAssistant } from "../../../../../types"; +import type { ZWaveJSRemoveFailedNodeDialogParams } from "./show-dialog-zwave_js-remove-failed-node"; @customElement("dialog-zwave_js-remove-failed-node") class DialogZWaveJSRemoveFailedNode extends LitElement { diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-node.ts index 20c885405777..03f7ed50cb42 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-node.ts @@ -1,13 +1,16 @@ import "@material/mwc-button/mwc-button"; import { mdiCheckCircle, mdiCloseCircle } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-circular-progress"; +import "../../../../../components/ha-alert"; import { createCloseHeading } from "../../../../../components/ha-dialog"; import { haStyleDialog } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; -import { ZWaveJSRemoveNodeDialogParams } from "./show-dialog-zwave_js-remove-node"; +import type { HomeAssistant } from "../../../../../types"; +import type { ZWaveJSRemoveNodeDialogParams } from "./show-dialog-zwave_js-remove-node"; export interface ZWaveJSRemovedNode { node_id: number; @@ -25,9 +28,13 @@ class DialogZWaveJSRemoveNode extends LitElement { @state() private _node?: ZWaveJSRemovedNode; + @state() private _removedCallback?: () => void; + private _removeNodeTimeoutHandle?: number; - private _subscribed?: Promise<() => Promise>; + private _subscribed?: Promise; + + @state() private _error?: string; public disconnectedCallback(): void { super.disconnectedCallback(); @@ -38,6 +45,10 @@ class DialogZWaveJSRemoveNode extends LitElement { params: ZWaveJSRemoveNodeDialogParams ): Promise { this.entry_id = params.entry_id; + this._removedCallback = params.removedCallback; + if (params.skipConfirmation) { + this._startExclusion(); + } } protected render() { @@ -67,7 +78,7 @@ class DialogZWaveJSRemoveNode extends LitElement { )} ` - : ``} + : nothing} ${this._status === "started" ? html`
@@ -93,7 +104,7 @@ class DialogZWaveJSRemoveNode extends LitElement { )} ` - : ``} + : nothing} ${this._status === "failed" ? html`
@@ -107,13 +118,18 @@ class DialogZWaveJSRemoveNode extends LitElement { "ui.panel.config.zwave_js.remove_node.exclusion_failed" )}

+ ${this._error + ? html` + ${this._error} + ` + : nothing}
${this.hass.localize("ui.common.close")} ` - : ``} + : nothing} ${this._status === "finished" ? html`
@@ -134,7 +150,7 @@ class DialogZWaveJSRemoveNode extends LitElement { ${this.hass.localize("ui.common.close")} ` - : ``} + : nothing} `; } @@ -143,13 +159,17 @@ class DialogZWaveJSRemoveNode extends LitElement { if (!this.hass) { return; } - this._subscribed = this.hass.connection.subscribeMessage( - (message) => this._handleMessage(message), - { + this._subscribed = this.hass.connection + .subscribeMessage((message) => this._handleMessage(message), { type: "zwave_js/remove_node", entry_id: this.entry_id, - } - ); + }) + .catch((err) => { + this._status = "failed"; + this._error = err.message; + return () => {}; + }); + this._status = "started"; this._removeNodeTimeoutHandle = window.setTimeout( () => this._unsubscribe(), 120000 @@ -174,6 +194,9 @@ class DialogZWaveJSRemoveNode extends LitElement { this._status = "finished"; this._node = message.node; this._unsubscribe(); + if (this._removedCallback) { + this._removedCallback(); + } } } diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-update-firmware-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-update-firmware-node.ts index 511d13cea783..99bd71b7b9bb 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-update-firmware-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-update-firmware-node.ts @@ -1,19 +1,25 @@ import "@material/mwc-button/mwc-button"; import "@material/mwc-linear-progress/mwc-linear-progress"; import { mdiCheckCircle, mdiCloseCircle, mdiFileUpload } from "@mdi/js"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import { createCloseHeading } from "../../../../../components/ha-dialog"; import "../../../../../components/ha-file-upload"; import "../../../../../components/ha-form/ha-form"; -import { HaFormSchema } from "../../../../../components/ha-form/types"; +import type { HaFormSchema } from "../../../../../components/ha-form/types"; import "../../../../../components/ha-svg-icon"; -import { - computeDeviceName, - DeviceRegistryEntry, -} from "../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../data/device_registry"; +import { computeDeviceName } from "../../../../../data/device_registry"; +import type { + ZWaveJSControllerFirmwareUpdateFinishedMessage, + ZWaveJSFirmwareUpdateProgressMessage, + ZWaveJSNodeFirmwareUpdateFinishedMessage, + ZWaveJSNodeStatus, + ZWaveJSNodeStatusUpdatedMessage, +} from "../../../../../data/zwave_js"; import { abortZwaveNodeFirmwareUpdate, ControllerFirmwareUpdateStatus, @@ -24,19 +30,14 @@ import { subscribeZwaveNodeFirmwareUpdate, subscribeZwaveNodeStatus, uploadFirmwareAndBeginUpdate, - ZWaveJSControllerFirmwareUpdateFinishedMessage, - ZWaveJSFirmwareUpdateProgressMessage, - ZWaveJSNodeFirmwareUpdateFinishedMessage, - ZWaveJSNodeStatus, - ZWaveJSNodeStatusUpdatedMessage, } from "../../../../../data/zwave_js"; import { showAlertDialog, showConfirmationDialog, } from "../../../../../dialogs/generic/show-dialog-box"; import { haStyleDialog } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; -import { ZWaveJSUpdateFirmwareNodeDialogParams } from "./show-dialog-zwave_js-update-firmware-node"; +import type { HomeAssistant } from "../../../../../types"; +import type { ZWaveJSUpdateFirmwareNodeDialogParams } from "./show-dialog-zwave_js-update-firmware-node"; const firmwareTargetSchema: HaFormSchema[] = [ { diff --git a/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-node-statistics.ts b/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-node-statistics.ts index ec48d7f02c54..0b684d8f8071 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-node-statistics.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-node-statistics.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../../../common/dom/fire_event"; -import { DeviceRegistryEntry } from "../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../data/device_registry"; export interface ZWaveJSNodeStatisticsDialogParams { device: DeviceRegistryEntry; diff --git a/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-rebuild-node-routes.ts b/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-rebuild-node-routes.ts index 073c19127f6f..724510c1b3d2 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-rebuild-node-routes.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-rebuild-node-routes.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../../../common/dom/fire_event"; -import { DeviceRegistryEntry } from "../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../data/device_registry"; export interface ZWaveJSRebuildNodeRoutesDialogParams { device: DeviceRegistryEntry; diff --git a/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-remove-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-remove-node.ts index ac76e6dbc8e1..ac5fe5b0633f 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-remove-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-remove-node.ts @@ -2,6 +2,8 @@ import { fireEvent } from "../../../../../common/dom/fire_event"; export interface ZWaveJSRemoveNodeDialogParams { entry_id: string; + skipConfirmation?: boolean; + removedCallback?: () => void; } export const loadRemoveNodeDialog = () => diff --git a/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-update-firmware-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-update-firmware-node.ts index ee3efb760eb4..f02385b21f37 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-update-firmware-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/show-dialog-zwave_js-update-firmware-node.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../../../common/dom/fire_event"; -import { DeviceRegistryEntry } from "../../../../../data/device_registry"; +import type { DeviceRegistryEntry } from "../../../../../data/device_registry"; export interface ZWaveJSUpdateFirmwareNodeDialogParams { device: DeviceRegistryEntry; diff --git a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-add-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-add-node.ts index 2a852f2878df..20e7c5a2f593 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-add-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-add-node.ts @@ -1,7 +1,7 @@ /* eslint-disable lit/lifecycle-super */ import { customElement } from "lit/decorators"; import { navigate } from "../../../../../common/navigate"; -import { HomeAssistant } from "../../../../../types"; +import type { HomeAssistant } from "../../../../../types"; import { showZWaveJSAddNodeDialog } from "./show-dialog-zwave_js-add-node"; @customElement("zwave_js-add-node") diff --git a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-config-dashboard.ts b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-config-dashboard.ts index 16f00a7178ac..286cbd2adb9c 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-config-dashboard.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-config-dashboard.ts @@ -7,15 +7,9 @@ import { mdiPlus, mdiRefresh, } from "@mdi/js"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - TemplateResult, - nothing, -} from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import "../../../../../components/ha-card"; @@ -25,24 +19,24 @@ import "../../../../../components/ha-help-tooltip"; import "../../../../../components/ha-icon-button"; import "../../../../../components/ha-icon-next"; import "../../../../../components/ha-svg-icon"; +import type { ConfigEntry } from "../../../../../data/config_entries"; import { - ConfigEntry, ERROR_STATES, getConfigEntries, } from "../../../../../data/config_entries"; +import type { + ZWaveJSClient, + ZWaveJSControllerStatisticsUpdatedMessage, + ZWaveJSNetwork, + ZwaveJSProvisioningEntry, +} from "../../../../../data/zwave_js"; import { fetchZwaveDataCollectionStatus, fetchZwaveNetworkStatus, fetchZwaveProvisioningEntries, InclusionState, setZwaveDataCollectionPreference, - stopZwaveExclusion, - stopZwaveInclusion, subscribeZwaveControllerStatistics, - ZWaveJSClient, - ZWaveJSControllerStatisticsUpdatedMessage, - ZWaveJSNetwork, - ZwaveJSProvisioningEntry, } from "../../../../../data/zwave_js"; import { showOptionsFlowDialog } from "../../../../../dialogs/config-flow/show-dialog-options-flow"; import "../../../../../layouts/hass-tabs-subpage"; @@ -81,9 +75,18 @@ class ZWaveJSConfigDashboard extends SubscribeMixin(LitElement) { @state() private _statistics?: ZWaveJSControllerStatisticsUpdatedMessage; - protected firstUpdated() { + protected async firstUpdated() { if (this.hass) { - this._fetchData(); + await this._fetchData(); + if (this._status === "connected") { + const inclusion_state = this._network?.controller.inclusion_state; + // show dialog if inclusion/exclusion is already in progress + if (inclusion_state === InclusionState.Including) { + this._addNodeClicked(); + } else if (inclusion_state === InclusionState.Excluding) { + this._removeNodeClicked(); + } + } } } @@ -126,31 +129,6 @@ class ZWaveJSConfigDashboard extends SubscribeMixin(LitElement) { .path=${mdiRefresh} .label=${this.hass!.localize("ui.common.refresh")} > - ${this._network && - this._status === "connected" && - (this._network?.controller.inclusion_state === - InclusionState.Including || - this._network?.controller.inclusion_state === - InclusionState.Excluding) - ? html` - - ${this.hass.localize( - `ui.panel.config.zwave_js.common.in_progress_inclusion_exclusion` - )} - - - - ` - : ""} ${this._network ? html` @@ -193,11 +171,11 @@ class ZWaveJSConfigDashboard extends SubscribeMixin(LitElement) { `ui.panel.config.zwave_js.dashboard.not_ready`, { count: notReadyDevices } )})` - : ""} + : nothing}
` - : ``} + : nothing}
@@ -464,7 +442,7 @@ class ZWaveJSConfigDashboard extends SubscribeMixin(LitElement) { ` - : ``} + : nothing} ` - : ""}`; + : nothing}`; } private _handleBack(): void { @@ -593,6 +571,9 @@ class ZWaveJSConfigDashboard extends SubscribeMixin(LitElement) { private async _removeNodeClicked() { showZWaveJSRemoveNodeDialog(this, { entry_id: this.configEntryId!, + skipConfirmation: + this._network?.controller.inclusion_state === InclusionState.Excluding, + removedCallback: () => this._fetchData(), }); } @@ -602,16 +583,6 @@ class ZWaveJSConfigDashboard extends SubscribeMixin(LitElement) { }); } - private async _cancelInclusion() { - stopZwaveInclusion(this.hass!, this.configEntryId!); - await this._fetchData(); - } - - private async _cancelExclusion() { - stopZwaveExclusion(this.hass!, this.configEntryId!); - await this._fetchData(); - } - private _dataCollectionToggled(ev) { setZwaveDataCollectionPreference( this.hass!, diff --git a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-config-router.ts b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-config-router.ts index 15dba45a433f..0666dedf4783 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-config-router.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-config-router.ts @@ -1,12 +1,10 @@ import { mdiServerNetwork, mdiMathLog } from "@mdi/js"; import { customElement, property } from "lit/decorators"; -import { - HassRouterPage, - RouterOptions, -} from "../../../../../layouts/hass-router-page"; -import { HomeAssistant } from "../../../../../types"; +import type { RouterOptions } from "../../../../../layouts/hass-router-page"; +import { HassRouterPage } from "../../../../../layouts/hass-router-page"; +import type { HomeAssistant } from "../../../../../types"; import { navigate } from "../../../../../common/navigate"; -import { PageNavigation } from "../../../../../layouts/hass-tabs-subpage"; +import type { PageNavigation } from "../../../../../layouts/hass-tabs-subpage"; import { getConfigEntries } from "../../../../../data/config_entries"; export const configTabs: PageNavigation[] = [ diff --git a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-logs.ts b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-logs.ts index 4e443e5a97c3..9b9f14194fd2 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-logs.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-logs.ts @@ -1,21 +1,22 @@ import "@material/mwc-list/mwc-list-item"; import { mdiDownload } from "@mdi/js"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultArray, html, LitElement } from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultArray } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { capitalizeFirstLetter } from "../../../../../common/string/capitalize-first-letter"; import "../../../../../components/ha-icon-button"; import "../../../../../components/ha-select"; +import type { ZWaveJSLogConfig } from "../../../../../data/zwave_js"; import { fetchZWaveJSLogConfig, setZWaveJSLogLevel, subscribeZWaveJSLogs, - ZWaveJSLogConfig, } from "../../../../../data/zwave_js"; import "../../../../../layouts/hass-tabs-subpage"; import { SubscribeMixin } from "../../../../../mixins/subscribe-mixin"; import { haStyle } from "../../../../../resources/styles"; -import { HomeAssistant, Route } from "../../../../../types"; +import type { HomeAssistant, Route } from "../../../../../types"; import { fileDownload } from "../../../../../util/file_download"; import { configTabs } from "./zwave_js-config-router"; diff --git a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-node-config.ts b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-node-config.ts index ce216094483c..91be0fa47003 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-node-config.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-node-config.ts @@ -6,15 +6,8 @@ import { mdiCloseCircle, mdiProgressClock, } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { groupBy } from "../../../../../common/util/group-by"; @@ -27,11 +20,13 @@ import "../../../../../components/ha-svg-icon"; import "../../../../../components/ha-textfield"; import "../../../../../components/ha-selector/ha-selector-boolean"; import { computeDeviceName } from "../../../../../data/device_registry"; -import { +import type { ZWaveJSNodeConfigParam, ZWaveJSNodeConfigParams, ZWaveJSSetConfigParamResult, ZwaveJSNodeMetadata, +} from "../../../../../data/zwave_js"; +import { fetchZwaveNodeConfigParameters, fetchZwaveNodeMetadata, setZwaveNodeConfigParameter, diff --git a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-provisioned.ts b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-provisioned.ts index 25a2fe0a8c6d..375fc717bff0 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-provisioned.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-provisioned.ts @@ -2,17 +2,17 @@ import { mdiCheckCircle, mdiCloseCircleOutline, mdiDelete } from "@mdi/js"; import { html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; -import { DataTableColumnContainer } from "../../../../../components/data-table/ha-data-table"; +import type { DataTableColumnContainer } from "../../../../../components/data-table/ha-data-table"; +import type { ZwaveJSProvisioningEntry } from "../../../../../data/zwave_js"; import { - ZwaveJSProvisioningEntry, fetchZwaveProvisioningEntries, SecurityClass, unprovisionZwaveSmartStartNode, } from "../../../../../data/zwave_js"; -import { LocalizeFunc } from "../../../../../common/translations/localize"; +import type { LocalizeFunc } from "../../../../../common/translations/localize"; import { showConfirmationDialog } from "../../../../../dialogs/generic/show-dialog-box"; import "../../../../../layouts/hass-tabs-subpage-data-table"; -import { HomeAssistant, Route } from "../../../../../types"; +import type { HomeAssistant, Route } from "../../../../../types"; import { configTabs } from "./zwave_js-config-router"; @customElement("zwave_js-provisioned") diff --git a/src/panels/config/integrations/show-add-integration-dialog.ts b/src/panels/config/integrations/show-add-integration-dialog.ts index 6fdd6243ac01..83ee10094fbb 100644 --- a/src/panels/config/integrations/show-add-integration-dialog.ts +++ b/src/panels/config/integrations/show-add-integration-dialog.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import { IntegrationManifest } from "../../../data/integration"; +import type { IntegrationManifest } from "../../../data/integration"; export interface AddIntegrationDialogParams { brand?: string; diff --git a/src/panels/config/labels/dialog-label-detail.ts b/src/panels/config/labels/dialog-label-detail.ts index bffc5d79c000..d1ec77c2e36a 100644 --- a/src/panels/config/labels/dialog-label-detail.ts +++ b/src/panels/config/labels/dialog-label-detail.ts @@ -1,5 +1,6 @@ import "@material/mwc-button"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import "../../../components/ha-alert"; @@ -10,11 +11,11 @@ import "../../../components/ha-textfield"; import "../../../components/ha-textarea"; import "../../../components/ha-icon-picker"; import "../../../components/ha-color-picker"; -import { HassDialog } from "../../../dialogs/make-dialog-manager"; +import type { HassDialog } from "../../../dialogs/make-dialog-manager"; import { haStyleDialog } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; -import { LabelDetailDialogParams } from "./show-dialog-label-detail"; -import { +import type { HomeAssistant } from "../../../types"; +import type { LabelDetailDialogParams } from "./show-dialog-label-detail"; +import type { LabelRegistryEntry, LabelRegistryEntryMutableParams, } from "../../../data/label_registry"; diff --git a/src/panels/config/labels/ha-config-labels.ts b/src/panels/config/labels/ha-config-labels.ts index 7d0e60e22d42..1d974bb7a582 100644 --- a/src/panels/config/labels/ha-config-labels.ts +++ b/src/panels/config/labels/ha-config-labels.ts @@ -6,15 +6,16 @@ import { mdiRobot, mdiShape, } from "@mdi/js"; -import { LitElement, PropertyValues, html, nothing } from "lit"; +import type { PropertyValues } from "lit"; +import { LitElement, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { computeCssColor } from "../../../common/color/compute-color"; import { formatShortDateTime } from "../../../common/datetime/format_date_time"; import { storage } from "../../../common/decorators/storage"; import { navigate } from "../../../common/navigate"; -import { LocalizeFunc } from "../../../common/translations/localize"; -import { +import type { LocalizeFunc } from "../../../common/translations/localize"; +import type { DataTableColumnContainer, RowClickedEvent, SortingChangedEvent, @@ -23,9 +24,11 @@ import "../../../components/ha-fab"; import "../../../components/ha-icon-button"; import "../../../components/ha-icon-overflow-menu"; import "../../../components/ha-relative-time"; -import { +import type { LabelRegistryEntry, LabelRegistryEntryMutableParams, +} from "../../../data/label_registry"; +import { createLabelRegistryEntry, deleteLabelRegistryEntry, fetchLabelRegistry, @@ -36,7 +39,7 @@ import { showConfirmationDialog, } from "../../../dialogs/generic/show-dialog-box"; import "../../../layouts/hass-tabs-subpage-data-table"; -import { HomeAssistant, Route } from "../../../types"; +import type { HomeAssistant, Route } from "../../../types"; import { configSections } from "../ha-panel-config"; import { showLabelDetailDialog } from "./show-dialog-label-detail"; diff --git a/src/panels/config/labels/show-dialog-label-detail.ts b/src/panels/config/labels/show-dialog-label-detail.ts index b41586df57c7..a16f8089f4ca 100644 --- a/src/panels/config/labels/show-dialog-label-detail.ts +++ b/src/panels/config/labels/show-dialog-label-detail.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import { +import type { LabelRegistryEntry, LabelRegistryEntryMutableParams, } from "../../../data/label_registry"; diff --git a/src/panels/config/logs/dialog-download-logs.ts b/src/panels/config/logs/dialog-download-logs.ts index fdb5e7242ea4..fdd67e5a315b 100644 --- a/src/panels/config/logs/dialog-download-logs.ts +++ b/src/panels/config/logs/dialog-download-logs.ts @@ -1,15 +1,16 @@ import { mdiClose } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import "../../../components/ha-md-dialog"; import "../../../components/ha-button"; import "../../../components/ha-dialog-header"; import "../../../components/ha-icon-button"; import type { HaMdDialog } from "../../../components/ha-md-dialog"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { haStyle, haStyleDialog } from "../../../resources/styles"; import { fireEvent } from "../../../common/dom/fire_event"; -import { DownloadLogsDialogParams } from "./show-dialog-download-logs"; +import type { DownloadLogsDialogParams } from "./show-dialog-download-logs"; import "../../../components/ha-select"; import "../../../components/ha-list-item"; import { stopPropagation } from "../../../common/dom/stop_propagation"; diff --git a/src/panels/config/logs/dialog-system-log-detail.ts b/src/panels/config/logs/dialog-system-log-detail.ts index 1ea09ae7438a..b31a49ca144a 100644 --- a/src/panels/config/logs/dialog-system-log-detail.ts +++ b/src/panels/config/logs/dialog-system-log-detail.ts @@ -1,6 +1,7 @@ import "@lrnwebcomponents/simple-tooltip/simple-tooltip"; import { mdiClose, mdiContentCopy } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { property, state } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import { copyToClipboard } from "../../../common/util/copy-clipboard"; @@ -9,11 +10,11 @@ import "../../../components/ha-dialog"; import "../../../components/ha-dialog-header"; import "../../../components/ha-icon-button"; import "../../../components/ha-svg-icon"; +import type { IntegrationManifest } from "../../../data/integration"; import { domainToName, fetchIntegrationManifest, integrationIssuesUrl, - IntegrationManifest, } from "../../../data/integration"; import { getLoggedErrorIntegration, diff --git a/src/panels/config/logs/error-log-card.ts b/src/panels/config/logs/error-log-card.ts index ae17a7a16466..b487f07c9549 100644 --- a/src/panels/config/logs/error-log-card.ts +++ b/src/panels/config/logs/error-log-card.ts @@ -7,11 +7,11 @@ import { } from "@mdi/js"; import { css, - CSSResultGroup, + type CSSResultGroup, html, LitElement, - PropertyValues, - TemplateResult, + type PropertyValues, + type TemplateResult, nothing, } from "lit"; import { classMap } from "lit/directives/class-map"; @@ -42,10 +42,10 @@ import { fetchHassioLogsFollow, getHassioLogDownloadUrl, } from "../../../data/hassio/supervisor"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { fileDownload } from "../../../util/file_download"; -import { HASSDomEvent } from "../../../common/dom/fire_event"; -import { ConnectionStatus } from "../../../data/connection-status"; +import type { HASSDomEvent } from "../../../common/dom/fire_event"; +import type { ConnectionStatus } from "../../../data/connection-status"; import { atLeastVersion } from "../../../common/config/version"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import { debounce } from "../../../common/util/debounce"; diff --git a/src/panels/config/logs/ha-config-logs.ts b/src/panels/config/logs/ha-config-logs.ts index 40e0f90b9288..4b15706054c6 100644 --- a/src/panels/config/logs/ha-config-logs.ts +++ b/src/panels/config/logs/ha-config-logs.ts @@ -1,16 +1,17 @@ import { mdiChevronDown } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import { extractSearchParam } from "../../../common/url/search-params"; import "../../../components/ha-button-menu"; import "../../../components/ha-button"; import "../../../components/search-input"; -import { LogProvider } from "../../../data/error_log"; +import type { LogProvider } from "../../../data/error_log"; import { fetchHassioAddonsInfo } from "../../../data/hassio/addon"; import "../../../layouts/hass-subpage"; import { haStyle } from "../../../resources/styles"; -import { HomeAssistant, Route } from "../../../types"; +import type { HomeAssistant, Route } from "../../../types"; import "./error-log-card"; import "./system-log-card"; import type { SystemLogCard } from "./system-log-card"; diff --git a/src/panels/config/logs/show-dialog-system-log-detail.ts b/src/panels/config/logs/show-dialog-system-log-detail.ts index f11e5c8eb303..95a5e247961f 100644 --- a/src/panels/config/logs/show-dialog-system-log-detail.ts +++ b/src/panels/config/logs/show-dialog-system-log-detail.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import { LoggedError } from "../../../data/system_log"; +import type { LoggedError } from "../../../data/system_log"; declare global { // for fire event diff --git a/src/panels/config/logs/system-log-card.ts b/src/panels/config/logs/system-log-card.ts index cba54b0f9e16..1e1a9d12c120 100644 --- a/src/panels/config/logs/system-log-card.ts +++ b/src/panels/config/logs/system-log-card.ts @@ -1,9 +1,10 @@ import { mdiRefresh } from "@mdi/js"; import "@material/mwc-list/mwc-list"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; -import { LocalizeFunc } from "../../../common/translations/localize"; +import type { LocalizeFunc } from "../../../common/translations/localize"; import "../../../components/buttons/ha-call-service-button"; import "../../../components/buttons/ha-progress-button"; import "../../../components/ha-card"; @@ -11,13 +12,13 @@ import "../../../components/ha-circular-progress"; import "../../../components/ha-icon-button"; import "../../../components/ha-list-item"; import { domainToName } from "../../../data/integration"; +import type { LoggedError } from "../../../data/system_log"; import { fetchSystemLog, getLoggedErrorIntegration, isCustomIntegrationError, - LoggedError, } from "../../../data/system_log"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { showSystemLogDetailDialog } from "./show-dialog-system-log-detail"; import { formatSystemLogTime } from "./util"; diff --git a/src/panels/config/logs/util.ts b/src/panels/config/logs/util.ts index 4cf0d7f704ef..f32f4ca703e7 100644 --- a/src/panels/config/logs/util.ts +++ b/src/panels/config/logs/util.ts @@ -1,7 +1,7 @@ -import { HassConfig } from "home-assistant-js-websocket"; +import type { HassConfig } from "home-assistant-js-websocket"; import { formatDateTimeWithSeconds } from "../../../common/datetime/format_date_time"; import { formatTimeWithSeconds } from "../../../common/datetime/format_time"; -import { FrontendLocaleData } from "../../../data/translation"; +import type { FrontendLocaleData } from "../../../data/translation"; export const formatSystemLogTime = ( date, diff --git a/src/panels/config/lovelace/dashboards/dialog-lovelace-dashboard-configure-strategy.ts b/src/panels/config/lovelace/dashboards/dialog-lovelace-dashboard-configure-strategy.ts index 2509438daae7..76ff6712646d 100644 --- a/src/panels/config/lovelace/dashboards/dialog-lovelace-dashboard-configure-strategy.ts +++ b/src/panels/config/lovelace/dashboards/dialog-lovelace-dashboard-configure-strategy.ts @@ -1,14 +1,15 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-button"; import { createCloseHeading } from "../../../../components/ha-dialog"; import "../../../../components/ha-form/ha-form"; -import { LovelaceStrategyConfig } from "../../../../data/lovelace/config/strategy"; +import type { LovelaceStrategyConfig } from "../../../../data/lovelace/config/strategy"; import { haStyleDialog } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; import "../../../lovelace/editor/dashboard-strategy-editor/hui-dashboard-strategy-element-editor"; -import { LovelaceDashboardConfigureStrategyDialogParams } from "./show-dialog-lovelace-dashboard-configure-strategy"; +import type { LovelaceDashboardConfigureStrategyDialogParams } from "./show-dialog-lovelace-dashboard-configure-strategy"; @customElement("dialog-lovelace-dashboard-configure-strategy") export class DialogLovelaceDashboardDetail extends LitElement { diff --git a/src/panels/config/lovelace/dashboards/dialog-lovelace-dashboard-detail.ts b/src/panels/config/lovelace/dashboards/dialog-lovelace-dashboard-detail.ts index 7e00f7c9575c..bceec4d6a829 100644 --- a/src/panels/config/lovelace/dashboards/dialog-lovelace-dashboard-detail.ts +++ b/src/panels/config/lovelace/dashboards/dialog-lovelace-dashboard-detail.ts @@ -1,22 +1,23 @@ import "@material/mwc-button/mwc-button"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../common/dom/fire_event"; import { slugify } from "../../../../common/string/slugify"; import { createCloseHeading } from "../../../../components/ha-dialog"; import "../../../../components/ha-form/ha-form"; -import { SchemaUnion } from "../../../../components/ha-form/types"; -import { CoreFrontendUserData } from "../../../../data/frontend"; -import { +import type { SchemaUnion } from "../../../../components/ha-form/types"; +import type { CoreFrontendUserData } from "../../../../data/frontend"; +import type { LovelaceDashboard, LovelaceDashboardCreateParams, LovelaceDashboardMutableParams, } from "../../../../data/lovelace/dashboard"; import { DEFAULT_PANEL, setDefaultPanel } from "../../../../data/panel"; import { haStyleDialog } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; -import { LovelaceDashboardDetailsDialogParams } from "./show-dialog-lovelace-dashboard-detail"; +import type { HomeAssistant } from "../../../../types"; +import type { LovelaceDashboardDetailsDialogParams } from "./show-dialog-lovelace-dashboard-detail"; @customElement("dialog-lovelace-dashboard-detail") export class DialogLovelaceDashboardDetail extends LitElement { diff --git a/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts b/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts index cdcab2a89997..782097949fc5 100644 --- a/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts +++ b/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts @@ -6,14 +6,15 @@ import { mdiOpenInNew, mdiPlus, } from "@mdi/js"; -import { LitElement, PropertyValues, html, nothing } from "lit"; +import type { PropertyValues } from "lit"; +import { LitElement, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import memoize from "memoize-one"; import { isComponentLoaded } from "../../../../common/config/is_component_loaded"; import { navigate } from "../../../../common/navigate"; import { stringCompare } from "../../../../common/string/compare"; -import { +import type { DataTableColumnContainer, RowClickedEvent, SortingChangedEvent, @@ -23,15 +24,17 @@ import "../../../../components/ha-fab"; import "../../../../components/ha-icon"; import "../../../../components/ha-icon-button"; import "../../../../components/ha-svg-icon"; -import { LovelacePanelConfig } from "../../../../data/lovelace"; +import type { LovelacePanelConfig } from "../../../../data/lovelace"; +import type { LovelaceRawConfig } from "../../../../data/lovelace/config/types"; import { - LovelaceRawConfig, isStrategyDashboard, saveConfig, } from "../../../../data/lovelace/config/types"; -import { +import type { LovelaceDashboard, LovelaceDashboardCreateParams, +} from "../../../../data/lovelace/dashboard"; +import { createDashboard, deleteDashboard, fetchDashboards, @@ -40,8 +43,8 @@ import { import { showConfirmationDialog } from "../../../../dialogs/generic/show-dialog-box"; import "../../../../layouts/hass-loading-screen"; import "../../../../layouts/hass-tabs-subpage-data-table"; -import { HomeAssistant, Route } from "../../../../types"; -import { LocalizeFunc } from "../../../../common/translations/localize"; +import type { HomeAssistant, Route } from "../../../../types"; +import type { LocalizeFunc } from "../../../../common/translations/localize"; import { getLovelaceStrategy } from "../../../lovelace/strategies/get-strategy"; import { showNewDashboardDialog } from "../../dashboard/show-dialog-new-dashboard"; import { lovelaceTabs } from "../ha-config-lovelace"; diff --git a/src/panels/config/lovelace/dashboards/show-dialog-lovelace-dashboard-configure-strategy.ts b/src/panels/config/lovelace/dashboards/show-dialog-lovelace-dashboard-configure-strategy.ts index 51f131e7b303..132a13d38148 100644 --- a/src/panels/config/lovelace/dashboards/show-dialog-lovelace-dashboard-configure-strategy.ts +++ b/src/panels/config/lovelace/dashboards/show-dialog-lovelace-dashboard-configure-strategy.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../../common/dom/fire_event"; -import { LovelaceDashboardStrategyConfig } from "../../../../data/lovelace/config/types"; +import type { LovelaceDashboardStrategyConfig } from "../../../../data/lovelace/config/types"; export interface LovelaceDashboardConfigureStrategyDialogParams { config: LovelaceDashboardStrategyConfig; diff --git a/src/panels/config/lovelace/dashboards/show-dialog-lovelace-dashboard-detail.ts b/src/panels/config/lovelace/dashboards/show-dialog-lovelace-dashboard-detail.ts index cf08844211fd..3f9e6c8fdfc1 100644 --- a/src/panels/config/lovelace/dashboards/show-dialog-lovelace-dashboard-detail.ts +++ b/src/panels/config/lovelace/dashboards/show-dialog-lovelace-dashboard-detail.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../../common/dom/fire_event"; -import { +import type { LovelaceDashboard, LovelaceDashboardCreateParams, LovelaceDashboardMutableParams, diff --git a/src/panels/config/lovelace/ha-config-lovelace.ts b/src/panels/config/lovelace/ha-config-lovelace.ts index eda9a8fd56e1..12716d23daa2 100644 --- a/src/panels/config/lovelace/ha-config-lovelace.ts +++ b/src/panels/config/lovelace/ha-config-lovelace.ts @@ -1,10 +1,8 @@ import { mdiViewDashboard } from "@mdi/js"; import { customElement, property } from "lit/decorators"; -import { - HassRouterPage, - RouterOptions, -} from "../../../layouts/hass-router-page"; -import { HomeAssistant } from "../../../types"; +import type { RouterOptions } from "../../../layouts/hass-router-page"; +import { HassRouterPage } from "../../../layouts/hass-router-page"; +import type { HomeAssistant } from "../../../types"; export const lovelaceTabs = [ { diff --git a/src/panels/config/lovelace/resources/dialog-lovelace-resource-detail.ts b/src/panels/config/lovelace/resources/dialog-lovelace-resource-detail.ts index 561a35750854..8614e8c8e83e 100644 --- a/src/panels/config/lovelace/resources/dialog-lovelace-resource-detail.ts +++ b/src/panels/config/lovelace/resources/dialog-lovelace-resource-detail.ts @@ -9,10 +9,10 @@ import type { HaMdDialog } from "../../../../components/ha-md-dialog"; import "../../../../components/ha-dialog-header"; import "../../../../components/ha-form/ha-form"; import "../../../../components/ha-icon-button"; -import { SchemaUnion } from "../../../../components/ha-form/types"; -import { LovelaceResourcesMutableParams } from "../../../../data/lovelace/resource"; -import { HomeAssistant } from "../../../../types"; -import { LovelaceResourceDetailsDialogParams } from "./show-dialog-lovelace-resource-detail"; +import type { SchemaUnion } from "../../../../components/ha-form/types"; +import type { LovelaceResourcesMutableParams } from "../../../../data/lovelace/resource"; +import type { HomeAssistant } from "../../../../types"; +import type { LovelaceResourceDetailsDialogParams } from "./show-dialog-lovelace-resource-detail"; const detectResourceType = (url?: string) => { if (!url) { diff --git a/src/panels/config/lovelace/resources/ha-config-lovelace-resources.ts b/src/panels/config/lovelace/resources/ha-config-lovelace-resources.ts index 7727f57c6652..a9989e785329 100644 --- a/src/panels/config/lovelace/resources/ha-config-lovelace-resources.ts +++ b/src/panels/config/lovelace/resources/ha-config-lovelace-resources.ts @@ -1,17 +1,11 @@ import { mdiDelete, mdiPlus } from "@mdi/js"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoize from "memoize-one"; import { stringCompare } from "../../../../common/string/compare"; -import { LocalizeFunc } from "../../../../common/translations/localize"; -import { +import type { LocalizeFunc } from "../../../../common/translations/localize"; +import type { DataTableColumnContainer, RowClickedEvent, SortingChangedEvent, @@ -19,11 +13,11 @@ import { import "../../../../components/ha-card"; import "../../../../components/ha-fab"; import "../../../../components/ha-svg-icon"; +import type { LovelaceResource } from "../../../../data/lovelace/resource"; import { createResource, deleteResource, fetchResources, - LovelaceResource, updateResource, } from "../../../../data/lovelace/resource"; import { @@ -34,7 +28,7 @@ import "../../../../layouts/hass-loading-screen"; import "../../../../layouts/hass-subpage"; import "../../../../layouts/hass-tabs-subpage-data-table"; import { haStyle } from "../../../../resources/styles"; -import { HomeAssistant, Route } from "../../../../types"; +import type { HomeAssistant, Route } from "../../../../types"; import { loadLovelaceResources } from "../../../lovelace/common/load-resources"; import { lovelaceResourcesTabs } from "../ha-config-lovelace"; import { showResourceDetailDialog } from "./show-dialog-lovelace-resource-detail"; diff --git a/src/panels/config/lovelace/resources/show-dialog-lovelace-resource-detail.ts b/src/panels/config/lovelace/resources/show-dialog-lovelace-resource-detail.ts index e1a5caa3affa..d71963e5438e 100644 --- a/src/panels/config/lovelace/resources/show-dialog-lovelace-resource-detail.ts +++ b/src/panels/config/lovelace/resources/show-dialog-lovelace-resource-detail.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../../common/dom/fire_event"; -import { +import type { LovelaceResource, LovelaceResourcesMutableParams, } from "../../../../data/lovelace/resource"; diff --git a/src/panels/config/network/ha-config-network.ts b/src/panels/config/network/ha-config-network.ts index 25952cd43ef0..cf9d3e1f36a0 100644 --- a/src/panels/config/network/ha-config-network.ts +++ b/src/panels/config/network/ha-config-network.ts @@ -1,12 +1,6 @@ import "@material/mwc-button/mwc-button"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import "../../../components/ha-alert"; @@ -15,11 +9,8 @@ import "../../../components/ha-checkbox"; import "../../../components/ha-network"; import "../../../components/ha-settings-row"; import { fetchNetworkInfo } from "../../../data/hassio/network"; -import { - getNetworkConfig, - NetworkConfig, - setNetworkConfig, -} from "../../../data/network"; +import type { NetworkConfig } from "../../../data/network"; +import { getNetworkConfig, setNetworkConfig } from "../../../data/network"; import { haStyle } from "../../../resources/styles"; import type { HomeAssistant } from "../../../types"; diff --git a/src/panels/config/network/ha-config-section-network.ts b/src/panels/config/network/ha-config-section-network.ts index addc69caa793..1a18aca3b640 100644 --- a/src/panels/config/network/ha-config-section-network.ts +++ b/src/panels/config/network/ha-config-section-network.ts @@ -1,4 +1,5 @@ -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import "../../../layouts/hass-subpage"; diff --git a/src/panels/config/network/ha-config-url-form.ts b/src/panels/config/network/ha-config-url-form.ts index 934869b79995..20a22a98f9ec 100644 --- a/src/panels/config/network/ha-config-url-form.ts +++ b/src/panels/config/network/ha-config-url-form.ts @@ -1,12 +1,6 @@ import "@material/mwc-button/mwc-button"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { mdiContentCopy, mdiEyeOff, mdiEye } from "@mdi/js"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; @@ -16,8 +10,11 @@ import "../../../components/ha-card"; import "../../../components/ha-formfield"; import "../../../components/ha-switch"; import "../../../components/ha-textfield"; +import "../../../components/ha-settings-row"; +import "../../../components/ha-button"; import type { HaTextField } from "../../../components/ha-textfield"; -import { CloudStatus, fetchCloudStatus } from "../../../data/cloud"; +import type { CloudStatus } from "../../../data/cloud"; +import { fetchCloudStatus } from "../../../data/cloud"; import { saveCoreConfig } from "../../../data/core"; import { getNetworkUrls, type NetworkUrls } from "../../../data/network"; import type { ValueChangedEvent, HomeAssistant } from "../../../types"; diff --git a/src/panels/config/network/supervisor-hostname.ts b/src/panels/config/network/supervisor-hostname.ts index f6b6f5333c16..7c3d914aabb5 100644 --- a/src/panels/config/network/supervisor-hostname.ts +++ b/src/panels/config/network/supervisor-hostname.ts @@ -1,7 +1,8 @@ import "@material/mwc-button/mwc-button"; import "@material/mwc-list/mwc-list"; import "@material/mwc-list/mwc-list-item"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/ha-alert"; import "../../../components/ha-card"; diff --git a/src/panels/config/network/supervisor-network.ts b/src/panels/config/network/supervisor-network.ts index 0d2fcfaf2134..22b23188c6c9 100644 --- a/src/panels/config/network/supervisor-network.ts +++ b/src/panels/config/network/supervisor-network.ts @@ -1,7 +1,8 @@ +import "@material/mwc-list/mwc-list"; import "@material/mwc-tab"; import "@material/mwc-tab-bar"; import { mdiDeleteOutline, mdiPlus, mdiMenuDown, mdiWifi } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import { css, type CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { cache } from "lit/directives/cache"; import "../../../components/ha-alert"; @@ -20,14 +21,14 @@ import "../../../components/ha-textfield"; import type { HaTextField } from "../../../components/ha-textfield"; import { extractApiErrorMessage } from "../../../data/hassio/common"; import { - AccessPoint, + type AccessPoint, accesspointScan, fetchNetworkInfo, formatAddress, - NetworkInterface, + type NetworkInterface, parseAddress, updateNetworkInterface, - WifiConfiguration, + type WifiConfiguration, } from "../../../data/hassio/network"; import { showAlertDialog, diff --git a/src/panels/config/person/dialog-person-detail.ts b/src/panels/config/person/dialog-person-detail.ts index 550c0c67bbc8..e8199853cdce 100644 --- a/src/panels/config/person/dialog-person-detail.ts +++ b/src/panels/config/person/dialog-person-detail.ts @@ -1,5 +1,6 @@ import { mdiPencil } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import "../../../components/entity/ha-entities-picker"; @@ -12,26 +13,26 @@ import type { HaPictureUpload } from "../../../components/ha-picture-upload"; import "../../../components/ha-settings-row"; import "../../../components/ha-textfield"; import { adminChangeUsername } from "../../../data/auth"; -import { PersonMutableParams } from "../../../data/person"; +import type { PersonMutableParams } from "../../../data/person"; +import type { User } from "../../../data/user"; import { deleteUser, SYSTEM_GROUP_ID_ADMIN, SYSTEM_GROUP_ID_USER, updateUser, - User, } from "../../../data/user"; import { showAlertDialog, showConfirmationDialog, showPromptDialog, } from "../../../dialogs/generic/show-dialog-box"; -import { CropOptions } from "../../../dialogs/image-cropper-dialog/show-image-cropper-dialog"; +import type { CropOptions } from "../../../dialogs/image-cropper-dialog/show-image-cropper-dialog"; import { haStyleDialog } from "../../../resources/styles"; -import { HomeAssistant, ValueChangedEvent } from "../../../types"; +import type { HomeAssistant, ValueChangedEvent } from "../../../types"; import { documentationUrl } from "../../../util/documentation-url"; import { showAddUserDialog } from "../users/show-dialog-add-user"; import { showAdminChangePasswordDialog } from "../users/show-dialog-admin-change-password"; -import { PersonDetailDialogParams } from "./show-dialog-person-detail"; +import type { PersonDetailDialogParams } from "./show-dialog-person-detail"; const includeDomains = ["device_tracker"]; diff --git a/src/panels/config/person/ha-config-person.ts b/src/panels/config/person/ha-config-person.ts index c4c658b02340..6596deddfa86 100644 --- a/src/panels/config/person/ha-config-person.ts +++ b/src/panels/config/person/ha-config-person.ts @@ -1,6 +1,7 @@ import { mdiPlus } from "@mdi/js"; import "@material/mwc-list/mwc-list"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { stringCompare } from "../../../common/string/compare"; import "../../../components/ha-card"; @@ -8,21 +9,22 @@ import "../../../components/ha-fab"; import "../../../components/ha-svg-icon"; import "../../../components/ha-list-item"; import "../../../components/user/ha-person-badge"; +import type { Person } from "../../../data/person"; import { createPerson, deletePerson, fetchPersons, - Person, updatePerson, } from "../../../data/person"; -import { fetchUsers, User } from "../../../data/user"; +import type { User } from "../../../data/user"; +import { fetchUsers } from "../../../data/user"; import { showAlertDialog, showConfirmationDialog, } from "../../../dialogs/generic/show-dialog-box"; import "../../../layouts/hass-loading-screen"; import "../../../layouts/hass-tabs-subpage"; -import { HomeAssistant, Route } from "../../../types"; +import type { HomeAssistant, Route } from "../../../types"; import { documentationUrl } from "../../../util/documentation-url"; import "../ha-config-section"; import { configSections } from "../ha-panel-config"; diff --git a/src/panels/config/person/show-dialog-person-detail.ts b/src/panels/config/person/show-dialog-person-detail.ts index 84251a6a114a..ae63f8d5ab34 100644 --- a/src/panels/config/person/show-dialog-person-detail.ts +++ b/src/panels/config/person/show-dialog-person-detail.ts @@ -1,6 +1,6 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import { Person, PersonMutableParams } from "../../../data/person"; -import { User } from "../../../data/user"; +import type { Person, PersonMutableParams } from "../../../data/person"; +import type { User } from "../../../data/user"; export interface PersonDetailDialogParams { entry?: Person; diff --git a/src/panels/config/repairs/dialog-integration-startup.ts b/src/panels/config/repairs/dialog-integration-startup.ts index a0786f13c778..62996283f590 100644 --- a/src/panels/config/repairs/dialog-integration-startup.ts +++ b/src/panels/config/repairs/dialog-integration-startup.ts @@ -1,5 +1,6 @@ import "@material/mwc-button/mwc-button"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import "../../../components/ha-card"; diff --git a/src/panels/config/repairs/dialog-repairs-issue.ts b/src/panels/config/repairs/dialog-repairs-issue.ts index 7d4866242321..b1e7fa4bb4b1 100644 --- a/src/panels/config/repairs/dialog-repairs-issue.ts +++ b/src/panels/config/repairs/dialog-repairs-issue.ts @@ -1,5 +1,6 @@ import { mdiClose } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state, query } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import { isNavigationClick } from "../../../common/dom/is-navigation-click"; @@ -10,7 +11,8 @@ import "../../../components/ha-button"; import "../../../components/ha-dialog-header"; import "./dialog-repairs-issue-subtitle"; import "../../../components/ha-markdown"; -import { ignoreRepairsIssue, RepairsIssue } from "../../../data/repairs"; +import type { RepairsIssue } from "../../../data/repairs"; +import { ignoreRepairsIssue } from "../../../data/repairs"; import { haStyleDialog } from "../../../resources/styles"; import type { HomeAssistant } from "../../../types"; import type { RepairsIssueDialogParams } from "./show-repair-issue-dialog"; diff --git a/src/panels/config/repairs/dialog-system-information.ts b/src/panels/config/repairs/dialog-system-information.ts index 99457e68b532..fccbedee5249 100644 --- a/src/panels/config/repairs/dialog-system-information.ts +++ b/src/panels/config/repairs/dialog-system-information.ts @@ -1,13 +1,7 @@ import "@material/mwc-button/mwc-button"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - TemplateResult, - nothing, -} from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import { formatDateTime } from "../../../common/datetime/format_date_time"; @@ -19,17 +13,16 @@ import "../../../components/ha-card"; import "../../../components/ha-circular-progress"; import { createCloseHeading } from "../../../components/ha-dialog"; import "../../../components/ha-metric"; -import { fetchHassioStats, HassioStats } from "../../../data/hassio/common"; -import { - fetchHassioResolution, - HassioResolution, -} from "../../../data/hassio/resolution"; +import type { HassioStats } from "../../../data/hassio/common"; +import { fetchHassioStats } from "../../../data/hassio/common"; +import type { HassioResolution } from "../../../data/hassio/resolution"; +import { fetchHassioResolution } from "../../../data/hassio/resolution"; import { domainToName } from "../../../data/integration"; -import { - subscribeSystemHealthInfo, +import type { SystemCheckValueObject, SystemHealthInfo, } from "../../../data/system_health"; +import { subscribeSystemHealthInfo } from "../../../data/system_health"; import { showAlertDialog } from "../../../dialogs/generic/show-dialog-box"; import { haStyleDialog } from "../../../resources/styles"; import type { HomeAssistant } from "../../../types"; diff --git a/src/panels/config/repairs/ha-config-repairs-dashboard.ts b/src/panels/config/repairs/ha-config-repairs-dashboard.ts index b79003c578ad..aa49368d325c 100644 --- a/src/panels/config/repairs/ha-config-repairs-dashboard.ts +++ b/src/panels/config/repairs/ha-config-repairs-dashboard.ts @@ -1,7 +1,8 @@ -import { RequestSelectedDetail } from "@material/mwc-list/mwc-list-item-base"; +import type { RequestSelectedDetail } from "@material/mwc-list/mwc-list-item-base"; import { mdiDotsVertical } from "@mdi/js"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, html, LitElement, TemplateResult } from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; @@ -10,8 +11,8 @@ import { navigate } from "../../../common/navigate"; import { extractSearchParam } from "../../../common/url/search-params"; import "../../../components/ha-card"; import "../../../components/ha-check-list-item"; +import type { RepairsIssue } from "../../../data/repairs"; import { - RepairsIssue, severitySort, subscribeRepairsIssueRegistry, } from "../../../data/repairs"; diff --git a/src/panels/config/repairs/ha-config-repairs.ts b/src/panels/config/repairs/ha-config-repairs.ts index 98366f89bbb8..77345f3e860b 100644 --- a/src/panels/config/repairs/ha-config-repairs.ts +++ b/src/panels/config/repairs/ha-config-repairs.ts @@ -15,9 +15,9 @@ import { brandsUrl } from "../../../util/brands-url"; import { fixStatisticsIssue } from "../../developer-tools/statistics/fix-statistics"; import { showRepairsFlowDialog } from "./show-dialog-repair-flow"; import { showRepairsIssueDialog } from "./show-repair-issue-dialog"; +import type { StatisticsValidationResult } from "../../../data/recorder"; import { STATISTIC_TYPES, - StatisticsValidationResult, updateStatisticsIssues, } from "../../../data/recorder"; diff --git a/src/panels/config/repairs/integrations-startup-time.ts b/src/panels/config/repairs/integrations-startup-time.ts index d72ea6eab3e1..a065b182411c 100644 --- a/src/panels/config/repairs/integrations-startup-time.ts +++ b/src/panels/config/repairs/integrations-startup-time.ts @@ -1,21 +1,17 @@ import "@material/mwc-list/mwc-list"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/ha-card"; import "../../../components/ha-clickable-list-item"; +import type { + IntegrationManifest, + IntegrationSetup, +} from "../../../data/integration"; import { domainToName, fetchIntegrationManifests, fetchIntegrationSetups, - IntegrationManifest, - IntegrationSetup, } from "../../../data/integration"; import type { HomeAssistant } from "../../../types"; import { brandsUrl } from "../../../util/brands-url"; diff --git a/src/panels/config/repairs/show-dialog-repair-flow.ts b/src/panels/config/repairs/show-dialog-repair-flow.ts index 149da94cf130..bdc4304fbfe5 100644 --- a/src/panels/config/repairs/show-dialog-repair-flow.ts +++ b/src/panels/config/repairs/show-dialog-repair-flow.ts @@ -1,9 +1,9 @@ import { html, nothing } from "lit"; -import { DataEntryFlowStep } from "../../../data/data_entry_flow"; +import type { DataEntryFlowStep } from "../../../data/data_entry_flow"; import { domainToName } from "../../../data/integration"; import "./dialog-repairs-issue-subtitle"; +import type { RepairsIssue } from "../../../data/repairs"; import { - RepairsIssue, createRepairsFlow, deleteRepairsFlow, fetchRepairsFlow, @@ -13,7 +13,7 @@ import { loadDataEntryFlowDialog, showFlowDialog, } from "../../../dialogs/config-flow/show-dialog-data-entry-flow"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; const mergePlaceholders = (issue: RepairsIssue, step: DataEntryFlowStep) => step.description_placeholders && issue.translation_placeholders diff --git a/src/panels/config/scene/ha-config-scene.ts b/src/panels/config/scene/ha-config-scene.ts index 965e1a6bbc19..3d60d2e76057 100644 --- a/src/panels/config/scene/ha-config-scene.ts +++ b/src/panels/config/scene/ha-config-scene.ts @@ -1,15 +1,13 @@ -import { HassEntities } from "home-assistant-js-websocket"; -import { PropertyValues } from "lit"; +import type { HassEntities } from "home-assistant-js-websocket"; +import type { PropertyValues } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; import { computeStateDomain } from "../../../common/entity/compute_state_domain"; import { debounce } from "../../../common/util/debounce"; -import { SceneEntity } from "../../../data/scene"; -import { - HassRouterPage, - RouterOptions, -} from "../../../layouts/hass-router-page"; -import { HomeAssistant } from "../../../types"; +import type { SceneEntity } from "../../../data/scene"; +import type { RouterOptions } from "../../../layouts/hass-router-page"; +import { HassRouterPage } from "../../../layouts/hass-router-page"; +import type { HomeAssistant } from "../../../types"; import "./ha-scene-dashboard"; import "./ha-scene-editor"; diff --git a/src/panels/config/scene/ha-scene-dashboard.ts b/src/panels/config/scene/ha-scene-dashboard.ts index e544a15792e9..5ce3e327f0f5 100644 --- a/src/panels/config/scene/ha-scene-dashboard.ts +++ b/src/panels/config/scene/ha-scene-dashboard.ts @@ -18,31 +18,25 @@ import { mdiTextureBox, } from "@mdi/js"; import { differenceInDays } from "date-fns"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { computeCssColor } from "../../../common/color/compute-color"; import { formatShortDateTime } from "../../../common/datetime/format_date_time"; import { relativeTime } from "../../../common/datetime/relative_time"; import { storage } from "../../../common/decorators/storage"; -import { HASSDomEvent, fireEvent } from "../../../common/dom/fire_event"; +import type { HASSDomEvent } from "../../../common/dom/fire_event"; +import { fireEvent } from "../../../common/dom/fire_event"; import { computeStateName } from "../../../common/entity/compute_state_name"; import { navigate } from "../../../common/navigate"; -import { LocalizeFunc } from "../../../common/translations/localize"; +import type { LocalizeFunc } from "../../../common/translations/localize"; import { hasRejectedItems, rejectedItems, } from "../../../common/util/promise-all-settled-results"; -import { +import type { DataTableColumnContainer, RowClickedEvent, SelectionChangedEvent, @@ -64,31 +58,31 @@ import "../../../components/ha-state-icon"; import "../../../components/ha-sub-menu"; import "../../../components/ha-svg-icon"; import { createAreaRegistryEntry } from "../../../data/area_registry"; +import type { CategoryRegistryEntry } from "../../../data/category_registry"; import { - CategoryRegistryEntry, createCategoryRegistryEntry, subscribeCategoryRegistry, } from "../../../data/category_registry"; import { fullEntitiesContext } from "../../../data/context"; +import type { DataTableFilters } from "../../../data/data_table_filters"; import { - DataTableFilters, deserializeFilters, serializeFilters, } from "../../../data/data_table_filters"; import { isUnavailableState } from "../../../data/entity"; -import { +import type { EntityRegistryEntry, UpdateEntityRegistryEntryResult, - updateEntityRegistryEntry, } from "../../../data/entity_registry"; +import { updateEntityRegistryEntry } from "../../../data/entity_registry"; import { forwardHaptic } from "../../../data/haptics"; +import type { LabelRegistryEntry } from "../../../data/label_registry"; import { - LabelRegistryEntry, createLabelRegistryEntry, subscribeLabelRegistry, } from "../../../data/label_registry"; +import type { SceneEntity } from "../../../data/scene"; import { - SceneEntity, activateScene, deleteScene, getSceneConfig, @@ -102,7 +96,7 @@ import { showMoreInfoDialog } from "../../../dialogs/more-info/show-ha-more-info import "../../../layouts/hass-tabs-subpage-data-table"; import { SubscribeMixin } from "../../../mixins/subscribe-mixin"; import { haStyle } from "../../../resources/styles"; -import { HomeAssistant, Route } from "../../../types"; +import type { HomeAssistant, Route } from "../../../types"; import { documentationUrl } from "../../../util/documentation-url"; import { showToast } from "../../../util/toast"; import { showAreaRegistryDetailDialog } from "../areas/show-dialog-area-registry-detail"; diff --git a/src/panels/config/scene/ha-scene-editor.ts b/src/panels/config/scene/ha-scene-editor.ts index 53ce39942a21..6ea07086418e 100644 --- a/src/panels/config/scene/ha-scene-editor.ts +++ b/src/panels/config/scene/ha-scene-editor.ts @@ -1,4 +1,4 @@ -import { ActionDetail } from "@material/mwc-list/mwc-list-foundation"; +import type { ActionDetail } from "@material/mwc-list/mwc-list-foundation"; import "@material/mwc-list/mwc-list"; import { mdiContentDuplicate, @@ -6,15 +6,9 @@ import { mdiDelete, mdiDotsVertical, } from "@mdi/js"; -import { HassEvent } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { HassEvent } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; @@ -35,16 +29,22 @@ import "../../../components/ha-icon-picker"; import "../../../components/ha-list-item"; import "../../../components/ha-svg-icon"; import "../../../components/ha-textfield"; +import type { DeviceRegistryEntry } from "../../../data/device_registry"; import { computeDeviceName, - DeviceRegistryEntry, subscribeDeviceRegistry, } from "../../../data/device_registry"; +import type { EntityRegistryEntry } from "../../../data/entity_registry"; import { - EntityRegistryEntry, subscribeEntityRegistry, updateEntityRegistryEntry, } from "../../../data/entity_registry"; +import type { + SceneConfig, + SceneEntities, + SceneEntity, + SceneMetaData, +} from "../../../data/scene"; import { activateScene, applyScene, @@ -52,10 +52,6 @@ import { getSceneConfig, getSceneEditorInitData, saveScene, - SceneConfig, - SceneEntities, - SceneEntity, - SceneMetaData, SCENE_IGNORED_DOMAINS, showSceneEditor, } from "../../../data/scene"; @@ -67,7 +63,7 @@ import "../../../layouts/hass-subpage"; import { KeyboardShortcutMixin } from "../../../mixins/keyboard-shortcut-mixin"; import { SubscribeMixin } from "../../../mixins/subscribe-mixin"; import { haStyle } from "../../../resources/styles"; -import { HomeAssistant, Route } from "../../../types"; +import type { HomeAssistant, Route } from "../../../types"; import { showToast } from "../../../util/toast"; import "../ha-config-section"; diff --git a/src/panels/config/script/blueprint-script-editor.ts b/src/panels/config/script/blueprint-script-editor.ts index dbe96677de50..5689d746482e 100644 --- a/src/panels/config/script/blueprint-script-editor.ts +++ b/src/panels/config/script/blueprint-script-editor.ts @@ -3,7 +3,7 @@ import { html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../components/ha-markdown"; import { fetchBlueprints } from "../../../data/blueprint"; -import { BlueprintScriptConfig } from "../../../data/script"; +import type { BlueprintScriptConfig } from "../../../data/script"; import { HaBlueprintGenericEditor } from "../blueprint/blueprint-generic-editor"; @customElement("blueprint-script-editor") diff --git a/src/panels/config/script/ha-config-script.ts b/src/panels/config/script/ha-config-script.ts index 56aaade1c1c9..2f3eac057dd5 100644 --- a/src/panels/config/script/ha-config-script.ts +++ b/src/panels/config/script/ha-config-script.ts @@ -1,18 +1,16 @@ import { consume } from "@lit-labs/context"; -import { HassEntities } from "home-assistant-js-websocket"; -import { PropertyValues } from "lit"; +import type { HassEntities } from "home-assistant-js-websocket"; +import type { PropertyValues } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { computeStateDomain } from "../../../common/entity/compute_state_domain"; import { debounce } from "../../../common/util/debounce"; import { fullEntitiesContext } from "../../../data/context"; -import { EntityRegistryEntry } from "../../../data/entity_registry"; -import { ScriptEntity } from "../../../data/script"; -import { - HassRouterPage, - RouterOptions, -} from "../../../layouts/hass-router-page"; -import { HomeAssistant } from "../../../types"; +import type { EntityRegistryEntry } from "../../../data/entity_registry"; +import type { ScriptEntity } from "../../../data/script"; +import type { RouterOptions } from "../../../layouts/hass-router-page"; +import { HassRouterPage } from "../../../layouts/hass-router-page"; +import type { HomeAssistant } from "../../../types"; import "./ha-script-editor"; import "./ha-script-picker"; diff --git a/src/panels/config/script/ha-script-editor.ts b/src/panels/config/script/ha-script-editor.ts index 3f69de66a173..d387f2a0dbb4 100644 --- a/src/panels/config/script/ha-script-editor.ts +++ b/src/panels/config/script/ha-script-editor.ts @@ -14,15 +14,8 @@ import { mdiRobotConfused, mdiTransitConnection, } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { fireEvent } from "../../../common/dom/fire_event"; @@ -39,10 +32,9 @@ import "../../../components/ha-svg-icon"; import "../../../components/ha-yaml-editor"; import { validateConfig } from "../../../data/config"; import { UNAVAILABLE } from "../../../data/entity"; -import { EntityRegistryEntry } from "../../../data/entity_registry"; +import type { EntityRegistryEntry } from "../../../data/entity_registry"; +import type { BlueprintScriptConfig, ScriptConfig } from "../../../data/script"; import { - BlueprintScriptConfig, - ScriptConfig, deleteScript, fetchScriptFileConfig, getScriptEditorInitData, diff --git a/src/panels/config/script/ha-script-field-row.ts b/src/panels/config/script/ha-script-field-row.ts index b10b72746b2d..b80cfeab9a61 100644 --- a/src/panels/config/script/ha-script-field-row.ts +++ b/src/panels/config/script/ha-script-field-row.ts @@ -1,7 +1,8 @@ -import { 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 { mdiCheck, mdiDelete, mdiDotsVertical } from "@mdi/js"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; @@ -10,11 +11,12 @@ import { slugify } from "../../../common/string/slugify"; import "../../../components/ha-alert"; import "../../../components/ha-button-menu"; import "../../../components/ha-card"; +import "../../../components/ha-form/ha-form"; import "../../../components/ha-expansion-panel"; import type { SchemaUnion } from "../../../components/ha-form/types"; import "../../../components/ha-icon-button"; import "../../../components/ha-yaml-editor"; -import { Field } from "../../../data/script"; +import type { Field } from "../../../data/script"; import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box"; import { haStyle } from "../../../resources/styles"; import type { HomeAssistant } from "../../../types"; diff --git a/src/panels/config/script/ha-script-fields.ts b/src/panels/config/script/ha-script-fields.ts index 8fb319db396f..3510f0838520 100644 --- a/src/panels/config/script/ha-script-fields.ts +++ b/src/panels/config/script/ha-script-fields.ts @@ -1,20 +1,14 @@ import "@material/mwc-button"; import { mdiPlus } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import "../../../components/ha-button"; import "../../../components/ha-button-menu"; import "../../../components/ha-svg-icon"; -import { Fields } from "../../../data/script"; -import { HomeAssistant } from "../../../types"; +import type { Fields } from "../../../data/script"; +import type { HomeAssistant } from "../../../types"; import "./ha-script-field-row"; import type HaScriptFieldRow from "./ha-script-field-row"; diff --git a/src/panels/config/script/ha-script-picker.ts b/src/panels/config/script/ha-script-picker.ts index d62033d6e0eb..0f1c59063244 100644 --- a/src/panels/config/script/ha-script-picker.ts +++ b/src/panels/config/script/ha-script-picker.ts @@ -17,16 +17,9 @@ import { mdiTransitConnection, } from "@mdi/js"; import { differenceInDays } from "date-fns"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import memoizeOne from "memoize-one"; @@ -35,15 +28,16 @@ import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import { formatShortDateTime } from "../../../common/datetime/format_date_time"; import { relativeTime } from "../../../common/datetime/relative_time"; import { storage } from "../../../common/decorators/storage"; -import { HASSDomEvent, fireEvent } from "../../../common/dom/fire_event"; +import type { HASSDomEvent } from "../../../common/dom/fire_event"; +import { fireEvent } from "../../../common/dom/fire_event"; import { computeStateName } from "../../../common/entity/compute_state_name"; import { navigate } from "../../../common/navigate"; -import { LocalizeFunc } from "../../../common/translations/localize"; +import type { LocalizeFunc } from "../../../common/translations/localize"; import { hasRejectedItems, rejectedItems, } from "../../../common/util/promise-all-settled-results"; -import { +import type { DataTableColumnContainer, RowClickedEvent, SelectionChangedEvent, @@ -64,30 +58,30 @@ import "../../../components/ha-md-menu-item"; import "../../../components/ha-sub-menu"; import "../../../components/ha-svg-icon"; import { createAreaRegistryEntry } from "../../../data/area_registry"; +import type { CategoryRegistryEntry } from "../../../data/category_registry"; import { - CategoryRegistryEntry, createCategoryRegistryEntry, subscribeCategoryRegistry, } from "../../../data/category_registry"; import { fullEntitiesContext } from "../../../data/context"; +import type { DataTableFilters } from "../../../data/data_table_filters"; import { - DataTableFilters, deserializeFilters, serializeFilters, } from "../../../data/data_table_filters"; import { UNAVAILABLE } from "../../../data/entity"; -import { +import type { EntityRegistryEntry, UpdateEntityRegistryEntryResult, - updateEntityRegistryEntry, } from "../../../data/entity_registry"; +import { updateEntityRegistryEntry } from "../../../data/entity_registry"; +import type { LabelRegistryEntry } from "../../../data/label_registry"; import { - LabelRegistryEntry, createLabelRegistryEntry, subscribeLabelRegistry, } from "../../../data/label_registry"; +import type { ScriptEntity } from "../../../data/script"; import { - ScriptEntity, deleteScript, fetchScriptFileConfig, getScriptStateConfig, @@ -103,7 +97,7 @@ import { showMoreInfoDialog } from "../../../dialogs/more-info/show-ha-more-info import "../../../layouts/hass-tabs-subpage-data-table"; import { SubscribeMixin } from "../../../mixins/subscribe-mixin"; import { haStyle } from "../../../resources/styles"; -import { HomeAssistant, Route } from "../../../types"; +import type { HomeAssistant, Route } from "../../../types"; import { documentationUrl } from "../../../util/documentation-url"; import { showToast } from "../../../util/toast"; import { showAreaRegistryDetailDialog } from "../areas/show-dialog-area-registry-detail"; diff --git a/src/panels/config/script/ha-script-trace.ts b/src/panels/config/script/ha-script-trace.ts index 81d2cd8a4b43..471aac8663cb 100644 --- a/src/panels/config/script/ha-script-trace.ts +++ b/src/panels/config/script/ha-script-trace.ts @@ -1,3 +1,4 @@ +import "@material/mwc-list/mwc-list-item"; import { mdiDotsVertical, mdiDownload, @@ -7,7 +8,8 @@ import { mdiRayStartArrow, mdiRefresh, } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { repeat } from "lit/directives/repeat"; @@ -25,21 +27,18 @@ import type { NodeInfo, } from "../../../components/trace/hat-script-graph"; import { traceTabStyles } from "../../../components/trace/trace-tab-styles"; -import { getLogbookDataForContext, LogbookEntry } from "../../../data/logbook"; -import { ScriptEntity } from "../../../data/script"; -import { - loadTrace, - loadTraces, - ScriptTrace, - ScriptTraceExtended, -} from "../../../data/trace"; +import type { LogbookEntry } from "../../../data/logbook"; +import { getLogbookDataForContext } from "../../../data/logbook"; +import type { ScriptEntity } from "../../../data/script"; +import type { ScriptTrace, ScriptTraceExtended } from "../../../data/trace"; +import { loadTrace, loadTraces } from "../../../data/trace"; import { showAlertDialog } from "../../../dialogs/generic/show-dialog-box"; import { haStyle } from "../../../resources/styles"; -import { HomeAssistant, Route } from "../../../types"; +import type { HomeAssistant, Route } from "../../../types"; import "../../../layouts/hass-subpage"; import "../../../components/ha-button-menu"; import { fireEvent } from "../../../common/dom/fire_event"; -import { EntityRegistryEntry } from "../../../data/entity_registry"; +import type { EntityRegistryEntry } from "../../../data/entity_registry"; @customElement("ha-script-trace") export class HaScriptTrace extends LitElement { diff --git a/src/panels/config/script/manual-script-editor.ts b/src/panels/config/script/manual-script-editor.ts index 240dc31437aa..0a4251ff8690 100644 --- a/src/panels/config/script/manual-script-editor.ts +++ b/src/panels/config/script/manual-script-editor.ts @@ -1,13 +1,7 @@ import "@material/mwc-button/mwc-button"; import { mdiHelpCircle } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import { constructUrlCurrentPath } from "../../../common/url/construct-url"; @@ -15,11 +9,10 @@ import { extractSearchParam, removeSearchParam, } from "../../../common/url/search-params"; -import { nestedArrayMove } from "../../../common/util/array-move"; import "../../../components/ha-card"; import "../../../components/ha-icon-button"; import "../../../components/ha-markdown"; -import { Action, Fields, ScriptConfig } from "../../../data/script"; +import type { Action, Fields, ScriptConfig } from "../../../data/script"; import { haStyle } from "../../../resources/styles"; import type { HomeAssistant } from "../../../types"; import { documentationUrl } from "../../../util/documentation-url"; @@ -163,7 +156,6 @@ export class HaManualScriptEditor extends LitElement { .actions=${this.config.sequence || []} .path=${["sequence"]} @value-changed=${this._sequenceChanged} - @item-moved=${this._itemMoved} .hass=${this.hass} .narrow=${this.narrow} .disabled=${this.disabled} @@ -185,21 +177,6 @@ export class HaManualScriptEditor extends LitElement { }); } - private _itemMoved(ev: CustomEvent): void { - ev.stopPropagation(); - const { oldIndex, newIndex, oldPath, newPath } = ev.detail; - const updatedConfig = nestedArrayMove( - this.config, - oldIndex, - newIndex, - oldPath, - newPath - ); - fireEvent(this, "value-changed", { - value: updatedConfig, - }); - } - static get styles(): CSSResultGroup { return [ haStyle, diff --git a/src/panels/config/storage/dialog-mount-view.ts b/src/panels/config/storage/dialog-mount-view.ts index 51edb642097b..eff766daae2d 100644 --- a/src/panels/config/storage/dialog-mount-view.ts +++ b/src/panels/config/storage/dialog-mount-view.ts @@ -1,9 +1,10 @@ import { mdiHelpCircle } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../common/dom/fire_event"; -import { LocalizeFunc } from "../../../common/translations/localize"; +import type { LocalizeFunc } from "../../../common/translations/localize"; import { computeRTLDirection } from "../../../common/util/compute_rtl"; import "../../../components/buttons/ha-progress-button"; import type { HaProgressButton } from "../../../components/buttons/ha-progress-button"; @@ -11,18 +12,18 @@ import "../../../components/ha-form/ha-form"; import type { SchemaUnion } from "../../../components/ha-form/types"; import "../../../components/ha-icon-button"; import { extractApiErrorMessage } from "../../../data/hassio/common"; +import type { SupervisorMountRequestParams } from "../../../data/supervisor/mounts"; import { createSupervisorMount, removeSupervisorMount, - SupervisorMountRequestParams, SupervisorMountType, SupervisorMountUsage, updateSupervisorMount, } from "../../../data/supervisor/mounts"; import { haStyle, haStyleDialog } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { documentationUrl } from "../../../util/documentation-url"; -import { MountViewDialogParams } from "./show-dialog-view-mount"; +import type { MountViewDialogParams } from "./show-dialog-view-mount"; const mountSchema = memoizeOne( ( diff --git a/src/panels/config/storage/dialog-move-datadisk.ts b/src/panels/config/storage/dialog-move-datadisk.ts index 7f5495a8e9dc..74df08e143b1 100644 --- a/src/panels/config/storage/dialog-move-datadisk.ts +++ b/src/panels/config/storage/dialog-move-datadisk.ts @@ -1,28 +1,32 @@ import "@material/mwc-list/mwc-list-item"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../common/dom/fire_event"; import { stopPropagation } from "../../../common/dom/stop_propagation"; import "../../../components/ha-circular-progress"; import "../../../components/ha-select"; +import "../../../components/ha-dialog"; import { extractApiErrorMessage, ignoreSupervisorError, } from "../../../data/hassio/common"; -import { +import type { DatadiskList, - fetchHassioHassOsInfo, HassioHassOSInfo, HassioHostInfo, +} from "../../../data/hassio/host"; +import { + fetchHassioHassOsInfo, listDatadisks, moveDatadisk, } from "../../../data/hassio/host"; import { showAlertDialog } from "../../../dialogs/generic/show-dialog-box"; import { haStyle, haStyleDialog } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { bytesToString } from "../../../util/bytes-to-string"; -import { MoveDatadiskDialogParams } from "./show-dialog-move-datadisk"; +import type { MoveDatadiskDialogParams } from "./show-dialog-move-datadisk"; const calculateMoveTime = memoizeOne((hostInfo: HassioHostInfo): number => { const speed = hostInfo.disk_life_time !== "" ? 30 : 10; diff --git a/src/panels/config/storage/ha-config-section-storage.ts b/src/panels/config/storage/ha-config-section-storage.ts index 89b5fc7cf040..6f75fa41bff0 100644 --- a/src/panels/config/storage/ha-config-section-storage.ts +++ b/src/panels/config/storage/ha-config-section-storage.ts @@ -6,14 +6,8 @@ import { mdiPlayBox, mdiReload, } from "@mdi/js"; -import { - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import "../../../components/ha-alert"; @@ -23,13 +17,16 @@ import "../../../components/ha-metric"; import "../../../components/ha-svg-icon"; import "../../../components/ha-icon-next"; import { extractApiErrorMessage } from "../../../data/hassio/common"; -import { HassioHostInfo, fetchHassioHostInfo } from "../../../data/hassio/host"; -import { +import type { HassioHostInfo } from "../../../data/hassio/host"; +import { fetchHassioHostInfo } from "../../../data/hassio/host"; +import type { SupervisorMount, + SupervisorMounts, +} from "../../../data/supervisor/mounts"; +import { SupervisorMountState, SupervisorMountType, SupervisorMountUsage, - SupervisorMounts, fetchSupervisorMounts, reloadSupervisorMount, } from "../../../data/supervisor/mounts"; diff --git a/src/panels/config/storage/show-dialog-move-datadisk.ts b/src/panels/config/storage/show-dialog-move-datadisk.ts index 11a3b296c1fa..77c287ab7378 100644 --- a/src/panels/config/storage/show-dialog-move-datadisk.ts +++ b/src/panels/config/storage/show-dialog-move-datadisk.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import { HassioHostInfo } from "../../../data/hassio/host"; +import type { HassioHostInfo } from "../../../data/hassio/host"; export interface MoveDatadiskDialogParams { hostInfo: HassioHostInfo; diff --git a/src/panels/config/storage/show-dialog-view-mount.ts b/src/panels/config/storage/show-dialog-view-mount.ts index ad760b05c4ea..fbfe9dd9f72b 100644 --- a/src/panels/config/storage/show-dialog-view-mount.ts +++ b/src/panels/config/storage/show-dialog-view-mount.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import { SupervisorMount } from "../../../data/supervisor/mounts"; +import type { SupervisorMount } from "../../../data/supervisor/mounts"; export interface MountViewDialogParams { mount?: SupervisorMount; diff --git a/src/panels/config/tags/dialog-tag-detail.ts b/src/panels/config/tags/dialog-tag-detail.ts index ef86c9aea33c..85fe7764604b 100644 --- a/src/panels/config/tags/dialog-tag-detail.ts +++ b/src/panels/config/tags/dialog-tag-detail.ts @@ -1,5 +1,6 @@ import "@material/mwc-button"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import "../../../components/ha-alert"; @@ -8,11 +9,11 @@ import "../../../components/ha-formfield"; import "../../../components/ha-qr-code"; import "../../../components/ha-switch"; import "../../../components/ha-textfield"; -import { Tag, UpdateTagParams } from "../../../data/tag"; -import { HassDialog } from "../../../dialogs/make-dialog-manager"; +import type { Tag, UpdateTagParams } from "../../../data/tag"; +import type { HassDialog } from "../../../dialogs/make-dialog-manager"; import { haStyleDialog } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; -import { TagDetailDialogParams } from "./show-dialog-tag-detail"; +import type { HomeAssistant } from "../../../types"; +import type { TagDetailDialogParams } from "./show-dialog-tag-detail"; const TAG_BASE = "https://www.home-assistant.io/tag/"; diff --git a/src/panels/config/tags/ha-config-tags.ts b/src/panels/config/tags/ha-config-tags.ts index cf87bafa7d3d..52f0b7ad80c0 100644 --- a/src/panels/config/tags/ha-config-tags.ts +++ b/src/panels/config/tags/ha-config-tags.ts @@ -5,23 +5,23 @@ import { mdiPlus, mdiRobot, } from "@mdi/js"; -import { html, LitElement, PropertyValues } from "lit"; +import type { PropertyValues } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; -import { DataTableColumnContainer } from "../../../components/data-table/ha-data-table"; +import type { DataTableColumnContainer } from "../../../components/data-table/ha-data-table"; import "../../../components/ha-fab"; import "../../../components/ha-icon-button"; import "../../../components/ha-relative-time"; -import { showAutomationEditor, TagTrigger } from "../../../data/automation"; +import type { TagTrigger } from "../../../data/automation"; +import { showAutomationEditor } from "../../../data/automation"; +import type { Tag, TagScannedEvent, UpdateTagParams } from "../../../data/tag"; import { createTag, deleteTag, EVENT_TAG_SCANNED, fetchTags, - Tag, - TagScannedEvent, updateTag, - UpdateTagParams, } from "../../../data/tag"; import { showAlertDialog, @@ -29,8 +29,8 @@ import { } from "../../../dialogs/generic/show-dialog-box"; import "../../../layouts/hass-tabs-subpage-data-table"; import { SubscribeMixin } from "../../../mixins/subscribe-mixin"; -import { HomeAssistant, Route } from "../../../types"; -import { LocalizeFunc } from "../../../common/translations/localize"; +import type { HomeAssistant, Route } from "../../../types"; +import type { LocalizeFunc } from "../../../common/translations/localize"; import { documentationUrl } from "../../../util/documentation-url"; import { configSections } from "../ha-panel-config"; import { showTagDetailDialog } from "./show-dialog-tag-detail"; diff --git a/src/panels/config/tags/show-dialog-tag-detail.ts b/src/panels/config/tags/show-dialog-tag-detail.ts index 68f26026e228..f80250079649 100644 --- a/src/panels/config/tags/show-dialog-tag-detail.ts +++ b/src/panels/config/tags/show-dialog-tag-detail.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import { Tag, UpdateTagParams } from "../../../data/tag"; +import type { Tag, UpdateTagParams } from "../../../data/tag"; export interface TagDetailDialogParams { entry?: Tag; diff --git a/src/panels/config/tags/tag-image.ts b/src/panels/config/tags/tag-image.ts index 17c3b636edb3..ab5bff3dca9a 100644 --- a/src/panels/config/tags/tag-image.ts +++ b/src/panels/config/tags/tag-image.ts @@ -1,8 +1,9 @@ import { mdiNfcVariant } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../components/ha-svg-icon"; -import { TagRowData } from "./ha-config-tags"; +import type { TagRowData } from "./ha-config-tags"; @customElement("tag-image") export class HaTagImage extends LitElement { diff --git a/src/panels/config/users/dialog-add-user.ts b/src/panels/config/users/dialog-add-user.ts index 7e7e9e70cdd7..2c490b03e061 100644 --- a/src/panels/config/users/dialog-add-user.ts +++ b/src/panels/config/users/dialog-add-user.ts @@ -1,11 +1,5 @@ -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/ha-alert"; import "../../../components/ha-button"; @@ -19,16 +13,16 @@ import type { HaSwitch } from "../../../components/ha-switch"; import "../../../components/ha-textfield"; import type { HaTextField } from "../../../components/ha-textfield"; import { createAuthForUser } from "../../../data/auth"; +import type { User } from "../../../data/user"; import { SYSTEM_GROUP_ID_ADMIN, SYSTEM_GROUP_ID_USER, - User, createUser, deleteUser, } from "../../../data/user"; import { haStyleDialog } from "../../../resources/styles"; -import { HomeAssistant, ValueChangedEvent } from "../../../types"; -import { AddUserDialogParams } from "./show-dialog-add-user"; +import type { HomeAssistant, ValueChangedEvent } from "../../../types"; +import type { AddUserDialogParams } from "./show-dialog-add-user"; import "../../../components/ha-password-field"; @customElement("dialog-add-user") diff --git a/src/panels/config/users/dialog-admin-change-password.ts b/src/panels/config/users/dialog-admin-change-password.ts index 71b5aa75ae4c..558f4145ce59 100644 --- a/src/panels/config/users/dialog-admin-change-password.ts +++ b/src/panels/config/users/dialog-admin-change-password.ts @@ -1,17 +1,18 @@ import "@material/mwc-button"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import { createCloseHeading } from "../../../components/ha-dialog"; import "../../../components/ha-form/ha-form"; -import { SchemaUnion } from "../../../components/ha-form/types"; +import type { SchemaUnion } from "../../../components/ha-form/types"; import "../../../components/ha-textfield"; import { adminChangePassword } from "../../../data/auth"; import { haStyleDialog } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { showToast } from "../../../util/toast"; -import { AdminChangePasswordDialogParams } from "./show-dialog-admin-change-password"; +import type { AdminChangePasswordDialogParams } from "./show-dialog-admin-change-password"; const SCHEMA = [ { diff --git a/src/panels/config/users/dialog-user-detail.ts b/src/panels/config/users/dialog-user-detail.ts index 98cf4b018751..287e21118e85 100644 --- a/src/panels/config/users/dialog-user-detail.ts +++ b/src/panels/config/users/dialog-user-detail.ts @@ -1,5 +1,6 @@ import { mdiPencil } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/ha-alert"; import "../../../components/ha-button"; @@ -22,9 +23,9 @@ import { showPromptDialog, } from "../../../dialogs/generic/show-dialog-box"; import { haStyleDialog } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { showAdminChangePasswordDialog } from "./show-dialog-admin-change-password"; -import { UserDetailDialogParams } from "./show-dialog-user-detail"; +import type { UserDetailDialogParams } from "./show-dialog-user-detail"; @customElement("dialog-user-detail") class DialogUserDetail extends LitElement { diff --git a/src/panels/config/users/ha-config-users.ts b/src/panels/config/users/ha-config-users.ts index 3b1dbce4c2bd..c8618ae34413 100644 --- a/src/panels/config/users/ha-config-users.ts +++ b/src/panels/config/users/ha-config-users.ts @@ -1,10 +1,11 @@ import { mdiCheck, mdiPlus } from "@mdi/js"; -import { LitElement, PropertyValues, html } from "lit"; +import type { PropertyValues } from "lit"; +import { LitElement, html } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; -import { HASSDomEvent } from "../../../common/dom/fire_event"; -import { LocalizeFunc } from "../../../common/translations/localize"; -import { +import type { HASSDomEvent } from "../../../common/dom/fire_event"; +import type { LocalizeFunc } from "../../../common/translations/localize"; +import type { DataTableColumnContainer, RowClickedEvent, SortingChangedEvent, @@ -13,8 +14,8 @@ import "../../../components/data-table/ha-data-table-icon"; import "../../../components/ha-fab"; import "../../../components/ha-help-tooltip"; import "../../../components/ha-svg-icon"; +import type { User } from "../../../data/user"; import { - User, computeUserBadges, deleteUser, fetchUsers, @@ -22,7 +23,7 @@ import { } from "../../../data/user"; import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box"; import "../../../layouts/hass-tabs-subpage-data-table"; -import { HomeAssistant, Route } from "../../../types"; +import type { HomeAssistant, Route } from "../../../types"; import { configSections } from "../ha-panel-config"; import { showAddUserDialog } from "./show-dialog-add-user"; import { showUserDetailDialog } from "./show-dialog-user-detail"; diff --git a/src/panels/config/users/show-dialog-add-user.ts b/src/panels/config/users/show-dialog-add-user.ts index 8fa226370fa2..84856e8a97cd 100644 --- a/src/panels/config/users/show-dialog-add-user.ts +++ b/src/panels/config/users/show-dialog-add-user.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import { User } from "../../../data/user"; +import type { User } from "../../../data/user"; export interface AddUserDialogParams { userAddedCallback: (user: User) => void; diff --git a/src/panels/config/users/show-dialog-user-detail.ts b/src/panels/config/users/show-dialog-user-detail.ts index e9d05cb112d4..90db3fe82bb8 100644 --- a/src/panels/config/users/show-dialog-user-detail.ts +++ b/src/panels/config/users/show-dialog-user-detail.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import { UpdateUserParams, User } from "../../../data/user"; +import type { UpdateUserParams, User } from "../../../data/user"; export interface UserDetailDialogParams { entry: User; diff --git a/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-config.ts b/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-config.ts index 2791d89f1334..592749b425c2 100644 --- a/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-config.ts +++ b/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-config.ts @@ -1,9 +1,10 @@ -import { css, CSSResultGroup, html, LitElement } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; -import { LocalizeKeys } from "../../../../common/translations/localize"; -import { AssistPipeline } from "../../../../data/assist_pipeline"; -import { HomeAssistant } from "../../../../types"; +import type { LocalizeKeys } from "../../../../common/translations/localize"; +import type { AssistPipeline } from "../../../../data/assist_pipeline"; +import type { HomeAssistant } from "../../../../types"; import "../../../../components/ha-form/ha-form"; @customElement("assist-pipeline-detail-config") diff --git a/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-conversation.ts b/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-conversation.ts index cd2b6441dd76..22c93108d39d 100644 --- a/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-conversation.ts +++ b/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-conversation.ts @@ -1,9 +1,10 @@ -import { css, CSSResultGroup, html, LitElement } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; -import { LocalizeKeys } from "../../../../common/translations/localize"; -import { AssistPipeline } from "../../../../data/assist_pipeline"; -import { HomeAssistant } from "../../../../types"; +import type { LocalizeKeys } from "../../../../common/translations/localize"; +import type { AssistPipeline } from "../../../../data/assist_pipeline"; +import type { HomeAssistant } from "../../../../types"; import "../../../../components/ha-form/ha-form"; import { fireEvent } from "../../../../common/dom/fire_event"; diff --git a/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-stt.ts b/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-stt.ts index 46d411dc6fd5..6ae3f463d0fd 100644 --- a/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-stt.ts +++ b/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-stt.ts @@ -1,9 +1,10 @@ -import { css, CSSResultGroup, html, LitElement } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; -import { LocalizeKeys } from "../../../../common/translations/localize"; -import { AssistPipeline } from "../../../../data/assist_pipeline"; -import { HomeAssistant } from "../../../../types"; +import type { LocalizeKeys } from "../../../../common/translations/localize"; +import type { AssistPipeline } from "../../../../data/assist_pipeline"; +import type { HomeAssistant } from "../../../../types"; import "../../../../components/ha-form/ha-form"; @customElement("assist-pipeline-detail-stt") diff --git a/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-tts.ts b/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-tts.ts index a99abb48dc0d..f3d7d0140065 100644 --- a/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-tts.ts +++ b/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-tts.ts @@ -1,12 +1,13 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; -import { LocalizeKeys } from "../../../../common/translations/localize"; +import type { LocalizeKeys } from "../../../../common/translations/localize"; import "../../../../components/ha-button"; import "../../../../components/ha-form/ha-form"; -import { AssistPipeline } from "../../../../data/assist_pipeline"; +import type { AssistPipeline } from "../../../../data/assist_pipeline"; import { showTTSTryDialog } from "../../../../dialogs/tts-try/show-dialog-tts-try"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; @customElement("assist-pipeline-detail-tts") export class AssistPipelineDetailTTS extends LitElement { diff --git a/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-wakeword.ts b/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-wakeword.ts index 7180bb295078..75e94ea3a547 100644 --- a/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-wakeword.ts +++ b/src/panels/config/voice-assistants/assist-pipeline-detail/assist-pipeline-detail-wakeword.ts @@ -1,18 +1,13 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; -import { LocalizeKeys } from "../../../../common/translations/localize"; +import type { LocalizeKeys } from "../../../../common/translations/localize"; import "../../../../components/ha-form/ha-form"; -import { AssistPipeline } from "../../../../data/assist_pipeline"; -import { HomeAssistant } from "../../../../types"; -import { fetchWakeWordInfo, WakeWord } from "../../../../data/wake_word"; +import type { AssistPipeline } from "../../../../data/assist_pipeline"; +import type { HomeAssistant } from "../../../../types"; +import type { WakeWord } from "../../../../data/wake_word"; +import { fetchWakeWordInfo } from "../../../../data/wake_word"; import { documentationUrl } from "../../../../util/documentation-url"; import { fireEvent } from "../../../../common/dom/fire_event"; diff --git a/src/panels/config/voice-assistants/assist-pref.ts b/src/panels/config/voice-assistants/assist-pref.ts index c7d6d6646255..8692d95680b1 100644 --- a/src/panels/config/voice-assistants/assist-pref.ts +++ b/src/panels/config/voice-assistants/assist-pref.ts @@ -8,7 +8,8 @@ import { mdiStar, mdiTrashCan, } from "@mdi/js"; -import { CSSResultGroup, LitElement, PropertyValues, css, html } from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { formatLanguageCode } from "../../../common/language/format_language"; @@ -20,16 +21,16 @@ import "../../../components/ha-icon-button"; import "../../../components/ha-list-item"; import "../../../components/ha-svg-icon"; import "../../../components/ha-switch"; +import type { AssistPipeline } from "../../../data/assist_pipeline"; import { - AssistPipeline, createAssistPipeline, deleteAssistPipeline, listAssistPipelines, setAssistPipelinePreferred, updateAssistPipeline, } from "../../../data/assist_pipeline"; -import { CloudStatus } from "../../../data/cloud"; -import { ExposeEntitySettings } from "../../../data/expose"; +import type { CloudStatus } from "../../../data/cloud"; +import type { ExposeEntitySettings } from "../../../data/expose"; import { showAlertDialog, showConfirmationDialog, diff --git a/src/panels/config/voice-assistants/assist/ha-config-voice-assistants-assist-devices.ts b/src/panels/config/voice-assistants/assist/ha-config-voice-assistants-assist-devices.ts index 5e3f250d90a9..4283f930d968 100644 --- a/src/panels/config/voice-assistants/assist/ha-config-voice-assistants-assist-devices.ts +++ b/src/panels/config/voice-assistants/assist/ha-config-voice-assistants-assist-devices.ts @@ -1,19 +1,22 @@ -import { LitElement, PropertyValues, html } from "lit"; +import type { PropertyValues } from "lit"; +import { LitElement, html } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { navigate } from "../../../../common/navigate"; -import { LocalizeFunc } from "../../../../common/translations/localize"; +import type { LocalizeFunc } from "../../../../common/translations/localize"; import "../../../../components/data-table/ha-data-table"; import type { DataTableColumnContainer } from "../../../../components/data-table/ha-data-table"; -import { +import type { AssistDevice, AssistPipeline, +} from "../../../../data/assist_pipeline"; +import { listAssistDevices, listAssistPipelines, } from "../../../../data/assist_pipeline"; import { computeDeviceName } from "../../../../data/device_registry"; import "../../../../layouts/hass-subpage"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; interface AssistDeviceExtra extends AssistDevice { name: string; diff --git a/src/panels/config/voice-assistants/cloud-alexa-pref.ts b/src/panels/config/voice-assistants/cloud-alexa-pref.ts index d4fccc2cb8b8..cdf03fee3061 100644 --- a/src/panels/config/voice-assistants/cloud-alexa-pref.ts +++ b/src/panels/config/voice-assistants/cloud-alexa-pref.ts @@ -1,6 +1,7 @@ import "@material/mwc-button"; import { mdiHelpCircle } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../common/dom/fire_event"; @@ -10,9 +11,10 @@ import "../../../components/ha-card"; import "../../../components/ha-settings-row"; import "../../../components/ha-switch"; import type { HaSwitch } from "../../../components/ha-switch"; -import { CloudStatusLoggedIn, updateCloudPref } from "../../../data/cloud"; +import type { CloudStatusLoggedIn } from "../../../data/cloud"; +import { updateCloudPref } from "../../../data/cloud"; +import type { ExposeEntitySettings } from "../../../data/expose"; import { - ExposeEntitySettings, getExposeNewEntities, setExposeNewEntities, } from "../../../data/expose"; diff --git a/src/panels/config/voice-assistants/cloud-discover.ts b/src/panels/config/voice-assistants/cloud-discover.ts index c8eff2db54f1..a770149e2523 100644 --- a/src/panels/config/voice-assistants/cloud-discover.ts +++ b/src/panels/config/voice-assistants/cloud-discover.ts @@ -1,5 +1,6 @@ import { mdiMicrophoneMessage, mdiOpenInNew } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../components/ha-card"; import type { HomeAssistant } from "../../../types"; diff --git a/src/panels/config/voice-assistants/cloud-google-pref.ts b/src/panels/config/voice-assistants/cloud-google-pref.ts index 951d85ee61a0..ae3eddd4081c 100644 --- a/src/panels/config/voice-assistants/cloud-google-pref.ts +++ b/src/panels/config/voice-assistants/cloud-google-pref.ts @@ -1,6 +1,7 @@ import "@material/mwc-button"; import { mdiHelpCircle } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../common/dom/fire_event"; @@ -12,13 +13,14 @@ import "../../../components/ha-switch"; import type { HaSwitch } from "../../../components/ha-switch"; import "../../../components/ha-textfield"; import type { HaTextField } from "../../../components/ha-textfield"; -import { CloudStatusLoggedIn, updateCloudPref } from "../../../data/cloud"; +import type { CloudStatusLoggedIn } from "../../../data/cloud"; +import { updateCloudPref } from "../../../data/cloud"; +import type { ExposeEntitySettings } from "../../../data/expose"; import { - ExposeEntitySettings, getExposeNewEntities, setExposeNewEntities, } from "../../../data/expose"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { brandsUrl } from "../../../util/brands-url"; import { showSaveSuccessToast } from "../../../util/toast-saved-success"; diff --git a/src/panels/config/voice-assistants/debug/assist-debug.ts b/src/panels/config/voice-assistants/debug/assist-debug.ts index 9495bc5ffa39..90316b31c62d 100644 --- a/src/panels/config/voice-assistants/debug/assist-debug.ts +++ b/src/panels/config/voice-assistants/debug/assist-debug.ts @@ -1,6 +1,6 @@ import { html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; -import { HomeAssistant, Route } from "../../../../types"; +import type { HomeAssistant, Route } from "../../../../types"; import "./assist-pipeline-debug"; import "./assist-pipeline-run-debug"; diff --git a/src/panels/config/voice-assistants/debug/assist-pipeline-debug.ts b/src/panels/config/voice-assistants/debug/assist-pipeline-debug.ts index 929d718255da..05547451f0d2 100644 --- a/src/panels/config/voice-assistants/debug/assist-pipeline-debug.ts +++ b/src/panels/config/voice-assistants/debug/assist-pipeline-debug.ts @@ -7,16 +7,18 @@ import { LitElement, css, html } from "lit"; import { customElement, property, state } from "lit/decorators"; import { repeat } from "lit/directives/repeat"; import { formatDateTimeWithSeconds } from "../../../../common/datetime/format_date_time"; -import { +import type { PipelineRunEvent, assistRunListing, +} from "../../../../data/assist_pipeline"; +import { getAssistPipelineRun, listAssistPipelineRuns, } from "../../../../data/assist_pipeline"; import { showAlertDialog } from "../../../../dialogs/generic/show-dialog-box"; import "../../../../layouts/hass-subpage"; import { haStyle } from "../../../../resources/styles"; -import { HomeAssistant, Route } from "../../../../types"; +import type { HomeAssistant, Route } from "../../../../types"; import "./assist-render-pipeline-events"; @customElement("assist-pipeline-debug") diff --git a/src/panels/config/voice-assistants/debug/assist-pipeline-run-debug.ts b/src/panels/config/voice-assistants/debug/assist-pipeline-run-debug.ts index 6137be81b1be..db714ea87c13 100644 --- a/src/panels/config/voice-assistants/debug/assist-pipeline-run-debug.ts +++ b/src/panels/config/voice-assistants/debug/assist-pipeline-run-debug.ts @@ -1,4 +1,5 @@ -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { extractSearchParam } from "../../../../common/url/search-params"; import "../../../../components/ha-assist-pipeline-picker"; @@ -8,11 +9,11 @@ import type { HaCheckbox } from "../../../../components/ha-checkbox"; import "../../../../components/ha-formfield"; import "../../../../components/ha-textfield"; import type { HaTextField } from "../../../../components/ha-textfield"; -import { +import type { PipelineRun, PipelineRunOptions, - runDebugAssistPipeline, } from "../../../../data/assist_pipeline"; +import { runDebugAssistPipeline } from "../../../../data/assist_pipeline"; import { showAlertDialog, showPromptDialog, diff --git a/src/panels/config/voice-assistants/debug/assist-render-pipeline-events.ts b/src/panels/config/voice-assistants/debug/assist-render-pipeline-events.ts index 7572553b553a..9c542c6962d2 100644 --- a/src/panels/config/voice-assistants/debug/assist-render-pipeline-events.ts +++ b/src/panels/config/voice-assistants/debug/assist-render-pipeline-events.ts @@ -1,11 +1,12 @@ -import { html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; -import { +import type { PipelineRun, PipelineRunEvent, - processEvent, } from "../../../../data/assist_pipeline"; +import { processEvent } from "../../../../data/assist_pipeline"; import type { HomeAssistant } from "../../../../types"; import "./assist-render-pipeline-run"; diff --git a/src/panels/config/voice-assistants/debug/assist-render-pipeline-run.ts b/src/panels/config/voice-assistants/debug/assist-render-pipeline-run.ts index ea42a9c89f97..b3c2a8629678 100644 --- a/src/panels/config/voice-assistants/debug/assist-render-pipeline-run.ts +++ b/src/panels/config/voice-assistants/debug/assist-render-pipeline-run.ts @@ -1,4 +1,5 @@ -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../../components/ha-card"; import "../../../../components/ha-alert"; diff --git a/src/panels/config/voice-assistants/dialog-expose-entity.ts b/src/panels/config/voice-assistants/dialog-expose-entity.ts index e4ff476fba09..6197fa084127 100644 --- a/src/panels/config/voice-assistants/dialog-expose-entity.ts +++ b/src/panels/config/voice-assistants/dialog-expose-entity.ts @@ -1,8 +1,10 @@ +import "@lit-labs/virtualizer"; import "@material/mwc-button"; import "@material/mwc-list"; import { mdiClose } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import memoizeOne from "memoize-one"; @@ -10,11 +12,15 @@ import { fireEvent } from "../../../common/dom/fire_event"; import { computeStateName } from "../../../common/entity/compute_state_name"; import "../../../components/ha-check-list-item"; import "../../../components/search-input"; -import { ExposeEntitySettings, voiceAssistants } from "../../../data/expose"; +import "../../../components/ha-dialog"; +import "../../../components/ha-dialog-header"; +import "../../../components/ha-state-icon"; +import type { ExposeEntitySettings } from "../../../data/expose"; +import { voiceAssistants } from "../../../data/expose"; import { haStyle } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import "./entity-voice-settings"; -import { ExposeEntityDialogParams } from "./show-dialog-expose-entity"; +import type { ExposeEntityDialogParams } from "./show-dialog-expose-entity"; @customElement("dialog-expose-entity") class DialogExposeEntity extends LitElement { diff --git a/src/panels/config/voice-assistants/dialog-voice-assistant-pipeline-detail.ts b/src/panels/config/voice-assistants/dialog-voice-assistant-pipeline-detail.ts index 94d345ba5e97..3cd566abf75d 100644 --- a/src/panels/config/voice-assistants/dialog-voice-assistant-pipeline-detail.ts +++ b/src/panels/config/voice-assistants/dialog-voice-assistant-pipeline-detail.ts @@ -1,24 +1,25 @@ import { mdiClose } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import "../../../components/ha-button"; import "../../../components/ha-dialog-header"; import "../../../components/ha-form/ha-form"; -import { +import type { AssistPipeline, AssistPipelineMutableParams, - fetchAssistPipelineLanguages, } from "../../../data/assist_pipeline"; +import { fetchAssistPipelineLanguages } from "../../../data/assist_pipeline"; import { haStyleDialog } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import "./assist-pipeline-detail/assist-pipeline-detail-config"; import "./assist-pipeline-detail/assist-pipeline-detail-conversation"; import "./assist-pipeline-detail/assist-pipeline-detail-stt"; import "./assist-pipeline-detail/assist-pipeline-detail-tts"; import "./assist-pipeline-detail/assist-pipeline-detail-wakeword"; import "./debug/assist-render-pipeline-events"; -import { VoiceAssistantPipelineDetailsDialogParams } from "./show-dialog-voice-assistant-pipeline-detail"; +import type { VoiceAssistantPipelineDetailsDialogParams } from "./show-dialog-voice-assistant-pipeline-detail"; import { computeDomain } from "../../../common/entity/compute_domain"; @customElement("dialog-voice-assistant-pipeline-detail") diff --git a/src/panels/config/voice-assistants/dialog-voice-settings.ts b/src/panels/config/voice-assistants/dialog-voice-settings.ts index f8c85ab95e0d..8113e155d765 100644 --- a/src/panels/config/voice-assistants/dialog-voice-settings.ts +++ b/src/panels/config/voice-assistants/dialog-voice-settings.ts @@ -1,15 +1,17 @@ import "@material/mwc-button/mwc-button"; import { mdiClose, mdiTuneVertical } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import { computeStateName } from "../../../common/entity/compute_state_name"; import "../../../components/ha-dialog-header"; +import "../../../components/ha-dialog"; import { showMoreInfoDialog } from "../../../dialogs/more-info/show-ha-more-info-dialog"; import { haStyle, haStyleDialog } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import "./entity-voice-settings"; -import { VoiceSettingsDialogParams } from "./show-dialog-voice-settings"; +import type { VoiceSettingsDialogParams } from "./show-dialog-voice-settings"; @customElement("dialog-voice-settings") class DialogVoiceSettings extends LitElement { diff --git a/src/panels/config/voice-assistants/entity-voice-settings.ts b/src/panels/config/voice-assistants/entity-voice-settings.ts index 4dd72efcaeb9..e3ee2ecea202 100644 --- a/src/panels/config/voice-assistants/entity-voice-settings.ts +++ b/src/panels/config/voice-assistants/entity-voice-settings.ts @@ -1,51 +1,44 @@ import { mdiAlertCircle } from "@mdi/js"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import { fireEvent } from "../../../common/dom/fire_event"; -import { +import type { EntityFilter, FilterFunc, +} from "../../../common/entity/entity_filter"; +import { generateFilter, isEmptyFilter, } from "../../../common/entity/entity_filter"; import "../../../components/ha-aliases-editor"; import "../../../components/ha-settings-row"; import "../../../components/ha-switch"; +import "../../../components/ha-formfield"; +import "../../../components/ha-checkbox"; +import "../../../components/ha-alert"; import { fetchCloudAlexaEntity } from "../../../data/alexa"; +import type { CloudStatus, CloudStatusLoggedIn } from "../../../data/cloud"; import { - CloudStatus, - CloudStatusLoggedIn, fetchCloudStatus, updateCloudGoogleEntityConfig, } from "../../../data/cloud"; +import type { ExtEntityRegistryEntry } from "../../../data/entity_registry"; import { - ExtEntityRegistryEntry, getExtendedEntityRegistryEntry, updateEntityRegistryEntry, } from "../../../data/entity_registry"; -import { - fetchCloudGoogleEntity, - GoogleEntity, -} from "../../../data/google_assistant"; -import { - exposeEntities, - ExposeEntitySettings, - voiceAssistants, -} from "../../../data/expose"; +import type { GoogleEntity } from "../../../data/google_assistant"; +import { fetchCloudGoogleEntity } from "../../../data/google_assistant"; +import type { ExposeEntitySettings } from "../../../data/expose"; +import { exposeEntities, voiceAssistants } from "../../../data/expose"; import { SubscribeMixin } from "../../../mixins/subscribe-mixin"; import { haStyle } from "../../../resources/styles"; import type { HomeAssistant } from "../../../types"; import { brandsUrl } from "../../../util/brands-url"; -import { EntityRegistrySettings } from "../entities/entity-registry-settings"; +import type { EntityRegistrySettings } from "../entities/entity-registry-settings"; import { documentationUrl } from "../../../util/documentation-url"; @customElement("entity-voice-settings") diff --git a/src/panels/config/voice-assistants/expose/expose-assistant-icon.ts b/src/panels/config/voice-assistants/expose/expose-assistant-icon.ts index 69d0bcf8215d..7438d782fd49 100644 --- a/src/panels/config/voice-assistants/expose/expose-assistant-icon.ts +++ b/src/panels/config/voice-assistants/expose/expose-assistant-icon.ts @@ -1,10 +1,11 @@ import "@lrnwebcomponents/simple-tooltip/simple-tooltip"; import { mdiAlertCircle } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import { voiceAssistants } from "../../../../data/expose"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; import { brandsUrl } from "../../../../util/brands-url"; import "../../../../components/ha-svg-icon"; diff --git a/src/panels/config/voice-assistants/ha-config-voice-assistants-assistants.ts b/src/panels/config/voice-assistants/ha-config-voice-assistants-assistants.ts index 623c1932cb11..78a51bec9228 100644 --- a/src/panels/config/voice-assistants/ha-config-voice-assistants-assistants.ts +++ b/src/panels/config/voice-assistants/ha-config-voice-assistants-assistants.ts @@ -1,12 +1,12 @@ import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; -import { CloudStatus } from "../../../data/cloud"; -import { ExposeEntitySettings } from "../../../data/expose"; +import type { CloudStatus } from "../../../data/cloud"; +import type { ExposeEntitySettings } from "../../../data/expose"; import "../../../layouts/hass-loading-screen"; import "../../../layouts/hass-tabs-subpage"; -import { HomeAssistant, Route } from "../../../types"; +import type { HomeAssistant, Route } from "../../../types"; import "./assist-pref"; import "./cloud-alexa-pref"; import "./cloud-discover"; diff --git a/src/panels/config/voice-assistants/ha-config-voice-assistants-expose.ts b/src/panels/config/voice-assistants/ha-config-voice-assistants-expose.ts index dfa40a6f832c..c9fe565c5cff 100644 --- a/src/panels/config/voice-assistants/ha-config-voice-assistants-expose.ts +++ b/src/panels/config/voice-assistants/ha-config-voice-assistants-expose.ts @@ -6,19 +6,21 @@ import { mdiPlus, mdiPlusBoxMultiple, } from "@mdi/js"; -import { CSSResultGroup, LitElement, PropertyValues, css, html } from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import memoize from "memoize-one"; -import { HASSDomEvent, fireEvent } from "../../../common/dom/fire_event"; +import type { HASSDomEvent } from "../../../common/dom/fire_event"; +import { fireEvent } from "../../../common/dom/fire_event"; import { computeStateName } from "../../../common/entity/compute_state_name"; +import type { EntityFilter } from "../../../common/entity/entity_filter"; import { - EntityFilter, generateFilter, isEmptyFilter, } from "../../../common/entity/entity_filter"; import { navigate } from "../../../common/navigate"; -import { +import type { DataTableColumnContainer, DataTableRowData, RowClickedEvent, @@ -26,29 +28,23 @@ import { SortingChangedEvent, } from "../../../components/data-table/ha-data-table"; import "../../../components/ha-fab"; -import { AlexaEntity, fetchCloudAlexaEntities } from "../../../data/alexa"; -import { CloudStatus, CloudStatusLoggedIn } from "../../../data/cloud"; +import type { AlexaEntity } from "../../../data/alexa"; +import { fetchCloudAlexaEntities } from "../../../data/alexa"; +import type { CloudStatus, CloudStatusLoggedIn } from "../../../data/cloud"; import { entitiesContext } from "../../../data/context"; -import { - ExtEntityRegistryEntry, - getExtendedEntityRegistryEntries, -} from "../../../data/entity_registry"; -import { - ExposeEntitySettings, - exposeEntities, - voiceAssistants, -} from "../../../data/expose"; -import { - GoogleEntity, - fetchCloudGoogleEntities, -} from "../../../data/google_assistant"; +import type { ExtEntityRegistryEntry } from "../../../data/entity_registry"; +import { getExtendedEntityRegistryEntries } from "../../../data/entity_registry"; +import type { ExposeEntitySettings } from "../../../data/expose"; +import { exposeEntities, voiceAssistants } from "../../../data/expose"; +import type { GoogleEntity } from "../../../data/google_assistant"; +import { fetchCloudGoogleEntities } from "../../../data/google_assistant"; import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box"; import "../../../layouts/hass-loading-screen"; import "../../../layouts/hass-tabs-subpage-data-table"; import type { HaTabsSubpageDataTable } from "../../../layouts/hass-tabs-subpage-data-table"; import { haStyle } from "../../../resources/styles"; -import { HomeAssistant, Route } from "../../../types"; -import { LocalizeFunc } from "../../../common/translations/localize"; +import type { HomeAssistant, Route } from "../../../types"; +import type { LocalizeFunc } from "../../../common/translations/localize"; import "./expose/expose-assistant-icon"; import { voiceAssistantTabs } from "./ha-config-voice-assistants"; import { showExposeEntityDialog } from "./show-dialog-expose-entity"; diff --git a/src/panels/config/voice-assistants/ha-config-voice-assistants.ts b/src/panels/config/voice-assistants/ha-config-voice-assistants.ts index 8c99c7808b66..3ead98d7acb8 100644 --- a/src/panels/config/voice-assistants/ha-config-voice-assistants.ts +++ b/src/panels/config/voice-assistants/ha-config-voice-assistants.ts @@ -1,18 +1,14 @@ import { consume } from "@lit-labs/context"; import { mdiDevices, mdiMicrophone } from "@mdi/js"; -import { PropertyValues } from "lit"; +import type { PropertyValues } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { CloudStatus } from "../../../data/cloud"; +import type { CloudStatus } from "../../../data/cloud"; import { entitiesContext } from "../../../data/context"; -import { - ExposeEntitySettings, - listExposedEntities, -} from "../../../data/expose"; -import { - HassRouterPage, - RouterOptions, -} from "../../../layouts/hass-router-page"; -import { HomeAssistant } from "../../../types"; +import type { ExposeEntitySettings } from "../../../data/expose"; +import { listExposedEntities } from "../../../data/expose"; +import type { RouterOptions } from "../../../layouts/hass-router-page"; +import { HassRouterPage } from "../../../layouts/hass-router-page"; +import type { HomeAssistant } from "../../../types"; export const voiceAssistantTabs = [ { diff --git a/src/panels/config/voice-assistants/show-dialog-expose-entity.ts b/src/panels/config/voice-assistants/show-dialog-expose-entity.ts index 4a9a992363bc..01d74fc09872 100644 --- a/src/panels/config/voice-assistants/show-dialog-expose-entity.ts +++ b/src/panels/config/voice-assistants/show-dialog-expose-entity.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import { ExposeEntitySettings } from "../../../data/expose"; +import type { ExposeEntitySettings } from "../../../data/expose"; export interface ExposeEntityDialogParams { filterAssistants: string[]; diff --git a/src/panels/config/voice-assistants/show-dialog-voice-assistant-pipeline-detail.ts b/src/panels/config/voice-assistants/show-dialog-voice-assistant-pipeline-detail.ts index 21dbdac76c50..887763e08de1 100644 --- a/src/panels/config/voice-assistants/show-dialog-voice-assistant-pipeline-detail.ts +++ b/src/panels/config/voice-assistants/show-dialog-voice-assistant-pipeline-detail.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import { +import type { AssistPipeline, AssistPipelineMutableParams, } from "../../../data/assist_pipeline"; diff --git a/src/panels/config/voice-assistants/show-dialog-voice-settings.ts b/src/panels/config/voice-assistants/show-dialog-voice-settings.ts index 7a0395127205..25794d7a175a 100644 --- a/src/panels/config/voice-assistants/show-dialog-voice-settings.ts +++ b/src/panels/config/voice-assistants/show-dialog-voice-settings.ts @@ -1,6 +1,6 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import { ExtEntityRegistryEntry } from "../../../data/entity_registry"; -import { ExposeEntitySettings } from "../../../data/expose"; +import type { ExtEntityRegistryEntry } from "../../../data/entity_registry"; +import type { ExposeEntitySettings } from "../../../data/expose"; export interface VoiceSettingsDialogParams { entityId: string; diff --git a/src/panels/config/zone/dialog-home-zone-detail.ts b/src/panels/config/zone/dialog-home-zone-detail.ts index fd0d1edd4906..0a25f8d713a9 100644 --- a/src/panels/config/zone/dialog-home-zone-detail.ts +++ b/src/panels/config/zone/dialog-home-zone-detail.ts @@ -1,14 +1,15 @@ import "@material/mwc-button"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../common/dom/fire_event"; import { createCloseHeading } from "../../../components/ha-dialog"; import "../../../components/ha-form/ha-form"; -import { HomeZoneMutableParams } from "../../../data/zone"; +import type { HomeZoneMutableParams } from "../../../data/zone"; import { haStyleDialog } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; -import { HomeZoneDetailDialogParams } from "./show-dialog-home-zone-detail"; +import type { HomeAssistant } from "../../../types"; +import type { HomeZoneDetailDialogParams } from "./show-dialog-home-zone-detail"; const SCHEMA = [ { diff --git a/src/panels/config/zone/dialog-zone-detail.ts b/src/panels/config/zone/dialog-zone-detail.ts index 064bf61fa798..065d1e514954 100644 --- a/src/panels/config/zone/dialog-zone-detail.ts +++ b/src/panels/config/zone/dialog-zone-detail.ts @@ -1,16 +1,18 @@ import "@material/mwc-button"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../common/dom/fire_event"; import { addDistanceToCoord } from "../../../common/location/add_distance_to_coord"; import { createCloseHeading } from "../../../components/ha-dialog"; import "../../../components/ha-form/ha-form"; -import { SchemaUnion } from "../../../components/ha-form/types"; -import { getZoneEditorInitData, ZoneMutableParams } from "../../../data/zone"; +import type { SchemaUnion } from "../../../components/ha-form/types"; +import type { ZoneMutableParams } from "../../../data/zone"; +import { getZoneEditorInitData } from "../../../data/zone"; import { haStyleDialog } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; -import { ZoneDetailDialogParams } from "./show-dialog-zone-detail"; +import type { HomeAssistant } from "../../../types"; +import type { ZoneDetailDialogParams } from "./show-dialog-zone-detail"; class DialogZoneDetail extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; diff --git a/src/panels/config/zone/ha-config-zone.ts b/src/panels/config/zone/ha-config-zone.ts index 47f12cb6439d..25306721af58 100644 --- a/src/panels/config/zone/ha-config-zone.ts +++ b/src/panels/config/zone/ha-config-zone.ts @@ -1,16 +1,9 @@ import "@lrnwebcomponents/simple-tooltip/simple-tooltip"; import "@material/mwc-list/mwc-list"; import { mdiPencil, mdiPencilOff, mdiPlus } from "@mdi/js"; -import { HassEntity, UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { HassEntity, UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { computeStateDomain } from "../../../common/entity/compute_state_domain"; @@ -29,10 +22,12 @@ import type { } from "../../../components/map/ha-locations-editor"; import { saveCoreConfig } from "../../../data/core"; import { subscribeEntityRegistry } from "../../../data/entity_registry"; -import { +import type { HomeZoneMutableParams, Zone, ZoneMutableParams, +} from "../../../data/zone"; +import { createZone, deleteZone, fetchZones, diff --git a/src/panels/config/zone/show-dialog-home-zone-detail.ts b/src/panels/config/zone/show-dialog-home-zone-detail.ts index a4dc6c12c647..9c8f3ba3b276 100644 --- a/src/panels/config/zone/show-dialog-home-zone-detail.ts +++ b/src/panels/config/zone/show-dialog-home-zone-detail.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import { HomeZoneMutableParams } from "../../../data/zone"; +import type { HomeZoneMutableParams } from "../../../data/zone"; export interface HomeZoneDetailDialogParams { updateEntry?: (updates: HomeZoneMutableParams) => Promise; diff --git a/src/panels/config/zone/show-dialog-zone-detail.ts b/src/panels/config/zone/show-dialog-zone-detail.ts index 43af1916f850..edb02c2a46c7 100644 --- a/src/panels/config/zone/show-dialog-zone-detail.ts +++ b/src/panels/config/zone/show-dialog-zone-detail.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import { Zone, ZoneMutableParams } from "../../../data/zone"; +import type { Zone, ZoneMutableParams } from "../../../data/zone"; export interface ZoneDetailDialogParams { entry?: Zone; diff --git a/src/panels/custom/ha-panel-custom.ts b/src/panels/custom/ha-panel-custom.ts index 6d048e924763..708f8f1fb7b6 100644 --- a/src/panels/custom/ha-panel-custom.ts +++ b/src/panels/custom/ha-panel-custom.ts @@ -1,9 +1,11 @@ -import { PropertyValues, ReactiveElement } from "lit"; +import type { PropertyValues } from "lit"; +import { ReactiveElement } from "lit"; import { property } from "lit/decorators"; -import { navigate, NavigateOptions } from "../../common/navigate"; +import type { NavigateOptions } from "../../common/navigate"; +import { navigate } from "../../common/navigate"; import { deepEqual } from "../../common/util/deep-equal"; -import { CustomPanelInfo } from "../../data/panel_custom"; -import { HomeAssistant, Route } from "../../types"; +import type { CustomPanelInfo } from "../../data/panel_custom"; +import type { HomeAssistant, Route } from "../../types"; import { createCustomPanelElement } from "../../util/custom-panel/create-custom-panel-element"; import { getUrl, diff --git a/src/panels/developer-tools/action/developer-tools-action.ts b/src/panels/developer-tools/action/developer-tools-action.ts index 23129a3c18b7..cfeedd267b7d 100644 --- a/src/panels/developer-tools/action/developer-tools-action.ts +++ b/src/panels/developer-tools/action/developer-tools-action.ts @@ -1,23 +1,26 @@ import { mdiHelpCircle } from "@mdi/js"; -import { ERR_CONNECTION_LOST, HassService } from "home-assistant-js-websocket"; +import type { HassService } from "home-assistant-js-websocket"; +import { ERR_CONNECTION_LOST } from "home-assistant-js-websocket"; import { load } from "js-yaml"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { storage } from "../../../common/decorators/storage"; import { computeDomain } from "../../../common/entity/compute_domain"; import { computeObjectId } from "../../../common/entity/compute_object_id"; import { hasTemplate } from "../../../common/string/has-template"; -import { LocalizeFunc } from "../../../common/translations/localize"; +import type { LocalizeFunc } from "../../../common/translations/localize"; import { extractSearchParam } from "../../../common/url/search-params"; import { copyToClipboard } from "../../../common/util/copy-clipboard"; -import { HaProgressButton } from "../../../components/buttons/ha-progress-button"; +import type { HaProgressButton } from "../../../components/buttons/ha-progress-button"; import { showToast } from "../../../util/toast"; import "../../../components/entity/ha-entity-picker"; import "../../../components/ha-alert"; import "../../../components/ha-button"; import "../../../components/ha-card"; +import "../../../components/buttons/ha-progress-button"; import "../../../components/ha-expansion-panel"; import "../../../components/ha-icon-button"; import "../../../components/ha-service-control"; @@ -25,17 +28,14 @@ import "../../../components/ha-service-picker"; import "../../../components/ha-yaml-editor"; import type { HaYamlEditor } from "../../../components/ha-yaml-editor"; import { forwardHaptic } from "../../../data/haptics"; -import { - Action, - migrateAutomationAction, - ServiceAction, -} from "../../../data/script"; +import type { Action, ServiceAction } from "../../../data/script"; +import { migrateAutomationAction } from "../../../data/script"; import { callExecuteScript, serviceCallWillDisconnect, } from "../../../data/service"; import { haStyle } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { documentationUrl } from "../../../util/documentation-url"; @customElement("developer-tools-action") diff --git a/src/panels/developer-tools/assist/developer-tools-assist.ts b/src/panels/developer-tools/assist/developer-tools-assist.ts index ed99e6bb7942..ad541bb8bede 100644 --- a/src/panels/developer-tools/assist/developer-tools-assist.ts +++ b/src/panels/developer-tools/assist/developer-tools-assist.ts @@ -1,6 +1,7 @@ import { mdiDownload } from "@mdi/js"; import { dump } from "js-yaml"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { storage } from "../../../common/decorators/storage"; import { formatLanguageCode } from "../../../common/language/format_language"; @@ -11,14 +12,11 @@ import "../../../components/ha-code-editor"; import "../../../components/ha-language-picker"; import "../../../components/ha-textarea"; import type { HaTextArea } from "../../../components/ha-textarea"; -import { - AssitDebugResult, - debugAgent, - listAgents, -} from "../../../data/conversation"; +import type { AssitDebugResult } from "../../../data/conversation"; +import { debugAgent, listAgents } from "../../../data/conversation"; import { SubscribeMixin } from "../../../mixins/subscribe-mixin"; import { haStyle } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { fileDownload } from "../../../util/file_download"; type SentenceParsingResult = { diff --git a/src/panels/developer-tools/debug/developer-tools-debug.ts b/src/panels/developer-tools/debug/developer-tools-debug.ts index 33ebe8ae6f0c..360fefb030ba 100644 --- a/src/panels/developer-tools/debug/developer-tools-debug.ts +++ b/src/panels/developer-tools/debug/developer-tools-debug.ts @@ -3,7 +3,7 @@ import { customElement, property } from "lit/decorators"; import "../../../components/ha-card"; import { SubscribeMixin } from "../../../mixins/subscribe-mixin"; import { haStyle } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import "./ha-debug-connection-row"; @customElement("developer-tools-debug") diff --git a/src/panels/developer-tools/debug/ha-debug-connection-row.ts b/src/panels/developer-tools/debug/ha-debug-connection-row.ts index 764931f649a8..c97172c9c2ca 100644 --- a/src/panels/developer-tools/debug/ha-debug-connection-row.ts +++ b/src/panels/developer-tools/debug/ha-debug-connection-row.ts @@ -1,4 +1,5 @@ -import { html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../components/ha-settings-row"; import "../../../components/ha-switch"; diff --git a/src/panels/developer-tools/developer-tools-router.ts b/src/panels/developer-tools/developer-tools-router.ts index 6018861ecbf6..9b7f8b5fc7fa 100644 --- a/src/panels/developer-tools/developer-tools-router.ts +++ b/src/panels/developer-tools/developer-tools-router.ts @@ -1,6 +1,7 @@ import { customElement, property } from "lit/decorators"; -import { HassRouterPage, RouterOptions } from "../../layouts/hass-router-page"; -import { HomeAssistant } from "../../types"; +import type { RouterOptions } from "../../layouts/hass-router-page"; +import { HassRouterPage } from "../../layouts/hass-router-page"; +import type { HomeAssistant } from "../../types"; @customElement("developer-tools-router") class DeveloperToolsRouter extends HassRouterPage { diff --git a/src/panels/developer-tools/event/developer-tools-event.ts b/src/panels/developer-tools/event/developer-tools-event.ts index a72b570e3a17..0c56e202042b 100644 --- a/src/panels/developer-tools/event/developer-tools-event.ts +++ b/src/panels/developer-tools/event/developer-tools-event.ts @@ -1,4 +1,5 @@ -import { CSSResultGroup, LitElement, TemplateResult, css, html } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/ha-yaml-editor"; import "../../../components/ha-textfield"; @@ -9,7 +10,7 @@ import { documentationUrl } from "../../../util/documentation-url"; import "./event-subscribe-card"; import "./events-list"; import { haStyle } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { fireEvent } from "../../../common/dom/fire_event"; @customElement("developer-tools-event") diff --git a/src/panels/developer-tools/event/event-subscribe-card.ts b/src/panels/developer-tools/event/event-subscribe-card.ts index 5c613a13c707..13b0b931414f 100644 --- a/src/panels/developer-tools/event/event-subscribe-card.ts +++ b/src/panels/developer-tools/event/event-subscribe-card.ts @@ -1,5 +1,6 @@ -import { HassEvent } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { HassEvent } from "home-assistant-js-websocket"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { repeat } from "lit/directives/repeat"; import { formatTime } from "../../../common/datetime/format_time"; @@ -8,7 +9,7 @@ import "../../../components/ha-textfield"; import "../../../components/ha-yaml-editor"; import "../../../components/ha-button"; import "../../../components/ha-alert"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; @customElement("event-subscribe-card") class EventSubscribeCard extends LitElement { diff --git a/src/panels/developer-tools/event/events-list.ts b/src/panels/developer-tools/event/events-list.ts index a509651f2d34..fb3af7bb0fa9 100644 --- a/src/panels/developer-tools/event/events-list.ts +++ b/src/panels/developer-tools/event/events-list.ts @@ -1,8 +1,9 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import { stringCompare } from "../../../common/string/compare"; import { fireEvent } from "../../../common/dom/fire_event"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; interface EventListenerCount { event: string; diff --git a/src/panels/developer-tools/ha-panel-developer-tools.ts b/src/panels/developer-tools/ha-panel-developer-tools.ts index 237e08272412..4c3711dd50ad 100644 --- a/src/panels/developer-tools/ha-panel-developer-tools.ts +++ b/src/panels/developer-tools/ha-panel-developer-tools.ts @@ -1,7 +1,8 @@ import { mdiDotsVertical } from "@mdi/js"; import "@polymer/paper-tabs/paper-tab"; import "@polymer/paper-tabs/paper-tabs"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import type { ActionDetail } from "@material/mwc-list"; import { navigate } from "../../common/navigate"; @@ -10,7 +11,7 @@ import "../../components/ha-button-menu"; import "../../components/ha-icon-button"; import "../../components/ha-list-item"; import { haStyle } from "../../resources/styles"; -import { HomeAssistant, Route } from "../../types"; +import type { HomeAssistant, Route } from "../../types"; import "./developer-tools-router"; @customElement("ha-panel-developer-tools") diff --git a/src/panels/developer-tools/state/developer-tools-state.ts b/src/panels/developer-tools/state/developer-tools-state.ts index ebeb324f2a0d..a6ec61a221f8 100644 --- a/src/panels/developer-tools/state/developer-tools-state.ts +++ b/src/panels/developer-tools/state/developer-tools-state.ts @@ -4,13 +4,14 @@ import { mdiRefresh, } from "@mdi/js"; import { addHours } from "date-fns"; -import { +import type { HassEntities, HassEntity, HassEntityAttributeBase, } from "home-assistant-js-websocket"; import { dump } from "js-yaml"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { formatDateTimeWithSeconds } from "../../../common/datetime/format_date_time"; @@ -31,7 +32,7 @@ import type { HaYamlEditor } from "../../../components/ha-yaml-editor"; import "../../../components/search-input"; import { showAlertDialog } from "../../../dialogs/generic/show-dialog-box"; import { haStyle } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; @customElement("developer-tools-state") class HaPanelDevState extends LitElement { diff --git a/src/panels/developer-tools/statistics/developer-tools-statistics.ts b/src/panels/developer-tools/statistics/developer-tools-statistics.ts index 989957098f40..e57bd24e57c3 100644 --- a/src/panels/developer-tools/statistics/developer-tools-statistics.ts +++ b/src/panels/developer-tools/statistics/developer-tools-statistics.ts @@ -11,14 +11,15 @@ import { mdiUnfoldMoreHorizontal, } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import { type CSSResultGroup, LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; -import { HASSDomEvent, fireEvent } from "../../../common/dom/fire_event"; +import type { HASSDomEvent } from "../../../common/dom/fire_event"; +import { fireEvent } from "../../../common/dom/fire_event"; import { computeStateName } from "../../../common/entity/compute_state_name"; -import { LocalizeFunc } from "../../../common/translations/localize"; +import type { LocalizeFunc } from "../../../common/translations/localize"; import "../../../components/chips/ha-assist-chip"; import "../../../components/data-table/ha-data-table"; import type { @@ -30,19 +31,21 @@ import type { import { showDataTableSettingsDialog } from "../../../components/data-table/show-dialog-data-table-settings"; import "../../../components/ha-md-button-menu"; import "../../../components/ha-dialog"; -import { HaMenu } from "../../../components/ha-menu"; +import type { HaMenu } from "../../../components/ha-menu"; import "../../../components/ha-md-menu-item"; import "../../../components/search-input-outlined"; -import { +import type { StatisticsMetaData, StatisticsValidationResult, +} from "../../../data/recorder"; +import { clearStatistics, getStatisticIds, updateStatisticsIssues, validateStatistics, } from "../../../data/recorder"; import { haStyle } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { showConfirmationDialog } from "../../lovelace/custom-card-helpers"; import { fixStatisticsIssue } from "./fix-statistics"; import { showStatisticsAdjustSumDialog } from "./show-dialog-statistics-adjust-sum"; diff --git a/src/panels/developer-tools/statistics/dialog-statistics-adjust-sum.ts b/src/panels/developer-tools/statistics/dialog-statistics-adjust-sum.ts index c29b5dedd92d..7b4b05944ddd 100644 --- a/src/panels/developer-tools/statistics/dialog-statistics-adjust-sum.ts +++ b/src/panels/developer-tools/statistics/dialog-statistics-adjust-sum.ts @@ -1,14 +1,7 @@ import "@material/mwc-button/mwc-button"; import { formatISO9075 } from "date-fns"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { formatDateTime } from "../../../common/datetime/format_date_time"; @@ -21,16 +14,16 @@ import "../../../components/ha-list-item"; import "../../../components/ha-selector/ha-selector-datetime"; import "../../../components/ha-selector/ha-selector-number"; import "../../../components/ha-svg-icon"; +import type { StatisticValue } from "../../../data/recorder"; import { adjustStatisticsSum, fetchStatistics, getDisplayUnit, - StatisticValue, } from "../../../data/recorder"; import type { DateTimeSelector, NumberSelector } from "../../../data/selector"; import { showAlertDialog } from "../../../dialogs/generic/show-dialog-box"; import { haStyle, haStyleDialog } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { showToast } from "../../../util/toast"; import type { DialogStatisticsAdjustSumParams } from "./show-dialog-statistics-adjust-sum"; diff --git a/src/panels/developer-tools/statistics/dialog-statistics-fix-units-changed.ts b/src/panels/developer-tools/statistics/dialog-statistics-fix-units-changed.ts index 15263541db19..c5ab6b3d9f08 100644 --- a/src/panels/developer-tools/statistics/dialog-statistics-fix-units-changed.ts +++ b/src/panels/developer-tools/statistics/dialog-statistics-fix-units-changed.ts @@ -1,5 +1,6 @@ import "@material/mwc-button/mwc-button"; -import { CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import "../../../components/ha-dialog"; @@ -11,7 +12,7 @@ import { updateStatisticsMetadata, } from "../../../data/recorder"; import { haStyle, haStyleDialog } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import type { DialogStatisticsUnitsChangedParams } from "./show-dialog-statistics-fix-units-changed"; @customElement("dialog-statistics-fix-units-changed") diff --git a/src/panels/developer-tools/statistics/dialog-statistics-fix.ts b/src/panels/developer-tools/statistics/dialog-statistics-fix.ts index f87c4f3d2e34..7c1b74abcabe 100644 --- a/src/panels/developer-tools/statistics/dialog-statistics-fix.ts +++ b/src/panels/developer-tools/statistics/dialog-statistics-fix.ts @@ -1,12 +1,13 @@ import "@material/mwc-button/mwc-button"; -import { CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/ha-circular-progress"; import { fireEvent } from "../../../common/dom/fire_event"; import "../../../components/ha-dialog"; import { clearStatistics, getStatisticLabel } from "../../../data/recorder"; import { haStyle, haStyleDialog } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { documentationUrl } from "../../../util/documentation-url"; import type { DialogStatisticsFixParams } from "./show-dialog-statistics-fix"; import { showAlertDialog } from "../../lovelace/custom-card-helpers"; diff --git a/src/panels/developer-tools/statistics/fix-statistics.ts b/src/panels/developer-tools/statistics/fix-statistics.ts index fdaf571e0b8f..49f192cb9c9c 100644 --- a/src/panels/developer-tools/statistics/fix-statistics.ts +++ b/src/panels/developer-tools/statistics/fix-statistics.ts @@ -1,4 +1,4 @@ -import { StatisticsValidationResult } from "../../../data/recorder"; +import type { StatisticsValidationResult } from "../../../data/recorder"; import { showFixStatisticsDialog } from "./show-dialog-statistics-fix"; import { showFixStatisticsUnitsChangedDialog } from "./show-dialog-statistics-fix-units-changed"; diff --git a/src/panels/developer-tools/statistics/show-dialog-statistics-adjust-sum.ts b/src/panels/developer-tools/statistics/show-dialog-statistics-adjust-sum.ts index 6248a6c42fb1..beb87aa2c700 100644 --- a/src/panels/developer-tools/statistics/show-dialog-statistics-adjust-sum.ts +++ b/src/panels/developer-tools/statistics/show-dialog-statistics-adjust-sum.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import { StatisticsMetaData } from "../../../data/recorder"; +import type { StatisticsMetaData } from "../../../data/recorder"; export const loadAdjustSumDialog = () => import("./dialog-statistics-adjust-sum"); diff --git a/src/panels/developer-tools/statistics/show-dialog-statistics-fix-units-changed.ts b/src/panels/developer-tools/statistics/show-dialog-statistics-fix-units-changed.ts index 3305fc897bcd..7cfcad649c1a 100644 --- a/src/panels/developer-tools/statistics/show-dialog-statistics-fix-units-changed.ts +++ b/src/panels/developer-tools/statistics/show-dialog-statistics-fix-units-changed.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import { StatisticsValidationResultUnitsChanged } from "../../../data/recorder"; +import type { StatisticsValidationResultUnitsChanged } from "../../../data/recorder"; export const loadFixUnitsDialog = () => import("./dialog-statistics-fix-units-changed"); diff --git a/src/panels/developer-tools/statistics/show-dialog-statistics-fix.ts b/src/panels/developer-tools/statistics/show-dialog-statistics-fix.ts index 70ffa4f0c343..bfa7c5e5d72a 100644 --- a/src/panels/developer-tools/statistics/show-dialog-statistics-fix.ts +++ b/src/panels/developer-tools/statistics/show-dialog-statistics-fix.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import { StatisticsValidationResult } from "../../../data/recorder"; +import type { StatisticsValidationResult } from "../../../data/recorder"; export const loadFixDialog = () => import("./dialog-statistics-fix"); diff --git a/src/panels/developer-tools/template/developer-tools-template.ts b/src/panels/developer-tools/template/developer-tools-template.ts index b80fdd3d5db8..f16f77bd1f4b 100644 --- a/src/panels/developer-tools/template/developer-tools-template.ts +++ b/src/panels/developer-tools/template/developer-tools-template.ts @@ -1,19 +1,19 @@ import "@material/mwc-button/mwc-button"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { debounce } from "../../../common/util/debounce"; import "../../../components/ha-alert"; import "../../../components/ha-circular-progress"; import "../../../components/ha-code-editor"; -import { - RenderTemplateResult, - subscribeRenderTemplate, -} from "../../../data/ws-templates"; +import "../../../components/ha-card"; +import type { RenderTemplateResult } from "../../../data/ws-templates"; +import { subscribeRenderTemplate } from "../../../data/ws-templates"; import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box"; import { haStyle } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { documentationUrl } from "../../../util/documentation-url"; const DEMO_TEMPLATE = `{## Imitate available variables: ##} diff --git a/src/panels/developer-tools/yaml_configuration/developer-yaml-config.ts b/src/panels/developer-tools/yaml_configuration/developer-yaml-config.ts index f08698523a04..c8130e389fa7 100644 --- a/src/panels/developer-tools/yaml_configuration/developer-yaml-config.ts +++ b/src/panels/developer-tools/yaml_configuration/developer-yaml-config.ts @@ -1,19 +1,14 @@ import "@material/mwc-button"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { componentsWithService } from "../../../common/config/components_with_service"; import "../../../components/buttons/ha-call-service-button"; import "../../../components/ha-alert"; import "../../../components/ha-card"; import "../../../components/ha-circular-progress"; -import { CheckConfigResult, checkCoreConfig } from "../../../data/core"; +import type { CheckConfigResult } from "../../../data/core"; +import { checkCoreConfig } from "../../../data/core"; import { domainToName } from "../../../data/integration"; import { stringCompare } from "../../../common/string/compare"; import { showRestartDialog } from "../../../dialogs/restart/show-dialog-restart"; diff --git a/src/panels/energy/cards/energy-setup-wizard-card.ts b/src/panels/energy/cards/energy-setup-wizard-card.ts index 87359e4250e3..6bd55b6c8e21 100644 --- a/src/panels/energy/cards/energy-setup-wizard-card.ts +++ b/src/panels/energy/cards/energy-setup-wizard-card.ts @@ -1,24 +1,21 @@ import "@material/mwc-button/mwc-button"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; -import { - EnergyInfo, - EnergyPreferences, - getEnergyInfo, - saveEnergyPreferences, -} from "../../../data/energy"; -import { LovelaceCardConfig } from "../../../data/lovelace/config/card"; +import type { EnergyInfo, EnergyPreferences } from "../../../data/energy"; +import { getEnergyInfo, saveEnergyPreferences } from "../../../data/energy"; +import type { LovelaceCardConfig } from "../../../data/lovelace/config/card"; import { showAlertDialog } from "../../../dialogs/generic/show-dialog-box"; import { haStyle } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import "../../config/energy/components/ha-energy-battery-settings"; import "../../config/energy/components/ha-energy-device-settings"; import "../../config/energy/components/ha-energy-gas-settings"; import "../../config/energy/components/ha-energy-grid-settings"; import "../../config/energy/components/ha-energy-solar-settings"; import "../../config/energy/components/ha-energy-water-settings"; -import { Lovelace, LovelaceCard } from "../../lovelace/types"; +import type { Lovelace, LovelaceCard } from "../../lovelace/types"; @customElement("energy-setup-wizard-card") export class EnergySetupWizard extends LitElement implements LovelaceCard { diff --git a/src/panels/energy/ha-panel-energy.ts b/src/panels/energy/ha-panel-energy.ts index 200e3e576ed7..aea970e2db63 100644 --- a/src/panels/energy/ha-panel-energy.ts +++ b/src/panels/energy/ha-panel-energy.ts @@ -1,29 +1,19 @@ -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { mdiPencil, mdiDownload } from "@mdi/js"; import { customElement, property, state } from "lit/decorators"; import "../../components/ha-menu-button"; import "../../components/ha-list-item"; import "../../components/ha-top-app-bar-fixed"; -import { LovelaceConfig } from "../../data/lovelace/config/types"; +import type { LovelaceConfig } from "../../data/lovelace/config/types"; import { haStyle } from "../../resources/styles"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import "../lovelace/components/hui-energy-period-selector"; -import { Lovelace } from "../lovelace/types"; +import type { Lovelace } from "../lovelace/types"; import "../lovelace/views/hui-view"; import "../lovelace/views/hui-view-container"; import { navigate } from "../../common/navigate"; -import { - getEnergyDataCollection, - getEnergyGasUnit, - getEnergyWaterUnit, +import type { GridSourceTypeEnergyPreference, SolarSourceTypeEnergyPreference, BatterySourceTypeEnergyPreference, @@ -31,6 +21,11 @@ import { WaterSourceTypeEnergyPreference, DeviceConsumptionEnergyPreference, } from "../../data/energy"; +import { + getEnergyDataCollection, + getEnergyGasUnit, + getEnergyWaterUnit, +} from "../../data/energy"; import { fileDownload } from "../../util/file_download"; const ENERGY_LOVELACE_CONFIG: LovelaceConfig = { diff --git a/src/panels/energy/strategies/energy-view-strategy.ts b/src/panels/energy/strategies/energy-view-strategy.ts index 7bec1c985bfb..ce57ecea54bb 100644 --- a/src/panels/energy/strategies/energy-view-strategy.ts +++ b/src/panels/energy/strategies/energy-view-strategy.ts @@ -1,13 +1,13 @@ import { ReactiveElement } from "lit"; import { customElement } from "lit/decorators"; -import { +import type { EnergyPreferences, - getEnergyPreferences, GridSourceTypeEnergyPreference, } from "../../../data/energy"; -import { HomeAssistant } from "../../../types"; -import { LovelaceViewConfig } from "../../../data/lovelace/config/view"; -import { LovelaceStrategyConfig } from "../../../data/lovelace/config/strategy"; +import { getEnergyPreferences } from "../../../data/energy"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceViewConfig } from "../../../data/lovelace/config/view"; +import type { LovelaceStrategyConfig } from "../../../data/lovelace/config/strategy"; const setupWizard = async (): Promise => { await import("../cards/energy-setup-wizard-card"); diff --git a/src/panels/history/ha-panel-history.ts b/src/panels/history/ha-panel-history.ts index 1f9f60073e53..c167c48da19d 100644 --- a/src/panels/history/ha-panel-history.ts +++ b/src/panels/history/ha-panel-history.ts @@ -4,13 +4,14 @@ import { mdiFilterRemove, mdiImagePlus, } from "@mdi/js"; -import { ActionDetail } from "@material/mwc-list"; +import type { ActionDetail } from "@material/mwc-list"; import { differenceInHours } from "date-fns"; -import { +import type { HassServiceTarget, UnsubscribeFunc, } from "home-assistant-js-websocket/dist/types"; -import { LitElement, PropertyValues, css, html } from "lit"; +import type { PropertyValues } from "lit"; +import { LitElement, css, html } from "lit"; import { property, query, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { ensureArray } from "../../common/array/ensure-array"; @@ -35,17 +36,20 @@ import "../../components/ha-icon-button-arrow-prev"; import "../../components/ha-menu-button"; import "../../components/ha-target-picker"; import "../../components/ha-top-app-bar-fixed"; -import { +import type { EntityHistoryState, HistoryResult, HistoryStates, LineChartState, LineChartUnit, +} from "../../data/history"; +import { computeGroupKey, computeHistory, subscribeHistory, } from "../../data/history"; -import { Statistics, fetchStatistics } from "../../data/recorder"; +import type { Statistics } from "../../data/recorder"; +import { fetchStatistics } from "../../data/recorder"; import { expandAreaTarget, expandDeviceTarget, @@ -55,7 +59,7 @@ import { import { getSensorNumericDeviceClasses } from "../../data/sensor"; import { showAlertDialog } from "../../dialogs/generic/show-dialog-box"; import { haStyle } from "../../resources/styles"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import { fileDownload } from "../../util/file_download"; import { addEntitiesToLovelaceView } from "../lovelace/editor/add-entities-to-view"; diff --git a/src/panels/iframe/ha-panel-iframe.ts b/src/panels/iframe/ha-panel-iframe.ts index 60d4f99742e1..aa29d29dee99 100644 --- a/src/panels/iframe/ha-panel-iframe.ts +++ b/src/panels/iframe/ha-panel-iframe.ts @@ -3,7 +3,7 @@ import { customElement, property } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import "../../layouts/hass-error-screen"; import "../../layouts/hass-subpage"; -import { HomeAssistant, PanelInfo } from "../../types"; +import type { HomeAssistant, PanelInfo } from "../../types"; import { IFRAME_SANDBOX } from "../../util/iframe"; @customElement("ha-panel-iframe") diff --git a/src/panels/logbook/ha-logbook-renderer.ts b/src/panels/logbook/ha-logbook-renderer.ts index 756cd6872677..0847afed52a2 100644 --- a/src/panels/logbook/ha-logbook-renderer.ts +++ b/src/panels/logbook/ha-logbook-renderer.ts @@ -1,13 +1,7 @@ -import { VisibilityChangedEvent } from "@lit-labs/virtualizer"; +import type { VisibilityChangedEvent } from "@lit-labs/virtualizer"; import type { HassEntity } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, eventOptions, property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { styleMap } from "lit/directives/style-map"; @@ -23,20 +17,20 @@ import "../../components/entity/state-badge"; import "../../components/ha-circular-progress"; import "../../components/ha-icon-next"; import "../../components/ha-relative-time"; +import type { LogbookEntry } from "../../data/logbook"; import { createHistoricState, localizeStateMessage, localizeTriggerSource, - LogbookEntry, } from "../../data/logbook"; -import { TraceContexts } from "../../data/trace"; +import type { TraceContexts } from "../../data/trace"; import { buttonLinkStyle, haStyle, haStyleScrollbar, } from "../../resources/styles"; import { loadVirtualizer } from "../../resources/virtualizer"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import { brandsUrl } from "../../util/brands-url"; import { domainToName } from "../../data/integration"; diff --git a/src/panels/logbook/ha-logbook.ts b/src/panels/logbook/ha-logbook.ts index 38ef5ee2a62f..342a9890a0b2 100644 --- a/src/panels/logbook/ha-logbook.ts +++ b/src/panels/logbook/ha-logbook.ts @@ -1,17 +1,16 @@ -import { css, html, LitElement, PropertyValues, nothing } from "lit"; +import type { PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { isComponentLoaded } from "../../common/config/is_component_loaded"; import { computeStateDomain } from "../../common/entity/compute_state_domain"; import { throttle } from "../../common/util/throttle"; import "../../components/ha-circular-progress"; -import { - LogbookEntry, - LogbookStreamMessage, - subscribeLogbook, -} from "../../data/logbook"; -import { loadTraceContexts, TraceContexts } from "../../data/trace"; +import type { LogbookEntry, LogbookStreamMessage } from "../../data/logbook"; +import { subscribeLogbook } from "../../data/logbook"; +import type { TraceContexts } from "../../data/trace"; +import { loadTraceContexts } from "../../data/trace"; import { fetchUsers } from "../../data/user"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import "./ha-logbook-renderer"; interface LogbookTimePeriod { @@ -141,6 +140,8 @@ export class HaLogbook extends LitElement { this._updateUsers.cancel(); this._unsubscribeSetLoading(); + this._liveUpdatesEnabled = true; + if (force) { this._getLogBookData(); } else { diff --git a/src/panels/logbook/ha-panel-logbook.ts b/src/panels/logbook/ha-panel-logbook.ts index cd9b6ed16efb..54c9f9b02294 100644 --- a/src/panels/logbook/ha-panel-logbook.ts +++ b/src/panels/logbook/ha-panel-logbook.ts @@ -1,5 +1,6 @@ import { mdiRefresh } from "@mdi/js"; -import { css, html, LitElement, PropertyValues } from "lit"; +import type { PropertyValues } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { navigate } from "../../common/navigate"; import { constructUrlCurrentPath } from "../../common/url/construct-url"; @@ -16,7 +17,7 @@ import "../../components/ha-menu-button"; import "../../components/ha-top-app-bar-fixed"; import { filterLogbookCompatibleEntities } from "../../data/logbook"; import { haStyle } from "../../resources/styles"; -import { HomeAssistant } from "../../types"; +import type { HomeAssistant } from "../../types"; import "./ha-logbook"; @customElement("ha-panel-logbook") diff --git a/src/panels/lovelace/badges/hui-badge.ts b/src/panels/lovelace/badges/hui-badge.ts index 7637d2c464c1..5384de37b6f8 100644 --- a/src/panels/lovelace/badges/hui-badge.ts +++ b/src/panels/lovelace/badges/hui-badge.ts @@ -1,9 +1,10 @@ -import { PropertyValues, ReactiveElement } from "lit"; +import type { PropertyValues } from "lit"; +import { ReactiveElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; -import { MediaQueriesListener } from "../../../common/dom/media_query"; +import type { MediaQueriesListener } from "../../../common/dom/media_query"; import "../../../components/ha-svg-icon"; -import { LovelaceBadgeConfig } from "../../../data/lovelace/config/badge"; +import type { LovelaceBadgeConfig } from "../../../data/lovelace/config/badge"; import type { HomeAssistant } from "../../../types"; import { attachConditionMediaQueriesListeners, diff --git a/src/panels/lovelace/badges/hui-entity-badge.ts b/src/panels/lovelace/badges/hui-entity-badge.ts index 5bf3b26d13d4..093e8f92aff3 100644 --- a/src/panels/lovelace/badges/hui-entity-badge.ts +++ b/src/panels/lovelace/badges/hui-entity-badge.ts @@ -1,6 +1,7 @@ import { mdiAlertCircle } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { styleMap } from "lit/directives/style-map"; @@ -16,14 +17,14 @@ import "../../../components/ha-ripple"; import "../../../components/ha-state-icon"; import "../../../components/ha-svg-icon"; import { cameraUrlWithWidthHeight } from "../../../data/camera"; -import { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; -import { HomeAssistant } from "../../../types"; +import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; +import type { HomeAssistant } from "../../../types"; import { actionHandler } from "../common/directives/action-handler-directive"; import { findEntities } from "../common/find-entities"; import { handleAction } from "../common/handle-action"; import { hasAction } from "../common/has-action"; -import { LovelaceBadge, LovelaceBadgeEditor } from "../types"; -import { EntityBadgeConfig } from "./types"; +import type { LovelaceBadge, LovelaceBadgeEditor } from "../types"; +import type { EntityBadgeConfig } from "./types"; export const DISPLAY_TYPES = ["minimal", "standard", "complete"] as const; export type DisplayType = (typeof DISPLAY_TYPES)[number]; diff --git a/src/panels/lovelace/badges/hui-entity-filter-badge.ts b/src/panels/lovelace/badges/hui-entity-filter-badge.ts index 3b5de69b3845..0c4f13e0c103 100644 --- a/src/panels/lovelace/badges/hui-entity-filter-badge.ts +++ b/src/panels/lovelace/badges/hui-entity-filter-badge.ts @@ -1,6 +1,7 @@ -import { PropertyValues, ReactiveElement } from "lit"; +import type { PropertyValues } from "lit"; +import { ReactiveElement } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { evaluateStateFilter } from "../common/evaluate-filter"; import { processConfigEntities } from "../common/process-config-entities"; import { @@ -8,11 +9,11 @@ import { checkConditionsMet, extractConditionEntityIds, } from "../common/validate-condition"; -import { EntityFilterEntityConfig } from "../entity-rows/types"; -import { LovelaceBadge } from "../types"; +import type { EntityFilterEntityConfig } from "../entity-rows/types"; +import type { LovelaceBadge } from "../types"; import "./hui-badge"; import type { HuiBadge } from "./hui-badge"; -import { EntityFilterBadgeConfig } from "./types"; +import type { EntityFilterBadgeConfig } from "./types"; @customElement("hui-entity-filter-badge") export class HuiEntityFilterBadge diff --git a/src/panels/lovelace/badges/hui-error-badge.ts b/src/panels/lovelace/badges/hui-error-badge.ts index 1df21d7d0433..449521f2f567 100644 --- a/src/panels/lovelace/badges/hui-error-badge.ts +++ b/src/panels/lovelace/badges/hui-error-badge.ts @@ -1,13 +1,14 @@ import { mdiAlertCircle } from "@mdi/js"; import { dump } from "js-yaml"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, state } from "lit/decorators"; import "../../../components/ha-badge"; import "../../../components/ha-svg-icon"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { showAlertDialog } from "../custom-card-helpers"; -import { LovelaceBadge } from "../types"; -import { ErrorBadgeConfig } from "./types"; +import type { LovelaceBadge } from "../types"; +import type { ErrorBadgeConfig } from "./types"; export const createErrorBadgeElement = (config) => { const el = document.createElement("hui-error-badge"); diff --git a/src/panels/lovelace/badges/hui-state-label-badge.ts b/src/panels/lovelace/badges/hui-state-label-badge.ts index 989d46cf9c37..011db03d6e06 100644 --- a/src/panels/lovelace/badges/hui-state-label-badge.ts +++ b/src/panels/lovelace/badges/hui-state-label-badge.ts @@ -1,8 +1,8 @@ import { customElement } from "lit/decorators"; import "../../../components/entity/ha-state-label-badge"; -import { HuiStateLabelBadgeEditor } from "../editor/config-elements/hui-state-label-badge-editor"; +import type { HuiStateLabelBadgeEditor } from "../editor/config-elements/hui-state-label-badge-editor"; import { HuiEntityBadge } from "./hui-entity-badge"; -import { EntityBadgeConfig, StateLabelBadgeConfig } from "./types"; +import type { EntityBadgeConfig, StateLabelBadgeConfig } from "./types"; @customElement("hui-state-label-badge") export class HuiStateLabelBadge extends HuiEntityBadge { diff --git a/src/panels/lovelace/badges/hui-view-badges.ts b/src/panels/lovelace/badges/hui-view-badges.ts index ee3d23e2ffa5..a8b609e5f0e2 100644 --- a/src/panels/lovelace/badges/hui-view-badges.ts +++ b/src/panels/lovelace/badges/hui-view-badges.ts @@ -1,12 +1,6 @@ import { mdiPlus } from "@mdi/js"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { repeat } from "lit/directives/repeat"; @@ -15,11 +9,11 @@ import "../../../components/ha-ripple"; import "../../../components/ha-sortable"; import type { HaSortableOptions } from "../../../components/ha-sortable"; import "../../../components/ha-svg-icon"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import "../components/hui-badge-edit-mode"; import { moveBadge } from "../editor/config-util"; -import { Lovelace } from "../types"; -import { HuiBadge } from "./hui-badge"; +import type { Lovelace } from "../types"; +import type { HuiBadge } from "./hui-badge"; const BADGE_SORTABLE_OPTIONS: HaSortableOptions = { delay: 100, @@ -83,11 +77,11 @@ export class HuiViewBadges extends LitElement { private _badgeMoved(ev) { ev.stopPropagation(); - const { oldIndex, newIndex, oldPath, newPath } = ev.detail; + const { oldIndex, newIndex } = ev.detail; const newConfig = moveBadge( this.lovelace!.config, - [...oldPath, oldIndex] as [number, number, number], - [...newPath, newIndex] as [number, number, number] + [this.viewIndex!, oldIndex], + [this.viewIndex!, newIndex] ); this.lovelace!.saveConfig(newConfig); } @@ -121,7 +115,6 @@ export class HuiViewBadges extends LitElement { @drag-end=${this._dragEnd} group="badge" draggable-selector="[data-sortable]" - .path=${[this.viewIndex]} .rollback=${false} .options=${BADGE_SORTABLE_OPTIONS} invert-swap diff --git a/src/panels/lovelace/card-features/hui-alarm-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-alarm-modes-card-feature.ts index 5419290f1d77..271f776b54f3 100644 --- a/src/panels/lovelace/card-features/hui-alarm-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-alarm-modes-card-feature.ts @@ -1,6 +1,7 @@ import { mdiShieldOff } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import memoizeOne from "memoize-one"; @@ -11,19 +12,21 @@ import "../../../components/ha-control-button-group"; import "../../../components/ha-control-select"; import type { ControlSelectOption } from "../../../components/ha-control-select"; import "../../../components/ha-control-slider"; -import { - ALARM_MODES, +import type { AlarmControlPanelEntity, AlarmMode, +} from "../../../data/alarm_control_panel"; +import { + ALARM_MODES, setProtectedAlarmControlPanelMode, supportedAlarmModes, } from "../../../data/alarm_control_panel"; import { UNAVAILABLE } from "../../../data/entity"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; import { filterModes } from "./common/filter-modes"; -import { AlarmModesCardFeatureConfig } from "./types"; +import type { AlarmModesCardFeatureConfig } from "./types"; export const supportsAlarmModesCardFeature = (stateObj: HassEntity) => { const domain = computeDomain(stateObj.entity_id); diff --git a/src/panels/lovelace/card-features/hui-card-feature.ts b/src/panels/lovelace/card-features/hui-card-feature.ts index a65fbd5ad587..7a6d3668e753 100644 --- a/src/panels/lovelace/card-features/hui-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-card-feature.ts @@ -1,7 +1,7 @@ import type { HassEntity } from "home-assistant-js-websocket"; import { LitElement, html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import type { HuiErrorCard } from "../cards/hui-error-card"; import { createCardFeatureElement } from "../create-element/create-card-feature-element"; import type { LovelaceCardFeature } from "../types"; diff --git a/src/panels/lovelace/card-features/hui-card-features.ts b/src/panels/lovelace/card-features/hui-card-features.ts index c0c8bb94292a..c9d1569568e5 100644 --- a/src/panels/lovelace/card-features/hui-card-features.ts +++ b/src/panels/lovelace/card-features/hui-card-features.ts @@ -1,7 +1,8 @@ import type { HassEntity } from "home-assistant-js-websocket"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import "./hui-card-feature"; import type { LovelaceCardFeatureConfig } from "./types"; diff --git a/src/panels/lovelace/card-features/hui-climate-fan-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-climate-fan-modes-card-feature.ts index fb07ce89e54f..dbe00c68d27f 100644 --- a/src/panels/lovelace/card-features/hui-climate-fan-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-climate-fan-modes-card-feature.ts @@ -1,6 +1,7 @@ import { mdiFan } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { stopPropagation } from "../../../common/dom/stop_propagation"; import { computeDomain } from "../../../common/entity/compute_domain"; @@ -10,13 +11,14 @@ import "../../../components/ha-control-select"; import type { ControlSelectOption } from "../../../components/ha-control-select"; import "../../../components/ha-control-select-menu"; import type { HaControlSelectMenu } from "../../../components/ha-control-select-menu"; -import { ClimateEntity, ClimateEntityFeature } from "../../../data/climate"; +import type { ClimateEntity } from "../../../data/climate"; +import { ClimateEntityFeature } from "../../../data/climate"; import { UNAVAILABLE } from "../../../data/entity"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; import { filterModes } from "./common/filter-modes"; -import { ClimateFanModesCardFeatureConfig } from "./types"; +import type { ClimateFanModesCardFeatureConfig } from "./types"; export const supportsClimateFanModesCardFeature = (stateObj: HassEntity) => { const domain = computeDomain(stateObj.entity_id); diff --git a/src/panels/lovelace/card-features/hui-climate-hvac-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-climate-hvac-modes-card-feature.ts index 65cf59959f26..a4d7c15a48f6 100644 --- a/src/panels/lovelace/card-features/hui-climate-hvac-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-climate-hvac-modes-card-feature.ts @@ -1,6 +1,7 @@ import { mdiThermostat } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import { stopPropagation } from "../../../common/dom/stop_propagation"; @@ -10,18 +11,17 @@ import "../../../components/ha-control-select"; import type { ControlSelectOption } from "../../../components/ha-control-select"; import "../../../components/ha-control-select-menu"; import type { HaControlSelectMenu } from "../../../components/ha-control-select-menu"; +import type { ClimateEntity, HvacMode } from "../../../data/climate"; import { - ClimateEntity, climateHvacModeIcon, compareClimateHvacModes, - HvacMode, } from "../../../data/climate"; import { UNAVAILABLE } from "../../../data/entity"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; import { filterModes } from "./common/filter-modes"; -import { ClimateHvacModesCardFeatureConfig } from "./types"; +import type { ClimateHvacModesCardFeatureConfig } from "./types"; export const supportsClimateHvacModesCardFeature = (stateObj: HassEntity) => { const domain = computeDomain(stateObj.entity_id); diff --git a/src/panels/lovelace/card-features/hui-climate-preset-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-climate-preset-modes-card-feature.ts index 90178bcb1d24..1e6d6ad02c15 100644 --- a/src/panels/lovelace/card-features/hui-climate-preset-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-climate-preset-modes-card-feature.ts @@ -1,6 +1,7 @@ import { mdiTuneVariant } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { stopPropagation } from "../../../common/dom/stop_propagation"; import { computeDomain } from "../../../common/entity/compute_domain"; @@ -10,13 +11,14 @@ import "../../../components/ha-control-select"; import type { ControlSelectOption } from "../../../components/ha-control-select"; import "../../../components/ha-control-select-menu"; import type { HaControlSelectMenu } from "../../../components/ha-control-select-menu"; -import { ClimateEntity, ClimateEntityFeature } from "../../../data/climate"; +import type { ClimateEntity } from "../../../data/climate"; +import { ClimateEntityFeature } from "../../../data/climate"; import { UNAVAILABLE } from "../../../data/entity"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; import { filterModes } from "./common/filter-modes"; -import { ClimatePresetModesCardFeatureConfig } from "./types"; +import type { ClimatePresetModesCardFeatureConfig } from "./types"; export const supportsClimatePresetModesCardFeature = (stateObj: HassEntity) => { const domain = computeDomain(stateObj.entity_id); diff --git a/src/panels/lovelace/card-features/hui-climate-swing-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-climate-swing-modes-card-feature.ts index b61f0966006b..24c909d269e0 100644 --- a/src/panels/lovelace/card-features/hui-climate-swing-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-climate-swing-modes-card-feature.ts @@ -1,6 +1,7 @@ import { mdiArrowOscillating } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { stopPropagation } from "../../../common/dom/stop_propagation"; import { computeDomain } from "../../../common/entity/compute_domain"; @@ -10,13 +11,14 @@ import "../../../components/ha-control-select"; import type { ControlSelectOption } from "../../../components/ha-control-select"; import "../../../components/ha-control-select-menu"; import type { HaControlSelectMenu } from "../../../components/ha-control-select-menu"; -import { ClimateEntity, ClimateEntityFeature } from "../../../data/climate"; +import type { ClimateEntity } from "../../../data/climate"; +import { ClimateEntityFeature } from "../../../data/climate"; import { UNAVAILABLE } from "../../../data/entity"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; import { filterModes } from "./common/filter-modes"; -import { ClimateSwingModesCardFeatureConfig } from "./types"; +import type { ClimateSwingModesCardFeatureConfig } from "./types"; export const supportsClimateSwingModesCardFeature = (stateObj: HassEntity) => { const domain = computeDomain(stateObj.entity_id); diff --git a/src/panels/lovelace/card-features/hui-cover-open-close-card-feature.ts b/src/panels/lovelace/card-features/hui-cover-open-close-card-feature.ts index 06a7eca48e58..0b4ec5e5f3c2 100644 --- a/src/panels/lovelace/card-features/hui-cover-open-close-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-cover-open-close-card-feature.ts @@ -1,5 +1,5 @@ import { mdiStop } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { computeDomain } from "../../../common/entity/compute_domain"; @@ -9,6 +9,7 @@ import { } from "../../../common/entity/cover_icon"; import { supportsFeature } from "../../../common/entity/supports-feature"; import "../../../components/ha-control-button"; +import "../../../components/ha-svg-icon"; import "../../../components/ha-control-button-group"; import { canClose, @@ -16,10 +17,10 @@ import { canStop, CoverEntityFeature, } from "../../../data/cover"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCardFeature } from "../types"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCardFeature } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; -import { CoverOpenCloseCardFeatureConfig } from "./types"; +import type { CoverOpenCloseCardFeatureConfig } from "./types"; export const supportsCoverOpenCloseCardFeature = (stateObj: HassEntity) => { const domain = computeDomain(stateObj.entity_id); diff --git a/src/panels/lovelace/card-features/hui-cover-position-card-feature.ts b/src/panels/lovelace/card-features/hui-cover-position-card-feature.ts index cb3a5cf85b9b..3fd595e447c5 100644 --- a/src/panels/lovelace/card-features/hui-cover-position-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-cover-position-card-feature.ts @@ -1,4 +1,4 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; @@ -11,10 +11,11 @@ import { supportsFeature } from "../../../common/entity/supports-feature"; import { CoverEntityFeature } from "../../../data/cover"; import { UNAVAILABLE } from "../../../data/entity"; import { DOMAIN_ATTRIBUTES_UNITS } from "../../../data/entity_attributes"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCardFeature } from "../types"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCardFeature } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; -import { CoverPositionCardFeatureConfig } from "./types"; +import type { CoverPositionCardFeatureConfig } from "./types"; +import "../../../components/ha-control-slider"; export const supportsCoverPositionCardFeature = (stateObj: HassEntity) => { const domain = computeDomain(stateObj.entity_id); diff --git a/src/panels/lovelace/card-features/hui-cover-tilt-card-feature.ts b/src/panels/lovelace/card-features/hui-cover-tilt-card-feature.ts index 9fbee23208e0..9c637bb192ce 100644 --- a/src/panels/lovelace/card-features/hui-cover-tilt-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-cover-tilt-card-feature.ts @@ -1,10 +1,11 @@ import { mdiArrowBottomLeft, mdiArrowTopRight, mdiStop } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { LitElement, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { computeDomain } from "../../../common/entity/compute_domain"; import { supportsFeature } from "../../../common/entity/supports-feature"; import "../../../components/ha-control-button"; +import "../../../components/ha-svg-icon"; import "../../../components/ha-control-button-group"; import { CoverEntityFeature, @@ -12,10 +13,10 @@ import { canOpenTilt, canStopTilt, } from "../../../data/cover"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCardFeature } from "../types"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCardFeature } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; -import { CoverTiltCardFeatureConfig } from "./types"; +import type { CoverTiltCardFeatureConfig } from "./types"; export const supportsCoverTiltCardFeature = (stateObj: HassEntity) => { const domain = computeDomain(stateObj.entity_id); diff --git a/src/panels/lovelace/card-features/hui-cover-tilt-position-card-feature.ts b/src/panels/lovelace/card-features/hui-cover-tilt-position-card-feature.ts index 5942c7004545..2b4ed1e2bd3e 100644 --- a/src/panels/lovelace/card-features/hui-cover-tilt-position-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-cover-tilt-position-card-feature.ts @@ -1,4 +1,4 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; @@ -7,14 +7,15 @@ import { computeAttributeNameDisplay } from "../../../common/entity/compute_attr import { computeDomain } from "../../../common/entity/compute_domain"; import { stateColorCss } from "../../../common/entity/state_color"; import { supportsFeature } from "../../../common/entity/supports-feature"; -import { CoverEntity, CoverEntityFeature } from "../../../data/cover"; +import type { CoverEntity } from "../../../data/cover"; +import { CoverEntityFeature } from "../../../data/cover"; import { UNAVAILABLE } from "../../../data/entity"; import { DOMAIN_ATTRIBUTES_UNITS } from "../../../data/entity_attributes"; import { generateTiltSliderTrackBackgroundGradient } from "../../../state-control/cover/ha-state-control-cover-tilt-position"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCardFeature } from "../types"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCardFeature } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; -import { CoverTiltPositionCardFeatureConfig } from "./types"; +import type { CoverTiltPositionCardFeatureConfig } from "./types"; const GRADIENT = generateTiltSliderTrackBackgroundGradient(); diff --git a/src/panels/lovelace/card-features/hui-fan-preset-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-fan-preset-modes-card-feature.ts index 51c054e26f1d..85eb6ea3dea9 100644 --- a/src/panels/lovelace/card-features/hui-fan-preset-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-fan-preset-modes-card-feature.ts @@ -1,6 +1,7 @@ import { mdiTuneVariant } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { stopPropagation } from "../../../common/dom/stop_propagation"; import { computeDomain } from "../../../common/entity/compute_domain"; @@ -11,12 +12,13 @@ import type { ControlSelectOption } from "../../../components/ha-control-select" import "../../../components/ha-control-select-menu"; import type { HaControlSelectMenu } from "../../../components/ha-control-select-menu"; import { UNAVAILABLE } from "../../../data/entity"; -import { FanEntity, FanEntityFeature } from "../../../data/fan"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; +import type { FanEntity } from "../../../data/fan"; +import { FanEntityFeature } from "../../../data/fan"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; import { filterModes } from "./common/filter-modes"; -import { FanPresetModesCardFeatureConfig } from "./types"; +import type { FanPresetModesCardFeatureConfig } from "./types"; export const supportsFanPresetModesCardFeature = (stateObj: HassEntity) => { const domain = computeDomain(stateObj.entity_id); diff --git a/src/panels/lovelace/card-features/hui-fan-speed-card-feature.ts b/src/panels/lovelace/card-features/hui-fan-speed-card-feature.ts index 93314761d26f..0be014687202 100644 --- a/src/panels/lovelace/card-features/hui-fan-speed-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-fan-speed-card-feature.ts @@ -1,4 +1,4 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { computeAttributeNameDisplay } from "../../../common/entity/compute_attribute_display"; @@ -9,20 +9,19 @@ import "../../../components/ha-control-select"; import type { ControlSelectOption } from "../../../components/ha-control-select"; import "../../../components/ha-control-slider"; import { UNAVAILABLE } from "../../../data/entity"; +import type { FanEntity, FanSpeed } from "../../../data/fan"; import { computeFanSpeedCount, computeFanSpeedIcon, FAN_SPEED_COUNT_MAX_FOR_BUTTONS, FAN_SPEEDS, - FanEntity, FanEntityFeature, fanPercentageToSpeed, - FanSpeed, fanSpeedToPercentage, } from "../../../data/fan"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCardFeature } from "../types"; -import { FanSpeedCardFeatureConfig } from "./types"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCardFeature } from "../types"; +import type { FanSpeedCardFeatureConfig } from "./types"; import { DOMAIN_ATTRIBUTES_UNITS } from "../../../data/entity_attributes"; import { cardFeatureStyles } from "./common/card-feature-styles"; diff --git a/src/panels/lovelace/card-features/hui-humidifier-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-humidifier-modes-card-feature.ts index 510d94685737..0ed087278f1e 100644 --- a/src/panels/lovelace/card-features/hui-humidifier-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-humidifier-modes-card-feature.ts @@ -1,6 +1,7 @@ import { mdiTuneVariant } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { stopPropagation } from "../../../common/dom/stop_propagation"; import { computeDomain } from "../../../common/entity/compute_domain"; @@ -11,15 +12,13 @@ import type { ControlSelectOption } from "../../../components/ha-control-select" import "../../../components/ha-control-select-menu"; import type { HaControlSelectMenu } from "../../../components/ha-control-select-menu"; import { UNAVAILABLE } from "../../../data/entity"; -import { - HumidifierEntity, - HumidifierEntityFeature, -} from "../../../data/humidifier"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; +import type { HumidifierEntity } from "../../../data/humidifier"; +import { HumidifierEntityFeature } from "../../../data/humidifier"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; import { filterModes } from "./common/filter-modes"; -import { HumidifierModesCardFeatureConfig } from "./types"; +import type { HumidifierModesCardFeatureConfig } from "./types"; export const supportsHumidifierModesCardFeature = (stateObj: HassEntity) => { const domain = computeDomain(stateObj.entity_id); diff --git a/src/panels/lovelace/card-features/hui-humidifier-toggle-card-feature.ts b/src/panels/lovelace/card-features/hui-humidifier-toggle-card-feature.ts index a1c2abba64a8..090164b27b65 100644 --- a/src/panels/lovelace/card-features/hui-humidifier-toggle-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-humidifier-toggle-card-feature.ts @@ -1,6 +1,7 @@ import { mdiPower, mdiWaterPercent } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; -import { LitElement, PropertyValues, TemplateResult, html } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues, TemplateResult } from "lit"; +import { LitElement, html } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import { computeDomain } from "../../../common/entity/compute_domain"; @@ -8,11 +9,14 @@ import { stateColorCss } from "../../../common/entity/state_color"; import "../../../components/ha-control-select"; import type { ControlSelectOption } from "../../../components/ha-control-select"; import { UNAVAILABLE } from "../../../data/entity"; -import { HumidifierEntity, HumidifierState } from "../../../data/humidifier"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCardFeature } from "../types"; +import type { + HumidifierEntity, + HumidifierState, +} from "../../../data/humidifier"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCardFeature } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; -import { HumidifierToggleCardFeatureConfig } from "./types"; +import type { HumidifierToggleCardFeatureConfig } from "./types"; export const supportsHumidifierToggleCardFeature = (stateObj: HassEntity) => { const domain = computeDomain(stateObj.entity_id); diff --git a/src/panels/lovelace/card-features/hui-lawn-mower-commands-card-feature.ts b/src/panels/lovelace/card-features/hui-lawn-mower-commands-card-feature.ts index de74459b0108..70306fd455ad 100644 --- a/src/panels/lovelace/card-features/hui-lawn-mower-commands-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-lawn-mower-commands-card-feature.ts @@ -1,25 +1,23 @@ import { mdiHomeImportOutline, mdiPause, mdiPlay } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { LitElement, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { computeDomain } from "../../../common/entity/compute_domain"; import { supportsFeature } from "../../../common/entity/supports-feature"; import "../../../components/ha-control-button"; +import "../../../components/ha-svg-icon"; import "../../../components/ha-control-button-group"; import { UNAVAILABLE } from "../../../data/entity"; -import { - LawnMowerEntity, - LawnMowerEntityFeature, - canDock, -} from "../../../data/lawn_mower"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; +import type { LawnMowerEntity } from "../../../data/lawn_mower"; +import { LawnMowerEntityFeature, canDock } from "../../../data/lawn_mower"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; -import { - LAWN_MOWER_COMMANDS, +import type { LawnMowerCommand, LawnMowerCommandsCardFeatureConfig, } from "./types"; +import { LAWN_MOWER_COMMANDS } from "./types"; interface LawnMowerButton { translationKey: string; diff --git a/src/panels/lovelace/card-features/hui-light-brightness-card-feature.ts b/src/panels/lovelace/card-features/hui-light-brightness-card-feature.ts index 3390f01e654c..ae48e0a74fa2 100644 --- a/src/panels/lovelace/card-features/hui-light-brightness-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-light-brightness-card-feature.ts @@ -1,4 +1,4 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { computeDomain } from "../../../common/entity/compute_domain"; @@ -6,10 +6,10 @@ import { stateActive } from "../../../common/entity/state_active"; import "../../../components/ha-control-slider"; import { UNAVAILABLE } from "../../../data/entity"; import { lightSupportsBrightness } from "../../../data/light"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCardFeature } from "../types"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCardFeature } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; -import { LightBrightnessCardFeatureConfig } from "./types"; +import type { LightBrightnessCardFeatureConfig } from "./types"; export const supportsLightBrightnessCardFeature = (stateObj: HassEntity) => { const domain = computeDomain(stateObj.entity_id); diff --git a/src/panels/lovelace/card-features/hui-light-color-temp-card-feature.ts b/src/panels/lovelace/card-features/hui-light-color-temp-card-feature.ts index f7a71b4ecee2..4675b293a60e 100644 --- a/src/panels/lovelace/card-features/hui-light-color-temp-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-light-color-temp-card-feature.ts @@ -1,4 +1,4 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; @@ -14,10 +14,10 @@ import { UNAVAILABLE } from "../../../data/entity"; import { DOMAIN_ATTRIBUTES_UNITS } from "../../../data/entity_attributes"; import { LightColorMode, lightSupportsColorMode } from "../../../data/light"; import { generateColorTemperatureGradient } from "../../../dialogs/more-info/components/lights/light-color-temp-picker"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCardFeature } from "../types"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCardFeature } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; -import { LightColorTempCardFeatureConfig } from "./types"; +import type { LightColorTempCardFeatureConfig } from "./types"; export const supportsLightColorTempCardFeature = (stateObj: HassEntity) => { const domain = computeDomain(stateObj.entity_id); diff --git a/src/panels/lovelace/card-features/hui-lock-commands-card-feature.ts b/src/panels/lovelace/card-features/hui-lock-commands-card-feature.ts index 1c321134fd87..2c6968faf93a 100644 --- a/src/panels/lovelace/card-features/hui-lock-commands-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-lock-commands-card-feature.ts @@ -1,6 +1,7 @@ import { mdiLock, mdiLockOpenVariant } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; -import { CSSResultGroup, LitElement, html, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { LitElement, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { computeDomain } from "../../../common/entity/compute_domain"; @@ -12,10 +13,10 @@ import { canLock, canUnlock, } from "../../../data/lock"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCardFeature } from "../types"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCardFeature } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; -import { LockCommandsCardFeatureConfig } from "./types"; +import type { LockCommandsCardFeatureConfig } from "./types"; export const supportsLockCommandsCardFeature = (stateObj: HassEntity) => { const domain = computeDomain(stateObj.entity_id); diff --git a/src/panels/lovelace/card-features/hui-lock-open-door-card-feature.ts b/src/panels/lovelace/card-features/hui-lock-open-door-card-feature.ts index a5a046228983..d0b14f1f464b 100644 --- a/src/panels/lovelace/card-features/hui-lock-open-door-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-lock-open-door-card-feature.ts @@ -1,6 +1,7 @@ import { mdiCheck } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { computeDomain } from "../../../common/entity/compute_domain"; @@ -12,9 +13,9 @@ import { canOpen, LockEntityFeature, } from "../../../data/lock"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCardFeature } from "../types"; -import { LockOpenDoorCardFeatureConfig } from "./types"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCardFeature } from "../types"; +import type { LockOpenDoorCardFeatureConfig } from "./types"; import { cardFeatureStyles } from "./common/card-feature-styles"; export const supportsLockOpenDoorCardFeature = (stateObj: HassEntity) => { diff --git a/src/panels/lovelace/card-features/hui-numeric-input-card-feature.ts b/src/panels/lovelace/card-features/hui-numeric-input-card-feature.ts index 50ab4a5d6fe8..b4d1f6cbd8f7 100644 --- a/src/panels/lovelace/card-features/hui-numeric-input-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-numeric-input-card-feature.ts @@ -1,5 +1,6 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { html, LitElement, nothing, PropertyValues } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { computeDomain } from "../../../common/entity/compute_domain"; import "../../../components/ha-control-button"; @@ -8,10 +9,10 @@ import "../../../components/ha-control-number-buttons"; import "../../../components/ha-control-slider"; import "../../../components/ha-icon"; import { isUnavailableState } from "../../../data/entity"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; -import { NumericInputCardFeatureConfig } from "./types"; +import type { NumericInputCardFeatureConfig } from "./types"; export const supportsNumericInputCardFeature = (stateObj: HassEntity) => { const domain = computeDomain(stateObj.entity_id); diff --git a/src/panels/lovelace/card-features/hui-select-options-card-feature.ts b/src/panels/lovelace/card-features/hui-select-options-card-feature.ts index 8f63910ca48e..e7edd3e50f0a 100644 --- a/src/panels/lovelace/card-features/hui-select-options-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-select-options-card-feature.ts @@ -1,18 +1,19 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { html, LitElement, nothing, PropertyValues } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { stopPropagation } from "../../../common/dom/stop_propagation"; import { computeDomain } from "../../../common/entity/compute_domain"; import "../../../components/ha-control-select-menu"; import type { HaControlSelectMenu } from "../../../components/ha-control-select-menu"; import { UNAVAILABLE } from "../../../data/entity"; -import { InputSelectEntity } from "../../../data/input_select"; -import { SelectEntity } from "../../../data/select"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; +import type { InputSelectEntity } from "../../../data/input_select"; +import type { SelectEntity } from "../../../data/select"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; import { filterModes } from "./common/filter-modes"; -import { SelectOptionsCardFeatureConfig } from "./types"; +import type { SelectOptionsCardFeatureConfig } from "./types"; export const supportsSelectOptionsCardFeature = (stateObj: HassEntity) => { const domain = computeDomain(stateObj.entity_id); diff --git a/src/panels/lovelace/card-features/hui-target-humidity-card-feature.ts b/src/panels/lovelace/card-features/hui-target-humidity-card-feature.ts index cb10385bc636..f077112c1715 100644 --- a/src/panels/lovelace/card-features/hui-target-humidity-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-target-humidity-card-feature.ts @@ -1,14 +1,15 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { html, LitElement, nothing, PropertyValues } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { computeDomain } from "../../../common/entity/compute_domain"; import "../../../components/ha-control-slider"; import { UNAVAILABLE } from "../../../data/entity"; -import { HumidifierEntity } from "../../../data/humidifier"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCardFeature } from "../types"; +import type { HumidifierEntity } from "../../../data/humidifier"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCardFeature } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; -import { TargetHumidityCardFeatureConfig } from "./types"; +import type { TargetHumidityCardFeatureConfig } from "./types"; export const supportsTargetHumidityCardFeature = (stateObj: HassEntity) => { const domain = computeDomain(stateObj.entity_id); diff --git a/src/panels/lovelace/card-features/hui-target-temperature-card-feature.ts b/src/panels/lovelace/card-features/hui-target-temperature-card-feature.ts index 7ed7bdb3f2f0..0cea86d0aa78 100644 --- a/src/panels/lovelace/card-features/hui-target-temperature-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-target-temperature-card-feature.ts @@ -1,5 +1,6 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { html, LitElement, nothing, PropertyValues } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import { UNIT_F } from "../../../common/const"; @@ -10,16 +11,15 @@ import { supportsFeature } from "../../../common/entity/supports-feature"; import { debounce } from "../../../common/util/debounce"; import "../../../components/ha-control-button-group"; import "../../../components/ha-control-number-buttons"; -import { ClimateEntity, ClimateEntityFeature } from "../../../data/climate"; +import type { ClimateEntity } from "../../../data/climate"; +import { ClimateEntityFeature } from "../../../data/climate"; import { UNAVAILABLE } from "../../../data/entity"; -import { - WaterHeaterEntity, - WaterHeaterEntityFeature, -} from "../../../data/water_heater"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCardFeature } from "../types"; +import type { WaterHeaterEntity } from "../../../data/water_heater"; +import { WaterHeaterEntityFeature } from "../../../data/water_heater"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCardFeature } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; -import { TargetTemperatureCardFeatureConfig } from "./types"; +import type { TargetTemperatureCardFeatureConfig } from "./types"; type Target = "value" | "low" | "high"; diff --git a/src/panels/lovelace/card-features/hui-update-actions-card-feature.ts b/src/panels/lovelace/card-features/hui-update-actions-card-feature.ts index 173a32883dcd..aa0ec42d3df6 100644 --- a/src/panels/lovelace/card-features/hui-update-actions-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-update-actions-card-feature.ts @@ -1,5 +1,5 @@ import { mdiCancel, mdiCellphoneArrowDown } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { LitElement, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { computeDomain } from "../../../common/entity/compute_domain"; @@ -8,16 +8,13 @@ import { supportsFeature } from "../../../common/entity/supports-feature"; import "../../../components/ha-control-button"; import "../../../components/ha-control-button-group"; import { UNAVAILABLE } from "../../../data/entity"; -import { - UpdateEntity, - UpdateEntityFeature, - updateIsInstalling, -} from "../../../data/update"; +import type { UpdateEntity } from "../../../data/update"; +import { UpdateEntityFeature, updateIsInstalling } from "../../../data/update"; import { showUpdateBackupDialogParams } from "../../../dialogs/update_backup/show-update-backup-dialog"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; -import { UpdateActionsCardFeatureConfig } from "./types"; +import type { UpdateActionsCardFeatureConfig } from "./types"; export const DEFAULT_UPDATE_BACKUP_OPTION = "ask"; diff --git a/src/panels/lovelace/card-features/hui-vacuum-commands-card-feature.ts b/src/panels/lovelace/card-features/hui-vacuum-commands-card-feature.ts index 228d3032d7cf..20f77d12ca29 100644 --- a/src/panels/lovelace/card-features/hui-vacuum-commands-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-vacuum-commands-card-feature.ts @@ -7,30 +7,28 @@ import { mdiStop, mdiTargetVariant, } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { LitElement, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { computeDomain } from "../../../common/entity/compute_domain"; import { supportsFeature } from "../../../common/entity/supports-feature"; import "../../../components/ha-control-button"; +import "../../../components/ha-svg-icon"; import "../../../components/ha-control-button-group"; import { UNAVAILABLE } from "../../../data/entity"; +import type { VacuumEntity } from "../../../data/vacuum"; import { - VacuumEntity, VacuumEntityFeature, canReturnHome, canStart, canStop, isCleaning, } from "../../../data/vacuum"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; -import { - VACUUM_COMMANDS, - VacuumCommand, - VacuumCommandsCardFeatureConfig, -} from "./types"; +import type { VacuumCommand, VacuumCommandsCardFeatureConfig } from "./types"; +import { VACUUM_COMMANDS } from "./types"; interface VacuumButton { translationKey: string; diff --git a/src/panels/lovelace/card-features/hui-water-heater-operation-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-water-heater-operation-modes-card-feature.ts index a1c7c6690b41..96491049ac2d 100644 --- a/src/panels/lovelace/card-features/hui-water-heater-operation-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-water-heater-operation-modes-card-feature.ts @@ -1,5 +1,6 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import { computeDomain } from "../../../common/entity/compute_domain"; @@ -10,17 +11,19 @@ import "../../../components/ha-control-select"; import type { ControlSelectOption } from "../../../components/ha-control-select"; import "../../../components/ha-control-slider"; import { UNAVAILABLE } from "../../../data/entity"; +import type { + OperationMode, + WaterHeaterEntity, +} from "../../../data/water_heater"; import { compareWaterHeaterOperationMode, computeOperationModeIcon, - OperationMode, - WaterHeaterEntity, } from "../../../data/water_heater"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; import { cardFeatureStyles } from "./common/card-feature-styles"; import { filterModes } from "./common/filter-modes"; -import { WaterHeaterOperationModesCardFeatureConfig } from "./types"; +import type { WaterHeaterOperationModesCardFeatureConfig } from "./types"; export const supportsWaterHeaterOperationModesCardFeature = ( stateObj: HassEntity diff --git a/src/panels/lovelace/card-features/types.ts b/src/panels/lovelace/card-features/types.ts index 04a0f1df5fa7..4d965bdde3b0 100644 --- a/src/panels/lovelace/card-features/types.ts +++ b/src/panels/lovelace/card-features/types.ts @@ -1,6 +1,6 @@ -import { AlarmMode } from "../../../data/alarm_control_panel"; -import { HvacMode } from "../../../data/climate"; -import { OperationMode } from "../../../data/water_heater"; +import type { AlarmMode } from "../../../data/alarm_control_panel"; +import type { HvacMode } from "../../../data/climate"; +import type { OperationMode } from "../../../data/water_heater"; export interface CoverOpenCloseCardFeatureConfig { type: "cover-open-close"; diff --git a/src/panels/lovelace/cards/energy/common/energy-chart-options.ts b/src/panels/lovelace/cards/energy/common/energy-chart-options.ts index 5063de0215ff..e67bc453158b 100644 --- a/src/panels/lovelace/cards/energy/common/energy-chart-options.ts +++ b/src/panels/lovelace/cards/energy/common/energy-chart-options.ts @@ -1,12 +1,12 @@ -import { ChartOptions } from "chart.js"; -import { HassConfig } from "home-assistant-js-websocket"; +import type { ChartOptions } from "chart.js"; +import type { HassConfig } from "home-assistant-js-websocket"; import { addHours, subHours, differenceInDays, differenceInHours, } from "date-fns"; -import { FrontendLocaleData } from "../../../../../data/translation"; +import type { FrontendLocaleData } from "../../../../../data/translation"; import { formatNumber, numberFormatToLocale, diff --git a/src/panels/lovelace/cards/energy/hui-energy-carbon-consumed-gauge-card.ts b/src/panels/lovelace/cards/energy/hui-energy-carbon-consumed-gauge-card.ts index f7512fc981ef..84fafa333612 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-carbon-consumed-gauge-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-carbon-consumed-gauge-card.ts @@ -1,22 +1,16 @@ import { mdiInformation } from "@mdi/js"; import "@lrnwebcomponents/simple-tooltip/simple-tooltip"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import { round } from "../../../../common/number/round"; import "../../../../components/ha-card"; import "../../../../components/ha-gauge"; import "../../../../components/ha-svg-icon"; +import type { EnergyData } from "../../../../data/energy"; import { - EnergyData, energySourcesByType, getEnergyDataCollection, } from "../../../../data/energy"; diff --git a/src/panels/lovelace/cards/energy/hui-energy-compare-card.ts b/src/panels/lovelace/cards/energy/hui-energy-compare-card.ts index f1357e713aad..c442b6f5a436 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-compare-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-compare-card.ts @@ -1,21 +1,17 @@ import { differenceInDays, endOfDay } from "date-fns"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { formatDate } from "../../../../common/datetime/format_date"; -import { EnergyData, getEnergyDataCollection } from "../../../../data/energy"; +import type { EnergyData } from "../../../../data/energy"; +import { getEnergyDataCollection } from "../../../../data/energy"; import { SubscribeMixin } from "../../../../mixins/subscribe-mixin"; -import { HomeAssistant } from "../../../../types"; -import { LovelaceCard } from "../../types"; -import { EnergyCardBaseConfig } from "../types"; +import type { HomeAssistant } from "../../../../types"; +import type { LovelaceCard } from "../../types"; +import type { EnergyCardBaseConfig } from "../types"; import { hasConfigChanged } from "../../common/has-changed"; +import "../../../../components/ha-alert"; @customElement("hui-energy-compare-card") export class HuiEnergyCompareCard diff --git a/src/panels/lovelace/cards/energy/hui-energy-date-selection-card.ts b/src/panels/lovelace/cards/energy/hui-energy-date-selection-card.ts index 0b2ff5fa817b..28a446d62a2a 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-date-selection-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-date-selection-card.ts @@ -1,17 +1,12 @@ -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; import { hasConfigChanged } from "../../common/has-changed"; import "../../components/hui-energy-period-selector"; -import { LovelaceCard, LovelaceLayoutOptions } from "../../types"; -import { EnergyCardBaseConfig } from "../types"; +import "../../../../components/ha-card"; +import type { LovelaceCard, LovelaceLayoutOptions } from "../../types"; +import type { EnergyCardBaseConfig } from "../types"; @customElement("hui-energy-date-selection-card") export class HuiEnergyDateSelectionCard diff --git a/src/panels/lovelace/cards/energy/hui-energy-devices-detail-graph-card.ts b/src/panels/lovelace/cards/energy/hui-energy-devices-detail-graph-card.ts index 46e09608c942..9e2dfd92b975 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-devices-detail-graph-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-devices-detail-graph-card.ts @@ -1,45 +1,41 @@ -import { +import type { ChartData, ChartDataset, ChartOptions, ScatterDataPoint, } from "chart.js"; import { endOfToday, startOfToday } from "date-fns"; -import { HassConfig, UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { HassConfig, UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; import { getGraphColorByIndex } from "../../../../common/color/colors"; import { getEnergyColor } from "./common/color"; -import { ChartDatasetExtra } from "../../../../components/chart/ha-chart-base"; +import type { ChartDatasetExtra } from "../../../../components/chart/ha-chart-base"; import "../../../../components/ha-card"; -import { +import "../../../../components/chart/ha-chart-base"; +import type { DeviceConsumptionEnergyPreference, EnergyData, +} from "../../../../data/energy"; +import { getEnergyDataCollection, getSummedData, computeConsumptionData, } from "../../../../data/energy"; +import type { Statistics, StatisticsMetaData } from "../../../../data/recorder"; import { calculateStatisticSumGrowth, getStatisticLabel, - Statistics, - StatisticsMetaData, isExternalStatistic, } from "../../../../data/recorder"; -import { FrontendLocaleData } from "../../../../data/translation"; +import type { FrontendLocaleData } from "../../../../data/translation"; import { SubscribeMixin } from "../../../../mixins/subscribe-mixin"; -import { HomeAssistant } from "../../../../types"; -import { LovelaceCard } from "../../types"; -import { EnergyDevicesDetailGraphCardConfig } from "../types"; +import type { HomeAssistant } from "../../../../types"; +import type { LovelaceCard } from "../../types"; +import type { EnergyDevicesDetailGraphCardConfig } from "../types"; import { hasConfigChanged } from "../../common/has-changed"; import { getCommonOptions } from "./common/energy-chart-options"; import { fireEvent } from "../../../../common/dom/fire_event"; diff --git a/src/panels/lovelace/cards/energy/hui-energy-devices-graph-card.ts b/src/panels/lovelace/cards/energy/hui-energy-devices-graph-card.ts index 18192156c35e..44543d79e37b 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-devices-graph-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-devices-graph-card.ts @@ -1,4 +1,4 @@ -import { +import type { ChartData, ChartDataset, ChartOptions, @@ -6,15 +6,9 @@ import { ScatterDataPoint, } from "chart.js"; import { getRelativePosition } from "chart.js/helpers"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; @@ -27,17 +21,18 @@ import { import "../../../../components/chart/ha-chart-base"; import type { HaChartBase } from "../../../../components/chart/ha-chart-base"; import "../../../../components/ha-card"; -import { EnergyData, getEnergyDataCollection } from "../../../../data/energy"; +import type { EnergyData } from "../../../../data/energy"; +import { getEnergyDataCollection } from "../../../../data/energy"; import { calculateStatisticSumGrowth, getStatisticLabel, isExternalStatistic, } from "../../../../data/recorder"; -import { FrontendLocaleData } from "../../../../data/translation"; +import type { FrontendLocaleData } from "../../../../data/translation"; import { SubscribeMixin } from "../../../../mixins/subscribe-mixin"; -import { HomeAssistant } from "../../../../types"; -import { LovelaceCard } from "../../types"; -import { EnergyDevicesGraphCardConfig } from "../types"; +import type { HomeAssistant } from "../../../../types"; +import type { LovelaceCard } from "../../types"; +import type { EnergyDevicesGraphCardConfig } from "../types"; import { hasConfigChanged } from "../../common/has-changed"; import { clickIsTouch } from "../../../../components/chart/click_is_touch"; diff --git a/src/panels/lovelace/cards/energy/hui-energy-distribution-card.ts b/src/panels/lovelace/cards/energy/hui-energy-distribution-card.ts index 534775bc5ffe..4f455b2d0b44 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-distribution-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-distribution-card.ts @@ -12,15 +12,16 @@ import { mdiTransmissionTower, mdiWater, } from "@mdi/js"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, html, LitElement, svg, nothing, PropertyValues } from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { PropertyValues } from "lit"; +import { css, html, LitElement, svg, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { formatNumber } from "../../../../common/number/format_number"; import "../../../../components/ha-card"; import "../../../../components/ha-svg-icon"; +import type { EnergyData } from "../../../../data/energy"; import { - EnergyData, energySourcesByType, getEnergyDataCollection, getEnergyGasUnit, @@ -28,9 +29,9 @@ import { } from "../../../../data/energy"; import { calculateStatisticsSumGrowth } from "../../../../data/recorder"; import { SubscribeMixin } from "../../../../mixins/subscribe-mixin"; -import { HomeAssistant } from "../../../../types"; -import { LovelaceCard } from "../../types"; -import { EnergyDistributionCardConfig } from "../types"; +import type { HomeAssistant } from "../../../../types"; +import type { LovelaceCard } from "../../types"; +import type { EnergyDistributionCardConfig } from "../types"; import { hasConfigChanged } from "../../common/has-changed"; const CIRCLE_CIRCUMFERENCE = 238.76104; diff --git a/src/panels/lovelace/cards/energy/hui-energy-gas-graph-card.ts b/src/panels/lovelace/cards/energy/hui-energy-gas-graph-card.ts index baf3b2a7a776..3c23f2fb9444 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-gas-graph-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-gas-graph-card.ts @@ -1,19 +1,13 @@ -import { +import type { ChartData, ChartDataset, ChartOptions, ScatterDataPoint, } from "chart.js"; import { endOfToday, isToday, startOfToday } from "date-fns"; -import { HassConfig, UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { HassConfig, UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; @@ -21,22 +15,21 @@ import { getEnergyColor } from "./common/color"; import { formatNumber } from "../../../../common/number/format_number"; import "../../../../components/chart/ha-chart-base"; import "../../../../components/ha-card"; -import { +import type { EnergyData, GasSourceTypeEnergyPreference, +} from "../../../../data/energy"; +import { getEnergyDataCollection, getEnergyGasUnit, } from "../../../../data/energy"; -import { - getStatisticLabel, - Statistics, - StatisticsMetaData, -} from "../../../../data/recorder"; -import { FrontendLocaleData } from "../../../../data/translation"; +import type { Statistics, StatisticsMetaData } from "../../../../data/recorder"; +import { getStatisticLabel } from "../../../../data/recorder"; +import type { FrontendLocaleData } from "../../../../data/translation"; import { SubscribeMixin } from "../../../../mixins/subscribe-mixin"; -import { HomeAssistant } from "../../../../types"; -import { LovelaceCard } from "../../types"; -import { EnergyGasGraphCardConfig } from "../types"; +import type { HomeAssistant } from "../../../../types"; +import type { LovelaceCard } from "../../types"; +import type { EnergyGasGraphCardConfig } from "../types"; import { hasConfigChanged } from "../../common/has-changed"; import { getCommonOptions } from "./common/energy-chart-options"; diff --git a/src/panels/lovelace/cards/energy/hui-energy-grid-neutrality-gauge-card.ts b/src/panels/lovelace/cards/energy/hui-energy-grid-neutrality-gauge-card.ts index fbed586357c5..83af78a7bee2 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-grid-neutrality-gauge-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-grid-neutrality-gauge-card.ts @@ -1,25 +1,19 @@ import { mdiInformation } from "@mdi/js"; import "@lrnwebcomponents/simple-tooltip/simple-tooltip"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { formatNumber } from "../../../../common/number/format_number"; import "../../../../components/ha-card"; import "../../../../components/ha-gauge"; import type { LevelDefinition } from "../../../../components/ha-gauge"; import "../../../../components/ha-svg-icon"; -import { +import type { EnergyData, - getEnergyDataCollection, GridSourceTypeEnergyPreference, } from "../../../../data/energy"; +import { getEnergyDataCollection } from "../../../../data/energy"; import { calculateStatisticsSumGrowth } from "../../../../data/recorder"; import { SubscribeMixin } from "../../../../mixins/subscribe-mixin"; import type { HomeAssistant } from "../../../../types"; diff --git a/src/panels/lovelace/cards/energy/hui-energy-self-sufficiency-gauge-card.ts b/src/panels/lovelace/cards/energy/hui-energy-self-sufficiency-gauge-card.ts index 1b5a1bb8b048..98995134b7ae 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-self-sufficiency-gauge-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-self-sufficiency-gauge-card.ts @@ -1,21 +1,15 @@ import "@lrnwebcomponents/simple-tooltip/simple-tooltip"; import { mdiInformation } from "@mdi/js"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import "../../../../components/ha-card"; import "../../../../components/ha-gauge"; import "../../../../components/ha-svg-icon"; +import type { EnergyData } from "../../../../data/energy"; import { - EnergyData, energySourcesByType, getEnergyDataCollection, } from "../../../../data/energy"; diff --git a/src/panels/lovelace/cards/energy/hui-energy-solar-consumed-gauge-card.ts b/src/panels/lovelace/cards/energy/hui-energy-solar-consumed-gauge-card.ts index 78ffa6c75078..9b18724c0fb0 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-solar-consumed-gauge-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-solar-consumed-gauge-card.ts @@ -1,21 +1,15 @@ import { mdiInformation } from "@mdi/js"; import "@lrnwebcomponents/simple-tooltip/simple-tooltip"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import "../../../../components/ha-card"; import "../../../../components/ha-gauge"; import "../../../../components/ha-svg-icon"; +import type { EnergyData } from "../../../../data/energy"; import { - EnergyData, energySourcesByType, getEnergyDataCollection, } from "../../../../data/energy"; diff --git a/src/panels/lovelace/cards/energy/hui-energy-solar-graph-card.ts b/src/panels/lovelace/cards/energy/hui-energy-solar-graph-card.ts index f6abc48b1855..1137345d450c 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-solar-graph-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-solar-graph-card.ts @@ -1,19 +1,13 @@ -import { +import type { ChartData, ChartDataset, ChartOptions, ScatterDataPoint, } from "chart.js"; import { differenceInDays, endOfToday, isToday, startOfToday } from "date-fns"; -import { HassConfig, UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { HassConfig, UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; @@ -21,23 +15,22 @@ import { getEnergyColor } from "./common/color"; import { formatNumber } from "../../../../common/number/format_number"; import "../../../../components/chart/ha-chart-base"; import "../../../../components/ha-card"; -import { +import type { EnergyData, EnergySolarForecasts, - getEnergyDataCollection, - getEnergySolarForecasts, SolarSourceTypeEnergyPreference, } from "../../../../data/energy"; import { - getStatisticLabel, - Statistics, - StatisticsMetaData, -} from "../../../../data/recorder"; -import { FrontendLocaleData } from "../../../../data/translation"; + getEnergyDataCollection, + getEnergySolarForecasts, +} from "../../../../data/energy"; +import type { Statistics, StatisticsMetaData } from "../../../../data/recorder"; +import { getStatisticLabel } from "../../../../data/recorder"; +import type { FrontendLocaleData } from "../../../../data/translation"; import { SubscribeMixin } from "../../../../mixins/subscribe-mixin"; -import { HomeAssistant } from "../../../../types"; -import { LovelaceCard } from "../../types"; -import { EnergySolarGraphCardConfig } from "../types"; +import type { HomeAssistant } from "../../../../types"; +import type { LovelaceCard } from "../../types"; +import type { EnergySolarGraphCardConfig } from "../types"; import { hasConfigChanged } from "../../common/has-changed"; import { getCommonOptions } from "./common/energy-chart-options"; diff --git a/src/panels/lovelace/cards/energy/hui-energy-sources-table-card.ts b/src/panels/lovelace/cards/energy/hui-energy-sources-table-card.ts index 06e5c29baae6..59722c45279c 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-sources-table-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-sources-table-card.ts @@ -1,23 +1,16 @@ // @ts-ignore import dataTableStyles from "@material/data-table/dist/mdc.data-table.min.css"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - unsafeCSS, - nothing, - PropertyValues, -} from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, unsafeCSS, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { styleMap } from "lit/directives/style-map"; import { formatNumber } from "../../../../common/number/format_number"; import { getEnergyColor } from "./common/color"; import "../../../../components/ha-card"; +import type { EnergyData } from "../../../../data/energy"; import { - EnergyData, energySourcesByType, getEnergyDataCollection, getEnergyGasUnit, @@ -29,9 +22,9 @@ import { isExternalStatistic, } from "../../../../data/recorder"; import { SubscribeMixin } from "../../../../mixins/subscribe-mixin"; -import { HomeAssistant } from "../../../../types"; -import { LovelaceCard } from "../../types"; -import { EnergySourcesTableCardConfig } from "../types"; +import type { HomeAssistant } from "../../../../types"; +import type { LovelaceCard } from "../../types"; +import type { EnergySourcesTableCardConfig } from "../types"; import { hasConfigChanged } from "../../common/has-changed"; import { fireEvent } from "../../../../common/dom/fire_event"; diff --git a/src/panels/lovelace/cards/energy/hui-energy-usage-graph-card.ts b/src/panels/lovelace/cards/energy/hui-energy-usage-graph-card.ts index 573afe4bdef7..b6b8243a94b4 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-usage-graph-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-usage-graph-card.ts @@ -1,19 +1,13 @@ -import { +import type { ChartData, ChartDataset, ChartOptions, ScatterDataPoint, } from "chart.js"; import { endOfToday, isToday, startOfToday } from "date-fns"; -import { HassConfig, UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { HassConfig, UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; @@ -21,17 +15,15 @@ import { getEnergyColor } from "./common/color"; import { formatNumber } from "../../../../common/number/format_number"; import "../../../../components/chart/ha-chart-base"; import "../../../../components/ha-card"; -import { EnergyData, getEnergyDataCollection } from "../../../../data/energy"; -import { - getStatisticLabel, - Statistics, - StatisticsMetaData, -} from "../../../../data/recorder"; -import { FrontendLocaleData } from "../../../../data/translation"; +import type { EnergyData } from "../../../../data/energy"; +import { getEnergyDataCollection } from "../../../../data/energy"; +import type { Statistics, StatisticsMetaData } from "../../../../data/recorder"; +import { getStatisticLabel } from "../../../../data/recorder"; +import type { FrontendLocaleData } from "../../../../data/translation"; import { SubscribeMixin } from "../../../../mixins/subscribe-mixin"; -import { HomeAssistant } from "../../../../types"; -import { LovelaceCard } from "../../types"; -import { EnergyUsageGraphCardConfig } from "../types"; +import type { HomeAssistant } from "../../../../types"; +import type { LovelaceCard } from "../../types"; +import type { EnergyUsageGraphCardConfig } from "../types"; import { hasConfigChanged } from "../../common/has-changed"; import { getCommonOptions } from "./common/energy-chart-options"; diff --git a/src/panels/lovelace/cards/energy/hui-energy-water-graph-card.ts b/src/panels/lovelace/cards/energy/hui-energy-water-graph-card.ts index d5011fc9cb8f..a37ea179c5bd 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-water-graph-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-water-graph-card.ts @@ -1,19 +1,13 @@ -import { +import type { ChartData, ChartDataset, ChartOptions, ScatterDataPoint, } from "chart.js"; import { endOfToday, isToday, startOfToday } from "date-fns"; -import { HassConfig, UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { HassConfig, UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; @@ -21,22 +15,21 @@ import { getEnergyColor } from "./common/color"; import { formatNumber } from "../../../../common/number/format_number"; import "../../../../components/chart/ha-chart-base"; import "../../../../components/ha-card"; -import { +import type { EnergyData, - getEnergyDataCollection, - getEnergyWaterUnit, WaterSourceTypeEnergyPreference, } from "../../../../data/energy"; import { - getStatisticLabel, - Statistics, - StatisticsMetaData, -} from "../../../../data/recorder"; -import { FrontendLocaleData } from "../../../../data/translation"; + getEnergyDataCollection, + getEnergyWaterUnit, +} from "../../../../data/energy"; +import type { Statistics, StatisticsMetaData } from "../../../../data/recorder"; +import { getStatisticLabel } from "../../../../data/recorder"; +import type { FrontendLocaleData } from "../../../../data/translation"; import { SubscribeMixin } from "../../../../mixins/subscribe-mixin"; -import { HomeAssistant } from "../../../../types"; -import { LovelaceCard } from "../../types"; -import { EnergyWaterGraphCardConfig } from "../types"; +import type { HomeAssistant } from "../../../../types"; +import type { LovelaceCard } from "../../types"; +import type { EnergyWaterGraphCardConfig } from "../types"; import { hasConfigChanged } from "../../common/has-changed"; import { getCommonOptions } from "./common/energy-chart-options"; diff --git a/src/panels/lovelace/cards/hui-alarm-panel-card.ts b/src/panels/lovelace/cards/hui-alarm-panel-card.ts index 225f30cea6e9..ed71bf763da6 100644 --- a/src/panels/lovelace/cards/hui-alarm-panel-card.ts +++ b/src/panels/lovelace/cards/hui-alarm-panel-card.ts @@ -1,12 +1,6 @@ -import { HassEntity, UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { HassEntity, UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { styleMap } from "lit/directives/style-map"; @@ -19,9 +13,9 @@ import "../../../components/ha-card"; import "../../../components/ha-state-icon"; import "../../../components/ha-textfield"; import type { HaTextField } from "../../../components/ha-textfield"; +import type { AlarmMode } from "../../../data/alarm_control_panel"; import { ALARM_MODES, - AlarmMode, FORMAT_NUMBER, callAlarmAction, } from "../../../data/alarm_control_panel"; @@ -30,12 +24,12 @@ import type { HomeAssistant } from "../../../types"; import { findEntities } from "../common/find-entities"; import { createEntityNotFoundWarning } from "../components/hui-warning"; import type { LovelaceCard } from "../types"; +import type { ExtEntityRegistryEntry } from "../../../data/entity_registry"; import { - ExtEntityRegistryEntry, getExtendedEntityRegistryEntry, subscribeEntityRegistry, } from "../../../data/entity_registry"; -import { AlarmPanelCardConfig, AlarmPanelCardConfigState } from "./types"; +import type { AlarmPanelCardConfig, AlarmPanelCardConfigState } from "./types"; const BUTTONS = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "", "0", "clear"]; diff --git a/src/panels/lovelace/cards/hui-area-card.ts b/src/panels/lovelace/cards/hui-area-card.ts index 387110d9ae19..1e2b335ade56 100644 --- a/src/panels/lovelace/cards/hui-area-card.ts +++ b/src/panels/lovelace/cards/hui-area-card.ts @@ -9,15 +9,8 @@ import { mdiWaterAlert, } from "@mdi/js"; import type { HassEntity, UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { styleMap } from "lit/directives/style-map"; @@ -37,30 +30,24 @@ import "../../../components/ha-card"; import "../../../components/ha-domain-icon"; import "../../../components/ha-icon-button"; import "../../../components/ha-state-icon"; -import { - AreaRegistryEntry, - subscribeAreaRegistry, -} from "../../../data/area_registry"; -import { - DeviceRegistryEntry, - subscribeDeviceRegistry, -} from "../../../data/device_registry"; +import type { AreaRegistryEntry } from "../../../data/area_registry"; +import { subscribeAreaRegistry } from "../../../data/area_registry"; +import type { DeviceRegistryEntry } from "../../../data/device_registry"; +import { subscribeDeviceRegistry } from "../../../data/device_registry"; import { isUnavailableState } from "../../../data/entity"; -import { - EntityRegistryEntry, - subscribeEntityRegistry, -} from "../../../data/entity_registry"; +import type { EntityRegistryEntry } from "../../../data/entity_registry"; +import { subscribeEntityRegistry } from "../../../data/entity_registry"; import { forwardHaptic } from "../../../data/haptics"; import { SubscribeMixin } from "../../../mixins/subscribe-mixin"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import "../components/hui-image"; import "../components/hui-warning"; -import { +import type { LovelaceCard, LovelaceCardEditor, LovelaceLayoutOptions, } from "../types"; -import { AreaCardConfig } from "./types"; +import type { AreaCardConfig } from "./types"; export const DEFAULT_ASPECT_RATIO = "16:9"; diff --git a/src/panels/lovelace/cards/hui-button-card.ts b/src/panels/lovelace/cards/hui-button-card.ts index f7492d0f65a1..2bed7c6038e9 100644 --- a/src/panels/lovelace/cards/hui-button-card.ts +++ b/src/panels/lovelace/cards/hui-button-card.ts @@ -1,17 +1,11 @@ import { consume } from "@lit-labs/context"; -import { +import type { HassConfig, HassEntities, HassEntity, } from "home-assistant-js-websocket"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { styleMap } from "lit/directives/style-map"; @@ -28,7 +22,7 @@ import { } from "../../../common/entity/state_color"; import { isValidEntityId } from "../../../common/entity/valid_entity_id"; import { iconColorCSS } from "../../../common/style/icon_color_css"; -import { LocalizeFunc } from "../../../common/translations/localize"; +import type { LocalizeFunc } from "../../../common/translations/localize"; import "../../../components/ha-card"; import "../../../components/ha-ripple"; import { CLIMATE_HVAC_ACTION_TO_MODE } from "../../../data/climate"; @@ -40,21 +34,21 @@ import { statesContext, themesContext, } from "../../../data/context"; -import { EntityRegistryDisplayEntry } from "../../../data/entity_registry"; -import { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; -import { FrontendLocaleData } from "../../../data/translation"; -import { Themes } from "../../../data/ws-themes"; -import { HomeAssistant } from "../../../types"; +import type { EntityRegistryDisplayEntry } from "../../../data/entity_registry"; +import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; +import type { FrontendLocaleData } from "../../../data/translation"; +import type { Themes } from "../../../data/ws-themes"; +import type { HomeAssistant } from "../../../types"; import { actionHandler } from "../common/directives/action-handler-directive"; import { findEntities } from "../common/find-entities"; import { hasAction } from "../common/has-action"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { +import type { LovelaceCard, LovelaceCardEditor, LovelaceLayoutOptions, } from "../types"; -import { ButtonCardConfig } from "./types"; +import type { ButtonCardConfig } from "./types"; export const getEntityDefaultButtonAction = (entityId?: string) => entityId && DOMAINS_TOGGLE.has(computeDomain(entityId)) diff --git a/src/panels/lovelace/cards/hui-calendar-card.ts b/src/panels/lovelace/cards/hui-calendar-card.ts index faa886b1baba..110d28378d64 100644 --- a/src/panels/lovelace/cards/hui-calendar-card.ts +++ b/src/panels/lovelace/cards/hui-calendar-card.ts @@ -1,23 +1,14 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { getColorByIndex } from "../../../common/color/colors"; import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element"; -import { HASSDomEvent } from "../../../common/dom/fire_event"; +import type { HASSDomEvent } from "../../../common/dom/fire_event"; import { computeStateName } from "../../../common/entity/compute_state_name"; import { debounce } from "../../../common/util/debounce"; import "../../../components/ha-card"; -import { - Calendar, - CalendarEvent, - fetchCalendarEvents, -} from "../../../data/calendar"; +import type { Calendar, CalendarEvent } from "../../../data/calendar"; +import { fetchCalendarEvents } from "../../../data/calendar"; import type { CalendarViewChanged, FullCalendarView, diff --git a/src/panels/lovelace/cards/hui-card.ts b/src/panels/lovelace/cards/hui-card.ts index 4ff02e2d0e88..855c4d30404f 100644 --- a/src/panels/lovelace/cards/hui-card.ts +++ b/src/panels/lovelace/cards/hui-card.ts @@ -1,9 +1,10 @@ -import { PropertyValues, ReactiveElement } from "lit"; +import type { PropertyValues } from "lit"; +import { ReactiveElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; -import { MediaQueriesListener } from "../../../common/dom/media_query"; +import type { MediaQueriesListener } from "../../../common/dom/media_query"; import "../../../components/ha-svg-icon"; -import { LovelaceCardConfig } from "../../../data/lovelace/config/card"; +import type { LovelaceCardConfig } from "../../../data/lovelace/config/card"; import type { HomeAssistant } from "../../../types"; import { migrateLayoutToGridOptions } from "../common/compute-card-grid-size"; import { computeCardSize } from "../common/compute-card-size"; diff --git a/src/panels/lovelace/cards/hui-conditional-card.ts b/src/panels/lovelace/cards/hui-conditional-card.ts index 630a7494c9b0..ca53b589bca9 100644 --- a/src/panels/lovelace/cards/hui-conditional-card.ts +++ b/src/panels/lovelace/cards/hui-conditional-card.ts @@ -1,10 +1,10 @@ import { customElement } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; -import { LovelaceCardConfig } from "../../../data/lovelace/config/card"; +import type { LovelaceCardConfig } from "../../../data/lovelace/config/card"; import { computeCardSize } from "../common/compute-card-size"; import { HuiConditionalBase } from "../components/hui-conditional-base"; -import { LovelaceCard, LovelaceCardEditor } from "../types"; -import { ConditionalCardConfig } from "./types"; +import type { LovelaceCard, LovelaceCardEditor } from "../types"; +import type { ConditionalCardConfig } from "./types"; @customElement("hui-conditional-card") class HuiConditionalCard extends HuiConditionalBase implements LovelaceCard { diff --git a/src/panels/lovelace/cards/hui-empty-state-card.ts b/src/panels/lovelace/cards/hui-empty-state-card.ts index 1ed616e84180..3b8671d58490 100644 --- a/src/panels/lovelace/cards/hui-empty-state-card.ts +++ b/src/panels/lovelace/cards/hui-empty-state-card.ts @@ -1,10 +1,11 @@ import "@material/mwc-button/mwc-button"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../components/ha-card"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCard } from "../types"; -import { EmptyStateCardConfig } from "./types"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCard } from "../types"; +import type { EmptyStateCardConfig } from "./types"; @customElement("hui-empty-state-card") export class HuiEmptyStateCard extends LitElement implements LovelaceCard { diff --git a/src/panels/lovelace/cards/hui-entities-card.ts b/src/panels/lovelace/cards/hui-entities-card.ts index 152c8b1ca4ef..cde4c45e1b68 100644 --- a/src/panels/lovelace/cards/hui-entities-card.ts +++ b/src/panels/lovelace/cards/hui-entities-card.ts @@ -1,35 +1,28 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, state } from "lit/decorators"; import { DOMAINS_TOGGLE } from "../../../common/const"; import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element"; import { computeDomain } from "../../../common/entity/compute_domain"; import "../../../components/ha-card"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { computeCardSize } from "../common/compute-card-size"; import { findEntities } from "../common/find-entities"; import { processConfigEntities } from "../common/process-config-entities"; import "../components/hui-entities-toggle"; import { createHeaderFooterElement } from "../create-element/create-header-footer-element"; import { createRowElement } from "../create-element/create-row-element"; -import { +import type { EntityConfig, LovelaceRow, LovelaceRowConfig, } from "../entity-rows/types"; -import { +import type { LovelaceCard, LovelaceCardEditor, LovelaceHeaderFooter, } from "../types"; -import { EntitiesCardConfig } from "./types"; +import type { EntitiesCardConfig } from "./types"; @customElement("hui-entities-card") class HuiEntitiesCard extends LitElement implements LovelaceCard { diff --git a/src/panels/lovelace/cards/hui-entity-card.ts b/src/panels/lovelace/cards/hui-entity-card.ts index b042d7e7c354..b2b849525540 100644 --- a/src/panels/lovelace/cards/hui-entity-card.ts +++ b/src/panels/lovelace/cards/hui-entity-card.ts @@ -1,12 +1,6 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { ifDefined } from "lit/directives/if-defined"; @@ -31,19 +25,19 @@ import "../../../components/ha-card"; import "../../../components/ha-icon"; import { CLIMATE_HVAC_ACTION_TO_MODE } from "../../../data/climate"; import { isUnavailableState } from "../../../data/entity"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { computeCardSize } from "../common/compute-card-size"; import { findEntities } from "../common/find-entities"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import { createEntityNotFoundWarning } from "../components/hui-warning"; import { createHeaderFooterElement } from "../create-element/create-header-footer-element"; -import { +import type { LovelaceCard, LovelaceHeaderFooter, LovelaceLayoutOptions, } from "../types"; -import { HuiErrorCard } from "./hui-error-card"; -import { EntityCardConfig } from "./types"; +import type { HuiErrorCard } from "./hui-error-card"; +import type { EntityCardConfig } from "./types"; @customElement("hui-entity-card") export class HuiEntityCard extends LitElement implements LovelaceCard { diff --git a/src/panels/lovelace/cards/hui-entity-filter-card.ts b/src/panels/lovelace/cards/hui-entity-filter-card.ts index 804801cc3fae..96239b853818 100644 --- a/src/panels/lovelace/cards/hui-entity-filter-card.ts +++ b/src/panels/lovelace/cards/hui-entity-filter-card.ts @@ -1,8 +1,9 @@ -import { PropertyValues, ReactiveElement } from "lit"; +import type { PropertyValues } from "lit"; +import { ReactiveElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; -import { LovelaceCardConfig } from "../../../data/lovelace/config/card"; -import { HomeAssistant } from "../../../types"; +import type { LovelaceCardConfig } from "../../../data/lovelace/config/card"; +import type { HomeAssistant } from "../../../types"; import { computeCardSize } from "../common/compute-card-size"; import { evaluateStateFilter } from "../common/evaluate-filter"; import { findEntities } from "../common/find-entities"; @@ -12,10 +13,10 @@ import { checkConditionsMet, extractConditionEntityIds, } from "../common/validate-condition"; -import { EntityFilterEntityConfig } from "../entity-rows/types"; -import { LovelaceCard } from "../types"; -import { HuiCard } from "./hui-card"; -import { EntityFilterCardConfig } from "./types"; +import type { EntityFilterEntityConfig } from "../entity-rows/types"; +import type { LovelaceCard } from "../types"; +import type { HuiCard } from "./hui-card"; +import type { EntityFilterCardConfig } from "./types"; @customElement("hui-entity-filter-card") export class HuiEntityFilterCard diff --git a/src/panels/lovelace/cards/hui-error-card.ts b/src/panels/lovelace/cards/hui-error-card.ts index 745b45852b37..7afe89a1b10f 100644 --- a/src/panels/lovelace/cards/hui-error-card.ts +++ b/src/panels/lovelace/cards/hui-error-card.ts @@ -1,10 +1,11 @@ import { dump } from "js-yaml"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/ha-alert"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCard } from "../types"; -import { ErrorCardConfig } from "./types"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCard } from "../types"; +import type { ErrorCardConfig } from "./types"; @customElement("hui-error-card") export class HuiErrorCard extends LitElement implements LovelaceCard { diff --git a/src/panels/lovelace/cards/hui-gauge-card.ts b/src/panels/lovelace/cards/hui-gauge-card.ts index 43705166531d..f43af8f06d0f 100644 --- a/src/panels/lovelace/cards/hui-gauge-card.ts +++ b/src/panels/lovelace/cards/hui-gauge-card.ts @@ -1,12 +1,6 @@ -import { HassEntity } from "home-assistant-js-websocket/dist/types"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { HassEntity } from "home-assistant-js-websocket/dist/types"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { classMap } from "lit/directives/class-map"; @@ -18,7 +12,7 @@ import { getNumberFormatOptions } from "../../../common/number/format_number"; import "../../../components/ha-card"; import "../../../components/ha-gauge"; import { UNAVAILABLE } from "../../../data/entity"; -import { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; +import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; import type { HomeAssistant } from "../../../types"; import { actionHandler } from "../common/directives/action-handler-directive"; import { findEntities } from "../common/find-entities"; diff --git a/src/panels/lovelace/cards/hui-glance-card.ts b/src/panels/lovelace/cards/hui-glance-card.ts index 37e895669332..1d75e2438e0d 100644 --- a/src/panels/lovelace/cards/hui-glance-card.ts +++ b/src/panels/lovelace/cards/hui-glance-card.ts @@ -1,12 +1,5 @@ -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { ifDefined } from "lit/directives/if-defined"; @@ -18,13 +11,13 @@ import "../../../components/ha-card"; import "../../../components/ha-icon"; import "../../../components/ha-relative-time"; import { isUnavailableState } from "../../../data/entity"; -import { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; -import { +import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; +import type { CallServiceActionConfig, MoreInfoActionConfig, } from "../../../data/lovelace/config/action"; import { SENSOR_DEVICE_CLASS_TIMESTAMP } from "../../../data/sensor"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { actionHandler } from "../common/directives/action-handler-directive"; import { findEntities } from "../common/find-entities"; import { handleAction } from "../common/handle-action"; @@ -34,8 +27,8 @@ import { processConfigEntities } from "../common/process-config-entities"; import "../components/hui-timestamp-display"; import { createEntityNotFoundWarning } from "../components/hui-warning"; import "../components/hui-warning-element"; -import { LovelaceCard, LovelaceCardEditor } from "../types"; -import { GlanceCardConfig, GlanceConfigEntity } from "./types"; +import type { LovelaceCard, LovelaceCardEditor } from "../types"; +import type { GlanceCardConfig, GlanceConfigEntity } from "./types"; @customElement("hui-glance-card") export class HuiGlanceCard extends LitElement implements LovelaceCard { diff --git a/src/panels/lovelace/cards/hui-grid-card.ts b/src/panels/lovelace/cards/hui-grid-card.ts index 0838db77d9ba..1e04ea81fbe5 100644 --- a/src/panels/lovelace/cards/hui-grid-card.ts +++ b/src/panels/lovelace/cards/hui-grid-card.ts @@ -1,8 +1,9 @@ -import { css, CSSResultGroup } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css } from "lit"; import { computeCardSize } from "../common/compute-card-size"; -import { LovelaceCardEditor } from "../types"; +import type { LovelaceCardEditor } from "../types"; import { HuiStackCard } from "./hui-stack-card"; -import { GridCardConfig } from "./types"; +import type { GridCardConfig } from "./types"; export const DEFAULT_COLUMNS = 3; const SQUARE_ROW_HEIGHTS_BY_COLUMNS = { diff --git a/src/panels/lovelace/cards/hui-heading-card.ts b/src/panels/lovelace/cards/hui-heading-card.ts index a0028ca5b9c9..6d57a1ae064c 100644 --- a/src/panels/lovelace/cards/hui-heading-card.ts +++ b/src/panels/lovelace/cards/hui-heading-card.ts @@ -1,13 +1,14 @@ -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import "../../../components/ha-card"; import "../../../components/ha-icon"; import "../../../components/ha-icon-next"; import "../../../components/ha-state-icon"; -import { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; +import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; import "../../../state-display/state-display"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { actionHandler } from "../common/directives/action-handler-directive"; import { handleAction } from "../common/handle-action"; import { hasAction } from "../common/has-action"; diff --git a/src/panels/lovelace/cards/hui-history-graph-card.ts b/src/panels/lovelace/cards/hui-history-graph-card.ts index e2d0b671b355..490180ac91c7 100644 --- a/src/panels/lovelace/cards/hui-history-graph-card.ts +++ b/src/panels/lovelace/cards/hui-history-graph-card.ts @@ -1,11 +1,5 @@ -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; @@ -13,17 +7,17 @@ import "../../../components/chart/state-history-charts"; import "../../../components/ha-alert"; import "../../../components/ha-card"; import "../../../components/ha-icon-next"; +import type { HistoryResult } from "../../../data/history"; import { - HistoryResult, computeHistory, subscribeHistoryStatesTimeWindow, } from "../../../data/history"; import { getSensorNumericDeviceClasses } from "../../../data/sensor"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { hasConfigOrEntitiesChanged } from "../common/has-changed"; import { processConfigEntities } from "../common/process-config-entities"; -import { LovelaceCard } from "../types"; -import { HistoryGraphCardConfig } from "./types"; +import type { LovelaceCard } from "../types"; +import type { HistoryGraphCardConfig } from "./types"; import { createSearchParam } from "../../../common/url/search-params"; export const DEFAULT_HOURS_TO_SHOW = 24; diff --git a/src/panels/lovelace/cards/hui-horizontal-stack-card.ts b/src/panels/lovelace/cards/hui-horizontal-stack-card.ts index e224953ade0f..4e41f9a5c071 100644 --- a/src/panels/lovelace/cards/hui-horizontal-stack-card.ts +++ b/src/panels/lovelace/cards/hui-horizontal-stack-card.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css } from "lit"; import { customElement } from "lit/decorators"; import { computeCardSize } from "../common/compute-card-size"; import { HuiStackCard } from "./hui-stack-card"; @@ -27,7 +28,6 @@ export class HuiHorizontalStackCard extends HuiStackCard { css` #root { display: flex; - height: 100%; gap: var(--horizontal-stack-card-gap, var(--stack-card-gap, 8px)); } #root > hui-card { diff --git a/src/panels/lovelace/cards/hui-humidifier-card.ts b/src/panels/lovelace/cards/hui-humidifier-card.ts index 405158847a09..c342934afc6e 100644 --- a/src/panels/lovelace/cards/hui-humidifier-card.ts +++ b/src/panels/lovelace/cards/hui-humidifier-card.ts @@ -1,13 +1,7 @@ import { ResizeController } from "@lit-labs/observers/resize-controller"; import { mdiDotsVertical } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element"; @@ -16,18 +10,18 @@ import { computeStateName } from "../../../common/entity/compute_state_name"; import { stateColorCss } from "../../../common/entity/state_color"; import "../../../components/ha-card"; import "../../../components/ha-icon-button"; -import { HumidifierEntity } from "../../../data/humidifier"; +import type { HumidifierEntity } from "../../../data/humidifier"; import "../../../state-control/humidifier/ha-state-control-humidifier-humidity"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import "../card-features/hui-card-features"; import { findEntities } from "../common/find-entities"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { +import type { LovelaceCard, LovelaceCardEditor, LovelaceLayoutOptions, } from "../types"; -import { HumidifierCardConfig } from "./types"; +import type { HumidifierCardConfig } from "./types"; @customElement("hui-humidifier-card") export class HuiHumidifierCard extends LitElement implements LovelaceCard { diff --git a/src/panels/lovelace/cards/hui-iframe-card.ts b/src/panels/lovelace/cards/hui-iframe-card.ts index b70af9a7abaa..aa078608cebc 100644 --- a/src/panels/lovelace/cards/hui-iframe-card.ts +++ b/src/panels/lovelace/cards/hui-iframe-card.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { styleMap } from "lit/directives/style-map"; @@ -7,12 +8,12 @@ import "../../../components/ha-alert"; import "../../../components/ha-card"; import type { HomeAssistant } from "../../../types"; import { IFRAME_SANDBOX } from "../../../util/iframe"; -import { +import type { LovelaceCard, LovelaceCardEditor, LovelaceLayoutOptions, } from "../types"; -import { IframeCardConfig } from "./types"; +import type { IframeCardConfig } from "./types"; @customElement("hui-iframe-card") export class HuiIframeCard extends LitElement implements LovelaceCard { diff --git a/src/panels/lovelace/cards/hui-light-card.ts b/src/panels/lovelace/cards/hui-light-card.ts index 3c87546d2978..9a5e4d54d64c 100644 --- a/src/panels/lovelace/cards/hui-light-card.ts +++ b/src/panels/lovelace/cards/hui-light-card.ts @@ -1,13 +1,7 @@ import { mdiDotsVertical } from "@mdi/js"; import "@thomasloven/round-slider"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { styleMap } from "lit/directives/style-map"; @@ -19,17 +13,18 @@ import "../../../components/ha-card"; import "../../../components/ha-icon-button"; import "../../../components/ha-state-icon"; import { UNAVAILABLE, isUnavailableState } from "../../../data/entity"; -import { LightEntity, lightSupportsBrightness } from "../../../data/light"; -import { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; -import { HomeAssistant } from "../../../types"; +import type { LightEntity } from "../../../data/light"; +import { lightSupportsBrightness } from "../../../data/light"; +import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; +import type { HomeAssistant } from "../../../types"; import { actionHandler } from "../common/directives/action-handler-directive"; import { findEntities } from "../common/find-entities"; import { handleAction } from "../common/handle-action"; import { hasAction } from "../common/has-action"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { LovelaceCard, LovelaceCardEditor } from "../types"; -import { LightCardConfig } from "./types"; +import type { LovelaceCard, LovelaceCardEditor } from "../types"; +import type { LightCardConfig } from "./types"; @customElement("hui-light-card") export class HuiLightCard extends LitElement implements LovelaceCard { diff --git a/src/panels/lovelace/cards/hui-logbook-card.ts b/src/panels/lovelace/cards/hui-logbook-card.ts index d73e246eb1c4..fbac8b6d22b4 100644 --- a/src/panels/lovelace/cards/hui-logbook-card.ts +++ b/src/panels/lovelace/cards/hui-logbook-card.ts @@ -1,11 +1,5 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; diff --git a/src/panels/lovelace/cards/hui-map-card.ts b/src/panels/lovelace/cards/hui-map-card.ts index c50cb0c38eb8..9931303f93f6 100644 --- a/src/panels/lovelace/cards/hui-map-card.ts +++ b/src/panels/lovelace/cards/hui-map-card.ts @@ -1,14 +1,8 @@ import { mdiImageFilterCenterFocus } from "@mdi/js"; -import { HassEntities } from "home-assistant-js-websocket"; -import { LatLngTuple } from "leaflet"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { HassEntities } from "home-assistant-js-websocket"; +import type { LatLngTuple } from "leaflet"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { getColorByIndex } from "../../../common/color/colors"; @@ -27,20 +21,18 @@ import type { HaMapPathPoint, HaMapPaths, } from "../../../components/map/ha-map"; -import { - HistoryStates, - subscribeHistoryStatesTimeWindow, -} from "../../../data/history"; +import type { HistoryStates } from "../../../data/history"; +import { subscribeHistoryStatesTimeWindow } from "../../../data/history"; import { hasConfigChanged, hasConfigOrEntitiesChanged, } from "../common/has-changed"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { findEntities } from "../common/find-entities"; import { processConfigEntities } from "../common/process-config-entities"; -import { EntityConfig } from "../entity-rows/types"; -import { LovelaceCard, LovelaceLayoutOptions } from "../types"; -import { MapCardConfig } from "./types"; +import type { EntityConfig } from "../entity-rows/types"; +import type { LovelaceCard, LovelaceLayoutOptions } from "../types"; +import type { MapCardConfig } from "./types"; export const DEFAULT_HOURS_TO_SHOW = 0; export const DEFAULT_ZOOM = 14; diff --git a/src/panels/lovelace/cards/hui-markdown-card.ts b/src/panels/lovelace/cards/hui-markdown-card.ts index 5ab0227f1879..caf9fb502f1e 100644 --- a/src/panels/lovelace/cards/hui-markdown-card.ts +++ b/src/panels/lovelace/cards/hui-markdown-card.ts @@ -1,12 +1,6 @@ -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { fireEvent } from "../../../common/dom/fire_event"; @@ -14,10 +8,8 @@ import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_elemen import "../../../components/ha-card"; import "../../../components/ha-markdown"; import "../../../components/ha-alert"; -import { - RenderTemplateResult, - subscribeRenderTemplate, -} from "../../../data/ws-templates"; +import type { RenderTemplateResult } from "../../../data/ws-templates"; +import { subscribeRenderTemplate } from "../../../data/ws-templates"; import type { HomeAssistant } from "../../../types"; import type { LovelaceCard, LovelaceCardEditor } from "../types"; import type { MarkdownCardConfig } from "./types"; diff --git a/src/panels/lovelace/cards/hui-media-control-card.ts b/src/panels/lovelace/cards/hui-media-control-card.ts index ffdfe2c34a2f..b110fcb857e8 100644 --- a/src/panels/lovelace/cards/hui-media-control-card.ts +++ b/src/panels/lovelace/cards/hui-media-control-card.ts @@ -1,14 +1,8 @@ import "@material/mwc-linear-progress/mwc-linear-progress"; import type { LinearProgress } from "@material/mwc-linear-progress/mwc-linear-progress"; import { mdiDotsVertical, mdiPlayBoxMultiple } from "@mdi/js"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { styleMap } from "lit/directives/style-map"; @@ -24,14 +18,16 @@ import "../../../components/ha-icon-button"; import "../../../components/ha-state-icon"; import { showMediaBrowserDialog } from "../../../components/media-player/show-media-browser-dialog"; import { isUnavailableState } from "../../../data/entity"; +import type { + MediaPickedEvent, + MediaPlayerEntity, +} from "../../../data/media-player"; import { cleanupMediaTitle, computeMediaControls, computeMediaDescription, getCurrentProgress, handleMediaControlClick, - MediaPickedEvent, - MediaPlayerEntity, MediaPlayerEntityFeature, mediaPlayerPlayMedia, } from "../../../data/media-player"; @@ -41,7 +37,7 @@ import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-marquee"; import { createEntityNotFoundWarning } from "../components/hui-warning"; import type { LovelaceCard, LovelaceCardEditor } from "../types"; -import { MediaControlCardConfig } from "./types"; +import type { MediaControlCardConfig } from "./types"; @customElement("hui-media-control-card") export class HuiMediaControlCard extends LitElement implements LovelaceCard { diff --git a/src/panels/lovelace/cards/hui-picture-card.ts b/src/panels/lovelace/cards/hui-picture-card.ts index f5abf64b5897..53b51ca1cefb 100644 --- a/src/panels/lovelace/cards/hui-picture-card.ts +++ b/src/panels/lovelace/cards/hui-picture-card.ts @@ -1,28 +1,23 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { ifDefined } from "lit/directives/if-defined"; import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element"; import { computeDomain } from "../../../common/entity/compute_domain"; import "../../../components/ha-card"; -import { computeImageUrl, ImageEntity } from "../../../data/image"; -import { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; -import { HomeAssistant } from "../../../types"; +import type { ImageEntity } from "../../../data/image"; +import { computeImageUrl } from "../../../data/image"; +import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; +import type { HomeAssistant } from "../../../types"; import { actionHandler } from "../common/directives/action-handler-directive"; import { handleAction } from "../common/handle-action"; import { hasAction } from "../common/has-action"; import { hasConfigChanged } from "../common/has-changed"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { LovelaceCard, LovelaceCardEditor } from "../types"; -import { PictureCardConfig } from "./types"; -import { PersonEntity } from "../../../data/person"; +import type { LovelaceCard, LovelaceCardEditor } from "../types"; +import type { PictureCardConfig } from "./types"; +import type { PersonEntity } from "../../../data/person"; @customElement("hui-picture-card") export class HuiPictureCard extends LitElement implements LovelaceCard { diff --git a/src/panels/lovelace/cards/hui-picture-elements-card.ts b/src/panels/lovelace/cards/hui-picture-elements-card.ts index 9ddf4d65e34a..1f09b477f195 100644 --- a/src/panels/lovelace/cards/hui-picture-elements-card.ts +++ b/src/panels/lovelace/cards/hui-picture-elements-card.ts @@ -1,23 +1,18 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element"; import { computeDomain } from "../../../common/entity/compute_domain"; import "../../../components/ha-card"; -import { ImageEntity, computeImageUrl } from "../../../data/image"; -import { HomeAssistant } from "../../../types"; +import type { ImageEntity } from "../../../data/image"; +import { computeImageUrl } from "../../../data/image"; +import type { HomeAssistant } from "../../../types"; import { findEntities } from "../common/find-entities"; -import { LovelaceElement, LovelaceElementConfig } from "../elements/types"; -import { LovelaceCard, LovelaceCardEditor } from "../types"; +import type { LovelaceElement, LovelaceElementConfig } from "../elements/types"; +import type { LovelaceCard, LovelaceCardEditor } from "../types"; import { createStyledHuiElement } from "./picture-elements/create-styled-hui-element"; -import { PictureElementsCardConfig } from "./types"; -import { PersonEntity } from "../../../data/person"; +import type { PictureElementsCardConfig } from "./types"; +import type { PersonEntity } from "../../../data/person"; @customElement("hui-picture-elements-card") class HuiPictureElementsCard extends LitElement implements LovelaceCard { diff --git a/src/panels/lovelace/cards/hui-picture-entity-card.ts b/src/panels/lovelace/cards/hui-picture-entity-card.ts index ccc430b24371..dc79940ef570 100644 --- a/src/panels/lovelace/cards/hui-picture-entity-card.ts +++ b/src/panels/lovelace/cards/hui-picture-entity-card.ts @@ -1,21 +1,15 @@ -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element"; import { computeDomain } from "../../../common/entity/compute_domain"; import { computeStateName } from "../../../common/entity/compute_state_name"; import "../../../components/ha-card"; -import { ImageEntity, computeImageUrl } from "../../../data/image"; -import { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; -import { HomeAssistant } from "../../../types"; +import type { ImageEntity } from "../../../data/image"; +import { computeImageUrl } from "../../../data/image"; +import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; +import type { HomeAssistant } from "../../../types"; import { actionHandler } from "../common/directives/action-handler-directive"; import { findEntities } from "../common/find-entities"; import { handleAction } from "../common/handle-action"; @@ -23,10 +17,10 @@ import { hasAction } from "../common/has-action"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-image"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { LovelaceCard, LovelaceCardEditor } from "../types"; -import { PictureEntityCardConfig } from "./types"; -import { CameraEntity } from "../../../data/camera"; -import { PersonEntity } from "../../../data/person"; +import type { LovelaceCard, LovelaceCardEditor } from "../types"; +import type { PictureEntityCardConfig } from "./types"; +import type { CameraEntity } from "../../../data/camera"; +import type { PersonEntity } from "../../../data/person"; @customElement("hui-picture-entity-card") class HuiPictureEntityCard extends LitElement implements LovelaceCard { diff --git a/src/panels/lovelace/cards/hui-picture-glance-card.ts b/src/panels/lovelace/cards/hui-picture-glance-card.ts index d178dd68d3d4..b4a84748724a 100644 --- a/src/panels/lovelace/cards/hui-picture-glance-card.ts +++ b/src/panels/lovelace/cards/hui-picture-glance-card.ts @@ -1,12 +1,5 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { ifDefined } from "lit/directives/if-defined"; @@ -17,9 +10,10 @@ import { computeStateName } from "../../../common/entity/compute_state_name"; import "../../../components/ha-card"; import "../../../components/ha-icon-button"; import "../../../components/ha-state-icon"; -import { computeImageUrl, ImageEntity } from "../../../data/image"; -import { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; -import { HomeAssistant } from "../../../types"; +import type { ImageEntity } from "../../../data/image"; +import { computeImageUrl } from "../../../data/image"; +import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; +import type { HomeAssistant } from "../../../types"; import { actionHandler } from "../common/directives/action-handler-directive"; import { findEntities } from "../common/find-entities"; import { handleAction } from "../common/handle-action"; @@ -29,9 +23,12 @@ import { processConfigEntities } from "../common/process-config-entities"; import "../components/hui-image"; import { createEntityNotFoundWarning } from "../components/hui-warning"; import "../components/hui-warning-element"; -import { LovelaceCard, LovelaceCardEditor } from "../types"; -import { PictureGlanceCardConfig, PictureGlanceEntityConfig } from "./types"; -import { PersonEntity } from "../../../data/person"; +import type { LovelaceCard, LovelaceCardEditor } from "../types"; +import type { + PictureGlanceCardConfig, + PictureGlanceEntityConfig, +} from "./types"; +import type { PersonEntity } from "../../../data/person"; const STATES_OFF = new Set(["closed", "locked", "not_home", "off"]); diff --git a/src/panels/lovelace/cards/hui-plant-status-card.ts b/src/panels/lovelace/cards/hui-plant-status-card.ts index c4409529893a..fa7a042b2049 100644 --- a/src/panels/lovelace/cards/hui-plant-status-card.ts +++ b/src/panels/lovelace/cards/hui-plant-status-card.ts @@ -4,15 +4,9 @@ import { mdiWaterPercent, mdiWhiteBalanceSunny, } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element"; import { fireEvent } from "../../../common/dom/fire_event"; @@ -20,13 +14,13 @@ import { batteryLevelIcon } from "../../../common/entity/battery_icon"; import { computeStateName } from "../../../common/entity/compute_state_name"; import "../../../components/ha-card"; import "../../../components/ha-svg-icon"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { actionHandler } from "../common/directives/action-handler-directive"; import { findEntities } from "../common/find-entities"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { LovelaceCard, LovelaceCardEditor } from "../types"; -import { PlantAttributeTarget, PlantStatusCardConfig } from "./types"; +import type { LovelaceCard, LovelaceCardEditor } from "../types"; +import type { PlantAttributeTarget, PlantStatusCardConfig } from "./types"; const SENSOR_ICONS = { moisture: mdiWaterPercent, diff --git a/src/panels/lovelace/cards/hui-recovery-mode-card.ts b/src/panels/lovelace/cards/hui-recovery-mode-card.ts index 5ebcbef1a1aa..10102b6dd728 100644 --- a/src/panels/lovelace/cards/hui-recovery-mode-card.ts +++ b/src/panels/lovelace/cards/hui-recovery-mode-card.ts @@ -1,10 +1,11 @@ import "@material/mwc-button"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../components/ha-card"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import "../../config/logs/error-log-card"; -import { LovelaceCard } from "../types"; +import type { LovelaceCard } from "../types"; @customElement("hui-recovery-mode-card") export class HuiRecoveryModeCard extends LitElement implements LovelaceCard { diff --git a/src/panels/lovelace/cards/hui-sensor-card.ts b/src/panels/lovelace/cards/hui-sensor-card.ts index c456d427b6ab..0bc454e3c533 100644 --- a/src/panels/lovelace/cards/hui-sensor-card.ts +++ b/src/panels/lovelace/cards/hui-sensor-card.ts @@ -1,13 +1,14 @@ -import { HassEntity } from "home-assistant-js-websocket/dist/types"; -import { css, CSSResultGroup } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket/dist/types"; +import type { CSSResultGroup } from "lit"; +import { css } from "lit"; import { customElement } from "lit/decorators"; import { computeDomain } from "../../../common/entity/compute_domain"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { findEntities } from "../common/find-entities"; -import { GraphHeaderFooterConfig } from "../header-footer/types"; -import { LovelaceCardEditor, LovelaceLayoutOptions } from "../types"; +import type { GraphHeaderFooterConfig } from "../header-footer/types"; +import type { LovelaceCardEditor, LovelaceLayoutOptions } from "../types"; import { HuiEntityCard } from "./hui-entity-card"; -import { EntityCardConfig, SensorCardConfig } from "./types"; +import type { EntityCardConfig, SensorCardConfig } from "./types"; const includeDomains = ["counter", "input_number", "number", "sensor"]; diff --git a/src/panels/lovelace/cards/hui-stack-card.ts b/src/panels/lovelace/cards/hui-stack-card.ts index de0b5b263628..c38c202ff417 100644 --- a/src/panels/lovelace/cards/hui-stack-card.ts +++ b/src/panels/lovelace/cards/hui-stack-card.ts @@ -1,12 +1,13 @@ -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { property, state } from "lit/decorators"; import { computeRTLDirection } from "../../../common/util/compute_rtl"; -import { LovelaceCardConfig } from "../../../data/lovelace/config/card"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCard, LovelaceCardEditor } from "../types"; +import type { LovelaceCardConfig } from "../../../data/lovelace/config/card"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCard, LovelaceCardEditor } from "../types"; import "./hui-card"; import type { HuiCard } from "./hui-card"; -import { StackCardConfig } from "./types"; +import type { StackCardConfig } from "./types"; export abstract class HuiStackCard extends LitElement diff --git a/src/panels/lovelace/cards/hui-starting-card.ts b/src/panels/lovelace/cards/hui-starting-card.ts index a5cd780a1e95..0c6058abaee3 100644 --- a/src/panels/lovelace/cards/hui-starting-card.ts +++ b/src/panels/lovelace/cards/hui-starting-card.ts @@ -1,20 +1,14 @@ import "@material/mwc-button/mwc-button"; import { STATE_NOT_RUNNING } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import "../../../components/ha-card"; import "../../../components/ha-circular-progress"; -import { LovelaceCardConfig } from "../../../data/lovelace/config/card"; -import { HomeAssistant } from "../../../types"; -import { LovelaceCard } from "../types"; +import type { LovelaceCardConfig } from "../../../data/lovelace/config/card"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceCard } from "../types"; @customElement("hui-starting-card") export class HuiStartingCard extends LitElement implements LovelaceCard { diff --git a/src/panels/lovelace/cards/hui-statistic-card.ts b/src/panels/lovelace/cards/hui-statistic-card.ts index 62338e7a65f3..e0ee0c079e17 100644 --- a/src/panels/lovelace/cards/hui-statistic-card.ts +++ b/src/panels/lovelace/cards/hui-statistic-card.ts @@ -1,12 +1,6 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element"; import { fireEvent } from "../../../common/dom/fire_event"; @@ -15,27 +9,27 @@ import { formatNumber } from "../../../common/number/format_number"; import "../../../components/ha-alert"; import "../../../components/ha-card"; import "../../../components/ha-state-icon"; +import type { StatisticsMetaData } from "../../../data/recorder"; import { - StatisticsMetaData, fetchStatistic, getDisplayUnit, getStatisticLabel, getStatisticMetadata, isExternalStatistic, } from "../../../data/recorder"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { computeCardSize } from "../common/compute-card-size"; import { findEntities } from "../common/find-entities"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import { createHeaderFooterElement } from "../create-element/create-header-footer-element"; -import { +import type { LovelaceCard, LovelaceCardEditor, LovelaceHeaderFooter, LovelaceLayoutOptions, } from "../types"; -import { HuiErrorCard } from "./hui-error-card"; -import { EntityCardConfig, StatisticCardConfig } from "./types"; +import type { HuiErrorCard } from "./hui-error-card"; +import type { EntityCardConfig, StatisticCardConfig } from "./types"; @customElement("hui-statistic-card") export class HuiStatisticCard extends LitElement implements LovelaceCard { diff --git a/src/panels/lovelace/cards/hui-statistics-graph-card.ts b/src/panels/lovelace/cards/hui-statistics-graph-card.ts index 7e98eb7dd3b4..4a59c6932de7 100644 --- a/src/panels/lovelace/cards/hui-statistics-graph-card.ts +++ b/src/panels/lovelace/cards/hui-statistics-graph-card.ts @@ -1,29 +1,25 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import "../../../components/ha-card"; +import type { + Statistics, + StatisticsMetaData, + StatisticType, +} from "../../../data/recorder"; import { fetchStatistics, getDisplayUnit, getStatisticMetadata, - Statistics, - StatisticsMetaData, - StatisticType, } from "../../../data/recorder"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { findEntities } from "../common/find-entities"; import { hasConfigOrEntitiesChanged } from "../common/has-changed"; import { processConfigEntities } from "../common/process-config-entities"; -import { LovelaceCard } from "../types"; -import { StatisticsGraphCardConfig } from "./types"; +import type { LovelaceCard } from "../types"; +import type { StatisticsGraphCardConfig } from "./types"; export const DEFAULT_DAYS_TO_SHOW = 30; diff --git a/src/panels/lovelace/cards/hui-thermostat-card.ts b/src/panels/lovelace/cards/hui-thermostat-card.ts index 620f17a20562..f96264e75eea 100644 --- a/src/panels/lovelace/cards/hui-thermostat-card.ts +++ b/src/panels/lovelace/cards/hui-thermostat-card.ts @@ -1,13 +1,7 @@ import { ResizeController } from "@lit-labs/observers/resize-controller"; import { mdiDotsVertical } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element"; @@ -16,18 +10,18 @@ import { computeStateName } from "../../../common/entity/compute_state_name"; import { stateColorCss } from "../../../common/entity/state_color"; import "../../../components/ha-card"; import "../../../components/ha-icon-button"; -import { ClimateEntity } from "../../../data/climate"; +import type { ClimateEntity } from "../../../data/climate"; import "../../../state-control/climate/ha-state-control-climate-temperature"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import "../card-features/hui-card-features"; import { findEntities } from "../common/find-entities"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { +import type { LovelaceCard, LovelaceCardEditor, LovelaceLayoutOptions, } from "../types"; -import { ThermostatCardConfig } from "./types"; +import type { ThermostatCardConfig } from "./types"; @customElement("hui-thermostat-card") export class HuiThermostatCard extends LitElement implements LovelaceCard { diff --git a/src/panels/lovelace/cards/hui-tile-card.ts b/src/panels/lovelace/cards/hui-tile-card.ts index 7de87b1c92e8..820926d4bb16 100644 --- a/src/panels/lovelace/cards/hui-tile-card.ts +++ b/src/panels/lovelace/cards/hui-tile-card.ts @@ -1,6 +1,7 @@ import { mdiExclamationThick, mdiHelp } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { ifDefined } from "lit/directives/if-defined"; @@ -24,7 +25,7 @@ import "../../../components/tile/ha-tile-info"; import { cameraUrlWithWidthHeight } from "../../../data/camera"; import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; import "../../../state-display/state-display"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import "../card-features/hui-card-features"; import { actionHandler } from "../common/directives/action-handler-directive"; import { findEntities } from "../common/find-entities"; diff --git a/src/panels/lovelace/cards/hui-todo-list-card.ts b/src/panels/lovelace/cards/hui-todo-list-card.ts index 91320b6c91dc..a6644f7c4786 100644 --- a/src/panels/lovelace/cards/hui-todo-list-card.ts +++ b/src/panels/lovelace/cards/hui-todo-list-card.ts @@ -10,16 +10,9 @@ import { mdiSort, } from "@mdi/js"; import { endOfDay, isSameDay } from "date-fns"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - CSSResultGroup, - LitElement, - PropertyValueMap, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValueMap, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { repeat } from "lit/directives/repeat"; @@ -40,8 +33,8 @@ import "../../../components/ha-svg-icon"; import "../../../components/ha-textfield"; import type { HaTextField } from "../../../components/ha-textfield"; import { isUnavailableState } from "../../../data/entity"; +import type { TodoItem } from "../../../data/todo"; import { - TodoItem, TodoItemStatus, TodoListEntityFeature, createItem, @@ -51,12 +44,12 @@ import { updateItem, } from "../../../data/todo"; import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { showTodoItemEditDialog } from "../../todo/show-dialog-todo-item-editor"; import { findEntities } from "../common/find-entities"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { LovelaceCard, LovelaceCardEditor } from "../types"; -import { TodoListCardConfig } from "./types"; +import type { LovelaceCard, LovelaceCardEditor } from "../types"; +import type { TodoListCardConfig } from "./types"; @customElement("hui-todo-list-card") export class HuiTodoListCard extends LitElement implements LovelaceCard { diff --git a/src/panels/lovelace/cards/hui-vertical-stack-card.ts b/src/panels/lovelace/cards/hui-vertical-stack-card.ts index f03b4524d4be..7e479a203e7f 100644 --- a/src/panels/lovelace/cards/hui-vertical-stack-card.ts +++ b/src/panels/lovelace/cards/hui-vertical-stack-card.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css } from "lit"; import { computeCardSize } from "../common/compute-card-size"; import { HuiStackCard } from "./hui-stack-card"; diff --git a/src/panels/lovelace/cards/hui-weather-forecast-card.ts b/src/panels/lovelace/cards/hui-weather-forecast-card.ts index 0f0c5d76b5bf..5fc2ec050438 100644 --- a/src/panels/lovelace/cards/hui-weather-forecast-card.ts +++ b/src/panels/lovelace/cards/hui-weather-forecast-card.ts @@ -1,12 +1,6 @@ import { ResizeController } from "@lit-labs/observers/resize-controller"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { formatDateWeekdayShort } from "../../../common/datetime/format_date"; @@ -18,10 +12,9 @@ import { formatNumber } from "../../../common/number/format_number"; import "../../../components/ha-card"; import "../../../components/ha-svg-icon"; import { UNAVAILABLE } from "../../../data/entity"; -import { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; +import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; +import type { ForecastEvent, WeatherEntity } from "../../../data/weather"; import { - ForecastEvent, - WeatherEntity, getForecast, getSecondaryWeatherAttribute, getWeatherStateIcon, diff --git a/src/panels/lovelace/cards/picture-elements/create-styled-hui-element.ts b/src/panels/lovelace/cards/picture-elements/create-styled-hui-element.ts index 6371572cf038..0ce472da3901 100644 --- a/src/panels/lovelace/cards/picture-elements/create-styled-hui-element.ts +++ b/src/panels/lovelace/cards/picture-elements/create-styled-hui-element.ts @@ -1,5 +1,8 @@ import { createHuiElement } from "../../create-element/create-hui-element"; -import { LovelaceElement, LovelaceElementConfig } from "../../elements/types"; +import type { + LovelaceElement, + LovelaceElementConfig, +} from "../../elements/types"; export function createStyledHuiElement( elementConfig: LovelaceElementConfig diff --git a/src/panels/lovelace/cards/tile/badges/tile-badge-climate.ts b/src/panels/lovelace/cards/tile/badges/tile-badge-climate.ts index ed75266f7475..025b7dc1868b 100644 --- a/src/panels/lovelace/cards/tile/badges/tile-badge-climate.ts +++ b/src/panels/lovelace/cards/tile/badges/tile-badge-climate.ts @@ -3,11 +3,9 @@ import { styleMap } from "lit/directives/style-map"; import { stateColorCss } from "../../../../../common/entity/state_color"; import "../../../../../components/ha-attribute-icon"; import "../../../../../components/tile/ha-tile-badge"; -import { - CLIMATE_HVAC_ACTION_TO_MODE, - ClimateEntity, -} from "../../../../../data/climate"; -import { RenderBadgeFunction } from "./tile-badge"; +import type { ClimateEntity } from "../../../../../data/climate"; +import { CLIMATE_HVAC_ACTION_TO_MODE } from "../../../../../data/climate"; +import type { RenderBadgeFunction } from "./tile-badge"; export const renderClimateBadge: RenderBadgeFunction = (stateObj, hass) => { const hvacAction = (stateObj as ClimateEntity).attributes.hvac_action; diff --git a/src/panels/lovelace/cards/tile/badges/tile-badge-humidifier.ts b/src/panels/lovelace/cards/tile/badges/tile-badge-humidifier.ts index d4186ce0bec1..01774e7dfcac 100644 --- a/src/panels/lovelace/cards/tile/badges/tile-badge-humidifier.ts +++ b/src/panels/lovelace/cards/tile/badges/tile-badge-humidifier.ts @@ -3,11 +3,9 @@ import { styleMap } from "lit/directives/style-map"; import { stateColorCss } from "../../../../../common/entity/state_color"; import "../../../../../components/ha-attribute-icon"; import "../../../../../components/tile/ha-tile-badge"; -import { - HUMIDIFIER_ACTION_MODE, - HumidifierEntity, -} from "../../../../../data/humidifier"; -import { RenderBadgeFunction } from "./tile-badge"; +import type { HumidifierEntity } from "../../../../../data/humidifier"; +import { HUMIDIFIER_ACTION_MODE } from "../../../../../data/humidifier"; +import type { RenderBadgeFunction } from "./tile-badge"; export const renderHumidifierBadge: RenderBadgeFunction = (stateObj, hass) => { const action = (stateObj as HumidifierEntity).attributes.action; diff --git a/src/panels/lovelace/cards/tile/badges/tile-badge-person.ts b/src/panels/lovelace/cards/tile/badges/tile-badge-person.ts index 4c0fd8be80b7..d36ebbe47302 100644 --- a/src/panels/lovelace/cards/tile/badges/tile-badge-person.ts +++ b/src/panels/lovelace/cards/tile/badges/tile-badge-person.ts @@ -1,13 +1,13 @@ import { mdiHome, mdiHomeExportOutline } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { html } from "lit"; import { styleMap } from "lit/directives/style-map"; import { stateColorCss } from "../../../../../common/entity/state_color"; import "../../../../../components/ha-icon"; import "../../../../../components/ha-svg-icon"; import "../../../../../components/tile/ha-tile-badge"; -import { HomeAssistant } from "../../../../../types"; -import { RenderBadgeFunction } from "./tile-badge"; +import type { HomeAssistant } from "../../../../../types"; +import type { RenderBadgeFunction } from "./tile-badge"; function getZone(entity: HassEntity, hass: HomeAssistant) { const state = entity.state; diff --git a/src/panels/lovelace/cards/tile/badges/tile-badge.ts b/src/panels/lovelace/cards/tile/badges/tile-badge.ts index e6bdc8fb0c38..f4e2c152b3e4 100644 --- a/src/panels/lovelace/cards/tile/badges/tile-badge.ts +++ b/src/panels/lovelace/cards/tile/badges/tile-badge.ts @@ -1,10 +1,11 @@ import { mdiExclamationThick } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; -import { TemplateResult, html, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { TemplateResult } from "lit"; +import { html, nothing } from "lit"; import { styleMap } from "lit/directives/style-map"; import { computeDomain } from "../../../../../common/entity/compute_domain"; import { UNAVAILABLE, UNKNOWN } from "../../../../../data/entity"; -import { HomeAssistant } from "../../../../../types"; +import type { HomeAssistant } from "../../../../../types"; import { renderClimateBadge } from "./tile-badge-climate"; import { renderHumidifierBadge } from "./tile-badge-humidifier"; import { renderPersonBadge } from "./tile-badge-person"; diff --git a/src/panels/lovelace/cards/types.ts b/src/panels/lovelace/cards/types.ts index 6ee537db30ba..9dac543b1ef3 100644 --- a/src/panels/lovelace/cards/types.ts +++ b/src/panels/lovelace/cards/types.ts @@ -1,22 +1,26 @@ -import { HaDurationData } from "../../../components/ha-duration-input"; -import { ActionConfig } from "../../../data/lovelace/config/action"; -import { LovelaceCardConfig } from "../../../data/lovelace/config/card"; -import { Statistic, StatisticType } from "../../../data/recorder"; -import { ForecastType } from "../../../data/weather"; -import { FullCalendarView, ThemeMode, TranslationDict } from "../../../types"; -import { LovelaceCardFeatureConfig } from "../card-features/types"; -import { LegacyStateFilter } from "../common/evaluate-filter"; -import { Condition, LegacyCondition } from "../common/validate-condition"; -import { HuiImage } from "../components/hui-image"; -import { TimestampRenderingFormat } from "../components/types"; -import { LovelaceElementConfig } from "../elements/types"; -import { +import type { HaDurationData } from "../../../components/ha-duration-input"; +import type { ActionConfig } from "../../../data/lovelace/config/action"; +import type { LovelaceCardConfig } from "../../../data/lovelace/config/card"; +import type { Statistic, StatisticType } from "../../../data/recorder"; +import type { ForecastType } from "../../../data/weather"; +import type { + FullCalendarView, + ThemeMode, + TranslationDict, +} from "../../../types"; +import type { LovelaceCardFeatureConfig } from "../card-features/types"; +import type { LegacyStateFilter } from "../common/evaluate-filter"; +import type { Condition, LegacyCondition } from "../common/validate-condition"; +import type { HuiImage } from "../components/hui-image"; +import type { TimestampRenderingFormat } from "../components/types"; +import type { LovelaceElementConfig } from "../elements/types"; +import type { EntityConfig, EntityFilterEntityConfig, LovelaceRowConfig, } from "../entity-rows/types"; -import { LovelaceHeaderFooterConfig } from "../header-footer/types"; -import { LovelaceHeadingBadgeConfig } from "../heading-badges/types"; +import type { LovelaceHeaderFooterConfig } from "../header-footer/types"; +import type { LovelaceHeadingBadgeConfig } from "../heading-badges/types"; export type AlarmPanelCardConfigState = | "arm_away" diff --git a/src/panels/lovelace/common/check-lovelace-config.ts b/src/panels/lovelace/common/check-lovelace-config.ts index a084906ec7af..5a79916bda2c 100644 --- a/src/panels/lovelace/common/check-lovelace-config.ts +++ b/src/panels/lovelace/common/check-lovelace-config.ts @@ -1,15 +1,9 @@ -import { - isStrategySection, - LovelaceSectionRawConfig, -} from "../../../data/lovelace/config/section"; -import { - isStrategyDashboard, - LovelaceRawConfig, -} from "../../../data/lovelace/config/types"; -import { - isStrategyView, - LovelaceViewRawConfig, -} from "../../../data/lovelace/config/view"; +import type { LovelaceSectionRawConfig } from "../../../data/lovelace/config/section"; +import { isStrategySection } from "../../../data/lovelace/config/section"; +import type { LovelaceRawConfig } from "../../../data/lovelace/config/types"; +import { isStrategyDashboard } from "../../../data/lovelace/config/types"; +import type { LovelaceViewRawConfig } from "../../../data/lovelace/config/view"; +import { isStrategyView } from "../../../data/lovelace/config/view"; export const checkLovelaceConfig = ( config: LovelaceRawConfig diff --git a/src/panels/lovelace/common/compute-card-grid-size.ts b/src/panels/lovelace/common/compute-card-grid-size.ts index 635d43ef53a1..6cb2e1098e2c 100644 --- a/src/panels/lovelace/common/compute-card-grid-size.ts +++ b/src/panels/lovelace/common/compute-card-grid-size.ts @@ -1,5 +1,5 @@ import { conditionalClamp } from "../../../common/number/clamp"; -import { LovelaceGridOptions, LovelaceLayoutOptions } from "../types"; +import type { LovelaceGridOptions, LovelaceLayoutOptions } from "../types"; export const GRID_COLUMN_MULTIPLIER = 3; @@ -64,4 +64,4 @@ export const computeCardGridSize = ( rows: clampedRows, columns: clampedColumns, }; -}; +}; \ No newline at end of file diff --git a/src/panels/lovelace/common/compute-card-size.ts b/src/panels/lovelace/common/compute-card-size.ts index 0a686fd145a8..193618900c03 100644 --- a/src/panels/lovelace/common/compute-card-size.ts +++ b/src/panels/lovelace/common/compute-card-size.ts @@ -1,6 +1,6 @@ import { promiseTimeout } from "../../../common/util/promise-timeout"; -import { HuiCard } from "../cards/hui-card"; -import { LovelaceCard, LovelaceHeaderFooter } from "../types"; +import type { HuiCard } from "../cards/hui-card"; +import type { LovelaceCard, LovelaceHeaderFooter } from "../types"; export const computeCardSize = ( card: LovelaceCard | LovelaceHeaderFooter | HuiCard diff --git a/src/panels/lovelace/common/compute-tooltip.ts b/src/panels/lovelace/common/compute-tooltip.ts index b002cd2caffa..6f758a046e7c 100644 --- a/src/panels/lovelace/common/compute-tooltip.ts +++ b/src/panels/lovelace/common/compute-tooltip.ts @@ -1,6 +1,6 @@ import { computeStateName } from "../../../common/entity/compute_state_name"; -import { ActionConfig } from "../../../data/lovelace/config/action"; -import { HomeAssistant } from "../../../types"; +import type { ActionConfig } from "../../../data/lovelace/config/action"; +import type { HomeAssistant } from "../../../types"; interface Config { entity?: string; diff --git a/src/panels/lovelace/common/compute-unused-entities.ts b/src/panels/lovelace/common/compute-unused-entities.ts index ff563456e0d2..32fec3b87406 100755 --- a/src/panels/lovelace/common/compute-unused-entities.ts +++ b/src/panels/lovelace/common/compute-unused-entities.ts @@ -1,6 +1,6 @@ -import { ActionConfig } from "../../../data/lovelace/config/action"; -import { LovelaceConfig } from "../../../data/lovelace/config/types"; -import { HomeAssistant } from "../../../types"; +import type { ActionConfig } from "../../../data/lovelace/config/action"; +import type { LovelaceConfig } from "../../../data/lovelace/config/types"; +import type { HomeAssistant } from "../../../types"; export const EXCLUDED_DOMAINS = ["zone", "persistent_notification"]; diff --git a/src/panels/lovelace/common/confirm-action.ts b/src/panels/lovelace/common/confirm-action.ts index 2b783cb3f3a6..98762159db77 100644 --- a/src/panels/lovelace/common/confirm-action.ts +++ b/src/panels/lovelace/common/confirm-action.ts @@ -1,6 +1,6 @@ import type { ConfirmationRestrictionConfig } from "../../../data/lovelace/config/action"; import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; export const confirmAction = async ( node: HTMLElement, diff --git a/src/panels/lovelace/common/directives/action-handler-directive.ts b/src/panels/lovelace/common/directives/action-handler-directive.ts index 10af1cd7aa0f..d39db84b6be5 100644 --- a/src/panels/lovelace/common/directives/action-handler-directive.ts +++ b/src/panels/lovelace/common/directives/action-handler-directive.ts @@ -1,14 +1,10 @@ /* eslint-disable max-classes-per-file */ import { noChange } from "lit"; -import { - AttributePart, - directive, - Directive, - DirectiveParameters, -} from "lit/directive"; +import type { AttributePart, DirectiveParameters } from "lit/directive"; +import { directive, Directive } from "lit/directive"; import { fireEvent } from "../../../../common/dom/fire_event"; import { deepEqual } from "../../../../common/util/deep-equal"; -import { +import type { ActionHandlerDetail, ActionHandlerOptions, } from "../../../../data/lovelace/action_handler"; diff --git a/src/panels/lovelace/common/entity/toggle-entity.ts b/src/panels/lovelace/common/entity/toggle-entity.ts index c2c406da3106..7220c769f103 100644 --- a/src/panels/lovelace/common/entity/toggle-entity.ts +++ b/src/panels/lovelace/common/entity/toggle-entity.ts @@ -1,5 +1,5 @@ import { STATES_OFF } from "../../../../common/const"; -import { HomeAssistant, ServiceCallResponse } from "../../../../types"; +import type { HomeAssistant, ServiceCallResponse } from "../../../../types"; import { turnOnOffEntity } from "./turn-on-off-entity"; export const toggleEntity = ( diff --git a/src/panels/lovelace/common/entity/turn-on-off-entities.ts b/src/panels/lovelace/common/entity/turn-on-off-entities.ts index fadbf9da389a..709190eea830 100644 --- a/src/panels/lovelace/common/entity/turn-on-off-entities.ts +++ b/src/panels/lovelace/common/entity/turn-on-off-entities.ts @@ -1,6 +1,6 @@ import { STATES_OFF } from "../../../../common/const"; import { computeDomain } from "../../../../common/entity/compute_domain"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; export const turnOnOffEntities = ( hass: HomeAssistant, diff --git a/src/panels/lovelace/common/entity/turn-on-off-entity.ts b/src/panels/lovelace/common/entity/turn-on-off-entity.ts index 5be6beaea844..7c4909000c24 100644 --- a/src/panels/lovelace/common/entity/turn-on-off-entity.ts +++ b/src/panels/lovelace/common/entity/turn-on-off-entity.ts @@ -1,5 +1,5 @@ import { computeDomain } from "../../../../common/entity/compute_domain"; -import { HomeAssistant, ServiceCallResponse } from "../../../../types"; +import type { HomeAssistant, ServiceCallResponse } from "../../../../types"; export const turnOnOffEntity = ( hass: HomeAssistant, diff --git a/src/panels/lovelace/common/evaluate-filter.ts b/src/panels/lovelace/common/evaluate-filter.ts index 6e716958750c..6e9eacb236cc 100644 --- a/src/panels/lovelace/common/evaluate-filter.ts +++ b/src/panels/lovelace/common/evaluate-filter.ts @@ -1,4 +1,4 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; type FilterOperator = | "==" diff --git a/src/panels/lovelace/common/find-entities.ts b/src/panels/lovelace/common/find-entities.ts index 533274a8fba2..e41e0f4f4fcf 100644 --- a/src/panels/lovelace/common/find-entities.ts +++ b/src/panels/lovelace/common/find-entities.ts @@ -1,6 +1,6 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { computeDomain } from "../../../common/entity/compute_domain"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; const arrayFilter = ( array: any[], diff --git a/src/panels/lovelace/common/generate-lovelace-config.ts b/src/panels/lovelace/common/generate-lovelace-config.ts index d5aa7b5d32b9..f3ff1f2cdf20 100644 --- a/src/panels/lovelace/common/generate-lovelace-config.ts +++ b/src/panels/lovelace/common/generate-lovelace-config.ts @@ -1,4 +1,4 @@ -import { HassEntities, HassEntity } from "home-assistant-js-websocket"; +import type { HassEntities, HassEntity } from "home-assistant-js-websocket"; import { SENSOR_ENTITIES, ASSIST_ENTITIES } from "../../../common/const"; import { computeDomain } from "../../../common/entity/compute_domain"; import { computeStateDomain } from "../../../common/entity/compute_state_domain"; @@ -6,21 +6,21 @@ import { computeStateName } from "../../../common/entity/compute_state_name"; import { splitByGroups } from "../../../common/entity/split_by_groups"; import { stripPrefixFromEntityName } from "../../../common/entity/strip_prefix_from_entity_name"; import { stringCompare } from "../../../common/string/compare"; -import { LocalizeFunc } from "../../../common/translations/localize"; +import type { LocalizeFunc } from "../../../common/translations/localize"; import type { AreaFilterValue } from "../../../components/ha-area-filter"; import { areaCompare } from "../../../data/area_registry"; -import { +import type { EnergyPreferences, GridSourceTypeEnergyPreference, } from "../../../data/energy"; import { domainToName } from "../../../data/integration"; -import { LovelaceCardConfig } from "../../../data/lovelace/config/card"; -import { LovelaceSectionConfig } from "../../../data/lovelace/config/section"; -import { LovelaceViewConfig } from "../../../data/lovelace/config/view"; +import type { LovelaceCardConfig } from "../../../data/lovelace/config/card"; +import type { LovelaceSectionConfig } from "../../../data/lovelace/config/section"; +import type { LovelaceViewConfig } from "../../../data/lovelace/config/view"; import { computeUserInitials } from "../../../data/user"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { HELPER_DOMAINS } from "../../config/helpers/const"; -import { +import type { AlarmPanelCardConfig, EntitiesCardConfig, HumidifierCardConfig, @@ -29,10 +29,10 @@ import { ThermostatCardConfig, TileCardConfig, } from "../cards/types"; -import { EntityConfig } from "../entity-rows/types"; -import { ButtonsHeaderFooterConfig } from "../header-footer/types"; -import { LovelaceBadgeConfig } from "../../../data/lovelace/config/badge"; -import { EntityBadgeConfig } from "../badges/types"; +import type { EntityConfig } from "../entity-rows/types"; +import type { ButtonsHeaderFooterConfig } from "../header-footer/types"; +import type { LovelaceBadgeConfig } from "../../../data/lovelace/config/badge"; +import type { EntityBadgeConfig } from "../badges/types"; const HIDE_DOMAIN = new Set([ "automation", diff --git a/src/panels/lovelace/common/graph/coordinates.ts b/src/panels/lovelace/common/graph/coordinates.ts index 02226d2bab1f..39f2fb79602e 100644 --- a/src/panels/lovelace/common/graph/coordinates.ts +++ b/src/panels/lovelace/common/graph/coordinates.ts @@ -1,5 +1,5 @@ import { strokeWidth } from "../../../../data/graph"; -import { EntityHistoryState } from "../../../../data/history"; +import type { EntityHistoryState } from "../../../../data/history"; const average = (items: any[]): number => items.reduce((sum, entry) => sum + parseFloat(entry.state), 0) / items.length; diff --git a/src/panels/lovelace/common/handle-action.ts b/src/panels/lovelace/common/handle-action.ts index 3c51b0d46861..00ab032fdd8d 100644 --- a/src/panels/lovelace/common/handle-action.ts +++ b/src/panels/lovelace/common/handle-action.ts @@ -2,10 +2,10 @@ import { fireEvent } from "../../../common/dom/fire_event"; import { navigate } from "../../../common/navigate"; import { forwardHaptic } from "../../../data/haptics"; import { domainToName } from "../../../data/integration"; -import { ActionConfig } from "../../../data/lovelace/config/action"; +import type { ActionConfig } from "../../../data/lovelace/config/action"; import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box"; import { showVoiceCommandDialog } from "../../../dialogs/voice-command-dialog/show-ha-voice-command-dialog"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { showToast } from "../../../util/toast"; import { toggleEntity } from "./entity/toggle-entity"; diff --git a/src/panels/lovelace/common/has-action.ts b/src/panels/lovelace/common/has-action.ts index 7d9ec25a51b3..261ade1164b6 100644 --- a/src/panels/lovelace/common/has-action.ts +++ b/src/panels/lovelace/common/has-action.ts @@ -1,5 +1,5 @@ -import { ActionConfig } from "../../../data/lovelace/config/action"; -import { ConfigEntity } from "../cards/types"; +import type { ActionConfig } from "../../../data/lovelace/config/action"; +import type { ConfigEntity } from "../cards/types"; export function hasAction(config?: ActionConfig): boolean { return config !== undefined && config.action !== "none"; diff --git a/src/panels/lovelace/common/has-changed.ts b/src/panels/lovelace/common/has-changed.ts index 76a1586107fb..8f3005f6b1ed 100644 --- a/src/panels/lovelace/common/has-changed.ts +++ b/src/panels/lovelace/common/has-changed.ts @@ -1,7 +1,7 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { PropertyValues } from "lit"; -import { EntityRegistryDisplayEntry } from "../../../data/entity_registry"; -import { HomeAssistant } from "../../../types"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { PropertyValues } from "lit"; +import type { EntityRegistryDisplayEntry } from "../../../data/entity_registry"; +import type { HomeAssistant } from "../../../types"; import { processConfigEntities } from "./process-config-entities"; export function hasConfigChanged( diff --git a/src/panels/lovelace/common/icon-condition.ts b/src/panels/lovelace/common/icon-condition.ts index 5a9f1986cff4..12341d69c54c 100644 --- a/src/panels/lovelace/common/icon-condition.ts +++ b/src/panels/lovelace/common/icon-condition.ts @@ -6,7 +6,7 @@ import { mdiResponsive, mdiStateMachine, } from "@mdi/js"; -import { Condition } from "./validate-condition"; +import type { Condition } from "./validate-condition"; export const ICON_CONDITION: Record = { numeric_state: mdiNumeric, diff --git a/src/panels/lovelace/common/load-resources.ts b/src/panels/lovelace/common/load-resources.ts index 5ef499359afb..7fcd856588eb 100644 --- a/src/panels/lovelace/common/load-resources.ts +++ b/src/panels/lovelace/common/load-resources.ts @@ -1,5 +1,5 @@ import { loadCSS, loadJS, loadModule } from "../../../common/dom/load_resource"; -import { LovelaceResource } from "../../../data/lovelace/resource"; +import type { LovelaceResource } from "../../../data/lovelace/resource"; import type { HomeAssistant } from "../../../types"; // CSS and JS should only be imported once. Modules and HTML are safe. diff --git a/src/panels/lovelace/common/process-config-entities.ts b/src/panels/lovelace/common/process-config-entities.ts index 49ce41ad27d7..da2a4076d99c 100644 --- a/src/panels/lovelace/common/process-config-entities.ts +++ b/src/panels/lovelace/common/process-config-entities.ts @@ -1,6 +1,6 @@ // Parse array of entity objects from config import { isValidEntityId } from "../../../common/entity/valid_entity_id"; -import { EntityConfig, LovelaceRowConfig } from "../entity-rows/types"; +import type { EntityConfig, LovelaceRowConfig } from "../entity-rows/types"; export const processConfigEntities = < T extends EntityConfig | LovelaceRowConfig, diff --git a/src/panels/lovelace/common/validate-condition.ts b/src/panels/lovelace/common/validate-condition.ts index ba583cf9e040..382ffdddfe09 100644 --- a/src/panels/lovelace/common/validate-condition.ts +++ b/src/panels/lovelace/common/validate-condition.ts @@ -1,11 +1,9 @@ import { ensureArray } from "../../../common/array/ensure-array"; -import { - MediaQueriesListener, - listenMediaQuery, -} from "../../../common/dom/media_query"; +import type { MediaQueriesListener } from "../../../common/dom/media_query"; +import { listenMediaQuery } from "../../../common/dom/media_query"; import { isValidEntityId } from "../../../common/entity/valid_entity_id"; import { UNAVAILABLE } from "../../../data/entity"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; export type Condition = | NumericStateCondition diff --git a/src/panels/lovelace/components/hui-action-editor.ts b/src/panels/lovelace/components/hui-action-editor.ts index dad65137adcd..a8e4eab7e8aa 100644 --- a/src/panels/lovelace/components/hui-action-editor.ts +++ b/src/panels/lovelace/components/hui-action-editor.ts @@ -1,30 +1,27 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../common/dom/fire_event"; import { stopPropagation } from "../../../common/dom/stop_propagation"; import "../../../components/ha-assist-pipeline-picker"; -import { HaFormSchema, SchemaUnion } from "../../../components/ha-form/types"; +import type { + HaFormSchema, + SchemaUnion, +} from "../../../components/ha-form/types"; import "../../../components/ha-help-tooltip"; import "../../../components/ha-navigation-picker"; import "../../../components/ha-service-control"; -import { +import type { ActionConfig, CallServiceActionConfig, NavigateActionConfig, UrlActionConfig, } from "../../../data/lovelace/config/action"; -import { ServiceAction } from "../../../data/script"; -import { HomeAssistant } from "../../../types"; -import { EditorTarget } from "../editor/types"; -import { HaSelect } from "../../../components/ha-select"; +import type { ServiceAction } from "../../../data/script"; +import type { HomeAssistant } from "../../../types"; +import type { EditorTarget } from "../editor/types"; +import type { HaSelect } from "../../../components/ha-select"; export type UiAction = Exclude; diff --git a/src/panels/lovelace/components/hui-badge-edit-mode.ts b/src/panels/lovelace/components/hui-badge-edit-mode.ts index b71221a78cb9..7da0e29b3179 100644 --- a/src/panels/lovelace/components/hui-badge-edit-mode.ts +++ b/src/panels/lovelace/components/hui-badge-edit-mode.ts @@ -1,4 +1,4 @@ -import { ActionDetail } from "@material/mwc-list/mwc-list-foundation"; +import type { ActionDetail } from "@material/mwc-list/mwc-list-foundation"; import { mdiContentCopy, mdiContentCut, @@ -8,7 +8,8 @@ import { mdiPlusCircleMultipleOutline, } from "@mdi/js"; import deepClone from "deep-clone-simple"; -import { CSSResultGroup, LitElement, TemplateResult, css, html } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { storage } from "../../../common/decorators/storage"; @@ -18,17 +19,17 @@ import "../../../components/ha-icon-button"; import "../../../components/ha-list-item"; import "../../../components/ha-svg-icon"; import { ensureBadgeConfig } from "../../../data/lovelace/config/badge"; -import { LovelaceCardConfig } from "../../../data/lovelace/config/card"; +import type { LovelaceCardConfig } from "../../../data/lovelace/config/card"; import { haStyle } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { showEditBadgeDialog } from "../editor/badge-editor/show-edit-badge-dialog"; +import type { LovelaceCardPath } from "../editor/lovelace-path"; import { - LovelaceCardPath, findLovelaceItems, getLovelaceContainerPath, parseLovelaceCardPath, } from "../editor/lovelace-path"; -import { Lovelace } from "../types"; +import type { Lovelace } from "../types"; @customElement("hui-badge-edit-mode") export class HuiBadgeEditMode extends LitElement { diff --git a/src/panels/lovelace/components/hui-buttons-base.ts b/src/panels/lovelace/components/hui-buttons-base.ts index 2b1f9a11524d..07938daf3687 100644 --- a/src/panels/lovelace/components/hui-buttons-base.ts +++ b/src/panels/lovelace/components/hui-buttons-base.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, state, property } from "lit/decorators"; import { computeStateName } from "../../../common/entity/compute_state_name"; import "../../../components/entity/state-badge"; diff --git a/src/panels/lovelace/components/hui-card-edit-mode.ts b/src/panels/lovelace/components/hui-card-edit-mode.ts index 4ae11e335ae6..c599910cce71 100644 --- a/src/panels/lovelace/components/hui-card-edit-mode.ts +++ b/src/panels/lovelace/components/hui-card-edit-mode.ts @@ -1,15 +1,16 @@ import "@material/mwc-button"; -import { ActionDetail } from "@material/mwc-list/mwc-list-foundation"; import { mdiContentCopy, mdiContentCut, + mdiCursorMove, mdiDelete, mdiDotsVertical, mdiPencil, mdiPlusCircleMultipleOutline, } from "@mdi/js"; import deepClone from "deep-clone-simple"; -import { CSSResultGroup, LitElement, TemplateResult, css, html } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { storage } from "../../../common/decorators/storage"; @@ -18,17 +19,17 @@ import "../../../components/ha-button-menu"; import "../../../components/ha-icon-button"; import "../../../components/ha-list-item"; import "../../../components/ha-svg-icon"; -import { LovelaceCardConfig } from "../../../data/lovelace/config/card"; +import type { LovelaceCardConfig } from "../../../data/lovelace/config/card"; import { haStyle } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { showEditCardDialog } from "../editor/card-editor/show-edit-card-dialog"; +import type { LovelaceCardPath } from "../editor/lovelace-path"; import { - LovelaceCardPath, findLovelaceItems, getLovelaceContainerPath, parseLovelaceCardPath, } from "../editor/lovelace-path"; -import { Lovelace } from "../types"; +import type { Lovelace } from "../types"; @customElement("hui-card-edit-mode") export class HuiCardEditMode extends LitElement { @@ -38,7 +39,14 @@ export class HuiCardEditMode extends LitElement { @property({ type: Array }) public path!: LovelaceCardPath; - @property({ type: Boolean }) public hiddenOverlay = false; + @property({ type: Boolean, attribute: "hidden-overlay" }) + public hiddenOverlay = false; + + @property({ type: Boolean, attribute: "no-edit" }) + public noEdit = false; + + @property({ type: Boolean, attribute: "no-duplicate" }) + public noDuplicate = false; @state() public _menuOpened: boolean = false; @@ -109,15 +117,24 @@ export class HuiCardEditMode extends LitElement { return html`
-
-
- -
+ ${this.noEdit + ? html` +
+
+ +
+ ` + : html` +
+
+ +
+ `} - - - ${this.hass.localize("ui.panel.lovelace.editor.edit_card.edit")} - - - - ${this.hass.localize( - "ui.panel.lovelace.editor.edit_card.duplicate" - )} - - + ${this.noEdit + ? nothing + : html` + + + ${this.hass.localize( + "ui.panel.lovelace.editor.edit_card.edit" + )} + + `} + ${this.noDuplicate + ? nothing + : html` + + + ${this.hass.localize( + "ui.panel.lovelace.editor.edit_card.duplicate" + )} + + `} + ${this.hass.localize("ui.panel.lovelace.editor.edit_card.copy")} - + ${this.hass.localize("ui.panel.lovelace.editor.edit_card.cut")}
  • - + ${this.hass.localize("ui.panel.lovelace.editor.edit_card.delete")} ) { - switch (ev.detail.index) { - case 0: + private _handleAction(ev) { + switch (ev.target.action) { + case "edit": this._editCard(); break; - case 1: + case "duplicate": this._duplicateCard(); break; - case 2: + case "copy": this._copyCard(); break; - case 3: + case "cut": this._cutCard(); break; - case 4: + case "delete": this._deleteCard(); break; } @@ -261,7 +309,7 @@ export class HuiCardEditMode extends LitElement { z-index: 0; } - .edit { + .control { outline: none !important; cursor: pointer; position: absolute; @@ -272,7 +320,7 @@ export class HuiCardEditMode extends LitElement { border-radius: var(--ha-card-border-radius, 12px); z-index: 0; } - .edit-overlay { + .control-overlay { position: absolute; inset: 0; opacity: 0.8; @@ -281,7 +329,7 @@ export class HuiCardEditMode extends LitElement { border-radius: var(--ha-card-border-radius, 12px); z-index: 0; } - .edit ha-svg-icon { + .control ha-svg-icon { display: flex; position: relative; color: var(--primary-text-color); diff --git a/src/panels/lovelace/components/hui-card-options.ts b/src/panels/lovelace/components/hui-card-options.ts index 0a9a39be8e38..851afe9b4018 100644 --- a/src/panels/lovelace/components/hui-card-options.ts +++ b/src/panels/lovelace/components/hui-card-options.ts @@ -1,5 +1,5 @@ import "@material/mwc-button"; -import { ActionDetail } from "@material/mwc-list/mwc-list-foundation"; +import type { ActionDetail } from "@material/mwc-list/mwc-list-foundation"; import { mdiContentCopy, mdiContentCut, @@ -11,54 +11,40 @@ import { mdiPlusCircleMultipleOutline, } from "@mdi/js"; import deepClone from "deep-clone-simple"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, queryAssignedNodes } from "lit/decorators"; import { storage } from "../../../common/decorators/storage"; import { fireEvent } from "../../../common/dom/fire_event"; import "../../../components/ha-button-menu"; import "../../../components/ha-icon-button"; import "../../../components/ha-list-item"; -import { LovelaceCardConfig } from "../../../data/lovelace/config/card"; +import type { LovelaceCardConfig } from "../../../data/lovelace/config/card"; import { saveConfig } from "../../../data/lovelace/config/types"; -import { - isStrategyView, - type LovelaceViewConfig, -} from "../../../data/lovelace/config/view"; +import { isStrategyView } from "../../../data/lovelace/config/view"; import { showAlertDialog, showPromptDialog, } from "../../../dialogs/generic/show-dialog-box"; import { haStyle } from "../../../resources/styles"; -import { HomeAssistant } from "../../../types"; -import { showSaveSuccessToast } from "../../../util/toast-saved-success"; +import type { HomeAssistant } from "../../../types"; import { computeCardSize } from "../common/compute-card-size"; import { showEditCardDialog } from "../editor/card-editor/show-edit-card-dialog"; import { addCard, - addSection, deleteCard, moveCardToContainer, moveCardToIndex, } from "../editor/config-util"; import { - LovelaceCardPath, + type LovelaceCardPath, type LovelaceContainerPath, findLovelaceItems, getLovelaceContainerPath, parseLovelaceCardPath, } from "../editor/lovelace-path"; import { showSelectViewDialog } from "../editor/select-view/show-select-view-dialog"; -import { Lovelace, LovelaceCard } from "../types"; -import { SECTIONS_VIEW_LAYOUT } from "../views/const"; -import type { LovelaceSectionConfig } from "../../../data/lovelace/config/section"; +import type { Lovelace, LovelaceCard } from "../types"; @customElement("hui-card-options") export class HuiCardOptions extends LitElement { @@ -359,9 +345,13 @@ export class HuiCardOptions extends LitElement { allowDashboardChange: true, header: this.hass!.localize("ui.panel.lovelace.editor.move_card.header"), viewSelectedCallback: async (urlPath, selectedDashConfig, viewIndex) => { - const fromView = selectedDashConfig.views[this.path![0]]; - let toView = selectedDashConfig.views[viewIndex]; - let newConfig = selectedDashConfig; + if (!this.lovelace) return; + const toView = selectedDashConfig.views[viewIndex]; + const newConfig = selectedDashConfig; + + const undoAction = async () => { + this.lovelace!.saveConfig(selectedDashConfig); + }; if (isStrategyView(toView)) { showAlertDialog(this, { @@ -376,53 +366,22 @@ export class HuiCardOptions extends LitElement { return; } - const isSectionsView = toView.type === SECTIONS_VIEW_LAYOUT; - - let toPath: LovelaceContainerPath = [viewIndex]; - - // If the view is a section view and has no "imported cards" section, adds a default section. - if (isSectionsView) { - const importedCardHeading = fromView.title - ? this.hass!.localize( - "ui.panel.lovelace.editor.section.imported_card_section_title_view", - { view_title: fromView.title } - ) - : this.hass!.localize( - "ui.panel.lovelace.editor.section.imported_card_section_title_default" - ); - - let sectionIndex = toView.sections - ? toView.sections.findIndex( - (s) => - "cards" in s && - s.cards?.some( - (c) => - c.type === "heading" && c.heading === importedCardHeading - ) - ) - : -1; - if (sectionIndex === -1) { - const newSection: LovelaceSectionConfig = { - type: "grid", - cards: [ - { - type: "heading", - heading: importedCardHeading, - }, - ], - }; - newConfig = addSection(selectedDashConfig, viewIndex, newSection); - toView = newConfig.views[viewIndex] as LovelaceViewConfig; - sectionIndex = toView.sections!.length - 1; - } - toPath = [viewIndex, sectionIndex]; - } + const toPath: LovelaceContainerPath = [viewIndex]; if (urlPath === this.lovelace!.urlPath) { this.lovelace!.saveConfig( moveCardToContainer(newConfig, this.path!, toPath) ); - showSaveSuccessToast(this, this.hass!); + this.lovelace.showToast({ + message: this.hass!.localize( + "ui.panel.lovelace.editor.move_card.success" + ), + duration: 4000, + action: { + action: undoAction, + text: this.hass!.localize("ui.common.undo"), + }, + }); return; } try { @@ -436,10 +395,22 @@ export class HuiCardOptions extends LitElement { this.lovelace!.saveConfig( deleteCard(this.lovelace!.config, this.path!) ); - showSaveSuccessToast(this, this.hass!); + + this.lovelace.showToast({ + message: this.hass!.localize( + "ui.panel.lovelace.editor.move_card.success" + ), + duration: 4000, + action: { + action: undoAction, + text: this.hass!.localize("ui.common.undo"), + }, + }); } catch (err: any) { - showAlertDialog(this, { - text: `Moving failed: ${err.message}`, + this.lovelace.showToast({ + message: this.hass!.localize( + "ui.panel.lovelace.editor.move_card.error" + ), }); } }, diff --git a/src/panels/lovelace/components/hui-conditional-base.ts b/src/panels/lovelace/components/hui-conditional-base.ts index 86ff09f57d5d..0d5249ee061e 100644 --- a/src/panels/lovelace/components/hui-conditional-base.ts +++ b/src/panels/lovelace/components/hui-conditional-base.ts @@ -1,18 +1,19 @@ -import { PropertyValues, ReactiveElement } from "lit"; +import type { PropertyValues } from "lit"; +import { ReactiveElement } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { MediaQueriesListener } from "../../../common/dom/media_query"; +import type { MediaQueriesListener } from "../../../common/dom/media_query"; import { deepEqual } from "../../../common/util/deep-equal"; -import { HomeAssistant } from "../../../types"; -import { HuiCard } from "../cards/hui-card"; -import { ConditionalCardConfig } from "../cards/types"; +import type { HomeAssistant } from "../../../types"; +import type { HuiCard } from "../cards/hui-card"; +import type { ConditionalCardConfig } from "../cards/types"; +import type { Condition } from "../common/validate-condition"; import { - Condition, attachConditionMediaQueriesListeners, checkConditionsMet, extractMediaQueries, validateConditionalConfig, } from "../common/validate-condition"; -import { ConditionalRowConfig, LovelaceRow } from "../entity-rows/types"; +import type { ConditionalRowConfig, LovelaceRow } from "../entity-rows/types"; declare global { interface HASSDomEvents { diff --git a/src/panels/lovelace/components/hui-energy-period-selector.ts b/src/panels/lovelace/components/hui-energy-period-selector.ts index 9246e81d87ae..dbacc7824ac7 100644 --- a/src/panels/lovelace/components/hui-energy-period-selector.ts +++ b/src/panels/lovelace/components/hui-energy-period-selector.ts @@ -21,15 +21,9 @@ import { startOfYear, subDays, } from "date-fns"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { @@ -52,9 +46,10 @@ import "../../../components/ha-date-range-picker"; import type { DateRangePickerRanges } from "../../../components/ha-date-range-picker"; import "../../../components/ha-icon-button-next"; import "../../../components/ha-icon-button-prev"; -import { EnergyData, getEnergyDataCollection } from "../../../data/energy"; +import type { EnergyData } from "../../../data/energy"; +import { getEnergyDataCollection } from "../../../data/energy"; import { SubscribeMixin } from "../../../mixins/subscribe-mixin"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; @customElement("hui-energy-period-selector") export class HuiEnergyPeriodSelector extends SubscribeMixin(LitElement) { diff --git a/src/panels/lovelace/components/hui-entities-toggle.ts b/src/panels/lovelace/components/hui-entities-toggle.ts index 0dfadc7924dc..a4379b082194 100644 --- a/src/panels/lovelace/components/hui-entities-toggle.ts +++ b/src/panels/lovelace/components/hui-entities-toggle.ts @@ -1,11 +1,5 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { DOMAINS_TOGGLE } from "../../../common/const"; import "../../../components/ha-switch"; diff --git a/src/panels/lovelace/components/hui-entity-editor.ts b/src/panels/lovelace/components/hui-entity-editor.ts index 77f22a85c097..7a8e94f119bc 100644 --- a/src/panels/lovelace/components/hui-entity-editor.ts +++ b/src/panels/lovelace/components/hui-entity-editor.ts @@ -1,5 +1,6 @@ import { mdiDrag } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { repeat } from "lit/directives/repeat"; import { fireEvent } from "../../../common/dom/fire_event"; @@ -10,8 +11,8 @@ import type { } from "../../../components/entity/ha-entity-picker"; import "../../../components/ha-icon-button"; import "../../../components/ha-sortable"; -import { HomeAssistant } from "../../../types"; -import { EntityConfig } from "../entity-rows/types"; +import type { HomeAssistant } from "../../../types"; +import type { EntityConfig } from "../entity-rows/types"; @customElement("hui-entity-editor") export class HuiEntityEditor extends LitElement { diff --git a/src/panels/lovelace/components/hui-generic-entity-row.ts b/src/panels/lovelace/components/hui-generic-entity-row.ts index f5e2d123cb96..7cc06e2f55c5 100644 --- a/src/panels/lovelace/components/hui-generic-entity-row.ts +++ b/src/panels/lovelace/components/hui-generic-entity-row.ts @@ -1,11 +1,5 @@ -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { ifDefined } from "lit/directives/if-defined"; @@ -15,9 +9,9 @@ import { computeDomain } from "../../../common/entity/compute_domain"; import { computeStateName } from "../../../common/entity/compute_state_name"; import "../../../components/entity/state-badge"; import "../../../components/ha-relative-time"; -import { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; -import { HomeAssistant } from "../../../types"; -import { EntitiesCardEntityConfig } from "../cards/types"; +import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; +import type { HomeAssistant } from "../../../types"; +import type { EntitiesCardEntityConfig } from "../cards/types"; import { actionHandler } from "../common/directives/action-handler-directive"; import { handleAction } from "../common/handle-action"; import { hasAction, hasAnyAction } from "../common/has-action"; diff --git a/src/panels/lovelace/components/hui-graph-base.ts b/src/panels/lovelace/components/hui-graph-base.ts index de0a35e25b67..7034f88388f9 100644 --- a/src/panels/lovelace/components/hui-graph-base.ts +++ b/src/panels/lovelace/components/hui-graph-base.ts @@ -1,12 +1,5 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - svg, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement, svg } from "lit"; import { customElement, property, state } from "lit/decorators"; import { strokeWidth } from "../../../data/graph"; import { getPath } from "../common/graph/get-path"; diff --git a/src/panels/lovelace/components/hui-image.ts b/src/panels/lovelace/components/hui-image.ts index cbfe01012064..90472db8bac7 100644 --- a/src/panels/lovelace/components/hui-image.ts +++ b/src/panels/lovelace/components/hui-image.ts @@ -1,11 +1,5 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { styleMap } from "lit/directives/style-map"; @@ -15,10 +9,12 @@ import parseAspectRatio from "../../../common/util/parse-aspect-ratio"; import "../../../components/ha-camera-stream"; import type { HaCameraStream } from "../../../components/ha-camera-stream"; import "../../../components/ha-circular-progress"; -import { CameraEntity, fetchThumbnailUrlWithCache } from "../../../data/camera"; +import type { CameraEntity } from "../../../data/camera"; +import { fetchThumbnailUrlWithCache } from "../../../data/camera"; import { UNAVAILABLE } from "../../../data/entity"; -import { computeImageUrl, ImageEntity } from "../../../data/image"; -import { HomeAssistant } from "../../../types"; +import type { ImageEntity } from "../../../data/image"; +import { computeImageUrl } from "../../../data/image"; +import type { HomeAssistant } from "../../../types"; const UPDATE_INTERVAL = 10000; const DEFAULT_FILTER = "grayscale(100%)"; diff --git a/src/panels/lovelace/components/hui-marquee.ts b/src/panels/lovelace/components/hui-marquee.ts index 3632c5dbc2bb..a5f20adf1444 100644 --- a/src/panels/lovelace/components/hui-marquee.ts +++ b/src/panels/lovelace/components/hui-marquee.ts @@ -1,11 +1,5 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; @customElement("hui-marquee") diff --git a/src/panels/lovelace/components/hui-timestamp-display.ts b/src/panels/lovelace/components/hui-timestamp-display.ts index c0b99d2c4554..84d5cde3aec2 100644 --- a/src/panels/lovelace/components/hui-timestamp-display.ts +++ b/src/panels/lovelace/components/hui-timestamp-display.ts @@ -1,14 +1,15 @@ -import { HassConfig } from "home-assistant-js-websocket"; -import { html, LitElement, PropertyValues, nothing } from "lit"; +import type { HassConfig } from "home-assistant-js-websocket"; +import type { PropertyValues } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { formatDate } from "../../../common/datetime/format_date"; import { formatDateTime } from "../../../common/datetime/format_date_time"; import { formatTime } from "../../../common/datetime/format_time"; import { relativeTime } from "../../../common/datetime/relative_time"; import { capitalizeFirstLetter } from "../../../common/string/capitalize-first-letter"; -import { FrontendLocaleData } from "../../../data/translation"; -import { HomeAssistant } from "../../../types"; -import { TimestampRenderingFormat } from "./types"; +import type { FrontendLocaleData } from "../../../data/translation"; +import type { HomeAssistant } from "../../../types"; +import type { TimestampRenderingFormat } from "./types"; const FORMATS: { [key: string]: ( diff --git a/src/panels/lovelace/components/hui-warning-element.ts b/src/panels/lovelace/components/hui-warning-element.ts index a8a163b89155..dc9c4ab3764b 100644 --- a/src/panels/lovelace/components/hui-warning-element.ts +++ b/src/panels/lovelace/components/hui-warning-element.ts @@ -1,5 +1,6 @@ import { mdiAlertOutline } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import "../../../components/ha-svg-icon"; diff --git a/src/panels/lovelace/components/hui-warning.ts b/src/panels/lovelace/components/hui-warning.ts index 3a70741a47c4..3d464a0e6d6b 100644 --- a/src/panels/lovelace/components/hui-warning.ts +++ b/src/panels/lovelace/components/hui-warning.ts @@ -1,8 +1,9 @@ import { STATE_NOT_RUNNING } from "home-assistant-js-websocket"; -import { html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement } from "lit/decorators"; import "../../../components/ha-alert"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; export const createEntityNotFoundWarning = ( hass: HomeAssistant, diff --git a/src/panels/lovelace/components/types.ts b/src/panels/lovelace/components/types.ts index 8377af2f9ff5..e05443f873eb 100644 --- a/src/panels/lovelace/components/types.ts +++ b/src/panels/lovelace/components/types.ts @@ -1,6 +1,6 @@ -import { LovelaceCardConfig } from "../../../data/lovelace/config/card"; -import { Condition } from "../common/validate-condition"; -import { LovelaceElementConfig } from "../elements/types"; +import type { LovelaceCardConfig } from "../../../data/lovelace/config/card"; +import type { Condition } from "../common/validate-condition"; +import type { LovelaceElementConfig } from "../elements/types"; export interface ConditionalBaseConfig extends LovelaceCardConfig { card: LovelaceCardConfig | LovelaceElementConfig; diff --git a/src/panels/lovelace/create-element/create-badge-element.ts b/src/panels/lovelace/create-element/create-badge-element.ts index 1a782683c228..15d7b45cddc3 100644 --- a/src/panels/lovelace/create-element/create-badge-element.ts +++ b/src/panels/lovelace/create-element/create-badge-element.ts @@ -1,4 +1,4 @@ -import { LovelaceBadgeConfig } from "../../../data/lovelace/config/badge"; +import type { LovelaceBadgeConfig } from "../../../data/lovelace/config/badge"; import "../badges/hui-entity-badge"; import { createLovelaceElement, diff --git a/src/panels/lovelace/create-element/create-card-element.ts b/src/panels/lovelace/create-element/create-card-element.ts index 7b2534ff1ea4..e11338cc0d3f 100644 --- a/src/panels/lovelace/create-element/create-card-element.ts +++ b/src/panels/lovelace/create-element/create-card-element.ts @@ -1,4 +1,4 @@ -import { LovelaceCardConfig } from "../../../data/lovelace/config/card"; +import type { LovelaceCardConfig } from "../../../data/lovelace/config/card"; import "../cards/hui-entity-card"; import "../cards/hui-entities-card"; import "../cards/hui-button-card"; diff --git a/src/panels/lovelace/create-element/create-card-feature-element.ts b/src/panels/lovelace/create-element/create-card-feature-element.ts index 2710c69ebf9a..8aa564e7f0df 100644 --- a/src/panels/lovelace/create-element/create-card-feature-element.ts +++ b/src/panels/lovelace/create-element/create-card-feature-element.ts @@ -24,7 +24,7 @@ import "../card-features/hui-update-actions-card-feature"; import "../card-features/hui-vacuum-commands-card-feature"; import "../card-features/hui-water-heater-operation-modes-card-feature"; -import { LovelaceCardFeatureConfig } from "../card-features/types"; +import type { LovelaceCardFeatureConfig } from "../card-features/types"; import { createLovelaceElement, getLovelaceElementClass, diff --git a/src/panels/lovelace/create-element/create-element-base.ts b/src/panels/lovelace/create-element/create-element-base.ts index 7346e63b620c..a29cb3ef915e 100644 --- a/src/panels/lovelace/create-element/create-element-base.ts +++ b/src/panels/lovelace/create-element/create-element-base.ts @@ -1,23 +1,23 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import { +import type { LovelaceSectionElement, LovelaceViewElement, } from "../../../data/lovelace"; -import { LovelaceBadgeConfig } from "../../../data/lovelace/config/badge"; -import { LovelaceCardConfig } from "../../../data/lovelace/config/card"; -import { LovelaceSectionConfig } from "../../../data/lovelace/config/section"; -import { LovelaceViewConfig } from "../../../data/lovelace/config/view"; +import type { LovelaceBadgeConfig } from "../../../data/lovelace/config/badge"; +import type { LovelaceCardConfig } from "../../../data/lovelace/config/card"; +import type { LovelaceSectionConfig } from "../../../data/lovelace/config/section"; +import type { LovelaceViewConfig } from "../../../data/lovelace/config/view"; import { isCustomType, stripCustomPrefix, } from "../../../data/lovelace_custom_cards"; -import { LovelaceCardFeatureConfig } from "../card-features/types"; +import type { LovelaceCardFeatureConfig } from "../card-features/types"; import type { ErrorCardConfig } from "../cards/types"; -import { LovelaceElement, LovelaceElementConfig } from "../elements/types"; -import { LovelaceRow, LovelaceRowConfig } from "../entity-rows/types"; -import { LovelaceHeaderFooterConfig } from "../header-footer/types"; -import { LovelaceHeadingBadgeConfig } from "../heading-badges/types"; -import { +import type { LovelaceElement, LovelaceElementConfig } from "../elements/types"; +import type { LovelaceRow, LovelaceRowConfig } from "../entity-rows/types"; +import type { LovelaceHeaderFooterConfig } from "../header-footer/types"; +import type { LovelaceHeadingBadgeConfig } from "../heading-badges/types"; +import type { LovelaceBadge, LovelaceBadgeConstructor, LovelaceCard, diff --git a/src/panels/lovelace/create-element/create-header-footer-element.ts b/src/panels/lovelace/create-element/create-header-footer-element.ts index 34ef90e9b6b1..bb18e3373c2a 100644 --- a/src/panels/lovelace/create-element/create-header-footer-element.ts +++ b/src/panels/lovelace/create-element/create-header-footer-element.ts @@ -1,4 +1,4 @@ -import { LovelaceHeaderFooterConfig } from "../header-footer/types"; +import type { LovelaceHeaderFooterConfig } from "../header-footer/types"; import { createLovelaceElement, getLovelaceElementClass, diff --git a/src/panels/lovelace/create-element/create-heading-badge-element.ts b/src/panels/lovelace/create-element/create-heading-badge-element.ts index e45bb6f14fef..282359295a4a 100644 --- a/src/panels/lovelace/create-element/create-heading-badge-element.ts +++ b/src/panels/lovelace/create-element/create-heading-badge-element.ts @@ -4,7 +4,7 @@ import { createLovelaceElement, getLovelaceElementClass, } from "./create-element-base"; -import { LovelaceHeadingBadgeConfig } from "../heading-badges/types"; +import type { LovelaceHeadingBadgeConfig } from "../heading-badges/types"; const ALWAYS_LOADED_TYPES = new Set(["error", "entity"]); diff --git a/src/panels/lovelace/create-element/create-hui-element.ts b/src/panels/lovelace/create-element/create-hui-element.ts index 59c411829f15..c2d1b40d6799 100644 --- a/src/panels/lovelace/create-element/create-hui-element.ts +++ b/src/panels/lovelace/create-element/create-hui-element.ts @@ -5,7 +5,7 @@ import "../elements/hui-service-button-element"; import "../elements/hui-state-badge-element"; import "../elements/hui-state-icon-element"; import "../elements/hui-state-label-element"; -import { LovelaceElementConfig } from "../elements/types"; +import type { LovelaceElementConfig } from "../elements/types"; import { createLovelaceElement } from "./create-element-base"; const ALWAYS_LOADED_TYPES = new Set([ diff --git a/src/panels/lovelace/create-element/create-picture-element.ts b/src/panels/lovelace/create-element/create-picture-element.ts index e1775a849744..d9c8ee268a39 100644 --- a/src/panels/lovelace/create-element/create-picture-element.ts +++ b/src/panels/lovelace/create-element/create-picture-element.ts @@ -5,7 +5,7 @@ import "../elements/hui-service-button-element"; import "../elements/hui-state-badge-element"; import "../elements/hui-state-icon-element"; import "../elements/hui-state-label-element"; -import { LovelaceElementConfig } from "../elements/types"; +import type { LovelaceElementConfig } from "../elements/types"; import { createLovelaceElement, getLovelaceElementClass, diff --git a/src/panels/lovelace/create-element/create-row-element.ts b/src/panels/lovelace/create-element/create-row-element.ts index 091f9b779c1a..64ee31306910 100644 --- a/src/panels/lovelace/create-element/create-row-element.ts +++ b/src/panels/lovelace/create-element/create-row-element.ts @@ -5,7 +5,7 @@ import "../entity-rows/hui-script-entity-row"; import "../entity-rows/hui-sensor-entity-row"; import "../entity-rows/hui-simple-entity-row"; import "../entity-rows/hui-toggle-entity-row"; -import { LovelaceRowConfig } from "../entity-rows/types"; +import type { LovelaceRowConfig } from "../entity-rows/types"; import "../special-rows/hui-attribute-row"; import "../special-rows/hui-button-row"; import "../special-rows/hui-call-service-row"; diff --git a/src/panels/lovelace/create-element/create-section-element.ts b/src/panels/lovelace/create-element/create-section-element.ts index 7b63d2742e17..bdfaca27fd59 100644 --- a/src/panels/lovelace/create-element/create-section-element.ts +++ b/src/panels/lovelace/create-element/create-section-element.ts @@ -1,6 +1,6 @@ -import { LovelaceSectionElement } from "../../../data/lovelace"; -import { LovelaceSectionConfig } from "../../../data/lovelace/config/section"; -import { HuiErrorCard } from "../cards/hui-error-card"; +import type { LovelaceSectionElement } from "../../../data/lovelace"; +import type { LovelaceSectionConfig } from "../../../data/lovelace/config/section"; +import type { HuiErrorCard } from "../cards/hui-error-card"; import "../sections/hui-grid-section"; import { createLovelaceElement } from "./create-element-base"; diff --git a/src/panels/lovelace/create-element/create-view-element.ts b/src/panels/lovelace/create-element/create-view-element.ts index 65bd3e30b241..d0b0edc66851 100644 --- a/src/panels/lovelace/create-element/create-view-element.ts +++ b/src/panels/lovelace/create-element/create-view-element.ts @@ -1,6 +1,6 @@ -import { LovelaceViewElement } from "../../../data/lovelace"; -import { LovelaceViewConfig } from "../../../data/lovelace/config/view"; -import { HuiErrorCard } from "../cards/hui-error-card"; +import type { LovelaceViewElement } from "../../../data/lovelace"; +import type { LovelaceViewConfig } from "../../../data/lovelace/config/view"; +import type { HuiErrorCard } from "../cards/hui-error-card"; import "../views/hui-masonry-view"; import { createLovelaceElement } from "./create-element-base"; diff --git a/src/panels/lovelace/editor/add-entities-to-view.ts b/src/panels/lovelace/editor/add-entities-to-view.ts index 8706287c0394..51d3a9696c71 100644 --- a/src/panels/lovelace/editor/add-entities-to-view.ts +++ b/src/panels/lovelace/editor/add-entities-to-view.ts @@ -1,14 +1,11 @@ -import { LovelacePanelConfig } from "../../../data/lovelace"; -import { LovelaceCardConfig } from "../../../data/lovelace/config/card"; -import { LovelaceSectionConfig } from "../../../data/lovelace/config/section"; -import { - LovelaceConfig, - fetchConfig, - saveConfig, -} from "../../../data/lovelace/config/types"; +import type { LovelacePanelConfig } from "../../../data/lovelace"; +import type { LovelaceCardConfig } from "../../../data/lovelace/config/card"; +import type { LovelaceSectionConfig } from "../../../data/lovelace/config/section"; +import type { LovelaceConfig } from "../../../data/lovelace/config/types"; +import { fetchConfig, saveConfig } from "../../../data/lovelace/config/types"; import { fetchDashboards } from "../../../data/lovelace/dashboard"; import { showAlertDialog } from "../../../dialogs/generic/show-dialog-box"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { showSuggestCardDialog } from "./card-editor/show-suggest-card-dialog"; import { showSelectViewDialog } from "./select-view/show-select-view-dialog"; diff --git a/src/panels/lovelace/editor/badge-editor/hui-badge-element-editor.ts b/src/panels/lovelace/editor/badge-editor/hui-badge-element-editor.ts index 0fbe0d0e1450..d130e370166b 100644 --- a/src/panels/lovelace/editor/badge-editor/hui-badge-element-editor.ts +++ b/src/panels/lovelace/editor/badge-editor/hui-badge-element-editor.ts @@ -1,8 +1,9 @@ import "@material/mwc-tab-bar/mwc-tab-bar"; import "@material/mwc-tab/mwc-tab"; -import { css, CSSResultGroup, html, nothing, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, nothing } from "lit"; import { customElement, state } from "lit/decorators"; -import { LovelaceBadgeConfig } from "../../../../data/lovelace/config/badge"; +import type { LovelaceBadgeConfig } from "../../../../data/lovelace/config/badge"; import { getBadgeElementClass } from "../../create-element/create-badge-element"; import type { LovelaceCardEditor, LovelaceConfigForm } from "../../types"; import { HuiTypedElementEditor } from "../hui-typed-element-editor"; diff --git a/src/panels/lovelace/editor/badge-editor/hui-badge-picker.ts b/src/panels/lovelace/editor/badge-editor/hui-badge-picker.ts index 00e18f08c315..986b1f298463 100644 --- a/src/panels/lovelace/editor/badge-editor/hui-badge-picker.ts +++ b/src/panels/lovelace/editor/badge-editor/hui-badge-picker.ts @@ -1,13 +1,7 @@ -import Fuse, { IFuseOptions } from "fuse.js"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { IFuseOptions } from "fuse.js"; +import Fuse from "fuse.js"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { styleMap } from "lit/directives/style-map"; @@ -20,11 +14,11 @@ import { stripDiacritics } from "../../../../common/string/strip-diacritics"; import "../../../../components/ha-circular-progress"; import "../../../../components/search-input"; import { isUnavailableState } from "../../../../data/entity"; -import { LovelaceBadgeConfig } from "../../../../data/lovelace/config/badge"; +import type { LovelaceBadgeConfig } from "../../../../data/lovelace/config/badge"; import type { LovelaceConfig } from "../../../../data/lovelace/config/types"; +import type { CustomBadgeEntry } from "../../../../data/lovelace_custom_cards"; import { CUSTOM_TYPE_PREFIX, - CustomBadgeEntry, customBadges, getCustomBadgeEntry, } from "../../../../data/lovelace_custom_cards"; diff --git a/src/panels/lovelace/editor/badge-editor/hui-badge-visibility-editor.ts b/src/panels/lovelace/editor/badge-editor/hui-badge-visibility-editor.ts index f7f1612d9fe5..aed9c1d53ba9 100644 --- a/src/panels/lovelace/editor/badge-editor/hui-badge-visibility-editor.ts +++ b/src/panels/lovelace/editor/badge-editor/hui-badge-visibility-editor.ts @@ -2,9 +2,9 @@ import { LitElement, html, css } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-alert"; -import { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; -import { HomeAssistant } from "../../../../types"; -import { Condition } from "../../common/validate-condition"; +import type { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; +import type { HomeAssistant } from "../../../../types"; +import type { Condition } from "../../common/validate-condition"; import "../conditions/ha-card-conditions-editor"; @customElement("hui-badge-visibility-editor") diff --git a/src/panels/lovelace/editor/badge-editor/hui-dialog-create-badge.ts b/src/panels/lovelace/editor/badge-editor/hui-dialog-create-badge.ts index 77bbfaead836..b284dd2fd43b 100644 --- a/src/panels/lovelace/editor/badge-editor/hui-dialog-create-badge.ts +++ b/src/panels/lovelace/editor/badge-editor/hui-dialog-create-badge.ts @@ -1,7 +1,8 @@ import "@material/mwc-tab-bar/mwc-tab-bar"; import "@material/mwc-tab/mwc-tab"; import { mdiClose } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { cache } from "lit/directives/cache"; import { classMap } from "lit/directives/class-map"; @@ -9,7 +10,7 @@ import memoize from "memoize-one"; import { fireEvent } from "../../../../common/dom/fire_event"; import { computeDomain } from "../../../../common/entity/compute_domain"; import { computeStateName } from "../../../../common/entity/compute_state_name"; -import { DataTableRowData } from "../../../../components/data-table/ha-data-table"; +import type { DataTableRowData } from "../../../../components/data-table/ha-data-table"; import "../../../../components/ha-dialog"; import "../../../../components/ha-dialog-header"; import type { LovelaceViewConfig } from "../../../../data/lovelace/config/view"; @@ -20,7 +21,7 @@ import { computeBadges } from "../../common/generate-lovelace-config"; import "../card-editor/hui-entity-picker-table"; import { findLovelaceContainer } from "../lovelace-path"; import "./hui-badge-picker"; -import { CreateBadgeDialogParams } from "./show-create-badge-dialog"; +import type { CreateBadgeDialogParams } from "./show-create-badge-dialog"; import { showEditBadgeDialog } from "./show-edit-badge-dialog"; import { showSuggestBadgeDialog } from "./show-suggest-badge-dialog"; diff --git a/src/panels/lovelace/editor/badge-editor/hui-dialog-edit-badge.ts b/src/panels/lovelace/editor/badge-editor/hui-dialog-edit-badge.ts index b469ae9d189b..5b3122fa34b1 100644 --- a/src/panels/lovelace/editor/badge-editor/hui-dialog-edit-badge.ts +++ b/src/panels/lovelace/editor/badge-editor/hui-dialog-edit-badge.ts @@ -1,13 +1,7 @@ import { mdiClose, mdiHelpCircle } from "@mdi/js"; import deepFreeze from "deep-freeze"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import type { HASSDomEvent } from "../../../../common/dom/fire_event"; import { fireEvent } from "../../../../common/dom/fire_event"; @@ -16,11 +10,9 @@ import "../../../../components/ha-circular-progress"; import "../../../../components/ha-dialog"; import "../../../../components/ha-dialog-header"; import "../../../../components/ha-icon-button"; -import { - ensureBadgeConfig, - LovelaceBadgeConfig, -} from "../../../../data/lovelace/config/badge"; -import { LovelaceViewConfig } from "../../../../data/lovelace/config/view"; +import type { LovelaceBadgeConfig } from "../../../../data/lovelace/config/badge"; +import { ensureBadgeConfig } from "../../../../data/lovelace/config/badge"; +import type { LovelaceViewConfig } from "../../../../data/lovelace/config/view"; import { getCustomBadgeEntry, isCustomType, diff --git a/src/panels/lovelace/editor/badge-editor/hui-dialog-suggest-badge.ts b/src/panels/lovelace/editor/badge-editor/hui-dialog-suggest-badge.ts index c02195022258..b25193385257 100644 --- a/src/panels/lovelace/editor/badge-editor/hui-dialog-suggest-badge.ts +++ b/src/panels/lovelace/editor/badge-editor/hui-dialog-suggest-badge.ts @@ -1,22 +1,21 @@ import deepFreeze from "deep-freeze"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-yaml-editor"; import type { HaYamlEditor } from "../../../../components/ha-yaml-editor"; -import { LovelaceBadgeConfig } from "../../../../data/lovelace/config/badge"; -import { LovelaceConfig } from "../../../../data/lovelace/config/types"; +import type { LovelaceBadgeConfig } from "../../../../data/lovelace/config/badge"; +import type { LovelaceConfig } from "../../../../data/lovelace/config/types"; import { haStyleDialog } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; import { showSaveSuccessToast } from "../../../../util/toast-saved-success"; import "../../badges/hui-badge"; import { addBadges } from "../config-util"; -import { - LovelaceContainerPath, - parseLovelaceContainerPath, -} from "../lovelace-path"; -import { SuggestBadgeDialogParams } from "./show-suggest-badge-dialog"; +import type { LovelaceContainerPath } from "../lovelace-path"; +import { parseLovelaceContainerPath } from "../lovelace-path"; +import type { SuggestBadgeDialogParams } from "./show-suggest-badge-dialog"; @customElement("hui-dialog-suggest-badge") export class HuiDialogSuggestBadge extends LitElement { diff --git a/src/panels/lovelace/editor/badge-editor/show-create-badge-dialog.ts b/src/panels/lovelace/editor/badge-editor/show-create-badge-dialog.ts index ab2313d10bd7..13469820f48b 100644 --- a/src/panels/lovelace/editor/badge-editor/show-create-badge-dialog.ts +++ b/src/panels/lovelace/editor/badge-editor/show-create-badge-dialog.ts @@ -1,6 +1,6 @@ import { fireEvent } from "../../../../common/dom/fire_event"; import type { LovelaceConfig } from "../../../../data/lovelace/config/types"; -import { LovelaceContainerPath } from "../lovelace-path"; +import type { LovelaceContainerPath } from "../lovelace-path"; export interface CreateBadgeDialogParams { lovelaceConfig: LovelaceConfig; diff --git a/src/panels/lovelace/editor/badge-editor/show-edit-badge-dialog.ts b/src/panels/lovelace/editor/badge-editor/show-edit-badge-dialog.ts index e7640e988780..4a75b42c2667 100644 --- a/src/panels/lovelace/editor/badge-editor/show-edit-badge-dialog.ts +++ b/src/panels/lovelace/editor/badge-editor/show-edit-badge-dialog.ts @@ -1,7 +1,7 @@ import { fireEvent } from "../../../../common/dom/fire_event"; import type { LovelaceBadgeConfig } from "../../../../data/lovelace/config/badge"; import type { LovelaceConfig } from "../../../../data/lovelace/config/types"; -import { LovelaceContainerPath } from "../lovelace-path"; +import type { LovelaceContainerPath } from "../lovelace-path"; export type EditBadgeDialogParams = { lovelaceConfig: LovelaceConfig; diff --git a/src/panels/lovelace/editor/badge-editor/show-suggest-badge-dialog.ts b/src/panels/lovelace/editor/badge-editor/show-suggest-badge-dialog.ts index 06bb94e1863f..4e4421d491b4 100644 --- a/src/panels/lovelace/editor/badge-editor/show-suggest-badge-dialog.ts +++ b/src/panels/lovelace/editor/badge-editor/show-suggest-badge-dialog.ts @@ -1,7 +1,7 @@ import { fireEvent } from "../../../../common/dom/fire_event"; -import { LovelaceBadgeConfig } from "../../../../data/lovelace/config/badge"; -import { LovelaceConfig } from "../../../../data/lovelace/config/types"; -import { LovelaceContainerPath } from "../lovelace-path"; +import type { LovelaceBadgeConfig } from "../../../../data/lovelace/config/badge"; +import type { LovelaceConfig } from "../../../../data/lovelace/config/types"; +import type { LovelaceContainerPath } from "../lovelace-path"; export interface SuggestBadgeDialogParams { lovelaceConfig?: LovelaceConfig; diff --git a/src/panels/lovelace/editor/card-editor/ha-grid-layout-slider.ts b/src/panels/lovelace/editor/card-editor/ha-grid-layout-slider.ts index cfbbd31c3aec..206436ce959d 100644 --- a/src/panels/lovelace/editor/card-editor/ha-grid-layout-slider.ts +++ b/src/panels/lovelace/editor/card-editor/ha-grid-layout-slider.ts @@ -1,13 +1,6 @@ import { DIRECTION_ALL, Manager, Pan, Tap } from "@egjs/hammerjs"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { styleMap } from "lit/directives/style-map"; diff --git a/src/panels/lovelace/editor/card-editor/hui-card-element-editor.ts b/src/panels/lovelace/editor/card-editor/hui-card-element-editor.ts index 51804864afb0..a46dda6304e5 100644 --- a/src/panels/lovelace/editor/card-editor/hui-card-element-editor.ts +++ b/src/panels/lovelace/editor/card-editor/hui-card-element-editor.ts @@ -1,14 +1,15 @@ import "@material/mwc-tab-bar/mwc-tab-bar"; import "@material/mwc-tab/mwc-tab"; -import { CSSResultGroup, TemplateResult, css, html, nothing } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; +import type { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; import { getCardElementClass } from "../../create-element/create-card-element"; import type { LovelaceCardEditor, LovelaceConfigForm } from "../../types"; import { HuiTypedElementEditor } from "../hui-typed-element-editor"; import "./hui-card-layout-editor"; import "./hui-card-visibility-editor"; -import { LovelaceSectionConfig } from "../../../../data/lovelace/config/section"; +import type { LovelaceSectionConfig } from "../../../../data/lovelace/config/section"; const tabs = ["config", "visibility", "layout"] as const; diff --git a/src/panels/lovelace/editor/card-editor/hui-card-layout-editor.ts b/src/panels/lovelace/editor/card-editor/hui-card-layout-editor.ts index d144c80f7d9c..aa617f79090c 100644 --- a/src/panels/lovelace/editor/card-editor/hui-card-layout-editor.ts +++ b/src/panels/lovelace/editor/card-editor/hui-card-layout-editor.ts @@ -1,6 +1,7 @@ import type { ActionDetail } from "@material/mwc-list"; import { mdiCheck, mdiDotsVertical } from "@mdi/js"; -import { css, html, LitElement, nothing, PropertyValues } from "lit"; +import type { PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import memoizeOne from "memoize-one"; @@ -17,20 +18,20 @@ import "../../../../components/ha-slider"; import "../../../../components/ha-svg-icon"; import "../../../../components/ha-switch"; import "../../../../components/ha-yaml-editor"; -import { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; -import { LovelaceSectionConfig } from "../../../../data/lovelace/config/section"; +import type { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; +import type { LovelaceSectionConfig } from "../../../../data/lovelace/config/section"; import { haStyle } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; -import { HuiCard } from "../../cards/hui-card"; +import type { HomeAssistant } from "../../../../types"; +import type { HuiCard } from "../../cards/hui-card"; +import type { CardGridSize } from "../../common/compute-card-grid-size"; import { - CardGridSize, computeCardGridSize, divideBy, GRID_COLUMN_MULTIPLIER, migrateLayoutToGridOptions, multiplyBy, } from "../../common/compute-card-grid-size"; -import { LovelaceGridOptions } from "../../types"; +import type { LovelaceGridOptions } from "../../types"; const computePreciseMode = (columns?: number | string) => typeof columns === "number" && columns % 3 !== 0; @@ -405,4 +406,4 @@ declare global { interface HTMLElementTagNameMap { "hui-card-layout-editor": HuiCardLayoutEditor; } -} +} \ No newline at end of file diff --git a/src/panels/lovelace/editor/card-editor/hui-card-picker.ts b/src/panels/lovelace/editor/card-editor/hui-card-picker.ts index 60d95b5e229f..83fa15305ff7 100644 --- a/src/panels/lovelace/editor/card-editor/hui-card-picker.ts +++ b/src/panels/lovelace/editor/card-editor/hui-card-picker.ts @@ -1,13 +1,7 @@ -import Fuse, { IFuseOptions } from "fuse.js"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { IFuseOptions } from "fuse.js"; +import Fuse from "fuse.js"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { styleMap } from "lit/directives/style-map"; @@ -22,9 +16,9 @@ import "../../../../components/search-input"; import { isUnavailableState } from "../../../../data/entity"; import type { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; import type { LovelaceConfig } from "../../../../data/lovelace/config/types"; +import type { CustomCardEntry } from "../../../../data/lovelace_custom_cards"; import { CUSTOM_TYPE_PREFIX, - CustomCardEntry, customCards, getCustomCardEntry, } from "../../../../data/lovelace_custom_cards"; diff --git a/src/panels/lovelace/editor/card-editor/hui-card-visibility-editor.ts b/src/panels/lovelace/editor/card-editor/hui-card-visibility-editor.ts index 7f9007f573de..3cea5e290d7e 100644 --- a/src/panels/lovelace/editor/card-editor/hui-card-visibility-editor.ts +++ b/src/panels/lovelace/editor/card-editor/hui-card-visibility-editor.ts @@ -2,9 +2,9 @@ import { LitElement, html, css } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-alert"; -import { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; -import { HomeAssistant } from "../../../../types"; -import { Condition } from "../../common/validate-condition"; +import type { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; +import type { HomeAssistant } from "../../../../types"; +import type { Condition } from "../../common/validate-condition"; import "../conditions/ha-card-conditions-editor"; @customElement("hui-card-visibility-editor") diff --git a/src/panels/lovelace/editor/card-editor/hui-dialog-create-card.ts b/src/panels/lovelace/editor/card-editor/hui-dialog-create-card.ts index 56a0cec39441..08f5487aedc7 100644 --- a/src/panels/lovelace/editor/card-editor/hui-dialog-create-card.ts +++ b/src/panels/lovelace/editor/card-editor/hui-dialog-create-card.ts @@ -1,7 +1,8 @@ import "@material/mwc-tab-bar/mwc-tab-bar"; import "@material/mwc-tab/mwc-tab"; import { mdiClose } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { cache } from "lit/directives/cache"; import { classMap } from "lit/directives/class-map"; @@ -9,13 +10,11 @@ import memoize from "memoize-one"; import { fireEvent } from "../../../../common/dom/fire_event"; import { computeDomain } from "../../../../common/entity/compute_domain"; import { computeStateName } from "../../../../common/entity/compute_state_name"; -import { DataTableRowData } from "../../../../components/data-table/ha-data-table"; +import type { DataTableRowData } from "../../../../components/data-table/ha-data-table"; import "../../../../components/ha-dialog"; import "../../../../components/ha-dialog-header"; -import { - isStrategySection, - LovelaceSectionConfig, -} from "../../../../data/lovelace/config/section"; +import type { LovelaceSectionConfig } from "../../../../data/lovelace/config/section"; +import { isStrategySection } from "../../../../data/lovelace/config/section"; import type { LovelaceViewConfig } from "../../../../data/lovelace/config/view"; import type { HassDialog } from "../../../../dialogs/make-dialog-manager"; import { haStyleDialog } from "../../../../resources/styles"; @@ -30,7 +29,7 @@ import { } from "../lovelace-path"; import "./hui-card-picker"; import "./hui-entity-picker-table"; -import { CreateCardDialogParams } from "./show-create-card-dialog"; +import type { CreateCardDialogParams } from "./show-create-card-dialog"; import { showEditCardDialog } from "./show-edit-card-dialog"; import { showSuggestCardDialog } from "./show-suggest-card-dialog"; diff --git a/src/panels/lovelace/editor/card-editor/hui-dialog-delete-card.ts b/src/panels/lovelace/editor/card-editor/hui-dialog-delete-card.ts index 65690b750161..467e5bc33b67 100644 --- a/src/panels/lovelace/editor/card-editor/hui-dialog-delete-card.ts +++ b/src/panels/lovelace/editor/card-editor/hui-dialog-delete-card.ts @@ -1,5 +1,6 @@ import deepFreeze from "deep-freeze"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import type { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; diff --git a/src/panels/lovelace/editor/card-editor/hui-dialog-edit-card.ts b/src/panels/lovelace/editor/card-editor/hui-dialog-edit-card.ts index 96779a34ccda..e0720420f2c7 100644 --- a/src/panels/lovelace/editor/card-editor/hui-dialog-edit-card.ts +++ b/src/panels/lovelace/editor/card-editor/hui-dialog-edit-card.ts @@ -1,13 +1,7 @@ import { mdiClose, mdiHelpCircle } from "@mdi/js"; import deepFreeze from "deep-freeze"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import type { HASSDomEvent } from "../../../../common/dom/fire_event"; @@ -17,9 +11,9 @@ import "../../../../components/ha-circular-progress"; import "../../../../components/ha-dialog"; import "../../../../components/ha-dialog-header"; import "../../../../components/ha-icon-button"; -import { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; -import { LovelaceSectionConfig } from "../../../../data/lovelace/config/section"; -import { LovelaceViewConfig } from "../../../../data/lovelace/config/view"; +import type { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; +import type { LovelaceSectionConfig } from "../../../../data/lovelace/config/section"; +import type { LovelaceViewConfig } from "../../../../data/lovelace/config/view"; import { getCustomCardEntry, isCustomType, diff --git a/src/panels/lovelace/editor/card-editor/hui-dialog-suggest-card.ts b/src/panels/lovelace/editor/card-editor/hui-dialog-suggest-card.ts index ef2618ff54ea..0bc13d0a113e 100644 --- a/src/panels/lovelace/editor/card-editor/hui-dialog-suggest-card.ts +++ b/src/panels/lovelace/editor/card-editor/hui-dialog-suggest-card.ts @@ -1,26 +1,25 @@ import deepFreeze from "deep-freeze"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-yaml-editor"; import type { HaYamlEditor } from "../../../../components/ha-yaml-editor"; -import { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; -import { LovelaceSectionConfig } from "../../../../data/lovelace/config/section"; -import { LovelaceConfig } from "../../../../data/lovelace/config/types"; +import type { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; +import type { LovelaceSectionConfig } from "../../../../data/lovelace/config/section"; +import type { LovelaceConfig } from "../../../../data/lovelace/config/types"; import { isStrategyView } from "../../../../data/lovelace/config/view"; import { haStyleDialog } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; import { showSaveSuccessToast } from "../../../../util/toast-saved-success"; import "../../sections/hui-section"; import { addCards, addSection } from "../config-util"; -import { - LovelaceContainerPath, - parseLovelaceContainerPath, -} from "../lovelace-path"; +import type { LovelaceContainerPath } from "../lovelace-path"; +import { parseLovelaceContainerPath } from "../lovelace-path"; import "../../cards/hui-card"; import { showCreateCardDialog } from "./show-create-card-dialog"; -import { SuggestCardDialogParams } from "./show-suggest-card-dialog"; +import type { SuggestCardDialogParams } from "./show-suggest-card-dialog"; @customElement("hui-dialog-suggest-card") export class HuiDialogSuggestCard extends LitElement { diff --git a/src/panels/lovelace/editor/card-editor/hui-entity-picker-table.ts b/src/panels/lovelace/editor/card-editor/hui-entity-picker-table.ts index 8caff95723fd..f9c28442c36b 100644 --- a/src/panels/lovelace/editor/card-editor/hui-entity-picker-table.ts +++ b/src/panels/lovelace/editor/card-editor/hui-entity-picker-table.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; import type { HASSDomEvent } from "../../../../common/dom/fire_event"; diff --git a/src/panels/lovelace/editor/card-editor/show-create-card-dialog.ts b/src/panels/lovelace/editor/card-editor/show-create-card-dialog.ts index 96c58879b260..c2934b0bcd84 100644 --- a/src/panels/lovelace/editor/card-editor/show-create-card-dialog.ts +++ b/src/panels/lovelace/editor/card-editor/show-create-card-dialog.ts @@ -1,6 +1,6 @@ import { fireEvent } from "../../../../common/dom/fire_event"; import type { LovelaceConfig } from "../../../../data/lovelace/config/types"; -import { LovelaceContainerPath } from "../lovelace-path"; +import type { LovelaceContainerPath } from "../lovelace-path"; export interface CreateCardDialogParams { lovelaceConfig: LovelaceConfig; diff --git a/src/panels/lovelace/editor/card-editor/show-delete-card-dialog.ts b/src/panels/lovelace/editor/card-editor/show-delete-card-dialog.ts index f9d6331e8fed..3fee6abed2d1 100644 --- a/src/panels/lovelace/editor/card-editor/show-delete-card-dialog.ts +++ b/src/panels/lovelace/editor/card-editor/show-delete-card-dialog.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../../common/dom/fire_event"; -import { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; +import type { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; export interface DeleteCardDialogParams { deleteCard: () => void; diff --git a/src/panels/lovelace/editor/card-editor/show-edit-card-dialog.ts b/src/panels/lovelace/editor/card-editor/show-edit-card-dialog.ts index 40391f6a1311..a1da36b66007 100644 --- a/src/panels/lovelace/editor/card-editor/show-edit-card-dialog.ts +++ b/src/panels/lovelace/editor/card-editor/show-edit-card-dialog.ts @@ -1,7 +1,7 @@ import { fireEvent } from "../../../../common/dom/fire_event"; import type { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; import type { LovelaceConfig } from "../../../../data/lovelace/config/types"; -import { LovelaceContainerPath } from "../lovelace-path"; +import type { LovelaceContainerPath } from "../lovelace-path"; export type EditCardDialogParams = { lovelaceConfig: LovelaceConfig; diff --git a/src/panels/lovelace/editor/card-editor/show-suggest-card-dialog.ts b/src/panels/lovelace/editor/card-editor/show-suggest-card-dialog.ts index c95fed399e8d..3f9d75481c6c 100644 --- a/src/panels/lovelace/editor/card-editor/show-suggest-card-dialog.ts +++ b/src/panels/lovelace/editor/card-editor/show-suggest-card-dialog.ts @@ -1,8 +1,8 @@ import { fireEvent } from "../../../../common/dom/fire_event"; -import { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; -import { LovelaceSectionConfig } from "../../../../data/lovelace/config/section"; -import { LovelaceConfig } from "../../../../data/lovelace/config/types"; -import { LovelaceContainerPath } from "../lovelace-path"; +import type { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; +import type { LovelaceSectionConfig } from "../../../../data/lovelace/config/section"; +import type { LovelaceConfig } from "../../../../data/lovelace/config/types"; +import type { LovelaceContainerPath } from "../lovelace-path"; export interface SuggestCardDialogParams { lovelaceConfig?: LovelaceConfig; diff --git a/src/panels/lovelace/editor/conditions/ha-card-condition-editor.ts b/src/panels/lovelace/editor/conditions/ha-card-condition-editor.ts index d7d41c1deaf4..a4308db46583 100644 --- a/src/panels/lovelace/editor/conditions/ha-card-condition-editor.ts +++ b/src/panels/lovelace/editor/conditions/ha-card-condition-editor.ts @@ -1,6 +1,7 @@ -import { ActionDetail } from "@material/mwc-list"; +import type { ActionDetail } from "@material/mwc-list"; import { mdiCheck, mdiDelete, mdiDotsVertical, mdiFlask } from "@mdi/js"; -import { LitElement, PropertyValues, css, html, nothing } from "lit"; +import type { PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { dynamicElement } from "../../../../common/dom/dynamic-element-directive"; @@ -20,9 +21,11 @@ import { showAlertDialog } from "../../../../dialogs/generic/show-dialog-box"; import { haStyle } from "../../../../resources/styles"; import type { HomeAssistant } from "../../../../types"; import { ICON_CONDITION } from "../../common/icon-condition"; -import { +import type { Condition, LegacyCondition, +} from "../../common/validate-condition"; +import { checkConditionsMet, validateConditionalConfig, } from "../../common/validate-condition"; diff --git a/src/panels/lovelace/editor/conditions/ha-card-conditions-editor.ts b/src/panels/lovelace/editor/conditions/ha-card-conditions-editor.ts index 66b5bfffd846..2f07ff3a02ef 100644 --- a/src/panels/lovelace/editor/conditions/ha-card-conditions-editor.ts +++ b/src/panels/lovelace/editor/conditions/ha-card-conditions-editor.ts @@ -1,5 +1,6 @@ import { mdiPlus } from "@mdi/js"; -import { CSSResultGroup, LitElement, PropertyValues, css, html } from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import { stopPropagation } from "../../../../common/dom/stop_propagation"; @@ -9,10 +10,13 @@ import type { HaSelect } from "../../../../components/ha-select"; import "../../../../components/ha-svg-icon"; import type { HomeAssistant } from "../../../../types"; import { ICON_CONDITION } from "../../common/icon-condition"; -import { Condition, LegacyCondition } from "../../common/validate-condition"; +import type { + Condition, + LegacyCondition, +} from "../../common/validate-condition"; import "./ha-card-condition-editor"; import type { HaCardConditionEditor } from "./ha-card-condition-editor"; -import { LovelaceConditionEditorConstructor } from "./types"; +import type { LovelaceConditionEditorConstructor } from "./types"; import "./types/ha-card-condition-and"; import "./types/ha-card-condition-numeric_state"; import "./types/ha-card-condition-or"; diff --git a/src/panels/lovelace/editor/conditions/types.ts b/src/panels/lovelace/editor/conditions/types.ts index 3025ebc54152..291658f4aee5 100644 --- a/src/panels/lovelace/editor/conditions/types.ts +++ b/src/panels/lovelace/editor/conditions/types.ts @@ -1,5 +1,5 @@ -import { HomeAssistant } from "../../../../types"; -import { Condition } from "../../common/validate-condition"; +import type { HomeAssistant } from "../../../../types"; +import type { Condition } from "../../common/validate-condition"; export interface LovelaceConditionEditorConstructor { defaultConfig?: Condition; diff --git a/src/panels/lovelace/editor/conditions/types/ha-card-condition-and.ts b/src/panels/lovelace/editor/conditions/types/ha-card-condition-and.ts index a22814516049..a5d0a152d832 100644 --- a/src/panels/lovelace/editor/conditions/types/ha-card-condition-and.ts +++ b/src/panels/lovelace/editor/conditions/types/ha-card-condition-and.ts @@ -4,7 +4,7 @@ import { any, array, assert, literal, object, optional } from "superstruct"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-form/ha-form"; import type { HomeAssistant } from "../../../../../types"; -import { +import type { AndCondition, Condition, StateCondition, diff --git a/src/panels/lovelace/editor/conditions/types/ha-card-condition-numeric_state.ts b/src/panels/lovelace/editor/conditions/types/ha-card-condition-numeric_state.ts index ff33d6352ce6..152e61361461 100644 --- a/src/panels/lovelace/editor/conditions/types/ha-card-condition-numeric_state.ts +++ b/src/panels/lovelace/editor/conditions/types/ha-card-condition-numeric_state.ts @@ -1,14 +1,16 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; import { assert, literal, number, object, optional, string } from "superstruct"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-form/ha-form"; -import type { SchemaUnion } from "../../../../../components/ha-form/types"; -import { HaFormSchema } from "../../../../../components/ha-form/types"; +import type { + SchemaUnion, + HaFormSchema, +} from "../../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../../types"; -import { +import type { NumericStateCondition, StateCondition, } from "../../../common/validate-condition"; diff --git a/src/panels/lovelace/editor/conditions/types/ha-card-condition-or.ts b/src/panels/lovelace/editor/conditions/types/ha-card-condition-or.ts index d9fdfc87a565..a6e41a2e82b4 100644 --- a/src/panels/lovelace/editor/conditions/types/ha-card-condition-or.ts +++ b/src/panels/lovelace/editor/conditions/types/ha-card-condition-or.ts @@ -4,7 +4,7 @@ import { any, array, assert, literal, object, optional } from "superstruct"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-form/ha-form"; import type { HomeAssistant } from "../../../../../types"; -import { +import type { Condition, OrCondition, StateCondition, diff --git a/src/panels/lovelace/editor/conditions/types/ha-card-condition-screen.ts b/src/panels/lovelace/editor/conditions/types/ha-card-condition-screen.ts index cd341562e238..c60397128231 100644 --- a/src/panels/lovelace/editor/conditions/types/ha-card-condition-screen.ts +++ b/src/panels/lovelace/editor/conditions/types/ha-card-condition-screen.ts @@ -3,12 +3,14 @@ import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; import { getAllCombinations } from "../../../../../common/array/combinations"; import { fireEvent } from "../../../../../common/dom/fire_event"; -import { LocalizeFunc } from "../../../../../common/translations/localize"; +import type { LocalizeFunc } from "../../../../../common/translations/localize"; import "../../../../../components/ha-form/ha-form"; -import type { SchemaUnion } from "../../../../../components/ha-form/types"; -import { HaFormSchema } from "../../../../../components/ha-form/types"; +import type { + SchemaUnion, + HaFormSchema, +} from "../../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../../types"; -import { ScreenCondition } from "../../../common/validate-condition"; +import type { ScreenCondition } from "../../../common/validate-condition"; const BREAKPOINT_VALUES = [0, 768, 1024, 1280, Infinity]; const BREAKPOINTS = ["mobile", "tablet", "desktop", "wide"] as const; diff --git a/src/panels/lovelace/editor/conditions/types/ha-card-condition-state.ts b/src/panels/lovelace/editor/conditions/types/ha-card-condition-state.ts index 006d00c3cf09..6a1b52ccdca0 100644 --- a/src/panels/lovelace/editor/conditions/types/ha-card-condition-state.ts +++ b/src/panels/lovelace/editor/conditions/types/ha-card-condition-state.ts @@ -1,14 +1,17 @@ -import { html, LitElement, PropertyValues } from "lit"; +import type { PropertyValues } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; import { assert, literal, object, optional, string } from "superstruct"; import { fireEvent } from "../../../../../common/dom/fire_event"; -import { LocalizeFunc } from "../../../../../common/translations/localize"; +import type { LocalizeFunc } from "../../../../../common/translations/localize"; import "../../../../../components/ha-form/ha-form"; -import type { SchemaUnion } from "../../../../../components/ha-form/types"; -import { HaFormSchema } from "../../../../../components/ha-form/types"; +import type { + SchemaUnion, + HaFormSchema, +} from "../../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../../types"; -import { StateCondition } from "../../../common/validate-condition"; +import type { StateCondition } from "../../../common/validate-condition"; const stateConditionStruct = object({ condition: literal("state"), diff --git a/src/panels/lovelace/editor/conditions/types/ha-card-condition-user.ts b/src/panels/lovelace/editor/conditions/types/ha-card-condition-user.ts index 68dfc63b67fa..f2cbded7bcf3 100644 --- a/src/panels/lovelace/editor/conditions/types/ha-card-condition-user.ts +++ b/src/panels/lovelace/editor/conditions/types/ha-card-condition-user.ts @@ -1,5 +1,6 @@ import "@material/mwc-list"; -import { LitElement, PropertyValues, css, html } from "lit"; +import type { PropertyValues } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { array, assert, literal, object, string } from "superstruct"; @@ -8,9 +9,10 @@ import { stringCompare } from "../../../../../common/string/compare"; import "../../../../../components/ha-check-list-item"; import "../../../../../components/ha-switch"; import "../../../../../components/user/ha-user-badge"; -import { User, fetchUsers } from "../../../../../data/user"; +import type { User } from "../../../../../data/user"; +import { fetchUsers } from "../../../../../data/user"; import type { HomeAssistant } from "../../../../../types"; -import { UserCondition } from "../../../common/validate-condition"; +import type { UserCondition } from "../../../common/validate-condition"; const userConditionStruct = object({ condition: literal("user"), diff --git a/src/panels/lovelace/editor/config-elements/elements/hui-conditional-element-editor.ts b/src/panels/lovelace/editor/config-elements/elements/hui-conditional-element-editor.ts index 7f39b10e497b..6696ebb3ee24 100644 --- a/src/panels/lovelace/editor/config-elements/elements/hui-conditional-element-editor.ts +++ b/src/panels/lovelace/editor/config-elements/elements/hui-conditional-element-editor.ts @@ -9,20 +9,24 @@ import { optional, string, } from "superstruct"; -import { HASSDomEvent, fireEvent } from "../../../../../common/dom/fire_event"; +import type { HASSDomEvent } from "../../../../../common/dom/fire_event"; +import { fireEvent } from "../../../../../common/dom/fire_event"; import type { HomeAssistant } from "../../../../../types"; import "../../../../../components/ha-form/ha-form"; -import { LovelacePictureElementEditor } from "../../../types"; -import { +import type { LovelacePictureElementEditor } from "../../../types"; +import type { ConditionalElementConfig, LovelaceElementConfig, } from "../../../elements/types"; import "../../conditions/ha-card-conditions-editor"; import "../../hui-picture-elements-card-row-editor"; -import { LovelaceCardConfig } from "../../../../../data/lovelace/config/card"; -import { EditDetailElementEvent, SubElementEditorConfig } from "../../types"; +import type { LovelaceCardConfig } from "../../../../../data/lovelace/config/card"; +import type { + EditDetailElementEvent, + SubElementEditorConfig, +} from "../../types"; import "../../hui-sub-element-editor"; -import { SchemaUnion } from "../../../../../components/ha-form/types"; +import type { SchemaUnion } from "../../../../../components/ha-form/types"; const conditionalElementConfigStruct = object({ type: literal("conditional"), diff --git a/src/panels/lovelace/editor/config-elements/elements/hui-icon-element-editor.ts b/src/panels/lovelace/editor/config-elements/elements/hui-icon-element-editor.ts index bbf89f747756..9256a0d6c316 100644 --- a/src/panels/lovelace/editor/config-elements/elements/hui-icon-element-editor.ts +++ b/src/panels/lovelace/editor/config-elements/elements/hui-icon-element-editor.ts @@ -5,8 +5,8 @@ import { fireEvent } from "../../../../../common/dom/fire_event"; import type { SchemaUnion } from "../../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../../types"; import "../../../../../components/ha-form/ha-form"; -import { LovelacePictureElementEditor } from "../../../types"; -import { IconElementConfig } from "../../../elements/types"; +import type { LovelacePictureElementEditor } from "../../../types"; +import type { IconElementConfig } from "../../../elements/types"; import { actionConfigStruct } from "../../structs/action-struct"; const iconElementConfigStruct = object({ diff --git a/src/panels/lovelace/editor/config-elements/elements/hui-image-element-editor.ts b/src/panels/lovelace/editor/config-elements/elements/hui-image-element-editor.ts index 24e761be8a88..570e80706cc3 100644 --- a/src/panels/lovelace/editor/config-elements/elements/hui-image-element-editor.ts +++ b/src/panels/lovelace/editor/config-elements/elements/hui-image-element-editor.ts @@ -5,8 +5,8 @@ import { fireEvent } from "../../../../../common/dom/fire_event"; import type { SchemaUnion } from "../../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../../types"; import "../../../../../components/ha-form/ha-form"; -import { LovelacePictureElementEditor } from "../../../types"; -import { ImageElementConfig } from "../../../elements/types"; +import type { LovelacePictureElementEditor } from "../../../types"; +import type { ImageElementConfig } from "../../../elements/types"; import { actionConfigStruct } from "../../structs/action-struct"; const imageElementConfigStruct = object({ diff --git a/src/panels/lovelace/editor/config-elements/elements/hui-service-button-element-editor.ts b/src/panels/lovelace/editor/config-elements/elements/hui-service-button-element-editor.ts index ae3039d32703..bae96f0a61e5 100644 --- a/src/panels/lovelace/editor/config-elements/elements/hui-service-button-element-editor.ts +++ b/src/panels/lovelace/editor/config-elements/elements/hui-service-button-element-editor.ts @@ -6,10 +6,10 @@ import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-form/ha-form"; import type { SchemaUnion } from "../../../../../components/ha-form/types"; import "../../../../../components/ha-service-control"; -import { ServiceAction } from "../../../../../data/script"; +import type { ServiceAction } from "../../../../../data/script"; import type { HomeAssistant } from "../../../../../types"; -import { ServiceButtonElementConfig } from "../../../elements/types"; -import { LovelacePictureElementEditor } from "../../../types"; +import type { ServiceButtonElementConfig } from "../../../elements/types"; +import type { LovelacePictureElementEditor } from "../../../types"; const serviceButtonElementConfigStruct = object({ type: enums(["service-button", "action-button"]), diff --git a/src/panels/lovelace/editor/config-elements/elements/hui-state-badge-element-editor.ts b/src/panels/lovelace/editor/config-elements/elements/hui-state-badge-element-editor.ts index f5cf03d0fbc8..81571919f6fc 100644 --- a/src/panels/lovelace/editor/config-elements/elements/hui-state-badge-element-editor.ts +++ b/src/panels/lovelace/editor/config-elements/elements/hui-state-badge-element-editor.ts @@ -5,8 +5,8 @@ import { fireEvent } from "../../../../../common/dom/fire_event"; import type { SchemaUnion } from "../../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../../types"; import "../../../../../components/ha-form/ha-form"; -import { LovelacePictureElementEditor } from "../../../types"; -import { StateBadgeElementConfig } from "../../../elements/types"; +import type { LovelacePictureElementEditor } from "../../../types"; +import type { StateBadgeElementConfig } from "../../../elements/types"; import { actionConfigStruct } from "../../structs/action-struct"; const stateBadgeElementConfigStruct = object({ diff --git a/src/panels/lovelace/editor/config-elements/elements/hui-state-icon-element-editor.ts b/src/panels/lovelace/editor/config-elements/elements/hui-state-icon-element-editor.ts index c5ebb70a1904..bee2c275e1a8 100644 --- a/src/panels/lovelace/editor/config-elements/elements/hui-state-icon-element-editor.ts +++ b/src/panels/lovelace/editor/config-elements/elements/hui-state-icon-element-editor.ts @@ -13,8 +13,8 @@ import { fireEvent } from "../../../../../common/dom/fire_event"; import type { SchemaUnion } from "../../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../../types"; import "../../../../../components/ha-form/ha-form"; -import { LovelacePictureElementEditor } from "../../../types"; -import { StateIconElementConfig } from "../../../elements/types"; +import type { LovelacePictureElementEditor } from "../../../types"; +import type { StateIconElementConfig } from "../../../elements/types"; import { actionConfigStruct } from "../../structs/action-struct"; const stateIconElementConfigStruct = object({ diff --git a/src/panels/lovelace/editor/config-elements/elements/hui-state-label-element-editor.ts b/src/panels/lovelace/editor/config-elements/elements/hui-state-label-element-editor.ts index af2043801dac..7c531a38368f 100644 --- a/src/panels/lovelace/editor/config-elements/elements/hui-state-label-element-editor.ts +++ b/src/panels/lovelace/editor/config-elements/elements/hui-state-label-element-editor.ts @@ -5,8 +5,8 @@ import { fireEvent } from "../../../../../common/dom/fire_event"; import type { SchemaUnion } from "../../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../../types"; import "../../../../../components/ha-form/ha-form"; -import { LovelacePictureElementEditor } from "../../../types"; -import { StateLabelElementConfig } from "../../../elements/types"; +import type { LovelacePictureElementEditor } from "../../../types"; +import type { StateLabelElementConfig } from "../../../elements/types"; import { actionConfigStruct } from "../../structs/action-struct"; const stateLabelElementConfigStruct = object({ diff --git a/src/panels/lovelace/editor/config-elements/hui-alarm-modes-card-feature-editor.ts b/src/panels/lovelace/editor/config-elements/hui-alarm-modes-card-feature-editor.ts index b96be97bb013..60855d787f10 100644 --- a/src/panels/lovelace/editor/config-elements/hui-alarm-modes-card-feature-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-alarm-modes-card-feature-editor.ts @@ -1,4 +1,4 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; @@ -11,7 +11,7 @@ import type { } from "../../../../components/ha-form/types"; import { supportedAlarmModes } from "../../../../data/alarm_control_panel"; import type { HomeAssistant } from "../../../../types"; -import { +import type { AlarmModesCardFeatureConfig, LovelaceCardFeatureContext, } from "../../card-features/types"; diff --git a/src/panels/lovelace/editor/config-elements/hui-alarm-panel-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-alarm-panel-card-editor.ts index 74ff40fc225f..63daefefb158 100644 --- a/src/panels/lovelace/editor/config-elements/hui-alarm-panel-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-alarm-panel-card-editor.ts @@ -2,7 +2,7 @@ import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { array, assert, assign, object, optional, string } from "superstruct"; -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { fireEvent } from "../../../../common/dom/fire_event"; import type { LocalizeFunc } from "../../../../common/translations/localize"; import "../../../../components/ha-form/ha-form"; diff --git a/src/panels/lovelace/editor/config-elements/hui-area-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-area-card-editor.ts index dc9eb19d73ce..d73fe9ecd291 100644 --- a/src/panels/lovelace/editor/config-elements/hui-area-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-area-card-editor.ts @@ -23,7 +23,7 @@ import type { LovelaceCardEditor } from "../../types"; import { baseLovelaceCardConfig } from "../structs/base-card-struct"; import { computeDomain } from "../../../../common/entity/compute_domain"; import { caseInsensitiveStringCompare } from "../../../../common/string/compare"; -import { SelectOption } from "../../../../data/selector"; +import type { SelectOption } from "../../../../data/selector"; import { getSensorNumericDeviceClasses } from "../../../../data/sensor"; const cardConfigStruct = assign( diff --git a/src/panels/lovelace/editor/config-elements/hui-button-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-button-card-editor.ts index 277eec42eb48..2e611a435bcc 100644 --- a/src/panels/lovelace/editor/config-elements/hui-button-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-button-card-editor.ts @@ -1,4 +1,5 @@ -import { CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { assert, assign, boolean, object, optional, string } from "superstruct"; diff --git a/src/panels/lovelace/editor/config-elements/hui-calendar-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-calendar-card-editor.ts index c66e08f8c602..8d3de51c1b28 100644 --- a/src/panels/lovelace/editor/config-elements/hui-calendar-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-calendar-card-editor.ts @@ -12,7 +12,7 @@ import { union, } from "superstruct"; import { fireEvent } from "../../../../common/dom/fire_event"; -import { LocalizeFunc } from "../../../../common/translations/localize"; +import type { LocalizeFunc } from "../../../../common/translations/localize"; import "../../../../components/entity/ha-entities-picker"; import "../../../../components/ha-form/ha-form"; import type { SchemaUnion } from "../../../../components/ha-form/types"; diff --git a/src/panels/lovelace/editor/config-elements/hui-card-features-editor.ts b/src/panels/lovelace/editor/config-elements/hui-card-features-editor.ts index 82d28ee169f4..e89417ab36fb 100644 --- a/src/panels/lovelace/editor/config-elements/hui-card-features-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-card-features-editor.ts @@ -1,6 +1,7 @@ import { mdiDelete, mdiDrag, mdiPencil, mdiPlus } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { repeat } from "lit/directives/repeat"; import { fireEvent } from "../../../../common/dom/fire_event"; @@ -10,14 +11,14 @@ import "../../../../components/ha-icon-button"; import "../../../../components/ha-list-item"; import "../../../../components/ha-sortable"; import "../../../../components/ha-svg-icon"; +import type { CustomCardFeatureEntry } from "../../../../data/lovelace_custom_cards"; import { CUSTOM_TYPE_PREFIX, - CustomCardFeatureEntry, getCustomCardFeatures, isCustomType, stripCustomPrefix, } from "../../../../data/lovelace_custom_cards"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; import { supportsAlarmModesCardFeature } from "../../card-features/hui-alarm-modes-card-feature"; import { supportsClimateFanModesCardFeature } from "../../card-features/hui-climate-fan-modes-card-feature"; import { supportsClimateHvacModesCardFeature } from "../../card-features/hui-climate-hvac-modes-card-feature"; @@ -43,7 +44,7 @@ import { supportsTargetTemperatureCardFeature } from "../../card-features/hui-ta import { supportsUpdateActionsCardFeature } from "../../card-features/hui-update-actions-card-feature"; import { supportsVacuumCommandsCardFeature } from "../../card-features/hui-vacuum-commands-card-feature"; import { supportsWaterHeaterOperationModesCardFeature } from "../../card-features/hui-water-heater-operation-modes-card-feature"; -import { LovelaceCardFeatureConfig } from "../../card-features/types"; +import type { LovelaceCardFeatureConfig } from "../../card-features/types"; import { getCardFeatureElementClass } from "../../create-element/create-card-feature-element"; export type FeatureType = LovelaceCardFeatureConfig["type"]; diff --git a/src/panels/lovelace/editor/config-elements/hui-climate-fan-modes-card-feature-editor.ts b/src/panels/lovelace/editor/config-elements/hui-climate-fan-modes-card-feature-editor.ts index 85c505913525..8921289f7bb2 100644 --- a/src/panels/lovelace/editor/config-elements/hui-climate-fan-modes-card-feature-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-climate-fan-modes-card-feature-editor.ts @@ -1,17 +1,17 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../common/dom/fire_event"; -import { FormatEntityAttributeValueFunc } from "../../../../common/translations/entity-state"; -import { LocalizeFunc } from "../../../../common/translations/localize"; +import type { FormatEntityAttributeValueFunc } from "../../../../common/translations/entity-state"; +import type { LocalizeFunc } from "../../../../common/translations/localize"; import "../../../../components/ha-form/ha-form"; import type { HaFormSchema, SchemaUnion, } from "../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../types"; -import { +import type { ClimateFanModesCardFeatureConfig, LovelaceCardFeatureContext, } from "../../card-features/types"; diff --git a/src/panels/lovelace/editor/config-elements/hui-climate-hvac-modes-card-feature-editor.ts b/src/panels/lovelace/editor/config-elements/hui-climate-hvac-modes-card-feature-editor.ts index 87663228aabb..577fec9be9d7 100644 --- a/src/panels/lovelace/editor/config-elements/hui-climate-hvac-modes-card-feature-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-climate-hvac-modes-card-feature-editor.ts @@ -1,4 +1,4 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; @@ -12,7 +12,7 @@ import type { } from "../../../../components/ha-form/types"; import { compareClimateHvacModes } from "../../../../data/climate"; import type { HomeAssistant } from "../../../../types"; -import { +import type { ClimateHvacModesCardFeatureConfig, LovelaceCardFeatureContext, } from "../../card-features/types"; diff --git a/src/panels/lovelace/editor/config-elements/hui-climate-preset-modes-card-feature-editor.ts b/src/panels/lovelace/editor/config-elements/hui-climate-preset-modes-card-feature-editor.ts index 344fc4da8491..75522c063532 100644 --- a/src/panels/lovelace/editor/config-elements/hui-climate-preset-modes-card-feature-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-climate-preset-modes-card-feature-editor.ts @@ -1,17 +1,17 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../common/dom/fire_event"; -import { FormatEntityAttributeValueFunc } from "../../../../common/translations/entity-state"; -import { LocalizeFunc } from "../../../../common/translations/localize"; +import type { FormatEntityAttributeValueFunc } from "../../../../common/translations/entity-state"; +import type { LocalizeFunc } from "../../../../common/translations/localize"; import "../../../../components/ha-form/ha-form"; import type { HaFormSchema, SchemaUnion, } from "../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../types"; -import { +import type { ClimatePresetModesCardFeatureConfig, LovelaceCardFeatureContext, } from "../../card-features/types"; diff --git a/src/panels/lovelace/editor/config-elements/hui-climate-swing-modes-card-feature-editor.ts b/src/panels/lovelace/editor/config-elements/hui-climate-swing-modes-card-feature-editor.ts index a8c4f4c09c3c..b46efbaae7fb 100644 --- a/src/panels/lovelace/editor/config-elements/hui-climate-swing-modes-card-feature-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-climate-swing-modes-card-feature-editor.ts @@ -1,17 +1,17 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../common/dom/fire_event"; -import { FormatEntityAttributeValueFunc } from "../../../../common/translations/entity-state"; -import { LocalizeFunc } from "../../../../common/translations/localize"; +import type { FormatEntityAttributeValueFunc } from "../../../../common/translations/entity-state"; +import type { LocalizeFunc } from "../../../../common/translations/localize"; import "../../../../components/ha-form/ha-form"; import type { HaFormSchema, SchemaUnion, } from "../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../types"; -import { +import type { ClimateSwingModesCardFeatureConfig, LovelaceCardFeatureContext, } from "../../card-features/types"; diff --git a/src/panels/lovelace/editor/config-elements/hui-conditional-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-conditional-card-editor.ts index dbc5d2fb2616..14e8b07430d6 100644 --- a/src/panels/lovelace/editor/config-elements/hui-conditional-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-conditional-card-editor.ts @@ -3,17 +3,19 @@ import "@material/mwc-tab/mwc-tab"; import type { MDCTabBarActivatedEvent } from "@material/tab-bar"; import { mdiCodeBraces, mdiContentCopy, mdiListBoxOutline } from "@mdi/js"; import deepClone from "deep-clone-simple"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { any, array, assert, assign, object, optional } from "superstruct"; import { storage } from "../../../../common/decorators/storage"; -import { HASSDomEvent, fireEvent } from "../../../../common/dom/fire_event"; +import type { HASSDomEvent } from "../../../../common/dom/fire_event"; +import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-alert"; import "../../../../components/ha-button"; import "../../../../components/ha-list-item"; import "../../../../components/ha-svg-icon"; -import { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; -import { LovelaceConfig } from "../../../../data/lovelace/config/types"; +import type { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; +import type { LovelaceConfig } from "../../../../data/lovelace/config/types"; import type { HomeAssistant } from "../../../../types"; import type { ConditionalCardConfig } from "../../cards/types"; import type { LovelaceCardEditor } from "../../types"; diff --git a/src/panels/lovelace/editor/config-elements/hui-entities-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-entities-card-editor.ts index 3f3280a91b53..de46a95c03b2 100644 --- a/src/panels/lovelace/editor/config-elements/hui-entities-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-entities-card-editor.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { any, @@ -16,7 +17,8 @@ import { type, union, } from "superstruct"; -import { fireEvent, HASSDomEvent } from "../../../../common/dom/fire_event"; +import type { HASSDomEvent } from "../../../../common/dom/fire_event"; +import { fireEvent } from "../../../../common/dom/fire_event"; import { customType } from "../../../../common/structs/is-custom-type"; import "../../../../components/ha-card"; import "../../../../components/ha-formfield"; @@ -39,7 +41,7 @@ import { actionConfigStruct } from "../structs/action-struct"; import { baseLovelaceCardConfig } from "../structs/base-card-struct"; import { buttonEntityConfigStruct } from "../structs/button-entity-struct"; import { entitiesConfigStruct } from "../structs/entities-struct"; -import { +import type { EditorTarget, EditDetailElementEvent, SubElementEditorConfig, diff --git a/src/panels/lovelace/editor/config-elements/hui-entity-badge-editor.ts b/src/panels/lovelace/editor/config-elements/hui-entity-badge-editor.ts index 926c0127746a..6735b2741ec2 100644 --- a/src/panels/lovelace/editor/config-elements/hui-entity-badge-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-entity-badge-editor.ts @@ -14,7 +14,7 @@ import { union, } from "superstruct"; import { fireEvent } from "../../../../common/dom/fire_event"; -import { LocalizeFunc } from "../../../../common/translations/localize"; +import type { LocalizeFunc } from "../../../../common/translations/localize"; import "../../../../components/ha-form/ha-form"; import type { HaFormSchema, @@ -26,7 +26,7 @@ import { DISPLAY_TYPES, migrateLegacyEntityBadgeConfig, } from "../../badges/hui-entity-badge"; -import { EntityBadgeConfig } from "../../badges/types"; +import type { EntityBadgeConfig } from "../../badges/types"; import type { LovelaceBadgeEditor } from "../../types"; import "../hui-sub-element-editor"; import { actionConfigStruct } from "../structs/action-struct"; diff --git a/src/panels/lovelace/editor/config-elements/hui-entity-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-entity-card-editor.ts index 4c9388262018..5144acff5944 100644 --- a/src/panels/lovelace/editor/config-elements/hui-entity-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-entity-card-editor.ts @@ -1,9 +1,9 @@ import { assert, assign, boolean, object, optional, string } from "superstruct"; -import { LocalizeFunc } from "../../../../common/translations/localize"; -import { HaFormSchema } from "../../../../components/ha-form/types"; -import { EntityCardConfig } from "../../cards/types"; +import type { LocalizeFunc } from "../../../../common/translations/localize"; +import type { HaFormSchema } from "../../../../components/ha-form/types"; +import type { EntityCardConfig } from "../../cards/types"; import { headerFooterConfigStructs } from "../../header-footer/structs"; -import { LovelaceConfigForm } from "../../types"; +import type { LovelaceConfigForm } from "../../types"; import { baseLovelaceCardConfig } from "../structs/base-card-struct"; const struct = assign( diff --git a/src/panels/lovelace/editor/config-elements/hui-fan-preset-modes-card-feature-editor.ts b/src/panels/lovelace/editor/config-elements/hui-fan-preset-modes-card-feature-editor.ts index acc3cc18319d..92d993dcd7ab 100644 --- a/src/panels/lovelace/editor/config-elements/hui-fan-preset-modes-card-feature-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-fan-preset-modes-card-feature-editor.ts @@ -1,17 +1,17 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../common/dom/fire_event"; -import { FormatEntityAttributeValueFunc } from "../../../../common/translations/entity-state"; -import { LocalizeFunc } from "../../../../common/translations/localize"; +import type { FormatEntityAttributeValueFunc } from "../../../../common/translations/entity-state"; +import type { LocalizeFunc } from "../../../../common/translations/localize"; import "../../../../components/ha-form/ha-form"; import type { HaFormSchema, SchemaUnion, } from "../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../types"; -import { +import type { FanPresetModesCardFeatureConfig, LovelaceCardFeatureContext, } from "../../card-features/types"; diff --git a/src/panels/lovelace/editor/config-elements/hui-form-editor.ts b/src/panels/lovelace/editor/config-elements/hui-form-editor.ts index 0625744d9cc6..a0bb712ebf5f 100644 --- a/src/panels/lovelace/editor/config-elements/hui-form-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-form-editor.ts @@ -1,11 +1,12 @@ -import { CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import { capitalizeFirstLetter } from "../../../../common/string/capitalize-first-letter"; -import { LocalizeFunc } from "../../../../common/translations/localize"; +import type { LocalizeFunc } from "../../../../common/translations/localize"; import "../../../../components/ha-form/ha-form"; import type { HaFormSchema } from "../../../../components/ha-form/types"; -import { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; +import type { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; import type { HomeAssistant } from "../../../../types"; import type { LovelaceGenericElementEditor } from "../../types"; import { configElementStyle } from "./config-elements-style"; diff --git a/src/panels/lovelace/editor/config-elements/hui-gauge-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-gauge-card-editor.ts index b2e6bd354362..ddea1b8b71ca 100644 --- a/src/panels/lovelace/editor/config-elements/hui-gauge-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-gauge-card-editor.ts @@ -21,7 +21,7 @@ import type { LovelaceCardEditor } from "../../types"; import { actionConfigStruct } from "../structs/action-struct"; import { baseLovelaceCardConfig } from "../structs/base-card-struct"; import { DEFAULT_MIN, DEFAULT_MAX } from "../../cards/hui-gauge-card"; -import { UiAction } from "../../components/hui-action-editor"; +import type { UiAction } from "../../components/hui-action-editor"; const TAP_ACTIONS: UiAction[] = ["navigate", "url", "perform-action", "none"]; diff --git a/src/panels/lovelace/editor/config-elements/hui-glance-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-glance-card-editor.ts index aff661bc2687..3ef29aaf100d 100644 --- a/src/panels/lovelace/editor/config-elements/hui-glance-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-glance-card-editor.ts @@ -15,7 +15,7 @@ import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-form/ha-form"; import type { SchemaUnion } from "../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../types"; -import { ConfigEntity, GlanceCardConfig } from "../../cards/types"; +import type { ConfigEntity, GlanceCardConfig } from "../../cards/types"; import "../../components/hui-entity-editor"; import type { LovelaceCardEditor } from "../../types"; import { processEditorEntities } from "../process-editor-entities"; diff --git a/src/panels/lovelace/editor/config-elements/hui-graph-footer-editor.ts b/src/panels/lovelace/editor/config-elements/hui-graph-footer-editor.ts index ec09710a6a15..ae15ee607905 100644 --- a/src/panels/lovelace/editor/config-elements/hui-graph-footer-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-graph-footer-editor.ts @@ -1,14 +1,16 @@ -import { CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { assert } from "superstruct"; -import { fireEvent, HASSDomEvent } from "../../../../common/dom/fire_event"; +import type { HASSDomEvent } from "../../../../common/dom/fire_event"; +import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/entity/ha-entity-picker"; import "../../../../components/ha-formfield"; import "../../../../components/ha-switch"; import "../../../../components/ha-textfield"; import type { HomeAssistant } from "../../../../types"; import { graphHeaderFooterConfigStruct } from "../../header-footer/structs"; -import { GraphHeaderFooterConfig } from "../../header-footer/types"; +import type { GraphHeaderFooterConfig } from "../../header-footer/types"; import type { LovelaceCardEditor } from "../../types"; import type { EditorTarget, EntitiesEditorEvent } from "../types"; import { configElementStyle } from "./config-elements-style"; diff --git a/src/panels/lovelace/editor/config-elements/hui-heading-badges-editor.ts b/src/panels/lovelace/editor/config-elements/hui-heading-badges-editor.ts index c102f3d37ed2..f15b38952262 100644 --- a/src/panels/lovelace/editor/config-elements/hui-heading-badges-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-heading-badges-editor.ts @@ -1,6 +1,7 @@ import { mdiDelete, mdiDrag, mdiPencil, mdiPlus } from "@mdi/js"; -import { ComboBoxLightOpenedChangedEvent } from "@vaadin/combo-box/vaadin-combo-box-light"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { ComboBoxLightOpenedChangedEvent } from "@vaadin/combo-box/vaadin-combo-box-light"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { repeat } from "lit/directives/repeat"; import { fireEvent } from "../../../../common/dom/fire_event"; @@ -13,8 +14,8 @@ import "../../../../components/ha-icon-button"; import "../../../../components/ha-list-item"; import "../../../../components/ha-sortable"; import "../../../../components/ha-svg-icon"; -import { HomeAssistant } from "../../../../types"; -import { LovelaceHeadingBadgeConfig } from "../../heading-badges/types"; +import type { HomeAssistant } from "../../../../types"; +import type { LovelaceHeadingBadgeConfig } from "../../heading-badges/types"; declare global { interface HASSDomEvents { diff --git a/src/panels/lovelace/editor/config-elements/hui-heading-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-heading-card-editor.ts index 3ba288a0a2bc..e2b1c985bcb1 100644 --- a/src/panels/lovelace/editor/config-elements/hui-heading-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-heading-card-editor.ts @@ -12,8 +12,9 @@ import { optional, string, } from "superstruct"; -import { fireEvent, HASSDomEvent } from "../../../../common/dom/fire_event"; -import { LocalizeFunc } from "../../../../common/translations/localize"; +import type { HASSDomEvent } from "../../../../common/dom/fire_event"; +import { fireEvent } from "../../../../common/dom/fire_event"; +import type { LocalizeFunc } from "../../../../common/translations/localize"; import "../../../../components/ha-expansion-panel"; import "../../../../components/ha-form/ha-form"; import type { @@ -24,15 +25,15 @@ import "../../../../components/ha-svg-icon"; import type { HomeAssistant } from "../../../../types"; import { migrateHeadingCardConfig } from "../../cards/hui-heading-card"; import type { HeadingCardConfig } from "../../cards/types"; -import { UiAction } from "../../components/hui-action-editor"; -import { +import type { UiAction } from "../../components/hui-action-editor"; +import type { EntityHeadingBadgeConfig, LovelaceHeadingBadgeConfig, } from "../../heading-badges/types"; import type { LovelaceCardEditor } from "../../types"; import { actionConfigStruct } from "../structs/action-struct"; import { baseLovelaceCardConfig } from "../structs/base-card-struct"; -import { EditSubElementEvent } from "../types"; +import type { EditSubElementEvent } from "../types"; import { configElementStyle } from "./config-elements-style"; import "./hui-heading-badges-editor"; diff --git a/src/panels/lovelace/editor/config-elements/hui-history-graph-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-history-graph-card-editor.ts index 862459b27797..2b76aa30a97e 100644 --- a/src/panels/lovelace/editor/config-elements/hui-history-graph-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-history-graph-card-editor.ts @@ -1,4 +1,5 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { diff --git a/src/panels/lovelace/editor/config-elements/hui-humidifier-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-humidifier-card-editor.ts index 7ce387121db8..16ff0caff2fa 100644 --- a/src/panels/lovelace/editor/config-elements/hui-humidifier-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-humidifier-card-editor.ts @@ -11,7 +11,8 @@ import { optional, string, } from "superstruct"; -import { HASSDomEvent, fireEvent } from "../../../../common/dom/fire_event"; +import type { HASSDomEvent } from "../../../../common/dom/fire_event"; +import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-expansion-panel"; import "../../../../components/ha-form/ha-form"; import type { @@ -20,14 +21,14 @@ import type { } from "../../../../components/ha-form/types"; import "../../../../components/ha-svg-icon"; import type { HomeAssistant } from "../../../../types"; -import { +import type { LovelaceCardFeatureConfig, LovelaceCardFeatureContext, } from "../../card-features/types"; import type { HumidifierCardConfig } from "../../cards/types"; import type { LovelaceCardEditor } from "../../types"; import { baseLovelaceCardConfig } from "../structs/base-card-struct"; -import { EditDetailElementEvent, EditSubElementEvent } from "../types"; +import type { EditDetailElementEvent, EditSubElementEvent } from "../types"; import { configElementStyle } from "./config-elements-style"; import "./hui-card-features-editor"; import type { FeatureType } from "./hui-card-features-editor"; diff --git a/src/panels/lovelace/editor/config-elements/hui-humidifier-modes-card-feature-editor.ts b/src/panels/lovelace/editor/config-elements/hui-humidifier-modes-card-feature-editor.ts index 92e6f778bb50..0c634830592f 100644 --- a/src/panels/lovelace/editor/config-elements/hui-humidifier-modes-card-feature-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-humidifier-modes-card-feature-editor.ts @@ -1,17 +1,17 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../common/dom/fire_event"; -import { FormatEntityAttributeValueFunc } from "../../../../common/translations/entity-state"; -import { LocalizeFunc } from "../../../../common/translations/localize"; +import type { FormatEntityAttributeValueFunc } from "../../../../common/translations/entity-state"; +import type { LocalizeFunc } from "../../../../common/translations/localize"; import "../../../../components/ha-form/ha-form"; import type { HaFormSchema, SchemaUnion, } from "../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../types"; -import { +import type { HumidifierModesCardFeatureConfig, LovelaceCardFeatureContext, } from "../../card-features/types"; diff --git a/src/panels/lovelace/editor/config-elements/hui-lawn-mower-commands-card-feature-editor.ts b/src/panels/lovelace/editor/config-elements/hui-lawn-mower-commands-card-feature-editor.ts index 1309e7a04a7c..d4c7933ae01a 100644 --- a/src/panels/lovelace/editor/config-elements/hui-lawn-mower-commands-card-feature-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-lawn-mower-commands-card-feature-editor.ts @@ -1,17 +1,18 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../common/dom/fire_event"; import type { LocalizeFunc } from "../../../../common/translations/localize"; import type { SchemaUnion } from "../../../../components/ha-form/types"; +import "../../../../components/ha-form/ha-form"; import type { HomeAssistant } from "../../../../types"; import { supportsLawnMowerCommand } from "../../card-features/hui-lawn-mower-commands-card-feature"; -import { - LAWN_MOWER_COMMANDS, +import type { LawnMowerCommandsCardFeatureConfig, LovelaceCardFeatureContext, } from "../../card-features/types"; +import { LAWN_MOWER_COMMANDS } from "../../card-features/types"; import type { LovelaceCardFeatureEditor } from "../../types"; @customElement("hui-lawn-mower-commands-card-feature-editor") diff --git a/src/panels/lovelace/editor/config-elements/hui-light-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-light-card-editor.ts index b32aa485d0f1..601f59a2c880 100644 --- a/src/panels/lovelace/editor/config-elements/hui-light-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-light-card-editor.ts @@ -1,4 +1,5 @@ -import { CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { assert, assign, object, optional, string } from "superstruct"; import { fireEvent } from "../../../../common/dom/fire_event"; diff --git a/src/panels/lovelace/editor/config-elements/hui-map-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-map-card-editor.ts index 41a32456e758..c3aa69cc8c6f 100644 --- a/src/panels/lovelace/editor/config-elements/hui-map-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-map-card-editor.ts @@ -1,5 +1,6 @@ import { mdiPalette } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { array, @@ -17,22 +18,22 @@ import { fireEvent } from "../../../../common/dom/fire_event"; import { hasLocation } from "../../../../common/entity/has_location"; import { computeDomain } from "../../../../common/entity/compute_domain"; import "../../../../components/ha-form/ha-form"; -import { SchemaUnion } from "../../../../components/ha-form/types"; +import type { SchemaUnion } from "../../../../components/ha-form/types"; import type { SelectSelector } from "../../../../data/selector"; import "../../../../components/ha-formfield"; import "../../../../components/ha-switch"; import "../../../../components/ha-selector/ha-selector-select"; -import { HomeAssistant, ValueChangedEvent } from "../../../../types"; +import type { HomeAssistant, ValueChangedEvent } from "../../../../types"; import { DEFAULT_HOURS_TO_SHOW, DEFAULT_ZOOM } from "../../cards/hui-map-card"; -import { MapCardConfig } from "../../cards/types"; +import type { MapCardConfig } from "../../cards/types"; import "../../components/hui-entity-editor"; -import { EntityConfig } from "../../entity-rows/types"; -import { LovelaceCardEditor } from "../../types"; +import type { EntityConfig } from "../../entity-rows/types"; +import type { LovelaceCardEditor } from "../../types"; import { processEditorEntities } from "../process-editor-entities"; import { baseLovelaceCardConfig } from "../structs/base-card-struct"; -import { EntitiesEditorEvent } from "../types"; +import type { EntitiesEditorEvent } from "../types"; import { configElementStyle } from "./config-elements-style"; -import { LocalizeFunc } from "../../../../common/translations/localize"; +import type { LocalizeFunc } from "../../../../common/translations/localize"; export const mapEntitiesConfigStruct = union([ object({ diff --git a/src/panels/lovelace/editor/config-elements/hui-media-control-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-media-control-card-editor.ts index 71596a1293e8..6602b02d7e2a 100644 --- a/src/panels/lovelace/editor/config-elements/hui-media-control-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-media-control-card-editor.ts @@ -4,11 +4,11 @@ import { assert, assign, object, optional, string } from "superstruct"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/entity/ha-entity-picker"; import "../../../../components/ha-theme-picker"; -import { HomeAssistant } from "../../../../types"; -import { MediaControlCardConfig } from "../../cards/types"; -import { LovelaceCardEditor } from "../../types"; +import type { HomeAssistant } from "../../../../types"; +import type { MediaControlCardConfig } from "../../cards/types"; +import type { LovelaceCardEditor } from "../../types"; import { baseLovelaceCardConfig } from "../structs/base-card-struct"; -import { EditorTarget, EntitiesEditorEvent } from "../types"; +import type { EditorTarget, EntitiesEditorEvent } from "../types"; const cardConfigStruct = assign( baseLovelaceCardConfig, diff --git a/src/panels/lovelace/editor/config-elements/hui-numeric-input-card-feature-editor.ts b/src/panels/lovelace/editor/config-elements/hui-numeric-input-card-feature-editor.ts index 83d7cd4a19b0..da7e4ec33c28 100644 --- a/src/panels/lovelace/editor/config-elements/hui-numeric-input-card-feature-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-numeric-input-card-feature-editor.ts @@ -5,12 +5,12 @@ import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-form/ha-form"; import type { SchemaUnion } from "../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../types"; -import { +import type { NumericInputCardFeatureConfig, LovelaceCardFeatureContext, } from "../../card-features/types"; import type { LovelaceCardFeatureEditor } from "../../types"; -import { LocalizeFunc } from "../../../../common/translations/localize"; +import type { LocalizeFunc } from "../../../../common/translations/localize"; @customElement("hui-numeric-input-card-feature-editor") export class HuiNumericInputCardFeatureEditor diff --git a/src/panels/lovelace/editor/config-elements/hui-picture-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-picture-card-editor.ts index 6bd9d93cba2a..12796b572cfa 100644 --- a/src/panels/lovelace/editor/config-elements/hui-picture-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-picture-card-editor.ts @@ -2,12 +2,12 @@ import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { assert, assign, object, optional, string } from "superstruct"; import { fireEvent } from "../../../../common/dom/fire_event"; -import { SchemaUnion } from "../../../../components/ha-form/types"; +import type { SchemaUnion } from "../../../../components/ha-form/types"; import "../../../../components/ha-theme-picker"; -import { HomeAssistant } from "../../../../types"; -import { PictureCardConfig } from "../../cards/types"; +import type { HomeAssistant } from "../../../../types"; +import type { PictureCardConfig } from "../../cards/types"; import "../../components/hui-action-editor"; -import { LovelaceCardEditor } from "../../types"; +import type { LovelaceCardEditor } from "../../types"; import { actionConfigStruct } from "../structs/action-struct"; import { baseLovelaceCardConfig } from "../structs/base-card-struct"; diff --git a/src/panels/lovelace/editor/config-elements/hui-picture-elements-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-picture-elements-card-editor.ts index a8147777bb48..6e1f761f30b7 100644 --- a/src/panels/lovelace/editor/config-elements/hui-picture-elements-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-picture-elements-card-editor.ts @@ -1,4 +1,5 @@ -import { CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { any, @@ -11,7 +12,8 @@ import { type, } from "superstruct"; import memoizeOne from "memoize-one"; -import { fireEvent, HASSDomEvent } from "../../../../common/dom/fire_event"; +import type { HASSDomEvent } from "../../../../common/dom/fire_event"; +import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-card"; import "../../../../components/ha-form/ha-form"; import "../../../../components/ha-icon"; @@ -21,12 +23,12 @@ import type { PictureElementsCardConfig } from "../../cards/types"; import type { LovelaceCardEditor } from "../../types"; import "../hui-sub-element-editor"; import { baseLovelaceCardConfig } from "../structs/base-card-struct"; -import { EditDetailElementEvent, SubElementEditorConfig } from "../types"; +import type { EditDetailElementEvent, SubElementEditorConfig } from "../types"; import { configElementStyle } from "./config-elements-style"; import "../hui-picture-elements-card-row-editor"; -import { LovelaceElementConfig } from "../../elements/types"; -import { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; -import { LocalizeFunc } from "../../../../common/translations/localize"; +import type { LovelaceElementConfig } from "../../elements/types"; +import type { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; +import type { LocalizeFunc } from "../../../../common/translations/localize"; const genericElementConfigStruct = type({ type: string(), diff --git a/src/panels/lovelace/editor/config-elements/hui-picture-entity-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-picture-entity-card-editor.ts index 5cc9d84edf0b..1b874b6a2acd 100644 --- a/src/panels/lovelace/editor/config-elements/hui-picture-entity-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-picture-entity-card-editor.ts @@ -1,4 +1,5 @@ -import { CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { assert, assign, boolean, object, optional, string } from "superstruct"; import { fireEvent } from "../../../../common/dom/fire_event"; diff --git a/src/panels/lovelace/editor/config-elements/hui-picture-glance-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-picture-glance-card-editor.ts index 8ed4b388db9f..86c477c5199b 100644 --- a/src/panels/lovelace/editor/config-elements/hui-picture-glance-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-picture-glance-card-editor.ts @@ -1,4 +1,5 @@ -import { CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { array, assert, assign, object, optional, string } from "superstruct"; import { fireEvent } from "../../../../common/dom/fire_event"; diff --git a/src/panels/lovelace/editor/config-elements/hui-select-options-card-feature-editor.ts b/src/panels/lovelace/editor/config-elements/hui-select-options-card-feature-editor.ts index 65b4dc6faf12..c9d63bad8a8b 100644 --- a/src/panels/lovelace/editor/config-elements/hui-select-options-card-feature-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-select-options-card-feature-editor.ts @@ -1,16 +1,16 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../common/dom/fire_event"; -import { FormatEntityStateFunc } from "../../../../common/translations/entity-state"; +import type { FormatEntityStateFunc } from "../../../../common/translations/entity-state"; import "../../../../components/ha-form/ha-form"; import type { HaFormSchema, SchemaUnion, } from "../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../types"; -import { +import type { LovelaceCardFeatureContext, SelectOptionsCardFeatureConfig, } from "../../card-features/types"; diff --git a/src/panels/lovelace/editor/config-elements/hui-sensor-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-sensor-card-editor.ts index 25b6846a5ebc..7dd201d53460 100644 --- a/src/panels/lovelace/editor/config-elements/hui-sensor-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-sensor-card-editor.ts @@ -1,4 +1,5 @@ -import { CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { assert, diff --git a/src/panels/lovelace/editor/config-elements/hui-stack-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-stack-card-editor.ts index 896ea2129685..1d5d945dbcc5 100644 --- a/src/panels/lovelace/editor/config-elements/hui-stack-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-stack-card-editor.ts @@ -9,7 +9,8 @@ import { import "@polymer/paper-tabs"; import "@polymer/paper-tabs/paper-tab"; import deepClone from "deep-clone-simple"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { any, @@ -25,21 +26,22 @@ import type { SchemaUnion, } from "../../../../components/ha-form/types"; import { storage } from "../../../../common/decorators/storage"; -import { HASSDomEvent, fireEvent } from "../../../../common/dom/fire_event"; +import type { HASSDomEvent } from "../../../../common/dom/fire_event"; +import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-icon-button"; import "../../../../components/ha-icon-button-arrow-prev"; import "../../../../components/ha-icon-button-arrow-next"; import type { LovelaceCardConfig } from "../../../../data/lovelace/config/card"; import type { LovelaceConfig } from "../../../../data/lovelace/config/types"; -import { HomeAssistant } from "../../../../types"; -import { StackCardConfig } from "../../cards/types"; -import { LovelaceCardEditor } from "../../types"; +import type { HomeAssistant } from "../../../../types"; +import type { StackCardConfig } from "../../cards/types"; +import type { LovelaceCardEditor } from "../../types"; import "../card-editor/hui-card-element-editor"; import type { HuiCardElementEditor } from "../card-editor/hui-card-element-editor"; import "../card-editor/hui-card-picker"; import type { ConfigChangedEvent } from "../hui-element-editor"; import { baseLovelaceCardConfig } from "../structs/base-card-struct"; -import { GUIModeChangedEvent } from "../types"; +import type { GUIModeChangedEvent } from "../types"; import { configElementStyle } from "./config-elements-style"; const cardConfigStruct = assign( diff --git a/src/panels/lovelace/editor/config-elements/hui-state-label-badge-editor.ts b/src/panels/lovelace/editor/config-elements/hui-state-label-badge-editor.ts index cfeefc476dbe..8c5d047bf534 100644 --- a/src/panels/lovelace/editor/config-elements/hui-state-label-badge-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-state-label-badge-editor.ts @@ -1,7 +1,7 @@ import { customElement } from "lit/decorators"; import { assert, assign, boolean, object, optional, string } from "superstruct"; import "../../../../components/ha-form/ha-form"; -import { EntityBadgeConfig } from "../../badges/types"; +import type { EntityBadgeConfig } from "../../badges/types"; import "../hui-sub-element-editor"; import { actionConfigStruct } from "../structs/action-struct"; import { baseLovelaceBadgeConfig } from "../structs/base-badge-struct"; diff --git a/src/panels/lovelace/editor/config-elements/hui-statistic-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-statistic-card-editor.ts index 0287be386251..4702abe33810 100644 --- a/src/panels/lovelace/editor/config-elements/hui-statistic-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-statistic-card-editor.ts @@ -3,15 +3,17 @@ import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { any, assert, assign, object, optional, string } from "superstruct"; import { fireEvent } from "../../../../common/dom/fire_event"; -import { LocalizeFunc } from "../../../../common/translations/localize"; +import type { LocalizeFunc } from "../../../../common/translations/localize"; import { deepEqual } from "../../../../common/util/deep-equal"; import "../../../../components/ha-form/ha-form"; import type { SchemaUnion } from "../../../../components/ha-form/types"; +import type { + StatisticsMetaData, + StatisticType, +} from "../../../../data/recorder"; import { getStatisticMetadata, - StatisticsMetaData, statisticsMetaHasType, - StatisticType, } from "../../../../data/recorder"; import type { HomeAssistant } from "../../../../types"; import type { StatisticCardConfig } from "../../cards/types"; diff --git a/src/panels/lovelace/editor/config-elements/hui-statistics-graph-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-statistics-graph-card-editor.ts index fb236112f177..87cb9e42bf7d 100644 --- a/src/panels/lovelace/editor/config-elements/hui-statistics-graph-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-statistics-graph-card-editor.ts @@ -1,11 +1,5 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { @@ -28,13 +22,15 @@ import { supportedStatTypeMap } from "../../../../components/chart/statistics-ch import "../../../../components/entity/ha-statistics-picker"; import "../../../../components/ha-form/ha-form"; import type { HaFormSchema } from "../../../../components/ha-form/types"; +import type { + StatisticsMetaData, + StatisticType, +} from "../../../../data/recorder"; import { getDisplayUnit, getStatisticMetadata, isExternalStatistic, - StatisticsMetaData, statisticsMetaHasType, - StatisticType, } from "../../../../data/recorder"; import type { HomeAssistant } from "../../../../types"; import type { StatisticsGraphCardConfig } from "../../cards/types"; diff --git a/src/panels/lovelace/editor/config-elements/hui-thermostat-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-thermostat-card-editor.ts index 1067ada35063..177f335e9094 100644 --- a/src/panels/lovelace/editor/config-elements/hui-thermostat-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-thermostat-card-editor.ts @@ -11,7 +11,8 @@ import { optional, string, } from "superstruct"; -import { HASSDomEvent, fireEvent } from "../../../../common/dom/fire_event"; +import type { HASSDomEvent } from "../../../../common/dom/fire_event"; +import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-expansion-panel"; import "../../../../components/ha-form/ha-form"; import type { @@ -20,14 +21,14 @@ import type { } from "../../../../components/ha-form/types"; import "../../../../components/ha-svg-icon"; import type { HomeAssistant } from "../../../../types"; -import { +import type { LovelaceCardFeatureConfig, LovelaceCardFeatureContext, } from "../../card-features/types"; import type { ThermostatCardConfig } from "../../cards/types"; import type { LovelaceCardEditor } from "../../types"; import { baseLovelaceCardConfig } from "../structs/base-card-struct"; -import { EditDetailElementEvent, EditSubElementEvent } from "../types"; +import type { EditDetailElementEvent, EditSubElementEvent } from "../types"; import { configElementStyle } from "./config-elements-style"; import "./hui-card-features-editor"; import type { FeatureType } from "./hui-card-features-editor"; diff --git a/src/panels/lovelace/editor/config-elements/hui-tile-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-tile-card-editor.ts index 7990f21eaab7..710536903b98 100644 --- a/src/panels/lovelace/editor/config-elements/hui-tile-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-tile-card-editor.ts @@ -13,7 +13,8 @@ import { string, union, } from "superstruct"; -import { HASSDomEvent, fireEvent } from "../../../../common/dom/fire_event"; +import type { HASSDomEvent } from "../../../../common/dom/fire_event"; +import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-expansion-panel"; import "../../../../components/ha-form/ha-form"; import type { @@ -22,7 +23,7 @@ import type { } from "../../../../components/ha-form/types"; import "../../../../components/ha-svg-icon"; import type { HomeAssistant } from "../../../../types"; -import { +import type { LovelaceCardFeatureConfig, LovelaceCardFeatureContext, } from "../../card-features/types"; @@ -31,7 +32,7 @@ import type { TileCardConfig } from "../../cards/types"; import type { LovelaceCardEditor } from "../../types"; import { actionConfigStruct } from "../structs/action-struct"; import { baseLovelaceCardConfig } from "../structs/base-card-struct"; -import { EditDetailElementEvent, EditSubElementEvent } from "../types"; +import type { EditDetailElementEvent, EditSubElementEvent } from "../types"; import { configElementStyle } from "./config-elements-style"; import "./hui-card-features-editor"; diff --git a/src/panels/lovelace/editor/config-elements/hui-todo-list-editor.ts b/src/panels/lovelace/editor/config-elements/hui-todo-list-editor.ts index 49c1a8a15341..6179225a2597 100644 --- a/src/panels/lovelace/editor/config-elements/hui-todo-list-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-todo-list-editor.ts @@ -1,15 +1,16 @@ -import { CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { assert, assign, boolean, object, optional, string } from "superstruct"; import { isComponentLoaded } from "../../../../common/config/is_component_loaded"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-alert"; import "../../../../components/ha-form/ha-form"; -import { HomeAssistant } from "../../../../types"; -import { TodoListCardConfig } from "../../cards/types"; -import { LovelaceCardEditor } from "../../types"; +import type { HomeAssistant } from "../../../../types"; +import type { TodoListCardConfig } from "../../cards/types"; +import type { LovelaceCardEditor } from "../../types"; import { baseLovelaceCardConfig } from "../structs/base-card-struct"; -import { SchemaUnion } from "../../../../components/ha-form/types"; +import type { SchemaUnion } from "../../../../components/ha-form/types"; import { configElementStyle } from "./config-elements-style"; const cardConfigStruct = assign( diff --git a/src/panels/lovelace/editor/config-elements/hui-update-actions-card-feature-editor.ts b/src/panels/lovelace/editor/config-elements/hui-update-actions-card-feature-editor.ts index f1478f090efa..201fd343bb35 100644 --- a/src/panels/lovelace/editor/config-elements/hui-update-actions-card-feature-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-update-actions-card-feature-editor.ts @@ -6,7 +6,7 @@ import type { LocalizeFunc } from "../../../../common/translations/localize"; import "../../../../components/ha-form/ha-form"; import type { SchemaUnion } from "../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../types"; -import { +import type { LovelaceCardFeatureContext, UpdateActionsCardFeatureConfig, } from "../../card-features/types"; diff --git a/src/panels/lovelace/editor/config-elements/hui-vacuum-commands-card-feature-editor.ts b/src/panels/lovelace/editor/config-elements/hui-vacuum-commands-card-feature-editor.ts index 0d11ddcb7431..0baa887764db 100644 --- a/src/panels/lovelace/editor/config-elements/hui-vacuum-commands-card-feature-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-vacuum-commands-card-feature-editor.ts @@ -1,17 +1,18 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../common/dom/fire_event"; import type { LocalizeFunc } from "../../../../common/translations/localize"; import type { SchemaUnion } from "../../../../components/ha-form/types"; +import "../../../../components/ha-form/ha-form"; import type { HomeAssistant } from "../../../../types"; import { supportsVacuumCommand } from "../../card-features/hui-vacuum-commands-card-feature"; -import { +import type { LovelaceCardFeatureContext, VacuumCommandsCardFeatureConfig, - VACUUM_COMMANDS, } from "../../card-features/types"; +import { VACUUM_COMMANDS } from "../../card-features/types"; import type { LovelaceCardFeatureEditor } from "../../types"; @customElement("hui-vacuum-commands-card-feature-editor") diff --git a/src/panels/lovelace/editor/config-elements/hui-water-heater-operation-modes-card-feature-editor.ts b/src/panels/lovelace/editor/config-elements/hui-water-heater-operation-modes-card-feature-editor.ts index aad60f9034c6..d793ec81e327 100644 --- a/src/panels/lovelace/editor/config-elements/hui-water-heater-operation-modes-card-feature-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-water-heater-operation-modes-card-feature-editor.ts @@ -1,4 +1,4 @@ -import { HassEntity } from "home-assistant-js-websocket"; +import type { HassEntity } from "home-assistant-js-websocket"; import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; @@ -10,7 +10,7 @@ import type { SchemaUnion, } from "../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../types"; -import { +import type { WaterHeaterOperationModesCardFeatureConfig, LovelaceCardFeatureContext, } from "../../card-features/types"; diff --git a/src/panels/lovelace/editor/config-util.ts b/src/panels/lovelace/editor/config-util.ts index 7d467d9aaa4b..e04e4206ff98 100644 --- a/src/panels/lovelace/editor/config-util.ts +++ b/src/panels/lovelace/editor/config-util.ts @@ -1,18 +1,13 @@ -import { - ensureBadgeConfig, - LovelaceBadgeConfig, -} from "../../../data/lovelace/config/badge"; -import { LovelaceCardConfig } from "../../../data/lovelace/config/card"; -import { LovelaceSectionRawConfig } from "../../../data/lovelace/config/section"; -import { LovelaceConfig } from "../../../data/lovelace/config/types"; -import { - LovelaceViewConfig, - isStrategyView, -} from "../../../data/lovelace/config/view"; +import type { LovelaceBadgeConfig } from "../../../data/lovelace/config/badge"; +import { ensureBadgeConfig } from "../../../data/lovelace/config/badge"; +import type { LovelaceCardConfig } from "../../../data/lovelace/config/card"; +import type { LovelaceSectionRawConfig } from "../../../data/lovelace/config/section"; +import type { LovelaceConfig } from "../../../data/lovelace/config/types"; +import type { LovelaceViewConfig } from "../../../data/lovelace/config/view"; +import { isStrategyView } from "../../../data/lovelace/config/view"; import type { HomeAssistant } from "../../../types"; +import type { LovelaceCardPath, LovelaceContainerPath } from "./lovelace-path"; import { - LovelaceCardPath, - LovelaceContainerPath, findLovelaceContainer, findLovelaceItems, getLovelaceContainerPath, diff --git a/src/panels/lovelace/editor/dashboard-strategy-editor/dialogs/dialog-dashboard-strategy-editor.ts b/src/panels/lovelace/editor/dashboard-strategy-editor/dialogs/dialog-dashboard-strategy-editor.ts index f2b232028313..3335dfcf4f5b 100644 --- a/src/panels/lovelace/editor/dashboard-strategy-editor/dialogs/dialog-dashboard-strategy-editor.ts +++ b/src/panels/lovelace/editor/dashboard-strategy-editor/dialogs/dialog-dashboard-strategy-editor.ts @@ -4,23 +4,25 @@ import { mdiCodeBraces, mdiDotsVertical, } from "@mdi/js"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; -import { HASSDomEvent, fireEvent } from "../../../../../common/dom/fire_event"; +import type { HASSDomEvent } from "../../../../../common/dom/fire_event"; +import { fireEvent } from "../../../../../common/dom/fire_event"; import { stopPropagation } from "../../../../../common/dom/stop_propagation"; import "../../../../../components/ha-button"; import "../../../../../components/ha-button-menu"; import "../../../../../components/ha-dialog"; import "../../../../../components/ha-dialog-header"; import "../../../../../components/ha-icon-button"; -import { LovelaceStrategyConfig } from "../../../../../data/lovelace/config/strategy"; +import type { LovelaceStrategyConfig } from "../../../../../data/lovelace/config/strategy"; import { haStyleDialog } from "../../../../../resources/styles"; import type { HomeAssistant } from "../../../../../types"; import { showSaveSuccessToast } from "../../../../../util/toast-saved-success"; import "../hui-dashboard-strategy-element-editor"; import type { HuiDashboardStrategyElementEditor } from "../hui-dashboard-strategy-element-editor"; -import { ConfigChangedEvent } from "../../hui-element-editor"; -import { GUIModeChangedEvent } from "../../types"; +import type { ConfigChangedEvent } from "../../hui-element-editor"; +import type { GUIModeChangedEvent } from "../../types"; import { cleanLegacyStrategyConfig } from "../../../strategies/legacy-strategy"; import type { DashboardStrategyEditorDialogParams } from "./show-dialog-dashboard-strategy-editor"; diff --git a/src/panels/lovelace/editor/dashboard-strategy-editor/dialogs/show-dialog-dashboard-strategy-editor.ts b/src/panels/lovelace/editor/dashboard-strategy-editor/dialogs/show-dialog-dashboard-strategy-editor.ts index d7571464f926..6e8749a431c9 100644 --- a/src/panels/lovelace/editor/dashboard-strategy-editor/dialogs/show-dialog-dashboard-strategy-editor.ts +++ b/src/panels/lovelace/editor/dashboard-strategy-editor/dialogs/show-dialog-dashboard-strategy-editor.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../../../common/dom/fire_event"; -import { LovelaceDashboardStrategyConfig } from "../../../../../data/lovelace/config/types"; +import type { LovelaceDashboardStrategyConfig } from "../../../../../data/lovelace/config/types"; export interface DashboardStrategyEditorDialogParams { config: LovelaceDashboardStrategyConfig; diff --git a/src/panels/lovelace/editor/dashboard-strategy-editor/hui-dashboard-strategy-element-editor.ts b/src/panels/lovelace/editor/dashboard-strategy-editor/hui-dashboard-strategy-element-editor.ts index b90eae0ade77..195dbec647c0 100644 --- a/src/panels/lovelace/editor/dashboard-strategy-editor/hui-dashboard-strategy-element-editor.ts +++ b/src/panels/lovelace/editor/dashboard-strategy-editor/hui-dashboard-strategy-element-editor.ts @@ -1,7 +1,7 @@ import { customElement } from "lit/decorators"; -import { LovelaceDashboardStrategyConfig } from "../../../../data/lovelace/config/types"; +import type { LovelaceDashboardStrategyConfig } from "../../../../data/lovelace/config/types"; import { getLovelaceStrategy } from "../../strategies/get-strategy"; -import { LovelaceStrategyEditor } from "../../strategies/types"; +import type { LovelaceStrategyEditor } from "../../strategies/types"; import { HuiTypedElementEditor } from "../hui-typed-element-editor"; @customElement("hui-dashboard-strategy-element-editor") diff --git a/src/panels/lovelace/editor/dashboard-strategy-editor/hui-iframe-dashboard-strategy-editor.ts b/src/panels/lovelace/editor/dashboard-strategy-editor/hui-iframe-dashboard-strategy-editor.ts index 32d012b0ce3e..fb06ab34f6d6 100644 --- a/src/panels/lovelace/editor/dashboard-strategy-editor/hui-iframe-dashboard-strategy-editor.ts +++ b/src/panels/lovelace/editor/dashboard-strategy-editor/hui-iframe-dashboard-strategy-editor.ts @@ -7,8 +7,8 @@ import type { SchemaUnion, } from "../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../types"; -import { IframeDashboardStrategyConfig } from "../../strategies/iframe/iframe-dashboard-strategy"; -import { LovelaceStrategyEditor } from "../../strategies/types"; +import type { IframeDashboardStrategyConfig } from "../../strategies/iframe/iframe-dashboard-strategy"; +import type { LovelaceStrategyEditor } from "../../strategies/types"; const SCHEMA = [ { diff --git a/src/panels/lovelace/editor/dashboard-strategy-editor/hui-original-states-dashboard-strategy-editor.ts b/src/panels/lovelace/editor/dashboard-strategy-editor/hui-original-states-dashboard-strategy-editor.ts index c5abdd4409f7..2d085b5c2ca0 100644 --- a/src/panels/lovelace/editor/dashboard-strategy-editor/hui-original-states-dashboard-strategy-editor.ts +++ b/src/panels/lovelace/editor/dashboard-strategy-editor/hui-original-states-dashboard-strategy-editor.ts @@ -7,8 +7,8 @@ import type { SchemaUnion, } from "../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../types"; -import { OriginalStatesDashboardStrategyConfig } from "../../strategies/original-states/original-states-dashboard-strategy"; -import { LovelaceStrategyEditor } from "../../strategies/types"; +import type { OriginalStatesDashboardStrategyConfig } from "../../strategies/original-states/original-states-dashboard-strategy"; +import type { LovelaceStrategyEditor } from "../../strategies/types"; const SCHEMA = [ { diff --git a/src/panels/lovelace/editor/delete-badge.ts b/src/panels/lovelace/editor/delete-badge.ts index 639096a95723..d08c93c1709e 100644 --- a/src/panels/lovelace/editor/delete-badge.ts +++ b/src/panels/lovelace/editor/delete-badge.ts @@ -1,5 +1,5 @@ import type { HomeAssistant } from "../../../types"; -import { Lovelace } from "../types"; +import type { Lovelace } from "../types"; import { deleteBadge } from "./config-util"; import type { LovelaceCardPath } from "./lovelace-path"; diff --git a/src/panels/lovelace/editor/delete-card.ts b/src/panels/lovelace/editor/delete-card.ts index f83a3063d640..48def747c965 100644 --- a/src/panels/lovelace/editor/delete-card.ts +++ b/src/panels/lovelace/editor/delete-card.ts @@ -1,5 +1,5 @@ -import { HomeAssistant } from "../../../types"; -import { Lovelace } from "../types"; +import type { HomeAssistant } from "../../../types"; +import type { Lovelace } from "../types"; import { deleteCard } from "./config-util"; import type { LovelaceCardPath } from "./lovelace-path"; diff --git a/src/panels/lovelace/editor/entity-row-editor/hui-row-element-editor.ts b/src/panels/lovelace/editor/entity-row-editor/hui-row-element-editor.ts index 12fa1406235f..a60f634ccc5d 100644 --- a/src/panels/lovelace/editor/entity-row-editor/hui-row-element-editor.ts +++ b/src/panels/lovelace/editor/entity-row-editor/hui-row-element-editor.ts @@ -1,6 +1,6 @@ import { customElement } from "lit/decorators"; import { getRowElementClass } from "../../create-element/create-row-element"; -import { LovelaceRowConfig } from "../../entity-rows/types"; +import type { LovelaceRowConfig } from "../../entity-rows/types"; import type { LovelaceRowEditor } from "../../types"; import { HuiTypedElementEditor } from "../hui-typed-element-editor"; import "../config-elements/hui-generic-entity-row-editor"; diff --git a/src/panels/lovelace/editor/feature-editor/hui-card-feature-element-editor.ts b/src/panels/lovelace/editor/feature-editor/hui-card-feature-element-editor.ts index 4602740ee304..834c331aea47 100644 --- a/src/panels/lovelace/editor/feature-editor/hui-card-feature-element-editor.ts +++ b/src/panels/lovelace/editor/feature-editor/hui-card-feature-element-editor.ts @@ -1,6 +1,6 @@ import { customElement } from "lit/decorators"; import { getCardFeatureElementClass } from "../../create-element/create-card-feature-element"; -import { +import type { LovelaceCardFeatureConfig, LovelaceCardFeatureContext, } from "../../card-features/types"; diff --git a/src/panels/lovelace/editor/get-badge-stub-config.ts b/src/panels/lovelace/editor/get-badge-stub-config.ts index 63c64e57a82a..3f18bb7a74c1 100644 --- a/src/panels/lovelace/editor/get-badge-stub-config.ts +++ b/src/panels/lovelace/editor/get-badge-stub-config.ts @@ -1,5 +1,5 @@ -import { LovelaceCardConfig } from "../../../data/lovelace/config/card"; -import { HomeAssistant } from "../../../types"; +import type { LovelaceCardConfig } from "../../../data/lovelace/config/card"; +import type { HomeAssistant } from "../../../types"; import { getBadgeElementClass } from "../create-element/create-badge-element"; export const getBadgeStubConfig = async ( diff --git a/src/panels/lovelace/editor/get-card-stub-config.ts b/src/panels/lovelace/editor/get-card-stub-config.ts index a260e3c51db1..1fc7eeb1e48d 100644 --- a/src/panels/lovelace/editor/get-card-stub-config.ts +++ b/src/panels/lovelace/editor/get-card-stub-config.ts @@ -1,5 +1,5 @@ -import { LovelaceCardConfig } from "../../../data/lovelace/config/card"; -import { HomeAssistant } from "../../../types"; +import type { LovelaceCardConfig } from "../../../data/lovelace/config/card"; +import type { HomeAssistant } from "../../../types"; import { getCardElementClass } from "../create-element/create-card-element"; export const getCardStubConfig = async ( diff --git a/src/panels/lovelace/editor/get-dashboard-documentation-url.ts b/src/panels/lovelace/editor/get-dashboard-documentation-url.ts index aada4e5978e3..658e1f2cece0 100644 --- a/src/panels/lovelace/editor/get-dashboard-documentation-url.ts +++ b/src/panels/lovelace/editor/get-dashboard-documentation-url.ts @@ -4,7 +4,7 @@ import { isCustomType, stripCustomPrefix, } from "../../../data/lovelace_custom_cards"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { documentationUrl } from "../../../util/documentation-url"; export const getCardDocumentationURL = ( diff --git a/src/panels/lovelace/editor/get-element-stub-config.ts b/src/panels/lovelace/editor/get-element-stub-config.ts index dbd48d023de2..46516c769892 100644 --- a/src/panels/lovelace/editor/get-element-stub-config.ts +++ b/src/panels/lovelace/editor/get-element-stub-config.ts @@ -1,5 +1,5 @@ -import { LovelaceElementConfig } from "../elements/types"; -import { HomeAssistant } from "../../../types"; +import type { LovelaceElementConfig } from "../elements/types"; +import type { HomeAssistant } from "../../../types"; import { getPictureElementClass } from "../create-element/create-picture-element"; export const getElementStubConfig = async ( diff --git a/src/panels/lovelace/editor/header-footer-editor/get-headerfooter-stub-config.ts b/src/panels/lovelace/editor/header-footer-editor/get-headerfooter-stub-config.ts index d1705e66435c..791fac8afee3 100644 --- a/src/panels/lovelace/editor/header-footer-editor/get-headerfooter-stub-config.ts +++ b/src/panels/lovelace/editor/header-footer-editor/get-headerfooter-stub-config.ts @@ -1,6 +1,6 @@ -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; import { getHeaderFooterElementClass } from "../../create-element/create-header-footer-element"; -import { LovelaceHeaderFooterConfig } from "../../header-footer/types"; +import type { LovelaceHeaderFooterConfig } from "../../header-footer/types"; export const getHeaderFooterStubConfig = async ( hass: HomeAssistant, diff --git a/src/panels/lovelace/editor/header-footer-editor/hui-dialog-create-headerfooter.ts b/src/panels/lovelace/editor/header-footer-editor/hui-dialog-create-headerfooter.ts index 8c13d58b65e1..ffc58df168a9 100644 --- a/src/panels/lovelace/editor/header-footer-editor/hui-dialog-create-headerfooter.ts +++ b/src/panels/lovelace/editor/header-footer-editor/hui-dialog-create-headerfooter.ts @@ -1,5 +1,6 @@ import "@material/mwc-button/mwc-button"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import { createCloseHeading } from "../../../../components/ha-dialog"; diff --git a/src/panels/lovelace/editor/header-footer-editor/hui-header-footer-editor.ts b/src/panels/lovelace/editor/header-footer-editor/hui-header-footer-editor.ts index d73d3d28d194..f9a5036bd3ed 100644 --- a/src/panels/lovelace/editor/header-footer-editor/hui-header-footer-editor.ts +++ b/src/panels/lovelace/editor/header-footer-editor/hui-header-footer-editor.ts @@ -1,5 +1,6 @@ import { mdiClose, mdiPencil, mdiPlus } from "@mdi/js"; -import { CSSResultGroup, LitElement, TemplateResult, css, html } from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-icon-button"; diff --git a/src/panels/lovelace/editor/heading-badge-editor/hui-entity-heading-badge-editor.ts b/src/panels/lovelace/editor/heading-badge-editor/hui-entity-heading-badge-editor.ts index a4671aa218b5..c09bde4ccd4f 100644 --- a/src/panels/lovelace/editor/heading-badge-editor/hui-entity-heading-badge-editor.ts +++ b/src/panels/lovelace/editor/heading-badge-editor/hui-entity-heading-badge-editor.ts @@ -13,7 +13,7 @@ import { union, } from "superstruct"; import { fireEvent } from "../../../../common/dom/fire_event"; -import { LocalizeFunc } from "../../../../common/translations/localize"; +import type { LocalizeFunc } from "../../../../common/translations/localize"; import "../../../../components/ha-expansion-panel"; import "../../../../components/ha-form/ha-form"; import type { @@ -21,8 +21,8 @@ import type { SchemaUnion, } from "../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../types"; -import { Condition } from "../../common/validate-condition"; -import { EntityHeadingBadgeConfig } from "../../heading-badges/types"; +import type { Condition } from "../../common/validate-condition"; +import type { EntityHeadingBadgeConfig } from "../../heading-badges/types"; import type { LovelaceGenericElementEditor } from "../../types"; import "../conditions/ha-card-conditions-editor"; import { configElementStyle } from "../config-elements/config-elements-style"; diff --git a/src/panels/lovelace/editor/heading-badge-editor/hui-heading-badge-element-editor.ts b/src/panels/lovelace/editor/heading-badge-editor/hui-heading-badge-element-editor.ts index dadef34f8b01..539352cf8eb9 100644 --- a/src/panels/lovelace/editor/heading-badge-editor/hui-heading-badge-element-editor.ts +++ b/src/panels/lovelace/editor/heading-badge-editor/hui-heading-badge-element-editor.ts @@ -1,7 +1,10 @@ import { customElement } from "lit/decorators"; import { getHeadingBadgeElementClass } from "../../create-element/create-heading-badge-element"; import type { EntityHeadingBadgeConfig } from "../../heading-badges/types"; -import { LovelaceConfigForm, LovelaceHeadingBadgeEditor } from "../../types"; +import type { + LovelaceConfigForm, + LovelaceHeadingBadgeEditor, +} from "../../types"; import { HuiTypedElementEditor } from "../hui-typed-element-editor"; @customElement("hui-heading-badge-element-editor") diff --git a/src/panels/lovelace/editor/hui-dialog-save-config.ts b/src/panels/lovelace/editor/hui-dialog-save-config.ts index 46c274e9cde5..f25237bae01b 100644 --- a/src/panels/lovelace/editor/hui-dialog-save-config.ts +++ b/src/panels/lovelace/editor/hui-dialog-save-config.ts @@ -1,6 +1,7 @@ import "@material/mwc-button"; import { mdiClose, mdiHelpCircle } from "@mdi/js"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import "../../../components/ha-circular-progress"; @@ -10,7 +11,7 @@ import "../../../components/ha-formfield"; import "../../../components/ha-icon-button"; import "../../../components/ha-switch"; import "../../../components/ha-yaml-editor"; -import { LovelaceConfig } from "../../../data/lovelace/config/types"; +import type { LovelaceConfig } from "../../../data/lovelace/config/types"; import type { HassDialog } from "../../../dialogs/make-dialog-manager"; import { haStyleDialog } from "../../../resources/styles"; import type { HomeAssistant } from "../../../types"; diff --git a/src/panels/lovelace/editor/hui-element-editor.ts b/src/panels/lovelace/editor/hui-element-editor.ts index d7993d2b42aa..6df053cc5223 100644 --- a/src/panels/lovelace/editor/hui-element-editor.ts +++ b/src/panels/lovelace/editor/hui-element-editor.ts @@ -1,22 +1,16 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { property, query, state } from "lit/decorators"; import { cache } from "lit/directives/cache"; -import { fireEvent, HASSDomEvent } from "../../../common/dom/fire_event"; +import type { HASSDomEvent } from "../../../common/dom/fire_event"; +import { fireEvent } from "../../../common/dom/fire_event"; import { handleStructError } from "../../../common/structs/handle-errors"; import { deepEqual } from "../../../common/util/deep-equal"; import "../../../components/ha-alert"; import "../../../components/ha-circular-progress"; import "../../../components/ha-yaml-editor"; import type { HaYamlEditor } from "../../../components/ha-yaml-editor"; -import { LovelaceConfig } from "../../../data/lovelace/config/types"; +import type { LovelaceConfig } from "../../../data/lovelace/config/types"; import type { HomeAssistant } from "../../../types"; import type { LovelaceConfigForm, @@ -24,7 +18,7 @@ import type { } from "../types"; import type { HuiFormEditor } from "./config-elements/hui-form-editor"; import { GUISupportError } from "./gui-support-error"; -import { +import type { EditDetailElementEvent, EditSubElementEvent, GUIModeChangedEvent, diff --git a/src/panels/lovelace/editor/hui-entities-card-row-editor.ts b/src/panels/lovelace/editor/hui-entities-card-row-editor.ts index d492ee8918f4..2555b2aaa786 100644 --- a/src/panels/lovelace/editor/hui-entities-card-row-editor.ts +++ b/src/panels/lovelace/editor/hui-entities-card-row-editor.ts @@ -1,5 +1,6 @@ import { mdiClose, mdiDrag, mdiPencil } from "@mdi/js"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { repeat } from "lit/directives/repeat"; import { fireEvent } from "../../../common/dom/fire_event"; @@ -8,8 +9,8 @@ import type { HaEntityPicker } from "../../../components/entity/ha-entity-picker import "../../../components/ha-icon-button"; import "../../../components/ha-sortable"; import "../../../components/ha-svg-icon"; -import { HomeAssistant } from "../../../types"; -import { EntityConfig, LovelaceRowConfig } from "../entity-rows/types"; +import type { HomeAssistant } from "../../../types"; +import type { EntityConfig, LovelaceRowConfig } from "../entity-rows/types"; declare global { interface HASSDomEvents { diff --git a/src/panels/lovelace/editor/hui-picture-elements-card-row-editor.ts b/src/panels/lovelace/editor/hui-picture-elements-card-row-editor.ts index d013cb8f817e..9e08c007a259 100644 --- a/src/panels/lovelace/editor/hui-picture-elements-card-row-editor.ts +++ b/src/panels/lovelace/editor/hui-picture-elements-card-row-editor.ts @@ -1,17 +1,18 @@ import deepClone from "deep-clone-simple"; import { mdiClose, mdiPencil, mdiContentDuplicate } from "@mdi/js"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; import { stopPropagation } from "../../../common/dom/stop_propagation"; import "../../../components/ha-icon-button"; import "../../../components/ha-svg-icon"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import "../../../components/ha-select"; import type { HaSelect } from "../../../components/ha-select"; import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box"; import { getElementStubConfig } from "./get-element-stub-config"; -import { +import type { ConditionalElementConfig, IconElementConfig, ImageElementConfig, diff --git a/src/panels/lovelace/editor/hui-sub-element-editor.ts b/src/panels/lovelace/editor/hui-sub-element-editor.ts index 0d01341abc1c..0716a68c20b3 100644 --- a/src/panels/lovelace/editor/hui-sub-element-editor.ts +++ b/src/panels/lovelace/editor/hui-sub-element-editor.ts @@ -1,14 +1,9 @@ import { mdiCodeBraces, mdiListBoxOutline } from "@mdi/js"; -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; -import { fireEvent, HASSDomEvent } from "../../../common/dom/fire_event"; +import type { HASSDomEvent } from "../../../common/dom/fire_event"; +import { fireEvent } from "../../../common/dom/fire_event"; import "../../../components/ha-icon-button"; import "../../../components/ha-icon-button-prev"; import type { HomeAssistant } from "../../../types"; diff --git a/src/panels/lovelace/editor/lovelace-badges.ts b/src/panels/lovelace/editor/lovelace-badges.ts index c4b17856bf56..a55217fcd643 100644 --- a/src/panels/lovelace/editor/lovelace-badges.ts +++ b/src/panels/lovelace/editor/lovelace-badges.ts @@ -1,4 +1,4 @@ -import { Badge } from "./types"; +import type { Badge } from "./types"; export const coreBadges: Badge[] = [ { diff --git a/src/panels/lovelace/editor/lovelace-cards.ts b/src/panels/lovelace/editor/lovelace-cards.ts index fbf1e81db594..2f22e6e3c094 100644 --- a/src/panels/lovelace/editor/lovelace-cards.ts +++ b/src/panels/lovelace/editor/lovelace-cards.ts @@ -1,4 +1,4 @@ -import { Card } from "./types"; +import type { Card } from "./types"; export const coreCards: Card[] = [ { diff --git a/src/panels/lovelace/editor/lovelace-headerfooters.ts b/src/panels/lovelace/editor/lovelace-headerfooters.ts index 0aa0ccc8a149..1ed8c16539ac 100644 --- a/src/panels/lovelace/editor/lovelace-headerfooters.ts +++ b/src/panels/lovelace/editor/lovelace-headerfooters.ts @@ -3,7 +3,7 @@ import { mdiGestureTapButton, mdiImageArea, } from "@mdi/js"; -import { HeaderFooter } from "./types"; +import type { HeaderFooter } from "./types"; export const headerFooterElements: HeaderFooter[] = [ { type: "graph", icon: mdiChartBellCurveCumulative }, diff --git a/src/panels/lovelace/editor/lovelace-path.ts b/src/panels/lovelace/editor/lovelace-path.ts index 22f58dfbd5ea..7021fb48d63e 100644 --- a/src/panels/lovelace/editor/lovelace-path.ts +++ b/src/panels/lovelace/editor/lovelace-path.ts @@ -1,14 +1,10 @@ -import { LovelaceBadgeConfig } from "../../../data/lovelace/config/badge"; -import { LovelaceCardConfig } from "../../../data/lovelace/config/card"; -import { - LovelaceSectionRawConfig, - isStrategySection, -} from "../../../data/lovelace/config/section"; -import { LovelaceConfig } from "../../../data/lovelace/config/types"; -import { - LovelaceViewRawConfig, - isStrategyView, -} from "../../../data/lovelace/config/view"; +import type { LovelaceBadgeConfig } from "../../../data/lovelace/config/badge"; +import type { LovelaceCardConfig } from "../../../data/lovelace/config/card"; +import type { LovelaceSectionRawConfig } from "../../../data/lovelace/config/section"; +import { isStrategySection } from "../../../data/lovelace/config/section"; +import type { LovelaceConfig } from "../../../data/lovelace/config/types"; +import type { LovelaceViewRawConfig } from "../../../data/lovelace/config/view"; +import { isStrategyView } from "../../../data/lovelace/config/view"; export type LovelaceCardPath = [number, number] | [number, number, number]; export type LovelaceContainerPath = [number] | [number, number]; diff --git a/src/panels/lovelace/editor/picture-element-editor/hui-picture-element-element-editor.ts b/src/panels/lovelace/editor/picture-element-editor/hui-picture-element-element-editor.ts index 638fc023af24..2d35315a9150 100644 --- a/src/panels/lovelace/editor/picture-element-editor/hui-picture-element-element-editor.ts +++ b/src/panels/lovelace/editor/picture-element-editor/hui-picture-element-element-editor.ts @@ -1,5 +1,5 @@ import { customElement } from "lit/decorators"; -import { LovelaceElementConfig } from "../../elements/types"; +import type { LovelaceElementConfig } from "../../elements/types"; import type { LovelacePictureElementEditor } from "../../types"; import { HuiTypedElementEditor } from "../hui-typed-element-editor"; import { getPictureElementClass } from "../../create-element/create-picture-element"; diff --git a/src/panels/lovelace/editor/process-editor-entities.ts b/src/panels/lovelace/editor/process-editor-entities.ts index 6637389e7cac..d51fdb86b3e1 100644 --- a/src/panels/lovelace/editor/process-editor-entities.ts +++ b/src/panels/lovelace/editor/process-editor-entities.ts @@ -1,4 +1,4 @@ -import { EntityConfig } from "../entity-rows/types"; +import type { EntityConfig } from "../entity-rows/types"; export function processEditorEntities( entities: (any | string)[] diff --git a/src/panels/lovelace/editor/section-editor/hui-dialog-edit-section.ts b/src/panels/lovelace/editor/section-editor/hui-dialog-edit-section.ts index e6973e606a63..0d7a1edced22 100644 --- a/src/panels/lovelace/editor/section-editor/hui-dialog-edit-section.ts +++ b/src/panels/lovelace/editor/section-editor/hui-dialog-edit-section.ts @@ -1,14 +1,7 @@ -import { ActionDetail } from "@material/mwc-list"; +import type { ActionDetail } from "@material/mwc-list"; import { mdiCheck, mdiClose, mdiDotsVertical } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { fireEvent } from "../../../../common/dom/fire_event"; @@ -21,7 +14,7 @@ import "../../../../components/ha-icon-button"; import "../../../../components/ha-list-item"; import "../../../../components/ha-yaml-editor"; import type { HaYamlEditor } from "../../../../components/ha-yaml-editor"; -import { LovelaceSectionRawConfig } from "../../../../data/lovelace/config/section"; +import type { LovelaceSectionRawConfig } from "../../../../data/lovelace/config/section"; import type { HassDialog } from "../../../../dialogs/make-dialog-manager"; import { haStyleDialog } from "../../../../resources/styles"; import type { HomeAssistant } from "../../../../types"; @@ -34,7 +27,7 @@ import "./hui-section-visibility-editor"; import type { EditSectionDialogParams } from "./show-edit-section-dialog"; import "@material/mwc-tab-bar/mwc-tab-bar"; import "@material/mwc-tab/mwc-tab"; -import { LovelaceViewConfig } from "../../../../data/lovelace/config/view"; +import type { LovelaceViewConfig } from "../../../../data/lovelace/config/view"; const TABS = ["tab-settings", "tab-visibility"] as const; diff --git a/src/panels/lovelace/editor/section-editor/hui-section-settings-editor.ts b/src/panels/lovelace/editor/section-editor/hui-section-settings-editor.ts index dcc922c3e886..b19627e33bdf 100644 --- a/src/panels/lovelace/editor/section-editor/hui-section-settings-editor.ts +++ b/src/panels/lovelace/editor/section-editor/hui-section-settings-editor.ts @@ -2,13 +2,14 @@ import { LitElement, html } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../common/dom/fire_event"; -import { +import type { HaFormSchema, SchemaUnion, } from "../../../../components/ha-form/types"; -import { LovelaceSectionRawConfig } from "../../../../data/lovelace/config/section"; -import { LovelaceViewConfig } from "../../../../data/lovelace/config/view"; -import { HomeAssistant } from "../../../../types"; +import "../../../../components/ha-form/ha-form"; +import type { LovelaceSectionRawConfig } from "../../../../data/lovelace/config/section"; +import type { LovelaceViewConfig } from "../../../../data/lovelace/config/view"; +import type { HomeAssistant } from "../../../../types"; type SettingsData = { column_span?: number; diff --git a/src/panels/lovelace/editor/section-editor/hui-section-visibility-editor.ts b/src/panels/lovelace/editor/section-editor/hui-section-visibility-editor.ts index 04f16a7aa32d..0826113eb0a4 100644 --- a/src/panels/lovelace/editor/section-editor/hui-section-visibility-editor.ts +++ b/src/panels/lovelace/editor/section-editor/hui-section-visibility-editor.ts @@ -2,9 +2,9 @@ import { LitElement, html } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-alert"; -import { LovelaceSectionRawConfig } from "../../../../data/lovelace/config/section"; -import { HomeAssistant } from "../../../../types"; -import { Condition } from "../../common/validate-condition"; +import type { LovelaceSectionRawConfig } from "../../../../data/lovelace/config/section"; +import type { HomeAssistant } from "../../../../types"; +import type { Condition } from "../../common/validate-condition"; import "../conditions/ha-card-conditions-editor"; @customElement("hui-section-visibility-editor") diff --git a/src/panels/lovelace/editor/section-editor/show-edit-section-dialog.ts b/src/panels/lovelace/editor/section-editor/show-edit-section-dialog.ts index ff06083fab9c..82650e9e38d3 100644 --- a/src/panels/lovelace/editor/section-editor/show-edit-section-dialog.ts +++ b/src/panels/lovelace/editor/section-editor/show-edit-section-dialog.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../../common/dom/fire_event"; -import { LovelaceConfig } from "../../../../data/lovelace/config/types"; +import type { LovelaceConfig } from "../../../../data/lovelace/config/types"; export type EditSectionDialogParams = { lovelaceConfig: LovelaceConfig; diff --git a/src/panels/lovelace/editor/select-view/hui-dialog-select-view.ts b/src/panels/lovelace/editor/select-view/hui-dialog-select-view.ts index 16449f0b3651..b38b0daf1d53 100644 --- a/src/panels/lovelace/editor/select-view/hui-dialog-select-view.ts +++ b/src/panels/lovelace/editor/select-view/hui-dialog-select-view.ts @@ -2,7 +2,8 @@ import "@material/mwc-button/mwc-button"; import "@material/mwc-list/mwc-list"; import "@material/mwc-list/mwc-list-item"; import "@material/mwc-list/mwc-radio-list-item"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import { stopPropagation } from "../../../../common/dom/stop_propagation"; @@ -10,16 +11,12 @@ import "../../../../components/ha-alert"; import { createCloseHeading } from "../../../../components/ha-dialog"; import "../../../../components/ha-icon"; import "../../../../components/ha-select"; -import { - fetchConfig, - LovelaceConfig, -} from "../../../../data/lovelace/config/types"; -import { - fetchDashboards, - LovelaceDashboard, -} from "../../../../data/lovelace/dashboard"; +import type { LovelaceConfig } from "../../../../data/lovelace/config/types"; +import { fetchConfig } from "../../../../data/lovelace/config/types"; +import type { LovelaceDashboard } from "../../../../data/lovelace/dashboard"; +import { fetchDashboards } from "../../../../data/lovelace/dashboard"; import { haStyleDialog } from "../../../../resources/styles"; -import { HomeAssistant } from "../../../../types"; +import type { HomeAssistant } from "../../../../types"; import type { SelectViewDialogParams } from "./show-select-view-dialog"; import { isStrategyView } from "../../../../data/lovelace/config/view"; diff --git a/src/panels/lovelace/editor/select-view/show-select-view-dialog.ts b/src/panels/lovelace/editor/select-view/show-select-view-dialog.ts index a93d75d24064..776cc26f7dc3 100644 --- a/src/panels/lovelace/editor/select-view/show-select-view-dialog.ts +++ b/src/panels/lovelace/editor/select-view/show-select-view-dialog.ts @@ -1,6 +1,6 @@ import { fireEvent } from "../../../../common/dom/fire_event"; -import { LovelaceConfig } from "../../../../data/lovelace/config/types"; -import { LovelaceDashboard } from "../../../../data/lovelace/dashboard"; +import type { LovelaceConfig } from "../../../../data/lovelace/config/types"; +import type { LovelaceDashboard } from "../../../../data/lovelace/dashboard"; export interface SelectViewDialogParams { lovelaceConfig: LovelaceConfig; diff --git a/src/panels/lovelace/editor/show-save-config-dialog.ts b/src/panels/lovelace/editor/show-save-config-dialog.ts index cda486ef1536..fbd7336998e3 100644 --- a/src/panels/lovelace/editor/show-save-config-dialog.ts +++ b/src/panels/lovelace/editor/show-save-config-dialog.ts @@ -1,5 +1,5 @@ import { fireEvent } from "../../../common/dom/fire_event"; -import { Lovelace } from "../types"; +import type { Lovelace } from "../types"; declare global { // for fire event diff --git a/src/panels/lovelace/editor/structs/action-struct.ts b/src/panels/lovelace/editor/structs/action-struct.ts index ed918e6d1f8b..7744a99070dc 100644 --- a/src/panels/lovelace/editor/structs/action-struct.ts +++ b/src/panels/lovelace/editor/structs/action-struct.ts @@ -10,7 +10,7 @@ import { type, union, } from "superstruct"; -import { BaseActionConfig } from "../../../../data/lovelace/config/action"; +import type { BaseActionConfig } from "../../../../data/lovelace/config/action"; const actionConfigStructUser = object({ user: string(), diff --git a/src/panels/lovelace/editor/types.ts b/src/panels/lovelace/editor/types.ts index c62c7595ab66..7731cb730a51 100644 --- a/src/panels/lovelace/editor/types.ts +++ b/src/panels/lovelace/editor/types.ts @@ -1,15 +1,15 @@ -import { ActionConfig } from "../../../data/lovelace/config/action"; -import { LovelaceCardConfig } from "../../../data/lovelace/config/card"; -import { +import type { ActionConfig } from "../../../data/lovelace/config/action"; +import type { LovelaceCardConfig } from "../../../data/lovelace/config/card"; +import type { LovelaceViewConfig, ShowViewConfig, } from "../../../data/lovelace/config/view"; -import { EntityConfig, LovelaceRowConfig } from "../entity-rows/types"; -import { LovelaceHeaderFooterConfig } from "../header-footer/types"; -import { LovelaceCardFeatureConfig } from "../card-features/types"; -import { LovelaceElementConfig } from "../elements/types"; -import { LovelaceBadgeConfig } from "../../../data/lovelace/config/badge"; -import { LovelaceHeadingBadgeConfig } from "../heading-badges/types"; +import type { EntityConfig, LovelaceRowConfig } from "../entity-rows/types"; +import type { LovelaceHeaderFooterConfig } from "../header-footer/types"; +import type { LovelaceCardFeatureConfig } from "../card-features/types"; +import type { LovelaceElementConfig } from "../elements/types"; +import type { LovelaceBadgeConfig } from "../../../data/lovelace/config/badge"; +import type { LovelaceHeadingBadgeConfig } from "../heading-badges/types"; export interface YamlChangedEvent extends Event { detail: { diff --git a/src/panels/lovelace/editor/unused-entities/hui-unused-entities.ts b/src/panels/lovelace/editor/unused-entities/hui-unused-entities.ts index ef0a34233356..fd3279cc5fb8 100644 --- a/src/panels/lovelace/editor/unused-entities/hui-unused-entities.ts +++ b/src/panels/lovelace/editor/unused-entities/hui-unused-entities.ts @@ -1,12 +1,6 @@ import { mdiPlus } from "@mdi/js"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { computeDomain } from "../../../../common/entity/compute_domain"; @@ -20,7 +14,7 @@ import type { Lovelace } from "../../types"; import "../card-editor/hui-entity-picker-table"; import { showSuggestCardDialog } from "../card-editor/show-suggest-card-dialog"; import { showSelectViewDialog } from "../select-view/show-select-view-dialog"; -import { LovelaceConfig } from "../../../../data/lovelace/config/types"; +import type { LovelaceConfig } from "../../../../data/lovelace/config/types"; import { computeCards, computeSection, diff --git a/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts b/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts index f0adb8ce2e29..68f7c4f93bf3 100644 --- a/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts +++ b/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts @@ -1,32 +1,26 @@ import "@material/mwc-button"; -import { ActionDetail } from "@material/mwc-list"; +import type { ActionDetail } from "@material/mwc-list"; import "@material/mwc-tab-bar/mwc-tab-bar"; import "@material/mwc-tab/mwc-tab"; import { mdiCheck, mdiClose, mdiDotsVertical } from "@mdi/js"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; -import { HASSDomEvent, fireEvent } from "../../../../common/dom/fire_event"; +import type { HASSDomEvent } from "../../../../common/dom/fire_event"; +import { fireEvent } from "../../../../common/dom/fire_event"; import { stopPropagation } from "../../../../common/dom/stop_propagation"; import { navigate } from "../../../../common/navigate"; import { deepEqual } from "../../../../common/util/deep-equal"; import "../../../../components/ha-alert"; +import "../../../../components/ha-button"; import "../../../../components/ha-circular-progress"; import "../../../../components/ha-dialog"; import "../../../../components/ha-dialog-header"; import "../../../../components/ha-yaml-editor"; import type { HaYamlEditor } from "../../../../components/ha-yaml-editor"; -import { - LovelaceViewConfig, - isStrategyView, -} from "../../../../data/lovelace/config/view"; +import type { LovelaceViewConfig } from "../../../../data/lovelace/config/view"; +import { isStrategyView } from "../../../../data/lovelace/config/view"; import { showAlertDialog, showConfirmationDialog, @@ -38,11 +32,11 @@ import { SECTIONS_VIEW_LAYOUT } from "../../views/const"; import { generateDefaultSection } from "../../views/default-section"; import { getViewType } from "../../views/get-view-type"; import { addView, deleteView, replaceView } from "../config-util"; -import { ViewEditEvent, ViewVisibilityChangeEvent } from "../types"; +import type { ViewEditEvent, ViewVisibilityChangeEvent } from "../types"; import "./hui-view-background-editor"; import "./hui-view-editor"; import "./hui-view-visibility-editor"; -import { EditViewDialogParams } from "./show-edit-view-dialog"; +import type { EditViewDialogParams } from "./show-edit-view-dialog"; const TABS = ["tab-settings", "tab-background", "tab-visibility"] as const; @@ -64,8 +58,10 @@ export class HuiDialogEditView extends LitElement { @query("ha-yaml-editor") private _editor?: HaYamlEditor; + @state() private _currentType = getViewType(); + get _type(): string { - return getViewType(this._config!); + return getViewType(this._config); } protected updated(changedProperties: PropertyValues) { @@ -83,7 +79,6 @@ export class HuiDialogEditView extends LitElement { if (this._params.viewIndex === undefined) { this._config = { type: SECTIONS_VIEW_LAYOUT, - sections: [generateDefaultSection(this.hass!.localize)], }; this._dirty = false; return; @@ -96,6 +91,7 @@ export class HuiDialogEditView extends LitElement { return; } this._config = view; + this._currentType = this._type; } public closeDialog(): void { @@ -166,12 +162,14 @@ export class HuiDialogEditView extends LitElement { } } - const isCompatibleViewType = - this._config?.type === SECTIONS_VIEW_LAYOUT - ? this._config?.type === SECTIONS_VIEW_LAYOUT && - !this._config?.cards?.length - : this._config?.type !== SECTIONS_VIEW_LAYOUT && - !this._config?.sections?.length; + const convertToSection = + this._type === SECTIONS_VIEW_LAYOUT && + this._currentType !== SECTIONS_VIEW_LAYOUT && + this._config?.cards?.length; + const convertNotSupported = + this._type !== SECTIONS_VIEW_LAYOUT && + this._currentType === SECTIONS_VIEW_LAYOUT && + this._config?.sections?.length; return html`
    - ${!isCompatibleViewType + ${convertToSection ? html` - - ${this._config?.type === SECTIONS_VIEW_LAYOUT - ? this.hass!.localize( - "ui.panel.lovelace.editor.edit_view.type_warning_sections" - ) - : this.hass!.localize( - "ui.panel.lovelace.editor.edit_view.type_warning_others" - )} + + ${this.hass!.localize( + "ui.panel.lovelace.editor.edit_view.card_to_section_convert" + )} + + + + ` + : nothing} + ${convertNotSupported + ? html` + + ${this.hass!.localize( + "ui.panel.lovelace.editor.edit_view.section_to_card_not_supported" + )} ` : nothing} @@ -265,7 +276,7 @@ export class HuiDialogEditView extends LitElement { ${content} ${this._params.viewIndex !== undefined ? html` - + ` : nothing} - ${this._saving @@ -291,7 +303,7 @@ export class HuiDialogEditView extends LitElement { aria-label="Saving" >` : nothing} - ${this.hass!.localize("ui.common.save")} `; @@ -310,6 +322,54 @@ export class HuiDialogEditView extends LitElement { } } + private async _convertToSection() { + if (!this._params || !this._config) { + return; + } + const confirm = await showConfirmationDialog(this, { + title: this.hass!.localize( + "ui.panel.lovelace.editor.edit_view.convert_view_title" + ), + text: this.hass!.localize( + "ui.panel.lovelace.editor.edit_view.convert_view_text" + ), + confirmText: this.hass!.localize( + "ui.panel.lovelace.editor.edit_view.convert_view_action" + ), + dismissText: this.hass!.localize("ui.common.cancel"), + }); + + if (!confirm) { + return; + } + + const newConfig = { + ...this._config, + }; + newConfig.type = SECTIONS_VIEW_LAYOUT; + newConfig.sections = [generateDefaultSection(this.hass!.localize)]; + newConfig.path = undefined; + const lovelace = this._params!.lovelace!; + + try { + await lovelace.saveConfig( + addView(this.hass!, lovelace.config, newConfig) + ); + if (this._params.saveCallback) { + this._params.saveCallback(lovelace.config.views.length, newConfig); + } + this.closeDialog(); + } catch (err: any) { + showAlertDialog(this, { + text: `${this.hass!.localize( + "ui.panel.lovelace.editor.edit_view.saving_failed" + )}: ${err.message}`, + }); + } finally { + this._saving = false; + } + } + private async _delete(): Promise { if (!this._params) { return; @@ -373,7 +433,7 @@ export class HuiDialogEditView extends LitElement { const viewConf = { ...this._config, }; - + // Ensure we have at least one section if we are in sections view if (viewConf.type === SECTIONS_VIEW_LAYOUT && !viewConf.sections?.length) { viewConf.sections = [generateDefaultSection(this.hass!.localize)]; } else if (!viewConf.cards?.length) { @@ -393,7 +453,7 @@ export class HuiDialogEditView extends LitElement { viewConf ) ); - if (this._params.saveCallback) { + if (this._params.saveCallback && this._creatingView) { this._params.saveCallback( this._params.viewIndex || lovelace.config.views.length, viewConf @@ -486,7 +546,7 @@ export class HuiDialogEditView extends LitElement { text-transform: uppercase; padding: 0 20px; } - mwc-button.warning { + ha-button.warning { margin-right: auto; margin-inline-end: auto; margin-inline-start: initial; @@ -501,7 +561,10 @@ export class HuiDialogEditView extends LitElement { color: var(--error-color); border-bottom: 1px solid var(--error-color); } - .incompatible { + ha-alert { + display: block; + } + ha-alert ha-button { display: block; } diff --git a/src/panels/lovelace/editor/view-editor/hui-view-background-editor.ts b/src/panels/lovelace/editor/view-editor/hui-view-background-editor.ts index 7cf3f2d5d435..1ab7e5fe1181 100644 --- a/src/panels/lovelace/editor/view-editor/hui-view-background-editor.ts +++ b/src/panels/lovelace/editor/view-editor/hui-view-background-editor.ts @@ -1,10 +1,11 @@ import "@material/mwc-list/mwc-list-item"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-selector/ha-selector-image"; -import { LovelaceViewConfig } from "../../../../data/lovelace/config/view"; -import { HomeAssistant, ValueChangedEvent } from "../../../../types"; +import type { LovelaceViewConfig } from "../../../../data/lovelace/config/view"; +import type { HomeAssistant, ValueChangedEvent } from "../../../../types"; const SELECTOR = { image: { original: true } }; diff --git a/src/panels/lovelace/editor/view-editor/hui-view-editor.ts b/src/panels/lovelace/editor/view-editor/hui-view-editor.ts index 6b807c1e8a75..000b5ca9d30f 100644 --- a/src/panels/lovelace/editor/view-editor/hui-view-editor.ts +++ b/src/panels/lovelace/editor/view-editor/hui-view-editor.ts @@ -9,7 +9,7 @@ import type { HaFormSchema, SchemaUnion, } from "../../../../components/ha-form/types"; -import { LovelaceViewConfig } from "../../../../data/lovelace/config/view"; +import type { LovelaceViewConfig } from "../../../../data/lovelace/config/view"; import type { HomeAssistant } from "../../../../types"; import { MASONRY_VIEW_LAYOUT, @@ -40,21 +40,6 @@ export class HuiViewEditor extends LitElement { private _schema = memoizeOne( (localize: LocalizeFunc, viewType: string) => [ - { name: "title", selector: { text: {} } }, - { - name: "icon", - selector: { - icon: {}, - }, - }, - { name: "path", selector: { text: {} } }, - { name: "theme", selector: { theme: {} } }, - { - name: "subview", - selector: { - boolean: {}, - }, - }, { name: "type", selector: { @@ -62,9 +47,9 @@ export class HuiViewEditor extends LitElement { options: ( [ SECTIONS_VIEW_LAYOUT, + MASONRY_VIEW_LAYOUT, SIDEBAR_VIEW_LAYOUT, PANEL_VIEW_LAYOUT, - MASONRY_VIEW_LAYOUT, ] as const ).map((type) => ({ value: type, @@ -75,6 +60,21 @@ export class HuiViewEditor extends LitElement { }, }, }, + { name: "title", selector: { text: {} } }, + { + name: "icon", + selector: { + icon: {}, + }, + }, + { name: "path", selector: { text: {} } }, + { name: "theme", selector: { theme: {} } }, + { + name: "subview", + selector: { + boolean: {}, + }, + }, ...(viewType === SECTIONS_VIEW_LAYOUT ? ([ { diff --git a/src/panels/lovelace/editor/view-editor/hui-view-visibility-editor.ts b/src/panels/lovelace/editor/view-editor/hui-view-visibility-editor.ts index 16ac0981f74c..9d3ab7f6a224 100644 --- a/src/panels/lovelace/editor/view-editor/hui-view-visibility-editor.ts +++ b/src/panels/lovelace/editor/view-editor/hui-view-visibility-editor.ts @@ -1,25 +1,21 @@ import "@material/mwc-list/mwc-list-item"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../common/dom/fire_event"; import { stringCompare } from "../../../../common/string/compare"; -import { HaSwitch } from "../../../../components/ha-switch"; +import type { HaSwitch } from "../../../../components/ha-switch"; import "../../../../components/user/ha-user-badge"; import "../../../../components/ha-list-item"; -import { +import "../../../../components/ha-switch"; +import type { LovelaceViewConfig, ShowViewConfig, } from "../../../../data/lovelace/config/view"; -import { User, fetchUsers } from "../../../../data/user"; -import { HomeAssistant } from "../../../../types"; +import type { User } from "../../../../data/user"; +import { fetchUsers } from "../../../../data/user"; +import type { HomeAssistant } from "../../../../types"; declare global { interface HASSDomEvents { diff --git a/src/panels/lovelace/editor/view-editor/show-edit-view-dialog.ts b/src/panels/lovelace/editor/view-editor/show-edit-view-dialog.ts index 4caae825ab7e..ed5d5d40ef85 100644 --- a/src/panels/lovelace/editor/view-editor/show-edit-view-dialog.ts +++ b/src/panels/lovelace/editor/view-editor/show-edit-view-dialog.ts @@ -1,6 +1,7 @@ -import { fireEvent, HASSDomEvent } from "../../../../common/dom/fire_event"; -import { LovelaceViewConfig } from "../../../../data/lovelace/config/view"; -import { Lovelace } from "../../types"; +import type { HASSDomEvent } from "../../../../common/dom/fire_event"; +import { fireEvent } from "../../../../common/dom/fire_event"; +import type { LovelaceViewConfig } from "../../../../data/lovelace/config/view"; +import type { Lovelace } from "../../types"; declare global { // for fire event diff --git a/src/panels/lovelace/elements/hui-conditional-element.ts b/src/panels/lovelace/elements/hui-conditional-element.ts index 838bb7087497..44ccbda64d5a 100644 --- a/src/panels/lovelace/elements/hui-conditional-element.ts +++ b/src/panels/lovelace/elements/hui-conditional-element.ts @@ -1,11 +1,11 @@ -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { createStyledHuiElement } from "../cards/picture-elements/create-styled-hui-element"; import { checkConditionsMet, validateConditionalConfig, } from "../common/validate-condition"; -import { LovelacePictureElementEditor } from "../types"; -import { +import type { LovelacePictureElementEditor } from "../types"; +import type { ConditionalElementConfig, LovelaceElement, LovelaceElementConfig, diff --git a/src/panels/lovelace/elements/hui-icon-element.ts b/src/panels/lovelace/elements/hui-icon-element.ts index dc799a2f69c2..6ab35b8b1dda 100644 --- a/src/panels/lovelace/elements/hui-icon-element.ts +++ b/src/panels/lovelace/elements/hui-icon-element.ts @@ -1,15 +1,16 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import "../../../components/ha-icon"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { computeTooltip } from "../common/compute-tooltip"; import { actionHandler } from "../common/directives/action-handler-directive"; import { handleAction } from "../common/handle-action"; import { hasAction } from "../common/has-action"; -import { IconElementConfig, LovelaceElement } from "./types"; -import { LovelacePictureElementEditor } from "../types"; -import { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; +import type { IconElementConfig, LovelaceElement } from "./types"; +import type { LovelacePictureElementEditor } from "../types"; +import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; @customElement("hui-icon-element") export class HuiIconElement extends LitElement implements LovelaceElement { diff --git a/src/panels/lovelace/elements/hui-image-element.ts b/src/panels/lovelace/elements/hui-image-element.ts index 104461661a45..b55a48583520 100644 --- a/src/panels/lovelace/elements/hui-image-element.ts +++ b/src/panels/lovelace/elements/hui-image-element.ts @@ -1,16 +1,18 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; -import { computeImageUrl, ImageEntity } from "../../../data/image"; -import { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; -import { HomeAssistant } from "../../../types"; +import type { ImageEntity } from "../../../data/image"; +import { computeImageUrl } from "../../../data/image"; +import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; +import type { HomeAssistant } from "../../../types"; import { computeTooltip } from "../common/compute-tooltip"; import { actionHandler } from "../common/directives/action-handler-directive"; import { handleAction } from "../common/handle-action"; import { hasAction } from "../common/has-action"; import "../components/hui-image"; -import { ImageElementConfig, LovelaceElement } from "./types"; -import { LovelacePictureElementEditor } from "../types"; +import type { ImageElementConfig, LovelaceElement } from "./types"; +import type { LovelacePictureElementEditor } from "../types"; @customElement("hui-image-element") export class HuiImageElement extends LitElement implements LovelaceElement { diff --git a/src/panels/lovelace/elements/hui-service-button-element.ts b/src/panels/lovelace/elements/hui-service-button-element.ts index c7f3ea8b39a2..7699e3e2f420 100644 --- a/src/panels/lovelace/elements/hui-service-button-element.ts +++ b/src/panels/lovelace/elements/hui-service-button-element.ts @@ -1,9 +1,10 @@ -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, state } from "lit/decorators"; import "../../../components/buttons/ha-call-service-button"; -import { HomeAssistant } from "../../../types"; -import { LovelaceElement, ServiceButtonElementConfig } from "./types"; -import { LovelacePictureElementEditor } from "../types"; +import type { HomeAssistant } from "../../../types"; +import type { LovelaceElement, ServiceButtonElementConfig } from "./types"; +import type { LovelacePictureElementEditor } from "../types"; @customElement("hui-service-button-element") export class HuiServiceButtonElement diff --git a/src/panels/lovelace/elements/hui-state-badge-element.ts b/src/panels/lovelace/elements/hui-state-badge-element.ts index 045b1104faad..6aff5bc93744 100644 --- a/src/panels/lovelace/elements/hui-state-badge-element.ts +++ b/src/panels/lovelace/elements/hui-state-badge-element.ts @@ -1,12 +1,13 @@ import type { HassEntity } from "home-assistant-js-websocket"; -import { LitElement, PropertyValues, html, nothing } from "lit"; +import type { PropertyValues } from "lit"; +import { LitElement, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { findEntities } from "../common/find-entities"; import { computeStateName } from "../../../common/entity/compute_state_name"; import "../../../components/entity/ha-state-label-badge"; -import { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; -import { HomeAssistant } from "../../../types"; +import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; +import type { HomeAssistant } from "../../../types"; import { actionHandler } from "../common/directives/action-handler-directive"; import { handleAction } from "../common/handle-action"; import { hasAction } from "../common/has-action"; @@ -14,8 +15,8 @@ import { isUnavailableState } from "../../../data/entity"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import { createEntityNotFoundWarning } from "../components/hui-warning"; import "../components/hui-warning-element"; -import { LovelaceElement, StateBadgeElementConfig } from "./types"; -import { LovelacePictureElementEditor } from "../types"; +import type { LovelaceElement, StateBadgeElementConfig } from "./types"; +import type { LovelacePictureElementEditor } from "../types"; @customElement("hui-state-badge-element") export class HuiStateBadgeElement diff --git a/src/panels/lovelace/elements/hui-state-icon-element.ts b/src/panels/lovelace/elements/hui-state-icon-element.ts index 6175ba77feb2..b6b7578e7210 100644 --- a/src/panels/lovelace/elements/hui-state-icon-element.ts +++ b/src/panels/lovelace/elements/hui-state-icon-element.ts @@ -1,17 +1,11 @@ import type { HassEntity } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { findEntities } from "../common/find-entities"; import "../../../components/entity/state-badge"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { computeTooltip } from "../common/compute-tooltip"; import { actionHandler } from "../common/directives/action-handler-directive"; import { handleAction } from "../common/handle-action"; @@ -20,9 +14,9 @@ import { isUnavailableState } from "../../../data/entity"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import { createEntityNotFoundWarning } from "../components/hui-warning"; import "../components/hui-warning-element"; -import { LovelaceElement, StateIconElementConfig } from "./types"; -import { LovelacePictureElementEditor } from "../types"; -import { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; +import type { LovelaceElement, StateIconElementConfig } from "./types"; +import type { LovelacePictureElementEditor } from "../types"; +import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; @customElement("hui-state-icon-element") export class HuiStateIconElement extends LitElement implements LovelaceElement { diff --git a/src/panels/lovelace/elements/hui-state-label-element.ts b/src/panels/lovelace/elements/hui-state-label-element.ts index bb85408e1e6b..d762b765147f 100644 --- a/src/panels/lovelace/elements/hui-state-label-element.ts +++ b/src/panels/lovelace/elements/hui-state-label-element.ts @@ -1,17 +1,11 @@ import type { HassEntity } from "home-assistant-js-websocket"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { findEntities } from "../common/find-entities"; -import { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; -import { HomeAssistant } from "../../../types"; +import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; +import type { HomeAssistant } from "../../../types"; import { computeTooltip } from "../common/compute-tooltip"; import { actionHandler } from "../common/directives/action-handler-directive"; import { handleAction } from "../common/handle-action"; @@ -20,8 +14,8 @@ import { isUnavailableState } from "../../../data/entity"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import { createEntityNotFoundWarning } from "../components/hui-warning"; import "../components/hui-warning-element"; -import { LovelaceElement, StateLabelElementConfig } from "./types"; -import { LovelacePictureElementEditor } from "../types"; +import type { LovelaceElement, StateLabelElementConfig } from "./types"; +import type { LovelacePictureElementEditor } from "../types"; @customElement("hui-state-label-element") class HuiStateLabelElement extends LitElement implements LovelaceElement { diff --git a/src/panels/lovelace/elements/types.ts b/src/panels/lovelace/elements/types.ts index e968081ca2e7..5ca44d502787 100644 --- a/src/panels/lovelace/elements/types.ts +++ b/src/panels/lovelace/elements/types.ts @@ -1,8 +1,8 @@ -import { HassServiceTarget } from "home-assistant-js-websocket"; -import { ActionConfig } from "../../../data/lovelace/config/action"; -import { HomeAssistant } from "../../../types"; -import { Condition } from "../common/validate-condition"; -import { HuiImage } from "../components/hui-image"; +import type { HassServiceTarget } from "home-assistant-js-websocket"; +import type { ActionConfig } from "../../../data/lovelace/config/action"; +import type { HomeAssistant } from "../../../types"; +import type { Condition } from "../common/validate-condition"; +import type { HuiImage } from "../components/hui-image"; interface LovelaceElementConfigBase { type: string; diff --git a/src/panels/lovelace/entity-rows/hui-button-entity-row.ts b/src/panels/lovelace/entity-rows/hui-button-entity-row.ts index c649b2664b1a..19c27ee95543 100644 --- a/src/panels/lovelace/entity-rows/hui-button-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-button-entity-row.ts @@ -1,19 +1,13 @@ import "@material/mwc-button/mwc-button"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { UNAVAILABLE } from "../../../data/entity"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { ActionRowConfig, LovelaceRow } from "./types"; +import type { ActionRowConfig, LovelaceRow } from "./types"; import { confirmAction } from "../common/confirm-action"; @customElement("hui-button-entity-row") diff --git a/src/panels/lovelace/entity-rows/hui-climate-entity-row.ts b/src/panels/lovelace/entity-rows/hui-climate-entity-row.ts index 2205c8782a98..255b2abda239 100644 --- a/src/panels/lovelace/entity-rows/hui-climate-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-climate-entity-row.ts @@ -1,18 +1,12 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/ha-climate-state"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { EntityConfig, LovelaceRow } from "./types"; +import type { EntityConfig, LovelaceRow } from "./types"; @customElement("hui-climate-entity-row") class HuiClimateEntityRow extends LitElement implements LovelaceRow { diff --git a/src/panels/lovelace/entity-rows/hui-cover-entity-row.ts b/src/panels/lovelace/entity-rows/hui-cover-entity-row.ts index 83b6a6fc2e35..4065605acd2a 100644 --- a/src/panels/lovelace/entity-rows/hui-cover-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-cover-entity-row.ts @@ -1,20 +1,15 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/ha-cover-controls"; import "../../../components/ha-cover-tilt-controls"; -import { CoverEntity, isTiltOnly } from "../../../data/cover"; -import { HomeAssistant } from "../../../types"; +import type { CoverEntity } from "../../../data/cover"; +import { isTiltOnly } from "../../../data/cover"; +import type { HomeAssistant } from "../../../types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { EntityConfig, LovelaceRow } from "./types"; +import type { EntityConfig, LovelaceRow } from "./types"; @customElement("hui-cover-entity-row") class HuiCoverEntityRow extends LitElement implements LovelaceRow { diff --git a/src/panels/lovelace/entity-rows/hui-date-entity-row.ts b/src/panels/lovelace/entity-rows/hui-date-entity-row.ts index 82a8286db118..473d06bbb9f6 100644 --- a/src/panels/lovelace/entity-rows/hui-date-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-date-entity-row.ts @@ -1,4 +1,5 @@ -import { html, LitElement, nothing, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/ha-date-input"; import { isUnavailableState, UNAVAILABLE } from "../../../data/entity"; diff --git a/src/panels/lovelace/entity-rows/hui-datetime-entity-row.ts b/src/panels/lovelace/entity-rows/hui-datetime-entity-row.ts index b215f51121bd..583f49d4f47c 100644 --- a/src/panels/lovelace/entity-rows/hui-datetime-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-datetime-entity-row.ts @@ -1,12 +1,5 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/ha-date-input"; import { format } from "date-fns"; diff --git a/src/panels/lovelace/entity-rows/hui-event-entity-row.ts b/src/panels/lovelace/entity-rows/hui-event-entity-row.ts index 67898966043d..6d0173dc9e3e 100644 --- a/src/panels/lovelace/entity-rows/hui-event-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-event-entity-row.ts @@ -1,16 +1,10 @@ -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { isUnavailableState } from "../../../data/entity"; -import { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; -import { HomeAssistant } from "../../../types"; -import { EntitiesCardEntityConfig } from "../cards/types"; +import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; +import type { HomeAssistant } from "../../../types"; +import type { EntitiesCardEntityConfig } from "../cards/types"; import { actionHandler } from "../common/directives/action-handler-directive"; import { handleAction } from "../common/handle-action"; import { hasAction } from "../common/has-action"; @@ -18,8 +12,8 @@ import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import "../components/hui-timestamp-display"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { TimestampRenderingFormat } from "../components/types"; -import { LovelaceRow } from "./types"; +import type { TimestampRenderingFormat } from "../components/types"; +import type { LovelaceRow } from "./types"; interface EventEntityConfig extends EntitiesCardEntityConfig { format?: TimestampRenderingFormat; diff --git a/src/panels/lovelace/entity-rows/hui-group-entity-row.ts b/src/panels/lovelace/entity-rows/hui-group-entity-row.ts index a530bdeabe31..a51bcc8d939e 100644 --- a/src/panels/lovelace/entity-rows/hui-group-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-group-entity-row.ts @@ -1,13 +1,14 @@ -import { LitElement, PropertyValues, html, nothing } from "lit"; +import type { PropertyValues } from "lit"; +import { LitElement, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { DOMAINS_TOGGLE } from "../../../common/const"; import { computeDomain } from "../../../common/entity/compute_domain"; import "../../../components/entity/ha-entity-toggle"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { EntityConfig, LovelaceRow } from "./types"; +import type { EntityConfig, LovelaceRow } from "./types"; @customElement("hui-group-entity-row") class HuiGroupEntityRow extends LitElement implements LovelaceRow { diff --git a/src/panels/lovelace/entity-rows/hui-humidifier-entity-row.ts b/src/panels/lovelace/entity-rows/hui-humidifier-entity-row.ts index 427e2addd199..3f8440b6647d 100644 --- a/src/panels/lovelace/entity-rows/hui-humidifier-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-humidifier-entity-row.ts @@ -1,20 +1,14 @@ -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/entity/ha-entity-toggle"; import "../../../components/ha-humidifier-state"; -import { HumidifierEntity } from "../../../data/humidifier"; -import { HomeAssistant } from "../../../types"; +import type { HumidifierEntity } from "../../../data/humidifier"; +import type { HomeAssistant } from "../../../types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { EntityConfig, LovelaceRow } from "./types"; +import type { EntityConfig, LovelaceRow } from "./types"; @customElement("hui-humidifier-entity-row") class HuiHumidifierEntityRow extends LitElement implements LovelaceRow { diff --git a/src/panels/lovelace/entity-rows/hui-input-button-entity-row.ts b/src/panels/lovelace/entity-rows/hui-input-button-entity-row.ts index 84697b89e5b5..1d3bf07265b4 100644 --- a/src/panels/lovelace/entity-rows/hui-input-button-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-input-button-entity-row.ts @@ -1,19 +1,13 @@ import "@material/mwc-button/mwc-button"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { UNAVAILABLE } from "../../../data/entity"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { ActionRowConfig, LovelaceRow } from "./types"; +import type { ActionRowConfig, LovelaceRow } from "./types"; import { confirmAction } from "../common/confirm-action"; @customElement("hui-input-button-entity-row") diff --git a/src/panels/lovelace/entity-rows/hui-input-datetime-entity-row.ts b/src/panels/lovelace/entity-rows/hui-input-datetime-entity-row.ts index 6af9f1f41e68..f65f3a8e9b89 100644 --- a/src/panels/lovelace/entity-rows/hui-input-datetime-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-input-datetime-entity-row.ts @@ -1,11 +1,5 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { computeStateName } from "../../../common/entity/compute_state_name"; import "../../../components/ha-date-input"; diff --git a/src/panels/lovelace/entity-rows/hui-input-number-entity-row.ts b/src/panels/lovelace/entity-rows/hui-input-number-entity-row.ts index 94a875f995e2..a1c2808691f6 100644 --- a/src/panels/lovelace/entity-rows/hui-input-number-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-input-number-entity-row.ts @@ -1,22 +1,16 @@ -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { debounce } from "../../../common/util/debounce"; import "../../../components/ha-slider"; import "../../../components/ha-textfield"; import { isUnavailableState } from "../../../data/entity"; import { setValue } from "../../../data/input_text"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { EntityConfig, LovelaceRow } from "./types"; +import type { EntityConfig, LovelaceRow } from "./types"; @customElement("hui-input-number-entity-row") class HuiInputNumberEntityRow extends LitElement implements LovelaceRow { diff --git a/src/panels/lovelace/entity-rows/hui-input-select-entity-row.ts b/src/panels/lovelace/entity-rows/hui-input-select-entity-row.ts index 2d4f6e5bf369..8b5c903de9ac 100644 --- a/src/panels/lovelace/entity-rows/hui-input-select-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-input-select-entity-row.ts @@ -1,5 +1,6 @@ import "@material/mwc-list/mwc-list-item"; -import { css, html, LitElement, PropertyValues, nothing } from "lit"; +import type { PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { stopPropagation } from "../../../common/dom/stop_propagation"; import { computeStateName } from "../../../common/entity/compute_state_name"; @@ -7,16 +8,14 @@ import "../../../components/ha-select"; import type { HaSelect } from "../../../components/ha-select"; import { UNAVAILABLE } from "../../../data/entity"; import { forwardHaptic } from "../../../data/haptics"; -import { - InputSelectEntity, - setInputSelectOption, -} from "../../../data/input_select"; -import { HomeAssistant } from "../../../types"; -import { EntitiesCardEntityConfig } from "../cards/types"; +import type { InputSelectEntity } from "../../../data/input_select"; +import { setInputSelectOption } from "../../../data/input_select"; +import type { HomeAssistant } from "../../../types"; +import type { EntitiesCardEntityConfig } from "../cards/types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { LovelaceRow } from "./types"; +import type { LovelaceRow } from "./types"; @customElement("hui-input-select-entity-row") class HuiInputSelectEntityRow extends LitElement implements LovelaceRow { diff --git a/src/panels/lovelace/entity-rows/hui-input-text-entity-row.ts b/src/panels/lovelace/entity-rows/hui-input-text-entity-row.ts index b217da751db2..3b17cb0cd777 100644 --- a/src/panels/lovelace/entity-rows/hui-input-text-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-input-text-entity-row.ts @@ -1,14 +1,15 @@ -import { css, html, LitElement, PropertyValues, nothing } from "lit"; +import type { PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { computeStateName } from "../../../common/entity/compute_state_name"; import "../../../components/ha-textfield"; import { isUnavailableState, UNAVAILABLE } from "../../../data/entity"; import { setValue } from "../../../data/input_text"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { EntityConfig, LovelaceRow } from "./types"; +import type { EntityConfig, LovelaceRow } from "./types"; @customElement("hui-input-text-entity-row") class HuiInputTextEntityRow extends LitElement implements LovelaceRow { diff --git a/src/panels/lovelace/entity-rows/hui-lock-entity-row.ts b/src/panels/lovelace/entity-rows/hui-lock-entity-row.ts index 454225cd6ee8..a428d3c7cf82 100644 --- a/src/panels/lovelace/entity-rows/hui-lock-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-lock-entity-row.ts @@ -1,19 +1,13 @@ import "@material/mwc-button/mwc-button"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { isUnavailableState } from "../../../data/entity"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { ConfirmableRowConfig, LovelaceRow } from "./types"; +import type { ConfirmableRowConfig, LovelaceRow } from "./types"; import { callProtectedLockService } from "../../../data/lock"; import { confirmAction } from "../common/confirm-action"; diff --git a/src/panels/lovelace/entity-rows/hui-media-player-entity-row.ts b/src/panels/lovelace/entity-rows/hui-media-player-entity-row.ts index ac7b6951561d..11965837e1fa 100644 --- a/src/panels/lovelace/entity-rows/hui-media-player-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-media-player-entity-row.ts @@ -11,15 +11,9 @@ import { mdiVolumeOff, mdiVolumePlus, } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { stateActive } from "../../../common/entity/state_active"; import { supportsFeature } from "../../../common/entity/supports-feature"; @@ -27,9 +21,11 @@ import { debounce } from "../../../common/util/debounce"; import "../../../components/ha-icon-button"; import "../../../components/ha-slider"; import { isUnavailableState } from "../../../data/entity"; -import { +import type { ControlButton, MediaPlayerEntity, +} from "../../../data/media-player"; +import { MediaPlayerEntityFeature, computeMediaDescription, } from "../../../data/media-player"; diff --git a/src/panels/lovelace/entity-rows/hui-number-entity-row.ts b/src/panels/lovelace/entity-rows/hui-number-entity-row.ts index d9ff7fd36785..b4aaba1cadce 100644 --- a/src/panels/lovelace/entity-rows/hui-number-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-number-entity-row.ts @@ -1,22 +1,16 @@ -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { debounce } from "../../../common/util/debounce"; import "../../../components/ha-slider"; import "../../../components/ha-textfield"; import { UNAVAILABLE } from "../../../data/entity"; import { setValue } from "../../../data/input_text"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { EntityConfig, LovelaceRow } from "./types"; +import type { EntityConfig, LovelaceRow } from "./types"; @customElement("hui-number-entity-row") class HuiNumberEntityRow extends LitElement implements LovelaceRow { diff --git a/src/panels/lovelace/entity-rows/hui-scene-entity-row.ts b/src/panels/lovelace/entity-rows/hui-scene-entity-row.ts index 27ddae5b70f5..8bada660cce3 100644 --- a/src/panels/lovelace/entity-rows/hui-scene-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-scene-entity-row.ts @@ -1,21 +1,15 @@ import "@material/mwc-button/mwc-button"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/entity/ha-entity-toggle"; import { UNAVAILABLE } from "../../../data/entity"; import { activateScene } from "../../../data/scene"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { ActionRowConfig, LovelaceRow } from "./types"; +import type { ActionRowConfig, LovelaceRow } from "./types"; import { confirmAction } from "../common/confirm-action"; @customElement("hui-scene-entity-row") diff --git a/src/panels/lovelace/entity-rows/hui-script-entity-row.ts b/src/panels/lovelace/entity-rows/hui-script-entity-row.ts index e884f405074f..a7731d7c0491 100644 --- a/src/panels/lovelace/entity-rows/hui-script-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-script-entity-row.ts @@ -1,20 +1,15 @@ import "@material/mwc-button/mwc-button"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { isUnavailableState } from "../../../data/entity"; -import { canRun, hasScriptFields, ScriptEntity } from "../../../data/script"; -import { HomeAssistant } from "../../../types"; +import type { ScriptEntity } from "../../../data/script"; +import { canRun, hasScriptFields } from "../../../data/script"; +import type { HomeAssistant } from "../../../types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { ActionRowConfig, LovelaceRow } from "./types"; +import type { ActionRowConfig, LovelaceRow } from "./types"; import { showMoreInfoDialog } from "../../../dialogs/more-info/show-ha-more-info-dialog"; import { confirmAction } from "../common/confirm-action"; diff --git a/src/panels/lovelace/entity-rows/hui-select-entity-row.ts b/src/panels/lovelace/entity-rows/hui-select-entity-row.ts index f65c9450049f..55290d721071 100644 --- a/src/panels/lovelace/entity-rows/hui-select-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-select-entity-row.ts @@ -1,12 +1,6 @@ import "@material/mwc-list/mwc-list-item"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { stopPropagation } from "../../../common/dom/stop_propagation"; import { computeStateName } from "../../../common/entity/compute_state_name"; @@ -14,13 +8,14 @@ import "../../../components/ha-select"; import { UNAVAILABLE } from "../../../data/entity"; import { forwardHaptic } from "../../../data/haptics"; import type { InputSelectEntity } from "../../../data/input_select"; -import { SelectEntity, setSelectOption } from "../../../data/select"; -import { HomeAssistant } from "../../../types"; -import { EntitiesCardEntityConfig } from "../cards/types"; +import type { SelectEntity } from "../../../data/select"; +import { setSelectOption } from "../../../data/select"; +import type { HomeAssistant } from "../../../types"; +import type { EntitiesCardEntityConfig } from "../cards/types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { LovelaceRow } from "./types"; +import type { LovelaceRow } from "./types"; @customElement("hui-select-entity-row") class HuiSelectEntityRow extends LitElement implements LovelaceRow { diff --git a/src/panels/lovelace/entity-rows/hui-sensor-entity-row.ts b/src/panels/lovelace/entity-rows/hui-sensor-entity-row.ts index 0a44388991f8..5c8988441965 100644 --- a/src/panels/lovelace/entity-rows/hui-sensor-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-sensor-entity-row.ts @@ -1,17 +1,11 @@ -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { isUnavailableState } from "../../../data/entity"; -import { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; +import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; import { SENSOR_DEVICE_CLASS_TIMESTAMP } from "../../../data/sensor"; -import { HomeAssistant } from "../../../types"; -import { EntitiesCardEntityConfig } from "../cards/types"; +import type { HomeAssistant } from "../../../types"; +import type { EntitiesCardEntityConfig } from "../cards/types"; import { actionHandler } from "../common/directives/action-handler-directive"; import { handleAction } from "../common/handle-action"; import { hasAction } from "../common/has-action"; @@ -19,8 +13,8 @@ import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import "../components/hui-timestamp-display"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { TimestampRenderingFormat } from "../components/types"; -import { LovelaceRow } from "./types"; +import type { TimestampRenderingFormat } from "../components/types"; +import type { LovelaceRow } from "./types"; interface SensorEntityConfig extends EntitiesCardEntityConfig { format?: TimestampRenderingFormat; diff --git a/src/panels/lovelace/entity-rows/hui-simple-entity-row.ts b/src/panels/lovelace/entity-rows/hui-simple-entity-row.ts index 220b931e0592..1396e0251ca2 100644 --- a/src/panels/lovelace/entity-rows/hui-simple-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-simple-entity-row.ts @@ -1,18 +1,12 @@ -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { HomeAssistant } from "../../../types"; -import { EntitiesCardEntityConfig } from "../cards/types"; +import type { HomeAssistant } from "../../../types"; +import type { EntitiesCardEntityConfig } from "../cards/types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { LovelaceRow } from "./types"; +import type { LovelaceRow } from "./types"; @customElement("hui-simple-entity-row") class HuiSimpleEntityRow extends LitElement implements LovelaceRow { diff --git a/src/panels/lovelace/entity-rows/hui-text-entity-row.ts b/src/panels/lovelace/entity-rows/hui-text-entity-row.ts index 87f73a722915..0424895769d6 100644 --- a/src/panels/lovelace/entity-rows/hui-text-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-text-entity-row.ts @@ -1,14 +1,16 @@ -import { css, html, LitElement, PropertyValues, nothing } from "lit"; +import type { PropertyValues } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { computeStateName } from "../../../common/entity/compute_state_name"; import "../../../components/ha-textfield"; import { isUnavailableState, UNAVAILABLE } from "../../../data/entity"; -import { setValue, TextEntity } from "../../../data/text"; -import { HomeAssistant } from "../../../types"; +import type { TextEntity } from "../../../data/text"; +import { setValue } from "../../../data/text"; +import type { HomeAssistant } from "../../../types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { EntityConfig, LovelaceRow } from "./types"; +import type { EntityConfig, LovelaceRow } from "./types"; @customElement("hui-text-entity-row") class HuiTextEntityRow extends LitElement implements LovelaceRow { diff --git a/src/panels/lovelace/entity-rows/hui-time-entity-row.ts b/src/panels/lovelace/entity-rows/hui-time-entity-row.ts index 932fe99f666e..6650b0a21e1b 100644 --- a/src/panels/lovelace/entity-rows/hui-time-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-time-entity-row.ts @@ -1,4 +1,5 @@ -import { html, LitElement, nothing, PropertyValues, TemplateResult } from "lit"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/ha-date-input"; import { isUnavailableState, UNAVAILABLE } from "../../../data/entity"; diff --git a/src/panels/lovelace/entity-rows/hui-timer-entity-row.ts b/src/panels/lovelace/entity-rows/hui-timer-entity-row.ts index cb6e6d17a1b9..514ce69a9a5e 100644 --- a/src/panels/lovelace/entity-rows/hui-timer-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-timer-entity-row.ts @@ -1,11 +1,12 @@ -import { LitElement, PropertyValues, html, nothing } from "lit"; +import type { PropertyValues } from "lit"; +import { LitElement, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../state-display/ha-timer-remaining-time"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { EntityConfig } from "./types"; +import type { EntityConfig } from "./types"; @customElement("hui-timer-entity-row") class HuiTimerEntityRow extends LitElement { diff --git a/src/panels/lovelace/entity-rows/hui-toggle-entity-row.ts b/src/panels/lovelace/entity-rows/hui-toggle-entity-row.ts index 376447f7a54b..1df87198d497 100644 --- a/src/panels/lovelace/entity-rows/hui-toggle-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-toggle-entity-row.ts @@ -1,12 +1,13 @@ -import { LitElement, PropertyValues, html, nothing } from "lit"; +import type { PropertyValues } from "lit"; +import { LitElement, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/entity/ha-entity-toggle"; import { isUnavailableState } from "../../../data/entity"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { EntityConfig, LovelaceRow } from "./types"; +import type { EntityConfig, LovelaceRow } from "./types"; @customElement("hui-toggle-entity-row") class HuiToggleEntityRow extends LitElement implements LovelaceRow { diff --git a/src/panels/lovelace/entity-rows/hui-update-entity-row.ts b/src/panels/lovelace/entity-rows/hui-update-entity-row.ts index 2cc5ecb9ede1..4d4e79d3a190 100644 --- a/src/panels/lovelace/entity-rows/hui-update-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-update-entity-row.ts @@ -1,19 +1,14 @@ -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { UpdateEntity, computeUpdateStateDisplay } from "../../../data/update"; -import { HomeAssistant } from "../../../types"; -import { EntitiesCardEntityConfig } from "../cards/types"; +import type { UpdateEntity } from "../../../data/update"; +import { computeUpdateStateDisplay } from "../../../data/update"; +import type { HomeAssistant } from "../../../types"; +import type { EntitiesCardEntityConfig } from "../cards/types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { LovelaceRow } from "./types"; +import type { LovelaceRow } from "./types"; @customElement("hui-update-entity-row") class HuiUpdateEntityRow extends LitElement implements LovelaceRow { diff --git a/src/panels/lovelace/entity-rows/hui-valve-entity-row.ts b/src/panels/lovelace/entity-rows/hui-valve-entity-row.ts index 4e86a1d7c203..69c0e4288368 100644 --- a/src/panels/lovelace/entity-rows/hui-valve-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-valve-entity-row.ts @@ -1,12 +1,13 @@ -import { LitElement, PropertyValues, html, nothing } from "lit"; +import type { PropertyValues } from "lit"; +import { LitElement, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/entity/ha-entity-toggle"; import { isUnavailableState } from "../../../data/entity"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { hasConfigOrEntityChanged } from "../common/has-changed"; import "../components/hui-generic-entity-row"; import { createEntityNotFoundWarning } from "../components/hui-warning"; -import { EntityConfig, LovelaceRow } from "./types"; +import type { EntityConfig, LovelaceRow } from "./types"; @customElement("hui-valve-entity-row") class HuiValveEntityRow extends LitElement implements LovelaceRow { diff --git a/src/panels/lovelace/entity-rows/hui-weather-entity-row.ts b/src/panels/lovelace/entity-rows/hui-weather-entity-row.ts index 8b32a65a16c3..856d9d6990a6 100644 --- a/src/panels/lovelace/entity-rows/hui-weather-entity-row.ts +++ b/src/panels/lovelace/entity-rows/hui-weather-entity-row.ts @@ -1,20 +1,13 @@ -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { ifDefined } from "lit/directives/if-defined"; import { computeStateName } from "../../../common/entity/compute_state_name"; import { isUnavailableState } from "../../../data/entity"; -import { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; +import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; +import type { ForecastEvent, WeatherEntity } from "../../../data/weather"; import { - ForecastEvent, - WeatherEntity, getDefaultForecastType, getForecast, getSecondaryWeatherAttribute, diff --git a/src/panels/lovelace/ha-panel-lovelace.ts b/src/panels/lovelace/ha-panel-lovelace.ts index 8e7ded7a8ad4..ed7b473719e5 100644 --- a/src/panels/lovelace/ha-panel-lovelace.ts +++ b/src/panels/lovelace/ha-panel-lovelace.ts @@ -1,7 +1,8 @@ import "@material/mwc-button"; import deepFreeze from "deep-freeze"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import type { UnsubscribeFunc } from "home-assistant-js-websocket"; +import type { PropertyValues, TemplateResult } from "lit"; +import { html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { constructUrlCurrentPath } from "../../common/url/construct-url"; import { @@ -10,28 +11,30 @@ import { } from "../../common/url/search-params"; import { domainToName } from "../../data/integration"; import { subscribeLovelaceUpdates } from "../../data/lovelace"; +import type { + LovelaceConfig, + LovelaceDashboardStrategyConfig, + LovelaceRawConfig, +} from "../../data/lovelace/config/types"; import { deleteConfig, fetchConfig, isStrategyDashboard, - LovelaceConfig, - LovelaceDashboardStrategyConfig, - LovelaceRawConfig, saveConfig, } from "../../data/lovelace/config/types"; import { fetchResources } from "../../data/lovelace/resource"; -import { WindowWithPreloads } from "../../data/preloads"; +import type { WindowWithPreloads } from "../../data/preloads"; import "../../layouts/hass-error-screen"; import "../../layouts/hass-loading-screen"; import type { ShowToastParams } from "../../managers/notification-manager"; -import { HomeAssistant, PanelInfo, Route } from "../../types"; +import type { HomeAssistant, PanelInfo, Route } from "../../types"; import { showToast } from "../../util/toast"; import { checkLovelaceConfig } from "./common/check-lovelace-config"; import { loadLovelaceResources } from "./common/load-resources"; import { showSaveDialog } from "./editor/show-save-config-dialog"; import "./hui-root"; import { generateLovelaceDashboardStrategy } from "./strategies/get-strategy"; -import { Lovelace } from "./types"; +import type { Lovelace } from "./types"; (window as any).loadCardHelpers = () => import("./custom-card-helpers"); diff --git a/src/panels/lovelace/header-footer/hui-buttons-header-footer.ts b/src/panels/lovelace/header-footer/hui-buttons-header-footer.ts index 2a8816347f1f..382486684242 100644 --- a/src/panels/lovelace/header-footer/hui-buttons-header-footer.ts +++ b/src/panels/lovelace/header-footer/hui-buttons-header-footer.ts @@ -1,13 +1,14 @@ -import { css, html, LitElement, TemplateResult } from "lit"; +import type { TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { classMap } from "lit/directives/class-map"; import { customElement, property, state } from "lit/decorators"; import { computeDomain } from "../../../common/entity/compute_domain"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { processConfigEntities } from "../common/process-config-entities"; import "../components/hui-buttons-base"; -import { EntityConfig } from "../entity-rows/types"; -import { LovelaceHeaderFooter } from "../types"; -import { ButtonsHeaderFooterConfig } from "./types"; +import type { EntityConfig } from "../entity-rows/types"; +import type { LovelaceHeaderFooter } from "../types"; +import type { ButtonsHeaderFooterConfig } from "./types"; @customElement("hui-buttons-header-footer") export class HuiButtonsHeaderFooter diff --git a/src/panels/lovelace/header-footer/hui-graph-header-footer.ts b/src/panels/lovelace/header-footer/hui-graph-header-footer.ts index ac466673bc24..e9c5878ec26b 100644 --- a/src/panels/lovelace/header-footer/hui-graph-header-footer.ts +++ b/src/panels/lovelace/header-footer/hui-graph-header-footer.ts @@ -1,23 +1,20 @@ -import { HassEntity } from "home-assistant-js-websocket"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import { computeDomain } from "../../../common/entity/compute_domain"; import "../../../components/ha-circular-progress"; import { subscribeHistoryStatesTimeWindow } from "../../../data/history"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { findEntities } from "../common/find-entities"; import { coordinatesMinimalResponseCompressedState } from "../common/graph/coordinates"; import "../components/hui-graph-base"; -import { LovelaceHeaderFooter, LovelaceHeaderFooterEditor } from "../types"; -import { GraphHeaderFooterConfig } from "./types"; +import type { + LovelaceHeaderFooter, + LovelaceHeaderFooterEditor, +} from "../types"; +import type { GraphHeaderFooterConfig } from "./types"; const MINUTE = 60000; const HOUR = 60 * MINUTE; diff --git a/src/panels/lovelace/header-footer/hui-picture-header-footer.ts b/src/panels/lovelace/header-footer/hui-picture-header-footer.ts index f43c560921de..3ba732318b41 100644 --- a/src/panels/lovelace/header-footer/hui-picture-header-footer.ts +++ b/src/panels/lovelace/header-footer/hui-picture-header-footer.ts @@ -1,22 +1,16 @@ -import { - CSSResultGroup, - LitElement, - PropertyValues, - css, - html, - nothing, -} from "lit"; +import type { CSSResultGroup, PropertyValues } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { ifDefined } from "lit/directives/if-defined"; import "../../../components/ha-card"; -import { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; -import { HomeAssistant } from "../../../types"; +import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; +import type { HomeAssistant } from "../../../types"; import { actionHandler } from "../common/directives/action-handler-directive"; import { handleAction } from "../common/handle-action"; import { hasAction } from "../common/has-action"; -import { LovelaceHeaderFooter } from "../types"; -import { PictureHeaderFooterConfig } from "./types"; +import type { LovelaceHeaderFooter } from "../types"; +import type { PictureHeaderFooterConfig } from "./types"; @customElement("hui-picture-header-footer") export class HuiPictureHeaderFooter diff --git a/src/panels/lovelace/header-footer/structs.ts b/src/panels/lovelace/header-footer/structs.ts index a588c4178db5..dd0a28780ff8 100644 --- a/src/panels/lovelace/header-footer/structs.ts +++ b/src/panels/lovelace/header-footer/structs.ts @@ -9,7 +9,7 @@ import { } from "superstruct"; import { actionConfigStruct } from "../editor/structs/action-struct"; import { buttonEntityConfigStruct } from "../editor/structs/button-entity-struct"; -import { LovelaceHeaderFooterConfig } from "./types"; +import type { LovelaceHeaderFooterConfig } from "./types"; export const pictureHeaderFooterConfigStruct = object({ type: string(), diff --git a/src/panels/lovelace/header-footer/types.ts b/src/panels/lovelace/header-footer/types.ts index 35dff4cef253..2611d2b73e82 100644 --- a/src/panels/lovelace/header-footer/types.ts +++ b/src/panels/lovelace/header-footer/types.ts @@ -1,5 +1,5 @@ -import { ActionConfig } from "../../../data/lovelace/config/action"; -import { EntitiesCardEntityConfig } from "../cards/types"; +import type { ActionConfig } from "../../../data/lovelace/config/action"; +import type { EntitiesCardEntityConfig } from "../cards/types"; export interface LovelaceHeaderFooterConfig { type: "buttons" | "graph" | "picture"; diff --git a/src/panels/lovelace/heading-badges/hui-entity-heading-badge.ts b/src/panels/lovelace/heading-badges/hui-entity-heading-badge.ts index e427d104d9da..e4a56daab931 100644 --- a/src/panels/lovelace/heading-badges/hui-entity-heading-badge.ts +++ b/src/panels/lovelace/heading-badges/hui-entity-heading-badge.ts @@ -1,6 +1,7 @@ import { mdiAlertCircle } from "@mdi/js"; -import { HassEntity } from "home-assistant-js-websocket"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { HassEntity } from "home-assistant-js-websocket"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import memoizeOne from "memoize-one"; @@ -11,15 +12,18 @@ import { stateActive } from "../../../common/entity/state_active"; import { stateColorCss } from "../../../common/entity/state_color"; import "../../../components/ha-heading-badge"; import "../../../components/ha-state-icon"; -import { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; +import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler"; import "../../../state-display/state-display"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { actionHandler } from "../common/directives/action-handler-directive"; import { handleAction } from "../common/handle-action"; import { hasAction } from "../common/has-action"; import { DEFAULT_CONFIG } from "../editor/heading-badge-editor/hui-entity-heading-badge-editor"; -import { LovelaceHeadingBadge, LovelaceHeadingBadgeEditor } from "../types"; -import { EntityHeadingBadgeConfig } from "./types"; +import type { + LovelaceHeadingBadge, + LovelaceHeadingBadgeEditor, +} from "../types"; +import type { EntityHeadingBadgeConfig } from "./types"; @customElement("hui-entity-heading-badge") export class HuiEntityHeadingBadge diff --git a/src/panels/lovelace/heading-badges/hui-error-heading-badge.ts b/src/panels/lovelace/heading-badges/hui-error-heading-badge.ts index 921059276359..ced1175db17c 100644 --- a/src/panels/lovelace/heading-badges/hui-error-heading-badge.ts +++ b/src/panels/lovelace/heading-badges/hui-error-heading-badge.ts @@ -1,13 +1,14 @@ import { mdiAlertCircle } from "@mdi/js"; import { dump } from "js-yaml"; -import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, state } from "lit/decorators"; import "../../../components/ha-badge"; import "../../../components/ha-svg-icon"; -import { HomeAssistant } from "../../../types"; +import type { HomeAssistant } from "../../../types"; import { showAlertDialog } from "../custom-card-helpers"; -import { LovelaceBadge } from "../types"; -import { ErrorBadgeConfig } from "./types"; +import type { LovelaceBadge } from "../types"; +import type { ErrorBadgeConfig } from "./types"; export const createErrorHeadingBadgeElement = (config) => { const el = document.createElement("hui-error-heading-badge"); diff --git a/src/panels/lovelace/heading-badges/hui-heading-badge.ts b/src/panels/lovelace/heading-badges/hui-heading-badge.ts index 92c5b04ca87e..3cc1c25a385a 100644 --- a/src/panels/lovelace/heading-badges/hui-heading-badge.ts +++ b/src/panels/lovelace/heading-badges/hui-heading-badge.ts @@ -1,7 +1,8 @@ -import { PropertyValues, ReactiveElement } from "lit"; +import type { PropertyValues } from "lit"; +import { ReactiveElement } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; -import { MediaQueriesListener } from "../../../common/dom/media_query"; +import type { MediaQueriesListener } from "../../../common/dom/media_query"; import "../../../components/ha-svg-icon"; import type { HomeAssistant } from "../../../types"; import { @@ -10,7 +11,7 @@ import { } from "../common/validate-condition"; import { createHeadingBadgeElement } from "../create-element/create-heading-badge-element"; import type { LovelaceHeadingBadge } from "../types"; -import { LovelaceHeadingBadgeConfig } from "./types"; +import type { LovelaceHeadingBadgeConfig } from "./types"; declare global { interface HASSDomEvents { diff --git a/src/panels/lovelace/heading-badges/types.ts b/src/panels/lovelace/heading-badges/types.ts index e87ccb1d64f4..45055824ee30 100644 --- a/src/panels/lovelace/heading-badges/types.ts +++ b/src/panels/lovelace/heading-badges/types.ts @@ -1,5 +1,5 @@ -import { ActionConfig } from "../../../data/lovelace/config/action"; -import { Condition } from "../common/validate-condition"; +import type { ActionConfig } from "../../../data/lovelace/config/action"; +import type { Condition } from "../common/validate-condition"; export type LovelaceHeadingBadgeConfig = { type?: string; diff --git a/src/panels/lovelace/hui-editor.ts b/src/panels/lovelace/hui-editor.ts index fd6dcf2722f7..476cb2f1bf34 100644 --- a/src/panels/lovelace/hui-editor.ts +++ b/src/panels/lovelace/hui-editor.ts @@ -2,14 +2,8 @@ import { undoDepth } from "@codemirror/commands"; import "@material/mwc-button"; import { mdiClose } from "@mdi/js"; import { dump, load } from "js-yaml"; -import { - css, - CSSResultGroup, - html, - LitElement, - PropertyValues, - TemplateResult, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { array, assert, object, optional, string, type } from "superstruct"; @@ -27,10 +21,8 @@ import type { HomeAssistant } from "../../types"; import { showToast } from "../../util/toast"; import type { Lovelace } from "./types"; import "../../components/ha-top-app-bar-fixed"; -import { - LovelaceRawConfig, - isStrategyDashboard, -} from "../../data/lovelace/config/types"; +import type { LovelaceRawConfig } from "../../data/lovelace/config/types"; +import { isStrategyDashboard } from "../../data/lovelace/config/types"; const lovelaceStruct = type({ title: optional(string()), diff --git a/src/panels/lovelace/hui-root.ts b/src/panels/lovelace/hui-root.ts index 3c749fe1a87f..0fe8d4f6de18 100644 --- a/src/panels/lovelace/hui-root.ts +++ b/src/panels/lovelace/hui-root.ts @@ -17,14 +17,8 @@ import { } from "@mdi/js"; import "@polymer/paper-tabs/paper-tab"; import "@polymer/paper-tabs/paper-tabs"; -import { - CSSResultGroup, - LitElement, - PropertyValues, - TemplateResult, - css, - html, -} from "lit"; +import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit"; +import { LitElement, css, html } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { ifDefined } from "lit/directives/if-defined"; @@ -33,7 +27,7 @@ import { isComponentLoaded } from "../../common/config/is_component_loaded"; import { fireEvent } from "../../common/dom/fire_event"; import { shouldHandleRequestSelectedEvent } from "../../common/mwc/handle-request-selected-event"; import { navigate } from "../../common/navigate"; -import { LocalizeKeys } from "../../common/translations/localize"; +import type { LocalizeKeys } from "../../common/translations/localize"; import { constructUrlCurrentPath } from "../../common/url/construct-url"; import { addSearchParam, @@ -52,11 +46,9 @@ import "../../components/ha-menu-button"; import "../../components/ha-svg-icon"; import "../../components/ha-tabs"; import type { LovelacePanelConfig } from "../../data/lovelace"; -import { - LovelaceConfig, - isStrategyDashboard, -} from "../../data/lovelace/config/types"; -import { LovelaceViewConfig } from "../../data/lovelace/config/view"; +import type { LovelaceConfig } from "../../data/lovelace/config/types"; +import { isStrategyDashboard } from "../../data/lovelace/config/types"; +import type { LovelaceViewConfig } from "../../data/lovelace/config/view"; import { deleteDashboard, fetchDashboards, @@ -841,6 +833,10 @@ class HUIRoot extends LitElement { showEditViewDialog(this, { lovelace: this.lovelace!, viewIndex: this._curView as number, + saveCallback: (viewIndex: number, viewConfig: LovelaceViewConfig) => { + const path = viewConfig.path || viewIndex; + this._navigateToView(path); + }, }); } diff --git a/src/panels/lovelace/sections/hui-error-section.ts b/src/panels/lovelace/sections/hui-error-section.ts index 801f6f0379c9..7f38a1739536 100644 --- a/src/panels/lovelace/sections/hui-error-section.ts +++ b/src/panels/lovelace/sections/hui-error-section.ts @@ -2,9 +2,9 @@ import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/ha-label-badge"; import "../../../components/ha-svg-icon"; -import { LovelaceSectionElement } from "../../../data/lovelace"; -import { LovelaceSectionConfig } from "../../../data/lovelace/config/section"; -import { HomeAssistant } from "../../../types"; +import type { LovelaceSectionElement } from "../../../data/lovelace"; +import type { LovelaceSectionConfig } from "../../../data/lovelace/config/section"; +import type { HomeAssistant } from "../../../types"; export interface ErrorSectionConfig extends LovelaceSectionConfig { error: string; diff --git a/src/panels/lovelace/sections/hui-grid-section.ts b/src/panels/lovelace/sections/hui-grid-section.ts index d08c0fe47cb3..fe4236bea038 100644 --- a/src/panels/lovelace/sections/hui-grid-section.ts +++ b/src/panels/lovelace/sections/hui-grid-section.ts @@ -1,21 +1,23 @@ import { mdiPlus } from "@mdi/js"; -import { CSSResultGroup, LitElement, css, html, nothing } from "lit"; +import type { CSSResultGroup } from "lit"; +import { LitElement, css, html, nothing } from "lit"; import { property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { repeat } from "lit/directives/repeat"; import { styleMap } from "lit/directives/style-map"; -import "../../../components/ha-ripple"; import { fireEvent } from "../../../common/dom/fire_event"; +import "../../../components/ha-ripple"; import type { HaSortableOptions } from "../../../components/ha-sortable"; -import { LovelaceSectionElement } from "../../../data/lovelace"; -import { LovelaceCardConfig } from "../../../data/lovelace/config/card"; +import type { LovelaceSectionElement } from "../../../data/lovelace"; +import type { LovelaceCardConfig } from "../../../data/lovelace/config/card"; import type { LovelaceSectionConfig } from "../../../data/lovelace/config/section"; import { haStyle } from "../../../resources/styles"; import type { HomeAssistant } from "../../../types"; -import { HuiCard } from "../cards/hui-card"; +import type { HuiCard } from "../cards/hui-card"; import { computeCardGridSize } from "../common/compute-card-grid-size"; import "../components/hui-card-edit-mode"; import { moveCard } from "../editor/config-util"; +import type { LovelaceCardPath } from "../editor/lovelace-path"; import type { Lovelace } from "../types"; const CARD_SORTABLE_OPTIONS: HaSortableOptions = { @@ -23,8 +25,18 @@ const CARD_SORTABLE_OPTIONS: HaSortableOptions = { delayOnTouchOnly: true, direction: "vertical", invertedSwapThreshold: 0.7, + group: "card", } as HaSortableOptions; +const IMPORT_MODE_CARD_SORTABLE_OPTIONS: HaSortableOptions = { + ...CARD_SORTABLE_OPTIONS, + sort: false, + group: { + name: "card", + put: false, + }, +}; + export class GridSection extends LitElement implements LovelaceSectionElement { @property({ attribute: false }) public hass!: HomeAssistant; @@ -38,6 +50,8 @@ export class GridSection extends LitElement implements LovelaceSectionElement { @property({ attribute: false }) public cards: HuiCard[] = []; + @property({ attribute: false }) public importOnly = false; + @state() _config?: LovelaceSectionConfig; @state() _dragging = false; @@ -65,20 +79,29 @@ export class GridSection extends LitElement implements LovelaceSectionElement { const editMode = Boolean(this.lovelace?.editMode && !this.isStrategy); + const sortableOptions = this.importOnly + ? IMPORT_MODE_CARD_SORTABLE_OPTIONS + : CARD_SORTABLE_OPTIONS; + return html` -
    +
    ${repeat( cardsConfig, (cardConfig) => this._getKey(cardConfig), @@ -89,6 +112,11 @@ export class GridSection extends LitElement implements LovelaceSectionElement { const { rows, columns } = computeCardGridSize(gridOptions); + const cardPath: LovelaceCardPath = [ + this.viewIndex!, + this.index!, + idx, + ]; return html`
    ${editMode ? html` ${card} @@ -117,7 +148,7 @@ export class GridSection extends LitElement implements LovelaceSectionElement { `; } )} - ${editMode + ${editMode && !this.importOnly ? html`