mirror of
https://github.com/home-assistant/frontend.git
synced 2025-10-21 01:29:56 +00:00
Compare commits
39 Commits
loading-an
...
fix-rtl-pr
Author | SHA1 | Date | |
---|---|---|---|
![]() |
85fd9bcc3b | ||
![]() |
2a49b5e15a | ||
![]() |
7a59e6ce75 | ||
![]() |
07a7664923 | ||
![]() |
fa4dd1c5ea | ||
![]() |
37a3af2e8b | ||
![]() |
fbfcef1573 | ||
![]() |
4eecd37aaf | ||
![]() |
c798521ab8 | ||
![]() |
e432f0a8ee | ||
![]() |
e3a1d0abe2 | ||
![]() |
8080ba696c | ||
![]() |
7bd8f321a4 | ||
![]() |
4e958302b4 | ||
![]() |
8a42d15bde | ||
![]() |
ef0da0a7ee | ||
![]() |
ae053c20b0 | ||
![]() |
5f71938d60 | ||
![]() |
82ac26b326 | ||
![]() |
80b92b9813 | ||
![]() |
904a083f61 | ||
![]() |
d75ee09d55 | ||
![]() |
a8e0d506b6 | ||
![]() |
01dd731622 | ||
![]() |
dc20702d36 | ||
![]() |
f32ca9be29 | ||
![]() |
8c4c4157a8 | ||
![]() |
c8419d4c3d | ||
![]() |
089316b8ae | ||
![]() |
8d03ac5f64 | ||
![]() |
e0e1f6f920 | ||
![]() |
d4c98cae3a | ||
![]() |
46d0eb4f44 | ||
![]() |
07812f8d84 | ||
![]() |
96f54d348f | ||
![]() |
6084ab116f | ||
![]() |
6b7acd8d3b | ||
![]() |
e35b155c66 | ||
![]() |
437d02c12f |
6
.github/workflows/codeql-analysis.yml
vendored
6
.github/workflows/codeql-analysis.yml
vendored
@@ -36,14 +36,14 @@ jobs:
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # v4.30.8
|
||||
uses: github/codeql-action/init@16140ae1a102900babc80a33c44059580f687047 # v4.30.9
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # v4.30.8
|
||||
uses: github/codeql-action/autobuild@16140ae1a102900babc80a33c44059580f687047 # v4.30.9
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
@@ -57,4 +57,4 @@ jobs:
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@f443b600d91635bebf5b0d9ebc620189c0d6fba5 # v4.30.8
|
||||
uses: github/codeql-action/analyze@16140ae1a102900babc80a33c44059580f687047 # v4.30.9
|
||||
|
14
package.json
14
package.json
@@ -34,7 +34,7 @@
|
||||
"@codemirror/legacy-modes": "6.5.2",
|
||||
"@codemirror/search": "6.5.11",
|
||||
"@codemirror/state": "6.5.2",
|
||||
"@codemirror/view": "6.38.5",
|
||||
"@codemirror/view": "6.38.6",
|
||||
"@date-fns/tz": "1.4.1",
|
||||
"@egjs/hammerjs": "2.0.17",
|
||||
"@formatjs/intl-datetimeformat": "6.18.2",
|
||||
@@ -52,8 +52,8 @@
|
||||
"@fullcalendar/list": "6.1.19",
|
||||
"@fullcalendar/luxon3": "6.1.19",
|
||||
"@fullcalendar/timegrid": "6.1.19",
|
||||
"@home-assistant/webawesome": "3.0.0-beta.6.ha.4",
|
||||
"@lezer/highlight": "1.2.1",
|
||||
"@home-assistant/webawesome": "3.0.0-beta.6.ha.5",
|
||||
"@lezer/highlight": "1.2.2",
|
||||
"@lit-labs/motion": "1.0.9",
|
||||
"@lit-labs/observers": "2.0.6",
|
||||
"@lit-labs/virtualizer": "2.1.1",
|
||||
@@ -122,7 +122,7 @@
|
||||
"lit": "3.3.1",
|
||||
"lit-html": "3.3.1",
|
||||
"luxon": "3.7.2",
|
||||
"marked": "16.4.0",
|
||||
"marked": "16.4.1",
|
||||
"memoize-one": "6.0.0",
|
||||
"node-vibrant": "4.0.3",
|
||||
"object-hash": "3.0.0",
|
||||
@@ -153,11 +153,11 @@
|
||||
"@babel/plugin-transform-runtime": "7.28.3",
|
||||
"@babel/preset-env": "7.28.3",
|
||||
"@bundle-stats/plugin-webpack-filter": "4.21.5",
|
||||
"@lokalise/node-api": "15.3.0",
|
||||
"@lokalise/node-api": "15.3.1",
|
||||
"@octokit/auth-oauth-device": "8.0.2",
|
||||
"@octokit/plugin-retry": "8.0.2",
|
||||
"@octokit/rest": "22.0.0",
|
||||
"@rsdoctor/rspack-plugin": "1.3.2",
|
||||
"@rsdoctor/rspack-plugin": "1.3.3",
|
||||
"@rspack/core": "1.5.8",
|
||||
"@rspack/dev-server": "1.1.4",
|
||||
"@types/babel__plugin-transform-runtime": "7.9.5",
|
||||
@@ -217,7 +217,7 @@
|
||||
"terser-webpack-plugin": "5.3.14",
|
||||
"ts-lit-plugin": "2.0.2",
|
||||
"typescript": "5.9.3",
|
||||
"typescript-eslint": "8.46.0",
|
||||
"typescript-eslint": "8.46.1",
|
||||
"vite-tsconfig-paths": "5.1.4",
|
||||
"vitest": "3.2.4",
|
||||
"webpack-stats-plugin": "1.1.3",
|
||||
|
@@ -6,6 +6,7 @@ import { showConfirmationDialog } from "../../dialogs/generic/show-dialog-box";
|
||||
import "./ha-progress-button";
|
||||
import type { HomeAssistant } from "../../types";
|
||||
import { fireEvent } from "../../common/dom/fire_event";
|
||||
import type { Appearance } from "../ha-button";
|
||||
|
||||
@customElement("ha-call-service-button")
|
||||
class HaCallServiceButton extends LitElement {
|
||||
@@ -25,12 +26,14 @@ class HaCallServiceButton extends LitElement {
|
||||
|
||||
@property() public confirmation?;
|
||||
|
||||
@property() public appearance: Appearance = "plain";
|
||||
|
||||
public render(): TemplateResult {
|
||||
return html`
|
||||
<ha-progress-button
|
||||
.progress=${this.progress}
|
||||
.disabled=${this.disabled}
|
||||
appearance="plain"
|
||||
.appearance=${this.appearance}
|
||||
@click=${this._buttonTapped}
|
||||
tabindex="0"
|
||||
>
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { mdiDrag, mdiEye, mdiEyeOff } from "@mdi/js";
|
||||
import { mdiDragHorizontalVariant, mdiEye, mdiEyeOff } from "@mdi/js";
|
||||
import type { CSSResultGroup } from "lit";
|
||||
import { LitElement, css, html, nothing } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
@@ -129,7 +129,7 @@ export class DialogDataTableSettings extends LitElement {
|
||||
${canMove && isVisible
|
||||
? html`<ha-svg-icon
|
||||
class="handle"
|
||||
.path=${mdiDrag}
|
||||
.path=${mdiDragHorizontalVariant}
|
||||
slot="graphic"
|
||||
></ha-svg-icon>`
|
||||
: nothing}
|
||||
|
@@ -1,13 +1,13 @@
|
||||
import { mdiDrag } from "@mdi/js";
|
||||
import { mdiDragHorizontalVariant } from "@mdi/js";
|
||||
import { css, html, LitElement, nothing } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import memoizeOne from "memoize-one";
|
||||
import { fireEvent } from "../../common/dom/fire_event";
|
||||
import { isValidEntityId } from "../../common/entity/valid_entity_id";
|
||||
import type { HaEntityPickerEntityFilterFunc } from "../../data/entity";
|
||||
import type { HomeAssistant, ValueChangedEvent } from "../../types";
|
||||
import "../ha-sortable";
|
||||
import "./ha-entity-picker";
|
||||
import type { HaEntityPickerEntityFilterFunc } from "../../data/entity";
|
||||
|
||||
@customElement("ha-entities-picker")
|
||||
class HaEntitiesPicker extends LitElement {
|
||||
@@ -118,7 +118,7 @@ class HaEntitiesPicker extends LitElement {
|
||||
? html`
|
||||
<ha-svg-icon
|
||||
class="entity-handle"
|
||||
.path=${mdiDrag}
|
||||
.path=${mdiDragHorizontalVariant}
|
||||
></ha-svg-icon>
|
||||
`
|
||||
: nothing}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import "@material/mwc-menu/mwc-menu-surface";
|
||||
import { mdiDrag, mdiPlus } from "@mdi/js";
|
||||
import { mdiDragHorizontalVariant, mdiPlus } from "@mdi/js";
|
||||
import type { ComboBoxLitRenderer } from "@vaadin/combo-box/lit";
|
||||
import type { IFuseOptions } from "fuse.js";
|
||||
import Fuse from "fuse.js";
|
||||
@@ -20,6 +20,7 @@ import "../chips/ha-chip-set";
|
||||
import "../chips/ha-input-chip";
|
||||
import "../ha-combo-box";
|
||||
import type { HaComboBox } from "../ha-combo-box";
|
||||
import "../ha-input-helper-text";
|
||||
import "../ha-sortable";
|
||||
|
||||
interface EntityNameOption {
|
||||
@@ -86,8 +87,8 @@ export class HaEntityNamePicker extends LitElement {
|
||||
|
||||
private _editIndex?: number;
|
||||
|
||||
private _validOptions = memoizeOne((entityId?: string) => {
|
||||
const options = new Set<string>();
|
||||
private _validTypes = memoizeOne((entityId?: string) => {
|
||||
const options = new Set<string>(["text"]);
|
||||
if (!entityId) {
|
||||
return options;
|
||||
}
|
||||
@@ -119,22 +120,22 @@ export class HaEntityNamePicker extends LitElement {
|
||||
return [];
|
||||
}
|
||||
|
||||
const options = this._validOptions(entityId);
|
||||
const types = this._validTypes(entityId);
|
||||
|
||||
const items = (
|
||||
["entity", "device", "area", "floor"] as const
|
||||
).map<EntityNameOption>((name) => {
|
||||
const stateObj = this.hass.states[entityId];
|
||||
const isValid = options.has(name);
|
||||
const isValid = types.has(name);
|
||||
const primary = this.hass.localize(
|
||||
`ui.components.entity.entity-name-picker.types.${name}`
|
||||
);
|
||||
const secondary =
|
||||
stateObj && isValid
|
||||
(stateObj && isValid
|
||||
? this.hass.formatEntityName(stateObj, { type: name })
|
||||
: this.hass.localize(
|
||||
`ui.components.entity.entity-name-picker.types.${name}_missing` as LocalizeKeys
|
||||
) || "-";
|
||||
)) || "-";
|
||||
|
||||
return {
|
||||
primary,
|
||||
@@ -169,9 +170,9 @@ export class HaEntityNamePicker extends LitElement {
|
||||
};
|
||||
|
||||
protected render() {
|
||||
const value = this._value;
|
||||
const value = this._items;
|
||||
const options = this._getOptions(this.entityId);
|
||||
const validOptions = this._validOptions(this.entityId);
|
||||
const validTypes = this._validTypes(this.entityId);
|
||||
|
||||
return html`
|
||||
${this.label ? html`<label>${this.label}</label>` : nothing}
|
||||
@@ -185,12 +186,11 @@ export class HaEntityNamePicker extends LitElement {
|
||||
>
|
||||
<ha-chip-set>
|
||||
${repeat(
|
||||
this._value,
|
||||
this._items,
|
||||
(item) => item,
|
||||
(item: EntityNameItem, idx) => {
|
||||
const label = this._formatItem(item);
|
||||
const isValid =
|
||||
item.type === "text" || validOptions.has(item.type);
|
||||
const isValid = validTypes.has(item.type);
|
||||
return html`
|
||||
<ha-input-chip
|
||||
data-idx=${idx}
|
||||
@@ -201,7 +201,10 @@ export class HaEntityNamePicker extends LitElement {
|
||||
.disabled=${this.disabled}
|
||||
class=${!isValid ? "invalid" : ""}
|
||||
>
|
||||
<ha-svg-icon slot="icon" .path=${mdiDrag}></ha-svg-icon>
|
||||
<ha-svg-icon
|
||||
slot="icon"
|
||||
.path=${mdiDragHorizontalVariant}
|
||||
></ha-svg-icon>
|
||||
<span>${label}</span>
|
||||
</ha-input-chip>
|
||||
`;
|
||||
@@ -235,9 +238,8 @@ export class HaEntityNamePicker extends LitElement {
|
||||
.hass=${this.hass}
|
||||
.value=${""}
|
||||
.autofocus=${this.autofocus}
|
||||
.disabled=${this.disabled || !this.entityId}
|
||||
.disabled=${this.disabled}
|
||||
.required=${this.required && !value.length}
|
||||
.helper=${this.helper}
|
||||
.items=${options}
|
||||
allow-custom-value
|
||||
item-id-path="value"
|
||||
@@ -251,9 +253,20 @@ export class HaEntityNamePicker extends LitElement {
|
||||
</ha-combo-box>
|
||||
</mwc-menu-surface>
|
||||
</div>
|
||||
${this._renderHelper()}
|
||||
`;
|
||||
}
|
||||
|
||||
private _renderHelper() {
|
||||
return this.helper
|
||||
? html`
|
||||
<ha-input-helper-text .disabled=${this.disabled}>
|
||||
${this.helper}
|
||||
</ha-input-helper-text>
|
||||
`
|
||||
: nothing;
|
||||
}
|
||||
|
||||
private _onClosed(ev) {
|
||||
ev.stopPropagation();
|
||||
this._opened = false;
|
||||
@@ -282,13 +295,16 @@ export class HaEntityNamePicker extends LitElement {
|
||||
this._opened = true;
|
||||
}
|
||||
|
||||
private get _value(): EntityNameItem[] {
|
||||
private get _items(): EntityNameItem[] {
|
||||
return this._toItems(this.value);
|
||||
}
|
||||
|
||||
private _toItems = memoizeOne((value?: typeof this.value) => {
|
||||
if (typeof value === "string") {
|
||||
return [{ type: "text", text: value } as const];
|
||||
if (value === "") {
|
||||
return [];
|
||||
}
|
||||
return [{ type: "text", text: value } satisfies EntityNameItem];
|
||||
}
|
||||
return value ? ensureArray(value) : [];
|
||||
});
|
||||
@@ -296,7 +312,7 @@ export class HaEntityNamePicker extends LitElement {
|
||||
private _toValue = memoizeOne(
|
||||
(items: EntityNameItem[]): typeof this.value => {
|
||||
if (items.length === 0) {
|
||||
return [];
|
||||
return "";
|
||||
}
|
||||
if (items.length === 1) {
|
||||
const item = items[0];
|
||||
@@ -312,19 +328,21 @@ export class HaEntityNamePicker extends LitElement {
|
||||
const options = this._comboBox.items || [];
|
||||
|
||||
const initialItem =
|
||||
this._editIndex != null ? this._value[this._editIndex] : undefined;
|
||||
this._editIndex != null ? this._items[this._editIndex] : undefined;
|
||||
|
||||
const initialValue = initialItem ? formatOptionValue(initialItem) : "";
|
||||
|
||||
const filteredItems = this._filterSelectedOptions(options, initialValue);
|
||||
|
||||
if (initialItem && initialItem.type === "text" && initialItem.text) {
|
||||
if (initialItem?.type === "text" && initialItem.text) {
|
||||
filteredItems.push(this._customNameOption(initialItem.text));
|
||||
}
|
||||
|
||||
this._comboBox.filteredItems = filteredItems;
|
||||
this._comboBox.setInputValue(initialValue);
|
||||
} else {
|
||||
this._opened = false;
|
||||
this._comboBox.setInputValue("");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,15 +350,16 @@ export class HaEntityNamePicker extends LitElement {
|
||||
options: EntityNameOption[],
|
||||
current?: string
|
||||
) => {
|
||||
const value = this._value;
|
||||
const items = this._items;
|
||||
|
||||
const types = value.map((item) => item.type) as string[];
|
||||
const excludedValues = new Set(
|
||||
items
|
||||
.filter((item) => UNIQUE_TYPES.has(item.type))
|
||||
.map((item) => formatOptionValue(item))
|
||||
);
|
||||
|
||||
const filteredOptions = options.filter(
|
||||
(option) =>
|
||||
!UNIQUE_TYPES.has(option.value) ||
|
||||
!types.includes(option.value) ||
|
||||
option.value === current
|
||||
(option) => !excludedValues.has(option.value) || option.value === current
|
||||
);
|
||||
return filteredOptions;
|
||||
};
|
||||
@@ -351,16 +370,14 @@ export class HaEntityNamePicker extends LitElement {
|
||||
const options = this._comboBox.items || [];
|
||||
|
||||
const currentItem =
|
||||
this._editIndex != null ? this._value[this._editIndex] : undefined;
|
||||
this._editIndex != null ? this._items[this._editIndex] : undefined;
|
||||
|
||||
const currentValue = currentItem ? formatOptionValue(currentItem) : "";
|
||||
|
||||
this._comboBox.filteredItems = this._filterSelectedOptions(
|
||||
options,
|
||||
currentValue
|
||||
);
|
||||
let filteredItems = this._filterSelectedOptions(options, currentValue);
|
||||
|
||||
if (!filter) {
|
||||
this._comboBox.filteredItems = filteredItems;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -372,9 +389,8 @@ export class HaEntityNamePicker extends LitElement {
|
||||
ignoreDiacritics: true,
|
||||
};
|
||||
|
||||
const fuse = new Fuse(this._comboBox.filteredItems, fuseOptions);
|
||||
const filteredItems = fuse.search(filter).map((result) => result.item);
|
||||
|
||||
const fuse = new Fuse(filteredItems, fuseOptions);
|
||||
filteredItems = fuse.search(filter).map((result) => result.item);
|
||||
filteredItems.push(this._customNameOption(input));
|
||||
this._comboBox.filteredItems = filteredItems;
|
||||
}
|
||||
@@ -382,7 +398,7 @@ export class HaEntityNamePicker extends LitElement {
|
||||
private async _moveItem(ev: CustomEvent) {
|
||||
ev.stopPropagation();
|
||||
const { oldIndex, newIndex } = ev.detail;
|
||||
const value = this._value;
|
||||
const value = this._items;
|
||||
const newValue = value.concat();
|
||||
const element = newValue.splice(oldIndex, 1)[0];
|
||||
newValue.splice(newIndex, 0, element);
|
||||
@@ -393,7 +409,7 @@ export class HaEntityNamePicker extends LitElement {
|
||||
|
||||
private async _removeItem(ev) {
|
||||
ev.stopPropagation();
|
||||
const value = [...this._value];
|
||||
const value = [...this._items];
|
||||
const idx = parseInt(ev.target.dataset.idx, 10);
|
||||
value.splice(idx, 1);
|
||||
this._setValue(value);
|
||||
@@ -411,7 +427,7 @@ export class HaEntityNamePicker extends LitElement {
|
||||
|
||||
const item: EntityNameItem = parseOptionValue(value);
|
||||
|
||||
const newValue = [...this._value];
|
||||
const newValue = [...this._items];
|
||||
|
||||
if (this._editIndex != null) {
|
||||
newValue[this._editIndex] = item;
|
||||
@@ -505,6 +521,11 @@ export class HaEntityNamePicker extends LitElement {
|
||||
.sortable-drag {
|
||||
cursor: grabbing;
|
||||
}
|
||||
|
||||
ha-input-helper-text {
|
||||
display: block;
|
||||
margin: var(--ha-space-2) 0 0;
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { mdiDrag } from "@mdi/js";
|
||||
import { mdiDragHorizontalVariant } from "@mdi/js";
|
||||
import type { HassEntity } from "home-assistant-js-websocket";
|
||||
import type { PropertyValues } from "lit";
|
||||
import { LitElement, css, html, nothing } from "lit";
|
||||
@@ -195,7 +195,10 @@ class HaEntityStatePicker extends LitElement {
|
||||
.label=${label}
|
||||
selected
|
||||
>
|
||||
<ha-svg-icon slot="icon" .path=${mdiDrag}></ha-svg-icon>
|
||||
<ha-svg-icon
|
||||
slot="icon"
|
||||
.path=${mdiDragHorizontalVariant}
|
||||
></ha-svg-icon>
|
||||
${label}
|
||||
</ha-input-chip>
|
||||
`;
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { mdiDrag, mdiTextureBox } from "@mdi/js";
|
||||
import { mdiDragHorizontalVariant, mdiTextureBox } from "@mdi/js";
|
||||
import type { TemplateResult } from "lit";
|
||||
import { LitElement, css, html, nothing } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
@@ -105,7 +105,7 @@ export class HaAreasFloorsDisplayEditor extends LitElement {
|
||||
<ha-svg-icon
|
||||
class="handle"
|
||||
slot="icons"
|
||||
.path=${mdiDrag}
|
||||
.path=${mdiDragHorizontalVariant}
|
||||
></ha-svg-icon>
|
||||
`}
|
||||
<ha-items-display-editor
|
||||
|
@@ -49,12 +49,16 @@ export class HaDialogHeader extends LitElement {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
padding: 4px;
|
||||
padding: 0 var(--ha-space-1);
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.header-content {
|
||||
flex: 1;
|
||||
padding: 10px 4px;
|
||||
padding: 10px var(--ha-space-1);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
min-height: var(--ha-space-12);
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
@@ -63,7 +67,7 @@ export class HaDialogHeader extends LitElement {
|
||||
.header-title {
|
||||
height: var(
|
||||
--ha-dialog-header-title-height,
|
||||
calc(var(--ha-font-size-xl) + 4px)
|
||||
calc(var(--ha-font-size-xl) + var(--ha-space-1))
|
||||
);
|
||||
font-size: var(--ha-font-size-xl);
|
||||
line-height: var(--ha-line-height-condensed);
|
||||
@@ -76,19 +80,19 @@ export class HaDialogHeader extends LitElement {
|
||||
}
|
||||
@media all and (min-width: 450px) and (min-height: 500px) {
|
||||
.header-bar {
|
||||
padding: 16px;
|
||||
padding: 0 var(--ha-space-2);
|
||||
}
|
||||
}
|
||||
.header-navigation-icon {
|
||||
flex: none;
|
||||
min-width: 8px;
|
||||
min-width: var(--ha-space-2);
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
}
|
||||
.header-action-items {
|
||||
flex: none;
|
||||
min-width: 8px;
|
||||
min-width: var(--ha-space-2);
|
||||
height: 100%;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
|
@@ -179,7 +179,7 @@ export class HaGenericPicker extends LitElement {
|
||||
}
|
||||
ha-input-helper-text {
|
||||
display: block;
|
||||
margin: 8px 0 0;
|
||||
margin: var(--ha-space-2) 0 0;
|
||||
}
|
||||
`,
|
||||
];
|
||||
|
@@ -1,5 +1,5 @@
|
||||
import { ResizeController } from "@lit-labs/observers/resize-controller";
|
||||
import { mdiDrag, mdiEye, mdiEyeOff } from "@mdi/js";
|
||||
import { mdiDragHorizontalVariant, mdiEye, mdiEyeOff } from "@mdi/js";
|
||||
import type { TemplateResult } from "lit";
|
||||
import { LitElement, css, html, nothing } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
@@ -178,7 +178,7 @@ export class HaItemDisplayEditor extends LitElement {
|
||||
? this._dragHandleKeydown
|
||||
: undefined}
|
||||
class="handle"
|
||||
.path=${mdiDrag}
|
||||
.path=${mdiDragHorizontalVariant}
|
||||
slot="end"
|
||||
></ha-svg-icon>
|
||||
`
|
||||
|
@@ -36,6 +36,8 @@ export class HaDeviceSelector extends LitElement {
|
||||
|
||||
@property() public helper?: string;
|
||||
|
||||
@property() public placeholder?: string;
|
||||
|
||||
@property({ type: Boolean }) public disabled = false;
|
||||
|
||||
@property({ type: Boolean }) public required = true;
|
||||
@@ -102,6 +104,7 @@ export class HaDeviceSelector extends LitElement {
|
||||
.entityFilter=${this.selector.device?.entity
|
||||
? this._filterEntities
|
||||
: undefined}
|
||||
.placeholder=${this.placeholder}
|
||||
.disabled=${this.disabled}
|
||||
.required=${this.required}
|
||||
allow-custom-entity
|
||||
|
@@ -29,6 +29,8 @@ export class HaEntitySelector extends LitElement {
|
||||
|
||||
@property() public helper?: string;
|
||||
|
||||
@property() public placeholder?: any;
|
||||
|
||||
@property({ type: Boolean }) public disabled = false;
|
||||
|
||||
@property({ type: Boolean }) public required = true;
|
||||
@@ -69,6 +71,7 @@ export class HaEntitySelector extends LitElement {
|
||||
.excludeEntities=${this.selector.entity?.exclude_entities}
|
||||
.entityFilter=${this._filterEntities}
|
||||
.createDomains=${this._createDomains}
|
||||
.placeholder=${this.placeholder}
|
||||
.disabled=${this.disabled}
|
||||
.required=${this.required}
|
||||
allow-custom-entity
|
||||
@@ -86,6 +89,7 @@ export class HaEntitySelector extends LitElement {
|
||||
.reorder=${this.selector.entity.reorder ?? false}
|
||||
.entityFilter=${this._filterEntities}
|
||||
.createDomains=${this._createDomains}
|
||||
.placeholder=${this.placeholder}
|
||||
.disabled=${this.disabled}
|
||||
.required=${this.required}
|
||||
></ha-entities-picker>
|
||||
|
@@ -1,152 +0,0 @@
|
||||
import { css, html, LitElement } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import { fireEvent } from "../../common/dom/fire_event";
|
||||
import type { ImageSelector } from "../../data/selector";
|
||||
import type { HomeAssistant } from "../../types";
|
||||
import "../ha-icon-button";
|
||||
import "../ha-textarea";
|
||||
import "../ha-textfield";
|
||||
import "../ha-picture-upload";
|
||||
import "../ha-radio";
|
||||
import "../ha-formfield";
|
||||
import type { HaPictureUpload } from "../ha-picture-upload";
|
||||
import { URL_PREFIX } from "../../data/image_upload";
|
||||
|
||||
@customElement("ha-selector-image")
|
||||
export class HaImageSelector extends LitElement {
|
||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||
|
||||
@property() public value?: any;
|
||||
|
||||
@property() public name?: string;
|
||||
|
||||
@property() public label?: string;
|
||||
|
||||
@property() public placeholder?: string;
|
||||
|
||||
@property() public helper?: string;
|
||||
|
||||
@property({ attribute: false }) public selector!: ImageSelector;
|
||||
|
||||
@property({ type: Boolean }) public disabled = false;
|
||||
|
||||
@property({ type: Boolean }) public required = true;
|
||||
|
||||
@state() private showUpload = false;
|
||||
|
||||
protected firstUpdated(changedProps): void {
|
||||
super.firstUpdated(changedProps);
|
||||
|
||||
if (!this.value || this.value.startsWith(URL_PREFIX)) {
|
||||
this.showUpload = true;
|
||||
}
|
||||
}
|
||||
|
||||
protected render() {
|
||||
return html`
|
||||
<div>
|
||||
<label>
|
||||
${this.hass.localize(
|
||||
"ui.components.selectors.image.select_image_with_label",
|
||||
{
|
||||
label:
|
||||
this.label ||
|
||||
this.hass.localize("ui.components.selectors.image.image"),
|
||||
}
|
||||
)}
|
||||
<ha-formfield
|
||||
.label=${this.hass.localize("ui.components.selectors.image.upload")}
|
||||
>
|
||||
<ha-radio
|
||||
name="mode"
|
||||
value="upload"
|
||||
.checked=${this.showUpload}
|
||||
@change=${this._radioGroupPicked}
|
||||
></ha-radio>
|
||||
</ha-formfield>
|
||||
<ha-formfield
|
||||
.label=${this.hass.localize("ui.components.selectors.image.url")}
|
||||
>
|
||||
<ha-radio
|
||||
name="mode"
|
||||
value="url"
|
||||
.checked=${!this.showUpload}
|
||||
@change=${this._radioGroupPicked}
|
||||
></ha-radio>
|
||||
</ha-formfield>
|
||||
</label>
|
||||
${!this.showUpload
|
||||
? html`
|
||||
<ha-textfield
|
||||
.name=${this.name}
|
||||
.value=${this.value || ""}
|
||||
.placeholder=${this.placeholder || ""}
|
||||
.helper=${this.helper}
|
||||
helperPersistent
|
||||
.disabled=${this.disabled}
|
||||
@input=${this._handleChange}
|
||||
.label=${this.label || ""}
|
||||
.required=${this.required}
|
||||
></ha-textfield>
|
||||
`
|
||||
: html`
|
||||
<ha-picture-upload
|
||||
.hass=${this.hass}
|
||||
.value=${this.value?.startsWith(URL_PREFIX) ? this.value : null}
|
||||
.original=${this.selector.image?.original}
|
||||
.cropOptions=${this.selector.image?.crop}
|
||||
select-media
|
||||
@change=${this._pictureChanged}
|
||||
></ha-picture-upload>
|
||||
`}
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
private _radioGroupPicked(ev): void {
|
||||
this.showUpload = ev.target.value === "upload";
|
||||
}
|
||||
|
||||
private _pictureChanged(ev) {
|
||||
const value = (ev.target as HaPictureUpload).value;
|
||||
|
||||
fireEvent(this, "value-changed", { value: value ?? undefined });
|
||||
}
|
||||
|
||||
private _handleChange(ev) {
|
||||
let value = ev.target.value;
|
||||
if (this.value === value) {
|
||||
return;
|
||||
}
|
||||
if (value === "" && !this.required) {
|
||||
value = undefined;
|
||||
}
|
||||
|
||||
fireEvent(this, "value-changed", { value });
|
||||
}
|
||||
|
||||
static styles = css`
|
||||
:host {
|
||||
display: block;
|
||||
position: relative;
|
||||
}
|
||||
div {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
label {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
ha-textarea,
|
||||
ha-textfield {
|
||||
width: 100%;
|
||||
}
|
||||
`;
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"ha-selector-image": HaImageSelector;
|
||||
}
|
||||
}
|
@@ -1,4 +1,9 @@
|
||||
import { mdiClose, mdiDelete, mdiDrag, mdiPencil } from "@mdi/js";
|
||||
import {
|
||||
mdiClose,
|
||||
mdiDelete,
|
||||
mdiDragHorizontalVariant,
|
||||
mdiPencil,
|
||||
} from "@mdi/js";
|
||||
import { css, html, LitElement, nothing, type PropertyValues } from "lit";
|
||||
import { customElement, property, query } from "lit/decorators";
|
||||
import memoizeOne from "memoize-one";
|
||||
@@ -92,7 +97,7 @@ export class HaObjectSelector extends LitElement {
|
||||
? html`
|
||||
<ha-svg-icon
|
||||
class="handle"
|
||||
.path=${mdiDrag}
|
||||
.path=${mdiDragHorizontalVariant}
|
||||
slot="start"
|
||||
></ha-svg-icon>
|
||||
`
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { mdiDrag } from "@mdi/js";
|
||||
import { mdiDragHorizontalVariant } from "@mdi/js";
|
||||
import { LitElement, css, html, nothing } from "lit";
|
||||
import { customElement, property, query } from "lit/decorators";
|
||||
import { repeat } from "lit/directives/repeat";
|
||||
@@ -197,7 +197,7 @@ export class HaSelectSelector extends LitElement {
|
||||
? html`
|
||||
<ha-svg-icon
|
||||
slot="icon"
|
||||
.path=${mdiDrag}
|
||||
.path=${mdiDragHorizontalVariant}
|
||||
></ha-svg-icon>
|
||||
`
|
||||
: nothing}
|
||||
|
@@ -34,7 +34,6 @@ const LOAD_ELEMENTS = {
|
||||
file: () => import("./ha-selector-file"),
|
||||
floor: () => import("./ha-selector-floor"),
|
||||
label: () => import("./ha-selector-label"),
|
||||
image: () => import("./ha-selector-image"),
|
||||
background: () => import("./ha-selector-background"),
|
||||
language: () => import("./ha-selector-language"),
|
||||
navigation: () => import("./ha-selector-navigation"),
|
||||
|
@@ -876,13 +876,20 @@ class HaSidebar extends SubscribeMixin(LitElement) {
|
||||
}
|
||||
|
||||
ha-md-list-item.user {
|
||||
--md-list-item-leading-icon-size: 40px;
|
||||
--md-list-item-leading-space: 4px;
|
||||
--md-list-item-leading-space: 0;
|
||||
--md-list-item-trailing-space: 0;
|
||||
}
|
||||
|
||||
ha-user-badge {
|
||||
flex-shrink: 0;
|
||||
margin-right: -8px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
ha-user-badge::part(picture) {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.spacer {
|
||||
|
@@ -59,12 +59,33 @@ export class HaSlider extends Slider {
|
||||
background-color: var(--ha-slider-thumb-color, var(--primary-color));
|
||||
}
|
||||
|
||||
#thumb:after {
|
||||
content: "";
|
||||
border-radius: 50%;
|
||||
position: absolute;
|
||||
width: calc(var(--thumb-width) * 2 + 8px);
|
||||
height: calc(var(--thumb-height) * 2 + 8px);
|
||||
left: calc(-50% - 4px);
|
||||
top: calc(-50% - 4px);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#slider:focus-visible:not(.disabled) #thumb,
|
||||
#slider:focus-visible:not(.disabled) #thumb-min,
|
||||
#slider:focus-visible:not(.disabled) #thumb-max {
|
||||
outline: var(--wa-focus-ring);
|
||||
}
|
||||
|
||||
#track:after {
|
||||
content: "";
|
||||
position: absolute;
|
||||
top: calc(-50% - 4px);
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: calc(var(--track-size) * 2 + 8px);
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#indicator {
|
||||
background-color: var(
|
||||
--ha-slider-indicator-color,
|
||||
|
@@ -36,8 +36,6 @@ export class HaTargetPicker extends SubscribeMixin(LitElement) {
|
||||
|
||||
@property({ attribute: false }) public value?: HassServiceTarget;
|
||||
|
||||
@property() public label?: string;
|
||||
|
||||
@property() public helper?: string;
|
||||
|
||||
@property({ type: Boolean, reflect: true }) public compact = false;
|
||||
@@ -101,7 +99,7 @@ export class HaTargetPicker extends SubscribeMixin(LitElement) {
|
||||
(floor_id) => html`
|
||||
<ha-target-picker-value-chip
|
||||
.hass=${this.hass}
|
||||
.type=${"floor"}
|
||||
type="floor"
|
||||
.itemId=${floor_id}
|
||||
@remove-target-item=${this._handleRemove}
|
||||
@expand-target-item=${this._handleExpand}
|
||||
@@ -114,7 +112,7 @@ export class HaTargetPicker extends SubscribeMixin(LitElement) {
|
||||
(area_id) => html`
|
||||
<ha-target-picker-value-chip
|
||||
.hass=${this.hass}
|
||||
.type=${"area"}
|
||||
type="area"
|
||||
.itemId=${area_id}
|
||||
@remove-target-item=${this._handleRemove}
|
||||
@expand-target-item=${this._handleExpand}
|
||||
@@ -127,7 +125,7 @@ export class HaTargetPicker extends SubscribeMixin(LitElement) {
|
||||
(device_id) => html`
|
||||
<ha-target-picker-value-chip
|
||||
.hass=${this.hass}
|
||||
.type=${"device"}
|
||||
type="device"
|
||||
.itemId=${device_id}
|
||||
@remove-target-item=${this._handleRemove}
|
||||
@expand-target-item=${this._handleExpand}
|
||||
@@ -140,7 +138,7 @@ export class HaTargetPicker extends SubscribeMixin(LitElement) {
|
||||
(entity_id) => html`
|
||||
<ha-target-picker-value-chip
|
||||
.hass=${this.hass}
|
||||
.type=${"entity"}
|
||||
type="entity"
|
||||
.itemId=${entity_id}
|
||||
@remove-target-item=${this._handleRemove}
|
||||
@expand-target-item=${this._handleExpand}
|
||||
@@ -153,7 +151,7 @@ export class HaTargetPicker extends SubscribeMixin(LitElement) {
|
||||
(label_id) => html`
|
||||
<ha-target-picker-value-chip
|
||||
.hass=${this.hass}
|
||||
.type=${"label"}
|
||||
type="label"
|
||||
.itemId=${label_id}
|
||||
@remove-target-item=${this._handleRemove}
|
||||
@expand-target-item=${this._handleExpand}
|
||||
@@ -173,7 +171,6 @@ export class HaTargetPicker extends SubscribeMixin(LitElement) {
|
||||
type="entity"
|
||||
.hass=${this.hass}
|
||||
.items=${{ entity: ensureArray(this.value?.entity_id) }}
|
||||
.collapsed=${this.compact}
|
||||
.deviceFilter=${this.deviceFilter}
|
||||
.entityFilter=${this.entityFilter}
|
||||
.includeDomains=${this.includeDomains}
|
||||
@@ -189,7 +186,6 @@ export class HaTargetPicker extends SubscribeMixin(LitElement) {
|
||||
type="device"
|
||||
.hass=${this.hass}
|
||||
.items=${{ device: ensureArray(this.value?.device_id) }}
|
||||
.collapsed=${this.compact}
|
||||
.deviceFilter=${this.deviceFilter}
|
||||
.entityFilter=${this.entityFilter}
|
||||
.includeDomains=${this.includeDomains}
|
||||
@@ -208,7 +204,6 @@ export class HaTargetPicker extends SubscribeMixin(LitElement) {
|
||||
floor: ensureArray(this.value?.floor_id),
|
||||
area: ensureArray(this.value?.area_id),
|
||||
}}
|
||||
.collapsed=${this.compact}
|
||||
.deviceFilter=${this.deviceFilter}
|
||||
.entityFilter=${this.entityFilter}
|
||||
.includeDomains=${this.includeDomains}
|
||||
@@ -224,7 +219,6 @@ export class HaTargetPicker extends SubscribeMixin(LitElement) {
|
||||
type="label"
|
||||
.hass=${this.hass}
|
||||
.items=${{ label: ensureArray(this.value?.label_id) }}
|
||||
.collapsed=${this.compact}
|
||||
.deviceFilter=${this.deviceFilter}
|
||||
.entityFilter=${this.entityFilter}
|
||||
.includeDomains=${this.includeDomains}
|
||||
@@ -277,6 +271,12 @@ export class HaTargetPicker extends SubscribeMixin(LitElement) {
|
||||
auto-size-padding="16"
|
||||
@wa-after-show=${this._showSelector}
|
||||
@wa-after-hide=${this._hidePicker}
|
||||
trap-focus
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label=${this.hass.localize(
|
||||
"ui.components.target-picker.add_target"
|
||||
)}
|
||||
>
|
||||
${this._renderTargetSelector()}
|
||||
</wa-popover>
|
||||
@@ -287,6 +287,11 @@ export class HaTargetPicker extends SubscribeMixin(LitElement) {
|
||||
.open=${this._pickerWrapperOpen}
|
||||
@wa-after-show=${this._showSelector}
|
||||
@closed=${this._hidePicker}
|
||||
role="dialog"
|
||||
aria-modal="true"
|
||||
aria-label=${this.hass.localize(
|
||||
"ui.components.target-picker.add_target"
|
||||
)}
|
||||
>
|
||||
${this._renderTargetSelector(true)}
|
||||
</ha-bottom-sheet>`
|
||||
@@ -394,6 +399,12 @@ export class HaTargetPicker extends SubscribeMixin(LitElement) {
|
||||
}
|
||||
: { [typeId]: id },
|
||||
});
|
||||
|
||||
this.shadowRoot
|
||||
?.querySelector(
|
||||
`ha-target-picker-item-group[type='${this._newTarget?.type}']`
|
||||
)
|
||||
?.removeAttribute("collapsed");
|
||||
}
|
||||
|
||||
private _handleTargetPicked = async (
|
||||
|
@@ -2,26 +2,13 @@ import { TopAppBarFixedBase } from "@material/mwc-top-app-bar-fixed/mwc-top-app-
|
||||
import { styles } from "@material/mwc-top-app-bar/mwc-top-app-bar.css";
|
||||
import { css } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import { ViewTransitionMixin } from "../mixins/view-transition-mixin";
|
||||
import { haStyleViewTransitions } from "../resources/styles";
|
||||
|
||||
@customElement("ha-top-app-bar-fixed")
|
||||
export class HaTopAppBarFixed extends ViewTransitionMixin(TopAppBarFixedBase) {
|
||||
export class HaTopAppBarFixed extends TopAppBarFixedBase {
|
||||
@property({ type: Boolean, reflect: true }) public narrow = false;
|
||||
|
||||
@property({ type: Boolean, reflect: true, attribute: "content-loading" })
|
||||
public contentLoading = true;
|
||||
|
||||
protected onLoadTransition(): void {
|
||||
// Trigger the transition when content is slotted
|
||||
this.startViewTransition(() => {
|
||||
this.contentLoading = false;
|
||||
});
|
||||
}
|
||||
|
||||
static override styles = [
|
||||
styles,
|
||||
haStyleViewTransitions,
|
||||
css`
|
||||
header {
|
||||
padding-top: var(--safe-area-inset-top);
|
||||
@@ -36,10 +23,6 @@ export class HaTopAppBarFixed extends ViewTransitionMixin(TopAppBarFixedBase) {
|
||||
);
|
||||
padding-bottom: var(--safe-area-inset-bottom);
|
||||
padding-right: var(--safe-area-inset-right);
|
||||
view-transition-name: layout-fade-in;
|
||||
}
|
||||
:host([content-loading]) .mdc-top-app-bar--fixed-adjust {
|
||||
opacity: 0;
|
||||
}
|
||||
:host([narrow]) .mdc-top-app-bar--fixed-adjust {
|
||||
padding-left: var(--safe-area-inset-left);
|
||||
|
@@ -7,18 +7,17 @@ import type { MDCTopAppBarAdapter } from "@material/top-app-bar/adapter";
|
||||
import { strings } from "@material/top-app-bar/constants";
|
||||
import MDCFixedTopAppBarFoundation from "@material/top-app-bar/fixed/foundation";
|
||||
import { html, css, nothing } from "lit";
|
||||
import { property, query, customElement, state } from "lit/decorators";
|
||||
import { property, query, customElement } from "lit/decorators";
|
||||
import { classMap } from "lit/directives/class-map";
|
||||
import { styles } from "@material/mwc-top-app-bar/mwc-top-app-bar.css";
|
||||
import { ViewTransitionMixin } from "../mixins/view-transition-mixin";
|
||||
import { haStyleScrollbar, haStyleViewTransitions } from "../resources/styles";
|
||||
import { haStyleScrollbar } from "../resources/styles";
|
||||
|
||||
export const passiveEventOptionsIfSupported = supportsPassiveEventListener
|
||||
? { passive: true }
|
||||
: undefined;
|
||||
|
||||
@customElement("ha-two-pane-top-app-bar-fixed")
|
||||
export class TopAppBarBaseBase extends ViewTransitionMixin(BaseElement) {
|
||||
export class TopAppBarBaseBase extends BaseElement {
|
||||
protected override mdcFoundation!: MDCFixedTopAppBarFoundation;
|
||||
|
||||
protected override mdcFoundationClass = MDCFixedTopAppBarFoundation;
|
||||
@@ -49,15 +48,6 @@ export class TopAppBarBaseBase extends ViewTransitionMixin(BaseElement) {
|
||||
|
||||
@query(".pane .ha-scrollbar") private _paneElement?: HTMLElement;
|
||||
|
||||
@state() private _loaded = false;
|
||||
|
||||
protected onLoadTransition(): void {
|
||||
// Trigger the transition when content is slotted
|
||||
this.startViewTransition(() => {
|
||||
this._loaded = true;
|
||||
});
|
||||
}
|
||||
|
||||
@property({ attribute: false, type: Object })
|
||||
get scrollTarget() {
|
||||
return this._scrollTarget || window;
|
||||
@@ -154,12 +144,7 @@ export class TopAppBarBaseBase extends ViewTransitionMixin(BaseElement) {
|
||||
: nothing}
|
||||
<div class="main">
|
||||
${this.pane ? html`<div class="shadow-container"></div>` : nothing}
|
||||
<div
|
||||
class=${classMap({
|
||||
content: true,
|
||||
loading: !this._loaded,
|
||||
})}
|
||||
>
|
||||
<div class="content">
|
||||
<slot></slot>
|
||||
</div>
|
||||
</div>
|
||||
@@ -260,7 +245,6 @@ export class TopAppBarBaseBase extends ViewTransitionMixin(BaseElement) {
|
||||
static override styles = [
|
||||
styles,
|
||||
haStyleScrollbar,
|
||||
haStyleViewTransitions,
|
||||
css`
|
||||
header {
|
||||
padding-top: var(--safe-area-inset-top);
|
||||
@@ -357,10 +341,6 @@ export class TopAppBarBaseBase extends ViewTransitionMixin(BaseElement) {
|
||||
.mdc-top-app-bar--pane .content {
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
view-transition-name: layout-fade-in;
|
||||
}
|
||||
.content.loading {
|
||||
opacity: 0;
|
||||
}
|
||||
.mdc-top-app-bar__title {
|
||||
font-size: var(--ha-font-size-xl);
|
||||
|
@@ -247,10 +247,7 @@ export class HaWaDialog extends LitElement {
|
||||
.header-title {
|
||||
margin: 0;
|
||||
margin-bottom: 0;
|
||||
color: var(
|
||||
--ha-dialog-header-title-color,
|
||||
var(--ha-color-on-surface-default, var(--primary-text-color))
|
||||
);
|
||||
color: var(--ha-dialog-header-title-color, var(--primary-text-color));
|
||||
font-size: var(
|
||||
--ha-dialog-header-title-font-size,
|
||||
var(--ha-font-size-2xl)
|
||||
|
@@ -18,7 +18,7 @@ export class HaTargetPickerItemGroup extends LitElement {
|
||||
Record<TargetType, string[]>
|
||||
>;
|
||||
|
||||
@property({ type: Boolean }) public collapsed = false;
|
||||
@property({ type: Boolean, reflect: true }) public collapsed = false;
|
||||
|
||||
@property({ attribute: false })
|
||||
public deviceFilter?: HaDevicePickerDeviceFilterFunc;
|
||||
@@ -50,7 +50,11 @@ export class HaTargetPickerItemGroup extends LitElement {
|
||||
}
|
||||
});
|
||||
|
||||
return html`<ha-expansion-panel .expanded=${!this.collapsed} left-chevron>
|
||||
return html`<ha-expansion-panel
|
||||
.expanded=${!this.collapsed}
|
||||
left-chevron
|
||||
@expanded-changed=${this._expandedChanged}
|
||||
>
|
||||
<div slot="header" class="heading">
|
||||
${this.hass.localize(
|
||||
`ui.components.target-picker.selected.${this.type}`,
|
||||
@@ -78,6 +82,10 @@ export class HaTargetPickerItemGroup extends LitElement {
|
||||
</ha-expansion-panel>`;
|
||||
}
|
||||
|
||||
private _expandedChanged(ev: CustomEvent) {
|
||||
this.collapsed = !ev.detail.expanded;
|
||||
}
|
||||
|
||||
static styles = css`
|
||||
:host {
|
||||
display: block;
|
||||
|
@@ -130,7 +130,7 @@ export class HaTargetPickerItemRow extends LitElement {
|
||||
|
||||
return html`
|
||||
<ha-md-list-item type="text">
|
||||
<div slot="start">
|
||||
<div class="icon" slot="start">
|
||||
${this.subEntry
|
||||
? html`
|
||||
<div class="horizontal-line-wrapper">
|
||||
@@ -172,7 +172,9 @@ export class HaTargetPickerItemRow extends LitElement {
|
||||
((entries && (showEntities || showDevices)) || this._domainName)
|
||||
? html`
|
||||
<div slot="end" class="summary">
|
||||
${showEntities && !this.expand
|
||||
${showEntities &&
|
||||
!this.expand &&
|
||||
entries?.referenced_entities.length
|
||||
? html`<button class="main link" @click=${this._openDetails}>
|
||||
${this.hass.localize(
|
||||
"ui.components.target-picker.entities_count",
|
||||
@@ -455,6 +457,9 @@ export class HaTargetPickerItemRow extends LitElement {
|
||||
}
|
||||
if (
|
||||
(this.type === "area" && entity.area_id === this.itemId) ||
|
||||
(this.type === "floor" &&
|
||||
entity.area_id &&
|
||||
entries.referenced_areas.includes(entity.area_id)) ||
|
||||
(this.type === "label" && entity.labels.includes(this.itemId)) ||
|
||||
entries.referenced_devices.includes(entity.device_id || "")
|
||||
) {
|
||||
@@ -606,6 +611,11 @@ export class HaTargetPickerItemRow extends LitElement {
|
||||
state-badge {
|
||||
color: var(--ha-color-on-neutral-quiet);
|
||||
}
|
||||
|
||||
.icon {
|
||||
display: flex;
|
||||
}
|
||||
|
||||
img {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
@@ -629,9 +639,6 @@ export class HaTargetPickerItemRow extends LitElement {
|
||||
font-size: var(--ha-font-size-s);
|
||||
color: var(--secondary-text-color);
|
||||
}
|
||||
.domain {
|
||||
font-family: var(--ha-font-family-code);
|
||||
}
|
||||
|
||||
.entries-tree {
|
||||
display: flex;
|
||||
|
@@ -520,6 +520,7 @@ export class HaTargetPickerSelector extends LitElement {
|
||||
id=${`list-item-${index}`}
|
||||
tabindex="-1"
|
||||
.type=${type === "empty" ? "text" : "button"}
|
||||
class=${type === "empty" ? "empty" : ""}
|
||||
@click=${this._handlePickTarget}
|
||||
.targetType=${type}
|
||||
.targetId=${type !== "empty" ? item.id : undefined}
|
||||
@@ -574,9 +575,7 @@ export class HaTargetPickerSelector extends LitElement {
|
||||
})}
|
||||
/>
|
||||
`
|
||||
: type === "area" &&
|
||||
(item as FloorComboBoxItem).type === "floor" &&
|
||||
(item as FloorComboBoxItem).floor
|
||||
: type === "floor"
|
||||
? html`<ha-floor-icon
|
||||
slot="start"
|
||||
.floor=${(item as FloorComboBoxItem).floor!}
|
||||
@@ -836,7 +835,7 @@ export class HaTargetPickerSelector extends LitElement {
|
||||
id: EMPTY_SEARCH,
|
||||
primary: this.hass.localize(
|
||||
"ui.components.target-picker.no_target_found",
|
||||
{ term: html`<span class="search-term">"${searchTerm}"</span>` }
|
||||
{ term: html`<div><b>‘${searchTerm}’</b></div>` }
|
||||
),
|
||||
});
|
||||
} else if (items.length === 0) {
|
||||
@@ -1020,10 +1019,14 @@ export class HaTargetPickerSelector extends LitElement {
|
||||
padding: var(--ha-space-1) var(--ha-space-2);
|
||||
font-weight: var(--ha-font-weight-bold);
|
||||
color: var(--secondary-text-color);
|
||||
min-height: var(--ha-space-6);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.title {
|
||||
width: 100%;
|
||||
min-height: var(--ha-space-8);
|
||||
}
|
||||
|
||||
:host([mode="dialog"]) .title {
|
||||
@@ -1055,7 +1058,6 @@ export class HaTargetPickerSelector extends LitElement {
|
||||
|
||||
.filter-header {
|
||||
opacity: 0;
|
||||
transition: opacity 300ms ease-in;
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
width: calc(100% - var(--ha-space-8));
|
||||
@@ -1083,9 +1085,8 @@ export class HaTargetPickerSelector extends LitElement {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.search-term {
|
||||
color: var(--primary-color);
|
||||
font-weight: var(--ha-font-weight-medium);
|
||||
.empty {
|
||||
text-align: center;
|
||||
}
|
||||
`,
|
||||
];
|
||||
|
@@ -54,6 +54,7 @@ class UserBadge extends LitElement {
|
||||
backgroundImage: `url(${this.hass.hassUrl(picture)})`,
|
||||
})}
|
||||
class="picture"
|
||||
part="picture"
|
||||
></div>`;
|
||||
}
|
||||
const initials = computeUserInitials(this.user.name);
|
||||
|
@@ -1,7 +1,6 @@
|
||||
import { computeAreaName } from "../common/entity/compute_area_name";
|
||||
import { computeDomain } from "../common/entity/compute_domain";
|
||||
import { computeFloorName } from "../common/entity/compute_floor_name";
|
||||
import { stringCompare } from "../common/string/compare";
|
||||
import type { HaDevicePickerDeviceFilterFunc } from "../components/device/ha-device-picker";
|
||||
import type { PickerComboBoxItem } from "../components/ha-picker-combo-box";
|
||||
import type { HomeAssistant } from "../types";
|
||||
@@ -13,7 +12,11 @@ import {
|
||||
} from "./device_registry";
|
||||
import type { HaEntityPickerEntityFilterFunc } from "./entity";
|
||||
import type { EntityRegistryDisplayEntry } from "./entity_registry";
|
||||
import { getFloorAreaLookup, type FloorRegistryEntry } from "./floor_registry";
|
||||
import {
|
||||
floorCompare,
|
||||
getFloorAreaLookup,
|
||||
type FloorRegistryEntry,
|
||||
} from "./floor_registry";
|
||||
|
||||
export interface FloorComboBoxItem extends PickerComboBoxItem {
|
||||
type: "floor" | "area";
|
||||
@@ -184,6 +187,8 @@ export const getAreasAndFloors = (
|
||||
(area) => !area.floor_id || !floorAreaLookup[area.floor_id]
|
||||
);
|
||||
|
||||
const compare = floorCompare(haFloors);
|
||||
|
||||
// @ts-ignore
|
||||
const floorAreaEntries: [
|
||||
FloorRegistryEntry | undefined,
|
||||
@@ -193,12 +198,7 @@ export const getAreasAndFloors = (
|
||||
const floor = floors.find((fl) => fl.floor_id === floorId)!;
|
||||
return [floor, floorAreas] as const;
|
||||
})
|
||||
.sort(([floorA], [floorB]) => {
|
||||
if (floorA.level !== floorB.level) {
|
||||
return (floorA.level ?? 0) - (floorB.level ?? 0);
|
||||
}
|
||||
return stringCompare(floorA.name, floorB.name);
|
||||
});
|
||||
.sort(([floorA], [floorB]) => compare(floorA.floor_id, floorB.floor_id));
|
||||
|
||||
const items: FloorComboBoxItem[] = [];
|
||||
|
||||
@@ -218,6 +218,7 @@ export const getAreasAndFloors = (
|
||||
type: "floor",
|
||||
primary: floorName,
|
||||
floor: floor,
|
||||
icon: floor.icon || undefined,
|
||||
search_labels: [
|
||||
floor.floor_id,
|
||||
floorName,
|
||||
|
@@ -68,13 +68,18 @@ export const getFloorAreaLookup = (
|
||||
};
|
||||
|
||||
export const floorCompare =
|
||||
(entries?: FloorRegistryEntry[], order?: string[]) =>
|
||||
(entries?: HomeAssistant["floors"], order?: string[]) =>
|
||||
(a: string, b: string) => {
|
||||
const indexA = order ? order.indexOf(a) : -1;
|
||||
const indexB = order ? order.indexOf(b) : -1;
|
||||
if (indexA === -1 && indexB === -1) {
|
||||
const nameA = entries?.[a]?.name ?? a;
|
||||
const nameB = entries?.[b]?.name ?? b;
|
||||
const floorA = entries?.[a];
|
||||
const floorB = entries?.[b];
|
||||
if (floorA && floorB && floorA.level !== floorB.level) {
|
||||
return (floorA.level ?? 9999) - (floorB.level ?? 9999);
|
||||
}
|
||||
const nameA = floorA?.name ?? a;
|
||||
const nameB = floorB?.name ?? b;
|
||||
return stringCompare(nameA, nameB);
|
||||
}
|
||||
if (indexA === -1) {
|
||||
|
@@ -1,18 +1,13 @@
|
||||
import type { Connection } from "home-assistant-js-websocket";
|
||||
import { createCollection } from "home-assistant-js-websocket";
|
||||
import type { Store } from "home-assistant-js-websocket/dist/store";
|
||||
import { stringCompare } from "../common/string/compare";
|
||||
import { debounce } from "../common/util/debounce";
|
||||
import type { AreaRegistryEntry } from "./area_registry";
|
||||
|
||||
const fetchAreaRegistry = (conn: Connection) =>
|
||||
conn
|
||||
.sendMessagePromise<AreaRegistryEntry[]>({
|
||||
type: "config/area_registry/list",
|
||||
})
|
||||
.then((areas) =>
|
||||
areas.sort((ent1, ent2) => stringCompare(ent1.name, ent2.name))
|
||||
);
|
||||
conn.sendMessagePromise<AreaRegistryEntry[]>({
|
||||
type: "config/area_registry/list",
|
||||
});
|
||||
|
||||
const subscribeAreaRegistryUpdates = (
|
||||
conn: Connection,
|
||||
|
@@ -1,23 +1,13 @@
|
||||
import type { Connection } from "home-assistant-js-websocket";
|
||||
import { createCollection } from "home-assistant-js-websocket";
|
||||
import type { Store } from "home-assistant-js-websocket/dist/store";
|
||||
import { stringCompare } from "../common/string/compare";
|
||||
import { debounce } from "../common/util/debounce";
|
||||
import type { FloorRegistryEntry } from "./floor_registry";
|
||||
|
||||
const fetchFloorRegistry = (conn: Connection) =>
|
||||
conn
|
||||
.sendMessagePromise({
|
||||
type: "config/floor_registry/list",
|
||||
})
|
||||
.then((floors) =>
|
||||
(floors as FloorRegistryEntry[]).sort((ent1, ent2) => {
|
||||
if (ent1.level !== ent2.level) {
|
||||
return (ent1.level ?? 9999) - (ent2.level ?? 9999);
|
||||
}
|
||||
return stringCompare(ent1.name, ent2.name);
|
||||
})
|
||||
);
|
||||
conn.sendMessagePromise<FloorRegistryEntry[]>({
|
||||
type: "config/floor_registry/list",
|
||||
});
|
||||
|
||||
const subscribeFloorRegistryUpdates = (
|
||||
conn: Connection,
|
||||
|
@@ -37,7 +37,6 @@
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
view-transition-name: layout-fade-out;
|
||||
}
|
||||
#ha-launch-screen svg {
|
||||
width: 112px;
|
||||
|
@@ -61,7 +61,6 @@ class HassLoadingScreen extends LitElement {
|
||||
display: block;
|
||||
height: 100%;
|
||||
background-color: var(--primary-background-color);
|
||||
view-transition-name: layout-fade-out;
|
||||
}
|
||||
.toolbar {
|
||||
display: flex;
|
||||
|
@@ -3,7 +3,6 @@ import { ReactiveElement } from "lit";
|
||||
import { property } from "lit/decorators";
|
||||
import memoizeOne from "memoize-one";
|
||||
import { navigate } from "../common/navigate";
|
||||
import { ViewTransitionMixin } from "../mixins/view-transition-mixin";
|
||||
import type { Route } from "../types";
|
||||
|
||||
const extractPage = (path: string, defaultPage: string) => {
|
||||
@@ -44,7 +43,7 @@ export interface RouterOptions {
|
||||
// Time to wait for code to load before we show loading screen.
|
||||
const LOADING_SCREEN_THRESHOLD = 400; // ms
|
||||
|
||||
export class HassRouterPage extends ViewTransitionMixin(ReactiveElement) {
|
||||
export class HassRouterPage extends ReactiveElement {
|
||||
@property({ attribute: false }) public route?: Route;
|
||||
|
||||
protected routerOptions!: RouterOptions;
|
||||
@@ -311,19 +310,16 @@ export class HassRouterPage extends ViewTransitionMixin(ReactiveElement) {
|
||||
page: string,
|
||||
routeOptions: RouteOptions
|
||||
) {
|
||||
this.startViewTransition(() => {
|
||||
if (this.lastChild) {
|
||||
this.removeChild(this.lastChild);
|
||||
}
|
||||
if (this.lastChild) {
|
||||
this.removeChild(this.lastChild);
|
||||
}
|
||||
|
||||
const panelEl = this._cache[page] || this.createElement(routeOptions.tag);
|
||||
(panelEl as HTMLElement).style.viewTransitionName = "layout-fade-in";
|
||||
this.updatePageEl(panelEl);
|
||||
this.appendChild(panelEl);
|
||||
const panelEl = this._cache[page] || this.createElement(routeOptions.tag);
|
||||
this.updatePageEl(panelEl);
|
||||
this.appendChild(panelEl);
|
||||
|
||||
if (routerOptions.cacheAll || routeOptions.cache) {
|
||||
this._cache[page] = panelEl;
|
||||
}
|
||||
});
|
||||
if (routerOptions.cacheAll || routeOptions.cache) {
|
||||
this._cache[page] = panelEl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,17 +1,15 @@
|
||||
import type { CSSResultGroup, TemplateResult } from "lit";
|
||||
import { css, html, LitElement } from "lit";
|
||||
import { customElement, eventOptions, property, state } from "lit/decorators";
|
||||
import { classMap } from "lit/directives/class-map";
|
||||
import { customElement, eventOptions, property } from "lit/decorators";
|
||||
import { restoreScroll } from "../common/decorators/restore-scroll";
|
||||
import { goBack } from "../common/navigate";
|
||||
import "../components/ha-icon-button-arrow-prev";
|
||||
import "../components/ha-menu-button";
|
||||
import { ViewTransitionMixin } from "../mixins/view-transition-mixin";
|
||||
import { haStyleScrollbar, haStyleViewTransitions } from "../resources/styles";
|
||||
import { haStyleScrollbar } from "../resources/styles";
|
||||
import type { HomeAssistant } from "../types";
|
||||
|
||||
@customElement("hass-subpage")
|
||||
class HassSubpage extends ViewTransitionMixin(LitElement) {
|
||||
class HassSubpage extends LitElement {
|
||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||
|
||||
@property() public header?: string;
|
||||
@@ -26,18 +24,9 @@ class HassSubpage extends ViewTransitionMixin(LitElement) {
|
||||
|
||||
@property({ type: Boolean }) public supervisor = false;
|
||||
|
||||
@state() private _loaded = false;
|
||||
|
||||
// @ts-ignore
|
||||
@restoreScroll(".content") private _savedScrollPos?: number;
|
||||
|
||||
protected onLoadTransition(): void {
|
||||
// Trigger the transition when content is slotted
|
||||
this.startViewTransition(() => {
|
||||
this._loaded = true;
|
||||
});
|
||||
}
|
||||
|
||||
protected render(): TemplateResult {
|
||||
return html`
|
||||
<div class="toolbar">
|
||||
@@ -71,14 +60,7 @@ class HassSubpage extends ViewTransitionMixin(LitElement) {
|
||||
<slot name="toolbar-icon"></slot>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class=${classMap({
|
||||
content: true,
|
||||
"ha-scrollbar": true,
|
||||
loading: !this._loaded,
|
||||
})}
|
||||
@scroll=${this._saveScrollPos}
|
||||
>
|
||||
<div class="content ha-scrollbar" @scroll=${this._saveScrollPos}>
|
||||
<slot></slot>
|
||||
</div>
|
||||
<div id="fab">
|
||||
@@ -103,7 +85,6 @@ class HassSubpage extends ViewTransitionMixin(LitElement) {
|
||||
static get styles(): CSSResultGroup {
|
||||
return [
|
||||
haStyleScrollbar,
|
||||
haStyleViewTransitions,
|
||||
css`
|
||||
:host {
|
||||
display: block;
|
||||
@@ -186,10 +167,6 @@ class HassSubpage extends ViewTransitionMixin(LitElement) {
|
||||
overflow-y: auto;
|
||||
overflow: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
view-transition-name: layout-fade-in;
|
||||
}
|
||||
.content.loading {
|
||||
opacity: 0;
|
||||
}
|
||||
:host([narrow]) .content {
|
||||
width: calc(
|
||||
|
@@ -11,8 +11,7 @@ import "../components/ha-icon-button-arrow-prev";
|
||||
import "../components/ha-menu-button";
|
||||
import "../components/ha-svg-icon";
|
||||
import "../components/ha-tab";
|
||||
import { ViewTransitionMixin } from "../mixins/view-transition-mixin";
|
||||
import { haStyleScrollbar, haStyleViewTransitions } from "../resources/styles";
|
||||
import { haStyleScrollbar } from "../resources/styles";
|
||||
import type { HomeAssistant, Route } from "../types";
|
||||
|
||||
export interface PageNavigation {
|
||||
@@ -30,7 +29,7 @@ export interface PageNavigation {
|
||||
}
|
||||
|
||||
@customElement("hass-tabs-subpage")
|
||||
class HassTabsSubpage extends ViewTransitionMixin(LitElement) {
|
||||
class HassTabsSubpage extends LitElement {
|
||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||
|
||||
@property({ type: Boolean }) public supervisor = false;
|
||||
@@ -62,18 +61,9 @@ class HassTabsSubpage extends ViewTransitionMixin(LitElement) {
|
||||
|
||||
@state() private _activeTab?: PageNavigation;
|
||||
|
||||
@state() private _loaded = false;
|
||||
|
||||
// @ts-ignore
|
||||
@restoreScroll(".content") private _savedScrollPos?: number;
|
||||
|
||||
protected onLoadTransition(): void {
|
||||
// Trigger the transition when content is slotted
|
||||
this.startViewTransition(() => {
|
||||
this._loaded = true;
|
||||
});
|
||||
}
|
||||
|
||||
private _getTabs = memoizeOne(
|
||||
(
|
||||
tabs: PageNavigation[],
|
||||
@@ -195,12 +185,7 @@ class HassTabsSubpage extends ViewTransitionMixin(LitElement) {
|
||||
</div>`
|
||||
: nothing}
|
||||
<div
|
||||
class=${classMap({
|
||||
content: true,
|
||||
"ha-scrollbar": true,
|
||||
tabs: showTabs,
|
||||
loading: !this._loaded,
|
||||
})}
|
||||
class="content ha-scrollbar ${classMap({ tabs: showTabs })}"
|
||||
@scroll=${this._saveScrollPos}
|
||||
>
|
||||
<slot></slot>
|
||||
@@ -229,7 +214,6 @@ class HassTabsSubpage extends ViewTransitionMixin(LitElement) {
|
||||
static get styles(): CSSResultGroup {
|
||||
return [
|
||||
haStyleScrollbar,
|
||||
haStyleViewTransitions,
|
||||
css`
|
||||
:host {
|
||||
display: block;
|
||||
@@ -348,10 +332,6 @@ class HassTabsSubpage extends ViewTransitionMixin(LitElement) {
|
||||
margin-bottom: var(--safe-area-inset-bottom);
|
||||
overflow: auto;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
view-transition-name: layout-fade-in;
|
||||
}
|
||||
.content.loading {
|
||||
opacity: 0;
|
||||
}
|
||||
:host([narrow]) .content {
|
||||
margin-left: var(--safe-area-inset-left);
|
||||
|
@@ -1,94 +0,0 @@
|
||||
import type { PropertyValues, ReactiveElement } from "lit";
|
||||
|
||||
type AbstractConstructor<T = object> = abstract new (...args: any[]) => T;
|
||||
|
||||
export const ViewTransitionMixin = <
|
||||
T extends AbstractConstructor<ReactiveElement>,
|
||||
>(
|
||||
superClass: T
|
||||
) => {
|
||||
abstract class ViewTransitionClass extends superClass {
|
||||
private _slot?: HTMLSlotElement;
|
||||
|
||||
private _transitionTriggered = false;
|
||||
|
||||
/**
|
||||
* Trigger a view transition if supported by the browser
|
||||
* @param updateCallback - Callback function that updates the DOM
|
||||
* @returns Promise that resolves when the transition is complete
|
||||
*/
|
||||
protected async startViewTransition(
|
||||
updateCallback: () => void | Promise<void>
|
||||
): Promise<void> {
|
||||
if (
|
||||
!document.startViewTransition ||
|
||||
window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
||||
) {
|
||||
// Fallback: update without view transition
|
||||
await updateCallback();
|
||||
return;
|
||||
}
|
||||
|
||||
const transition = document.startViewTransition(async () => {
|
||||
await updateCallback();
|
||||
});
|
||||
|
||||
try {
|
||||
await transition.finished;
|
||||
} catch (_error) {
|
||||
// View transition skipped
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional callback to execute during the load transition
|
||||
*/
|
||||
protected onLoadTransition?(): void;
|
||||
|
||||
/**
|
||||
* Check if slot has content and trigger transition if it does
|
||||
*/
|
||||
private _checkSlotContent = (): void => {
|
||||
// Guard against multiple slotchange events triggering the transition multiple times
|
||||
if (this._transitionTriggered) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (this._slot) {
|
||||
const elements = this._slot.assignedElements();
|
||||
if (elements.length > 0) {
|
||||
this._transitionTriggered = true;
|
||||
this.onLoadTransition?.();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Automatically apply view transition on first render
|
||||
* @param changedProperties - Properties that changed
|
||||
*/
|
||||
protected firstUpdated(changedProperties: PropertyValues): void {
|
||||
super.firstUpdated(changedProperties);
|
||||
|
||||
// Wait for slotted content to be ready, then trigger transition
|
||||
this._slot = this.shadowRoot?.querySelector(
|
||||
"slot:not([name])"
|
||||
) as HTMLSlotElement | undefined;
|
||||
if (this._slot) {
|
||||
this._checkSlotContent();
|
||||
this._slot.addEventListener("slotchange", this._checkSlotContent);
|
||||
} else {
|
||||
// Start transition immediately if no slot is found
|
||||
this.onLoadTransition?.();
|
||||
}
|
||||
}
|
||||
|
||||
override disconnectedCallback(): void {
|
||||
super.disconnectedCallback();
|
||||
if (this._slot) {
|
||||
this._slot.removeEventListener("slotchange", this._checkSlotContent);
|
||||
}
|
||||
}
|
||||
}
|
||||
return ViewTransitionClass;
|
||||
};
|
@@ -1,4 +1,4 @@
|
||||
import { mdiDrag, mdiPlus } from "@mdi/js";
|
||||
import { mdiDragHorizontalVariant, mdiPlus } from "@mdi/js";
|
||||
import deepClone from "deep-clone-simple";
|
||||
import type { PropertyValues } from "lit";
|
||||
import { LitElement, html, nothing } from "lit";
|
||||
@@ -115,7 +115,9 @@ export default class HaAutomationAction extends LitElement {
|
||||
@click=${stopPropagation}
|
||||
.index=${idx}
|
||||
>
|
||||
<ha-svg-icon .path=${mdiDrag}></ha-svg-icon>
|
||||
<ha-svg-icon
|
||||
.path=${mdiDragHorizontalVariant}
|
||||
></ha-svg-icon>
|
||||
</div>
|
||||
`
|
||||
: nothing}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { mdiDrag, mdiPlus } from "@mdi/js";
|
||||
import { mdiDragHorizontalVariant, mdiPlus } from "@mdi/js";
|
||||
import deepClone from "deep-clone-simple";
|
||||
import type { PropertyValues } from "lit";
|
||||
import { html, LitElement, nothing } from "lit";
|
||||
@@ -193,7 +193,9 @@ export default class HaAutomationCondition extends LitElement {
|
||||
@click=${stopPropagation}
|
||||
.index=${idx}
|
||||
>
|
||||
<ha-svg-icon .path=${mdiDrag}></ha-svg-icon>
|
||||
<ha-svg-icon
|
||||
.path=${mdiDragHorizontalVariant}
|
||||
></ha-svg-icon>
|
||||
</div>
|
||||
`
|
||||
: nothing}
|
||||
|
@@ -10,8 +10,10 @@ import {
|
||||
optional,
|
||||
string,
|
||||
union,
|
||||
array,
|
||||
} from "superstruct";
|
||||
import { createDurationData } from "../../../../../common/datetime/create_duration_data";
|
||||
import { ensureArray } from "../../../../../common/array/ensure-array";
|
||||
import { fireEvent } from "../../../../../common/dom/fire_event";
|
||||
import "../../../../../components/ha-form/ha-form";
|
||||
import type { SchemaUnion } from "../../../../../components/ha-form/types";
|
||||
@@ -25,7 +27,7 @@ const stateConditionStruct = object({
|
||||
condition: literal("state"),
|
||||
entity_id: optional(string()),
|
||||
attribute: optional(string()),
|
||||
state: optional(string()),
|
||||
state: optional(union([string(), array(string())])),
|
||||
for: optional(union([number(), string(), forDictStruct])),
|
||||
enabled: optional(boolean()),
|
||||
});
|
||||
@@ -69,7 +71,7 @@ const SCHEMA = [
|
||||
name: "state",
|
||||
required: true,
|
||||
selector: {
|
||||
state: {},
|
||||
state: { multiple: true },
|
||||
},
|
||||
context: {
|
||||
filter_entity: "entity_id",
|
||||
@@ -88,7 +90,7 @@ export class HaStateCondition extends LitElement implements ConditionElement {
|
||||
@property({ type: Boolean }) public disabled = false;
|
||||
|
||||
public static get defaultConfig(): StateCondition {
|
||||
return { condition: "state", entity_id: "", state: "" };
|
||||
return { condition: "state", entity_id: "", state: [] };
|
||||
}
|
||||
|
||||
public shouldUpdate(changedProperties: PropertyValues) {
|
||||
@@ -105,7 +107,11 @@ export class HaStateCondition extends LitElement implements ConditionElement {
|
||||
|
||||
protected render() {
|
||||
const trgFor = createDurationData(this.condition.for);
|
||||
const data = { ...this.condition, for: trgFor };
|
||||
const data = {
|
||||
...this.condition,
|
||||
state: ensureArray(this.condition.state) || [],
|
||||
for: trgFor,
|
||||
};
|
||||
|
||||
return html`
|
||||
<ha-form
|
||||
@@ -129,10 +135,9 @@ export class HaStateCondition extends LitElement implements ConditionElement {
|
||||
: {}
|
||||
);
|
||||
|
||||
// We should not cleanup state in the above, as it is required.
|
||||
// Set it to empty string if it is undefined.
|
||||
if (!newCondition.state) {
|
||||
newCondition.state = "";
|
||||
// Ensure `state` stays an array for multi-select. If absent, set to []
|
||||
if (newCondition.state === undefined || newCondition.state === "") {
|
||||
newCondition.state = [];
|
||||
}
|
||||
|
||||
fireEvent(this, "value-changed", { value: newCondition });
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { mdiDrag, mdiPlus } from "@mdi/js";
|
||||
import { mdiDragHorizontalVariant, mdiPlus } from "@mdi/js";
|
||||
import deepClone from "deep-clone-simple";
|
||||
import type { PropertyValues } from "lit";
|
||||
import { LitElement, css, html, nothing } from "lit";
|
||||
@@ -100,7 +100,9 @@ export default class HaAutomationOption extends LitElement {
|
||||
@click=${stopPropagation}
|
||||
.index=${idx}
|
||||
>
|
||||
<ha-svg-icon .path=${mdiDrag}></ha-svg-icon>
|
||||
<ha-svg-icon
|
||||
.path=${mdiDragHorizontalVariant}
|
||||
></ha-svg-icon>
|
||||
</div>
|
||||
`
|
||||
: nothing}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { mdiDrag, mdiPlus } from "@mdi/js";
|
||||
import { mdiDragHorizontalVariant, mdiPlus } from "@mdi/js";
|
||||
import deepClone from "deep-clone-simple";
|
||||
import type { PropertyValues } from "lit";
|
||||
import { html, LitElement, nothing } from "lit";
|
||||
@@ -110,7 +110,9 @@ export default class HaAutomationTrigger extends LitElement {
|
||||
@click=${stopPropagation}
|
||||
.index=${idx}
|
||||
>
|
||||
<ha-svg-icon .path=${mdiDrag}></ha-svg-icon>
|
||||
<ha-svg-icon
|
||||
.path=${mdiDragHorizontalVariant}
|
||||
></ha-svg-icon>
|
||||
</div>
|
||||
`
|
||||
: nothing}
|
||||
|
@@ -244,7 +244,8 @@ class HaConfigBackupSettings extends LitElement {
|
||||
`
|
||||
: nothing}
|
||||
</div>
|
||||
${!this.cloudStatus?.logged_in
|
||||
${!this.cloudStatus?.logged_in &&
|
||||
isComponentLoaded(this.hass, "cloud")
|
||||
? html`<ha-card class="cloud-info">
|
||||
<div class="cloud-header">
|
||||
<img
|
||||
@@ -279,7 +280,10 @@ class HaConfigBackupSettings extends LitElement {
|
||||
"ui.panel.config.voice_assistants.assistants.cloud.sign_in"
|
||||
)}
|
||||
</ha-button>
|
||||
<ha-button href="/config/cloud/register">
|
||||
<ha-button
|
||||
href="/config/cloud/register"
|
||||
appearance="filled"
|
||||
>
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.voice_assistants.assistants.cloud.try_one_month"
|
||||
)}
|
||||
|
@@ -134,8 +134,8 @@ export class HaDeviceCard extends LitElement {
|
||||
}
|
||||
|
||||
protected _getAddresses() {
|
||||
return this.device.connections.filter(
|
||||
(conn) => conn[0] === "mac" || conn[0] === "bluetooth"
|
||||
return this.device.connections.filter((conn) =>
|
||||
["mac", "bluetooth", "zigbee"].includes(conn[0])
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -38,7 +38,6 @@ export class HaDeviceInfoZha extends LitElement {
|
||||
}
|
||||
return html`
|
||||
<ha-expansion-panel header="Zigbee info">
|
||||
<div>IEEE: ${this._zhaDevice.ieee}</div>
|
||||
<div>Nwk: ${formatAsPaddedHex(this._zhaDevice.nwk)}</div>
|
||||
<div>Device Type: ${this._zhaDevice.device_type}</div>
|
||||
<div>
|
||||
|
@@ -1,4 +1,10 @@
|
||||
import { mdiDelete, mdiDevices, mdiDrag, mdiPencil, mdiPlus } from "@mdi/js";
|
||||
import {
|
||||
mdiDelete,
|
||||
mdiDevices,
|
||||
mdiDragHorizontalVariant,
|
||||
mdiPencil,
|
||||
mdiPlus,
|
||||
} from "@mdi/js";
|
||||
import type { CSSResultGroup, TemplateResult } from "lit";
|
||||
import { css, html, LitElement } from "lit";
|
||||
import { repeat } from "lit/directives/repeat";
|
||||
@@ -89,7 +95,9 @@ export class EnergyDeviceSettings extends LitElement {
|
||||
(device) => html`
|
||||
<div class="row" .device=${device}>
|
||||
<div class="handle">
|
||||
<ha-svg-icon .path=${mdiDrag}></ha-svg-icon>
|
||||
<ha-svg-icon
|
||||
.path=${mdiDragHorizontalVariant}
|
||||
></ha-svg-icon>
|
||||
</div>
|
||||
<span class="content"
|
||||
>${device.name ||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { mdiDelete, mdiDrag } from "@mdi/js";
|
||||
import { mdiDelete, mdiDragHorizontalVariant } from "@mdi/js";
|
||||
import type { CSSResultGroup } from "lit";
|
||||
import { LitElement, css, html, nothing } from "lit";
|
||||
import { customElement, property, query, state } from "lit/decorators";
|
||||
@@ -111,7 +111,9 @@ class HaInputSelectForm extends LitElement {
|
||||
<ha-list-item class="option" hasMeta>
|
||||
<div class="optioncontent">
|
||||
<div class="handle">
|
||||
<ha-svg-icon .path=${mdiDrag}></ha-svg-icon>
|
||||
<ha-svg-icon
|
||||
.path=${mdiDragHorizontalVariant}
|
||||
></ha-svg-icon>
|
||||
</div>
|
||||
${option}
|
||||
</div>
|
||||
|
@@ -528,18 +528,20 @@ class HaConfigIntegrationPage extends SubscribeMixin(LitElement) {
|
||||
</ha-button>
|
||||
`
|
||||
: nothing}
|
||||
<ha-button
|
||||
.appearance=${canAddDevice ? "filled" : "accent"}
|
||||
@click=${this._addIntegration}
|
||||
>
|
||||
${this._manifest?.integration_type
|
||||
? this.hass.localize(
|
||||
`ui.panel.config.integrations.integration_page.add_${this._manifest.integration_type}`
|
||||
)
|
||||
: this.hass.localize(
|
||||
`ui.panel.config.integrations.integration_page.add_entry`
|
||||
)}
|
||||
</ha-button>
|
||||
${this._manifest?.integration_type !== "hardware"
|
||||
? html`<ha-button
|
||||
.appearance=${canAddDevice ? "filled" : "accent"}
|
||||
@click=${this._addIntegration}
|
||||
>
|
||||
${this._manifest?.integration_type
|
||||
? this.hass.localize(
|
||||
`ui.panel.config.integrations.integration_page.add_${this._manifest.integration_type}`
|
||||
)
|
||||
: this.hass.localize(
|
||||
`ui.panel.config.integrations.integration_page.add_entry`
|
||||
)}
|
||||
</ha-button>`
|
||||
: nothing}
|
||||
${Array.from(supportedSubentryTypes).map(
|
||||
(flowType) =>
|
||||
html`<ha-button
|
||||
|
@@ -220,6 +220,9 @@ class DialogZHAManageZigbeeDevice extends LitElement {
|
||||
|
||||
.content {
|
||||
outline: none;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: var(--ha-space-2);
|
||||
}
|
||||
|
||||
@media all and (min-width: 600px) and (min-height: 501px) {
|
||||
|
@@ -117,15 +117,6 @@ export class ZHAClusterAttributes extends LitElement {
|
||||
></ha-textfield>
|
||||
</div>
|
||||
<div class="card-actions">
|
||||
<ha-progress-button
|
||||
@click=${this._onGetZigbeeAttributeClick}
|
||||
.progress=${this._readingAttribute}
|
||||
.disabled=${this._readingAttribute}
|
||||
>
|
||||
${this.hass!.localize(
|
||||
"ui.panel.config.zha.cluster_attributes.read_zigbee_attribute"
|
||||
)}
|
||||
</ha-progress-button>
|
||||
<ha-call-service-button
|
||||
.hass=${this.hass}
|
||||
domain="zha"
|
||||
@@ -136,6 +127,15 @@ export class ZHAClusterAttributes extends LitElement {
|
||||
"ui.panel.config.zha.cluster_attributes.write_zigbee_attribute"
|
||||
)}
|
||||
</ha-call-service-button>
|
||||
<ha-progress-button
|
||||
@click=${this._onGetZigbeeAttributeClick}
|
||||
.progress=${this._readingAttribute}
|
||||
.disabled=${this._readingAttribute}
|
||||
>
|
||||
${this.hass!.localize(
|
||||
"ui.panel.config.zha.cluster_attributes.read_zigbee_attribute"
|
||||
)}
|
||||
</ha-progress-button>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
@@ -230,6 +230,10 @@ export class ZHAClusterAttributes extends LitElement {
|
||||
return [
|
||||
haStyle,
|
||||
css`
|
||||
ha-card {
|
||||
border: none;
|
||||
}
|
||||
|
||||
ha-select {
|
||||
margin-top: 16px;
|
||||
}
|
||||
@@ -263,6 +267,12 @@ export class ZHAClusterAttributes extends LitElement {
|
||||
.header {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.card-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: var(--ha-space-1);
|
||||
}
|
||||
`,
|
||||
];
|
||||
}
|
||||
|
@@ -108,6 +108,7 @@ export class ZHAClusterCommands extends LitElement {
|
||||
service="issue_zigbee_cluster_command"
|
||||
.data=${this._issueClusterCommandServiceData}
|
||||
.disabled=${!this._canIssueCommand}
|
||||
appearance="accent"
|
||||
>
|
||||
${this.hass!.localize(
|
||||
"ui.panel.config.zha.cluster_commands.issue_zigbee_command"
|
||||
@@ -187,6 +188,10 @@ export class ZHAClusterCommands extends LitElement {
|
||||
return [
|
||||
haStyle,
|
||||
css`
|
||||
ha-card {
|
||||
border: none;
|
||||
}
|
||||
|
||||
ha-select {
|
||||
margin-top: 16px;
|
||||
}
|
||||
@@ -239,6 +244,11 @@ export class ZHAClusterCommands extends LitElement {
|
||||
padding-inline-start: initial;
|
||||
color: var(--primary-color);
|
||||
}
|
||||
|
||||
.card-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
`,
|
||||
];
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@ import {
|
||||
} from "@mdi/js";
|
||||
import type { CSSResultGroup, PropertyValues, TemplateResult } from "lit";
|
||||
import { css, html, LitElement, nothing } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import { customElement, property, query, state } from "lit/decorators";
|
||||
import "../../../../../components/buttons/ha-progress-button";
|
||||
import "../../../../../components/ha-alert";
|
||||
import "../../../../../components/ha-button";
|
||||
@@ -43,6 +43,7 @@ import type { HomeAssistant, Route } from "../../../../../types";
|
||||
import { fileDownload } from "../../../../../util/file_download";
|
||||
import "../../../ha-config-section";
|
||||
import { showZHAChangeChannelDialog } from "./show-dialog-zha-change-channel";
|
||||
import type { HaProgressButton } from "../../../../../components/buttons/ha-progress-button";
|
||||
|
||||
const MULTIPROTOCOL_ADDON_URL = "socket://core-silabs-multiprotocol:9999";
|
||||
|
||||
@@ -88,6 +89,8 @@ class ZHAConfigDashboard extends LitElement {
|
||||
|
||||
@state() private _generatingBackup = false;
|
||||
|
||||
@query("#config-save-button") private _configSaveButton?: HaProgressButton;
|
||||
|
||||
protected firstUpdated(changedProperties: PropertyValues) {
|
||||
super.firstUpdated(changedProperties);
|
||||
if (this.hass) {
|
||||
@@ -290,7 +293,8 @@ class ZHAConfigDashboard extends LitElement {
|
||||
></ha-form>
|
||||
</div>
|
||||
<div class="card-actions">
|
||||
<ha-button
|
||||
<ha-progress-button
|
||||
id="config-save-button"
|
||||
appearance="filled"
|
||||
variant="brand"
|
||||
@click=${this._updateConfiguration}
|
||||
@@ -298,7 +302,7 @@ class ZHAConfigDashboard extends LitElement {
|
||||
${this.hass.localize(
|
||||
"ui.panel.config.zha.configuration_page.update_button"
|
||||
)}
|
||||
</ha-button>
|
||||
</ha-progress-button>
|
||||
</div>
|
||||
</ha-card>`
|
||||
)
|
||||
@@ -416,7 +420,15 @@ class ZHAConfigDashboard extends LitElement {
|
||||
}
|
||||
|
||||
private async _updateConfiguration(): Promise<any> {
|
||||
await updateZHAConfiguration(this.hass!, this._configuration!.data);
|
||||
this._configSaveButton!.progress = true;
|
||||
try {
|
||||
await updateZHAConfiguration(this.hass!, this._configuration!.data);
|
||||
this._configSaveButton!.actionSuccess();
|
||||
} catch (_err: any) {
|
||||
this._configSaveButton!.actionError();
|
||||
} finally {
|
||||
this._configSaveButton!.progress = false;
|
||||
}
|
||||
}
|
||||
|
||||
private _computeLabelCallback(localize, section: string) {
|
||||
|
@@ -60,6 +60,15 @@ export class ZHADeviceBindingControl extends LitElement {
|
||||
</ha-select>
|
||||
</div>
|
||||
<div class="card-actions">
|
||||
<ha-progress-button
|
||||
@click=${this._onUnbindDevicesClick}
|
||||
.disabled=${!(this._deviceToBind && this.device) ||
|
||||
this._bindingOperationInProgress}
|
||||
variant="danger"
|
||||
appearance="plain"
|
||||
>
|
||||
${this.hass!.localize("ui.panel.config.zha.device_binding.unbind")}
|
||||
</ha-progress-button>
|
||||
<ha-progress-button
|
||||
@click=${this._onBindDevicesClick}
|
||||
.disabled=${!(this._deviceToBind && this.device) ||
|
||||
@@ -67,13 +76,6 @@ export class ZHADeviceBindingControl extends LitElement {
|
||||
>
|
||||
${this.hass!.localize("ui.panel.config.zha.device_binding.bind")}
|
||||
</ha-progress-button>
|
||||
<ha-progress-button
|
||||
@click=${this._onUnbindDevicesClick}
|
||||
.disabled=${!(this._deviceToBind && this.device) ||
|
||||
this._bindingOperationInProgress}
|
||||
>
|
||||
${this.hass!.localize("ui.panel.config.zha.device_binding.unbind")}
|
||||
</ha-progress-button>
|
||||
</div>
|
||||
</ha-card>
|
||||
`;
|
||||
@@ -133,6 +135,10 @@ export class ZHADeviceBindingControl extends LitElement {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding-top: var(--ha-space-2);
|
||||
}
|
||||
|
||||
.command-picker {
|
||||
align-items: center;
|
||||
padding-left: 28px;
|
||||
@@ -145,6 +151,11 @@ export class ZHADeviceBindingControl extends LitElement {
|
||||
.header {
|
||||
flex-grow: 1;
|
||||
}
|
||||
.card-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: var(--ha-space-1);
|
||||
}
|
||||
`,
|
||||
];
|
||||
}
|
||||
|
@@ -85,23 +85,24 @@ export class ZHAGroupBindingControl extends LitElement {
|
||||
></zha-clusters-data-table>
|
||||
</div>
|
||||
<div class="card-actions">
|
||||
<ha-progress-button
|
||||
@click=${this._onBindGroupClick}
|
||||
.disabled=${!this._canBind || this._bindingOperationInProgress}
|
||||
>
|
||||
${this.hass!.localize(
|
||||
"ui.panel.config.zha.group_binding.bind_button_label"
|
||||
)}
|
||||
</ha-progress-button>
|
||||
|
||||
<ha-progress-button
|
||||
@click=${this._onUnbindGroupClick}
|
||||
.disabled=${!this._canBind || this._bindingOperationInProgress}
|
||||
variant="danger"
|
||||
appearance="plain"
|
||||
>
|
||||
${this.hass!.localize(
|
||||
"ui.panel.config.zha.group_binding.unbind_button_label"
|
||||
)}
|
||||
</ha-progress-button>
|
||||
<ha-progress-button
|
||||
@click=${this._onBindGroupClick}
|
||||
.disabled=${!this._canBind || this._bindingOperationInProgress}
|
||||
>
|
||||
${this.hass!.localize(
|
||||
"ui.panel.config.zha.group_binding.bind_button_label"
|
||||
)}
|
||||
</ha-progress-button>
|
||||
</div>
|
||||
</ha-card>
|
||||
</ha-config-section>
|
||||
@@ -205,6 +206,10 @@ export class ZHAGroupBindingControl extends LitElement {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding-top: var(--ha-space-2);
|
||||
}
|
||||
|
||||
.command-picker {
|
||||
align-items: center;
|
||||
padding-left: 28px;
|
||||
@@ -225,6 +230,12 @@ export class ZHAGroupBindingControl extends LitElement {
|
||||
.sectionHeader {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.card-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: var(--ha-space-1);
|
||||
}
|
||||
`,
|
||||
];
|
||||
}
|
||||
|
@@ -9,7 +9,6 @@ import {
|
||||
import type { PropertyValues } from "lit";
|
||||
import { LitElement, html, nothing } from "lit";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import { ifDefined } from "lit/directives/if-defined";
|
||||
import memoize from "memoize-one";
|
||||
import { isComponentLoaded } from "../../../../common/config/is_component_loaded";
|
||||
import { storage } from "../../../../common/decorators/storage";
|
||||
@@ -62,7 +61,7 @@ type DataTableItem = Pick<
|
||||
> & {
|
||||
default: boolean;
|
||||
filename: string;
|
||||
iconColor?: string;
|
||||
type: string;
|
||||
};
|
||||
|
||||
@customElement("ha-config-lovelace-dashboards")
|
||||
@@ -107,6 +106,20 @@ export class HaConfigLovelaceDashboards extends LitElement {
|
||||
})
|
||||
private _activeHiddenColumns?: string[];
|
||||
|
||||
@storage({
|
||||
key: "lovelace-dashboards-table-grouping",
|
||||
state: false,
|
||||
subscribe: false,
|
||||
})
|
||||
private _activeGrouping?: string = "type";
|
||||
|
||||
@storage({
|
||||
key: "lovelace-dashboards-table-collapsed",
|
||||
state: false,
|
||||
subscribe: false,
|
||||
})
|
||||
private _activeCollapsed: string[] = [];
|
||||
|
||||
public willUpdate() {
|
||||
if (!this.hasUpdated) {
|
||||
this.hass.loadFragmentTranslation("lovelace");
|
||||
@@ -132,15 +145,7 @@ export class HaConfigLovelaceDashboards extends LitElement {
|
||||
template: (dashboard) =>
|
||||
dashboard.icon
|
||||
? html`
|
||||
<ha-icon
|
||||
slot="item-icon"
|
||||
.icon=${dashboard.icon}
|
||||
style=${ifDefined(
|
||||
dashboard.iconColor
|
||||
? `color: ${dashboard.iconColor}`
|
||||
: undefined
|
||||
)}
|
||||
></ha-icon>
|
||||
<ha-icon slot="item-icon" .icon=${dashboard.icon}></ha-icon>
|
||||
`
|
||||
: nothing,
|
||||
},
|
||||
@@ -177,6 +182,15 @@ export class HaConfigLovelaceDashboards extends LitElement {
|
||||
},
|
||||
};
|
||||
|
||||
columns.type = {
|
||||
title: localize(
|
||||
"ui.panel.config.lovelace.dashboards.picker.headers.type"
|
||||
),
|
||||
sortable: true,
|
||||
groupable: true,
|
||||
filterable: true,
|
||||
};
|
||||
|
||||
columns.mode = {
|
||||
title: localize(
|
||||
"ui.panel.config.lovelace.dashboards.picker.headers.conf_mode"
|
||||
@@ -287,7 +301,7 @@ export class HaConfigLovelaceDashboards extends LitElement {
|
||||
url_path: "lovelace",
|
||||
mode: defaultMode,
|
||||
filename: defaultMode === "yaml" ? "ui-lovelace.yaml" : "",
|
||||
iconColor: "var(--primary-color)",
|
||||
type: this._localizeType("built_in"),
|
||||
},
|
||||
];
|
||||
if (isComponentLoaded(this.hass, "energy")) {
|
||||
@@ -298,9 +312,9 @@ export class HaConfigLovelaceDashboards extends LitElement {
|
||||
mode: "storage",
|
||||
url_path: "energy",
|
||||
filename: "",
|
||||
iconColor: "var(--orange-color)",
|
||||
default: false,
|
||||
require_admin: false,
|
||||
type: this._localizeType("built_in"),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -312,9 +326,9 @@ export class HaConfigLovelaceDashboards extends LitElement {
|
||||
mode: "storage",
|
||||
url_path: "light",
|
||||
filename: "",
|
||||
iconColor: "var(--amber-color)",
|
||||
default: false,
|
||||
require_admin: false,
|
||||
type: this._localizeType("built_in"),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -326,9 +340,9 @@ export class HaConfigLovelaceDashboards extends LitElement {
|
||||
mode: "storage",
|
||||
url_path: "safety",
|
||||
filename: "",
|
||||
iconColor: "var(--blue-grey-color)",
|
||||
default: false,
|
||||
require_admin: false,
|
||||
type: this._localizeType("built_in"),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -340,9 +354,9 @@ export class HaConfigLovelaceDashboards extends LitElement {
|
||||
mode: "storage",
|
||||
url_path: "climate",
|
||||
filename: "",
|
||||
iconColor: "var(--deep-orange-color)",
|
||||
default: false,
|
||||
require_admin: false,
|
||||
type: this._localizeType("built_in"),
|
||||
});
|
||||
}
|
||||
|
||||
@@ -351,16 +365,25 @@ export class HaConfigLovelaceDashboards extends LitElement {
|
||||
.sort((a, b) =>
|
||||
stringCompare(a.title, b.title, this.hass.locale.language)
|
||||
)
|
||||
.map((dashboard) => ({
|
||||
filename: "",
|
||||
...dashboard,
|
||||
default: defaultUrlPath === dashboard.url_path,
|
||||
}))
|
||||
.map(
|
||||
(dashboard) =>
|
||||
({
|
||||
filename: "",
|
||||
...dashboard,
|
||||
default: defaultUrlPath === dashboard.url_path,
|
||||
type: this._localizeType("user_created"),
|
||||
}) satisfies DataTableItem
|
||||
)
|
||||
);
|
||||
return result;
|
||||
}
|
||||
);
|
||||
|
||||
private _localizeType = (type: "user_created" | "built_in") =>
|
||||
this.hass.localize(
|
||||
`ui.panel.config.lovelace.dashboards.picker.type.${type}`
|
||||
);
|
||||
|
||||
protected render() {
|
||||
if (!this.hass || this._dashboards === undefined) {
|
||||
return html` <hass-loading-screen></hass-loading-screen> `;
|
||||
@@ -380,9 +403,13 @@ export class HaConfigLovelaceDashboards extends LitElement {
|
||||
this.hass.localize
|
||||
)}
|
||||
.data=${this._getItems(this._dashboards, this.hass.defaultPanel)}
|
||||
.initialGroupColumn=${this._activeGrouping}
|
||||
.initialCollapsedGroups=${this._activeCollapsed}
|
||||
.initialSorting=${this._activeSorting}
|
||||
.columnOrder=${this._activeColumnOrder}
|
||||
.hiddenColumns=${this._activeHiddenColumns}
|
||||
@grouping-changed=${this._handleGroupingChanged}
|
||||
@collapsed-changed=${this._handleCollapseChanged}
|
||||
@columns-changed=${this._handleColumnsChanged}
|
||||
@sorting-changed=${this._handleSortingChanged}
|
||||
.filter=${this._filter}
|
||||
@@ -443,13 +470,13 @@ export class HaConfigLovelaceDashboards extends LitElement {
|
||||
}
|
||||
|
||||
private _canDelete(urlPath: string) {
|
||||
return !["lovelace", "energy", "light", "security", "climate"].includes(
|
||||
return !["lovelace", "energy", "light", "safety", "climate"].includes(
|
||||
urlPath
|
||||
);
|
||||
}
|
||||
|
||||
private _canEdit(urlPath: string) {
|
||||
return !["light", "security", "climate"].includes(urlPath);
|
||||
return !["light", "safety", "climate"].includes(urlPath);
|
||||
}
|
||||
|
||||
private _handleDelete = async (item: DataTableItem) => {
|
||||
@@ -571,6 +598,14 @@ export class HaConfigLovelaceDashboards extends LitElement {
|
||||
this._activeColumnOrder = ev.detail.columnOrder;
|
||||
this._activeHiddenColumns = ev.detail.hiddenColumns;
|
||||
}
|
||||
|
||||
private _handleGroupingChanged(ev: CustomEvent) {
|
||||
this._activeGrouping = ev.detail.value;
|
||||
}
|
||||
|
||||
private _handleCollapseChanged(ev: CustomEvent) {
|
||||
this._activeCollapsed = ev.detail.value;
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
|
@@ -11,7 +11,6 @@ import { computeDomain } from "../../../common/entity/compute_domain";
|
||||
import { computeStateDomain } from "../../../common/entity/compute_state_domain";
|
||||
import { stateActive } from "../../../common/entity/state_active";
|
||||
import { stateColorCss } from "../../../common/entity/state_color";
|
||||
import { computeLovelaceEntityName } from "../common/entity/compute-lovelace-entity-name";
|
||||
import "../../../components/ha-badge";
|
||||
import "../../../components/ha-ripple";
|
||||
import "../../../components/ha-state-icon";
|
||||
@@ -20,6 +19,7 @@ import { cameraUrlWithWidthHeight } from "../../../data/camera";
|
||||
import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler";
|
||||
import type { HomeAssistant } from "../../../types";
|
||||
import { actionHandler } from "../common/directives/action-handler-directive";
|
||||
import { computeLovelaceEntityName } from "../common/entity/compute-lovelace-entity-name";
|
||||
import { findEntities } from "../common/find-entities";
|
||||
import { handleAction } from "../common/handle-action";
|
||||
import { hasAction } from "../common/has-action";
|
||||
@@ -162,11 +162,7 @@ export class HuiEntityBadge extends LitElement implements LovelaceBadge {
|
||||
if (!stateObj) {
|
||||
return html`
|
||||
<ha-badge .label=${entityId} class="error">
|
||||
<ha-svg-icon
|
||||
slot="icon"
|
||||
.hass=${this.hass}
|
||||
.path=${mdiAlertCircle}
|
||||
></ha-svg-icon>
|
||||
<ha-svg-icon slot="icon" .path=${mdiAlertCircle}></ha-svg-icon>
|
||||
${this.hass.localize("ui.badge.entity.not_found")}
|
||||
</ha-badge>
|
||||
`;
|
||||
@@ -179,22 +175,22 @@ export class HuiEntityBadge extends LitElement implements LovelaceBadge {
|
||||
"--badge-color": color,
|
||||
};
|
||||
|
||||
const stateDisplay = html`
|
||||
<state-display
|
||||
.stateObj=${stateObj}
|
||||
.hass=${this.hass}
|
||||
.content=${this._config.state_content}
|
||||
.name=${this._config.name}
|
||||
>
|
||||
</state-display>
|
||||
`;
|
||||
|
||||
const name = computeLovelaceEntityName(
|
||||
this.hass,
|
||||
stateObj,
|
||||
this._config.name
|
||||
);
|
||||
|
||||
const stateDisplay = html`
|
||||
<state-display
|
||||
.stateObj=${stateObj}
|
||||
.hass=${this.hass}
|
||||
.content=${this._config.state_content}
|
||||
.name=${name}
|
||||
>
|
||||
</state-display>
|
||||
`;
|
||||
|
||||
const showState = this._config.show_state;
|
||||
const showName = this._config.show_name;
|
||||
const showIcon = this._config.show_icon;
|
||||
|
@@ -9,13 +9,14 @@ import { LitElement, css, html, nothing } from "lit";
|
||||
import { customElement, state } from "lit/decorators";
|
||||
import { ifDefined } from "lit/directives/if-defined";
|
||||
import { styleMap } from "lit/directives/style-map";
|
||||
import { computeCssColor } from "../../../common/color/compute-color";
|
||||
import { DOMAINS_TOGGLE } from "../../../common/const";
|
||||
import { transform } from "../../../common/decorators/transform";
|
||||
import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element";
|
||||
import { fireEvent } from "../../../common/dom/fire_event";
|
||||
import { computeDomain } from "../../../common/entity/compute_domain";
|
||||
import { computeStateDomain } from "../../../common/entity/compute_state_domain";
|
||||
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||
import { stateActive } from "../../../common/entity/state_active";
|
||||
import {
|
||||
stateColorBrightness,
|
||||
stateColorCss,
|
||||
@@ -40,6 +41,7 @@ import type { FrontendLocaleData } from "../../../data/translation";
|
||||
import type { Themes } from "../../../data/ws-themes";
|
||||
import type { HomeAssistant } from "../../../types";
|
||||
import { actionHandler } from "../common/directives/action-handler-directive";
|
||||
import { computeLovelaceEntityName } from "../common/entity/compute-lovelace-entity-name";
|
||||
import { findEntities } from "../common/find-entities";
|
||||
import { hasAction } from "../common/has-action";
|
||||
import { createEntityNotFoundWarning } from "../components/hui-warning";
|
||||
@@ -49,8 +51,6 @@ import type {
|
||||
LovelaceGridOptions,
|
||||
} from "../types";
|
||||
import type { ButtonCardConfig } from "./types";
|
||||
import { computeCssColor } from "../../../common/color/compute-color";
|
||||
import { stateActive } from "../../../common/entity/state_active";
|
||||
|
||||
export const getEntityDefaultButtonAction = (entityId?: string) =>
|
||||
entityId && DOMAINS_TOGGLE.has(computeDomain(entityId))
|
||||
@@ -183,9 +183,11 @@ export class HuiButtonCard extends LitElement implements LovelaceCard {
|
||||
`;
|
||||
}
|
||||
|
||||
const name = this._config.show_name
|
||||
? this._config.name || (stateObj ? computeStateName(stateObj) : "")
|
||||
: "";
|
||||
const name = computeLovelaceEntityName(
|
||||
this.hass,
|
||||
stateObj,
|
||||
this._config.name
|
||||
);
|
||||
|
||||
return html`
|
||||
<ha-card
|
||||
@@ -195,8 +197,7 @@ export class HuiButtonCard extends LitElement implements LovelaceCard {
|
||||
hasDoubleClick: hasAction(this._config!.double_tap_action),
|
||||
})}
|
||||
role="button"
|
||||
aria-label=${this._config.name ||
|
||||
(stateObj ? computeStateName(stateObj) : "")}
|
||||
aria-label=${name}
|
||||
tabindex=${ifDefined(
|
||||
hasAction(this._config.tap_action) ? "0" : undefined
|
||||
)}
|
||||
|
@@ -272,7 +272,6 @@ export class HuiTileCard extends LitElement implements LovelaceCard {
|
||||
.stateObj=${stateObj}
|
||||
.hass=${this.hass}
|
||||
.content=${this._config.state_content}
|
||||
.name=${name}
|
||||
>
|
||||
</state-display>
|
||||
`;
|
||||
|
@@ -5,7 +5,7 @@ import {
|
||||
mdiDelete,
|
||||
mdiDeleteSweep,
|
||||
mdiDotsVertical,
|
||||
mdiDrag,
|
||||
mdiDragHorizontalVariant,
|
||||
mdiPlus,
|
||||
mdiSort,
|
||||
} from "@mdi/js";
|
||||
@@ -522,7 +522,7 @@ export class HuiTodoListCard extends LitElement implements LovelaceCard {
|
||||
"ui.panel.lovelace.cards.todo-list.drag_and_drop"
|
||||
)}
|
||||
class="reorderButton handle"
|
||||
.path=${mdiDrag}
|
||||
.path=${mdiDragHorizontalVariant}
|
||||
slot="meta"
|
||||
>
|
||||
</ha-svg-icon>
|
||||
|
@@ -4,6 +4,7 @@ import {
|
||||
type EntityNameItem,
|
||||
} from "../../../../common/entity/compute_entity_name_display";
|
||||
import type { HomeAssistant } from "../../../../types";
|
||||
import { ensureArray } from "../../../../common/array/ensure-array";
|
||||
|
||||
/**
|
||||
* Computes the display name for an entity in Lovelace (cards and badges).
|
||||
@@ -15,9 +16,24 @@ import type { HomeAssistant } from "../../../../types";
|
||||
*/
|
||||
export const computeLovelaceEntityName = (
|
||||
hass: HomeAssistant,
|
||||
stateObj: HassEntity,
|
||||
stateObj: HassEntity | undefined,
|
||||
nameConfig: string | EntityNameItem | EntityNameItem[] | undefined
|
||||
): string =>
|
||||
typeof nameConfig === "string"
|
||||
? nameConfig
|
||||
: hass.formatEntityName(stateObj, nameConfig || DEFAULT_ENTITY_NAME);
|
||||
): string => {
|
||||
if (typeof nameConfig === "string") {
|
||||
return nameConfig;
|
||||
}
|
||||
const config = nameConfig || DEFAULT_ENTITY_NAME;
|
||||
if (stateObj) {
|
||||
return hass.formatEntityName(stateObj, config);
|
||||
}
|
||||
// If entity is not found, fall back to text parts in config
|
||||
// This allows for static names even when the entity is missing
|
||||
// e.g. for a card that doesn't require an entity
|
||||
const textParts = ensureArray(config)
|
||||
.filter((item) => item.type === "text")
|
||||
.map((item) => ("text" in item ? item.text : ""));
|
||||
if (textParts.length) {
|
||||
return textParts.join(" ");
|
||||
}
|
||||
return "";
|
||||
};
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { mdiClose, mdiDrag, mdiPencil } from "@mdi/js";
|
||||
import { mdiClose, mdiDragHorizontalVariant, mdiPencil } from "@mdi/js";
|
||||
import { css, html, LitElement, nothing } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import { repeat } from "lit/directives/repeat";
|
||||
@@ -66,7 +66,11 @@ export class HuiEntityEditor extends LitElement {
|
||||
|
||||
return html`
|
||||
<ha-md-list-item class="item">
|
||||
<ha-svg-icon class="handle" .path=${mdiDrag} slot="start"></ha-svg-icon>
|
||||
<ha-svg-icon
|
||||
class="handle"
|
||||
.path=${mdiDragHorizontalVariant}
|
||||
slot="start"
|
||||
></ha-svg-icon>
|
||||
|
||||
<div slot="headline" class="label">${primary}</div>
|
||||
${secondary
|
||||
@@ -152,7 +156,9 @@ export class HuiEntityEditor extends LitElement {
|
||||
(entityConf, index) => html`
|
||||
<div class="entity" data-entity-id=${entityConf.entity}>
|
||||
<div class="handle">
|
||||
<ha-svg-icon .path=${mdiDrag}></ha-svg-icon>
|
||||
<ha-svg-icon
|
||||
.path=${mdiDragHorizontalVariant}
|
||||
></ha-svg-icon>
|
||||
</div>
|
||||
<ha-entity-picker
|
||||
.hass=${this.hass}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { mdiDelete, mdiDrag, mdiPencil } from "@mdi/js";
|
||||
import { mdiDelete, mdiDragHorizontalVariant, mdiPencil } from "@mdi/js";
|
||||
import type { CSSResultGroup, TemplateResult } from "lit";
|
||||
import { LitElement, css, html } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
@@ -31,7 +31,7 @@ export class HuiSectionEditMode extends LitElement {
|
||||
<ha-svg-icon
|
||||
aria-hidden="true"
|
||||
class="handle"
|
||||
.path=${mdiDrag}
|
||||
.path=${mdiDragHorizontalVariant}
|
||||
></ha-svg-icon>
|
||||
<ha-icon-button
|
||||
.label=${this.hass.localize("ui.common.edit")}
|
||||
|
@@ -5,6 +5,7 @@ import { customElement, property, state } from "lit/decorators";
|
||||
import memoizeOne from "memoize-one";
|
||||
import { assert, assign, boolean, object, optional, string } from "superstruct";
|
||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||
import { DEFAULT_ENTITY_NAME } from "../../../../common/entity/compute_entity_name_display";
|
||||
import "../../../../components/ha-form/ha-form";
|
||||
import type {
|
||||
HaFormSchema,
|
||||
@@ -16,13 +17,14 @@ import type { ButtonCardConfig } from "../../cards/types";
|
||||
import type { LovelaceCardEditor } from "../../types";
|
||||
import { actionConfigStruct } from "../structs/action-struct";
|
||||
import { baseLovelaceCardConfig } from "../structs/base-card-struct";
|
||||
import { entityNameStruct } from "../structs/entity-name-struct";
|
||||
import { configElementStyle } from "./config-elements-style";
|
||||
|
||||
const cardConfigStruct = assign(
|
||||
baseLovelaceCardConfig,
|
||||
object({
|
||||
entity: optional(string()),
|
||||
name: optional(string()),
|
||||
name: optional(entityNameStruct),
|
||||
show_name: optional(boolean()),
|
||||
icon: optional(string()),
|
||||
show_icon: optional(boolean()),
|
||||
@@ -68,7 +70,13 @@ export class HuiButtonCardEditor
|
||||
(entityId: string | undefined) =>
|
||||
[
|
||||
{ name: "entity", selector: { entity: {} } },
|
||||
{ name: "name", selector: { text: {} } },
|
||||
{
|
||||
name: "name",
|
||||
selector: {
|
||||
entity_name: { default_name: DEFAULT_ENTITY_NAME },
|
||||
},
|
||||
context: { entity: "entity" },
|
||||
},
|
||||
{
|
||||
name: "",
|
||||
type: "grid",
|
||||
|
@@ -1,4 +1,9 @@
|
||||
import { mdiDelete, mdiDrag, mdiPencil, mdiPlus } from "@mdi/js";
|
||||
import {
|
||||
mdiDelete,
|
||||
mdiDragHorizontalVariant,
|
||||
mdiPencil,
|
||||
mdiPlus,
|
||||
} from "@mdi/js";
|
||||
import { LitElement, css, html, nothing } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import { repeat } from "lit/directives/repeat";
|
||||
@@ -345,7 +350,9 @@ export class HuiCardFeaturesEditor extends LitElement {
|
||||
return html`
|
||||
<div class="feature">
|
||||
<div class="handle">
|
||||
<ha-svg-icon .path=${mdiDrag}></ha-svg-icon>
|
||||
<ha-svg-icon
|
||||
.path=${mdiDragHorizontalVariant}
|
||||
></ha-svg-icon>
|
||||
</div>
|
||||
<div class="feature-content">
|
||||
<div>
|
||||
|
@@ -1,5 +1,10 @@
|
||||
import "@material/mwc-menu/mwc-menu-surface";
|
||||
import { mdiDelete, mdiDrag, mdiPencil, mdiPlus } from "@mdi/js";
|
||||
import {
|
||||
mdiDelete,
|
||||
mdiDragHorizontalVariant,
|
||||
mdiPencil,
|
||||
mdiPlus,
|
||||
} from "@mdi/js";
|
||||
import type { ComboBoxLightOpenedChangedEvent } from "@vaadin/combo-box/vaadin-combo-box-light";
|
||||
import { LitElement, css, html, nothing } from "lit";
|
||||
import { customElement, property, query, state } from "lit/decorators";
|
||||
@@ -86,7 +91,9 @@ export class HuiHeadingBadgesEditor extends LitElement {
|
||||
return html`
|
||||
<div class="badge">
|
||||
<div class="handle">
|
||||
<ha-svg-icon .path=${mdiDrag}></ha-svg-icon>
|
||||
<ha-svg-icon
|
||||
.path=${mdiDragHorizontalVariant}
|
||||
></ha-svg-icon>
|
||||
</div>
|
||||
<div class="badge-content">
|
||||
<span>${label}</span>
|
||||
|
@@ -13,6 +13,7 @@ import {
|
||||
union,
|
||||
} from "superstruct";
|
||||
import { fireEvent } from "../../../../common/dom/fire_event";
|
||||
import { DEFAULT_ENTITY_NAME } from "../../../../common/entity/compute_entity_name_display";
|
||||
import type { LocalizeFunc } from "../../../../common/translations/localize";
|
||||
import "../../../../components/ha-expansion-panel";
|
||||
import "../../../../components/ha-form/ha-form";
|
||||
@@ -27,6 +28,7 @@ import type { LovelaceGenericElementEditor } from "../../types";
|
||||
import "../conditions/ha-card-conditions-editor";
|
||||
import { configElementStyle } from "../config-elements/config-elements-style";
|
||||
import { actionConfigStruct } from "../structs/action-struct";
|
||||
import { entityNameStruct } from "../structs/entity-name-struct";
|
||||
|
||||
export const DEFAULT_CONFIG: Partial<EntityHeadingBadgeConfig> = {
|
||||
type: "entity",
|
||||
@@ -37,7 +39,7 @@ export const DEFAULT_CONFIG: Partial<EntityHeadingBadgeConfig> = {
|
||||
const entityConfigStruct = object({
|
||||
type: optional(string()),
|
||||
entity: optional(string()),
|
||||
name: optional(string()),
|
||||
name: optional(entityNameStruct),
|
||||
icon: optional(string()),
|
||||
state_content: optional(union([string(), array(string())])),
|
||||
show_state: optional(boolean()),
|
||||
@@ -92,8 +94,11 @@ export class HuiHeadingEntityEditor
|
||||
{
|
||||
name: "name",
|
||||
selector: {
|
||||
text: {},
|
||||
entity_name: {
|
||||
default_name: DEFAULT_ENTITY_NAME,
|
||||
},
|
||||
},
|
||||
context: { entity: "entity" },
|
||||
},
|
||||
{
|
||||
name: "icon",
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { mdiClose, mdiDrag, mdiPencil } from "@mdi/js";
|
||||
import { mdiClose, mdiDragHorizontalVariant, mdiPencil } from "@mdi/js";
|
||||
import { LitElement, css, html, nothing } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import { repeat } from "lit/directives/repeat";
|
||||
@@ -59,7 +59,7 @@ export class HuiEntitiesCardRowEditor extends LitElement {
|
||||
(entityConf, index) => html`
|
||||
<div class="entity">
|
||||
<div class="handle">
|
||||
<ha-svg-icon .path=${mdiDrag}></ha-svg-icon>
|
||||
<ha-svg-icon .path=${mdiDragHorizontalVariant}></ha-svg-icon>
|
||||
</div>
|
||||
${entityConf.type
|
||||
? html`
|
||||
|
@@ -7,7 +7,6 @@ import memoizeOne from "memoize-one";
|
||||
import { computeCssColor } from "../../../common/color/compute-color";
|
||||
import { hsv2rgb, rgb2hex, rgb2hsv } from "../../../common/color/convert-color";
|
||||
import { computeDomain } from "../../../common/entity/compute_domain";
|
||||
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||
import { stateActive } from "../../../common/entity/state_active";
|
||||
import { stateColorCss } from "../../../common/entity/state_color";
|
||||
import "../../../components/ha-heading-badge";
|
||||
@@ -16,6 +15,7 @@ import type { ActionHandlerEvent } from "../../../data/lovelace/action_handler";
|
||||
import "../../../state-display/state-display";
|
||||
import type { HomeAssistant } from "../../../types";
|
||||
import { actionHandler } from "../common/directives/action-handler-directive";
|
||||
import { computeLovelaceEntityName } from "../common/entity/compute-lovelace-entity-name";
|
||||
import { handleAction } from "../common/handle-action";
|
||||
import { hasAction } from "../common/has-action";
|
||||
import { DEFAULT_CONFIG } from "../editor/heading-badge-editor/hui-entity-heading-badge-editor";
|
||||
@@ -137,7 +137,11 @@ export class HuiEntityHeadingBadge
|
||||
"--icon-color": color,
|
||||
};
|
||||
|
||||
const name = config.name || computeStateName(stateObj);
|
||||
const name = computeLovelaceEntityName(
|
||||
this.hass,
|
||||
stateObj,
|
||||
this._config.name
|
||||
);
|
||||
|
||||
return html`
|
||||
<ha-heading-badge
|
||||
@@ -166,7 +170,7 @@ export class HuiEntityHeadingBadge
|
||||
.hass=${this.hass}
|
||||
.stateObj=${stateObj}
|
||||
.content=${config.state_content}
|
||||
.name=${config.name}
|
||||
.name=${name}
|
||||
dash-unavailable
|
||||
></state-display>
|
||||
`
|
||||
|
@@ -72,8 +72,7 @@ import {
|
||||
} from "../../dialogs/quick-bar/show-dialog-quick-bar";
|
||||
import { showShortcutsDialog } from "../../dialogs/shortcuts/show-shortcuts-dialog";
|
||||
import { showVoiceCommandDialog } from "../../dialogs/voice-command-dialog/show-ha-voice-command-dialog";
|
||||
import { ViewTransitionMixin } from "../../mixins/view-transition-mixin";
|
||||
import { haStyle, haStyleViewTransitions } from "../../resources/styles";
|
||||
import { haStyle } from "../../resources/styles";
|
||||
import type { HomeAssistant, PanelInfo } from "../../types";
|
||||
import { documentationUrl } from "../../util/documentation-url";
|
||||
import { showToast } from "../../util/toast";
|
||||
@@ -115,7 +114,7 @@ interface SubActionItem {
|
||||
}
|
||||
|
||||
@customElement("hui-root")
|
||||
class HUIRoot extends ViewTransitionMixin(LitElement) {
|
||||
class HUIRoot extends LitElement {
|
||||
@property({ attribute: false }) public panel?: PanelInfo<LovelacePanelConfig>;
|
||||
|
||||
@property({ attribute: false }) public hass!: HomeAssistant;
|
||||
@@ -131,8 +130,6 @@ class HUIRoot extends ViewTransitionMixin(LitElement) {
|
||||
|
||||
@state() private _curView?: number | "hass-unused-entities";
|
||||
|
||||
@state() private _loaded = false;
|
||||
|
||||
private _viewCache?: Record<string, HUIView>;
|
||||
|
||||
private _viewScrollPositions: Record<string, number> = {};
|
||||
@@ -156,10 +153,6 @@ class HUIRoot extends ViewTransitionMixin(LitElement) {
|
||||
);
|
||||
}
|
||||
|
||||
protected onLoadTransition(): void {
|
||||
this._loaded = true;
|
||||
}
|
||||
|
||||
private _renderActionItems(): TemplateResult {
|
||||
const result: TemplateResult[] = [];
|
||||
if (this._editMode) {
|
||||
@@ -397,11 +390,14 @@ class HUIRoot extends ViewTransitionMixin(LitElement) {
|
||||
<ha-button-menu slot="actionItems">
|
||||
<ha-icon-button
|
||||
slot="trigger"
|
||||
.label=${this.hass!.localize("ui.panel.lovelace.editor.menu.open")}
|
||||
id="dashboardmenu"
|
||||
.path=${mdiDotsVertical}
|
||||
></ha-icon-button>
|
||||
${listItems}
|
||||
</ha-button-menu>
|
||||
<ha-tooltip placement="bottom" for="dashboardmenu">
|
||||
${this.hass!.localize("ui.panel.lovelace.editor.menu.open")}
|
||||
</ha-tooltip>
|
||||
`);
|
||||
}
|
||||
return html`${result}`;
|
||||
@@ -500,7 +496,6 @@ class HUIRoot extends ViewTransitionMixin(LitElement) {
|
||||
class=${classMap({
|
||||
"edit-mode": this._editMode,
|
||||
narrow: this.narrow,
|
||||
loading: !this._loaded,
|
||||
})}
|
||||
>
|
||||
<div class="header">
|
||||
@@ -1170,45 +1165,43 @@ class HUIRoot extends ViewTransitionMixin(LitElement) {
|
||||
// Recreate a new element to clear the applied themes.
|
||||
const root = this._viewRoot;
|
||||
|
||||
this.startViewTransition(() => {
|
||||
if (root.lastChild) {
|
||||
root.removeChild(root.lastChild);
|
||||
}
|
||||
if (root.lastChild) {
|
||||
root.removeChild(root.lastChild);
|
||||
}
|
||||
|
||||
if (viewIndex === "hass-unused-entities") {
|
||||
const unusedEntities = document.createElement("hui-unused-entities");
|
||||
// Wait for promise to resolve so that the element has been upgraded.
|
||||
import("./editor/unused-entities/hui-unused-entities").then(() => {
|
||||
unusedEntities.hass = this.hass!;
|
||||
unusedEntities.lovelace = this.lovelace!;
|
||||
unusedEntities.narrow = this.narrow;
|
||||
});
|
||||
root.appendChild(unusedEntities);
|
||||
return;
|
||||
}
|
||||
if (viewIndex === "hass-unused-entities") {
|
||||
const unusedEntities = document.createElement("hui-unused-entities");
|
||||
// Wait for promise to resolve so that the element has been upgraded.
|
||||
import("./editor/unused-entities/hui-unused-entities").then(() => {
|
||||
unusedEntities.hass = this.hass!;
|
||||
unusedEntities.lovelace = this.lovelace!;
|
||||
unusedEntities.narrow = this.narrow;
|
||||
});
|
||||
root.appendChild(unusedEntities);
|
||||
return;
|
||||
}
|
||||
|
||||
let view;
|
||||
const viewConfig = this.config.views[viewIndex];
|
||||
let view;
|
||||
const viewConfig = this.config.views[viewIndex];
|
||||
|
||||
if (!viewConfig) {
|
||||
this.lovelace!.setEditMode(true);
|
||||
return;
|
||||
}
|
||||
if (!viewConfig) {
|
||||
this.lovelace!.setEditMode(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!force && this._viewCache![viewIndex]) {
|
||||
view = this._viewCache![viewIndex];
|
||||
} else {
|
||||
view = document.createElement("hui-view");
|
||||
view.index = viewIndex;
|
||||
this._viewCache![viewIndex] = view;
|
||||
}
|
||||
if (!force && this._viewCache![viewIndex]) {
|
||||
view = this._viewCache![viewIndex];
|
||||
} else {
|
||||
view = document.createElement("hui-view");
|
||||
view.index = viewIndex;
|
||||
this._viewCache![viewIndex] = view;
|
||||
}
|
||||
|
||||
view.lovelace = this.lovelace;
|
||||
view.hass = this.hass;
|
||||
view.narrow = this.narrow;
|
||||
view.lovelace = this.lovelace;
|
||||
view.hass = this.hass;
|
||||
view.narrow = this.narrow;
|
||||
|
||||
root.appendChild(view);
|
||||
});
|
||||
root.appendChild(view);
|
||||
}
|
||||
|
||||
private _openShortcutDialog(ev: Event) {
|
||||
@@ -1219,21 +1212,12 @@ class HUIRoot extends ViewTransitionMixin(LitElement) {
|
||||
static get styles(): CSSResultGroup {
|
||||
return [
|
||||
haStyle,
|
||||
haStyleViewTransitions,
|
||||
css`
|
||||
:host {
|
||||
-ms-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
-moz-user-select: none;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
::view-transition-new(hui-root-container) {
|
||||
animation: fade-in var(--ha-animation-layout-duration) ease-out;
|
||||
animation-delay: var(--ha-animation-layout-delay-base);
|
||||
}
|
||||
}
|
||||
|
||||
.header {
|
||||
background-color: var(--app-header-background-color);
|
||||
color: var(--app-header-text-color, white);
|
||||
@@ -1422,10 +1406,6 @@ class HUIRoot extends ViewTransitionMixin(LitElement) {
|
||||
padding-right: var(--safe-area-inset-right);
|
||||
padding-inline-end: var(--safe-area-inset-right);
|
||||
padding-bottom: var(--safe-area-inset-bottom);
|
||||
view-transition-name: hui-root-container;
|
||||
}
|
||||
.loading hui-view-container {
|
||||
opacity: 0;
|
||||
}
|
||||
.narrow hui-view-container {
|
||||
padding-left: var(--safe-area-inset-left);
|
||||
@@ -1434,7 +1414,6 @@ class HUIRoot extends ViewTransitionMixin(LitElement) {
|
||||
hui-view-container > * {
|
||||
flex: 1 1 100%;
|
||||
max-width: 100%;
|
||||
view-transition-name: layout-fade-in;
|
||||
}
|
||||
/**
|
||||
* In edit mode we have the tab bar on a new line *
|
||||
|
@@ -3,13 +3,11 @@ import { computeStateName } from "../../../../../common/entity/compute_state_nam
|
||||
import type { EntityFilterFunc } from "../../../../../common/entity/entity_filter";
|
||||
import { generateEntityFilter } from "../../../../../common/entity/entity_filter";
|
||||
import { stripPrefixFromEntityName } from "../../../../../common/entity/strip_prefix_from_entity_name";
|
||||
import {
|
||||
orderCompare,
|
||||
stringCompare,
|
||||
} from "../../../../../common/string/compare";
|
||||
import { orderCompare } from "../../../../../common/string/compare";
|
||||
import type { AreaRegistryEntry } from "../../../../../data/area_registry";
|
||||
import { areaCompare } from "../../../../../data/area_registry";
|
||||
import type { FloorRegistryEntry } from "../../../../../data/floor_registry";
|
||||
import { floorCompare } from "../../../../../data/floor_registry";
|
||||
import type { LovelaceCardConfig } from "../../../../../data/lovelace/config/card";
|
||||
import type { HomeAssistant } from "../../../../../types";
|
||||
import { supportsAlarmModesCardFeature } from "../../../card-features/hui-alarm-modes-card-feature";
|
||||
@@ -304,18 +302,11 @@ export const getFloors = (
|
||||
floorsOrder?: string[]
|
||||
): FloorRegistryEntry[] => {
|
||||
const floors = Object.values(entries);
|
||||
const compare = orderCompare(floorsOrder || []);
|
||||
const compare = floorCompare(entries, floorsOrder);
|
||||
|
||||
return floors.sort((floorA, floorB) => {
|
||||
const order = compare(floorA.floor_id, floorB.floor_id);
|
||||
if (order !== 0) {
|
||||
return order;
|
||||
}
|
||||
if (floorA.level !== floorB.level) {
|
||||
return (floorA.level ?? 0) - (floorB.level ?? 0);
|
||||
}
|
||||
return stringCompare(floorA.name, floorB.name);
|
||||
});
|
||||
return floors.sort((floorA, floorB) =>
|
||||
compare(floorA.floor_id, floorB.floor_id)
|
||||
);
|
||||
};
|
||||
|
||||
export const computeAreaPath = (areaId: string): string => `areas-${areaId}`;
|
||||
|
@@ -135,7 +135,6 @@ export class HomeMainViewStrategy extends ReactiveElement {
|
||||
const commonControlsSection = {
|
||||
strategy: {
|
||||
type: "common-controls",
|
||||
title: hass.localize("ui.panel.lovelace.strategy.home.common_controls"),
|
||||
limit: maxCommonControls,
|
||||
include_entities: favoriteEntities,
|
||||
hide_empty: true,
|
||||
|
@@ -1,8 +1,12 @@
|
||||
import { css, LitElement, nothing } from "lit";
|
||||
import type { PropertyValues } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import { customElement, property, state } from "lit/decorators";
|
||||
import type { HomeAssistant } from "../../../types";
|
||||
import type { LovelaceViewBackgroundConfig } from "../../../data/lovelace/config/view";
|
||||
import {
|
||||
isMediaSourceContentId,
|
||||
resolveMediaSource,
|
||||
} from "../../../data/media_source";
|
||||
|
||||
@customElement("hui-view-background")
|
||||
export class HUIViewBackground extends LitElement {
|
||||
@@ -13,10 +17,27 @@ export class HUIViewBackground extends LitElement {
|
||||
| LovelaceViewBackgroundConfig
|
||||
| undefined;
|
||||
|
||||
@state({ attribute: false }) resolvedImage?: string;
|
||||
|
||||
protected render() {
|
||||
return nothing;
|
||||
}
|
||||
|
||||
private _fetchMedia() {
|
||||
const backgroundImage =
|
||||
typeof this.background === "string"
|
||||
? this.background
|
||||
: this.background?.image;
|
||||
|
||||
if (backgroundImage && isMediaSourceContentId(backgroundImage)) {
|
||||
resolveMediaSource(this.hass, backgroundImage).then((result) => {
|
||||
this.resolvedImage = result.url;
|
||||
});
|
||||
} else {
|
||||
this.resolvedImage = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
private _applyTheme() {
|
||||
const computedStyles = getComputedStyle(this);
|
||||
const themeBackground = computedStyles.getPropertyValue(
|
||||
@@ -52,13 +73,19 @@ export class HUIViewBackground extends LitElement {
|
||||
background?: string | LovelaceViewBackgroundConfig
|
||||
) {
|
||||
if (typeof background === "object" && background.image) {
|
||||
if (isMediaSourceContentId(background.image) && !this.resolvedImage) {
|
||||
return null;
|
||||
}
|
||||
const alignment = background.alignment ?? "center";
|
||||
const size = background.size ?? "cover";
|
||||
const repeat = background.repeat ?? "no-repeat";
|
||||
return `${alignment} / ${size} ${repeat} url('${this.hass.hassUrl(background.image)}')`;
|
||||
return `${alignment} / ${size} ${repeat} url('${this.hass.hassUrl(this.resolvedImage || background.image)}')`;
|
||||
}
|
||||
if (typeof background === "string") {
|
||||
return background;
|
||||
if (isMediaSourceContentId(background) && !this.resolvedImage) {
|
||||
return null;
|
||||
}
|
||||
return this.resolvedImage || background;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -90,6 +117,10 @@ export class HUIViewBackground extends LitElement {
|
||||
|
||||
if (changedProperties.has("background")) {
|
||||
this._applyTheme();
|
||||
this._fetchMedia();
|
||||
}
|
||||
if (changedProperties.has("resolvedImage")) {
|
||||
this._applyTheme();
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -199,56 +199,3 @@ export const baseEntrypointStyles = css`
|
||||
width: 100vw;
|
||||
}
|
||||
`;
|
||||
|
||||
export const haStyleViewTransitions = css`
|
||||
@keyframes fade-in {
|
||||
from {
|
||||
opacity: 0;
|
||||
}
|
||||
to {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes fade-out {
|
||||
from {
|
||||
opacity: 1;
|
||||
}
|
||||
to {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
/* Prevent root cross-fade during view transitions (pseudo-element) */
|
||||
::view-transition-old(root) {
|
||||
animation: none;
|
||||
}
|
||||
::view-transition-new(root) {
|
||||
animation: none;
|
||||
}
|
||||
|
||||
/* Elements leaving the view (loading screen) */
|
||||
::view-transition-group(layout-fade-out) {
|
||||
animation-duration: var(--ha-animation-layout-duration);
|
||||
animation-timing-function: ease-out;
|
||||
}
|
||||
::view-transition-old(layout-fade-out) {
|
||||
animation: fade-out var(--ha-animation-layout-duration) ease-out;
|
||||
}
|
||||
::view-transition-new(layout-fade-out) {
|
||||
animation: none;
|
||||
}
|
||||
|
||||
/* New content entering (panels, subpages)
|
||||
Uses base delay to be less abrupt and allow for elements to render */
|
||||
::view-transition-group(layout-fade-in) {
|
||||
animation-duration: var(--ha-animation-layout-duration);
|
||||
animation-timing-function: ease-out;
|
||||
}
|
||||
::view-transition-new(layout-fade-in) {
|
||||
animation: fade-in var(--ha-animation-layout-duration) ease-out;
|
||||
animation-delay: var(--ha-animation-layout-delay-base);
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
@@ -155,7 +155,6 @@ export const semanticColorStyles = css`
|
||||
|
||||
/* Surfaces */
|
||||
--ha-color-surface-default: var(--ha-color-neutral-95);
|
||||
--ha-color-on-surface-default: var(--ha-color-neutral-05);
|
||||
}
|
||||
`;
|
||||
|
||||
@@ -287,6 +286,5 @@ export const darkSemanticColorStyles = css`
|
||||
|
||||
/* Surfaces */
|
||||
--ha-color-surface-default: var(--ha-color-neutral-10);
|
||||
--ha-color-on-surface-default: var(--ha-color-neutral-95);
|
||||
}
|
||||
`;
|
||||
|
@@ -42,17 +42,6 @@ export const coreStyles = css`
|
||||
--ha-space-18: 72px;
|
||||
--ha-space-19: 76px;
|
||||
--ha-space-20: 80px;
|
||||
|
||||
/* Animation timing */
|
||||
--ha-animation-layout-duration: 350ms;
|
||||
--ha-animation-layout-delay-base: 100ms;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
html {
|
||||
--ha-animation-layout-duration: 0ms;
|
||||
--ha-animation-layout-delay-base: 0ms;
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
|
@@ -5,7 +5,6 @@ import { customElement, property } from "lit/decorators";
|
||||
import { join } from "lit/directives/join";
|
||||
import { ensureArray } from "../common/array/ensure-array";
|
||||
import { computeStateDomain } from "../common/entity/compute_state_domain";
|
||||
import { computeStateName } from "../common/entity/compute_state_name";
|
||||
import "../components/ha-relative-time";
|
||||
import { isUnavailableState } from "../data/entity";
|
||||
import { SENSOR_DEVICE_CLASS_TIMESTAMP } from "../data/sensor";
|
||||
@@ -100,8 +99,8 @@ class StateDisplay extends LitElement {
|
||||
|
||||
return this.hass!.formatEntityState(stateObj);
|
||||
}
|
||||
if (content === "name") {
|
||||
return html`${this.name || computeStateName(stateObj)}`;
|
||||
if (content === "name" && this.name) {
|
||||
return html`${this.name}`;
|
||||
}
|
||||
|
||||
let relativeDateTime: string | Date | undefined;
|
||||
|
@@ -3455,12 +3455,17 @@
|
||||
"require_admin": "Admin only",
|
||||
"sidebar": "In sidebar",
|
||||
"filename": "Filename",
|
||||
"url": "Open"
|
||||
"url": "Open",
|
||||
"type": "Type"
|
||||
},
|
||||
"open": "Open",
|
||||
"edit": "Edit",
|
||||
"delete": "Delete",
|
||||
"add_dashboard": "Add dashboard"
|
||||
"add_dashboard": "Add dashboard",
|
||||
"type": {
|
||||
"user_created": "User created",
|
||||
"built_in": "Built-in"
|
||||
}
|
||||
},
|
||||
"confirm_delete_title": "Delete {dashboard_title}?",
|
||||
"confirm_delete_text": "This dashboard will be permanently deleted.",
|
||||
@@ -6924,8 +6929,7 @@
|
||||
"areas": "Areas",
|
||||
"other_areas": "Other areas",
|
||||
"unamed_device": "Unnamed device",
|
||||
"others": "Others",
|
||||
"common_controls": "Commonly used"
|
||||
"others": "Others"
|
||||
},
|
||||
"common_controls": {
|
||||
"not_loaded": "Usage Prediction integration is not loaded.",
|
||||
|
@@ -3,20 +3,7 @@ import { render } from "lit";
|
||||
|
||||
export const removeLaunchScreen = () => {
|
||||
const launchScreenElement = document.getElementById("ha-launch-screen");
|
||||
if (!launchScreenElement) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Use View Transition API if available and user doesn't prefer reduced motion
|
||||
if (
|
||||
document.startViewTransition &&
|
||||
!window.matchMedia("(prefers-reduced-motion: reduce)").matches
|
||||
) {
|
||||
document.startViewTransition(() => {
|
||||
launchScreenElement.parentElement!.removeChild(launchScreenElement);
|
||||
});
|
||||
} else {
|
||||
// Fallback: Direct removal without transition
|
||||
if (launchScreenElement) {
|
||||
launchScreenElement.parentElement!.removeChild(launchScreenElement);
|
||||
}
|
||||
};
|
||||
|
@@ -24,10 +24,16 @@ describe("absoluteTime", () => {
|
||||
|
||||
it("should format date correctly for same year", () => {
|
||||
const from = new Date();
|
||||
from.setUTCMonth(9, 20);
|
||||
from.setUTCHours(13, 23);
|
||||
const result = absoluteTime(from, locale, config);
|
||||
expect(result).toBe("Oct 20, 13:23");
|
||||
if (from.getUTCMonth() === 9 && from.getUTCDate() === 20) {
|
||||
from.setUTCMonth(10, 20);
|
||||
const result = absoluteTime(from, locale, config);
|
||||
expect(result).toBe("Nov 20, 13:23");
|
||||
} else {
|
||||
from.setUTCMonth(9, 20);
|
||||
const result = absoluteTime(from, locale, config);
|
||||
expect(result).toBe("Oct 20, 13:23");
|
||||
}
|
||||
});
|
||||
|
||||
it("should format date with year correctly", () => {
|
||||
|
116
test/data/floor_registry.test.ts
Normal file
116
test/data/floor_registry.test.ts
Normal file
@@ -0,0 +1,116 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { floorCompare } from "../../src/data/floor_registry";
|
||||
import type { FloorRegistryEntry } from "../../src/data/floor_registry";
|
||||
|
||||
describe("floorCompare", () => {
|
||||
describe("floorCompare()", () => {
|
||||
it("sorts by floor ID alphabetically", () => {
|
||||
const floors = ["basement", "attic", "ground"];
|
||||
|
||||
expect(floors.sort(floorCompare())).toEqual([
|
||||
"attic",
|
||||
"basement",
|
||||
"ground",
|
||||
]);
|
||||
});
|
||||
|
||||
it("handles numeric strings in natural order", () => {
|
||||
const floors = ["floor10", "floor2", "floor1"];
|
||||
|
||||
expect(floors.sort(floorCompare())).toEqual([
|
||||
"floor1",
|
||||
"floor2",
|
||||
"floor10",
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("floorCompare(entries)", () => {
|
||||
it("sorts by level, then by name", () => {
|
||||
const entries = {
|
||||
floor1: { name: "Ground Floor", level: 0 } as FloorRegistryEntry,
|
||||
floor2: { name: "First Floor", level: 1 } as FloorRegistryEntry,
|
||||
floor3: { name: "Basement", level: -1 } as FloorRegistryEntry,
|
||||
};
|
||||
const floors = ["floor1", "floor2", "floor3"];
|
||||
|
||||
expect(floors.sort(floorCompare(entries))).toEqual([
|
||||
"floor3",
|
||||
"floor1",
|
||||
"floor2",
|
||||
]);
|
||||
});
|
||||
|
||||
it("treats null level as 9999, placing it at the end", () => {
|
||||
const entries = {
|
||||
floor1: { name: "Ground Floor", level: 0 } as FloorRegistryEntry,
|
||||
floor2: { name: "First Floor", level: 1 } as FloorRegistryEntry,
|
||||
floor3: { name: "Unassigned", level: null } as FloorRegistryEntry,
|
||||
};
|
||||
const floors = ["floor2", "floor3", "floor1"];
|
||||
|
||||
expect(floors.sort(floorCompare(entries))).toEqual([
|
||||
"floor1",
|
||||
"floor2",
|
||||
"floor3",
|
||||
]);
|
||||
});
|
||||
|
||||
it("sorts by name when levels are equal", () => {
|
||||
const entries = {
|
||||
floor1: { name: "Suite B", level: 1 } as FloorRegistryEntry,
|
||||
floor2: { name: "Suite A", level: 1 } as FloorRegistryEntry,
|
||||
};
|
||||
const floors = ["floor1", "floor2"];
|
||||
|
||||
expect(floors.sort(floorCompare(entries))).toEqual(["floor2", "floor1"]);
|
||||
});
|
||||
|
||||
it("falls back to floor ID when entry not found", () => {
|
||||
const entries = {
|
||||
floor1: { name: "Ground Floor" } as FloorRegistryEntry,
|
||||
};
|
||||
const floors = ["xyz", "floor1", "abc"];
|
||||
|
||||
expect(floors.sort(floorCompare(entries))).toEqual([
|
||||
"abc",
|
||||
"floor1",
|
||||
"xyz",
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
describe("floorCompare(entries, order)", () => {
|
||||
it("follows order array", () => {
|
||||
const entries = {
|
||||
basement: { name: "Basement" } as FloorRegistryEntry,
|
||||
ground: { name: "Ground Floor" } as FloorRegistryEntry,
|
||||
first: { name: "First Floor" } as FloorRegistryEntry,
|
||||
};
|
||||
const order = ["first", "ground", "basement"];
|
||||
const floors = ["basement", "first", "ground"];
|
||||
|
||||
expect(floors.sort(floorCompare(entries, order))).toEqual([
|
||||
"first",
|
||||
"ground",
|
||||
"basement",
|
||||
]);
|
||||
});
|
||||
|
||||
it("places items not in order array at the end, sorted by name", () => {
|
||||
const entries = {
|
||||
floor1: { name: "First Floor" } as FloorRegistryEntry,
|
||||
floor2: { name: "Ground Floor" } as FloorRegistryEntry,
|
||||
floor3: { name: "Basement" } as FloorRegistryEntry,
|
||||
};
|
||||
const order = ["floor1"];
|
||||
const floors = ["floor3", "floor2", "floor1"];
|
||||
|
||||
expect(floors.sort(floorCompare(entries, order))).toEqual([
|
||||
"floor1",
|
||||
"floor3",
|
||||
"floor2",
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
@@ -77,4 +77,71 @@ describe("computeLovelaceEntityName", () => {
|
||||
expect(mockFormatEntityName).toHaveBeenCalledTimes(1);
|
||||
expect(mockFormatEntityName).toHaveBeenCalledWith(stateObj, nameConfig);
|
||||
});
|
||||
|
||||
describe("when stateObj is undefined", () => {
|
||||
it("returns empty string when nameConfig is undefined", () => {
|
||||
const mockFormatEntityName = vi.fn();
|
||||
const hass = createMockHass(mockFormatEntityName);
|
||||
|
||||
const result = computeLovelaceEntityName(hass, undefined, undefined);
|
||||
|
||||
expect(result).toBe("");
|
||||
expect(mockFormatEntityName).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("returns text from single text EntityNameItem", () => {
|
||||
const mockFormatEntityName = vi.fn();
|
||||
const hass = createMockHass(mockFormatEntityName);
|
||||
const nameConfig = { type: "text" as const, text: "Custom Text" };
|
||||
|
||||
const result = computeLovelaceEntityName(hass, undefined, nameConfig);
|
||||
|
||||
expect(result).toBe("Custom Text");
|
||||
expect(mockFormatEntityName).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("returns joined text from multiple text EntityNameItems", () => {
|
||||
const mockFormatEntityName = vi.fn();
|
||||
const hass = createMockHass(mockFormatEntityName);
|
||||
const nameConfig = [
|
||||
{ type: "text" as const, text: "First" },
|
||||
{ type: "text" as const, text: "Second" },
|
||||
];
|
||||
|
||||
const result = computeLovelaceEntityName(hass, undefined, nameConfig);
|
||||
|
||||
expect(result).toBe("First Second");
|
||||
expect(mockFormatEntityName).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("returns only text items when mixed with non-text items", () => {
|
||||
const mockFormatEntityName = vi.fn();
|
||||
const hass = createMockHass(mockFormatEntityName);
|
||||
const nameConfig = [
|
||||
{ type: "text" as const, text: "Prefix" },
|
||||
{ type: "device" as const },
|
||||
{ type: "text" as const, text: "Suffix" },
|
||||
{ type: "entity" as const },
|
||||
];
|
||||
|
||||
const result = computeLovelaceEntityName(hass, undefined, nameConfig);
|
||||
|
||||
expect(result).toBe("Prefix Suffix");
|
||||
expect(mockFormatEntityName).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("returns empty string when no text items in config", () => {
|
||||
const mockFormatEntityName = vi.fn();
|
||||
const hass = createMockHass(mockFormatEntityName);
|
||||
const nameConfig = [
|
||||
{ type: "device" as const },
|
||||
{ type: "entity" as const },
|
||||
];
|
||||
|
||||
const result = computeLovelaceEntityName(hass, undefined, nameConfig);
|
||||
|
||||
expect(result).toBe("");
|
||||
expect(mockFormatEntityName).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
308
yarn.lock
308
yarn.lock
@@ -1284,15 +1284,15 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@codemirror/view@npm:6.38.5, @codemirror/view@npm:^6.0.0, @codemirror/view@npm:^6.17.0, @codemirror/view@npm:^6.23.0, @codemirror/view@npm:^6.27.0":
|
||||
version: 6.38.5
|
||||
resolution: "@codemirror/view@npm:6.38.5"
|
||||
"@codemirror/view@npm:6.38.6, @codemirror/view@npm:^6.0.0, @codemirror/view@npm:^6.17.0, @codemirror/view@npm:^6.23.0, @codemirror/view@npm:^6.27.0":
|
||||
version: 6.38.6
|
||||
resolution: "@codemirror/view@npm:6.38.6"
|
||||
dependencies:
|
||||
"@codemirror/state": "npm:^6.5.0"
|
||||
crelt: "npm:^1.0.6"
|
||||
style-mod: "npm:^4.1.0"
|
||||
w3c-keyname: "npm:^2.2.4"
|
||||
checksum: 10/2335b593770042eb3adfe369073432b07cd2d15f1e230ae4dc7be7a7b8edd74e57c13e59b92a11e7e5d59ae030aabf7f55478dfec1cf2a2fe3a1ef3f091676a4
|
||||
checksum: 10/5a047337a98de111817ce8c8d39e6429c90ca0b0a4d2678d6e161e9e5961b1d476a891f447ab7a05cac395d4a93530e7c68bedd93191285265f0742a308ad00b
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -1942,9 +1942,9 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@home-assistant/webawesome@npm:3.0.0-beta.6.ha.4":
|
||||
version: 3.0.0-beta.6.ha.4
|
||||
resolution: "@home-assistant/webawesome@npm:3.0.0-beta.6.ha.4"
|
||||
"@home-assistant/webawesome@npm:3.0.0-beta.6.ha.5":
|
||||
version: 3.0.0-beta.6.ha.5
|
||||
resolution: "@home-assistant/webawesome@npm:3.0.0-beta.6.ha.5"
|
||||
dependencies:
|
||||
"@ctrl/tinycolor": "npm:4.1.0"
|
||||
"@floating-ui/dom": "npm:^1.6.13"
|
||||
@@ -1955,7 +1955,7 @@ __metadata:
|
||||
lit: "npm:^3.2.1"
|
||||
nanoid: "npm:^5.1.5"
|
||||
qr-creator: "npm:^1.0.0"
|
||||
checksum: 10/d9072b321126ef458468ed2cf040e0b04cb2aff73336c6e742c0cfb25d9fb674b7672e7c9abcf5bcb0aa0b2fe953c20186f0910f485024c827bfe4cf399f10a4
|
||||
checksum: 10/6bfa5e06b91df06402c348bc19ec59a7fe6ed70080989d60a3c6519f99f5dc72da8b42c5dc2cad9d1ab211c51c4c67a74c0e22f21368da3c9f2565cbf8646a90
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -2286,19 +2286,19 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@lezer/common@npm:^1.0.0, @lezer/common@npm:^1.1.0":
|
||||
version: 1.2.3
|
||||
resolution: "@lezer/common@npm:1.2.3"
|
||||
checksum: 10/dad24e353e4e67d88b203191361ca1dff26c01c2b7b4ae829b668a1d115929334d077217367683e39180c0556510ed2066ea8ddba2b079be7c08a7152208cc87
|
||||
"@lezer/common@npm:^1.0.0, @lezer/common@npm:^1.1.0, @lezer/common@npm:^1.3.0":
|
||||
version: 1.3.0
|
||||
resolution: "@lezer/common@npm:1.3.0"
|
||||
checksum: 10/8e195a8e426bc18d4339b3f2a1a7ad39c3b2cfa740c7108657a241985f63bdee5255a5f5cf8d863b878881744288bcb679d16170f0e5bcebb141188b53cfd8c0
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@lezer/highlight@npm:1.2.1, @lezer/highlight@npm:^1.0.0":
|
||||
version: 1.2.1
|
||||
resolution: "@lezer/highlight@npm:1.2.1"
|
||||
"@lezer/highlight@npm:1.2.2, @lezer/highlight@npm:^1.0.0":
|
||||
version: 1.2.2
|
||||
resolution: "@lezer/highlight@npm:1.2.2"
|
||||
dependencies:
|
||||
"@lezer/common": "npm:^1.0.0"
|
||||
checksum: 10/fec3082419ee87fb265039b680fbac6796f862d8e3042dcb860e8c5a34291503a74927302b568ff1a626f0d2b5cf8dae02a51cfd200084eb329e5fd1236c3163
|
||||
"@lezer/common": "npm:^1.3.0"
|
||||
checksum: 10/73cb339de042b354cbc0b9e83978a91d2448435edae865a192cfc50d536e0b7d2e3cd563aabeb59eb6c86b0c38b3edc6f2871da8482c5dd8dca4a0899e743f7f
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -2374,10 +2374,10 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@lokalise/node-api@npm:15.3.0":
|
||||
version: 15.3.0
|
||||
resolution: "@lokalise/node-api@npm:15.3.0"
|
||||
checksum: 10/a90cdc8524f78ac0c6a16f3bfc742a39a0449f19da9ba5a100f233310de205483c901b0279fc21dd810c5fd13f931c67300ffc0b1a6f8403c857939346bd0875
|
||||
"@lokalise/node-api@npm:15.3.1":
|
||||
version: 15.3.1
|
||||
resolution: "@lokalise/node-api@npm:15.3.1"
|
||||
checksum: 10/9175559660cfbde3f6451ee0ade96ca5ccf6686f3a8f07a23ae6abf3a58db5b5dc71683cdb7f19252765250df7b77dc67539a80e24c3b44a1a97bb2f2d9cd090
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -3918,83 +3918,83 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@rsdoctor/client@npm:1.3.2":
|
||||
version: 1.3.2
|
||||
resolution: "@rsdoctor/client@npm:1.3.2"
|
||||
checksum: 10/cc6d82453976e3231c141231b474043eb8e55beae2266742993019888934a66b839173374eec5af1374970c31b6e0ac67171031e35ac0c246b2e73b2f0d46c60
|
||||
"@rsdoctor/client@npm:1.3.3":
|
||||
version: 1.3.3
|
||||
resolution: "@rsdoctor/client@npm:1.3.3"
|
||||
checksum: 10/2982a8bf7da99d6e82401195b90becfdb3b2ca929fc0c36136a142fb272bd824847c95cdc2bc7e0071b12136a6654dbb2a60327becd8a6d17c29f13412fafb8c
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@rsdoctor/core@npm:1.3.2":
|
||||
version: 1.3.2
|
||||
resolution: "@rsdoctor/core@npm:1.3.2"
|
||||
"@rsdoctor/core@npm:1.3.3":
|
||||
version: 1.3.3
|
||||
resolution: "@rsdoctor/core@npm:1.3.3"
|
||||
dependencies:
|
||||
"@rsbuild/plugin-check-syntax": "npm:1.4.0"
|
||||
"@rsdoctor/graph": "npm:1.3.2"
|
||||
"@rsdoctor/sdk": "npm:1.3.2"
|
||||
"@rsdoctor/types": "npm:1.3.2"
|
||||
"@rsdoctor/utils": "npm:1.3.2"
|
||||
"@rsdoctor/graph": "npm:1.3.3"
|
||||
"@rsdoctor/sdk": "npm:1.3.3"
|
||||
"@rsdoctor/types": "npm:1.3.3"
|
||||
"@rsdoctor/utils": "npm:1.3.3"
|
||||
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"
|
||||
lodash: "npm:^4.17.21"
|
||||
semver: "npm:^7.7.3"
|
||||
source-map: "npm:^0.7.6"
|
||||
checksum: 10/56f3fb3b12250bdc4140b50f6681b768475d014e243ca892f35f072153a292f63f014d38f6715d1b58707f93950b5f9109c823c9eb8f33c55475922eda765cc2
|
||||
checksum: 10/5b38a784b8b1805867c4fd7b8167c47e0b3e4db0fa2ea7b35f1c1dde34602deb6c77e3a8f86dec8757fa568c95ec4dc9466c3754a65580bd15ad28abfbcda858
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@rsdoctor/graph@npm:1.3.2":
|
||||
version: 1.3.2
|
||||
resolution: "@rsdoctor/graph@npm:1.3.2"
|
||||
"@rsdoctor/graph@npm:1.3.3":
|
||||
version: 1.3.3
|
||||
resolution: "@rsdoctor/graph@npm:1.3.3"
|
||||
dependencies:
|
||||
"@rsdoctor/types": "npm:1.3.2"
|
||||
"@rsdoctor/utils": "npm:1.3.2"
|
||||
"@rsdoctor/types": "npm:1.3.3"
|
||||
"@rsdoctor/utils": "npm:1.3.3"
|
||||
lodash.unionby: "npm:^4.8.0"
|
||||
path-browserify: "npm:1.0.1"
|
||||
source-map: "npm:^0.7.6"
|
||||
checksum: 10/ecdb653e603656bac1715383d968e544349294db4082cf094b138501650ceac24c3037f27c503e7507e7419199f559e3628cc4aa5091c753a48e88960a9ded61
|
||||
checksum: 10/d125fda326554bde644f5dcebc1c17ddef8a80748cd40ab75bbaac8d415aaa19b6c659b33880748eb02c639afb2b5c72abd9ad0c229ee50d9e11f81839ae54be
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@rsdoctor/rspack-plugin@npm:1.3.2":
|
||||
version: 1.3.2
|
||||
resolution: "@rsdoctor/rspack-plugin@npm:1.3.2"
|
||||
"@rsdoctor/rspack-plugin@npm:1.3.3":
|
||||
version: 1.3.3
|
||||
resolution: "@rsdoctor/rspack-plugin@npm:1.3.3"
|
||||
dependencies:
|
||||
"@rsdoctor/core": "npm:1.3.2"
|
||||
"@rsdoctor/graph": "npm:1.3.2"
|
||||
"@rsdoctor/sdk": "npm:1.3.2"
|
||||
"@rsdoctor/types": "npm:1.3.2"
|
||||
"@rsdoctor/utils": "npm:1.3.2"
|
||||
"@rsdoctor/core": "npm:1.3.3"
|
||||
"@rsdoctor/graph": "npm:1.3.3"
|
||||
"@rsdoctor/sdk": "npm:1.3.3"
|
||||
"@rsdoctor/types": "npm:1.3.3"
|
||||
"@rsdoctor/utils": "npm:1.3.3"
|
||||
lodash-es: "npm:^4.17.21"
|
||||
peerDependencies:
|
||||
"@rspack/core": "*"
|
||||
peerDependenciesMeta:
|
||||
"@rspack/core":
|
||||
optional: true
|
||||
checksum: 10/b9d1feb6448a3004b34d2c3f77db62dfa4207ba6bf576fb92c3e0ceb55e35795d175662970e3dd2c4b8b324302579e987581e9112dfd7d54f27b5a3f0d29d4c5
|
||||
checksum: 10/866294ad3ab35ec8940d1a96cafca92bc474c5b25fa13026538de625b7945eac735a86534b4d4d67f301d38efa07a1fde4430e9c24c58e8c9f0df71ab3c41d0b
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@rsdoctor/sdk@npm:1.3.2":
|
||||
version: 1.3.2
|
||||
resolution: "@rsdoctor/sdk@npm:1.3.2"
|
||||
"@rsdoctor/sdk@npm:1.3.3":
|
||||
version: 1.3.3
|
||||
resolution: "@rsdoctor/sdk@npm:1.3.3"
|
||||
dependencies:
|
||||
"@rsdoctor/client": "npm:1.3.2"
|
||||
"@rsdoctor/graph": "npm:1.3.2"
|
||||
"@rsdoctor/types": "npm:1.3.2"
|
||||
"@rsdoctor/utils": "npm:1.3.2"
|
||||
"@rsdoctor/client": "npm:1.3.3"
|
||||
"@rsdoctor/graph": "npm:1.3.3"
|
||||
"@rsdoctor/types": "npm:1.3.3"
|
||||
"@rsdoctor/utils": "npm:1.3.3"
|
||||
safer-buffer: "npm:2.1.2"
|
||||
socket.io: "npm:4.8.1"
|
||||
tapable: "npm:2.2.3"
|
||||
checksum: 10/06149043259b90d5bd5a0e8f19dfebbcf9f8e6b698c4bc67a49b28c939094797e7923455914cbc30512723f9dfe557a7d00cdf4bb07285c6e8f27679cab667b9
|
||||
checksum: 10/448e4be79c71a10efa0e6eecf79e6fb6b4d2819934f2b9b6f775efc3e856195cb77125e1d243626f862d9f8640bad5ace7a910c3fd3a30b108acba8018b67708
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@rsdoctor/types@npm:1.3.2":
|
||||
version: 1.3.2
|
||||
resolution: "@rsdoctor/types@npm:1.3.2"
|
||||
"@rsdoctor/types@npm:1.3.3":
|
||||
version: 1.3.3
|
||||
resolution: "@rsdoctor/types@npm:1.3.3"
|
||||
dependencies:
|
||||
"@types/connect": "npm:3.4.38"
|
||||
"@types/estree": "npm:1.0.5"
|
||||
@@ -4008,22 +4008,22 @@ __metadata:
|
||||
optional: true
|
||||
webpack:
|
||||
optional: true
|
||||
checksum: 10/168e59d0f8fa2cda7451746cc071bcddaadb69ce322c99eb730ab7004fe4dee57d52317f6f510020e65fe88045bab906a93d4732a43c53ef67b1cd2d6f889109
|
||||
checksum: 10/1292aa1732b2600bf7b4a5ffdc4b114bf52ec1dfc955b14da62524b38eaf86036eccd710071e5e1b2cf0ddce5297a7f5c36a0d84690a97e1a114271d7f56d5e6
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@rsdoctor/utils@npm:1.3.2":
|
||||
version: 1.3.2
|
||||
resolution: "@rsdoctor/utils@npm:1.3.2"
|
||||
"@rsdoctor/utils@npm:1.3.3":
|
||||
version: 1.3.3
|
||||
resolution: "@rsdoctor/utils@npm:1.3.3"
|
||||
dependencies:
|
||||
"@babel/code-frame": "npm:7.26.2"
|
||||
"@rsdoctor/types": "npm:1.3.2"
|
||||
"@rsdoctor/types": "npm:1.3.3"
|
||||
"@types/estree": "npm:1.0.5"
|
||||
acorn: "npm:^8.10.0"
|
||||
acorn-import-attributes: "npm:^1.9.5"
|
||||
acorn-walk: "npm:8.3.4"
|
||||
deep-eql: "npm:4.1.4"
|
||||
envinfo: "npm:7.14.0"
|
||||
envinfo: "npm:7.18.0"
|
||||
fs-extra: "npm:^11.1.1"
|
||||
get-port: "npm:5.1.1"
|
||||
json-stream-stringify: "npm:3.0.1"
|
||||
@@ -4031,7 +4031,7 @@ __metadata:
|
||||
picocolors: "npm:^1.1.1"
|
||||
rslog: "npm:^1.2.11"
|
||||
strip-ansi: "npm:^6.0.1"
|
||||
checksum: 10/f1523fd9906c42642e7af4904d7d9c74e1de8158905d54102f2ac939ec6a4f48122f552fa88a8aa7e6bdd19044066808844bb1f98fe0a3772f0dc0f4f2b5753a
|
||||
checksum: 10/d4e8801d21bd19956cc254f4311344726b1ec5ec5a6681b1574c8ddc1fa73a48d400483da4b6160193a0f87e27fd1aa2a2763b9c2064a136c0fd6fc5908480ba
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -4964,106 +4964,106 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/eslint-plugin@npm:8.46.0":
|
||||
version: 8.46.0
|
||||
resolution: "@typescript-eslint/eslint-plugin@npm:8.46.0"
|
||||
"@typescript-eslint/eslint-plugin@npm:8.46.1":
|
||||
version: 8.46.1
|
||||
resolution: "@typescript-eslint/eslint-plugin@npm:8.46.1"
|
||||
dependencies:
|
||||
"@eslint-community/regexpp": "npm:^4.10.0"
|
||||
"@typescript-eslint/scope-manager": "npm:8.46.0"
|
||||
"@typescript-eslint/type-utils": "npm:8.46.0"
|
||||
"@typescript-eslint/utils": "npm:8.46.0"
|
||||
"@typescript-eslint/visitor-keys": "npm:8.46.0"
|
||||
"@typescript-eslint/scope-manager": "npm:8.46.1"
|
||||
"@typescript-eslint/type-utils": "npm:8.46.1"
|
||||
"@typescript-eslint/utils": "npm:8.46.1"
|
||||
"@typescript-eslint/visitor-keys": "npm:8.46.1"
|
||||
graphemer: "npm:^1.4.0"
|
||||
ignore: "npm:^7.0.0"
|
||||
natural-compare: "npm:^1.4.0"
|
||||
ts-api-utils: "npm:^2.1.0"
|
||||
peerDependencies:
|
||||
"@typescript-eslint/parser": ^8.46.0
|
||||
"@typescript-eslint/parser": ^8.46.1
|
||||
eslint: ^8.57.0 || ^9.0.0
|
||||
typescript: ">=4.8.4 <6.0.0"
|
||||
checksum: 10/415afd894a5fec9cfe2c327c8b26377045979cc6bdf720aeecb32af335b9e6865c70fa6a355dd16f52a36dc38f50755df3eb1466d5822c53c80465ff824c9881
|
||||
checksum: 10/9fd8c279584e11c7dcfcac6dddc4dde8719f8fe79349f5a2d0473ffcee198dd543a5311b24c601228ae03cc1a47b29118261bcf45f7f697c8ba1e4289fda4096
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/parser@npm:8.46.0":
|
||||
version: 8.46.0
|
||||
resolution: "@typescript-eslint/parser@npm:8.46.0"
|
||||
"@typescript-eslint/parser@npm:8.46.1":
|
||||
version: 8.46.1
|
||||
resolution: "@typescript-eslint/parser@npm:8.46.1"
|
||||
dependencies:
|
||||
"@typescript-eslint/scope-manager": "npm:8.46.0"
|
||||
"@typescript-eslint/types": "npm:8.46.0"
|
||||
"@typescript-eslint/typescript-estree": "npm:8.46.0"
|
||||
"@typescript-eslint/visitor-keys": "npm:8.46.0"
|
||||
"@typescript-eslint/scope-manager": "npm:8.46.1"
|
||||
"@typescript-eslint/types": "npm:8.46.1"
|
||||
"@typescript-eslint/typescript-estree": "npm:8.46.1"
|
||||
"@typescript-eslint/visitor-keys": "npm:8.46.1"
|
||||
debug: "npm:^4.3.4"
|
||||
peerDependencies:
|
||||
eslint: ^8.57.0 || ^9.0.0
|
||||
typescript: ">=4.8.4 <6.0.0"
|
||||
checksum: 10/6838fde776fd2b2932b259a20cc89b517e0c94a2cfa363a5e8531095c23fb35d8f803196f6594026d0510bf2a8ec003c67181bb2c407904685a64c97602da65f
|
||||
checksum: 10/4edcb49bb001e9a0e72155c4181f941be00c603bf277c283d4185dca528e9642da927032e8d2671c444ca1904c7f51743029b4b48c12e94d39df2dac49d7d3ff
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/project-service@npm:8.46.0":
|
||||
version: 8.46.0
|
||||
resolution: "@typescript-eslint/project-service@npm:8.46.0"
|
||||
"@typescript-eslint/project-service@npm:8.46.1":
|
||||
version: 8.46.1
|
||||
resolution: "@typescript-eslint/project-service@npm:8.46.1"
|
||||
dependencies:
|
||||
"@typescript-eslint/tsconfig-utils": "npm:^8.46.0"
|
||||
"@typescript-eslint/types": "npm:^8.46.0"
|
||||
"@typescript-eslint/tsconfig-utils": "npm:^8.46.1"
|
||||
"@typescript-eslint/types": "npm:^8.46.1"
|
||||
debug: "npm:^4.3.4"
|
||||
peerDependencies:
|
||||
typescript: ">=4.8.4 <6.0.0"
|
||||
checksum: 10/de11af23ae6b82769b667e8d6e81d47ce039c7817465b99c1e29c8fbcac58af898bebe70368a274cd7b3c7232354134d53ceba0415b8d7e18317037bc4a4a2f7
|
||||
checksum: 10/d63cbb88524be85ba626c4969bdec1cd5c1ab64b6ebdd565a45698e700efb764f192db1cdc3322f4d63d3acd8d0a36e2685b89bdfa2edf50fda3c2d0cb6efdd7
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/scope-manager@npm:8.46.0":
|
||||
version: 8.46.0
|
||||
resolution: "@typescript-eslint/scope-manager@npm:8.46.0"
|
||||
"@typescript-eslint/scope-manager@npm:8.46.1":
|
||||
version: 8.46.1
|
||||
resolution: "@typescript-eslint/scope-manager@npm:8.46.1"
|
||||
dependencies:
|
||||
"@typescript-eslint/types": "npm:8.46.0"
|
||||
"@typescript-eslint/visitor-keys": "npm:8.46.0"
|
||||
checksum: 10/ed85abd08c0edf088b1b11757c658acf593cf84051bddde651304a609d3a6cd9e331149e88653676606a565c3f92c191d4af049f540f6e3bb692a4f38305fd71
|
||||
"@typescript-eslint/types": "npm:8.46.1"
|
||||
"@typescript-eslint/visitor-keys": "npm:8.46.1"
|
||||
checksum: 10/3d73812087a17be84184cc68143d4dca7602b8cd4bf5ad334e541d4b3acf5c65c58935369dcf66ab81b38014fe0c6bc57ac2f655fdd69b3e24161a827b86bd34
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/tsconfig-utils@npm:8.46.0, @typescript-eslint/tsconfig-utils@npm:^8.46.0":
|
||||
version: 8.46.0
|
||||
resolution: "@typescript-eslint/tsconfig-utils@npm:8.46.0"
|
||||
"@typescript-eslint/tsconfig-utils@npm:8.46.1, @typescript-eslint/tsconfig-utils@npm:^8.46.1":
|
||||
version: 8.46.1
|
||||
resolution: "@typescript-eslint/tsconfig-utils@npm:8.46.1"
|
||||
peerDependencies:
|
||||
typescript: ">=4.8.4 <6.0.0"
|
||||
checksum: 10/e78a66a854322423aca835070c5ee9489975c4d80d2f8ffe9cf4d6e3f67a1646ddc05b086f7156599c90ad521670ca572a4315f2b49a5922c33d6e49723558e4
|
||||
checksum: 10/f033d68a53f62c7cc4c09e5697dd9b7fa34a3c3e79133e0b14ca582821869b77e81d3942b91535f6ef789ffaaad31eef1e1ace20518e7de0935a55a16120fae7
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/type-utils@npm:8.46.0":
|
||||
version: 8.46.0
|
||||
resolution: "@typescript-eslint/type-utils@npm:8.46.0"
|
||||
"@typescript-eslint/type-utils@npm:8.46.1":
|
||||
version: 8.46.1
|
||||
resolution: "@typescript-eslint/type-utils@npm:8.46.1"
|
||||
dependencies:
|
||||
"@typescript-eslint/types": "npm:8.46.0"
|
||||
"@typescript-eslint/typescript-estree": "npm:8.46.0"
|
||||
"@typescript-eslint/utils": "npm:8.46.0"
|
||||
"@typescript-eslint/types": "npm:8.46.1"
|
||||
"@typescript-eslint/typescript-estree": "npm:8.46.1"
|
||||
"@typescript-eslint/utils": "npm:8.46.1"
|
||||
debug: "npm:^4.3.4"
|
||||
ts-api-utils: "npm:^2.1.0"
|
||||
peerDependencies:
|
||||
eslint: ^8.57.0 || ^9.0.0
|
||||
typescript: ">=4.8.4 <6.0.0"
|
||||
checksum: 10/5405b71b91d02ed4eac1028fc156c053953403b9f48393d92340b15a8b05bee5bf1281324c6283ac31a0e03cc1a19baf94768cb3fd70b4621f8c07a4243837db
|
||||
checksum: 10/db989c1f55624b34da24eaf0dc230ee696a1f2a614ea95a8dd3b8635ad47d748140be2345ed7afcee844dfabd41129f5a8ca583b1a4d6ecc7d581f89c5e508e2
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/types@npm:8.46.0, @typescript-eslint/types@npm:^8.46.0":
|
||||
version: 8.46.0
|
||||
resolution: "@typescript-eslint/types@npm:8.46.0"
|
||||
checksum: 10/0118b0dd592bf4beaf41e8c6be812980dd0adea44d48c90d8b0272777b58d4cfd6326b8bc363efa3c640be476a6bf3632aee2d97052d5e34071e6576b9c28264
|
||||
"@typescript-eslint/types@npm:8.46.1, @typescript-eslint/types@npm:^8.46.1":
|
||||
version: 8.46.1
|
||||
resolution: "@typescript-eslint/types@npm:8.46.1"
|
||||
checksum: 10/d162ddf6d77d8c9bdfca942da5de5fb4ba80efa740b14077482b5a71282f1d05e1b1dd393ae810eb2923ca9c845bd26b4a9d2dbf25d43dd5d9cb6e20c2a1db46
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/typescript-estree@npm:8.46.0":
|
||||
version: 8.46.0
|
||||
resolution: "@typescript-eslint/typescript-estree@npm:8.46.0"
|
||||
"@typescript-eslint/typescript-estree@npm:8.46.1":
|
||||
version: 8.46.1
|
||||
resolution: "@typescript-eslint/typescript-estree@npm:8.46.1"
|
||||
dependencies:
|
||||
"@typescript-eslint/project-service": "npm:8.46.0"
|
||||
"@typescript-eslint/tsconfig-utils": "npm:8.46.0"
|
||||
"@typescript-eslint/types": "npm:8.46.0"
|
||||
"@typescript-eslint/visitor-keys": "npm:8.46.0"
|
||||
"@typescript-eslint/project-service": "npm:8.46.1"
|
||||
"@typescript-eslint/tsconfig-utils": "npm:8.46.1"
|
||||
"@typescript-eslint/types": "npm:8.46.1"
|
||||
"@typescript-eslint/visitor-keys": "npm:8.46.1"
|
||||
debug: "npm:^4.3.4"
|
||||
fast-glob: "npm:^3.3.2"
|
||||
is-glob: "npm:^4.0.3"
|
||||
@@ -5072,32 +5072,32 @@ __metadata:
|
||||
ts-api-utils: "npm:^2.1.0"
|
||||
peerDependencies:
|
||||
typescript: ">=4.8.4 <6.0.0"
|
||||
checksum: 10/61053bd0c35a1fe5c82aef00cb70dbe0878ab28e55550cc1e2d6e7d4a0520c81947eb7505227c85a742a93db905d7e7376aed7d958dc257507b9bdda1daf0b00
|
||||
checksum: 10/af068a14d6d0b4849e9f0e52b7ddcd24c266f099528c7b62ff2bebebc0fb82d07439bf6dc565b27cf2fed0af0aaae618aae220676d0fb041c93ec2a8163f0da1
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/utils@npm:8.46.0":
|
||||
version: 8.46.0
|
||||
resolution: "@typescript-eslint/utils@npm:8.46.0"
|
||||
"@typescript-eslint/utils@npm:8.46.1":
|
||||
version: 8.46.1
|
||||
resolution: "@typescript-eslint/utils@npm:8.46.1"
|
||||
dependencies:
|
||||
"@eslint-community/eslint-utils": "npm:^4.7.0"
|
||||
"@typescript-eslint/scope-manager": "npm:8.46.0"
|
||||
"@typescript-eslint/types": "npm:8.46.0"
|
||||
"@typescript-eslint/typescript-estree": "npm:8.46.0"
|
||||
"@typescript-eslint/scope-manager": "npm:8.46.1"
|
||||
"@typescript-eslint/types": "npm:8.46.1"
|
||||
"@typescript-eslint/typescript-estree": "npm:8.46.1"
|
||||
peerDependencies:
|
||||
eslint: ^8.57.0 || ^9.0.0
|
||||
typescript: ">=4.8.4 <6.0.0"
|
||||
checksum: 10/4e0da60de389799afdd36249fd4bcf9e085a4d6f119e241e436a701b45cdf10becc3f1e3cdef29ebbf147a81f40d9a4800d428cb4a66799d3e4aa80b879c9ee2
|
||||
checksum: 10/a8fed8aebd34a559c5abd780649edd6be632531e4930b19642f0fdc862b77bff463ef200e8ced48ba489c3fceee7443b6735c87b918b97b98e95e842cd8a38b5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@typescript-eslint/visitor-keys@npm:8.46.0":
|
||||
version: 8.46.0
|
||||
resolution: "@typescript-eslint/visitor-keys@npm:8.46.0"
|
||||
"@typescript-eslint/visitor-keys@npm:8.46.1":
|
||||
version: 8.46.1
|
||||
resolution: "@typescript-eslint/visitor-keys@npm:8.46.1"
|
||||
dependencies:
|
||||
"@typescript-eslint/types": "npm:8.46.0"
|
||||
"@typescript-eslint/types": "npm:8.46.1"
|
||||
eslint-visitor-keys: "npm:^4.2.1"
|
||||
checksum: 10/37e6145b6a5e960c59777d7fc86f722ff696e76c627106ac4577b945ca35744a5f96525d77bde50fe8c328503e9392e21e3adb7cf9899ae0efc054d63f4c3916
|
||||
checksum: 10/eed1c5ce08d2743bd2ec95a33f2118a67596b1b9fa5bf6a3d84ed09ca66e09af3cc91ef3e302c2222e5882e13576340532b586030b3652ce046eb218cd4508b7
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -7638,12 +7638,12 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"envinfo@npm:7.14.0":
|
||||
version: 7.14.0
|
||||
resolution: "envinfo@npm:7.14.0"
|
||||
"envinfo@npm:7.18.0":
|
||||
version: 7.18.0
|
||||
resolution: "envinfo@npm:7.18.0"
|
||||
bin:
|
||||
envinfo: dist/cli.js
|
||||
checksum: 10/0d9d711f2b6ae02dec89dd768a3390acbcb99ac50d07f20e635a8d2db68447703476db535483592d1ed4656c3d36eee4883032d71a5118c917b4973e2d4fa027
|
||||
checksum: 10/d08b27f39f8e562cc5b9ef202b1a20a05e9598f3f05ea2509d561c45989e1dc6bdea272bf55f552a178e2898c16fe49fb3808d41414c317bfac7c2389a466339
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -9255,7 +9255,7 @@ __metadata:
|
||||
"@codemirror/legacy-modes": "npm:6.5.2"
|
||||
"@codemirror/search": "npm:6.5.11"
|
||||
"@codemirror/state": "npm:6.5.2"
|
||||
"@codemirror/view": "npm:6.38.5"
|
||||
"@codemirror/view": "npm:6.38.6"
|
||||
"@date-fns/tz": "npm:1.4.1"
|
||||
"@egjs/hammerjs": "npm:2.0.17"
|
||||
"@formatjs/intl-datetimeformat": "npm:6.18.2"
|
||||
@@ -9273,14 +9273,14 @@ __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.4"
|
||||
"@lezer/highlight": "npm:1.2.1"
|
||||
"@home-assistant/webawesome": "npm:3.0.0-beta.6.ha.5"
|
||||
"@lezer/highlight": "npm:1.2.2"
|
||||
"@lit-labs/motion": "npm:1.0.9"
|
||||
"@lit-labs/observers": "npm:2.0.6"
|
||||
"@lit-labs/virtualizer": "npm:2.1.1"
|
||||
"@lit/context": "npm:1.1.6"
|
||||
"@lit/reactive-element": "npm:2.1.1"
|
||||
"@lokalise/node-api": "npm:15.3.0"
|
||||
"@lokalise/node-api": "npm:15.3.1"
|
||||
"@material/chips": "npm:=14.0.0-canary.53b3cad2f.0"
|
||||
"@material/data-table": "npm:=14.0.0-canary.53b3cad2f.0"
|
||||
"@material/mwc-base": "npm:0.27.0"
|
||||
@@ -9310,7 +9310,7 @@ __metadata:
|
||||
"@octokit/plugin-retry": "npm:8.0.2"
|
||||
"@octokit/rest": "npm:22.0.0"
|
||||
"@replit/codemirror-indentation-markers": "npm:6.5.3"
|
||||
"@rsdoctor/rspack-plugin": "npm:1.3.2"
|
||||
"@rsdoctor/rspack-plugin": "npm:1.3.3"
|
||||
"@rspack/core": "npm:1.5.8"
|
||||
"@rspack/dev-server": "npm:1.1.4"
|
||||
"@swc/helpers": "npm:0.5.17"
|
||||
@@ -9398,7 +9398,7 @@ __metadata:
|
||||
lodash.template: "npm:4.5.0"
|
||||
luxon: "npm:3.7.2"
|
||||
map-stream: "npm:0.0.7"
|
||||
marked: "npm:16.4.0"
|
||||
marked: "npm:16.4.1"
|
||||
memoize-one: "npm:6.0.0"
|
||||
node-vibrant: "npm:4.0.3"
|
||||
object-hash: "npm:3.0.0"
|
||||
@@ -9420,7 +9420,7 @@ __metadata:
|
||||
tinykeys: "npm:3.0.0"
|
||||
ts-lit-plugin: "npm:2.0.2"
|
||||
typescript: "npm:5.9.3"
|
||||
typescript-eslint: "npm:8.46.0"
|
||||
typescript-eslint: "npm:8.46.1"
|
||||
ua-parser-js: "npm:2.0.6"
|
||||
vite-tsconfig-paths: "npm:5.1.4"
|
||||
vitest: "npm:3.2.4"
|
||||
@@ -11052,12 +11052,12 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"marked@npm:16.4.0":
|
||||
version: 16.4.0
|
||||
resolution: "marked@npm:16.4.0"
|
||||
"marked@npm:16.4.1":
|
||||
version: 16.4.1
|
||||
resolution: "marked@npm:16.4.1"
|
||||
bin:
|
||||
marked: bin/marked.js
|
||||
checksum: 10/5174b345ccc61e2030c2eb8abb3e5cbebeb6697a6d2b609f64ffa2ff6e482f5f1e1fda1912db19c747f43971b1fa54ae53c1ab1ce5d2f58566d6db4bc3016833
|
||||
checksum: 10/b5f475dbe297162dc988b7f345b559d03248fde1023822b9f2a68f50cbca0981c78c42f380c3aa5e133b5f5c069a2c6cd683413c12c83710e983a7bc46cdf4a2
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -14395,18 +14395,18 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"typescript-eslint@npm:8.46.0":
|
||||
version: 8.46.0
|
||||
resolution: "typescript-eslint@npm:8.46.0"
|
||||
"typescript-eslint@npm:8.46.1":
|
||||
version: 8.46.1
|
||||
resolution: "typescript-eslint@npm:8.46.1"
|
||||
dependencies:
|
||||
"@typescript-eslint/eslint-plugin": "npm:8.46.0"
|
||||
"@typescript-eslint/parser": "npm:8.46.0"
|
||||
"@typescript-eslint/typescript-estree": "npm:8.46.0"
|
||||
"@typescript-eslint/utils": "npm:8.46.0"
|
||||
"@typescript-eslint/eslint-plugin": "npm:8.46.1"
|
||||
"@typescript-eslint/parser": "npm:8.46.1"
|
||||
"@typescript-eslint/typescript-estree": "npm:8.46.1"
|
||||
"@typescript-eslint/utils": "npm:8.46.1"
|
||||
peerDependencies:
|
||||
eslint: ^8.57.0 || ^9.0.0
|
||||
typescript: ">=4.8.4 <6.0.0"
|
||||
checksum: 10/fd74aab1d21d661299a64107236b5c3515d6d955eb1764b56c5c9505b8cef5f2600e8290d251f1379138333573df94a1fe1fd7fef23952b5ab9f12ff2b774f92
|
||||
checksum: 10/ba6914cc4006390908de9e3de295c2f7110461175a818608d198e2d1529e726c32d778fe9e224ea30464ba2c4a43c05f534d2dbc5aabf297354a2aa49a2e1cd6
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
Reference in New Issue
Block a user