20221230.0 (#14925)

This commit is contained in:
Bram Kragten 2022-12-30 13:39:58 +01:00 committed by GitHub
commit 7cde3b66dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 95 additions and 13 deletions

View File

@ -98,7 +98,9 @@ const alerts: {
description: "Alert with slotted image",
type: "warning",
iconSlot: html`<span slot="icon" class="image"
><img src="https://www.home-assistant.io/images/home-assistant-logo.svg"
><img
alt="Home Assistant logo"
src="https://www.home-assistant.io/images/home-assistant-logo.svg"
/></span>`,
},
{

View File

@ -404,6 +404,7 @@ class HassioAddonInfo extends LitElement {
? html`
<img
class="logo"
alt=""
src="/api/hassio/addons/${this.addon.slug}/logo"
/>
`

View File

@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "home-assistant-frontend"
version = "20221228.0"
version = "20221230.0"
license = {text = "Apache-2.0"}
description = "The Home Assistant frontend"
readme = "README.md"

View File

@ -16,7 +16,11 @@ const rowRenderer: ComboBoxLitRenderer<HassioAddonInfo> = (
<span>${item.name}</span>
<span slot="secondary">${item.slug}</span>
${item.icon
? html`<img slot="graphic" .src="/api/hassio/addons/${item.slug}/icon" />`
? html`<img
alt=""
slot="graphic"
.src="/api/hassio/addons/${item.slug}/icon"
/>`
: ""}
</mwc-list-item>`;

View File

@ -266,6 +266,9 @@ export class HaBaseTimeInput extends LitElement {
seconds: this.seconds,
milliseconds: this.milliseconds,
};
if (this.enableDay) {
value.days = this.days;
}
if (this.format === 12) {
value.amPm = this.amPm;
}

View File

@ -59,6 +59,7 @@ class HaConfigEntryPicker extends LitElement {
>
<span slot="secondary">${item.localized_domain_name}</span>
<img
alt=""
slot="graphic"
src=${brandsUrl({
domain: item.domain,

View File

@ -1,14 +1,19 @@
import { CSSResultGroup, html, css, LitElement, TemplateResult } from "lit";
import { customElement, property } from "lit/decorators";
import { ifDefined } from "lit/directives/if-defined";
@customElement("ha-tile-image")
export class HaTileImage extends LitElement {
@property() public imageUrl?: string;
@property() public imageAlt?: string;
protected render(): TemplateResult {
return html`
<div class="image">
${this.imageUrl ? html`<img src=${this.imageUrl} />` : null}
${this.imageUrl
? html`<img alt=${ifDefined(this.imageAlt)} src=${this.imageUrl} />`
: null}
</div>
`;
}

View File

@ -74,7 +74,7 @@ export class HaImagecropperDialog extends LitElement {
round: Boolean(this._params?.options.round),
})}"
>
<img />
<img alt=${this.hass.localize("ui.dialogs.image_cropper.crop_image")} />
</div>
<mwc-button slot="secondaryAction" @click=${this.closeDialog}>
${this.hass.localize("ui.common.cancel")}

View File

@ -19,6 +19,7 @@ class IntegrationBadge extends LitElement {
return html`
<div class="icon">
<img
alt=""
src=${brandsUrl({
domain: this.domain,
type: "icon",

View File

@ -250,6 +250,7 @@ class DialogCalendarEventEditor extends LitElement {
<ha-recurrence-rule-editor
.hass=${this.hass}
.dtstart=${this._dtstart}
.allDay=${this._allDay}
.locale=${this.hass.locale}
.timezone=${this.hass.config.time_zone}
.value=${this._rrule || ""}

View File

@ -41,6 +41,8 @@ export class RecurrenceRuleEditor extends LitElement {
@property() public dtstart?: Date;
@property() public allDay?: boolean;
@property({ attribute: false }) public locale!: HomeAssistant["locale"];
@property() public timezone?: string;
@ -402,7 +404,14 @@ export class RecurrenceRuleEditor extends LitElement {
byweekday: byweekday,
bymonthday: bymonthday,
};
const contentline = RRule.optionsToString(options);
let contentline = RRule.optionsToString(options);
if (this._until && this.allDay) {
// rrule.js only computes UNTIL values as DATE-TIME however rfc5545 says
// The value of the UNTIL rule part MUST have the same value type as the
// "DTSTART" property. If needed, strip off any time values as a workaround
// This converts "UNTIL=20220512T060000" to "UNTIL=20220512"
contentline = contentline.replace(/(UNTIL=\d{8})T\d{6}Z?/, "$1");
}
return contentline.slice(6); // Strip "RRULE:" prefix
}

View File

@ -258,7 +258,8 @@ class HaConfigAreaPage extends SubscribeMixin(LitElement) {
<div class="column">
${area.picture
? html`<div class="img-container">
<img src=${area.picture} /><ha-icon-button
<img alt=${area.name} src=${area.picture} />
<ha-icon-button
.path=${mdiPencil}
.entry=${area}
@click=${this._showSettings}

View File

@ -659,6 +659,10 @@ export class HaConfigDevicePage extends LitElement {
integrations.length
? html`
<img
alt=${domainToName(
this.hass.localize,
integrations[0].domain
)}
src=${brandsUrl({
domain: integrations[0].domain,
type: "logo",

View File

@ -220,6 +220,7 @@ export class EnergyGridSettings extends LitElement {
${this._co2ConfigEntry
? html`<div class="row" .entry=${this._co2ConfigEntry}>
<img
alt=""
referrerpolicy="no-referrer"
src=${brandsUrl({
domain: "co2signal",
@ -244,6 +245,7 @@ export class EnergyGridSettings extends LitElement {
: html`
<div class="row border-bottom">
<img
alt=""
referrerpolicy="no-referrer"
src=${brandsUrl({
domain: "co2signal",

View File

@ -130,6 +130,7 @@ export class DialogEnergySolarSettings
style="display: flex; align-items: center;"
>
<img
alt=""
referrerpolicy="no-referrer"
style="height: 24px; margin-right: 16px;"
src=${brandsUrl({

View File

@ -118,6 +118,7 @@ const OVERRIDE_NUMBER_UNITS = {
};
const OVERRIDE_SENSOR_UNITS = {
current: ["A", "mA"],
distance: ["cm", "ft", "in", "km", "m", "mi", "mm", "yd"],
gas: ["CCF", "ft³", "m³"],
precipitation: ["cm", "in", "mm"],
@ -125,6 +126,7 @@ const OVERRIDE_SENSOR_UNITS = {
pressure: ["hPa", "Pa", "kPa", "bar", "cbar", "mbar", "mmHg", "inHg", "psi"],
speed: ["ft/s", "in/d", "in/h", "km/h", "kn", "m/s", "mm/d", "mm/h", "mph"],
temperature: ["°C", "°F", "K"],
voltage: ["V", "mV"],
volume: ["CCF", "fl. oz.", "ft³", "gal", "L", "mL", "m³"],
water: ["CCF", "ft³", "gal", "L", "m³"],
weight: ["g", "kg", "lb", "mg", "oz", "st", "µg"],

View File

@ -305,7 +305,7 @@ class HaConfigHardware extends SubscribeMixin(LitElement) {
.twoline=${Boolean(boardId)}
>
${imageURL
? html`<img slot="graphic" src=${imageURL} />`
? html`<img alt="" slot="graphic" src=${imageURL} />`
: ""}
<span class="primary-text">
${boardName ||

View File

@ -48,6 +48,7 @@ class HaDomainIntegrations extends LitElement {
hasMeta
>
<img
alt=""
slot="graphic"
loading="lazy"
src=${brandsUrl({

View File

@ -92,6 +92,7 @@ export class HaIntegrationHeader extends LitElement {
<slot name="above-header"></slot>
<div class="header">
<img
alt=""
src=${brandsUrl({
domain: this.domain,
type: "icon",

View File

@ -47,6 +47,7 @@ export class HaIntegrationListItem extends ListItemBase {
)}"
>
<img
alt=""
loading="lazy"
src=${brandsUrl({
domain: this.integration.domain,

View File

@ -52,6 +52,7 @@ class HaConfigRepairs extends LitElement {
@click=${this._openShowMoreDialog}
>
<img
alt=${domainToName(this.hass.localize, issue.domain)}
loading="lazy"
src=${brandsUrl({
domain: issue.issue_domain || issue.domain,

View File

@ -65,6 +65,7 @@ class IntegrationsStartupTime extends LitElement {
href=${docLink}
>
<img
alt=""
loading="lazy"
src=${brandsUrl({
domain: setup.domain,

View File

@ -244,7 +244,14 @@ class DialogTagDetail
canvas.height / 3
);
this._qrCode = html`<img src=${canvas.toDataURL()}></img>`;
this._qrCode = html`<img
alt=${this.hass.localize(
"ui.panel.config.tag.qr_code_image",
"name",
this._name
)}
src=${canvas.toDataURL()}
></img>`;
}
static get styles(): CSSResultGroup {

View File

@ -101,7 +101,10 @@ export class HuiPictureCard extends LitElement implements LovelaceCard {
),
})}
>
<img src=${this.hass.hassUrl(this._config.image)} />
<img
alt=${this._config.alt_text}
src=${this.hass.hassUrl(this._config.image)}
/>
</ha-card>
`;
}

View File

@ -332,6 +332,7 @@ export interface PictureCardConfig extends LovelaceCardConfig {
hold_action?: ActionConfig;
double_tap_action?: ActionConfig;
theme?: string;
alt_text?: string;
}
export interface PictureElementsCardConfig extends LovelaceCardConfig {

View File

@ -20,6 +20,7 @@ const cardConfigStruct = assign(
tap_action: optional(actionConfigStruct),
hold_action: optional(actionConfigStruct),
theme: optional(string()),
alt_text: optional(string()),
})
);
@ -53,6 +54,10 @@ export class HuiPictureCardEditor
return this._config!.theme || "";
}
get _alt_text(): string {
return this._config!.alt_text || "";
}
protected render(): TemplateResult {
if (!this.hass || !this._config) {
return html``;
@ -72,6 +77,16 @@ export class HuiPictureCardEditor
.configValue=${"image"}
@input=${this._valueChanged}
></ha-textfield>
<ha-textfield
.label="${this.hass.localize(
"ui.panel.lovelace.editor.card.generic.alt_text"
)} (${this.hass.localize(
"ui.panel.lovelace.editor.card.config.optional"
)})"
.value=${this._alt_text}
.configValue=${"alt_text"}
@input=${this._valueChanged}
></ha-textfield>
<ha-theme-picker
.hass=${this.hass}
.value=${this._theme}

View File

@ -68,6 +68,7 @@ export class HuiPictureHeaderFooter
return html`
<img
alt=${this._config!.alt_text}
@action=${this._handleAction}
.actionHandler=${actionHandler({
hasHold: hasAction(this._config!.hold_action),

View File

@ -17,6 +17,7 @@ export const pictureHeaderFooterConfigStruct = object({
tap_action: optional(actionConfigStruct),
hold_action: optional(actionConfigStruct),
double_tap_action: optional(actionConfigStruct),
alt_text: optional(string()),
});
export const buttonsHeaderFooterConfigStruct = object({

View File

@ -27,4 +27,5 @@ export interface PictureHeaderFooterConfig extends LovelaceHeaderFooterConfig {
tap_action?: ActionConfig;
hold_action?: ActionConfig;
double_tap_action?: ActionConfig;
alt_text?: string;
}

View File

@ -85,7 +85,14 @@ export class HaLongLivedAccessTokenDialog extends LitElement {
canvas.height / 3
);
this._qrCode = html`<img src=${canvas.toDataURL()}></img>`;
this._qrCode = html`<img
alt=${this.hass.localize(
"ui.panel.profile.long_lived_access_tokens.qr_code_image",
"name",
this._params!.name
)}
src=${canvas.toDataURL()}
></img>`;
}
static get styles(): CSSResultGroup {

View File

@ -791,7 +791,8 @@
"close": "Close"
},
"image_cropper": {
"crop": "Crop"
"crop": "Crop",
"crop_image": "Picture to crop"
},
"date-picker": {
"today": "Today"
@ -1435,6 +1436,7 @@
"confirm_remove_title": "Remove tag?",
"confirm_remove": "Are you sure you want to remove tag {tag}?",
"automation_title": "Tag {name} is scanned",
"qr_code_image": "QR code for tag {name}",
"headers": {
"icon": "Icon",
"name": "Name",
@ -4195,6 +4197,7 @@
"description": "The Light card allows you to change the brightness of the light."
},
"generic": {
"alt_text": "Alternative Text",
"aspect_ratio": "Aspect Ratio",
"attribute": "Attribute",
"camera_image": "Camera Entity",
@ -4598,7 +4601,8 @@
"name": "Name",
"prompt_name": "Give the token a name",
"prompt_copy_token": "Copy your access token. It will not be shown again.",
"empty_state": "You have no long-lived access tokens yet."
"empty_state": "You have no long-lived access tokens yet.",
"qr_code_image": "QR code for token {name}"
}
},
"shopping_list": {