Skip to content

Commit

Permalink
Replace all private properties with internalProperty decorator (home-…
Browse files Browse the repository at this point in the history
  • Loading branch information
bramkragten authored Jul 15, 2020
1 parent 9cd2d0d commit f8c5eea
Show file tree
Hide file tree
Showing 357 changed files with 1,236 additions and 920 deletions.
5 changes: 3 additions & 2 deletions cast/src/launcher/layout/hc-cast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import { CastManager } from "../../../../src/cast/cast_manager";
Expand Down Expand Up @@ -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) {
Expand Down
14 changes: 7 additions & 7 deletions cast/src/launcher/layout/hc-connect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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;

Expand Down
12 changes: 9 additions & 3 deletions cast/src/receiver/layout/hc-demo.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion cast/src/receiver/layout/hc-launch-screen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions cast/src/receiver/layout/hc-lovelace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
15 changes: 10 additions & 5 deletions cast/src/receiver/layout/hc-main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions demo/src/custom-cards/cast-demo-row.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
customElement,
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import { CastManager } from "../../../src/cast/cast_manager";
Expand All @@ -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.
Expand Down
7 changes: 4 additions & 3 deletions demo/src/custom-cards/ha-demo-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import { until } from "lit-html/directives/until";
Expand All @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion hassio/src/addon-store/hassio-addon-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 2 additions & 1 deletion hassio/src/addon-store/hassio-addon-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
CSSResult,
LitElement,
property,
internalProperty,
PropertyValues,
} from "lit-element";
import { html, TemplateResult } from "lit-html";
Expand Down Expand Up @@ -52,7 +53,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;
Expand Down
11 changes: 6 additions & 5 deletions hassio/src/addon-view/config/hassio-addon-audio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
html,
LitElement,
property,
internalProperty,
PropertyValues,
TemplateResult,
} from "lit-element";
Expand All @@ -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`
Expand Down
3 changes: 2 additions & 1 deletion hassio/src/addon-view/config/hassio-addon-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
html,
LitElement,
property,
internalProperty,
PropertyValues,
query,
TemplateResult,
Expand All @@ -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;

Expand Down
5 changes: 3 additions & 2 deletions hassio/src/addon-view/config/hassio-addon-network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
html,
LitElement,
property,
internalProperty,
PropertyValues,
TemplateResult,
} from "lit-element";
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import "../../../../src/components/ha-markdown";
Expand All @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion hassio/src/addon-view/info/hassio-addon-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import { classMap } from "lit-html/directives/class-map";
Expand Down Expand Up @@ -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;

Expand Down
5 changes: 3 additions & 2 deletions hassio/src/addon-view/log/hassio-addon-logs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import "../../../../src/components/ha-card";
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion hassio/src/components/hassio-card-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion hassio/src/dashboard/hassio-addons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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[];

Expand Down
9 changes: 5 additions & 4 deletions hassio/src/dashboard/hassio-update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import "../../../src/components/buttons/ha-call-api-button";
Expand All @@ -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 = [
Expand Down
5 changes: 3 additions & 2 deletions hassio/src/dialogs/markdown/dialog-hassio-markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
html,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import { createCloseHeading } from "../../../../src/components/ha-dialog";
Expand All @@ -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;
Expand Down
Loading

0 comments on commit f8c5eea

Please sign in to comment.