From 962912c43ca77b0f12e35141bbe2fde6883a92fe Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Wed, 28 Feb 2024 21:51:21 +0100 Subject: [PATCH 001/401] Add allow changing type of empty views (#19912) --- src/panels/lovelace/editor/view-editor/hui-view-editor.ts | 8 ++++++-- src/translations/en.json | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/panels/lovelace/editor/view-editor/hui-view-editor.ts b/src/panels/lovelace/editor/view-editor/hui-view-editor.ts index d0c4f24d53..803cdea063 100644 --- a/src/panels/lovelace/editor/view-editor/hui-view-editor.ts +++ b/src/panels/lovelace/editor/view-editor/hui-view-editor.ts @@ -95,12 +95,16 @@ export class HuiViewEditor extends LitElement { : this._config.type || DEFAULT_VIEW_LAYOUT; } + private get _isEmpty(): boolean { + return !this._config.sections?.length && !this._config.cards?.length; + } + protected render() { if (!this.hass) { return nothing; } - const schema = this._schema(this.hass.localize, this._type, this.isNew); + const schema = this._schema(this.hass.localize, this._type, this._isEmpty); const data = { ...this._config, @@ -165,7 +169,7 @@ export class HuiViewEditor extends LitElement { "ui.panel.lovelace.editor.edit_view.subview_helper" ); case "type": - if (this.isNew) return undefined; + if (this._isEmpty) return undefined; return this._type === "sections" ? this.hass.localize( "ui.panel.lovelace.editor.edit_view.type_helper_others" diff --git a/src/translations/en.json b/src/translations/en.json index 24f63e86a3..c8c1b42c79 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -5112,7 +5112,7 @@ "select_users": "Select which users should see this view in the navigation" }, "type": "View type", - "type_helper_sections": "You can not change your view to use the 'sections' view type, because migration is not supported yet. Start from scratch with a new view if you want to experiment with the 'sections' view.", + "type_helper_sections": "You can not change your view to use the 'sections' view type because migration is not supported yet. Start from scratch with a new view if you want to experiment with the 'sections' view.", "type_helper_others": "You can not change your view to an other type because migration is not supported yet. Start from scratch with a new view if you want to use another view type.", "types": { From a34332b48dec3fef7d58c58d2295f23a5885f21e Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Thu, 29 Feb 2024 15:12:19 +0100 Subject: [PATCH 002/401] Fix section editing after disconnect/reconnect (#19917) * Fix section editing after disconnect/reconnect * Update src/components/ha-sortable.ts Co-authored-by: Bram Kragten --------- Co-authored-by: Bram Kragten --- src/components/ha-sortable.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/components/ha-sortable.ts b/src/components/ha-sortable.ts index 1c83eef950..fc885d71ea 100644 --- a/src/components/ha-sortable.ts +++ b/src/components/ha-sortable.ts @@ -82,6 +82,9 @@ export class HaSortable extends LitElement { public connectedCallback() { super.connectedCallback(); this._shouldBeDestroy = false; + if (this.hasUpdated) { + this.requestUpdate(); + } } protected createRenderRoot() { From ca7e257e9561e9b69f23136da6b534bcb93700e2 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 29 Feb 2024 16:44:43 +0100 Subject: [PATCH 003/401] Bumped version to 20240228.1 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 15c83c13a4..a725ab6ed3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "home-assistant-frontend" -version = "20240228.0" +version = "20240228.1" license = {text = "Apache-2.0"} description = "The Home Assistant frontend" readme = "README.md" From 7d8cb5c8631e63d525322c80000552d93b8f0592 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 29 Feb 2024 18:32:16 -0500 Subject: [PATCH 004/401] Update typescript-eslint monorepo to v7.1.0 (#19922) --- package.json | 4 +- yarn.lock | 104 +++++++++++++++++++++++++-------------------------- 2 files changed, 54 insertions(+), 54 deletions(-) diff --git a/package.json b/package.json index 6bc3ff4a06..8f3eb3a9ce 100644 --- a/package.json +++ b/package.json @@ -185,8 +185,8 @@ "@types/tar": "6.1.11", "@types/ua-parser-js": "0.7.39", "@types/webspeechapi": "0.0.29", - "@typescript-eslint/eslint-plugin": "7.0.2", - "@typescript-eslint/parser": "7.0.2", + "@typescript-eslint/eslint-plugin": "7.1.0", + "@typescript-eslint/parser": "7.1.0", "@web/dev-server": "0.1.38", "@web/dev-server-rollup": "0.4.1", "babel-loader": "9.1.3", diff --git a/yarn.lock b/yarn.lock index 375d5ac91e..9893206ce2 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4555,15 +4555,15 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:7.0.2": - version: 7.0.2 - resolution: "@typescript-eslint/eslint-plugin@npm:7.0.2" +"@typescript-eslint/eslint-plugin@npm:7.1.0": + version: 7.1.0 + resolution: "@typescript-eslint/eslint-plugin@npm:7.1.0" dependencies: "@eslint-community/regexpp": "npm:^4.5.1" - "@typescript-eslint/scope-manager": "npm:7.0.2" - "@typescript-eslint/type-utils": "npm:7.0.2" - "@typescript-eslint/utils": "npm:7.0.2" - "@typescript-eslint/visitor-keys": "npm:7.0.2" + "@typescript-eslint/scope-manager": "npm:7.1.0" + "@typescript-eslint/type-utils": "npm:7.1.0" + "@typescript-eslint/utils": "npm:7.1.0" + "@typescript-eslint/visitor-keys": "npm:7.1.0" debug: "npm:^4.3.4" graphemer: "npm:^1.4.0" ignore: "npm:^5.2.4" @@ -4576,44 +4576,44 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 10/430b2f7ca36ee73dc75c1d677088709f3c9d5bbb4fffa3cfbe1b7d63979ee397f7a4a2a1386e05a04991500fa0ab0dd5272e8603a2b20f42e4bf590603500858 + checksum: 10/f0b6b6e6ae2afee1df8dd2fd0c56588f9bb600468be9f255e033709a53371c6434da687e75dcb673503ef4f0416226f4ca3c94c65272828106e39b56aac87334 languageName: node linkType: hard -"@typescript-eslint/parser@npm:7.0.2": - version: 7.0.2 - resolution: "@typescript-eslint/parser@npm:7.0.2" +"@typescript-eslint/parser@npm:7.1.0": + version: 7.1.0 + resolution: "@typescript-eslint/parser@npm:7.1.0" dependencies: - "@typescript-eslint/scope-manager": "npm:7.0.2" - "@typescript-eslint/types": "npm:7.0.2" - "@typescript-eslint/typescript-estree": "npm:7.0.2" - "@typescript-eslint/visitor-keys": "npm:7.0.2" + "@typescript-eslint/scope-manager": "npm:7.1.0" + "@typescript-eslint/types": "npm:7.1.0" + "@typescript-eslint/typescript-estree": "npm:7.1.0" + "@typescript-eslint/visitor-keys": "npm:7.1.0" debug: "npm:^4.3.4" peerDependencies: eslint: ^8.56.0 peerDependenciesMeta: typescript: optional: true - checksum: 10/18d6e1bda64013f7d66164164c57a10390f7979db55b265062ae9337e11e0921bffca10870e252cd0bd198f79ffa2e87a652e57110e5b1b4cc738453154c205c + checksum: 10/39238d37f5a5f7058371ee3882fb7cd8a4579883fc5f13fda645c151fcf8d15e4c0db3ea7ffa7915a55c82451b544e9340c0228b45b83085158cb97974112f19 languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:7.0.2": - version: 7.0.2 - resolution: "@typescript-eslint/scope-manager@npm:7.0.2" +"@typescript-eslint/scope-manager@npm:7.1.0": + version: 7.1.0 + resolution: "@typescript-eslint/scope-manager@npm:7.1.0" dependencies: - "@typescript-eslint/types": "npm:7.0.2" - "@typescript-eslint/visitor-keys": "npm:7.0.2" - checksum: 10/773ea6e61f741777e69a469641f3db0d3c2301c0102667825fb235ed5a65c95f6d6b31b19e734b9a215acc0c7c576c65497635b8d5928eeddb58653ceb13d2d5 + "@typescript-eslint/types": "npm:7.1.0" + "@typescript-eslint/visitor-keys": "npm:7.1.0" + checksum: 10/3fb18de864331739c1b04fe9e3bb5d926e2fdf0d1fea2871181f68d0fb52325cbc9a5b81da58b7fe7f22d6d58d62b21c83460907146bc2f54ef0720fb3f9037f languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:7.0.2": - version: 7.0.2 - resolution: "@typescript-eslint/type-utils@npm:7.0.2" +"@typescript-eslint/type-utils@npm:7.1.0": + version: 7.1.0 + resolution: "@typescript-eslint/type-utils@npm:7.1.0" dependencies: - "@typescript-eslint/typescript-estree": "npm:7.0.2" - "@typescript-eslint/utils": "npm:7.0.2" + "@typescript-eslint/typescript-estree": "npm:7.1.0" + "@typescript-eslint/utils": "npm:7.1.0" debug: "npm:^4.3.4" ts-api-utils: "npm:^1.0.1" peerDependencies: @@ -4621,23 +4621,23 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 10/63bf19c9f5bbcb0f3e127f509d85dc49be4e5e51781d78f58c96786089e7c909b25d35d0248a6a758e2f7d5b5223d2262c2d597ab71f226af6beb499ae950645 + checksum: 10/439e6fadab3df3c21adfd651af4e605e1020c86c8c2400b0127c2ee914646bc73945b4add31ca7201cafeead261ad2958362c339ebdfc0798064d56daeb60661 languageName: node linkType: hard -"@typescript-eslint/types@npm:7.0.2": - version: 7.0.2 - resolution: "@typescript-eslint/types@npm:7.0.2" - checksum: 10/2cba8a0355cc7357db142fa597d02cf39e1d1cb0ec87c80e91daaa2b87f2a794d2649def9d7b2aa435691c3810d2cbd4cdc21668b19b991863f0d54d4a22da82 +"@typescript-eslint/types@npm:7.1.0": + version: 7.1.0 + resolution: "@typescript-eslint/types@npm:7.1.0" + checksum: 10/34801a14ea1444a1707de5bd3211f0ea53afc82a3c6c4543092f123267389da607c498d1a7de554ac9f071e6ef488238728a5f279ff2abaa0cbdfaa733899b67 languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:7.0.2": - version: 7.0.2 - resolution: "@typescript-eslint/typescript-estree@npm:7.0.2" +"@typescript-eslint/typescript-estree@npm:7.1.0": + version: 7.1.0 + resolution: "@typescript-eslint/typescript-estree@npm:7.1.0" dependencies: - "@typescript-eslint/types": "npm:7.0.2" - "@typescript-eslint/visitor-keys": "npm:7.0.2" + "@typescript-eslint/types": "npm:7.1.0" + "@typescript-eslint/visitor-keys": "npm:7.1.0" debug: "npm:^4.3.4" globby: "npm:^11.1.0" is-glob: "npm:^4.0.3" @@ -4647,34 +4647,34 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 10/307080e29c22fc69f0ce7ab7101e1629e05f45a9e541c250e03d06b61336ab0ccb5f0a7354ee3da4e38d5cade4dd2fb7bb396cd7cbe74c2c4b3e29706a70abcc + checksum: 10/7dfc6fc70ff00875728ce5d85a3c5d6cb01435082b20ff9301ebe4d8e4a31a0c997282c762c636937bd66a40b4e0154e2ce98f85d888a6c46d433e9a24c46c4c languageName: node linkType: hard -"@typescript-eslint/utils@npm:7.0.2": - version: 7.0.2 - resolution: "@typescript-eslint/utils@npm:7.0.2" +"@typescript-eslint/utils@npm:7.1.0": + version: 7.1.0 + resolution: "@typescript-eslint/utils@npm:7.1.0" dependencies: "@eslint-community/eslint-utils": "npm:^4.4.0" "@types/json-schema": "npm:^7.0.12" "@types/semver": "npm:^7.5.0" - "@typescript-eslint/scope-manager": "npm:7.0.2" - "@typescript-eslint/types": "npm:7.0.2" - "@typescript-eslint/typescript-estree": "npm:7.0.2" + "@typescript-eslint/scope-manager": "npm:7.1.0" + "@typescript-eslint/types": "npm:7.1.0" + "@typescript-eslint/typescript-estree": "npm:7.1.0" semver: "npm:^7.5.4" peerDependencies: eslint: ^8.56.0 - checksum: 10/e68bac777419cd529371f7f29f534efaeca130c90ed9723bfc7aac451d61ca3fc4ebd310e2c015e29e8dc7be4734ae46258ca8755897d7f5e3bb502660d5372f + checksum: 10/26d64094d8b828ce6cfea660c95cdbd4d0193d338646fc773312093388bc781653fc1ca16977b3be5288579fe43f14c7108fc431da66dd95b6ed680ad44712a0 languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:7.0.2": - version: 7.0.2 - resolution: "@typescript-eslint/visitor-keys@npm:7.0.2" +"@typescript-eslint/visitor-keys@npm:7.1.0": + version: 7.1.0 + resolution: "@typescript-eslint/visitor-keys@npm:7.1.0" dependencies: - "@typescript-eslint/types": "npm:7.0.2" + "@typescript-eslint/types": "npm:7.1.0" eslint-visitor-keys: "npm:^3.4.1" - checksum: 10/da6c1b0729af99216cde3a65d4e91584a81fc6c9dff7ba291089f01bf7262de375f58c4c4246e5fbc29f51258db7725d9c830f82ccbd1cda812fd13c51480cda + checksum: 10/c3e98ebf166fd1854adb0e9599dc108cdbbd95f6eb099d31deae2fd1d4df8fcd8dc9c24ad4f509b961ad900b474c246f6b4b228b5711cc504106c3e0f751a11c languageName: node linkType: hard @@ -9686,8 +9686,8 @@ __metadata: "@types/tar": "npm:6.1.11" "@types/ua-parser-js": "npm:0.7.39" "@types/webspeechapi": "npm:0.0.29" - "@typescript-eslint/eslint-plugin": "npm:7.0.2" - "@typescript-eslint/parser": "npm:7.0.2" + "@typescript-eslint/eslint-plugin": "npm:7.1.0" + "@typescript-eslint/parser": "npm:7.1.0" "@vaadin/combo-box": "npm:24.3.7" "@vaadin/vaadin-themable-mixin": "npm:24.3.7" "@vibrant/color": "npm:3.2.1-alpha.1" From ec0434c9b01041c8945e5d3efef74fe379e75ae5 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 1 Mar 2024 11:58:00 +0100 Subject: [PATCH 005/401] Update dependency hls.js to v1.5.7 (#19927) Co-authored-by: renovate[bot] <29139614+renovate[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 8f3eb3a9ce..94ef362df5 100644 --- a/package.json +++ b/package.json @@ -110,7 +110,7 @@ "element-internals-polyfill": "1.3.10", "fuse.js": "7.0.0", "google-timezones-json": "1.2.0", - "hls.js": "1.5.6", + "hls.js": "1.5.7", "home-assistant-js-websocket": "9.1.0", "idb-keyval": "6.2.1", "intl-messageformat": "10.5.11", diff --git a/yarn.lock b/yarn.lock index 9893206ce2..2553804a27 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9576,10 +9576,10 @@ __metadata: languageName: node linkType: hard -"hls.js@npm:1.5.6": - version: 1.5.6 - resolution: "hls.js@npm:1.5.6" - checksum: 10/795c1d41b5ee682a48c21a78fa995ab8aa2b5badf84593eb12965b0fc58050ca5330df36a115946b8757dff558ba172f9210bb2896b12241416e069269e15d95 +"hls.js@npm:1.5.7": + version: 1.5.7 + resolution: "hls.js@npm:1.5.7" + checksum: 10/8d863a56f3674ccf11eaf214005c57e2df13c51e7a7064b2f239ff2aca8aaac11571b86769f007f29c4034bc92fad8dd889e28670d07d7000e8953c40dbfcff9 languageName: node linkType: hard @@ -9735,7 +9735,7 @@ __metadata: gulp-merge-json: "npm:2.1.2" gulp-rename: "npm:2.0.0" gulp-zopfli-green: "npm:6.0.1" - hls.js: "npm:1.5.6" + hls.js: "npm:1.5.7" home-assistant-js-websocket: "npm:9.1.0" html-minifier-terser: "npm:7.2.0" husky: "npm:9.0.11" From 5463a272555bda16ab985531d141e9b2e63be864 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Fri, 1 Mar 2024 13:09:10 +0100 Subject: [PATCH 006/401] Add badges support to sections view (#19929) --- src/panels/lovelace/views/const.ts | 6 +----- src/panels/lovelace/views/hui-masonry-view.ts | 6 ------ src/panels/lovelace/views/hui-sections-view.ts | 13 ++++++++++++- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/panels/lovelace/views/const.ts b/src/panels/lovelace/views/const.ts index 5633f05bbc..fb68615fd8 100644 --- a/src/panels/lovelace/views/const.ts +++ b/src/panels/lovelace/views/const.ts @@ -2,8 +2,4 @@ export const DEFAULT_VIEW_LAYOUT = "masonry"; export const PANEL_VIEW_LAYOUT = "panel"; export const SIDEBAR_VIEW_LAYOUT = "sidebar"; export const SECTION_VIEW_LAYOUT = "sections"; -export const VIEWS_NO_BADGE_SUPPORT = [ - PANEL_VIEW_LAYOUT, - SIDEBAR_VIEW_LAYOUT, - SECTION_VIEW_LAYOUT, -]; +export const VIEWS_NO_BADGE_SUPPORT = [PANEL_VIEW_LAYOUT, SIDEBAR_VIEW_LAYOUT]; diff --git a/src/panels/lovelace/views/hui-masonry-view.ts b/src/panels/lovelace/views/hui-masonry-view.ts index bcc87214e3..c8e3047c2d 100644 --- a/src/panels/lovelace/views/hui-masonry-view.ts +++ b/src/panels/lovelace/views/hui-masonry-view.ts @@ -291,12 +291,6 @@ export class MasonryView extends LitElement implements LovelaceViewElement { padding-top: 4px; } - .badges { - margin: 8px 16px; - font-size: 85%; - text-align: center; - } - #columns { display: flex; flex-direction: row; diff --git a/src/panels/lovelace/views/hui-sections-view.ts b/src/panels/lovelace/views/hui-sections-view.ts index cbf5af8570..71c612808e 100644 --- a/src/panels/lovelace/views/hui-sections-view.ts +++ b/src/panels/lovelace/views/hui-sections-view.ts @@ -20,7 +20,7 @@ import { updateLovelaceContainer, } from "../editor/lovelace-path"; import { HuiSection } from "../sections/hui-section"; -import type { Lovelace } from "../types"; +import type { Lovelace, LovelaceBadge } from "../types"; @customElement("hui-sections-view") export class SectionsView extends LitElement implements LovelaceViewElement { @@ -34,6 +34,8 @@ export class SectionsView extends LitElement implements LovelaceViewElement { @property({ attribute: false }) public sections: HuiSection[] = []; + @property({ attribute: false }) public badges: LovelaceBadge[] = []; + @state() private _config?: LovelaceViewConfig; public setConfig(config: LovelaceViewConfig): void { @@ -57,6 +59,9 @@ export class SectionsView extends LitElement implements LovelaceViewElement { const editMode = this.lovelace.editMode; return html` + ${this.badges.length > 0 + ? html`
${this.badges}
` + : ""} Date: Fri, 1 Mar 2024 13:09:21 +0100 Subject: [PATCH 007/401] Use max column count instead of max width for section grid (#19932) --- .../lovelace/views/hui-sections-view.ts | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/panels/lovelace/views/hui-sections-view.ts b/src/panels/lovelace/views/hui-sections-view.ts index 71c612808e..2e2320fa54 100644 --- a/src/panels/lovelace/views/hui-sections-view.ts +++ b/src/panels/lovelace/views/hui-sections-view.ts @@ -73,8 +73,8 @@ export class SectionsView extends LitElement implements LovelaceViewElement {
@@ -249,26 +249,28 @@ export class SectionsView extends LitElement implements LovelaceViewElement { } .container { + /* Inputs */ --grid-gap: 20px; - --grid-max-width: 1400px; - --grid-cell-max-width: 500px; - --grid-cell-min-width: 320px; + --grid-max-section-count: 4; + --grid-section-min-width: 320px; + + /* Calculated */ + --max-count: min(var(--section-count), var(--grid-max-section-count)); + --grid-max-width: calc( + (var(--max-count) + 1) * var(--grid-section-min-width) + + (var(--max-count) + 2) * var(--grid-gap) - 1px + ); + display: grid; grid-template-columns: repeat( auto-fit, - minmax(var(--grid-cell-min-width), 1fr) + minmax(var(--grid-section-min-width), 1fr) ); + grid-gap: 8px var(--grid-gap); justify-content: center; - gap: 8px var(--grid-gap); padding: var(--grid-gap); box-sizing: border-box; - max-width: min( - calc( - var(--cell-count) * (var(--grid-cell-max-width) + var(--grid-gap)) + - var(--grid-gap) - ), - var(--grid-max-width) - ); + max-width: var(--grid-max-width); margin: 0 auto; } From 3abdffda9cb06fb3757d6e03601b7f15c1c4b99c Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Fri, 1 Mar 2024 14:55:34 +0100 Subject: [PATCH 008/401] Transform helper to warning for edit view type --- .../view-editor/hui-dialog-edit-view.ts | 34 ++++++++++++++++++- .../editor/view-editor/hui-view-editor.ts | 22 ++---------- src/translations/en.json | 4 +-- 3 files changed, 37 insertions(+), 23 deletions(-) diff --git a/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts b/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts index 038680b049..a4ba863a12 100644 --- a/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts +++ b/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts @@ -57,6 +57,8 @@ import { EditViewDialogParams } from "./show-edit-view-dialog"; export class HuiDialogEditView extends LitElement { @property({ attribute: false }) public hass?: HomeAssistant; + @state() private _currentType?: string; + @state() private _params?: EditViewDialogParams; @state() private _config?: LovelaceViewConfig; @@ -111,6 +113,7 @@ export class HuiDialogEditView extends LitElement { this._badges = []; return; } + this._currentType = view.type; const { badges, ...viewConfig } = view; this._config = viewConfig; this._badges = badges ? processEditorEntities(badges) : []; @@ -211,6 +214,15 @@ export class HuiDialogEditView extends LitElement { } } + const isEmpty = + !this._config?.cards?.length && !this._config?.sections?.length; + + const isCompatibleViewType = + isEmpty || + (this._currentType === SECTION_VIEW_LAYOUT + ? this._config?.type === SECTION_VIEW_LAYOUT + : this._config?.type !== SECTION_VIEW_LAYOUT); + return html` ` : nothing} + ${!isCompatibleViewType + ? html` + + ${this._config?.type === SECTION_VIEW_LAYOUT + ? this.hass!.localize( + "ui.panel.lovelace.editor.edit_view.type_warning_sections" + ) + : this.hass!.localize( + "ui.panel.lovelace.editor.edit_view.type_warning_others" + )} + + ` + : nothing} ${this._saving @@ -554,6 +582,10 @@ export class HuiDialogEditView extends LitElement { margin: 12px 16px; flex-wrap: wrap; } + .incompatible { + display: block; + margin-top: 16px; + } @media all and (min-width: 600px) { ha-dialog { diff --git a/src/panels/lovelace/editor/view-editor/hui-view-editor.ts b/src/panels/lovelace/editor/view-editor/hui-view-editor.ts index 803cdea063..b22dc61d68 100644 --- a/src/panels/lovelace/editor/view-editor/hui-view-editor.ts +++ b/src/panels/lovelace/editor/view-editor/hui-view-editor.ts @@ -37,7 +37,7 @@ export class HuiViewEditor extends LitElement { private _suggestedPath = false; private _schema = memoizeOne( - (localize: LocalizeFunc, currentType: string, isNew: boolean) => + (localize: LocalizeFunc) => [ { name: "title", selector: { text: {} } }, { @@ -64,11 +64,6 @@ export class HuiViewEditor extends LitElement { label: localize( `ui.panel.lovelace.editor.edit_view.types.${type}` ), - disabled: - !isNew && - (currentType === SECTION_VIEW_LAYOUT - ? type !== SECTION_VIEW_LAYOUT - : type === SECTION_VIEW_LAYOUT), })), }, }, @@ -95,16 +90,12 @@ export class HuiViewEditor extends LitElement { : this._config.type || DEFAULT_VIEW_LAYOUT; } - private get _isEmpty(): boolean { - return !this._config.sections?.length && !this._config.cards?.length; - } - protected render() { if (!this.hass) { return nothing; } - const schema = this._schema(this.hass.localize, this._type, this._isEmpty); + const schema = this._schema(this.hass.localize); const data = { ...this._config, @@ -168,15 +159,6 @@ export class HuiViewEditor extends LitElement { return this.hass.localize( "ui.panel.lovelace.editor.edit_view.subview_helper" ); - case "type": - if (this._isEmpty) return undefined; - return this._type === "sections" - ? this.hass.localize( - "ui.panel.lovelace.editor.edit_view.type_helper_others" - ) - : this.hass.localize( - "ui.panel.lovelace.editor.edit_view.type_helper_sections" - ); default: return undefined; } diff --git a/src/translations/en.json b/src/translations/en.json index daa0884853..ff714e0144 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -5135,8 +5135,8 @@ "select_users": "Select which users should see this view in the navigation" }, "type": "View type", - "type_helper_sections": "You can not change your view to use the 'sections' view type because migration is not supported yet. Start from scratch with a new view if you want to experiment with the 'sections' view.", - "type_helper_others": "You can not change your view to an other type because migration is not supported yet. Start from scratch with a new view if you want to use another view type.", + "type_warning_sections": "You can not change your view to use the 'sections' view type because migration is not supported yet. Start from scratch with a new view if you want to experiment with the 'sections' view.", + "type_warning_others": "You can not change your view to an other type because migration is not supported yet. Start from scratch with a new view if you want to use another view type.", "types": { "masonry": "Masonry (default)", From c05824c6413982fbfd61d2bff40be1a73e70a685 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Fri, 1 Mar 2024 14:57:08 +0100 Subject: [PATCH 009/401] Revert "Transform helper to warning for edit view type" This reverts commit 3abdffda9cb06fb3757d6e03601b7f15c1c4b99c. --- .../view-editor/hui-dialog-edit-view.ts | 34 +------------------ .../editor/view-editor/hui-view-editor.ts | 22 ++++++++++-- src/translations/en.json | 4 +-- 3 files changed, 23 insertions(+), 37 deletions(-) diff --git a/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts b/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts index a4ba863a12..038680b049 100644 --- a/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts +++ b/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts @@ -57,8 +57,6 @@ import { EditViewDialogParams } from "./show-edit-view-dialog"; export class HuiDialogEditView extends LitElement { @property({ attribute: false }) public hass?: HomeAssistant; - @state() private _currentType?: string; - @state() private _params?: EditViewDialogParams; @state() private _config?: LovelaceViewConfig; @@ -113,7 +111,6 @@ export class HuiDialogEditView extends LitElement { this._badges = []; return; } - this._currentType = view.type; const { badges, ...viewConfig } = view; this._config = viewConfig; this._badges = badges ? processEditorEntities(badges) : []; @@ -214,15 +211,6 @@ export class HuiDialogEditView extends LitElement { } } - const isEmpty = - !this._config?.cards?.length && !this._config?.sections?.length; - - const isCompatibleViewType = - isEmpty || - (this._currentType === SECTION_VIEW_LAYOUT - ? this._config?.type === SECTION_VIEW_LAYOUT - : this._config?.type !== SECTION_VIEW_LAYOUT); - return html` ` : nothing} - ${!isCompatibleViewType - ? html` - - ${this._config?.type === SECTION_VIEW_LAYOUT - ? this.hass!.localize( - "ui.panel.lovelace.editor.edit_view.type_warning_sections" - ) - : this.hass!.localize( - "ui.panel.lovelace.editor.edit_view.type_warning_others" - )} - - ` - : nothing} ${this._saving @@ -582,10 +554,6 @@ export class HuiDialogEditView extends LitElement { margin: 12px 16px; flex-wrap: wrap; } - .incompatible { - display: block; - margin-top: 16px; - } @media all and (min-width: 600px) { ha-dialog { diff --git a/src/panels/lovelace/editor/view-editor/hui-view-editor.ts b/src/panels/lovelace/editor/view-editor/hui-view-editor.ts index b22dc61d68..803cdea063 100644 --- a/src/panels/lovelace/editor/view-editor/hui-view-editor.ts +++ b/src/panels/lovelace/editor/view-editor/hui-view-editor.ts @@ -37,7 +37,7 @@ export class HuiViewEditor extends LitElement { private _suggestedPath = false; private _schema = memoizeOne( - (localize: LocalizeFunc) => + (localize: LocalizeFunc, currentType: string, isNew: boolean) => [ { name: "title", selector: { text: {} } }, { @@ -64,6 +64,11 @@ export class HuiViewEditor extends LitElement { label: localize( `ui.panel.lovelace.editor.edit_view.types.${type}` ), + disabled: + !isNew && + (currentType === SECTION_VIEW_LAYOUT + ? type !== SECTION_VIEW_LAYOUT + : type === SECTION_VIEW_LAYOUT), })), }, }, @@ -90,12 +95,16 @@ export class HuiViewEditor extends LitElement { : this._config.type || DEFAULT_VIEW_LAYOUT; } + private get _isEmpty(): boolean { + return !this._config.sections?.length && !this._config.cards?.length; + } + protected render() { if (!this.hass) { return nothing; } - const schema = this._schema(this.hass.localize); + const schema = this._schema(this.hass.localize, this._type, this._isEmpty); const data = { ...this._config, @@ -159,6 +168,15 @@ export class HuiViewEditor extends LitElement { return this.hass.localize( "ui.panel.lovelace.editor.edit_view.subview_helper" ); + case "type": + if (this._isEmpty) return undefined; + return this._type === "sections" + ? this.hass.localize( + "ui.panel.lovelace.editor.edit_view.type_helper_others" + ) + : this.hass.localize( + "ui.panel.lovelace.editor.edit_view.type_helper_sections" + ); default: return undefined; } diff --git a/src/translations/en.json b/src/translations/en.json index ff714e0144..daa0884853 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -5135,8 +5135,8 @@ "select_users": "Select which users should see this view in the navigation" }, "type": "View type", - "type_warning_sections": "You can not change your view to use the 'sections' view type because migration is not supported yet. Start from scratch with a new view if you want to experiment with the 'sections' view.", - "type_warning_others": "You can not change your view to an other type because migration is not supported yet. Start from scratch with a new view if you want to use another view type.", + "type_helper_sections": "You can not change your view to use the 'sections' view type because migration is not supported yet. Start from scratch with a new view if you want to experiment with the 'sections' view.", + "type_helper_others": "You can not change your view to an other type because migration is not supported yet. Start from scratch with a new view if you want to use another view type.", "types": { "masonry": "Masonry (default)", From 329a8c0c907b31b097d2d2d743791e4f9e9578c1 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Fri, 1 Mar 2024 15:31:25 +0100 Subject: [PATCH 010/401] Transform helper to warning for edit view type (#19934) --- .../view-editor/hui-dialog-edit-view.ts | 34 ++++++++++++++++++- .../editor/view-editor/hui-view-editor.ts | 22 ++---------- src/translations/en.json | 4 +-- 3 files changed, 37 insertions(+), 23 deletions(-) diff --git a/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts b/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts index 038680b049..a4ba863a12 100644 --- a/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts +++ b/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts @@ -57,6 +57,8 @@ import { EditViewDialogParams } from "./show-edit-view-dialog"; export class HuiDialogEditView extends LitElement { @property({ attribute: false }) public hass?: HomeAssistant; + @state() private _currentType?: string; + @state() private _params?: EditViewDialogParams; @state() private _config?: LovelaceViewConfig; @@ -111,6 +113,7 @@ export class HuiDialogEditView extends LitElement { this._badges = []; return; } + this._currentType = view.type; const { badges, ...viewConfig } = view; this._config = viewConfig; this._badges = badges ? processEditorEntities(badges) : []; @@ -211,6 +214,15 @@ export class HuiDialogEditView extends LitElement { } } + const isEmpty = + !this._config?.cards?.length && !this._config?.sections?.length; + + const isCompatibleViewType = + isEmpty || + (this._currentType === SECTION_VIEW_LAYOUT + ? this._config?.type === SECTION_VIEW_LAYOUT + : this._config?.type !== SECTION_VIEW_LAYOUT); + return html` ` : nothing} + ${!isCompatibleViewType + ? html` + + ${this._config?.type === SECTION_VIEW_LAYOUT + ? this.hass!.localize( + "ui.panel.lovelace.editor.edit_view.type_warning_sections" + ) + : this.hass!.localize( + "ui.panel.lovelace.editor.edit_view.type_warning_others" + )} + + ` + : nothing} ${this._saving @@ -554,6 +582,10 @@ export class HuiDialogEditView extends LitElement { margin: 12px 16px; flex-wrap: wrap; } + .incompatible { + display: block; + margin-top: 16px; + } @media all and (min-width: 600px) { ha-dialog { diff --git a/src/panels/lovelace/editor/view-editor/hui-view-editor.ts b/src/panels/lovelace/editor/view-editor/hui-view-editor.ts index 803cdea063..b22dc61d68 100644 --- a/src/panels/lovelace/editor/view-editor/hui-view-editor.ts +++ b/src/panels/lovelace/editor/view-editor/hui-view-editor.ts @@ -37,7 +37,7 @@ export class HuiViewEditor extends LitElement { private _suggestedPath = false; private _schema = memoizeOne( - (localize: LocalizeFunc, currentType: string, isNew: boolean) => + (localize: LocalizeFunc) => [ { name: "title", selector: { text: {} } }, { @@ -64,11 +64,6 @@ export class HuiViewEditor extends LitElement { label: localize( `ui.panel.lovelace.editor.edit_view.types.${type}` ), - disabled: - !isNew && - (currentType === SECTION_VIEW_LAYOUT - ? type !== SECTION_VIEW_LAYOUT - : type === SECTION_VIEW_LAYOUT), })), }, }, @@ -95,16 +90,12 @@ export class HuiViewEditor extends LitElement { : this._config.type || DEFAULT_VIEW_LAYOUT; } - private get _isEmpty(): boolean { - return !this._config.sections?.length && !this._config.cards?.length; - } - protected render() { if (!this.hass) { return nothing; } - const schema = this._schema(this.hass.localize, this._type, this._isEmpty); + const schema = this._schema(this.hass.localize); const data = { ...this._config, @@ -168,15 +159,6 @@ export class HuiViewEditor extends LitElement { return this.hass.localize( "ui.panel.lovelace.editor.edit_view.subview_helper" ); - case "type": - if (this._isEmpty) return undefined; - return this._type === "sections" - ? this.hass.localize( - "ui.panel.lovelace.editor.edit_view.type_helper_others" - ) - : this.hass.localize( - "ui.panel.lovelace.editor.edit_view.type_helper_sections" - ); default: return undefined; } diff --git a/src/translations/en.json b/src/translations/en.json index daa0884853..ff714e0144 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -5135,8 +5135,8 @@ "select_users": "Select which users should see this view in the navigation" }, "type": "View type", - "type_helper_sections": "You can not change your view to use the 'sections' view type because migration is not supported yet. Start from scratch with a new view if you want to experiment with the 'sections' view.", - "type_helper_others": "You can not change your view to an other type because migration is not supported yet. Start from scratch with a new view if you want to use another view type.", + "type_warning_sections": "You can not change your view to use the 'sections' view type because migration is not supported yet. Start from scratch with a new view if you want to experiment with the 'sections' view.", + "type_warning_others": "You can not change your view to an other type because migration is not supported yet. Start from scratch with a new view if you want to use another view type.", "types": { "masonry": "Masonry (default)", From 3202ea55d23eb3efd5fae34888e88da825d7f54b Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Fri, 1 Mar 2024 15:41:56 +0100 Subject: [PATCH 011/401] Bumped version to 20240301.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 15c83c13a4..c15f5c2579 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "home-assistant-frontend" -version = "20240228.0" +version = "20240301.0" license = {text = "Apache-2.0"} description = "The Home Assistant frontend" readme = "README.md" From 39bd07de73e52c92ef29ce02fddf17ee44d7ff0a Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Fri, 1 Mar 2024 15:59:01 +0100 Subject: [PATCH 012/401] Revert "Bumped version to 20240301.0" This reverts commit 3202ea55d23eb3efd5fae34888e88da825d7f54b. --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c15f5c2579..15c83c13a4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "home-assistant-frontend" -version = "20240301.0" +version = "20240228.0" license = {text = "Apache-2.0"} description = "The Home Assistant frontend" readme = "README.md" From 67d8765624efdb09c6e7a21103dd73a8bfc8be8f Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Fri, 1 Mar 2024 13:09:10 +0100 Subject: [PATCH 013/401] Add badges support to sections view (#19929) --- src/panels/lovelace/views/const.ts | 6 +----- src/panels/lovelace/views/hui-masonry-view.ts | 6 ------ src/panels/lovelace/views/hui-sections-view.ts | 13 ++++++++++++- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/panels/lovelace/views/const.ts b/src/panels/lovelace/views/const.ts index 5633f05bbc..fb68615fd8 100644 --- a/src/panels/lovelace/views/const.ts +++ b/src/panels/lovelace/views/const.ts @@ -2,8 +2,4 @@ export const DEFAULT_VIEW_LAYOUT = "masonry"; export const PANEL_VIEW_LAYOUT = "panel"; export const SIDEBAR_VIEW_LAYOUT = "sidebar"; export const SECTION_VIEW_LAYOUT = "sections"; -export const VIEWS_NO_BADGE_SUPPORT = [ - PANEL_VIEW_LAYOUT, - SIDEBAR_VIEW_LAYOUT, - SECTION_VIEW_LAYOUT, -]; +export const VIEWS_NO_BADGE_SUPPORT = [PANEL_VIEW_LAYOUT, SIDEBAR_VIEW_LAYOUT]; diff --git a/src/panels/lovelace/views/hui-masonry-view.ts b/src/panels/lovelace/views/hui-masonry-view.ts index bcc87214e3..c8e3047c2d 100644 --- a/src/panels/lovelace/views/hui-masonry-view.ts +++ b/src/panels/lovelace/views/hui-masonry-view.ts @@ -291,12 +291,6 @@ export class MasonryView extends LitElement implements LovelaceViewElement { padding-top: 4px; } - .badges { - margin: 8px 16px; - font-size: 85%; - text-align: center; - } - #columns { display: flex; flex-direction: row; diff --git a/src/panels/lovelace/views/hui-sections-view.ts b/src/panels/lovelace/views/hui-sections-view.ts index cbf5af8570..71c612808e 100644 --- a/src/panels/lovelace/views/hui-sections-view.ts +++ b/src/panels/lovelace/views/hui-sections-view.ts @@ -20,7 +20,7 @@ import { updateLovelaceContainer, } from "../editor/lovelace-path"; import { HuiSection } from "../sections/hui-section"; -import type { Lovelace } from "../types"; +import type { Lovelace, LovelaceBadge } from "../types"; @customElement("hui-sections-view") export class SectionsView extends LitElement implements LovelaceViewElement { @@ -34,6 +34,8 @@ export class SectionsView extends LitElement implements LovelaceViewElement { @property({ attribute: false }) public sections: HuiSection[] = []; + @property({ attribute: false }) public badges: LovelaceBadge[] = []; + @state() private _config?: LovelaceViewConfig; public setConfig(config: LovelaceViewConfig): void { @@ -57,6 +59,9 @@ export class SectionsView extends LitElement implements LovelaceViewElement { const editMode = this.lovelace.editMode; return html` + ${this.badges.length > 0 + ? html`
${this.badges}
` + : ""} Date: Fri, 1 Mar 2024 13:09:21 +0100 Subject: [PATCH 014/401] Use max column count instead of max width for section grid (#19932) --- .../lovelace/views/hui-sections-view.ts | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/panels/lovelace/views/hui-sections-view.ts b/src/panels/lovelace/views/hui-sections-view.ts index 71c612808e..2e2320fa54 100644 --- a/src/panels/lovelace/views/hui-sections-view.ts +++ b/src/panels/lovelace/views/hui-sections-view.ts @@ -73,8 +73,8 @@ export class SectionsView extends LitElement implements LovelaceViewElement {
@@ -249,26 +249,28 @@ export class SectionsView extends LitElement implements LovelaceViewElement { } .container { + /* Inputs */ --grid-gap: 20px; - --grid-max-width: 1400px; - --grid-cell-max-width: 500px; - --grid-cell-min-width: 320px; + --grid-max-section-count: 4; + --grid-section-min-width: 320px; + + /* Calculated */ + --max-count: min(var(--section-count), var(--grid-max-section-count)); + --grid-max-width: calc( + (var(--max-count) + 1) * var(--grid-section-min-width) + + (var(--max-count) + 2) * var(--grid-gap) - 1px + ); + display: grid; grid-template-columns: repeat( auto-fit, - minmax(var(--grid-cell-min-width), 1fr) + minmax(var(--grid-section-min-width), 1fr) ); + grid-gap: 8px var(--grid-gap); justify-content: center; - gap: 8px var(--grid-gap); padding: var(--grid-gap); box-sizing: border-box; - max-width: min( - calc( - var(--cell-count) * (var(--grid-cell-max-width) + var(--grid-gap)) + - var(--grid-gap) - ), - var(--grid-max-width) - ); + max-width: var(--grid-max-width); margin: 0 auto; } From de8b0ba8c5e6b49a9d283cb16dce50bdbee3084d Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Fri, 1 Mar 2024 15:31:25 +0100 Subject: [PATCH 015/401] Transform helper to warning for edit view type (#19934) --- .../view-editor/hui-dialog-edit-view.ts | 34 ++++++++++++++++++- .../editor/view-editor/hui-view-editor.ts | 22 ++---------- src/translations/en.json | 4 +-- 3 files changed, 37 insertions(+), 23 deletions(-) diff --git a/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts b/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts index 038680b049..a4ba863a12 100644 --- a/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts +++ b/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts @@ -57,6 +57,8 @@ import { EditViewDialogParams } from "./show-edit-view-dialog"; export class HuiDialogEditView extends LitElement { @property({ attribute: false }) public hass?: HomeAssistant; + @state() private _currentType?: string; + @state() private _params?: EditViewDialogParams; @state() private _config?: LovelaceViewConfig; @@ -111,6 +113,7 @@ export class HuiDialogEditView extends LitElement { this._badges = []; return; } + this._currentType = view.type; const { badges, ...viewConfig } = view; this._config = viewConfig; this._badges = badges ? processEditorEntities(badges) : []; @@ -211,6 +214,15 @@ export class HuiDialogEditView extends LitElement { } } + const isEmpty = + !this._config?.cards?.length && !this._config?.sections?.length; + + const isCompatibleViewType = + isEmpty || + (this._currentType === SECTION_VIEW_LAYOUT + ? this._config?.type === SECTION_VIEW_LAYOUT + : this._config?.type !== SECTION_VIEW_LAYOUT); + return html` ` : nothing} + ${!isCompatibleViewType + ? html` + + ${this._config?.type === SECTION_VIEW_LAYOUT + ? this.hass!.localize( + "ui.panel.lovelace.editor.edit_view.type_warning_sections" + ) + : this.hass!.localize( + "ui.panel.lovelace.editor.edit_view.type_warning_others" + )} + + ` + : nothing} ${this._saving @@ -554,6 +582,10 @@ export class HuiDialogEditView extends LitElement { margin: 12px 16px; flex-wrap: wrap; } + .incompatible { + display: block; + margin-top: 16px; + } @media all and (min-width: 600px) { ha-dialog { diff --git a/src/panels/lovelace/editor/view-editor/hui-view-editor.ts b/src/panels/lovelace/editor/view-editor/hui-view-editor.ts index 803cdea063..b22dc61d68 100644 --- a/src/panels/lovelace/editor/view-editor/hui-view-editor.ts +++ b/src/panels/lovelace/editor/view-editor/hui-view-editor.ts @@ -37,7 +37,7 @@ export class HuiViewEditor extends LitElement { private _suggestedPath = false; private _schema = memoizeOne( - (localize: LocalizeFunc, currentType: string, isNew: boolean) => + (localize: LocalizeFunc) => [ { name: "title", selector: { text: {} } }, { @@ -64,11 +64,6 @@ export class HuiViewEditor extends LitElement { label: localize( `ui.panel.lovelace.editor.edit_view.types.${type}` ), - disabled: - !isNew && - (currentType === SECTION_VIEW_LAYOUT - ? type !== SECTION_VIEW_LAYOUT - : type === SECTION_VIEW_LAYOUT), })), }, }, @@ -95,16 +90,12 @@ export class HuiViewEditor extends LitElement { : this._config.type || DEFAULT_VIEW_LAYOUT; } - private get _isEmpty(): boolean { - return !this._config.sections?.length && !this._config.cards?.length; - } - protected render() { if (!this.hass) { return nothing; } - const schema = this._schema(this.hass.localize, this._type, this._isEmpty); + const schema = this._schema(this.hass.localize); const data = { ...this._config, @@ -168,15 +159,6 @@ export class HuiViewEditor extends LitElement { return this.hass.localize( "ui.panel.lovelace.editor.edit_view.subview_helper" ); - case "type": - if (this._isEmpty) return undefined; - return this._type === "sections" - ? this.hass.localize( - "ui.panel.lovelace.editor.edit_view.type_helper_others" - ) - : this.hass.localize( - "ui.panel.lovelace.editor.edit_view.type_helper_sections" - ); default: return undefined; } diff --git a/src/translations/en.json b/src/translations/en.json index c8c1b42c79..9b52c4299b 100644 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -5112,8 +5112,8 @@ "select_users": "Select which users should see this view in the navigation" }, "type": "View type", - "type_helper_sections": "You can not change your view to use the 'sections' view type because migration is not supported yet. Start from scratch with a new view if you want to experiment with the 'sections' view.", - "type_helper_others": "You can not change your view to an other type because migration is not supported yet. Start from scratch with a new view if you want to use another view type.", + "type_warning_sections": "You can not change your view to use the 'sections' view type because migration is not supported yet. Start from scratch with a new view if you want to experiment with the 'sections' view.", + "type_warning_others": "You can not change your view to an other type because migration is not supported yet. Start from scratch with a new view if you want to use another view type.", "types": { "masonry": "Masonry (default)", From 69dbcec678b02513af896b59c08a50c21ffaec9b Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Fri, 1 Mar 2024 16:15:03 +0100 Subject: [PATCH 016/401] Bumped version to 20240301.0 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a725ab6ed3..c15f5c2579 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "home-assistant-frontend" -version = "20240228.1" +version = "20240301.0" license = {text = "Apache-2.0"} description = "The Home Assistant frontend" readme = "README.md" From 3d8654253ae857a2a41497f7104170f0cf644daa Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 1 Mar 2024 21:31:44 -0500 Subject: [PATCH 017/401] Update octokit monorepo (#19941) --- package.json | 4 ++-- yarn.lock | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 94ef362df5..6bd5c5a462 100644 --- a/package.json +++ b/package.json @@ -159,8 +159,8 @@ "@bundle-stats/plugin-webpack-filter": "4.10.1", "@koa/cors": "5.0.0", "@lokalise/node-api": "12.1.0", - "@octokit/auth-oauth-device": "7.0.0", - "@octokit/plugin-retry": "7.0.1", + "@octokit/auth-oauth-device": "7.0.1", + "@octokit/plugin-retry": "7.0.2", "@octokit/rest": "20.0.2", "@open-wc/dev-server-hmr": "0.1.4", "@rollup/plugin-babel": "6.0.4", diff --git a/yarn.lock b/yarn.lock index 2553804a27..744d9e1a48 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3234,15 +3234,15 @@ __metadata: languageName: node linkType: hard -"@octokit/auth-oauth-device@npm:7.0.0": - version: 7.0.0 - resolution: "@octokit/auth-oauth-device@npm:7.0.0" +"@octokit/auth-oauth-device@npm:7.0.1": + version: 7.0.1 + resolution: "@octokit/auth-oauth-device@npm:7.0.1" dependencies: "@octokit/oauth-methods": "npm:^5.0.0" "@octokit/request": "npm:^9.0.0" "@octokit/types": "npm:^12.0.0" universal-user-agent: "npm:^7.0.0" - checksum: 10/74124b097c6af43e23b84012257210e6c1cc08c97620b5861d45661d52b448bc5e8d3c78309c7a7e878627ceac12e125b7bfe20a11e1ed8754afb90410737f9e + checksum: 10/410051ec666bc9792a9080f9c15c035adda113539db6bd9783e30046bae0297b92b8faab83e04e8ae5c0d9f7260fd516de733b6a4f3ac0cce80fa7462e2b322b languageName: node linkType: hard @@ -3357,16 +3357,16 @@ __metadata: languageName: node linkType: hard -"@octokit/plugin-retry@npm:7.0.1": - version: 7.0.1 - resolution: "@octokit/plugin-retry@npm:7.0.1" +"@octokit/plugin-retry@npm:7.0.2": + version: 7.0.2 + resolution: "@octokit/plugin-retry@npm:7.0.2" dependencies: "@octokit/request-error": "npm:^5.0.0" "@octokit/types": "npm:^12.0.0" bottleneck: "npm:^2.15.3" peerDependencies: "@octokit/core": ">=6" - checksum: 10/38182a9b537d39692302e7595e286e05435556fefc74daa5125e1369fe8256a9dd8c2423f7138ee881f36d404caf53b43f6d4be0821bb7ed095cb99979b558a9 + checksum: 10/dfb753fb3c51c02458d24be95599c69620f29a8304e6dc1b0a7ac024fed28ed96a001639f65e8ceb36557cbc57d968c60eba4288e281ad111eb15956c9c3c199 languageName: node linkType: hard @@ -9655,8 +9655,8 @@ __metadata: "@material/web": "npm:=1.3.0" "@mdi/js": "npm:7.4.47" "@mdi/svg": "npm:7.4.47" - "@octokit/auth-oauth-device": "npm:7.0.0" - "@octokit/plugin-retry": "npm:7.0.1" + "@octokit/auth-oauth-device": "npm:7.0.1" + "@octokit/plugin-retry": "npm:7.0.2" "@octokit/rest": "npm:20.0.2" "@open-wc/dev-server-hmr": "npm:0.1.4" "@polymer/paper-item": "npm:3.0.1" From 94e70f81edb58bb8ad270a20d31cf9880be677e3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 2 Mar 2024 15:00:33 -0500 Subject: [PATCH 018/401] Update dependency chart.js to v4.4.2 (#19947) Co-authored-by: renovate[bot] <29139614+renovate[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 6bd5c5a462..763ba01d5b 100644 --- a/package.json +++ b/package.json @@ -98,7 +98,7 @@ "@webcomponents/scoped-custom-element-registry": "0.0.9", "@webcomponents/webcomponentsjs": "2.8.0", "app-datepicker": "5.1.1", - "chart.js": "4.4.1", + "chart.js": "4.4.2", "color-name": "2.0.0", "comlink": "4.4.1", "core-js": "3.36.0", diff --git a/yarn.lock b/yarn.lock index 744d9e1a48..b5bf90604d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6480,12 +6480,12 @@ __metadata: languageName: node linkType: hard -"chart.js@npm:4.4.1": - version: 4.4.1 - resolution: "chart.js@npm:4.4.1" +"chart.js@npm:4.4.2": + version: 4.4.2 + resolution: "chart.js@npm:4.4.2" dependencies: "@kurkle/color": "npm:^0.3.0" - checksum: 10/bb58247349ed04b6a38c4c4b45d953d87dab40ecd70dd796da302cbcebf866dfc1ecf7bd32d95ecb44b89dccf9a4cfc6ff84f74ba69b024be9b5bd19b2930fbc + checksum: 10/609444dfc9e847e4c891884309d6083464333e39a7266996fa15f622a44d0c5202c20c86b3bfb1d72b3769096f71c80e131860270c39ce1291cac52b9f45dc6d languageName: node linkType: hard @@ -9702,7 +9702,7 @@ __metadata: babel-loader: "npm:9.1.3" babel-plugin-template-html-minifier: "npm:4.1.0" chai: "npm:5.1.0" - chart.js: "npm:4.4.1" + chart.js: "npm:4.4.2" color-name: "npm:2.0.0" comlink: "npm:4.4.1" core-js: "npm:3.36.0" From a7867a9253227c7874f49f9cfd7ba1c408d184d0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sat, 2 Mar 2024 21:38:07 -0500 Subject: [PATCH 019/401] Update babel monorepo to v7.24.0 (#19945) --- package.json | 10 +-- yarn.lock | 168 +++++++++++++++++++++++++-------------------------- 2 files changed, 89 insertions(+), 89 deletions(-) diff --git a/package.json b/package.json index 763ba01d5b..ec80af06f2 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,7 @@ "license": "Apache-2.0", "type": "module", "dependencies": { - "@babel/runtime": "7.23.9", + "@babel/runtime": "7.24.0", "@braintree/sanitize-url": "7.0.0", "@codemirror/autocomplete": "6.12.0", "@codemirror/commands": "6.3.3", @@ -150,11 +150,11 @@ "xss": "1.0.14" }, "devDependencies": { - "@babel/core": "7.23.9", + "@babel/core": "7.24.0", "@babel/helper-define-polyfill-provider": "0.5.0", - "@babel/plugin-proposal-decorators": "7.23.9", - "@babel/plugin-transform-runtime": "7.23.9", - "@babel/preset-env": "7.23.9", + "@babel/plugin-proposal-decorators": "7.24.0", + "@babel/plugin-transform-runtime": "7.24.0", + "@babel/preset-env": "7.24.0", "@babel/preset-typescript": "7.23.3", "@bundle-stats/plugin-webpack-filter": "4.10.1", "@koa/cors": "5.0.0", diff --git a/yarn.lock b/yarn.lock index b5bf90604d..035aaf5d10 100644 --- a/yarn.lock +++ b/yarn.lock @@ -55,33 +55,33 @@ __metadata: languageName: node linkType: hard -"@babel/compat-data@npm:^7.22.6, @babel/compat-data@npm:^7.23.3, @babel/compat-data@npm:^7.23.5": +"@babel/compat-data@npm:^7.22.6, @babel/compat-data@npm:^7.23.5": version: 7.23.5 resolution: "@babel/compat-data@npm:7.23.5" checksum: 10/088f14f646ecbddd5ef89f120a60a1b3389a50a9705d44603dca77662707d0175a5e0e0da3943c3298f1907a4ab871468656fbbf74bb7842cd8b0686b2c19736 languageName: node linkType: hard -"@babel/core@npm:7.23.9, @babel/core@npm:^7.0.0, @babel/core@npm:^7.11.1, @babel/core@npm:^7.12.3": - version: 7.23.9 - resolution: "@babel/core@npm:7.23.9" +"@babel/core@npm:7.24.0, @babel/core@npm:^7.0.0, @babel/core@npm:^7.11.1, @babel/core@npm:^7.12.3": + version: 7.24.0 + resolution: "@babel/core@npm:7.24.0" dependencies: "@ampproject/remapping": "npm:^2.2.0" "@babel/code-frame": "npm:^7.23.5" "@babel/generator": "npm:^7.23.6" "@babel/helper-compilation-targets": "npm:^7.23.6" "@babel/helper-module-transforms": "npm:^7.23.3" - "@babel/helpers": "npm:^7.23.9" - "@babel/parser": "npm:^7.23.9" - "@babel/template": "npm:^7.23.9" - "@babel/traverse": "npm:^7.23.9" - "@babel/types": "npm:^7.23.9" + "@babel/helpers": "npm:^7.24.0" + "@babel/parser": "npm:^7.24.0" + "@babel/template": "npm:^7.24.0" + "@babel/traverse": "npm:^7.24.0" + "@babel/types": "npm:^7.24.0" convert-source-map: "npm:^2.0.0" debug: "npm:^4.1.0" gensync: "npm:^1.0.0-beta.2" json5: "npm:^2.2.3" semver: "npm:^6.3.1" - checksum: 10/268cdbb86bef1b8ea5b1300f2f325e56a1740a5051360cb228ffeaa0f80282b6674f3a2b4d6466adb0691183759b88d4c37b4a4f77232c84a49ed771c84cdc27 + checksum: 10/1e22215cc89e061e0cbfed72f265ad24d363f3e9b24b51e9c4cf3ccb9222260a29a1c1e62edb439cb7e2229a3fce924edd43300500416613236c13fc8d62a947 languageName: node linkType: hard @@ -128,9 +128,9 @@ __metadata: languageName: node linkType: hard -"@babel/helper-create-class-features-plugin@npm:^7.22.15, @babel/helper-create-class-features-plugin@npm:^7.23.9": - version: 7.23.9 - resolution: "@babel/helper-create-class-features-plugin@npm:7.23.9" +"@babel/helper-create-class-features-plugin@npm:^7.22.15, @babel/helper-create-class-features-plugin@npm:^7.24.0": + version: 7.24.0 + resolution: "@babel/helper-create-class-features-plugin@npm:7.24.0" dependencies: "@babel/helper-annotate-as-pure": "npm:^7.22.5" "@babel/helper-environment-visitor": "npm:^7.22.20" @@ -143,7 +143,7 @@ __metadata: semver: "npm:^6.3.1" peerDependencies: "@babel/core": ^7.0.0 - checksum: 10/91c8aa8888780bd90aa50f511917cb0953ccd61b2ea4abf61915c1d68d99bb14b472969a8ae5b391d7890759dfc22be79104297be07919c38351714a4ce2fe74 + checksum: 10/de74a2689ca35d7c11a9080e8f3cd68e36d2a3fc254d3d826d1eb45bc9a3354c093dd830b5dde067acc8ff7a50d9c1f9d826fb75b546d280c6e821059976ab79 languageName: node linkType: hard @@ -243,10 +243,10 @@ __metadata: languageName: node linkType: hard -"@babel/helper-plugin-utils@npm:^7.0.0, @babel/helper-plugin-utils@npm:^7.10.4, @babel/helper-plugin-utils@npm:^7.12.13, @babel/helper-plugin-utils@npm:^7.14.5, @babel/helper-plugin-utils@npm:^7.18.6, @babel/helper-plugin-utils@npm:^7.22.5, @babel/helper-plugin-utils@npm:^7.8.0, @babel/helper-plugin-utils@npm:^7.8.3": - version: 7.22.5 - resolution: "@babel/helper-plugin-utils@npm:7.22.5" - checksum: 10/ab220db218089a2aadd0582f5833fd17fa300245999f5f8784b10f5a75267c4e808592284a29438a0da365e702f05acb369f99e1c915c02f9f9210ec60eab8ea +"@babel/helper-plugin-utils@npm:^7.0.0, @babel/helper-plugin-utils@npm:^7.10.4, @babel/helper-plugin-utils@npm:^7.12.13, @babel/helper-plugin-utils@npm:^7.14.5, @babel/helper-plugin-utils@npm:^7.18.6, @babel/helper-plugin-utils@npm:^7.22.5, @babel/helper-plugin-utils@npm:^7.24.0, @babel/helper-plugin-utils@npm:^7.8.0, @babel/helper-plugin-utils@npm:^7.8.3": + version: 7.24.0 + resolution: "@babel/helper-plugin-utils@npm:7.24.0" + checksum: 10/dc8c7af321baf7653d93315beffee1790eb2c464b4f529273a24c8743a3f3095bf3f2d11828cb2c52d56282ef43a4bdc67a79c9ab8dd845e35d01871f3f28a0e languageName: node linkType: hard @@ -335,14 +335,14 @@ __metadata: languageName: node linkType: hard -"@babel/helpers@npm:^7.23.9": - version: 7.23.9 - resolution: "@babel/helpers@npm:7.23.9" +"@babel/helpers@npm:^7.24.0": + version: 7.24.0 + resolution: "@babel/helpers@npm:7.24.0" dependencies: - "@babel/template": "npm:^7.23.9" - "@babel/traverse": "npm:^7.23.9" - "@babel/types": "npm:^7.23.9" - checksum: 10/dd56daac8bbd7ed174bb00fd185926fd449e591d9a00edaceb7ac6edbdd7a8db57e2cb365b4fafda382201752789ced2f7ae010f667eab0f198a4571cda4d2c5 + "@babel/template": "npm:^7.24.0" + "@babel/traverse": "npm:^7.24.0" + "@babel/types": "npm:^7.24.0" + checksum: 10/cc82012161b30185c2698da359c7311cf019f0932f8fcb805e985fec9e0053c354f0534dc9961f3170eee579df6724eecd34b0f5ffaa155cdd456af59fbff86e languageName: node linkType: hard @@ -357,12 +357,12 @@ __metadata: languageName: node linkType: hard -"@babel/parser@npm:^7.23.5, @babel/parser@npm:^7.23.9": - version: 7.23.9 - resolution: "@babel/parser@npm:7.23.9" +"@babel/parser@npm:^7.23.5, @babel/parser@npm:^7.24.0": + version: 7.24.0 + resolution: "@babel/parser@npm:7.24.0" bin: parser: ./bin/babel-parser.js - checksum: 10/727a7a807100f6a26df859e2f009c4ddbd0d3363287b45daa50bd082ccd0d431d0c4d0e610a91f806e04a1918726cd0f5a0592c9b902a815337feed12e1cafd9 + checksum: 10/3e5ebb903a6f71629a9d0226743e37fe3d961e79911d2698b243637f66c4df7e3e0a42c07838bc0e7cc9fcd585d9be8f4134a145b9459ee4a459420fb0d1360b languageName: node linkType: hard @@ -402,16 +402,16 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-proposal-decorators@npm:7.23.9": - version: 7.23.9 - resolution: "@babel/plugin-proposal-decorators@npm:7.23.9" +"@babel/plugin-proposal-decorators@npm:7.24.0": + version: 7.24.0 + resolution: "@babel/plugin-proposal-decorators@npm:7.24.0" dependencies: - "@babel/helper-create-class-features-plugin": "npm:^7.23.9" - "@babel/helper-plugin-utils": "npm:^7.22.5" - "@babel/plugin-syntax-decorators": "npm:^7.23.3" + "@babel/helper-create-class-features-plugin": "npm:^7.24.0" + "@babel/helper-plugin-utils": "npm:^7.24.0" + "@babel/plugin-syntax-decorators": "npm:^7.24.0" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10/256a060d2346da10afdcc32d3c4939183bd8865367a64893c739174c4d247b586204dd0b7927d20e90f73714ac7d7a1a5f4740f827ef8e0277697bd626df59dc + checksum: 10/c35eab2e5c2c3f75253f599edc6d78eaa8525f97e68febac32ef1d68fba9dd51b8ff887ebee3f4713d120e14eb26b4a41c6fca7ec1656138a5d0767ab98e8642 languageName: node linkType: hard @@ -457,14 +457,14 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-syntax-decorators@npm:^7.23.3": - version: 7.23.3 - resolution: "@babel/plugin-syntax-decorators@npm:7.23.3" +"@babel/plugin-syntax-decorators@npm:^7.24.0": + version: 7.24.0 + resolution: "@babel/plugin-syntax-decorators@npm:7.24.0" dependencies: - "@babel/helper-plugin-utils": "npm:^7.22.5" + "@babel/helper-plugin-utils": "npm:^7.24.0" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10/5856e236f7ae15a58c839fd40df1aa4df31029048df01191b4870c34b1bff44c77fbee78ca5edd8eb3c81410005d8f9a36a9cf48094f2bb328592304a738648a + checksum: 10/2f09c5545715cea7b92848a3917cb1483b0a736b6451cca03adfe78f63263e647aefac686a8f44d8ee6ee4466704bea6cd80277dbceff5efc86b90e83b459a34 languageName: node linkType: hard @@ -1010,18 +1010,18 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-object-rest-spread@npm:^7.23.4": - version: 7.23.4 - resolution: "@babel/plugin-transform-object-rest-spread@npm:7.23.4" +"@babel/plugin-transform-object-rest-spread@npm:^7.24.0": + version: 7.24.0 + resolution: "@babel/plugin-transform-object-rest-spread@npm:7.24.0" dependencies: - "@babel/compat-data": "npm:^7.23.3" - "@babel/helper-compilation-targets": "npm:^7.22.15" - "@babel/helper-plugin-utils": "npm:^7.22.5" + "@babel/compat-data": "npm:^7.23.5" + "@babel/helper-compilation-targets": "npm:^7.23.6" + "@babel/helper-plugin-utils": "npm:^7.24.0" "@babel/plugin-syntax-object-rest-spread": "npm:^7.8.3" "@babel/plugin-transform-parameters": "npm:^7.23.3" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10/656f09c4ec629856e807d5b386559166ae417ff75943abce19656b2c6de5101dfd0aaf23f9074e854339370b4e09f57518d3202457046ee5b567ded531005479 + checksum: 10/1dfafd9461723769b29f724fcbdca974c4280f68a9e03c8ff412643ffe88930755f093f9cbf919cdb6d0d53751614892dd2882bccad286e14e9e995c5a8242ed languageName: node linkType: hard @@ -1133,19 +1133,19 @@ __metadata: languageName: node linkType: hard -"@babel/plugin-transform-runtime@npm:7.23.9": - version: 7.23.9 - resolution: "@babel/plugin-transform-runtime@npm:7.23.9" +"@babel/plugin-transform-runtime@npm:7.24.0": + version: 7.24.0 + resolution: "@babel/plugin-transform-runtime@npm:7.24.0" dependencies: "@babel/helper-module-imports": "npm:^7.22.15" - "@babel/helper-plugin-utils": "npm:^7.22.5" + "@babel/helper-plugin-utils": "npm:^7.24.0" babel-plugin-polyfill-corejs2: "npm:^0.4.8" babel-plugin-polyfill-corejs3: "npm:^0.9.0" babel-plugin-polyfill-regenerator: "npm:^0.5.5" semver: "npm:^6.3.1" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10/d942e5852f100d0de5021c4d1fda9e30c28b94aa846e09588476dd82c058fb6869a30be0cf915362bf23b5f3504aa150ca3c3b0299dbd0a86b3b1f5f744c2333 + checksum: 10/162c59982d1c6df45458c6a449f305d1b61b113bb2bbdad6bb19e41390749f118edb225f68bedf90ae1e8d32abefe7314480ad1ca770bc916cd15c46724a1458 languageName: node linkType: hard @@ -1266,13 +1266,13 @@ __metadata: languageName: node linkType: hard -"@babel/preset-env@npm:7.23.9, @babel/preset-env@npm:^7.0.0, @babel/preset-env@npm:^7.11.0": - version: 7.23.9 - resolution: "@babel/preset-env@npm:7.23.9" +"@babel/preset-env@npm:7.24.0, @babel/preset-env@npm:^7.0.0, @babel/preset-env@npm:^7.11.0": + version: 7.24.0 + resolution: "@babel/preset-env@npm:7.24.0" dependencies: "@babel/compat-data": "npm:^7.23.5" "@babel/helper-compilation-targets": "npm:^7.23.6" - "@babel/helper-plugin-utils": "npm:^7.22.5" + "@babel/helper-plugin-utils": "npm:^7.24.0" "@babel/helper-validator-option": "npm:^7.23.5" "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "npm:^7.23.3" "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "npm:^7.23.3" @@ -1325,7 +1325,7 @@ __metadata: "@babel/plugin-transform-new-target": "npm:^7.23.3" "@babel/plugin-transform-nullish-coalescing-operator": "npm:^7.23.4" "@babel/plugin-transform-numeric-separator": "npm:^7.23.4" - "@babel/plugin-transform-object-rest-spread": "npm:^7.23.4" + "@babel/plugin-transform-object-rest-spread": "npm:^7.24.0" "@babel/plugin-transform-object-super": "npm:^7.23.3" "@babel/plugin-transform-optional-catch-binding": "npm:^7.23.4" "@babel/plugin-transform-optional-chaining": "npm:^7.23.4" @@ -1352,7 +1352,7 @@ __metadata: semver: "npm:^6.3.1" peerDependencies: "@babel/core": ^7.0.0-0 - checksum: 10/0214ac9434a2496eac7f56c0c91164421232ff2083a66e1ccab633ca91e262828e54a5cbdb9036e8fe53d53530b6597aa98c99de8ff07b5193ffd95f21dc9d2c + checksum: 10/88bca150a09e658124997178ee1ff375a9aceecfd70ec11c7ccc12e82f5be5f7ff2ddfefba5b10fb617891645f92949392b350509de9742d2aa138f42959e190 languageName: node linkType: hard @@ -1391,29 +1391,29 @@ __metadata: languageName: node linkType: hard -"@babel/runtime@npm:7.23.9, @babel/runtime@npm:^7.10.2, @babel/runtime@npm:^7.11.2, @babel/runtime@npm:^7.21.0, @babel/runtime@npm:^7.7.2, @babel/runtime@npm:^7.8.4": - version: 7.23.9 - resolution: "@babel/runtime@npm:7.23.9" +"@babel/runtime@npm:7.24.0, @babel/runtime@npm:^7.10.2, @babel/runtime@npm:^7.11.2, @babel/runtime@npm:^7.21.0, @babel/runtime@npm:^7.7.2, @babel/runtime@npm:^7.8.4": + version: 7.24.0 + resolution: "@babel/runtime@npm:7.24.0" dependencies: regenerator-runtime: "npm:^0.14.0" - checksum: 10/9a520fe1bf72249f7dd60ff726434251858de15cccfca7aa831bd19d0d3fb17702e116ead82724659b8da3844977e5e13de2bae01eb8a798f2823a669f122be6 + checksum: 10/8d32c7e116606ea322b89f9fde8ffae6be9503b549dc0d0abb38bd9dc26e87469b9fb7a66964cc089ee558fd0a97d304fb0a3cfec140694764fb0d71b6a6f5e4 languageName: node linkType: hard -"@babel/template@npm:^7.22.15, @babel/template@npm:^7.23.9": - version: 7.23.9 - resolution: "@babel/template@npm:7.23.9" +"@babel/template@npm:^7.22.15, @babel/template@npm:^7.24.0": + version: 7.24.0 + resolution: "@babel/template@npm:7.24.0" dependencies: "@babel/code-frame": "npm:^7.23.5" - "@babel/parser": "npm:^7.23.9" - "@babel/types": "npm:^7.23.9" - checksum: 10/1b011ba9354dc2e646561d54b6862e0df51760e6179faadd79be05825b0b6da04911e4e192df943f1766748da3037fd8493615b38707f7cadb0cf0c96601c170 + "@babel/parser": "npm:^7.24.0" + "@babel/types": "npm:^7.24.0" + checksum: 10/8c538338c7de8fac8ada691a5a812bdcbd60bd4a4eb5adae2cc9ee19773e8fb1a724312a00af9e1ce49056ffd3c3475e7287b5668cf6360bfb3f8ac827a06ffe languageName: node linkType: hard -"@babel/traverse@npm:^7.23.9": - version: 7.23.9 - resolution: "@babel/traverse@npm:7.23.9" +"@babel/traverse@npm:^7.24.0": + version: 7.24.0 + resolution: "@babel/traverse@npm:7.24.0" dependencies: "@babel/code-frame": "npm:^7.23.5" "@babel/generator": "npm:^7.23.6" @@ -1421,22 +1421,22 @@ __metadata: "@babel/helper-function-name": "npm:^7.23.0" "@babel/helper-hoist-variables": "npm:^7.22.5" "@babel/helper-split-export-declaration": "npm:^7.22.6" - "@babel/parser": "npm:^7.23.9" - "@babel/types": "npm:^7.23.9" + "@babel/parser": "npm:^7.24.0" + "@babel/types": "npm:^7.24.0" debug: "npm:^4.3.1" globals: "npm:^11.1.0" - checksum: 10/e2bb845f7f229feb7c338f7e150f5f1abc5395dcd3a6a47f63a25242ec3ec6b165f04a6df7d4849468547faee34eb3cf52487eb0bd867a7d3c42fec2a648266f + checksum: 10/5cc482248ebb79adcbcf021aab4e0e95bafe2a1736ee4b46abe6f88b59848ad73e15e219db8f06c9a33a14c64257e5b47e53876601e998a8c596accb1b7f4996 languageName: node linkType: hard -"@babel/types@npm:^7.22.15, @babel/types@npm:^7.22.19, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.0, @babel/types@npm:^7.23.6, @babel/types@npm:^7.23.9, @babel/types@npm:^7.4.4, @babel/types@npm:^7.8.3": - version: 7.23.9 - resolution: "@babel/types@npm:7.23.9" +"@babel/types@npm:^7.22.15, @babel/types@npm:^7.22.19, @babel/types@npm:^7.22.5, @babel/types@npm:^7.23.0, @babel/types@npm:^7.23.6, @babel/types@npm:^7.24.0, @babel/types@npm:^7.4.4, @babel/types@npm:^7.8.3": + version: 7.24.0 + resolution: "@babel/types@npm:7.24.0" dependencies: "@babel/helper-string-parser": "npm:^7.23.4" "@babel/helper-validator-identifier": "npm:^7.22.20" to-fast-properties: "npm:^2.0.0" - checksum: 10/bed9634e5fd0f9dc63c84cfa83316c4cb617192db9fedfea464fca743affe93736d7bf2ebf418ee8358751a9d388e303af87a0c050cb5d87d5870c1b0154f6cb + checksum: 10/a0b4875ce2e132f9daff0d5b27c7f4c4fcc97f2b084bdc5834e92c9d32592778489029e65d99d00c406da612d87b72d7a236c0afccaa1435c028d0c94c9b6da4 languageName: node linkType: hard @@ -9587,13 +9587,13 @@ __metadata: version: 0.0.0-use.local resolution: "home-assistant-frontend@workspace:." dependencies: - "@babel/core": "npm:7.23.9" + "@babel/core": "npm:7.24.0" "@babel/helper-define-polyfill-provider": "npm:0.5.0" - "@babel/plugin-proposal-decorators": "npm:7.23.9" - "@babel/plugin-transform-runtime": "npm:7.23.9" - "@babel/preset-env": "npm:7.23.9" + "@babel/plugin-proposal-decorators": "npm:7.24.0" + "@babel/plugin-transform-runtime": "npm:7.24.0" + "@babel/preset-env": "npm:7.24.0" "@babel/preset-typescript": "npm:7.23.3" - "@babel/runtime": "npm:7.23.9" + "@babel/runtime": "npm:7.24.0" "@braintree/sanitize-url": "npm:7.0.0" "@bundle-stats/plugin-webpack-filter": "npm:4.10.1" "@codemirror/autocomplete": "npm:6.12.0" From edbe6851f768296b2fba3f254a554cc0cadf638e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 3 Mar 2024 12:42:30 -0500 Subject: [PATCH 020/401] Update dependency @types/chromecast-caf-sender to v1.0.9 (#19960) --- package.json | 2 +- yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index ec80af06f2..8cb0f065f3 100644 --- a/package.json +++ b/package.json @@ -170,7 +170,7 @@ "@rollup/plugin-replace": "5.0.5", "@types/babel__plugin-transform-runtime": "7.9.5", "@types/chromecast-caf-receiver": "6.0.13", - "@types/chromecast-caf-sender": "1.0.8", + "@types/chromecast-caf-sender": "1.0.9", "@types/color-name": "1.1.3", "@types/glob": "8.1.0", "@types/html-minifier-terser": "7.0.2", diff --git a/yarn.lock b/yarn.lock index 035aaf5d10..0fb7286dd7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4020,12 +4020,12 @@ __metadata: languageName: node linkType: hard -"@types/chromecast-caf-sender@npm:1.0.8": - version: 1.0.8 - resolution: "@types/chromecast-caf-sender@npm:1.0.8" +"@types/chromecast-caf-sender@npm:1.0.9": + version: 1.0.9 + resolution: "@types/chromecast-caf-sender@npm:1.0.9" dependencies: "@types/chrome": "npm:*" - checksum: 10/68a2d7c7e4668756e7895c81c4edf59bfbd58be30196dd73bac411d56b2fa60c33eac0afdda9b6219ca2512fb7ef93d9cc86c18064465e22e6e3bd0907b09199 + checksum: 10/a3a3f1bb3da0f56901d5606cec7ab7c375d6d039d4e5e7e669c9630bb1beee10c7f1fc04512bc959b8a91047f4414df00287db351bf305a6d37b476bb3d6df98 languageName: node linkType: hard @@ -9671,7 +9671,7 @@ __metadata: "@thomasloven/round-slider": "npm:0.6.0" "@types/babel__plugin-transform-runtime": "npm:7.9.5" "@types/chromecast-caf-receiver": "npm:6.0.13" - "@types/chromecast-caf-sender": "npm:1.0.8" + "@types/chromecast-caf-sender": "npm:1.0.9" "@types/color-name": "npm:1.1.3" "@types/glob": "npm:8.1.0" "@types/html-minifier-terser": "npm:7.0.2" From 99c2dd976560e4e6123d9071d235c1d8ac2e8017 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 3 Mar 2024 12:43:34 -0500 Subject: [PATCH 021/401] Update dependency @bundle-stats/plugin-webpack-filter to v4.12.0 (#19957) --- package.json | 2 +- yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 8cb0f065f3..e6d21d5a8f 100644 --- a/package.json +++ b/package.json @@ -156,7 +156,7 @@ "@babel/plugin-transform-runtime": "7.24.0", "@babel/preset-env": "7.24.0", "@babel/preset-typescript": "7.23.3", - "@bundle-stats/plugin-webpack-filter": "4.10.1", + "@bundle-stats/plugin-webpack-filter": "4.12.0", "@koa/cors": "5.0.0", "@lokalise/node-api": "12.1.0", "@octokit/auth-oauth-device": "7.0.1", diff --git a/yarn.lock b/yarn.lock index 0fb7286dd7..4c5fdf0978 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1447,12 +1447,12 @@ __metadata: languageName: node linkType: hard -"@bundle-stats/plugin-webpack-filter@npm:4.10.1": - version: 4.10.1 - resolution: "@bundle-stats/plugin-webpack-filter@npm:4.10.1" +"@bundle-stats/plugin-webpack-filter@npm:4.12.0": + version: 4.12.0 + resolution: "@bundle-stats/plugin-webpack-filter@npm:4.12.0" peerDependencies: core-js: ^3.0.0 - checksum: 10/f389188a27a01b8c353bb8b90a3c9fe1eabf4c24ed9f28c52e4063204780490dfd73df109d55ac0b0331a82b61705c0f3dac68b04fe50fcbd0e4e2efff2eda89 + checksum: 10/d0deaad865d234db539db1d3942a82a3d8233179e6a44896d00c049f3f25d9873b0ec6ee9fc11b1a35ed6af7b0d7107e23c97813408d5323259b48d01faa8c73 languageName: node linkType: hard @@ -9595,7 +9595,7 @@ __metadata: "@babel/preset-typescript": "npm:7.23.3" "@babel/runtime": "npm:7.24.0" "@braintree/sanitize-url": "npm:7.0.0" - "@bundle-stats/plugin-webpack-filter": "npm:4.10.1" + "@bundle-stats/plugin-webpack-filter": "npm:4.12.0" "@codemirror/autocomplete": "npm:6.12.0" "@codemirror/commands": "npm:6.3.3" "@codemirror/language": "npm:6.10.1" From 05c1328ca763086cda6dc6831d360f3f0be26d73 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 3 Mar 2024 17:03:18 -0500 Subject: [PATCH 022/401] Update dependency gulp-merge-json to v2.2.1 (#19942) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 2 +- yarn.lock | 101 ++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 92 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index e6d21d5a8f..0739e2e7d3 100644 --- a/package.json +++ b/package.json @@ -210,7 +210,7 @@ "gulp": "4.0.2", "gulp-flatmap": "1.0.2", "gulp-json-transform": "0.5.0", - "gulp-merge-json": "2.1.2", + "gulp-merge-json": "2.2.1", "gulp-rename": "2.0.0", "gulp-zopfli-green": "6.0.1", "html-minifier-terser": "7.2.0", diff --git a/yarn.lock b/yarn.lock index 4c5fdf0978..3f23111d85 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6077,6 +6077,13 @@ __metadata: languageName: node linkType: hard +"bare-events@npm:^2.2.0": + version: 2.2.1 + resolution: "bare-events@npm:2.2.1" + checksum: 10/a2c96a638e5a049960e42660320bcd9e3c5e83da2072e4c05080661219eae744931751be86c814590dcce5107c30cbb60dc2d15097b1b14e2f42db1cd9b80898 + languageName: node + linkType: hard + "base64-js@npm:^1.3.0, base64-js@npm:^1.3.1": version: 1.5.1 resolution: "base64-js@npm:1.5.1" @@ -8486,6 +8493,13 @@ __metadata: languageName: node linkType: hard +"fast-fifo@npm:^1.1.0": + version: 1.3.2 + resolution: "fast-fifo@npm:1.3.2" + checksum: 10/6bfcba3e4df5af7be3332703b69a7898a8ed7020837ec4395bb341bd96cc3a6d86c3f6071dd98da289618cf2234c70d84b2a6f09a33dd6f988b1ff60d8e54275 + languageName: node + linkType: hard + "fast-glob@npm:^3.2.11, fast-glob@npm:^3.2.2, fast-glob@npm:^3.2.9, fast-glob@npm:^3.3.0": version: 3.3.1 resolution: "fast-glob@npm:3.3.1" @@ -9394,16 +9408,17 @@ __metadata: languageName: node linkType: hard -"gulp-merge-json@npm:2.1.2": - version: 2.1.2 - resolution: "gulp-merge-json@npm:2.1.2" +"gulp-merge-json@npm:2.2.1": + version: 2.2.1 + resolution: "gulp-merge-json@npm:2.2.1" dependencies: - json5: "npm:^2.2.1" + json5: "npm:^2.2.3" + lodash.clonedeep: "npm:^4.5.0" lodash.mergewith: "npm:^4.6.1" - plugin-error: "npm:^1.0.1" + plugin-error: "npm:^2.0.1" through: "npm:^2.3.8" - vinyl: "npm:^2.2.1" - checksum: 10/21325538cf882306e13aa4079913eb17d22605b91361d400ea9b7c8917c3b2782020199b219dfbac582205d8104ea283a9c385e32c25125cd456f01e0b0c04e6 + vinyl: "npm:^3.0.0" + checksum: 10/fe87fd2101d0a35f2c5d488d546affaa6115d3be376fcf07b56029eed22ccfa8811206ac8bdf13ff79e5f518d0a65d886506204d2bdc3c0f871dc7cfa82c75eb languageName: node linkType: hard @@ -9732,7 +9747,7 @@ __metadata: gulp: "npm:4.0.2" gulp-flatmap: "npm:1.0.2" gulp-json-transform: "npm:0.5.0" - gulp-merge-json: "npm:2.1.2" + gulp-merge-json: "npm:2.2.1" gulp-rename: "npm:2.0.0" gulp-zopfli-green: "npm:6.0.1" hls.js: "npm:1.5.7" @@ -11038,7 +11053,7 @@ __metadata: languageName: node linkType: hard -"json5@npm:^2.2.0, json5@npm:^2.2.1, json5@npm:^2.2.3": +"json5@npm:^2.2.0, json5@npm:^2.2.3": version: 2.2.3 resolution: "json5@npm:2.2.3" bin: @@ -11540,6 +11555,13 @@ __metadata: languageName: node linkType: hard +"lodash.clonedeep@npm:^4.5.0": + version: 4.5.0 + resolution: "lodash.clonedeep@npm:4.5.0" + checksum: 10/957ed243f84ba6791d4992d5c222ffffca339a3b79dbe81d2eaf0c90504160b500641c5a0f56e27630030b18b8e971ea10b44f928a977d5ced3c8948841b555f + languageName: node + linkType: hard + "lodash.debounce@npm:^4.0.8": version: 4.0.8 resolution: "lodash.debounce@npm:4.0.8" @@ -13212,6 +13234,15 @@ __metadata: languageName: node linkType: hard +"plugin-error@npm:^2.0.1": + version: 2.0.1 + resolution: "plugin-error@npm:2.0.1" + dependencies: + ansi-colors: "npm:^1.0.1" + checksum: 10/9a4f91461cd24cce401112098969991d7aa6b4c94f78e0381234280c07da779570a8b21ab143292b534ec0117c09705a67e5d756c1c303d4706fdd7f861bf5bc + languageName: node + linkType: hard + "pngjs@npm:^3.0.0, pngjs@npm:^3.3.3": version: 3.4.0 resolution: "pngjs@npm:3.4.0" @@ -13432,6 +13463,13 @@ __metadata: languageName: node linkType: hard +"queue-tick@npm:^1.0.1": + version: 1.0.1 + resolution: "queue-tick@npm:1.0.1" + checksum: 10/f447926c513b64a857906f017a3b350f7d11277e3c8d2a21a42b7998fa1a613d7a829091e12d142bb668905c8f68d8103416c7197856efb0c72fa835b8e254b5 + languageName: node + linkType: hard + "randombytes@npm:^2.1.0": version: 2.1.0 resolution: "randombytes@npm:2.1.0" @@ -13703,6 +13741,13 @@ __metadata: languageName: node linkType: hard +"replace-ext@npm:^2.0.0": + version: 2.0.0 + resolution: "replace-ext@npm:2.0.0" + checksum: 10/ed640ac90d24cce4be977642847d138908d430049cc097633be33b072143515cc7d29699675a0c35f6dc3c3c73cb529ed352d59649cf15931740eb31ae083c1e + languageName: node + linkType: hard + "replace-homedir@npm:^1.0.0": version: 1.0.0 resolution: "replace-homedir@npm:1.0.0" @@ -14798,6 +14843,20 @@ __metadata: languageName: node linkType: hard +"streamx@npm:^2.12.5": + version: 2.16.1 + resolution: "streamx@npm:2.16.1" + dependencies: + bare-events: "npm:^2.2.0" + fast-fifo: "npm:^1.1.0" + queue-tick: "npm:^1.0.1" + dependenciesMeta: + bare-events: + optional: true + checksum: 10/f6d0899adf089385d9c58a630fc705dc6c3931b18181c32860e5013955a339a3b763a4df62168f37c7fc56b1f7bb2a38db989fa9df487995278cb5d46f248da6 + languageName: node + linkType: hard + "string-argv@npm:0.3.2": version: 0.3.2 resolution: "string-argv@npm:0.3.2" @@ -15119,6 +15178,15 @@ __metadata: languageName: node linkType: hard +"teex@npm:^1.0.1": + version: 1.0.1 + resolution: "teex@npm:1.0.1" + dependencies: + streamx: "npm:^2.12.5" + checksum: 10/36bf7ce8bb5eb428ad7b14b695ee7fb0a02f09c1a9d8181cc42531208543a920b299d711bf78dad4ff9bcf36ac437ae8e138053734746076e3e0e7d6d76eef64 + languageName: node + linkType: hard + "temp-dir@npm:^2.0.0": version: 2.0.0 resolution: "temp-dir@npm:2.0.0" @@ -16067,7 +16135,7 @@ __metadata: languageName: node linkType: hard -"vinyl@npm:^2.0.0, vinyl@npm:^2.1.0, vinyl@npm:^2.2.1": +"vinyl@npm:^2.0.0, vinyl@npm:^2.1.0": version: 2.2.1 resolution: "vinyl@npm:2.2.1" dependencies: @@ -16081,6 +16149,19 @@ __metadata: languageName: node linkType: hard +"vinyl@npm:^3.0.0": + version: 3.0.0 + resolution: "vinyl@npm:3.0.0" + dependencies: + clone: "npm:^2.1.2" + clone-stats: "npm:^1.0.0" + remove-trailing-separator: "npm:^1.1.0" + replace-ext: "npm:^2.0.0" + teex: "npm:^1.0.1" + checksum: 10/3371947a92c4b65c7adb944b22586480ffc723ec62347d09b64e593193cb523ce5f472d52549f0e0bbfa82db6c320cae46739461594b0602bba0419d0d7800fb + languageName: node + linkType: hard + "vis-data@npm:7.1.9": version: 7.1.9 resolution: "vis-data@npm:7.1.9" From 19d50b9c923cadbff1c1452697168dbce3c9a713 Mon Sep 17 00:00:00 2001 From: karwosts <32912880+karwosts@users.noreply.github.com> Date: Mon, 4 Mar 2024 09:02:32 -0500 Subject: [PATCH 023/401] Support max_devices for energy-devices-detail-graph (#19936) * Support max_devices for energy-devices-detail-graph * responsive ui editor --- .../hui-energy-devices-detail-graph-card.ts | 54 +++++++++++-------- 1 file changed, 33 insertions(+), 21 deletions(-) diff --git a/src/panels/lovelace/cards/energy/hui-energy-devices-detail-graph-card.ts b/src/panels/lovelace/cards/energy/hui-energy-devices-detail-graph-card.ts index 5bd0e8ce33..1d585f2d57 100644 --- a/src/panels/lovelace/cards/energy/hui-energy-devices-detail-graph-card.ts +++ b/src/panels/lovelace/cards/energy/hui-energy-devices-detail-graph-card.ts @@ -96,7 +96,10 @@ export class HuiEnergyDevicesDetailGraphCard } protected willUpdate(changedProps: PropertyValues) { - if (changedProps.has("_hiddenStats") && this._data) { + if ( + (changedProps.has("_hiddenStats") || changedProps.has("_config")) && + this._data + ) { this._processStatistics(); } } @@ -217,17 +220,17 @@ export class HuiEnergyDevicesDetailGraphCard const datasets: ChartDataset<"bar", ScatterDataPoint[]>[] = []; const datasetExtras: ChartDatasetExtra[] = []; - datasets.push( - ...this._processDataSet( + const { data: processedData, dataExtras: processedDataExtras } = + this._processDataSet( data, energyData.statsMetadata, energyData.prefs.device_consumption, sorted_devices - ) - ); + ); - const items = datasets.length; - datasetExtras.push(...Array(items).fill({})); + datasets.push(...processedData); + + datasetExtras.push(...processedDataExtras); if (compareData) { // Add empty dataset to align the bars @@ -247,18 +250,19 @@ export class HuiEnergyDevicesDetailGraphCard show_legend: false, }); - datasets.push( - ...this._processDataSet( - compareData, - energyData.statsMetadata, - energyData.prefs.device_consumption, - sorted_devices, - true - ) - ); - datasetExtras.push( - ...Array(items).fill({ show_legend: false }) + const { + data: processedCompareData, + dataExtras: processedCompareDataExtras, + } = this._processDataSet( + compareData, + energyData.statsMetadata, + energyData.prefs.device_consumption, + sorted_devices, + true ); + + datasets.push(...processedCompareData); + datasetExtras.push(...processedCompareDataExtras); } this._start = energyData.start; @@ -281,6 +285,7 @@ export class HuiEnergyDevicesDetailGraphCard compare = false ) { const data: ChartDataset<"bar", ScatterDataPoint[]>[] = []; + const dataExtras: ChartDatasetExtra[] = []; devices.forEach((source, idx) => { const color = getColorByIndex(idx); @@ -317,23 +322,30 @@ export class HuiEnergyDevicesDetailGraphCard } } + const order = sorted_devices.indexOf(source.stat_consumption); + const itemExceedsMax = !!( + this._config?.max_devices && order >= this._config.max_devices + ); + data.push({ label: getStatisticLabel( this.hass, source.stat_consumption, statisticsMetaData[source.stat_consumption] ), - hidden: this._hiddenStats.has(source.stat_consumption), + hidden: + this._hiddenStats.has(source.stat_consumption) || itemExceedsMax, borderColor: compare ? color + "7F" : color, backgroundColor: compare ? color + "32" : color + "7F", data: consumptionData, - order: 1 + sorted_devices.indexOf(source.stat_consumption), + order: 1 + order, stack: "devices", pointStyle: compare ? false : "circle", xAxisID: compare ? "xAxisCompare" : undefined, }); + dataExtras.push({ show_legend: !compare && !itemExceedsMax }); }); - return data; + return { data, dataExtras }; } static get styles(): CSSResultGroup { From 70146a08c1d6179d6af64162b805ae9750ede4dd Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Mon, 4 Mar 2024 15:04:20 +0100 Subject: [PATCH 024/401] Make migration warning alert sticky at the top for views (#19970) --- .../view-editor/hui-dialog-edit-view.ts | 45 ++++++++----------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts b/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts index a4ba863a12..4d67c4dbf6 100644 --- a/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts +++ b/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts @@ -57,8 +57,6 @@ import { EditViewDialogParams } from "./show-edit-view-dialog"; export class HuiDialogEditView extends LitElement { @property({ attribute: false }) public hass?: HomeAssistant; - @state() private _currentType?: string; - @state() private _params?: EditViewDialogParams; @state() private _config?: LovelaceViewConfig; @@ -113,7 +111,6 @@ export class HuiDialogEditView extends LitElement { this._badges = []; return; } - this._currentType = view.type; const { badges, ...viewConfig } = view; this._config = viewConfig; this._badges = badges ? processEditorEntities(badges) : []; @@ -214,14 +211,12 @@ export class HuiDialogEditView extends LitElement { } } - const isEmpty = - !this._config?.cards?.length && !this._config?.sections?.length; - const isCompatibleViewType = - isEmpty || - (this._currentType === SECTION_VIEW_LAYOUT - ? this._config?.type === SECTION_VIEW_LAYOUT - : this._config?.type !== SECTION_VIEW_LAYOUT); + this._config?.type === SECTION_VIEW_LAYOUT + ? this._config?.type === SECTION_VIEW_LAYOUT && + !this._config?.cards?.length + : this._config?.type !== SECTION_VIEW_LAYOUT && + !this._config?.sections?.length; return html` + ${!isCompatibleViewType + ? html` + + ${this._config?.type === SECTION_VIEW_LAYOUT + ? this.hass!.localize( + "ui.panel.lovelace.editor.edit_view.type_warning_sections" + ) + : this.hass!.localize( + "ui.panel.lovelace.editor.edit_view.type_warning_others" + )} + + ` + : nothing} ${!this._yamlMode ? html` ` : nothing} - ${!isCompatibleViewType - ? html` - - ${this._config?.type === SECTION_VIEW_LAYOUT - ? this.hass!.localize( - "ui.panel.lovelace.editor.edit_view.type_warning_sections" - ) - : this.hass!.localize( - "ui.panel.lovelace.editor.edit_view.type_warning_others" - )} - - ` - : nothing} Date: Mon, 4 Mar 2024 15:04:45 +0100 Subject: [PATCH 025/401] Fix masonry badges not centered (#19972) --- src/panels/lovelace/views/hui-masonry-view.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/panels/lovelace/views/hui-masonry-view.ts b/src/panels/lovelace/views/hui-masonry-view.ts index c8e3047c2d..bcc87214e3 100644 --- a/src/panels/lovelace/views/hui-masonry-view.ts +++ b/src/panels/lovelace/views/hui-masonry-view.ts @@ -291,6 +291,12 @@ export class MasonryView extends LitElement implements LovelaceViewElement { padding-top: 4px; } + .badges { + margin: 8px 16px; + font-size: 85%; + text-align: center; + } + #columns { display: flex; flex-direction: row; From 19a3810168ba015f650c005174c61b0b94170a9b Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Mon, 4 Mar 2024 15:22:04 +0100 Subject: [PATCH 026/401] Add sections dashboard to demo dashboard (#19976) --- demo/src/configs/demo-configs.ts | 1 + demo/src/configs/sections/entities.ts | 482 ++++++++++++++++++ demo/src/configs/sections/index.ts | 12 + demo/src/configs/sections/lovelace.ts | 280 ++++++++++ .../lovelace/sections/hui-grid-section.ts | 1 + 5 files changed, 776 insertions(+) create mode 100644 demo/src/configs/sections/entities.ts create mode 100644 demo/src/configs/sections/index.ts create mode 100644 demo/src/configs/sections/lovelace.ts diff --git a/demo/src/configs/demo-configs.ts b/demo/src/configs/demo-configs.ts index 07dca811f7..dacddf0944 100644 --- a/demo/src/configs/demo-configs.ts +++ b/demo/src/configs/demo-configs.ts @@ -4,6 +4,7 @@ import { energyEntities } from "../stubs/entities"; import { DemoConfig } from "./types"; export const demoConfigs: Array<() => Promise> = [ + () => import("./sections").then((mod) => mod.demoSections), () => import("./arsaboo").then((mod) => mod.demoArsaboo), () => import("./teachingbirds").then((mod) => mod.demoTeachingbirds), () => import("./kernehed").then((mod) => mod.demoKernehed), diff --git a/demo/src/configs/sections/entities.ts b/demo/src/configs/sections/entities.ts new file mode 100644 index 0000000000..ffb7389503 --- /dev/null +++ b/demo/src/configs/sections/entities.ts @@ -0,0 +1,482 @@ +import { convertEntities } from "../../../../src/fake_data/entity"; +import { DemoConfig } from "../types"; + +export const demoEntitiesSections: DemoConfig["entities"] = () => + convertEntities({ + "cover.living_room_garden_shutter": { + entity_id: "cover.living_room_garden_shutter", + state: "open", + attributes: { + current_position: 100, + device_class: "shutter", + friendly_name: "Living room garden shutter", + supported_features: 15, + }, + }, + "cover.living_room_graveyard_shutter": { + entity_id: "cover.living_room_graveyard_shutter", + state: "open", + attributes: { + current_position: 100, + device_class: "shutter", + friendly_name: "Living room graveyard shutter", + supported_features: 15, + }, + }, + "cover.living_room_left_shutter": { + entity_id: "cover.living_room_left_shutter", + state: "open", + attributes: { + current_position: 100, + device_class: "shutter", + friendly_name: "Living room left shutter", + supported_features: 15, + }, + }, + "cover.living_room_right_shutter": { + entity_id: "cover.living_room_right_shutter", + state: "open", + attributes: { + current_position: 100, + device_class: "shutter", + friendly_name: "Living room right shutter", + supported_features: 15, + }, + }, + "light.floor_lamp": { + entity_id: "light.floor_lamp", + state: "on", + attributes: { + min_color_temp_kelvin: 2000, + max_color_temp_kelvin: 6535, + min_mireds: 153, + max_mireds: 500, + supported_color_modes: ["color_temp", "xy"], + color_mode: "color_temp", + brightness: 178, + color_temp_kelvin: 2583, + color_temp: 387, + hs_color: [28.664, 69.597], + rgb_color: [255, 162, 77], + xy_color: [0.538, 0.389], + icon: "mdi:floor-lamp", + friendly_name: "Floor lamp", + supported_features: 44, + }, + }, + "light.living_room_spotlights": { + entity_id: "light.living_room_spotlights", + state: "on", + attributes: { + supported_color_modes: ["brightness"], + color_mode: "brightness", + brightness: 126, + icon: "mdi:ceiling-light-multiple", + friendly_name: "Living room spotlights", + supported_features: 32, + }, + }, + "light.bar_lamp": { + entity_id: "light.bar_lamp", + state: "on", + attributes: { + min_color_temp_kelvin: 2202, + max_color_temp_kelvin: 4504, + min_mireds: 222, + max_mireds: 454, + effect_list: ["None", "candle"], + supported_color_modes: ["color_temp"], + effect: null, + color_mode: null, + brightness: null, + color_temp_kelvin: null, + color_temp: null, + hs_color: null, + rgb_color: null, + xy_color: null, + mode: "normal", + dynamics: "none", + icon: "mdi:lightbulb-variant", + friendly_name: "Bar lamp", + supported_features: 44, + }, + }, + "sensor.living_room_temperature": { + entity_id: "sensor.living_room_temperature", + state: "22.8", + attributes: { + state_class: "measurement", + unit_of_measurement: "°C", + device_class: "temperature", + friendly_name: "Living room Temperature", + }, + }, + "media_player.living_room_nest_mini": { + entity_id: "media_player.living_room_nest_mini", + state: "off", + attributes: { + device_class: "speaker", + friendly_name: "Living room Nest Mini", + supported_features: 152461, + }, + }, + "cover.kitchen_shutter": { + entity_id: "cover.kitchen_shutter", + state: "open", + attributes: { + current_position: 100, + device_class: "shutter", + friendly_name: "Kitchen shutter ", + supported_features: 15, + }, + }, + "light.kitchen_spotlights": { + entity_id: "light.kitchen_spotlights", + state: "off", + attributes: { + supported_color_modes: ["brightness"], + color_mode: null, + brightness: null, + icon: "mdi:ceiling-light-multiple", + friendly_name: "Kitchen spotlights ", + supported_features: 32, + }, + }, + "light.worktop_spotlights": { + entity_id: "light.worktop_spotlights", + state: "off", + attributes: { + supported_color_modes: ["brightness"], + color_mode: null, + brightness: null, + icon: "mdi:ceiling-light-multiple", + friendly_name: "Worktop spotlights ", + supported_features: 32, + }, + }, + "binary_sensor.fridge_door": { + entity_id: "binary_sensor.fridge_door", + state: "off", + attributes: { + device_class: "door", + icon: "mdi:fridge", + friendly_name: "Fridge door", + }, + }, + "media_player.kitchen_nest_audio": { + entity_id: "media_player.kitchen_nest_audio", + state: "on", + attributes: { + device_class: "speaker", + friendly_name: "Kitchen Nest Audio", + supported_features: 152461, + }, + }, + "binary_sensor.tesla_wall_connector_vehicle_connected": { + entity_id: "binary_sensor.tesla_wall_connector_vehicle_connected", + state: "off", + attributes: { + device_class: "plug", + friendly_name: "Wall Connector Vehicle connected", + }, + }, + "sensor.tesla_wall_connector_session_energy": { + entity_id: "sensor.tesla_wall_connector_session_energy", + state: "16.3", + attributes: { + state_class: "total_increasing", + unit_of_measurement: "kWh", + device_class: "energy", + friendly_name: "Tesla Wall Connector Session energy", + }, + }, + "sensor.electric_meter_power": { + entity_id: "sensor.electric_meter_power", + state: "797.86", + attributes: { + state_class: "measurement", + unit_of_measurement: "W", + device_class: "power", + icon: "mdi:meter-electric", + friendly_name: "Electric meter Power", + }, + }, + "sensor.eletric_meter_voltage": { + entity_id: "sensor.eletric_meter_voltage", + state: "232.19", + attributes: { + state_class: "measurement", + unit_of_measurement: "V", + device_class: "voltage", + friendly_name: "Electric meter voltage", + }, + }, + "sensor.electricity_maps_grid_fossil_fuel_percentage": { + entity_id: "sensor.electricity_maps_grid_fossil_fuel_percentage", + state: "9.84", + attributes: { + state_class: "measurement", + country_code: "FR", + unit_of_measurement: "%", + attribution: "Data provided by Electricity Maps", + icon: "mdi:barrel", + friendly_name: "Electricity Maps Grid fossil fuel percentage", + }, + }, + "sensor.electricity_maps_co2_intensity": { + entity_id: "sensor.electricity_maps_co2_intensity", + state: "62.0", + attributes: { + state_class: "measurement", + country_code: "FR", + unit_of_measurement: "gCO2eq/kWh", + attribution: "Data provided by Electricity Maps", + friendly_name: "Electricity Maps CO2 intensity", + }, + }, + "sun.sun": { + entity_id: "sun.sun", + state: "above_horizon", + attributes: { + next_dawn: "2024-03-05T05:50:21.964405+00:00", + next_dusk: "2024-03-04T18:08:54.311334+00:00", + next_midnight: "2024-03-05T00:00:00+00:00", + next_noon: "2024-03-05T12:00:05+00:00", + next_rising: "2024-03-05T06:23:42.739159+00:00", + next_setting: "2024-03-04T17:35:26.271171+00:00", + elevation: 30.38, + azimuth: 204.42, + rising: false, + friendly_name: "Sun", + }, + }, + "sensor.moon_phase": { + entity_id: "sensor.moon_phase", + state: "waning_crescent", + attributes: { + options: [ + "new_moon", + "waxing_crescent", + "first_quarter", + "waxing_gibbous", + "full_moon", + "waning_gibbous", + "last_quarter", + "waning_crescent", + ], + device_class: "enum", + icon: "mdi:moon-waning-crescent", + friendly_name: "Moon Phase", + }, + }, + "climate.ground_floor": { + entity_id: "climate.ground_floor", + state: "heat", + attributes: { + hvac_modes: ["auto", "heat", "off"], + min_temp: 7, + max_temp: 35, + preset_modes: [ + "comfort", + "away", + "eco", + "frost_protection", + "external", + "home", + ], + current_temperature: 20.8, + temperature: 21, + preset_mode: "comfort", + icon: "mdi:home-floor-0", + friendly_name: "Ground floor Thermostat", + supported_features: 401, + }, + }, + "climate.first_floor": { + entity_id: "climate.first_floor", + state: "heat", + attributes: { + hvac_modes: ["auto", "heat", "off"], + min_temp: 7, + max_temp: 35, + preset_modes: [ + "comfort", + "away", + "eco", + "frost_protection", + "external", + "home", + ], + current_temperature: 21.7, + temperature: 21, + preset_mode: "comfort", + icon: "mdi:home-floor-1", + friendly_name: "First floor Thermostat", + supported_features: 401, + }, + }, + "cover.study_shutter": { + entity_id: "cover.study_shutter", + state: "open", + attributes: { + current_position: 100, + device_class: "shutter", + friendly_name: "Study shutter", + supported_features: 15, + }, + }, + "light.study_spotlights": { + entity_id: "light.study_spotlights", + state: "off", + attributes: { + supported_color_modes: ["brightness"], + color_mode: null, + brightness: null, + icon: "mdi:ceiling-light-multiple", + friendly_name: "Study spotlights", + supported_features: 32, + }, + }, + "media_player.study_nest_hub": { + entity_id: "media_player.study_nest_hub", + state: "off", + attributes: { + friendly_name: "Study Nest Hub", + supported_features: 152461, + }, + }, + "sensor.standing_desk_height": { + entity_id: "sensor.standing_desk_height", + state: "72", + attributes: { + unit_of_measurement: "cm", + icon: "mdi:tape-measure", + friendly_name: "Standing desk Height", + }, + }, + "light.outdoor_light": { + entity_id: "light.outdoor_light", + state: "on", + attributes: { + supported_color_modes: ["brightness"], + color_mode: null, + brightness: 255, + icon: "mdi:outdoor-lamp", + friendly_name: "Outdoor light", + supported_features: 32, + }, + }, + "light.flood_light": { + entity_id: "light.flood_light", + state: "off", + attributes: { + effect_list: ["None", "candle"], + supported_color_modes: ["brightness"], + effect: null, + color_mode: null, + brightness: null, + mode: "normal", + dynamics: "none", + icon: "mdi:light-flood-down", + friendly_name: "Flood light", + supported_features: 44, + }, + }, + "sensor.outdoor_motion_sensor_temperature": { + entity_id: "sensor.outdoor_motion_sensor_temperature", + state: "10.2", + attributes: { + state_class: "measurement", + unit_of_measurement: "°C", + device_class: "temperature", + friendly_name: "Outdoor motion sensor Temperature", + }, + }, + "binary_sensor.outdoor_motion_sensor_motion": { + entity_id: "binary_sensor.outdoor_motion_sensor_motion", + state: "off", + attributes: { + device_class: "motion", + friendly_name: "Outdoor motion sensor Motion", + }, + }, + "sensor.outdoor_motion_sensor_illuminance": { + entity_id: "sensor.outdoor_motion_sensor_illuminance", + state: "555", + attributes: { + state_class: "measurement", + light_level: 27444, + unit_of_measurement: "lx", + device_class: "illuminance", + friendly_name: "Outdoor motion sensor Illuminance", + }, + }, + "automation.home_assistant_auto_update": { + entity_id: "automation.home_assistant_auto_update", + state: "off", + attributes: { + id: "1700669321947", + last_triggered: "2024-02-29T18:02:05.343139+00:00", + mode: "queued", + current: 0, + max: 50, + icon: "mdi:auto-mode", + friendly_name: "Home Assistant Auto-update", + }, + }, + "update.home_assistant_operating_system_update": { + entity_id: "update.home_assistant_operating_system_update", + state: "off", + attributes: { + auto_update: false, + installed_version: "12.1", + in_progress: false, + latest_version: "12.1", + release_summary: null, + release_url: + "https://github.com/home-assistant/operating-system/commits/dev", + skipped_version: null, + title: "Home Assistant Operating System", + entity_picture: + "https://brands.home-assistant.io/homeassistant/icon.png", + friendly_name: "Home Assistant Operating System Update", + supported_features: 3, + }, + }, + "update.home_assistant_supervisor_update": { + entity_id: "update.home_assistant_supervisor_update", + state: "off", + attributes: { + auto_update: true, + installed_version: "2024.02.2", + in_progress: false, + latest_version: "2024.02.2", + release_summary: null, + release_url: + "https://github.com/home-assistant/supervisor/commits/main", + skipped_version: null, + title: "Home Assistant Supervisor", + entity_picture: "https://brands.home-assistant.io/hassio/icon.png", + friendly_name: "Home Assistant Supervisor Update", + supported_features: 1, + }, + }, + "update.home_assistant_core_update": { + entity_id: "update.home_assistant_supervisor_update", + state: "off", + attributes: { + auto_update: false, + installed_version: "2024.4.0", + in_progress: false, + latest_version: "2024.4.0", + release_summary: null, + release_url: "https://github.com/home-assistant/core/commits/dev", + skipped_version: null, + title: "Home Assistant Core", + entity_picture: + "https://brands.home-assistant.io/homeassistant/icon.png", + friendly_name: "Home Assistant Core Update", + supported_features: 11, + }, + }, + }); diff --git a/demo/src/configs/sections/index.ts b/demo/src/configs/sections/index.ts new file mode 100644 index 0000000000..39bc7419b8 --- /dev/null +++ b/demo/src/configs/sections/index.ts @@ -0,0 +1,12 @@ +import { DemoConfig } from "../types"; +import { demoEntitiesSections } from "./entities"; +import { demoLovelaceSections } from "./lovelace"; + +export const demoSections: DemoConfig = { + authorName: "Home Assistant", + authorUrl: "https://github.com/home-assistant/frontend/", + name: "Home Demo", + lovelace: demoLovelaceSections, + entities: demoEntitiesSections, + theme: () => ({}), +}; diff --git a/demo/src/configs/sections/lovelace.ts b/demo/src/configs/sections/lovelace.ts new file mode 100644 index 0000000000..197a434a2a --- /dev/null +++ b/demo/src/configs/sections/lovelace.ts @@ -0,0 +1,280 @@ +import { DemoConfig } from "../types"; + +export const demoLovelaceSections: DemoConfig["lovelace"] = () => ({ + title: "Home Assistant Demo", + views: [ + { + type: "sections", + title: "Demo", + path: "home", + icon: "mdi:home-assistant", + sections: [ + { + title: "Welcome 👋", + cards: [{ type: "custom:ha-demo-card" }], + }, + { + cards: [ + { + type: "tile", + entity: "cover.living_room_garden_shutter", + name: "Garden", + }, + { + type: "tile", + entity: "cover.living_room_graveyard_shutter", + name: "Rear", + }, + { + type: "tile", + entity: "cover.living_room_left_shutter", + name: "Left", + }, + { + type: "tile", + entity: "cover.living_room_right_shutter", + name: "Right", + }, + { + type: "tile", + entity: "light.floor_lamp", + }, + { + type: "tile", + entity: "light.living_room_spotlights", + name: "Spotlights", + features: [ + { + type: "light-brightness", + }, + ], + }, + { + type: "tile", + entity: "light.bar_lamp", + }, + { + graph: "line", + type: "sensor", + entity: "sensor.living_room_temperature", + detail: 1, + name: "Temperature", + }, + { + type: "tile", + entity: "media_player.living_room_nest_mini", + name: "Nest Mini", + }, + ], + title: "🛋️ Living room ", + }, + { + type: "grid", + cards: [ + { + type: "tile", + entity: "cover.kitchen_shutter", + name: "Shutter", + }, + { + type: "tile", + entity: "light.kitchen_spotlights", + name: "Spotlights", + features: [ + { + type: "light-brightness", + }, + ], + }, + { + type: "tile", + entity: "light.worktop_spotlights", + name: "Worktop", + }, + { + type: "tile", + entity: "binary_sensor.fridge_door", + name: "Fridge", + }, + { + type: "tile", + entity: "media_player.kitchen_nest_audio", + name: "Nest Audio", + }, + ], + title: "👩‍🍳 Kitchen", + }, + { + type: "grid", + cards: [ + { + type: "tile", + entity: "binary_sensor.tesla_wall_connector_vehicle_connected", + name: "EV", + icon: "mdi:car", + }, + { + type: "tile", + entity: "sensor.tesla_wall_connector_session_energy", + name: "EV last charge", + color: "green", + }, + { + type: "tile", + entity: "sensor.electric_meter_power", + color: "deep-orange", + name: "Home power", + }, + { + type: "tile", + entity: "sensor.eletric_meter_voltage", + name: "Voltage", + color: "deep-orange", + }, + { + type: "tile", + entity: "sensor.electricity_maps_grid_fossil_fuel_percentage", + name: "Fossil fuel", + color: "brown", + }, + { + type: "tile", + entity: "sensor.electricity_maps_co2_intensity", + name: "CO2 Intensity", + color: "dark-grey", + }, + ], + title: "⚡️ Energy", + }, + { + type: "grid", + cards: [ + { + type: "tile", + entity: "sun.sun", + }, + { + type: "tile", + entity: "sensor.moon_phase", + color: "indigo", + name: "Moon", + }, + { + features: [ + { + type: "target-temperature", + }, + ], + type: "tile", + entity: "climate.ground_floor", + state_content: ["preset_mode", "current_temperature"], + }, + { + features: [ + { + type: "target-temperature", + }, + ], + type: "tile", + entity: "climate.first_floor", + state_content: ["preset_mode", "current_temperature"], + }, + ], + title: "🌤️ Climate", + }, + { + type: "grid", + cards: [ + { + type: "tile", + entity: "cover.study_shutter", + name: "Shutter", + }, + { + type: "tile", + entity: "light.study_spotlights", + name: "Spotlights", + }, + { + type: "tile", + entity: "media_player.study_nest_hub", + name: "Nest Hub", + }, + { + type: "tile", + entity: "sensor.standing_desk_height", + name: "Desk", + color: "brown", + icon: "mdi:desk", + }, + ], + title: "🧑‍💻 Study", + }, + { + type: "grid", + cards: [ + { + type: "tile", + entity: "light.outdoor_light", + name: "Door light", + }, + { + type: "tile", + entity: "light.flood_light", + }, + { + graph: "line", + type: "sensor", + entity: "sensor.outdoor_motion_sensor_temperature", + detail: 1, + name: "Temperature", + }, + { + type: "tile", + entity: "binary_sensor.outdoor_motion_sensor_motion", + name: "Motion", + color: "blue", + }, + { + type: "tile", + entity: "sensor.outdoor_motion_sensor_illuminance", + color: "amber", + name: "Illuminance", + }, + ], + title: "🌳 Outdoor", + }, + { + type: "grid", + cards: [ + { + type: "tile", + entity: "automation.home_assistant_auto_update", + name: "Auto-update", + color: "green", + }, + { + type: "tile", + entity: "update.home_assistant_operating_system_update", + name: "OS", + icon: "mdi:home-assistant", + }, + { + type: "tile", + entity: "update.home_assistant_supervisor_update", + icon: "mdi:home-assistant", + name: "Supervisor", + }, + { + type: "tile", + entity: "update.home_assistant_core_update", + name: "Core", + icon: "mdi:home-assistant", + }, + ], + title: "🎉 Updates", + }, + ], + }, + ], +}); diff --git a/src/panels/lovelace/sections/hui-grid-section.ts b/src/panels/lovelace/sections/hui-grid-section.ts index b63e9fac8f..72fc0b13df 100644 --- a/src/panels/lovelace/sections/hui-grid-section.ts +++ b/src/panels/lovelace/sections/hui-grid-section.ts @@ -96,6 +96,7 @@ export class GridSection extends LitElement implements LovelaceSectionElement { (_cardConfig, idx) => { const card = this.cards![idx]; (card as any).editMode = editMode; + (card as any).lovelace = this.lovelace; const size = card && (card as any).getGridSize?.(); return html`
Date: Mon, 4 Mar 2024 15:22:22 +0100 Subject: [PATCH 027/401] Expose dialog to custom card helpers (#19969) --- src/data/lock.ts | 4 ++-- src/dialogs/enter-code/show-enter-code-dialog.ts | 2 +- .../more-info/controls/more-info-alarm_control_panel.ts | 4 ++-- .../lovelace/card-features/hui-alarm-modes-card-feature.ts | 4 ++-- src/panels/lovelace/custom-card-helpers.ts | 6 ++++++ .../ha-state-control-alarm_control_panel-modes.ts | 4 ++-- 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/data/lock.ts b/src/data/lock.ts index 6630ef0989..7d155369f4 100644 --- a/src/data/lock.ts +++ b/src/data/lock.ts @@ -3,7 +3,7 @@ import { HassEntityBase, } from "home-assistant-js-websocket"; import { getExtendedEntityRegistryEntry } from "./entity_registry"; -import { showEnterCodeDialogDialog } from "../dialogs/enter-code/show-enter-code-dialog"; +import { showEnterCodeDialog } from "../dialogs/enter-code/show-enter-code-dialog"; import { HomeAssistant } from "../types"; export const FORMAT_TEXT = "text"; @@ -38,7 +38,7 @@ export const callProtectedLockService = async ( const defaultCode = lockRegistryEntry?.options?.lock?.default_code; if (stateObj!.attributes.code_format && !defaultCode) { - const response = await showEnterCodeDialogDialog(element, { + const response = await showEnterCodeDialog(element, { codeFormat: "text", codePattern: stateObj!.attributes.code_format, title: hass.localize(`ui.card.lock.${service}`), diff --git a/src/dialogs/enter-code/show-enter-code-dialog.ts b/src/dialogs/enter-code/show-enter-code-dialog.ts index 6356c20364..84006ea06f 100644 --- a/src/dialogs/enter-code/show-enter-code-dialog.ts +++ b/src/dialogs/enter-code/show-enter-code-dialog.ts @@ -10,7 +10,7 @@ export interface EnterCodeDialogParams { cancel?: () => void; } -export const showEnterCodeDialogDialog = ( +export const showEnterCodeDialog = ( element: HTMLElement, dialogParams: EnterCodeDialogParams ) => diff --git a/src/dialogs/more-info/controls/more-info-alarm_control_panel.ts b/src/dialogs/more-info/controls/more-info-alarm_control_panel.ts index bfc39a2ddc..312c0f2c0d 100644 --- a/src/dialogs/more-info/controls/more-info-alarm_control_panel.ts +++ b/src/dialogs/more-info/controls/more-info-alarm_control_panel.ts @@ -8,7 +8,7 @@ import "../../../components/ha-state-icon"; import { AlarmControlPanelEntity } from "../../../data/alarm_control_panel"; import "../../../state-control/alarm_control_panel/ha-state-control-alarm_control_panel-modes"; import type { HomeAssistant } from "../../../types"; -import { showEnterCodeDialogDialog } from "../../enter-code/show-enter-code-dialog"; +import { showEnterCodeDialog } from "../../enter-code/show-enter-code-dialog"; import "../components/ha-more-info-state-header"; import { moreInfoControlStyle } from "../components/more-info-control-style"; @@ -22,7 +22,7 @@ class MoreInfoAlarmControlPanel extends LitElement { let code: string | undefined; if (this.stateObj!.attributes.code_format) { - const response = await showEnterCodeDialogDialog(this, { + const response = await showEnterCodeDialog(this, { codeFormat: this.stateObj!.attributes.code_format, title: this.hass.localize("ui.card.alarm_control_panel.disarm"), submitText: this.hass.localize("ui.card.alarm_control_panel.disarm"), diff --git a/src/panels/lovelace/card-features/hui-alarm-modes-card-feature.ts b/src/panels/lovelace/card-features/hui-alarm-modes-card-feature.ts index b04318e46f..818b1e66a4 100644 --- a/src/panels/lovelace/card-features/hui-alarm-modes-card-feature.ts +++ b/src/panels/lovelace/card-features/hui-alarm-modes-card-feature.ts @@ -21,7 +21,7 @@ import { UNAVAILABLE } from "../../../data/entity"; import { HomeAssistant } from "../../../types"; import { LovelaceCardFeature, LovelaceCardFeatureEditor } from "../types"; import { AlarmModesCardFeatureConfig } from "./types"; -import { showEnterCodeDialogDialog } from "../../../dialogs/enter-code/show-enter-code-dialog"; +import { showEnterCodeDialog } from "../../../dialogs/enter-code/show-enter-code-dialog"; export const supportsAlarmModesCardFeature = (stateObj: HassEntity) => { const domain = computeDomain(stateObj.entity_id); @@ -131,7 +131,7 @@ class HuiAlarmModeCardFeature ) { const disarm = mode === "disarmed"; - const response = await showEnterCodeDialogDialog(this, { + const response = await showEnterCodeDialog(this, { codeFormat: this.stateObj!.attributes.code_format, title: this.hass!.localize( `ui.card.alarm_control_panel.${disarm ? "disarm" : "arm"}` diff --git a/src/panels/lovelace/custom-card-helpers.ts b/src/panels/lovelace/custom-card-helpers.ts index 3c4508ca0b..5cf34343aa 100644 --- a/src/panels/lovelace/custom-card-helpers.ts +++ b/src/panels/lovelace/custom-card-helpers.ts @@ -1,3 +1,9 @@ +export { showEnterCodeDialog } from "../../dialogs/enter-code/show-enter-code-dialog"; +export { + showAlertDialog, + showConfirmationDialog, + showPromptDialog, +} from "../../dialogs/generic/show-dialog-box"; export { importMoreInfoControl } from "../../dialogs/more-info/state_more_info_control"; export { createBadgeElement } from "./create-element/create-badge-element"; export { createCardElement } from "./create-element/create-card-element"; diff --git a/src/state-control/alarm_control_panel/ha-state-control-alarm_control_panel-modes.ts b/src/state-control/alarm_control_panel/ha-state-control-alarm_control_panel-modes.ts index 1e9b53a277..647795f46a 100644 --- a/src/state-control/alarm_control_panel/ha-state-control-alarm_control_panel-modes.ts +++ b/src/state-control/alarm_control_panel/ha-state-control-alarm_control_panel-modes.ts @@ -13,7 +13,7 @@ import { AlarmMode, } from "../../data/alarm_control_panel"; import { UNAVAILABLE } from "../../data/entity"; -import { showEnterCodeDialogDialog } from "../../dialogs/enter-code/show-enter-code-dialog"; +import { showEnterCodeDialog } from "../../dialogs/enter-code/show-enter-code-dialog"; import { HomeAssistant } from "../../types"; @customElement("ha-state-control-alarm_control_panel-modes") @@ -56,7 +56,7 @@ export class HaStateControlAlarmControlPanelModes extends LitElement { ) { const disarm = mode === "disarmed"; - const response = await showEnterCodeDialogDialog(this, { + const response = await showEnterCodeDialog(this, { codeFormat: this.stateObj!.attributes.code_format, title: this.hass!.localize( `ui.card.alarm_control_panel.${disarm ? "disarm" : "arm"}` From 88ccbcd883544da4b8e7e1e2a81245829bae03b8 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Mon, 4 Mar 2024 15:28:58 +0100 Subject: [PATCH 028/401] Fix badges not saved in view editor (#19971) --- .../view-editor/hui-dialog-edit-view.ts | 29 +++++++------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts b/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts index 4d67c4dbf6..498a7890dc 100644 --- a/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts +++ b/src/panels/lovelace/editor/view-editor/hui-dialog-edit-view.ts @@ -23,7 +23,6 @@ import "../../../../components/ha-dialog"; import "../../../../components/ha-dialog-header"; import "../../../../components/ha-yaml-editor"; import type { HaYamlEditor } from "../../../../components/ha-yaml-editor"; -import { LovelaceBadgeConfig } from "../../../../data/lovelace/config/badge"; import { LovelaceViewConfig, isStrategyView, @@ -61,8 +60,6 @@ export class HuiDialogEditView extends LitElement { @state() private _config?: LovelaceViewConfig; - @state() private _badges?: LovelaceBadgeConfig[]; - @state() private _saving = false; @state() private _curTab?: string; @@ -88,7 +85,6 @@ export class HuiDialogEditView extends LitElement { if (this._yamlMode && changedProperties.has("_yamlMode")) { const viewConfig = { ...this._config, - badges: this._badges, }; this._editor?.setValue(viewConfig); } @@ -99,7 +95,6 @@ export class HuiDialogEditView extends LitElement { if (this._params.viewIndex === undefined) { this._config = {}; - this._badges = []; this._dirty = false; return; } @@ -108,19 +103,15 @@ export class HuiDialogEditView extends LitElement { if (isStrategyView(view)) { const { strategy, ...viewConfig } = view; this._config = viewConfig; - this._badges = []; return; } - const { badges, ...viewConfig } = view; - this._config = viewConfig; - this._badges = badges ? processEditorEntities(badges) : []; + this._config = view; } public closeDialog(): void { this._curTabIndex = 0; this._params = undefined; this._config = {}; - this._badges = []; this._yamlMode = false; this._dirty = false; fireEvent(this, "dialog-closed", { dialog: this.localName }); @@ -166,7 +157,7 @@ export class HuiDialogEditView extends LitElement { break; case "tab-badges": content = html` - ${this._badges?.length + ${this._config?.badges?.length ? html` ${VIEWS_NO_BADGE_SUPPORT.includes(this._type) ? html` @@ -178,7 +169,7 @@ export class HuiDialogEditView extends LitElement { ` : nothing}
- ${this._badges.map( + ${this._config.badges.map( (badgeConfig) => html` `; @@ -420,9 +411,9 @@ export class HuiDialogEditView extends LitElement { } this._saving = true; - const viewConf: LovelaceViewConfig = { + + const viewConf = { ...this._config, - badges: this._badges, }; if (viewConf.type === SECTION_VIEW_LAYOUT && !viewConf.sections?.length) { @@ -487,10 +478,13 @@ export class HuiDialogEditView extends LitElement { } private _badgesChanged(ev: EntitiesEditorEvent): void { - if (!this._badges || !this.hass || !ev.detail || !ev.detail.entities) { + if (!this.hass || !ev.detail || !ev.detail.entities) { return; } - this._badges = processEditorEntities(ev.detail.entities); + this._config = { + ...this._config, + badges: processEditorEntities(ev.detail.entities), + }; this._dirty = true; } @@ -501,7 +495,6 @@ export class HuiDialogEditView extends LitElement { } const { badges, ...config } = ev.detail.value; this._config = config; - this._badges = badges; this._dirty = true; } From b9a7a7c422b0a48c668b1636b515420759b38ba3 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Mon, 4 Mar 2024 15:30:31 +0100 Subject: [PATCH 029/401] Don't suggest to pick another card for sections (#19977) --- .../card-editor/hui-dialog-suggest-card.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/panels/lovelace/editor/card-editor/hui-dialog-suggest-card.ts b/src/panels/lovelace/editor/card-editor/hui-dialog-suggest-card.ts index 80e517d5ce..89b2dac01c 100644 --- a/src/panels/lovelace/editor/card-editor/hui-dialog-suggest-card.ts +++ b/src/panels/lovelace/editor/card-editor/hui-dialog-suggest-card.ts @@ -131,11 +131,15 @@ export class HuiDialogSuggestCard extends LitElement { ${!this._params.yaml ? html` - ${this.hass!.localize( - "ui.panel.lovelace.editor.suggest_card.create_own" - )} + ${!(this._sectionConfig && this._viewSupportsSection) + ? html` + + ${this.hass!.localize( + "ui.panel.lovelace.editor.suggest_card.create_own" + )} + + ` + : nothing} ` - : ""} + : nothing} `; } From b99072d986133f7ddbc772047dfedd46ddc1e656 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Mon, 4 Mar 2024 15:31:07 +0100 Subject: [PATCH 030/401] Use icon in area card if there is no image (#19933) --- src/panels/lovelace/cards/hui-area-card.ts | 43 +++++++++++++++++----- 1 file changed, 34 insertions(+), 9 deletions(-) diff --git a/src/panels/lovelace/cards/hui-area-card.ts b/src/panels/lovelace/cards/hui-area-card.ts index ecd9dda6b3..d11cab9475 100644 --- a/src/panels/lovelace/cards/hui-area-card.ts +++ b/src/panels/lovelace/cards/hui-area-card.ts @@ -418,15 +418,24 @@ export class HuiAreaCard })} > ${area.picture || cameraEntityId - ? html`` - : ""} + ? html` + + ` + : area.icon + ? html` +
+ +
+ ` + : nothing}
Date: Mon, 4 Mar 2024 16:33:31 +0100 Subject: [PATCH 035/401] Change wording from add section to create section (#19978) * Rename add section to create section * update function name --- src/panels/lovelace/views/hui-sections-view.ts | 14 +++++++------- src/translations/en.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/panels/lovelace/views/hui-sections-view.ts b/src/panels/lovelace/views/hui-sections-view.ts index 2e2320fa54..54a50829ec 100644 --- a/src/panels/lovelace/views/hui-sections-view.ts +++ b/src/panels/lovelace/views/hui-sections-view.ts @@ -119,13 +119,13 @@ export class SectionsView extends LitElement implements LovelaceViewElement { ${editMode ? html`