mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-15 21:36:36 +00:00
Adding Type to Returns
This commit is contained in:
parent
bb4ce278b0
commit
1fcf510278
@ -13,6 +13,7 @@ import { HomeAssistant, LightEntity } from "../../../types.js";
|
|||||||
import { hassLocalizeLitMixin } from "../../../mixins/lit-localize-mixin";
|
import { hassLocalizeLitMixin } from "../../../mixins/lit-localize-mixin";
|
||||||
import { LovelaceCard, LovelaceConfig } from "../types.js";
|
import { LovelaceCard, LovelaceConfig } from "../types.js";
|
||||||
import { longPress } from "../common/directives/long-press-directive";
|
import { longPress } from "../common/directives/long-press-directive";
|
||||||
|
import { TemplateResult } from "lit-html";
|
||||||
|
|
||||||
const lightConfig = {
|
const lightConfig = {
|
||||||
radius: 80,
|
radius: 80,
|
||||||
@ -138,107 +139,107 @@ export class HuiLightCard extends hassLocalizeLitMixin(LitElement)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private renderStyle() {
|
private renderStyle(): TemplateResult {
|
||||||
return html`
|
return html`
|
||||||
${roundSliderStyle}
|
${roundSliderStyle}
|
||||||
<style>
|
<style>
|
||||||
:host {
|
:host {
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
ha-card {
|
ha-card {
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
}
|
}
|
||||||
#tooltip {
|
#tooltip {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
z-index: 15;
|
z-index: 15;
|
||||||
}
|
}
|
||||||
.icon-state {
|
.icon-state {
|
||||||
display: block;
|
display: block;
|
||||||
margin: auto;
|
margin: auto;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
transform: translate(0,25%);
|
transform: translate(0,25%);
|
||||||
}
|
}
|
||||||
#light {
|
#light {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding-top: 16px;
|
padding-top: 16px;
|
||||||
padding-bottom: 16px;
|
padding-bottom: 16px;
|
||||||
}
|
}
|
||||||
#light .rs-bar.rs-transition.rs-first, .rs-bar.rs-transition.rs-second{
|
#light .rs-bar.rs-transition.rs-first, .rs-bar.rs-transition.rs-second{
|
||||||
z-index: 20 !important;
|
z-index: 20 !important;
|
||||||
}
|
}
|
||||||
#light .rs-range-color {
|
#light .rs-range-color {
|
||||||
background-color: var(--primary-color);
|
|
||||||
}
|
|
||||||
#light .rs-path-color {
|
|
||||||
background-color: #d6d6d6;
|
|
||||||
}
|
|
||||||
#light .rs-handle {
|
|
||||||
background-color: #FFF;
|
|
||||||
padding: 7px;
|
|
||||||
border: 2px solid #d6d6d6;
|
|
||||||
}
|
|
||||||
#light .rs-handle.rs-focus {
|
|
||||||
border-color:var(--primary-color);
|
|
||||||
}
|
|
||||||
#light .rs-handle:after {
|
|
||||||
border-color: var(--primary-color);
|
|
||||||
background-color: var(--primary-color);
|
background-color: var(--primary-color);
|
||||||
}
|
}
|
||||||
#light .rs-border {
|
#light .rs-path-color {
|
||||||
border-color: transparent;
|
background-color: #d6d6d6;
|
||||||
}
|
}
|
||||||
ha-icon {
|
#light .rs-handle {
|
||||||
margin: auto;
|
background-color: #FFF;
|
||||||
width: 76px;
|
padding: 7px;
|
||||||
height: 76px;
|
border: 2px solid #d6d6d6;
|
||||||
color: var(--paper-item-icon-color, #44739e);
|
}
|
||||||
cursor: pointer;
|
#light .rs-handle.rs-focus {
|
||||||
}
|
border-color:var(--primary-color);
|
||||||
ha-icon[data-state=on] {
|
}
|
||||||
color: var(--paper-item-icon-active-color, #FDD835);
|
#light .rs-handle:after {
|
||||||
}
|
border-color: var(--primary-color);
|
||||||
ha-icon[data-state=unavailable] {
|
background-color: var(--primary-color);
|
||||||
color: var(--state-icon-unavailable-color);
|
}
|
||||||
}
|
#light .rs-border {
|
||||||
.name {
|
border-color: transparent;
|
||||||
padding-top: 40px;
|
}
|
||||||
font-size: 1.2rem;
|
ha-icon {
|
||||||
}
|
margin: auto;
|
||||||
.brightness {
|
width: 76px;
|
||||||
font-size: 1.2rem;
|
height: 76px;
|
||||||
position: absolute;
|
color: var(--paper-item-icon-color, #44739e);
|
||||||
margin: 0 auto;
|
cursor: pointer;
|
||||||
left: 50%;
|
}
|
||||||
top: 10%;
|
ha-icon[data-state=on] {
|
||||||
transform: translate(-50%);
|
color: var(--paper-item-icon-active-color, #FDD835);
|
||||||
opacity: 0;
|
}
|
||||||
transition: opacity .5s ease-in-out;
|
ha-icon[data-state=unavailable] {
|
||||||
-moz-transition: opacity .5s ease-in-out;
|
color: var(--state-icon-unavailable-color);
|
||||||
-webkit-transition: opacity .5s ease-in-out;
|
}
|
||||||
cursor: pointer;
|
.name {
|
||||||
color: white;
|
padding-top: 40px;
|
||||||
text-shadow:
|
font-size: 1.2rem;
|
||||||
-1px -1px 0 #000,
|
}
|
||||||
1px -1px 0 #000,
|
.brightness {
|
||||||
-1px 1px 0 #000,
|
font-size: 1.2rem;
|
||||||
1px 1px 0 #000;
|
position: absolute;
|
||||||
}
|
margin: 0 auto;
|
||||||
.show_brightness {
|
left: 50%;
|
||||||
opacity: 1;
|
top: 10%;
|
||||||
}
|
transform: translate(-50%);
|
||||||
.not-found {
|
opacity: 0;
|
||||||
flex: 1;
|
transition: opacity .5s ease-in-out;
|
||||||
background-color: yellow;
|
-moz-transition: opacity .5s ease-in-out;
|
||||||
padding: 8px;
|
-webkit-transition: opacity .5s ease-in-out;
|
||||||
}
|
cursor: pointer;
|
||||||
</style>
|
color: white;
|
||||||
|
text-shadow:
|
||||||
|
-1px -1px 0 #000,
|
||||||
|
1px -1px 0 #000,
|
||||||
|
-1px 1px 0 #000,
|
||||||
|
1px 1px 0 #000;
|
||||||
|
}
|
||||||
|
.show_brightness {
|
||||||
|
opacity: 1;
|
||||||
|
}
|
||||||
|
.not-found {
|
||||||
|
flex: 1;
|
||||||
|
background-color: yellow;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,7 +269,7 @@ export class HuiLightCard extends hassLocalizeLitMixin(LitElement)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private _computeBrightness(stateObj: LightEntity) {
|
private _computeBrightness(stateObj: LightEntity): string {
|
||||||
if (!stateObj.attributes.brightness) {
|
if (!stateObj.attributes.brightness) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@ -276,7 +277,7 @@ export class HuiLightCard extends hassLocalizeLitMixin(LitElement)
|
|||||||
return `brightness(${(brightness + 245) / 5}%)`;
|
return `brightness(${(brightness + 245) / 5}%)`;
|
||||||
}
|
}
|
||||||
|
|
||||||
private _computeColor(stateObj: LightEntity) {
|
private _computeColor(stateObj: LightEntity): string {
|
||||||
if (!stateObj.attributes.hs_color) {
|
if (!stateObj.attributes.hs_color) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user