From e0df5e4631dc3bcc9875b7d5cca5828daca6aba7 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Feb 2023 04:20:49 +0000 Subject: [PATCH 01/24] 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] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 61 +++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 54 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index c6da7766bf..86095bdf03 100644 --- a/package.json +++ b/package.json @@ -182,7 +182,7 @@ "@types/tar": "^6", "@types/webspeechapi": "^0.0.29", "@typescript-eslint/eslint-plugin": "^5.53.0", - "@typescript-eslint/parser": "^5.53.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", diff --git a/yarn.lock b/yarn.lock index 21d3d0396c..397af44cd0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4525,20 +4525,20 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/parser@npm:^5.53.0": - version: 5.53.0 - resolution: "@typescript-eslint/parser@npm:5.53.0" +"@typescript-eslint/parser@npm:^5.54.0": + version: 5.54.0 + resolution: "@typescript-eslint/parser@npm:5.54.0" dependencies: - "@typescript-eslint/scope-manager": 5.53.0 - "@typescript-eslint/types": 5.53.0 - "@typescript-eslint/typescript-estree": 5.53.0 + "@typescript-eslint/scope-manager": 5.54.0 + "@typescript-eslint/types": 5.54.0 + "@typescript-eslint/typescript-estree": 5.54.0 debug: ^4.3.4 peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 peerDependenciesMeta: typescript: optional: true - checksum: 979e5d63793a9e64998b1f956ba0f00f8a2674db3a664fafce7b2433323f5248bd776af8305e2419d73a9d94c55176fee099abc5c153b4cc52e5765c725c1edd + checksum: 368d6dd85be42c3f518f0ddeed23ecd1d3c9484a77ae291ee4e08e2703ed379bed613bde014cd8ab2a3e06e85dd8aef201112ae5e3d2a07deba29ae80bb1fe06 languageName: node linkType: hard @@ -4552,6 +4552,16 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/scope-manager@npm:5.54.0": + version: 5.54.0 + resolution: "@typescript-eslint/scope-manager@npm:5.54.0" + dependencies: + "@typescript-eslint/types": 5.54.0 + "@typescript-eslint/visitor-keys": 5.54.0 + checksum: e50f12396de0ddb94aab119bdd5f4769b80dd2c273e137fd25e5811e25114d7a3d3668cdb3c454aca9537e940744881d62a1fed2ec86f07f60533dc7382ae15c + languageName: node + linkType: hard + "@typescript-eslint/type-utils@npm:5.53.0": version: 5.53.0 resolution: "@typescript-eslint/type-utils@npm:5.53.0" @@ -4576,6 +4586,13 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/types@npm:5.54.0": + version: 5.54.0 + resolution: "@typescript-eslint/types@npm:5.54.0" + checksum: 0f66b1b93078f3afea6dfcd3d4e2f0abea4f60cd0c613c2cf13f85098e5bf786185484c9846ed80b6c4272de2c31a70c5a8aacb91314cf1b6da7dcb8855cb7ac + languageName: node + linkType: hard + "@typescript-eslint/typescript-estree@npm:5.53.0": version: 5.53.0 resolution: "@typescript-eslint/typescript-estree@npm:5.53.0" @@ -4594,6 +4611,24 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/typescript-estree@npm:5.54.0": + version: 5.54.0 + resolution: "@typescript-eslint/typescript-estree@npm:5.54.0" + dependencies: + "@typescript-eslint/types": 5.54.0 + "@typescript-eslint/visitor-keys": 5.54.0 + debug: ^4.3.4 + globby: ^11.1.0 + is-glob: ^4.0.3 + semver: ^7.3.7 + tsutils: ^3.21.0 + peerDependenciesMeta: + typescript: + optional: true + checksum: 377c75c34c4f95b7ab6218c1d96a6db3ea6ed6727711b6a09354582fe0157861dc1b6fb9e3f7113cd09741f713735d59d5ab5845457f5733a4ebad7470bf600a + languageName: node + linkType: hard + "@typescript-eslint/utils@npm:5.53.0": version: 5.53.0 resolution: "@typescript-eslint/utils@npm:5.53.0" @@ -4622,6 +4657,16 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/visitor-keys@npm:5.54.0": + version: 5.54.0 + resolution: "@typescript-eslint/visitor-keys@npm:5.54.0" + dependencies: + "@typescript-eslint/types": 5.54.0 + eslint-visitor-keys: ^3.3.0 + checksum: 17fc323c09e6272b603cdaec30a99916600fbbb737e1fbc8c1727a487753b4363cea112277fa43e0562bff34bdd1de9ad73ff9433118b1fd469b112fad0313ca + languageName: node + linkType: hard + "@vaadin/combo-box@npm:^23.3.7": version: 23.3.7 resolution: "@vaadin/combo-box@npm:23.3.7" @@ -9610,7 +9655,7 @@ fsevents@~2.3.2: "@types/tar": ^6 "@types/webspeechapi": ^0.0.29 "@typescript-eslint/eslint-plugin": ^5.53.0 - "@typescript-eslint/parser": ^5.53.0 + "@typescript-eslint/parser": ^5.54.0 "@vaadin/combo-box": ^23.3.7 "@vaadin/vaadin-themable-mixin": ^23.3.7 "@vibrant/color": ^3.2.1-alpha.1 From 67d064db28ca0b1e77703693f610b4e24238e323 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 28 Feb 2023 04:37:18 +0000 Subject: [PATCH 02/24] 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] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 87 +++++++++++++--------------------------------------- 2 files changed, 22 insertions(+), 67 deletions(-) diff --git a/package.json b/package.json index 86095bdf03..7a036d9719 100644 --- a/package.json +++ b/package.json @@ -181,7 +181,7 @@ "@types/sortablejs": "^1", "@types/tar": "^6", "@types/webspeechapi": "^0.0.29", - "@typescript-eslint/eslint-plugin": "^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", diff --git a/yarn.lock b/yarn.lock index 397af44cd0..5353b60da3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4501,13 +4501,13 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:^5.53.0": - version: 5.53.0 - resolution: "@typescript-eslint/eslint-plugin@npm:5.53.0" +"@typescript-eslint/eslint-plugin@npm:^5.54.0": + version: 5.54.0 + resolution: "@typescript-eslint/eslint-plugin@npm:5.54.0" dependencies: - "@typescript-eslint/scope-manager": 5.53.0 - "@typescript-eslint/type-utils": 5.53.0 - "@typescript-eslint/utils": 5.53.0 + "@typescript-eslint/scope-manager": 5.54.0 + "@typescript-eslint/type-utils": 5.54.0 + "@typescript-eslint/utils": 5.54.0 debug: ^4.3.4 grapheme-splitter: ^1.0.4 ignore: ^5.2.0 @@ -4521,7 +4521,7 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 12dffe65969d8e5248c86a700fe46a737e55ecafb276933e747b4731eab6266fe55e2d43a34b8b340179fe248e127d861cd016a7614b1b9804cd0687c99616d1 + checksum: 4fdb520b8e0f6b9eb878206ddfa4212522f170d1507d7aba8a975159a198efa37af6d2d17982dd560317452d0748f2e2da5dd7347b172bc4446d1c5562ce2e94 languageName: node linkType: hard @@ -4542,16 +4542,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:5.53.0": - version: 5.53.0 - resolution: "@typescript-eslint/scope-manager@npm:5.53.0" - dependencies: - "@typescript-eslint/types": 5.53.0 - "@typescript-eslint/visitor-keys": 5.53.0 - checksum: 51f31dc01e95908611f402441f58404da80a338c0237b2b82f4a7b0b2e8868c4bfe8f7cf44b2567dd56533de609156a5d4ac54bb1f9f09c7014b99428aef2543 - languageName: node - linkType: hard - "@typescript-eslint/scope-manager@npm:5.54.0": version: 5.54.0 resolution: "@typescript-eslint/scope-manager@npm:5.54.0" @@ -4562,12 +4552,12 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:5.53.0": - version: 5.53.0 - resolution: "@typescript-eslint/type-utils@npm:5.53.0" +"@typescript-eslint/type-utils@npm:5.54.0": + version: 5.54.0 + resolution: "@typescript-eslint/type-utils@npm:5.54.0" dependencies: - "@typescript-eslint/typescript-estree": 5.53.0 - "@typescript-eslint/utils": 5.53.0 + "@typescript-eslint/typescript-estree": 5.54.0 + "@typescript-eslint/utils": 5.54.0 debug: ^4.3.4 tsutils: ^3.21.0 peerDependencies: @@ -4575,14 +4565,7 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 52c40967c5fabd58c2ae8bf519ef89e4feb511e4df630aeaeac8335661a79b6b3a32d30a61a5f1d8acc703f21c4d90751a5d41cda1b35d08867524da11bc2e1d - languageName: node - linkType: hard - -"@typescript-eslint/types@npm:5.53.0": - version: 5.53.0 - resolution: "@typescript-eslint/types@npm:5.53.0" - checksum: b0eaf23de4ab13697d4d2095838c959a3f410c30f0d19091e5ca08e62320c3cc3c72bcb631823fb6a4fbb31db0a059e386a0801244930d0a88a6a698e5f46548 + checksum: 9cb5b52c7277bdf74b9ea3282fc40f41fda90ea4b1d33039044476e43cf05a766b1294e7d45f429594f2776828f7d17729cfa4ea027315f3df883e748ba57514 languageName: node linkType: hard @@ -4593,24 +4576,6 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:5.53.0": - version: 5.53.0 - resolution: "@typescript-eslint/typescript-estree@npm:5.53.0" - dependencies: - "@typescript-eslint/types": 5.53.0 - "@typescript-eslint/visitor-keys": 5.53.0 - debug: ^4.3.4 - globby: ^11.1.0 - is-glob: ^4.0.3 - semver: ^7.3.7 - tsutils: ^3.21.0 - peerDependenciesMeta: - typescript: - optional: true - checksum: 6e119c8e4167c8495d728c5556a834545a9c064918dd5e7b79b0d836726f4f8e2a0297b0ac82bf2b71f1e5427552217d0b59d8fb1406fd79bd3bf91b75dca873 - languageName: node - linkType: hard - "@typescript-eslint/typescript-estree@npm:5.54.0": version: 5.54.0 resolution: "@typescript-eslint/typescript-estree@npm:5.54.0" @@ -4629,31 +4594,21 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/utils@npm:5.53.0": - version: 5.53.0 - resolution: "@typescript-eslint/utils@npm:5.53.0" +"@typescript-eslint/utils@npm:5.54.0": + version: 5.54.0 + resolution: "@typescript-eslint/utils@npm:5.54.0" dependencies: "@types/json-schema": ^7.0.9 "@types/semver": ^7.3.12 - "@typescript-eslint/scope-manager": 5.53.0 - "@typescript-eslint/types": 5.53.0 - "@typescript-eslint/typescript-estree": 5.53.0 + "@typescript-eslint/scope-manager": 5.54.0 + "@typescript-eslint/types": 5.54.0 + "@typescript-eslint/typescript-estree": 5.54.0 eslint-scope: ^5.1.1 eslint-utils: ^3.0.0 semver: ^7.3.7 peerDependencies: eslint: ^6.0.0 || ^7.0.0 || ^8.0.0 - checksum: 18e6bac14ae853385a74123759850bca367904723e170c37416fc014673eb714afb6bb090367bff61494a8387e941b6af65ee5f4f845f7177fabb4df85e01643 - languageName: node - linkType: hard - -"@typescript-eslint/visitor-keys@npm:5.53.0": - version: 5.53.0 - resolution: "@typescript-eslint/visitor-keys@npm:5.53.0" - dependencies: - "@typescript-eslint/types": 5.53.0 - eslint-visitor-keys: ^3.3.0 - checksum: 090695883c15364c6f401e97f56b13db0f31c1114f3bd22562bd41734864d27f6a3c80de33957e9dedab2d5f94b0f4480ba3fde1d4574e74dca4593917b7b54a + checksum: b8f344fc2961c7af530b93e53d5a17b5084cdf550b381082e3fb7f349ef16e718d9eebde1b9fc2d8fc4ecf8d60d334b004359977247554265c1afc87323bed37 languageName: node linkType: hard @@ -9654,7 +9609,7 @@ fsevents@~2.3.2: "@types/sortablejs": ^1 "@types/tar": ^6 "@types/webspeechapi": ^0.0.29 - "@typescript-eslint/eslint-plugin": ^5.53.0 + "@typescript-eslint/eslint-plugin": ^5.54.0 "@typescript-eslint/parser": ^5.54.0 "@vaadin/combo-box": ^23.3.7 "@vaadin/vaadin-themable-mixin": ^23.3.7 From 17e6e132d1a42fe086769a5e08228dd2c496a0e2 Mon Sep 17 00:00:00 2001 From: Steve Repsher Date: Tue, 28 Feb 2023 00:02:04 -0500 Subject: [PATCH 03/24] Minify HTML and CSS template literals (#15624) --- build-scripts/bundle.js | 26 +++++++++- build-scripts/rollup.js | 2 +- build-scripts/webpack.js | 2 +- package.json | 1 + yarn.lock | 107 ++++++++++++++++++++++++++++++++++++--- 5 files changed, 129 insertions(+), 9 deletions(-) diff --git a/build-scripts/bundle.js b/build-scripts/bundle.js index 715dbd9f93..e1cf89d661 100644 --- a/build-scripts/bundle.js +++ b/build-scripts/bundle.js @@ -53,13 +53,23 @@ module.exports.definedVars = ({ isProdBuild, latestBuild, defineOverlay }) => ({ ...defineOverlay, }); +module.exports.htmlMinifierOptions = { + caseSensitive: true, + collapseWhitespace: true, + conservativeCollapse: true, + decodeEntities: true, + removeComments: true, + removeRedundantAttributes: true, + minifyCSS: true, +}; + 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: [ @@ -93,12 +103,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: module.exports.htmlMinifierOptions, + failOnError: true, // we can turn this off in case of false positives + }, + ], ].filter(Boolean), exclude: [ // \\ for Windows, / for Mac OS and Linux diff --git a/build-scripts/rollup.js b/build-scripts/rollup.js index 95a447f661..410e396632 100644 --- a/build-scripts/rollup.js +++ b/build-scripts/rollup.js @@ -54,7 +54,7 @@ const createRollupConfig = ({ commonjs(), json(), babel({ - ...bundle.babelOptions({ latestBuild }), + ...bundle.babelOptions({ latestBuild, isProdBuild }), extensions, babelHelpers: isWDS ? "inline" : "bundled", }), diff --git a/build-scripts/webpack.js b/build-scripts/webpack.js index ecf6a28e5d..77b78a1dc7 100644 --- a/build-scripts/webpack.js +++ b/build-scripts/webpack.js @@ -51,7 +51,7 @@ const createWebpackConfig = ({ use: { loader: "babel-loader", options: { - ...bundle.babelOptions({ latestBuild }), + ...bundle.babelOptions({ latestBuild, isProdBuild }), cacheDirectory: !isProdBuild, cacheCompression: false, }, diff --git a/package.json b/package.json index 7a036d9719..6d53b9f8eb 100644 --- a/package.json +++ b/package.json @@ -186,6 +186,7 @@ "@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.35.0", diff --git a/yarn.lock b/yarn.lock index 5353b60da3..dd84e5b4c4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6007,6 +6007,17 @@ __metadata: languageName: node linkType: hard +"babel-plugin-template-html-minifier@npm:^4.1.0": + version: 4.1.0 + resolution: "babel-plugin-template-html-minifier@npm:4.1.0" + dependencies: + clean-css: ^4.2.1 + html-minifier-terser: ^5.0.0 + is-builtin-module: ^3.0.0 + checksum: 85102c9cc1f5026cde52549a79bbb595aaed6316fd990b3b353315bd6ecf0e685b341bf757f8f339abc09fbed0e424b93d0099c33d85628848572168b8cb76bf + languageName: node + linkType: hard + "bach@npm:^1.0.0": version: 1.2.0 resolution: "bach@npm:1.2.0" @@ -6364,6 +6375,16 @@ __metadata: languageName: node linkType: hard +"camel-case@npm:^4.1.1": + version: 4.1.2 + resolution: "camel-case@npm:4.1.2" + dependencies: + pascal-case: ^3.1.2 + tslib: ^2.0.3 + checksum: bcbd25cd253b3cbc69be3f535750137dbf2beb70f093bdc575f73f800acc8443d34fd52ab8f0a2413c34f1e8203139ffc88428d8863e4dfe530cfb257a379ad6 + languageName: node + linkType: hard + "camelcase@npm:^3.0.0": version: 3.0.0 resolution: "camelcase@npm:3.0.0" @@ -6537,12 +6558,12 @@ __metadata: languageName: node linkType: hard -"clean-css@npm:^4.2.1": - version: 4.2.3 - resolution: "clean-css@npm:4.2.3" +"clean-css@npm:^4.2.1, clean-css@npm:^4.2.3": + version: 4.2.4 + resolution: "clean-css@npm:4.2.4" dependencies: source-map: ~0.6.0 - checksum: 613129973a038b8bb13e3975ad6b679feccb8c98f2a9d03e6bec9e60291ef1e6b5037ee8cb09a3470751adc52f43782b1dcb4cb049360230b48062d6e3314072 + checksum: 045ff6fcf4b5c76a084b24e1633e0c78a13b24080338fc8544565a9751559aa32ff4ee5886d9e52c18a644a6ff119bd8e37bc58e574377c05382a1fb7dbe39f8 languageName: node linkType: hard @@ -6823,6 +6844,13 @@ __metadata: languageName: node linkType: hard +"commander@npm:^4.1.1": + version: 4.1.1 + resolution: "commander@npm:4.1.1" + checksum: d7b9913ff92cae20cb577a4ac6fcc121bd6223319e54a40f51a14740a681ad5c574fd29a57da478a5f234a6fa6c52cbf0b7c641353e03c648b1ae85ba670b977 + languageName: node + linkType: hard + "commander@npm:^9.4.1": version: 9.5.0 resolution: "commander@npm:9.5.0" @@ -7497,6 +7525,16 @@ __metadata: languageName: node linkType: hard +"dot-case@npm:^3.0.4": + version: 3.0.4 + resolution: "dot-case@npm:3.0.4" + dependencies: + no-case: ^3.0.4 + tslib: ^2.0.3 + checksum: a65e3519414856df0228b9f645332f974f2bf5433370f544a681122eab59e66038fc3349b4be1cdc47152779dac71a5864f1ccda2f745e767c46e9c6543b1169 + languageName: node + linkType: hard + "duplexify@npm:^3.6.0": version: 3.7.1 resolution: "duplexify@npm:3.7.1" @@ -9623,6 +9661,7 @@ fsevents@~2.3.2: "@webcomponents/webcomponentsjs": ^2.7.0 app-datepicker: ^5.1.0 babel-loader: ^9.1.2 + babel-plugin-template-html-minifier: ^4.1.0 chai: ^4.3.7 chart.js: ^3.3.2 comlink: ^4.4.1 @@ -9774,6 +9813,23 @@ fsevents@~2.3.2: languageName: node linkType: hard +"html-minifier-terser@npm:^5.0.0": + version: 5.1.1 + resolution: "html-minifier-terser@npm:5.1.1" + dependencies: + camel-case: ^4.1.1 + clean-css: ^4.2.3 + commander: ^4.1.1 + he: ^1.2.0 + param-case: ^3.0.3 + relateurl: ^0.2.7 + terser: ^4.6.3 + bin: + html-minifier-terser: cli.js + checksum: 75ff3ff886631b9ecb3035acb8e7dd98c599bb4d4618ad6f7e487ee9752987dddcf6848dc3c1ab1d7fc1ad4484337c2ce39c19eac17b0342b4b15e4294c8a904 + languageName: node + linkType: hard + "html-minifier@npm:^4.0.0": version: 4.0.0 resolution: "html-minifier@npm:4.0.0" @@ -10286,7 +10342,7 @@ fsevents@~2.3.2: languageName: node linkType: hard -"is-builtin-module@npm:^3.1.0": +"is-builtin-module@npm:^3.0.0, is-builtin-module@npm:^3.1.0": version: 3.2.1 resolution: "is-builtin-module@npm:3.2.1" dependencies: @@ -11561,6 +11617,15 @@ fsevents@~2.3.2: languageName: node linkType: hard +"lower-case@npm:^2.0.2": + version: 2.0.2 + resolution: "lower-case@npm:2.0.2" + dependencies: + tslib: ^2.0.3 + checksum: 83a0a5f159ad7614bee8bf976b96275f3954335a84fad2696927f609ddae902802c4f3312d86668722e668bef41400254807e1d3a7f2e8c3eede79691aa1f010 + languageName: node + linkType: hard + "lru-cache@npm:^4.0.1": version: 4.1.5 resolution: "lru-cache@npm:4.1.5" @@ -12227,6 +12292,16 @@ fsevents@~2.3.2: languageName: node linkType: hard +"no-case@npm:^3.0.4": + version: 3.0.4 + resolution: "no-case@npm:3.0.4" + dependencies: + lower-case: ^2.0.2 + tslib: ^2.0.3 + checksum: 0b2ebc113dfcf737d48dde49cfebf3ad2d82a8c3188e7100c6f375e30eafbef9e9124aadc3becef237b042fd5eb0aad2fd78669c20972d045bbe7fea8ba0be5c + languageName: node + linkType: hard + "node-fetch@npm:^2.6.7": version: 2.6.7 resolution: "node-fetch@npm:2.6.7" @@ -12814,6 +12889,16 @@ fsevents@~2.3.2: languageName: node linkType: hard +"param-case@npm:^3.0.3": + version: 3.0.4 + resolution: "param-case@npm:3.0.4" + dependencies: + dot-case: ^3.0.4 + tslib: ^2.0.3 + checksum: b34227fd0f794e078776eb3aa6247442056cb47761e9cd2c4c881c86d84c64205f6a56ef0d70b41ee7d77da02c3f4ed2f88e3896a8fefe08bdfb4deca037c687 + languageName: node + linkType: hard + "parent-module@npm:^1.0.0": version: 1.0.1 resolution: "parent-module@npm:1.0.1" @@ -12932,6 +13017,16 @@ fsevents@~2.3.2: languageName: node linkType: hard +"pascal-case@npm:^3.1.2": + version: 3.1.2 + resolution: "pascal-case@npm:3.1.2" + dependencies: + no-case: ^3.0.4 + tslib: ^2.0.3 + checksum: ba98bfd595fc91ef3d30f4243b1aee2f6ec41c53b4546bfa3039487c367abaa182471dcfc830a1f9e1a0df00c14a370514fa2b3a1aacc68b15a460c31116873e + languageName: node + linkType: hard + "pascalcase@npm:^0.1.1": version: 0.1.1 resolution: "pascalcase@npm:0.1.1" @@ -15168,7 +15263,7 @@ fsevents@~2.3.2: languageName: node linkType: hard -"terser@npm:^4.6.2": +"terser@npm:^4.6.2, terser@npm:^4.6.3": version: 4.8.1 resolution: "terser@npm:4.8.1" dependencies: From 6af57fa2cd3bd8bf3ff105597efd8bbde5682214 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 28 Feb 2023 04:54:27 -0500 Subject: [PATCH 04/24] Temp patch to fix Rollup build (#15631) --- build-scripts/rollup.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/build-scripts/rollup.js b/build-scripts/rollup.js index 410e396632..ed030a774a 100644 --- a/build-scripts/rollup.js +++ b/build-scripts/rollup.js @@ -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, From 20f2f5b317bf182ec4e4fe158478f35f32426e53 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 28 Feb 2023 03:57:04 -0600 Subject: [PATCH 05/24] Avoid fetching all stats metadata when there are no entities on the energy panel (#15591) Co-authored-by: Bram Kragten --- src/data/energy.ts | 158 ++++++++++++++++++++++++++------------------- 1 file changed, 90 insertions(+), 68 deletions(-) diff --git a/src/data/energy.ts b/src/data/energy.ts index 1584d385c5..d253d63d0d 100644 --- a/src/data/energy.ts +++ b/src/data/energy.ts @@ -11,10 +11,8 @@ import { } from "date-fns/esm"; import { Collection, getCollection } from "home-assistant-js-websocket"; import { groupBy } from "../common/util/group-by"; -import { subscribeOne } from "../common/util/subscribe-one"; import { HomeAssistant } from "../types"; import { ConfigEntry, getConfigEntries } from "./config_entries"; -import { subscribeEntityRegistry } from "./entity_registry"; import { fetchStatistics, getStatisticMetadata, @@ -341,9 +339,8 @@ const getEnergyData = async ( end?: Date, compare?: boolean ): Promise => { - const [configEntries, entityRegistryEntries, info] = await Promise.all([ + const [configEntries, info] = await Promise.all([ getConfigEntries(hass, { domain: "co2signal" }), - subscribeOne(hass.connection, subscribeEntityRegistry), getEnergyInfo(hass), ]); @@ -352,15 +349,14 @@ const getEnergyData = async ( : undefined; let co2SignalEntity: string | undefined; - if (co2SignalConfigEntry) { - for (const entry of entityRegistryEntries) { - if (entry.config_entry_id !== co2SignalConfigEntry.entry_id) { + 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[entry.entity_id]; + const co2State = hass.states[entity.entity_id]; if (!co2State || co2State.attributes.unit_of_measurement !== "%") { continue; } @@ -405,34 +401,35 @@ const getEnergyData = async ( volume: lengthUnit === "km" ? "L" : "gal", }; - const stats = { - ...(energyStatIds.length - ? await fetchStatistics( - hass!, - startMinHour, - end, - energyStatIds, - period, - energyUnits, - ["sum"] - ) - : {}), - ...(waterStatIds.length - ? await fetchStatistics( - hass!, - startMinHour, - end, - waterStatIds, - period, - waterUnits, - ["sum"] - ) - : {}), - }; + const _energyStats: Statistics | Promise = energyStatIds.length + ? fetchStatistics( + hass!, + startMinHour, + end, + energyStatIds, + period, + energyUnits, + ["sum"] + ) + : {}; + const _waterStats: Statistics | Promise = waterStatIds.length + ? fetchStatistics( + hass!, + startMinHour, + end, + waterStatIds, + period, + waterUnits, + ["sum"] + ) + : {}; let statsCompare; let startCompare; let endCompare; + let _energyStatsCompare: Statistics | Promise = {}; + let _waterStatsCompare: Statistics | Promise = {}; + if (compare) { if (dayDifference > 27 && dayDifference < 32) { // When comparing a month, we want to start at the begining of the month @@ -443,38 +440,36 @@ const getEnergyData = async ( const compareStartMinHour = addHours(startCompare, -1); endCompare = addMilliseconds(start, -1); - - statsCompare = { - ...(energyStatIds.length - ? await fetchStatistics( - hass!, - compareStartMinHour, - endCompare, - energyStatIds, - period, - energyUnits, - ["sum"] - ) - : {}), - ...(waterStatIds.length - ? await fetchStatistics( - hass!, - compareStartMinHour, - endCompare, - waterStatIds, - period, - waterUnits, - ["sum"] - ) - : {}), - }; + if (energyStatIds.length) { + _energyStatsCompare = fetchStatistics( + hass!, + compareStartMinHour, + endCompare, + energyStatIds, + period, + energyUnits, + ["sum"] + ); + } + if (waterStatIds.length) { + _waterStatsCompare = fetchStatistics( + hass!, + compareStartMinHour, + endCompare, + waterStatIds, + period, + waterUnits, + ["sum"] + ); + } } - let fossilEnergyConsumption: FossilEnergyConsumption | undefined; - let fossilEnergyConsumptionCompare: FossilEnergyConsumption | undefined; - + let _fossilEnergyConsumption: undefined | Promise; + let _fossilEnergyConsumptionCompare: + | undefined + | Promise; if (co2SignalEntity !== undefined) { - fossilEnergyConsumption = await getFossilEnergyConsumption( + _fossilEnergyConsumption = getFossilEnergyConsumption( hass!, start, consumptionStatIDs, @@ -483,7 +478,7 @@ const getEnergyData = async ( dayDifference > 35 ? "month" : dayDifference > 2 ? "day" : "hour" ); if (compare) { - fossilEnergyConsumptionCompare = await getFossilEnergyConsumption( + _fossilEnergyConsumptionCompare = getFossilEnergyConsumption( hass!, startCompare, consumptionStatIDs, @@ -494,6 +489,39 @@ const getEnergyData = async ( } } + const statsMetadata: Record = {}; + const _getStatisticMetadata: + | Promise + | StatisticsMetaData[] = allStatIDs.length + ? getStatisticMetadata(hass, allStatIDs) + : []; + const [ + energyStats, + waterStats, + energyStatsCompare, + waterStatsCompare, + statsMetadataArray, + fossilEnergyConsumption, + fossilEnergyConsumptionCompare, + ] = await Promise.all([ + _energyStats, + _waterStats, + _energyStatsCompare, + _waterStatsCompare, + _getStatisticMetadata, + _fossilEnergyConsumption, + _fossilEnergyConsumptionCompare, + ]); + const stats = { ...energyStats, ...waterStats }; + if (compare) { + statsCompare = { ...energyStatsCompare, ...waterStatsCompare }; + } + if (allStatIDs.length) { + statsMetadataArray.forEach((x) => { + statsMetadata[x.statistic_id] = x; + }); + } + Object.values(stats).forEach((stat) => { // if the start of the first value is after the requested period, we have the first data point, and should add a zero point if (stat.length && new Date(stat[0].start) > startMinHour) { @@ -507,12 +535,6 @@ const getEnergyData = async ( } }); - const statsMetadataArray = await getStatisticMetadata(hass, allStatIDs); - const statsMetadata: Record = {}; - statsMetadataArray.forEach((x) => { - statsMetadata[x.statistic_id] = x; - }); - const data: EnergyData = { start, end, From 4031d9cc782e16f277ef4b6f14ba46bbfd084132 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 28 Feb 2023 03:58:45 -0600 Subject: [PATCH 06/24] Avoid loading the whole entity registry for more info (#15627) --- src/dialogs/more-info/ha-more-info-info.ts | 25 ++++------------------ 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/src/dialogs/more-info/ha-more-info-info.ts b/src/dialogs/more-info/ha-more-info-info.ts index c7e9721ca7..b1b1ec7a2b 100644 --- a/src/dialogs/more-info/ha-more-info-info.ts +++ b/src/dialogs/more-info/ha-more-info-info.ts @@ -1,11 +1,6 @@ import { css, html, LitElement } from "lit"; -import { customElement, property, state } from "lit/decorators"; +import { customElement, property } from "lit/decorators"; import { computeDomain } from "../../common/entity/compute_domain"; -import { subscribeOne } from "../../common/util/subscribe-one"; -import { - EntityRegistryEntry, - subscribeEntityRegistry, -} from "../../data/entity_registry"; import type { HomeAssistant } from "../../types"; import { computeShowHistoryComponent, @@ -24,11 +19,10 @@ export class MoreInfoInfo extends LitElement { @property() public entityId!: string; - @state() private _entityEntry?: EntityRegistryEntry; - protected render() { const entityId = this.entityId; const stateObj = this.hass.states[entityId]; + const entityRegObj = this.hass.entities[entityId]; const domain = computeDomain(entityId); const newMoreInfo = computeShowNewMoreInfo(stateObj); @@ -41,12 +35,12 @@ export class MoreInfoInfo extends LitElement { )} ` : ""} - ${stateObj?.attributes.restored && this._entityEntry + ${stateObj?.attributes.restored && entityRegObj ? html` ${this.hass.localize( "ui.dialogs.more_info_control.restored.no_longer_provided", { - integration: this._entityEntry.platform, + integration: entityRegObj.platform, } )} ` @@ -86,17 +80,6 @@ export class MoreInfoInfo extends LitElement { `; } - protected firstUpdated(changedProps) { - super.firstUpdated(changedProps); - subscribeOne(this.hass.connection, subscribeEntityRegistry).then( - (entries) => { - this._entityEntry = entries.find( - (entry) => entry.entity_id === this.entityId - ); - } - ); - } - static get styles() { return css` .container { From 9ce4563dd436afadf6881f67c40f81b708d5f5e1 Mon Sep 17 00:00:00 2001 From: Steve Repsher Date: Tue, 28 Feb 2023 05:02:47 -0500 Subject: [PATCH 07/24] Prefer nothing over empty templates (#15633) --- .eslintrc.json | 1 - cast/src/receiver/layout/hc-demo.ts | 6 +-- demo/src/custom-cards/cast-demo-row.ts | 6 +-- demo/src/custom-cards/ha-demo-card.ts | 6 +-- gallery/src/components/page-description.ts | 4 +- .../src/pages/automation/describe-action.ts | 6 +-- .../pages/automation/describe-condition.ts | 6 +-- .../src/pages/automation/describe-trigger.ts | 6 +-- .../src/pages/automation/trace-timeline.ts | 7 ++-- gallery/src/pages/automation/trace.ts | 11 +++--- gallery/src/pages/misc/entity-state.ts | 6 +-- gallery/src/pages/misc/integration-card.ts | 18 ++++----- hassio/src/addon-store/hassio-addon-store.ts | 7 ++-- .../addon-view/config/hassio-addon-network.ts | 6 +-- hassio/src/backups/hassio-backups.ts | 6 +-- .../components/supervisor-backup-content.ts | 15 ++++++-- hassio/src/dashboard/hassio-update.ts | 12 +++--- .../backup/dialog-hassio-backup-upload.ts | 6 +-- .../dialogs/backup/dialog-hassio-backup.ts | 12 +++--- .../backup/dialog-hassio-create-backup.ts | 10 ++--- .../datadisk/dialog-hassio-datadisk.ts | 6 +-- .../hardware/dialog-hassio-hardware.ts | 8 ++-- .../markdown/dialog-hassio-markdown.ts | 6 +-- .../dialogs/network/dialog-hassio-network.ts | 6 +-- .../dialog-hassio-repositories.ts | 14 +++---- hassio/src/hassio-my-redirect.ts | 6 +-- .../update-available/update-available-card.ts | 6 +-- src/auth/ha-auth-flow.ts | 14 +++---- src/components/chart/state-history-charts.ts | 12 +++--- src/components/data-table/ha-data-table.ts | 10 ++--- .../device/ha-area-devices-picker.ts | 8 ++-- .../device/ha-device-automation-picker.ts | 6 +-- src/components/device/ha-devices-picker.ts | 6 +-- src/components/entity/ha-entities-picker.ts | 6 +-- .../entity/ha-entity-attribute-picker.ts | 6 +-- .../entity/ha-entity-state-picker.ts | 12 +++--- src/components/entity/ha-statistics-picker.ts | 6 +-- src/components/entity/state-badge.ts | 6 +-- src/components/entity/state-info.ts | 6 +-- src/components/ha-addon-picker.ts | 6 +-- src/components/ha-areas-picker.ts | 6 +-- src/components/ha-attributes.ts | 15 ++++++-- src/components/ha-blueprint-picker.ts | 6 +-- src/components/ha-camera-stream.ts | 10 ++--- src/components/ha-card.ts | 6 +-- src/components/ha-config-entry-picker.ts | 14 +++---- src/components/ha-cover-controls.ts | 6 +-- src/components/ha-cover-tilt-controls.ts | 6 +-- src/components/ha-dialog-date-picker.ts | 4 +- src/components/ha-icon.ts | 6 +-- src/components/ha-markdown.ts | 6 +-- src/components/ha-network.ts | 4 +- src/components/ha-related-items.ts | 6 +-- .../ha-selector/ha-selector-area.ts | 6 +-- .../ha-selector/ha-selector-device.ts | 4 +- .../ha-selector/ha-selector-entity.ts | 4 +- .../ha-selector/ha-selector-target.ts | 6 +-- src/components/ha-sidebar.ts | 3 +- src/components/ha-target-picker.ts | 4 +- src/components/ha-tip.ts | 8 ++-- src/components/ha-yaml-editor.ts | 6 +-- .../media-player/dialog-media-manage.ts | 8 ++-- .../dialog-media-player-browse.ts | 10 ++--- .../media-player/ha-media-manage-button.ts | 12 +++--- .../media-player/ha-media-player-browse.ts | 5 ++- .../media-player/ha-media-upload-button.ts | 14 +++---- src/components/trace/hat-trace-timeline.ts | 5 ++- src/components/user/ha-person-badge.ts | 6 +-- src/components/user/ha-user-badge.ts | 6 +-- src/components/user/ha-users-picker.ts | 6 +-- src/dialogs/aliases/dialog-aliases.ts | 6 +-- .../dialog-config-entry-system-options.ts | 6 +-- .../config-flow/dialog-data-entry-flow.ts | 6 +-- src/dialogs/config-flow/step-flow-abort.ts | 18 +++------ .../domain-toggler/dialog-domain-toggler.ts | 6 +-- src/dialogs/generic/dialog-box.ts | 6 +-- .../ha-more-info-view-light-color-picker.ts | 6 +-- .../controls/more-info-alarm_control_panel.ts | 12 +++--- .../controls/more-info-automation.ts | 6 +-- .../more-info/controls/more-info-camera.ts | 6 +-- .../more-info/controls/more-info-climate.ts | 6 +-- .../controls/more-info-configurator.ts | 6 +-- .../more-info/controls/more-info-counter.ts | 6 +-- .../more-info/controls/more-info-cover.ts | 10 ++--- .../more-info/controls/more-info-default.ts | 6 +-- .../more-info/controls/more-info-group.ts | 6 +-- .../controls/more-info-humidifier.ts | 6 +-- .../controls/more-info-input_datetime.ts | 6 +-- .../more-info/controls/more-info-lock.ts | 6 +-- .../controls/more-info-media_player.ts | 6 +-- .../more-info/controls/more-info-person.ts | 6 +-- .../more-info/controls/more-info-remote.ts | 12 +++--- .../more-info/controls/more-info-script.ts | 6 +-- .../more-info/controls/more-info-sun.ts | 6 +-- .../more-info/controls/more-info-timer.ts | 6 +-- .../more-info/controls/more-info-update.ts | 12 +++--- .../more-info/controls/more-info-vacuum.ts | 6 +-- .../more-info/controls/more-info-weather.ts | 6 +-- src/dialogs/more-info/ha-more-info-history.ts | 14 +++---- src/dialogs/more-info/ha-more-info-logbook.ts | 8 ++-- .../more-info/ha-more-info-settings.ts | 13 +++++-- .../configurator-notification-item.ts | 6 +-- .../notifications/notification-item.ts | 6 +-- .../persistent-notification-item.ts | 6 +-- src/dialogs/quick-bar/ha-quick-bar.ts | 10 ++--- src/dialogs/restart/dialog-restart.ts | 6 +-- .../ha-voice-command-dialog.ts | 6 +-- src/onboarding/ha-onboarding.ts | 6 +-- src/onboarding/onboarding-integrations.ts | 9 +++-- .../calendar/confirm-event-dialog-box.ts | 8 ++-- .../calendar/dialog-calendar-event-detail.ts | 12 +++--- .../calendar/dialog-calendar-event-editor.ts | 10 ++--- src/panels/calendar/ha-full-calendar.ts | 6 +-- .../calendar/ha-recurrence-rule-editor.ts | 26 ++++++------- .../dialog-add-application-credential.ts | 6 +-- .../ha-config-application-credentials.ts | 11 +++++- .../areas/dialog-area-registry-detail.ts | 8 ++-- .../config/areas/ha-config-area-page.ts | 10 ++--- .../dialog-automation-mode.ts | 24 ++++++------ .../dialog-automation-rename.ts | 12 +++--- .../condition/ha-automation-condition-row.ts | 4 +- .../condition/ha-automation-condition.ts | 13 +++++-- .../automation/dialog-new-automation.ts | 6 +-- .../automation/thingtalk/dialog-thingtalk.ts | 6 +-- .../types/ha-automation-trigger-tag.ts | 4 +- .../types/ha-automation-trigger-time.ts | 14 +++---- .../blueprint/dialog-import-blueprint.ts | 6 +-- .../config/cloud/account/cloud-alexa-pref.ts | 6 +-- .../config/cloud/account/cloud-google-pref.ts | 6 +-- .../config/cloud/account/cloud-remote-pref.ts | 6 +-- .../config/cloud/account/cloud-tts-pref.ts | 6 +-- .../cloud/account/dialog-cloud-tts-try.ts | 6 +-- .../dialog-cloud-certificate.ts | 4 +- .../dialog-manage-cloudhook.ts | 4 +- .../config/core/updates/dialog-join-beta.ts | 6 +-- .../config/dashboard/ha-config-updates.ts | 16 ++++---- .../ha-device-automation-card.ts | 6 +-- .../ha-device-automation-dialog.ts | 6 +-- .../ha-device-via-devices-card.ts | 6 +-- .../mqtt/dialog-mqtt-device-debug-info.ts | 13 +++++-- .../zha/ha-device-info-zha.ts | 6 +-- .../zwave_js/ha-device-info-zwave_js.ts | 10 ++--- .../dialog-device-registry-detail.ts | 8 ++-- .../components/ha-energy-validation-result.ts | 4 +- .../dialogs/dialog-energy-battery-settings.ts | 12 +++--- .../dialogs/dialog-energy-device-settings.ts | 18 ++++----- .../dialogs/dialog-energy-gas-settings.ts | 32 ++++++++-------- .../dialog-energy-grid-flow-settings.ts | 30 +++++++-------- .../dialogs/dialog-energy-solar-settings.ts | 28 +++++++------- .../dialogs/dialog-energy-water-settings.ts | 10 ++--- .../settings/entity-settings-helper-tab.ts | 6 +-- .../entities/entity-registry-basic-editor.ts | 8 ++-- .../entities/entity-registry-settings.ts | 12 +++--- .../config/entities/ha-config-entities.ts | 6 +-- .../hardware/dialog-hardware-available.ts | 6 +-- .../config/helpers/dialog-helper-detail.ts | 13 +++++-- .../config/helpers/forms/ha-counter-form.ts | 8 ++-- .../helpers/forms/ha-input_boolean-form.ts | 6 +-- .../helpers/forms/ha-input_button-form.ts | 6 +-- .../helpers/forms/ha-input_datetime-form.ts | 8 ++-- .../helpers/forms/ha-input_number-form.ts | 12 +++--- .../helpers/forms/ha-input_select-form.ts | 6 +-- .../helpers/forms/ha-input_text-form.ts | 14 +++---- .../config/helpers/forms/ha-schedule-form.ts | 6 +-- .../config/helpers/forms/ha-timer-form.ts | 6 +-- .../integrations/dialog-add-integration.ts | 15 ++++++-- .../integrations/dialog-yaml-integration.ts | 6 +-- .../integrations/ha-integration-list-item.ts | 19 ++++++---- .../matter/dialog-matter-add-device.ts | 6 +-- .../zha/dialog-zha-manage-zigbee-device.ts | 28 +++++++------- .../zha/dialog-zha-reconfigure-device.ts | 6 +-- .../zha/zha-cluster-attributes.ts | 9 +++-- .../zha/zha-cluster-commands.ts | 8 ++-- .../integration-panels/zha/zha-device-card.ts | 26 ++++++------- .../zha/zha-device-neighbors.ts | 12 +++--- .../zha/zha-device-pairing-status-card.ts | 12 +++--- .../zha/zha-device-signature.ts | 6 +-- .../integration-panels/zha/zha-group-page.ts | 13 +++++-- .../zha/zha-manage-clusters.ts | 10 ++--- .../zwave_js/dialog-zwave_js-add-node.ts | 6 +-- .../zwave_js/dialog-zwave_js-heal-network.ts | 8 ++-- .../zwave_js/dialog-zwave_js-heal-node.ts | 12 +++--- .../dialog-zwave_js-node-statistics.ts | 29 ++++++++------ .../dialog-zwave_js-reinterview-node.ts | 6 +-- .../dialog-zwave_js-remove-failed-node.ts | 6 +-- .../zwave_js/dialog-zwave_js-remove-node.ts | 6 +-- .../dialog-zwave_js-update-firmware-node.ts | 38 +++++++++---------- .../zwave_js/zwave_js-config-dashboard.ts | 33 +++++++++------- .../config/logs/dialog-system-log-detail.ts | 8 ++-- src/panels/config/logs/system-log-card.ts | 6 +-- .../dialog-lovelace-dashboard-detail.ts | 6 +-- .../ha-config-lovelace-dashboards.ts | 6 +-- .../dialog-lovelace-resource-detail.ts | 8 ++-- src/panels/config/network/dialog-ip-detail.ts | 6 +-- .../config/network/ha-config-network.ts | 6 +-- .../config/network/ha-config-url-form.ts | 6 +-- .../config/network/supervisor-hostname.ts | 6 +-- .../config/network/supervisor-network.ts | 6 +-- .../config/person/dialog-person-detail.ts | 8 ++-- src/panels/config/person/ha-config-person.ts | 6 +-- .../repairs/dialog-integration-startup.ts | 6 +-- .../config/repairs/dialog-repairs-issue.ts | 6 +-- .../repairs/dialog-system-information.ts | 15 ++++++-- .../config/repairs/ha-config-repairs.ts | 6 +-- .../repairs/integrations-startup-time.ts | 6 +-- src/panels/config/scene/ha-scene-editor.ts | 10 ++--- src/panels/config/script/ha-script-editor.ts | 7 ++-- .../config/storage/dialog-move-datadisk.ts | 6 +-- src/panels/config/tags/dialog-tag-detail.ts | 15 ++++++-- src/panels/config/tags/tag-image.ts | 4 +- src/panels/config/users/dialog-add-user.ts | 6 +-- .../users/dialog-admin-change-password.ts | 6 +-- src/panels/config/users/dialog-user-detail.ts | 6 +-- src/panels/config/zone/dialog-zone-detail.ts | 8 ++-- .../dialog-statistics-adjust-sum.ts | 5 ++- .../dialog-statistics-fix-units-changed.ts | 16 ++++---- .../template/developer-tools-template.ts | 4 +- src/panels/logbook/ha-logbook-renderer.ts | 13 +++---- src/panels/logbook/ha-logbook.ts | 8 ++-- src/panels/lovelace/badges/hui-error-badge.ts | 6 +-- .../lovelace/badges/hui-state-label-badge.ts | 6 +-- .../hui-energy-carbon-consumed-gauge-card.ts | 8 ++-- .../cards/energy/hui-energy-compare-card.ts | 6 +-- .../energy/hui-energy-date-selection-card.ts | 8 ++-- .../energy/hui-energy-devices-graph-card.ts | 6 +-- .../energy/hui-energy-distribution-card.ts | 4 +- .../cards/energy/hui-energy-gas-graph-card.ts | 8 ++-- .../hui-energy-grid-neutrality-gauge-card.ts | 10 ++--- .../hui-energy-solar-consumed-gauge-card.ts | 8 ++-- .../energy/hui-energy-solar-graph-card.ts | 8 ++-- .../energy/hui-energy-sources-table-card.ts | 19 +++------- .../energy/hui-energy-usage-graph-card.ts | 8 ++-- .../energy/hui-energy-water-graph-card.ts | 10 ++--- .../lovelace/cards/hui-alarm-panel-card.ts | 10 ++--- src/panels/lovelace/cards/hui-area-card.ts | 7 ++-- src/panels/lovelace/cards/hui-button-card.ts | 6 +-- .../lovelace/cards/hui-calendar-card.ts | 8 ++-- .../lovelace/cards/hui-empty-state-card.ts | 6 +-- .../lovelace/cards/hui-entities-card.ts | 7 ++-- src/panels/lovelace/cards/hui-entity-card.ts | 6 +-- src/panels/lovelace/cards/hui-error-card.ts | 6 +-- src/panels/lovelace/cards/hui-gauge-card.ts | 6 +-- src/panels/lovelace/cards/hui-glance-card.ts | 5 ++- .../lovelace/cards/hui-history-graph-card.ts | 6 +-- .../lovelace/cards/hui-humidifier-card.ts | 6 +-- src/panels/lovelace/cards/hui-iframe-card.ts | 6 +-- src/panels/lovelace/cards/hui-light-card.ts | 6 +-- src/panels/lovelace/cards/hui-logbook-card.ts | 6 +-- src/panels/lovelace/cards/hui-map-card.ts | 34 ++++++++--------- .../lovelace/cards/hui-markdown-card.ts | 6 +-- .../lovelace/cards/hui-media-control-card.ts | 6 +-- src/panels/lovelace/cards/hui-picture-card.ts | 6 +-- .../cards/hui-picture-elements-card.ts | 6 +-- .../lovelace/cards/hui-picture-entity-card.ts | 5 ++- .../lovelace/cards/hui-picture-glance-card.ts | 5 ++- .../lovelace/cards/hui-plant-status-card.ts | 6 +-- .../lovelace/cards/hui-shopping-list-card.ts | 6 +-- src/panels/lovelace/cards/hui-stack-card.ts | 6 +-- .../lovelace/cards/hui-starting-card.ts | 6 +-- .../lovelace/cards/hui-statistic-card.ts | 6 +-- .../cards/hui-statistics-graph-card.ts | 6 +-- .../lovelace/cards/hui-thermostat-card.ts | 10 ++--- src/panels/lovelace/cards/hui-tile-card.ts | 13 +++++-- .../cards/hui-weather-forecast-card.ts | 6 +-- .../lovelace/components/hui-action-editor.ts | 8 ++-- .../components/hui-energy-period-selector.ts | 12 +++--- .../components/hui-entities-toggle.ts | 6 +-- .../lovelace/components/hui-entity-editor.ts | 6 +-- .../components/hui-generic-entity-row.ts | 8 ++-- src/panels/lovelace/components/hui-image.ts | 12 +++--- .../components/hui-input-list-editor.ts | 8 ++-- src/panels/lovelace/components/hui-marquee.ts | 6 +-- .../components/hui-timestamp-display.ts | 6 +-- .../editor/card-editor/hui-card-picker.ts | 7 ++-- .../card-editor/hui-dialog-create-card.ts | 6 +-- .../card-editor/hui-dialog-delete-card.ts | 6 +-- .../card-editor/hui-dialog-edit-card.ts | 6 +-- .../card-editor/hui-dialog-suggest-card.ts | 6 +-- .../hui-alarm-panel-card-editor.ts | 6 +-- .../config-elements/hui-area-card-editor.ts | 6 +-- .../config-elements/hui-button-card-editor.ts | 6 +-- .../hui-calendar-card-editor.ts | 10 ++--- .../hui-conditional-card-editor.ts | 6 +-- .../hui-entities-card-editor.ts | 14 +++---- .../config-elements/hui-entity-card-editor.ts | 6 +-- .../config-elements/hui-gauge-card-editor.ts | 6 +-- .../hui-generic-entity-row-editor.ts | 6 +-- .../config-elements/hui-glance-card-editor.ts | 14 +++---- .../hui-graph-footer-editor.ts | 6 +-- .../config-elements/hui-grid-card-editor.ts | 6 +-- .../hui-history-graph-card-editor.ts | 14 +++---- .../hui-humidifier-card-editor.ts | 6 +-- .../config-elements/hui-iframe-card-editor.ts | 8 ++-- .../config-elements/hui-light-card-editor.ts | 6 +-- .../hui-logbook-card-editor.ts | 10 ++--- .../config-elements/hui-map-card-editor.ts | 8 ++-- .../hui-markdown-card-editor.ts | 8 ++-- .../hui-media-control-card-editor.ts | 6 +-- .../hui-picture-card-editor.ts | 8 ++-- .../hui-picture-entity-card-editor.ts | 6 +-- .../hui-picture-glance-card-editor.ts | 6 +-- .../hui-plant-status-card-editor.ts | 6 +-- .../config-elements/hui-sensor-card-editor.ts | 6 +-- .../hui-shopping-list-editor.ts | 10 ++--- .../config-elements/hui-stack-card-editor.ts | 6 +-- .../hui-statistic-card-editor.ts | 6 +-- .../hui-statistics-graph-card-editor.ts | 8 ++-- .../hui-thermostat-card-editor.ts | 6 +-- .../config-elements/hui-tile-card-editor.ts | 6 +-- ...hui-vacuum-commands-tile-feature-editor.ts | 6 +-- .../hui-weather-forecast-card-editor.ts | 6 +-- .../hui-dialog-create-headerfooter.ts | 6 +-- .../lovelace/editor/hui-dialog-save-config.ts | 6 +-- .../editor/hui-entities-card-row-editor.ts | 6 +-- .../hui-dialog-edit-lovelace.ts | 8 ++-- .../select-view/hui-dialog-select-view.ts | 6 +-- .../unused-entities/hui-unused-entities.ts | 8 ++-- .../view-editor/hui-dialog-edit-view.ts | 6 +-- .../editor/view-editor/hui-view-editor.ts | 6 +-- .../view-editor/hui-view-visibility-editor.ts | 6 +-- .../lovelace/elements/hui-icon-element.ts | 6 +-- .../lovelace/elements/hui-image-element.ts | 6 +-- .../elements/hui-service-button-element.ts | 6 +-- .../elements/hui-state-badge-element.ts | 6 +-- .../elements/hui-state-icon-element.ts | 6 +-- .../elements/hui-state-label-element.ts | 6 +-- .../entity-rows/hui-button-entity-row.ts | 6 +-- .../entity-rows/hui-climate-entity-row.ts | 6 +-- .../entity-rows/hui-cover-entity-row.ts | 6 +-- .../entity-rows/hui-group-entity-row.ts | 6 +-- .../entity-rows/hui-humidifier-entity-row.ts | 6 +-- .../hui-input-button-entity-row.ts | 6 +-- .../hui-input-datetime-entity-row.ts | 10 ++--- .../hui-input-number-entity-row.ts | 6 +-- .../hui-input-select-entity-row.ts | 10 ++--- .../entity-rows/hui-input-text-entity-row.ts | 10 ++--- .../entity-rows/hui-lock-entity-row.ts | 6 +-- .../hui-media-player-entity-row.ts | 6 +-- .../entity-rows/hui-number-entity-row.ts | 8 ++-- .../entity-rows/hui-scene-entity-row.ts | 6 +-- .../entity-rows/hui-script-entity-row.ts | 6 +-- .../entity-rows/hui-select-entity-row.ts | 6 +-- .../entity-rows/hui-sensor-entity-row.ts | 6 +-- .../entity-rows/hui-simple-entity-row.ts | 6 +-- .../entity-rows/hui-text-entity-row.ts | 12 +++--- .../entity-rows/hui-timer-entity-row.ts | 6 +-- .../entity-rows/hui-toggle-entity-row.ts | 6 +-- .../entity-rows/hui-weather-entity-row.ts | 6 +-- .../header-footer/hui-graph-header-footer.ts | 10 ++--- .../hui-picture-header-footer.ts | 6 +-- .../special-rows/hui-attribute-row.ts | 6 +-- .../lovelace/special-rows/hui-button-row.ts | 8 ++-- .../lovelace/special-rows/hui-cast-row.ts | 8 ++-- .../lovelace/special-rows/hui-divider-row.ts | 6 +-- .../lovelace/special-rows/hui-section-row.ts | 8 ++-- .../lovelace/special-rows/hui-text-row.ts | 6 +-- .../lovelace/special-rows/hui-weblink-row.ts | 6 +-- .../media-browser/ha-bar-media-player.ts | 6 +-- .../hui-dialog-web-browser-play-media.ts | 13 ++----- src/panels/my/ha-panel-my.ts | 4 +- .../dialog-ha-mfa-module-setup-flow.ts | 6 +-- .../ha-long-lived-access-token-dialog.ts | 15 ++++++-- 362 files changed, 1533 insertions(+), 1435 deletions(-) mode change 100755 => 100644 hassio/src/dialogs/hardware/dialog-hassio-hardware.ts mode change 100755 => 100644 src/panels/lovelace/editor/card-editor/hui-dialog-edit-card.ts mode change 100755 => 100644 src/panels/lovelace/editor/card-editor/hui-dialog-suggest-card.ts diff --git a/.eslintrc.json b/.eslintrc.json index 5680879b3c..553dba0c4a 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -119,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", diff --git a/cast/src/receiver/layout/hc-demo.ts b/cast/src/receiver/layout/hc-demo.ts index a5822ebe97..16daeead9b 100644 --- a/cast/src/receiver/layout/hc-demo.ts +++ b/cast/src/receiver/layout/hc-demo.ts @@ -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` diff --git a/demo/src/custom-cards/ha-demo-card.ts b/demo/src/custom-cards/ha-demo-card.ts index 89835b5174..92f1731b71 100644 --- a/demo/src/custom-cards/ha-demo-card.ts +++ b/demo/src/custom-cards/ha-demo-card.ts @@ -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` diff --git a/gallery/src/components/page-description.ts b/gallery/src/components/page-description.ts index e9680e59b3..9c98d9b37e 100644 --- a/gallery/src/components/page-description.ts +++ b/gallery/src/components/page-description.ts @@ -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` diff --git a/gallery/src/pages/automation/describe-action.ts b/gallery/src/pages/automation/describe-action.ts index 6465e9fc1e..9735880916 100644 --- a/gallery/src/pages/automation/describe-action.ts +++ b/gallery/src/pages/automation/describe-action.ts @@ -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` diff --git a/gallery/src/pages/automation/describe-condition.ts b/gallery/src/pages/automation/describe-condition.ts index 3350dce74f..dfd959a633 100644 --- a/gallery/src/pages/automation/describe-condition.ts +++ b/gallery/src/pages/automation/describe-condition.ts @@ -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` diff --git a/gallery/src/pages/automation/describe-trigger.ts b/gallery/src/pages/automation/describe-trigger.ts index 081f6162a7..49a57e652a 100644 --- a/gallery/src/pages/automation/describe-trigger.ts +++ b/gallery/src/pages/automation/describe-trigger.ts @@ -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` diff --git a/gallery/src/pages/automation/trace-timeline.ts b/gallery/src/pages/automation/trace-timeline.ts index b4d9fea9ec..638da986e0 100644 --- a/gallery/src/pages/automation/trace-timeline.ts +++ b/gallery/src/pages/automation/trace-timeline.ts @@ -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( diff --git a/gallery/src/pages/automation/trace.ts b/gallery/src/pages/automation/trace.ts index 7de26e1004..0092915510 100644 --- a/gallery/src/pages/automation/trace.ts +++ b/gallery/src/pages/automation/trace.ts @@ -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( diff --git a/gallery/src/pages/misc/entity-state.ts b/gallery/src/pages/misc/entity-state.ts index abd6e7c4f3..c49fcc0abc 100644 --- a/gallery/src/pages/misc/entity-state.ts +++ b/gallery/src/pages/misc/entity-state.ts @@ -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` diff --git a/gallery/src/pages/misc/integration-card.ts b/gallery/src/pages/misc/integration-card.ts index 168344e51b..f99b5f676c 100644 --- a/gallery/src/pages/misc/integration-card.ts +++ b/gallery/src/pages/misc/integration-card.ts @@ -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`
diff --git a/hassio/src/addon-store/hassio-addon-store.ts b/hassio/src/addon-store/hassio-addon-store.ts index 0ae00d5453..024d803be2 100644 --- a/hassio/src/addon-store/hassio-addon-store.ts +++ b/hassio/src/addon-store/hassio-addon-store.ts @@ -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} > ` - : html``; + : nothing; }) ); diff --git a/hassio/src/addon-view/config/hassio-addon-network.ts b/hassio/src/addon-view/config/hassio-addon-network.ts index 2d3b11c5ad..0e315bbf11 100644 --- a/hassio/src/addon-view/config/hassio-addon-network.ts +++ b/hassio/src/addon-view/config/hassio-addon-network.ts @@ -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( diff --git a/hassio/src/backups/hassio-backups.ts b/hassio/src/backups/hassio-backups.ts index abd17be598..bca0160b64 100644 --- a/hassio/src/backups/hassio-backups.ts +++ b/hassio/src/backups/hassio-backups.ts @@ -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` diff --git a/hassio/src/dialogs/backup/dialog-hassio-backup-upload.ts b/hassio/src/dialogs/backup/dialog-hassio-backup-upload.ts index 05901f2a3a..8718a359bc 100644 --- a/hassio/src/dialogs/backup/dialog-hassio-backup-upload.ts +++ b/hassio/src/dialogs/backup/dialog-hassio-backup-upload.ts @@ -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` diff --git a/hassio/src/dialogs/backup/dialog-hassio-backup.ts b/hassio/src/dialogs/backup/dialog-hassio-backup.ts index c5c868cd26..389bf5dd46 100644 --- a/hassio/src/dialogs/backup/dialog-hassio-backup.ts +++ b/hassio/src/dialogs/backup/dialog-hassio-backup.ts @@ -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` 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( diff --git a/hassio/src/hassio-my-redirect.ts b/hassio/src/hassio-my-redirect.ts index 526d6295e1..71bc873eb6 100644 --- a/hassio/src/hassio-my-redirect.ts +++ b/hassio/src/hassio-my-redirect.ts @@ -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``; } - return html``; + return nothing; } private _createRedirectUrl(redirect: Redirect): string { diff --git a/hassio/src/update-available/update-available-card.ts b/hassio/src/update-available/update-available-card.ts index c8472ae93b..84b01d1fdd 100644 --- a/hassio/src/update-available/update-available-card.ts +++ b/hassio/src/update-available/update-available-card.ts @@ -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); diff --git a/src/auth/ha-auth-flow.ts b/src/auth/ha-auth-flow.ts index f151fea546..0577a0af7c 100644 --- a/src/auth/ha-auth-flow.ts +++ b/src/auth/ha-auth-flow.ts @@ -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) { `; 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)} > ` - : html``} + : nothing} ${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`
diff --git a/src/components/data-table/ha-data-table.ts b/src/components/data-table/ha-data-table.ts index 34a0bc29d3..f837968d02 100644 --- a/src/components/data-table/ha-data-table.ts +++ b/src/components/data-table/ha-data-table.ts @@ -6,6 +6,7 @@ import { CSSResultGroup, html, LitElement, + nothing, PropertyValues, TemplateResult, } from "lit"; @@ -73,7 +74,7 @@ export interface DataTableColumnData 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`
${row.content}
`; diff --git a/src/components/device/ha-area-devices-picker.ts b/src/components/device/ha-area-devices-picker.ts index 3edee20f5a..9d2a1162c0 100644 --- a/src/components/device/ha-area-devices-picker.ts +++ b/src/components/device/ha-area-devices-picker.ts @@ -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, diff --git a/src/components/device/ha-device-automation-picker.ts b/src/components/device/ha-device-automation-picker.ts index d14833ca9e..a6a6632e1e 100644 --- a/src/components/device/ha-device-automation-picker.ts +++ b/src/components/device/ha-device-automation-picker.ts @@ -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` diff --git a/src/components/device/ha-devices-picker.ts b/src/components/device/ha-devices-picker.ts index 327af4c8ac..dd42865401 100644 --- a/src/components/device/ha-devices-picker.ts +++ b/src/components/device/ha-devices-picker.ts @@ -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; diff --git a/src/components/entity/ha-entities-picker.ts b/src/components/entity/ha-entities-picker.ts index e0a8b5ae41..e54074806b 100644 --- a/src/components/entity/ha-entities-picker.ts +++ b/src/components/entity/ha-entities-picker.ts @@ -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; diff --git a/src/components/entity/ha-entity-attribute-picker.ts b/src/components/entity/ha-entity-attribute-picker.ts index 6fb98f55b9..1e4c790712 100644 --- a/src/components/entity/ha-entity-attribute-picker.ts +++ b/src/components/entity/ha-entity-attribute-picker.ts @@ -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` diff --git a/src/components/entity/ha-entity-state-picker.ts b/src/components/entity/ha-entity-state-picker.ts index 3536baa665..2174ffb093 100644 --- a/src/components/entity/ha-entity-state-picker.ts +++ b/src/components/entity/ha-entity-state-picker.ts @@ -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` diff --git a/src/components/entity/ha-statistics-picker.ts b/src/components/entity/ha-statistics-picker.ts index 31266721c4..797cc1cf9f 100644 --- a/src/components/entity/ha-statistics-picker.ts +++ b/src/components/entity/ha-statistics-picker.ts @@ -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 = diff --git a/src/components/entity/state-badge.ts b/src/components/entity/state-badge.ts index b0e001e9c2..e855bfdd57 100644 --- a/src/components/entity/state-badge.ts +++ b/src/components/entity/state-badge.ts @@ -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; diff --git a/src/components/entity/state-info.ts b/src/components/entity/state-info.ts index 9db1bae9f7..7becc6c5b9 100644 --- a/src/components/entity/state-info.ts +++ b/src/components/entity/state-info.ts @@ -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); diff --git a/src/components/ha-addon-picker.ts b/src/components/ha-addon-picker.ts index 8c765d9755..86a6272e8e 100644 --- a/src/components/ha-addon-picker.ts +++ b/src/components/ha-addon-picker.ts @@ -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` ` - : html``; + : nothing; } if (this.stateObj.attributes.frontend_stream_type === STREAM_TYPE_WEB_RTC) { return html``; } - return html``; + return nothing; } private get _shouldRenderMJPEG() { diff --git a/src/components/ha-card.ts b/src/components/ha-card.ts index b00fa0ae51..fc95aa118d 100644 --- a/src/components/ha-card.ts +++ b/src/components/ha-card.ts @@ -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`

${this.header}

` - : html``} + : nothing} `; } diff --git a/src/components/ha-config-entry-picker.ts b/src/components/ha-config-entry-picker.ts index 09bfc45b4e..b4efd43637 100644 --- a/src/components/ha-config-entry-picker.ts +++ b/src/components/ha-config-entry-picker.ts @@ -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 { /> `; - protected render(): TemplateResult { + protected render() { if (!this._configEntries) { - return html``; + return nothing; } return html` `; diff --git a/src/components/ha-markdown.ts b/src/components/ha-markdown.ts index 4183fba672..795349d256 100644 --- a/src/components/ha-markdown.ts +++ b/src/components/ha-markdown.ts @@ -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` @@ -388,7 +389,7 @@ export class HaMediaPlayerBrowse extends LitElement { : ""}
` - : html``} + : nothing}
[entityId]); - protected render(): TemplateResult { + protected render() { if (!this.hass || !this.stateObj) { - return html``; + return nothing; } return html` diff --git a/src/dialogs/more-info/controls/more-info-remote.ts b/src/dialogs/more-info/controls/more-info-remote.ts index dbdc2fd0c9..5198453308 100644 --- a/src/dialogs/more-info/controls/more-info-remote.ts +++ b/src/dialogs/more-info/controls/more-info-remote.ts @@ -1,12 +1,12 @@ -import { html, LitElement, TemplateResult } from "lit"; +import "@material/mwc-list/mwc-list"; +import "@material/mwc-list/mwc-list-item"; +import { html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; +import { stopPropagation } from "../../../common/dom/stop_propagation"; import { supportsFeature } from "../../../common/entity/supports-feature"; import "../../../components/ha-attributes"; import { RemoteEntity, REMOTE_SUPPORT_ACTIVITY } from "../../../data/remote"; import { HomeAssistant } from "../../../types"; -import "@material/mwc-list/mwc-list-item"; -import "@material/mwc-list/mwc-list"; -import { stopPropagation } from "../../../common/dom/stop_propagation"; const filterExtraAttributes = "activity_list,current_activity"; @@ -16,9 +16,9 @@ class MoreInfoRemote extends LitElement { @property() public stateObj?: RemoteEntity; - protected render(): TemplateResult { + protected render() { if (!this.hass || !this.stateObj) { - return html``; + return nothing; } const stateObj = this.stateObj; diff --git a/src/dialogs/more-info/controls/more-info-script.ts b/src/dialogs/more-info/controls/more-info-script.ts index 2f42f1b6e7..1d9ed6fb0c 100644 --- a/src/dialogs/more-info/controls/more-info-script.ts +++ b/src/dialogs/more-info/controls/more-info-script.ts @@ -1,5 +1,5 @@ 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 { HomeAssistant } from "../../../types"; @@ -10,9 +10,9 @@ class MoreInfoScript extends LitElement { @property() public stateObj?: HassEntity; - protected render(): TemplateResult { + protected render() { if (!this.hass || !this.stateObj) { - return html``; + return nothing; } return html` diff --git a/src/dialogs/more-info/controls/more-info-sun.ts b/src/dialogs/more-info/controls/more-info-sun.ts index 728dcfcf72..537fb95f78 100644 --- a/src/dialogs/more-info/controls/more-info-sun.ts +++ b/src/dialogs/more-info/controls/more-info-sun.ts @@ -1,5 +1,5 @@ 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 { formatTime } from "../../../common/datetime/format_time"; import { formatNumber } from "../../../common/number/format_number"; @@ -12,9 +12,9 @@ class MoreInfoSun extends LitElement { @property() public stateObj?: HassEntity; - protected render(): TemplateResult { + protected render() { if (!this.hass || !this.stateObj) { - return html``; + return nothing; } const risingDate = new Date(this.stateObj.attributes.next_rising); diff --git a/src/dialogs/more-info/controls/more-info-timer.ts b/src/dialogs/more-info/controls/more-info-timer.ts index 63be3032f9..cba66d5ed7 100644 --- a/src/dialogs/more-info/controls/more-info-timer.ts +++ b/src/dialogs/more-info/controls/more-info-timer.ts @@ -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 } from "lit/decorators"; import "../../../components/ha-attributes"; import { TimerEntity } from "../../../data/timer"; @@ -11,9 +11,9 @@ class MoreInfoTimer extends LitElement { @property() public stateObj?: TimerEntity; - protected render(): TemplateResult { + protected render() { if (!this.hass || !this.stateObj) { - return html``; + return nothing; } return html` diff --git a/src/dialogs/more-info/controls/more-info-update.ts b/src/dialogs/more-info/controls/more-info-update.ts index de73cc1f3c..195fe6f7d5 100644 --- a/src/dialogs/more-info/controls/more-info-update.ts +++ b/src/dialogs/more-info/controls/more-info-update.ts @@ -1,12 +1,13 @@ -import "../../../components/ha-alert"; -import "../../../components/ha-faded"; import "@material/mwc-button/mwc-button"; import "@material/mwc-linear-progress/mwc-linear-progress"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; +import { BINARY_STATE_OFF } from "../../../common/const"; import { supportsFeature } from "../../../common/entity/supports-feature"; +import "../../../components/ha-alert"; import "../../../components/ha-checkbox"; import "../../../components/ha-circular-progress"; +import "../../../components/ha-faded"; import "../../../components/ha-formfield"; import "../../../components/ha-markdown"; import { isUnavailableState } from "../../../data/entity"; @@ -21,7 +22,6 @@ import { UPDATE_SUPPORT_SPECIFIC_VERSION, } from "../../../data/update"; import type { HomeAssistant } from "../../../types"; -import { BINARY_STATE_OFF } from "../../../common/const"; @customElement("more-info-update") class MoreInfoUpdate extends LitElement { @@ -33,13 +33,13 @@ class MoreInfoUpdate extends LitElement { @state() private _error?: string; - protected render(): TemplateResult { + protected render() { if ( !this.hass || !this.stateObj || isUnavailableState(this.stateObj.state) ) { - return html``; + return nothing; } const skippedVersion = diff --git a/src/dialogs/more-info/controls/more-info-vacuum.ts b/src/dialogs/more-info/controls/more-info-vacuum.ts index 5a183712d6..c734e0160c 100644 --- a/src/dialogs/more-info/controls/more-info-vacuum.ts +++ b/src/dialogs/more-info/controls/more-info-vacuum.ts @@ -9,7 +9,7 @@ import { mdiStop, mdiTargetVariant, } 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 { stopPropagation } from "../../../common/dom/stop_propagation"; import { supportsFeature } from "../../../common/entity/supports-feature"; @@ -90,9 +90,9 @@ class MoreInfoVacuum extends LitElement { @property() public stateObj?: VacuumEntity; - protected render(): TemplateResult { + protected render() { if (!this.hass || !this.stateObj) { - return html``; + return nothing; } const stateObj = this.stateObj; diff --git a/src/dialogs/more-info/controls/more-info-weather.ts b/src/dialogs/more-info/controls/more-info-weather.ts index 01a091b146..0b4a80ad93 100644 --- a/src/dialogs/more-info/controls/more-info-weather.ts +++ b/src/dialogs/more-info/controls/more-info-weather.ts @@ -11,7 +11,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property } from "lit/decorators"; import { formatDateWeekdayDay } from "../../../common/datetime/format_date"; @@ -50,9 +50,9 @@ class MoreInfoWeather extends LitElement { return false; } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this.stateObj) { - return html``; + return nothing; } const hourly = isForecastHourly(this.stateObj.attributes.forecast); diff --git a/src/dialogs/more-info/ha-more-info-history.ts b/src/dialogs/more-info/ha-more-info-history.ts index 0611b0559a..a347ac59df 100644 --- a/src/dialogs/more-info/ha-more-info-history.ts +++ b/src/dialogs/more-info/ha-more-info-history.ts @@ -1,24 +1,24 @@ import { startOfYesterday, subHours } from "date-fns/esm"; -import { css, html, LitElement, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement, PropertyValues, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { isComponentLoaded } from "../../common/config/is_component_loaded"; import { fireEvent } from "../../common/dom/fire_event"; +import { computeDomain } from "../../common/entity/compute_domain"; import "../../components/chart/state-history-charts"; +import "../../components/chart/statistics-chart"; import { + computeHistory, HistoryResult, subscribeHistoryStatesTimeWindow, - computeHistory, } from "../../data/history"; import { fetchStatistics, getStatisticMetadata, Statistics, - StatisticsTypes, StatisticsMetaData, + StatisticsTypes, } from "../../data/recorder"; import { HomeAssistant } from "../../types"; -import "../../components/chart/statistics-chart"; -import { computeDomain } from "../../common/entity/compute_domain"; declare global { interface HASSDomEvents { @@ -50,9 +50,9 @@ export class MoreInfoHistory extends LitElement { private _metadata?: Record; - protected render(): TemplateResult { + protected render() { if (!this.entityId) { - return html``; + return nothing; } return html` ${isComponentLoaded(this.hass, "history") diff --git a/src/dialogs/more-info/ha-more-info-logbook.ts b/src/dialogs/more-info/ha-more-info-logbook.ts index 0698489112..f7a3ea990a 100644 --- a/src/dialogs/more-info/ha-more-info-logbook.ts +++ b/src/dialogs/more-info/ha-more-info-logbook.ts @@ -1,5 +1,5 @@ import { startOfYesterday } from "date-fns/esm"; -import { css, html, LitElement, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement, PropertyValues, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import memoizeOne from "memoize-one"; import { isComponentLoaded } from "../../common/config/is_component_loaded"; @@ -19,14 +19,14 @@ export class MoreInfoLogbook extends LitElement { private _entityIdAsList = memoizeOne((entityId: string) => [entityId]); - protected render(): TemplateResult { + protected render() { if (!isComponentLoaded(this.hass, "logbook") || !this.entityId) { - return html``; + return nothing; } const stateObj = this.hass.states[this.entityId]; if (!stateObj) { - return html``; + return nothing; } return html` diff --git a/src/dialogs/more-info/ha-more-info-settings.ts b/src/dialogs/more-info/ha-more-info-settings.ts index 54dbffcb4c..6cc09a47fa 100644 --- a/src/dialogs/more-info/ha-more-info-settings.ts +++ b/src/dialogs/more-info/ha-more-info-settings.ts @@ -1,6 +1,13 @@ import "@material/mwc-tab"; import "@material/mwc-tab-bar"; -import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit"; +import { + css, + CSSResultGroup, + html, + LitElement, + PropertyValues, + nothing, +} from "lit"; import { customElement, property, state } from "lit/decorators"; import { dynamicElement } from "../../common/dom/dynamic-element-directive"; import { @@ -25,7 +32,7 @@ export class HaMoreInfoSettings extends LitElement { protected render() { // loading. if (this.entry === undefined) { - return html``; + return nothing; } // No unique ID @@ -49,7 +56,7 @@ export class HaMoreInfoSettings extends LitElement { } if (!this._settingsElementTag) { - return html``; + return nothing; } return html` diff --git a/src/dialogs/notifications/configurator-notification-item.ts b/src/dialogs/notifications/configurator-notification-item.ts index 2ec0c037c7..47c7be0750 100644 --- a/src/dialogs/notifications/configurator-notification-item.ts +++ b/src/dialogs/notifications/configurator-notification-item.ts @@ -1,5 +1,5 @@ import "@material/mwc-button"; -import { html, LitElement, TemplateResult } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../common/dom/fire_event"; import { computeStateDisplay } from "../../common/entity/compute_state_display"; @@ -14,9 +14,9 @@ export class HuiConfiguratorNotificationItem extends LitElement { @property() public notification?: PersitentNotificationEntity; - protected render(): TemplateResult { + protected render() { if (!this.hass || !this.notification) { - return html``; + return nothing; } return html` diff --git a/src/dialogs/notifications/notification-item.ts b/src/dialogs/notifications/notification-item.ts index ad767eab15..908e192514 100644 --- a/src/dialogs/notifications/notification-item.ts +++ b/src/dialogs/notifications/notification-item.ts @@ -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 } from "lit/decorators"; import { PersistentNotification } from "../../data/persistent_notification"; import { HomeAssistant } from "../../types"; @@ -20,9 +20,9 @@ export class HuiNotificationItem extends LitElement { return false; } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this.notification) { - return html``; + return nothing; } return "entity_id" in this.notification diff --git a/src/dialogs/notifications/persistent-notification-item.ts b/src/dialogs/notifications/persistent-notification-item.ts index 1bd0c408d8..fca3a395da 100644 --- a/src/dialogs/notifications/persistent-notification-item.ts +++ b/src/dialogs/notifications/persistent-notification-item.ts @@ -1,6 +1,6 @@ import "@material/mwc-button"; import "@polymer/paper-tooltip/paper-tooltip"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { formatDateTime } from "../../common/datetime/format_date_time"; import "../../components/ha-markdown"; @@ -15,9 +15,9 @@ export class HuiPersistentNotificationItem extends LitElement { @property() public notification?: PersistentNotification; - protected render(): TemplateResult { + protected render() { if (!this.hass || !this.notification) { - return html``; + return nothing; } return html` diff --git a/src/dialogs/quick-bar/ha-quick-bar.ts b/src/dialogs/quick-bar/ha-quick-bar.ts index 2b86ca4351..9923b134c1 100644 --- a/src/dialogs/quick-bar/ha-quick-bar.ts +++ b/src/dialogs/quick-bar/ha-quick-bar.ts @@ -9,7 +9,7 @@ import { mdiReload, mdiServerNetwork, } from "@mdi/js"; -import { css, html, LitElement, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import { styleMap } from "lit/directives/style-map"; @@ -32,8 +32,8 @@ import "../../components/ha-chip"; import "../../components/ha-circular-progress"; import "../../components/ha-header-bar"; import "../../components/ha-icon-button"; -import "../../components/ha-textfield"; import "../../components/ha-list-item"; +import "../../components/ha-textfield"; import { fetchHassioAddonsInfo } from "../../data/hassio/addon"; import { domainToName } from "../../data/integration"; import { getPanelNameTranslationKey } from "../../data/panel"; @@ -136,7 +136,7 @@ export class QuickBar extends LitElement { protected render() { if (!this._open) { - return html``; + return nothing; } const items: QuickBarItem[] | undefined = this._getItems( @@ -273,9 +273,9 @@ export class QuickBar extends LitElement { } } - private _renderItem = (item: QuickBarItem, index: number): TemplateResult => { + private _renderItem = (item: QuickBarItem, index: number) => { if (!item) { - return html``; + return nothing; } return isCommandItem(item) ? this._renderCommandItem(item, index) diff --git a/src/dialogs/restart/dialog-restart.ts b/src/dialogs/restart/dialog-restart.ts index cc712f4839..506b961823 100644 --- a/src/dialogs/restart/dialog-restart.ts +++ b/src/dialogs/restart/dialog-restart.ts @@ -1,6 +1,6 @@ import "@material/mwc-list/mwc-list"; import { mdiAutoFix, mdiPower, mdiPowerCycle, mdiRefresh } 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 { isComponentLoaded } from "../../common/config/is_component_loaded"; import { fireEvent } from "../../common/dom/fire_event"; @@ -74,9 +74,9 @@ class DialogRestart extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this._open) { - return html``; + return nothing; } const showReload = this.hass.userData?.showAdvanced; diff --git a/src/dialogs/voice-command-dialog/ha-voice-command-dialog.ts b/src/dialogs/voice-command-dialog/ha-voice-command-dialog.ts index dc0cfd1e8b..b32d0d40e5 100644 --- a/src/dialogs/voice-command-dialog/ha-voice-command-dialog.ts +++ b/src/dialogs/voice-command-dialog/ha-voice-command-dialog.ts @@ -12,7 +12,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -86,9 +86,9 @@ export class HaVoiceCommandDialog extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this._opened) { - return html``; + return nothing; } return html` `; } - return html``; + return nothing; } protected firstUpdated(changedProps: PropertyValues) { diff --git a/src/onboarding/onboarding-integrations.ts b/src/onboarding/onboarding-integrations.ts index e35cdf15e2..519499721c 100644 --- a/src/onboarding/onboarding-integrations.ts +++ b/src/onboarding/onboarding-integrations.ts @@ -1,4 +1,5 @@ import "@material/mwc-button/mwc-button"; +import { mdiCheck, mdiDotsHorizontal } from "@mdi/js"; import { css, CSSResultGroup, @@ -6,12 +7,12 @@ import { LitElement, PropertyValues, TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { mdiCheck, mdiDotsHorizontal } from "@mdi/js"; +import { isComponentLoaded } from "../common/config/is_component_loaded"; import { fireEvent } from "../common/dom/fire_event"; import { stringCompare } from "../common/string/compare"; -import { isComponentLoaded } from "../common/config/is_component_loaded"; import { LocalizeFunc } from "../common/translations/localize"; import { ConfigEntry, getConfigEntries } from "../data/config_entries"; import { @@ -74,9 +75,9 @@ class OnboardingIntegrations extends LitElement { } } - protected render(): TemplateResult { + protected render() { if (!this._entries || !this._discovered) { - return html``; + return nothing; } // Render discovered and existing entries together sorted by localized title. const entries: Array<[string, TemplateResult]> = this._entries.map( diff --git a/src/panels/calendar/confirm-event-dialog-box.ts b/src/panels/calendar/confirm-event-dialog-box.ts index 77819ee774..389c753d73 100644 --- a/src/panels/calendar/confirm-event-dialog-box.ts +++ b/src/panels/calendar/confirm-event-dialog-box.ts @@ -1,13 +1,13 @@ 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 "../../components/ha-dialog"; import "../../components/ha-svg-icon"; import "../../components/ha-switch"; +import { RecurrenceRange } from "../../data/calendar"; import { HomeAssistant } from "../../types"; import { ConfirmEventDialogBoxParams } from "./show-confirm-event-dialog-box"; -import { RecurrenceRange } from "../../data/calendar"; @customElement("confirm-event-dialog-box") class ConfirmEventDialogBox extends LitElement { @@ -23,9 +23,9 @@ class ConfirmEventDialogBox extends LitElement { return true; } - protected render(): TemplateResult { + protected render() { if (!this._params) { - return html``; + return nothing; } return html` diff --git a/src/panels/calendar/dialog-calendar-event-detail.ts b/src/panels/calendar/dialog-calendar-event-detail.ts index 8bc8f81512..aba011143a 100644 --- a/src/panels/calendar/dialog-calendar-event-detail.ts +++ b/src/panels/calendar/dialog-calendar-event-detail.ts @@ -1,8 +1,8 @@ import "@material/mwc-button"; import { mdiCalendarClock, mdiClose } from "@mdi/js"; -import { addDays, isSameDay } from "date-fns/esm"; import { toDate } from "date-fns-tz"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { addDays, isSameDay } from "date-fns/esm"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { property, state } from "lit/decorators"; import { formatDate } from "../../common/datetime/format_date"; import { formatDateTime } from "../../common/datetime/format_date_time"; @@ -19,10 +19,10 @@ import { import { haStyleDialog } from "../../resources/styles"; import { HomeAssistant } from "../../types"; import "../lovelace/components/hui-generic-entity-row"; +import { renderRRuleAsText } from "./recurrence"; import { showConfirmEventDialog } from "./show-confirm-event-dialog-box"; import { CalendarEventDetailDialogParams } from "./show-dialog-calendar-event-detail"; import { showCalendarEventEditDialog } from "./show-dialog-calendar-event-editor"; -import { renderRRuleAsText } from "./recurrence"; class DialogCalendarEventDetail extends LitElement { @property({ attribute: false }) public hass!: HomeAssistant; @@ -54,9 +54,9 @@ class DialogCalendarEventDetail extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this._params) { - return html``; + return nothing; } const stateObj = this.hass.states[this._calendarId!]; return html` @@ -90,7 +90,7 @@ class DialogCalendarEventDetail extends LitElement { ? html`
${this._data.description}

` - : html``} + : nothing}
diff --git a/src/panels/calendar/dialog-calendar-event-editor.ts b/src/panels/calendar/dialog-calendar-event-editor.ts index 64a7aa3321..35660d67ae 100644 --- a/src/panels/calendar/dialog-calendar-event-editor.ts +++ b/src/panels/calendar/dialog-calendar-event-editor.ts @@ -1,5 +1,6 @@ import "@material/mwc-button"; import { mdiClose } from "@mdi/js"; +import { formatInTimeZone, toDate } from "date-fns-tz"; import { addDays, addHours, @@ -7,9 +8,8 @@ import { differenceInMilliseconds, startOfHour, } from "date-fns/esm"; -import { formatInTimeZone, toDate } from "date-fns-tz"; 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, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../common/dom/fire_event"; @@ -25,8 +25,8 @@ import { CalendarEventMutableParams, createCalendarEvent, deleteCalendarEvent, - updateCalendarEvent, RecurrenceRange, + updateCalendarEvent, } from "../../data/calendar"; import { haStyleDialog } from "../../resources/styles"; import { HomeAssistant } from "../../types"; @@ -123,9 +123,9 @@ class DialogCalendarEventEditor extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this._params) { - return html``; + return nothing; } const isCreate = this._params.entry === undefined; diff --git a/src/panels/calendar/ha-full-calendar.ts b/src/panels/calendar/ha-full-calendar.ts index 56ff0fd8d7..447d2211f8 100644 --- a/src/panels/calendar/ha-full-calendar.ts +++ b/src/panels/calendar/ha-full-calendar.ts @@ -18,7 +18,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoize from "memoize-one"; @@ -104,7 +104,7 @@ export class HAFullCalendar extends LitElement { this.calendar?.updateSize(); } - protected render(): TemplateResult { + protected render() { const viewToggleButtons = this._viewToggleButtons( this.views, this.hass.localize @@ -203,7 +203,7 @@ export class HAFullCalendar extends LitElement { > ` - : html``} + : nothing} `; } diff --git a/src/panels/calendar/ha-recurrence-rule-editor.ts b/src/panels/calendar/ha-recurrence-rule-editor.ts index b7b3c03f5e..987b58ab2e 100644 --- a/src/panels/calendar/ha-recurrence-rule-editor.ts +++ b/src/panels/calendar/ha-recurrence-rule-editor.ts @@ -1,6 +1,6 @@ import type { SelectedDetail } from "@material/mwc-list"; import { formatInTimeZone, toDate } from "date-fns-tz"; -import { css, html, LitElement, PropertyValues } from "lit"; +import { css, html, LitElement, PropertyValues, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import type { Options, WeekdayStr } from "rrule"; @@ -9,6 +9,7 @@ import { firstWeekdayIndex } from "../../common/datetime/first_weekday"; import { stopPropagation } from "../../common/dom/stop_propagation"; import { LocalizeKeys } from "../../common/translations/localize"; import "../../components/ha-chip"; +import "../../components/ha-date-input"; import "../../components/ha-list-item"; import "../../components/ha-select"; import type { HaSelect } from "../../components/ha-select"; @@ -18,18 +19,17 @@ import { convertFrequency, convertRepeatFrequency, DEFAULT_COUNT, + getMonthdayRepeatFromRule, + getMonthlyRepeatItems, + getMonthlyRepeatWeekdayFromRule, getWeekday, getWeekdays, - getMonthlyRepeatItems, + MonthlyRepeatItem, RepeatEnd, RepeatFrequency, ruleByWeekDay, untilValue, - MonthlyRepeatItem, - getMonthlyRepeatWeekdayFromRule, - getMonthdayRepeatFromRule, } from "./recurrence"; -import "../../components/ha-date-input"; @customElement("ha-recurrence-rule-editor") export class RecurrenceRuleEditor extends LitElement { @@ -233,7 +233,7 @@ export class RecurrenceRuleEditor extends LitElement { ` )} ` - : html``} + : nothing} `; } @@ -321,7 +321,7 @@ export class RecurrenceRuleEditor extends LitElement { @change=${this._onCountChange} > ` - : html``} + : nothing} ${this._end === "on" ? html` ` - : html``} + : nothing} `; } render() { return html` ${this.renderRepeat()} - ${this._freq === "monthly" ? this.renderMonthly() : html``} - ${this._freq === "weekly" ? this.renderWeekly() : html``} - ${this._freq === "daily" ? this.renderDaily() : html``} - ${this._freq !== "none" ? this.renderEnd() : html``} + ${this._freq === "monthly" ? this.renderMonthly() : nothing} + ${this._freq === "weekly" ? this.renderWeekly() : nothing} + ${this._freq === "daily" ? this.renderDaily() : nothing} + ${this._freq !== "none" ? this.renderEnd() : nothing} `; } diff --git a/src/panels/config/application_credentials/dialog-add-application-credential.ts b/src/panels/config/application_credentials/dialog-add-application-credential.ts index f6d017a9ee..8c1283ec8f 100644 --- a/src/panels/config/application_credentials/dialog-add-application-credential.ts +++ b/src/panels/config/application_credentials/dialog-add-application-credential.ts @@ -2,7 +2,7 @@ import "@material/mwc-button"; import "@material/mwc-list/mwc-list-item"; import { mdiOpenInNew } from "@mdi/js"; import { ComboBoxLitRenderer } from "@vaadin/combo-box/lit"; -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"; @@ -84,9 +84,9 @@ export class DialogAddApplicationCredential extends LitElement { } } - protected render(): TemplateResult { + protected render() { if (!this._params || !this._domains) { - return html``; + return nothing; } const selectedDomainName = this._params.selectedDomain ? domainToName(this.hass.localize, this._domain!) diff --git a/src/panels/config/application_credentials/ha-config-application-credentials.ts b/src/panels/config/application_credentials/ha-config-application-credentials.ts index bacd283923..da139623ee 100644 --- a/src/panels/config/application_credentials/ha-config-application-credentials.ts +++ b/src/panels/config/application_credentials/ha-config-application-credentials.ts @@ -1,5 +1,12 @@ import { mdiDelete, mdiPlus } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit"; +import { + css, + CSSResultGroup, + html, + LitElement, + PropertyValues, + nothing, +} from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; @@ -147,7 +154,7 @@ export class HaConfigApplicationCredentials extends LitElement { ` - : html``} + : nothing} ` - : html``} + : nothing} = { name: string; @@ -164,9 +164,9 @@ class HaConfigAreaPage extends SubscribeMixin(LitElement) { ]; } - protected render(): TemplateResult { + protected render() { if (!this._areas || !this._devices || !this._entities) { - return html``; + return nothing; } const area = this._area(this.areaId, this._areas); diff --git a/src/panels/config/automation/automation-mode-dialog/dialog-automation-mode.ts b/src/panels/config/automation/automation-mode-dialog/dialog-automation-mode.ts index a8e1ce3aab..54175de108 100644 --- a/src/panels/config/automation/automation-mode-dialog/dialog-automation-mode.ts +++ b/src/panels/config/automation/automation-mode-dialog/dialog-automation-mode.ts @@ -1,22 +1,22 @@ import "@material/mwc-button"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import "@material/mwc-list/mwc-list-item"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; +import { stopPropagation } from "../../../../common/dom/stop_propagation"; import { createCloseHeading } from "../../../../components/ha-dialog"; -import "../../../../components/ha-textfield"; import "../../../../components/ha-select"; -import { HassDialog } from "../../../../dialogs/make-dialog-manager"; -import { haStyle, haStyleDialog } from "../../../../resources/styles"; -import type { HomeAssistant } from "../../../../types"; -import type { AutomationModeDialog } from "./show-dialog-automation-mode"; +import "../../../../components/ha-textfield"; import { AUTOMATION_DEFAULT_MAX, AUTOMATION_DEFAULT_MODE, } from "../../../../data/automation"; -import { documentationUrl } from "../../../../util/documentation-url"; import { isMaxMode, MODES } from "../../../../data/script"; -import "@material/mwc-list/mwc-list-item"; -import { stopPropagation } from "../../../../common/dom/stop_propagation"; +import { HassDialog } from "../../../../dialogs/make-dialog-manager"; +import { haStyle, haStyleDialog } from "../../../../resources/styles"; +import type { HomeAssistant } from "../../../../types"; +import { documentationUrl } from "../../../../util/documentation-url"; +import type { AutomationModeDialog } from "./show-dialog-automation-mode"; @customElement("ha-dialog-automation-mode") class DialogAutomationMode extends LitElement implements HassDialog { @@ -48,9 +48,9 @@ class DialogAutomationMode extends LitElement implements HassDialog { this._opened = false; } - protected render(): TemplateResult { + protected render() { if (!this._opened) { - return html``; + return nothing; } return html` @@ -107,7 +107,7 @@ class DialogAutomationMode extends LitElement implements HassDialog { > ` - : html``} + : nothing} ${this.hass.localize("ui.dialogs.generic.cancel")} diff --git a/src/panels/config/automation/automation-rename-dialog/dialog-automation-rename.ts b/src/panels/config/automation/automation-rename-dialog/dialog-automation-rename.ts index 8dcf1e4219..f39223cfad 100644 --- a/src/panels/config/automation/automation-rename-dialog/dialog-automation-rename.ts +++ b/src/panels/config/automation/automation-rename-dialog/dialog-automation-rename.ts @@ -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, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; +import "../../../../components/ha-alert"; import { createCloseHeading } from "../../../../components/ha-dialog"; +import "../../../../components/ha-textarea"; +import "../../../../components/ha-textfield"; import { HassDialog } from "../../../../dialogs/make-dialog-manager"; import { haStyle, haStyleDialog } from "../../../../resources/styles"; import type { HomeAssistant } from "../../../../types"; import type { AutomationRenameDialog } from "./show-dialog-automation-rename"; -import "../../../../components/ha-textarea"; -import "../../../../components/ha-alert"; -import "../../../../components/ha-textfield"; @customElement("ha-dialog-automation-rename") class DialogAutomationRename extends LitElement implements HassDialog { @@ -43,9 +43,9 @@ class DialogAutomationRename extends LitElement implements HassDialog { this._opened = false; } - protected render(): TemplateResult { + protected render() { if (!this._opened) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/automation/condition/ha-automation-condition.ts b/src/panels/config/automation/condition/ha-automation-condition.ts index d936b7a4f3..942fe074ae 100644 --- a/src/panels/config/automation/condition/ha-automation-condition.ts +++ b/src/panels/config/automation/condition/ha-automation-condition.ts @@ -2,7 +2,14 @@ import "@material/mwc-button"; import type { ActionDetail } from "@material/mwc-list"; import { mdiArrowDown, mdiArrowUp, mdiDrag, mdiPlus } from "@mdi/js"; import deepClone from "deep-clone-simple"; -import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit"; +import { + css, + CSSResultGroup, + html, + LitElement, + PropertyValues, + nothing, +} from "lit"; import { customElement, property } from "lit/decorators"; import { repeat } from "lit/directives/repeat"; import memoizeOne from "memoize-one"; @@ -22,6 +29,7 @@ import { stringCompare } from "../../../../common/string/compare"; import type { LocalizeFunc } from "../../../../common/translations/localize"; import type { HaSelect } from "../../../../components/ha-select"; import { CONDITION_TYPES } from "../../../../data/condition"; +import { sortableStyles } from "../../../../resources/ha-sortable-style"; import { loadSortable, SortableInstance, @@ -35,7 +43,6 @@ import "./types/ha-automation-condition-template"; import "./types/ha-automation-condition-time"; import "./types/ha-automation-condition-trigger"; import "./types/ha-automation-condition-zone"; -import { sortableStyles } from "../../../../resources/ha-sortable-style"; @customElement("ha-automation-condition") export default class HaAutomationCondition extends LitElement { @@ -102,7 +109,7 @@ export default class HaAutomationCondition extends LitElement { protected render() { if (!Array.isArray(this.conditions)) { - return html``; + return nothing; } return html` ${this.reOrderMode && !this.nested diff --git a/src/panels/config/automation/dialog-new-automation.ts b/src/panels/config/automation/dialog-new-automation.ts index c91ad599f9..cc9183a3c8 100644 --- a/src/panels/config/automation/dialog-new-automation.ts +++ b/src/panels/config/automation/dialog-new-automation.ts @@ -7,7 +7,7 @@ import { mdiPencilOutline, mdiWeb, } 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 "../../../common/dom/fire_event"; @@ -78,9 +78,9 @@ class DialogNewAutomation extends LitElement implements HassDialog { ); }); - protected render(): TemplateResult { + protected render() { if (!this._opened) { - return html``; + return nothing; } const processedBlueprints = this._processedBlueprints(this.blueprints); diff --git a/src/panels/config/automation/thingtalk/dialog-thingtalk.ts b/src/panels/config/automation/thingtalk/dialog-thingtalk.ts index 8eae2ce4b6..7b06413e2c 100644 --- a/src/panels/config/automation/thingtalk/dialog-thingtalk.ts +++ b/src/panels/config/automation/thingtalk/dialog-thingtalk.ts @@ -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, query, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-circular-progress"; @@ -70,9 +70,9 @@ class DialogThingtalk extends LitElement { this.closeDialog(); } - protected render(): TemplateResult { + protected render() { if (!this._params) { - return html``; + return nothing; } if (this._placeholders) { return html` diff --git a/src/panels/config/automation/trigger/types/ha-automation-trigger-tag.ts b/src/panels/config/automation/trigger/types/ha-automation-trigger-tag.ts index e9c13c24fb..be5a8c7fee 100644 --- a/src/panels/config/automation/trigger/types/ha-automation-trigger-tag.ts +++ b/src/panels/config/automation/trigger/types/ha-automation-trigger-tag.ts @@ -1,5 +1,5 @@ import "@material/mwc-list/mwc-list-item"; -import { css, html, LitElement, PropertyValues } from "lit"; +import { css, html, LitElement, PropertyValues, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import { caseInsensitiveStringCompare } from "../../../../../common/string/compare"; @@ -30,7 +30,7 @@ export class HaTagTrigger extends LitElement implements TriggerElement { protected render() { if (!this._tags) { - return html``; + return nothing; } return html` entity.entity_id === entityId) ); - protected render(): TemplateResult { + protected render() { if (!this.updateEntities?.length) { - return html``; + return nothing; } const updates = this.updateEntities; diff --git a/src/panels/config/devices/device-detail/ha-device-automation-card.ts b/src/panels/config/devices/device-detail/ha-device-automation-card.ts index dc22f8a1dc..b1b1c6c697 100644 --- a/src/panels/config/devices/device-detail/ha-device-automation-card.ts +++ b/src/panels/config/devices/device-detail/ha-device-automation-card.ts @@ -1,4 +1,4 @@ -import { css, html, LitElement, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-chip"; @@ -58,9 +58,9 @@ export abstract class HaDeviceAutomationCard< return false; } - protected render(): TemplateResult { + protected render() { if (this.automations.length === 0) { - return html``; + return nothing; } const automations = this._showSecondary ? this.automations diff --git a/src/panels/config/devices/device-detail/ha-device-automation-dialog.ts b/src/panels/config/devices/device-detail/ha-device-automation-dialog.ts index de0c862a0c..c116ef0ddd 100644 --- a/src/panels/config/devices/device-detail/ha-device-automation-dialog.ts +++ b/src/panels/config/devices/device-detail/ha-device-automation-dialog.ts @@ -1,5 +1,5 @@ import "@material/mwc-button/mwc-button"; -import { CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-dialog"; @@ -77,9 +77,9 @@ export class DialogDeviceAutomation extends LitElement { }); } - protected render(): TemplateResult | void { + protected render() { if (!this._params) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/devices/device-detail/ha-device-via-devices-card.ts b/src/panels/config/devices/device-detail/ha-device-via-devices-card.ts index b437c42938..fd75189514 100644 --- a/src/panels/config/devices/device-detail/ha-device-via-devices-card.ts +++ b/src/panels/config/devices/device-detail/ha-device-via-devices-card.ts @@ -1,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 { caseInsensitiveStringCompare } from "../../../../common/string/compare"; @@ -37,11 +37,11 @@ export class HaDeviceViaDevicesCard extends LitElement { ) ); - protected render(): TemplateResult { + protected render() { const viaDevices = this._viaDevices(this.deviceId, this.hass.devices); if (viaDevices.length === 0) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/devices/device-detail/integration-elements/mqtt/dialog-mqtt-device-debug-info.ts b/src/panels/config/devices/device-detail/integration-elements/mqtt/dialog-mqtt-device-debug-info.ts index 93c3d6a5a9..933ed8769c 100644 --- a/src/panels/config/devices/device-detail/integration-elements/mqtt/dialog-mqtt-device-debug-info.ts +++ b/src/panels/config/devices/device-detail/integration-elements/mqtt/dialog-mqtt-device-debug-info.ts @@ -1,5 +1,12 @@ import "@material/mwc-button/mwc-button"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { + css, + CSSResultGroup, + html, + LitElement, + TemplateResult, + nothing, +} from "lit"; import { customElement, state } from "lit/decorators"; import { computeStateName } from "../../../../../../common/entity/compute_state_name"; import { computeRTLDirection } from "../../../../../../common/util/compute_rtl"; @@ -39,9 +46,9 @@ class DialogMQTTDeviceDebugInfo extends LitElement { }); } - protected render(): TemplateResult { + protected render() { if (!this._params || !this._debugInfo) { - return html``; + return nothing; } const dir = computeRTLDirection(this.hass!); diff --git a/src/panels/config/devices/device-detail/integration-elements/zha/ha-device-info-zha.ts b/src/panels/config/devices/device-detail/integration-elements/zha/ha-device-info-zha.ts index 3f1f0fad16..227cfbd043 100644 --- a/src/panels/config/devices/device-detail/integration-elements/zha/ha-device-info-zha.ts +++ b/src/panels/config/devices/device-detail/integration-elements/zha/ha-device-info-zha.ts @@ -4,7 +4,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../../../../components/ha-expansion-panel"; @@ -37,9 +37,9 @@ export class HaDeviceActionsZha extends LitElement { } } - protected render(): TemplateResult { + protected render() { if (!this._zhaDevice) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/devices/device-detail/integration-elements/zwave_js/ha-device-info-zwave_js.ts b/src/panels/config/devices/device-detail/integration-elements/zwave_js/ha-device-info-zwave_js.ts index 69cd2b88ec..4beb7f949d 100644 --- a/src/panels/config/devices/device-detail/integration-elements/zwave_js/ha-device-info-zwave_js.ts +++ b/src/panels/config/devices/device-detail/integration-elements/zwave_js/ha-device-info-zwave_js.ts @@ -1,14 +1,14 @@ +import { UnsubscribeFunc } from "home-assistant-js-websocket"; import { css, CSSResultGroup, html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../../../../components/ha-expansion-panel"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; import { ConfigEntry, getConfigEntries, @@ -21,9 +21,9 @@ import { subscribeZwaveNodeStatus, ZWaveJSNodeStatus, } from "../../../../../../data/zwave_js"; +import { SubscribeMixin } from "../../../../../../mixins/subscribe-mixin"; import { haStyle } from "../../../../../../resources/styles"; import { HomeAssistant } from "../../../../../../types"; -import { SubscribeMixin } from "../../../../../../mixins/subscribe-mixin"; @customElement("ha-device-info-zwave_js") export class HaDeviceInfoZWaveJS extends SubscribeMixin(LitElement) { @@ -83,9 +83,9 @@ export class HaDeviceInfoZWaveJS extends SubscribeMixin(LitElement) { this._node = await fetchZwaveNodeStatus(this.hass, this.device.id); } - protected render(): TemplateResult { + protected render() { if (!this._node) { - return html``; + return nothing; } return html` `; } @@ -687,7 +687,7 @@ export class HaConfigEntities extends SubscribeMixin(LitElement) { ` - : html``} + : nothing} `; } diff --git a/src/panels/config/hardware/dialog-hardware-available.ts b/src/panels/config/hardware/dialog-hardware-available.ts index d99a15c723..d60d801b19 100644 --- a/src/panels/config/hardware/dialog-hardware-available.ts +++ b/src/panels/config/hardware/dialog-hardware-available.ts @@ -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 memoizeOne from "memoize-one"; import { fireEvent } from "../../../common/dom/fire_event"; @@ -67,9 +67,9 @@ class DialogHardwareAvailable extends LitElement implements HassDialog { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this._hardware) { - return html``; + return nothing; } const devices = _filterDevices( diff --git a/src/panels/config/helpers/dialog-helper-detail.ts b/src/panels/config/helpers/dialog-helper-detail.ts index 1cab181d17..9d60baf078 100644 --- a/src/panels/config/helpers/dialog-helper-detail.ts +++ b/src/panels/config/helpers/dialog-helper-detail.ts @@ -2,7 +2,14 @@ import "@material/mwc-button/mwc-button"; import { RequestSelectedDetail } from "@material/mwc-list/mwc-list-item-base"; import "@polymer/paper-item/paper-icon-item"; import "@polymer/paper-tooltip/paper-tooltip"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { + css, + CSSResultGroup, + html, + LitElement, + TemplateResult, + nothing, +} from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; @@ -103,9 +110,9 @@ export class DialogHelperDetail extends LitElement { this._params = undefined; } - protected render(): TemplateResult { + protected render() { if (!this._opened) { - return html``; + return nothing; } let content: TemplateResult; diff --git a/src/panels/config/helpers/forms/ha-counter-form.ts b/src/panels/config/helpers/forms/ha-counter-form.ts index dfd594cf0b..58af320e52 100644 --- a/src/panels/config/helpers/forms/ha-counter-form.ts +++ b/src/panels/config/helpers/forms/ha-counter-form.ts @@ -1,10 +1,10 @@ -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-icon-picker"; import "../../../../components/ha-switch"; -import "../../../../components/ha-textfield"; import type { HaSwitch } from "../../../../components/ha-switch"; +import "../../../../components/ha-textfield"; import { Counter } from "../../../../data/counter"; import { haStyle } from "../../../../resources/styles"; import { HomeAssistant } from "../../../../types"; @@ -60,9 +60,9 @@ class HaCounterForm extends LitElement { ); } - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } const nameInvalid = !this._name || this._name.trim() === ""; diff --git a/src/panels/config/helpers/forms/ha-input_boolean-form.ts b/src/panels/config/helpers/forms/ha-input_boolean-form.ts index 991ee256a3..945954ca0e 100644 --- a/src/panels/config/helpers/forms/ha-input_boolean-form.ts +++ b/src/panels/config/helpers/forms/ha-input_boolean-form.ts @@ -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 { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-icon-picker"; @@ -38,9 +38,9 @@ class HaInputBooleanForm extends LitElement { ); } - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } const nameInvalid = !this._name || this._name.trim() === ""; diff --git a/src/panels/config/helpers/forms/ha-input_button-form.ts b/src/panels/config/helpers/forms/ha-input_button-form.ts index c1e9302071..3c78370228 100644 --- a/src/panels/config/helpers/forms/ha-input_button-form.ts +++ b/src/panels/config/helpers/forms/ha-input_button-form.ts @@ -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 { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-icon-picker"; @@ -38,9 +38,9 @@ class HaInputButtonForm extends LitElement { ); } - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } const nameInvalid = !this._name || this._name.trim() === ""; diff --git a/src/panels/config/helpers/forms/ha-input_datetime-form.ts b/src/panels/config/helpers/forms/ha-input_datetime-form.ts index c63f794a95..e427d9405d 100644 --- a/src/panels/config/helpers/forms/ha-input_datetime-form.ts +++ b/src/panels/config/helpers/forms/ha-input_datetime-form.ts @@ -1,11 +1,11 @@ -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-formfield"; import "../../../../components/ha-icon-picker"; import "../../../../components/ha-radio"; -import "../../../../components/ha-textfield"; import type { HaRadio } from "../../../../components/ha-radio"; +import "../../../../components/ha-textfield"; import { InputDateTime } from "../../../../data/input_datetime"; import { haStyle } from "../../../../resources/styles"; import { HomeAssistant } from "../../../../types"; @@ -52,9 +52,9 @@ class HaInputDateTimeForm extends LitElement { ); } - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } const nameInvalid = !this._name || this._name.trim() === ""; diff --git a/src/panels/config/helpers/forms/ha-input_number-form.ts b/src/panels/config/helpers/forms/ha-input_number-form.ts index 9c53a9afbc..ac7b301352 100644 --- a/src/panels/config/helpers/forms/ha-input_number-form.ts +++ b/src/panels/config/helpers/forms/ha-input_number-form.ts @@ -1,14 +1,14 @@ -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-formfield"; import "../../../../components/ha-icon-picker"; +import "../../../../components/ha-radio"; +import type { HaRadio } from "../../../../components/ha-radio"; import "../../../../components/ha-textfield"; import { InputNumber } from "../../../../data/input_number"; import { haStyle } from "../../../../resources/styles"; import { HomeAssistant } from "../../../../types"; -import "../../../../components/ha-formfield"; -import "../../../../components/ha-radio"; -import type { HaRadio } from "../../../../components/ha-radio"; @customElement("ha-input_number-form") class HaInputNumberForm extends LitElement { @@ -67,9 +67,9 @@ class HaInputNumberForm extends LitElement { ); } - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } const nameInvalid = !this._name || this._name.trim() === ""; diff --git a/src/panels/config/helpers/forms/ha-input_select-form.ts b/src/panels/config/helpers/forms/ha-input_select-form.ts index e15e1f0cf4..06c5df0cae 100644 --- a/src/panels/config/helpers/forms/ha-input_select-form.ts +++ b/src/panels/config/helpers/forms/ha-input_select-form.ts @@ -1,7 +1,7 @@ import "@material/mwc-button/mwc-button"; import "@material/mwc-list/mwc-list-item"; import { mdiDelete } 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 } from "../../../../common/dom/fire_event"; import "../../../../components/ha-icon-button"; @@ -50,9 +50,9 @@ class HaInputSelectForm extends LitElement { ); } - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } const nameInvalid = !this._name || this._name.trim() === ""; diff --git a/src/panels/config/helpers/forms/ha-input_text-form.ts b/src/panels/config/helpers/forms/ha-input_text-form.ts index 400f92f012..c978c3f520 100644 --- a/src/panels/config/helpers/forms/ha-input_text-form.ts +++ b/src/panels/config/helpers/forms/ha-input_text-form.ts @@ -1,15 +1,15 @@ -import "../../../../components/ha-form/ha-form"; -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-form/ha-form"; +import "../../../../components/ha-formfield"; import "../../../../components/ha-icon-picker"; -import "../../../../components/ha-textfield"; +import "../../../../components/ha-radio"; import type { HaRadio } from "../../../../components/ha-radio"; +import "../../../../components/ha-textfield"; import { InputText } from "../../../../data/input_text"; import { haStyle } from "../../../../resources/styles"; import { HomeAssistant } from "../../../../types"; -import "../../../../components/ha-formfield"; -import "../../../../components/ha-radio"; @customElement("ha-input_text-form") class HaInputTextForm extends LitElement { @@ -57,9 +57,9 @@ class HaInputTextForm extends LitElement { ); } - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } const nameInvalid = !this._name || this._name.trim() === ""; diff --git a/src/panels/config/helpers/forms/ha-schedule-form.ts b/src/panels/config/helpers/forms/ha-schedule-form.ts index 24a29809df..81d34c6c9a 100644 --- a/src/panels/config/helpers/forms/ha-schedule-form.ts +++ b/src/panels/config/helpers/forms/ha-schedule-form.ts @@ -9,7 +9,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { firstWeekdayIndex } from "../../../../common/datetime/first_weekday"; @@ -137,9 +137,9 @@ class HaScheduleForm extends LitElement { this._resizeObserver.observe(form); } - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } const nameInvalid = !this._name || this._name.trim() === ""; diff --git a/src/panels/config/helpers/forms/ha-timer-form.ts b/src/panels/config/helpers/forms/ha-timer-form.ts index a0b88347ef..a19362f37d 100644 --- a/src/panels/config/helpers/forms/ha-timer-form.ts +++ b/src/panels/config/helpers/forms/ha-timer-form.ts @@ -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 { fireEvent } from "../../../../common/dom/fire_event"; import "../../../../components/ha-icon-picker"; @@ -46,9 +46,9 @@ class HaTimerForm extends LitElement { ); } - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } const nameInvalid = !this._name || this._name.trim() === ""; diff --git a/src/panels/config/integrations/dialog-add-integration.ts b/src/panels/config/integrations/dialog-add-integration.ts index 00f5b8af3d..2fe114e1bf 100644 --- a/src/panels/config/integrations/dialog-add-integration.ts +++ b/src/panels/config/integrations/dialog-add-integration.ts @@ -1,7 +1,14 @@ import "@material/mwc-button"; import "@material/mwc-list/mwc-list"; import Fuse from "fuse.js"; -import { css, html, LitElement, PropertyValues, TemplateResult } from "lit"; +import { + css, + html, + LitElement, + PropertyValues, + TemplateResult, + nothing, +} from "lit"; import { customElement, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import memoizeOne from "memoize-one"; @@ -270,9 +277,9 @@ class AddIntegrationDialog extends LitElement { ); } - protected render(): TemplateResult { + protected render() { if (!this._open) { - return html``; + return nothing; } const integrations = this._integrations ? this._getIntegrations() @@ -428,7 +435,7 @@ class AddIntegrationDialog extends LitElement { private _renderRow = (integration: IntegrationListItem) => { if (!integration) { - return html``; + return nothing; } return html` `; } - protected renderMeta() { + // @ts-expect-error + protected override renderMeta() { if (!this.integration) { - return html``; + return nothing; } return html` ${this.integration.cloud diff --git a/src/panels/config/integrations/integration-panels/matter/dialog-matter-add-device.ts b/src/panels/config/integrations/integration-panels/matter/dialog-matter-add-device.ts index cff6d3bcad..89de69b387 100644 --- a/src/panels/config/integrations/integration-panels/matter/dialog-matter-add-device.ts +++ b/src/panels/config/integrations/integration-panels/matter/dialog-matter-add-device.ts @@ -1,6 +1,6 @@ import "@material/mwc-button/mwc-button"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, html, LitElement, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-circular-progress"; @@ -39,9 +39,9 @@ class DialogMatterAddDevice extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this._open) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/integrations/integration-panels/zha/dialog-zha-manage-zigbee-device.ts b/src/panels/config/integrations/integration-panels/zha/dialog-zha-manage-zigbee-device.ts index 1be029cfe9..a2e7c083b4 100644 --- a/src/panels/config/integrations/integration-panels/zha/dialog-zha-manage-zigbee-device.ts +++ b/src/panels/config/integrations/integration-panels/zha/dialog-zha-manage-zigbee-device.ts @@ -1,18 +1,21 @@ +import "@material/mwc-tab-bar/mwc-tab-bar"; +import "@material/mwc-tab/mwc-tab"; +import { mdiClose } from "@mdi/js"; import { css, CSSResultGroup, html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; -import { mdiClose } from "@mdi/js"; import { customElement, property, state } from "lit/decorators"; import { cache } from "lit/directives/cache"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-code-editor"; import { createCloseHeading } from "../../../../../components/ha-dialog"; +import "../../../../../components/ha-header-bar"; import { fetchBindableDevices, fetchGroups, @@ -22,20 +25,17 @@ import { import { haStyleDialog } from "../../../../../resources/styles"; import { HomeAssistant } from "../../../../../types"; import { sortZHADevices, sortZHAGroups } from "./functions"; -import "./zha-cluster-attributes"; -import "./zha-cluster-commands"; -import "./zha-manage-clusters"; -import "./zha-device-binding"; -import "./zha-group-binding"; -import "./zha-device-neighbors"; -import "./zha-device-signature"; import { Tab, ZHAManageZigbeeDeviceDialogParams, } from "./show-dialog-zha-manage-zigbee-device"; -import "../../../../../components/ha-header-bar"; -import "@material/mwc-tab-bar/mwc-tab-bar"; -import "@material/mwc-tab/mwc-tab"; +import "./zha-cluster-attributes"; +import "./zha-cluster-commands"; +import "./zha-device-binding"; +import "./zha-device-neighbors"; +import "./zha-device-signature"; +import "./zha-group-binding"; +import "./zha-manage-clusters"; @customElement("dialog-zha-manage-zigbee-device") class DialogZHAManageZigbeeDevice extends LitElement { @@ -87,9 +87,9 @@ class DialogZHAManageZigbeeDevice extends LitElement { } } - protected render(): TemplateResult { + protected render() { if (!this._device) { - return html``; + return nothing; } const tabs = this._getTabs(this._device); diff --git a/src/panels/config/integrations/integration-panels/zha/dialog-zha-reconfigure-device.ts b/src/panels/config/integrations/integration-panels/zha/dialog-zha-reconfigure-device.ts index 92d1d5840b..50395ccf1f 100644 --- a/src/panels/config/integrations/integration-panels/zha/dialog-zha-reconfigure-device.ts +++ b/src/panels/config/integrations/integration-panels/zha/dialog-zha-reconfigure-device.ts @@ -1,7 +1,7 @@ import "@material/mwc-button/mwc-button"; import { mdiCheckCircle, mdiCloseCircle } from "@mdi/js"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -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-circular-progress"; @@ -59,9 +59,9 @@ class DialogZHAReconfigureDevice extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this._params) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/integrations/integration-panels/zha/zha-cluster-attributes.ts b/src/panels/config/integrations/integration-panels/zha/zha-cluster-attributes.ts index a0a3695dea..b5b4087940 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-cluster-attributes.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-cluster-attributes.ts @@ -7,13 +7,15 @@ import { LitElement, PropertyValues, TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { stopPropagation } from "../../../../../common/dom/stop_propagation"; import "../../../../../components/buttons/ha-call-service-button"; +import "../../../../../components/buttons/ha-progress-button"; import "../../../../../components/ha-card"; import "../../../../../components/ha-select"; -import "../../../../../components/buttons/ha-progress-button"; +import { forwardHaptic } from "../../../../../data/haptics"; import { Attribute, Cluster, @@ -24,7 +26,6 @@ import { } from "../../../../../data/zha"; import { haStyle } from "../../../../../resources/styles"; import { HomeAssistant } from "../../../../../types"; -import { forwardHaptic } from "../../../../../data/haptics"; import { formatAsPaddedHex } from "./functions"; import { ChangeEvent, @@ -63,9 +64,9 @@ export class ZHAClusterAttributes extends LitElement { super.updated(changedProperties); } - protected render(): TemplateResult { + protected render() { if (!this.device || !this.selectedCluster || !this._attributes) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/integrations/integration-panels/zha/zha-cluster-commands.ts b/src/panels/config/integrations/integration-panels/zha/zha-cluster-commands.ts index 31298a5e0a..1d0de70fae 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-cluster-commands.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-cluster-commands.ts @@ -6,14 +6,14 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { property, state } from "lit/decorators"; import { stopPropagation } from "../../../../../common/dom/stop_propagation"; import "../../../../../components/buttons/ha-call-service-button"; import "../../../../../components/ha-card"; -import "../../../../../components/ha-select"; import "../../../../../components/ha-form/ha-form"; +import "../../../../../components/ha-select"; import { Cluster, Command, @@ -58,9 +58,9 @@ export class ZHAClusterCommands extends LitElement { super.updated(changedProperties); } - protected render(): TemplateResult { + protected render() { if (!this.device || !this.selectedCluster || !this._commands) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/integrations/integration-panels/zha/zha-device-card.ts b/src/panels/config/integrations/integration-panels/zha/zha-device-card.ts index ab15c017d6..7bbc64fa67 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-device-card.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-device-card.ts @@ -1,30 +1,30 @@ import "@polymer/paper-input/paper-input"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; -import memoizeOne from "memoize-one"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; +import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../../common/dom/fire_event"; import { computeStateName } from "../../../../../common/entity/compute_state_name"; +import { stringCompare } from "../../../../../common/string/compare"; +import { slugify } from "../../../../../common/string/slugify"; import "../../../../../components/buttons/ha-call-service-button"; import "../../../../../components/entity/state-badge"; +import "../../../../../components/ha-area-picker"; import "../../../../../components/ha-card"; import "../../../../../components/ha-service-description"; import { updateDeviceRegistryEntry } from "../../../../../data/device_registry"; -import { ZHADevice } from "../../../../../data/zha"; -import { haStyle } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; -import "../../../../../components/ha-area-picker"; -import { showAlertDialog } from "../../../../../dialogs/generic/show-dialog-box"; -import { SubscribeMixin } from "../../../../../mixins/subscribe-mixin"; import { - subscribeEntityRegistry, EntityRegistryEntry, + subscribeEntityRegistry, updateEntityRegistryEntry, } from "../../../../../data/entity_registry"; +import { ZHADevice } from "../../../../../data/zha"; +import { showAlertDialog } from "../../../../../dialogs/generic/show-dialog-box"; +import { SubscribeMixin } from "../../../../../mixins/subscribe-mixin"; +import { haStyle } from "../../../../../resources/styles"; +import { HomeAssistant } from "../../../../../types"; import { EntityRegistryStateEntry } from "../../../devices/ha-config-device-page"; -import { stringCompare } from "../../../../../common/string/compare"; import { getIeeeTail } from "./functions"; -import { slugify } from "../../../../../common/string/slugify"; @customElement("zha-device-card") class ZHADeviceCard extends SubscribeMixin(LitElement) { @@ -64,9 +64,9 @@ class ZHADeviceCard extends SubscribeMixin(LitElement) { ]; } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this.device) { - return html``; + return nothing; } const entities = this._deviceEntities( this.device.device_reg_id, diff --git a/src/panels/config/integrations/integration-panels/zha/zha-device-neighbors.ts b/src/panels/config/integrations/integration-panels/zha/zha-device-neighbors.ts index e292f403f5..31ebd12be9 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-device-neighbors.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-device-neighbors.ts @@ -1,16 +1,16 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; -import memoizeOne from "memoize-one"; +import { html, LitElement, PropertyValues, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; +import memoizeOne from "memoize-one"; import { computeRTLDirection } from "../../../../../common/util/compute_rtl"; -import "../../../../../components/ha-code-editor"; -import { HomeAssistant } from "../../../../../types"; import "../../../../../components/data-table/ha-data-table"; import type { DataTableColumnContainer, DataTableRowData, } from "../../../../../components/data-table/ha-data-table"; import "../../../../../components/ha-circular-progress"; +import "../../../../../components/ha-code-editor"; import { fetchDevices, ZHADevice } from "../../../../../data/zha"; +import { HomeAssistant } from "../../../../../types"; export interface DeviceRowData extends DataTableRowData { id: string; @@ -113,9 +113,9 @@ class ZHADeviceNeighbors extends LitElement { } ); - protected render(): TemplateResult { + protected render() { if (!this.device) { - return html``; + return nothing; } return html` ${!this._devices diff --git a/src/panels/config/integrations/integration-panels/zha/zha-device-pairing-status-card.ts b/src/panels/config/integrations/integration-panels/zha/zha-device-pairing-status-card.ts index ad3ff8c5c3..42768533ce 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-device-pairing-status-card.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-device-pairing-status-card.ts @@ -1,5 +1,5 @@ import "@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 { classMap } from "lit/directives/class-map"; import "../../../../../components/buttons/ha-call-service-button"; @@ -29,9 +29,9 @@ class ZHADevicePairingStatusCard extends LitElement { @state() private _showHelp = false; - protected render(): TemplateResult { + protected render() { if (!this.hass || !this.device) { - return html``; + return nothing; } return html` @@ -66,7 +66,7 @@ class ZHADevicePairingStatusCard extends LitElement { )} ` - : html``} + : nothing}
${INCOMPLETE_PAIRING_STATUSES.includes(this.device.pairing_status!) ? html` @@ -75,7 +75,7 @@ class ZHADevicePairingStatusCard extends LitElement { NWK: ${formatAsPaddedHex(this.device.nwk)}
` - : html``} + : nothing} ${this.device.pairing_status === INITIALIZED ? html` @@ -87,7 +87,7 @@ class ZHADevicePairingStatusCard extends LitElement { .showHelp=${this._showHelp} > ` - : html``} + : nothing}
`; diff --git a/src/panels/config/integrations/integration-panels/zha/zha-device-signature.ts b/src/panels/config/integrations/integration-panels/zha/zha-device-signature.ts index 0ce2b9767a..5d83434184 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-device-signature.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-device-signature.ts @@ -1,4 +1,4 @@ -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import { html, LitElement, PropertyValues, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../../../components/ha-code-editor"; import { ZHADevice } from "../../../../../data/zha"; @@ -28,9 +28,9 @@ class ZHADeviceZigbeeInfo extends LitElement { super.updated(changedProperties); } - protected render(): TemplateResult { + protected render() { if (!this._signature) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/integrations/integration-panels/zha/zha-group-page.ts b/src/panels/config/integrations/integration-panels/zha/zha-group-page.ts index 3eeb04d18b..3a7f951687 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-group-page.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-group-page.ts @@ -1,7 +1,14 @@ import "@material/mwc-button"; import { mdiDelete } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, PropertyValues } from "lit"; -import { customElement, property, state, query } from "lit/decorators"; +import { + css, + CSSResultGroup, + html, + LitElement, + PropertyValues, + nothing, +} from "lit"; +import { customElement, property, query, state } from "lit/decorators"; import { HASSDomEvent } from "../../../../../common/dom/fire_event"; import { navigate } from "../../../../../common/navigate"; import { SelectionChangedEvent } from "../../../../../components/data-table/ha-data-table"; @@ -174,7 +181,7 @@ export class ZHAGroupPage extends LitElement { > ` - : html``} + : nothing}
${this.hass.localize("ui.panel.config.zha.groups.add_members")} diff --git a/src/panels/config/integrations/integration-panels/zha/zha-manage-clusters.ts b/src/panels/config/integrations/integration-panels/zha/zha-manage-clusters.ts index db9aff319b..65512ab1a2 100644 --- a/src/panels/config/integrations/integration-panels/zha/zha-manage-clusters.ts +++ b/src/panels/config/integrations/integration-panels/zha/zha-manage-clusters.ts @@ -1,11 +1,13 @@ import "@material/mwc-list/mwc-list-item"; +import "@material/mwc-tab-bar/mwc-tab-bar"; +import "@material/mwc-tab/mwc-tab"; import { css, CSSResultGroup, html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { cache } from "lit/directives/cache"; @@ -20,8 +22,6 @@ import { import { haStyle } from "../../../../../resources/styles"; import { HomeAssistant } from "../../../../../types"; import { computeClusterKey } from "./functions"; -import "@material/mwc-tab-bar/mwc-tab-bar"; -import "@material/mwc-tab/mwc-tab"; import "./zha-cluster-attributes"; import "./zha-cluster-commands"; @@ -74,9 +74,9 @@ export class ZHAManageClusters extends LitElement { super.updated(changedProperties); } - protected render(): TemplateResult { + protected render() { if (!this.device || !this._clustersLoaded) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-add-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-add-node.ts index 6e645beb1a..392b0049a3 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-add-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-add-node.ts @@ -1,7 +1,7 @@ import "@material/mwc-button/mwc-button"; import { mdiAlertCircle, mdiCheckCircle, mdiQrcodeScan } from "@mdi/js"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import "../../../../../components/ha-alert"; @@ -100,9 +100,9 @@ class DialogZWaveJSAddNode extends LitElement { @query("#pin-input") private _pinInput?: HaTextField; - protected render(): TemplateResult { + protected render() { if (!this._entryId) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-heal-network.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-heal-network.ts index 3cf31dc360..db11625195 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-heal-network.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-heal-network.ts @@ -1,8 +1,8 @@ import "@material/mwc-button/mwc-button"; import "@material/mwc-linear-progress/mwc-linear-progress"; -import { mdiStethoscope, mdiCheckCircle, mdiCloseCircle } from "@mdi/js"; +import { mdiCheckCircle, mdiCloseCircle, mdiStethoscope } from "@mdi/js"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -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 { createCloseHeading } from "../../../../../components/ha-dialog"; @@ -50,9 +50,9 @@ class DialogZWaveJSHealNetwork extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this.entry_id) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-heal-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-heal-node.ts index f880f5c20f..776f316f44 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-heal-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-heal-node.ts @@ -1,13 +1,13 @@ -import "../../../../../components/ha-circular-progress"; import "@material/mwc-button/mwc-button"; -import { mdiStethoscope, mdiCheckCircle, mdiCloseCircle } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { mdiCheckCircle, mdiCloseCircle, mdiStethoscope } from "@mdi/js"; +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-circular-progress"; import { createCloseHeading } from "../../../../../components/ha-dialog"; import { - DeviceRegistryEntry, computeDeviceName, + DeviceRegistryEntry, } from "../../../../../data/device_registry"; import { fetchZwaveNetworkStatus, @@ -41,9 +41,9 @@ class DialogZWaveJSHealNode extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this.device) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-node-statistics.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-node-statistics.ts index b68eb367c0..ed32965b98 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-node-statistics.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-node-statistics.ts @@ -1,29 +1,36 @@ -import { UnsubscribeFunc } from "home-assistant-js-websocket"; import "@material/mwc-list/mwc-list"; import "@material/mwc-list/mwc-list-item"; +import { mdiSwapHorizontal } from "@mdi/js"; +import { UnsubscribeFunc } from "home-assistant-js-websocket"; +import { + css, + CSSResultGroup, + html, + LitElement, + TemplateResult, + nothing, +} from "lit"; +import { customElement, property, state } from "lit/decorators"; +import { fireEvent } from "../../../../../common/dom/fire_event"; +import { createCloseHeading } from "../../../../../components/ha-dialog"; import "../../../../../components/ha-expansion-panel"; import "../../../../../components/ha-help-tooltip"; import "../../../../../components/ha-svg-icon"; -import { mdiSwapHorizontal } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; -import { customElement, property, state } from "lit/decorators"; -import { fireEvent } from "../../../../../common/dom/fire_event"; import { - DeviceRegistryEntry, computeDeviceName, + DeviceRegistryEntry, subscribeDeviceRegistry, } from "../../../../../data/device_registry"; import { - subscribeZwaveNodeStatistics, ProtocolDataRate, + RssiError, + subscribeZwaveNodeStatistics, ZWaveJSNodeStatisticsUpdatedMessage, ZWaveJSRouteStatistics, - RssiError, } from "../../../../../data/zwave_js"; import { haStyleDialog } from "../../../../../resources/styles"; import { HomeAssistant } from "../../../../../types"; import { ZWaveJSNodeStatisticsDialogParams } from "./show-dialog-zwave_js-node-statistics"; -import { createCloseHeading } from "../../../../../components/ha-dialog"; type WorkingRouteStatistics = | (ZWaveJSRouteStatistics & { @@ -69,9 +76,9 @@ class DialogZWaveJSNodeStatistics extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this.device) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-reinterview-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-reinterview-node.ts index 0c3eda988d..a973ac05c4 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-reinterview-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-reinterview-node.ts @@ -1,7 +1,7 @@ import "@material/mwc-button/mwc-button"; import { mdiCheckCircle, mdiCloseCircle } from "@mdi/js"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -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-circular-progress"; @@ -30,9 +30,9 @@ class DialogZWaveJSReinterviewNode extends LitElement { this.device_id = params.device_id; } - protected render(): TemplateResult { + protected render() { if (!this.device_id) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-failed-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-failed-node.ts index f328c97088..a7a0494e47 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-failed-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-failed-node.ts @@ -1,7 +1,7 @@ import "@material/mwc-button/mwc-button"; import { mdiCheckCircle, mdiCloseCircle, mdiRobotDead } from "@mdi/js"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, 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-circular-progress"; @@ -52,9 +52,9 @@ class DialogZWaveJSRemoveFailedNode extends LitElement { this.closeDialog(); } - protected render(): TemplateResult { + protected render() { if (!this.device_id) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-node.ts index bad6ef4597..8db12606c4 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-remove-node.ts @@ -1,6 +1,6 @@ import "@material/mwc-button/mwc-button"; import { mdiCheckCircle, mdiCloseCircle } 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-circular-progress"; @@ -40,9 +40,9 @@ class DialogZWaveJSRemoveNode extends LitElement { this.entry_id = params.entry_id; } - protected render(): TemplateResult { + protected render() { if (!this.entry_id) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-update-firmware-node.ts b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-update-firmware-node.ts index e6d5859efa..68d0ff8235 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-update-firmware-node.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/dialog-zwave_js-update-firmware-node.ts @@ -1,17 +1,18 @@ -import "../../../../../components/ha-file-upload"; -import "../../../../../components/ha-form/ha-form"; -import "../../../../../components/ha-svg-icon"; import "@material/mwc-button/mwc-button"; import "@material/mwc-linear-progress/mwc-linear-progress"; import { mdiCheckCircle, mdiCloseCircle, mdiFileUpload } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; -import { customElement, property, state } from "lit/decorators"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; +import { customElement, property, state } from "lit/decorators"; import { fireEvent } from "../../../../../common/dom/fire_event"; import { createCloseHeading } from "../../../../../components/ha-dialog"; +import "../../../../../components/ha-file-upload"; +import "../../../../../components/ha-form/ha-form"; +import { HaFormSchema } from "../../../../../components/ha-form/types"; +import "../../../../../components/ha-svg-icon"; import { - DeviceRegistryEntry, computeDeviceName, + DeviceRegistryEntry, } from "../../../../../data/device_registry"; import { abortZwaveNodeFirmwareUpdate, @@ -20,23 +21,22 @@ import { fetchZwaveNodeStatus, NodeFirmwareUpdateStatus, NodeStatus, - subscribeZwaveNodeStatus, subscribeZwaveNodeFirmwareUpdate, + subscribeZwaveNodeStatus, uploadFirmwareAndBeginUpdate, - ZWaveJSNodeFirmwareUpdateFinishedMessage, - ZWaveJSFirmwareUpdateProgressMessage, - ZWaveJSNodeStatusUpdatedMessage, - ZWaveJSNodeStatus, ZWaveJSControllerFirmwareUpdateFinishedMessage, + ZWaveJSFirmwareUpdateProgressMessage, + ZWaveJSNodeFirmwareUpdateFinishedMessage, + ZWaveJSNodeStatus, + ZWaveJSNodeStatusUpdatedMessage, } from "../../../../../data/zwave_js"; -import { haStyleDialog } from "../../../../../resources/styles"; -import { HomeAssistant } from "../../../../../types"; -import { ZWaveJSUpdateFirmwareNodeDialogParams } from "./show-dialog-zwave_js-update-firmware-node"; import { showAlertDialog, showConfirmationDialog, } from "../../../../../dialogs/generic/show-dialog-box"; -import { HaFormSchema } from "../../../../../components/ha-form/types"; +import { haStyleDialog } from "../../../../../resources/styles"; +import { HomeAssistant } from "../../../../../types"; +import { ZWaveJSUpdateFirmwareNodeDialogParams } from "./show-dialog-zwave_js-update-firmware-node"; const firmwareTargetSchema: HaFormSchema[] = [ { @@ -97,13 +97,13 @@ class DialogZWaveJSUpdateFirmwareNode extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if ( !this.device || !this._nodeStatus || this._updateInProgress === undefined ) { - return html``; + return nothing; } const beginFirmwareUpdateHTML = html` ${this._nodeStatus.is_controller_node - ? html`` + ? nothing : html`

${this.hass.localize( "ui.panel.config.zwave_js.update_firmware.firmware_target_intro" @@ -150,7 +150,7 @@ class DialogZWaveJSUpdateFirmwareNode extends LitElement { : ""; const abortFirmwareUpdateButton = this._nodeStatus.is_controller_node - ? html`` + ? nothing : html` ${this.hass.localize( diff --git a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-config-dashboard.ts b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-config-dashboard.ts index 2668262a98..5fedec41f8 100644 --- a/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-config-dashboard.ts +++ b/src/panels/config/integrations/integration-panels/zwave_js/zwave_js-config-dashboard.ts @@ -7,17 +7,30 @@ import { mdiPlus, mdiRefresh, } from "@mdi/js"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { UnsubscribeFunc } from "home-assistant-js-websocket"; +import { + css, + CSSResultGroup, + html, + LitElement, + TemplateResult, + nothing, +} from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; +import { computeRTL } from "../../../../../common/util/compute_rtl"; import "../../../../../components/ha-card"; -import "../../../../../components/ha-icon-button"; import "../../../../../components/ha-expansion-panel"; import "../../../../../components/ha-fab"; import "../../../../../components/ha-help-tooltip"; +import "../../../../../components/ha-icon-button"; import "../../../../../components/ha-icon-next"; import "../../../../../components/ha-svg-icon"; -import { UnsubscribeFunc } from "home-assistant-js-websocket"; +import { + ConfigEntry, + ERROR_STATES, + getConfigEntries, +} from "../../../../../data/config_entries"; import { fetchZwaveDataCollectionStatus, fetchZwaveNetworkStatus, @@ -32,12 +45,9 @@ import { ZWaveJSNetwork, ZwaveJSProvisioningEntry, } from "../../../../../data/zwave_js"; -import { - ConfigEntry, - getConfigEntries, - ERROR_STATES, -} from "../../../../../data/config_entries"; +import { showOptionsFlowDialog } from "../../../../../dialogs/config-flow/show-dialog-options-flow"; import "../../../../../layouts/hass-tabs-subpage"; +import { SubscribeMixin } from "../../../../../mixins/subscribe-mixin"; import { haStyle } from "../../../../../resources/styles"; import type { HomeAssistant, Route } from "../../../../../types"; import "../../../ha-config-section"; @@ -45,9 +55,6 @@ import { showZWaveJSAddNodeDialog } from "./show-dialog-zwave_js-add-node"; import { showZWaveJSHealNetworkDialog } from "./show-dialog-zwave_js-heal-network"; import { showZWaveJSRemoveNodeDialog } from "./show-dialog-zwave_js-remove-node"; import { configTabs } from "./zwave_js-config-router"; -import { showOptionsFlowDialog } from "../../../../../dialogs/config-flow/show-dialog-options-flow"; -import { computeRTL } from "../../../../../common/util/compute_rtl"; -import { SubscribeMixin } from "../../../../../mixins/subscribe-mixin"; @customElement("zwave_js-config-dashboard") class ZWaveJSConfigDashboard extends SubscribeMixin(LitElement) { @@ -97,9 +104,9 @@ class ZWaveJSConfigDashboard extends SubscribeMixin(LitElement) { ]; } - protected render(): TemplateResult { + protected render() { if (!this._configEntry) { - return html``; + return nothing; } if (ERROR_STATES.includes(this._configEntry.state)) { diff --git a/src/panels/config/logs/dialog-system-log-detail.ts b/src/panels/config/logs/dialog-system-log-detail.ts index 86920b3877..cb7a3365b9 100644 --- a/src/panels/config/logs/dialog-system-log-detail.ts +++ b/src/panels/config/logs/dialog-system-log-detail.ts @@ -1,6 +1,6 @@ import { mdiClose, mdiContentCopy } from "@mdi/js"; import "@polymer/paper-tooltip/paper-tooltip"; -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 { copyToClipboard } from "../../../common/util/copy-clipboard"; @@ -55,9 +55,9 @@ class DialogSystemLogDetail extends LitElement { } } - protected render(): TemplateResult { + protected render() { if (!this._params) { - return html``; + return nothing; } const item = this._params.item; @@ -159,7 +159,7 @@ class DialogSystemLogDetail extends LitElement { ` : item.message[0]} - ${item.exception ? html`

${item.exception}
` : html``} + ${item.exception ? html`
${item.exception}
` : nothing}
`; diff --git a/src/panels/config/logs/system-log-card.ts b/src/panels/config/logs/system-log-card.ts index 1a0843c0ce..beec07abaf 100644 --- a/src/panels/config/logs/system-log-card.ts +++ b/src/panels/config/logs/system-log-card.ts @@ -1,7 +1,7 @@ import { mdiRefresh } from "@mdi/js"; import "@polymer/paper-item/paper-item"; import "@polymer/paper-item/paper-item-body"; -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 "../../../components/buttons/ha-call-service-button"; @@ -69,7 +69,7 @@ export class SystemLogCard extends LitElement { }) ); - protected render(): TemplateResult { + protected render() { const filteredItems = this._items ? this._getFilteredItems(this._items, this.filter.toLowerCase()) : []; @@ -134,7 +134,7 @@ export class SystemLogCard extends LitElement { : item.source[0]} ${item.count > 1 ? html` - ${this._multipleMessages(item)} ` - : html``} + : nothing} diff --git a/src/panels/config/lovelace/dashboards/dialog-lovelace-dashboard-detail.ts b/src/panels/config/lovelace/dashboards/dialog-lovelace-dashboard-detail.ts index fdf95e6351..1c5ccb8c7b 100644 --- a/src/panels/config/lovelace/dashboards/dialog-lovelace-dashboard-detail.ts +++ b/src/panels/config/lovelace/dashboards/dialog-lovelace-dashboard-detail.ts @@ -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 memoizeOne from "memoize-one"; import { fireEvent } from "../../../../common/dom/fire_event"; @@ -55,9 +55,9 @@ export class DialogLovelaceDashboardDetail extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this._params || !this._data) { - return html``; + return nothing; } const defaultPanelUrlPath = this.hass.defaultPanel; const titleInvalid = !this._data.title || !this._data.title.trim(); diff --git a/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts b/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts index b4d53ec211..90dac9127e 100644 --- a/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts +++ b/src/panels/config/lovelace/dashboards/ha-config-lovelace-dashboards.ts @@ -6,7 +6,7 @@ import { mdiPlus, } from "@mdi/js"; import "@polymer/paper-tooltip/paper-tooltip"; -import { html, LitElement, PropertyValues, TemplateResult } from "lit"; +import { html, LitElement, nothing, PropertyValues } from "lit"; import { customElement, property, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import memoize from "memoize-one"; @@ -72,7 +72,7 @@ export class HaConfigLovelaceDashboards extends LitElement { )} > ` - : html``, + : nothing, }, title: { title: this.hass.localize( @@ -242,7 +242,7 @@ export class HaConfigLovelaceDashboards extends LitElement { return result; }); - protected render(): TemplateResult { + protected render() { if (!this.hass || this._dashboards === undefined) { return html` `; } diff --git a/src/panels/config/lovelace/resources/dialog-lovelace-resource-detail.ts b/src/panels/config/lovelace/resources/dialog-lovelace-resource-detail.ts index ae19bcb0de..ee6bfb577d 100644 --- a/src/panels/config/lovelace/resources/dialog-lovelace-resource-detail.ts +++ b/src/panels/config/lovelace/resources/dialog-lovelace-resource-detail.ts @@ -1,5 +1,5 @@ import "@material/mwc-button/mwc-button"; -import { CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../common/dom/fire_event"; @@ -60,9 +60,9 @@ export class DialogLovelaceResourceDetail extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this._params) { - return html``; + return nothing; } const urlInvalid = !this._data?.url || this._data.url.trim() === ""; return html` @@ -114,7 +114,7 @@ export class DialogLovelaceResourceDetail extends LitElement { )} ` - : html``} + : nothing} ` : ""} ` - : html``} + : nothing} ; - protected render(): TemplateResult { + protected render() { if ( !this.hass || this._storageItems === undefined || @@ -113,7 +113,7 @@ class HaConfigPerson extends LitElement { > ` - : html``} + : nothing}
${this._configItems.length > 0 ? html` diff --git a/src/panels/config/repairs/dialog-integration-startup.ts b/src/panels/config/repairs/dialog-integration-startup.ts index edc9c96aa6..f9a78d2806 100644 --- a/src/panels/config/repairs/dialog-integration-startup.ts +++ b/src/panels/config/repairs/dialog-integration-startup.ts @@ -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 "../../../components/ha-card"; @@ -23,9 +23,9 @@ class DialogIntegrationStartup extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this._opened) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/repairs/dialog-repairs-issue.ts b/src/panels/config/repairs/dialog-repairs-issue.ts index 00daaa9393..fe6bc4b4f5 100644 --- a/src/panels/config/repairs/dialog-repairs-issue.ts +++ b/src/panels/config/repairs/dialog-repairs-issue.ts @@ -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 { formatDateNumeric } from "../../../common/datetime/format_date"; import { fireEvent } from "../../../common/dom/fire_event"; @@ -33,9 +33,9 @@ class DialogRepairsIssue extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this._issue) { - return html``; + return nothing; } const learnMoreUrlIsHomeAssistant = diff --git a/src/panels/config/repairs/dialog-system-information.ts b/src/panels/config/repairs/dialog-system-information.ts index b62ec9f410..ce2bfefd5a 100644 --- a/src/panels/config/repairs/dialog-system-information.ts +++ b/src/panels/config/repairs/dialog-system-information.ts @@ -1,6 +1,13 @@ import "@material/mwc-button/mwc-button"; import { UnsubscribeFunc } 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 { isComponentLoaded } from "../../../common/config/is_component_loaded"; import { formatDateTime } from "../../../common/datetime/format_date_time"; @@ -9,6 +16,7 @@ import { copyToClipboard } from "../../../common/util/copy-clipboard"; import { subscribePollingCollection } from "../../../common/util/subscribe-polling"; import "../../../components/ha-alert"; import "../../../components/ha-card"; +import "../../../components/ha-circular-progress"; import { createCloseHeading } from "../../../components/ha-dialog"; import "../../../components/ha-metric"; import { fetchHassioStats, HassioStats } from "../../../data/hassio/common"; @@ -27,7 +35,6 @@ import { haStyleDialog } from "../../../resources/styles"; import type { HomeAssistant } from "../../../types"; import { documentationUrl } from "../../../util/documentation-url"; import { showToast } from "../../../util/toast"; -import "../../../components/ha-circular-progress"; const sortKeys = (a: string, b: string) => { if (a === "homeassistant") { @@ -128,9 +135,9 @@ class DialogSystemInformation extends LitElement { this._supervisorStats = undefined; } - protected render(): TemplateResult { + protected render() { if (!this._opened) { - return html``; + return nothing; } const sections = this._getSections(); diff --git a/src/panels/config/repairs/ha-config-repairs.ts b/src/panels/config/repairs/ha-config-repairs.ts index e24a5f1dfd..7265f2f837 100644 --- a/src/panels/config/repairs/ha-config-repairs.ts +++ b/src/panels/config/repairs/ha-config-repairs.ts @@ -1,5 +1,5 @@ import "@material/mwc-list/mwc-list"; -import { css, html, LitElement, TemplateResult } from "lit"; +import { css, html, LitElement, nothing } from "lit"; import { customElement, property } from "lit/decorators"; import { relativeTime } from "../../../common/datetime/relative_time"; import { capitalizeFirstLetter } from "../../../common/string/capitalize-first-letter"; @@ -27,9 +27,9 @@ class HaConfigRepairs extends LitElement { @property({ type: Number }) public total?: number; - protected render(): TemplateResult { + protected render() { if (!this.repairsIssues?.length) { - return html``; + return nothing; } const issues = this.repairsIssues; diff --git a/src/panels/config/repairs/integrations-startup-time.ts b/src/panels/config/repairs/integrations-startup-time.ts index 411d05792d..ddb7a4c89e 100644 --- a/src/panels/config/repairs/integrations-startup-time.ts +++ b/src/panels/config/repairs/integrations-startup-time.ts @@ -5,7 +5,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../components/ha-card"; @@ -39,9 +39,9 @@ class IntegrationsStartupTime extends LitElement { this._fetchSetups(); } - protected render(): TemplateResult { + protected render() { if (!this._setups) { - return html``; + return nothing; } return html` diff --git a/src/panels/config/scene/ha-scene-editor.ts b/src/panels/config/scene/ha-scene-editor.ts index 14166fe293..d09ddb57d2 100644 --- a/src/panels/config/scene/ha-scene-editor.ts +++ b/src/panels/config/scene/ha-scene-editor.ts @@ -16,7 +16,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -206,9 +206,9 @@ export class HaSceneEditor extends SubscribeMixin( ]; } - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } const { devices, entities } = this._getEntitiesDevices( this._entities, @@ -342,7 +342,7 @@ export class HaSceneEditor extends SubscribeMixin( ${device.entities.map((entityId) => { const entityStateObj = this.hass.states[entityId]; if (!entityStateObj) { - return html``; + return nothing; } return html` ` - : html``} + : nothing}
diff --git a/src/panels/config/users/dialog-add-user.ts b/src/panels/config/users/dialog-add-user.ts index 70761bbdd7..d1e4ded2fa 100644 --- a/src/panels/config/users/dialog-add-user.ts +++ b/src/panels/config/users/dialog-add-user.ts @@ -6,7 +6,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { computeRTLDirection } from "../../../common/util/compute_rtl"; @@ -80,9 +80,9 @@ export class DialogAddUser extends LitElement { }); } - protected render(): TemplateResult { + protected render() { if (!this._params) { - return html``; + return nothing; } return html` ` - : html``} + : nothing} ` - : html``} + : nothing}
`; diff --git a/src/panels/logbook/ha-logbook-renderer.ts b/src/panels/logbook/ha-logbook-renderer.ts index 6877567895..aa6a64e5f2 100644 --- a/src/panels/logbook/ha-logbook-renderer.ts +++ b/src/panels/logbook/ha-logbook-renderer.ts @@ -5,8 +5,8 @@ import { CSSResultGroup, html, LitElement, + nothing, PropertyValues, - TemplateResult, } from "lit"; import { customElement, eventOptions, property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -95,7 +95,7 @@ class HaLogbookRenderer extends LitElement { ); } - protected render(): TemplateResult { + protected render() { if (!this.entries?.length) { return html`
@@ -129,12 +129,9 @@ class HaLogbookRenderer extends LitElement { `; } - private _renderLogbookItem = ( - item: LogbookEntry, - index: number - ): TemplateResult => { + private _renderLogbookItem = (item: LogbookEntry, index: number) => { if (!item || index === undefined) { - return html``; + return nothing; } const previous = this.entries[index - 1] as LogbookEntry | undefined; const seenEntityIds: string[] = []; @@ -188,7 +185,7 @@ class HaLogbookRenderer extends LitElement { ${formatDate(new Date(item.when * 1000), this.hass.locale)} ` - : html``} + : nothing}
diff --git a/src/panels/logbook/ha-logbook.ts b/src/panels/logbook/ha-logbook.ts index bfeaf28c67..6d6107f1c1 100644 --- a/src/panels/logbook/ha-logbook.ts +++ b/src/panels/logbook/ha-logbook.ts @@ -1,7 +1,7 @@ -import { css, html, LitElement, PropertyValues, TemplateResult } from "lit"; +import { css, html, LitElement, PropertyValues, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { isComponentLoaded } from "../../common/config/is_component_loaded"; import { ensureArray } from "../../common/array/ensure-array"; +import { isComponentLoaded } from "../../common/config/is_component_loaded"; import { computeStateDomain } from "../../common/entity/compute_state_domain"; import { throttle } from "../../common/util/throttle"; import "../../components/ha-circular-progress"; @@ -92,9 +92,9 @@ export class HaLogbook extends LitElement { 1000 ); - protected render(): TemplateResult { + protected render() { if (!isComponentLoaded(this.hass, "logbook")) { - return html``; + return nothing; } if (this._error) { diff --git a/src/panels/lovelace/badges/hui-error-badge.ts b/src/panels/lovelace/badges/hui-error-badge.ts index 375cac75ab..aa02366f26 100644 --- a/src/panels/lovelace/badges/hui-error-badge.ts +++ b/src/panels/lovelace/badges/hui-error-badge.ts @@ -1,5 +1,5 @@ import { mdiAlert } 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 "../../../components/ha-label-badge"; import "../../../components/ha-svg-icon"; @@ -28,9 +28,9 @@ export class HuiErrorBadge extends LitElement implements LovelaceBadge { this._config = config; } - protected render(): TemplateResult { + protected render() { if (!this._config) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/badges/hui-state-label-badge.ts b/src/panels/lovelace/badges/hui-state-label-badge.ts index 9ccceba1e8..4d917d5dbd 100644 --- a/src/panels/lovelace/badges/hui-state-label-badge.ts +++ b/src/panels/lovelace/badges/hui-state-label-badge.ts @@ -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 { ifDefined } from "lit/directives/if-defined"; import "../../../components/entity/ha-state-label-badge"; @@ -20,9 +20,9 @@ export class HuiStateLabelBadge extends LitElement implements LovelaceBadge { this._config = config; } - protected render(): TemplateResult { + protected render() { if (!this._config || !this.hass) { - return html``; + return nothing; } const stateObj = this.hass.states[this._config.entity!]; diff --git a/src/panels/lovelace/cards/energy/hui-energy-carbon-consumed-gauge-card.ts b/src/panels/lovelace/cards/energy/hui-energy-carbon-consumed-gauge-card.ts index 9c266c54ad..97541d5cc5 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-carbon-consumed-gauge-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-carbon-consumed-gauge-card.ts @@ -1,7 +1,7 @@ import { mdiInformation } from "@mdi/js"; import "@polymer/paper-tooltip"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import { round } from "../../../../common/number/round"; @@ -52,9 +52,9 @@ class HuiEnergyCarbonGaugeCard ]; } - protected render(): TemplateResult { + protected render() { if (!this._config || !this.hass) { - return html``; + return nothing; } if (!this._data) { @@ -64,7 +64,7 @@ class HuiEnergyCarbonGaugeCard } if (!this._data.co2SignalEntity) { - return html``; + return nothing; } const co2State = this.hass.states[this._data.co2SignalEntity]; diff --git a/src/panels/lovelace/cards/energy/hui-energy-compare-card.ts b/src/panels/lovelace/cards/energy/hui-energy-compare-card.ts index 46f0a317e0..552680e2e9 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-compare-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-compare-card.ts @@ -1,6 +1,6 @@ import { differenceInDays, endOfDay } from "date-fns"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { formatDate } from "../../../../common/datetime/format_date"; import { EnergyData, getEnergyDataCollection } from "../../../../data/energy"; @@ -46,9 +46,9 @@ export class HuiEnergyCompareCard ]; } - protected render(): TemplateResult { + protected render() { if (!this._startCompare || !this._endCompare) { - return html``; + return nothing; } const dayDifference = differenceInDays( diff --git a/src/panels/lovelace/cards/energy/hui-energy-date-selection-card.ts b/src/panels/lovelace/cards/energy/hui-energy-date-selection-card.ts index d064e44d18..251cf30506 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-date-selection-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-date-selection-card.ts @@ -1,9 +1,9 @@ -import { html, LitElement, TemplateResult } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { HomeAssistant } from "../../../../types"; +import "../../components/hui-energy-period-selector"; import { LovelaceCard } from "../../types"; import { EnergyCardBaseConfig } from "../types"; -import "../../components/hui-energy-period-selector"; @customElement("hui-energy-date-selection-card") export class HuiEnergyDateSelectionCard @@ -22,9 +22,9 @@ export class HuiEnergyDateSelectionCard this._config = config; } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/energy/hui-energy-devices-graph-card.ts b/src/panels/lovelace/cards/energy/hui-energy-devices-graph-card.ts index 5c5e93673a..5f4b012869 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-devices-graph-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-devices-graph-card.ts @@ -8,7 +8,7 @@ import { import { getRelativePosition } from "chart.js/helpers"; import { addHours, differenceInDays } from "date-fns/esm"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -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 memoizeOne from "memoize-one"; @@ -71,9 +71,9 @@ export class HuiEnergyDevicesGraphCard this._config = config; } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/energy/hui-energy-distribution-card.ts b/src/panels/lovelace/cards/energy/hui-energy-distribution-card.ts index b57b718d59..378f6e7a5f 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-distribution-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-distribution-card.ts @@ -13,7 +13,7 @@ import { mdiWater, } from "@mdi/js"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, html, LitElement, svg } from "lit"; +import { css, html, LitElement, svg, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { formatNumber } from "../../../../common/number/format_number"; @@ -67,7 +67,7 @@ class HuiEnergyDistrubutionCard protected render() { if (!this._config) { - return html``; + return nothing; } if (!this._data) { diff --git a/src/panels/lovelace/cards/energy/hui-energy-gas-graph-card.ts b/src/panels/lovelace/cards/energy/hui-energy-gas-graph-card.ts index 266531a00f..3dd3e0ca3d 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-gas-graph-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-gas-graph-card.ts @@ -13,7 +13,7 @@ import { startOfToday, } from "date-fns"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; @@ -39,9 +39,9 @@ import { getEnergyGasUnit, } from "../../../../data/energy"; import { + getStatisticLabel, Statistics, StatisticsMetaData, - getStatisticLabel, } from "../../../../data/recorder"; import { FrontendLocaleData } from "../../../../data/translation"; import { SubscribeMixin } from "../../../../mixins/subscribe-mixin"; @@ -90,9 +90,9 @@ export class HuiEnergyGasGraphCard this._config = config; } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/energy/hui-energy-grid-neutrality-gauge-card.ts b/src/panels/lovelace/cards/energy/hui-energy-grid-neutrality-gauge-card.ts index 1b3897b7d1..73efe19f4a 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-grid-neutrality-gauge-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-grid-neutrality-gauge-card.ts @@ -1,13 +1,13 @@ import { mdiInformation } from "@mdi/js"; import "@polymer/paper-tooltip"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { formatNumber } from "../../../../common/number/format_number"; import "../../../../components/ha-card"; -import "../../../../components/ha-svg-icon"; import "../../../../components/ha-gauge"; import type { LevelDefinition } from "../../../../components/ha-gauge"; +import "../../../../components/ha-svg-icon"; import { EnergyData, getEnergyDataCollection, @@ -55,9 +55,9 @@ class HuiEnergyGridGaugeCard this._config = config; } - protected render(): TemplateResult { + protected render() { if (!this._config || !this.hass) { - return html``; + return nothing; } if (!this._data) { @@ -74,7 +74,7 @@ class HuiEnergyGridGaugeCard let value: number | undefined; if (!gridSource) { - return html``; + return nothing; } const consumedFromGrid = calculateStatisticsSumGrowth( diff --git a/src/panels/lovelace/cards/energy/hui-energy-solar-consumed-gauge-card.ts b/src/panels/lovelace/cards/energy/hui-energy-solar-consumed-gauge-card.ts index fd5de64399..b027d92b49 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-solar-consumed-gauge-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-solar-consumed-gauge-card.ts @@ -1,7 +1,7 @@ import { mdiInformation } from "@mdi/js"; import "@polymer/paper-tooltip"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import "../../../../components/ha-card"; @@ -50,9 +50,9 @@ class HuiEnergySolarGaugeCard this._config = config; } - protected render(): TemplateResult { + protected render() { if (!this._config || !this.hass) { - return html``; + return nothing; } if (!this._data) { @@ -65,7 +65,7 @@ class HuiEnergySolarGaugeCard const types = energySourcesByType(prefs); if (!types.solar) { - return html``; + return nothing; } const totalSolarProduction = calculateStatisticsSumGrowth( diff --git a/src/panels/lovelace/cards/energy/hui-energy-solar-graph-card.ts b/src/panels/lovelace/cards/energy/hui-energy-solar-graph-card.ts index 672989c0d0..6d00ed3209 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-solar-graph-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-solar-graph-card.ts @@ -13,7 +13,7 @@ import { startOfToday, } from "date-fns/esm"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; @@ -40,9 +40,9 @@ import { SolarSourceTypeEnergyPreference, } from "../../../../data/energy"; import { + getStatisticLabel, Statistics, StatisticsMetaData, - getStatisticLabel, } from "../../../../data/recorder"; import { FrontendLocaleData } from "../../../../data/translation"; import { SubscribeMixin } from "../../../../mixins/subscribe-mixin"; @@ -89,9 +89,9 @@ export class HuiEnergySolarGraphCard this._config = config; } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/energy/hui-energy-sources-table-card.ts b/src/panels/lovelace/cards/energy/hui-energy-sources-table-card.ts index 9a05d71990..a6570a4485 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-sources-table-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-sources-table-card.ts @@ -1,21 +1,14 @@ // @ts-ignore import dataTableStyles from "@material/data-table/dist/mdc.data-table.min.css"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { - css, - CSSResultGroup, - html, - LitElement, - TemplateResult, - unsafeCSS, -} from "lit"; +import { css, CSSResultGroup, html, LitElement, unsafeCSS, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { styleMap } from "lit/directives/style-map"; import { - rgb2hex, - lab2rgb, - rgb2lab, hex2rgb, + lab2rgb, + rgb2hex, + rgb2lab, } from "../../../../common/color/convert-color"; import { labBrighten, labDarken } from "../../../../common/color/lab"; import { formatNumber } from "../../../../common/number/format_number"; @@ -67,9 +60,9 @@ export class HuiEnergySourcesTableCard this._config = config; } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } if (!this._data) { diff --git a/src/panels/lovelace/cards/energy/hui-energy-usage-graph-card.ts b/src/panels/lovelace/cards/energy/hui-energy-usage-graph-card.ts index ebe5be75a3..e65a621b15 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-usage-graph-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-usage-graph-card.ts @@ -13,7 +13,7 @@ import { startOfToday, } from "date-fns/esm"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; @@ -34,9 +34,9 @@ import "../../../../components/chart/ha-chart-base"; import "../../../../components/ha-card"; import { EnergyData, getEnergyDataCollection } from "../../../../data/energy"; import { + getStatisticLabel, Statistics, StatisticsMetaData, - getStatisticLabel, } from "../../../../data/recorder"; import { FrontendLocaleData } from "../../../../data/translation"; import { SubscribeMixin } from "../../../../mixins/subscribe-mixin"; @@ -83,9 +83,9 @@ export class HuiEnergyUsageGraphCard this._config = config; } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/energy/hui-energy-water-graph-card.ts b/src/panels/lovelace/cards/energy/hui-energy-water-graph-card.ts index 38d20d3d29..e5b751cbf9 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-water-graph-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-water-graph-card.ts @@ -13,7 +13,7 @@ import { startOfToday, } from "date-fns"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import memoizeOne from "memoize-one"; @@ -34,14 +34,14 @@ import "../../../../components/chart/ha-chart-base"; import "../../../../components/ha-card"; import { EnergyData, - WaterSourceTypeEnergyPreference, getEnergyDataCollection, getEnergyWaterUnit, + WaterSourceTypeEnergyPreference, } from "../../../../data/energy"; import { + getStatisticLabel, Statistics, StatisticsMetaData, - getStatisticLabel, } from "../../../../data/recorder"; import { FrontendLocaleData } from "../../../../data/translation"; import { SubscribeMixin } from "../../../../mixins/subscribe-mixin"; @@ -90,9 +90,9 @@ export class HuiEnergyWaterGraphCard this._config = config; } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/hui-alarm-panel-card.ts b/src/panels/lovelace/cards/hui-alarm-panel-card.ts index 1f2d2bb6c5..165fb8ed8a 100644 --- a/src/panels/lovelace/cards/hui-alarm-panel-card.ts +++ b/src/panels/lovelace/cards/hui-alarm-panel-card.ts @@ -4,7 +4,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -133,9 +133,9 @@ class HuiAlarmPanelCard extends LitElement implements LovelaceCard { ); } - protected render(): TemplateResult { + protected render() { if (!this._config || !this.hass) { - return html``; + return nothing; } const stateObj = this.hass.states[this._config.entity]; @@ -185,7 +185,7 @@ class HuiAlarmPanelCard extends LitElement implements LovelaceCard { )}
${!stateObj.attributes.code_format - ? html`` + ? nothing : html` `} ${stateObj.attributes.code_format !== FORMAT_NUMBER - ? html`` + ? nothing : html`
${BUTTONS.map((value) => diff --git a/src/panels/lovelace/cards/hui-area-card.ts b/src/panels/lovelace/cards/hui-area-card.ts index 385e48c6bf..70a0258867 100644 --- a/src/panels/lovelace/cards/hui-area-card.ts +++ b/src/panels/lovelace/cards/hui-area-card.ts @@ -17,6 +17,7 @@ import { LitElement, PropertyValues, TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -33,7 +34,6 @@ import "../../../components/ha-card"; import "../../../components/ha-icon-button"; import "../../../components/ha-state-icon"; import "../../../components/ha-svg-icon"; -import "../components/hui-image"; import { AreaRegistryEntry, subscribeAreaRegistry, @@ -50,6 +50,7 @@ import { import { forwardHaptic } from "../../../data/haptics"; import { SubscribeMixin } from "../../../mixins/subscribe-mixin"; import { HomeAssistant } from "../../../types"; +import "../components/hui-image"; import "../components/hui-warning"; import { LovelaceCard, LovelaceCardEditor } from "../types"; import { AreaCardConfig } from "./types"; @@ -318,7 +319,7 @@ export class HuiAreaCard return false; } - protected render(): TemplateResult { + protected render() { if ( !this._config || !this.hass || @@ -326,7 +327,7 @@ export class HuiAreaCard !this._devices || !this._entities ) { - return html``; + return nothing; } const entitiesByDomain = this._entitiesByDomain( diff --git a/src/panels/lovelace/cards/hui-button-card.ts b/src/panels/lovelace/cards/hui-button-card.ts index dd79487d25..3886e2b83d 100644 --- a/src/panels/lovelace/cards/hui-button-card.ts +++ b/src/panels/lovelace/cards/hui-button-card.ts @@ -8,7 +8,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, @@ -136,9 +136,9 @@ export class HuiButtonCard extends LitElement implements LovelaceCard { ); } - protected render(): TemplateResult { + protected render() { if (!this._config || !this.hass) { - return html``; + return nothing; } const stateObj = this._config.entity ? this.hass.states[this._config.entity] diff --git a/src/panels/lovelace/cards/hui-calendar-card.ts b/src/panels/lovelace/cards/hui-calendar-card.ts index abd69bf654..c502cc1da8 100644 --- a/src/panels/lovelace/cards/hui-calendar-card.ts +++ b/src/panels/lovelace/cards/hui-calendar-card.ts @@ -4,9 +4,9 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; -import { customElement, property, state, query } from "lit/decorators"; +import { customElement, property, query, state } from "lit/decorators"; import { getColorByIndex } from "../../../common/color/colors"; import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element"; import { HASSDomEvent } from "../../../common/dom/fire_event"; @@ -118,9 +118,9 @@ export class HuiCalendarCard extends LitElement implements LovelaceCard { } } - protected render(): TemplateResult { + protected render() { if (!this._config || !this.hass || !this._calendars.length) { - return html``; + return nothing; } const views: FullCalendarView[] = this._veryNarrow diff --git a/src/panels/lovelace/cards/hui-empty-state-card.ts b/src/panels/lovelace/cards/hui-empty-state-card.ts index 83f376ae12..7202ae4ff2 100644 --- a/src/panels/lovelace/cards/hui-empty-state-card.ts +++ b/src/panels/lovelace/cards/hui-empty-state-card.ts @@ -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 } from "lit/decorators"; import "../../../components/ha-card"; import { HomeAssistant } from "../../../types"; @@ -18,9 +18,9 @@ export class HuiEmptyStateCard extends LitElement implements LovelaceCard { // eslint-disable-next-line } - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/hui-entities-card.ts b/src/panels/lovelace/cards/hui-entities-card.ts index 59ccec7ae5..3d5b46449e 100644 --- a/src/panels/lovelace/cards/hui-entities-card.ts +++ b/src/panels/lovelace/cards/hui-entities-card.ts @@ -5,6 +5,7 @@ import { LitElement, PropertyValues, TemplateResult, + nothing, } from "lit"; import { customElement, state } from "lit/decorators"; import { DOMAINS_TOGGLE } from "../../../common/const"; @@ -178,9 +179,9 @@ class HuiEntitiesCard extends LitElement implements LovelaceCard { } } - protected render(): TemplateResult { + protected render() { if (!this._config || !this._hass) { - return html``; + return nothing; } return html` @@ -204,7 +205,7 @@ class HuiEntitiesCard extends LitElement implements LovelaceCard { ${this._config.title}
${!this._showHeaderToggle - ? html`` + ? nothing : html` ${this._error}
`; diff --git a/src/panels/lovelace/cards/hui-markdown-card.ts b/src/panels/lovelace/cards/hui-markdown-card.ts index d03a9cd45d..59dfd15265 100644 --- a/src/panels/lovelace/cards/hui-markdown-card.ts +++ b/src/panels/lovelace/cards/hui-markdown-card.ts @@ -5,7 +5,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -72,9 +72,9 @@ export class HuiMarkdownCard extends LitElement implements LovelaceCard { this._tryDisconnect(); } - protected render(): TemplateResult { + protected render() { if (!this._config) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/hui-media-control-card.ts b/src/panels/lovelace/cards/hui-media-control-card.ts index 05d6faf3b2..2a021ff662 100644 --- a/src/panels/lovelace/cards/hui-media-control-card.ts +++ b/src/panels/lovelace/cards/hui-media-control-card.ts @@ -7,7 +7,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -138,9 +138,9 @@ export class HuiMediaControlCard extends LitElement implements LovelaceCard { } } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } const stateObj = this._stateObj; diff --git a/src/panels/lovelace/cards/hui-picture-card.ts b/src/panels/lovelace/cards/hui-picture-card.ts index ffcf4f5009..c72bf72bc9 100644 --- a/src/panels/lovelace/cards/hui-picture-card.ts +++ b/src/panels/lovelace/cards/hui-picture-card.ts @@ -4,7 +4,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -78,9 +78,9 @@ export class HuiPictureCard extends LitElement implements LovelaceCard { } } - protected render(): TemplateResult { + protected render() { if (!this._config || !this.hass) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/hui-picture-elements-card.ts b/src/panels/lovelace/cards/hui-picture-elements-card.ts index 192569b3a9..fad22f2c66 100644 --- a/src/panels/lovelace/cards/hui-picture-elements-card.ts +++ b/src/panels/lovelace/cards/hui-picture-elements-card.ts @@ -4,7 +4,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element"; @@ -110,9 +110,9 @@ class HuiPictureElementsCard extends LitElement implements LovelaceCard { } } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/hui-picture-entity-card.ts b/src/panels/lovelace/cards/hui-picture-entity-card.ts index c1e3efbd80..665aad7f32 100644 --- a/src/panels/lovelace/cards/hui-picture-entity-card.ts +++ b/src/panels/lovelace/cards/hui-picture-entity-card.ts @@ -5,6 +5,7 @@ import { LitElement, PropertyValues, TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; @@ -102,9 +103,9 @@ class HuiPictureEntityCard extends LitElement implements LovelaceCard { } } - protected render(): TemplateResult { + protected render() { if (!this._config || !this.hass) { - return html``; + return nothing; } const stateObj = this.hass.states[this._config.entity]; diff --git a/src/panels/lovelace/cards/hui-picture-glance-card.ts b/src/panels/lovelace/cards/hui-picture-glance-card.ts index eda0d51fec..298a745026 100644 --- a/src/panels/lovelace/cards/hui-picture-glance-card.ts +++ b/src/panels/lovelace/cards/hui-picture-glance-card.ts @@ -5,6 +5,7 @@ import { LitElement, PropertyValues, TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -164,9 +165,9 @@ class HuiPictureGlanceCard extends LitElement implements LovelaceCard { } } - protected render(): TemplateResult { + protected render() { if (!this._config || !this.hass) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/hui-plant-status-card.ts b/src/panels/lovelace/cards/hui-plant-status-card.ts index 507d82f10a..74c080031a 100644 --- a/src/panels/lovelace/cards/hui-plant-status-card.ts +++ b/src/panels/lovelace/cards/hui-plant-status-card.ts @@ -11,7 +11,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element"; @@ -101,9 +101,9 @@ class HuiPlantStatusCard extends LitElement implements LovelaceCard { } } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } const stateObj = this.hass.states[this._config!.entity]; diff --git a/src/panels/lovelace/cards/hui-shopping-list-card.ts b/src/panels/lovelace/cards/hui-shopping-list-card.ts index f1d82f45e3..2c53ce6a71 100644 --- a/src/panels/lovelace/cards/hui-shopping-list-card.ts +++ b/src/panels/lovelace/cards/hui-shopping-list-card.ts @@ -6,7 +6,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -105,9 +105,9 @@ class HuiShoppingListCard } } - protected render(): TemplateResult { + protected render() { if (!this._config || !this.hass) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/hui-stack-card.ts b/src/panels/lovelace/cards/hui-stack-card.ts index 9ad8d2ba93..28bd1c5ae5 100644 --- a/src/panels/lovelace/cards/hui-stack-card.ts +++ b/src/panels/lovelace/cards/hui-stack-card.ts @@ -4,7 +4,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { property, state } from "lit/decorators"; import { LovelaceCardConfig } from "../../../data/lovelace"; @@ -68,9 +68,9 @@ export abstract class HuiStackCard } } - protected render(): TemplateResult { + protected render() { if (!this._config || !this._cards) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/hui-starting-card.ts b/src/panels/lovelace/cards/hui-starting-card.ts index 09bdd24079..2c7be82c53 100644 --- a/src/panels/lovelace/cards/hui-starting-card.ts +++ b/src/panels/lovelace/cards/hui-starting-card.ts @@ -6,7 +6,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../../../common/dom/fire_event"; @@ -39,9 +39,9 @@ export class HuiStartingCard extends LitElement implements LovelaceCard { } } - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/hui-statistic-card.ts b/src/panels/lovelace/cards/hui-statistic-card.ts index 951e68b6f7..ddf5651450 100644 --- a/src/panels/lovelace/cards/hui-statistic-card.ts +++ b/src/panels/lovelace/cards/hui-statistic-card.ts @@ -5,7 +5,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element"; @@ -123,9 +123,9 @@ export class HuiStatisticCard extends LitElement implements LovelaceCard { return size; } - protected render(): TemplateResult { + protected render() { if (!this._config || !this.hass) { - return html``; + return nothing; } if (this._error) { diff --git a/src/panels/lovelace/cards/hui-statistics-graph-card.ts b/src/panels/lovelace/cards/hui-statistics-graph-card.ts index 997f84d2e5..d97005ffb3 100644 --- a/src/panels/lovelace/cards/hui-statistics-graph-card.ts +++ b/src/panels/lovelace/cards/hui-statistics-graph-card.ts @@ -5,7 +5,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -177,9 +177,9 @@ export class HuiStatisticsGraphCard extends LitElement implements LovelaceCard { ); } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/cards/hui-thermostat-card.ts b/src/panels/lovelace/cards/hui-thermostat-card.ts index 956782dec3..dbeb47db18 100644 --- a/src/panels/lovelace/cards/hui-thermostat-card.ts +++ b/src/panels/lovelace/cards/hui-thermostat-card.ts @@ -15,9 +15,9 @@ import { CSSResultGroup, html, LitElement, + nothing, PropertyValues, svg, - TemplateResult, } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -104,9 +104,9 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard { this._config = config; } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } const stateObj = this.hass.states[this._config.entity] as ClimateEntity; @@ -467,9 +467,9 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard { } } - private _renderIcon(mode: string, currentMode: string): TemplateResult { + private _renderIcon(mode: string, currentMode: string) { if (!modeIcons[mode]) { - return html``; + return nothing; } return html` ; @@ -62,9 +62,9 @@ export class HuiActionEditor extends LitElement { }) ); - protected render(): TemplateResult { + protected render() { if (!this.hass) { - return html``; + return nothing; } const actions = this.actions ?? DEFAULT_ACTIONS; diff --git a/src/panels/lovelace/components/hui-energy-period-selector.ts b/src/panels/lovelace/components/hui-energy-period-selector.ts index b1fb786dba..ef733beeb4 100644 --- a/src/panels/lovelace/components/hui-energy-period-selector.ts +++ b/src/panels/lovelace/components/hui-energy-period-selector.ts @@ -19,8 +19,9 @@ import { startOfYear, } from "date-fns/esm"; import { UnsubscribeFunc } from "home-assistant-js-websocket"; -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; +import { firstWeekdayIndex } from "../../../common/datetime/first_weekday"; import { formatDate, formatDateMonthYear, @@ -28,15 +29,14 @@ import { formatDateYear, } from "../../../common/datetime/format_date"; import { toggleAttribute } from "../../../common/dom/toggle_attribute"; +import { computeRTLDirection } from "../../../common/util/compute_rtl"; import "../../../components/ha-button-toggle-group"; import "../../../components/ha-icon-button"; -import "../../../components/ha-icon-button-prev"; import "../../../components/ha-icon-button-next"; +import "../../../components/ha-icon-button-prev"; import { EnergyData, getEnergyDataCollection } from "../../../data/energy"; import { SubscribeMixin } from "../../../mixins/subscribe-mixin"; import { HomeAssistant, ToggleButton } from "../../../types"; -import { computeRTLDirection } from "../../../common/util/compute_rtl"; -import { firstWeekdayIndex } from "../../../common/datetime/first_weekday"; @customElement("hui-energy-period-selector") export class HuiEnergyPeriodSelector extends SubscribeMixin(LitElement) { @@ -67,9 +67,9 @@ export class HuiEnergyPeriodSelector extends SubscribeMixin(LitElement) { ]; } - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._startDate) { - return html``; + return nothing; } const viewButtons: ToggleButton[] = [ diff --git a/src/panels/lovelace/components/hui-entities-toggle.ts b/src/panels/lovelace/components/hui-entities-toggle.ts index 7e0431b61f..8c28f4b7be 100644 --- a/src/panels/lovelace/components/hui-entities-toggle.ts +++ b/src/panels/lovelace/components/hui-entities-toggle.ts @@ -4,7 +4,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, state } from "lit/decorators"; import { DOMAINS_TOGGLE } from "../../../common/const"; @@ -33,9 +33,9 @@ class HuiEntitiesToggle extends LitElement { } } - protected render(): TemplateResult { + protected render() { if (!this._toggleEntities?.length) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/components/hui-entity-editor.ts b/src/panels/lovelace/components/hui-entity-editor.ts index dbfa9b1eaf..138a88d870 100644 --- a/src/panels/lovelace/components/hui-entity-editor.ts +++ b/src/panels/lovelace/components/hui-entity-editor.ts @@ -1,5 +1,5 @@ import { mdiDrag } 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 { repeat } from "lit/directives/repeat"; import type { SortableEvent } from "sortablejs"; @@ -39,9 +39,9 @@ export class HuiEntityEditor extends LitElement { return this._entityKeys.get(action)!; } - protected render(): TemplateResult { + protected render() { if (!this.entities) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/components/hui-generic-entity-row.ts b/src/panels/lovelace/components/hui-generic-entity-row.ts index 55b6bc6cab..3d1c1e0d0c 100644 --- a/src/panels/lovelace/components/hui-generic-entity-row.ts +++ b/src/panels/lovelace/components/hui-generic-entity-row.ts @@ -4,7 +4,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { property } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -40,9 +40,9 @@ class HuiGenericEntityRow extends LitElement { // Default behavior is controlled by DOMAINS_INPUT_ROW. @property({ type: Boolean }) public catchInteraction?; - protected render(): TemplateResult { + protected render() { if (!this.hass || !this.config) { - return html``; + return nothing; } const stateObj = this.config.entity ? this.hass.states[this.config.entity] @@ -153,7 +153,7 @@ class HuiGenericEntityRow extends LitElement { ` : ""}
` - : html``} + : nothing} ${this.catchInteraction ?? !DOMAINS_INPUT_ROW.includes(domain) ? html`
0 && this._ratio.h > 0 @@ -219,7 +219,7 @@ export class HuiImage extends LitElement { > ` : imageSrc === undefined - ? html`` + ? nothing : html` ({ entity_id }) ); - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } const stateObj = this.hass.states[this._config.entity ?? ""] as diff --git a/src/panels/lovelace/editor/config-elements/hui-vacuum-commands-tile-feature-editor.ts b/src/panels/lovelace/editor/config-elements/hui-vacuum-commands-tile-feature-editor.ts index 982b48ea4c..aeed477351 100644 --- a/src/panels/lovelace/editor/config-elements/hui-vacuum-commands-tile-feature-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-vacuum-commands-tile-feature-editor.ts @@ -1,5 +1,5 @@ import { HassEntity } from "home-assistant-js-websocket"; -import { html, LitElement, TemplateResult } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { fireEvent } from "../../../../common/dom/fire_event"; @@ -52,9 +52,9 @@ export class HuiVacuumCommandsTileFeatureEditor ] as const ); - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } const stateObj = this.context?.entity_id diff --git a/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts index 264637c16a..c338e4a8e9 100644 --- a/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts @@ -1,4 +1,4 @@ -import { html, LitElement, TemplateResult } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { assert, assign, boolean, object, optional, string } from "superstruct"; @@ -121,9 +121,9 @@ export class HuiWeatherForecastCardEditor ] as const ); - protected render(): TemplateResult { + protected render() { if (!this.hass || !this._config) { - return html``; + return nothing; } const schema = this._schema(this.hass.localize, this._has_forecast); diff --git a/src/panels/lovelace/editor/header-footer-editor/hui-dialog-create-headerfooter.ts b/src/panels/lovelace/editor/header-footer-editor/hui-dialog-create-headerfooter.ts index 6c909c8bf1..3386d220be 100644 --- a/src/panels/lovelace/editor/header-footer-editor/hui-dialog-create-headerfooter.ts +++ b/src/panels/lovelace/editor/header-footer-editor/hui-dialog-create-headerfooter.ts @@ -1,5 +1,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 { createCloseHeading } from "../../../../components/ha-dialog"; @@ -32,9 +32,9 @@ export class HuiCreateDialogHeaderFooter return true; } - protected render(): TemplateResult { + protected render() { if (!this._params) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/editor/hui-dialog-save-config.ts b/src/panels/lovelace/editor/hui-dialog-save-config.ts index 1ebf011137..06c0dcfd0e 100644 --- a/src/panels/lovelace/editor/hui-dialog-save-config.ts +++ b/src/panels/lovelace/editor/hui-dialog-save-config.ts @@ -1,6 +1,6 @@ import "@material/mwc-button"; import { mdiHelpCircle } from "@mdi/js"; -import { CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { 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"; @@ -46,9 +46,9 @@ export class HuiSaveConfig extends LitElement implements HassDialog { return true; } - protected render(): TemplateResult { + protected render() { if (!this._params) { - return html``; + return nothing; } return html` ` - : html``} + : nothing} `; } diff --git a/src/panels/lovelace/special-rows/hui-text-row.ts b/src/panels/lovelace/special-rows/hui-text-row.ts index b64d8a3842..aa1eabff0c 100644 --- a/src/panels/lovelace/special-rows/hui-text-row.ts +++ b/src/panels/lovelace/special-rows/hui-text-row.ts @@ -1,4 +1,4 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, state } from "lit/decorators"; import "../../../components/ha-icon"; import { LovelaceRow, TextConfig } from "../entity-rows/types"; @@ -15,9 +15,9 @@ class HuiTextRow extends LitElement implements LovelaceRow { this._config = config; } - protected render(): TemplateResult { + protected render() { if (!this._config) { - return html``; + return nothing; } return html` diff --git a/src/panels/lovelace/special-rows/hui-weblink-row.ts b/src/panels/lovelace/special-rows/hui-weblink-row.ts index 5af61bb49e..04d00240f0 100644 --- a/src/panels/lovelace/special-rows/hui-weblink-row.ts +++ b/src/panels/lovelace/special-rows/hui-weblink-row.ts @@ -1,4 +1,4 @@ -import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; +import { css, CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import "../../../components/ha-icon"; @@ -23,9 +23,9 @@ class HuiWeblinkRow extends LitElement implements LovelaceRow { }; } - protected render(): TemplateResult { + protected render() { if (!this._config) { - return html``; + return nothing; } return html` diff --git a/src/panels/media-browser/ha-bar-media-player.ts b/src/panels/media-browser/ha-bar-media-player.ts index ba7f1b5820..5266eebf33 100644 --- a/src/panels/media-browser/ha-bar-media-player.ts +++ b/src/panels/media-browser/ha-bar-media-player.ts @@ -18,7 +18,7 @@ import { html, LitElement, PropertyValues, - TemplateResult, + nothing, } from "lit"; import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; @@ -156,7 +156,7 @@ export class BarMediaPlayer extends SubscribeMixin(LitElement) { this._newMediaExpected = false; } - protected render(): TemplateResult { + protected render() { if (this._newMediaExpected) { return html`
@@ -267,7 +267,7 @@ export class BarMediaPlayer extends SubscribeMixin(LitElement) { )}
${stateObj.attributes.media_duration === Infinity - ? html`` + ? nothing : this.narrow ? html`` : html` diff --git a/src/panels/media-browser/hui-dialog-web-browser-play-media.ts b/src/panels/media-browser/hui-dialog-web-browser-play-media.ts index 78a7beb8c3..365e70dd1b 100644 --- a/src/panels/media-browser/hui-dialog-web-browser-play-media.ts +++ b/src/panels/media-browser/hui-dialog-web-browser-play-media.ts @@ -1,11 +1,4 @@ -import { - css, - CSSResultGroup, - html, - LitElement, - nothing, - 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 { createCloseHeading } from "../../components/ha-dialog"; @@ -30,9 +23,9 @@ export class HuiDialogWebBrowserPlayMedia extends LitElement { fireEvent(this, "dialog-closed", { dialog: this.localName }); } - protected render(): TemplateResult { + protected render() { if (!this._params || !this._params.sourceType || !this._params.sourceUrl) { - return html``; + return nothing; } const mediaType = this._params.sourceType.split("/", 1)[0]; diff --git a/src/panels/my/ha-panel-my.ts b/src/panels/my/ha-panel-my.ts index 609aba96f2..2cfc2d7e50 100644 --- a/src/panels/my/ha-panel-my.ts +++ b/src/panels/my/ha-panel-my.ts @@ -1,5 +1,5 @@ import { sanitizeUrl } from "@braintree/sanitize-url"; -import { html, LitElement } from "lit"; +import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { isComponentLoaded } from "../../common/config/is_component_loaded"; import { @@ -406,7 +406,7 @@ class HaPanelMy extends LitElement { .hass=${this.hass} >`; } - return html``; + return nothing; } private _createRedirectUrl(): string { diff --git a/src/panels/profile/dialog-ha-mfa-module-setup-flow.ts b/src/panels/profile/dialog-ha-mfa-module-setup-flow.ts index d1a6ec1937..e5e9ff4abe 100644 --- a/src/panels/profile/dialog-ha-mfa-module-setup-flow.ts +++ b/src/panels/profile/dialog-ha-mfa-module-setup-flow.ts @@ -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 "../../components/ha-circular-progress"; import "../../components/ha-dialog"; @@ -67,9 +67,9 @@ class HaMfaModuleSetupFlow extends LitElement { this._opened = false; } - protected render(): TemplateResult { + protected render() { if (!this._opened) { - return html``; + return nothing; } return html` Date: Tue, 28 Feb 2023 02:06:51 -0800 Subject: [PATCH 08/24] Fix a hang in history graph card editor (#15623) --- src/components/chart/state-history-chart-timeline.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/chart/state-history-chart-timeline.ts b/src/components/chart/state-history-chart-timeline.ts index 546e062d29..fd2dea5e0a 100644 --- a/src/components/chart/state-history-chart-timeline.ts +++ b/src/components/chart/state-history-chart-timeline.ts @@ -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, From ea95fb98aa0d27f3f652fe36e6a8aa61467e6dad Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Tue, 28 Feb 2023 11:34:35 +0100 Subject: [PATCH 09/24] 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 --------- Co-authored-by: Bram Kragten --- src/dialogs/more-info/controls/more-info-lock.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/dialogs/more-info/controls/more-info-lock.ts b/src/dialogs/more-info/controls/more-info-lock.ts index 2be217eda6..33afb0e93f 100644 --- a/src/dialogs/more-info/controls/more-info-lock.ts +++ b/src/dialogs/more-info/controls/more-info-lock.ts @@ -21,7 +21,7 @@ class MoreInfoLock extends LitElement { } return html` ${this.stateObj.attributes.code_format - ? html` + ? html`
${this.hass.localize("ui.card.lock.lock")}`} - ` +
` : ""} Date: Tue, 28 Feb 2023 17:21:52 +0100 Subject: [PATCH 10/24] Prevent config menu jump when cloud info loads (#15638) Prevent config menu jump --- src/panels/config/dashboard/ha-config-dashboard.ts | 7 ++++--- src/translations/en.json | 3 +++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/panels/config/dashboard/ha-config-dashboard.ts b/src/panels/config/dashboard/ha-config-dashboard.ts index fadd8f6650..7c539b720d 100644 --- a/src/panels/config/dashboard/ha-config-dashboard.ts +++ b/src/panels/config/dashboard/ha-config-dashboard.ts @@ -137,16 +137,17 @@ class HaConfigDashboard extends SubscribeMixin(LitElement) { total: 0, }; - private _pages = memoizeOne((clouStatus, isLoaded) => { + private _pages = memoizeOne((cloudStatus, isCloudLoaded) => { const pages: PageNavigation[] = []; - if (clouStatus && isLoaded) { + if (isCloudLoaded) { pages.push({ component: "cloud", path: "/config/cloud", name: "Home Assistant Cloud", - info: this.cloudStatus, + info: cloudStatus, iconPath: mdiCloudLock, iconColor: "#3B808E", + translationKey: "cloud", }); } return [...pages, ...configSections.dashboard]; diff --git a/src/translations/en.json b/src/translations/en.json index 020ae10cb3..c97d144058 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -1395,6 +1395,9 @@ "about": { "main": "About", "secondary": "Version information, credits and more" + }, + "cloud": { + "secondary": "Loading..." } }, "common": { From e3b797e85c72a5321c8058435d7509fed0418b15 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Wed, 1 Mar 2023 10:29:19 +0100 Subject: [PATCH 11/24] Fix more info for disabled entity (#15641) --- src/dialogs/more-info/ha-more-info-dialog.ts | 5 +++-- src/dialogs/more-info/ha-more-info-info.ts | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/dialogs/more-info/ha-more-info-dialog.ts b/src/dialogs/more-info/ha-more-info-dialog.ts index 38a7e4ab84..ced7e56e0e 100644 --- a/src/dialogs/more-info/ha-more-info-dialog.ts +++ b/src/dialogs/more-info/ha-more-info-dialog.ts @@ -214,7 +214,7 @@ export class MoreInfoDialog extends LitElement { return null; } const entityId = this._entityId; - const stateObj = this.hass.states[entityId]; + const stateObj = this.hass.states[entityId] as HassEntity | undefined; const domain = computeDomain(entityId); const name = (stateObj && computeStateName(stateObj)) || entityId; @@ -226,6 +226,7 @@ export class MoreInfoDialog extends LitElement { const title = this._childView?.viewTitle ?? name; const isInfoView = this._currView === "info" && !this._childView; + const isNewMoreInfo = stateObj && computeShowNewMoreInfo(stateObj); return html` @@ -251,7 +252,7 @@ export class MoreInfoDialog extends LitElement { )} > `} - ${!isInfoView || !computeShowNewMoreInfo(stateObj) + ${!isInfoView || !isNewMoreInfo ? html`
@@ -46,7 +47,7 @@ export class MoreInfoInfo extends LitElement { ` : ""}
- ${DOMAINS_NO_INFO.includes(domain) || computeShowNewMoreInfo(stateObj) + ${DOMAINS_NO_INFO.includes(domain) || isNewMoreInfo ? "" : html` `} From 9c703ab469d9e8aa5d770227bd58884e09d6c431 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Wed, 1 Mar 2023 11:24:01 +0100 Subject: [PATCH 12/24] Add color temperature value to light more info (#15639) --- .../ha-more-info-view-light-color-picker.ts | 54 ++++++++++++++----- 1 file changed, 42 insertions(+), 12 deletions(-) diff --git a/src/dialogs/more-info/components/lights/ha-more-info-view-light-color-picker.ts b/src/dialogs/more-info/components/lights/ha-more-info-view-light-color-picker.ts index 80a9af71e9..d9114c229b 100644 --- a/src/dialogs/more-info/components/lights/ha-more-info-view-light-color-picker.ts +++ b/src/dialogs/more-info/components/lights/ha-more-info-view-light-color-picker.ts @@ -7,8 +7,8 @@ import { CSSResultGroup, html, LitElement, - PropertyValues, nothing, + PropertyValues, } from "lit"; import { customElement, property, state } from "lit/decorators"; import "../../../../components/ha-button-toggle-group"; @@ -97,15 +97,19 @@ class MoreInfoViewLightColorPicker extends LitElement {
${this._mode === LightColorMode.COLOR_TEMP ? html` +

+ ${this._ctSliderValue ? `${this._ctSliderValue} K` : nothing} +

@@ -114,7 +118,7 @@ class MoreInfoViewLightColorPicker extends LitElement { : ""} ${this._mode === "color" ? html` -
+
@@ -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; @@ -524,7 +543,17 @@ class MoreInfoViewLightColorPicker extends LitElement { width: 100%; } - .color_temp { + .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-thickness: 100px; --control-slider-border-radius: 24px; --control-slider-background: -webkit-linear-gradient( @@ -534,6 +563,7 @@ class MoreInfoViewLightColorPicker extends LitElement { rgb(255, 160, 0) 100% ); --control-slider-background-opacity: 1; + margin-bottom: 44px; } hr { From c747ab7605b67daf4cdb20cbafa8e691a580e081 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Wed, 1 Mar 2023 11:24:35 +0100 Subject: [PATCH 13/24] Add on/off icon for some domains (#15640) --- src/common/const.ts | 11 ----------- src/common/entity/domain_icon.ts | 18 +++++++++++++++++- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/common/const.ts b/src/common/const.ts index 64811ef272..6e9d669bc5 100644 --- a/src/common/const.ts +++ b/src/common/const.ts @@ -1,7 +1,6 @@ /** Constants to be used in the frontend. */ import { - mdiAccount, mdiAirFilter, mdiAlert, mdiAngleAcute, @@ -48,7 +47,6 @@ import { mdiProgressClock, mdiRayVertex, mdiRemote, - mdiRobot, mdiRobotVacuum, mdiScriptText, mdiSineWave, @@ -59,15 +57,12 @@ import { mdiThermostat, mdiTimerOutline, mdiTransmissionTower, - mdiVideo, mdiWater, mdiWaterPercent, - mdiWeatherCloudy, mdiWeatherPouring, mdiWeatherRainy, mdiWeatherWindy, mdiWeight, - mdiWhiteBalanceSunny, mdiWifi, } from "@mdi/js"; @@ -82,9 +77,7 @@ 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, @@ -105,7 +98,6 @@ export const FIXED_DOMAIN_ICONS = { notify: mdiCommentAlert, number: mdiRayVertex, persistent_notification: mdiBell, - person: mdiAccount, plant: mdiFlower, proximity: mdiAppleSafari, remote: mdiRemote, @@ -116,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, }; diff --git a/src/common/entity/domain_icon.ts b/src/common/entity/domain_icon.ts index b334b4570e..fe4a911c79 100644 --- a/src/common/entity/domain_icon.ts +++ b/src/common/entity/domain_icon.ts @@ -30,6 +30,8 @@ import { mdiPowerPlug, mdiPowerPlugOff, mdiRestart, + mdiRobot, + mdiRobotOff, mdiSpeaker, mdiSpeakerOff, mdiSpeakerPause, @@ -41,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"; @@ -83,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); @@ -96,6 +106,9 @@ export const domainIconWithoutDefault = ( return mdiGestureTapButton; } + case "camera": + return compareState === "off" ? mdiVideoOff : mdiVideo; + case "cover": return coverIcon(compareState, stateObj); @@ -221,7 +234,7 @@ export const domainIconWithoutDefault = ( case "sun": return stateObj?.state === "above_horizon" - ? FIXED_DOMAIN_ICONS[domain] + ? mdiWhiteBalanceSunny : mdiWeatherNight; case "switch_as_x": @@ -237,6 +250,9 @@ export const domainIconWithoutDefault = ( : mdiPackageUp : mdiPackage; + case "water_heater": + return compareState === "off" ? mdiWaterBoilerOff : mdiWaterBoiler; + case "weather": return weatherIcon(stateObj?.state); } From 4a9ec7233d48d61bab21a65ca1d5430f34fd04bf Mon Sep 17 00:00:00 2001 From: Erik Montnemery Date: Wed, 1 Mar 2023 11:24:48 +0100 Subject: [PATCH 14/24] Fetch weather units from core (#15212) --- src/data/weather.ts | 15 ++++++++ .../entities/entity-registry-settings.ts | 34 ++++++++++++------- 2 files changed, 36 insertions(+), 13 deletions(-) diff --git a/src/data/weather.ts b/src/data/weather.ts index fe64a4ff8a..619240354d 100644 --- a/src/data/weather.ts +++ b/src/data/weather.ts @@ -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", + }); diff --git a/src/panels/config/entities/entity-registry-settings.ts b/src/panels/config/entities/entity-registry-settings.ts index 980d3de909..272dfa2d5b 100644 --- a/src/panels/config/entities/entity-registry-settings.ts +++ b/src/panels/config/entities/entity-registry-settings.ts @@ -72,6 +72,10 @@ import { import { domainToName } from "../../../data/integration"; import { getNumberDeviceClassConvertibleUnits } from "../../../data/number"; import { getSensorDeviceClassConvertibleUnits } from "../../../data/sensor"; +import { + WeatherUnits, + getWeatherConvertibleUnits, +} from "../../../data/weather"; import { showAliasesDialog } from "../../../dialogs/aliases/show-dialog-aliases"; import { showOptionsFlowDialog } from "../../../dialogs/config-flow/show-dialog-options-flow"; import { @@ -118,14 +122,6 @@ const OVERRIDE_DEVICE_CLASSES = { ], }; -const OVERRIDE_WEATHER_UNITS = { - precipitation: ["mm", "in"], - pressure: ["hPa", "mbar", "mmHg", "inHg"], - temperature: ["°C", "°F"], - visibility: ["km", "mi"], - wind_speed: ["ft/s", "km/h", "kn", "m/s", "mph"], -}; - const SWITCH_AS_DOMAINS = ["cover", "fan", "light", "lock", "siren"]; const PRECISIONS = [0, 1, 2, 3, 4, 5, 6]; @@ -180,6 +176,8 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) { @state() private _sensorDeviceClassConvertibleUnits?: string[]; + @state() private _weatherConvertibleUnits?: WeatherUnits; + private _origEntityId!: string; private _deviceLookup?: Record; @@ -319,6 +317,16 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) { this._sensorDeviceClassConvertibleUnits = []; } } + if (changedProps.has("_entityId")) { + const domain = computeDomain(this.entry.entity_id); + + if (domain === "weather") { + const { units } = await getWeatherConvertibleUnits(this.hass); + this._weatherConvertibleUnits = units; + } else { + this._weatherConvertibleUnits = undefined; + } + } } protected render() { @@ -543,7 +551,7 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) { @selected=${this._precipitationUnitChanged} @closed=${stopPropagation} > - ${OVERRIDE_WEATHER_UNITS.precipitation.map( + ${this._weatherConvertibleUnits?.precipitation_unit.map( (unit: string) => html` ${unit} ` @@ -559,7 +567,7 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) { @selected=${this._pressureUnitChanged} @closed=${stopPropagation} > - ${OVERRIDE_WEATHER_UNITS.pressure.map( + ${this._weatherConvertibleUnits?.pressure_unit.map( (unit: string) => html` ${unit} ` @@ -575,7 +583,7 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) { @selected=${this._temperatureUnitChanged} @closed=${stopPropagation} > - ${OVERRIDE_WEATHER_UNITS.temperature.map( + ${this._weatherConvertibleUnits?.temperature_unit.map( (unit: string) => html` ${unit} ` @@ -591,7 +599,7 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) { @selected=${this._visibilityUnitChanged} @closed=${stopPropagation} > - ${OVERRIDE_WEATHER_UNITS.visibility.map( + ${this._weatherConvertibleUnits?.visibility_unit.map( (unit: string) => html` ${unit} ` @@ -607,7 +615,7 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) { @selected=${this._windSpeedUnitChanged} @closed=${stopPropagation} > - ${OVERRIDE_WEATHER_UNITS.wind_speed.map( + ${this._weatherConvertibleUnits?.wind_speed_unit.map( (unit: string) => html` ${unit} ` From ccf670465bfa43781a86ad690de8bc2b15771a7a Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Wed, 1 Mar 2023 11:30:11 +0100 Subject: [PATCH 15/24] Fix statistics name sorting in developer tools (#15646) --- .../statistics/developer-tools-statistics.ts | 33 +++++++++++++------ 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/src/panels/developer-tools/statistics/developer-tools-statistics.ts b/src/panels/developer-tools/statistics/developer-tools-statistics.ts index 7dee426178..0e3c6bb3eb 100644 --- a/src/panels/developer-tools/statistics/developer-tools-statistics.ts +++ b/src/panels/developer-tools/statistics/developer-tools-statistics.ts @@ -34,16 +34,23 @@ const FIX_ISSUES_ORDER = { unsupported_state_class: 2, units_changed: 3, }; + +type StatisticData = StatisticsMetaData & { + issues?: StatisticsValidationResult[]; + state?: HassEntity; +}; + +type DisplayedStatisticData = StatisticData & { + displayName: string; +}; + @customElement("developer-tools-statistics") class HaPanelDevStatistics extends SubscribeMixin(LitElement) { @property({ attribute: false }) public hass!: HomeAssistant; @property({ type: Boolean }) public narrow!: boolean; - @state() private _data: (StatisticsMetaData & { - issues?: StatisticsValidationResult[]; - state?: HassEntity; - })[] = [] as StatisticsMetaData[]; + @state() private _data: StatisticData[] = [] as StatisticsMetaData[]; private _disabledEntities = new Set(); @@ -51,17 +58,23 @@ class HaPanelDevStatistics extends SubscribeMixin(LitElement) { this._validateStatistics(); } + private _displayData = memoizeOne( + (data: StatisticData[]): DisplayedStatisticData[] => + data.map((item) => ({ + ...item, + displayName: item.state + ? computeStateName(item.state) + : item.name || item.statistic_id, + })) + ); + private _columns = memoizeOne( (localize): DataTableColumnContainer => ({ - state: { + displayName: { title: "Name", sortable: true, filterable: true, grows: true, - template: (entityState, data: any) => - html`${entityState - ? computeStateName(entityState) - : data.name || data.statistic_id}`, }, statistic_id: { title: "Statistic id", @@ -140,7 +153,7 @@ class HaPanelDevStatistics extends SubscribeMixin(LitElement) { return html` Date: Wed, 1 Mar 2023 12:15:12 +0100 Subject: [PATCH 16/24] Adapt more info control height for small screen (#15647) * Adapt more info control height for small screen * Fix light picker sliders --- src/dialogs/more-info/components/ha-more-info-toggle.ts | 8 ++++++-- .../components/lights/ha-more-info-light-brightness.ts | 4 +++- .../lights/ha-more-info-view-light-color-picker.ts | 8 +++++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/dialogs/more-info/components/ha-more-info-toggle.ts b/src/dialogs/more-info/components/ha-more-info-toggle.ts index 5f10a849e2..0548a45e9a 100644 --- a/src/dialogs/more-info/components/ha-more-info-toggle.ts +++ b/src/dialogs/more-info/components/ha-more-info-toggle.ts @@ -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; } diff --git a/src/dialogs/more-info/components/lights/ha-more-info-light-brightness.ts b/src/dialogs/more-info/components/lights/ha-more-info-light-brightness.ts index b82226ec6f..5e7816e136 100644 --- a/src/dialogs/more-info/components/lights/ha-more-info-light-brightness.ts +++ b/src/dialogs/more-info/components/lights/ha-more-info-light-brightness.ts @@ -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); diff --git a/src/dialogs/more-info/components/lights/ha-more-info-view-light-color-picker.ts b/src/dialogs/more-info/components/lights/ha-more-info-view-light-color-picker.ts index d9114c229b..29f1158628 100644 --- a/src/dialogs/more-info/components/lights/ha-more-info-view-light-color-picker.ts +++ b/src/dialogs/more-info/components/lights/ha-more-info-view-light-color-picker.ts @@ -535,8 +535,12 @@ 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 { @@ -554,8 +558,6 @@ class MoreInfoViewLightColorPicker extends LitElement { } .color-temp { - --control-slider-thickness: 100px; - --control-slider-border-radius: 24px; --control-slider-background: -webkit-linear-gradient( top, rgb(166, 209, 255) 0%, From 34c15d96c1a45ee2501bba364bf1f2bc314c5d93 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Wed, 1 Mar 2023 14:28:35 +0100 Subject: [PATCH 17/24] Reduce more-info dialog margin (#15649) Reduce more-info margin --- src/dialogs/more-info/ha-more-info-dialog.ts | 2 +- src/dialogs/more-info/ha-more-info-info.ts | 2 +- src/dialogs/more-info/ha-more-info-settings.ts | 2 +- src/panels/config/entities/entity-registry-settings.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/dialogs/more-info/ha-more-info-dialog.ts b/src/dialogs/more-info/ha-more-info-dialog.ts index ced7e56e0e..6b4f412ce7 100644 --- a/src/dialogs/more-info/ha-more-info-dialog.ts +++ b/src/dialogs/more-info/ha-more-info-dialog.ts @@ -454,7 +454,7 @@ export class MoreInfoDialog extends LitElement { ha-related-items, ha-more-info-history-and-logbook { - padding: 24px; + padding: 8px 24px 24px 24px; display: block; } diff --git a/src/dialogs/more-info/ha-more-info-info.ts b/src/dialogs/more-info/ha-more-info-info.ts index 858d0110bc..e9d59d3b62 100644 --- a/src/dialogs/more-info/ha-more-info-info.ts +++ b/src/dialogs/more-info/ha-more-info-info.ts @@ -98,7 +98,7 @@ export class MoreInfoInfo extends LitElement { display: flex; flex-direction: column; flex: 1; - padding: 24px; + padding: 8px 24px 24px 24px; padding-bottom: max(env(safe-area-inset-bottom), 24px); } diff --git a/src/dialogs/more-info/ha-more-info-settings.ts b/src/dialogs/more-info/ha-more-info-settings.ts index 6cc09a47fa..a10545c651 100644 --- a/src/dialogs/more-info/ha-more-info-settings.ts +++ b/src/dialogs/more-info/ha-more-info-settings.ts @@ -93,7 +93,7 @@ export class HaMoreInfoSettings extends LitElement { return [ css` .content { - padding: 24px; + padding: 8px 24px 24px 24px; } `, ]; diff --git a/src/panels/config/entities/entity-registry-settings.ts b/src/panels/config/entities/entity-registry-settings.ts index 272dfa2d5b..88cfa86657 100644 --- a/src/panels/config/entities/entity-registry-settings.ts +++ b/src/panels/config/entities/entity-registry-settings.ts @@ -1325,7 +1325,7 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) { display: block; } .container { - padding: 20px 24px; + padding: 8px 24px 20px 24px; } .buttons { box-sizing: border-box; From d32cde3cf8099b6afaa9c78c665cb2d90ea8d600 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 1 Mar 2023 14:42:42 +0100 Subject: [PATCH 18/24] Fix more info position (#15650) --- src/dialogs/more-info/ha-more-info-dialog.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/dialogs/more-info/ha-more-info-dialog.ts b/src/dialogs/more-info/ha-more-info-dialog.ts index 6b4f412ce7..04ebaeebf2 100644 --- a/src/dialogs/more-info/ha-more-info-dialog.ts +++ b/src/dialogs/more-info/ha-more-info-dialog.ts @@ -428,10 +428,12 @@ export class MoreInfoDialog extends LitElement { haStyleDialog, css` ha-dialog { + /* Set the top top of the dialog to a fixed position, so it doesnt jump when the content changes size */ + --vertical-align-dialog: flex-start; + --dialog-surface-margin-top: 40px; /* This is needed for the tooltip of the history charts to be positioned correctly */ --dialog-surface-position: static; --dialog-content-position: static; - --vertical-align-dialog: flex-start; --dialog-content-padding: 0; } @@ -469,11 +471,17 @@ export class MoreInfoDialog extends LitElement { text-overflow: ellipsis; } + @media all and (max-width: 450px), all and (max-height: 500px) { + /* When in fullscreen dialog should be attached to top */ + ha-dialog { + --dialog-surface-margin-top: 0px; + } + } + @media all and (min-width: 600px) and (min-height: 501px) { ha-dialog { --mdc-dialog-min-width: 560px; --mdc-dialog-max-width: 580px; - --dialog-surface-margin-top: 40px; --mdc-dialog-max-height: calc(100% - 72px); } From 42688e100c3c27655abd0d0f9b9cc954b5b95c24 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Mar 2023 09:04:48 -0500 Subject: [PATCH 19/24] 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] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 6d53b9f8eb..84ce16f0c8 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/yarn.lock b/yarn.lock index dd84e5b4c4..7117fba43c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9537,10 +9537,10 @@ fsevents@~2.3.2: languageName: node linkType: hard -"hls.js@npm:^1.3.3": - version: 1.3.3 - resolution: "hls.js@npm:1.3.3" - checksum: 373b80838ac2d9bdb8d3cb319b1279930b5b344c9015b88ae198ead2442c2517b768b831898c5182acff40c13a26745382798b9dc2c8115d09d8693c142e09e9 +"hls.js@npm:^1.3.4": + version: 1.3.4 + resolution: "hls.js@npm:1.3.4" + checksum: bdc0ad130853737c08705c1aa12035ee6d81b4edba17cf0d0d1304af19ee1b65e63bbdf2e96d49f1b5e605767ffd9c8fcf145160d8af2d1aad3407c9918ce7b5 languageName: node linkType: hard @@ -9695,7 +9695,7 @@ fsevents@~2.3.2: gulp-merge-json: ^2.1.2 gulp-rename: ^2.0.0 gulp-zopfli-green: ^6.0.1 - hls.js: ^1.3.3 + hls.js: ^1.3.4 home-assistant-js-websocket: ^8.0.1 html-minifier: ^4.0.0 husky: ^8.0.3 From 7b4850b5d6f446fe0b5ae12ffe65e817a3512545 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 1 Mar 2023 15:08:56 +0100 Subject: [PATCH 20/24] Bump core js, replace serve with serve-handler (#15637) * Bump core js, remove serve from deps * resplace serve with serve-handler --- .github/dependabot.yml | 1 - build-scripts/bundle.js | 2 +- package.json | 5 +- yarn.lock | 368 ++++------------------------------------ 4 files changed, 36 insertions(+), 340 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 99dc4f65c3..eb9eeccfa5 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -18,4 +18,3 @@ updates: # Ignore rollup and plugins until everything else is updated - dependency-name: "*rollup*" - dependency-name: "@rollup/*" - - dependency-name: "serve" diff --git a/build-scripts/bundle.js b/build-scripts/bundle.js index e1cf89d661..0c36092f36 100644 --- a/build-scripts/bundle.js +++ b/build-scripts/bundle.js @@ -77,7 +77,7 @@ module.exports.babelOptions = ({ latestBuild, isProdBuild }) => ({ "@babel/preset-env", { useBuiltIns: "entry", - corejs: { version: "3.28", proposals: true }, + corejs: { version: "3.29", proposals: true }, bugfixes: true, }, ], diff --git a/package.json b/package.json index 84ce16f0c8..9a1467b350 100644 --- a/package.json +++ b/package.json @@ -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", @@ -178,6 +178,7 @@ "@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", @@ -230,7 +231,7 @@ "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.14.0", diff --git a/yarn.lock b/yarn.lock index 7117fba43c..267a94ab3d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4424,6 +4424,15 @@ __metadata: languageName: node linkType: hard +"@types/serve-handler@npm:^6": + version: 6.1.1 + resolution: "@types/serve-handler@npm:6.1.1" + dependencies: + "@types/node": "*" + checksum: f519f83b18d7dea80f188f387a56dfe30fe944196849c470902fabf9db344c083c470f67e3362ad3f2294512950bc55924282c5c7a911ec8d507c37c6861d8ce + languageName: node + linkType: hard + "@types/serve-index@npm:^1.9.1": version: 1.9.1 resolution: "@types/serve-index@npm:1.9.1" @@ -5256,13 +5265,6 @@ __metadata: languageName: node linkType: hard -"@zeit/schemas@npm:2.6.0": - version: 2.6.0 - resolution: "@zeit/schemas@npm:2.6.0" - checksum: 7f2175ee34fad1a37da20882f9cda038ebb43a99ceaf30877f1676044669adde714ee56de6f1fcb57214dfa4479995a63fb2d053fe9f877b6852cdc1e4da574c - languageName: node - linkType: hard - "abbrev@npm:1": version: 1.1.1 resolution: "abbrev@npm:1.1.1" @@ -5381,18 +5383,6 @@ __metadata: languageName: node linkType: hard -"ajv@npm:6.5.3": - version: 6.5.3 - resolution: "ajv@npm:6.5.3" - dependencies: - fast-deep-equal: ^2.0.1 - fast-json-stable-stringify: ^2.0.0 - json-schema-traverse: ^0.4.1 - uri-js: ^4.2.2 - checksum: 787f5a6a69a75f48723bcdb5d17eea0bfbac39bd83ff96b8e82e8f1f7e40be3558a26252152ff917ccca14176b31a3dba4e219ed2f4195a72f6fbd97530f419a - languageName: node - linkType: hard - "ajv@npm:^6.10.0, ajv@npm:^6.12.4, ajv@npm:^6.12.5": version: 6.12.6 resolution: "ajv@npm:6.12.6" @@ -5417,15 +5407,6 @@ __metadata: languageName: node linkType: hard -"ansi-align@npm:^2.0.0": - version: 2.0.0 - resolution: "ansi-align@npm:2.0.0" - dependencies: - string-width: ^2.0.0 - checksum: fecefb3b4a128aaad52ed1d2ee2f999968acc77573645be49666273ec2952840e27aed8cb9c2e48cd0c2d5a088389223eabb6d09aa74bceba3b931d242288c97 - languageName: node - linkType: hard - "ansi-colors@npm:4.1.1": version: 4.1.1 resolution: "ansi-colors@npm:4.1.1" @@ -5609,13 +5590,6 @@ __metadata: languageName: node linkType: hard -"arch@npm:^2.1.0": - version: 2.1.2 - resolution: "arch@npm:2.1.2" - checksum: cf750b4720970a704c8328ff013164bbcb00d06bf18239caeaebccc9ad36a82dcde287d9274e958d21276441272c50ec12f232b58f1dd216669b60279d08a44b - languageName: node - linkType: hard - "archy@npm:^1.0.0": version: 1.0.0 resolution: "archy@npm:1.0.0" @@ -5633,13 +5607,6 @@ __metadata: languageName: node linkType: hard -"arg@npm:2.0.0": - version: 2.0.0 - resolution: "arg@npm:2.0.0" - checksum: eeadcfa6160847452ac1973d1c6990e2133e50972d56f80f3601f83a465daa88431cb430cc12101d90b01719361a55a166b03f489143b6ba2acd2304714ebe74 - languageName: node - linkType: hard - "argparse@npm:^2.0.1": version: 2.0.1 resolution: "argparse@npm:2.0.1" @@ -6148,21 +6115,6 @@ __metadata: languageName: node linkType: hard -"boxen@npm:1.3.0": - version: 1.3.0 - resolution: "boxen@npm:1.3.0" - dependencies: - ansi-align: ^2.0.0 - camelcase: ^4.0.0 - chalk: ^2.0.1 - cli-boxes: ^1.0.0 - string-width: ^2.0.0 - term-size: ^1.2.0 - widest-line: ^2.0.0 - checksum: 8dad2081bfaf5a86cb85685882b5f22027c5c430ee0974894078f521a44d92a90222fb4391b41fc4575aa1215c9133ea2c6b7feadcd1cb2fae8f4e97c05dbf11 - languageName: node - linkType: hard - "brace-expansion@npm:^1.1.7": version: 1.1.11 resolution: "brace-expansion@npm:1.1.11" @@ -6392,13 +6344,6 @@ __metadata: languageName: node linkType: hard -"camelcase@npm:^4.0.0": - version: 4.1.0 - resolution: "camelcase@npm:4.1.0" - checksum: 9683356daf9b64fae4b30c91f8ceb1f34f22746e03d1804efdbe738357d38b47f206cdd71efcf2ed72018b2e88eeb8ec3f79adb09c02f1253a4b6d5d405ff2ae - languageName: node - linkType: hard - "camelcase@npm:^5.0.0": version: 5.3.1 resolution: "camelcase@npm:5.3.1" @@ -6435,18 +6380,7 @@ __metadata: languageName: node linkType: hard -"chalk@npm:2.4.1": - version: 2.4.1 - resolution: "chalk@npm:2.4.1" - dependencies: - ansi-styles: ^3.2.1 - escape-string-regexp: ^1.0.5 - supports-color: ^5.3.0 - checksum: 196eb8e99a0c00c6fcef216c794b109fd071931b10ec0f8f305c368fb6d776d0d4857d0028d2cc3561632428d6d94a41d7edf33b506f7540b7c8492f4224d89e - languageName: node - linkType: hard - -"chalk@npm:^2.0.0, chalk@npm:^2.0.1, chalk@npm:^2.4.2": +"chalk@npm:^2.0.0, chalk@npm:^2.4.2": version: 2.4.2 resolution: "chalk@npm:2.4.2" dependencies: @@ -6583,13 +6517,6 @@ __metadata: languageName: node linkType: hard -"cli-boxes@npm:^1.0.0": - version: 1.0.0 - resolution: "cli-boxes@npm:1.0.0" - checksum: 101cfd6464a418a76523c332665eaf0641522f30ecc2492de48263ada6b0852333b2ed47b2998ddda621e7008471c51f597f813be798db237c33ba45b27e802a - languageName: node - linkType: hard - "cli-cursor@npm:^3.1.0": version: 3.1.0 resolution: "cli-cursor@npm:3.1.0" @@ -6619,16 +6546,6 @@ __metadata: languageName: node linkType: hard -"clipboardy@npm:1.2.3": - version: 1.2.3 - resolution: "clipboardy@npm:1.2.3" - dependencies: - arch: ^2.1.0 - execa: ^0.8.0 - checksum: 013b226bfd196e54641d58d7047c4ffbad5ba5849cbdb4d9938860256923ffa6ae2eb10a75e7cda6d1f69c313fc2372c15fbba8d6e6cdf50e756acd3faa75bb6 - languageName: node - linkType: hard - "cliui@npm:^3.2.0": version: 3.2.0 resolution: "cliui@npm:3.2.0" @@ -6879,7 +6796,7 @@ __metadata: languageName: node linkType: hard -"compressible@npm:~2.0.14, compressible@npm:~2.0.16": +"compressible@npm:~2.0.16": version: 2.0.18 resolution: "compressible@npm:2.0.18" dependencies: @@ -6888,21 +6805,6 @@ __metadata: languageName: node linkType: hard -"compression@npm:1.7.3": - version: 1.7.3 - resolution: "compression@npm:1.7.3" - dependencies: - accepts: ~1.3.5 - bytes: 3.0.0 - compressible: ~2.0.14 - debug: 2.6.9 - on-headers: ~1.0.1 - safe-buffer: 5.1.2 - vary: ~1.1.2 - checksum: f1c24d9d3f30f6ae7ac57a41078ec90ca514112e6d21fc992d1d79d904a2eedb2a96620806f8de9ab85a75dbec94ef9b6dded9a06a6d72faa9bc8c4e3c375072 - languageName: node - linkType: hard - "compression@npm:^1.7.4": version: 1.7.4 resolution: "compression@npm:1.7.4" @@ -7047,10 +6949,10 @@ __metadata: languageName: node linkType: hard -"core-js@npm:^3.28.0": - version: 3.28.0 - resolution: "core-js@npm:3.28.0" - checksum: 3155fd0ec16d0089106b145e9595280a4ea4bde0d7ff26aa14364cd4f1c203baf6620c3025acd284f363d08b9f21104101692766ca9a36ffeee7307bdf3e1881 +"core-js@npm:^3.29.0": + version: 3.29.0 + resolution: "core-js@npm:3.29.0" + checksum: 2bd69d783efcd2ef9197ce892a8b91d7b2fd86dddce805a3be0ff721013a2342eeab0f7d0b4b5548c1377b9846a8fb81485054efd39618b9d1a1fca04af81ccf languageName: node linkType: hard @@ -7075,17 +6977,6 @@ __metadata: languageName: node linkType: hard -"cross-spawn@npm:^5.0.1": - version: 5.1.0 - resolution: "cross-spawn@npm:5.1.0" - dependencies: - lru-cache: ^4.0.1 - shebang-command: ^1.2.0 - which: ^1.2.9 - checksum: 726939c9954fc70c20e538923feaaa33bebc253247d13021737c3c7f68cdc3e0a57f720c0fe75057c0387995349f3f12e20e9bfdbf12274db28019c7ea4ec166 - languageName: node - linkType: hard - "cross-spawn@npm:^7.0.2, cross-spawn@npm:^7.0.3": version: 7.0.3 resolution: "cross-spawn@npm:7.0.3" @@ -8270,36 +8161,6 @@ __metadata: languageName: node linkType: hard -"execa@npm:^0.7.0": - version: 0.7.0 - resolution: "execa@npm:0.7.0" - dependencies: - cross-spawn: ^5.0.1 - get-stream: ^3.0.0 - is-stream: ^1.1.0 - npm-run-path: ^2.0.0 - p-finally: ^1.0.0 - signal-exit: ^3.0.0 - strip-eof: ^1.0.0 - checksum: dd70206d74b7217bf678ec9f04dddedc82f425df4c1d70e34c9f429d630ec407819e4bd42e3af2618981a4a3a1be000c9b651c0637be486cdab985160c20337c - languageName: node - linkType: hard - -"execa@npm:^0.8.0": - version: 0.8.0 - resolution: "execa@npm:0.8.0" - dependencies: - cross-spawn: ^5.0.1 - get-stream: ^3.0.0 - is-stream: ^1.1.0 - npm-run-path: ^2.0.0 - p-finally: ^1.0.0 - signal-exit: ^3.0.0 - strip-eof: ^1.0.0 - checksum: c2a4bf6e051737e46bee61a93ec286cb71a05f16650a1918c8d6262ba9f0bac031472252411baa8c78b7f432f10cb4c601349403774d69be2ebd864e9b1eca60 - languageName: node - linkType: hard - "execa@npm:^5.0.0": version: 5.0.0 resolution: "execa@npm:5.0.0" @@ -8476,13 +8337,6 @@ __metadata: languageName: node linkType: hard -"fast-deep-equal@npm:^2.0.1": - version: 2.0.1 - resolution: "fast-deep-equal@npm:2.0.1" - checksum: b701835a87985e0ec4925bdf1f0c1e7eb56309b5d12d534d5b4b69d95a54d65bb16861c081781ead55f73f12d6c60ba668713391ee7fbf6b0567026f579b7b0b - languageName: node - linkType: hard - "fast-deep-equal@npm:^3.1.1, fast-deep-equal@npm:^3.1.3": version: 3.1.3 resolution: "fast-deep-equal@npm:3.1.3" @@ -9035,13 +8889,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"get-stream@npm:^3.0.0": - version: 3.0.0 - resolution: "get-stream@npm:3.0.0" - checksum: 36142f46005ed74ce3a45c55545ec4e7da8e243554179e345a786baf144e5c4a35fb7bdc49fadfa9f18bd08000589b6fe364abdadfc4e1eb0e1b9914a6bb9c56 - languageName: node - linkType: hard - "get-stream@npm:^6.0.0, get-stream@npm:^6.0.1": version: 6.0.1 resolution: "get-stream@npm:6.0.1" @@ -9644,6 +9491,7 @@ fsevents@~2.3.2: "@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 @@ -9665,7 +9513,7 @@ fsevents@~2.3.2: chai: ^4.3.7 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 @@ -9734,7 +9582,7 @@ fsevents@~2.3.2: rollup-plugin-terser: ^5.3.0 rollup-plugin-visualizer: ^5.9.0 rrule: ^2.7.2 - serve: ^11.3.2 + serve-handler: ^6.1.5 sinon: ^15.0.1 sortablejs: ^1.15.0 source-map-url: ^0.4.1 @@ -10691,13 +10539,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"is-stream@npm:^1.1.0": - version: 1.1.0 - resolution: "is-stream@npm:1.1.0" - checksum: 063c6bec9d5647aa6d42108d4c59723d2bd4ae42135a2d4db6eadbd49b7ea05b750fd69d279e5c7c45cf9da753ad2c00d8978be354d65aa9f6bb434969c6a2ae - languageName: node - linkType: hard - "is-stream@npm:^2.0.0": version: 2.0.0 resolution: "is-stream@npm:2.0.0" @@ -11626,16 +11467,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"lru-cache@npm:^4.0.1": - version: 4.1.5 - resolution: "lru-cache@npm:4.1.5" - dependencies: - pseudomap: ^1.0.2 - yallist: ^2.1.2 - checksum: 4bb4b58a36cd7dc4dcec74cbe6a8f766a38b7426f1ff59d4cf7d82a2aa9b9565cd1cb98f6ff60ce5cd174524868d7bc9b7b1c294371851356066ca9ac4cf135a - languageName: node - linkType: hard - "lru-cache@npm:^5.1.1": version: 5.1.1 resolution: "lru-cache@npm:5.1.1" @@ -11917,12 +11748,12 @@ fsevents@~2.3.2: languageName: node linkType: hard -"minimatch@npm:3.0.4": - version: 3.0.4 - resolution: "minimatch@npm:3.0.4" +"minimatch@npm:3.1.2, minimatch@npm:^3.0.4, minimatch@npm:^3.0.5, minimatch@npm:^3.1.2": + version: 3.1.2 + resolution: "minimatch@npm:3.1.2" dependencies: brace-expansion: ^1.1.7 - checksum: 66ac295f8a7b59788000ea3749938b0970344c841750abd96694f80269b926ebcafad3deeb3f1da2522978b119e6ae3a5869b63b13a7859a456b3408bd18a078 + checksum: c154e566406683e7bcb746e000b84d74465b3a832c45d59912b9b55cd50dee66e5c4b1e5566dba26154040e51672f9aa450a9aef0c97cfc7336b78b7afb9540a languageName: node linkType: hard @@ -11935,15 +11766,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"minimatch@npm:^3.0.4, minimatch@npm:^3.0.5, minimatch@npm:^3.1.2": - version: 3.1.2 - resolution: "minimatch@npm:3.1.2" - dependencies: - brace-expansion: ^1.1.7 - checksum: c154e566406683e7bcb746e000b84d74465b3a832c45d59912b9b55cd50dee66e5c4b1e5566dba26154040e51672f9aa450a9aef0c97cfc7336b78b7afb9540a - languageName: node - linkType: hard - "minimatch@npm:^5.0.1": version: 5.1.6 resolution: "minimatch@npm:5.1.6" @@ -12485,15 +12307,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"npm-run-path@npm:^2.0.0": - version: 2.0.2 - resolution: "npm-run-path@npm:2.0.2" - dependencies: - path-key: ^2.0.0 - checksum: acd5ad81648ba4588ba5a8effb1d98d2b339d31be16826a118d50f182a134ac523172101b82eab1d01cb4c2ba358e857d54cfafd8163a1ffe7bd52100b741125 - languageName: node - linkType: hard - "npm-run-path@npm:^4.0.1": version: 4.0.1 resolution: "npm-run-path@npm:4.0.1" @@ -12687,7 +12500,7 @@ fsevents@~2.3.2: languageName: node linkType: hard -"on-headers@npm:~1.0.1, on-headers@npm:~1.0.2": +"on-headers@npm:~1.0.2": version: 1.0.2 resolution: "on-headers@npm:1.0.2" checksum: 2bf13467215d1e540a62a75021e8b318a6cfc5d4fc53af8e8f84ad98dbcea02d506c6d24180cd62e1d769c44721ba542f3154effc1f7579a8288c9f7873ed8e5 @@ -12795,13 +12608,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"p-finally@npm:^1.0.0": - version: 1.0.0 - resolution: "p-finally@npm:1.0.0" - checksum: 93a654c53dc805dd5b5891bab16eb0ea46db8f66c4bfd99336ae929323b1af2b70a8b0654f8f1eae924b2b73d037031366d645f1fd18b3d30cbd15950cc4b1d4 - languageName: node - linkType: hard - "p-limit@npm:^2.2.0": version: 2.3.0 resolution: "p-limit@npm:2.3.0" @@ -13071,13 +12877,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"path-key@npm:^2.0.0": - version: 2.0.1 - resolution: "path-key@npm:2.0.1" - checksum: f7ab0ad42fe3fb8c7f11d0c4f849871e28fbd8e1add65c370e422512fc5887097b9cf34d09c1747d45c942a8c1e26468d6356e2df3f740bf177ab8ca7301ebfd - languageName: node - linkType: hard - "path-key@npm:^3.0.0, path-key@npm:^3.1.0": version: 3.1.1 resolution: "path-key@npm:3.1.1" @@ -13421,13 +13220,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"pseudomap@npm:^1.0.2": - version: 1.0.2 - resolution: "pseudomap@npm:1.0.2" - checksum: 856c0aae0ff2ad60881168334448e898ad7a0e45fe7386d114b150084254c01e200c957cf378378025df4e052c7890c5bd933939b0e0d2ecfcc1dc2f0b2991f5 - languageName: node - linkType: hard - "pump@npm:^2.0.0": version: 2.0.1 resolution: "pump@npm:2.0.1" @@ -13544,7 +13336,7 @@ fsevents@~2.3.2: languageName: node linkType: hard -"rc@npm:^1.0.1, rc@npm:^1.1.6, rc@npm:^1.2.7": +"rc@npm:^1.2.7": version: 1.2.8 resolution: "rc@npm:1.2.8" dependencies: @@ -13724,25 +13516,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"registry-auth-token@npm:3.3.2": - version: 3.3.2 - resolution: "registry-auth-token@npm:3.3.2" - dependencies: - rc: ^1.1.6 - safe-buffer: ^5.0.1 - checksum: c9d7ae160a738f1fa825556e3669e6c771d2c0239ce37679f7e8646157a97d0a76464738be075002a1f754ef9bfb913b689f4bbfd5296d28f136fbf98c8c2217 - languageName: node - linkType: hard - -"registry-url@npm:3.1.0": - version: 3.1.0 - resolution: "registry-url@npm:3.1.0" - dependencies: - rc: ^1.0.1 - checksum: 6d223da41b04e1824f5faa63905c6f2e43b216589d72794111573f017352b790aef42cd1f826463062f89d804abb2027e3d9665d2a9a0426a11eedd04d470af3 - languageName: node - linkType: hard - "regjsgen@npm:^0.7.1": version: 0.7.1 resolution: "regjsgen@npm:0.7.1" @@ -14162,7 +13935,7 @@ fsevents@~2.3.2: languageName: node linkType: hard -"safe-buffer@npm:5.2.1, safe-buffer@npm:>=5.1.0, safe-buffer@npm:^5.0.1, safe-buffer@npm:^5.1.0, safe-buffer@npm:^5.1.1, safe-buffer@npm:^5.1.2, safe-buffer@npm:~5.2.0": +"safe-buffer@npm:5.2.1, safe-buffer@npm:>=5.1.0, safe-buffer@npm:^5.1.0, safe-buffer@npm:^5.1.1, safe-buffer@npm:^5.1.2, safe-buffer@npm:~5.2.0": version: 5.2.1 resolution: "safe-buffer@npm:5.2.1" checksum: b99c4b41fdd67a6aaf280fcd05e9ffb0813654894223afb78a31f14a19ad220bba8aba1cb14eddce1fcfb037155fe6de4e861784eb434f7d11ed58d1e70dd491 @@ -14326,19 +14099,19 @@ fsevents@~2.3.2: languageName: node linkType: hard -"serve-handler@npm:6.1.3": - version: 6.1.3 - resolution: "serve-handler@npm:6.1.3" +"serve-handler@npm:^6.1.5": + version: 6.1.5 + resolution: "serve-handler@npm:6.1.5" dependencies: bytes: 3.0.0 content-disposition: 0.5.2 fast-url-parser: 1.1.3 mime-types: 2.1.18 - minimatch: 3.0.4 + minimatch: 3.1.2 path-is-inside: 1.0.2 path-to-regexp: 2.2.1 range-parser: 1.2.0 - checksum: 384c1bc10add07a554207f918acaa75af47fcfd8fb89e070faa3468ab45ec5bbc9f976e62d659b6b63404edcf5c54efb7e0a48f3f55946eec83b62b283b9837e + checksum: 7a98ca9cbf8692583b6cde4deb3941cff900fa38bf16adbfccccd8430209bab781e21d9a1f61c9c03e226f9f67689893bbce25941368f3ddaf985fc3858b49dc languageName: node linkType: hard @@ -14369,25 +14142,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"serve@npm:^11.3.2": - version: 11.3.2 - resolution: "serve@npm:11.3.2" - dependencies: - "@zeit/schemas": 2.6.0 - ajv: 6.5.3 - arg: 2.0.0 - boxen: 1.3.0 - chalk: 2.4.1 - clipboardy: 1.2.3 - compression: 1.7.3 - serve-handler: 6.1.3 - update-check: 1.5.2 - bin: - serve: bin/serve.js - checksum: ef54e3fed7d77acd414014e24171f5e41f932c501f690bbf83003bf3d8e441bdeb1b0c0efcdd24bad1197f141a4b6dec2cb1286d37b9e3b146c49cff00024852 - languageName: node - linkType: hard - "set-blocking@npm:^2.0.0, set-blocking@npm:~2.0.0": version: 2.0.0 resolution: "set-blocking@npm:2.0.0" @@ -14444,15 +14198,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"shebang-command@npm:^1.2.0": - version: 1.2.0 - resolution: "shebang-command@npm:1.2.0" - dependencies: - shebang-regex: ^1.0.0 - checksum: 9eed1750301e622961ba5d588af2212505e96770ec376a37ab678f965795e995ade7ed44910f5d3d3cb5e10165a1847f52d3348c64e146b8be922f7707958908 - languageName: node - linkType: hard - "shebang-command@npm:^2.0.0": version: 2.0.0 resolution: "shebang-command@npm:2.0.0" @@ -14462,13 +14207,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"shebang-regex@npm:^1.0.0": - version: 1.0.0 - resolution: "shebang-regex@npm:1.0.0" - checksum: 404c5a752cd40f94591dfd9346da40a735a05139dac890ffc229afba610854d8799aaa52f87f7e0c94c5007f2c6af55bdcaeb584b56691926c5eaf41dc8f1372 - languageName: node - linkType: hard - "shebang-regex@npm:^3.0.0": version: 3.0.0 resolution: "shebang-regex@npm:3.0.0" @@ -14891,7 +14629,7 @@ fsevents@~2.3.2: languageName: node linkType: hard -"string-width@npm:^1.0.2 || 2, string-width@npm:^2.0.0, string-width@npm:^2.1.1": +"string-width@npm:^1.0.2 || 2": version: 2.1.1 resolution: "string-width@npm:2.1.1" dependencies: @@ -15049,13 +14787,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"strip-eof@npm:^1.0.0": - version: 1.0.0 - resolution: "strip-eof@npm:1.0.0" - checksum: 40bc8ddd7e072f8ba0c2d6d05267b4e0a4800898c3435b5fb5f5a21e6e47dfaff18467e7aa0d1844bb5d6274c3097246595841fbfeb317e541974ee992cac506 - languageName: node - linkType: hard - "strip-final-newline@npm:^2.0.0": version: 2.0.0 resolution: "strip-final-newline@npm:2.0.0" @@ -15232,15 +14963,6 @@ fsevents@~2.3.2: languageName: node linkType: hard -"term-size@npm:^1.2.0": - version: 1.2.0 - resolution: "term-size@npm:1.2.0" - dependencies: - execa: ^0.7.0 - checksum: 833aeb21c74d735c6ab63859fec6a7308d8724089b23b6f58e1a21c015058383529222a63074cbf0814a1812621bf11f01e60d5c5afbbfedcc31d115bf54631a - languageName: node - linkType: hard - "terser-webpack-plugin@npm:^5.1.3, terser-webpack-plugin@npm:^5.3.6": version: 5.3.6 resolution: "terser-webpack-plugin@npm:5.3.6" @@ -15969,16 +15691,6 @@ typescript@^3.8.3: languageName: node linkType: hard -"update-check@npm:1.5.2": - version: 1.5.2 - resolution: "update-check@npm:1.5.2" - dependencies: - registry-auth-token: 3.3.2 - registry-url: 3.1.0 - checksum: 82b42978610ef616afd374153bcbff5055c6482454f3391fe5df48c0bd9fe63de16733f100f8b8d12cea7b33d094d15bdd01ef329ff123f127ca3dcf2b7dfce5 - languageName: node - linkType: hard - "upper-case@npm:^1.1.1": version: 1.1.3 resolution: "upper-case@npm:1.1.3" @@ -16624,7 +16336,7 @@ typescript@^3.8.3: languageName: node linkType: hard -"which@npm:^1.2.14, which@npm:^1.2.9": +"which@npm:^1.2.14": version: 1.3.1 resolution: "which@npm:1.3.1" dependencies: @@ -16662,15 +16374,6 @@ typescript@^3.8.3: languageName: node linkType: hard -"widest-line@npm:^2.0.0": - version: 2.0.1 - resolution: "widest-line@npm:2.0.1" - dependencies: - string-width: ^2.1.1 - checksum: 6245b1f2cff418107f937691d1cafd0e416b9e350aa79e3853dc0759ad20849451d7126c2f06d0a13286d37b44b8e79e4220df09630bce1e4722d9808bc7bfd2 - languageName: node - linkType: hard - "wildcard@npm:^2.0.0": version: 2.0.0 resolution: "wildcard@npm:2.0.0" @@ -17037,13 +16740,6 @@ typescript@^3.8.3: languageName: node linkType: hard -"yallist@npm:^2.1.2": - version: 2.1.2 - resolution: "yallist@npm:2.1.2" - checksum: 9ba99409209f485b6fcb970330908a6d41fa1c933f75e08250316cce19383179a6b70a7e0721b89672ebb6199cc377bf3e432f55100da6a7d6e11902b0a642cb - languageName: node - linkType: hard - "yallist@npm:^3.0.0, yallist@npm:^3.0.2": version: 3.0.3 resolution: "yallist@npm:3.0.3" From 1a1c00ba6298340415f50d17c221eaf529c30446 Mon Sep 17 00:00:00 2001 From: Philip Allgaier Date: Wed, 1 Mar 2023 15:10:14 +0100 Subject: [PATCH 21/24] Add loading info text to hardware config page (#15616) Co-authored-by: Bram Kragten --- src/panels/config/hardware/ha-config-hardware.ts | 12 +++++++++++- src/translations/en.json | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/panels/config/hardware/ha-config-hardware.ts b/src/panels/config/hardware/ha-config-hardware.ts index ebe7340e35..9e0cbea2a1 100644 --- a/src/panels/config/hardware/ha-config-hardware.ts +++ b/src/panels/config/hardware/ha-config-hardware.ts @@ -359,7 +359,7 @@ class HaConfigHardware extends SubscribeMixin(LitElement) { ` : ""} ${dongles?.length - ? html` + ? html` ${dongles.map((dongle) => { const configEntry = dongle.config_entries .map((id) => this._configEntries?.[id]) @@ -441,6 +441,16 @@ class HaConfigHardware extends SubscribeMixin(LitElement) { >
` + : isComponentLoaded(this.hass, "hardware") + ? html` +
+
+ ${this.hass.localize( + "ui.panel.config.hardware.loading_system_data" + )} +
+
+
` : ""}
diff --git a/src/translations/en.json b/src/translations/en.json index c97d144058..d8977a8d8d 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -1808,7 +1808,8 @@ "documentation": "Documentation", "configure": "Configure", "documentation_description": "Find extra information about your device", - "restart_homeassistant": "[%key:ui::panel::config::system_dashboard::restart_homeassistant%]" + "restart_homeassistant": "[%key:ui::panel::config::system_dashboard::restart_homeassistant%]", + "loading_system_data": "Loading processor and memory data..." }, "info": { "caption": "About", From 2ab8bba4b01ab941481b0d3b0881a88c6ec819b3 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Wed, 1 Mar 2023 15:22:57 +0100 Subject: [PATCH 22/24] Sort null and undefined at the bottom in data-table (#15651) Sort null and undefined at the bottom in datatable --- src/components/data-table/sort_filter_worker.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/data-table/sort_filter_worker.ts b/src/components/data-table/sort_filter_worker.ts index 36e756f91e..8fcb9cc3ae 100644 --- a/src/components/data-table/sort_filter_worker.ts +++ b/src/components/data-table/sort_filter_worker.ts @@ -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; } From f803bbadc9537f9bbddd4034887242e89c5b7c9c Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 1 Mar 2023 15:24:00 +0100 Subject: [PATCH 23/24] Set css optimise level to 0 (#15652) --- build-scripts/bundle.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/build-scripts/bundle.js b/build-scripts/bundle.js index 0c36092f36..c1e2ef1d10 100644 --- a/build-scripts/bundle.js +++ b/build-scripts/bundle.js @@ -53,14 +53,16 @@ module.exports.definedVars = ({ isProdBuild, latestBuild, defineOverlay }) => ({ ...defineOverlay, }); -module.exports.htmlMinifierOptions = { +const htmlMinifierOptions = { caseSensitive: true, collapseWhitespace: true, conservativeCollapse: true, decodeEntities: true, removeComments: true, removeRedundantAttributes: true, - minifyCSS: true, + minifyCSS: { + level: 0, + }, }; module.exports.terserOptions = (latestBuild) => ({ @@ -119,7 +121,7 @@ module.exports.babelOptions = ({ latestBuild, isProdBuild }) => ({ "@polymer/polymer/lib/utils/html-tag": ["html"], }, strictCSS: true, - htmlMinifier: module.exports.htmlMinifierOptions, + htmlMinifier: htmlMinifierOptions, failOnError: true, // we can turn this off in case of false positives }, ], From 657a74e8ad9cc45a1adce73e26279d7ea2ccf345 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Wed, 1 Mar 2023 15:32:57 +0100 Subject: [PATCH 24/24] Bumped version to 20230301.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 75d76c0cd7..2ae677b2cc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "home-assistant-frontend" -version = "20230227.0" +version = "20230301.0" license = {text = "Apache-2.0"} description = "The Home Assistant frontend" readme = "README.md"