-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate state cards from Polymer to Lit (#18257)
- Loading branch information
Showing
56 changed files
with
1,573 additions
and
1,399 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
title: Input Text | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { html, LitElement, PropertyValues, TemplateResult } from "lit"; | ||
import { customElement, property, query } from "lit/decorators"; | ||
import "../../../../src/components/ha-card"; | ||
import "../../../../src/dialogs/more-info/more-info-content"; | ||
import { getEntity } from "../../../../src/fake_data/entity"; | ||
import { | ||
MockHomeAssistant, | ||
provideHass, | ||
} from "../../../../src/fake_data/provide_hass"; | ||
import "../../components/demo-more-infos"; | ||
|
||
const ENTITIES = [ | ||
getEntity("input_text", "text", "Inspiration", { | ||
friendly_name: "Text", | ||
mode: "text", | ||
}), | ||
]; | ||
|
||
@customElement("demo-more-info-input-text") | ||
class DemoMoreInfoInputText extends LitElement { | ||
@property() public hass!: MockHomeAssistant; | ||
|
||
@query("demo-more-infos") private _demoRoot!: HTMLElement; | ||
|
||
protected render(): TemplateResult { | ||
return html` | ||
<demo-more-infos | ||
.hass=${this.hass} | ||
.entities=${ENTITIES.map((ent) => ent.entityId)} | ||
></demo-more-infos> | ||
`; | ||
} | ||
|
||
protected firstUpdated(changedProperties: PropertyValues) { | ||
super.firstUpdated(changedProperties); | ||
const hass = provideHass(this._demoRoot); | ||
hass.updateTranslations(null, "en"); | ||
hass.addEntities(ENTITIES); | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
"demo-more-info-input-text": DemoMoreInfoInputText; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
title: Lock | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { html, LitElement, PropertyValues, TemplateResult } from "lit"; | ||
import { customElement, property, query } from "lit/decorators"; | ||
import "../../../../src/components/ha-card"; | ||
import "../../../../src/dialogs/more-info/more-info-content"; | ||
import { getEntity } from "../../../../src/fake_data/entity"; | ||
import { | ||
MockHomeAssistant, | ||
provideHass, | ||
} from "../../../../src/fake_data/provide_hass"; | ||
import "../../components/demo-more-infos"; | ||
|
||
const ENTITIES = [ | ||
getEntity("lock", "lock", "locked", { | ||
friendly_name: "Lock", | ||
device_class: "lock", | ||
}), | ||
getEntity("lock", "unavailable", "unavailable", { | ||
friendly_name: "Unavailable lock", | ||
}), | ||
]; | ||
|
||
@customElement("demo-more-info-lock") | ||
class DemoMoreInfoLock extends LitElement { | ||
@property() public hass!: MockHomeAssistant; | ||
|
||
@query("demo-more-infos") private _demoRoot!: HTMLElement; | ||
|
||
protected render(): TemplateResult { | ||
return html` | ||
<demo-more-infos | ||
.hass=${this.hass} | ||
.entities=${ENTITIES.map((ent) => ent.entityId)} | ||
></demo-more-infos> | ||
`; | ||
} | ||
|
||
protected firstUpdated(changedProperties: PropertyValues) { | ||
super.firstUpdated(changedProperties); | ||
const hass = provideHass(this._demoRoot); | ||
hass.updateTranslations(null, "en"); | ||
hass.addEntities(ENTITIES); | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
"demo-more-info-lock": DemoMoreInfoLock; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
title: Media Player | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { html, LitElement, PropertyValues, TemplateResult } from "lit"; | ||
import { customElement, property, query } from "lit/decorators"; | ||
import "../../../../src/components/ha-card"; | ||
import "../../../../src/dialogs/more-info/more-info-content"; | ||
import { | ||
MockHomeAssistant, | ||
provideHass, | ||
} from "../../../../src/fake_data/provide_hass"; | ||
import "../../components/demo-more-infos"; | ||
import { createMediaPlayerEntities } from "../../data/media_players"; | ||
|
||
const ENTITIES = createMediaPlayerEntities(); | ||
|
||
@customElement("demo-more-info-media-player") | ||
class DemoMoreInfoMediaPlayer extends LitElement { | ||
@property() public hass!: MockHomeAssistant; | ||
|
||
@query("demo-more-infos") private _demoRoot!: HTMLElement; | ||
|
||
protected render(): TemplateResult { | ||
return html` | ||
<demo-more-infos | ||
.hass=${this.hass} | ||
.entities=${ENTITIES.map((ent) => ent.entityId)} | ||
></demo-more-infos> | ||
`; | ||
} | ||
|
||
protected firstUpdated(changedProperties: PropertyValues) { | ||
super.firstUpdated(changedProperties); | ||
const hass = provideHass(this._demoRoot); | ||
hass.updateTranslations(null, "en"); | ||
hass.addEntities(ENTITIES); | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
"demo-more-info-media-player": DemoMoreInfoMediaPlayer; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
title: Number | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
import { html, LitElement, PropertyValues, TemplateResult } from "lit"; | ||
import { customElement, property, query } from "lit/decorators"; | ||
import "../../../../src/components/ha-card"; | ||
import "../../../../src/dialogs/more-info/more-info-content"; | ||
import { getEntity } from "../../../../src/fake_data/entity"; | ||
import { | ||
MockHomeAssistant, | ||
provideHass, | ||
} from "../../../../src/fake_data/provide_hass"; | ||
import "../../components/demo-more-infos"; | ||
|
||
const ENTITIES = [ | ||
getEntity("number", "box1", 0, { | ||
friendly_name: "Box1", | ||
min: 0, | ||
max: 100, | ||
step: 1, | ||
initial: 0, | ||
mode: "box", | ||
unit_of_measurement: "items", | ||
}), | ||
getEntity("number", "slider1", 0, { | ||
friendly_name: "Slider1", | ||
min: 0, | ||
max: 100, | ||
step: 1, | ||
initial: 0, | ||
mode: "slider", | ||
unit_of_measurement: "items", | ||
}), | ||
getEntity("number", "auto1", 0, { | ||
friendly_name: "Auto1", | ||
min: 0, | ||
max: 1000, | ||
step: 1, | ||
initial: 0, | ||
mode: "auto", | ||
unit_of_measurement: "items", | ||
}), | ||
getEntity("number", "auto2", 0, { | ||
friendly_name: "Auto2", | ||
min: 0, | ||
max: 100, | ||
step: 1, | ||
initial: 0, | ||
mode: "auto", | ||
unit_of_measurement: "items", | ||
}), | ||
]; | ||
|
||
@customElement("demo-more-info-number") | ||
class DemoMoreInfoNumber extends LitElement { | ||
@property() public hass!: MockHomeAssistant; | ||
|
||
@query("demo-more-infos") private _demoRoot!: HTMLElement; | ||
|
||
protected render(): TemplateResult { | ||
return html` | ||
<demo-more-infos | ||
.hass=${this.hass} | ||
.entities=${ENTITIES.map((ent) => ent.entityId)} | ||
></demo-more-infos> | ||
`; | ||
} | ||
|
||
protected firstUpdated(changedProperties: PropertyValues) { | ||
super.firstUpdated(changedProperties); | ||
const hass = provideHass(this._demoRoot); | ||
hass.updateTranslations(null, "en"); | ||
hass.addEntities(ENTITIES); | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
"demo-more-info-number": DemoMoreInfoNumber; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
title: Scene | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { html, LitElement, PropertyValues, TemplateResult } from "lit"; | ||
import { customElement, property, query } from "lit/decorators"; | ||
import "../../../../src/components/ha-card"; | ||
import "../../../../src/dialogs/more-info/more-info-content"; | ||
import { getEntity } from "../../../../src/fake_data/entity"; | ||
import { | ||
MockHomeAssistant, | ||
provideHass, | ||
} from "../../../../src/fake_data/provide_hass"; | ||
import "../../components/demo-more-infos"; | ||
|
||
const ENTITIES = [ | ||
getEntity("scene", "romantic_lights", "scening", { | ||
entity_id: ["light.bed_light", "light.ceiling_lights"], | ||
friendly_name: "Romantic Scene", | ||
}), | ||
getEntity("scene", "unavailable", "unavailable", { | ||
friendly_name: "Romantic Scene", | ||
}), | ||
]; | ||
|
||
@customElement("demo-more-info-scene") | ||
class DemoMoreInfoScene extends LitElement { | ||
@property() public hass!: MockHomeAssistant; | ||
|
||
@query("demo-more-infos") private _demoRoot!: HTMLElement; | ||
|
||
protected render(): TemplateResult { | ||
return html` | ||
<demo-more-infos | ||
.hass=${this.hass} | ||
.entities=${ENTITIES.map((ent) => ent.entityId)} | ||
></demo-more-infos> | ||
`; | ||
} | ||
|
||
protected firstUpdated(changedProperties: PropertyValues) { | ||
super.firstUpdated(changedProperties); | ||
const hass = provideHass(this._demoRoot); | ||
hass.updateTranslations(null, "en"); | ||
hass.addEntities(ENTITIES); | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
"demo-more-info-scene": DemoMoreInfoScene; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
title: Timer | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { html, LitElement, PropertyValues, TemplateResult } from "lit"; | ||
import { customElement, property, query } from "lit/decorators"; | ||
import "../../../../src/components/ha-card"; | ||
import "../../../../src/dialogs/more-info/more-info-content"; | ||
import { getEntity } from "../../../../src/fake_data/entity"; | ||
import { | ||
MockHomeAssistant, | ||
provideHass, | ||
} from "../../../../src/fake_data/provide_hass"; | ||
import "../../components/demo-more-infos"; | ||
|
||
const ENTITIES = [ | ||
getEntity("timer", "timer", "idle", { | ||
friendly_name: "Timer", | ||
duration: "0:05:00", | ||
}), | ||
]; | ||
|
||
@customElement("demo-more-info-timer") | ||
class DemoMoreInfoTimer extends LitElement { | ||
@property() public hass!: MockHomeAssistant; | ||
|
||
@query("demo-more-infos") private _demoRoot!: HTMLElement; | ||
|
||
protected render(): TemplateResult { | ||
return html` | ||
<demo-more-infos | ||
.hass=${this.hass} | ||
.entities=${ENTITIES.map((ent) => ent.entityId)} | ||
></demo-more-infos> | ||
`; | ||
} | ||
|
||
protected firstUpdated(changedProperties: PropertyValues) { | ||
super.firstUpdated(changedProperties); | ||
const hass = provideHass(this._demoRoot); | ||
hass.updateTranslations(null, "en"); | ||
hass.addEntities(ENTITIES); | ||
} | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
"demo-more-info-timer": DemoMoreInfoTimer; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
title: Vacuum | ||
--- |
Oops, something went wrong.