diff --git a/pyproject.toml b/pyproject.toml index 33e2a52faa..fc9171c38e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "home-assistant-frontend" -version = "20230405.0" +version = "20230406.0" license = {text = "Apache-2.0"} description = "The Home Assistant frontend" readme = "README.md" diff --git a/src/common/structs/is-entity-id.ts b/src/common/structs/is-entity-id.ts deleted file mode 100644 index 05a7a8b439..0000000000 --- a/src/common/structs/is-entity-id.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { refine, string } from "superstruct"; - -const isEntityId = (value: string): boolean => value.includes("."); - -export const entityId = () => - refine(string(), "entity ID (domain.entity)", isEntityId); - -const isEntityIdOrAll = (value: string): boolean => { - if (value === "all") { - return true; - } - - return isEntityId(value); -}; - -export const entityIdOrAll = () => - refine(string(), "entity ID (domain.entity or all)", isEntityIdOrAll); diff --git a/src/components/chart/ha-chart-base.ts b/src/components/chart/ha-chart-base.ts index b4ecf7e063..902d567885 100644 --- a/src/components/chart/ha-chart-base.ts +++ b/src/components/chart/ha-chart-base.ts @@ -276,7 +276,11 @@ export default class HaChartBase extends LitElement { top: this.chart!.canvas.offsetTop + context.tooltip.caretY + 12 + "px", left: this.chart!.canvas.offsetLeft + - clamp(context.tooltip.caretX, 100, this.clientWidth - 100) - + clamp( + context.tooltip.caretX, + 100, + this.clientWidth - 100 - this.paddingYAxis + ) - 100 + "px", }; diff --git a/src/components/ha-analytics.ts b/src/components/ha-analytics.ts index 9ea3540baa..9faec6a273 100644 --- a/src/components/ha-analytics.ts +++ b/src/components/ha-analytics.ts @@ -2,9 +2,9 @@ import "@lrnwebcomponents/simple-tooltip/simple-tooltip"; import { css, CSSResultGroup, html, LitElement, TemplateResult } from "lit"; import { customElement, property } from "lit/decorators"; import { fireEvent } from "../common/dom/fire_event"; +import { LocalizeFunc } from "../common/translations/localize"; import type { Analytics, AnalyticsPreferences } from "../data/analytics"; import { haStyle } from "../resources/styles"; -import type { HomeAssistant } from "../types"; import "./ha-settings-row"; import "./ha-switch"; import type { HaSwitch } from "./ha-switch"; @@ -19,7 +19,7 @@ declare global { @customElement("ha-analytics") export class HaAnalytics extends LitElement { - @property({ attribute: false }) public hass!: HomeAssistant; + @property({ attribute: false }) public localize!: LocalizeFunc; @property({ attribute: false }) public analytics?: Analytics; @@ -34,12 +34,12 @@ export class HaAnalytics extends LitElement { return html` - ${this.hass.localize( + ${this.localize( `ui.panel.${this.translationKeyPanel}.analytics.preferences.base.title` )} - ${this.hass.localize( + ${this.localize( `ui.panel.${this.translationKeyPanel}.analytics.preferences.base.description` )} @@ -57,12 +57,12 @@ export class HaAnalytics extends LitElement { html` - ${this.hass.localize( + ${this.localize( `ui.panel.${this.translationKeyPanel}.analytics.preferences.${preference}.title` )} - ${this.hass.localize( + ${this.localize( `ui.panel.${this.translationKeyPanel}.analytics.preferences.${preference}.description` )} @@ -77,7 +77,7 @@ export class HaAnalytics extends LitElement { ${!baseEnabled ? html` - ${this.hass.localize( + ${this.localize( `ui.panel.${this.translationKeyPanel}.analytics.need_base_enabled` )} @@ -89,12 +89,12 @@ export class HaAnalytics extends LitElement { )} - ${this.hass.localize( + ${this.localize( `ui.panel.${this.translationKeyPanel}.analytics.preferences.diagnostics.title` )} - ${this.hass.localize( + ${this.localize( `ui.panel.${this.translationKeyPanel}.analytics.preferences.diagnostics.description` )} diff --git a/src/onboarding/onboarding-analytics.ts b/src/onboarding/onboarding-analytics.ts index cbc4b6aad7..e7aa0502aa 100644 --- a/src/onboarding/onboarding-analytics.ts +++ b/src/onboarding/onboarding-analytics.ts @@ -23,11 +23,11 @@ class OnboardingAnalytics extends LitElement { protected render(): TemplateResult { return html` -

${this.hass.localize("ui.panel.page-onboarding.analytics.intro")}

+

${this.localize("ui.panel.page-onboarding.analytics.intro")}

@@ -41,7 +41,7 @@ class OnboardingAnalytics extends LitElement { target="_blank" rel="noreferrer" > - ${this.hass.localize("ui.panel.page-onboarding.analytics.learn_more")} + ${this.localize("ui.panel.page-onboarding.analytics.learn_more")} `; diff --git a/src/panels/config/core/ha-config-analytics.ts b/src/panels/config/core/ha-config-analytics.ts index 4c506ff7eb..e2b2ffa24a 100644 --- a/src/panels/config/core/ha-config-analytics.ts +++ b/src/panels/config/core/ha-config-analytics.ts @@ -45,7 +45,7 @@ class ConfigAnalytics extends LitElement { diff --git a/src/panels/config/entities/entity-registry-settings.ts b/src/panels/config/entities/entity-registry-settings.ts index 88cfa86657..817819b7b5 100644 --- a/src/panels/config/entities/entity-registry-settings.ts +++ b/src/panels/config/entities/entity-registry-settings.ts @@ -663,7 +663,7 @@ export class EntityRegistrySettings extends SubscribeMixin(LitElement) { )} ` : ""} - ${this._helperConfigEntry + ${this._helperConfigEntry && this._helperConfigEntry.supports_options ? html`
- ${!this._showDisabled && disabledCount - ? html`
-
+ ${!this._showDisabled && disabledCount + ? html`
@@ -469,10 +469,10 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) { "ui.panel.config.integrations.disable.show" )} > -
- ${filterMenu} -
` - : ""} +
` + : ""} + ${filterMenu} +
`} diff --git a/src/panels/history/ha-panel-history.ts b/src/panels/history/ha-panel-history.ts index 6bb2e9ce11..fb2e74299b 100644 --- a/src/panels/history/ha-panel-history.ts +++ b/src/panels/history/ha-panel-history.ts @@ -518,10 +518,6 @@ class HaPanelHistory extends SubscribeMixin(LitElement) { padding-bottom: max(env(safe-area-inset-bottom), 16px); } - state-history-charts { - overflow-x: hidden; - } - :host([virtualize]) { height: 100%; } diff --git a/src/panels/lovelace/editor/config-elements/hui-alarm-panel-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-alarm-panel-card-editor.ts index e4554abacc..b70e346018 100644 --- a/src/panels/lovelace/editor/config-elements/hui-alarm-panel-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-alarm-panel-card-editor.ts @@ -3,7 +3,6 @@ import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { array, assert, assign, object, optional, string } from "superstruct"; import { fireEvent } from "../../../../common/dom/fire_event"; -import { entityId } from "../../../../common/structs/is-entity-id"; import type { LocalizeFunc } from "../../../../common/translations/localize"; import "../../../../components/ha-form/ha-form"; import type { SchemaUnion } from "../../../../components/ha-form/types"; @@ -15,7 +14,7 @@ import { baseLovelaceCardConfig } from "../structs/base-card-struct"; const cardConfigStruct = assign( baseLovelaceCardConfig, object({ - entity: optional(entityId()), + entity: optional(string()), name: optional(string()), states: optional(array()), theme: optional(string()), diff --git a/src/panels/lovelace/editor/config-elements/hui-button-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-button-card-editor.ts index bd88ad16d9..7466a4cdcd 100644 --- a/src/panels/lovelace/editor/config-elements/hui-button-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-button-card-editor.ts @@ -2,7 +2,6 @@ import { CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { assert, assign, boolean, object, optional, string } from "superstruct"; import { fireEvent } from "../../../../common/dom/fire_event"; -import { entityId } from "../../../../common/structs/is-entity-id"; import "../../../../components/ha-form/ha-form"; import type { SchemaUnion } from "../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../types"; @@ -15,7 +14,7 @@ import { configElementStyle } from "./config-elements-style"; const cardConfigStruct = assign( baseLovelaceCardConfig, object({ - entity: optional(entityId()), + entity: optional(string()), name: optional(string()), show_name: optional(boolean()), icon: optional(string()), diff --git a/src/panels/lovelace/editor/config-elements/hui-entities-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-entities-card-editor.ts index 95a5cad8ff..abcb662114 100644 --- a/src/panels/lovelace/editor/config-elements/hui-entities-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-entities-card-editor.ts @@ -18,7 +18,6 @@ import { } from "superstruct"; import { fireEvent, HASSDomEvent } from "../../../../common/dom/fire_event"; import { customType } from "../../../../common/structs/is-custom-type"; -import { entityId } from "../../../../common/structs/is-entity-id"; import { computeRTLDirection } from "../../../../common/util/compute_rtl"; import "../../../../components/entity/state-badge"; import "../../../../components/ha-card"; @@ -184,7 +183,7 @@ const cardConfigStruct = assign( baseLovelaceCardConfig, object({ title: optional(union([string(), boolean()])), - entity: optional(entityId()), + entity: optional(string()), theme: optional(string()), icon: optional(string()), show_header_toggle: optional(boolean()), diff --git a/src/panels/lovelace/editor/config-elements/hui-entity-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-entity-card-editor.ts index 5d57ed495b..3379792b6f 100644 --- a/src/panels/lovelace/editor/config-elements/hui-entity-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-entity-card-editor.ts @@ -2,7 +2,6 @@ import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { assert, assign, boolean, object, optional, string } from "superstruct"; import { fireEvent } from "../../../../common/dom/fire_event"; -import { entityId } from "../../../../common/structs/is-entity-id"; import "../../../../components/ha-form/ha-form"; import type { SchemaUnion } from "../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../types"; @@ -14,7 +13,7 @@ import { baseLovelaceCardConfig } from "../structs/base-card-struct"; const cardConfigStruct = assign( baseLovelaceCardConfig, object({ - entity: optional(entityId()), + entity: optional(string()), name: optional(string()), icon: optional(string()), attribute: optional(string()), diff --git a/src/panels/lovelace/editor/config-elements/hui-gauge-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-gauge-card-editor.ts index 4055c1eea7..06f173b9b4 100644 --- a/src/panels/lovelace/editor/config-elements/hui-gauge-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-gauge-card-editor.ts @@ -12,7 +12,6 @@ import { string, } from "superstruct"; import { fireEvent } from "../../../../common/dom/fire_event"; -import { entityId } from "../../../../common/structs/is-entity-id"; import "../../../../components/ha-form/ha-form"; import type { SchemaUnion } from "../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../types"; @@ -31,7 +30,7 @@ const cardConfigStruct = assign( baseLovelaceCardConfig, object({ name: optional(string()), - entity: optional(entityId()), + entity: optional(string()), unit: optional(string()), min: optional(number()), max: optional(number()), diff --git a/src/panels/lovelace/editor/config-elements/hui-humidifier-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-humidifier-card-editor.ts index 975e0fc674..5cb79b1621 100644 --- a/src/panels/lovelace/editor/config-elements/hui-humidifier-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-humidifier-card-editor.ts @@ -2,7 +2,6 @@ import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { assert, assign, object, optional, string } from "superstruct"; import { fireEvent } from "../../../../common/dom/fire_event"; -import { entityId } from "../../../../common/structs/is-entity-id"; import "../../../../components/ha-form/ha-form"; import type { SchemaUnion } from "../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../types"; @@ -13,7 +12,7 @@ import { baseLovelaceCardConfig } from "../structs/base-card-struct"; const cardConfigStruct = assign( baseLovelaceCardConfig, object({ - entity: optional(entityId()), + entity: optional(string()), name: optional(string()), theme: optional(string()), }) diff --git a/src/panels/lovelace/editor/config-elements/hui-light-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-light-card-editor.ts index fc3fb17910..7f9e657765 100644 --- a/src/panels/lovelace/editor/config-elements/hui-light-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-light-card-editor.ts @@ -2,7 +2,6 @@ import { CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { assert, assign, object, optional, string } from "superstruct"; import { fireEvent } from "../../../../common/dom/fire_event"; -import { entityId } from "../../../../common/structs/is-entity-id"; import "../../../../components/ha-form/ha-form"; import type { SchemaUnion } from "../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../types"; @@ -16,7 +15,7 @@ const cardConfigStruct = assign( baseLovelaceCardConfig, object({ name: optional(string()), - entity: optional(entityId()), + entity: optional(string()), theme: optional(string()), icon: optional(string()), hold_action: optional(actionConfigStruct), diff --git a/src/panels/lovelace/editor/config-elements/hui-media-control-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-media-control-card-editor.ts index 10f2d5764d..71596a1293 100644 --- a/src/panels/lovelace/editor/config-elements/hui-media-control-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-media-control-card-editor.ts @@ -2,7 +2,6 @@ import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { assert, assign, object, optional, string } from "superstruct"; import { fireEvent } from "../../../../common/dom/fire_event"; -import { entityId } from "../../../../common/structs/is-entity-id"; import "../../../../components/entity/ha-entity-picker"; import "../../../../components/ha-theme-picker"; import { HomeAssistant } from "../../../../types"; @@ -14,7 +13,7 @@ import { EditorTarget, EntitiesEditorEvent } from "../types"; const cardConfigStruct = assign( baseLovelaceCardConfig, object({ - entity: optional(entityId()), + entity: optional(string()), theme: optional(string()), }) ); diff --git a/src/panels/lovelace/editor/config-elements/hui-picture-entity-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-picture-entity-card-editor.ts index b96a2c0607..6ead63f55c 100644 --- a/src/panels/lovelace/editor/config-elements/hui-picture-entity-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-picture-entity-card-editor.ts @@ -2,7 +2,6 @@ import { CSSResultGroup, html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { assert, assign, boolean, object, optional, string } from "superstruct"; import { fireEvent } from "../../../../common/dom/fire_event"; -import { entityId } from "../../../../common/structs/is-entity-id"; import "../../../../components/ha-form/ha-form"; import type { SchemaUnion } from "../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../types"; @@ -15,7 +14,7 @@ import { configElementStyle } from "./config-elements-style"; const cardConfigStruct = assign( baseLovelaceCardConfig, object({ - entity: optional(entityId()), + entity: optional(string()), image: optional(string()), name: optional(string()), camera_image: optional(string()), diff --git a/src/panels/lovelace/editor/config-elements/hui-plant-status-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-plant-status-card-editor.ts index da6f01c8a6..1fde6b438d 100644 --- a/src/panels/lovelace/editor/config-elements/hui-plant-status-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-plant-status-card-editor.ts @@ -2,7 +2,6 @@ import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { assert, assign, object, optional, string } from "superstruct"; import { fireEvent } from "../../../../common/dom/fire_event"; -import { entityId } from "../../../../common/structs/is-entity-id"; import "../../../../components/ha-form/ha-form"; import type { SchemaUnion } from "../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../types"; @@ -13,7 +12,7 @@ import { baseLovelaceCardConfig } from "../structs/base-card-struct"; const cardConfigStruct = assign( baseLovelaceCardConfig, object({ - entity: optional(entityId()), + entity: optional(string()), name: optional(string()), theme: optional(string()), }) diff --git a/src/panels/lovelace/editor/config-elements/hui-sensor-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-sensor-card-editor.ts index 60f4315d99..25b6846a5e 100644 --- a/src/panels/lovelace/editor/config-elements/hui-sensor-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-sensor-card-editor.ts @@ -11,7 +11,6 @@ import { union, } from "superstruct"; import { fireEvent } from "../../../../common/dom/fire_event"; -import { entityId } from "../../../../common/structs/is-entity-id"; import "../../../../components/ha-form/ha-form"; import type { SchemaUnion } from "../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../types"; @@ -24,7 +23,7 @@ import { DEFAULT_HOURS_TO_SHOW } from "../../cards/hui-sensor-card"; const cardConfigStruct = assign( baseLovelaceCardConfig, object({ - entity: optional(entityId()), + entity: optional(string()), name: optional(string()), icon: optional(string()), graph: optional(union([literal("line"), literal("none")])), diff --git a/src/panels/lovelace/editor/config-elements/hui-thermostat-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-thermostat-card-editor.ts index 8da6a2ee4b..79158e892d 100644 --- a/src/panels/lovelace/editor/config-elements/hui-thermostat-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-thermostat-card-editor.ts @@ -2,7 +2,6 @@ import { html, LitElement, nothing } from "lit"; import { customElement, property, state } from "lit/decorators"; import { assert, assign, object, optional, string } from "superstruct"; import { fireEvent } from "../../../../common/dom/fire_event"; -import { entityId } from "../../../../common/structs/is-entity-id"; import "../../../../components/ha-form/ha-form"; import type { SchemaUnion } from "../../../../components/ha-form/types"; import type { HomeAssistant } from "../../../../types"; @@ -13,7 +12,7 @@ import { baseLovelaceCardConfig } from "../structs/base-card-struct"; const cardConfigStruct = assign( baseLovelaceCardConfig, object({ - entity: optional(entityId()), + entity: optional(string()), name: optional(string()), theme: optional(string()), }) diff --git a/src/panels/lovelace/editor/config-elements/hui-tile-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-tile-card-editor.ts index 18cd64fa96..0241615be7 100644 --- a/src/panels/lovelace/editor/config-elements/hui-tile-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-tile-card-editor.ts @@ -14,7 +14,6 @@ import { string, } from "superstruct"; import { fireEvent, HASSDomEvent } from "../../../../common/dom/fire_event"; -import { entityId } from "../../../../common/structs/is-entity-id"; import { LocalizeFunc } from "../../../../common/translations/localize"; import "../../../../components/ha-form/ha-form"; import type { SchemaUnion } from "../../../../components/ha-form/types"; @@ -35,7 +34,7 @@ import "./hui-tile-card-features-editor"; const cardConfigStruct = assign( baseLovelaceCardConfig, object({ - entity: optional(entityId()), + entity: optional(string()), name: optional(string()), icon: optional(string()), color: optional(string()), diff --git a/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts b/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts index c338e4a8e9..2be07c183b 100644 --- a/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts +++ b/src/panels/lovelace/editor/config-elements/hui-weather-forecast-card-editor.ts @@ -3,7 +3,6 @@ import { customElement, property, state } from "lit/decorators"; import memoizeOne from "memoize-one"; import { assert, assign, boolean, object, optional, string } from "superstruct"; import { fireEvent } from "../../../../common/dom/fire_event"; -import { entityId } from "../../../../common/structs/is-entity-id"; import type { LocalizeFunc } from "../../../../common/translations/localize"; import "../../../../components/ha-form/ha-form"; import type { SchemaUnion } from "../../../../components/ha-form/types"; @@ -18,7 +17,7 @@ import { baseLovelaceCardConfig } from "../structs/base-card-struct"; const cardConfigStruct = assign( baseLovelaceCardConfig, object({ - entity: optional(entityId()), + entity: optional(string()), name: optional(string()), theme: optional(string()), show_current: optional(boolean()), diff --git a/src/panels/lovelace/hui-root.ts b/src/panels/lovelace/hui-root.ts index 5571bd0316..b9cb5977f7 100644 --- a/src/panels/lovelace/hui-root.ts +++ b/src/panels/lovelace/hui-root.ts @@ -26,13 +26,7 @@ import { PropertyValues, TemplateResult, } from "lit"; -import { - customElement, - eventOptions, - property, - query, - state, -} from "lit/decorators"; +import { customElement, property, query, state } from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { ifDefined } from "lit/directives/if-defined"; import memoizeOne from "memoize-one"; @@ -93,7 +87,7 @@ class HUIRoot extends LitElement { @state() private _curView?: number | "hass-unused-entities"; - @query("#view", true) _view!: HTMLDivElement; + @query("#view", true) _viewRoot!: HTMLDivElement; private _viewCache?: { [viewId: string]: HUIView }; @@ -550,19 +544,14 @@ class HUIRoot extends LitElement { ` : ""} -
+
`; } - @eventOptions({ passive: true }) - private _viewScrolled(ev) { + private _viewScrolled = (ev) => { this.toggleAttribute("scrolled", ev.currentTarget.scrollTop !== 0); - } + }; private _isVisible = (view: LovelaceViewConfig) => Boolean( @@ -684,10 +673,6 @@ class HUIRoot extends LitElement { return this.lovelace!.editMode; } - private get _viewRoot(): HTMLDivElement { - return this.shadowRoot!.getElementById("view") as HTMLDivElement; - } - private get _showButtonMenu(): boolean { return ( (this.narrow && this._conversation(this.hass.config.components)) || @@ -874,7 +859,6 @@ class HUIRoot extends LitElement { const path = this.config.views[viewIndex].path || viewIndex; this._navigateToView(path); } - this._view.scrollTo(0, 0); } private _selectView(viewIndex: HUIRoot["_curView"], force: boolean): void { @@ -894,6 +878,7 @@ class HUIRoot extends LitElement { const root = this._viewRoot; if (root.lastChild) { + root.lastChild.removeEventListener("scroll", this._viewScrolled); root.removeChild(root.lastChild); } @@ -928,6 +913,7 @@ class HUIRoot extends LitElement { view.lovelace = this.lovelace; view.hass = this.hass; view.narrow = this.narrow; + view.addEventListener("scroll", this._viewScrolled, { passive: true }); const configBackground = viewConfig.background || this.config.background; @@ -936,6 +922,7 @@ class HUIRoot extends LitElement { } else { this.style.removeProperty("--lovelace-background"); } + this.removeAttribute("scrolled"); root.appendChild(view); // Recalculate to see if we need to adjust content area for tab bar @@ -1046,18 +1033,20 @@ class HUIRoot extends LitElement { mwc-button.warning:not([disabled]) { color: var(--error-color); } - #view { + hui-view { margin-top: calc(var(--header-height) + env(safe-area-inset-top)); height: calc(100vh - var(--header-height) - env(safe-area-inset-top)); - padding-left: env(safe-area-inset-left); - padding-right: env(safe-area-inset-right); background: var( --lovelace-background, var(--primary-background-color) ); + padding-left: env(safe-area-inset-left); + padding-right: env(safe-area-inset-right); + width: 100%; + padding-bottom: env(safe-area-inset-bottom); + display: block; overflow: auto; transform: translateZ(0); - display: flex; } /** * In edit mode we have the tab bar on a new line * @@ -1070,21 +1059,6 @@ class HUIRoot extends LitElement { var(--header-height) + 48px + env(safe-area-inset-top) ); } - #view > * { - /** - * The view could get larger than the window in Firefox - * to prevent that we set the max-width to 100% - * flex-grow: 1 and flex-basis: 100% should make sure the view - * stays full width. - * - * https://github.com/home-assistant/home-assistant-polymer/pull/3806 - */ - flex: 1 1 100%; - height: 100%; - max-width: 100%; - padding-bottom: env(safe-area-inset-bottom); - display: block; - } .hide-tab { display: none; } diff --git a/src/panels/lovelace/views/hui-view.ts b/src/panels/lovelace/views/hui-view.ts index bcf440f328..4d9c56a928 100644 --- a/src/panels/lovelace/views/hui-view.ts +++ b/src/panels/lovelace/views/hui-view.ts @@ -161,9 +161,8 @@ export class HUIView extends ReactiveElement { | undefined; if ( - !oldHass || - this.hass.themes !== oldHass.themes || - this.hass.selectedTheme !== oldHass.selectedTheme + changedProperties.has("hass") && + (!oldHass || this.hass.themes !== oldHass.themes) ) { applyThemesOnElement(this, this.hass.themes, this._viewConfigTheme); } diff --git a/src/translations/en.json b/src/translations/en.json index 8b8e01ef28..33394b18ab 100755 --- a/src/translations/en.json +++ b/src/translations/en.json @@ -901,7 +901,7 @@ } }, "zone": { - "graph_unit": "People home" + "graph_unit": "People in zone" }, "light": { "toggle": "Toggle",