Compare commits

..

47 Commits

Author SHA1 Message Date
Bram Kragten
db1f81e0ef 20230301.0 (#15657) 2023-03-01 16:36:00 +01:00
Bram Kragten
657a74e8ad Bumped version to 20230301.0 2023-03-01 15:32:57 +01:00
Bram Kragten
f803bbadc9 Set css optimise level to 0 (#15652) 2023-03-01 14:24:00 +00:00
Paul Bottein
2ab8bba4b0 Sort null and undefined at the bottom in data-table (#15651)
Sort null and undefined at the bottom in datatable
2023-03-01 14:22:57 +00:00
Philip Allgaier
1a1c00ba62 Add loading info text to hardware config page (#15616)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2023-03-01 15:10:14 +01:00
Bram Kragten
7b4850b5d6 Bump core js, replace serve with serve-handler (#15637)
* Bump core js, remove serve from deps

* resplace serve with serve-handler
2023-03-01 09:08:56 -05:00
dependabot[bot]
42688e100c Bump hls.js from 1.3.3 to 1.3.4 (#15644)
Bumps [hls.js](https://github.com/video-dev/hls.js) from 1.3.3 to 1.3.4.
- [Release notes](https://github.com/video-dev/hls.js/releases)
- [Changelog](https://github.com/video-dev/hls.js/blob/master/docs/release-process.md)
- [Commits](https://github.com/video-dev/hls.js/compare/v1.3.3...v1.3.4)

---
updated-dependencies:
- dependency-name: hls.js
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-03-01 09:04:48 -05:00
Bram Kragten
d32cde3cf8 Fix more info position (#15650) 2023-03-01 13:42:42 +00:00
Paul Bottein
34c15d96c1 Reduce more-info dialog margin (#15649)
Reduce more-info margin
2023-03-01 13:28:35 +00:00
Paul Bottein
0d869d53e3 Adapt more info control height for small screen (#15647)
* Adapt more info control height for small screen

* Fix light picker sliders
2023-03-01 12:15:12 +01:00
Paul Bottein
ccf670465b Fix statistics name sorting in developer tools (#15646) 2023-03-01 10:30:11 +00:00
Erik Montnemery
4a9ec7233d Fetch weather units from core (#15212) 2023-03-01 11:24:48 +01:00
Paul Bottein
c747ab7605 Add on/off icon for some domains (#15640) 2023-03-01 11:24:35 +01:00
Paul Bottein
9c703ab469 Add color temperature value to light more info (#15639) 2023-03-01 11:24:01 +01:00
Paul Bottein
e3b797e85c Fix more info for disabled entity (#15641) 2023-03-01 10:29:19 +01:00
Bram Kragten
a5541996d7 Prevent config menu jump when cloud info loads (#15638)
Prevent config menu jump
2023-02-28 17:21:52 +01:00
Paul Bottein
ea95fb98aa Fix lock more info with attributes (#15622)
* Fix lock more info with attributes

* Update src/dialogs/more-info/controls/more-info-lock.ts

Co-authored-by: Bram Kragten <mail@bramkragten.nl>

---------

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2023-02-28 10:34:35 +00:00
karwosts
4b428a60cd Fix a hang in history graph card editor (#15623) 2023-02-28 11:06:51 +01:00
Steve Repsher
9ce4563dd4 Prefer nothing over empty templates (#15633) 2023-02-28 11:02:47 +01:00
J. Nick Koston
4031d9cc78 Avoid loading the whole entity registry for more info (#15627) 2023-02-28 10:58:45 +01:00
J. Nick Koston
20f2f5b317 Avoid fetching all stats metadata when there are no entities on the energy panel (#15591)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2023-02-28 10:57:04 +01:00
Paulus Schoutsen
6af57fa2cd Temp patch to fix Rollup build (#15631) 2023-02-28 10:54:27 +01:00
Steve Repsher
17e6e132d1 Minify HTML and CSS template literals (#15624) 2023-02-28 00:02:04 -05:00
dependabot[bot]
67d064db28 Bump @typescript-eslint/eslint-plugin from 5.53.0 to 5.54.0 (#15629)
Bumps [@typescript-eslint/eslint-plugin](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/eslint-plugin) from 5.53.0 to 5.54.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.54.0/packages/eslint-plugin)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/eslint-plugin"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-28 04:37:18 +00:00
dependabot[bot]
e0df5e4631 Bump @typescript-eslint/parser from 5.53.0 to 5.54.0 (#15628)
Bumps [@typescript-eslint/parser](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/parser) from 5.53.0 to 5.54.0.
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/parser/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v5.54.0/packages/parser)

---
updated-dependencies:
- dependency-name: "@typescript-eslint/parser"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-28 04:20:49 +00:00
Paul Bottein
a8a85a2af6 20230227.0 (#15625) 2023-02-27 21:10:57 +01:00
Paul Bottein
702c24d908 Bumped version to 20230227.0 2023-02-27 21:02:33 +01:00
Marius
5eafecf95d add domain icons for fan (#15613) 2023-02-27 16:30:14 +00:00
Bram Kragten
7f644530e4 Add delete and add thread dataset (#15619) 2023-02-27 17:27:58 +01:00
wizmo2
3aea416175 Add --ha-label-badge-border-radius (#15597)
allows button shape to be customized in themes.
2023-02-27 16:48:38 +01:00
Paul Bottein
868c414759 Show all hardware button for supervised installs (#15617) 2023-02-27 15:03:34 +00:00
Paul Bottein
f4848964c3 Restart dialog improvements (#15611) 2023-02-27 12:00:02 +01:00
dependabot[bot]
b10c95e803 Bump weekstart from 1.1.0 to 2.0.0 (#15608)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-02-27 10:38:15 +01:00
J. Nick Koston
25cf879793 Fix duplicate fetch of stats metadata in more info (#15590) 2023-02-27 10:27:26 +01:00
Steve Repsher
ba3b265b9a Fix invalid style in password manager polyfill and ha-bar (#15603) 2023-02-27 10:22:55 +01:00
Steve Repsher
7568ae5964 Fix unsafe optional chaining (#15604) 2023-02-27 10:11:44 +01:00
Paul Bottein
d4ace99de3 Fix display precision label when unknown or unavailable (#15610) 2023-02-27 10:10:35 +01:00
dependabot[bot]
087bda22d4 Bump systemjs from 6.13.0 to 6.14.0 (#15606) 2023-02-27 00:59:24 -05:00
dependabot[bot]
83ffc754c9 Bump vis-network from 9.1.2 to 9.1.4 (#15609) 2023-02-27 00:56:22 -05:00
dependabot[bot]
7a8ea4a9f9 Bump eslint from 8.34.0 to 8.35.0 (#15607) 2023-02-27 00:55:11 -05:00
Bram Kragten
df8f46388f 20230224.0 (#15588) 2023-02-24 21:06:33 +01:00
Bram Kragten
650f32ba6d Bumped version to 20230224.0 2023-02-24 21:05:47 +01:00
Bram Kragten
dd6437376d 20230223.0 (#15575) 2023-02-23 19:01:26 +01:00
Bram Kragten
971d2ff1c2 20230222.0 (#15551)Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Steve Repsher <steverep@users.noreply.github.com> Co-authored-by: Bram Kragten <mail@bramkragten.nl> Co-authored-by: Paul Bottein <paul.bottein@gmail.com> Co-authored-by: Flavien Charlon <Flavien@users.noreply.github.com> Co-authored-by: Raman Gupta <7243222+raman325@users.noreply.github.com> Co-authored-by: karwosts <32912880+karwosts@users.noreply.github.com> Co-authored-by: Erik Montnemery <erik@montnemery.com> Co-authored-by: J. Nick Koston <nick@koston.org> Co-authored-by: Yosi Levy <37745463+yosilevy@users.noreply.github.com> Co-authored-by: lunmay <28674102+lunmay@users.noreply.github.com> Co-authored-by: Jc2k <john.carr@unrouted.co.uk> Co-authored-by: chiahsing <chiahsing@gmail.com> Co-authored-by: Paulus Schoutsen <balloob@gmail.com> Fix a coloring issue with climate states (#15325) resolver-webpack from 0.13.1 to 0.13.2 (#15355) resolver-webpack](https://github.com/import-js/eslint-plugin-import) from 0.13.1 to 0.13.2. fix some errors (#15334) Fix stats data being fetched for all entities when there are no energy/water stat ids (#15428) Fix custom card documentation url (#15439) fixes (#15446) fix dedupe precommit (#15399) Fix typo from restart dialog (whitch -> which) (#15458) Fix typo in water consumption description (#15464) Fix initial scroll inside more info dialog (#15473) Fix alert padding inside more info dialog (#15477) Fix area name in target picker (#15511) fix history crash) (#15509) Fix promise constructors with returns (#15486) fixes feb23 (#15487) Fix errors in duration data processing in Automation UI Editor (#15422) Fix map sizing in grids and h-stacks (#15290) Fix a typo: Add OpenTread Border Router (#15528) Fix tile card typings (#15529) fix more info history tooltips (#15533) Fix double defined cloud-account (#15537) Fix more info control assumed state color (#15548) Fix a bug in cast launcher that hassURL and path are incorrectly passed (#15546) 2023-02-22 18:16:25 +01:00
Bram Kragten
e6de8ec94d 20230202.0 (#15323) 2023-02-02 20:45:17 +01:00
Bram Kragten
0e06267055 20230201.0 (#15307) 2023-02-01 17:17:12 +01:00
Bram Kragten
63a35c9d68 20230130.0 (#15278) 2023-01-30 22:03:34 +01:00
389 changed files with 2302 additions and 2096 deletions

View File

@@ -59,7 +59,6 @@
"prefer-destructuring": "off",
"no-restricted-globals": [2, "event"],
"prefer-promise-reject-errors": "off",
"no-unsafe-optional-chaining": "warn",
"import/prefer-default-export": "off",
"import/no-default-export": "off",
"import/no-unresolved": "off",
@@ -120,7 +119,6 @@
"lit/no-template-map": "off",
"lit/no-native-attributes": "warn",
"lit/no-this-assign-in-render": "warn",
"lit/prefer-nothing": "warn",
"lit-a11y/click-events-have-key-events": ["off"],
"lit-a11y/no-autofocus": "off",
"lit-a11y/alt-text": "warn",

View File

@@ -18,4 +18,3 @@ updates:
# Ignore rollup and plugins until everything else is updated
- dependency-name: "*rollup*"
- dependency-name: "@rollup/*"
- dependency-name: "serve"

View File

@@ -53,13 +53,25 @@ module.exports.definedVars = ({ isProdBuild, latestBuild, defineOverlay }) => ({
...defineOverlay,
});
const htmlMinifierOptions = {
caseSensitive: true,
collapseWhitespace: true,
conservativeCollapse: true,
decodeEntities: true,
removeComments: true,
removeRedundantAttributes: true,
minifyCSS: {
level: 0,
},
};
module.exports.terserOptions = (latestBuild) => ({
safari10: !latestBuild,
ecma: latestBuild ? undefined : 5,
output: { comments: false },
});
module.exports.babelOptions = ({ latestBuild }) => ({
module.exports.babelOptions = ({ latestBuild, isProdBuild }) => ({
babelrc: false,
compact: false,
presets: [
@@ -67,7 +79,7 @@ module.exports.babelOptions = ({ latestBuild }) => ({
"@babel/preset-env",
{
useBuiltIns: "entry",
corejs: { version: "3.28", proposals: true },
corejs: { version: "3.29", proposals: true },
bugfixes: true,
},
],
@@ -93,12 +105,26 @@ module.exports.babelOptions = ({ latestBuild }) => ({
"@babel/plugin-syntax-import-meta",
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-syntax-top-level-await",
// Support various proposals
"@babel/plugin-proposal-optional-chaining",
"@babel/plugin-proposal-nullish-coalescing-operator",
["@babel/plugin-proposal-decorators", { decoratorsBeforeExport: true }],
["@babel/plugin-proposal-private-methods", { loose: true }],
["@babel/plugin-proposal-private-property-in-object", { loose: true }],
["@babel/plugin-proposal-class-properties", { loose: true }],
// Minify template literals for production
isProdBuild && [
"template-html-minifier",
{
modules: {
lit: ["html", "svg", { name: "css", encapsulation: "style" }],
"@polymer/polymer/lib/utils/html-tag": ["html"],
},
strictCSS: true,
htmlMinifier: htmlMinifierOptions,
failOnError: true, // we can turn this off in case of false positives
},
],
].filter(Boolean),
exclude: [
// \\ for Windows, / for Mac OS and Linux

View File

@@ -43,7 +43,14 @@ const createRollupConfig = ({
preserveEntrySignatures: false,
plugins: [
ignore({
files: bundle.emptyPackages({ latestBuild }),
files: bundle
.emptyPackages({ latestBuild })
// TEMP HACK: Makes Rollup build work again
.concat(
require.resolve(
"@webcomponents/scoped-custom-element-registry/scoped-custom-element-registry.min"
)
),
}),
resolve({
extensions,
@@ -54,7 +61,7 @@ const createRollupConfig = ({
commonjs(),
json(),
babel({
...bundle.babelOptions({ latestBuild }),
...bundle.babelOptions({ latestBuild, isProdBuild }),
extensions,
babelHelpers: isWDS ? "inline" : "bundled",
}),

View File

@@ -51,7 +51,7 @@ const createWebpackConfig = ({
use: {
loader: "babel-loader",
options: {
...bundle.babelOptions({ latestBuild }),
...bundle.babelOptions({ latestBuild, isProdBuild }),
cacheDirectory: !isProdBuild,
cacheCompression: false,
},

View File

@@ -1,4 +1,4 @@
import { html, TemplateResult } from "lit";
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";
@@ -18,9 +18,9 @@ class HcDemo extends HassElement {
@state() private _lovelaceConfig?: LovelaceConfig;
protected render(): TemplateResult {
protected render() {
if (!this._lovelaceConfig) {
return html``;
return nothing;
}
return html`
<hc-lovelace

View File

@@ -1,5 +1,5 @@
import { mdiTelevision } from "@mdi/js";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
import { customElement, state } from "lit/decorators";
import { CastManager } from "../../../src/cast/cast_manager";
import { castSendShowDemo } from "../../../src/cast/receiver_messages";
@@ -20,12 +20,12 @@ class CastDemoRow extends LitElement implements LovelaceRow {
// No config possible.
}
protected render(): TemplateResult {
protected render() {
if (
!this._castManager ||
this._castManager.castState === "NO_DEVICES_AVAILABLE"
) {
return html``;
return nothing;
}
return html`
<ha-svg-icon .path=${mdiTelevision}></ha-svg-icon>

View File

@@ -1,5 +1,5 @@
import "@material/mwc-button";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
import { until } from "lit/directives/until";
import "../../../src/components/ha-card";
@@ -30,9 +30,9 @@ export class HADemoCard extends LitElement implements LovelaceCard {
public setConfig(_config: LovelaceCardConfig) {}
protected render(): TemplateResult {
protected render() {
if (this._hidden) {
return html``;
return nothing;
}
return html`
<ha-card>

View File

@@ -1,4 +1,4 @@
import { html, css } from "lit";
import { css, html, nothing } from "lit";
import { customElement, property } from "lit/decorators";
import { until } from "lit/directives/until";
import { HaMarkdown } from "../../../src/components/ha-markdown";
@@ -10,7 +10,7 @@ class PageDescription extends HaMarkdown {
render() {
if (!PAGES[this.page].description) {
return html``;
return nothing;
}
return html`

View File

@@ -1,5 +1,5 @@
import { dump } from "js-yaml";
import { html, css, LitElement, TemplateResult } from "lit";
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";
@@ -127,9 +127,9 @@ export class DemoAutomationDescribeAction extends LitElement {
@state() _action = initialAction;
protected render(): TemplateResult {
protected render() {
if (!this.hass) {
return html``;
return nothing;
}
return html`
<ha-card header="Actions">

View File

@@ -1,5 +1,5 @@
import { dump } from "js-yaml";
import { css, html, LitElement, TemplateResult } from "lit";
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";
@@ -53,9 +53,9 @@ export class DemoAutomationDescribeCondition extends LitElement {
@state() _condition = initialCondition;
protected render(): TemplateResult {
protected render() {
if (!this.hass) {
return html``;
return nothing;
}
return html`

View File

@@ -1,5 +1,5 @@
import { dump } from "js-yaml";
import { css, html, LitElement, TemplateResult } from "lit";
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";
@@ -64,9 +64,9 @@ export class DemoAutomationDescribeTrigger extends LitElement {
@state() _trigger = initialTrigger;
protected render(): TemplateResult {
protected render() {
if (!this.hass) {
return html``;
return nothing;
}
return html`

View File

@@ -1,5 +1,6 @@
/* eslint-disable lit/no-template-arrow */
import { html, css, LitElement, TemplateResult } from "lit";
import { css, html, LitElement, nothing } from "lit";
import { customElement, property } from "lit/decorators";
import "../../../../src/components/ha-card";
import "../../../../src/components/trace/hat-script-graph";
@@ -29,9 +30,9 @@ const traces: DemoTrace[] = [
export class DemoAutomationTraceTimeline extends LitElement {
@property({ attribute: false }) hass?: HomeAssistant;
protected render(): TemplateResult {
protected render() {
if (!this.hass) {
return html``;
return nothing;
}
return html`
${traces.map(

View File

@@ -1,14 +1,15 @@
/* eslint-disable lit/no-template-arrow */
import { html, css, LitElement, TemplateResult } from "lit";
import { css, html, LitElement, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
import "../../../../src/components/ha-card";
import "../../../../src/components/trace/hat-script-graph";
import "../../../../src/components/trace/hat-trace-timeline";
import { customElement, property, state } from "lit/decorators";
import { provideHass } from "../../../../src/fake_data/provide_hass";
import { HomeAssistant } from "../../../../src/types";
import { DemoTrace } from "../../data/traces/types";
import { basicTrace } from "../../data/traces/basic_trace";
import { motionLightTrace } from "../../data/traces/motion-light-trace";
import { DemoTrace } from "../../data/traces/types";
const traces: DemoTrace[] = [basicTrace, motionLightTrace];
@@ -18,9 +19,9 @@ export class DemoAutomationTrace extends LitElement {
@state() private _selected = {};
protected render(): TemplateResult {
protected render() {
if (!this.hass) {
return html``;
return nothing;
}
return html`
${traces.map(

View File

@@ -2,7 +2,7 @@ import {
HassEntity,
HassEntityAttributeBase,
} from "home-assistant-js-websocket";
import { css, html, LitElement, TemplateResult } from "lit";
import { css, html, LitElement, nothing } from "lit";
import { customElement, property } from "lit/decorators";
import memoizeOne from "memoize-one";
import { computeDomain } from "../../../../src/common/entity/compute_domain";
@@ -387,9 +387,9 @@ export class DemoEntityState extends LitElement {
hass.updateTranslations("config", "en");
}
protected render(): TemplateResult {
protected render() {
if (!this.hass) {
return html``;
return nothing;
}
return html`

View File

@@ -1,22 +1,22 @@
import { html, css, LitElement, TemplateResult } from "lit";
import { css, html, LitElement, nothing } from "lit";
import "../../../../src/components/ha-formfield";
import "../../../../src/components/ha-switch";
import { classMap } from "lit/directives/class-map";
import { customElement, property, state } from "lit/decorators";
import { classMap } from "lit/directives/class-map";
import { IntegrationManifest } from "../../../../src/data/integration";
import { DeviceRegistryEntry } from "../../../../src/data/device_registry";
import { EntityRegistryEntry } from "../../../../src/data/entity_registry";
import { provideHass } from "../../../../src/fake_data/provide_hass";
import { HomeAssistant } from "../../../../src/types";
import "../../../../src/panels/config/integrations/ha-integration-card";
import "../../../../src/panels/config/integrations/ha-ignored-config-entry-card";
import "../../../../src/panels/config/integrations/ha-config-flow-card";
import type {
ConfigEntryExtended,
DataEntryFlowProgressExtended,
} from "../../../../src/panels/config/integrations/ha-config-integrations";
import { DeviceRegistryEntry } from "../../../../src/data/device_registry";
import { EntityRegistryEntry } from "../../../../src/data/entity_registry";
import "../../../../src/panels/config/integrations/ha-ignored-config-entry-card";
import "../../../../src/panels/config/integrations/ha-integration-card";
import { HomeAssistant } from "../../../../src/types";
const createConfigEntry = (
title: string,
@@ -231,9 +231,9 @@ export class DemoIntegrationCard extends LitElement {
@state() isCloud = false;
protected render(): TemplateResult {
protected render() {
if (!this.hass) {
return html``;
return nothing;
}
return html`
<div class="container">

View File

@@ -6,6 +6,7 @@ import {
CSSResultGroup,
html,
LitElement,
nothing,
PropertyValues,
TemplateResult,
} from "lit";
@@ -73,8 +74,8 @@ export class HassioAddonStore extends LitElement {
}
}
protected render(): TemplateResult {
let repos: TemplateResult[] = [];
protected render() {
let repos: (TemplateResult | typeof nothing)[] = [];
if (this.supervisor.store.repositories) {
repos = this.addonRepositories(
@@ -173,7 +174,7 @@ export class HassioAddonStore extends LitElement {
.supervisor=${this.supervisor}
></hassio-addon-repository>
`
: html``;
: nothing;
})
);

View File

@@ -4,7 +4,7 @@ import {
html,
LitElement,
PropertyValues,
TemplateResult,
nothing,
} from "lit";
import { customElement, property, state } from "lit/decorators";
import memoizeOne from "memoize-one";
@@ -47,9 +47,9 @@ class HassioAddonNetwork extends LitElement {
this._setNetworkConfig();
}
protected render(): TemplateResult {
protected render() {
if (!this._config) {
return html``;
return nothing;
}
const hasHiddenOptions = Object.keys(this._config).find(

View File

@@ -8,7 +8,7 @@ import {
html,
LitElement,
PropertyValues,
TemplateResult,
nothing,
} from "lit";
import { customElement, property, query, state } from "lit/decorators";
import { classMap } from "lit/directives/class-map";
@@ -160,9 +160,9 @@ export class HassioBackups extends LitElement {
}))
);
protected render(): TemplateResult {
protected render() {
if (!this.supervisor) {
return html``;
return nothing;
}
return html`
<hass-tabs-subpage-data-table

View File

@@ -1,6 +1,13 @@
import { mdiFolder, mdiHomeAssistant, mdiPuzzle } from "@mdi/js";
import { PaperInputElement } from "@polymer/paper-input/paper-input";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import {
css,
CSSResultGroup,
html,
LitElement,
TemplateResult,
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";
@@ -11,9 +18,9 @@ import "../../../src/components/ha-formfield";
import "../../../src/components/ha-radio";
import type { HaRadio } from "../../../src/components/ha-radio";
import {
HassioBackupDetail,
HassioFullBackupCreateParams,
HassioPartialBackupCreateParams,
HassioBackupDetail,
} from "../../../src/data/hassio/backup";
import { Supervisor } from "../../../src/data/supervisor/supervisor";
import { PolymerChangedEvent } from "../../../src/polymer-types";
@@ -115,9 +122,9 @@ export class SupervisorBackupContent extends LitElement {
this.supervisor?.localize(`backup.${key}`) ||
this.localize!(`ui.panel.page-onboarding.restore.${key}`);
protected render(): TemplateResult {
protected render() {
if (!this.onboarding && !this.supervisor) {
return html``;
return nothing;
}
const foldersSection =
this.backupType === "partial" ? this._getSection("folders") : undefined;

View File

@@ -1,6 +1,6 @@
import "@material/mwc-button";
import { mdiHomeAssistant } from "@mdi/js";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
import { customElement, property } from "lit/decorators";
import memoizeOne from "memoize-one";
import "../../../src/components/buttons/ha-progress-button";
@@ -33,14 +33,14 @@ export class HassioUpdate extends LitElement {
).length
);
protected render(): TemplateResult {
protected render() {
if (!this.supervisor) {
return html``;
return nothing;
}
const updatesAvailable = this._pendingUpdates(this.supervisor);
if (!updatesAvailable) {
return html``;
return nothing;
}
return html`
@@ -80,9 +80,9 @@ export class HassioUpdate extends LitElement {
name: string,
key: string,
object: HassioHomeAssistantInfo | HassioSupervisorInfo | HassioHassOSInfo
): TemplateResult {
) {
if (!object.update_available) {
return html``;
return nothing;
}
return html`
<ha-card outlined>

View File

@@ -1,5 +1,5 @@
import { mdiClose } from "@mdi/js";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { css, CSSResultGroup, 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";
@@ -36,9 +36,9 @@ export class DialogHassioBackupUpload
fireEvent(this, "dialog-closed", { dialog: this.localName });
}
protected render(): TemplateResult {
protected render() {
if (!this._dialogParams) {
return html``;
return nothing;
}
return html`

View File

@@ -1,9 +1,11 @@
import { ActionDetail } from "@material/mwc-list";
import "@material/mwc-list/mwc-list-item";
import { mdiClose, mdiDotsVertical } from "@mdi/js";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { css, CSSResultGroup, 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";
import { stopPropagation } from "../../../../src/common/dom/stop_propagation";
import { slugify } from "../../../../src/common/string/slugify";
import "../../../../src/components/buttons/ha-progress-button";
import "../../../../src/components/ha-alert";
@@ -11,11 +13,11 @@ 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 { extractApiErrorMessage } from "../../../../src/data/hassio/common";
import {
fetchHassioBackupInfo,
HassioBackupDetail,
} from "../../../../src/data/hassio/backup";
import { extractApiErrorMessage } from "../../../../src/data/hassio/common";
import {
showAlertDialog,
showConfirmationDialog,
@@ -27,8 +29,6 @@ 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 { atLeastVersion } from "../../../../src/common/config/version";
import { stopPropagation } from "../../../../src/common/dom/stop_propagation";
@customElement("dialog-hassio-backup")
class HassioBackupDialog
@@ -62,9 +62,9 @@ class HassioBackupDialog
fireEvent(this, "dialog-closed", { dialog: this.localName });
}
protected render(): TemplateResult {
protected render() {
if (!this._dialogParams || !this._backup) {
return html``;
return nothing;
}
return html`
<ha-dialog

View File

@@ -1,15 +1,15 @@
import "@material/mwc-button";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
import { customElement, property, query, state } from "lit/decorators";
import { fireEvent } from "../../../../src/common/dom/fire_event";
import "../../../../src/components/ha-alert";
import "../../../../src/components/buttons/ha-progress-button";
import "../../../../src/components/ha-alert";
import { createCloseHeading } from "../../../../src/components/ha-dialog";
import { extractApiErrorMessage } from "../../../../src/data/hassio/common";
import {
createHassioFullBackup,
createHassioPartialBackup,
} from "../../../../src/data/hassio/backup";
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";
@@ -42,9 +42,9 @@ class HassioCreateBackupDialog extends LitElement {
fireEvent(this, "dialog-closed", { dialog: this.localName });
}
protected render(): TemplateResult {
protected render() {
if (!this._dialogParams) {
return html``;
return nothing;
}
return html`
<ha-dialog

View File

@@ -1,5 +1,5 @@
import "@material/mwc-list/mwc-list-item";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { css, CSSResultGroup, 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";
@@ -55,9 +55,9 @@ class HassioDatadiskDialog extends LitElement {
fireEvent(this, "dialog-closed", { dialog: this.localName });
}
protected render(): TemplateResult {
protected render() {
if (!this.dialogParams) {
return html``;
return nothing;
}
return html`
<ha-dialog

8
hassio/src/dialogs/hardware/dialog-hassio-hardware.ts Executable file → Normal file
View File

@@ -1,13 +1,13 @@
import { mdiClose } from "@mdi/js";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { css, CSSResultGroup, 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/search-input";
import { stringCompare } from "../../../../src/common/string/compare";
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 { dump } from "../../../../src/resources/js-yaml-dump";
import { haStyle, haStyleDialog } from "../../../../src/resources/styles";
@@ -53,9 +53,9 @@ class HassioHardwareDialog extends LitElement {
fireEvent(this, "dialog-closed", { dialog: this.localName });
}
protected render(): TemplateResult {
protected render() {
if (!this._dialogParams) {
return html``;
return nothing;
}
const devices = _filterDevices(

View File

@@ -1,4 +1,4 @@
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
import { createCloseHeading } from "../../../../src/components/ha-dialog";
import "../../../../src/components/ha-markdown";
@@ -27,9 +27,9 @@ class HassioMarkdownDialog extends LitElement {
this._opened = false;
}
protected render(): TemplateResult {
protected render() {
if (!this._opened) {
return html``;
return nothing;
}
return html`
<ha-dialog

View File

@@ -5,7 +5,7 @@ import "@material/mwc-tab";
import "@material/mwc-tab-bar";
import { mdiClose } from "@mdi/js";
import { PaperInputElement } from "@polymer/paper-input/paper-input";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { css, CSSResultGroup, 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";
@@ -83,9 +83,9 @@ export class DialogHassioNetwork
fireEvent(this, "dialog-closed", { dialog: this.localName });
}
protected render(): TemplateResult {
protected render() {
if (!this._params || !this._interface) {
return html``;
return nothing;
}
return html`

View File

@@ -1,11 +1,11 @@
import "@polymer/paper-tooltip/paper-tooltip";
import "@material/mwc-button/mwc-button";
import { mdiDelete, mdiDeleteOff } from "@mdi/js";
import "@polymer/paper-input/paper-input";
import type { PaperInputElement } from "@polymer/paper-input/paper-input";
import "@polymer/paper-item/paper-item";
import "@polymer/paper-item/paper-item-body";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import "@polymer/paper-tooltip/paper-tooltip";
import { css, CSSResultGroup, 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";
@@ -19,14 +19,14 @@ import {
HassioAddonRepository,
} from "../../../../src/data/hassio/addon";
import { extractApiErrorMessage } from "../../../../src/data/hassio/common";
import { haStyle, haStyleDialog } from "../../../../src/resources/styles";
import type { HomeAssistant } from "../../../../src/types";
import { HassioRepositoryDialogParams } from "./show-dialog-repositories";
import {
addStoreRepository,
fetchStoreRepositories,
removeStoreRepository,
} from "../../../../src/data/supervisor/store";
import { haStyle, haStyleDialog } from "../../../../src/resources/styles";
import type { HomeAssistant } from "../../../../src/types";
import { HassioRepositoryDialogParams } from "./show-dialog-repositories";
@customElement("dialog-hassio-repositories")
class HassioRepositoriesDialog extends LitElement {
@@ -82,9 +82,9 @@ class HassioRepositoriesDialog extends LitElement {
.map((repo) => repo.slug)
);
protected render(): TemplateResult {
protected render() {
if (!this._dialogParams?.supervisor || this._repositories === undefined) {
return html``;
return nothing;
}
const repositories = this._filteredRepositories(this._repositories);
const usedRepositories = this._filteredUsedRepositories(

View File

@@ -1,5 +1,5 @@
import { sanitizeUrl } from "@braintree/sanitize-url";
import { html, LitElement, TemplateResult } from "lit";
import { html, LitElement, TemplateResult, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
import { navigate } from "../../src/common/navigate";
import {
@@ -101,13 +101,13 @@ class HassioMyRedirect extends LitElement {
navigate(url, { replace: true });
}
protected render(): TemplateResult {
protected render() {
if (this._error) {
return html`<hass-error-screen
.error=${this._error}
></hass-error-screen>`;
}
return html``;
return nothing;
}
private _createRedirectUrl(redirect: Redirect): string {

View File

@@ -5,7 +5,7 @@ import {
html,
LitElement,
PropertyValues,
TemplateResult,
nothing,
} from "lit";
import { customElement, property, state } from "lit/decorators";
import memoizeOne from "memoize-one";
@@ -116,12 +116,12 @@ class UpdateAvailableCard extends LitElement {
storeAddons.find((addon) => addon.slug === slug)
);
protected render(): TemplateResult {
protected render() {
if (
!this._updateType ||
(this._updateType === "addon" && !this._addonInfo)
) {
return html``;
return nothing;
}
const changelog = changelogUrl(this._updateType, this._version_latest);

View File

@@ -100,7 +100,7 @@
"app-datepicker": "^5.1.0",
"chart.js": "^3.3.2",
"comlink": "^4.4.1",
"core-js": "^3.28.0",
"core-js": "^3.29.0",
"cropperjs": "^1.5.13",
"date-fns": "^2.29.3",
"date-fns-tz": "^2.0.0",
@@ -108,7 +108,7 @@
"deep-freeze": "^0.0.1",
"fuse.js": "^6.6.2",
"google-timezones-json": "^1.0.2",
"hls.js": "^1.3.3",
"hls.js": "^1.3.4",
"home-assistant-js-websocket": "^8.0.1",
"idb-keyval": "^6.2.0",
"intl-messageformat": "^10.3.1",
@@ -134,10 +134,10 @@
"tsparticles-preset-links": "^2.9.3",
"unfetch": "^5.0.0",
"vis-data": "^7.1.4",
"vis-network": "^9.1.2",
"vis-network": "^9.1.4",
"vue": "^2.7.14",
"vue2-daterange-picker": "^0.6.8",
"weekstart": "^1.1.0",
"weekstart": "^2.0.0",
"workbox-cacheable-response": "^6.5.4",
"workbox-core": "^6.5.4",
"workbox-expiration": "^6.5.4",
@@ -178,17 +178,19 @@
"@types/marked": "^4",
"@types/mocha": "^10",
"@types/qrcode": "^1.5.0",
"@types/serve-handler": "^6",
"@types/sortablejs": "^1",
"@types/tar": "^6",
"@types/webspeechapi": "^0.0.29",
"@typescript-eslint/eslint-plugin": "^5.53.0",
"@typescript-eslint/parser": "^5.53.0",
"@typescript-eslint/eslint-plugin": "^5.54.0",
"@typescript-eslint/parser": "^5.54.0",
"@web/dev-server": "^0.1.35",
"@web/dev-server-rollup": "^0.2.11",
"babel-loader": "^9.1.2",
"babel-plugin-template-html-minifier": "^4.1.0",
"chai": "^4.3.7",
"del": "^7.0.0",
"eslint": "^8.34.0",
"eslint": "^8.35.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-config-prettier": "^8.6.0",
@@ -229,10 +231,10 @@
"rollup-plugin-string": "^3.0.0",
"rollup-plugin-terser": "^5.3.0",
"rollup-plugin-visualizer": "^5.9.0",
"serve": "^11.3.2",
"serve-handler": "^6.1.5",
"sinon": "^15.0.1",
"source-map-url": "^0.4.1",
"systemjs": "^6.13.0",
"systemjs": "^6.14.0",
"tar": "^6.1.13",
"terser-webpack-plugin": "^5.3.6",
"ts-lit-plugin": "^1.2.1",

View File

@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "home-assistant-frontend"
version = "20230223.0"
version = "20230301.0"
license = {text = "Apache-2.0"}
description = "The Home Assistant frontend"
readme = "README.md"

View File

@@ -5,8 +5,8 @@ import {
CSSResultGroup,
html,
LitElement,
nothing,
PropertyValues,
TemplateResult,
} from "lit";
import { customElement, property, state } from "lit/decorators";
import "../components/ha-alert";
@@ -134,11 +134,11 @@ export class HaAuthFlow extends litLocalizeLiteMixin(LitElement) {
}, 500);
}
private _renderForm(): TemplateResult {
private _renderForm() {
switch (this._state) {
case "step":
if (this._step == null) {
return html``;
return nothing;
}
return html`
${this._renderStep(this._step)}
@@ -176,11 +176,11 @@ export class HaAuthFlow extends litLocalizeLiteMixin(LitElement) {
</ha-alert>
`;
default:
return html``;
return nothing;
}
}
private _renderStep(step: DataEntryFlowStep): TemplateResult {
private _renderStep(step: DataEntryFlowStep) {
switch (step.type) {
case "abort":
return html`
@@ -202,7 +202,7 @@ export class HaAuthFlow extends litLocalizeLiteMixin(LitElement) {
.content=${this._computeStepDescription(step)}
></ha-markdown>
`
: html``}
: nothing}
<ha-form
.data=${this._stepData}
.schema=${autocompleteLoginFields(step.data_schema)}
@@ -228,7 +228,7 @@ export class HaAuthFlow extends litLocalizeLiteMixin(LitElement) {
: ""}
`;
default:
return html``;
return nothing;
}
}

View File

@@ -1,6 +1,6 @@
/* eslint-disable lit/prefer-static-styles */
import { html, LitElement, TemplateResult } from "lit";
import { css, html, LitElement, nothing } from "lit";
import { customElement, property } from "lit/decorators";
import { styleMap } from "lit/directives/style-map";
import { fireEvent } from "../common/dom/fire_event";
import type { HaFormSchema } from "../components/ha-form/types";
import { autocompleteLoginFields } from "../data/auth";
@@ -29,35 +29,43 @@ export class HaPasswordManagerPolyfill extends LitElement {
@property({ attribute: false }) public boundingRect?: DOMRect;
private _styleElement?: HTMLStyleElement;
public connectedCallback() {
super.connectedCallback();
this._styleElement = document.createElement("style");
this._styleElement.textContent = css`
.password-manager-polyfill {
position: absolute;
opacity: 0;
z-index: -1;
}
.password-manager-polyfill input {
width: 100%;
height: 62px;
padding: 0;
border: 0;
}
.password-manager-polyfill input[type="submit"] {
width: 0;
height: 0;
}
`.toString();
document.head.append(this._styleElement);
}
public disconnectedCallback() {
super.disconnectedCallback();
this._styleElement?.remove();
delete this._styleElement;
}
protected createRenderRoot() {
// Add under document body so the element isn't placed inside any shadow roots
return document.body;
}
private get styles() {
return `
.password-manager-polyfill {
position: absolute;
top: ${this.boundingRect?.y || 148}px;
left: calc(50% - ${(this.boundingRect?.width || 360) / 2}px);
width: ${this.boundingRect?.width || 360}px;
opacity: 0;
z-index: -1;
}
.password-manager-polyfill input {
width: 100%;
height: 62px;
padding: 0;
border: 0;
}
.password-manager-polyfill input[type="submit"] {
width: 0;
height: 0;
}
`;
}
protected render(): TemplateResult {
protected render() {
if (
this.step &&
this.step.type === "form" &&
@@ -67,6 +75,11 @@ export class HaPasswordManagerPolyfill extends LitElement {
return html`
<form
class="password-manager-polyfill"
style=${styleMap({
top: `${this.boundingRect?.y || 148}px`,
left: `calc(50% - ${(this.boundingRect?.width || 360) / 2}px)`,
width: `${this.boundingRect?.width || 360}px`,
})}
aria-hidden="true"
@submit=${this._handleSubmit}
>
@@ -74,16 +87,13 @@ export class HaPasswordManagerPolyfill extends LitElement {
this.render_input(input)
)}
<input type="submit" />
<style>
${this.styles}
</style>
</form>
`;
}
return html``;
return nothing;
}
private render_input(schema: HaFormSchema): TemplateResult | string {
private render_input(schema: HaFormSchema) {
const inputType = schema.name.includes("password") ? "password" : "text";
if (schema.type !== "string") {
return "";

View File

@@ -1,7 +1,6 @@
/** Constants to be used in the frontend. */
import {
mdiAccount,
mdiAirFilter,
mdiAlert,
mdiAngleAcute,
@@ -24,7 +23,6 @@ import {
mdiDatabase,
mdiEarHearing,
mdiEye,
mdiFan,
mdiFlash,
mdiFlower,
mdiFormatListBulleted,
@@ -49,7 +47,6 @@ import {
mdiProgressClock,
mdiRayVertex,
mdiRemote,
mdiRobot,
mdiRobotVacuum,
mdiScriptText,
mdiSineWave,
@@ -60,15 +57,12 @@ import {
mdiThermostat,
mdiTimerOutline,
mdiTransmissionTower,
mdiVideo,
mdiWater,
mdiWaterPercent,
mdiWeatherCloudy,
mdiWeatherPouring,
mdiWeatherRainy,
mdiWeatherWindy,
mdiWeight,
mdiWhiteBalanceSunny,
mdiWifi,
} from "@mdi/js";
@@ -83,15 +77,12 @@ export const DEFAULT_DOMAIN_ICON = mdiBookmark;
export const FIXED_DOMAIN_ICONS = {
alert: mdiAlert,
air_quality: mdiAirFilter,
automation: mdiRobot,
calendar: mdiCalendar,
camera: mdiVideo,
climate: mdiThermostat,
configurator: mdiCog,
conversation: mdiMicrophoneMessage,
counter: mdiCounter,
demo: mdiHomeAssistant,
fan: mdiFan,
google_assistant: mdiGoogleAssistant,
group: mdiGoogleCirclesCommunities,
homeassistant: mdiHomeAssistant,
@@ -107,7 +98,6 @@ export const FIXED_DOMAIN_ICONS = {
notify: mdiCommentAlert,
number: mdiRayVertex,
persistent_notification: mdiBell,
person: mdiAccount,
plant: mdiFlower,
proximity: mdiAppleSafari,
remote: mdiRemote,
@@ -118,13 +108,10 @@ export const FIXED_DOMAIN_ICONS = {
sensor: mdiEye,
siren: mdiBullhorn,
simple_alarm: mdiBell,
sun: mdiWhiteBalanceSunny,
text: mdiFormTextbox,
timer: mdiTimerOutline,
updater: mdiCloudUpload,
vacuum: mdiRobotVacuum,
water_heater: mdiThermometer,
weather: mdiWeatherCloudy,
zone: mdiMapMarkerRadius,
};

View File

@@ -15,6 +15,8 @@ import {
mdiCheckCircleOutline,
mdiClock,
mdiCloseCircleOutline,
mdiFan,
mdiFanOff,
mdiGestureTapButton,
mdiLanConnect,
mdiLanDisconnect,
@@ -28,6 +30,8 @@ import {
mdiPowerPlug,
mdiPowerPlugOff,
mdiRestart,
mdiRobot,
mdiRobotOff,
mdiSpeaker,
mdiSpeakerOff,
mdiSpeakerPause,
@@ -39,7 +43,12 @@ import {
mdiTelevisionPlay,
mdiToggleSwitchVariant,
mdiToggleSwitchVariantOff,
mdiVideo,
mdiVideoOff,
mdiWaterBoiler,
mdiWaterBoilerOff,
mdiWeatherNight,
mdiWhiteBalanceSunny,
} from "@mdi/js";
import { HassEntity } from "home-assistant-js-websocket";
import { UpdateEntity, updateIsInstalling } from "../../data/update";
@@ -81,6 +90,9 @@ export const domainIconWithoutDefault = (
case "alarm_control_panel":
return alarmPanelIcon(compareState);
case "automation":
return compareState === "off" ? mdiRobotOff : mdiRobot;
case "binary_sensor":
return binarySensorIcon(compareState, stateObj);
@@ -94,6 +106,9 @@ export const domainIconWithoutDefault = (
return mdiGestureTapButton;
}
case "camera":
return compareState === "off" ? mdiVideoOff : mdiVideo;
case "cover":
return coverIcon(compareState, stateObj);
@@ -108,6 +123,9 @@ export const domainIconWithoutDefault = (
}
return compareState === "not_home" ? mdiAccountArrowRight : mdiAccount;
case "fan":
return compareState === "off" ? mdiFanOff : mdiFan;
case "humidifier":
return compareState === "off" ? mdiAirHumidifierOff : mdiAirHumidifier;
@@ -216,7 +234,7 @@ export const domainIconWithoutDefault = (
case "sun":
return stateObj?.state === "above_horizon"
? FIXED_DOMAIN_ICONS[domain]
? mdiWhiteBalanceSunny
: mdiWeatherNight;
case "switch_as_x":
@@ -232,6 +250,9 @@ export const domainIconWithoutDefault = (
: mdiPackageUp
: mdiPackage;
case "water_heater":
return compareState === "off" ? mdiWaterBoilerOff : mdiWaterBoiler;
case "weather":
return weatherIcon(stateObj?.state);
}

View File

@@ -143,7 +143,10 @@ export class StateHistoryChartTimeline extends LitElement {
}
},
afterUpdate: (y) => {
if (this._yWidth !== Math.floor(y.width)) {
if (
this._yWidth !== Math.floor(y.width) &&
y.ticks.length === this.data.length
) {
this._yWidth = Math.floor(y.width);
fireEvent(this, "y-width-changed", {
value: this._yWidth,

View File

@@ -4,11 +4,12 @@ import {
CSSResultGroup,
html,
LitElement,
nothing,
PropertyValues,
TemplateResult,
} from "lit";
import { customElement, property, state, eventOptions } from "lit/decorators";
import { customElement, eventOptions, property, state } from "lit/decorators";
import { isComponentLoaded } from "../../common/config/is_component_loaded";
import { restoreScroll } from "../../common/decorators/restore-scroll";
import {
HistoryResult,
LineChartUnit,
@@ -17,7 +18,6 @@ import {
import type { HomeAssistant } from "../../types";
import "./state-history-chart-line";
import "./state-history-chart-timeline";
import { restoreScroll } from "../../common/decorators/restore-scroll";
const CANVAS_TIMELINE_ROWS_CHUNK = 10; // Split up the canvases to avoid hitting the render limit
@@ -71,7 +71,7 @@ export class StateHistoryCharts extends LitElement {
// @ts-ignore
@restoreScroll(".container") private _savedScrollPos?: number;
protected render(): TemplateResult {
protected render() {
if (!isComponentLoaded(this.hass, "history")) {
return html`<div class="info">
${this.hass.localize("ui.components.history_charts.history_disabled")}
@@ -130,9 +130,9 @@ export class StateHistoryCharts extends LitElement {
private _renderHistoryItem = (
item: TimelineEntity[] | LineChartUnit,
index: number
): TemplateResult => {
) => {
if (!item || index === undefined) {
return html``;
return nothing;
}
if (!Array.isArray(item)) {
return html`<div class="entry-container">

View File

@@ -6,6 +6,7 @@ import {
CSSResultGroup,
html,
LitElement,
nothing,
PropertyValues,
TemplateResult,
} from "lit";
@@ -73,7 +74,7 @@ export interface DataTableColumnData<T = any> extends DataTableSortColumnData {
title: TemplateResult | string;
label?: TemplateResult | string;
type?: "numeric" | "icon" | "icon-button" | "overflow-menu";
template?: (data: any, row: T) => TemplateResult | string;
template?: (data: any, row: T) => TemplateResult | string | typeof nothing;
width?: string;
maxWidth?: string;
grows?: boolean;
@@ -352,13 +353,10 @@ export class HaDataTable extends LitElement {
`;
}
private _renderRow = (
row: DataTableRowData,
index: number
): TemplateResult => {
private _renderRow = (row: DataTableRowData, index: number) => {
// not sure how this happens...
if (!row) {
return html``;
return nothing;
}
if (row.append) {
return html` <div class="mdc-data-table__row">${row.content}</div> `;

View File

@@ -67,11 +67,11 @@ const sortData = (
}
}
// Ensure "undefined" is always sorted to the bottom
if (valA === undefined && valB !== undefined) {
// Ensure "undefined" and "null" are always sorted to the bottom
if (valA == null && valB != null) {
return 1;
}
if (valB === undefined && valA !== undefined) {
if (valB == null && valA != null) {
return -1;
}

View File

@@ -1,7 +1,7 @@
import "@material/mwc-button/mwc-button";
import { UnsubscribeFunc } from "home-assistant-js-websocket";
import { html, LitElement, PropertyValues, TemplateResult } from "lit";
import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit";
import { UnsubscribeFunc } from "home-assistant-js-websocket";
import { html, LitElement, PropertyValues, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
import memoizeOne from "memoize-one";
import { fireEvent } from "../../common/dom/fire_event";
@@ -230,9 +230,9 @@ export class HaAreaDevicesPicker extends SubscribeMixin(LitElement) {
}
}
protected render(): TemplateResult {
protected render() {
if (!this._devices || !this._areas || !this._entities) {
return html``;
return nothing;
}
const areas = this._getAreasWithDevices(
this._devices,

View File

@@ -1,5 +1,5 @@
import "@material/mwc-list/mwc-list-item";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
import { property, state } from "lit/decorators";
import { fireEvent } from "../../common/dom/fire_event";
import {
@@ -85,9 +85,9 @@ export abstract class HaDeviceAutomationPicker<
return `${this._automations[idx].device_id}_${idx}`;
}
protected render(): TemplateResult {
protected render() {
if (this._renderEmpty) {
return html``;
return nothing;
}
const value = this._value;
return html`

View File

@@ -1,4 +1,4 @@
import { css, html, LitElement, TemplateResult } from "lit";
import { css, html, LitElement, nothing } from "lit";
import { customElement, property } from "lit/decorators";
import { fireEvent } from "../../common/dom/fire_event";
import { PolymerChangedEvent } from "../../polymer-types";
@@ -49,9 +49,9 @@ class HaDevicesPicker extends LitElement {
@property() public entityFilter?: HaDevicePickerEntityFilterFunc;
protected render(): TemplateResult {
protected render() {
if (!this.hass) {
return html``;
return nothing;
}
const currentDevices = this._currentDevices;

View File

@@ -1,5 +1,5 @@
import type { HassEntity } from "home-assistant-js-websocket";
import { css, html, LitElement, 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";
@@ -76,9 +76,9 @@ class HaEntitiesPickerLight extends LitElement {
@property() public entityFilter?: HaEntityPickerEntityFilterFunc;
protected render(): TemplateResult {
protected render() {
if (!this.hass) {
return html``;
return nothing;
}
const currentEntities = this._currentEntities;

View File

@@ -1,5 +1,5 @@
import { HassEntity } from "home-assistant-js-websocket";
import { html, LitElement, PropertyValues, TemplateResult } from "lit";
import { html, LitElement, PropertyValues, nothing } from "lit";
import { customElement, property, query } from "lit/decorators";
import { formatAttributeName } from "../../data/entity_attributes";
import { PolymerChangedEvent } from "../../polymer-types";
@@ -60,9 +60,9 @@ class HaEntityAttributePicker extends LitElement {
}
}
protected render(): TemplateResult {
protected render() {
if (!this.hass) {
return html``;
return nothing;
}
return html`

View File

@@ -1,14 +1,14 @@
import { HassEntity } from "home-assistant-js-websocket";
import { html, LitElement, PropertyValues, TemplateResult } from "lit";
import { html, LitElement, PropertyValues, nothing } from "lit";
import { customElement, property, query } from "lit/decorators";
import { fireEvent } from "../../common/dom/fire_event";
import { computeStateDisplay } from "../../common/entity/compute_state_display";
import { PolymerChangedEvent } from "../../polymer-types";
import { getStates } from "../../common/entity/get_states";
import { formatAttributeValue } from "../../data/entity_attributes";
import { PolymerChangedEvent } from "../../polymer-types";
import { HomeAssistant } from "../../types";
import "../ha-combo-box";
import type { HaComboBox } from "../ha-combo-box";
import { formatAttributeValue } from "../../data/entity_attributes";
import { fireEvent } from "../../common/dom/fire_event";
export type HaEntityPickerEntityFilterFunc = (entityId: HassEntity) => boolean;
@@ -64,9 +64,9 @@ class HaEntityStatePicker extends LitElement {
}
}
protected render(): TemplateResult {
protected render() {
if (!this.hass) {
return html``;
return nothing;
}
return html`

View File

@@ -1,4 +1,4 @@
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
import { customElement, property } from "lit/decorators";
import { fireEvent } from "../../common/dom/fire_event";
import type { PolymerChangedEvent } from "../../polymer-types";
@@ -56,9 +56,9 @@ class HaStatisticsPicker extends LitElement {
})
public ignoreRestrictionsOnFirstStatistic = false;
protected render(): TemplateResult {
protected render() {
if (!this.hass) {
return html``;
return nothing;
}
const ignoreRestriction =

View File

@@ -6,7 +6,7 @@ import {
html,
LitElement,
PropertyValues,
TemplateResult,
nothing,
} from "lit";
import { property, state } from "lit/decorators";
import { ifDefined } from "lit/directives/if-defined";
@@ -45,7 +45,7 @@ export class StateBadge extends LitElement {
return this.stateColor || (domain === "light" && this.stateColor !== false);
}
protected render(): TemplateResult {
protected render() {
const stateObj = this.stateObj;
// We either need a `stateObj` or one override
@@ -56,7 +56,7 @@ export class StateBadge extends LitElement {
}
if (!this._showIcon) {
return html``;
return nothing;
}
const domain = stateObj ? computeStateDomain(stateObj) : undefined;

View File

@@ -1,6 +1,6 @@
import "@polymer/paper-tooltip/paper-tooltip";
import type { HassEntity } from "home-assistant-js-websocket";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
import { customElement, property } from "lit/decorators";
import { computeStateName } from "../../common/entity/compute_state_name";
import { computeRTL } from "../../common/util/compute_rtl";
@@ -21,9 +21,9 @@ class StateInfo extends LitElement {
@property() public color?: string;
protected render(): TemplateResult {
protected render() {
if (!this.hass || !this.stateObj) {
return html``;
return nothing;
}
const name = computeStateName(this.stateObj);

View File

@@ -1,5 +1,5 @@
import { html, LitElement, TemplateResult } from "lit";
import { 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";
@@ -54,9 +54,9 @@ class HaAddonPicker extends LitElement {
this._getAddons();
}
protected render(): TemplateResult {
protected render() {
if (!this._addons) {
return html``;
return nothing;
}
return html`
<ha-combo-box

View File

@@ -1,5 +1,5 @@
import { HassEntity } from "home-assistant-js-websocket";
import { css, html, LitElement, TemplateResult } from "lit";
import { css, html, LitElement, nothing } from "lit";
import { customElement, property } from "lit/decorators";
import { fireEvent } from "../common/dom/fire_event";
import { SubscribeMixin } from "../mixins/subscribe-mixin";
@@ -60,9 +60,9 @@ export class HaAreasPicker extends SubscribeMixin(LitElement) {
@property({ type: Boolean }) public required?: boolean;
protected render(): TemplateResult {
protected render() {
if (!this.hass) {
return html``;
return nothing;
}
const currentAreas = this._currentAreas;

View File

@@ -1,5 +1,12 @@
import { HassEntity } from "home-assistant-js-websocket";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import {
css,
CSSResultGroup,
html,
LitElement,
TemplateResult,
nothing,
} from "lit";
import { customElement, property, state } from "lit/decorators";
import {
formatAttributeName,
@@ -21,9 +28,9 @@ class HaAttributes extends LitElement {
@state() private _expanded = false;
protected render(): TemplateResult {
protected render() {
if (!this.stateObj) {
return html``;
return nothing;
}
const attributes = this.computeDisplayAttributes(
@@ -32,7 +39,7 @@ class HaAttributes extends LitElement {
)
);
if (attributes.length === 0) {
return html``;
return nothing;
}
return html`

View File

@@ -44,7 +44,6 @@ export class HaBar extends LitElement {
}
rect:last-child {
fill: var(--ha-bar-primary-color, var(--primary-color));
rx: var(--ha-bar-border-radius, 4px);
}
svg {
border-radius: var(--ha-bar-border-radius, 4px);

View File

@@ -1,5 +1,5 @@
import "@material/mwc-list/mwc-list-item";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
import { customElement, property } from "lit/decorators";
import memoizeOne from "memoize-one";
import { fireEvent } from "../common/dom/fire_event";
@@ -51,9 +51,9 @@ class HaBluePrintPicker extends LitElement {
);
});
protected render(): TemplateResult {
protected render() {
if (!this.hass) {
return html``;
return nothing;
}
return html`
<ha-select

View File

@@ -4,7 +4,7 @@ import {
html,
LitElement,
PropertyValues,
TemplateResult,
nothing,
} from "lit";
import { customElement, property, state } from "lit/decorators";
import { isComponentLoaded } from "../common/config/is_component_loaded";
@@ -76,9 +76,9 @@ export class HaCameraStream extends LitElement {
this._connected = false;
}
protected render(): TemplateResult {
protected render() {
if (!this.stateObj) {
return html``;
return nothing;
}
if (__DEMO__ || this._shouldRenderMJPEG) {
return html`<img
@@ -102,7 +102,7 @@ export class HaCameraStream extends LitElement {
.url=${this._url}
.posterUrl=${this._posterUrl}
></ha-hls-player>`
: html``;
: nothing;
}
if (this.stateObj.attributes.frontend_stream_type === STREAM_TYPE_WEB_RTC) {
return html`<ha-web-rtc-player
@@ -115,7 +115,7 @@ export class HaCameraStream extends LitElement {
.posterUrl=${this._posterUrl}
></ha-web-rtc-player>`;
}
return html``;
return nothing;
}
private get _shouldRenderMJPEG() {

View File

@@ -1,4 +1,4 @@
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
import { customElement, property } from "lit/decorators";
@customElement("ha-card")
@@ -70,11 +70,11 @@ export class HaCard extends LitElement {
`;
}
protected render(): TemplateResult {
protected render() {
return html`
${this.header
? html`<h1 class="card-header">${this.header}</h1>`
: html``}
: nothing}
<slot></slot>
`;
}

View File

@@ -1,16 +1,16 @@
import "@material/mwc-list/mwc-list-item";
import { html, LitElement, TemplateResult } from "lit";
import { 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 { PolymerChangedEvent } from "../polymer-types";
import { HomeAssistant } from "../types";
import type { HaComboBox } from "./ha-combo-box";
import { caseInsensitiveStringCompare } from "../common/string/compare";
import { ConfigEntry, getConfigEntries } from "../data/config_entries";
import { domainToName } from "../data/integration";
import { caseInsensitiveStringCompare } from "../common/string/compare";
import { PolymerChangedEvent } from "../polymer-types";
import { HomeAssistant } from "../types";
import { brandsUrl } from "../util/brands-url";
import "./ha-combo-box";
import type { HaComboBox } from "./ha-combo-box";
export interface ConfigEntryExtended extends ConfigEntry {
localized_domain_name?: string;
@@ -72,9 +72,9 @@ class HaConfigEntryPicker extends LitElement {
/>
</mwc-list-item>`;
protected render(): TemplateResult {
protected render() {
if (!this._configEntries) {
return html``;
return nothing;
}
return html`
<ha-combo-box

View File

@@ -1,5 +1,5 @@
import { mdiStop } from "@mdi/js";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { css, CSSResultGroup, 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";
@@ -20,9 +20,9 @@ class HaCoverControls extends LitElement {
@property({ attribute: false }) public stateObj!: CoverEntity;
protected render(): TemplateResult {
protected render() {
if (!this.stateObj) {
return html``;
return nothing;
}
return html`

View File

@@ -1,5 +1,5 @@
import { mdiArrowBottomLeft, mdiArrowTopRight, mdiStop } from "@mdi/js";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { css, CSSResultGroup, 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";
@@ -19,9 +19,9 @@ class HaCoverTiltControls extends LitElement {
@property({ attribute: false }) stateObj!: CoverEntity;
protected render(): TemplateResult {
protected render() {
if (!this.stateObj) {
return html``;
return nothing;
}
return html` <ha-icon-button

View File

@@ -1,6 +1,6 @@
import "@material/mwc-button/mwc-button";
import "app-datepicker";
import { css, html, LitElement } from "lit";
import { css, html, LitElement, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
import { fireEvent } from "../common/dom/fire_event";
import { nextRender } from "../common/util/render-status";
@@ -38,7 +38,7 @@ export class HaDialogDatePicker extends LitElement {
render() {
if (!this._params) {
return html``;
return nothing;
}
return html`<ha-dialog open @closed=${this.closeDialog}>
<app-datepicker

View File

@@ -5,7 +5,7 @@ import {
html,
LitElement,
PropertyValues,
TemplateResult,
nothing,
} from "lit";
import { customElement, property, state } from "lit/decorators";
import { fireEvent } from "../common/dom/fire_event";
@@ -156,9 +156,9 @@ export class HaIcon extends LitElement {
}
}
protected render(): TemplateResult {
protected render() {
if (!this.icon) {
return html``;
return nothing;
}
if (this._legacy) {
return html`<iron-icon .icon=${this.icon}></iron-icon>`;

View File

@@ -62,7 +62,7 @@ class HaLabelBadge extends LitElement {
height: var(--ha-label-badge-size, 2.5em);
line-height: var(--ha-label-badge-size, 2.5em);
font-size: var(--ha-label-badge-font-size, 1.5em);
border-radius: 50%;
border-radius: var(--ha-label-badge-border-radius, 50%);
border: 0.1em solid var(--ha-label-badge-color, var(--primary-color));
color: var(--label-badge-text-color, rgb(76, 76, 76));

View File

@@ -30,6 +30,30 @@ export class HaListItem extends ListItemBase {
margin-inline-end: 0px !important;
direction: var(--direction);
}
:host([multiline-secondary]) {
height: auto;
}
:host([multiline-secondary]) .mdc-deprecated-list-item__text {
padding: 8px 0;
}
:host([multiline-secondary]) .mdc-deprecated-list-item__secondary-text {
text-overflow: initial;
white-space: normal;
overflow: auto;
display: inline-block;
margin-top: 10px;
}
:host([multiline-secondary]) .mdc-deprecated-list-item__primary-text {
margin-top: 10px;
}
:host([multiline-secondary])
.mdc-deprecated-list-item__secondary-text::before {
display: none;
}
:host([multiline-secondary])
.mdc-deprecated-list-item__primary-text::before {
display: none;
}
`,
];
}

View File

@@ -1,4 +1,4 @@
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
import { customElement, property } from "lit/decorators";
import "./ha-markdown-element";
@@ -15,9 +15,9 @@ export class HaMarkdown extends LitElement {
@property({ type: Boolean }) public breaks = false;
protected render(): TemplateResult {
protected render() {
if (!this.content) {
return html``;
return nothing;
}
return html`<ha-markdown-element

View File

@@ -54,9 +54,9 @@ export class HaNetwork extends LitElement {
@state() private _expanded?: boolean;
protected render(): TemplateResult {
protected render() {
if (this.networkConfig === undefined) {
return html``;
return nothing;
}
const configured_adapters = this.networkConfig.configured_adapters || [];
return html`

View File

@@ -5,7 +5,7 @@ import {
html,
LitElement,
PropertyValues,
TemplateResult,
nothing,
} from "lit";
import { customElement, property, state } from "lit/decorators";
import { fireEvent } from "../common/dom/fire_event";
@@ -70,9 +70,9 @@ export class HaRelatedItems extends SubscribeMixin(LitElement) {
}
}
protected render(): TemplateResult {
protected render() {
if (!this._related) {
return html``;
return nothing;
}
if (Object.keys(this._related).length === 0) {
return html`

View File

@@ -1,5 +1,5 @@
import { HassEntity } from "home-assistant-js-websocket";
import { html, LitElement, PropertyValues, TemplateResult } from "lit";
import { html, LitElement, PropertyValues, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
import memoizeOne from "memoize-one";
import { ensureArray } from "../../common/array/ensure-array";
@@ -61,9 +61,9 @@ export class HaAreaSelector extends LitElement {
}
}
protected render(): TemplateResult {
protected render() {
if (this._hasIntegration(this.selector) && !this._entitySources) {
return html``;
return nothing;
}
if (!this.selector.area?.multiple) {

View File

@@ -1,5 +1,5 @@
import { HassEntity } from "home-assistant-js-websocket";
import { html, LitElement } 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";
@@ -66,7 +66,7 @@ export class HaDeviceSelector extends LitElement {
protected render() {
if (this._hasIntegration(this.selector) && !this._entitySources) {
return html``;
return nothing;
}
if (!this.selector.device?.multiple) {

View File

@@ -1,5 +1,5 @@
import { HassEntity } from "home-assistant-js-websocket";
import { html, LitElement, PropertyValues } from "lit";
import { html, LitElement, PropertyValues, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
import { ensureArray } from "../../common/array/ensure-array";
import {
@@ -39,7 +39,7 @@ export class HaEntitySelector extends LitElement {
protected render() {
if (this._hasIntegration(this.selector) && !this._entitySources) {
return html``;
return nothing;
}
if (!this.selector.entity?.multiple) {

View File

@@ -5,7 +5,7 @@ import {
html,
LitElement,
PropertyValues,
TemplateResult,
nothing,
} from "lit";
import { customElement, property, state } from "lit/decorators";
import memoizeOne from "memoize-one";
@@ -70,9 +70,9 @@ export class HaTargetSelector extends LitElement {
}
}
protected render(): TemplateResult {
protected render() {
if (this._hasIntegration(this.selector) && !this._entitySources) {
return html``;
return nothing;
}
return html`<ha-target-picker

View File

@@ -29,6 +29,7 @@ import {
html,
LitElement,
PropertyValues,
nothing,
} from "lit";
import { customElement, eventOptions, property, state } from "lit/decorators";
import { classMap } from "lit/directives/class-map";
@@ -241,7 +242,7 @@ class HaSidebar extends SubscribeMixin(LitElement) {
protected render() {
if (!this.hass) {
return html``;
return nothing;
}
// prettier-ignore

View File

@@ -12,7 +12,7 @@ import {
import "@polymer/paper-tooltip/paper-tooltip";
import { ComboBoxLightOpenedChangedEvent } from "@vaadin/combo-box/vaadin-combo-box-light";
import { HassEntity, HassServiceTarget } from "home-assistant-js-websocket";
import { css, CSSResultGroup, html, LitElement, unsafeCSS } from "lit";
import { css, CSSResultGroup, html, LitElement, unsafeCSS, nothing } from "lit";
import { customElement, property, query, state } from "lit/decorators";
import { classMap } from "lit/directives/class-map";
import { ensureArray } from "../common/array/ensure-array";
@@ -278,7 +278,7 @@ export class HaTargetPicker extends LitElement {
private _renderPicker() {
if (!this._addMode) {
return html``;
return nothing;
}
return html`<mwc-menu-surface
open

View File

@@ -1,6 +1,6 @@
import { mdiLightbulbOutline } from "@mdi/js";
import { css, html, LitElement, TemplateResult } from "lit";
import { property, customElement } from "lit/decorators";
import { css, html, LitElement, nothing } from "lit";
import { customElement, property } from "lit/decorators";
import { HomeAssistant } from "../types";
import "./ha-svg-icon";
@@ -9,9 +9,9 @@ import "./ha-svg-icon";
class HaTip extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
public render(): TemplateResult {
public render() {
if (!this.hass) {
return html``;
return nothing;
}
return html`

View File

@@ -1,5 +1,5 @@
import { DEFAULT_SCHEMA, dump, load, Schema } from "js-yaml";
import { html, LitElement, TemplateResult } from "lit";
import { html, LitElement, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
import { fireEvent } from "../common/dom/fire_event";
import type { HomeAssistant } from "../types";
@@ -56,9 +56,9 @@ export class HaYamlEditor extends LitElement {
}
}
protected render(): TemplateResult {
protected render() {
if (this._yaml === undefined) {
return html``;
return nothing;
}
return html`
${this.label

View File

@@ -2,7 +2,7 @@ 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, TemplateResult } from "lit";
import { css, CSSResultGroup, 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";
@@ -18,11 +18,11 @@ import {
import { showConfirmationDialog } from "../../dialogs/generic/show-dialog-box";
import { haStyleDialog } from "../../resources/styles";
import type { HomeAssistant } from "../../types";
import "../ha-check-list-item";
import "../ha-circular-progress";
import "../ha-dialog";
import "../ha-header-bar";
import "../ha-svg-icon";
import "../ha-check-list-item";
import "./ha-media-player-browse";
import "./ha-media-upload-button";
import type { MediaManageDialogParams } from "./show-media-manage-dialog";
@@ -60,9 +60,9 @@ class DialogMediaManage extends LitElement {
fireEvent(this, "dialog-closed", { dialog: this.localName });
}
protected render(): TemplateResult {
protected render() {
if (!this._params) {
return html``;
return nothing;
}
const children =

View File

@@ -1,6 +1,5 @@
import "../ha-header-bar";
import { mdiArrowLeft, mdiClose } from "@mdi/js";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
import { customElement, property, query, state } from "lit/decorators";
import { fireEvent, HASSDomEvent } from "../../common/dom/fire_event";
import { computeRTLDirection } from "../../common/util/compute_rtl";
@@ -12,8 +11,9 @@ import type {
import { haStyleDialog } from "../../resources/styles";
import type { HomeAssistant } from "../../types";
import "../ha-dialog";
import "./ha-media-player-browse";
import "../ha-header-bar";
import "./ha-media-manage-button";
import "./ha-media-player-browse";
import type {
HaMediaPlayerBrowse,
MediaPlayerItemId,
@@ -49,9 +49,9 @@ class DialogMediaPlayerBrowse extends LitElement {
fireEvent(this, "dialog-closed", { dialog: this.localName });
}
protected render(): TemplateResult {
protected render() {
if (!this._params || !this._navigateIds) {
return html``;
return nothing;
}
return html`

View File

@@ -1,13 +1,13 @@
import { mdiFolderEdit } from "@mdi/js";
import "@material/mwc-button";
import { css, html, LitElement, TemplateResult } from "lit";
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 "../ha-svg-icon";
import { isLocalMediaSourceContentId } from "../../data/media_source";
import type { HomeAssistant } from "../../types";
import "../ha-svg-icon";
import { showMediaManageDialog } from "./show-media-manage-dialog";
import { fireEvent } from "../../common/dom/fire_event";
declare global {
interface HASSDomEvents {
@@ -23,12 +23,12 @@ class MediaManageButton extends LitElement {
@state() _uploading = 0;
protected render(): TemplateResult {
protected render() {
if (
!this.currentItem ||
!isLocalMediaSourceContentId(this.currentItem.media_content_id || "")
) {
return html``;
return nothing;
}
return html`
<mwc-button

View File

@@ -13,6 +13,7 @@ import {
LitElement,
PropertyValues,
TemplateResult,
nothing,
} from "lit";
import {
customElement,
@@ -311,7 +312,7 @@ export class HaMediaPlayerBrowse extends LitElement {
}
}
protected render(): TemplateResult {
protected render() {
if (this._error) {
return html`
<div class="container">
@@ -388,7 +389,7 @@ export class HaMediaPlayerBrowse extends LitElement {
: ""}
</div>
`
: html``}
: nothing}
<div class="header-info">
<div class="breadcrumb">
<h1 class="title">${currentItem.title}</h1>

View File

@@ -1,17 +1,17 @@
import { mdiUpload } from "@mdi/js";
import "@material/mwc-button";
import { css, html, LitElement, TemplateResult } from "lit";
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 "../ha-circular-progress";
import "../ha-svg-icon";
import {
isLocalMediaSourceContentId,
uploadLocalMedia,
} from "../../data/media_source";
import type { HomeAssistant } from "../../types";
import { showAlertDialog } from "../../dialogs/generic/show-dialog-box";
import type { HomeAssistant } from "../../types";
import "../ha-circular-progress";
import "../ha-svg-icon";
declare global {
interface HASSDomEvents {
@@ -28,12 +28,12 @@ class MediaUploadButton extends LitElement {
@state() _uploading = 0;
protected render(): TemplateResult {
protected render() {
if (
!this.currentItem ||
!isLocalMediaSourceContentId(this.currentItem.media_content_id || "")
) {
return html``;
return nothing;
}
return html`
<mwc-button

View File

@@ -14,6 +14,7 @@ import {
LitElement,
PropertyValues,
TemplateResult,
nothing,
} from "lit";
import { customElement, property, state } from "lit/decorators";
import { ifDefined } from "lit/directives/if-defined";
@@ -595,9 +596,9 @@ export class HaAutomationTracer extends LitElement {
];
}
protected render(): TemplateResult {
protected render() {
if (!this.trace) {
return html``;
return nothing;
}
const entries: TemplateResult[] = [];

View File

@@ -1,4 +1,4 @@
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { css, CSSResultGroup, 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";
@@ -9,9 +9,9 @@ import { computeUserInitials } from "../../data/user";
class PersonBadge extends LitElement {
@property({ attribute: false }) public person?: Person;
protected render(): TemplateResult {
protected render() {
if (!this.person) {
return html``;
return nothing;
}
const picture = this.person.picture;

View File

@@ -4,7 +4,7 @@ import {
html,
LitElement,
PropertyValues,
TemplateResult,
nothing,
} from "lit";
import { customElement, property, state } from "lit/decorators";
import { classMap } from "lit/directives/class-map";
@@ -47,9 +47,9 @@ class UserBadge extends LitElement {
}
}
protected render(): TemplateResult {
protected render() {
if (!this.hass || !this.user) {
return html``;
return nothing;
}
const picture = this._personPicture;

View File

@@ -1,5 +1,5 @@
import { mdiClose } from "@mdi/js";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
import { customElement, property } from "lit/decorators";
import { guard } from "lit/directives/guard";
import memoizeOne from "memoize-one";
@@ -34,9 +34,9 @@ class HaUsersPickerLight extends LitElement {
}
}
protected render(): TemplateResult {
protected render() {
if (!this.hass || !this.users) {
return html``;
return nothing;
}
const notSelectedUsers = this._notSelectedUsers(this.users, this.value);

View File

@@ -350,14 +350,13 @@ const getEnergyData = async (
let co2SignalEntity: string | undefined;
if (co2SignalConfigEntry) {
for (const entityId of Object.keys(hass.entities)) {
const entity = hass.entities[entityId];
for (const entity of Object.values(hass.entities)) {
if (entity.platform !== "co2signal") {
continue;
}
// The integration offers 2 entities. We want the % one.
const co2State = hass.states[entityId];
const co2State = hass.states[entity.entity_id];
if (!co2State || co2State.attributes.unit_of_measurement !== "%") {
continue;
}
@@ -402,7 +401,7 @@ const getEnergyData = async (
volume: lengthUnit === "km" ? "L" : "gal",
};
const _energyStats = energyStatIds.length
const _energyStats: Statistics | Promise<Statistics> = energyStatIds.length
? fetchStatistics(
hass!,
startMinHour,
@@ -412,9 +411,9 @@ const getEnergyData = async (
energyUnits,
["sum"]
)
: Promise.resolve({});
const _waterStats = waterStatIds.length
? await fetchStatistics(
: {};
const _waterStats: Statistics | Promise<Statistics> = waterStatIds.length
? fetchStatistics(
hass!,
startMinHour,
end,
@@ -423,13 +422,13 @@ const getEnergyData = async (
waterUnits,
["sum"]
)
: Promise.resolve({});
: {};
let statsCompare;
let startCompare;
let endCompare;
let _energyStatsCompare = Promise.resolve({});
let _waterStatsCompare = Promise.resolve({});
let _energyStatsCompare: Statistics | Promise<Statistics> = {};
let _waterStatsCompare: Statistics | Promise<Statistics> = {};
if (compare) {
if (dayDifference > 27 && dayDifference < 32) {
@@ -465,12 +464,10 @@ const getEnergyData = async (
}
}
let _fossilEnergyConsumption:
| Promise<undefined>
| Promise<FossilEnergyConsumption> = Promise.resolve(undefined);
let _fossilEnergyConsumption: undefined | Promise<FossilEnergyConsumption>;
let _fossilEnergyConsumptionCompare:
| Promise<undefined>
| Promise<FossilEnergyConsumption> = Promise.resolve(undefined);
| undefined
| Promise<FossilEnergyConsumption>;
if (co2SignalEntity !== undefined) {
_fossilEnergyConsumption = getFossilEnergyConsumption(
hass!,
@@ -493,9 +490,11 @@ const getEnergyData = async (
}
const statsMetadata: Record<string, StatisticsMetaData> = {};
const _getStatisticMetadata: Promise<StatisticsMetaData[]> = allStatIDs.length
const _getStatisticMetadata:
| Promise<StatisticsMetaData[]>
| StatisticsMetaData[] = allStatIDs.length
? getStatisticMetadata(hass, allStatIDs)
: Promise.resolve([]);
: [];
const [
energyStats,
waterStats,

View File

@@ -10,13 +10,13 @@ export interface ThreadRouter {
}
export interface ThreadDataSet {
created;
dataset_id;
extended_pan_id;
network_name: string;
pan_id;
created: string;
dataset_id: string;
preferred: boolean;
source;
source: string;
network_name: string;
extended_pan_id?: string;
pan_id?: string;
}
export interface ThreadRouterDiscoveryEvent {
@@ -61,3 +61,29 @@ export const listThreadDataSets = (
hass.callWS({
type: "thread/list_datasets",
});
export const getThreadDataSetTLV = (
hass: HomeAssistant,
dataset_id: string
): Promise<{ tlv: string }> =>
hass.callWS({ type: "thread/get_dataset_tlv", dataset_id });
export const addThreadDataSet = (
hass: HomeAssistant,
source: string,
tlv: string
): Promise<void> =>
hass.callWS({
type: "thread/add_dataset_tlv",
source,
tlv,
});
export const removeThreadDataSet = (
hass: HomeAssistant,
dataset_id: string
): Promise<void> =>
hass.callWS({
type: "thread/delete_dataset",
dataset_id,
});

View File

@@ -523,3 +523,18 @@ export const isForecastHourly = (
return undefined;
};
export type WeatherUnits = {
precipitation_unit: string[];
pressure_unit: string[];
temperature_unit: string[];
visibility_unit: string[];
wind_speed_unit: string[];
};
export const getWeatherConvertibleUnits = (
hass: HomeAssistant
): Promise<{ units: WeatherUnits }> =>
hass.callWS({
type: "weather/convertible_units",
});

View File

@@ -1,6 +1,6 @@
import "@material/mwc-button/mwc-button";
import { mdiDeleteOutline, mdiPlus } from "@mdi/js";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
import { fireEvent } from "../../common/dom/fire_event";
import "../../components/ha-alert";
@@ -40,9 +40,9 @@ class DialogAliases extends LitElement {
fireEvent(this, "dialog-closed", { dialog: this.localName });
}
protected render(): TemplateResult {
protected render() {
if (!this._params) {
return html``;
return nothing;
}
return html`

View File

@@ -1,5 +1,5 @@
import "@material/mwc-button/mwc-button";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
import { fireEvent } from "../../common/dom/fire_event";
import { computeRTLDirection } from "../../common/util/compute_rtl";
@@ -45,9 +45,9 @@ class DialogConfigEntrySystemOptions extends LitElement {
fireEvent(this, "dialog-closed", { dialog: this.localName });
}
protected render(): TemplateResult {
protected render() {
if (!this._params) {
return html``;
return nothing;
}
return html`

View File

@@ -7,7 +7,7 @@ import {
html,
LitElement,
PropertyValues,
TemplateResult,
nothing,
} from "lit";
import { customElement, state } from "lit/decorators";
import { fireEvent, HASSDomEvent } from "../../common/dom/fire_event";
@@ -202,9 +202,9 @@ class DataEntryFlowDialog extends LitElement {
fireEvent(this, "dialog-closed", { dialog: this.localName });
}
protected render(): TemplateResult {
protected render() {
if (!this._params) {
return html``;
return nothing;
}
return html`

View File

@@ -1,19 +1,13 @@
import "@material/mwc-button";
import {
CSSResultGroup,
html,
LitElement,
TemplateResult,
PropertyValues,
} from "lit";
import { CSSResultGroup, html, LitElement, PropertyValues, nothing } from "lit";
import { customElement, property } from "lit/decorators";
import { fireEvent } from "../../common/dom/fire_event";
import { DataEntryFlowStepAbort } from "../../data/data_entry_flow";
import { HomeAssistant } from "../../types";
import { showAddApplicationCredentialDialog } from "../../panels/config/application_credentials/show-dialog-add-application-credential";
import { configFlowContentStyles } from "./styles";
import { DataEntryFlowDialogParams } from "./show-dialog-data-entry-flow";
import { HomeAssistant } from "../../types";
import { showConfigFlowDialog } from "./show-dialog-config-flow";
import { DataEntryFlowDialogParams } from "./show-dialog-data-entry-flow";
import { configFlowContentStyles } from "./styles";
@customElement("step-flow-abort")
class StepFlowAbort extends LitElement {
@@ -32,9 +26,9 @@ class StepFlowAbort extends LitElement {
}
}
protected render(): TemplateResult {
protected render() {
if (this.step.reason === "missing_credentials") {
return html``;
return nothing;
}
return html`
<h2>${this.hass.localize(`component.${this.domain}.title`)}</h2>

View File

@@ -1,5 +1,5 @@
import "@material/mwc-button/mwc-button";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
import { customElement, state } from "lit/decorators";
import { fireEvent } from "../../common/dom/fire_event";
import { createCloseHeading } from "../../components/ha-dialog";
@@ -29,9 +29,9 @@ class DomainTogglerDialog
fireEvent(this, "dialog-closed", { dialog: this.localName });
}
protected render(): TemplateResult {
protected render() {
if (!this._params) {
return html``;
return nothing;
}
const domains = this._params.domains

View File

@@ -1,6 +1,6 @@
import "@material/mwc-button/mwc-button";
import { mdiAlertOutline } from "@mdi/js";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { css, CSSResultGroup, 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";
@@ -35,9 +35,9 @@ class DialogBox extends LitElement {
return true;
}
protected render(): TemplateResult {
protected render() {
if (!this._params) {
return html``;
return nothing;
}
const confirmPrompt = this._params.confirmation || this._params.prompt;

View File

@@ -128,7 +128,9 @@ export class HaMoreInfoToggle extends LitElement {
static get styles(): CSSResultGroup {
return css`
ha-control-switch {
height: 320px;
height: 45vh;
max-height: 320px;
min-height: 200px;
--control-switch-thickness: 100px;
--control-switch-border-radius: 24px;
--control-switch-padding: 6px;
@@ -138,7 +140,9 @@ export class HaMoreInfoToggle extends LitElement {
display: flex;
flex-direction: column;
width: 100px;
height: 320px;
height: 45vh;
max-height: 320px;
min-height: 200px;
padding: 6px;
box-sizing: border-box;
}

View File

@@ -84,7 +84,9 @@ export class HaMoreInfoLightBrightness extends LitElement {
static get styles(): CSSResultGroup {
return css`
ha-control-slider {
height: 320px;
height: 45vh;
max-height: 320px;
min-height: 200px;
--control-slider-thickness: 100px;
--control-slider-border-radius: 24px;
--control-slider-color: var(--primary-color);

View File

@@ -7,8 +7,8 @@ import {
CSSResultGroup,
html,
LitElement,
nothing,
PropertyValues,
TemplateResult,
} from "lit";
import { customElement, property, state } from "lit/decorators";
import "../../../../components/ha-button-toggle-group";
@@ -62,9 +62,9 @@ class MoreInfoViewLightColorPicker extends LitElement {
: undefined;
}
protected render(): TemplateResult {
protected render() {
if (!this.params || !this.stateObj) {
return html``;
return nothing;
}
const supportsRgbww = lightSupportsColorMode(
@@ -97,15 +97,19 @@ class MoreInfoViewLightColorPicker extends LitElement {
<div class="content">
${this._mode === LightColorMode.COLOR_TEMP
? html`
<p class="color-temp-value">
${this._ctSliderValue ? `${this._ctSliderValue} K` : nothing}
</p>
<ha-control-slider
vertical
class="color_temp"
class="color-temp"
label=${this.hass.localize("ui.card.light.color_temperature")}
min="1"
max="100"
mode="cursor"
.value=${this._ctSliderValue}
@value-changed=${this._ctSliderChanged}
@slider-moved=${this._ctSliderMoved}
.min=${this.stateObj.attributes.min_color_temp_kelvin!}
.max=${this.stateObj.attributes.max_color_temp_kelvin!}
>
@@ -114,7 +118,7 @@ class MoreInfoViewLightColorPicker extends LitElement {
: ""}
${this._mode === "color"
? html`
<div class="segmentationContainer">
<div class="segmentation-container">
<ha-color-picker
class="color"
@colorselected=${this._colorPicked}
@@ -127,7 +131,7 @@ class MoreInfoViewLightColorPicker extends LitElement {
<ha-icon-button
.path=${mdiPalette}
@click=${this._segmentClick}
class="segmentationButton"
class="segmentation-button"
></ha-icon-button>
</div>
@@ -206,7 +210,11 @@ class MoreInfoViewLightColorPicker extends LitElement {
this._brightnessAdjusted = maxVal;
}
}
this._ctSliderValue = stateObj.attributes.color_temp_kelvin;
this._ctSliderValue =
stateObj.attributes.color_mode === LightColorMode.COLOR_TEMP
? stateObj.attributes.color_temp_kelvin
: undefined;
this._wvSliderValue =
stateObj.attributes.color_mode === LightColorMode.RGBW
? Math.round((stateObj.attributes.rgbw_color![3] * 100) / 255)
@@ -243,7 +251,7 @@ class MoreInfoViewLightColorPicker extends LitElement {
public willUpdate(changedProps: PropertyValues) {
super.willUpdate(changedProps);
if (!changedProps.has("params") || !changedProps.has("hass")) {
if (!changedProps.has("params") && !changedProps.has("hass")) {
return;
}
@@ -264,10 +272,11 @@ class MoreInfoViewLightColorPicker extends LitElement {
}
this._modes = modes;
this._mode =
this.stateObj!.attributes.color_mode === LightColorMode.COLOR_TEMP
this._mode = this.stateObj!.attributes.color_mode
? this.stateObj!.attributes.color_mode === LightColorMode.COLOR_TEMP
? LightColorMode.COLOR_TEMP
: "color";
: "color"
: this._modes[0];
}
this._updateSliderValues();
@@ -281,6 +290,16 @@ class MoreInfoViewLightColorPicker extends LitElement {
this._mode = newMode;
}
private _ctSliderMoved(ev: CustomEvent) {
const ct = ev.detail.value;
if (isNaN(ct)) {
return;
}
this._ctSliderValue = ct;
}
private _ctSliderChanged(ev: CustomEvent) {
const ct = ev.detail.value;
@@ -493,14 +512,14 @@ class MoreInfoViewLightColorPicker extends LitElement {
flex: 1;
}
.segmentationContainer {
.segmentation-container {
position: relative;
max-height: 500px;
display: flex;
justify-content: center;
}
.segmentationButton {
.segmentation-button {
position: absolute;
top: 5%;
left: 0;
@@ -516,17 +535,29 @@ class MoreInfoViewLightColorPicker extends LitElement {
}
ha-control-slider {
height: 320px;
height: 45vh;
max-height: 320px;
min-height: 200px;
margin: 20px 0;
--control-slider-thickness: 100px;
--control-slider-border-radius: 24px;
}
ha-labeled-slider {
width: 100%;
}
.color_temp {
--control-slider-thickness: 100px;
--control-slider-border-radius: 24px;
.color-temp-value {
font-style: normal;
font-weight: 500;
font-size: 16px;
height: 24px;
line-height: 24px;
letter-spacing: 0.1px;
margin: 0;
}
.color-temp {
--control-slider-background: -webkit-linear-gradient(
top,
rgb(166, 209, 255) 0%,
@@ -534,6 +565,7 @@ class MoreInfoViewLightColorPicker extends LitElement {
rgb(255, 160, 0) 100%
);
--control-slider-background-opacity: 1;
margin-bottom: 44px;
}
hr {

View File

@@ -1,15 +1,15 @@
import "@material/mwc-button";
import type { HassEntity } from "home-assistant-js-websocket";
import { css, html, LitElement, PropertyValues, TemplateResult } from "lit";
import { customElement, property, state, query } from "lit/decorators";
import { css, html, LitElement, PropertyValues, nothing } from "lit";
import { customElement, property, query, state } from "lit/decorators";
import { classMap } from "lit/directives/class-map";
import "../../../components/ha-textfield";
import { supportsFeature } from "../../../common/entity/supports-feature";
import "../../../components/ha-textfield";
import type { HaTextField } from "../../../components/ha-textfield";
import {
AlarmControlPanelEntityFeature,
callAlarmAction,
FORMAT_NUMBER,
AlarmControlPanelEntityFeature,
} from "../../../data/alarm_control_panel";
import type { HomeAssistant } from "../../../types";
@@ -67,9 +67,9 @@ export class MoreInfoAlarmControlPanel extends LitElement {
}
}
protected render(): TemplateResult {
protected render() {
if (!this.hass || !this.stateObj) {
return html``;
return nothing;
}
return html`

View File

@@ -1,6 +1,6 @@
import "@material/mwc-button";
import { HassEntity } from "home-assistant-js-websocket";
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
import { customElement, property } from "lit/decorators";
import "../../../components/ha-relative-time";
import { triggerAutomationActions } from "../../../data/automation";
@@ -13,9 +13,9 @@ class MoreInfoAutomation extends LitElement {
@property({ attribute: false }) public stateObj?: HassEntity;
protected render(): TemplateResult {
protected render() {
if (!this.hass || !this.stateObj) {
return html``;
return nothing;
}
return html`

View File

@@ -1,4 +1,4 @@
import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit";
import { css, CSSResultGroup, html, LitElement, nothing } from "lit";
import { property, state } from "lit/decorators";
import "../../../components/ha-camera-stream";
import { CameraEntity } from "../../../data/camera";
@@ -21,9 +21,9 @@ class MoreInfoCamera extends LitElement {
this._attached = false;
}
protected render(): TemplateResult {
protected render() {
if (!this._attached || !this.hass || !this.stateObj) {
return html``;
return nothing;
}
return html`

View File

@@ -5,7 +5,7 @@ import {
html,
LitElement,
PropertyValues,
TemplateResult,
nothing,
} from "lit";
import { property } from "lit/decorators";
import { classMap } from "lit/directives/class-map";
@@ -36,9 +36,9 @@ class MoreInfoClimate extends LitElement {
private _resizeDebounce?: number;
protected render(): TemplateResult {
protected render() {
if (!this.stateObj) {
return html``;
return nothing;
}
const hass = this.hass;

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