Compare commits

..
Author SHA1 Message Date
WendelinandClaude Opus 5.5 22969613f3 Cap the view editor's code editor to the dialog height
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-30 15:06:10 +01:00
WendelinandClaude Opus 5.5 889f826009 Widen the dashboard editors in YAML mode
Switching to the code editor now makes the card, badge, section and
view editors as wide as the screen allows, animated like the enlarge
button. The card and badge editors enlarge as if the button was
pressed, so Shrink undoes it, and switching back restores the width
from before. On desktop the code editor is also at least 500px high,
so a short config no longer gives a wide but flat dialog.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-30 12:54:16 +01:00
renovate[bot]andPetar Petrov db9a56cd4b Update dependency barcode-detector to v3.2.5 (#56210)
* Update dependency barcode-detector to v3.2.5

* Remove type-fest license override

zxing-wasm 3.1.8 no longer depends on type-fest, so no production
dependency ships it and the pinned override fails the build.

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Petar Petrov <[email protected]>
2026-11-30 11:09:54 +01:00
WendelinandClaude Opus 5.5 dc874ffdb5 Size the section editor to its preview (#56263)
* Size the section editor to its preview

Clicking the title of the section editor made it fill the screen, but
nothing showed that this was possible. On desktop the dialog now takes
the width the preview needs next to the editor: wider for a section
spanning several columns in the desktop preview, narrower in the mobile
preview. The width animates when switching the preview or changing the
section width.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Treat a non-numeric section width as one column

A column span that isn't a whole number of at least one, like text in
YAML mode, made the desktop preview's dialog width invalid.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-30 10:04:33 +00:00
Paulus Schoutsen ef6a1222b2 Open restart confirmation directly after Marketplace integration updates (#56212)
* Open restart confirmation directly from Marketplace

* Call restart confirmation directly from Marketplace
2026-11-30 09:54:48 +01:00
renovate[bot]andPetar Petrov a25a643a31 Update dependency @vvo/tzdb to v6.208.0 (#56261)
* Update dependency @vvo/tzdb to v6.208.0

* Exclude @vvo/tzdb 6.208.0 from pnpm trust policy

6.208.0 lacks the trusted-publisher record that 6.205.0-6.207.0 carry,
but its provenance still points to vvo/tzdb's release workflow on main.

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Petar Petrov <[email protected]>
2026-11-30 09:33:10 +01:00
d7fbb1efac Use Marketplace icons for app install and uninstall (#56231)
The app info page now uses the same icons as the Marketplace:
mdiDownload for install and mdiDelete for uninstall. The previous
install icon filled its whole box and looked too large on the button.

Co-authored-by: Paulus Schoutsen <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-30 09:32:31 +01:00
Petar Petrov 4d643b7133 Open more-info from energy meter suggestion names (#56226)
* Open more-info from energy meter suggestion names

* Type the more-info handler's current target
2026-11-30 09:29:13 +01:00
Eduardo Moreno c196356d05 Fix thermostat and humidifier dial size when the entity appears after load (#56260)
In a sections view the grid sizes the card, so the host doesn't resize
when the entity appears and the warning is replaced by the control. The
ResizeController observed only the host, so its value stayed undefined
and the control got no max-width. Observe the .container element instead.
2026-11-30 09:44:25 +02:00
Jonathan DilksandClaude Opus 5.5 53d9395b44 Fix pause button size in narrow media control card (#56256)
A missing comma in the narrow-layout selector meant the pause and stop
buttons never got the larger play-button size, so the card changed
height when switching between play and pause.

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-30 09:16:38 +02:00
darkrain-nl dc031d0566 Keep the startup progress in view while the list scrolls (#56213) 2026-11-30 09:03:18 +02:00
renovate[bot] 893daa8333 Update github/codeql-action action to v4.39.4 (#56258)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-30 08:31:41 +02:00
renovate[bot] bbc67bb9d6 Update actions/dependency-review-action action to v5.0.1 (#56257)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-30 08:31:30 +02:00
renovate[bot] 48b56c4653 Update dependency @codemirror/view to v6.44.2 (#56255)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-30 06:08:52 +00:00
renovate[bot] 9dd88a24ce Update dependency tar to v7.5.24 (#56253)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-29 20:49:13 +02:00
renovate[bot] 963711b8fd Update dependency cally to v0.10.0 (#56251)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-29 18:10:16 +00:00
renovate[bot] 55b43df5b5 Update dependency vite to v8.4.0 (#56250)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-29 17:25:02 +02:00
renovate[bot] 0481cfdde3 Update dependency @rslib/core to v1.1.0 (#56248)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-29 14:27:47 +02:00
renovate[bot] 2ce8646318 Update dependency @codemirror/view to v6.44.1 (#56247)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-29 11:02:38 +00:00
Lazizbek Ergashev 459a48b51f Keep picture glance icons visible when tap action is none (#56239) 2026-11-29 08:39:40 +02:00
renovate[bot] c148beafd3 Update dependency @versatiles/style to v9.1.3 (#56241)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-29 08:34:46 +02:00
renovate[bot] 696c3fb093 Update dependency @vvo/tzdb to v6.207.0 (#56242)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-29 08:34:36 +02:00
Paulus Schoutsen 12008d3a06 Distinguish Marketplace dialog alert icons (#56235)
Use icons specific to the required Home Assistant update, built-in integration replacement, and GitHub connection. These notices can appear alongside another alert with the same severity.
2026-11-28 20:33:48 +02:00
Paulus Schoutsen a2179425e0 Remove duplicate Marketplace repository icons (#56230)
* Remove duplicate Marketplace restart icon

The status already shows the restart icon beside its text. Use the button label alone to identify the action.

* Remove other repeated Marketplace repository icons

Use text-only labels for Install, Update, and the Community links. A package icon denotes an available repository and a separate download-count icon distinguishes the metric from the Install action in repository menus.
2026-11-28 20:32:44 +02:00
Lazizbek Ergashev 261debd0d9 Translate the voice satellite setup dialog title (#56233) 2026-11-28 20:31:10 +02:00
renovate[bot] 9a7d6c2892 Update dependency @types/node to v24.19.4 (#56223)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-28 17:38:22 +02:00
Norbert Rittel 90d9e3e87a Clarify configuration warning when recreating entity IDs (#56221)
Clarify configuration warning when recreating Entity IDs
2026-11-28 17:30:57 +02:00
renovate[bot] 1490f8ff12 Update dependency @lezer/common to v1.5.7 (#56220)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-28 17:28:05 +02:00
renovate[bot] 2cb6974ab7 Update dependency @types/leaflet to v1.9.23 (#56222)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-28 17:27:25 +02:00
renovate[bot] 53abe40f72 Update vitest monorepo to v5.1.2 (#56228)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-28 17:25:31 +02:00
renovate[bot] 0a63f12c50 Update dependency @html-eslint/eslint-plugin to v0.69.0 (#56229)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-28 17:24:22 +02:00
renovate[bot] 8f0a6539ac Update CodeMirror (#56219)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-28 15:53:06 +02:00
darkrain-nl 31678bba2d Keep the startup details dialog at a fixed height (#56209) 2026-11-27 19:46:01 +01:00
Lazizbek Ergashev 3a9f461e46 Show Home Assistant Link as the title of the signed out Link page (#56205) 2026-11-27 14:37:26 +02:00
renovate[bot] 6198a100f0 Update dependency @rspack/core to v2.3.4 (#56201)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-27 14:22:51 +02:00
Petar Petrov 6517d24017 Show the device tooltip when hovering a name in the energy devices chart (#56200) 2026-11-27 11:08:59 +01:00
Petar Petrov 1343ac5bc2 Add a Dismiss all button to energy meter suggestions (#56198) 2026-11-27 10:38:12 +01:00
github-actions[bot]andpiitaya 133dd06b07 Update sensor entity constants (#56195)
Co-authored-by: piitaya <[email protected]>
2026-11-27 08:56:20 +02:00
Lazizbek Ergashev bbc4d57fe8 Only add the entity name to energy devices when it tells them apart (#56192)
* Only add the entity name to energy devices when it tells them apart

* Keep entity names for same-named devices with several meters

* Keep entity names when a custom name shares the device label
2026-11-27 08:40:36 +02:00
Jan-Philipp BeneckeandCopilot Autofix powered by AI 0d5588ae56 Use ha-control-select-menu for the run picker on the assist debug page (#56190)
* Use ha-control-select-menu for the run picker on the assist debug page

* Update min-width calculation for toolbar select menu

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
2026-11-27 08:35:21 +02:00
renovate[bot] 67d858b828 Update dependency marked to v18.3.0 (#56194)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-27 08:32:20 +02:00
renovate[bot] 95e00f1e36 Update dependency @versatiles/style to v9.1.2 (#56193)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-27 08:32:12 +02:00
WendelinandClaude Opus 5.5 01f9c5eb5b Add a button to enlarge the card and badge editors (#56186)
Replace the hidden title click with a visible button next to Help,
shown on desktop only. The width animates after a click and is not
animated when the code editor switches to full screen.

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-26 20:31:41 +02:00
renovate[bot] 40a28525fb Update dependency typescript-eslint to v8.74.0 (#56187)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-26 20:25:40 +02:00
f80deb0240 Timer progress bar tile card feature (#55994)
* Timer progress bar tile card feature

* Fix Copilot issues

Co-authored-by: Copilot Autofix powered by AI <[email protected]>

* Calculate remaining time only once

* Fix issues

* Switch willUpdate to update

* Update src/panels/lovelace/card-features/hui-timer-progress-card-feature.ts

Co-authored-by: Petar Petrov <[email protected]>

* Fix reduced motion

---------

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Petar Petrov <[email protected]>
2026-11-26 19:59:29 +02:00
WendelinandClaude Opus 5.5 68313876d3 Only offer the tab's categories in the Marketplace filter (#56183)
The integration category filter offered every category on every tab, so
on the installed tab a category nothing installed is in emptied the
table. It now lists the categories of the tab's repositories, and a
category picked on another tab that this one doesn't list is left out
here but kept for that tab, like statuses.

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-26 16:54:07 +01:00
Paul Bottein c3db90ae22 Swipe to open or close the tilt of tilt-only covers (#56182) 2026-11-26 16:52:38 +01:00
WendelinandClaude Opus 5.5 95e0988b93 Load Marketplace category icons only when they are shown (#56185)
The repository page loaded the integration category icons for every
repository, also for ones without integration categories. Load them once
a shown repository has categories, and only once per page.

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-26 16:08:31 +01:00
WendelinandClaude Opus 5.5 00312420d8 Remove clicking the title to enlarge the more info dialog (#56176)
Clicking the title of the more info dialog made it fill the screen, but
nothing showed that this was possible. For a camera it only added black
bars, since its info view already fits the picture. Cameras also no
longer open at the large width: their info view and the image's size the
dialog from the picture, and their other views are as wide as those of
any other entity. A large width passed by the caller still works.

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-26 15:24:20 +01:00
WendelinandClaude Opus 5.5 f2116b61fc Remove two marketplace tests that only cover helpers (#56184)
Follow-up to #55130 review: the empty integration_category link test only
covered the query param decoder, and the filtersOfTab category test only
covered a spread.

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-26 14:19:49 +00:00
Bram KragtenandClaude Opus 5.5 2e872965f6 Draw the slats of tilt-only covers from their state (#56173)
* Draw the slats of tilt-only covers from their state

A tilt-only cover that only reports open or closed, without a tilt
position, was always drawn with half open slats. When the cover can't
move up or down, its state describes the slats, so draw them at the
closed tilt position when closed and at the open tilt position when
open. Covers that also move up and down keep the neutral slats, as
their state describes the position.

Add tilt-only blinds, open and closed, to the cover more-info gallery.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Draw the slats from the state with the default tilt positions

Core only sends the open and closed tilt positions of covers that can
set their tilt position, so a tilt-only cover drawn from its state
always uses 0 and 100.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-26 15:19:19 +01:00
Paul Bottein cbf745f38a Fix rows value bubble cut off in the card size editor (#56181) 2026-11-26 15:02:14 +01:00
WendelinandClaude Opus 5.5 fe7cedd04b Make the image more info as wide as its picture fits (#56141)
* Make the image more info as wide as its picture fits

The more info of an image was always 1024px wide. Like the camera, the
dialog now takes the width the picture needs to be as high as there is
room for, between 580px and 1920px, but never wider than the picture
itself, so small images keep the standard width. Images no longer open
at the large width before their picture is loaded. The camera's aspect
ratio event becomes media-size-changed, with an optional natural width,
and the dialog forgets the size whenever the entity changes, also when
going to a related entity or back.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Keep the image size for cached views and leave room for the safe area

A picture that finished loading while the info view was detached by
cache() couldn't send its size, and it doesn't load again when the view
is shown, so more-info-image sends the size again when it's reattached.
The picture's height now also leaves out the safe area, like the
dialog's height limit, and the image info's bottom padding that grows
with it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-26 13:39:58 +02:00
Paul Bottein 2e9d8a1788 Fix integration names and toast overlap in startup details (#56147)
* Fix integration names and toast overlap in startup details

* Track startup details opened from the completion toast
2026-11-26 12:24:41 +01:00
Martin Salinas 332d612956 Give the tile icon's action its whole 48px area again (#56150)
* Give the tile icon's action its whole 48px area again

The tile container pads the icon by 6px so it is a 48px target, but the action handler was bound to the 36px circle inside it. A tap on that ring, around the circle or on a badge landed on the icon's host, which had no handler, and the container stopped it before the card's handler. Bind the action handler to the host instead.

* Let taps on the tile icon's badge reach the icon

With the action handler on the host, a tap on a badge in the default slot had the badge as its target, so a double tap across the badge and the rest of the icon fired two taps.

* Show the pointer cursor over the tile icon's whole area
2026-11-26 12:16:58 +01:00
WendelinandClaude Opus 5.5 11ef852384 Fix the Bluetooth adapter count on the dashboard (#56165)
* Fix the Bluetooth adapter count on the dashboard

The dashboard counted every bluetooth config entry that isn't disabled,
including ignored discoveries and entries without an adapter device, so
it could show more adapters than the adapters page lists. Move the
adapters page logic to a shared getBluetoothAdapters() helper and count
its enabled adapters on the dashboard. The count waits for the device
registry to load.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Show skeletons while the Bluetooth adapters load

Don't report zero adapters and an offline network before the config
entries and the device registry have loaded. Add tests for the shared
adapter selection.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Show an error with retry when the Bluetooth config entries fail to load

Otherwise the dashboard would keep showing its loading skeletons.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Keep the Bluetooth adapters link named while it loads

A skeleton in the link made its accessible name only "Loading". Show
"Bluetooth adapters" until the count is known instead.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-26 11:23:45 +01:00
394d5999b8 Show Home Assistant Link label on WebRTC in camera stream info (#56153)
* Show Home Assistant Link label on WebRTC in camera stream info

The camera stream info dialog labels the WebRTC row with
"Enhanced by Home Assistant Link" when the cloud TURN servers are in
use. The dialog reads cloud/status and uses the same check as core:
logged in, active subscription, and cloud_ice_servers_enabled.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* Wrap the Home Assistant Link tag on narrow screens

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Paulus Schoutsen <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-26 11:22:32 +01:00
Petar Petrov 384fdfdbc9 Group intl-messageformat with formatjs packages in Renovate (#56161)
Group intl-messageformat with the formatjs packages in Renovate
2026-11-26 10:14:17 +00:00
Martin Salinas 0cccdc5972 Don't set the max value when a circular slider is removed during a drag (#56163)
Cancel a circular slider drag when the slider is removed from the page
2026-11-26 11:49:09 +02:00
Aidan Timson 771eaa70ff Add a skill for browser checks and pull request screenshots (#56142)
* Add a skill for browser checks and pull request screenshots

* Point the screenshot reminder to the browser checks skill

* Cover light and dark, long text and recorded demos in the browser checks skill

* Check RTL with an RTL profile language in the browser checks skill

* Keep a before capture for every change to an existing screen

* Have agents add pull request screenshots themselves when they can
2026-11-26 11:02:29 +02:00
darkrain-nl aff47efe5e 2026.12 beta - Fix add integration search focus (#56151)
* Focus autofocus elements slotted into an adaptive dialog

* Test focusing autofocus elements slotted into a dialog
2026-11-26 09:50:16 +01:00
Erwin Douna f13470719c Restore dismissed energy meter suggestions (#56156)
* Restore dismissed energy meter suggestions

* Use a toolbar menu for dismissed meter suggestions and fix save races
2026-11-26 08:50:27 +02:00
Martin Salinas 5f769d613c Show the entity's value in number controls after the device puts it back (#56148)
* Show the entity's value in number controls after the device puts it back

The numeric input card feature and the number entity row bound the state straight to the control's value. When the entity came back to the value it had, Lit skipped the unchanged binding and the control kept the requested value. Bind with live() so the control is compared with the entity's value on each render.

* Remove the number row tests

They only check that the template puts the entity's value back on the controls, which is a rendering test. The gallery reproduction in the PR covers the change.
2026-11-26 08:44:12 +02:00
renovate[bot] f214ef8667 Update dependency @versatiles/style to v9.1.1 (#56158)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-26 08:32:28 +02:00
renovate[bot] 528ebe6b27 Update dependency memoize-one to v7 (#56160)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-11-26 08:32:20 +02:00
Gerd Naschenweng 82e6f1106f Cap the bar width in the statistics graph (#56097) 2026-11-26 08:04:48 +02:00
Martin Salinas f02656da54 Keep the color wheel drawn when only the cold white value is set (#56149)
With cw set and ww undefined, the ww !== null check let undefined through to rgbww2rgb, which returned NaN and made addColorStop throw, leaving the wheel blank. Moving the cold white slider of an RGBWW light that is off or in another color mode did that.
2026-11-26 07:52:12 +02:00
Matthias de BaatandClaude Opus 5.5 25307e427d Show when backup retention is paused for a location (#56088)
Automatic backup retention no longer deletes backups from locations
that are turned off for automatic backups (home-assistant/core#192788).
Show "Retention paused" in the locations list and an info alert on the
location page for those locations.

Co-authored-by: Claude Opus 5.5 <[email protected]>
2026-11-25 22:17:03 +01:00
Paul Bottein 207cbcc585 Show the connection error when logged out and the server is offline (#56139)
* Show the connection error when logged out and the server is offline

* Show the connection error when the server responds with a 5xx

* Time out the server check before the login redirect

* Give the server check 10 seconds
2026-11-25 19:44:23 +02:00
62 changed files with 1744 additions and 1456 deletions

No files matched your search

@@ -0,0 +1,43 @@
---
name: ha-frontend-browser-checks
description: Check a Home Assistant frontend change in a browser and show it in a pull request. Use when checking how a change looks or behaves at different screen sizes, in light and dark mode, right to left (RTL) or with long translations, or when taking before and after screenshots or recording a demo of a feature for a pull request.
---
# HA Frontend Browser Checks
Use this skill to check a visible change in a browser and to show it in a pull request. Any browser tool you already have works if it can open a page, set its size, run a script in it, take screenshots and record video. Load `ha-frontend-testing` for the dev servers, and `ha-frontend-loading` for loading states.
Screenshots and recordings help reviewers see what changed, but they don't make a large change easy to review. [Keep pull requests small](https://contributors.home-assistant.io/start/pull-requests/#keep-it-small), and make sure you have reviewed and understood the change and can explain it, as the [AI policy](https://contributors.home-assistant.io/start/ai-policy/) asks.
## Check Real Devices
Check the sizes the change affects rather than one fixed size, such as a phone, a tablet in both orientations, a laptop and a large desktop monitor. Include a small phone. Take each device's viewport in CSS pixels, its pixel ratio and touch support from the device presets your tools have, rather than from memory, and check the page really has that size once it's set.
## Check Light And Dark
When the change can look different in light and dark mode, such as a colour, border, background or image, check it in both. Switch the colour scheme in your browser tool, with the profile's theme following it, or pick light and dark in the profile. A fix for one mode only needs that mode.
## Check Right To Left (RTL)
Check layout, alignment, icons and anything with a direction in RTL. In the app, set your profile language to one written right to left, then set it back: many components take their direction from the language, so setting the page to RTL in your browser tool leaves them left to right. The gallery's RTL toggle checks styling only.
## Check Long Text
When a change adds or changes text, check it in a language with long words or long translations too, so labels, descriptions and buttons don't overflow or wrap badly. When the new string isn't translated yet, try a rough translation to check its length.
## Show It In The Pull Request
- When the change alters something that exists already, capture the same screen on `dev` and on your branch, in the same state, and put them side by side. Only a new screen, with nothing before it, needs just the after.
- Keep the size of every capture fixed, screenshots as well as videos. Set the page size before you capture and don't change it in between, and capture the same area each time, so the subject sits in the same place in before and after. For a card or other part of the page, work out a fixed area around it for each size you test, and use that same area on both branches.
- Say which device, size or mode each capture shows.
- Make the change easy to see: capture the part of the screen it affects rather than a whole page where it's a few pixels.
- Save captures outside the repository, so they can't be committed by accident.
- Keep personal details out: use demo data, such as the demo or the Demo integration, and mask anything else before you capture, such as names, addresses, IP and MAC addresses, hostnames, serial numbers and tokens. Check each capture before you attach it.
Record a video when it shows the change better than a still, such as an animation, a drag, a loading sequence (hold the loading state as "Checking It" in `ha-frontend-loading` shows) or a flow across several screens. Keep each video short and small: GitHub limits upload sizes, and reviewers have to watch it. You can record it yourself with the tools you have; it doesn't need a person.
- Use the recording tools at hand: your browser tool's recorder for a page, or a desktop screen recorder for a window, such as a phone emulator, so the device frame shows.
- Don't resize, zoom or take screenshots while recording, which redraw the page at another size and make the video jump.
- Check the whole recording before you attach it. For a short clip, look at a frame every second or half second, not only the first and last, since the page can jump to another size partway through. Record again if it does. Take stills from the same frames, so they match the video.
- Keep the window drawn on a screen. A hidden or minimised window records only a frame every few seconds.
- Label each video, such as **Before** and **After**, and say what it shows and how you set it up. Say what you didn't record and why.
+1 -1
View File
@@ -20,7 +20,7 @@ When creating a pull request, use `.github/PULL_REQUEST_TEMPLATE.md` as the body
- Do not omit, reorder, or rewrite template sections.
- Check the appropriate "Type of change" box based on the actual change.
- Do not check checklist items on behalf of the user.
- If the PR includes UI changes, remind the user to add screenshots or a short video.
- If the PR includes UI changes, add screenshots or a short video, taken as `ha-frontend-browser-checks` describes. Only ask the user to add them when you can't take them yourself.
- Explain what the change does for users, not only implementation details.
- Use Markdown.
+8 -8
View File
@@ -18,7 +18,7 @@ workflows:
- 'actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9'
'.github/workflows/codeql-analysis.yaml':
- 'actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1'
- 'github/codeql-action@33d7b85da1a04171e211befe2c739303b9a4c066'
- 'github/codeql-action@1bd86f2fdb4b86187fa4059f16f31a3202acc9ea'
'.github/workflows/copilot-setup-steps.yml':
- 'actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9'
- 'actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1'
@@ -29,7 +29,7 @@ workflows:
- 'actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1'
'.github/workflows/dependency-review.yaml':
- 'actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1'
- 'actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294'
- 'actions/dependency-review-action@bbc44d14a204704ccc493733616cd1e93a0321ec'
- 'actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3'
'.github/workflows/design_deployment.yaml':
- 'actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9'
@@ -101,9 +101,9 @@ dependencies:
commit: 'sha1-3d3c42e5aac5ba805825da76410c181273ba90b1'
owner_id: 44036562
repo_id: 197814629
'actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294':
ref: 'v5.0.0'
commit: 'sha1-a1d282b36b6f3519aa1f3fc636f609c47dddb294'
'actions/dependency-review-action@bbc44d14a204704ccc493733616cd1e93a0321ec':
ref: 'v5.0.1'
commit: 'sha1-bbc44d14a204704ccc493733616cd1e93a0321ec'
owner_id: 44036562
repo_id: 476372928
'actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333':
@@ -151,9 +151,9 @@ dependencies:
commit: 'sha1-89ae32b08ed1a541efecbab17912962a5e38981c'
owner_id: 7513068
repo_id: 113918130
'github/codeql-action@33d7b85da1a04171e211befe2c739303b9a4c066':
ref: 'v4.39.3'
commit: 'sha1-33d7b85da1a04171e211befe2c739303b9a4c066'
'github/codeql-action@1bd86f2fdb4b86187fa4059f16f31a3202acc9ea':
ref: 'v4.39.4'
commit: 'sha1-1bd86f2fdb4b86187fa4059f16f31a3202acc9ea'
owner_id: 9919
repo_id: 259445878
'home-assistant/[email protected]':
+2 -2
View File
@@ -32,12 +32,12 @@ jobs:
persist-credentials: false
- name: Initialize CodeQL
uses: github/codeql-action/init@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
uses: github/codeql-action/init@1bd86f2fdb4b86187fa4059f16f31a3202acc9ea # v4.39.4
with:
languages: javascript-typescript
build-mode: none
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@33d7b85da1a04171e211befe2c739303b9a4c066 # v4.39.3
uses: github/codeql-action/analyze@1bd86f2fdb4b86187fa4059f16f31a3202acc9ea # v4.39.4
with:
category: "/language:javascript-typescript"
+1 -1
View File
@@ -27,7 +27,7 @@ jobs:
contents: read # To compare the dependency graph between base and head
steps:
- name: Dependency review
uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0
uses: actions/dependency-review-action@bbc44d14a204704ccc493733616cd1e93a0321ec # v5.0.1
with:
license-check: false # Covered by pnpm lint:licenses
fail-on-severity: high
+2 -1
View File
@@ -53,10 +53,11 @@ Detailed guidance lives in `.agents/skills/<name>/SKILL.md`. Load every matching
- `ha-frontend-ux-readiness`: UI/UX routing that complements frontend review for new user experiences.
- `ha-frontend-gallery`: gallery pages, demos, sidebar structure, content, and verification.
- `ha-frontend-demo`: standalone demo structure, configurations, navigation, shared stubs, and verification.
- `ha-frontend-browser-checks`: checking a change in a browser at real device sizes, in light and dark mode, right to left (RTL) and with long translations, and screenshots and recorded demos for pull requests.
## Pull Requests
When creating a pull request, use `.github/PULL_REQUEST_TEMPLATE.md` as the PR body. Preserve template sections, check only the appropriate type-of-change boxes, and do not check checklist items on behalf of the user. If the PR includes UI changes, remind the user to add screenshots or a short video.
When creating a pull request, use `.github/PULL_REQUEST_TEMPLATE.md` as the PR body. Preserve template sections, check only the appropriate type-of-change boxes, and do not check checklist items on behalf of the user. If the PR includes UI changes, add screenshots or a short video, taken as `ha-frontend-browser-checks` describes. Only ask the user to add them when you can't take them yourself.
## AI policy
+1 -7
View File
@@ -25,13 +25,7 @@ const NOTICE_FILES = [path.join(NODE_MODULES, "echarts/NOTICE")];
// that the new version's license still matches. The build will fail if
// the pinned version is no longer installed.
const LICENSE_OVERRIDES = [
{
// type-fest ships two license files (MIT for code, CC0 for types).
// We use the MIT license since that covers the bundled code.
packageName: "type-fest",
version: "5.10.0",
licenseFile: "license-mit",
},
// No entries currently needed.
];
// Locate the directory of an installed package matching an exact version.
+19 -19
View File
@@ -43,15 +43,15 @@
"@babel/runtime": "8.1.3",
"@braintree/sanitize-url": "7.1.2",
"@codemirror/autocomplete": "6.20.4",
"@codemirror/commands": "6.11.1",
"@codemirror/commands": "6.11.2",
"@codemirror/lang-jinja": "6.0.1",
"@codemirror/lang-python": "6.2.1",
"@codemirror/lang-yaml": "6.1.3",
"@codemirror/language": "6.13.1",
"@codemirror/lint": "6.9.8",
"@codemirror/search": "6.7.2",
"@codemirror/search": "6.7.3",
"@codemirror/state": "6.7.6",
"@codemirror/view": "6.43.15",
"@codemirror/view": "6.44.2",
"@date-fns/tz": "1.5.0",
"@egjs/hammerjs": "2.0.17",
"@formatjs/intl-datetimeformat": "8.0.3",
@@ -64,7 +64,7 @@
"@formatjs/intl-pluralrules": "7.1.0",
"@formatjs/intl-relativetimeformat": "13.0.3",
"@home-assistant/webawesome": "3.14.0-ha.2",
"@lezer/common": "1.5.6",
"@lezer/common": "1.5.7",
"@lezer/highlight": "1.2.5",
"@lit-labs/motion": "1.1.0",
"@lit-labs/observers": "2.1.0",
@@ -79,12 +79,12 @@
"@swc/helpers": "0.5.24",
"@tsparticles/engine": "4.5.4",
"@tsparticles/preset-links": "4.5.4",
"@versatiles/style": "9.1.0",
"@versatiles/style": "9.1.3",
"@vibrant/color": "4.0.4",
"@vvo/tzdb": "6.204.0",
"@vvo/tzdb": "6.208.0",
"@webcomponents/scoped-custom-element-registry": "0.0.11",
"barcode-detector": "3.2.4",
"cally": "0.9.2",
"barcode-detector": "3.2.5",
"cally": "0.10.0",
"color-name": "2.1.1",
"comlink": "4.4.2",
"core-js": "3.51.0",
@@ -109,8 +109,8 @@
"lit": "3.3.3",
"lit-html": "3.3.3",
"maplibre-gl": "6.19.0",
"marked": "18.2.1",
"memoize-one": "6.0.0",
"marked": "18.3.0",
"memoize-one": "7.0.0",
"nanoid": "6.0.2",
"node-vibrant": "4.0.4",
"object-hash": "3.0.0",
@@ -147,13 +147,13 @@
"@eslint/js": "10.0.1",
"@gfx/zopfli": "1.0.15",
"@home-assistant/components": "workspace:*",
"@html-eslint/eslint-plugin": "0.68.0",
"@html-eslint/eslint-plugin": "0.69.0",
"@lokalise/node-api": "17.0.1",
"@octokit/auth-oauth-device": "8.0.5",
"@octokit/rest": "22.0.1",
"@playwright/test": "1.65.1",
"@rsdoctor/rspack-plugin": "1.6.5",
"@rspack/core": "2.3.3",
"@rspack/core": "2.3.4",
"@rspack/dev-server": "2.2.2",
"@types/babel__plugin-transform-runtime": "7.9.5",
"@types/chromecast-caf-receiver": "7.0.1",
@@ -162,15 +162,15 @@
"@types/culori": "4.0.1",
"@types/geojson": "7946.0.16",
"@types/html-minifier-terser": "7.0.2",
"@types/leaflet": "1.9.22",
"@types/leaflet": "1.9.23",
"@types/leaflet.markercluster": "1.5.6",
"@types/lodash.merge": "4.6.9",
"@types/node": "24.19.2",
"@types/node": "24.19.4",
"@types/qrcode": "1.5.6",
"@types/sortablejs": "1.15.9",
"@types/tar": "7.0.87",
"@typescript/native": "npm:[email protected]",
"@vitest/coverage-v8": "5.1.1",
"@vitest/coverage-v8": "5.1.2",
"babel-loader": "10.1.1",
"babel-plugin-polyfill-corejs3": "1.0.0",
"browserslist": "4.29.6",
@@ -210,14 +210,14 @@
"rspack-manifest-plugin": "5.2.2",
"serve": "14.2.8",
"sinon": "22.1.0",
"tar": "7.5.23",
"tar": "7.5.24",
"terser-webpack-plugin": "5.6.1",
"ts-lit-plugin": "2.0.2",
"typescript": "6.0.3",
"typescript-eslint": "8.73.0",
"vite": "8.3.8",
"typescript-eslint": "8.74.0",
"vite": "8.4.0",
"vite-tsconfig-paths": "6.1.1",
"vitest": "5.1.1",
"vitest": "5.1.2",
"webpack-stats-plugin": "1.1.3",
"webpackbar": "7.0.0",
"workbox-build": "7.4.1"
+1 -1
View File
@@ -53,7 +53,7 @@
},
"devDependencies": {
"@custom-elements-manifest/analyzer": "0.11.0",
"@rslib/core": "1.0.7",
"@rslib/core": "1.1.0",
"lit": "3.3.3",
"typescript": "6.0.3"
}
+684 -594
View File
File diff suppressed because it is too large. Load diff
+2
View File
@@ -18,6 +18,8 @@ trustPolicyExclude:
- [email protected]
# Pre-release published without provenance, used by workbox-build
- "@trickfilm400/[email protected]"
# Published without the trusted-publisher record; provenance still from vvo/tzdb release.yml
- "@vvo/[email protected]"
# Dependency build scripts are denied unless listed here with true
allowBuilds:
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "home-assistant-frontend"
version = "20261125.2"
version = "20261125.0"
license = "Apache-2.0"
license-files = ["LICENSE*"]
description = "The Home Assistant frontend"
+2 -2
View File
@@ -126,9 +126,9 @@
"matchPackageNames": ["echarts", "zrender"]
},
{
"description": "Group formatjs monorepo package",
"description": "Group formatjs monorepo packages",
"groupName": "formatjs",
"matchPackageNames": ["@formatjs/**"]
"matchPackageNames": ["@formatjs/**", "intl-messageformat"]
},
{
"description": "Group Playwright package and CI container updates",
@@ -1,33 +0,0 @@
import { mdiVideoOffOutline } from "@mdi/js";
import { css, html, LitElement } from "lit";
import { customElement } from "lit/decorators";
import "../ha-svg-icon";
/**
* @element ha-camera-placeholder
*
* @summary Shows instead of a camera's picture when there is none, like
* while the camera is unavailable.
*/
@customElement("ha-camera-placeholder")
export class HaCameraPlaceholder extends LitElement {
protected render() {
return html`<ha-svg-icon .path=${mdiVideoOffOutline}></ha-svg-icon>`;
}
static styles = css`
:host {
display: flex;
align-items: center;
justify-content: center;
color: var(--secondary-text-color);
--mdc-icon-size: 40px;
}
`;
}
declare global {
interface HTMLElementTagNameMap {
"ha-camera-placeholder": HaCameraPlaceholder;
}
}
+18 -110
View File
@@ -22,16 +22,12 @@ import type { LocalizeFunc } from "../../common/translations/localize";
import { nextRender } from "../../common/util/render-status";
import type { CameraCapabilities, CameraEntity } from "../../data/camera";
import type { CameraStreamStatus } from "../../data/camera-streams";
import {
showCameraStreamInfoDialog,
type CameraStreamInfo,
} from "../../dialogs/camera/show-dialog-camera-stream-info";
import { showCameraStreamInfoDialog } from "../../dialogs/camera/show-dialog-camera-stream-info";
import "../ha-camera-stream";
import type { HaCameraStream } from "../ha-camera-stream";
import "../ha-icon-button";
import "../ha-spinner";
import "../ha-svg-icon";
import "./ha-camera-placeholder";
import "./ha-camera-stream-badge";
import {
fitPicture,
@@ -101,9 +97,6 @@ export class HaCameraPlayer extends LitElement {
@property({ type: Boolean, attribute: "keep-awake" })
public keepAwake = false;
/** Fills the height it is given, with the picture in the middle. */
@property({ type: Boolean, reflect: true }) public fill = false;
@state() private _status: CameraStreamStatus = {
connecting: true,
hasAudio: false,
@@ -111,8 +104,6 @@ export class HaCameraPlayer extends LitElement {
@state() private _capabilities?: CameraCapabilities;
private _streamInfoCallbacks = new Set<(info: CameraStreamInfo) => void>();
@state() private _video?: HTMLVideoElement;
@state() private _muted = false;
@@ -218,7 +209,6 @@ export class HaCameraPlayer extends LitElement {
);
clearTimeout(this._controlsTimeout);
clearTimeout(this._wheelHintTimeout);
this._streamInfoCallbacks.clear();
this._unbindVideo(this._video);
this._video = undefined;
this._pointers.clear();
@@ -245,7 +235,7 @@ export class HaCameraPlayer extends LitElement {
const aspectRatio = this._aspectRatio();
if (aspectRatio !== this._firedAspectRatio) {
this._firedAspectRatio = aspectRatio;
fireEvent(this, "camera-aspect-ratio-changed", { aspectRatio });
fireEvent(this, "media-size-changed", { aspectRatio });
}
if (changedProps.has("keepAwake")) {
if (this.keepAwake) {
@@ -258,10 +248,6 @@ export class HaCameraPlayer extends LitElement {
this._unbindVideo(changedProps.get("_video") as HTMLVideoElement);
this._bindVideo(this._video);
}
if (changedProps.has("_status") || changedProps.has("_capabilities")) {
const info = this._streamInfo();
this._streamInfoCallbacks.forEach((callback) => callback(info));
}
}
protected render() {
@@ -273,12 +259,11 @@ export class HaCameraPlayer extends LitElement {
// controls and zoom of this one can't reach, so it shows just the stream
const inApp = Boolean(status.inApp);
const zoomed = !inApp && isZoomed(this._zoom);
// Stays while not live, so the user sees what happens
// Stays while the connection changes, so the user sees what happens
const badgeVisible =
this._controlsVisible ||
status.connecting ||
Boolean(status.unavailable) ||
Boolean(status.disconnected);
status.upgrading !== undefined;
return html`
<div
@@ -299,10 +284,9 @@ export class HaCameraPlayer extends LitElement {
gesture: this._gesture,
})}
style=${styleMap({
aspectRatio:
this._fullscreen || this.fill
? undefined
: String(this._aspectRatio()),
aspectRatio: this._fullscreen
? undefined
: String(this._aspectRatio()),
})}
@pointerdown=${this._pointerDown}
@pointerup=${this._pointerUp}
@@ -319,9 +303,6 @@ export class HaCameraPlayer extends LitElement {
mjpeg-video
measure-poster
style=${styleMap({
"--picture-aspect-ratio": this.fill
? String(this._aspectRatio())
: undefined,
transform: zoomed
? `translate(${this._zoom.x}px, ${this._zoom.y}px) scale(${this._zoom.scale})`
: undefined,
@@ -331,11 +312,6 @@ export class HaCameraPlayer extends LitElement {
@camera-capabilities-changed=${this._capabilitiesChanged}
@camera-poster-size-changed=${this._posterSizeChanged}
></ha-camera-stream>
${
status.unavailable
? html`<ha-camera-placeholder></ha-camera-placeholder>`
: nothing
}
</div>
${inApp ? nothing : this._renderControls(status, zoomed, badgeVisible)}
</div>
@@ -349,10 +325,7 @@ export class HaCameraPlayer extends LitElement {
) {
return html`
${
this._paused &&
!status.connecting &&
!status.unavailable &&
!status.disconnected
this._paused && !status.connecting
? html`<ha-icon-button
class="control pinned play"
.label=${this._localize("ui.components.camera-player.play")}
@@ -563,21 +536,15 @@ export class HaCameraPlayer extends LitElement {
) {
const oldStatus = this._status;
this._status = ev.detail;
if (ev.detail.inApp || ev.detail.unavailable) {
if (ev.detail.inApp) {
this._zoom = ZOOM_PAN_IDENTITY;
}
if (
oldStatus.connecting !== ev.detail.connecting ||
oldStatus.unavailable !== ev.detail.unavailable ||
oldStatus.disconnected !== ev.detail.disconnected
) {
// Shows the new state for a moment
this._showControls();
}
if (
oldStatus.connecting !== ev.detail.connecting ||
oldStatus.type !== ev.detail.type
) {
// Shows the new connection for a moment
this._showControls();
this._updateVideo();
}
}
@@ -612,26 +579,10 @@ export class HaCameraPlayer extends LitElement {
this._posterSize = ev.detail.size;
}
private _streamInfo(): CameraStreamInfo {
return {
status: this._status,
supportedTypes: this._capabilities?.frontend_stream_types,
};
}
private _subscribeStreamInfo = (
callback: (info: CameraStreamInfo) => void
) => {
this._streamInfoCallbacks.add(callback);
callback(this._streamInfo());
return () => {
this._streamInfoCallbacks.delete(callback);
};
};
private _showStreamInfo() {
showCameraStreamInfoDialog(this, {
subscribe: this._subscribeStreamInfo,
status: this._status,
supportedTypes: this._capabilities?.frontend_stream_types,
});
}
@@ -862,17 +813,12 @@ export class HaCameraPlayer extends LitElement {
this._zoom = refitZoomPan(this._zoom, oldViewport, viewport);
};
// The app's own player and a camera without picture can't be zoomed
private _canZoom(): boolean {
return !this._status.inApp && !this._status.unavailable;
}
private _resetZoom() {
this._zoom = ZOOM_PAN_IDENTITY;
}
private _wheel(ev: WheelEvent) {
if (!this._viewport || !this._canZoom()) {
if (!this._viewport || this._status.inApp) {
return;
}
// A pinch on a touchpad scrolls with ctrl held
@@ -916,7 +862,7 @@ export class HaCameraPlayer extends LitElement {
}
private _doubleClick(ev: MouseEvent) {
if (!this._viewport || !this._canZoom()) {
if (!this._viewport || this._status.inApp) {
return;
}
if (isZoomed(this._zoom)) {
@@ -959,8 +905,7 @@ export class HaCameraPlayer extends LitElement {
this._showControls();
}
const pointer = this._pointers.get(ev.pointerId);
// Taps still toggle the controls when the picture can't be zoomed
if (!pointer || !this._viewport || !this._canZoom()) {
if (!pointer || !this._viewport) {
return;
}
const { rect, viewport } = this._measureViewport();
@@ -1085,38 +1030,6 @@ export class HaCameraPlayer extends LitElement {
cursor: none;
}
:host([fill]) {
position: relative;
flex: 1;
min-height: 0;
}
:host([fill]) .player {
position: absolute;
inset: 0;
}
:host([fill]) .viewport {
height: 100%;
max-height: none;
container-type: size;
--video-max-height: 100%;
}
/* As large as the picture fits in the middle, zoomed from the corner of
the viewport like a stream that fills it */
:host([fill]) ha-camera-stream {
--picture-width: min(100cqw, 100cqh * var(--picture-aspect-ratio));
--picture-height: min(100cqh, 100cqw / var(--picture-aspect-ratio));
position: absolute;
top: calc((100cqh - var(--picture-height)) / 2);
left: calc((100cqw - var(--picture-width)) / 2);
width: var(--picture-width);
height: var(--picture-height);
transform-origin: calc((var(--picture-width) - 100cqw) / 2)
calc((var(--picture-height) - 100cqh) / 2);
}
.viewport {
position: relative;
overflow: hidden;
@@ -1154,12 +1067,6 @@ export class HaCameraPlayer extends LitElement {
transition: transform var(--ha-animation-duration-fast) ease-out;
}
ha-camera-placeholder {
position: absolute;
inset: 0;
color: rgba(255, 255, 255, 0.5);
}
.viewport.gesture ha-camera-stream {
transition: none;
will-change: transform;
@@ -1282,6 +1189,7 @@ declare global {
"ha-camera-player": HaCameraPlayer;
}
interface HASSDomEvents {
"camera-aspect-ratio-changed": { aspectRatio: number };
/** The natural width limits the picture's width when it is set */
"media-size-changed": { aspectRatio: number; naturalWidth?: number };
}
}
+52 -25
View File
@@ -6,6 +6,7 @@ import type {
CameraStreamStatus,
CameraStreamType,
} from "../../data/camera-streams";
import "../ha-spinner";
/** Names of the protocols, the same in every language. */
export const CAMERA_STREAM_TYPE_NAMES: Record<CameraStreamType, string> = {
@@ -15,10 +16,8 @@ export const CAMERA_STREAM_TYPE_NAMES: Record<CameraStreamType, string> = {
};
/**
* @element ha-camera-stream-badge
*
* @summary Shows over a camera stream whether it is live. Selecting it
* shows how it is connected.
* Shows over a camera stream how it is connected. A faster stream that still
* connects in the background is shown next to the current one.
*/
@customElement("ha-camera-stream-badge")
export class HaCameraStreamBadge extends LitElement {
@@ -33,27 +32,51 @@ export class HaCameraStreamBadge extends LitElement {
if (!status) {
return nothing;
}
const connection = status.disconnected
? "disconnected"
: status.unavailable
? "unavailable"
: status.connecting || !status.type
? "connecting"
: "live";
const connecting = status.connecting || !status.type;
const label = connecting
? this._localize("ui.components.camera-player.connecting")
: CAMERA_STREAM_TYPE_NAMES[status.type!];
return html`
<button type="button" class=${connection} aria-describedby="details">
<span class="dot"></span>
<span class="label"
>${this._localize(`ui.components.camera-player.${connection}`)}</span
>
</button>
<span id="details" hidden
>${this._localize("ui.components.camera-player.show_details")}</span
<button
type="button"
aria-label=${this._ariaLabel(status)}
class=${connecting ? "connecting" : "live"}
>
<span class="dot"></span>
<span class="label">${label}</span>
${
status.upgrading
? html`<span class="upgrading" aria-hidden="true">
<ha-spinner></ha-spinner>
${CAMERA_STREAM_TYPE_NAMES[status.upgrading]}
</span>`
: nothing
}
</button>
`;
}
private _ariaLabel(status: CameraStreamStatus): string {
if (status.connecting || !status.type) {
return this._localize(
"ui.components.camera-player.stream_info_connecting"
);
}
if (status.upgrading) {
return this._localize(
"ui.components.camera-player.stream_info_upgrading",
{
type: CAMERA_STREAM_TYPE_NAMES[status.type],
upgrading: CAMERA_STREAM_TYPE_NAMES[status.upgrading],
}
);
}
return this._localize("ui.components.camera-player.stream_info", {
type: CAMERA_STREAM_TYPE_NAMES[status.type],
});
}
static styles = css`
:host {
display: inline-flex;
@@ -97,12 +120,16 @@ export class HaCameraStreamBadge extends LitElement {
animation: pulse 1.2s ease-in-out infinite;
}
.unavailable .dot {
background-color: rgba(255, 255, 255, 0.5);
}
.disconnected .dot {
background-color: var(--ha-color-red-60);
.upgrading {
display: inline-flex;
align-items: center;
gap: var(--ha-space-1);
padding-inline-start: var(--ha-space-1);
border-inline-start: 1px solid rgba(255, 255, 255, 0.3);
opacity: 0.7;
--ha-spinner-indicator-color: var(--ha-color-white);
--ha-spinner-size: 10px;
--ha-spinner-divider-color: rgba(255, 255, 255, 0.3);
}
@keyframes pulse {
@@ -328,6 +328,11 @@ export function generateStatisticsChartData(
: undefined,
color: chartType === "bar" ? backgroundColor : borderColor,
};
if (chartType === "bar") {
// echarts sizes bars from the smallest gap between points, so sparse
// data (one point, or points far apart) gets huge bars without a cap
(series as BarSeriesOption).barMaxWidth = 50;
}
if (chartStacked) {
series.stack = `band-stacked`;
series.stackStrategy = "samesign";
+2 -8
View File
@@ -1,6 +1,5 @@
import { mdiClose } from "@mdi/js";
import type { ContextType } from "@lit/context";
import { createContext, provide } from "@lit/context";
import { css, html, LitElement, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
import { consume } from "../common/decorators/consume";
@@ -12,10 +11,7 @@ import "./ha-icon-button";
import "./ha-dialog";
import type { DialogWidth } from "./ha-dialog";
export type DialogSheetMode = "dialog" | "bottom-sheet";
export const adaptiveDialogModeContext =
createContext<DialogSheetMode>("adaptiveDialogMode");
type DialogSheetMode = "dialog" | "bottom-sheet";
export const ADAPTIVE_DIALOG_MEDIA_QUERY =
"(max-width: 870px), (max-height: 500px)";
@@ -129,9 +125,7 @@ export class HaAdaptiveDialog extends LitElement {
@property({ type: Boolean, reflect: true, attribute: "flexcontent" })
public flexContent = false;
@provide({ context: adaptiveDialogModeContext })
@state()
public mode: DialogSheetMode = "dialog";
@state() public mode: DialogSheetMode = "dialog";
@state()
@consume({ context: internationalizationContext, subscribe: true })
+17 -116
View File
@@ -34,8 +34,6 @@ import {
connectionContext,
formattersContext,
} from "../data/context";
import { UNAVAILABLE } from "../data/entity/entity";
import "./camera/ha-camera-placeholder";
import "./ha-hls-player";
import type { HaHLSPlayer } from "./ha-hls-player";
import "./ha-mjpeg-player";
@@ -113,13 +111,6 @@ export class HaCameraStream extends LitElement {
// The app plays the HLS stream in its own player, over the page
@state() private _hlsInApp = false;
// WebRTC is the only stream and failed, its player shows why
@state() private _webRtcFailed = false;
// The MJPEG image failed, it is tried again with the next access token or
// once Home Assistant reconnects
@state() private _mjpegImageFailed = false;
@query("ha-web-rtc-player") private _webRtcPlayer?: HaWebRtcPlayer;
@query("ha-mjpeg-player") private _mjpegPlayer?: HaMjpegPlayer;
@@ -162,32 +153,9 @@ export class HaCameraStream extends LitElement {
this._config.config.state === STATE_RUNNING &&
oldConfig.config?.state !== STATE_RUNNING;
const oldStateObj = changedProps.get("stateObj") as
CameraEntity | undefined;
const becameAvailable =
!entityChanged &&
this.stateObj !== undefined &&
oldStateObj?.state === UNAVAILABLE &&
!this._unavailable;
if (entityChanged || backendStarted || becameAvailable) {
if (this._unavailable) {
// Core often doesn't know the camera then, as its integration
// didn't load. Its capabilities are fetched once it is back.
this._clearCapabilities();
} else {
this._getCapabilities();
this._getPosterUrl();
}
}
if (
oldStateObj &&
oldStateObj.attributes.access_token !==
this.stateObj?.attributes.access_token
) {
// A new token gives a new MJPEG address, worth another try
this._mjpegImageFailed = false;
if (entityChanged || backendStarted) {
this._getCapabilities();
this._getPosterUrl();
}
const oldConnection = changedProps.get("_connection") as
@@ -202,10 +170,6 @@ export class HaCameraStream extends LitElement {
}
}
private get _unavailable(): boolean {
return this.stateObj?.state === UNAVAILABLE;
}
/** The microphone track sent to the camera, only on WebRTC streams. */
public get microphoneTrack(): MediaStreamTrack | undefined {
return this._webRtcPlayer?.microphoneTrack;
@@ -274,63 +238,29 @@ export class HaCameraStream extends LitElement {
this._visibleStreamType = visibleStreamType;
fireEvent(this, "stream-type-changed", { type: visibleStreamType });
}
const status = this._computeStatus(streams, visibleStreamType);
const status: CameraStreamStatus = {
...computeCameraStreamStatus(
streams,
// Nothing plays while Home Assistant is disconnected
this._connection.connected ? this._loadedStreams : new Set(),
this._hlsStreams,
this._webRtcStreams
),
inApp: visibleStreamType === STREAM_TYPE_HLS && this._hlsInApp,
};
if (
!this._status ||
status.type !== this._status.type ||
status.connecting !== this._status.connecting ||
status.upgrading !== this._status.upgrading ||
status.hasAudio !== this._status.hasAudio ||
status.inApp !== this._status.inApp ||
status.unavailable !== this._status.unavailable ||
status.disconnected !== this._status.disconnected
status.inApp !== this._status.inApp
) {
this._status = status;
fireEvent(this, "camera-stream-status-changed", status);
}
}
private _computeStatus(
streams: CameraStream[],
visibleStreamType?: CameraStreamType
): CameraStreamStatus {
// A playing WebRTC stream can come straight from the camera or an
// external go2rtc, it then keeps playing without Home Assistant
const playsWithoutHomeAssistant =
visibleStreamType === STREAM_TYPE_WEB_RTC &&
this._loadedStreams.has(STREAM_TYPE_WEB_RTC);
const inApp = visibleStreamType === STREAM_TYPE_HLS && this._hlsInApp;
if (!this._connection.connected && !playsWithoutHomeAssistant) {
// Kept so the player still shows its placeholder instead of nothing
return {
connecting: false,
hasAudio: false,
inApp,
disconnected: "home_assistant",
unavailable: this._unavailable,
};
}
if (this._unavailable) {
return { connecting: false, hasAudio: false, unavailable: true };
}
if (this._webRtcFailed) {
return {
connecting: false,
hasAudio: false,
disconnected: "stream_failed",
};
}
return {
...computeCameraStreamStatus(
streams,
this._loadedStreams,
this._hlsStreams,
this._webRtcStreams
),
inApp,
};
}
protected render() {
if (!this.stateObj) {
return nothing;
@@ -367,11 +297,6 @@ export class HaCameraStream extends LitElement {
@load=${this._handleMjpegLoad}
></ha-mjpeg-player>`;
}
if (this._mjpegImageFailed) {
return html`<ha-camera-placeholder
style=${styleMap({ aspectRatio: this.aspectRatio ?? 16 / 9 })}
></ha-camera-placeholder>`;
}
return html`<img
.src=${streamUrl}
style=${styleMap({
@@ -380,7 +305,6 @@ export class HaCameraStream extends LitElement {
})}
alt=${`Preview of the ${this._formatters?.formatEntityName(this.stateObj) ?? ""} camera.`}
@load=${this._handleImageLoad}
@error=${this._handleImageError}
/>`;
}
@@ -422,9 +346,6 @@ export class HaCameraStream extends LitElement {
}
private _currentStreams() {
if (this._unavailable) {
return [];
}
return this._streams(
this._capabilities?.frontend_stream_types,
this._hlsStreams,
@@ -432,15 +353,10 @@ export class HaCameraStream extends LitElement {
);
}
/** Returns the request number, so an older request can be dropped. */
private _clearCapabilities() {
private async _getCapabilities() {
this._capabilities = undefined;
this._resetStreams();
return ++this._capabilitiesRequest;
}
private async _getCapabilities() {
const request = this._clearCapabilities();
const request = ++this._capabilitiesRequest;
if (!supportsFeature(this.stateObj!, CameraEntityFeature.STREAM)) {
this._capabilities = {
frontend_stream_types: [],
@@ -463,14 +379,11 @@ export class HaCameraStream extends LitElement {
this._webRtcStreams = undefined;
this._loadedStreams = new Set();
this._hlsInApp = false;
this._webRtcFailed = false;
this._mjpegImageFailed = false;
this._mjpegPlayer?.restart();
}
private _restartMjpeg() {
this._setLoaded(MJPEG_STREAM, false);
this._mjpegImageFailed = false;
this._mjpegPlayer?.restart();
}
@@ -530,11 +443,6 @@ export class HaCameraStream extends LitElement {
fireEvent(this, "load");
}
private _handleImageError() {
this._mjpegImageFailed = true;
this._setLoaded(MJPEG_STREAM, false);
}
private _handleMjpegLoad() {
this._setLoaded(MJPEG_STREAM, true);
}
@@ -550,7 +458,6 @@ export class HaCameraStream extends LitElement {
}
private _handleWebRtcLoad() {
this._webRtcFailed = false;
this._setLoaded(STREAM_TYPE_WEB_RTC, true);
}
@@ -570,7 +477,6 @@ export class HaCameraStream extends LitElement {
) {
// Without another stream type, keep the player to show why it failed.
// Only a browser without WebRTC falls back to MJPEG.
this._webRtcFailed = true;
this._setLoaded(STREAM_TYPE_WEB_RTC, false);
return;
}
@@ -604,15 +510,10 @@ export class HaCameraStream extends LitElement {
display: block;
}
img,
ha-camera-placeholder {
img {
width: 100%;
}
ha-camera-placeholder {
background-color: var(--ha-color-fill-neutral-normal-resting);
}
ha-web-rtc-player {
width: 100%;
height: 100%;
+4
View File
@@ -1939,6 +1939,10 @@ export class HaCodeEditor extends ReactiveElement {
padding-top: var(--code-editor-toolbar-height);
}
:host(.fullscreen) {
--code-mirror-min-height: 100%;
}
:host(.fullscreen) .cm-editor {
height: 100% !important;
max-height: 100% !important;
+17 -9
View File
@@ -179,6 +179,10 @@ export class HaControlCircularSlider extends LitElement {
disconnectedCallback(): void {
super.disconnectedCallback();
this._destroyListeners();
if (this._activeSlider) {
this._cancelInteraction();
}
}
private _managers: HammerManager[] = [];
@@ -248,6 +252,18 @@ export class HaControlCircularSlider extends LitElement {
return undefined;
}
private _cancelInteraction() {
if (this._activeSlider) {
fireEvent(this, `${this._activeSlider}-changing`, {
value: undefined,
});
}
this._activeSlider = undefined;
this._localValue = this.value;
this._localLow = this.low;
this._localHigh = this.high;
}
private _setupListeners() {
if (this._interactions && this._managers.length === 0) {
this._interactions.forEach((interaction) => {
@@ -279,15 +295,7 @@ export class HaControlCircularSlider extends LitElement {
mc.add(new Tap({ event: "singletap" }));
const cancelInteraction = () => {
if (this._activeSlider) {
fireEvent(this, `${this._activeSlider}-changing`, {
value: undefined,
});
}
this._activeSlider = undefined;
this._localValue = this.value;
this._localLow = this.low;
this._localHigh = this.high;
this._cancelInteraction();
if (pressToActivate) {
panRecognizer.set({ enable: false });
}
+1 -1
View File
@@ -45,7 +45,7 @@ function adjustRgb(
if (wv != null) {
return rgbw2rgb([...rgb, wv] as [number, number, number, number]);
}
if (cw != null && ww !== null) {
if (cw != null && ww != null) {
return rgbww2rgb(
[...rgb, cw, ww] as [number, number, number, number, number],
minKelvin,
+14 -30
View File
@@ -42,8 +42,6 @@ export class HaMjpegPlayer extends LitElement {
private _drawInterval?: number;
private _copyingFrame = false;
/** The video for picture in picture, undefined when it can't be shown. */
public get videoElement(): HTMLVideoElement | undefined {
return this._canCopy ? this._videoEl : undefined;
@@ -68,13 +66,12 @@ export class HaMjpegPlayer extends LitElement {
}
try {
if (!this._stream) {
// The canvas already has a frame from the copy test
this._copyFrame();
this._drawFrame();
// Captures a frame whenever the canvas is drawn
this._stream = this._canvas!.captureStream();
video.srcObject = this._stream;
this._drawInterval = window.setInterval(
() => this._copyFrame(),
() => this._drawFrame(),
1000 / PICTURE_IN_PICTURE_FRAME_RATE
);
}
@@ -181,45 +178,32 @@ export class HaMjpegPlayer extends LitElement {
/** An image from another origin can't be copied out of a canvas. */
private _testCopy(): boolean {
const image = this._imageEl!;
try {
this._drawFrame(image, image.naturalWidth, image.naturalHeight);
this._canvas!.getContext("2d")?.getImageData(0, 0, 1, 1);
return true;
this._drawFrame();
this._canvas?.getContext("2d")?.getImageData(0, 0, 1, 1);
return Boolean(this._canvas);
} catch (_err: unknown) {
return false;
}
}
// Firefox only draws the first frame of an MJPEG image, a bitmap of it
// has the current one
private async _copyFrame() {
private _drawFrame() {
const image = this._imageEl;
if (this._copyingFrame || !image?.naturalWidth) {
if (!image?.naturalWidth) {
return;
}
this._copyingFrame = true;
try {
const bitmap = await createImageBitmap(image);
this._drawFrame(bitmap, bitmap.width, bitmap.height);
bitmap.close();
} catch (_err: unknown) {
// The stream is between frames or restarting, the next copy tries again
} finally {
this._copyingFrame = false;
}
}
private _drawFrame(frame: CanvasImageSource, width: number, height: number) {
if (!this._canvas) {
this._canvas = document.createElement("canvas");
}
const canvas = this._canvas;
if (canvas.width !== width || canvas.height !== height) {
canvas.width = width;
canvas.height = height;
if (
canvas.width !== image.naturalWidth ||
canvas.height !== image.naturalHeight
) {
canvas.width = image.naturalWidth;
canvas.height = image.naturalHeight;
}
canvas.getContext("2d")?.drawImage(frame, 0, 0);
canvas.getContext("2d")?.drawImage(image, 0, 0);
}
private _stopVideo = () => {
-6
View File
@@ -79,8 +79,6 @@ export const selectCameraStreams = ({
];
};
export type CameraStreamDisconnectReason = "home_assistant" | "stream_failed";
/** What the player tells the user about the connection of its stream. */
export interface CameraStreamStatus {
/** The stream that is shown, undefined until the camera's types are known */
@@ -93,10 +91,6 @@ export interface CameraStreamStatus {
hasAudio: boolean;
/** The app plays the shown stream in its own player, over the page */
inApp?: boolean;
/** The camera is unavailable, no stream is started */
unavailable?: boolean;
/** Home Assistant is disconnected, or the only stream failed */
disconnected?: CameraStreamDisconnectReason;
}
export const computeCameraStreamStatus = (
+2
View File
@@ -223,6 +223,7 @@ export const SENSOR_DEVICE_CLASS_UNITS: Record<string, (string | null)[]> = {
voltage: ["kV", "MV", "mV", "V", "μV"],
volume: ["CCF", "fl. oz.", "ft³", "gal", "L", "MCF", "mL", "m³"],
volume_flow_rate: [
"ft³/h",
"ft³/min",
"gal/d",
"gal/h",
@@ -399,6 +400,7 @@ export const SENSOR_DEVICE_CLASS_CONVERTIBLE_UNITS: Record<
voltage: ["kV", "MV", "mV", "V", "μV"],
volume: ["CCF", "fl. oz.", "ft³", "gal", "L", "MCF", "mL", "m³"],
volume_flow_rate: [
"ft³/h",
"ft³/min",
"gal/d",
"gal/h",
@@ -28,10 +28,7 @@ import { fetchCloudStatus } from "../../data/cloud";
import { apiContext, configContext } from "../../data/context";
import { haStyleDialog, haStyleDialogFixedTop } from "../../resources/styles";
import { DialogMixin } from "../dialog-mixin";
import type {
CameraStreamInfo,
CameraStreamInfoDialogParams,
} from "./show-dialog-camera-stream-info";
import type { CameraStreamInfoDialogParams } from "./show-dialog-camera-stream-info";
// Ordered from the fastest to the most compatible
const STREAM_TYPES: { type: CameraStreamType; icon: string }[] = [
@@ -56,23 +53,6 @@ class DialogCameraStreamInfo extends DialogMixin<CameraStreamInfoDialogParams>(
@state() private _cloudIceServers = false;
@state() private _info?: CameraStreamInfo;
private _unsubscribe?: () => void;
public connectedCallback() {
super.connectedCallback();
this._unsubscribe = this.params?.subscribe((info) => {
this._info = info;
});
}
public disconnectedCallback() {
this._unsubscribe?.();
this._unsubscribe = undefined;
super.disconnectedCallback();
}
protected firstUpdated() {
this._fetchCloudIceServers();
}
@@ -94,10 +74,10 @@ class DialogCameraStreamInfo extends DialogMixin<CameraStreamInfoDialogParams>(
}
protected render() {
if (!this._info) {
if (!this.params) {
return nothing;
}
const { status, supportedTypes } = this._info;
const { status, supportedTypes } = this.params;
// Without a video stream, still images are all the camera has
const stillImagesOnly = supportedTypes?.length === 0;
// MJPEG is only the fallback, only worth explaining while it shows
@@ -126,22 +106,6 @@ class DialogCameraStreamInfo extends DialogMixin<CameraStreamInfoDialogParams>(
: "ui.dialogs.camera_stream_info.intro"
)}
</p>
${
status.disconnected
? html`<ha-alert alert-type="error">
${this._localize(
`ui.dialogs.camera_stream_info.disconnected.${status.disconnected}`
)}
</ha-alert>`
: nothing
}
${
status.unavailable
? html`<ha-alert alert-type="warning">
${this._localize("ui.dialogs.camera_stream_info.unavailable")}
</ha-alert>`
: nothing
}
${
mjpegInUse && !stillImagesOnly
? html`<ha-alert alert-type="info">
@@ -181,7 +145,7 @@ class DialogCameraStreamInfo extends DialogMixin<CameraStreamInfoDialogParams>(
type: CameraStreamType;
icon: string;
}) {
const { status } = this._info!;
const { status } = this.params!;
const current = !status.connecting && status.type === type;
const upgrading = status.upgrading === type;
return html`
@@ -1,17 +1,12 @@
import { fireEvent } from "../../common/dom/fire_event";
import type { CameraStreamStatus, StreamType } from "../../data/camera-streams";
export interface CameraStreamInfo {
export interface CameraStreamInfoDialogParams {
status: CameraStreamStatus;
/** The stream types the camera supports, undefined while unknown */
supportedTypes?: StreamType[];
}
export interface CameraStreamInfoDialogParams {
/** Calls back with the current info right away and on every change */
subscribe: (callback: (info: CameraStreamInfo) => void) => () => void;
}
export const showCameraStreamInfoDialog = (
element: HTMLElement,
params: CameraStreamInfoDialogParams
+1 -1
View File
@@ -46,7 +46,7 @@ export const DOMAINS_WITH_NEW_MORE_INFO = [
"media_player",
];
/** Domains with full height more info dialog */
export const DOMAINS_FULL_HEIGHT_MORE_INFO = ["camera", "update"];
export const DOMAINS_FULL_HEIGHT_MORE_INFO = ["update"];
/** Domains with separate more info dialog. */
export const DOMAINS_WITH_MORE_INFO = [
@@ -9,10 +9,6 @@ import { consumeLocalize } from "../../../common/decorators/consume-context-entr
import type { HASSDomEvent } from "../../../common/dom/fire_event";
import { fireEvent } from "../../../common/dom/fire_event";
import type { LocalizeFunc } from "../../../common/translations/localize";
import {
adaptiveDialogModeContext,
type DialogSheetMode,
} from "../../../components/ha-adaptive-dialog";
import "../../../components/ha-button";
import "../../../components/camera/ha-camera-player";
import type { HaCameraPlayer } from "../../../components/camera/ha-camera-player";
@@ -54,10 +50,6 @@ class MoreInfoCamera extends LitElement {
@state() private _attached = false;
@state()
@consume({ context: adaptiveDialogModeContext, subscribe: true })
private _dialogMode?: DialogSheetMode;
@state() private _microphoneState: WebRtcMicrophoneState = "off";
@state() private _streamType?: CameraStreamType;
@@ -141,7 +133,6 @@ class MoreInfoCamera extends LitElement {
.stateObj=${this.stateObj}
allow-exoplayer
keep-awake
?fill=${this._dialogMode === "bottom-sheet"}
@microphone-changed=${this._microphoneChanged}
@stream-type-changed=${this._streamTypeChanged}
@camera-capabilities-changed=${this._capabilitiesChanged}
@@ -324,10 +315,6 @@ class MoreInfoCamera extends LitElement {
ev: HASSDomEvent<HASSDomEvents["stream-type-changed"]>
) {
this._streamType = ev.detail.type;
// A removed WebRTC player can't tell that its microphone stopped
if (ev.detail.type !== STREAM_TYPE_WEB_RTC && !this._useAppMicrophone) {
this._microphoneState = "off";
}
}
private _capabilitiesChanged(
@@ -347,9 +334,7 @@ class MoreInfoCamera extends LitElement {
static styles = css`
:host {
display: flex;
flex-direction: column;
flex: 1;
display: block;
}
.buttons {
@@ -2,6 +2,8 @@ import { css, html, LitElement, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
import { consume } from "../../../common/decorators/consume";
import { transform } from "../../../common/decorators/transform";
import type { HASSDomCurrentTargetEvent } from "../../../common/dom/fire_event";
import { fireEvent } from "../../../common/dom/fire_event";
import { connectionContext, formattersContext } from "../../../data/context";
import type { ImageEntity } from "../../../data/image";
import { computeImageUrl } from "../../../data/image";
@@ -28,6 +30,17 @@ class MoreInfoImage extends LitElement {
@property({ attribute: false }) public stateObj?: ImageEntity;
private _size?: HASSDomEvents["media-size-changed"];
public connectedCallback() {
super.connectedCallback();
// A cached view that was detached while the picture loaded couldn't send
// its size, and the picture doesn't load again when it's shown
if (this._size) {
fireEvent(this, "media-size-changed", this._size);
}
}
protected render() {
if (!this._connection || !this.stateObj) {
return nothing;
@@ -39,16 +52,28 @@ class MoreInfoImage extends LitElement {
return html`<img
alt=${this._formatEntityName?.(this.stateObj) || this.stateObj.entity_id}
src=${this._connection.hassUrl(imageUrl)}
@load=${this._imageLoaded}
/> `;
}
private _imageLoaded(ev: HASSDomCurrentTargetEvent<HTMLImageElement>) {
const { naturalWidth, naturalHeight } = ev.currentTarget;
if (!naturalWidth || !naturalHeight) {
return;
}
this._size = { aspectRatio: naturalWidth / naturalHeight, naturalWidth };
fireEvent(this, "media-size-changed", this._size);
}
static styles = css`
:host {
display: block;
text-align: center;
}
img {
display: block;
margin: 0 auto;
max-width: 100%;
max-height: var(--more-info-media-max-height, none);
}
`;
}
+69 -47
View File
@@ -149,10 +149,12 @@ export class MoreInfoDialog extends DirtyStateProviderMixin<
@property({ type: Boolean, reflect: true }) public large = false;
@state() private _fill = false;
// The dialog grows with the camera's or image's picture, as high as there
// is room for
@state() private _mediaAspectRatio?: number;
// The dialog grows with the camera's picture, as high as there is room for
@state() private _cameraAspectRatio?: number;
// An image is not shown larger than it is
@state() private _mediaNaturalWidth?: number;
// Height of the controls the camera's info shows below the picture
@state() private _cameraControlsHeight?: string;
@@ -196,12 +198,6 @@ export class MoreInfoDialog extends DirtyStateProviderMixin<
}
public showDialog(params: MoreInfoDialogParams) {
// The camera player keeps running for the same entity and doesn't send
// its size again
if (params.entityId !== this._entityId) {
this._cameraAspectRatio = undefined;
this._cameraControlsHeight = undefined;
}
this._entityId = params.entityId;
if (!this._entityId) {
this.closeDialog();
@@ -219,7 +215,6 @@ export class MoreInfoDialog extends DirtyStateProviderMixin<
this._detailsYamlMode = false;
this.large = params.large ?? false;
this._fill = false;
this._open = true;
this._loadEntityRegistryEntry();
}
@@ -265,8 +260,6 @@ export class MoreInfoDialog extends DirtyStateProviderMixin<
this._currView = DEFAULT_VIEW;
this._childViewStack = [];
this._returnUrl = undefined;
this._cameraAspectRatio = undefined;
this._cameraControlsHeight = undefined;
this._isEscapeEnabled = true;
window.removeEventListener("dialog-closed", this._enableEscapeKeyClose);
window.removeEventListener("show-dialog", this._disableEscapeKeyClose);
@@ -691,30 +684,32 @@ export class MoreInfoDialog extends DirtyStateProviderMixin<
`
: nothing;
// Also when the camera was opened from a smaller entity's related view
const cameraAspectRatio =
domain === "camera" && isDefaultView
? this._cameraAspectRatio
// Also when it was opened from a smaller entity's related view
const mediaAspectRatio =
(domain === "camera" || domain === "image") && isDefaultView
? this._mediaAspectRatio
: undefined;
// As wide as the picture is when it's as high as there is room for
const fullHeightWidth = `var(--more-info-media-max-height) * ${mediaAspectRatio}`;
const mediaPictureWidth = this._mediaNaturalWidth
? `min(${fullHeightWidth}, ${this._mediaNaturalWidth}px)`
: fullHeightWidth;
return html`
<ha-adaptive-dialog
.open=${this._open}
.width=${
this._fill
? "full"
: this.large || cameraAspectRatio
? "large"
: "medium"
}
class=${classMap({ camera: domain === "camera" })}
.width=${this.large || mediaAspectRatio ? "large" : "medium"}
class=${classMap({
camera: domain === "camera",
image: domain === "image",
})}
style=${styleMap({
"--more-info-camera-controls-height": this._cameraControlsHeight,
"--ha-dialog-width-lg": cameraAspectRatio
? `clamp(var(--ha-dialog-width-md, 580px), calc(var(--video-max-height) * ${cameraAspectRatio}), 1920px)`
"--ha-dialog-width-lg": mediaAspectRatio
? `clamp(var(--ha-dialog-width-md, 580px), calc(${mediaPictureWidth} + var(--more-info-media-inline-padding, 0px)), 1920px)`
: undefined,
})}
@camera-aspect-ratio-changed=${this._cameraAspectRatioChanged}
@media-size-changed=${this._mediaSizeChanged}
@camera-controls-height-changed=${this._cameraControlsHeightChanged}
.accessibleLabel=${title}
@closed=${this._dialogClosed}
@@ -747,7 +742,7 @@ export class MoreInfoDialog extends DirtyStateProviderMixin<
></ha-icon-button-prev>
`
}
<span slot="headerTitle" @click=${this._enlarge} class="title">
<span slot="headerTitle" class="title">
${
breadcrumb.length > 0
? !__DEMO__ && isAdmin
@@ -1071,6 +1066,17 @@ export class MoreInfoDialog extends DirtyStateProviderMixin<
`;
}
protected willUpdate(changedProps: PropertyValues) {
super.willUpdate(changedProps);
// Also when going to a related entity or back. The camera player or image
// of the same entity keeps running and doesn't send its size again.
if (changedProps.has("_entityId")) {
this._mediaAspectRatio = undefined;
this._mediaNaturalWidth = undefined;
this._cameraControlsHeight = undefined;
}
}
protected firstUpdated(changedProps: PropertyValues<this>) {
super.firstUpdated(changedProps);
this.addEventListener("close-dialog", () => this.closeDialog());
@@ -1140,10 +1146,11 @@ export class MoreInfoDialog extends DirtyStateProviderMixin<
this._entry = ev.detail;
}
private _cameraAspectRatioChanged(
ev: HASSDomEvent<HASSDomEvents["camera-aspect-ratio-changed"]>
private _mediaSizeChanged(
ev: HASSDomEvent<HASSDomEvents["media-size-changed"]>
) {
this._cameraAspectRatio = ev.detail.aspectRatio;
this._mediaAspectRatio = ev.detail.aspectRatio;
this._mediaNaturalWidth = ev.detail.naturalWidth;
}
private _cameraControlsHeightChanged(
@@ -1152,12 +1159,6 @@ export class MoreInfoDialog extends DirtyStateProviderMixin<
this._cameraControlsHeight = ev.detail.height;
}
private _enlarge() {
withViewTransition(() => {
this._fill = !this._fill;
});
}
private _handleOpened() {
window.addEventListener("dialog-closed", this._enableEscapeKeyClose);
window.addEventListener("show-dialog", this._disableEscapeKeyClose);
@@ -1216,12 +1217,14 @@ export class MoreInfoDialog extends DirtyStateProviderMixin<
--dialog-content-padding: 0;
}
/* The dialog's margin, its header of about 68px and the controls
below the picture */
ha-adaptive-dialog.camera {
--video-max-height: calc(
100vh - var(--ha-space-20) -
68px - var(--more-info-camera-controls-height, 0px)
/* The dialog's margin, the safe area like the dialog's height limit,
its header of about 68px and what the info shows besides the
picture */
ha-adaptive-dialog.camera,
ha-adaptive-dialog.image {
--more-info-media-max-height: calc(
100vh - var(--ha-space-20) - var(--safe-area-inset-y, 0px) -
68px - var(--more-info-media-reserved-height, 0px)
);
/* Along with the height of the picture */
--ha-dialog-width-transition:
@@ -1232,14 +1235,33 @@ export class MoreInfoDialog extends DirtyStateProviderMixin<
/* A custom property takes any value, so it can't fall back to the
declaration before it. svh like the height limit of the dialog. */
@supports (height: 1svh) {
ha-adaptive-dialog.camera {
--video-max-height: calc(
100svh - var(--ha-space-20) -
68px - var(--more-info-camera-controls-height, 0px)
ha-adaptive-dialog.camera,
ha-adaptive-dialog.image {
--more-info-media-max-height: calc(
100svh - var(--ha-space-20) - var(--safe-area-inset-y, 0px) -
68px - var(--more-info-media-reserved-height, 0px)
);
}
}
ha-adaptive-dialog.camera {
--more-info-media-reserved-height: var(
--more-info-camera-controls-height,
0px
);
--video-max-height: var(--more-info-media-max-height);
}
/* The info's padding around the picture and the entity's row of 40px
above it, with 16px between them */
ha-adaptive-dialog.image {
--more-info-media-reserved-height: calc(
var(--ha-space-6) +
max(var(--safe-area-inset-bottom, 0px), var(--ha-space-6)) + 56px
);
--more-info-media-inline-padding: calc(var(--ha-space-6) * 2);
}
.content-wrapper {
flex: 1 1 auto;
min-height: 0;
+32 -118
View File
@@ -13,7 +13,6 @@ import { fireEvent } from "../../common/dom/fire_event";
import type { HASSDomCurrentTargetEvent } from "../../common/dom/fire_event";
import "../../components/animation/ha-fade-in";
import "../../components/ha-adaptive-dialog";
import "../../components/ha-alert";
import "../../components/ha-expansion-panel";
import "../../components/ha-icon-next";
import "../../components/ha-spinner";
@@ -21,10 +20,6 @@ import "../../components/item/ha-list-item-button";
import type { HaListItemButton } from "../../components/item/ha-list-item-button";
import "../../components/list/ha-list-base";
import "../../components/progress/ha-progress-bar";
import {
getBackupState,
type BackupManagerState,
} from "../../data/backup_manager";
import {
extractApiErrorMessage,
ignoreSupervisorError,
@@ -36,14 +31,14 @@ import {
shutdownHost,
} from "../../data/hassio/host";
import { haStyle, haStyleDialog } from "../../resources/styles";
import type { HomeAssistant, ServiceCallRequest } from "../../types";
import type { HomeAssistant } from "../../types";
import { HOST_ACTION_TOAST_ID, showToast } from "../../util/toast";
import { showAlertDialog } from "../generic/show-dialog-box";
import {
showAlertDialog,
showConfirmationDialog,
} from "../generic/show-dialog-box";
import { showRestartWaitDialog } from "./show-dialog-restart";
import "./automation-restart-status";
confirmRestartAction,
showRestartConfirmation,
type RestartAction,
} from "./show-restart-confirmation";
@customElement("dialog-restart")
class DialogRestart extends LitElement {
@@ -74,15 +69,6 @@ class DialogRestart extends LitElement {
}
}
private async _loadBackupState() {
try {
return await getBackupState(this.hass);
} catch (_err) {
// Do nothing
return "idle";
}
}
private async _loadHostInfo() {
this._loadingHostInfo = true;
try {
@@ -273,45 +259,16 @@ class DialogRestart extends LitElement {
duration: 1000,
});
this._restartAction(
"homeassistant",
"reload_all",
this.hass.localize("ui.dialogs.restart.reload.failed")
)();
}
private _getBackupProgressMessage(backupState: BackupManagerState) {
switch (backupState) {
case "create_backup":
return this.hass.localize("ui.dialogs.restart.backup_in_progress");
case "receive_backup":
return this.hass.localize("ui.dialogs.restart.upload_in_progress");
case "restore_backup":
return this.hass.localize("ui.dialogs.restart.restore_in_progress");
default:
return "";
try {
await this.hass.callService("homeassistant", "reload_all");
} catch (err: any) {
showAlertDialog(this, {
title: this.hass.localize("ui.dialogs.restart.reload.failed"),
text: err.message,
});
}
}
private _restartAction =
(
domain: ServiceCallRequest["domain"],
service: ServiceCallRequest["service"],
errorTitle: string,
serviceData?: ServiceCallRequest["serviceData"]
) =>
async () => {
try {
await this.hass.callService(domain, service, serviceData);
} catch (err: any) {
showAlertDialog(this, {
title: errorTitle,
text: err.message,
});
}
};
private _hostAction =
(toastMessage: string, action: "reboot" | "shutdown") => async () => {
showToast(this, {
@@ -343,75 +300,32 @@ class DialogRestart extends LitElement {
};
private async _handleAction(
ev: HASSDomCurrentTargetEvent<
HaListItemButton & {
action: "restart" | "reboot" | "shutdown" | "restart-safe-mode";
}
>
ev: HASSDomCurrentTargetEvent<HaListItemButton & { action: RestartAction }>
) {
if (this._loadingBackupInfo) {
return;
}
this._loadingBackupInfo = true;
const action = ev.currentTarget.action;
const backupState = await this._loadBackupState();
const backupProgressMessage = this._getBackupProgressMessage(backupState);
this._loadingBackupInfo = false;
const confirmed = await showConfirmationDialog(this, {
title: this.hass.localize(`ui.dialogs.restart.${action}.confirm_title`),
text: html`${this.hass.localize(
`ui.dialogs.restart.${action}.confirm_description`
)}${
backupProgressMessage
? html`<br /><br /><ha-alert>${backupProgressMessage}</ha-alert>`
: nothing
} <br /><br /><automation-restart-status></automation-restart-status>`,
confirmText: this.hass.localize(
`ui.dialogs.restart.${action}.confirm_action${backupState === "idle" ? "" : "_backup"}`
),
destructive: true,
});
if (!confirmed) {
return;
try {
const confirmed =
action === "restart" || action === "restart-safe-mode"
? await showRestartConfirmation(this, this.hass, action)
: await confirmRestartAction(
this,
this.hass,
action,
this._hostAction(
this.hass.localize(`ui.dialogs.restart.${action}.action_toast`),
action
)
);
if (confirmed) {
this._dialogOpen = false;
}
} finally {
this._loadingBackupInfo = false;
}
this._dialogOpen = false;
let actionFunc: () => Promise<void>;
if (["restart", "restart-safe-mode"].includes(action)) {
const serviceData =
action === "restart-safe-mode" ? { safe_mode: true } : undefined;
actionFunc = this._restartAction(
"homeassistant",
"restart",
this.hass.localize(`ui.dialogs.restart.${action}.failed`),
serviceData
);
} else {
actionFunc = this._hostAction(
this.hass.localize(
`ui.dialogs.restart.${action as "reboot" | "shutdown"}.action_toast`
),
action as "reboot" | "shutdown"
);
}
if (backupState !== "idle") {
showRestartWaitDialog(this, {
title: this.hass.localize(`ui.dialogs.restart.${action}.title`),
initialBackupState: backupState,
action: actionFunc,
});
return;
}
actionFunc();
}
static get styles(): CSSResultGroup {
@@ -0,0 +1,96 @@
import { html, nothing } from "lit";
import "../../components/ha-alert";
import {
getBackupState,
type BackupManagerState,
} from "../../data/backup_manager";
import type { HomeAssistant } from "../../types";
import {
showAlertDialog,
showConfirmationDialog,
} from "../generic/show-dialog-box";
import "./automation-restart-status";
import { showRestartWaitDialog } from "./show-dialog-restart";
export type RestartAction =
"restart" | "reboot" | "shutdown" | "restart-safe-mode";
type ConfirmationContext = Pick<HomeAssistant, "connection" | "localize">;
function getBackupProgressMessage(
localize: HomeAssistant["localize"],
backupState: BackupManagerState
) {
switch (backupState) {
case "create_backup":
return localize("ui.dialogs.restart.backup_in_progress");
case "receive_backup":
return localize("ui.dialogs.restart.upload_in_progress");
case "restore_backup":
return localize("ui.dialogs.restart.restore_in_progress");
default:
return "";
}
}
export async function confirmRestartAction(
element: HTMLElement,
hass: ConfirmationContext,
action: RestartAction,
run: () => Promise<void>
) {
const backupState = await getBackupState(hass).catch(() => "idle" as const);
const backupProgressMessage = getBackupProgressMessage(
hass.localize,
backupState
);
const confirmed = await showConfirmationDialog(element, {
title: hass.localize(`ui.dialogs.restart.${action}.confirm_title`),
text: html`${hass.localize(
`ui.dialogs.restart.${action}.confirm_description`
)}${
backupProgressMessage
? html`<br /><br /><ha-alert>${backupProgressMessage}</ha-alert>`
: nothing
} <br /><br /><automation-restart-status></automation-restart-status>`,
confirmText: hass.localize(
`ui.dialogs.restart.${action}.confirm_action${backupState === "idle" ? "" : "_backup"}`
),
destructive: true,
});
if (!confirmed) {
return false;
}
if (backupState !== "idle") {
showRestartWaitDialog(element, {
title: hass.localize(`ui.dialogs.restart.${action}.title`),
initialBackupState: backupState,
action: run,
});
} else {
run();
}
return true;
}
export function showRestartConfirmation(
element: HTMLElement,
hass: ConfirmationContext & Pick<HomeAssistant, "callService">,
action: "restart" | "restart-safe-mode" = "restart"
) {
return confirmRestartAction(element, hass, action, async () => {
try {
await hass.callService(
"homeassistant",
"restart",
action === "restart-safe-mode" ? { safe_mode: true } : undefined
);
} catch (err: any) {
showAlertDialog(element, {
title: hass.localize(`ui.dialogs.restart.${action}.failed`),
text: err.message,
});
}
});
}
@@ -145,7 +145,9 @@ export class HaVoiceAssistantSetupDialog extends LitElement {
return html`
<ha-dialog
.open=${this._open}
header-title="Voice Satellite setup"
header-title=${this.hass.localize(
"ui.panel.config.voice_assistants.satellite_wizard.title"
)}
prevent-scrim-close
@closed=${this._dialogClosed}
>
@@ -44,7 +44,7 @@ export class HaVoiceAssistantSetupStepChangeWakeWord extends LitElement {
@click=${this._wakeWordPicked}
.value=${wakeWord.id}
>
<div slot="headline">${wakeWord.wake_word}</div>
${wakeWord.wake_word}
<ha-icon-next slot="end"></ha-icon-next>
</ha-list-item-button>`
)}
@@ -514,16 +514,8 @@ class AddIntegrationDialog extends LitElement {
return [...integrations]
.filter((item) => !brand || item.domain === brand)
.sort(byName)
.flatMap((item) =>
this._brandRows(item)
.filter((row) => !row.is_header)
// The brand on the second line, so its entries read as a group
.map((row) =>
brand || !this._isBrand(item)
? row
: { ...row, description: item.name }
)
);
.flatMap((item) => this._brandRows(item))
.filter((row) => !brand || !row.is_header);
}
// A brand shows its integrations here, not itself, like the website
if (category) {
@@ -1215,11 +1207,17 @@ class AddIntegrationDialog extends LitElement {
})}
>
${
this._stickyBrand
? html`<ha-section-title class="sticky">
${this._stickyBrand}
</ha-section-title>`
: nothing
!this._stickyBrand
? nothing
: this._filter
? html`<ha-section-title class="sticky">
${this._stickyBrand}
</ha-section-title>`
: html`<ha-integration-list-title
class="sticky raised"
>
${this._stickyBrand}
</ha-integration-list-title>`
}
<ha-list-virtualized
.rows=${this._filter ? rows : this._withEndSpace(rows)}
@@ -1773,7 +1771,7 @@ class AddIntegrationDialog extends LitElement {
);
}
// The virtualizer positions rows, so CSS sticky can't hold the section title
// The virtualizer positions rows, so CSS sticky can't hold the brand
@eventOptions({ passive: true })
private _visibilityChanged(ev: HASSDomEvent<HaListVisibilityChangedDetail>) {
const rows = this._getRows();
@@ -1796,7 +1794,11 @@ class AddIntegrationDialog extends LitElement {
return html`<div style="height: var(--ha-space-2)"></div>`;
}
if (integration.is_header) {
return html`<ha-section-title>${integration.name}</ha-section-title>`;
return this._filter
? html`<ha-section-title>${integration.name}</ha-section-title>`
: html`<ha-integration-list-title>
${integration.name}
</ha-integration-list-title>`;
}
return html`
<ha-integration-list-item
@@ -6,9 +6,13 @@ import {
import type { PropertyValues } from "lit";
import { LitElement, css, html } from "lit";
import { customElement, property, state } from "lit/decorators";
import { repeat } from "lit/directives/repeat";
import type { UnsubscribeFunc } from "home-assistant-js-websocket";
import type { HassConfig, UnsubscribeFunc } from "home-assistant-js-websocket";
import memoizeOne from "memoize-one";
import { formatDateTimeWithSeconds } from "../../../../common/datetime/format_date_time";
import "../../../../components/ha-control-select-menu";
import type { SelectOption } from "../../../../components/ha-control-select-menu";
import type { HaDropdownSelectEvent } from "../../../../components/ha-dropdown";
import type { FrontendLocaleData } from "../../../../data/translation";
import type {
PipelineRunEvent,
AssistRunListing,
@@ -79,20 +83,20 @@ export class AssistPipelineDebug extends LitElement {
@click=${this._pickOlderRun}
.path=${mdiRayEndArrow}
></ha-icon-button>
<select .value=${this._runId} @change=${this._pickRun}>
${repeat(
this._runs,
(run) => run.pipeline_run_id,
(run) =>
html`<option value=${run.pipeline_run_id}>
${formatDateTimeWithSeconds(
new Date(run.timestamp),
this.hass.locale,
this.hass.config
)}
</option>`
<ha-control-select-menu
.label=${this.hass.localize(
"ui.panel.config.voice_assistants.debug.run"
)}
</select>
hide-label
show-arrow
.value=${this._runId}
.options=${this._runOptions(
this._runs,
this.hass.locale,
this.hass.config
)}
@wa-select=${this._pickRun}
></ha-control-select-menu>
<ha-icon-button
.disabled=${this._runs[0].pipeline_run_id === this._runId}
.label=${this.hass.localize(
@@ -254,8 +258,27 @@ export class AssistPipelineDebug extends LitElement {
this._runId = this._runs![curIndex - 1].pipeline_run_id;
}
private _pickRun(ev) {
this._runId = ev.target.value;
private _runOptions = memoizeOne(
(
runs: AssistRunListing[],
locale: FrontendLocaleData,
config: HassConfig
): SelectOption[] =>
runs.map((run) => ({
value: run.pipeline_run_id,
label: formatDateTimeWithSeconds(
new Date(run.timestamp),
locale,
config
),
}))
);
private _pickRun(ev: HaDropdownSelectEvent) {
const runId = ev.detail.item?.value;
if (runId) {
this._runId = runId;
}
}
static styles = [
@@ -270,6 +293,13 @@ export class AssistPipelineDebug extends LitElement {
border-bottom: var(--app-header-border-bottom, none);
box-sizing: border-box;
}
.toolbar ha-control-select-menu {
min-width: min(
240px,
calc(100% - 2 * var(--ha-icon-button-size, 48px))
);
--control-select-menu-height: 40px;
}
.content {
padding: 24px 0 32px;
max-width: var(--ha-content-width-narrow);
@@ -2,6 +2,7 @@ import type { HassEntity } from "home-assistant-js-websocket";
import type { PropertyValues } from "lit";
import { html, LitElement, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
import { live } from "lit/directives/live";
import { consume } from "../../../common/decorators/consume";
import {
consumeEntityState,
@@ -139,7 +140,7 @@ class HuiNumericInputCardFeature
return html`
<ha-control-number-buttons
.label=${label}
.value=${value}
.value=${live(value)}
.min=${stateObj.attributes.min}
.max=${stateObj.attributes.max}
.step=${stateObj.attributes.step}
@@ -153,7 +154,7 @@ class HuiNumericInputCardFeature
return html`
<ha-control-slider
.label=${label}
.value=${value}
.value=${live(value)}
.min=${stateObj.attributes.min}
.max=${stateObj.attributes.max}
.step=${stateObj.attributes.step}
@@ -0,0 +1,145 @@
import type { HassEntity } from "home-assistant-js-websocket";
import type { PropertyValues } from "lit";
import { LitElement, css, html, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
import { styleMap } from "lit/directives/style-map";
import { consume } from "../../../common/decorators/consume";
import durationToSeconds from "../../../common/datetime/duration_to_seconds";
import { consumeEntityState } from "../../../common/decorators/consume-context-entry";
import { computeDomain } from "../../../common/entity/compute_domain";
import type { HomeAssistant } from "../../../types";
import type { LovelaceCardFeature } from "../types";
import { cardFeatureStyles } from "./common/card-feature-styles";
import type {
LovelaceCardFeatureContext,
TimerProgressCardFeatureConfig,
} from "./types";
import { TimerRemainingTimeController } from "../../../common/controllers/timer-remaining-time-controller";
import { reducedMotionContext } from "../../../data/context";
export const supportsTimerProgressCardFeature = (
hass: HomeAssistant,
context: LovelaceCardFeatureContext
) => {
const stateObj = context.entity_id
? hass.states[context.entity_id]
: undefined;
return !!stateObj && computeDomain(stateObj.entity_id) === "timer";
};
@customElement("hui-timer-progress-card-feature")
class HuiTimerProgressCardFeature
extends LitElement
implements LovelaceCardFeature
{
@property({ attribute: false }) public context?: LovelaceCardFeatureContext;
@state()
@consumeEntityState({ entityIdPath: ["context", "entity_id"] })
private _stateObj?: HassEntity;
@state()
@consume({ context: reducedMotionContext, subscribe: true })
private _reducedMotion = false;
@state() private _config?: TimerProgressCardFeatureConfig;
private _timeRemaining = new TimerRemainingTimeController(this);
private _prevRatio = 0;
private _animate = false;
static getStubConfig(): TimerProgressCardFeatureConfig {
return { type: "timer-progress" };
}
public setConfig(config: TimerProgressCardFeatureConfig): void {
if (!config) {
throw new Error("Invalid configuration");
}
this._config = config;
}
protected update(changedProps: PropertyValues): void {
if (changedProps.has("_stateObj")) {
this._timeRemaining.setStateObj(this._stateObj);
}
if (this._stateObj) {
const ratio = this._ratio(this._stateObj);
this._animate =
!this._reducedMotion &&
this._stateObj.state === "active" &&
ratio <= this._prevRatio;
this._prevRatio = ratio;
}
super.update(changedProps);
}
private _ratio(stateObj: HassEntity, offset = 0): number {
const { duration } = stateObj.attributes;
const total =
typeof duration === "string" ? durationToSeconds(duration) : 0;
if (!total || stateObj.state === "idle") {
return 0;
}
const left = (this._timeRemaining.timeRemaining ?? 0) - offset;
return Math.min(Math.max(left / total, 0), 1);
}
protected render() {
if (
!this._config ||
!this.context ||
!this._stateObj ||
computeDomain(this._stateObj.entity_id) !== "timer"
) {
return nothing;
}
const stateObj = this._stateObj;
const ratio = this._ratio(stateObj);
const target = this._animate ? this._ratio(stateObj, 1) : ratio;
return html`
<div
class="track"
role="progressbar"
aria-label=${stateObj.attributes.friendly_name || stateObj.entity_id}
aria-valuemin="0"
aria-valuemax="100"
aria-valuenow=${Math.round(ratio * 100)}
>
<div
class="bar"
style=${styleMap({
transform: `scaleX(${target})`,
transition: this._animate ? "transform 1s linear" : "none",
})}
></div>
</div>
`;
}
static styles = [
cardFeatureStyles,
css`
:host {
pointer-events: none !important;
}
.track {
height: var(--feature-height);
border-radius: var(--feature-border-radius);
background: color-mix(in srgb, var(--feature-color) 20%, transparent);
overflow: hidden;
}
.bar {
height: 100%;
width: 100%;
transform-origin: var(--float-start, left);
background: var(--feature-color);
}
`,
];
}
declare global {
interface HTMLElementTagNameMap {
"hui-timer-progress-card-feature": HuiTimerProgressCardFeature;
}
}
@@ -43,6 +43,7 @@ import { supportsTargetHumidityCardFeature } from "./hui-target-humidity-card-fe
import { supportsTargetTemperatureCardFeature } from "./hui-target-temperature-card-feature";
import { supportsTimerActionsCardFeature } from "./hui-timer-actions-card-feature";
import { supportsTimerPresetsCardFeature } from "./hui-timer-presets-card-feature";
import { supportsTimerProgressCardFeature } from "./hui-timer-progress-card-feature";
import { supportsToggleCardFeature } from "./hui-toggle-card-feature";
import { supportsTrendGraphCardFeature } from "./hui-trend-graph-card-feature";
import { supportsUpdateActionsCardFeature } from "./hui-update-actions-card-feature";
@@ -110,6 +111,7 @@ export const UI_FEATURE_TYPES = [
"target-temperature",
"timer-actions",
"timer-presets",
"timer-progress",
"toggle",
"update-actions",
"vacuum-commands",
@@ -169,6 +171,7 @@ export const SUPPORTS_FEATURE_TYPES: Record<UiFeatureType, SupportsFeature> = {
"temperature-forecast": supportsTemperatureForecastCardFeature,
"timer-actions": supportsTimerActionsCardFeature,
"timer-presets": supportsTimerPresetsCardFeature,
"timer-progress": supportsTimerProgressCardFeature,
toggle: supportsToggleCardFeature,
"update-actions": supportsUpdateActionsCardFeature,
"vacuum-commands": supportsVacuumCommandsCardFeature,
@@ -237,6 +237,10 @@ export interface TimerPresetsCardFeatureConfig {
style?: "buttons" | "dropdown";
}
export interface TimerProgressCardFeatureConfig {
type: "timer-progress";
}
export interface WaterHeaterOperationModesCardFeatureConfig {
type: "water-heater-operation-modes";
style?: "dropdown" | "icons";
@@ -406,6 +410,7 @@ export type LovelaceCardFeatureConfig =
| TargetTemperatureCardFeatureConfig
| TimerActionsCardFeatureConfig
| TimerPresetsCardFeatureConfig
| TimerProgressCardFeatureConfig
| ToggleCardFeatureConfig
| UpdateActionsCardFeatureConfig
| VacuumCommandsCardFeatureConfig
@@ -84,7 +84,7 @@ const DOMAIN_VARIANTS: Record<string, TileVariant[]> = {
],
alarm_control_panel: [TILE_VARIANT, ["alarm-modes"]],
counter: [TILE_VARIANT, ["counter-actions"]],
timer: [TILE_VARIANT, ["timer-actions"]],
timer: [TILE_VARIANT, ["timer-actions"], ["timer-progress"]],
input_select: SELECT_VARIANTS,
select: SELECT_VARIANTS,
input_number: NUMERIC_INPUT_VARIANTS,
@@ -2,7 +2,7 @@ import { ResizeController } from "@lit-labs/observers/resize-controller";
import { mdiDotsVertical } from "@mdi/js";
import type { PropertyValues } from "lit";
import { LitElement, css, html, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
import { customElement, property, query, state } from "lit/decorators";
import { styleMap } from "lit/directives/style-map";
import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element";
import { fireEvent } from "../../../common/dom/fire_event";
@@ -25,13 +25,13 @@ import type { HumidifierCardConfig } from "./types";
@customElement("hui-humidifier-card")
export class HuiHumidifierCard extends LitElement implements LovelaceCard {
@query(".container") private _container?: HTMLElement;
// Observe .container, not the host: in a sections view the host keeps its
// size when the entity appears and the warning is replaced by the control.
private _resizeController = new ResizeController(this, {
callback: (entries) => {
const container = entries[0]?.target.shadowRoot?.querySelector(
".container"
) as HTMLElement | undefined;
return container?.clientHeight;
},
target: null,
callback: () => this._container?.clientHeight,
});
public static async getConfigElement(): Promise<LovelaceCardEditor> {
@@ -142,7 +142,7 @@ export class HuiHumidifierCard extends LitElement implements LovelaceCard {
return html`
<ha-card role="group" aria-labelledby="title">
<p class="title" id="title">${name}</p>
<div class="container">
<div class="container" ${this._resizeController.target()}>
<ha-state-control-humidifier-humidity
style=${styleMap({
maxWidth: controlMaxWidth,
@@ -387,7 +387,7 @@ class HuiPictureGlanceCard extends LitElement implements LovelaceCard {
}
ha-icon-button {
--ha-icon-button-size: 40px;
--disabled-text-color: currentColor;
--ha-color-on-disabled-quiet: currentColor;
color: var(--ha-picture-icon-button-color, #a9a9a9);
}
ha-icon-button.state-on {
@@ -2,7 +2,7 @@ import { ResizeController } from "@lit-labs/observers/resize-controller";
import { mdiDotsVertical } from "@mdi/js";
import type { PropertyValues } from "lit";
import { LitElement, css, html, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
import { customElement, property, query, state } from "lit/decorators";
import { styleMap } from "lit/directives/style-map";
import { applyThemesOnElement } from "../../../common/dom/apply_themes_on_element";
import { fireEvent } from "../../../common/dom/fire_event";
@@ -26,13 +26,13 @@ import type { ThermostatCardConfig } from "./types";
@customElement("hui-thermostat-card")
export class HuiThermostatCard extends LitElement implements LovelaceCard {
@query(".container") private _container?: HTMLElement;
// Observe .container, not the host: in a sections view the host keeps its
// size when the entity appears and the warning is replaced by the control.
private _resizeController = new ResizeController(this, {
callback: (entries) => {
const container = entries[0]?.target.shadowRoot?.querySelector(
".container"
) as HTMLElement | undefined;
return container?.clientHeight;
},
target: null,
callback: () => this._container?.clientHeight,
});
public static async getConfigElement(): Promise<LovelaceCardEditor> {
@@ -141,7 +141,7 @@ export class HuiThermostatCard extends LitElement implements LovelaceCard {
return html`
<ha-card role="group" aria-labelledby="title">
<p class="title" id="title">${name}</p>
<div class="container">
<div class="container" ${this._resizeController.target()}>
${
domain === "water_heater"
? html` <ha-state-control-water_heater-temperature
+63 -90
View File
@@ -11,7 +11,6 @@ import type {
} from "../../../common/dom/fire_event";
import { computeDomain } from "../../../common/entity/compute_domain";
import parseAspectRatio from "../../../common/util/parse-aspect-ratio";
import "../../../components/camera/ha-camera-placeholder";
import "../../../components/ha-camera-stream";
import type { HaCameraStream } from "../../../components/ha-camera-stream";
import "../../../components/ha-spinner";
@@ -136,12 +135,6 @@ export class HuiImage extends LitElement {
if (this._shouldStartCameraUpdates(oldHass)) {
this._startIntersectionObserver();
} else if (
this._cameraBecameAvailable(oldHass) &&
this._imageVisible &&
this.cameraView !== "live"
) {
this._updateCameraImageSrc();
} else if (!this.hass!.connected) {
this._stopUpdateCameraInterval();
this._stopIntersectionObserver();
@@ -271,13 +264,6 @@ export class HuiImage extends LitElement {
// Snapshots load only once the card is on screen; skip the spinner until then.
const showSpinner = !this.cameraImage || this._imageVisible;
const cameraUnavailable = this._cameraUnavailable();
const placeholderHeight = !useRatio
? this._lastImageHeight
? `${this._lastImageHeight}px`
: "100%"
: undefined;
return html`
<div
style=${styleMap({
@@ -302,66 +288,71 @@ export class HuiImage extends LitElement {
})}"
>
${
cameraUnavailable
? nothing
: this.cameraImage && this.cameraView === "live"
? html`
<ha-camera-stream
muted
.stateObj=${cameraObj}
.fitMode=${this.fitMode}
.aspectRatio=${
this._ratio ? this._ratio.w / this._ratio.h : undefined
}
@load=${this._onVideoLoad}
></ha-camera-stream>
this.cameraImage && this.cameraView === "live"
? html`
<ha-camera-stream
muted
.stateObj=${cameraObj}
.fitMode=${this.fitMode}
.aspectRatio=${
this._ratio ? this._ratio.w / this._ratio.h : undefined
}
@load=${this._onVideoLoad}
></ha-camera-stream>
`
: imageSrc === undefined
? nothing
: html`
<img
id="image"
src=${this._reconnectImg ? nothing : live(imageSrc)}
alt=${this.entity || ""}
@error=${this._onImageError}
@load=${this._onImageLoad}
style=${styleMap({
display:
useRatio || this._loadState === LoadState.Loaded
? "block"
: "none",
})}
/>
`
: imageSrc === undefined
? nothing
: html`
<img
id="image"
src=${this._reconnectImg ? nothing : live(imageSrc)}
alt=${this.entity || ""}
@error=${this._onImageError}
@load=${this._onImageLoad}
style=${styleMap({
display:
useRatio || this._loadState === LoadState.Loaded
? "block"
: "none",
})}
/>
`
}
${
this.cameraImage &&
(cameraUnavailable || this._loadState === LoadState.Error)
? html`<ha-camera-placeholder
style=${styleMap({ height: placeholderHeight })}
></ha-camera-placeholder>`
: this._loadState === LoadState.Error
this._loadState === LoadState.Error
? html`<div
id="brokenImage"
style=${styleMap({
height: !useRatio
? this._lastImageHeight
? `${this._lastImageHeight}px`
: "100%"
: undefined,
})}
></div>`
: this.cameraView !== "live" &&
(imageSrc === undefined ||
this._loadState === LoadState.Loading)
? html`<div
id="brokenImage"
style=${styleMap({ height: placeholderHeight })}
></div>`
: this.cameraView !== "live" &&
(imageSrc === undefined ||
this._loadState === LoadState.Loading)
? html`<div
class="progress-container"
style=${styleMap({ height: placeholderHeight })}
>
${
showSpinner
? html`<ha-spinner
class="render-spinner"
size="small"
></ha-spinner>`
: nothing
}
</div>`
: ""
class="progress-container"
style=${styleMap({
height: !useRatio
? this._lastImageHeight
? `${this._lastImageHeight}px`
: "100%"
: undefined,
})}
>
${
showSpinner
? html`<ha-spinner
class="render-spinner"
size="small"
></ha-spinner>`
: nothing
}
</div>`
: ""
}
</div>
`;
@@ -375,18 +366,6 @@ export class HuiImage extends LitElement {
);
}
private _cameraUnavailable(hass = this.hass): boolean {
return Boolean(
this.cameraImage && hass?.states[this.cameraImage]?.state === UNAVAILABLE
);
}
private _cameraBecameAvailable(oldHass?: HomeAssistant): boolean {
return Boolean(
oldHass && this._cameraUnavailable(oldHass) && !this._cameraUnavailable()
);
}
private _startIntersectionObserver(): void {
if (!this._intersectionObserver) {
this._intersectionObserver = new IntersectionObserver(
@@ -455,8 +434,7 @@ export class HuiImage extends LitElement {
}
private async _updateCameraImageSrc(): Promise<void> {
// Its picture can't load, a placeholder shows instead
if (!this.hass || !this.cameraImage || this._cameraUnavailable()) {
if (!this.hass || !this.cameraImage) {
return;
}
@@ -547,8 +525,7 @@ export class HuiImage extends LitElement {
}
.ratio img,
.ratio div,
.ratio ha-camera-placeholder {
.ratio div {
position: absolute;
top: 0;
left: 0;
@@ -560,10 +537,6 @@ export class HuiImage extends LitElement {
visibility: hidden;
}
ha-camera-placeholder {
background-color: var(--ha-color-fill-neutral-normal-resting);
}
#brokenImage {
background: grey url("/static/images/image-broken.svg") center/36px
no-repeat;
@@ -38,6 +38,7 @@ import "../card-features/hui-target-humidity-card-feature";
import "../card-features/hui-target-temperature-card-feature";
import "../card-features/hui-timer-actions-card-feature";
import "../card-features/hui-timer-presets-card-feature";
import "../card-features/hui-timer-progress-card-feature";
import "../card-features/hui-toggle-card-feature";
import "../card-features/hui-update-actions-card-feature";
import "../card-features/hui-vacuum-commands-card-feature";
@@ -104,6 +105,7 @@ const TYPES = new Set<LovelaceCardFeatureConfig["type"]>([
"temperature-forecast",
"timer-actions",
"timer-presets",
"timer-progress",
"toggle",
"update-actions",
"vacuum-commands",
@@ -1,8 +1,14 @@
import { mdiClose, mdiHelpCircleOutline } from "@mdi/js";
import {
mdiClose,
mdiFullscreen,
mdiFullscreenExit,
mdiHelpCircleOutline,
} from "@mdi/js";
import deepFreeze from "deep-freeze";
import type { CSSResultGroup, PropertyValues } from "lit";
import { css, html, LitElement, nothing } from "lit";
import { customElement, property, query, state } from "lit/decorators";
import { classMap } from "lit/directives/class-map";
import type { HASSDomEvent } from "../../../../common/dom/fire_event";
import { fireEvent } from "../../../../common/dom/fire_event";
import { ctrlOrCmdLabel } from "../../../../common/keyboard/ctrl-or-cmd";
@@ -68,6 +74,10 @@ export class HuiDialogEditBadge
@state() private _open = false;
@state() private _animateWidth = false;
private _largeBeforeCodeEditor = false;
@state() private _badgeConfig?: LovelaceBadgeConfig;
@state() private _saving = false;
@@ -92,6 +102,7 @@ export class HuiDialogEditBadge
this._badgeConfig = params.badgeConfig;
this.large = false;
this._animateWidth = false;
if (this._badgeConfig && !Object.isFrozen(this._badgeConfig)) {
this._badgeConfig = deepFreeze(this._badgeConfig);
}
@@ -195,6 +206,11 @@ export class HuiDialogEditBadge
.open=${this._open}
.accessibleLabel=${heading}
.width=${this.large ? "full" : "large"}
class=${classMap({
"animate-width": this._animateWidth,
"yaml-mode": !this._GUImode,
})}
@dialog-set-fullscreen=${this._stopWidthAnimation}
.preventScrimClose=${this.isEffectiveDirtyState}
@keydown=${this._ignoreKeydown}
@closed=${this._dialogClosed}
@@ -205,12 +221,18 @@ export class HuiDialogEditBadge
.label=${this.hass.localize("ui.common.close")}
.path=${mdiClose}
></ha-icon-button>
<span
slot="headerTitle"
class="title-enlargeable"
@click=${this._enlarge}
>${heading}</span
>
<span slot="headerTitle">${heading}</span>
<ha-icon-button
slot="headerActionItems"
class="enlarge"
.path=${this.large ? mdiFullscreenExit : mdiFullscreen}
.label=${this.hass.localize(
this.large
? "ui.panel.lovelace.editor.edit_badge.shrink"
: "ui.panel.lovelace.editor.edit_badge.enlarge"
)}
@click=${this._toggleLarge}
></ha-icon-button>
${
this._documentationURL !== undefined
? html`
@@ -304,10 +326,14 @@ export class HuiDialogEditBadge
`;
}
private _enlarge() {
withViewTransition(() => {
this.large = !this.large;
});
private _toggleLarge() {
this._animateWidth = true;
this.large = !this.large;
}
// The code editor's fullscreen changes the height at once, so the width must not lag behind
private _stopWidthAnimation() {
this._animateWidth = false;
}
private _ignoreKeydown(ev: KeyboardEvent) {
@@ -326,11 +352,21 @@ export class HuiDialogEditBadge
private _handleGUIModeChanged(ev: HASSDomEvent<GUIModeChangedEvent>): void {
ev.stopPropagation();
// Fired again on every error while staying in the same mode
if (ev.detail.guiMode !== this._GUImode) {
if (ev.detail.guiMode) {
this.large = this._largeBeforeCodeEditor;
} else {
this._largeBeforeCodeEditor = this.large;
this.large = true;
}
}
this._GUImode = ev.detail.guiMode;
this._guiModeAvailable = ev.detail.guiModeAvailable;
}
private _toggleMode(): void {
this._animateWidth = true;
withViewTransition(() => {
this._badgeEditorEl?.toggleMode();
});
@@ -494,8 +530,29 @@ export class HuiDialogEditBadge
ha-dialog ha-icon-button[slot="headerActionItems"] {
color: var(--secondary-text-color);
}
.title-enlargeable {
display: block;
@supports (min-height: min(1px, 2px)) {
@media (min-width: 1000px) {
ha-dialog.yaml-mode {
/* Minus the toolbar of the code editor */
--code-mirror-min-height: min(
500px,
var(--code-mirror-max-height, 100vh) - 28px
);
}
}
}
ha-dialog.animate-width {
--ha-dialog-width-transition:
min-width var(--ha-animation-duration-normal) ease-out,
max-width var(--ha-animation-duration-normal) ease-out;
}
ha-dialog[fullscreen] .enlarge {
display: none;
}
@media (max-width: 999px) {
.enlarge {
display: none;
}
}
`,
];
@@ -1,8 +1,14 @@
import { mdiClose, mdiHelpCircleOutline } from "@mdi/js";
import {
mdiClose,
mdiFullscreen,
mdiFullscreenExit,
mdiHelpCircleOutline,
} from "@mdi/js";
import deepFreeze from "deep-freeze";
import type { CSSResultGroup, PropertyValues } from "lit";
import { LitElement, css, html, nothing } from "lit";
import { customElement, property, query, state } from "lit/decorators";
import { classMap } from "lit/directives/class-map";
import memoizeOne from "memoize-one";
import type { HASSDomEvent } from "../../../../common/dom/fire_event";
import { fireEvent } from "../../../../common/dom/fire_event";
@@ -76,6 +82,10 @@ export class HuiDialogEditCard
@state() private _open = false;
@state() private _animateWidth = false;
private _largeBeforeCodeEditor = false;
@state() private _cardConfig?: LovelaceCardConfig;
@state() private _sectionConfig?: LovelaceSectionConfig;
@@ -104,6 +114,7 @@ export class HuiDialogEditCard
this._cardConfig = params.cardConfig;
this.large = false;
this._animateWidth = false;
if (this._cardConfig && !Object.isFrozen(this._cardConfig)) {
this._cardConfig = deepFreeze(this._cardConfig);
}
@@ -207,6 +218,11 @@ export class HuiDialogEditCard
.open=${this._open}
.accessibleLabel=${heading}
.width=${this.large ? "full" : "large"}
class=${classMap({
"animate-width": this._animateWidth,
"yaml-mode": !this._GUImode,
})}
@dialog-set-fullscreen=${this._stopWidthAnimation}
.preventScrimClose=${this.isEffectiveDirtyState}
@keydown=${this._ignoreKeydown}
@closed=${this._dialogClosed}
@@ -217,12 +233,18 @@ export class HuiDialogEditCard
.label=${this.hass.localize("ui.common.close")}
.path=${mdiClose}
></ha-icon-button>
<span
slot="headerTitle"
class="title-enlargeable"
@click=${this._enlarge}
>${heading}</span
>
<span slot="headerTitle">${heading}</span>
<ha-icon-button
slot="headerActionItems"
class="enlarge"
.path=${this.large ? mdiFullscreenExit : mdiFullscreen}
.label=${this.hass.localize(
this.large
? "ui.panel.lovelace.editor.edit_card.shrink"
: "ui.panel.lovelace.editor.edit_card.enlarge"
)}
@click=${this._toggleLarge}
></ha-icon-button>
${
this._documentationURL !== undefined
? html`
@@ -330,10 +352,14 @@ export class HuiDialogEditCard
`;
}
private _enlarge() {
withViewTransition(() => {
this.large = !this.large;
});
private _toggleLarge() {
this._animateWidth = true;
this.large = !this.large;
}
// The code editor's fullscreen changes the height at once, so the width must not lag behind
private _stopWidthAnimation() {
this._animateWidth = false;
}
private _ignoreKeydown(ev: KeyboardEvent) {
@@ -352,11 +378,21 @@ export class HuiDialogEditCard
private _handleGUIModeChanged(ev: HASSDomEvent<GUIModeChangedEvent>): void {
ev.stopPropagation();
// Fired again on every error while staying in the same mode
if (ev.detail.guiMode !== this._GUImode) {
if (ev.detail.guiMode) {
this.large = this._largeBeforeCodeEditor;
} else {
this._largeBeforeCodeEditor = this.large;
this.large = true;
}
}
this._GUImode = ev.detail.guiMode;
this._guiModeAvailable = ev.detail.guiModeAvailable;
}
private _toggleMode(): void {
this._animateWidth = true;
withViewTransition(() => {
this._cardEditorEl?.toggleMode();
});
@@ -576,8 +612,29 @@ export class HuiDialogEditCard
ha-dialog ha-icon-button[slot="headerActionItems"] {
color: var(--secondary-text-color);
}
.title-enlargeable {
display: block;
@supports (min-height: min(1px, 2px)) {
@media (min-width: 1000px) {
ha-dialog.yaml-mode {
/* Minus the toolbar of the code editor */
--code-mirror-min-height: min(
500px,
var(--code-mirror-max-height, 100vh) - 28px
);
}
}
}
ha-dialog.animate-width {
--ha-dialog-width-transition:
min-width var(--ha-animation-duration-normal) ease-out,
max-width var(--ha-animation-duration-normal) ease-out;
}
ha-dialog[fullscreen] .enlarge {
display: none;
}
@media (max-width: 999px) {
.enlarge {
display: none;
}
}
`,
];
@@ -67,6 +67,7 @@ import { supportsTargetHumidityCardFeature } from "../../card-features/hui-targe
import { supportsTargetTemperatureCardFeature } from "../../card-features/hui-target-temperature-card-feature";
import { supportsTimerActionsCardFeature } from "../../card-features/hui-timer-actions-card-feature";
import { supportsTimerPresetsCardFeature } from "../../card-features/hui-timer-presets-card-feature";
import { supportsTimerProgressCardFeature } from "../../card-features/hui-timer-progress-card-feature";
import { supportsToggleCardFeature } from "../../card-features/hui-toggle-card-feature";
import { supportsTrendGraphCardFeature } from "../../card-features/hui-trend-graph-card-feature";
import { supportsUpdateActionsCardFeature } from "../../card-features/hui-update-actions-card-feature";
@@ -136,6 +137,7 @@ const UI_FEATURE_TYPES = [
"temperature-forecast",
"timer-actions",
"timer-presets",
"timer-progress",
"toggle",
"update-actions",
"vacuum-commands",
@@ -239,6 +241,7 @@ const SUPPORTS_FEATURE_TYPES: Record<
"temperature-forecast": supportsTemperatureForecastCardFeature,
"timer-actions": supportsTimerActionsCardFeature,
"timer-presets": supportsTimerPresetsCardFeature,
"timer-progress": supportsTimerProgressCardFeature,
toggle: supportsToggleCardFeature,
"update-actions": supportsUpdateActionsCardFeature,
"vacuum-commands": supportsVacuumCommandsCardFeature,
@@ -96,8 +96,6 @@ export class HuiDialogEditSection
@property({ attribute: false }) public lovelace?: Lovelace;
@property({ type: Boolean, reflect: true }) public large = false;
@state() private _params?: EditSectionDialogParams;
@state() private _config?: LovelaceSectionRawConfig;
@@ -114,6 +112,8 @@ export class HuiDialogEditSection
@state() private _yamlError = false;
@state() private _animateWidth = false;
@storage({
key: "dashboardSectionPreviewMode",
state: true,
@@ -177,7 +177,7 @@ export class HuiDialogEditSection
private _dialogClosed(): void {
this._params = undefined;
this.large = false;
this._animateWidth = false;
this._yamlMode = false;
this._config = undefined;
this._currTab = TABS[0];
@@ -202,8 +202,14 @@ export class HuiDialogEditSection
? "tab-appearance"
: this._currTab;
// YAML mode accepts any value, and the dialog width depends on it
const configColumnSpan = this._config.column_span;
const columnSpan = Math.min(
this._config.column_span ?? DEFAULT_SECTION_COLUMN_SPAN,
typeof configColumnSpan === "number" &&
Number.isInteger(configColumnSpan) &&
configColumnSpan >= 1
? configColumnSpan
: DEFAULT_SECTION_COLUMN_SPAN,
this._viewConfig?.max_columns || DEFAULT_MAX_COLUMNS
);
const singleColumn = columnSpan === 1;
@@ -258,7 +264,13 @@ export class HuiDialogEditSection
<ha-dialog
.open=${this._open}
.accessibleLabel=${heading}
.width=${this.large ? "full" : "large"}
.width=${this._yamlMode ? "full" : "large"}
class=${classMap({
"animate-width": this._animateWidth,
"yaml-mode": this._yamlMode,
})}
style=${styleMap({ "--preview-column-span": previewColumnSpan })}
@dialog-set-fullscreen=${this._stopWidthAnimation}
.preventScrimClose=${this.isDirtyState}
@keydown=${this._ignoreKeydown}
@closed=${this._dialogClosed}
@@ -269,12 +281,7 @@ export class HuiDialogEditSection
.label=${this.hass.localize("ui.common.close")}
.path=${mdiClose}
></ha-icon-button>
<span
slot="headerTitle"
class="title-enlargeable"
@click=${this._enlarge}
>${heading}</span
>
<span slot="headerTitle">${heading}</span>
${
this._params.newSection
? nothing
@@ -454,6 +461,7 @@ export class HuiDialogEditSection
ev: ValueChangedEvent<LovelaceSectionRawConfig>
): void {
ev.stopPropagation();
this._animateWidth = true;
this._config = ev.detail.value;
this._updateDirtyState(this._config!);
}
@@ -494,15 +502,15 @@ export class HuiDialogEditSection
}
private _previewModeClicked(ev: Event) {
this._animateWidth = true;
this._storedPreviewMode = (
ev.currentTarget as HTMLElement & { mode: PreviewMode }
).mode;
}
private _enlarge() {
withViewTransition(() => {
this.large = !this.large;
});
// The code editor's fullscreen changes the height at once, so the width must not lag behind
private _stopWidthAnimation() {
this._animateWidth = false;
}
private _handleTabChanged(ev: CustomEvent): void {
@@ -524,6 +532,7 @@ export class HuiDialogEditSection
private async _toggleMode(): Promise<void> {
if (this._yamlMode && this._yamlError) return;
this._animateWidth = true;
await withViewTransition(() => {
this._yamlMode = !this._yamlMode;
});
@@ -737,6 +746,29 @@ export class HuiDialogEditSection
ha-dialog {
--dialog-content-padding: var(--ha-space-2);
--preview-column-width: 390px;
--preview-width: calc(
var(--preview-column-span) * var(--preview-column-width) +
(var(--preview-column-span) - 1) *
var(--ha-view-sections-column-gap, 32px)
);
}
@supports (min-height: min(1px, 2px)) {
@media (min-width: 1000px) {
ha-dialog.yaml-mode {
/* Minus the toolbar of the code editor */
--code-mirror-min-height: min(
500px,
var(--code-mirror-max-height, 100vh) - 28px
);
}
}
}
ha-dialog.animate-width {
--ha-dialog-width-transition:
min-width var(--ha-animation-duration-normal) ease-out,
max-width var(--ha-animation-duration-normal) ease-out;
}
.content {
@@ -752,29 +784,18 @@ export class HuiDialogEditSection
}
}
@media all and (min-width: 451px) and (min-height: 501px) {
:host([large]) .content {
max-width: none;
}
}
.content .preview-frame {
padding: 4px;
overflow-x: auto;
}
.content .section-preview {
--preview-column-width: 390px;
display: block;
margin: 0 auto;
max-width: var(--preview-column-width);
}
.content .section-preview.wide {
max-width: none;
width: calc(
var(--column-span) * var(--preview-column-width) +
(var(--column-span) - 1) *
var(--ha-view-sections-column-gap, 32px)
);
width: var(--preview-width);
}
.preview-header {
display: flex;
@@ -828,19 +849,36 @@ export class HuiDialogEditSection
}
@media (min-width: 1000px) {
ha-dialog {
--editor-column-width: 520px;
/* Plus the paddings of the preview */
--preview-column-total-width: calc(var(--preview-width) + 28px);
--ha-dialog-width-lg: calc(
var(--editor-column-width) + var(--preview-column-total-width) +
2 * var(--dialog-content-padding)
);
}
.content {
flex-direction: row;
max-height: var(--code-mirror-max-height);
}
.content > .element-editor {
box-sizing: border-box;
flex: 0 1 var(--editor-column-width);
padding-inline-end: var(--ha-space-4);
max-width: 500px;
}
.content > .element-preview {
flex: 1 1 0;
}
ha-dialog.yaml-mode .content > .element-editor {
flex: 1 0 var(--editor-column-width);
}
ha-dialog.yaml-mode .content > .element-preview {
box-sizing: border-box;
flex: 0 1 var(--preview-column-total-width);
}
.content > .element-editor,
.content > .element-preview {
flex-basis: 0;
flex-grow: 1;
flex-shrink: 1;
min-width: 0;
height: auto;
}
@@ -889,9 +927,6 @@ export class HuiDialogEditSection
margin-inline-end: auto;
margin-inline-start: initial;
}
.title-enlargeable {
display: block;
}
`,
];
}
@@ -90,6 +90,8 @@ export class HuiDialogEditView extends DirtyStateProviderMixin<LovelaceViewConfi
@state() private _open = false;
@state() private _animateWidth = false;
get _type(): string {
return getViewType(this._config);
}
@@ -136,6 +138,7 @@ export class HuiDialogEditView extends DirtyStateProviderMixin<LovelaceViewConfi
this._params = undefined;
this._config = {};
this._yamlMode = false;
this._animateWidth = false;
this._currTab = TABS[0];
fireEvent(this, "dialog-closed", { dialog: this.localName });
}
@@ -210,10 +213,12 @@ export class HuiDialogEditView extends DirtyStateProviderMixin<LovelaceViewConfi
<ha-dialog
.open=${this._open}
.accessibleLabel=${this._viewConfigTitle}
width="large"
.width=${this._yamlMode ? "full" : "large"}
.preventScrimClose=${this.isDirtyState}
@closed=${this._dialogClosed}
@dialog-set-fullscreen=${this._stopWidthAnimation}
class=${classMap({
"animate-width": this._animateWidth,
"yaml-mode": this._yamlMode,
})}
>
@@ -365,7 +370,13 @@ export class HuiDialogEditView extends DirtyStateProviderMixin<LovelaceViewConfi
}
}
// The code editor's fullscreen changes the height at once, so the width must not lag behind
private _stopWidthAnimation() {
this._animateWidth = false;
}
private async _toggleMode() {
this._animateWidth = true;
this._yamlMode = !this._yamlMode;
if (this._yamlMode) {
await this.updateComplete;
@@ -680,6 +691,29 @@ export class HuiDialogEditView extends DirtyStateProviderMixin<LovelaceViewConfi
ha-dialog.yaml-mode {
--dialog-content-padding: 0;
}
@media (min-width: 1000px) {
ha-dialog.yaml-mode {
/* 80px - margin of the dialog
137px - header and footer */
--code-mirror-max-height: calc(100vh - 217px);
}
}
@supports (min-height: min(1px, 2px)) {
@media (min-width: 1000px) {
ha-dialog.yaml-mode {
/* Minus the toolbar of the code editor */
--code-mirror-min-height: min(
500px,
var(--code-mirror-max-height, 100vh) - 28px
);
}
}
}
ha-dialog.animate-width {
--ha-dialog-width-transition:
min-width var(--ha-animation-duration-normal) ease-out,
max-width var(--ha-animation-duration-normal) ease-out;
}
h2 {
margin: 0;
font-size: inherit;
@@ -1,6 +1,7 @@
import type { PropertyValues } from "lit";
import { LitElement, css, html, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
import { live } from "lit/directives/live";
import { debounce } from "../../../common/util/debounce";
import "../../../components/ha-slider";
import "../../../components/input/ha-input";
@@ -88,7 +89,7 @@ class HuiNumberEntityRow extends LitElement implements LovelaceRow {
.step=${Number(stateObj.attributes.step)}
.min=${Number(stateObj.attributes.min)}
.max=${Number(stateObj.attributes.max)}
.value=${Number(stateObj.state)}
.value=${live(Number(stateObj.state))}
@change=${this._selectedValueChanged}
></ha-slider>
<span class="state">
@@ -111,7 +112,7 @@ class HuiNumberEntityRow extends LitElement implements LovelaceRow {
.step=${Number(stateObj.attributes.step)}
.min=${Number(stateObj.attributes.min)}
.max=${Number(stateObj.attributes.max)}
.value=${Number(stateObj.state).toString()}
.value=${live(Number(stateObj.state).toString())}
type="number"
@change=${this._selectedValueChanged}
>
@@ -1,5 +1,5 @@
import type { ContextType } from "@lit/context";
import { mdiCheckCircle, mdiDownload, mdiStar } from "@mdi/js";
import { mdiCheckCircle, mdiDownloadMultiple, mdiStar } from "@mdi/js";
import type { CSSResultGroup } from "lit";
import { css, html, LitElement, nothing } from "lit";
import { customElement, property, state } from "lit/decorators";
@@ -160,7 +160,7 @@ export class HaMarketplaceDiscover extends LitElement {
${
repository.downloads
? html`<span>
<ha-svg-icon .path=${mdiDownload}></ha-svg-icon>
<ha-svg-icon .path=${mdiDownloadMultiple}></ha-svg-icon>
${formatNumber(repository.downloads, locale, compact)}
</span>`
: nothing
@@ -6,7 +6,7 @@ import {
mdiCheckCircleOutline,
mdiCompassOutline,
mdiDotsVertical,
mdiDownload,
mdiDownloadMultiple,
mdiLinkPlus,
mdiOpenInNew,
mdiStar,
@@ -674,7 +674,7 @@ export class HaMarketplaceDashboard extends LitElement {
return html`${
narrow
? html`<ha-svg-icon .path=${mdiDownload}></ha-svg-icon>`
? html`<ha-svg-icon .path=${mdiDownloadMultiple}></ha-svg-icon>`
: nothing
}${formatNumber(repository.downloads, this._i18n.locale, compact)}`;
},
@@ -3,12 +3,11 @@ import {
mdiAccountGroup,
mdiAlertCircleOutline,
mdiArrowUpBoldCircleOutline,
mdiBug,
mdiCheckCircle,
mdiCheckCircleOutline,
mdiDotsVertical,
mdiDownload,
mdiGithub,
mdiDownloadMultiple,
mdiPackageVariantClosed,
mdiRestart,
mdiStar,
mdiTestTube,
@@ -58,7 +57,7 @@ import type { UpdateEntity } from "../../../data/update";
import { latestVersionIsSkipped } from "../../../data/update";
import { showConfigFlowDialog } from "../../../dialogs/config-flow/show-dialog-config-flow";
import { showConfirmationDialog } from "../../../dialogs/generic/show-dialog-box";
import { showRestartDialog } from "../../../dialogs/restart/show-dialog-restart";
import { showRestartConfirmation } from "../../../dialogs/restart/show-restart-confirmation";
import "../../../layouts/hass-error-screen";
import "../../../layouts/hass-loading-screen";
import "../../../layouts/hass-subpage";
@@ -175,6 +174,8 @@ export class HaMarketplaceRepositoryDashboard extends LitElement {
@consume({ context: connectionContext, subscribe: true })
private _connection!: ContextType<typeof connectionContext>;
@state() private _confirmingRestart = false;
@state() private _integrationCategoryIcons?: IntegrationCategoryIcons;
@state()
@@ -706,13 +707,12 @@ export class HaMarketplaceRepositoryDashboard extends LitElement {
if (!repository.installed) {
return {
kind: "available",
icon: mdiDownload,
icon: mdiPackageVariantClosed,
title: localize("ui.panel.marketplace.repository.status.not_installed"),
detail: localize("ui.panel.marketplace.repository.status.available", {
version: repository.available_version,
}),
action: this._installButton(
mdiDownload,
localize("ui.panel.marketplace.common.install")
),
};
@@ -734,11 +734,7 @@ export class HaMarketplaceRepositoryDashboard extends LitElement {
installed: repository.installed_version,
version: repository.available_version,
}),
action: this._installButton(
mdiArrowUpBoldCircleOutline,
localize("ui.common.update"),
this._update
),
action: this._installButton(localize("ui.common.update"), this._update),
};
}
@@ -755,9 +751,9 @@ export class HaMarketplaceRepositoryDashboard extends LitElement {
action: html`<ha-button
variant="warning"
appearance="filled"
.loading=${this._confirmingRestart}
@click=${this._restart}
>
<ha-svg-icon slot="start" .path=${mdiRestart}></ha-svg-icon>
${localize("ui.panel.marketplace.repository.next_step.restart_button")}
</ha-button>`,
};
@@ -800,12 +796,10 @@ export class HaMarketplaceRepositoryDashboard extends LitElement {
}
private _installButton(
icon: string,
label: string,
handler: () => void = this._installRepositoryDialog
) {
return html`<ha-button appearance="filled" @click=${handler}>
<ha-svg-icon slot="start" .path=${icon}></ha-svg-icon>
${label}
</ha-button>`;
}
@@ -938,7 +932,6 @@ type: module</pre>`,
target="_blank"
rel="noreferrer"
>
<ha-svg-icon slot="start" .path=${mdiGithub}></ha-svg-icon>
${localize("ui.panel.marketplace.repository.details.source_code")}
</ha-button>
<ha-button
@@ -947,7 +940,6 @@ type: module</pre>`,
target="_blank"
rel="noreferrer"
>
<ha-svg-icon slot="start" .path=${mdiBug}></ha-svg-icon>
${localize("ui.panel.marketplace.repository.details.issue_tracker")}
</ha-button>
</div>
@@ -1027,7 +1019,7 @@ type: module</pre>`,
}
if (repository.downloads) {
signals.push({
icon: mdiDownload,
icon: mdiDownloadMultiple,
text: localize("ui.panel.marketplace.repository.community.downloads", {
number: repository.downloads,
count: html`<strong
@@ -1092,8 +1084,20 @@ type: module</pre>`,
this._installRepositoryDialog();
}
private _restart() {
showRestartDialog(this);
private async _restart() {
if (this._confirmingRestart) {
return;
}
this._confirmingRestart = true;
try {
await showRestartConfirmation(this, {
localize: this._i18n.localize,
connection: this._connection.connection,
callService: this._api.callService,
});
} finally {
this._confirmingRestart = false;
}
}
private _setUp() {
@@ -1,4 +1,5 @@
import type { ContextType } from "@lit/context";
import { mdiGithub } from "@mdi/js";
import { css, html, LitElement, nothing } from "lit";
import { customElement, state } from "lit/decorators";
import memoizeOne from "memoize-one";
@@ -10,6 +11,7 @@ import "../../../components/ha-dialog";
import "../../../components/ha-dialog-footer";
import "../../../components/ha-form/ha-form";
import type { HaFormSchema } from "../../../components/ha-form/types";
import "../../../components/ha-svg-icon";
import "../../../components/progress/ha-progress-bar";
import { apiContext, internationalizationContext } from "../../../data/context";
import type { RepositoryType } from "../../../data/marketplace/repository";
@@ -79,6 +81,7 @@ export class DialogMarketplaceCustomRepositories extends DialogMixin<Marketplace
this._githubConnected
? nothing
: html`<ha-alert alert-type="info">
<ha-svg-icon slot="icon" .path=${mdiGithub}></ha-svg-icon>
${this._i18n.localize(
"ui.panel.marketplace.dialog_custom_repositories.github_needed"
)}
@@ -1,5 +1,6 @@
import type { RenderItemFunction } from "@lit-labs/virtualizer/virtualize";
import type { ContextType } from "@lit/context";
import { mdiSwapHorizontal, mdiUpdate } from "@mdi/js";
import type { CSSResultGroup } from "lit";
import { css, html, LitElement, nothing } from "lit";
import { customElement, state } from "lit/decorators";
@@ -21,6 +22,7 @@ import {
type PickerComboBoxItem,
} from "../../../components/ha-picker-combo-box";
import "../../../components/ha-spinner";
import "../../../components/ha-svg-icon";
import "../../../components/progress/ha-progress-bar";
import { relativeTime } from "../../../common/datetime/relative_time";
@@ -259,6 +261,7 @@ export class DialogMarketplaceInstall extends DialogMixin<MarketplaceInstallDial
{ domain: repository.domain }
)}
>
<ha-svg-icon slot="icon" .path=${mdiSwapHorizontal}></ha-svg-icon>
${this._i18n.localize(
"ui.panel.marketplace.dialog_install.replaces_built_in_warning",
{ repository: repository.name, domain: repository.domain }
@@ -281,6 +284,7 @@ export class DialogMarketplaceInstall extends DialogMixin<MarketplaceInstallDial
${
tooNew
? html`<ha-alert alert-type="warning">
<ha-svg-icon slot="icon" .path=${mdiUpdate}></ha-svg-icon>
${installBlockedReason(this._i18n.localize, repository)}
${this._i18n.localize(
"ui.panel.marketplace.dialog_install.older_version_hint"
+5
View File
@@ -305,6 +305,11 @@ export const haTheme = EditorView.theme({
".cm-scroller": { outline: "none" },
// On these instead of the editor, so that the gutter grows along
".cm-content, .cm-gutter": {
minHeight: "var(--code-mirror-min-height, 100%)",
},
".cm-content": {
caretColor: "var(--secondary-text-color)",
paddingTop: "16px",
+1 -10
View File
@@ -1,7 +1,6 @@
import type { PropertyValues } from "lit";
import type { HASSDomEvent } from "../common/dom/fire_event";
import { mainWindow } from "../common/dom/get_main_window";
import { computeDomain } from "../common/entity/compute_domain";
import { replaceCurrentUrl } from "../common/navigate";
import {
createMoreInfoUrl,
@@ -12,8 +11,6 @@ import type { MoreInfoDialogParams } from "../dialogs/more-info/ha-more-info-dia
import type { Constructor } from "../types";
import type { HassBaseEl } from "./hass-base-mixin";
const LARGE_MORE_INFO_DOMAINS = ["camera", "image"];
declare global {
// for fire event
interface HASSDomEvents {
@@ -47,13 +44,7 @@ export default <T extends Constructor<HassBaseEl>>(superClass: T) =>
{
entityId: ev.detail.entityId,
view,
large:
ev.detail.large ??
(ev.detail.entityId
? LARGE_MORE_INFO_DOMAINS.includes(
computeDomain(ev.detail.entityId)
)
: false),
large: ev.detail.large,
data: ev.detail.data,
returnUrl,
},
+12 -10
View File
@@ -1394,10 +1394,9 @@
"reset_zoom": "Reset zoom",
"zoom_hint": "Use {modifier} + scroll to zoom",
"connecting": "Connecting",
"live": "Live",
"unavailable": "[%key:state::default::unavailable%]",
"disconnected": "Disconnected",
"show_details": "Show connection details"
"stream_info": "Streaming with {type}. Show connection details",
"stream_info_connecting": "Connecting to the camera. Show connection details",
"stream_info_upgrading": "Streaming with {type}, connecting with {upgrading} in the background. Show connection details"
},
"web-rtc-player": {
"not_supported": "WebRTC is not supported in this browser.",
@@ -2423,7 +2422,7 @@
},
"recreate_entity_ids": {
"confirm_rename_title": "Are you sure you want to recreate your entity IDs?",
"confirm_rename_warning": "This will not change any configuration (like automations, scripts, scenes, dashboards) that is currently using these entities! You will have to manually edit them yourself to use the new entity IDs!",
"confirm_rename_warning": "This will not update any configuration (like automations, scripts, scenes, dashboards) that is currently using these entities! You will have to manually edit them yourself to use the new entity IDs!",
"will_rename": "{count} {count, plural,\n one {entity ID}\n other {entity IDs}\n} will be renamed",
"new": "New",
"old": "Old",
@@ -2855,11 +2854,6 @@
"intro": "Home Assistant starts with the connection that works most reliably and switches to a faster one as soon as it is ready.",
"still_images_only": "This camera has no video stream, so it shows a series of still images.",
"fallback_in_use": "The video streams of this camera could not be started, so still images are shown instead.",
"unavailable": "The camera is unavailable, so no stream can start. It connects again as soon as the camera is back.",
"disconnected": {
"home_assistant": "The connection to Home Assistant was lost, so the stream stopped. It starts again as soon as Home Assistant is reachable.",
"stream_failed": "WebRTC could not connect, and this camera has no other stream to fall back to. The player shows what went wrong."
},
"in_use": "In use",
"connecting": "Connecting",
"not_supported_count": "Not supported by this camera ({count})",
@@ -5800,6 +5794,7 @@
"expose_new_entities_info": "Should new entities be exposed? Exposes supported devices that are not classified as security devices."
},
"satellite_wizard": {
"title": "Voice satellite setup",
"skip": "Skip",
"not_available": "Your voice assistant is not available.",
"update": {
@@ -10959,6 +10954,8 @@
"pick_card": "Add to dashboard",
"pick_card_title": "Which card would you like to add to {name}",
"toggle_editor": "Toggle editor",
"enlarge": "Enlarge",
"shrink": "Shrink",
"unsaved_changes": "You have unsaved changes",
"confirm_cancel": "Are you sure you want to cancel?",
"show_visual_editor": "Show visual editor",
@@ -11007,6 +11004,8 @@
"pick_badge": "Which badge would you like to add?",
"pick_badge_title": "Which badge would you like to add to \"{name}\"?",
"toggle_editor": "[%key:ui::panel::lovelace::editor::edit_card::toggle_editor%]",
"enlarge": "[%key:ui::panel::lovelace::editor::edit_card::enlarge%]",
"shrink": "[%key:ui::panel::lovelace::editor::edit_card::shrink%]",
"unsaved_changes": "[%key:ui::panel::lovelace::editor::edit_card::unsaved_changes%]",
"confirm_cancel": "[%key:ui::panel::lovelace::editor::edit_card::confirm_cancel%]",
"show_visual_editor": "[%key:ui::panel::lovelace::editor::edit_card::show_visual_editor%]",
@@ -12457,6 +12456,9 @@
"dropdown": "[%key:ui::panel::lovelace::editor::features::types::climate-preset-modes::style_list::dropdown%]"
}
},
"timer-progress": {
"label": "Timer progress"
},
"fan-preset-modes": {
"label": "Fan preset modes",
"style": "[%key:ui::panel::lovelace::editor::features::types::climate-preset-modes::style%]",
@@ -177,6 +177,7 @@ exports[`generateStatisticsChartData > matches snapshot for a bar chart with sum
"datasets": [
{
"animationDurationUpdate": 0,
"barMaxWidth": 50,
"color": "#4269d07F",
"cursor": "default",
"data": [
@@ -347,6 +348,7 @@ exports[`generateStatisticsChartData > matches snapshot for a bar chart with sum
},
{
"animationDurationUpdate": 0,
"barMaxWidth": 50,
"color": "#f4bd4a7F",
"cursor": "default",
"data": [
@@ -1380,6 +1382,7 @@ exports[`generateStatisticsChartData > matches snapshot for a stacked bar chart
"datasets": [
{
"animationDurationUpdate": 0,
"barMaxWidth": 50,
"color": "#4269d07F",
"cursor": "default",
"data": [
@@ -1444,6 +1447,7 @@ exports[`generateStatisticsChartData > matches snapshot for a stacked bar chart
},
{
"animationDurationUpdate": 0,
"barMaxWidth": 50,
"color": "#f4bd4a7F",
"cursor": "default",
"data": [