Compare commits

..

1 Commits

Author SHA1 Message Date
Jan-Philipp Benecke
d6a97c0efb Refactor overflow menu in labels data table to have a single instance 2025-09-29 20:15:39 +02:00
40 changed files with 233 additions and 290 deletions

2
.nvmrc
View File

@@ -1 +1 @@
22.20.0
lts/iron

View File

@@ -52,7 +52,7 @@
"@fullcalendar/list": "6.1.19",
"@fullcalendar/luxon3": "6.1.19",
"@fullcalendar/timegrid": "6.1.19",
"@home-assistant/webawesome": "3.0.0-beta.6.ha.0",
"@home-assistant/webawesome": "3.0.0-beta.4.ha.3",
"@lezer/highlight": "1.2.1",
"@lit-labs/motion": "1.0.9",
"@lit-labs/observers": "2.0.6",
@@ -157,7 +157,7 @@
"@octokit/auth-oauth-device": "8.0.1",
"@octokit/plugin-retry": "8.0.1",
"@octokit/rest": "22.0.0",
"@rsdoctor/rspack-plugin": "1.3.1",
"@rsdoctor/rspack-plugin": "1.3.0",
"@rspack/core": "1.5.7",
"@rspack/dev-server": "1.1.4",
"@types/babel__plugin-transform-runtime": "7.9.5",
@@ -203,7 +203,7 @@
"husky": "9.1.7",
"jsdom": "27.0.0",
"jszip": "3.10.1",
"lint-staged": "16.2.2",
"lint-staged": "16.2.1",
"lit-analyzer": "2.0.3",
"lodash.merge": "4.6.2",
"lodash.template": "4.5.0",

View File

@@ -18,7 +18,6 @@ export const FIXED_DOMAIN_STATES = {
"pending",
"triggered",
],
alert: ["on", "off", "idle"],
assist_satellite: ["idle", "listening", "responding", "processing"],
automation: ["on", "off"],
binary_sensor: ["on", "off"],

View File

@@ -40,7 +40,6 @@ const STATE_COLORED_DOMAIN = new Set([
"vacuum",
"valve",
"water_heater",
"weather",
]);
export const stateColorCss = (stateObj: HassEntity, state?: string) => {

View File

@@ -32,8 +32,6 @@ export const numberFormatToLocale = (
return ["de", "es", "it"]; // Use German with fallback to Spanish then Italian formatting 1.234.567,89
case NumberFormat.space_comma:
return ["fr", "sv", "cs"]; // Use French with fallback to Swedish and Czech formatting 1 234 567,89
case NumberFormat.quote_decimal:
return ["de-CH"]; // Use German (Switzerland) formatting 1'234'567.89
case NumberFormat.system:
return undefined;
default:

View File

@@ -6,8 +6,6 @@ import { computeDomain } from "../../common/entity/compute_domain";
import { stateColorProperties } from "../../common/entity/state_color";
import { UNAVAILABLE, UNKNOWN } from "../../data/entity";
import { computeCssValue } from "../../resources/css-variables";
import { computeStateDomain } from "../../common/entity/compute_state_domain";
import { FIXED_DOMAIN_STATES } from "../../common/entity/get_states";
const DOMAIN_STATE_SHADES: Record<string, Record<string, number>> = {
media_player: {
@@ -53,28 +51,6 @@ function computeTimelineStateColor(
let colorIndex = 0;
const stateColorMap = new Map<string, string>();
function computeTimelineEnumColor(
state: string,
computedStyles: CSSStyleDeclaration,
stateObj?: HassEntity
): string | undefined {
if (!stateObj) {
return undefined;
}
const domain = computeStateDomain(stateObj);
const states =
FIXED_DOMAIN_STATES[domain] ||
(domain === "sensor" &&
stateObj.attributes.device_class === "enum" &&
stateObj.attributes.options) ||
[];
const idx = states.indexOf(state);
if (idx === -1) {
return undefined;
}
return getGraphColorByIndex(idx, computedStyles);
}
function computeTimeLineGenericColor(
state: string,
computedStyles: CSSStyleDeclaration
@@ -95,7 +71,6 @@ export function computeTimelineColor(
): string {
return (
computeTimelineStateColor(state, computedStyles, stateObj) ||
computeTimelineEnumColor(state, computedStyles, stateObj) ||
computeTimeLineGenericColor(state, computedStyles)
);
}

View File

@@ -112,7 +112,7 @@ export class HaEntityToggle extends LitElement {
if (!this.hass || !this.stateObj) {
return;
}
forwardHaptic(this, "light");
forwardHaptic("light");
const stateDomain = computeStateDomain(this.stateObj);
let serviceDomain;
let service;

View File

@@ -42,8 +42,8 @@ export class HaBottomSheet extends LitElement {
static styles = css`
wa-drawer {
--wa-color-surface-raised: var(
--ha-bottom-sheet-surface-background,
var(--ha-dialog-surface-background, var(--mdc-theme-surface, #fff)),
--ha-dialog-surface-background,
var(--mdc-theme-surface, #fff)
);
--spacing: 0;
--size: auto;
@@ -51,14 +51,8 @@ export class HaBottomSheet extends LitElement {
--hide-duration: ${BOTTOM_SHEET_ANIMATION_DURATION_MS}ms;
}
wa-drawer::part(dialog) {
border-top-left-radius: var(
--ha-bottom-sheet-border-radius,
var(--ha-dialog-border-radius, var(--ha-border-radius-2xl))
);
border-top-right-radius: var(
--ha-bottom-sheet-border-radius,
var(--ha-dialog-border-radius, var(--ha-border-radius-2xl))
);
border-top-left-radius: var(--ha-border-radius-lg);
border-top-right-radius: var(--ha-border-radius-lg);
max-height: 90vh;
padding-bottom: var(--safe-area-inset-bottom);
padding-left: var(--safe-area-inset-left);

View File

@@ -217,8 +217,8 @@ export class HaResizableBottomSheet extends LitElement {
max-height: 70vh;
min-height: 30vh;
background-color: var(
--ha-bottom-sheet-surface-background,
var(--ha-dialog-surface-background, var(--mdc-theme-surface, #fff)),
--ha-dialog-surface-background,
var(--mdc-theme-surface, #fff)
);
display: flex;
flex-direction: column;
@@ -239,12 +239,12 @@ export class HaResizableBottomSheet extends LitElement {
inset-inline-start: 0;
box-shadow: 0px -8px 16px rgba(0, 0, 0, 0.2);
border-top-left-radius: var(
--ha-bottom-sheet-border-radius,
var(--ha-dialog-border-radius, var(--ha-border-radius-2xl))
--ha-dialog-border-radius,
var(--ha-border-radius-2xl)
);
border-top-right-radius: var(
--ha-bottom-sheet-border-radius,
var(--ha-dialog-border-radius, var(--ha-border-radius-2xl))
--ha-dialog-border-radius,
var(--ha-border-radius-2xl)
);
transform: translateY(100%);
transition: transform ${BOTTOM_SHEET_ANIMATION_DURATION_MS}ms ease;

View File

@@ -15,7 +15,7 @@ export class HaSwitch extends SwitchBase {
super.firstUpdated();
this.addEventListener("change", () => {
if (this.haptic) {
forwardHaptic(this, "light");
forwardHaptic("light");
}
});
}

View File

@@ -28,6 +28,6 @@ declare global {
}
}
export const forwardHaptic = (node: HTMLElement, hapticType: HapticType) => {
fireEvent(node, "haptic", hapticType);
export const forwardHaptic = (hapticType: HapticType) => {
fireEvent(window, "haptic", hapticType);
};

View File

@@ -6,7 +6,6 @@ export enum NumberFormat {
system = "system",
comma_decimal = "comma_decimal",
decimal_comma = "decimal_comma",
quote_decimal = "quote_decimal",
space_comma = "space_comma",
none = "none",
}

View File

@@ -42,7 +42,7 @@ class MoreInfoFan extends LitElement {
private _toggle = () => {
const service = this.stateObj?.state === "on" ? "turn_off" : "turn_on";
forwardHaptic(this, "light");
forwardHaptic("light");
this.hass.callService("fan", service, {
entity_id: this.stateObj!.entity_id,
});

View File

@@ -310,7 +310,7 @@ class MoreInfoLight extends LitElement {
private _toggle = () => {
const service = this.stateObj?.state === "on" ? "turn_off" : "turn_on";
forwardHaptic(this, "light");
forwardHaptic("light");
this.hass.callService("light", service, {
entity_id: this.stateObj!.entity_id,
});

View File

@@ -258,10 +258,7 @@ class MoreInfoMediaPlayer extends LitElement {
const stateObj = this.stateObj;
const controls = computeMediaControls(stateObj, true);
const coverUrl =
stateObj.attributes.entity_picture_local ||
stateObj.attributes.entity_picture ||
"";
const coverUrl = stateObj.attributes.entity_picture || "";
const playerObj = new HassMediaPlayerEntity(this.hass, this.stateObj);
const position = Math.max(Math.floor(playerObj.currentProgress || 0), 0);

View File

@@ -210,10 +210,10 @@ export class ZHAClusterAttributes extends LitElement {
this._readingAttribute = true;
try {
this._attributeValue = await readAttributeValue(this.hass, data);
forwardHaptic(this, "success");
forwardHaptic("success");
button.actionSuccess();
} catch (_err: any) {
forwardHaptic(this, "failure");
forwardHaptic("failure");
button.actionError();
} finally {
this._readingAttribute = false;

View File

@@ -1,6 +1,7 @@
import {
mdiDelete,
mdiDevices,
mdiDotsVertical,
mdiHelpCircle,
mdiPlus,
mdiRobot,
@@ -8,9 +9,8 @@ import {
} from "@mdi/js";
import type { PropertyValues } from "lit";
import { LitElement, html, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
import { customElement, property, query, state } from "lit/decorators";
import memoizeOne from "memoize-one";
import { styleMap } from "lit/directives/style-map";
import { computeCssColor } from "../../../common/color/compute-color";
import { formatShortDateTime } from "../../../common/datetime/format_date_time";
import { storage } from "../../../common/decorators/storage";
@@ -23,7 +23,6 @@ import type {
} from "../../../components/data-table/ha-data-table";
import "../../../components/ha-fab";
import "../../../components/ha-icon-button";
import "../../../components/ha-icon-overflow-menu";
import "../../../components/ha-relative-time";
import type {
LabelRegistryEntry,
@@ -43,6 +42,7 @@ import "../../../layouts/hass-tabs-subpage-data-table";
import type { HomeAssistant, Route } from "../../../types";
import { configSections } from "../ha-panel-config";
import { showLabelDetailDialog } from "./show-dialog-label-detail";
import type { HaMdMenu } from "../../../components/ha-md-menu";
@customElement("ha-config-labels")
export class HaConfigLabels extends LitElement {
@@ -86,6 +86,10 @@ export class HaConfigLabels extends LitElement {
})
private _activeHiddenColumns?: string[];
@query("#overflow-menu") private _overflowMenu!: HaMdMenu;
private _overflowLabel!: LabelRegistryEntry;
private _columns = memoizeOne((localize: LocalizeFunc, narrow: boolean) => {
const columns: DataTableColumnContainer<LabelRegistryEntry> = {
icon: {
@@ -105,14 +109,13 @@ export class HaConfigLabels extends LitElement {
template: (label) =>
label.color
? html`<div
style=${styleMap({
backgroundColor: computeCssColor(label.color),
borderRadius: "10px",
border: "1px solid var(--outline-color)",
boxSizing: "border-box",
width: "20px",
height: "20px",
})}
style="
background-color: ${computeCssColor(label.color)};
border-radius: 10px;
border: 1px solid var(--outline-color);
box-sizing: border-box;
width: 20px;
height: 20px;"
></div>`
: nothing,
},
@@ -173,34 +176,12 @@ export class HaConfigLabels extends LitElement {
hideable: false,
type: "overflow-menu",
template: (label) => html`
<ha-icon-overflow-menu
.hass=${this.hass}
narrow
.items=${[
{
label: this.hass.localize("ui.panel.config.entities.caption"),
path: mdiShape,
action: () => this._navigateEntities(label),
},
{
label: this.hass.localize("ui.panel.config.devices.caption"),
path: mdiDevices,
action: () => this._navigateDevices(label),
},
{
label: this.hass.localize("ui.panel.config.automation.caption"),
path: mdiRobot,
action: () => this._navigateAutomations(label),
},
{
label: this.hass.localize("ui.common.delete"),
path: mdiDelete,
action: () => this._removeLabel(label),
warning: true,
},
]}
>
</ha-icon-overflow-menu>
<ha-icon-button
.selected=${label}
.label=${this.hass.localize("ui.common.overflow_menu")}
.path=${mdiDotsVertical}
@click=${this._showOverflowMenu}
></ha-icon-button>
`,
},
};
@@ -214,6 +195,19 @@ export class HaConfigLabels extends LitElement {
}))
);
private _showOverflowMenu = (ev) => {
if (
this._overflowMenu.open &&
ev.target === this._overflowMenu.anchorElement
) {
this._overflowMenu.close();
return;
}
this._overflowLabel = ev.target.selected;
this._overflowMenu.anchorElement = ev.target;
this._overflowMenu.show();
};
protected firstUpdated(changedProperties: PropertyValues) {
super.firstUpdated(changedProperties);
this._fetchLabels();
@@ -257,6 +251,32 @@ export class HaConfigLabels extends LitElement {
<ha-svg-icon slot="icon" .path=${mdiPlus}></ha-svg-icon>
</ha-fab>
</hass-tabs-subpage-data-table>
<ha-md-menu id="overflow-menu" positioning="fixed">
<ha-md-menu-item .clickAction=${this._navigateEntities}>
<ha-svg-icon slot="start" .path=${mdiShape}></ha-svg-icon>
${this.hass.localize("ui.panel.config.entities.caption")}
</ha-md-menu-item>
<ha-md-menu-item .clickAction=${this._navigateDevices}>
<ha-svg-icon slot="start" .path=${mdiDevices}></ha-svg-icon>
${this.hass.localize("ui.panel.config.devices.caption")}
</ha-md-menu-item>
<ha-md-menu-item .clickAction=${this._navigateAutomations}>
<ha-svg-icon slot="start" .path=${mdiRobot}></ha-svg-icon>
${this.hass.localize("ui.panel.config.automation.caption")}
</ha-md-menu-item>
<ha-md-divider role="separator" tabindex="-1"></ha-md-divider>
<ha-md-menu-item
class="warning"
.clickAction=${this._handleRemoveLabelClick}
>
<ha-svg-icon
slot="start"
class="warning"
.path=${mdiDelete}
></ha-svg-icon>
${this.hass.localize("ui.common.delete")}
</ha-md-menu-item>
</ha-md-menu>
`;
}
@@ -317,6 +337,10 @@ export class HaConfigLabels extends LitElement {
return updated;
}
private _handleRemoveLabelClick = () => {
this._removeLabel(this._overflowLabel);
};
private async _removeLabel(selectedLabel: LabelRegistryEntry) {
if (
!(await showConfirmationDialog(this, {
@@ -344,19 +368,23 @@ export class HaConfigLabels extends LitElement {
}
}
private _navigateEntities(label: LabelRegistryEntry) {
navigate(`/config/entities?historyBack=1&label=${label.label_id}`);
}
private _navigateDevices(label: LabelRegistryEntry) {
navigate(`/config/devices/dashboard?historyBack=1&label=${label.label_id}`);
}
private _navigateAutomations(label: LabelRegistryEntry) {
private _navigateEntities = () => {
navigate(
`/config/automation/dashboard?historyBack=1&label=${label.label_id}`
`/config/entities?historyBack=1&label=${this._overflowLabel.label_id}`
);
}
};
private _navigateDevices = () => {
navigate(
`/config/devices/dashboard?historyBack=1&label=${this._overflowLabel.label_id}`
);
};
private _navigateAutomations = () => {
navigate(
`/config/automation/dashboard?historyBack=1&label=${this._overflowLabel.label_id}`
);
};
private _handleSortingChanged(ev: CustomEvent) {
this._activeSorting = ev.detail;

View File

@@ -1087,7 +1087,7 @@ ${rejected
name: computeStateName(scene),
}),
});
forwardHaptic(this, "light");
forwardHaptic("light");
};
private _deleteConfirm(scene: SceneEntity): void {

View File

@@ -443,7 +443,7 @@ class HaPanelDevAction extends LitElement {
const button = ev.currentTarget as HaProgressButton;
if (this._yamlMode && !this._yamlValid) {
forwardHaptic(this, "failure");
forwardHaptic("failure");
button.actionError();
this._error = this.hass.localize(
"ui.panel.developer-tools.tabs.actions.errors.yaml.invalid_yaml"
@@ -465,7 +465,7 @@ class HaPanelDevAction extends LitElement {
);
if (this._error !== undefined) {
forwardHaptic(this, "failure");
forwardHaptic("failure");
button.actionError();
return;
}
@@ -534,7 +534,7 @@ class HaPanelDevAction extends LitElement {
) {
return;
}
forwardHaptic(this, "failure");
forwardHaptic("failure");
button.actionError();
let localizedErrorMessage: string | undefined;

View File

@@ -177,7 +177,7 @@ class HuiAreaControlsCardFeature
.map((entityId) => this.hass!.states[entityId] as HassEntity | undefined)
.filter((v): v is HassEntity => Boolean(v));
forwardHaptic(this, "light");
forwardHaptic("light");
toggleGroupEntities(this.hass, entities);
}

View File

@@ -69,7 +69,7 @@ class HuiLockCommandsCardFeature
if (!this.hass || !this._stateObj || !service) {
return;
}
forwardHaptic(this, "light");
forwardHaptic("light");
callProtectedLockService(this, this.hass, this._stateObj, service);
}

View File

@@ -112,7 +112,7 @@ class HuiToggleCardFeature extends LitElement implements LovelaceCardFeature {
if (!this.hass || !this._stateObj) {
return;
}
forwardHaptic(this, "light");
forwardHaptic("light");
const stateDomain = computeDomain(this._stateObj.entity_id);
const serviceDomain = stateDomain;
const service = turnOn ? "turn_on" : "turn_off";

View File

@@ -1,6 +1,5 @@
import type { PropertyValues } from "lit";
import { css, html, LitElement, nothing } from "lit";
import { classMap } from "lit/directives/class-map";
import { customElement, property, state } from "lit/decorators";
import { getColorByIndex } from "../../../common/color/colors";
import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element";
@@ -17,11 +16,7 @@ import type {
import "../../calendar/ha-full-calendar";
import { findEntities } from "../common/find-entities";
import "../components/hui-warning";
import type {
LovelaceCard,
LovelaceCardEditor,
LovelaceGridOptions,
} from "../types";
import type { LovelaceCard, LovelaceCardEditor } from "../types";
import type { CalendarCardConfig } from "./types";
@customElement("hui-calendar-card")
@@ -53,8 +48,6 @@ export class HuiCalendarCard extends LitElement implements LovelaceCard {
@property({ attribute: false }) public hass?: HomeAssistant;
@property({ attribute: false }) public layout?: string;
@state() private _events: CalendarEvent[] = [];
@state() private _config?: CalendarCardConfig;
@@ -95,16 +88,7 @@ export class HuiCalendarCard extends LitElement implements LovelaceCard {
}
public getCardSize(): number {
return 12;
}
public getGridOptions(): LovelaceGridOptions {
return {
rows: 6,
columns: 12,
min_columns: 4,
min_rows: 4,
};
return this._config?.header ? 1 : 0 + 11;
}
public connectedCallback(): void {
@@ -134,10 +118,6 @@ export class HuiCalendarCard extends LitElement implements LovelaceCard {
<ha-card>
<div class="header">${this._config.title}</div>
<ha-full-calendar
class=${classMap({
"is-grid": this.layout === "grid",
"is-panel": this.layout === "panel",
})}
.narrow=${this._narrow}
.events=${this._events}
.hass=${this.hass}
@@ -244,11 +224,6 @@ export class HuiCalendarCard extends LitElement implements LovelaceCard {
ha-full-calendar {
--calendar-height: 400px;
}
ha-full-calendar.is-grid,
ha-full-calendar.is-panel {
height: calc(100% - 16px);
}
`;
}

View File

@@ -231,7 +231,6 @@ export class HuiMarkdownCard extends LitElement implements LovelaceCard {
static styles = css`
ha-card {
height: 100%;
overflow-y: auto;
}
ha-alert {
margin-bottom: 8px;

View File

@@ -53,7 +53,7 @@ export const handleAction = async (
(e) => e.user === hass!.user?.id
))
) {
forwardHaptic(node, "warning");
forwardHaptic("warning");
let serviceName;
if (
@@ -107,7 +107,7 @@ export const handleAction = async (
"ui.panel.lovelace.cards.actions.no_entity_more_info"
),
});
forwardHaptic(node, "failure");
forwardHaptic("failure");
}
break;
}
@@ -122,7 +122,7 @@ export const handleAction = async (
"ui.panel.lovelace.cards.actions.no_navigation_path"
),
});
forwardHaptic(node, "failure");
forwardHaptic("failure");
}
break;
case "url": {
@@ -132,21 +132,21 @@ export const handleAction = async (
showToast(node, {
message: hass.localize("ui.panel.lovelace.cards.actions.no_url"),
});
forwardHaptic(node, "failure");
forwardHaptic("failure");
}
break;
}
case "toggle": {
if (config.entity) {
toggleEntity(hass, config.entity!);
forwardHaptic(node, "light");
forwardHaptic("light");
} else {
showToast(node, {
message: hass.localize(
"ui.panel.lovelace.cards.actions.no_entity_toggle"
),
});
forwardHaptic(node, "failure");
forwardHaptic("failure");
}
break;
}
@@ -156,7 +156,7 @@ export const handleAction = async (
showToast(node, {
message: hass.localize("ui.panel.lovelace.cards.actions.no_action"),
});
forwardHaptic(node, "failure");
forwardHaptic("failure");
return;
}
const [domain, service] = (actionConfig.perform_action ||
@@ -167,7 +167,7 @@ export const handleAction = async (
actionConfig.data ?? actionConfig.service_data,
actionConfig.target
);
forwardHaptic(node, "light");
forwardHaptic("light");
break;
}
case "assist": {

View File

@@ -58,7 +58,7 @@ class HuiEntitiesToggle extends LitElement {
`;
private _callService(ev: MouseEvent): void {
forwardHaptic(this, "light");
forwardHaptic("light");
const turnOn = (ev.target as HaSwitch).checked;
turnOnOffEntities(this.hass!, this._toggleEntities!, turnOn!);
}

View File

@@ -103,7 +103,7 @@ class HuiInputSelectEntityRow extends LitElement implements LovelaceRow {
return;
}
forwardHaptic(this, "light");
forwardHaptic("light");
setInputSelectOption(this.hass!, stateObj.entity_id, option);
}

View File

@@ -104,7 +104,7 @@ class HuiSelectEntityRow extends LitElement implements LovelaceRow {
return;
}
forwardHaptic(this, "light");
forwardHaptic("light");
setSelectOption(this.hass!, stateObj.entity_id, option);
}

View File

@@ -1,3 +1,4 @@
import type { ActionDetail } from "@material/mwc-list";
import {
mdiAndroid,
mdiApple,
@@ -14,8 +15,7 @@ import memoizeOne from "memoize-one";
import { relativeTime } from "../../common/datetime/relative_time";
import { fireEvent } from "../../common/dom/fire_event";
import "../../components/ha-button";
import "../../components/ha-md-button-menu";
import "../../components/ha-md-menu-item";
import "../../components/ha-button-menu";
import "../../components/ha-card";
import "../../components/ha-icon-button";
import "../../components/ha-label";
@@ -146,19 +146,20 @@ class HaRefreshTokens extends LitElement {
)}
</div>
<div>
<ha-md-button-menu positioning="popover">
<ha-button-menu
corner="BOTTOM_END"
menu-corner="END"
@action=${this._handleAction}
.token=${token}
>
<ha-icon-button
slot="trigger"
.label=${this.hass.localize("ui.common.menu")}
.path=${mdiDotsVertical}
></ha-icon-button>
<ha-md-menu-item
graphic="icon"
@click=${this._toggleTokenExpiration}
.token=${token}
>
<ha-list-item graphic="icon">
<ha-svg-icon
slot="start"
slot="graphic"
.path=${token.expire_at
? mdiClockRemoveOutline
: mdiClockCheckOutline}
@@ -170,24 +171,20 @@ class HaRefreshTokens extends LitElement {
: this.hass.localize(
"ui.panel.profile.refresh_tokens.enable_token_expiration"
)}
</ha-md-menu-item>
<ha-md-menu-item
</ha-list-item>
<ha-list-item
graphic="icon"
class="warning"
.disabled=${token.is_current}
@click=${this._deleteToken}
.token=${token}
>
<ha-svg-icon
class="warning"
slot="start"
slot="graphic"
.path=${mdiDelete}
></ha-svg-icon>
<div slot="headline">
${this.hass.localize("ui.common.delete")}
</div>
</ha-md-menu-item>
</ha-md-button-menu>
${this.hass.localize("ui.common.delete")}
</ha-list-item>
</ha-button-menu>
</div>
</ha-settings-row>
`
@@ -210,8 +207,19 @@ class HaRefreshTokens extends LitElement {
`;
}
private async _toggleTokenExpiration(ev): Promise<void> {
const token = (ev.currentTarget as any).token as RefreshToken;
private async _handleAction(ev: CustomEvent<ActionDetail>) {
const token = (ev.currentTarget as any).token;
switch (ev.detail.index) {
case 0:
this._toggleTokenExpiration(token);
break;
case 1:
this._deleteToken(token);
break;
}
}
private async _toggleTokenExpiration(token: RefreshToken): Promise<void> {
const enable = !token.expire_at;
if (!enable) {
if (
@@ -252,8 +260,7 @@ class HaRefreshTokens extends LitElement {
}
}
private async _deleteToken(ev): Promise<void> {
const token = (ev.currentTarget as any).token as RefreshToken;
private async _deleteToken(token: RefreshToken): Promise<void> {
if (
!(await showConfirmationDialog(this, {
title: this.hass.localize(
@@ -325,8 +332,8 @@ class HaRefreshTokens extends LitElement {
ha-icon-button {
color: var(--primary-text-color);
}
ha-md-list-item[disabled],
ha-md-list-item[disabled] ha-svg-icon {
ha-list-item[disabled],
ha-list-item[disabled] ha-svg-icon {
color: var(--disabled-text-color) !important;
}
ha-settings-row .current-session {

View File

@@ -39,7 +39,7 @@ class HaSetVibrateRow extends LitElement {
fireEvent(this, "hass-vibrate", {
vibrate,
});
forwardHaptic(this, "light");
forwardHaptic("light");
}
}

View File

@@ -14,15 +14,7 @@ import {
polyfillTimeZoneData,
} from "./locale-data-polyfill";
let polyfilled = false;
const _polyfillTimeZoneData = polyfillTimeZoneData;
const polyfillIntl = async () => {
if (polyfilled) {
return;
}
polyfilled = true;
const locale = getLocalLanguage();
const polyfills: Promise<unknown>[] = [];
if (shouldPolyfillGetCanonicalLocales()) {
@@ -34,7 +26,7 @@ const polyfillIntl = async () => {
if (shouldPolyfillDateTimeFormat(locale)) {
polyfills.push(
import("@formatjs/intl-datetimeformat/polyfill-force").then(() =>
_polyfillTimeZoneData()
polyfillTimeZoneData()
)
);
}
@@ -66,7 +58,7 @@ const polyfillIntl = async () => {
if (polyfills.length === 0) {
return;
}
await Promise.allSettled(polyfills).then(() =>
await Promise.all(polyfills).then(() =>
// Load the default language
polyfillLocaleData(locale)
);

View File

@@ -184,21 +184,6 @@ export const colorStyles = css`
--state-water_heater-heat_pump-color: var(--orange-color);
--state-water_heater-high_demand-color: var(--deep-orange-color);
--state-water_heater-performance-color: var(--deep-orange-color);
--state-weather-clear_night-color: var(--deep-purple-color);
--state-weather-cloudy-color: var(--light-grey-color);
--state-weather-exceptional-color: var(--red-color);
--state-weather-fog-color: var(--grey-color);
--state-weather-hail-color: var(--cyan-color);
--state-weather-lightning_rainy-color: var(--lime-color);
--state-weather-lightning-color: var(--yellow-color);
--state-weather-partlycloudy-color: var(--blue-grey-color);
--state-weather-pouring-color: var(--indigo-color);
--state-weather-rainy-color: var(--blue-color);
--state-weather-snowy_rainy-color: var(--light-blue-color);
--state-weather-snowy-color: #c0e0ff;
--state-weather-sunny-color: var(--amber-color);
--state-weather-windy_variant-color: var(--green-color);
--state-weather-windy-color: var(--green-color);
/* history colors */
--history-unknown-color: var(--dark-grey-color);

View File

@@ -19,8 +19,8 @@ export const coreStyles = css`
--ha-border-radius-pill: 9999px;
--ha-border-radius-circle: 50%;
--ha-border-radius-square: 0;
/* Spacing */
# Spacing
--ha-space-0: 0px;
--ha-space-1: 4px;
--ha-space-2: 8px;
@@ -34,7 +34,7 @@ export const coreStyles = css`
--ha-space-10: 40px;
--ha-space-11: 44px;
--ha-space-12: 48px;
--ha-space-13: 52px;
--ha-space-13: 44px;
--ha-space-14: 56px;
--ha-space-15: 60px;
--ha-space-16: 64px;

View File

@@ -40,7 +40,7 @@ export class HaStateControlCoverToggle extends LitElement {
if (!this.hass || !this.stateObj) {
return;
}
forwardHaptic(this, "light");
forwardHaptic("light");
await this.hass.callService(
"cover",

View File

@@ -46,7 +46,7 @@ export class HaStateControlToggle extends LitElement {
if (!this.hass || !this.stateObj) {
return;
}
forwardHaptic(this, "light");
forwardHaptic("light");
const stateDomain = computeDomain(this.stateObj.entity_id);
let serviceDomain;
let service;

View File

@@ -68,7 +68,7 @@ export class HaStateControlLockToggle extends LitElement {
if (!this.hass || !this.stateObj) {
return;
}
forwardHaptic(this, "light");
forwardHaptic("light");
fireEvent(this, "lock-service-called");
callProtectedLockService(
this,

View File

@@ -40,7 +40,7 @@ export class HaStateControlValveToggle extends LitElement {
if (!this.hass || !this.stateObj) {
return;
}
forwardHaptic(this, "light");
forwardHaptic("light");
await this.hass.callService(
"valve",

View File

@@ -127,7 +127,7 @@ export const connectionMixin = <T extends Constructor<HassBaseEl>>(
);
}
if (notifyOnError) {
forwardHaptic(this, "failure");
forwardHaptic("failure");
const lokalize = await this.hass!.loadBackendTranslation(
"exceptions",
err.translation_domain

View File

@@ -8440,7 +8440,6 @@
"system": "Use system locale",
"comma_decimal": "1,234,567.89",
"decimal_comma": "1.234.567,89",
"quote_decimal": "1'234'567.89",
"space_comma": "1234567,89",
"none": "None"
}

141
yarn.lock
View File

@@ -1351,10 +1351,10 @@ __metadata:
languageName: node
linkType: hard
"@ctrl/tinycolor@npm:4.1.0":
version: 4.1.0
resolution: "@ctrl/tinycolor@npm:4.1.0"
checksum: 10/e64569399139ef0abd2eb0ec9fb7267dfd7820f7ad7d4567a63e5fc35e5cfdcb8ecdb3bad65cb9244b47ba6c77bc51085826c00e981acf263a3221dc89343adc
"@ctrl/tinycolor@npm:^4.1.0":
version: 4.2.0
resolution: "@ctrl/tinycolor@npm:4.2.0"
checksum: 10/1be14de7d7e8184c0bc5c8d7e3486cc8186e6702e8ca899c7239f328bb1df9a15d1575e2af7b4c6ba020727fa78f5a9f887555971f30a2890cece9e4253a9d3a
languageName: node
linkType: hard
@@ -1940,11 +1940,11 @@ __metadata:
languageName: node
linkType: hard
"@home-assistant/webawesome@npm:3.0.0-beta.6.ha.0":
version: 3.0.0-beta.6.ha.0
resolution: "@home-assistant/webawesome@npm:3.0.0-beta.6.ha.0"
"@home-assistant/webawesome@npm:3.0.0-beta.4.ha.3":
version: 3.0.0-beta.4.ha.3
resolution: "@home-assistant/webawesome@npm:3.0.0-beta.4.ha.3"
dependencies:
"@ctrl/tinycolor": "npm:4.1.0"
"@ctrl/tinycolor": "npm:^4.1.0"
"@floating-ui/dom": "npm:^1.6.13"
"@lit/react": "npm:^1.0.8"
"@shoelace-style/animations": "npm:^1.2.0"
@@ -1953,7 +1953,8 @@ __metadata:
lit: "npm:^3.2.1"
nanoid: "npm:^5.1.5"
qr-creator: "npm:^1.0.0"
checksum: 10/ec9d74585b544e5755f7b2644a0d7f9318b5776bedf51430c8f8729918fddb6e54cce46acace674960383385362846cc4c0f2da5245fa622bce8c54733a31865
style-observer: "npm:^0.0.7"
checksum: 10/b9241821ed471ccbad86b0ea4697a2d41395f05fdc26f46e5edbc7f6b5eeab5d248251ef702326312ded00d5bf850ce0dcdcf7cd5e2e542b9d9cb9a84f3726da
languageName: node
linkType: hard
@@ -3898,82 +3899,81 @@ __metadata:
languageName: node
linkType: hard
"@rsdoctor/client@npm:1.3.1":
version: 1.3.1
resolution: "@rsdoctor/client@npm:1.3.1"
checksum: 10/6885dd7e16f2172ddf5d4c901275af77640402f1b5cfd41b0eab6e695cad423bda2909a5b13dc68e864e9d9df4440587b8a3403138437c20b6e3bb15d0c83b04
"@rsdoctor/client@npm:1.3.0":
version: 1.3.0
resolution: "@rsdoctor/client@npm:1.3.0"
checksum: 10/dca67aa80613ddd36b7bc43456e15633b632df91c7aca6ab05653b3fbb1d57887ffe9fa3a792a3812efc2e0d2c6f50cec9b5567ed182fd125c675cc9a4fa8ceb
languageName: node
linkType: hard
"@rsdoctor/core@npm:1.3.1":
version: 1.3.1
resolution: "@rsdoctor/core@npm:1.3.1"
"@rsdoctor/core@npm:1.3.0":
version: 1.3.0
resolution: "@rsdoctor/core@npm:1.3.0"
dependencies:
"@rsdoctor/graph": "npm:1.3.1"
"@rsdoctor/sdk": "npm:1.3.1"
"@rsdoctor/types": "npm:1.3.1"
"@rsdoctor/utils": "npm:1.3.1"
"@rsdoctor/graph": "npm:1.3.0"
"@rsdoctor/sdk": "npm:1.3.0"
"@rsdoctor/types": "npm:1.3.0"
"@rsdoctor/utils": "npm:1.3.0"
browserslist-load-config: "npm:^1.0.1"
enhanced-resolve: "npm:5.12.0"
filesize: "npm:^10.1.6"
fs-extra: "npm:^11.1.1"
lodash-es: "npm:^4.17.21"
semver: "npm:^7.7.2"
source-map: "npm:^0.7.6"
checksum: 10/40f4de3680202487ff094cd97664035c19c8bd802ff9adbd4c3947c53b08e738eac65e22b45514ca1cd2640305451c53d1efd23a0097674d4af0391698eff9a7
checksum: 10/e990358b82a260242a27af9d93fa6f673c68fb0896b74888aa121b4060069e8b47079f929403a237a532da65f4566d6bfb1d824dae2266735e44294d2521b1e6
languageName: node
linkType: hard
"@rsdoctor/graph@npm:1.3.1":
version: 1.3.1
resolution: "@rsdoctor/graph@npm:1.3.1"
"@rsdoctor/graph@npm:1.3.0":
version: 1.3.0
resolution: "@rsdoctor/graph@npm:1.3.0"
dependencies:
"@rsdoctor/types": "npm:1.3.1"
"@rsdoctor/utils": "npm:1.3.1"
"@rsdoctor/types": "npm:1.3.0"
"@rsdoctor/utils": "npm:1.3.0"
lodash.unionby: "npm:^4.8.0"
path-browserify: "npm:1.0.1"
source-map: "npm:^0.7.6"
checksum: 10/7ae4abd2bd630e2589975df3e34d029921c2ff34c9f62961aff73c384dbb7e94d24faf2bf3f5118860f56b9bab2a5cd4b5185c178ce91f8a0852a258a854602c
checksum: 10/64dd610819fd38beb0bb96cf7f2b85c47d2b40134150a8f07e71bc94ae1ad38b7be23a453b42d3692303f1c7b07c3f7ec78bca6b7e8b7f41c961e8b7dc479495
languageName: node
linkType: hard
"@rsdoctor/rspack-plugin@npm:1.3.1":
version: 1.3.1
resolution: "@rsdoctor/rspack-plugin@npm:1.3.1"
"@rsdoctor/rspack-plugin@npm:1.3.0":
version: 1.3.0
resolution: "@rsdoctor/rspack-plugin@npm:1.3.0"
dependencies:
"@rsdoctor/core": "npm:1.3.1"
"@rsdoctor/graph": "npm:1.3.1"
"@rsdoctor/sdk": "npm:1.3.1"
"@rsdoctor/types": "npm:1.3.1"
"@rsdoctor/utils": "npm:1.3.1"
"@rsdoctor/core": "npm:1.3.0"
"@rsdoctor/graph": "npm:1.3.0"
"@rsdoctor/sdk": "npm:1.3.0"
"@rsdoctor/types": "npm:1.3.0"
"@rsdoctor/utils": "npm:1.3.0"
lodash-es: "npm:^4.17.21"
peerDependencies:
"@rspack/core": "*"
peerDependenciesMeta:
"@rspack/core":
optional: true
checksum: 10/94759bf214102e8acffeaaeb89d8274301f0b420274bf6f26afa736ac915f029e02e33cbc4f9f977d208e20a5e38bf3d812a1147be830dcd25a49755ff111d6d
checksum: 10/8f9126f6ed8c0bc350e899da5a9104cbf74808ac51a98a0f6a95fddf6dfdcbfb9b338c696095c9b7960bbc378947e90895bdf531da959426f47f3d00e5402409
languageName: node
linkType: hard
"@rsdoctor/sdk@npm:1.3.1":
version: 1.3.1
resolution: "@rsdoctor/sdk@npm:1.3.1"
"@rsdoctor/sdk@npm:1.3.0":
version: 1.3.0
resolution: "@rsdoctor/sdk@npm:1.3.0"
dependencies:
"@rsdoctor/client": "npm:1.3.1"
"@rsdoctor/graph": "npm:1.3.1"
"@rsdoctor/types": "npm:1.3.1"
"@rsdoctor/utils": "npm:1.3.1"
"@rsdoctor/client": "npm:1.3.0"
"@rsdoctor/graph": "npm:1.3.0"
"@rsdoctor/types": "npm:1.3.0"
"@rsdoctor/utils": "npm:1.3.0"
safer-buffer: "npm:2.1.2"
socket.io: "npm:4.8.1"
tapable: "npm:2.2.3"
checksum: 10/194efba86d15e86d81de3b1a747c3e82874f69c4e3f1f96e9f36f8a83cabbcc6371729498e2ab82724550f376dd2630849c435841031a0c139406aeb4b472d06
checksum: 10/c6183047ce5e7db1240b89c3d3890def9fc7ae2c1dcab8621ee3c0652b174e3facae6358cbd706317ae103af748d41e9c3187a519b082e1d249dcc18a9938a58
languageName: node
linkType: hard
"@rsdoctor/types@npm:1.3.1":
version: 1.3.1
resolution: "@rsdoctor/types@npm:1.3.1"
"@rsdoctor/types@npm:1.3.0":
version: 1.3.0
resolution: "@rsdoctor/types@npm:1.3.0"
dependencies:
"@types/connect": "npm:3.4.38"
"@types/estree": "npm:1.0.5"
@@ -3987,16 +3987,16 @@ __metadata:
optional: true
webpack:
optional: true
checksum: 10/e058017b77b4b58c22c39a0f1177e6cabdedbdebc355f936bbc6be3ace51279d0cd078e2cab19543a5fe2d4cff3e9980f076c4d18bd70ab3d393d5ce0dd1eb89
checksum: 10/bc077915aa616844ee1d58b17ac34250f2174a0f5d2b8c83e2983a4c435855c85ec8317e7d2800ce62dcba225c2b493bca95c6cfa51c4f232a019e3390dd0ca4
languageName: node
linkType: hard
"@rsdoctor/utils@npm:1.3.1":
version: 1.3.1
resolution: "@rsdoctor/utils@npm:1.3.1"
"@rsdoctor/utils@npm:1.3.0":
version: 1.3.0
resolution: "@rsdoctor/utils@npm:1.3.0"
dependencies:
"@babel/code-frame": "npm:7.26.2"
"@rsdoctor/types": "npm:1.3.1"
"@rsdoctor/types": "npm:1.3.0"
"@types/estree": "npm:1.0.5"
acorn: "npm:^8.10.0"
acorn-import-attributes: "npm:^1.9.5"
@@ -4010,7 +4010,7 @@ __metadata:
picocolors: "npm:^1.1.1"
rslog: "npm:^1.2.11"
strip-ansi: "npm:^6.0.1"
checksum: 10/ebe1a7233179bf9be0272959c16fc2fc89c37c2cc2553973002889ab8432697f2bee6308dc1c82208ddb1d13d875be6341b9a985d9fe18536af381989200dc48
checksum: 10/d11ab54328d719542965af87fb843627850e26a48e49378ab4b0b02553cbf37b2ec185caa622f745bc27735738112f29b1d1f00656e8d0a8b4bd23103a320a9a
languageName: node
linkType: hard
@@ -7528,16 +7528,6 @@ __metadata:
languageName: node
linkType: hard
"enhanced-resolve@npm:5.12.0":
version: 5.12.0
resolution: "enhanced-resolve@npm:5.12.0"
dependencies:
graceful-fs: "npm:^4.2.4"
tapable: "npm:^2.2.0"
checksum: 10/ea5b49a0641827c6a083eaa3a625f953f4bd4e8f015bf70b9fb8cf60a35aaeb44e567df2da91ed28efaea3882845016e1d22a3152c2fdf773ea14f39cbe3d8a9
languageName: node
linkType: hard
"enhanced-resolve@npm:^0.9.1":
version: 0.9.1
resolution: "enhanced-resolve@npm:0.9.1"
@@ -8979,7 +8969,7 @@ __metadata:
languageName: node
linkType: hard
"graceful-fs@npm:^4.1.2, graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.2.0, graceful-fs@npm:^4.2.10, graceful-fs@npm:^4.2.11, graceful-fs@npm:^4.2.4, graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.8":
"graceful-fs@npm:^4.1.2, graceful-fs@npm:^4.1.6, graceful-fs@npm:^4.2.0, graceful-fs@npm:^4.2.10, graceful-fs@npm:^4.2.11, graceful-fs@npm:^4.2.6, graceful-fs@npm:^4.2.8":
version: 4.2.11
resolution: "graceful-fs@npm:4.2.11"
checksum: 10/bf152d0ed1dc159239db1ba1f74fdbc40cb02f626770dcd5815c427ce0688c2635a06ed69af364396da4636d0408fcf7d4afdf7881724c3307e46aff30ca49e2
@@ -9205,7 +9195,7 @@ __metadata:
"@fullcalendar/list": "npm:6.1.19"
"@fullcalendar/luxon3": "npm:6.1.19"
"@fullcalendar/timegrid": "npm:6.1.19"
"@home-assistant/webawesome": "npm:3.0.0-beta.6.ha.0"
"@home-assistant/webawesome": "npm:3.0.0-beta.4.ha.3"
"@lezer/highlight": "npm:1.2.1"
"@lit-labs/motion": "npm:1.0.9"
"@lit-labs/observers": "npm:2.0.6"
@@ -9242,7 +9232,7 @@ __metadata:
"@octokit/plugin-retry": "npm:8.0.1"
"@octokit/rest": "npm:22.0.0"
"@replit/codemirror-indentation-markers": "npm:6.5.3"
"@rsdoctor/rspack-plugin": "npm:1.3.1"
"@rsdoctor/rspack-plugin": "npm:1.3.0"
"@rspack/core": "npm:1.5.7"
"@rspack/dev-server": "npm:1.1.4"
"@swc/helpers": "npm:0.5.17"
@@ -9322,7 +9312,7 @@ __metadata:
leaflet: "npm:1.9.4"
leaflet-draw: "patch:leaflet-draw@npm%3A1.0.4#./.yarn/patches/leaflet-draw-npm-1.0.4-0ca0ebcf65.patch"
leaflet.markercluster: "npm:1.5.3"
lint-staged: "npm:16.2.2"
lint-staged: "npm:16.2.1"
lit: "npm:3.3.1"
lit-analyzer: "npm:2.0.3"
lit-html: "npm:3.3.1"
@@ -10657,9 +10647,9 @@ __metadata:
languageName: node
linkType: hard
"lint-staged@npm:16.2.2":
version: 16.2.2
resolution: "lint-staged@npm:16.2.2"
"lint-staged@npm:16.2.1":
version: 16.2.1
resolution: "lint-staged@npm:16.2.1"
dependencies:
commander: "npm:^14.0.1"
listr2: "npm:^9.0.4"
@@ -10670,7 +10660,7 @@ __metadata:
yaml: "npm:^2.8.1"
bin:
lint-staged: bin/lint-staged.js
checksum: 10/8a6dc0a54fabd095c99ce5962b50df6cee3c8b1191b5e4ff345037a721284cc77532c359e125a0877cf83314a7847b361879da6608e142b22aad2fb32ff66e3a
checksum: 10/b604de3ca27a067e45c5f0e0780ca46f5617e9f6ac3895297dee087d62742bbcd9f9e910300c15c599e1f06900666469b73e036e3fe3153ccedef314ce791dd5
languageName: node
linkType: hard
@@ -13735,6 +13725,13 @@ __metadata:
languageName: node
linkType: hard
"style-observer@npm:^0.0.7":
version: 0.0.7
resolution: "style-observer@npm:0.0.7"
checksum: 10/bb57f98bae4463c1e1b57234f8ffe72ec0de27fb08b032c1919910129c210aacd1ddd615432b9453d491e10d3b719cf6c2a68a97165ca55d6fc9b86c0fca37fb
languageName: node
linkType: hard
"style-observer@npm:^0.0.8":
version: 0.0.8
resolution: "style-observer@npm:0.0.8"