Compare commits

..

74 Commits

Author SHA1 Message Date
Bram Kragten
685d28229e Fix for displaying time left for values > 24 hour 2020-07-27 19:04:25 +02:00
HomeAssistant Azure
8634ee536d [ci skip] Translation update 2020-07-27 00:32:48 +00:00
HomeAssistant Azure
632d3cda24 [ci skip] Translation update 2020-07-26 00:32:40 +00:00
HomeAssistant Azure
29b6a907d4 [ci skip] Translation update 2020-07-25 00:32:25 +00:00
HomeAssistant Azure
7474d09e5d [ci skip] Translation update 2020-07-24 00:32:32 +00:00
HomeAssistant Azure
fc7bcd7e00 [ci skip] Translation update 2020-07-23 00:32:33 +00:00
Bram Kragten
f6fb2e4b1d Missed the entities in the editors (#6443) 2020-07-22 14:16:25 +02:00
HomeAssistant Azure
8c8673a272 [ci skip] Translation update 2020-07-22 00:32:23 +00:00
Bram Kragten
4404a1173b Fix mwc-list/menu actions (#6442)
* Fix mwc-list/menu actions

Fix double actions when using request-selected

* Update ha-button-menu.ts

* Automation menu styling

* Update src/panels/lovelace/hui-root.ts

Co-authored-by: Zack Arnett <arnett.zackary@gmail.com>

* Move

Co-authored-by: Zack Arnett <arnett.zackary@gmail.com>
2020-07-21 23:22:19 +02:00
Bram Kragten
e08c10315e Fix removing/moving device actions (#6441)
Fixes https://github.com/home-assistant/frontend/issues/6438
2020-07-21 09:05:21 -07:00
Bram Kragten
16473c9177 Bump superstruct, add struct to automation action (#6436)
Co-authored-by: Zack Arnett <arnett.zackary@gmail.com>
2020-07-21 12:42:07 +02:00
HomeAssistant Azure
235fd5603f [ci skip] Translation update 2020-07-21 00:32:32 +00:00
Quinn Casey
d07d5832f5 Increase z-index of save button on editor (#6435) 2020-07-20 18:46:10 +02:00
Yosi Levy
ef8be5d559 Merge pull request #6433 from yosilevy/edit-card-RTL-fix
Edit card rtl fix
2020-07-20 14:44:05 +03:00
Yosi Levy
ccafdc6e1f Merge pull request #6431 from yosilevy/Unused-entities-search
ha-data-table search label + no data text label
2020-07-20 14:31:41 +03:00
Yosi Levy
11827aa4c0 Merge pull request #6426 from yosilevy/Logbook-link-fix
Logbook link fix
2020-07-20 14:31:21 +03:00
Yosi Levy
6b0589d343 Update lint 2020-07-20 14:30:32 +03:00
Yosi Levy
cec1eed99e Merge branch 'dev' into edit-card-RTL-fix 2020-07-20 14:01:20 +03:00
Yosi Levy
d7e1e9e284 Merge pull request #6417 from yosilevy/RTL-date-selector
RTL fix for range list
2020-07-20 13:57:27 +03:00
Yosi Levy
cae46453a7 New parameterized label 2020-07-20 13:56:39 +03:00
Yosi Levy
a6e948c808 Typeo 2020-07-20 13:41:20 +03:00
Yosi Levy
7638020bfc Changed default wording 2020-07-20 13:37:18 +03:00
Yosi Levy
10a62ca17c Fix bad merge 2020-07-20 13:29:51 +03:00
Yosi Levy
0afc7c184f Fixed comments 2020-07-20 13:25:34 +03:00
Yosi Levy
168e26aeb4 Merge branch 'dev' into RTL-date-selector 2020-07-20 13:12:53 +03:00
Yosi Levy
e6b9389b33 Fixed heading (concat) to support RTL (name comes last) 2020-07-20 07:49:09 +03:00
Yosi Levy
377c37425e Refactor ha-dialog RTL to include dialogs not using createCloseHeader 2020-07-20 07:32:09 +03:00
HomeAssistant Azure
4af26602bb [ci skip] Translation update 2020-07-20 00:32:37 +00:00
Yosi Levy
c6624e5cb6 Optimized RTL check 2020-07-19 15:09:34 +03:00
Yosi Levy
f7ae5b91bf Remove rtl update check 2020-07-19 14:17:09 +03:00
Yosi Levy
07e68496c0 Removed directive 2020-07-19 06:14:09 +03:00
Yosi Levy
d5a947e2cc Removed style 2020-07-19 06:09:57 +03:00
Yosi Levy
3f920767f1 Added noDataText 2020-07-19 06:04:42 +03:00
Yosi Levy
3e14d27a1e Usage of search label 2020-07-19 05:58:01 +03:00
Yosi Levy
cfa4c14108 Added search label support to ha-data-table 2020-07-19 05:56:39 +03:00
HomeAssistant Azure
209056dbe1 [ci skip] Translation update 2020-07-19 00:32:25 +00:00
Aidan Timson
10356a7496 Fix typo in ZHA (#6429) 2020-07-18 19:27:46 +02:00
Yosi Levy
d4ae74de44 Removed style 2020-07-18 11:06:43 +03:00
Yosi Levy
88d5e7dd5e Line breaks 2020-07-18 11:02:13 +03:00
Yosi Levy
06c7b0b82e Optimized 2020-07-18 10:59:48 +03:00
Yosi Levy
689febda60 Fixed comments 2020-07-18 06:48:36 +03:00
Yosi Levy
80bc6fda8b Improved 2020-07-18 06:31:33 +03:00
Yosi Levy
346eb78c4e Fixed extra space issue + RTL support when no entries 2020-07-18 06:29:21 +03:00
HomeAssistant Azure
2df02f1b09 [ci skip] Translation update 2020-07-18 00:32:26 +00:00
Bram Kragten
92915eddc2 Make menu's work with keyboard (#6421) 2020-07-17 20:31:44 +02:00
Bram Kragten
cddbf460f8 Add close function to edit card dialog (#6423) 2020-07-17 11:29:08 -07:00
Bram Kragten
3c63c23e5a Fix spacing more info (#6419) 2020-07-17 12:04:20 +02:00
Yosi Levy
ba67b1291f Merge pull request #6404 from yosilevy/RTL-dev-changes
Removed LTR force - looks much better
2020-07-17 07:00:07 +03:00
Yosi Levy
7bced28327 RTL fix for range list 2020-07-17 06:57:42 +03:00
HomeAssistant Azure
db2b60700c [ci skip] Translation update 2020-07-17 00:32:26 +00:00
Bram Kragten
9034822c44 Bump lit-analyzer and add back cast types (#6409) 2020-07-16 12:01:24 -07:00
Bram Kragten
a14179b81a Bumped version to 20200716.0 2020-07-16 17:51:47 +02:00
Bram Kragten
427c5db7f4 default 0 2020-07-16 17:51:01 +02:00
Bram Kragten
fcb5865468 Make gauge bit smaller 2020-07-16 17:49:35 +02:00
Bram Kragten
41370be2b8 Rewrite gauge (#6407) 2020-07-16 08:42:14 -07:00
Bram Kragten
d7d8dd8986 Debug was still true (#6410) 2020-07-16 17:18:55 +02:00
Bram Kragten
a0f596e419 Missing icon change (#6406) 2020-07-16 09:47:41 +02:00
Paulus Schoutsen
0a8894feb7 Random cleanups (#6402) 2020-07-16 08:24:16 +02:00
Bram Kragten
1db9eea0f8 Add visual-studio-code to icon conversion (#6401)
Fixes https://github.com/home-assistant/frontend/issues/6400
2020-07-16 08:22:22 +02:00
Sean Mooney
489783c398 Fix typo in icon rename mapping (#6405)
After updating all my MDI icons I noticed that one wasn't displaying anymore. Then realized there was a minor typo.
2020-07-16 08:21:32 +02:00
Yosi Levy
be62f327ee Removed LTR force - looks much better 2020-07-16 05:32:49 +03:00
HomeAssistant Azure
32359adb6d [ci skip] Translation update 2020-07-16 00:32:14 +00:00
Bram Kragten
d154fcbd71 Bumped version to 20200715.1 2020-07-15 19:56:56 +02:00
Bram Kragten
21e277b8a2 Change default automation mode (#6398) 2020-07-15 10:56:15 -07:00
Jaroslav Hanslík
f98cdd0749 Added missing translation to alarm panel card (#6390)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2020-07-15 19:42:06 +02:00
Mike Knudson
e60e306426 Update icon_color_css.ts (#6385)
* Update icon_color_css.ts

Adding the "group" data-domain to CSS check for active coloring.  

This fixes ha-icon to change to the active color based on an "on" state.

* Update icon_color_css.ts

Adding, home, open, locked, and problem to the list.
2020-07-15 19:31:05 +02:00
Bram Kragten
135232d880 Bumped version to 20200715.0 2020-07-15 15:40:55 +02:00
Bram Kragten
9c42ca0315 Fix filtering attributes (#6394) 2020-07-15 15:34:18 +02:00
Bram Kragten
9ad9c569a6 Fix button position entity settings dialog (#6395) 2020-07-15 15:33:55 +02:00
Bram Kragten
a9071d7920 Fix long entity name streching header (#6393) 2020-07-15 15:26:01 +02:00
Bram Kragten
1b4a10fac1 Merge pull request #6392 from home-assistant/fix-gauge-text-color
Fix text color in gauge
2020-07-15 15:21:19 +02:00
Bram Kragten
d340f3b383 Fix text color in gauge 2020-07-15 11:31:48 +02:00
Bram Kragten
f8c5eeab5d Replace all private properties with internalProperty decorator (#6386) 2020-07-14 21:38:36 -07:00
HomeAssistant Azure
9cd2d0df93 [ci skip] Translation update 2020-07-15 00:32:18 +00:00
420 changed files with 4790 additions and 2044 deletions

View File

@@ -8,6 +8,7 @@ import {
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import { CastManager } from "../../../../src/cast/cast_manager";
@@ -41,9 +42,9 @@ class HcCast extends LitElement {
@property() public castManager!: CastManager;
@property() private askWrite = false;
@internalProperty() private askWrite = false;
@property() private lovelaceConfig?: LovelaceConfig | null;
@internalProperty() private lovelaceConfig?: LovelaceConfig | null;
protected render(): TemplateResult {
if (this.lovelaceConfig === undefined) {

View File

@@ -17,8 +17,8 @@ import {
customElement,
html,
LitElement,
property,
TemplateResult,
internalProperty,
} from "lit-element";
import { CastManager, getCastManager } from "../../../../src/cast/cast_manager";
import { castSendShowDemo } from "../../../../src/cast/receiver_messages";
@@ -60,19 +60,19 @@ const INTRO = html`
@customElement("hc-connect")
export class HcConnect extends LitElement {
@property() private loading = false;
@internalProperty() private loading = false;
// If we had stored credentials but we cannot connect,
// show a screen asking retry or logout.
@property() private cannotConnect = false;
@internalProperty() private cannotConnect = false;
@property() private error?: string | TemplateResult;
@internalProperty() private error?: string | TemplateResult;
@property() private auth?: Auth;
@internalProperty() private auth?: Auth;
@property() private connection?: Connection;
@internalProperty() private connection?: Connection;
@property() private castManager?: CastManager | null;
@internalProperty() private castManager?: CastManager | null;
private openDemo = false;

View File

@@ -1,4 +1,10 @@
import { customElement, html, property, TemplateResult } from "lit-element";
import {
customElement,
html,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import { mockHistory } from "../../../../demo/src/stubs/history";
import { LovelaceConfig } from "../../../../src/data/lovelace";
import {
@@ -13,9 +19,9 @@ import "./hc-lovelace";
@customElement("hc-demo")
class HcDemo extends HassElement {
@property() public lovelacePath!: string;
@property({ attribute: false }) public lovelacePath!: string;
@property() private _lovelaceConfig?: LovelaceConfig;
@internalProperty() private _lovelaceConfig?: LovelaceConfig;
protected render(): TemplateResult {
if (!this._lovelaceConfig) {

View File

@@ -11,7 +11,7 @@ import { HomeAssistant } from "../../../../src/types";
@customElement("hc-launch-screen")
class HcLaunchScreen extends LitElement {
@property() public hass?: HomeAssistant;
@property({ attribute: false }) public hass?: HomeAssistant;
@property() public error?: string;

View File

@@ -16,9 +16,9 @@ import "./hc-launch-screen";
@customElement("hc-lovelace")
class HcLovelace extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public lovelaceConfig!: LovelaceConfig;
@property({ attribute: false }) public lovelaceConfig!: LovelaceConfig;
@property() public viewPath?: string | number;

View File

@@ -3,7 +3,12 @@ import {
getAuth,
UnsubscribeFunc,
} from "home-assistant-js-websocket";
import { customElement, html, property, TemplateResult } from "lit-element";
import {
customElement,
html,
internalProperty,
TemplateResult,
} from "lit-element";
import { CAST_NS } from "../../../../src/cast/const";
import {
ConnectMessage,
@@ -31,13 +36,13 @@ let resourcesLoaded = false;
@customElement("hc-main")
export class HcMain extends HassElement {
@property() private _showDemo = false;
@internalProperty() private _showDemo = false;
@property() private _lovelaceConfig?: LovelaceConfig;
@internalProperty() private _lovelaceConfig?: LovelaceConfig;
@property() private _lovelacePath: string | number | null = null;
@internalProperty() private _lovelacePath: string | number | null = null;
@property() private _error?: string;
@internalProperty() private _error?: string;
private _unsubLovelace?: UnsubscribeFunc;

View File

@@ -4,7 +4,7 @@ import {
customElement,
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import { CastManager } from "../../../src/cast/cast_manager";
@@ -20,7 +20,7 @@ import { HomeAssistant } from "../../../src/types";
class CastDemoRow extends LitElement implements LovelaceRow {
public hass!: HomeAssistant;
@property() private _castManager?: CastManager | null;
@internalProperty() private _castManager?: CastManager | null;
public setConfig(_config: CastConfig): void {
// No config possible.
@@ -52,7 +52,6 @@ class CastDemoRow extends LitElement implements LovelaceRow {
});
mgr.castContext.addEventListener(
// eslint-disable-next-line no-undef
// @ts-ignore
cast.framework.CastContextEventType.SESSION_STATE_CHANGED,
(ev) => {
// On Android, opening a new session always results in SESSION_RESUMED.

View File

@@ -5,6 +5,7 @@ import {
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import { until } from "lit-html/directives/until";
@@ -21,11 +22,11 @@ import {
} from "../configs/demo-configs";
export class HADemoCard extends LitElement implements LovelaceCard {
@property() public lovelace?: Lovelace;
@property({ attribute: false }) public lovelace?: Lovelace;
@property() public hass!: MockHomeAssistant;
@property({ attribute: false }) public hass!: MockHomeAssistant;
@property() private _switching?: boolean;
@internalProperty() private _switching?: boolean;
private _hidden = localStorage.hide_demo_card;

View File

@@ -21,7 +21,7 @@ import { filterAndSort } from "../components/hassio-filter-addons";
import { hassioStyle } from "../resources/hassio-style";
class HassioAddonRepositoryEl extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public repo!: HassioAddonRepository;

View File

@@ -6,6 +6,7 @@ import {
CSSResult,
LitElement,
property,
internalProperty,
PropertyValues,
} from "lit-element";
import { html, TemplateResult } from "lit-html";
@@ -24,6 +25,7 @@ import { HomeAssistant, Route } from "../../../src/types";
import { showRepositoriesDialog } from "../dialogs/repositories/show-dialog-repositories";
import { supervisorTabs } from "../hassio-tabs";
import "./hassio-addon-repository";
import { ActionDetail } from "@material/mwc-list/mwc-list-foundation";
const sortRepos = (a: HassioAddonRepository, b: HassioAddonRepository) => {
if (a.slug === "local") {
@@ -52,7 +54,7 @@ class HassioAddonStore extends LitElement {
@property({ attribute: false }) private _repos?: HassioAddonRepository[];
@property() private _filter?: string;
@internalProperty() private _filter?: string;
public async refreshData() {
this._repos = undefined;
@@ -96,14 +98,18 @@ class HassioAddonStore extends LitElement {
.tabs=${supervisorTabs}
>
<span slot="header">Add-on store</span>
<ha-button-menu corner="BOTTOM_START" slot="toolbar-icon">
<ha-button-menu
corner="BOTTOM_START"
slot="toolbar-icon"
@action=${this._handleAction}
>
<mwc-icon-button slot="trigger" alt="menu">
<ha-svg-icon path=${mdiDotsVertical}></ha-svg-icon>
</mwc-icon-button>
<mwc-list-item @tap=${this._manageRepositories}>
<mwc-list-item>
Repositories
</mwc-list-item>
<mwc-list-item @tap=${this.refreshData}>
<mwc-list-item>
Reload
</mwc-list-item>
</ha-button-menu>
@@ -142,6 +148,17 @@ class HassioAddonStore extends LitElement {
this._loadData();
}
private _handleAction(ev: CustomEvent<ActionDetail>) {
switch (ev.detail.index) {
case 0:
this._manageRepositories();
break;
case 1:
this.refreshData();
break;
}
}
private apiCalled(ev) {
if (ev.detail.success) {
this._loadData();

View File

@@ -9,6 +9,7 @@ import {
html,
LitElement,
property,
internalProperty,
PropertyValues,
TemplateResult,
} from "lit-element";
@@ -34,15 +35,15 @@ class HassioAddonAudio extends LitElement {
@property({ attribute: false }) public addon!: HassioAddonDetails;
@property() private _error?: string;
@internalProperty() private _error?: string;
@property() private _inputDevices?: HassioHardwareAudioDevice[];
@internalProperty() private _inputDevices?: HassioHardwareAudioDevice[];
@property() private _outputDevices?: HassioHardwareAudioDevice[];
@internalProperty() private _outputDevices?: HassioHardwareAudioDevice[];
@property() private _selectedInput!: null | string;
@internalProperty() private _selectedInput!: null | string;
@property() private _selectedOutput!: null | string;
@internalProperty() private _selectedOutput!: null | string;
protected render(): TemplateResult {
return html`

View File

@@ -7,6 +7,7 @@ import {
html,
LitElement,
property,
internalProperty,
PropertyValues,
query,
TemplateResult,
@@ -32,7 +33,7 @@ class HassioAddonConfig extends LitElement {
@property({ attribute: false }) public addon!: HassioAddonDetails;
@property() private _error?: string;
@internalProperty() private _error?: string;
@property({ type: Boolean }) private _configHasChanged = false;

View File

@@ -6,6 +6,7 @@ import {
html,
LitElement,
property,
internalProperty,
PropertyValues,
TemplateResult,
} from "lit-element";
@@ -37,9 +38,9 @@ class HassioAddonNetwork extends LitElement {
@property({ attribute: false }) public addon!: HassioAddonDetails;
@property() private _error?: string;
@internalProperty() private _error?: string;
@property() private _config?: NetworkItem[];
@internalProperty() private _config?: NetworkItem[];
public connectedCallback(): void {
super.connectedCallback();

View File

@@ -5,6 +5,7 @@ import {
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import "../../../../src/components/ha-markdown";
@@ -24,9 +25,9 @@ class HassioAddonDocumentationDashboard extends LitElement {
@property({ attribute: false }) public addon?: HassioAddonDetails;
@property() private _error?: string;
@internalProperty() private _error?: string;
@property() private _content?: string;
@internalProperty() private _content?: string;
public async connectedCallback(): Promise<void> {
super.connectedCallback();

View File

@@ -23,6 +23,7 @@ import {
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import { classMap } from "lit-html/directives/class-map";
@@ -124,7 +125,7 @@ class HassioAddonInfo extends LitElement {
@property({ attribute: false }) public addon!: HassioAddonDetails;
@property() private _error?: string;
@internalProperty() private _error?: string;
@property({ type: Boolean }) private _installing = false;

View File

@@ -6,6 +6,7 @@ import {
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import "../../../../src/components/ha-card";
@@ -24,9 +25,9 @@ class HassioAddonLogs extends LitElement {
@property({ attribute: false }) public addon!: HassioAddonDetails;
@property() private _error?: string;
@internalProperty() private _error?: string;
@property() private _content?: string;
@internalProperty() private _content?: string;
public async connectedCallback(): Promise<void> {
super.connectedCallback();

View File

@@ -14,7 +14,7 @@ import { HomeAssistant } from "../../../src/types";
@customElement("hassio-card-content")
class HassioCardContent extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public title!: string;

View File

@@ -19,7 +19,7 @@ import { hassioStyle } from "../resources/hassio-style";
@customElement("hassio-addons")
class HassioAddons extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public addons?: HassioAddonInfo[];

View File

@@ -7,6 +7,7 @@ import {
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import "../../../src/components/buttons/ha-call-api-button";
@@ -23,15 +24,15 @@ import { hassioStyle } from "../resources/hassio-style";
@customElement("hassio-update")
export class HassioUpdate extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public hassInfo: HassioHomeAssistantInfo;
@property({ attribute: false }) public hassInfo: HassioHomeAssistantInfo;
@property() public hassOsInfo?: HassioHassOSInfo;
@property({ attribute: false }) public hassOsInfo?: HassioHassOSInfo;
@property() public supervisorInfo: HassioSupervisorInfo;
@property() private _error?: string;
@internalProperty() private _error?: string;
protected render(): TemplateResult {
const updatesAvailable: number = [

View File

@@ -5,6 +5,7 @@ import {
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import { createCloseHeading } from "../../../../src/components/ha-dialog";
@@ -16,13 +17,13 @@ import { HassioMarkdownDialogParams } from "./show-dialog-hassio-markdown";
@customElement("dialog-hassio-markdown")
class HassioMarkdownDialog extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public title!: string;
@property() public content!: string;
@property() private _opened = false;
@internalProperty() private _opened = false;
public showDialog(params: HassioMarkdownDialogParams) {
this.title = params.title;

View File

@@ -13,6 +13,7 @@ import {
html,
LitElement,
property,
internalProperty,
query,
TemplateResult,
} from "lit-element";
@@ -39,11 +40,11 @@ class HassioRepositoriesDialog extends LitElement {
@query("#repository_input") private _optionInput?: PaperInputElement;
@property() private _opened = false;
@internalProperty() private _opened = false;
@property() private _prosessing = false;
@internalProperty() private _prosessing = false;
@property() private _error?: string;
@internalProperty() private _error?: string;
public async showDialog(_dialogParams: any): Promise<void> {
this._dialogParams = _dialogParams;

View File

@@ -9,6 +9,7 @@ import {
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import { createCloseHeading } from "../../../../src/components/ha-dialog";
@@ -68,21 +69,21 @@ interface FolderItem {
@customElement("dialog-hassio-snapshot")
class HassioSnapshotDialog extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() private _error?: string;
@internalProperty() private _error?: string;
@property() private _snapshot?: HassioSnapshotDetail;
@internalProperty() private _snapshot?: HassioSnapshotDetail;
@property() private _folders!: FolderItem[];
@internalProperty() private _folders!: FolderItem[];
@property() private _addons!: AddonItem[];
@internalProperty() private _addons!: AddonItem[];
@property() private _dialogParams?: HassioSnapshotDialogParams;
@internalProperty() private _dialogParams?: HassioSnapshotDialogParams;
@property() private _snapshotPassword!: string;
@internalProperty() private _snapshotPassword!: string;
@property() private _restoreHass: boolean | null | undefined = true;
@internalProperty() private _restoreHass: boolean | null | undefined = true;
public async showDialog(params: HassioSnapshotDialogParams) {
this._snapshot = await fetchHassioSnapshotInfo(this.hass, params.slug);

View File

@@ -1,5 +1,10 @@
import { PolymerElement } from "@polymer/polymer";
import { customElement, property, PropertyValues } from "lit-element";
import {
customElement,
property,
internalProperty,
PropertyValues,
} from "lit-element";
import { applyThemesOnElement } from "../../src/common/dom/apply_themes_on_element";
import { fireEvent } from "../../src/common/dom/fire_event";
import { navigate } from "../../src/common/navigate";
@@ -37,7 +42,7 @@ import "./hassio-panel";
@customElement("hassio-main")
class HassioMain extends ProvideHassLitMixin(HassRouterPage) {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public panel!: HassioPanelInfo;
@@ -73,15 +78,15 @@ class HassioMain extends ProvideHassLitMixin(HassRouterPage) {
},
};
@property() private _supervisorInfo: HassioSupervisorInfo;
@internalProperty() private _supervisorInfo: HassioSupervisorInfo;
@property() private _hostInfo: HassioHostInfo;
@internalProperty() private _hostInfo: HassioHostInfo;
@property() private _hassioInfo?: HassioInfo;
@internalProperty() private _hassioInfo?: HassioInfo;
@property() private _hassOsInfo?: HassioHassOSInfo;
@internalProperty() private _hassOsInfo?: HassioHassOSInfo;
@property() private _hassInfo: HassioHomeAssistantInfo;
@internalProperty() private _hassInfo: HassioHomeAssistantInfo;
protected firstUpdated(changedProps: PropertyValues) {
super.firstUpdated(changedProps);

View File

@@ -5,6 +5,7 @@ import {
html,
LitElement,
property,
internalProperty,
PropertyValues,
TemplateResult,
} from "lit-element";
@@ -19,11 +20,11 @@ import { HomeAssistant, Route } from "../../../src/types";
@customElement("hassio-ingress-view")
class HassioIngressView extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public route!: Route;
@property() private _addon?: HassioAddonDetails;
@internalProperty() private _addon?: HassioAddonDetails;
protected render(): TemplateResult {
if (!this._addon) {

View File

@@ -15,6 +15,7 @@ import {
html,
LitElement,
property,
internalProperty,
PropertyValues,
TemplateResult,
} from "lit-element";
@@ -56,19 +57,19 @@ class HassioSnapshots extends LitElement {
@property({ attribute: false }) public supervisorInfo!: HassioSupervisorInfo;
@property() private _snapshotName = "";
@internalProperty() private _snapshotName = "";
@property() private _snapshotPassword = "";
@internalProperty() private _snapshotPassword = "";
@property() private _snapshotHasPassword = false;
@internalProperty() private _snapshotHasPassword = false;
@property() private _snapshotType: HassioSnapshot["type"] = "full";
@internalProperty() private _snapshotType: HassioSnapshot["type"] = "full";
@property() private _snapshots?: HassioSnapshot[] = [];
@internalProperty() private _snapshots?: HassioSnapshot[] = [];
@property() private _addonList: CheckboxItem[] = [];
@internalProperty() private _addonList: CheckboxItem[] = [];
@property() private _folderList: CheckboxItem[] = [
@internalProperty() private _folderList: CheckboxItem[] = [
{
slug: "homeassistant",
name: "Home Assistant configuration",
@@ -79,9 +80,9 @@ class HassioSnapshots extends LitElement {
{ slug: "addons/local", name: "Local add-ons", checked: true },
];
@property() private _creatingSnapshot = false;
@internalProperty() private _creatingSnapshot = false;
@property() private _error = "";
@internalProperty() private _error = "";
public async refreshData() {
await reloadHassioSnapshots(this.hass);

View File

@@ -6,6 +6,7 @@ import {
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import "../../../src/components/buttons/ha-call-api-button";
@@ -32,15 +33,15 @@ import { hassioStyle } from "../resources/hassio-style";
@customElement("hassio-host-info")
class HassioHostInfo extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public hostInfo!: HassioHostInfoType;
@property({ attribute: false }) public hassioInfo!: HassioInfo;
@property() public hassOsInfo!: HassioHassOSInfo;
@property({ attribute: false }) public hassOsInfo!: HassioHassOSInfo;
@property() private _errors?: string;
@internalProperty() private _errors?: string;
public render(): TemplateResult | void {
return html`

View File

@@ -6,6 +6,7 @@ import {
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import { fireEvent } from "../../../src/common/dom/fire_event";
@@ -23,11 +24,11 @@ import { hassioStyle } from "../resources/hassio-style";
@customElement("hassio-supervisor-info")
class HassioSupervisorInfo extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public supervisorInfo!: HassioSupervisorInfoType;
@property() private _errors?: string;
@internalProperty() private _errors?: string;
public render(): TemplateResult | void {
return html`

View File

@@ -9,6 +9,7 @@ import {
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import "../../../src/components/ha-card";
@@ -55,11 +56,11 @@ const logProviders: LogProvider[] = [
class HassioSupervisorLog extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() private _error?: string;
@internalProperty() private _error?: string;
@property() private _selectedLogProvider = "supervisor";
@internalProperty() private _selectedLogProvider = "supervisor";
@property() private _content?: string;
@internalProperty() private _content?: string;
public async connectedCallback(): Promise<void> {
super.connectedCallback();

View File

@@ -13,7 +13,7 @@
"lint:prettier": "prettier '**/src/**/*.{js,ts,json,css,md}' --check",
"format:prettier": "prettier '**/src/**/*.{js,ts,json,css,md}' --write",
"lint:types": "tsc",
"lint:lit": "lit-analyzer '**/src/**/*.ts'",
"lint:lit": "lit-analyzer '**/src/**/*.ts' --format markdown --outFile result.md",
"lint": "npm run lint:eslint && npm run lint:prettier && npm run lint:types",
"format": "npm run format:eslint && npm run format:prettier",
"mocha": "node_modules/.bin/ts-mocha -p test-mocha/tsconfig.test.json --opts test-mocha/mocha.opts",
@@ -74,6 +74,7 @@
"@polymer/paper-tooltip": "^3.0.1",
"@polymer/polymer": "3.1.0",
"@thomasloven/round-slider": "0.5.0",
"@types/chromecast-caf-sender": "^1.0.3",
"@vaadin/vaadin-combo-box": "^5.0.10",
"@vaadin/vaadin-date-picker": "^4.0.7",
"@vue/web-component-wrapper": "^1.2.0",
@@ -107,8 +108,7 @@
"regenerator-runtime": "^0.13.2",
"resize-observer-polyfill": "^1.5.1",
"roboto-fontface": "^0.10.0",
"superstruct": "^0.6.1",
"svg-gauge": "^1.0.6",
"superstruct": "^0.10.12",
"unfetch": "^4.1.0",
"vue": "^2.6.11",
"vue2-daterange-picker": "^0.5.1",
@@ -171,7 +171,7 @@
"html-minifier": "^4.0.0",
"husky": "^1.3.1",
"lint-staged": "^8.1.5",
"lit-analyzer": "^1.1.10",
"lit-analyzer": "^1.2.0",
"lodash.template": "^4.5.0",
"magic-string": "^0.25.7",
"map-stream": "^0.0.7",
@@ -192,7 +192,7 @@
"source-map-url": "^0.4.0",
"systemjs": "^6.3.2",
"terser-webpack-plugin": "^3.0.6",
"ts-lit-plugin": "^1.1.10",
"ts-lit-plugin": "^1.2.0",
"ts-mocha": "^6.0.0",
"typescript": "^3.8.3",
"vinyl-buffer": "^1.0.1",

View File

@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
setup(
name="home-assistant-frontend",
version="20200714.0",
version="20200716.0",
description="The Home Assistant frontend",
url="https://github.com/home-assistant/home-assistant-polymer",
author="The Home Assistant Authors",

View File

@@ -5,6 +5,7 @@ import {
html,
LitElement,
property,
internalProperty,
PropertyValues,
TemplateResult,
} from "lit-element";
@@ -28,13 +29,13 @@ class HaAuthFlow extends litLocalizeLiteMixin(LitElement) {
@property() public oauth2State?: string;
@property() private _state: State = "loading";
@internalProperty() private _state: State = "loading";
@property() private _stepData: any = {};
@internalProperty() private _stepData: any = {};
@property() private _step?: DataEntryFlowStep;
@internalProperty() private _step?: DataEntryFlowStep;
@property() private _errorMessage?: string;
@internalProperty() private _errorMessage?: string;
protected render() {
return html`

View File

@@ -4,6 +4,7 @@ import {
html,
LitElement,
property,
internalProperty,
PropertyValues,
} from "lit-element";
import {
@@ -25,9 +26,9 @@ class HaAuthorize extends litLocalizeLiteMixin(LitElement) {
@property() public oauth2State?: string;
@property() private _authProvider?: AuthProvider;
@internalProperty() private _authProvider?: AuthProvider;
@property() private _authProviders?: AuthProvider[];
@internalProperty() private _authProviders?: AuthProvider[];
constructor() {
super();

View File

@@ -1,4 +1,8 @@
/* eslint-disable no-undef, no-console */
import {
CastStateEventData,
SessionStateEventData,
} from "chromecast-caf-receiver/cast.framework";
import { Auth } from "home-assistant-js-websocket";
import { castApiAvailable } from "./cast_framework";
import { CAST_APP_ID, CAST_DEV, CAST_NS } from "./const";
@@ -40,16 +44,13 @@ export class CastManager {
const context = this.castContext;
context.setOptions({
receiverApplicationId: CAST_APP_ID,
// @ts-ignore
autoJoinPolicy: chrome.cast.AutoJoinPolicy.ORIGIN_SCOPED,
});
context.addEventListener(
// @ts-ignore
cast.framework.CastContextEventType.SESSION_STATE_CHANGED,
(ev) => this._sessionStateChanged(ev)
);
context.addEventListener(
// @ts-ignore
cast.framework.CastContextEventType.CAST_STATE_CHANGED,
(ev) => this._castStateChanged(ev)
);
@@ -118,7 +119,7 @@ export class CastManager {
}
}
private _sessionStateChanged(ev) {
private _sessionStateChanged(ev: SessionStateEventData) {
if (__DEV__) {
console.log("Cast session state changed", ev.sessionState);
}
@@ -141,7 +142,7 @@ export class CastManager {
}
}
private _castStateChanged(ev) {
private _castStateChanged(ev: CastStateEventData) {
if (__DEV__) {
console.log("Cast state changed", ev.castState);
}

View File

@@ -1,4 +1,10 @@
export default function durationToSeconds(duration: string): number {
let days = 0;
if (duration.includes("day")) {
const position = duration.indexOf("day");
days = Number(duration.substr(0, position));
duration = duration.split(",")[1];
}
const parts = duration.split(":").map(Number);
return parts[0] * 3600 + parts[1] * 60 + parts[2];
return (days * 24 + parts[0]) * 3600 + parts[1] * 60 + parts[2];
}

View File

@@ -23,7 +23,8 @@ const _load = (
if (type) {
(element as HTMLScriptElement).type = type;
// https://github.com/home-assistant/frontend/pull/6328
(element as HTMLScriptElement).crossOrigin = url.substr(0, 1) === "/" ? "use-credentials" : "anonymous";
(element as HTMLScriptElement).crossOrigin =
url.substr(0, 1) === "/" ? "use-credentials" : "anonymous";
}
break;
case "link":

View File

@@ -0,0 +1,14 @@
import {
RequestSelectedDetail,
ListItem,
} from "@material/mwc-list/mwc-list-item";
export const shouldHandleRequestSelectedEvent = (
ev: CustomEvent<RequestSelectedDetail>
): boolean => {
if (!ev.detail.selected && ev.detail.source !== "property") {
return false;
}
(ev.target as ListItem).selected = false;
return true;
};

View File

@@ -19,7 +19,13 @@ export const iconColorCSS = css`
ha-icon[data-domain="sun"][data-state="above_horizon"],
ha-icon[data-domain="switch"][data-state="on"],
ha-icon[data-domain="timer"][data-state="active"],
ha-icon[data-domain="vacuum"][data-state="cleaning"] {
ha-icon[data-domain="vacuum"][data-state="cleaning"],
ha-icon[data-domain="group"][data-state="on"],
ha-icon[data-domain="group"][data-state="home"],
ha-icon[data-domain="group"][data-state="open"],
ha-icon[data-domain="group"][data-state="locked"],
ha-icon[data-domain="group"][data-state="problem"]
{
color: var(--paper-item-icon-active-color, #fdd835);
}

View File

@@ -9,5 +9,9 @@ export function computeRTL(hass: HomeAssistant) {
}
export function computeRTLDirection(hass: HomeAssistant) {
return computeRTL(hass) ? "rtl" : "ltr";
return emitRTLDirection(computeRTL(hass));
}
export function emitRTLDirection(rtl: boolean) {
return rtl ? "rtl" : "ltr";
}

View File

@@ -6,11 +6,11 @@ import {
html,
LitElement,
property,
internalProperty,
PropertyValues,
query,
TemplateResult,
eventOptions,
internalProperty,
} from "lit-element";
import { classMap } from "lit-html/directives/class-map";
import { ifDefined } from "lit-html/directives/if-defined";
@@ -98,6 +98,8 @@ export class HaDataTable extends LitElement {
@property({ type: String }) public noDataText?: string;
@property({ type: String }) public searchLabel?: string;
@property({ type: String }) public filter = "";
@internalProperty() private _filterable = false;
@@ -202,6 +204,7 @@ export class HaDataTable extends LitElement {
<div class="table-header">
<search-input
@value-changed=${this._handleSearchChange}
.label=${this.searchLabel}
></search-input>
</div>
`

View File

@@ -13,6 +13,7 @@ import {
html,
LitElement,
property,
internalProperty,
PropertyValues,
TemplateResult,
} from "lit-element";
@@ -87,7 +88,7 @@ const rowRenderer = (
@customElement("ha-area-devices-picker")
export class HaAreaDevicesPicker extends SubscribeMixin(LitElement) {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public label?: string;
@@ -124,13 +125,13 @@ export class HaAreaDevicesPicker extends SubscribeMixin(LitElement) {
@property({ type: Boolean })
private _opened?: boolean;
@property() private _areaPicker = true;
@internalProperty() private _areaPicker = true;
@property() private _devices?: DeviceRegistryEntry[];
@internalProperty() private _devices?: DeviceRegistryEntry[];
@property() private _areas?: AreaRegistryEntry[];
@internalProperty() private _areas?: AreaRegistryEntry[];
@property() private _entities?: EntityRegistryEntry[];
@internalProperty() private _entities?: EntityRegistryEntry[];
private _selectedDevices: string[] = [];

View File

@@ -8,6 +8,7 @@ import {
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import { fireEvent } from "../../common/dom/fire_event";
@@ -24,7 +25,7 @@ const UNKNOWN_AUTOMATION_KEY = "UNKNOWN_AUTOMATION";
export abstract class HaDeviceAutomationPicker<
T extends DeviceAutomation
> extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public label?: string;
@@ -36,11 +37,11 @@ export abstract class HaDeviceAutomationPicker<
protected UNKNOWN_AUTOMATION_TEXT = "Unknown automation";
@property() private _automations: T[] = [];
@internalProperty() private _automations: T[] = [];
// Trigger an empty render so we start with a clean DOM.
// paper-listbox does not like changing things around.
@property() private _renderEmpty = false;
@internalProperty() private _renderEmpty = false;
private _localizeDeviceAutomation: (
hass: HomeAssistant,
@@ -116,11 +117,7 @@ export abstract class HaDeviceAutomationPicker<
>
${this.NO_AUTOMATION_TEXT}
</paper-item>
<paper-item
key=${UNKNOWN_AUTOMATION_KEY}
.automation=${this.value}
hidden
>
<paper-item key=${UNKNOWN_AUTOMATION_KEY} hidden>
${this.UNKNOWN_AUTOMATION_TEXT}
</paper-item>
${this._automations.map(
@@ -174,18 +171,17 @@ export abstract class HaDeviceAutomationPicker<
}
private _automationChanged(ev) {
this._setValue(ev.detail.item.automation);
if (ev.detail.item.automation) {
this._setValue(ev.detail.item.automation);
}
}
private _setValue(automation: T) {
if (this.value && deviceAutomationsEqual(automation, this.value)) {
return;
}
this.value = automation;
setTimeout(() => {
fireEvent(this, "change");
fireEvent(this, "value-changed", { value: automation });
}, 0);
fireEvent(this, "change");
fireEvent(this, "value-changed", { value: automation });
}
static get styles(): CSSResult {

View File

@@ -66,7 +66,7 @@ const rowRenderer = (root: HTMLElement, _owner, model: { item: Device }) => {
@customElement("ha-device-picker")
export class HaDevicePicker extends SubscribeMixin(LitElement) {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public label?: string;

View File

@@ -12,7 +12,7 @@ import "./ha-device-picker";
@customElement("ha-devices-picker")
class HaDevicesPicker extends LitElement {
@property() public hass?: HomeAssistant;
@property({ attribute: false }) public hass?: HomeAssistant;
@property() public value?: string[];

View File

@@ -15,7 +15,7 @@ import type { HaEntityPickerEntityFilterFunc } from "./ha-entity-picker";
@customElement("ha-entities-picker")
class HaEntitiesPickerLight extends LitElement {
@property() public hass?: HomeAssistant;
@property({ attribute: false }) public hass?: HomeAssistant;
@property() public value?: string[];

View File

@@ -59,7 +59,7 @@ class HaEntityPicker extends LitElement {
@property({ type: Boolean, attribute: "allow-custom-entity" })
public allowCustomEntity;
@property() public hass?: HomeAssistant;
@property({ attribute: false }) public hass?: HomeAssistant;
@property() public label?: string;

View File

@@ -6,6 +6,7 @@ import {
html,
LitElement,
property,
internalProperty,
PropertyValues,
TemplateResult,
} from "lit-element";
@@ -28,7 +29,7 @@ export class HaEntityToggle extends LitElement {
@property() public stateObj?: HassEntity;
@property() private _isOn = false;
@internalProperty() private _isOn = false;
protected render(): TemplateResult {
if (!this.stateObj) {

View File

@@ -6,6 +6,7 @@ import {
html,
LitElement,
property,
internalProperty,
PropertyValues,
TemplateResult,
} from "lit-element";
@@ -22,7 +23,7 @@ import "../ha-label-badge";
@customElement("ha-state-label-badge")
export class HaStateLabelBadge extends LitElement {
@property() public hass?: HomeAssistant;
@property({ attribute: false }) public hass?: HomeAssistant;
@property() public state?: HassEntity;
@@ -32,7 +33,7 @@ export class HaStateLabelBadge extends LitElement {
@property() public image?: string;
@property() private _timerTimeRemaining?: number;
@internalProperty() private _timerTimeRemaining?: number;
private _connected?: boolean;

View File

@@ -6,6 +6,7 @@ import {
html,
LitElement,
property,
internalProperty,
PropertyValues,
TemplateResult,
} from "lit-element";
@@ -31,7 +32,7 @@ export class StateBadge extends LitElement {
@property({ type: Boolean, reflect: true, attribute: "icon" })
private _showIcon = true;
@property() private _iconStyle: { [name: string]: string } = {};
@internalProperty() private _iconStyle: { [name: string]: string } = {};
protected render(): TemplateResult {
const stateObj = this.stateObj;

View File

@@ -12,6 +12,7 @@ import {
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import { fireEvent } from "../common/dom/fire_event";
@@ -61,7 +62,7 @@ const rowRenderer = (
@customElement("ha-area-picker")
export class HaAreaPicker extends SubscribeMixin(LitElement) {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public label?: string;
@@ -72,7 +73,7 @@ export class HaAreaPicker extends SubscribeMixin(LitElement) {
@property({ type: Boolean, attribute: "no-add" })
public noAdd?: boolean;
@property() private _opened?: boolean;
@internalProperty() private _opened?: boolean;
public hassSubscribe(): UnsubscribeFunc[] {
return [

View File

@@ -17,7 +17,7 @@ let jsYamlPromise: Promise<typeof import("js-yaml")>;
class HaAttributes extends LitElement {
@property() public stateObj?: HassEntity;
@property() public extraFilters?: string;
@property({ attribute: "extra-filters" }) public extraFilters?: string;
protected render(): TemplateResult {
if (!this.stateObj) {

View File

@@ -10,7 +10,6 @@ import {
} from "lit-element";
import "@material/mwc-button";
import "@material/mwc-menu";
import "@material/mwc-list/mwc-list-item";
import type { Menu, Corner } from "@material/mwc-menu";
import "./ha-icon-button";
@@ -19,14 +18,30 @@ import "./ha-icon-button";
export class HaButtonMenu extends LitElement {
@property() public corner: Corner = "TOP_START";
@property({ type: Boolean }) public multi = false;
@property({ type: Boolean }) public activatable = false;
@query("mwc-menu") private _menu?: Menu;
public get items() {
return this._menu?.items;
}
public get selected() {
return this._menu?.selected;
}
protected render(): TemplateResult {
return html`
<div @click=${this._handleClick}>
<slot name="trigger"></slot>
</div>
<mwc-menu .corner=${this.corner}>
<mwc-menu
.corner=${this.corner}
.multi=${this.multi}
.activatable=${this.activatable}
>
<slot></slot>
</mwc-menu>
`;

View File

@@ -5,6 +5,7 @@ import {
html,
LitElement,
property,
internalProperty,
PropertyValues,
TemplateResult,
} from "lit-element";
@@ -22,17 +23,17 @@ type HLSModule = typeof import("hls.js");
@customElement("ha-camera-stream")
class HaCameraStream extends LitElement {
@property() public hass?: HomeAssistant;
@property({ attribute: false }) public hass?: HomeAssistant;
@property() public stateObj?: CameraEntity;
@property({ type: Boolean }) public showControls = false;
@property() private _attached = false;
@internalProperty() private _attached = false;
// We keep track if we should force MJPEG with a string
// that way it automatically resets if we change entity.
@property() private _forceMJPEG: string | undefined = undefined;
@internalProperty() private _forceMJPEG: string | undefined = undefined;
private _hlsPolyfillInstance?: Hls;

View File

@@ -9,7 +9,7 @@ import {
} from "lit-element";
@customElement("ha-card")
class HaCard extends LitElement {
export class HaCard extends LitElement {
@property() public header?: string;
@property({ type: Boolean, reflect: true }) public outlined = false;

View File

@@ -2,6 +2,7 @@ import { Editor } from "codemirror";
import {
customElement,
property,
internalProperty,
PropertyValues,
UpdatingElement,
} from "lit-element";
@@ -28,7 +29,7 @@ export class HaCodeEditor extends UpdatingElement {
@property() public error = false;
@property() private _value = "";
@internalProperty() private _value = "";
public set value(value: string) {
this._value = value;

View File

@@ -17,6 +17,8 @@ import "./ha-svg-icon";
import "@polymer/paper-input/paper-input";
import "@material/mwc-list/mwc-list";
import "./date-range-picker";
import { computeRTLDirection } from "../common/util/compute_rtl";
import { ActionDetail } from "@material/mwc-list/mwc-list-foundation";
export interface DateRangePickerRanges {
[key: string]: [Date, Date];
@@ -24,7 +26,7 @@ export interface DateRangePickerRanges {
@customElement("ha-date-range-picker")
export class HaDateRangePicker extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public startDate!: Date;
@@ -36,11 +38,14 @@ export class HaDateRangePicker extends LitElement {
@property({ type: Boolean }) private _hour24format = false;
@property({ type: String }) private _rtlDirection = "ltr";
protected updated(changedProps: PropertyValues) {
if (changedProps.has("hass")) {
const oldHass = changedProps.get("hass") as HomeAssistant | undefined;
if (!oldHass || oldHass.language !== this.hass.language) {
this._hour24format = this._compute24hourFormat();
this._rtlDirection = computeRTLDirection(this.hass);
}
}
}
@@ -76,16 +81,14 @@ export class HaDateRangePicker extends LitElement {
></paper-input>
</div>
${this.ranges
? html`<div slot="ranges" class="date-range-ranges">
<mwc-list @click=${this._setDateRange}>
${Object.entries(this.ranges).map(
([name, dates]) => html`<mwc-list-item
.activated=${this.startDate.getTime() ===
dates[0].getTime() &&
this.endDate.getTime() === dates[1].getTime()}
.startDate=${dates[0]}
.endDate=${dates[1]}
>
? html`<div
slot="ranges"
class="date-range-ranges"
.dir=${this._rtlDirection}
>
<mwc-list @action=${this._setDateRange} activatable>
${Object.keys(this.ranges).map(
(name) => html`<mwc-list-item>
${name}
</mwc-list-item>`
)}
@@ -116,12 +119,10 @@ export class HaDateRangePicker extends LitElement {
);
}
private _setDateRange(ev: Event) {
const target = ev.target as any;
const startDate = target.startDate;
const endDate = target.endDate;
private _setDateRange(ev: CustomEvent<ActionDetail>) {
const dateRange = Object.values(this.ranges!)[ev.detail.index];
const dateRangePicker = this._dateRangePicker;
dateRangePicker.clickRange([startDate, endDate]);
dateRangePicker.clickRange(dateRange);
dateRangePicker.clickedApply();
}

View File

@@ -5,7 +5,7 @@ import "./ha-icon-button";
import { css, CSSResult, customElement, html } from "lit-element";
import type { Constructor, HomeAssistant } from "../types";
import { mdiClose } from "@mdi/js";
import { computeRTL } from "../common/util/compute_rtl";
import { computeRTLDirection } from "../common/util/compute_rtl";
const MwcDialog = customElements.get("mwc-dialog") as Constructor<Dialog>;
@@ -14,8 +14,8 @@ export const createCloseHeading = (hass: HomeAssistant, title: string) => html`
<mwc-icon-button
aria-label=${hass.localize("ui.dialogs.generic.close")}
dialogAction="close"
?rtl=${computeRTL(hass)}
class="header_button"
dir=${computeRTLDirection(hass)}
>
<ha-svg-icon path=${mdiClose}></ha-svg-icon>
</mwc-icon-button>
@@ -51,7 +51,7 @@ export class HaDialog extends MwcDialog {
padding: var(--dialog-content-padding, 20px 24px);
}
.mdc-dialog .mdc-dialog__surface {
position: var(--dialog-content-position, relative);
position: var(--dialog-surface-position, relative);
min-height: var(--mdc-dialog-min-height, auto);
}
.header_button {
@@ -61,7 +61,7 @@ export class HaDialog extends MwcDialog {
text-decoration: none;
color: inherit;
}
mwc-icon-button[rtl].header_button {
[dir="rtl"].header_button {
right: auto;
left: 16px;
}

View File

@@ -11,6 +11,7 @@ import {
html,
LitElement,
property,
internalProperty,
query,
TemplateResult,
} from "lit-element";
@@ -32,7 +33,7 @@ export class HaFormMultiSelect extends LitElement implements HaFormElement {
@property() public suffix!: string;
@property() private _init = false;
@internalProperty() private _init = false;
@query("paper-menu-button") private _input?: HTMLElement;

View File

@@ -6,6 +6,7 @@ import {
html,
LitElement,
property,
internalProperty,
query,
TemplateResult,
} from "lit-element";
@@ -26,7 +27,7 @@ export class HaFormString extends LitElement implements HaFormElement {
@property() public suffix!: string;
@property() private _unmaskedPassword = false;
@internalProperty() private _unmaskedPassword = false;
@query("paper-input") private _input?: HTMLElement;

130
src/components/ha-gauge.ts Normal file
View File

@@ -0,0 +1,130 @@
import {
LitElement,
svg,
customElement,
css,
property,
internalProperty,
PropertyValues,
} from "lit-element";
import { styleMap } from "lit-html/directives/style-map";
import { afterNextRender } from "../common/util/render-status";
const getAngle = (value: number, min: number, max: number) => {
const percentage = getValueInPercentage(normalize(value, min, max), min, max);
return (percentage * 180) / 100;
};
const normalize = (value: number, min: number, max: number) => {
if (value > max) return max;
if (value < min) return min;
return value;
};
const getValueInPercentage = (value: number, min: number, max: number) => {
const newMax = max - min;
const newVal = value - min;
return (100 * newVal) / newMax;
};
@customElement("ha-gauge")
export class Gauge extends LitElement {
@property({ type: Number }) public min = 0;
@property({ type: Number }) public max = 100;
@property({ type: Number }) public value = 0;
@property() public label = "";
@internalProperty() private _angle = 0;
@internalProperty() private _updated = false;
protected firstUpdated(changedProperties: PropertyValues) {
super.firstUpdated(changedProperties);
// Wait for the first render for the initial animation to work
afterNextRender(() => {
this._updated = true;
this._angle = getAngle(this.value, this.min, this.max);
this._rescale_svg();
});
}
protected updated(changedProperties: PropertyValues) {
super.updated(changedProperties);
if (!this._updated || !changedProperties.has("value")) {
return;
}
this._angle = getAngle(this.value, this.min, this.max);
this._rescale_svg();
}
protected render() {
return svg`
<svg viewBox="0 0 100 50" class="gauge">
<path
class="dial"
d="M 10 50 A 40 40 0 0 1 90 50"
></path>
<path
class="value"
style=${styleMap({ transform: `rotate(${this._angle}deg)` })}
d="M 90 50.001 A 40 40 0 0 1 10 50"
></path>
</svg>
<svg class="text">
<text class="value-text">
${this.value} ${this.label}
</text>
</svg>`;
}
private _rescale_svg() {
// Set the viewbox of the SVG containing the value to perfectly
// fit the text
// That way it will auto-scale correctly
const svgRoot = this.shadowRoot!.querySelector(".text")!;
const box = svgRoot.querySelector("text")!.getBBox()!;
svgRoot.setAttribute(
"viewBox",
`${box.x} ${box!.y} ${box.width} ${box.height}`
);
}
static get styles() {
return css`
:host {
position: relative;
}
.dial {
fill: none;
stroke: var(--primary-background-color);
stroke-width: 15;
}
.value {
fill: none;
stroke-width: 15;
stroke: var(--gauge-color);
transition: all 1000ms ease 0s;
transform-origin: 50% 100%;
}
.gauge {
display: block;
}
.text {
position: absolute;
max-height: 40%;
max-width: 55%;
left: 50%;
bottom: -6%;
transform: translate(-50%, 0%);
}
.value-text {
font-size: 50px;
fill: var(--primary-text-color);
text-anchor: middle;
}
`;
}
}

View File

@@ -1,6 +1,7 @@
import {
LitElement,
property,
internalProperty,
TemplateResult,
html,
customElement,
@@ -13,7 +14,7 @@ import "./ha-svg-icon";
export class HaIconButtonArrowNext extends LitElement {
@property({ type: Boolean }) public disabled = false;
@property() private _icon = mdiArrowRight;
@internalProperty() private _icon = mdiArrowRight;
public connectedCallback() {
super.connectedCallback();

View File

@@ -1,6 +1,7 @@
import {
LitElement,
property,
internalProperty,
TemplateResult,
html,
customElement,
@@ -13,7 +14,7 @@ import "./ha-svg-icon";
export class HaIconButtonArrowPrev extends LitElement {
@property({ type: Boolean }) public disabled = false;
@property() private _icon = mdiArrowLeft;
@internalProperty() private _icon = mdiArrowLeft;
public connectedCallback() {
super.connectedCallback();

View File

@@ -1,6 +1,7 @@
import {
LitElement,
property,
internalProperty,
TemplateResult,
html,
customElement,
@@ -13,7 +14,7 @@ import "./ha-svg-icon";
export class HaIconButtonNext extends LitElement {
@property({ type: Boolean }) public disabled = false;
@property() private _icon = mdiChevronRight;
@internalProperty() private _icon = mdiChevronRight;
public connectedCallback() {
super.connectedCallback();

View File

@@ -1,6 +1,7 @@
import {
LitElement,
property,
internalProperty,
TemplateResult,
html,
customElement,
@@ -13,7 +14,7 @@ import "./ha-svg-icon";
export class HaIconButtonPrev extends LitElement {
@property({ type: Boolean }) public disabled = false;
@property() private _icon = mdiChevronLeft;
@internalProperty() private _icon = mdiChevronLeft;
public connectedCallback() {
super.connectedCallback();

View File

@@ -3,6 +3,7 @@ import {
customElement,
LitElement,
property,
internalProperty,
PropertyValues,
html,
TemplateResult,
@@ -88,7 +89,7 @@ const mdiRenameMapping = {
"library-movie": "filmstrip-box-multiple",
"library-music": "music-box-multiple",
"library-music-outline": "music-box-multiple-outline",
"library-video": "play-box-mutiple",
"library-video": "play-box-multiple",
markdown: "language-markdown",
"markdown-outline": "language-markdown-outline",
"message-settings-variant": "message-cog",
@@ -150,6 +151,8 @@ const mdiRenameMapping = {
"textbox-lock": "form-textbox-lock",
"textbox-password": "form-textbox-password",
"syllabary-katakana-half-width": "syllabary-katakana-halfwidth",
"visual-studio-code": "microsoft-visual-studio-code",
"visual-studio": "microsoft-visual-studio",
};
const mdiRemovedIcons = new Set([
@@ -233,11 +236,11 @@ const cachedIcons: { [key: string]: string } = {};
export class HaIcon extends LitElement {
@property() public icon?: string;
@property() private _path?: string;
@internalProperty() private _path?: string;
@property() private _viewBox?;
@internalProperty() private _viewBox?;
@property() private _legacy = false;
@internalProperty() private _legacy = false;
protected updated(changedProps: PropertyValues) {
if (changedProps.has("icon")) {

View File

@@ -15,7 +15,7 @@ class HaLabeledSlider extends PolymerElement {
.title {
margin-bottom: 16px;
opacity: var(--dark-primary-opacity);
color: var(--secondary-text-color);
}
.slider-container {
@@ -24,7 +24,7 @@ class HaLabeledSlider extends PolymerElement {
ha-icon {
margin-top: 4px;
opacity: var(--dark-secondary-opacity);
color: var(--secondary-text-color);
}
ha-paper-slider {

View File

@@ -8,6 +8,7 @@ import {
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import { fireEvent } from "../common/dom/fire_event";
@@ -22,9 +23,9 @@ class HaMenuButton extends LitElement {
@property() public narrow!: boolean;
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() private _hasNotifications = false;
@internalProperty() private _hasNotifications = false;
private _alwaysVisible = false;

View File

@@ -6,6 +6,7 @@ import {
html,
LitElement,
property,
internalProperty,
PropertyValues,
TemplateResult,
} from "lit-element";
@@ -27,19 +28,19 @@ import "./ha-switch";
@customElement("ha-related-items")
export class HaRelatedItems extends SubscribeMixin(LitElement) {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public itemType!: ItemType;
@property() public itemId!: string;
@property() private _entries?: ConfigEntry[];
@internalProperty() private _entries?: ConfigEntry[];
@property() private _devices?: DeviceRegistryEntry[];
@internalProperty() private _devices?: DeviceRegistryEntry[];
@property() private _areas?: AreaRegistryEntry[];
@internalProperty() private _areas?: AreaRegistryEntry[];
@property() private _related?: RelatedResult;
@internalProperty() private _related?: RelatedResult;
public hassSubscribe(): UnsubscribeFunc[] {
return [

View File

@@ -18,6 +18,7 @@ import {
customElement,
LitElement,
property,
internalProperty,
PropertyValues,
} from "lit-element";
import { classMap } from "lit-html/directives/class-map";
@@ -111,7 +112,7 @@ const computePanels = (hass: HomeAssistant): [PanelInfo[], PanelInfo[]] => {
@customElement("ha-sidebar")
class HaSidebar extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public narrow!: boolean;
@@ -119,9 +120,9 @@ class HaSidebar extends LitElement {
@property({ type: Boolean, reflect: true }) public expanded = false;
@property() private _externalConfig?: ExternalConfig;
@internalProperty() private _externalConfig?: ExternalConfig;
@property() private _notifications?: PersistentNotification[];
@internalProperty() private _notifications?: PersistentNotification[];
// property used only in css
// @ts-ignore

View File

@@ -4,10 +4,10 @@ import {
customElement,
LitElement,
property,
internalProperty,
TemplateResult,
html,
queryAsync,
internalProperty,
eventOptions,
} from "lit-element";
import "@material/mwc-ripple/mwc-ripple";

View File

@@ -4,6 +4,7 @@ import {
html,
LitElement,
property,
internalProperty,
query,
TemplateResult,
} from "lit-element";
@@ -41,7 +42,7 @@ export class HaYamlEditor extends LitElement {
@property() public label?: string;
@property() private _yaml = "";
@internalProperty() private _yaml = "";
@query("ha-code-editor") private _editor?: HaCodeEditor;

View File

@@ -22,7 +22,7 @@ import { HomeAssistant } from "../../types";
@customElement("ha-map")
class HaMap extends LitElement {
@property() public hass?: HomeAssistant;
@property({ attribute: false }) public hass?: HomeAssistant;
@property() public entities?: string[];

View File

@@ -46,8 +46,8 @@ export interface MqttTrigger {
export interface GeoLocationTrigger {
platform: "geo_location";
source: "string";
zone: "string";
source: string;
zone: string;
event: "enter" | "leave";
}

View File

@@ -5,7 +5,13 @@ import { HomeAssistant } from "../types";
import { DataEntryFlowProgress, DataEntryFlowStep } from "./data_entry_flow";
import { domainToName } from "./integration";
export const DISCOVERY_SOURCES = ["unignore", "homekit", "ssdp", "zeroconf", "discovery"];
export const DISCOVERY_SOURCES = [
"unignore",
"homekit",
"ssdp",
"zeroconf",
"discovery",
];
export const createConfigFlow = (hass: HomeAssistant, handler: string) =>
hass.callApi<DataEntryFlowStep>("POST", "config/config_entries/flow", {

View File

@@ -7,6 +7,7 @@ import {
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import "../../components/dialog/ha-paper-dialog";
@@ -26,17 +27,17 @@ import { computeRTLDirection } from "../../common/util/compute_rtl";
@customElement("dialog-config-entry-system-options")
class DialogConfigEntrySystemOptions extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() private _disableNewEntities!: boolean;
@internalProperty() private _disableNewEntities!: boolean;
@property() private _error?: string;
@internalProperty() private _error?: string;
@property() private _params?: ConfigEntrySystemOptionsDialogParams;
@internalProperty() private _params?: ConfigEntrySystemOptionsDialogParams;
@property() private _loading?: boolean;
@internalProperty() private _loading?: boolean;
@property() private _submitting?: boolean;
@internalProperty() private _submitting?: boolean;
public async showDialog(
params: ConfigEntrySystemOptionsDialogParams

View File

@@ -10,7 +10,7 @@ import {
customElement,
html,
LitElement,
property,
internalProperty,
PropertyValues,
TemplateResult,
} from "lit-element";
@@ -54,23 +54,23 @@ declare global {
class DataEntryFlowDialog extends LitElement {
public hass!: HomeAssistant;
@property() private _params?: DataEntryFlowDialogParams;
@internalProperty() private _params?: DataEntryFlowDialogParams;
@property() private _loading = true;
@internalProperty() private _loading = true;
private _instance = instance;
@property() private _step:
@internalProperty() private _step:
| DataEntryFlowStep
| undefined
// Null means we need to pick a config flow
| null;
@property() private _devices?: DeviceRegistryEntry[];
@internalProperty() private _devices?: DeviceRegistryEntry[];
@property() private _areas?: AreaRegistryEntry[];
@internalProperty() private _areas?: AreaRegistryEntry[];
@property() private _handlers?: string[];
@internalProperty() private _handlers?: string[];
private _unsubAreas?: UnsubscribeFunc;

View File

@@ -8,6 +8,7 @@ import {
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import { classMap } from "lit-html/directives/class-map";
@@ -31,13 +32,13 @@ interface HandlerObj {
class StepFlowPickHandler extends LitElement {
public flowConfig!: FlowConfig;
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public handlers!: string[];
@property() public showAdvanced?: boolean;
@property() private filter?: string;
@internalProperty() private filter?: string;
private _width?: number;

View File

@@ -11,6 +11,7 @@ import {
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import "../../components/dialog/ha-paper-dialog";
@@ -23,15 +24,15 @@ import { DeviceRegistryDetailDialogParams } from "./show-dialog-device-registry-
@customElement("dialog-device-registry-detail")
class DialogDeviceRegistryDetail extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() private _nameByUser!: string;
@internalProperty() private _nameByUser!: string;
@property() private _error?: string;
@internalProperty() private _error?: string;
@property() private _params?: DeviceRegistryDetailDialogParams;
@internalProperty() private _params?: DeviceRegistryDetailDialogParams;
@property() private _areaId?: string;
@internalProperty() private _areaId?: string;
private _submitting?: boolean;

View File

@@ -5,7 +5,7 @@ import {
customElement,
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import "../../components/dialog/ha-paper-dialog";
@@ -19,7 +19,7 @@ import { HaDomainTogglerDialogParams } from "./show-dialog-domain-toggler";
class DomainTogglerDialog extends LitElement {
public hass!: HomeAssistant;
@property() private _params?: HaDomainTogglerDialogParams;
@internalProperty() private _params?: HaDomainTogglerDialogParams;
public async showDialog(params: HaDomainTogglerDialogParams): Promise<void> {
this._params = params;

View File

@@ -7,6 +7,7 @@ import {
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import { classMap } from "lit-html/directives/class-map";
@@ -20,11 +21,11 @@ import { fireEvent } from "../../common/dom/fire_event";
@customElement("dialog-box")
class DialogBox extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() private _params?: DialogParams;
@internalProperty() private _params?: DialogParams;
@property() private _value?: string;
@internalProperty() private _value?: string;
public async showDialog(params: DialogParams): Promise<void> {
this._params = params;

View File

@@ -15,7 +15,8 @@ declare global {
}
}
interface HassDialog<T = HASSDomEvents[ValidHassDomEvent]> extends HTMLElement {
export interface HassDialog<T = HASSDomEvents[ValidHassDomEvent]>
extends HTMLElement {
showDialog(params: T);
closeDialog?: () => boolean | void;
}

View File

@@ -15,7 +15,7 @@ import { HomeAssistant } from "../../../types";
@customElement("more-info-automation")
class MoreInfoAutomation extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public stateObj?: HassEntity;

View File

@@ -6,6 +6,7 @@ import {
html,
LitElement,
property,
internalProperty,
PropertyValues,
TemplateResult,
} from "lit-element";
@@ -20,13 +21,13 @@ import {
import type { CameraEntity, HomeAssistant } from "../../../types";
class MoreInfoCamera extends LitElement {
@property() public hass?: HomeAssistant;
@property({ attribute: false }) public hass?: HomeAssistant;
@property() public stateObj?: CameraEntity;
@property() private _cameraPrefs?: CameraPreferences;
@internalProperty() private _cameraPrefs?: CameraPreferences;
@property() private _attached = false;
@internalProperty() private _attached = false;
public connectedCallback() {
super.connectedCallback();

View File

@@ -32,7 +32,7 @@ import {
import { HomeAssistant } from "../../../types";
class MoreInfoClimate extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public stateObj?: ClimateEntity;

View File

@@ -13,7 +13,7 @@ import { HomeAssistant } from "../../../types";
@customElement("more-info-counter")
class MoreInfoCounter extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public stateObj?: HassEntity;

View File

@@ -11,7 +11,7 @@ import { HomeAssistant } from "../../../types";
@customElement("more-info-default")
class MoreInfoDefault extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public stateObj?: HassEntity;

View File

@@ -24,7 +24,7 @@ import {
import { HomeAssistant } from "../../../types";
class MoreInfoHumidifier extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public stateObj?: HumidifierEntity;

View File

@@ -68,26 +68,15 @@ class MoreInfoLight extends LocalizeMixin(EventsMixin(PolymerElement)) {
}
.segmentationButton {
display: none;
position: absolute;
top: 11%;
top: 5%;
transform: translate(0%, 0%);
padding: 0px;
max-height: 0px;
width: 23px;
height: 23px;
opacity: var(--dark-secondary-opacity);
overflow: hidden;
transition: max-height 0.5s ease-in;
color: var(--secondary-text-color);
}
.has-color.is-on .segmentationContainer .segmentationButton {
position: absolute;
top: 11%;
transform: translate(0%, 0%);
width: 23px;
height: 23px;
padding: 0px;
opacity: var(--dark-secondary-opacity);
.has-color.is-on .segmentationButton {
display: inline-block;
}
.has-effect_list.is-on .effect_list,
@@ -108,11 +97,6 @@ class MoreInfoLight extends LocalizeMixin(EventsMixin(PolymerElement)) {
padding-top: 16px;
}
.has-color.is-on .segmentationButton {
max-height: 100px;
overflow: visible;
}
.has-color.is-on ha-color-picker {
max-height: 500px;
overflow: visible;
@@ -189,7 +173,7 @@ class MoreInfoLight extends LocalizeMixin(EventsMixin(PolymerElement)) {
<ha-icon-button
icon="mdi:palette"
on-click="segmentClick"
class="control segmentationButton"
class="segmentationButton"
></ha-icon-button>
</div>
@@ -217,7 +201,7 @@ class MoreInfoLight extends LocalizeMixin(EventsMixin(PolymerElement)) {
<ha-attributes
state-obj="[[stateObj]]"
extra-filters="brightness,color_temp,white_value,effect_list,effect,hs_color,rgb_color,xy_color,min_mireds,max_mireds"
extra-filters="brightness,color_temp,white_value,effect_list,effect,hs_color,rgb_color,xy_color,min_mireds,max_mireds,entity_id"
></ha-attributes>
</div>
`;

View File

@@ -18,7 +18,7 @@ import { HomeAssistant } from "../../../types";
@customElement("more-info-person")
class MoreInfoPerson extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public stateObj?: HassEntity;

View File

@@ -11,7 +11,7 @@ import { HomeAssistant } from "../../../types";
@customElement("more-info-script")
class MoreInfoScript extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public stateObj?: HassEntity;

View File

@@ -14,7 +14,7 @@ import { HomeAssistant } from "../../../types";
@customElement("more-info-sun")
class MoreInfoSun extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public stateObj?: HassEntity;

View File

@@ -14,7 +14,7 @@ import { HomeAssistant } from "../../../types";
@customElement("more-info-timer")
class MoreInfoTimer extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public stateObj?: TimerEntity;

View File

@@ -90,7 +90,7 @@ const VACUUM_COMMANDS: VacuumCommand[] = [
@customElement("more-info-vacuum")
class MoreInfoVacuum extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public stateObj?: VacuumEntity;

View File

@@ -51,7 +51,7 @@ const weatherIcons = {
@customElement("more-info-weather")
class MoreInfoWeather extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public stateObj?: HassEntity;

View File

@@ -18,9 +18,9 @@ import {
customElement,
LitElement,
property,
internalProperty,
css,
html,
internalProperty,
} from "lit-element";
import { haStyleDialog } from "../../resources/styles";
import { HomeAssistant } from "../../types";
@@ -39,7 +39,7 @@ export interface MoreInfoDialogParams {
@customElement("ha-more-info-dialog")
export class MoreInfoDialog extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property({ type: Boolean, reflect: true }) public large = false;
@@ -248,6 +248,7 @@ export class MoreInfoDialog extends LitElement {
haStyleDialog,
css`
ha-dialog {
--dialog-surface-position: static;
--dialog-content-position: static;
}
@@ -272,19 +273,22 @@ export class MoreInfoDialog extends LitElement {
--mdc-dialog-max-width: 90vw;
}
ha-dialog:not([data-domain="camera"]) app-toolbar {
max-width: 368px;
}
.content {
width: 352px;
}
ha-header-bar {
width: 400px;
}
.main-title {
overflow: hidden;
text-overflow: ellipsis;
cursor: default;
}
ha-dialog[data-domain="camera"] .content {
ha-dialog[data-domain="camera"] .content,
ha-dialog[data-domain="camera"] ha-header-bar {
width: auto;
}
@@ -292,18 +296,21 @@ export class MoreInfoDialog extends LitElement {
width: calc(90vw - 48px);
}
:host([large]) app-toolbar {
max-width: calc(90vw - 32px);
:host([large]) ha-dialog[data-domain="camera"] .content,
:host([large]) ha-header-bar {
width: 90vw;
}
}
state-history-charts {
margin-top: 16px 0;
}
ha-dialog[data-domain="camera"] {
--dialog-content-padding: 0;
}
state-card-content,
state-history-charts {
display: block;
margin-bottom: 16px;
}
`,
];
}

View File

@@ -27,7 +27,7 @@ import "./controls/more-info-water_heater";
import "./controls/more-info-weather";
class MoreInfoContent extends UpdatingElement {
@property() public hass?: HomeAssistant;
@property({ attribute: false }) public hass?: HomeAssistant;
@property() public stateObj?: HassEntity;

View File

@@ -15,7 +15,7 @@ import "./notification-item-template";
@customElement("configurator-notification-item")
export class HuiConfiguratorNotificationItem extends LitElement {
@property() public hass?: HomeAssistant;
@property({ attribute: false }) public hass?: HomeAssistant;
@property() public notification?: PersitentNotificationEntity;

View File

@@ -14,7 +14,7 @@ import "./persistent-notification-item";
@customElement("notification-item")
export class HuiNotificationItem extends LitElement {
@property() public hass?: HomeAssistant;
@property({ attribute: false }) public hass?: HomeAssistant;
@property() public notification?: HassEntity | PersistentNotification;

View File

@@ -17,7 +17,7 @@ import "./notification-item-template";
@customElement("persistent-notification-item")
export class HuiPersistentNotificationItem extends LitElement {
@property() public hass?: HomeAssistant;
@property({ attribute: false }) public hass?: HomeAssistant;
@property() public notification?: PersistentNotification;

View File

@@ -10,6 +10,7 @@ import {
html,
LitElement,
property,
internalProperty,
PropertyValues,
query,
TemplateResult,
@@ -41,20 +42,20 @@ interface Results {
@customElement("ha-voice-command-dialog")
export class HaVoiceCommandDialog extends LitElement {
@property() public hass!: HomeAssistant;
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public results: Results | null = null;
@property() private _conversation: Message[] = [
@internalProperty() private _conversation: Message[] = [
{
who: "hass",
text: "",
},
];
@property() private _opened = false;
@internalProperty() private _opened = false;
@property() private _agentInfo?: AgentInfo;
@internalProperty() private _agentInfo?: AgentInfo;
@query("#messages") private messages!: PaperDialogScrollableElement;

View File

@@ -21,7 +21,7 @@ class HassLoadingScreen extends LitElement {
@property({ type: Boolean }) public rootnav = false;
@property() public hass?: HomeAssistant;
@property({ attribute: false }) public hass?: HomeAssistant;
@property() public narrow?: boolean;

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