Skip to content

Commit e5d4d97

Browse files
authored
Merge branch 'dev' into feat/addon-iframe-allow-mic-cam
2 parents 9b53a3f + 4728eb7 commit e5d4d97

40 files changed

Lines changed: 1396 additions & 526 deletions

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ jobs:
4141

4242
# Initializes the CodeQL tools for scanning.
4343
- name: Initialize CodeQL
44-
uses: github/codeql-action/init@e46ed2cbd01164d986452f91f178727624ae40d7 # v4.35.3
44+
uses: github/codeql-action/init@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4.35.4
4545
with:
4646
languages: ${{ matrix.language }}
4747

4848
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
4949
# If this step fails, then you should remove it and run the build manually (see below)
5050
- name: Autobuild
51-
uses: github/codeql-action/autobuild@e46ed2cbd01164d986452f91f178727624ae40d7 # v4.35.3
51+
uses: github/codeql-action/autobuild@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4.35.4
5252

5353
# ℹ️ Command-line programs to run using the OS shell.
5454
# 📚 https://git.io/JvXDl
@@ -62,4 +62,4 @@ jobs:
6262
# make release
6363

6464
- name: Perform CodeQL Analysis
65-
uses: github/codeql-action/analyze@e46ed2cbd01164d986452f91f178727624ae40d7 # v4.35.3
65+
uses: github/codeql-action/analyze@68bde559dea0fdcac2102bfdf6230c5f70eb485e # v4.35.4

.github/workflows/labeler.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Apply labels
13-
uses: actions/labeler@634933edcd8ababfe52f92936142cc22ac488b1b # v6.0.1
13+
uses: actions/labeler@f27b608878404679385c85cfa523b85ccb86e213 # v6.1.0
1414
with:
1515
sync-labels: true

.github/workflows/relative-ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919
steps:
2020
- name: Send bundle stats and build information to RelativeCI
21-
uses: relative-ci/agent-action@3c681926017930047fc03acaa35cd6a44efcbfc3 # v3.2.2
21+
uses: relative-ci/agent-action@fcf45416581928e8dd62eded78ce98c78e5149f8 # v3.2.3
2222
with:
2323
key: ${{ secrets.RELATIVE_CI_KEY_frontend_modern }}
2424
token: ${{ github.token }}
@@ -31,7 +31,7 @@ jobs:
3131
runs-on: ubuntu-latest
3232
steps:
3333
- name: Send bundle stats and build information to RelativeCI
34-
uses: relative-ci/agent-action@3c681926017930047fc03acaa35cd6a44efcbfc3 # v3.2.2
34+
uses: relative-ci/agent-action@fcf45416581928e8dd62eded78ce98c78e5149f8 # v3.2.3
3535
with:
3636
key: ${{ secrets.RELATIVE_CI_KEY_frontend_legacy }}
3737
token: ${{ github.token }}

.github/workflows/release-drafter.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ jobs:
1818
pull-requests: read
1919
runs-on: ubuntu-latest
2020
steps:
21-
- uses: release-drafter/release-drafter@563bf132657a13ded0b01fcb723c5a58cdd824e2 # v7.2.1
21+
- uses: release-drafter/release-drafter@c2e2804cc59f45f57076a99af580d0fedb697927 # v7.3.0
2222
env:
2323
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

package.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,18 @@
3737
"@codemirror/lint": "6.9.6",
3838
"@codemirror/search": "6.7.0",
3939
"@codemirror/state": "6.6.0",
40-
"@codemirror/view": "6.42.1",
40+
"@codemirror/view": "6.43.0",
4141
"@date-fns/tz": "1.4.1",
4242
"@egjs/hammerjs": "2.0.17",
43-
"@formatjs/intl-datetimeformat": "7.4.3",
44-
"@formatjs/intl-displaynames": "7.3.6",
45-
"@formatjs/intl-durationformat": "0.10.9",
46-
"@formatjs/intl-getcanonicallocales": "3.2.7",
47-
"@formatjs/intl-listformat": "8.3.6",
48-
"@formatjs/intl-locale": "5.3.6",
49-
"@formatjs/intl-numberformat": "9.3.6",
50-
"@formatjs/intl-pluralrules": "6.3.6",
51-
"@formatjs/intl-relativetimeformat": "12.3.6",
43+
"@formatjs/intl-datetimeformat": "7.4.5",
44+
"@formatjs/intl-displaynames": "7.3.7",
45+
"@formatjs/intl-durationformat": "0.10.11",
46+
"@formatjs/intl-getcanonicallocales": "3.2.8",
47+
"@formatjs/intl-listformat": "8.3.7",
48+
"@formatjs/intl-locale": "5.3.7",
49+
"@formatjs/intl-numberformat": "9.3.8",
50+
"@formatjs/intl-pluralrules": "6.3.7",
51+
"@formatjs/intl-relativetimeformat": "12.3.7",
5252
"@fullcalendar/core": "6.1.20",
5353
"@fullcalendar/daygrid": "6.1.20",
5454
"@fullcalendar/interaction": "6.1.20",
@@ -75,8 +75,8 @@
7575
"@replit/codemirror-indentation-markers": "6.5.3",
7676
"@swc/helpers": "0.5.21",
7777
"@thomasloven/round-slider": "0.6.0",
78-
"@tsparticles/engine": "3.9.1",
79-
"@tsparticles/preset-links": "3.2.0",
78+
"@tsparticles/engine": "4.0.0",
79+
"@tsparticles/preset-links": "4.0.0",
8080
"@vibrant/color": "4.0.4",
8181
"@webcomponents/scoped-custom-element-registry": "0.0.10",
8282
"@webcomponents/webcomponentsjs": "2.8.0",
@@ -99,13 +99,13 @@
9999
"hls.js": "1.6.16",
100100
"home-assistant-js-websocket": "9.6.0",
101101
"idb-keyval": "6.2.2",
102-
"intl-messageformat": "11.2.5",
102+
"intl-messageformat": "11.2.6",
103103
"js-yaml": "4.1.1",
104104
"leaflet": "1.9.4",
105105
"leaflet-draw": "patch:leaflet-draw@npm%3A1.0.4#./.yarn/patches/leaflet-draw-npm-1.0.4-0ca0ebcf65.patch",
106106
"leaflet.markercluster": "1.5.3",
107-
"lit": "3.3.2",
108-
"lit-html": "3.3.2",
107+
"lit": "3.3.3",
108+
"lit-html": "3.3.3",
109109
"luxon": "3.7.2",
110110
"marked": "18.0.3",
111111
"memoize-one": "6.0.0",
@@ -210,8 +210,8 @@
210210
"workbox-build": "patch:workbox-build@npm%3A7.4.1#~/.yarn/patches/workbox-build-npm-7.4.1-c84561662c.patch"
211211
},
212212
"resolutions": {
213-
"lit": "3.3.2",
214-
"lit-html": "3.3.2",
213+
"lit": "3.3.3",
214+
"lit-html": "3.3.3",
215215
"clean-css": "5.3.3",
216216
"@lit/reactive-element": "2.1.2",
217217
"@fullcalendar/daygrid": "6.1.20",
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import type {
2+
ReactiveController,
3+
ReactiveControllerHost,
4+
} from "@lit/reactive-element/reactive-controller";
5+
import type {
6+
Condition,
7+
ConditionContext,
8+
} from "../../panels/lovelace/common/validate-condition";
9+
import type { HomeAssistant } from "../../types";
10+
import { setupConditionListeners } from "../condition/listeners";
11+
12+
/**
13+
* Reactive controller that manages the media-query and time-based listeners
14+
* needed to keep a set of lovelace visibility conditions evaluated live.
15+
*
16+
* The host is responsible for the actual evaluation (e.g. computing visible /
17+
* hidden / invalid state); the controller only triggers it via the supplied
18+
* `onUpdate` callback when something the conditions depend on changes. Call
19+
* `setup()` whenever the conditions change; the controller clears previous
20+
* listeners and re-subscribes. Listeners are automatically released when the
21+
* host disconnects.
22+
*/
23+
export class ConditionListenersController implements ReactiveController {
24+
private _unsubs: (() => void)[] = [];
25+
26+
constructor(host: ReactiveControllerHost) {
27+
host.addController(this);
28+
}
29+
30+
public hostDisconnected(): void {
31+
this.clear();
32+
}
33+
34+
public setup(
35+
conditions: Condition[],
36+
hass: HomeAssistant,
37+
onUpdate: () => void,
38+
getContext?: () => ConditionContext
39+
): void {
40+
this.clear();
41+
if (!conditions.length) {
42+
return;
43+
}
44+
setupConditionListeners(
45+
conditions,
46+
hass,
47+
(unsub) => this._unsubs.push(unsub),
48+
() => onUpdate(),
49+
getContext
50+
);
51+
}
52+
53+
public clear(): void {
54+
for (const unsub of this._unsubs) {
55+
unsub();
56+
}
57+
this._unsubs = [];
58+
}
59+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
import { LitElement, css, html, nothing } from "lit";
2+
import { customElement, property } from "lit/decorators";
3+
import "../ha-tooltip";
4+
5+
export type LiveTestState = "pass" | "fail" | "invalid" | "unknown";
6+
7+
/**
8+
* @element ha-automation-row-live-test
9+
*
10+
* @summary
11+
* Small status indicator dot used in automation/condition rows to surface the
12+
* live evaluation result. Renders an optional tooltip with details on hover.
13+
*
14+
* @attr {"pass"|"fail"|"invalid"|"unknown"} state - The current live-test state. Defaults to `unknown`.
15+
* @attr {string} label - Accessible label announced by assistive technology.
16+
* @attr {string} message - Optional tooltip body shown on hover/focus.
17+
*/
18+
@customElement("ha-automation-row-live-test")
19+
export class HaAutomationRowLiveTest extends LitElement {
20+
@property({ reflect: true }) public state: LiveTestState = "unknown";
21+
22+
@property() public label = "";
23+
24+
@property() public message?: string;
25+
26+
protected render() {
27+
return html`
28+
<div
29+
id="indicator"
30+
role="status"
31+
tabindex="0"
32+
aria-label=${this.label}
33+
></div>
34+
${this.message
35+
? html`<ha-tooltip for="indicator">${this.message}</ha-tooltip>`
36+
: nothing}
37+
`;
38+
}
39+
40+
static styles = css`
41+
:host {
42+
position: absolute;
43+
inset-inline-end: -6px;
44+
display: inline-block;
45+
}
46+
#indicator {
47+
width: 12px;
48+
height: 12px;
49+
border-radius: var(--ha-border-radius-circle);
50+
border: 3px solid;
51+
box-sizing: border-box;
52+
background-color: var(--card-background-color);
53+
transition: all var(--ha-animation-duration-normal) ease-in-out;
54+
}
55+
:host([state="pass"]) #indicator {
56+
background-color: var(--ha-color-fill-success-loud-resting);
57+
border-color: var(--ha-color-fill-success-loud-resting);
58+
}
59+
:host([state="pass"]) #indicator:hover {
60+
background-color: var(--ha-color-fill-success-loud-hover);
61+
border-color: var(--ha-color-fill-success-loud-hover);
62+
}
63+
:host([state="fail"]) #indicator {
64+
border-color: var(--ha-color-fill-warning-loud-resting);
65+
}
66+
:host([state="fail"]) #indicator:hover {
67+
background-color: var(--ha-color-fill-warning-loud-hover);
68+
border-color: var(--ha-color-fill-warning-loud-hover);
69+
}
70+
:host([state="invalid"]) #indicator {
71+
border-color: var(--ha-color-fill-danger-loud-resting);
72+
}
73+
:host([state="invalid"]) #indicator:hover {
74+
background-color: var(--ha-color-fill-danger-loud-hover);
75+
border-color: var(--ha-color-fill-danger-loud-hover);
76+
}
77+
:host([state="unknown"]) #indicator {
78+
border-color: var(--ha-color-fill-neutral-loud-resting);
79+
}
80+
:host([state="unknown"]) #indicator:hover {
81+
background-color: var(--ha-color-fill-neutral-loud-hover);
82+
border-color: var(--ha-color-fill-neutral-loud-hover);
83+
}
84+
`;
85+
}
86+
87+
declare global {
88+
interface HTMLElementTagNameMap {
89+
"ha-automation-row-live-test": HaAutomationRowLiveTest;
90+
}
91+
}

src/components/chart/state-history-chart-line.ts

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import type { LineChartEntity, LineChartState } from "../../data/history";
1212
import type { HomeAssistant } from "../../types";
1313
import { MIN_TIME_BETWEEN_UPDATES } from "./ha-chart-base";
1414
import { sideTooltipPosition } from "./chart-tooltip-position";
15+
import { computeYAxisFractionDigits } from "./y-axis-fraction-digits";
1516
import type { ECOption } from "../../resources/echarts/echarts";
1617
import { formatDateTimeWithSeconds } from "../../common/datetime/format_date_time";
1718
import {
@@ -117,9 +118,7 @@ export class StateHistoryChartLine extends LitElement {
117118

118119
private _chartTime: Date = new Date();
119120

120-
private _previousYAxisLabelValue = 0;
121-
122-
private _yAxisMaximumFractionDigits = 0;
121+
private _yAxisFractionDigits = 1;
123122

124123
protected render() {
125124
return html`
@@ -436,6 +435,14 @@ export class StateHistoryChartLine extends LitElement {
436435
const datasets: LineSeriesOption[] = [];
437436
const entityIds: string[] = [];
438437
const datasetToDataIndex: number[] = [];
438+
let yMin = Infinity;
439+
let yMax = -Infinity;
440+
const trackY = (v: number | null | undefined) => {
441+
if (typeof v === "number" && Number.isFinite(v)) {
442+
if (v < yMin) yMin = v;
443+
if (v > yMax) yMax = v;
444+
}
445+
};
439446
if (entityStates.length === 0) {
440447
return;
441448
}
@@ -471,6 +478,7 @@ export class StateHistoryChartLine extends LitElement {
471478
d.data!.push([timestamp, prevValues[i]]);
472479
}
473480
d.data!.push([timestamp, datavalues[i]]);
481+
trackY(datavalues[i]);
474482
});
475483
prevValues = datavalues;
476484
};
@@ -821,13 +829,15 @@ export class StateHistoryChartLine extends LitElement {
821829
const currentValue = stateObj ? safeParseFloat(stateObj.state) : null;
822830
if (currentValue !== null) {
823831
data[0].data!.push([now, currentValue]);
832+
trackY(currentValue);
824833
}
825834
}
826835

827836
// Concat two arrays
828837
Array.prototype.push.apply(datasets, data);
829838
});
830839

840+
this._yAxisFractionDigits = computeYAxisFractionDigits(yMin, yMax);
831841
this._chartData = datasets;
832842
this._entityIds = entityIds;
833843
this._datasetToDataIndex = datasetToDataIndex;
@@ -861,20 +871,8 @@ export class StateHistoryChartLine extends LitElement {
861871
}
862872

863873
private _formatYAxisLabel = (value: number) => {
864-
// show the first significant digit for tiny values
865-
const maximumFractionDigits = Math.max(
866-
1,
867-
// use the difference to the previous value to determine the number of significant digits #25526
868-
-Math.floor(
869-
Math.log10(Math.abs(value - this._previousYAxisLabelValue || 1))
870-
)
871-
);
872-
this._yAxisMaximumFractionDigits = Math.max(
873-
this._yAxisMaximumFractionDigits,
874-
maximumFractionDigits
875-
);
876874
const label = formatNumber(value, this.hass.locale, {
877-
maximumFractionDigits: this._yAxisMaximumFractionDigits,
875+
maximumFractionDigits: this._yAxisFractionDigits,
878876
});
879877
const width = measureTextWidth(label, 12) + 5;
880878
if (width > this._yWidth) {
@@ -884,7 +882,6 @@ export class StateHistoryChartLine extends LitElement {
884882
chartIndex: this.chartIndex,
885883
});
886884
}
887-
this._previousYAxisLabelValue = value;
888885
return label;
889886
};
890887

0 commit comments

Comments
 (0)