Compare commits

..

298 Commits

Author SHA1 Message Date
Paul Bottein
637eb6e894 Fix new script/automation dialog 2024-12-11 09:22:47 +01:00
Simon Lamon
f688780677 Combine Edit in yaml and Edit in visual editor (2/2) (#23143)
* yaml / visual part 2

* clean up

* ci
2024-12-11 09:49:15 +02:00
Simon Lamon
0ce98a86e6 Combine Edit in yaml and Edit in visual editor (1/2) (#23142)
* yaml / visual part 1

* clean up

* clean up
2024-12-11 09:48:10 +02:00
Jan-Philipp Benecke
bf624f5ca7 Intercept default search shortcut and focus our search input on data table pages (#23209)
Intercept default search shortcut on data table pages
2024-12-11 09:34:27 +02:00
renovate[bot]
ce5ce37de7 Update formatjs monorepo (#23250)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-11 07:36:33 +01:00
Simon Zumbrunnen
da727d3a3a Added "Media player volume slider" card feature. (#23199)
* Added "Media player volume" card feature.

* Make sure the feature is not displayed on unsupported players

Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>

* Renamed to Media player volume *slider*

* Missed one rename.

---------

Co-authored-by: Simon Zumbrunnen <simon-zumbrunnen@users.noreply.github.com>
Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>
2024-12-10 13:36:56 +00:00
Paul Bottein
9d83cc6988 Use list item for integration quality scale (#23236) 2024-12-10 13:33:21 +02:00
Petar Petrov
ed625d4e0b Simplify dialog navigation to fix back button (#23220)
* Simplify dialog navigation to fix back btn

* add back comment

* manage dialog stack in the manager instead of history

* handle dialogs that refuse to close
2024-12-10 13:26:57 +02:00
Wendelin
84157c8ea5 Extract assist-chat out of voice-command-dialog (#23184) 2024-12-10 13:23:48 +02:00
Wendelin
8f19c0abb0 Use localStorage with Web Storage API (#23172) 2024-12-10 11:14:15 +01:00
Wendelin
008647aa7a Fix landingpage, supervisor release permission (#23223) 2024-12-10 10:51:25 +01:00
Wendelin
b86d6021da Revert "Update developer-tools-template.ts: add independent scrollbars for left & right panels for large screens" (#23237)
Revert "Update developer-tools-template.ts: add independent scrollbars for le…"

This reverts commit d1c981bc19.
2024-12-10 09:47:40 +00:00
Steve Repsher
98af479fd3 Drop support for IE 11 and Samsung 4 (#23234) 2024-12-10 10:35:33 +01:00
ildar170975
d1c981bc19 Update developer-tools-template.ts: add independent scrollbars for left & right panels for large screens (#17765)
* Update developer-tools-template.ts

* Update developer-tools-template.ts

* fix overflow

* Update src/panels/developer-tools/template/developer-tools-template.ts

Co-authored-by: Wendelin <12148533+wendevlin@users.noreply.github.com>

* Update src/panels/developer-tools/template/developer-tools-template.ts

Co-authored-by: Wendelin <12148533+wendevlin@users.noreply.github.com>

* Update developer-tools-template.ts

* Update src/panels/developer-tools/template/developer-tools-template.ts

Co-authored-by: Wendelin <12148533+wendevlin@users.noreply.github.com>

* Update developer-tools-template.ts

* prettier

* Update developer-tools-template.ts

* Update developer-tools-template.ts

* prettier

* Update developer-tools-template.ts

* prettier

* prettier

* Update developer-tools-template.ts

* prettier

* prettier

* prettier

* Update developer-tools-template.ts

---------

Co-authored-by: Wendelin <12148533+wendevlin@users.noreply.github.com>
2024-12-10 10:11:48 +01:00
dependabot[bot]
1b0e53d3d9 Bump nanoid from 3.3.7 to 3.3.8 (#23235)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-10 09:21:23 +01:00
renovate[bot]
0d49927541 Update dependency @codemirror/view to v6.35.2 (#23232)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-10 08:30:36 +01:00
Charles Garwood
9e8d452438 Fix typo in translations build script (#23227)
* Fix typo in build script
2024-12-09 18:23:23 +00:00
renovate[bot]
ddd646007e Update dependency @codemirror/view to v6.35.1 (#23221)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-09 17:18:38 +01:00
Norbert Rittel
787fba82bd Improve "Restore?" option for Timer helpers (#23213)
When creating or editing a Timer helper the option "Restore?" can be ticked by the user.

This should not be a question but rather just the option itself and in addition this should better explain its purpose as there is a full line of text possible.

This commit fixes this by adding a similar explanation as for a Counter helpers, following the explanation in the online docs.
2024-12-09 16:43:48 +02:00
renovate[bot]
1393a3ade8 Update vaadinWebComponents monorepo to v24.5.5 (#23219)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-09 11:37:34 +01:00
ildar170975
bf24d67066 Fix "Integration entries" page for yaml-based integrations (#23201)
* Update ha-config-integration-page.ts

* prettier
2024-12-09 09:06:18 +02:00
dependabot[bot]
9774deef6d Bump actions/cache from 4.1.2 to 4.2.0 (#23217)
Bumps [actions/cache](https://github.com/actions/cache) from 4.1.2 to 4.2.0.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v4.1.2...v4.2.0)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-09 08:52:56 +02:00
Paulus Schoutsen
8390c6e29b Fix voice debug link (#23214) 2024-12-08 22:32:43 +01:00
Christopher Fenner
c78d371a9c Correct overwriting integration labelling on integrations page (#23206)
* Update ha-config-integration-page.ts

fixes #22776

* update icon color

---------

Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>
2024-12-08 17:21:34 +00:00
renovate[bot]
7750299a66 Update dependency @types/leaflet to v1.9.15 (#23202)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-07 22:33:51 +01:00
renovate[bot]
43f31dd455 Update dependency prettier to v3.4.2 (#23195)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-07 09:54:27 +01:00
karwosts
df21900341 No script entities in scenes (#23192) 2024-12-07 02:45:25 +01:00
Paul Bottein
6934f0626c Fix boolean attributes (#23189) 2024-12-06 18:39:34 +01:00
Paul Bottein
ea5bf17780 Fix has-secondary attribute (#23187) 2024-12-06 15:16:33 +00:00
Bram Kragten
0b7af715a8 Fix label selector when required (#23186) 2024-12-06 15:14:30 +00:00
Petar Petrov
8579bee053 Don't allow any more eslint warnings (#23181) 2024-12-06 14:58:04 +01:00
Petar Petrov
400ddbf625 Fix attributes broken by the warning fixes (#23182) 2024-12-06 14:56:42 +01:00
renovate[bot]
5fdefc0c20 Update dependency @rsdoctor/rspack-plugin to v0.4.11 (#23175)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-06 12:57:02 +02:00
renovate[bot]
c72c74828e Update rspack monorepo to v1.1.5 (#23176)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-06 11:23:31 +01:00
Petar Petrov
e0b157d280 Remove @web/dev-server (#23179) 2024-12-06 09:54:28 +00:00
Petar Petrov
e02736b4e2 ZwaveJS: Handle S2 inclusion via Inclusion Controller (#23100) 2024-12-06 11:32:45 +02:00
Petar Petrov
af049274d9 Cleanup unused WDS deps and config (#23155)
* Cleanup unused WDS deps and config

* fix
2024-12-06 09:57:46 +01:00
Petar Petrov
7a12fd2853 Fix ALL the eslint warnings (#23165)
* Fix many lint warnings

* Fix ALL lint warnings

* small fix

* type fixes
2024-12-06 09:55:07 +01:00
Paul Bottein
f724d8e7a9 Fix text color in ha-md-select in dark mode (#23174) 2024-12-06 09:19:56 +01:00
Bram Kragten
0d7e0df194 Add localisation to voice wizard (#23169)
* Add localization to voice wizard

* more
2024-12-06 09:11:17 +02:00
renovate[bot]
7d567bc386 Update vitest monorepo to v2.1.8 (#23166)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-05 17:33:14 +01:00
karwosts
ad52386ae0 Missing horiz swing mode import (#23168) 2024-12-05 16:02:55 +00:00
Paul Bottein
512fee47b6 Improve trigger and action description for conversation (#23141) 2024-12-05 17:01:04 +01:00
Petar Petrov
4092f56ea5 Remove Zopfli compression (#23157) 2024-12-05 14:01:25 +01:00
renovate[bot]
926972cce6 Update vitest monorepo to v2.1.7 (#23156)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-05 12:58:37 +02:00
Bram Kragten
d51eea7bb6 Voice addon install: try to find discovered flow (#23146) 2024-12-05 10:14:06 +01:00
karwosts
a3ca889ca3 Location selector: Move location on map click (#22198)
* Add button to location-selector to move marker to current view

* move on click

* double-click handling
2024-12-05 08:55:53 +02:00
renovate[bot]
a7406b3201 Update dependency globals to v15.13.0 (#23148)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-05 08:20:38 +02:00
renovate[bot]
b54057cc4b Update dependency chart.js to v4.4.7 (#23145)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-05 08:20:09 +02:00
Petar Petrov
d77dd5300e Require underscore for private methods (#23138) 2024-12-04 15:05:49 +01:00
Wendelin
9396d5cf8c Automate supervisor & landing-page release (#22959)
* Automate supervisor & landing-page release

* Add no prerelease condition to supervisor/landing-page release

* Prepare release workflow for testing

* Add release permissions to create PR

* Add supervisor, landingpage release to assets

* Create test draft release to test

* Fix hassio release path

* Fix workflow permission for test reasons

* Revert test settings
2024-12-04 14:41:21 +01:00
Wendelin
a78ddb50fd Fix time input with helper text width (#23134)
* Fix time input with helper text width

* Make time input help text always newline

* Put helper text out of base-time-input
2024-12-04 13:25:31 +00:00
Bram Kragten
64e8b636b9 Use action instead of selected for select entity row (#23135) 2024-12-04 13:57:55 +01:00
Wendelin
2c604ff946 Add red delete button to delete zone confirmation dialog (#23136) 2024-12-04 12:55:12 +00:00
Paul Bottein
f8ce7c2ce1 Don't use duration formatting for second unit (#23132)
Don't use duration formatting for sec unit
2024-12-04 13:17:47 +01:00
Abílio Costa
af1622e306 Show unit for number domains (#23101)
* Show unit for number domains

* Remove duplicated code

* Allow monetary formatting

Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>

* Update src/common/entity/compute_state_display.ts

---------

Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>
2024-12-04 11:25:29 +00:00
Jan-Philipp Benecke
3c03dfb322 Revert translation change for device quick bar (#23131) 2024-12-04 11:43:50 +01:00
Jan-Philipp Benecke
697a99f913 Show in assist pipeline debug when intent is preferred and processed locally (#23115) 2024-12-04 09:52:48 +01:00
Paul Bottein
06925f0716 Reduce button target zone in media player more info (#23130) 2024-12-04 09:40:41 +01:00
Jan-Philipp Benecke
afcfdb5140 Explicitly set file name for camera snapshot (#23124)
* Explicitly set file name for camera snapshot

* Process code review
2024-12-04 08:52:53 +02:00
Jan Čermák
6126280f2d Fix Markdown cards in Grid not taking full height (#23121)
The implementation of show_empty property in #21379 introduced
regression which causes Markdown cards rendered within a Grid card to
not take full height of its space. This is because a visible card is now
forced to have "display: block", while without that it's rendered as
"display: inline".

As the CSSStyleDeclaration.style mandates string type, it's not possible
to delete or null the value. Setting it to an empty string seems to do
the trick as well and the linter is happy too.

Fixes #23119
2024-12-03 17:33:59 +01:00
Paul Bottein
8e6f4886e8 Fix create section on iOS (#23123) 2024-12-03 17:16:52 +02:00
Wendelin
480de9ef03 Remove static font from ha-badge (#23120) 2024-12-03 14:15:59 +00:00
renovate[bot]
614c4ec404 Update dependency @rsdoctor/rspack-plugin to v0.4.10 (#23108)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-03 15:07:54 +02:00
Wendelin
d43291ae52 Fix ha-target-picker hideTitle (#23116) 2024-12-03 13:05:05 +00:00
Petar Petrov
7c486ec969 ZWaveJS: abort S2 bootstrapping when inclusion is canceled (#23106) 2024-12-03 13:56:17 +01:00
Bram Kragten
19f54b6ba2 Voice local: Small refactor and return when local already exists (#23113) 2024-12-03 12:01:54 +01:00
Wendelin
97cc9f9ab9 Simplify mediaBrowserPreferredLayout @storage (#23107) 2024-12-03 11:37:23 +01:00
Marcin
a104d38fc9 Updated English translations for scene editor. (#23110) 2024-12-03 10:25:56 +01:00
renovate[bot]
2582023ab2 Update dependency eslint to v9.16.0 (#23105)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-03 08:50:48 +02:00
Jan-Philipp Benecke
e731f060f1 Add device search to quick bar (#23095)
* Add device search to quick bar

* Process code review
2024-12-03 08:50:07 +02:00
Wendelin
c3942d244d Add automatic retry to stream logs (#23098) 2024-12-02 21:30:51 +01:00
Bram Kragten
f4ef4c628a Voice wizard local: Add error message, fix hostname (#23103)
Add error message, fix hostname
2024-12-02 14:48:24 -05:00
Simon Lamon
a0f3e4f785 Add a label filter (#23081)
* Label filter

* adjust height

* ci

* Update src/components/ha-filter-labels.ts

---------

Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>
2024-12-02 15:41:41 +00:00
Norbert Rittel
2c13c5a18c Change "Low-carbon energy consumed" to "… electricity …" (#23096)
The Energy card allows the user to monitor the "Grid carbon footprint" which is visualized by the "Low-carbon energy consumed" gauge.

But this does not cover the carbon emissions of the gas consumption that might be shown right next to it, just the electrical energy from the grid.

So the labeling is very misleading in that context – not even considering energy consumed by oil or wood burned in addition.

Therefore this needs to be changed to use "electricity" just like the description already does.
2024-12-02 17:32:56 +02:00
Paul Bottein
22cfd40ccc Don't show alert in voice assistant dialog (#23097) 2024-12-02 14:35:41 +01:00
martetassyns
5c7d9b3fa3 Made it easier to test the frontend against an existing core instance. (#23062)
* Made it easier to test the frontend against an existing core instance.

* Ensured that script works regardless of current working dir

* Use consistent quote style

* Also allow using variables in hassUrl override

* Improved the default behavior of the script

* more consistent variable naming

* don't install a global dependency

* documented caching wierdness where if you switch core endpoints the old one remains in use

* Simplified some code

* improved documentation

---------

Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>
2024-12-02 13:27:36 +00:00
Wendelin
55b6aa09d9 Save scene before switching to live edit (#23094)
Save scene changes before live edit, align delete icons for entities.
2024-12-02 15:24:03 +02:00
Robert MacWha
96395dd5e1 Store Media Browser view in localStorage (#23061)
feat: store preferredLayout in localStorage
2024-12-02 14:02:13 +01:00
renovate[bot]
7191edd3c6 Update dependency marked to v15.0.3 (#23088)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-02 11:58:59 +01:00
dependabot[bot]
6169379f4c Bump relative-ci/agent-action from 2.1.13 to 2.1.14 (#23089)
Bumps [relative-ci/agent-action](https://github.com/relative-ci/agent-action) from 2.1.13 to 2.1.14.
- [Release notes](https://github.com/relative-ci/agent-action/releases)
- [Commits](https://github.com/relative-ci/agent-action/compare/v2.1.13...v2.1.14)

---
updated-dependencies:
- dependency-name: relative-ci/agent-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-02 11:57:33 +01:00
Alex Jurkiewicz
5500dd1332 history-graph-card-editor: Correct hours_to_show validation (#23090)
history-graph-card-editor: Correct hours_to_show validation

Allow all floating point numbers from 0 up.

Fixes #15933.
2024-12-02 12:48:12 +02:00
renovate[bot]
5c681896f3 Update dependency @codemirror/language to v6.10.6 (#23092)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-02 12:45:19 +02:00
Norbert Rittel
d826113319 Change "Energy usage" to "Electricity usage" (#23091)
The energy dashboard tracks the total energy of a home, including the gas consumption in a separate graph (if configured).

The topmost graph is currently labeled "Energy usage" but it does only cover the electricity consumption and production. Also note the "Energy distribution" next to it includes gas, too.

Thus the title is misleading and needs to be changed to "Electricity usage" to make this clearer.
2024-12-02 12:30:56 +02:00
karwosts
f72b298f97 Init new scenes in live edit mode (#23051)
* Init new scenes in live edit mode

* Update src/panels/config/scene/ha-scene-editor.ts

Co-authored-by: Simon Lamon <32477463+silamon@users.noreply.github.com>

* imports

---------

Co-authored-by: Simon Lamon <32477463+silamon@users.noreply.github.com>
2024-12-02 11:18:03 +01:00
Jan-Philipp Benecke
90b7cad7ac Add shortcut to open the voice assist dialog (#23082)
* Add shortcut to open the voice assist dialog

* Add tip

* Only show dialog when enabled

* Update src/translations/en.json

---------

Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>
2024-12-02 09:26:27 +00:00
renovate[bot]
e0239486bc Update dependency element-internals-polyfill to v1.3.12 (#23077)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-12-01 12:13:29 +01:00
Norbert Rittel
e10fb3c168 Fix inconsistent "remove" in description of refresh tokens (#23073)
As Refresh tokens are created in HA the corresponding verb is "delete", not "remove".

All buttons and menu items in this context use the correct verb, except for the description which contains "remove", twice.

This commit fixes that.
2024-11-30 22:32:00 +01:00
Norbert Rittel
5ee8bee6dc Remove the misleading word "updates" from system options (#23069)
Remove the misleading word "update" from system options

The second option in the system options dialog for integrations uses the word "updates" in both the headline and the explanation.

This is highly misleading as it sounds like polling for firmware updates for many device integrations.

Therefore the words "(state) changes" should be used instead.
2024-11-30 17:07:37 +01:00
renovate[bot]
4b678ffb41 Update dependency @codemirror/language to v6.10.5 (#23070)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-30 16:44:46 +01:00
Norbert Rittel
82c23026b3 Correctly match "Remove" to "Add" within Energy dashboard (#23068)
In Home Assistant the action "Add" should always pair with "Remove", like "Create" does with "Delete".
This commit addresses all mismatched pairs in the Energy dashboard.

In addition the grammar of device_consumption_energy is fixed by using the consistent "energy consumption" word pair.
2024-11-30 16:44:09 +01:00
renovate[bot]
94b7b60fe0 Update dependency prettier to v3.4.1 (#23053)
* Update dependency prettier to v3.4.1

* Prettier rule

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Simon Lamon <32477463+silamon@users.noreply.github.com>
2024-11-29 16:55:54 +00:00
renovate[bot]
e1553a7ccf Update dependency magic-string to v0.30.14 (#23052)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-29 17:40:33 +01:00
renovate[bot]
fb0ca49742 Update vitest monorepo to v2.1.6 (#23060)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-29 16:55:18 +02:00
Norbert Rittel
97015788a2 Correctly pair 'remove' with 'add' in description of To-do list card (#23044)
When using 'Add' in HA this should always pair with 'Remove', like 'Create' with 'Delete'.

The To-do list card introduces an inconsistent third word by using 'clear' instead of 'remove'.

This fixes this and also properly capitalizes "To-do list" as it's name like in all other Dashboard card types.
2024-11-29 08:35:45 +02:00
renovate[bot]
0cf05ea2cc Update dependency @types/chromecast-caf-receiver to v6.0.20 (#23049)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-28 21:11:24 +01:00
renovate[bot]
acbe77c0d6 Update Yarn to v4.5.3 (#23046)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-28 18:57:25 +01:00
renovate[bot]
bede8c66c5 Update dependency @rsdoctor/rspack-plugin to v0.4.9 (#23043)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-28 13:58:28 +01:00
Norbert Rittel
de87aee15b Replace add_zone with create_zone in ha-config-zone.ts (#23041)
* Replace add_zone with create_zone in ha-config-zone.ts

The action button is the only inconsistent item here now.

* Remove orphaned "add_zone" string
2024-11-28 14:46:29 +02:00
Wendelin
36312cc273 Simplify depends_on_cloud translation (#23042) 2024-11-28 13:24:44 +02:00
Wendelin
3120184d63 Add internal, legacy to IQS (#23040) 2024-11-28 13:23:53 +02:00
Wendelin
a1be9d923e Fix iqs naming and docs link anchor (#23036) 2024-11-28 09:58:34 +02:00
renovate[bot]
7dee34ca75 Update dependency @codemirror/language to v6.10.4 (#23031)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-28 06:19:06 +01:00
karwosts
f7c8c6e3e8 Dont floor duration for milliseconds (#23028)
* Dont floor duration for milliseconds

* remove ms
2024-11-27 17:27:03 +00:00
Paul Bottein
3411967fd9 Only use duration poly-fill when necessary (#23030) 2024-11-27 17:13:29 +01:00
Wendelin
125805d6d1 Fix platinum color and spacing of integration logo (#23029) 2024-11-27 16:27:53 +01:00
Bram Kragten
e0e158b64c Merge branch 'master' into dev 2024-11-27 15:19:46 +01:00
Bram Kragten
078095db3f Bumped version to 20241127.0 2024-11-27 15:17:35 +01:00
Wendelin
8c7fcc725c Limit iqs indicator to colors only (#23026) 2024-11-27 15:16:52 +01:00
G Johansson
988fa3e4e4 Add horizontal swing to climate (#22043) 2024-11-27 15:10:11 +01:00
Bram Kragten
f9118a4b87 Add alt to img, fix styling issue voice (#23024) 2024-11-27 15:04:09 +01:00
Paul Bottein
164944ceff Improve duration formatting (#23025) 2024-11-27 15:00:29 +01:00
Wendelin
bc195c61cc Integration Quality Scale indicator (#23015) 2024-11-27 14:45:44 +01:00
Bram Kragten
f54bb20fef Fix error on hardware page (#23021)
* fix error on hardware page

* Update ha-config-hardware.ts
2024-11-27 15:44:24 +02:00
Bram Kragten
71214351ca Fix timeout error handling local voice (#23023)
fix timeout error handling local voice
2024-11-27 14:36:30 +01:00
Bram Kragten
0a954cf1c7 Add add-on installation to voice setup flow (#23018) 2024-11-27 14:12:36 +01:00
Simon Lamon
2782b2fb1b Use DurationFormat for calendar trigger (#23020)
duration long
2024-11-27 13:47:14 +01:00
Paul Bottein
a532b4461d Use explicit duration format for state formatting (#23017) 2024-11-27 12:49:21 +01:00
Wendelin
dd7987e199 Add unit tests for common/array files (#23006)
* add vitest coverage

* Add js doc to functions

* Add tests for common/array
2024-11-27 10:02:24 +02:00
Jan-Philipp Benecke
81cc73ece3 Make missed strings translatable in ha-script-trace and ha-automation-trace (#23013) 2024-11-27 07:49:58 +01:00
Jan-Philipp Benecke
f9701b2363 Use "No traces found" automation translation in ha-script-trace (#23010) 2024-11-27 07:26:48 +01:00
Jan-Philipp Benecke
adb22abd7d Mark reset addon options dialog as destructive (#23009) 2024-11-26 21:16:13 +01:00
Jan-Philipp Benecke
4df90ebbc3 Mark delete backup dialog as destructive (#23008) 2024-11-26 19:54:10 +00:00
Wendelin
4655929fed Add node_modules cache in ci (#22826)
* Add reusable node_modules to ci

* Use node_modules cache

Co-authored-by: Bram Kragten <mail@bramkragten.nl>

* Add yarn version to cache

---------

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2024-11-26 19:08:28 +01:00
Mark Bergsma
39b00f1063 Support time entities in automation time conditions/triggers selectors (#21069)
Co-authored-by: Simon Lamon <32477463+silamon@users.noreply.github.com>
2024-11-26 15:41:59 +01:00
Wendelin
bd0bfc1fbe Rspack (#22807)
* Add rspack

* Remove TransformAsyncModulesPlugin from rspack

* Migrate all webpack usage to rspack

* Migrate tests to vitest

* Fix test suites

* Remove chai dependency

* Fix compute_state_display tests

* Fix resolveTimeZone

* Reduces test pipeline

* Revert test ci

* optimize chunk filtering

* Migrate landing-page to rspack

* Update rspack dependencies

* Add rsdoctor

* Fix prod build bundle size

* Use rsdoctor for demo stats

* Remove unused webpack configs

* Update build-scripts/rspack.cjs

Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>

* Fix eslint

* Update rspack

* Remove unused code

---------

Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>
2024-11-26 14:49:13 +01:00
Paul Bottein
09c5dab69f Improve tags datatable (#23003)
* Improve tags datatable

* Update translations
2024-11-26 12:19:00 +01:00
ildar170975
25a7f6ebf7 Fix padding top for logbook panel (#22999) 2024-11-26 11:46:06 +01:00
renovate[bot]
a5e12cb558 Update dependency typescript to v5.7.2 (#22998)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-26 09:08:42 +01:00
renovate[bot]
a2927f281d Update dependency @types/chromecast-caf-receiver to v6.0.19 (#23000)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-26 09:05:33 +01:00
renovate[bot]
3c23c18faf Update dependency @types/chromecast-caf-sender to v1.0.11 (#23001)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-26 08:45:36 +01:00
renovate[bot]
616bd065e0 Update vaadinWebComponents monorepo to v24.5.4 (#22990)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-25 17:17:13 +01:00
Ruben van Dijk
a525c44794 Cancels page retry loop with negative intervals. (#22983)
* Cancels page retry loop with negative intervals.
This shouldn't be required, but sometimes, which I can't easily reproduce, it fails to reload.
Fixes #20052

* Clear interval before reload.
2024-11-25 14:43:27 +02:00
Wendelin
2d3579c08a Add workflow_dispatch to release workflow (#22993) 2024-11-25 13:34:25 +01:00
renovate[bot]
6ef36dce3e Update dependency @codemirror/search to v6.5.8 (#22989)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-25 11:07:42 +02:00
Norbert Rittel
74bf1d2a82 Use consistent name "Field key" for entry field (#22985)
Both error messages just refer to the "field key" as such.

Therefore the label in the dialog should be consistent.
2024-11-25 08:21:50 +02:00
renovate[bot]
8ea2e3f471 Update Yarn to v4.5.2 (#22986)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-25 08:19:52 +02:00
arthanoss
1b74e94f14 Remove redundant action handler and wrapper from sensor entity row (#22975) 2024-11-24 17:04:01 +02:00
renovate[bot]
536d2e0ab0 Update dependency @codemirror/view to v6.35.0 (#22982)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-24 16:49:53 +02:00
Norbert Rittel
c610778b0f Fix inconsistent capitalization in Device info (#22979) 2024-11-24 11:42:12 +01:00
renovate[bot]
0791b1bc71 Update dependency marked to v15.0.2 (#22974)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-24 11:11:47 +01:00
renovate[bot]
c93f6f683a Update dependency @types/mocha to v10.0.10 (#22972)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-24 11:11:06 +01:00
Norbert Rittel
999969b78d Make key_c_hint strings consistent (#22971)
Make ui::dialogs::quick-bar::key_c_hint consistent with ui::tips::key_c_hint
2024-11-23 20:50:49 +02:00
Steven B.
10b8627f51 Webrtc use RTCIceCandidateInit messages with backend (#22667)
* Add sdp m line index to ICE Candidates

* Remove ? from candidate

Co-authored-by: Bram Kragten <mail@bramkragten.nl>

* Send full candidate in message

* Revert launch.json change

* Use RTCIceCandidate for messaging

---------

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2024-11-23 14:56:19 +02:00
Wendelin
528fcecd16 Ha-alert-narrow-action (#22956)
* Add ha-alert narrow option

* Use ha-alert narrow in ha-scene-editor
2024-11-22 18:37:05 +02:00
Bram Kragten
f8fb5d7bf2 Add cloud signup to voice flow (#22941) 2024-11-22 08:55:37 +01:00
renovate[bot]
3e02d95e01 Update dependency magic-string to v0.30.13 (#22949)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-21 20:33:13 +01:00
renovate[bot]
4ef6661532 Update dependency husky to v9.1.7 (#22945)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-21 18:56:28 +01:00
Wendelin
6cc6d9fb45 Tolerant env vars (#22948) 2024-11-21 18:26:51 +01:00
Wendelin
43911ef3be Fix disable ha-progress button (#22939)
* Fix disable ha-progress button

* Simplify ha-progress disabled fix

* Fix ha-progress-button click handler

* fix ha-progress-button pointer-events
2024-11-21 15:30:28 +00:00
Wendelin
6b0afe6ebb Add inline-arrow option to ha-select & ha-language-picker (#22935)
* Add inline-arrow option to ha-select & use it in some language pickers

* Update src/components/ha-language-picker.ts

Co-authored-by: Bram Kragten <mail@bramkragten.nl>

---------

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2024-11-21 16:44:11 +02:00
Wendelin
811977b366 Fix disable fields in general config (#22938) 2024-11-21 15:58:26 +02:00
Wendelin
fc2e3b7bcf Disable devices/entities click in scene review mode (#22940) 2024-11-21 15:57:02 +02:00
Bram Kragten
6b8068a22a Improv external flow (#22878)
* WIP improv external flow

* Update external_messaging.ts

* use name instead, start flow

* make copy

* Update ha-config-integrations-dashboard.ts

* Update

* rename command

* Use a map instead of array for deduping
2024-11-21 14:45:49 +01:00
Norbert Rittel
2899388395 Change "Add" to "Create" for Labels and Zones following HA Design guidelines (#22942) 2024-11-21 14:23:46 +01:00
Bram Kragten
4e63eacb79 Improve message for yaml core settings (#22936) 2024-11-21 11:38:04 +01:00
Wendelin
881ff13832 Fix landing-page dns update request (#22932)
* Fix landing-page dns update request

* clear  _dnsPrimaryInterface
2024-11-21 11:10:20 +01:00
Bram Kragten
79c7cf59ee Add warning for muted voice assistant or when not heard wakeword in 1… (#22934)
Add warning for muted voice assistant or when not heard wakeword in 15 secs
2024-11-21 10:07:56 +00:00
renovate[bot]
b82d880bfd Update formatjs monorepo (#22930)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-21 11:54:25 +02:00
Bram Kragten
64374a4fcb Voice wizard: prevent flash of hardware screen when cloud is active (#22933) 2024-11-21 08:59:43 +00:00
Norbert Rittel
0e0be279ea Fix broken grammar in confirm_unsaved_comments alert (#22928) 2024-11-21 09:37:06 +01:00
renovate[bot]
08a8e053d3 Update dependency marked to v15.0.1 (#22929)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-21 09:36:35 +01:00
Norbert Rittel
7d9752abdf Dev Tools: Replace "Current entities" with "Current entity states" (#22924) 2024-11-20 23:09:23 +01:00
Norbert Rittel
0c382f1967 Change "Add script" and "Add scene" to "Create …" (#22922) 2024-11-20 19:39:05 +00:00
Norbert Rittel
7833a31eea Change "Elevation" to "Elevation above sea level" for clarity (#22919) 2024-11-20 20:19:27 +01:00
Norbert Rittel
8e796e013a Change "Find my value" to "Find my ISO Code" for the currency field (#22917)
Under Settings > System > General the user can set the currency for the system.

To enter the correct ISO code there is a link to the respective Wikipedia page.

The link is currently labeled "Find my value" which makes no real sense.
2024-11-20 20:28:14 +02:00
Paulus Schoutsen
757ed2e80c Add local processing option to pipeline for LLM conversation agents (#22561)
* Add local processing field to pipeline

* update

* Update wording

* handle current pipelines

---------

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2024-11-20 20:24:50 +02:00
Norbert Rittel
d2665f1349 Fix two strings for Settings > Tags (#22916)
The explanation for the QR code does not make sense right now.

The 'Create automation with tag' missing a 'this'.
2024-11-20 18:06:38 +00:00
Abílio Costa
84f7c62ee2 Add support for unit_of_measurement translation (#22868) 2024-11-20 18:44:44 +01:00
Norbert Rittel
a9d7082218 Add missing words in matter::ping_node::battery_device_warning (#22914) 2024-11-20 18:36:17 +01:00
Norbert Rittel
766de17ea3 Change "Run" command for automation to "Run actions" (#22913) 2024-11-20 18:35:43 +01:00
Norbert Rittel
8988bd519f No longer use "button" when referring to "Edit ID" menu item for triggers (#22892) 2024-11-20 18:34:14 +01:00
Simon Lamon
6ccd4fa431 Handle empty trigger or action in migration path (#22912)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2024-11-20 16:24:21 +00:00
Wendelin
5b8e63a213 Landing page (#22598) 2024-11-20 16:20:08 +00:00
Simon Lamon
6a337cc486 Remove activate scene in automation editor (#22258) 2024-11-20 17:02:15 +01:00
Norbert Rittel
f7f936cb54 Use consistent name "Entity search" for that part of "Quick Search" (#22907)
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2024-11-20 16:17:55 +01:00
renovate[bot]
7252169325 Update dependency @lit-labs/observers to v2.0.4 (#21636)
* Update dependency @lit-labs/observers to v2.0.4

* Pin lit-html to 2.8.0

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Simon Lamon <32477463+silamon@users.noreply.github.com>
2024-11-20 15:16:48 +00:00
Bram Kragten
b7ef633a3e Voice wizard: Use test message in tts language (#22882)
* Voice wizard: Use test message in tts language

* catch none existing lang
2024-11-20 15:09:48 +00:00
Wendelin
995155696f Improve scene editor UI (#22910) 2024-11-20 14:53:49 +00:00
Yosi Levy
7996f4e0b2 Picture elements card editor: Add title to secondary description for custom cards (#22908) 2024-11-20 15:45:29 +01:00
karwosts
ac6e61b9b8 Remove display of 'Current state' in ha-card-condition-state (#22887) 2024-11-20 14:43:21 +00:00
System Tester
b7f3e40340 Fixes #17769, #22503: Improved subscription handling (#22889)
* Fixes #17769, #22503: Improved subscription handling

Prevent multiple active subscriptions
Ensure a clean state when the component reconnects
Checking subscription status before processing

* Prettier issue resolved

* async methods referencing _unsubscribe are properly awaited

* Apply suggestions from code review

Thank you

Co-authored-by: Wendelin <12148533+wendevlin@users.noreply.github.com>

---------

Co-authored-by: Wendelin <12148533+wendevlin@users.noreply.github.com>
2024-11-20 15:41:59 +01:00
Norbert Rittel
39b4e85dcd Better explain the "Push notification" option in the browser settings (#22906) 2024-11-20 15:38:10 +01:00
karwosts
37d2c6844a Update Scene Editor (#22847)
* New scene editor design

* bugfixes

* reorder overflow menu, change label

* category support
2024-11-20 15:12:23 +01:00
Norbert Rittel
b8e2298cdd Update the explanation for setting up the Google Home integration (#22897) 2024-11-20 12:49:57 +01:00
Norbert Rittel
a3ff065c7a Update 'mqtt_device_debug_info' strings to use ICU syntax (#22899) 2024-11-20 12:49:11 +01:00
Norbert Rittel
a224d6c61b Fix grammar issue in remove_fabric_confirm_text (#22901) 2024-11-20 12:48:21 +01:00
Norbert Rittel
cd0980d13e Clarify 'updates_refreshed' message (#22904) 2024-11-20 12:46:59 +01:00
Norbert Rittel
13cb32a83f Entity settings for helpers: avoid repeating "options" in explanation (#22896) 2024-11-20 12:43:04 +01:00
Norbert Rittel
12a9cf4b32 Replace wrong uses of "energy" with "electricity" in Energy dashboard (#22893) 2024-11-20 12:41:54 +01:00
Norbert Rittel
8cce13163f Make sidebar (app) settings items consistent by replacing 'configuration' (#22890) 2024-11-20 12:39:42 +01:00
Petar Petrov
46a55630fa ZWaveJS: Support for Door Lock in Expert UI (#22775)
* ZWaveJS: Support for Door Lock in Expert UI

* make it dry

* Update src/panels/config/integrations/integration-panels/zwave_js/capability-controls/zwave_js-capability-control-door-lock.ts

Co-authored-by: AlCalzone <dominic.griesel@nabucasa.com>

* add validation

* fix booleans

* Update src/panels/config/integrations/integration-panels/zwave_js/capability-controls/zwave_js-capability-control-door-lock.ts

Co-authored-by: AlCalzone <dominic.griesel@nabucasa.com>

* handle ZWaveErrorCodes.CC_NotSupported for getCapabilities

* get/set mode

---------

Co-authored-by: AlCalzone <dominic.griesel@nabucasa.com>
2024-11-20 12:28:39 +01:00
Petar Petrov
c92bee4f1d Show ZwaveJS "Installer settings" based on installer_mode option (#22710)
Show "Installer settings" based on `installer_mode` option
2024-11-20 13:06:15 +02:00
Norbert Rittel
940cbd42c3 Dashboard: Fix description of the Tile card (#22894)
There are currently two grammar issues in the Tile card description: It should be "allows" and "trigger" needs to be added.
2024-11-20 10:31:46 +01:00
Norbert Rittel
39bf7c9ad4 Use ICU string for proper singular vs. plural of "listener(s)" (#22885)
Fix for the permanent plural in ({count}  listeners)
2024-11-20 09:52:30 +01:00
Norbert Rittel
64c260c1c4 Form correct headline for 'Delete backups?' alert, separate "Delete backup" menu item (#22891)
Create correct headline for 'Delete backups?' alert

Change 'Delete backup' to 'Delete backups?' to use correct plural and form a question the user has to confirm.

Separates the 'Delete backup' menu item that is currently referenced from this key.
2024-11-20 09:21:51 +01:00
Norbert Rittel
36f3ef9e86 Update en.json to make all automation conditions use "if", not "when" (#22883)
* Update en.json to make all automation conditions use "if", not "when"

Fixes the remaining inconsistencies in all conditions defined in HA Frontend.

Especially important as these are prefixed with "Test" in the condition building block of automations and scripts, so they currently result in "Test when …" instead of the correct "Test if …".

* Updated en.json to fix the two wrong lowercase if
2024-11-19 16:56:21 +00:00
Bram Kragten
42622fe21e Hide wake word in pipeline settings (#22879)
* hide wake word in pipeline settings

* move logic to pipeline-editor
2024-11-19 16:35:44 +02:00
Wendelin
64f7afd60f Fix lint-staged with eslint v9 (#22880) 2024-11-19 14:03:38 +01:00
Ivan Kara
3282785cf2 Fix media browser (#22875) 2024-11-19 11:24:36 +00:00
DominikBitzer
2c1931adb1 Add Y-Axis limits functionality from history graphs card to statistics graph card (#22771) 2024-11-19 12:19:35 +01:00
Petar Petrov
c9cad254d2 Add tone,volume & duration selector to more-info dialog for sirens (#22786)
* Add tone selector to more-info for sirens

* add selected tone to service call

* rework the tone into an advanced controls dialog

* tweaks from PR comments

* fix % conversion

* assume duration is in seconds
2024-11-19 11:56:52 +01:00
Wendelin
f4f2cce57e Fix logbook date range alignment (#22877) 2024-11-19 11:32:13 +02:00
renovate[bot]
556315b360 Update dependency eslint to v9.15.0 (#22870)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-19 09:12:20 +01:00
boern99
bed470f79d add previous and next button to History and Logbook (#22802)
* add previous and next button to History and Logbook

* used date-fns and changed media-query-resolution to fit on mobiles

* hide .prev and .next on small screens; optimized dateRange for ranges lower 1 day

* fixed Date type number
2024-11-19 08:57:08 +01:00
renovate[bot]
9acf946097 Update dependency @bundle-stats/plugin-webpack-filter to v4.17.0 (#22869)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-19 08:40:32 +01:00
renovate[bot]
231ef4b5b4 Lock file maintenance (#22873)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-19 06:25:02 +01:00
renovate[bot]
f8bcc6dde4 Pin dependency globals to 15.12.0 (#22858)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-18 16:55:18 +00:00
dependabot[bot]
11ed4600fd Bump http-proxy-middleware from 2.0.6 to 2.0.7 (#22865)
Bumps [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware) from 2.0.6 to 2.0.7.
- [Release notes](https://github.com/chimurai/http-proxy-middleware/releases)
- [Changelog](https://github.com/chimurai/http-proxy-middleware/blob/v2.0.7/CHANGELOG.md)
- [Commits](https://github.com/chimurai/http-proxy-middleware/compare/v2.0.6...v2.0.7)

---
updated-dependencies:
- dependency-name: http-proxy-middleware
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-18 16:42:37 +00:00
dependabot[bot]
c0e2d6fa23 Bump cross-spawn from 7.0.3 to 7.0.6 (#22864)
Bumps [cross-spawn](https://github.com/moxystudio/node-cross-spawn) from 7.0.3 to 7.0.6.
- [Changelog](https://github.com/moxystudio/node-cross-spawn/blob/master/CHANGELOG.md)
- [Commits](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.3...v7.0.6)

---
updated-dependencies:
- dependency-name: cross-spawn
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-18 16:41:46 +00:00
renovate[bot]
942562161a Update dependency @codemirror/view to v6.34.3 (#22863)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-18 16:33:20 +00:00
renovate[bot]
d35c40b585 Update dependency globals to v15 (#22861)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-18 17:23:13 +01:00
renovate[bot]
8cd0ddceb8 Update dependency eslint to v9.14.0 (#22859)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-18 17:22:09 +01:00
dependabot[bot]
c3ee49298a Bump @eslint/plugin-kit from 0.2.0 to 0.2.3 (#22860)
Bumps [@eslint/plugin-kit](https://github.com/eslint/rewrite) from 0.2.0 to 0.2.3.
- [Release notes](https://github.com/eslint/rewrite/releases)
- [Changelog](https://github.com/eslint/rewrite/blob/main/release-please-config.json)
- [Commits](https://github.com/eslint/rewrite/compare/core-v0.2.0...plugin-kit-v0.2.3)

---
updated-dependencies:
- dependency-name: "@eslint/plugin-kit"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-18 17:21:07 +01:00
Simon Lamon
89dc1a7ebc ESLint Flat Config (#22221)
* Flat config file

* Plugin

* prettier

* Set eslint to latest version (non dev)

* yarn dedupe

* push changes from eslint type pr

* dedupe
2024-11-18 15:49:59 +01:00
Wendelin
ced70fd9a1 Fix 2fa login validation, add autofocus to login (#22856) 2024-11-18 15:25:51 +02:00
Simon Lamon
253c8f358b Logbook target picker (#22851)
Logbook picker
2024-11-18 14:19:17 +01:00
Paul Bottein
23b55484c3 Improve grid size editor (#22697)
* Use table instead of grid

* Add animation

* Change size

* Simplify precideMode logic

* Add tooltip and improve slider style

* Improve size

* Back to default instead of min

* Limit number of cells for the grid when more than 24 cells
2024-11-18 09:43:52 +01:00
dependabot[bot]
1990b8fa84 Bump softprops/action-gh-release from 2.0.9 to 2.1.0 (#22854)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-18 08:54:58 +01:00
Paul Bottein
03ea08f98c Create a section when dropping card on the create section button (#22790)
* Create a section when dropping card on the create section button

* Add translations

* Add title by default

* And case when moving a heading card
2024-11-18 08:53:01 +02:00
Matt Way
1f5f6c5f8a Fix back gesture on Android activating buttons (#22852)
Touchcancel event cancels touch regardless of cancelled flag

Co-authored-by: Benjamin Paul <benjamin.ian.paul@gmail.com>
2024-11-17 16:55:43 +00:00
renovate[bot]
fa821b1c4f Update dependency @types/chromecast-caf-receiver to v6.0.18 (#22849)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-17 17:47:56 +01:00
karwosts
f51bc40203 Catch yaml errors in script editor (#22853) 2024-11-17 15:09:03 +00:00
renovate[bot]
c7dae49c42 Update dependency marked to v15 (#22782)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-16 18:23:45 +01:00
Joost Lekkerkerker
b056b71557 Only download verified translations (#22844) 2024-11-16 13:20:06 +01:00
dependabot[bot]
0db2b45cc3 Bump cross-spawn from 7.0.3 to 7.0.5 (#22843)
Bumps [cross-spawn](https://github.com/moxystudio/node-cross-spawn) from 7.0.3 to 7.0.5.
- [Changelog](https://github.com/moxystudio/node-cross-spawn/blob/master/CHANGELOG.md)
- [Commits](https://github.com/moxystudio/node-cross-spawn/compare/v7.0.3...v7.0.5)

---
updated-dependencies:
- dependency-name: cross-spawn
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-16 10:16:36 +01:00
renovate[bot]
1be1003549 Update dependency @codemirror/autocomplete to v6.18.3 (#22842)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-16 09:02:45 +01:00
Petar Petrov
b8a13dd6eb ZWaveJS: Add names to colors in Installer Settings (#22819) 2024-11-15 17:55:02 +01:00
Petar Petrov
cae5540c44 ZWaveJS: Configuration.resetAll is only supported on CC v4+ (#22823) 2024-11-15 17:40:38 +01:00
karwosts
d47966cdf7 Allow attaching additional data to schedule in UI (#22798)
* Allow attaching additional data to schedule in UI

* use expandable
2024-11-15 18:13:04 +02:00
renovate[bot]
991cf83ff3 Update dependency @babel/helper-define-polyfill-provider to v0.6.3 (#22829)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-15 12:00:34 +01:00
Simon Lamon
b83be38514 Introduce calendar trigger description (#22814) 2024-11-14 09:28:15 +02:00
Simon Lamon
17982e0bdc Fix swapped plural and singular match use in and condition (#22815)
* Fix swapped plural and singular match

* Test if => if
2024-11-14 09:11:20 +02:00
Simon Lamon
b918862bb1 Confirm uses to if for clarity (#22816) 2024-11-14 09:08:54 +02:00
ildar170975
6bdc7af09f Add outline to a label (3) - consistency (#22812)
Update ha-config-labels.ts
2024-11-14 09:05:01 +02:00
ildar170975
7cbebfd603 Add outline to a label (2) (#22803)
* Update ha-filter-labels.ts

* Update ha-automation-picker.ts

* Update ha-scene-dashboard.ts

* Update ha-script-picker.ts

* Update ha-config-devices-dashboard.ts

* Update ha-config-entities.ts

* Update ha-config-helpers.ts

* Update ha-filter-labels.ts

* Update ha-automation-picker.ts

* Update ha-config-devices-dashboard.ts

* Update ha-config-helpers.ts

* Update ha-script-picker.ts

* Update ha-scene-dashboard.ts

* Update ha-config-entities.ts

* Update ha-data-table-labels.ts

* Update ha-label.ts

* Update ha-label.ts
2024-11-13 16:05:03 +00:00
Petar Petrov
42b1f938d6 Increase ZwaveJS add device timeout to 5 mins (#22809) 2024-11-13 16:13:29 +01:00
boern99
311f221387 Add describeCondition and entity_ids as additional information to automation step details (#21965)
* Add describeCondition and entity_ids as additional information to automation step details

* Update src/components/trace/ha-trace-path-details.ts

Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>

* tested suggestions

* Update src/components/trace/ha-trace-path-details.ts

Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>

* Update src/components/trace/ha-trace-path-details.ts

Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>

* code style fixes

---------

Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>
2024-11-13 14:30:29 +02:00
ildar170975
3c6be8cf99 Fix visibility for shown entities on device card (#22579)
* Update ha-device-entities-card.ts

* Update ha-device-entities-card.ts

* Update src/panels/config/devices/device-detail/ha-device-entities-card.ts

Co-authored-by: Wendelin <12148533+wendevlin@users.noreply.github.com>

* Update ha-device-entities-card.ts

* Update src/panels/config/devices/device-detail/ha-device-entities-card.ts

Co-authored-by: Wendelin <12148533+wendevlin@users.noreply.github.com>

* Update ha-device-entities-card.ts

* Update src/panels/config/devices/device-detail/ha-device-entities-card.ts

Co-authored-by: Wendelin <12148533+wendevlin@users.noreply.github.com>

* Update ha-device-entities-card.ts

* Update ha-device-entities-card.ts

---------

Co-authored-by: Wendelin <12148533+wendevlin@users.noreply.github.com>
2024-11-13 07:56:58 +01:00
karwosts
28703b39da Allow entities table to delete helpers (#22248)
* Allow deleting helpers in entities table

* Fix calling the right delete on restored legacy helpers
2024-11-12 18:16:24 +00:00
Petar Petrov
db03e271f5 ZWaveJS: Color Switch support fot the expert UI (#22722)
* ZWaveJS: Color Switch support fot the expert UI

* remove debug code

* fix stopTransition options

* fix options format
2024-11-12 18:21:45 +01:00
AlCalzone
7c851d4542 Z-Wave JS: Fix validation/parsing for custom config param UI (#22789)
* Z-Wave JS: Fix validation/parsing for custom config param UI

* Apply suggestions from code review

Co-authored-by: Bram Kragten <mail@bramkragten.nl>

---------

Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2024-11-12 14:57:32 +00:00
Jan-Philipp Benecke
4d107f978c Add download snapshot button to camera more info dialog (#22704)
* Add take snapshot button to camera more info dialog

* Change to download

* Use camera proxy

* Remove filename to have right extension

* Add error handling and process indication

* Update src/dialogs/more-info/controls/more-info-camera.ts

Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>

* Run prettier

---------

Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>
2024-11-12 12:59:29 +02:00
karwosts
de57b025e6 Warn on switching to automation UI mode with yaml errors (#22780) 2024-11-12 12:47:12 +02:00
renovate[bot]
3f4351476f Update vaadinWebComponents monorepo to v24.5.3 (#22779)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-11 17:06:31 +01:00
karwosts
d763a014ad Show YAML parsing errors in automation editor (#22753)
* Show YAML parsing errors in automation editor

* make dirty on error

* formatting
2024-11-11 15:40:20 +00:00
Petar Petrov
52a91d8403 Allow GET/SET custom config param in Z-Wave device configuration (#22364)
* Allow GET/SET custom config param in Z-Wave device configuration

* update api calls and validation

* update imports

* fix import

* PR review comments

* fix import

* fix merge error

* fix merge
2024-11-11 08:50:13 +01:00
Petar Petrov
f6cc435f86 More flexible translation keys for logbook binary sensors (#22696)
* Revert "Revert "More flexible translation keys for logbook binary sensors" (#22687)"

This reverts commit c3b7ce8dc4.

* fix type issue
2024-11-11 08:39:11 +01:00
dependabot[bot]
349b1ccaad Bump home-assistant/wheels from 2024.07.1 to 2024.11.0 (#22774) 2024-11-11 08:17:16 +01:00
Paulus Schoutsen
ca921be9d2 CSS Fixes for md-dialog (#22638)
* CSS Fixes for md-dialog

* Update src/components/ha-md-dialog.ts

---------

Co-authored-by: Wendelin <12148533+wendevlin@users.noreply.github.com>
2024-11-11 07:11:58 +00:00
Simon Lamon
919932e414 Improve choose description in automation editor (#22769) 2024-11-10 21:11:48 +01:00
Simon Lamon
97a8b6da34 Fix calendar add/edit event dialogs not saving via keyboard (#22767) 2024-11-10 20:18:59 +01:00
renovate[bot]
1eceaa0d1b Update dependency marked to v14.1.4 (#22768)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-10 20:10:57 +01:00
renovate[bot]
ba3fae2577 Update dependency barcode-detector to v2.3.1 (#22763)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-10 15:51:14 +01:00
renovate[bot]
93ed1cae5e Update dependency comlink to v4.4.2 (#22761)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-10 15:34:45 +01:00
Adam Jež
d8618b4a25 Fix typo in Czech language for blank before percent (#22760) 2024-11-10 12:30:07 +01:00
Simon Lamon
1f6b0360de Collection of localization issues (2) (#22758)
* Clarify delay action

* Change order

* Add translations for "line" and "bar"
2024-11-10 10:58:04 +00:00
karwosts
e1830470b6 Better disabled/error handling on config/helpers page (#22237)
* Add a way to fix/remove broken helpers

* more disabled/sources fixes

* Update src/translations/en.json

Co-authored-by: Simon Lamon <32477463+silamon@users.noreply.github.com>

* Update ha-config-helpers.ts

---------

Co-authored-by: Simon Lamon <32477463+silamon@users.noreply.github.com>
2024-11-10 00:40:49 +01:00
renovate[bot]
9e002f7940 Update dependency webpackbar to v7 (#22752)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-09 16:43:33 +01:00
renovate[bot]
a1380e93ea Update dependency barcode-detector to v2.3.0 (#22743)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-08 20:16:20 +01:00
renovate[bot]
c511672b0d Update dependency barcode-detector to v2.2.12 (#22741)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-08 17:23:28 +00:00
renovate[bot]
d6d6d1d0b5 Update formatjs monorepo (#22728)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-08 18:10:48 +01:00
Wendelin
bee629f7ed Improve stream and iOS checks in error-log-card (#22738)
Improve stream and download checks in error-log-card
2024-11-08 12:59:35 +00:00
Bram Kragten
188fe44c2e Bumped version to 20241106.2 2024-11-08 13:01:19 +01:00
Wendelin
25c02b1219 Fix live-logs loading (#22737) 2024-11-08 13:00:40 +01:00
Wendelin
e5e84acd07 Fix join-beta text (#22733) 2024-11-08 13:00:40 +01:00
tzagim
722ccc017f Fix for RTL languages in logs (#22727)
Fix for RTL Languages (log)
2024-11-08 13:00:39 +01:00
Wendelin
d8df380edc Add reset to default to zwave node config (#21991)
* Add reset to default to zwave node config

* use invoke_cc_api instead of a new API

---------

Co-authored-by: Petar Petrov <MindFreeze@users.noreply.github.com>
2024-11-08 11:53:22 +00:00
Wendelin
cbfcad71d5 Fix live-logs loading (#22737) 2024-11-08 12:39:21 +01:00
renovate[bot]
327a9ff836 Update CodeMirror (#22732)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-08 13:05:04 +02:00
dependabot[bot]
ae2c389273 Bump http-proxy-middleware from 2.0.6 to 2.0.7 (#22731)
Bumps [http-proxy-middleware](https://github.com/chimurai/http-proxy-middleware) from 2.0.6 to 2.0.7.
- [Release notes](https://github.com/chimurai/http-proxy-middleware/releases)
- [Changelog](https://github.com/chimurai/http-proxy-middleware/blob/v2.0.7/CHANGELOG.md)
- [Commits](https://github.com/chimurai/http-proxy-middleware/compare/v2.0.6...v2.0.7)

---
updated-dependencies:
- dependency-name: http-proxy-middleware
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-08 11:01:31 +01:00
Wendelin
5ce75cea0d Fix join-beta text (#22733) 2024-11-08 11:00:54 +01:00
Simon Lamon
ee79c3a983 Remove rollup build configuration (#22181)
Rollup remove
2024-11-08 10:19:52 +02:00
tzagim
f396be2ed7 Fix for RTL languages in logs (#22727)
Fix for RTL Languages (log)
2024-11-08 10:16:42 +02:00
Bram Kragten
8a4b96f1ff Bumped version to 20241106.1 2024-11-07 21:40:38 +01:00
Paul Bottein
17b6bf0673 Enable auto-scroll for drag and drop (#22725) 2024-11-07 21:39:45 +01:00
Bram Kragten
387392713c move download logs button, switch between raw and normal logs (#22721) 2024-11-07 21:39:44 +01:00
Wendelin
125ad9c794 Fix logs live-indicator on older boots (#22719) 2024-11-07 21:39:43 +01:00
Bram Kragten
ae33b10cb2 Add support for helper text in form boolean (#22711) 2024-11-07 21:39:43 +01:00
Wendelin
1181ddcbbf Fix hassio logs for core < 2024.11 (#22708) 2024-11-07 21:39:42 +01:00
Paul Bottein
f7103febdf Fix typo for fixed background attribute (#22707) 2024-11-07 21:39:41 +01:00
Bram Kragten
6e8c1f1a63 Update value of password field on change event (#22706) 2024-11-07 21:39:40 +01:00
Bram Kragten
9f55ef811d move download logs button, switch between raw and normal logs (#22721) 2024-11-07 21:32:28 +01:00
Paul Bottein
4c898a2a5a Enable auto-scroll for drag and drop (#22725) 2024-11-07 17:33:18 +01:00
Wendelin
a56e22790d Fix logs live-indicator on older boots (#22719) 2024-11-07 14:50:24 +01:00
renovate[bot]
2d8fbc652f Update vaadinWebComponents monorepo to v24.5.2 (#22709)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-07 14:00:50 +02:00
Bram Kragten
46f0e0212d Add support for helper text in form boolean (#22711) 2024-11-07 09:09:24 +00:00
Bram Kragten
786b9ee8d6 Update value of password field on change event (#22706) 2024-11-07 09:53:34 +01:00
Wendelin
1e73cebda6 Fix hassio logs for core < 2024.11 (#22708) 2024-11-07 09:45:58 +01:00
Paul Bottein
9b9adf3c7a Fix typo for fixed background attribute (#22707) 2024-11-07 08:40:18 +00:00
renovate[bot]
a08c7a319f Update formatjs monorepo (#22681)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-11-07 08:52:53 +02:00
Petar Petrov
5e8868e4b1 Fix import type linter issues (#22702) 2024-11-07 06:39:30 +00:00
Bram Kragten
64285d5155 Add zwave expert UI / Installer settings (#21897)
* Add zwave expert UI / Installer settings

* Fix zwave invoceCC api function name

* Fix function calls of invokeZWaveCCApi

* Add zwave node-installer translations and endpoint separation

* Add zwave capability-control error handling, translations and thermostat setback

* Fix zwave capability thermostat setback

---------

Co-authored-by: Wendelin <w@pe8.at>
2024-11-07 08:00:51 +02:00
Bram Kragten
ce39b1a2c8 20241106.0 (#22695) 2024-11-06 14:05:23 +01:00
Paul Bottein
a6971d61d1 20241105.0 (#22679) 2024-11-05 18:47:04 +01:00
Bram Kragten
452cfee2cd Merge branch 'dev' 2024-11-04 19:04:13 +01:00
Paul Bottein
deb077b5e9 20241031.0 (#22613) 2024-10-31 15:14:02 +01:00
Paul Bottein
79e223cf8e 20241030.0 (#22599) 2024-10-30 16:35:54 +01:00
638 changed files with 15712 additions and 7892 deletions

View File

@@ -4,13 +4,12 @@
# - released in the last year + current alpha/beta versions
# - Firefox extended support release (ESR)
# - with global utilization at or above 0.5%
# - must support dynamic import of ES modules
# - exclude browsers no longer being maintained
# - exclude dead browsers (no security maintenance for 2+ years)
# - exclude KaiOS, QQ, and UC browsers due to lack of sufficient feature support data
unreleased versions
last 1 year
Firefox ESR
>= 0.5% and supports es6-module-dynamic-import
>= 0.5%
not dead
not KaiOS > 0
not QQAndroid > 0
@@ -20,23 +19,18 @@ not UCAndroid > 0
# Legacy builds are served when modern requirements are not met and support browsers:
# - released in the last 7 years + current alpha/beta versionss
# - with global utilization at or above 0.05%
# The lattermost query ensures that support for popular old browsers is not dropped too early
# (e.g. IE 11, Android 4.4, or Samsung 4).
#
# In addition, legacy browsers must support some minimum features that cannot be polyfilled:
# - ES5 (strict mode)
# - web sockets to communicate with backend
# - inline SVG used widely in buttons, widgets, etc.
# - custom events used for most user interactions
# - CSS flexbox used in the majority of the layout
# Nearly all of these are redundant with the above rules.
# As of May 2023, only web sockets must be added to the query.
# - exclude dead browsers (no security maintenance for 2+ years)
# - exclude Opera Mini which does not support web sockets
unreleased versions
last 7 years
>= 0.05% and supports websockets
>= 0.05%
not dead
not op_mini all
[legacy-sw]
# Same as legacy plus supports service workers
unreleased versions
last 7 years
>= 0.05% and supports websockets and supports serviceworkers
>= 0.05% and supports serviceworkers
not dead
not op_mini all

View File

@@ -1,132 +0,0 @@
{
"extends": [
"airbnb-base",
"airbnb-typescript/base",
"plugin:@typescript-eslint/recommended",
"plugin:wc/recommended",
"plugin:lit/all",
"plugin:lit-a11y/recommended",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"ecmaFeatures": {
"modules": true
},
"sourceType": "module",
"project": "./tsconfig.json"
},
"settings": {
"import/resolver": {
"webpack": {
"config": "./webpack.config.cjs"
}
}
},
"globals": {
"__DEV__": false,
"__DEMO__": false,
"__BUILD__": false,
"__VERSION__": false,
"__STATIC_PATH__": false,
"__SUPERVISOR__": false,
"Polymer": true
},
"env": {
"browser": true,
"es6": true
},
"rules": {
"class-methods-use-this": "off",
"new-cap": "off",
"prefer-template": "off",
"object-shorthand": "off",
"func-names": "off",
"no-underscore-dangle": "off",
"strict": "off",
"no-plusplus": "off",
"no-bitwise": "error",
"comma-dangle": "off",
"vars-on-top": "off",
"no-continue": "off",
"no-param-reassign": "off",
"no-multi-assign": "off",
"no-console": "error",
"radix": "off",
"no-alert": "off",
"no-nested-ternary": "off",
"prefer-destructuring": "off",
"no-restricted-globals": [2, "event"],
"prefer-promise-reject-errors": "off",
"import/prefer-default-export": "off",
"import/no-default-export": "off",
"import/no-unresolved": "off",
"import/no-cycle": "off",
"import/extensions": [
"error",
"ignorePackages",
{
"ts": "never",
"js": "never"
}
],
"no-restricted-syntax": ["error", "LabeledStatement", "WithStatement"],
"object-curly-newline": "off",
"default-case": "off",
"wc/no-self-class": "off",
"no-shadow": "off",
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-shadow": ["error"],
"@typescript-eslint/naming-convention": [
"off",
{
"selector": "default",
"format": ["camelCase", "snake_case"],
"leadingUnderscore": "allow",
"trailingUnderscore": "allow"
},
{
"selector": ["variable"],
"format": ["camelCase", "snake_case", "UPPER_CASE"],
"leadingUnderscore": "allow",
"trailingUnderscore": "allow"
},
{
"selector": "typeLike",
"format": ["PascalCase"]
}
],
"@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-vars": [
"error",
{
"vars": "all",
"varsIgnorePattern": "^_",
"args": "after-used",
"argsIgnorePattern": "^_",
"ignoreRestSiblings": true
}
],
"unused-imports/no-unused-imports": "error",
"lit/attribute-names": "warn",
"lit/attribute-value-entities": "off",
"lit/no-template-map": "off",
"lit/no-native-attributes": "warn",
"lit/no-this-assign-in-render": "warn",
"lit-a11y/click-events-have-key-events": ["off"],
"lit-a11y/no-autofocus": "off",
"lit-a11y/alt-text": "warn",
"lit-a11y/anchor-is-valid": "warn",
"lit-a11y/role-has-required-aria-attrs": "warn",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/no-import-type-side-effects": "error"
},
"plugins": ["unused-imports"]
}

View File

@@ -26,18 +26,24 @@ jobs:
- name: Check out files from GitHub
uses: actions/checkout@v4.2.2
- name: Setup Node
id: setup-node
uses: actions/setup-node@v4.1.0
with:
node-version-file: ".nvmrc"
cache: yarn
- uses: actions/cache@v4.2.0
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: "node_modules"
key: ${{ runner.os }}-yarn-${{ hashFiles('.yarnrc.yml') }}-${{ steps.setup-node.outputs.node-version }}-${{ hashFiles('yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-${{ hashFiles('.yarnrc.yml') }}-${{ steps.setup-node.outputs.node-version }}
- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --immutable
- name: Check for duplicate dependencies
run: yarn dedupe --check
- name: Build resources
run: ./node_modules/.bin/gulp gen-icons-json build-translations build-locale-data gather-gallery-pages
- name: Setup lint cache
uses: actions/cache@v4.1.2
uses: actions/cache@v4.2.0
with:
path: |
node_modules/.cache/prettier
@@ -60,11 +66,19 @@ jobs:
- name: Check out files from GitHub
uses: actions/checkout@v4.2.2
- name: Setup Node
id: setup-node
uses: actions/setup-node@v4.1.0
with:
node-version-file: ".nvmrc"
cache: yarn
- uses: actions/cache@v4.2.0
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: "node_modules"
key: ${{ runner.os }}-yarn-${{ hashFiles('.yarnrc.yml') }}-${{ steps.setup-node.outputs.node-version }}-${{ hashFiles('yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-${{ hashFiles('.yarnrc.yml') }}-${{ steps.setup-node.outputs.node-version }}
- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --immutable
- name: Build resources
run: ./node_modules/.bin/gulp gen-icons-json build-translations build-locale-data
@@ -78,11 +92,19 @@ jobs:
- name: Check out files from GitHub
uses: actions/checkout@v4.2.2
- name: Setup Node
id: setup-node
uses: actions/setup-node@v4.1.0
with:
node-version-file: ".nvmrc"
cache: yarn
- uses: actions/cache@v4.2.0
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: "node_modules"
key: ${{ runner.os }}-yarn-${{ hashFiles('.yarnrc.yml') }}-${{ steps.setup-node.outputs.node-version }}-${{ hashFiles('yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-${{ hashFiles('.yarnrc.yml') }}-${{ steps.setup-node.outputs.node-version }}
- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --immutable
- name: Build Application
run: ./node_modules/.bin/gulp build-app
@@ -102,11 +124,19 @@ jobs:
- name: Check out files from GitHub
uses: actions/checkout@v4.2.2
- name: Setup Node
id: setup-node
uses: actions/setup-node@v4.1.0
with:
node-version-file: ".nvmrc"
cache: yarn
- uses: actions/cache@v4.2.0
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: "node_modules"
key: ${{ runner.os }}-yarn-${{ hashFiles('.yarnrc.yml') }}-${{ steps.setup-node.outputs.node-version }}-${{ hashFiles('yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn-${{ hashFiles('.yarnrc.yml') }}-${{ steps.setup-node.outputs.node-version }}
- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn install --immutable
- name: Build Application
run: ./node_modules/.bin/gulp build-hassio

View File

@@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Send bundle stats and build information to RelativeCI
uses: relative-ci/agent-action@v2.1.13
uses: relative-ci/agent-action@v2.1.14
with:
key: ${{ secrets[format('RELATIVE_CI_KEY_{0}_{1}', matrix.bundle, matrix.build)] }}
token: ${{ github.token }}

View File

@@ -55,7 +55,7 @@ jobs:
script/release
- name: Upload release assets
uses: softprops/action-gh-release@v2.0.9
uses: softprops/action-gh-release@v2.1.0
with:
files: |
dist/*.whl
@@ -74,10 +74,68 @@ jobs:
echo "home-assistant-frontend==$version" > ./requirements.txt
- name: Build wheels
uses: home-assistant/wheels@2024.07.1
uses: home-assistant/wheels@2024.11.0
with:
abi: cp312
tag: musllinux_1_2
arch: amd64
wheels-key: ${{ secrets.WHEELS_KEY }}
requirements: "requirements.txt"
release-landing-page:
name: Release landing-page frontend
if: github.event.release.prerelease == false
runs-on: ubuntu-latest
permissions:
contents: write # Required to upload release assets
steps:
- name: Checkout the repository
uses: actions/checkout@v4.2.2
- name: Setup Node
uses: actions/setup-node@v4.1.0
with:
node-version-file: ".nvmrc"
cache: yarn
- name: Install dependencies
run: yarn install
- name: Download Translations
run: ./script/translations_download
env:
LOKALISE_TOKEN: ${{ secrets.LOKALISE_TOKEN }}
- name: Build landing-page
run: landing-page/script/build_landing_page
- name: Tar folder
run: tar -czf landing-page/home_assistant_frontend_landingpage-${{ github.event.release.tag_name }}.tar.gz -C landing-page/dist .
- name: Upload release asset
uses: softprops/action-gh-release@v2.1.0
with:
files: landing-page/home_assistant_frontend_landingpage-${{ github.event.release.tag_name }}.tar.gz
release-supervisor:
name: Release supervisor frontend
if: github.event.release.prerelease == false
runs-on: ubuntu-latest
permissions:
contents: write # Required to upload release assets
steps:
- name: Checkout the repository
uses: actions/checkout@v4.2.2
- name: Setup Node
uses: actions/setup-node@v4.1.0
with:
node-version-file: ".nvmrc"
cache: yarn
- name: Install dependencies
run: yarn install
- name: Download Translations
run: ./script/translations_download
env:
LOKALISE_TOKEN: ${{ secrets.LOKALISE_TOKEN }}
- name: Build supervisor
run: hassio/script/build_hassio
- name: Tar folder
run: tar -czf hassio/home_assistant_frontend_supervisor-${{ github.event.release.tag_name }}.tar.gz -C hassio/build .
- name: Upload release asset
uses: softprops/action-gh-release@v2.1.0
with:
files: hassio/home_assistant_frontend_supervisor-${{ github.event.release.tag_name }}.tar.gz

3
.gitignore vendored
View File

@@ -50,3 +50,6 @@ src/cast/dev_const.ts
# Jetbrains
/.idea/
# test coverage
test/coverage/

View File

@@ -4,6 +4,7 @@
"esbenp.prettier-vscode",
"runem.lit-plugin",
"github.vscode-pull-request-github",
"eamodio.gitlens"
"eamodio.gitlens",
"vitest.explorer"
]
}

32
.vscode/tasks.json vendored
View File

@@ -100,6 +100,38 @@
"instanceLimit": 1
}
},
{
"label": "Develop Landing Page",
"type": "gulp",
"task": "develop-landing-page",
"problemMatcher": {
"owner": "ha-build",
"source": "ha-build",
"fileLocation": "absolute",
"severity": "error",
"pattern": [
{
"regexp": "(SyntaxError): (.+): (.+) \\((\\d+):(\\d+)\\)",
"severity": 1,
"file": 2,
"message": 3,
"line": 4,
"column": 5
}
],
"background": {
"activeOnStart": true,
"beginsPattern": "Changes detected. Starting compilation",
"endsPattern": "Build done @"
}
},
"isBackground": true,
"group": "build",
"runOptions": {
"instanceLimit": 1
}
},
{
"label": "Develop Demo",
"type": "gulp",

File diff suppressed because one or more lines are too long

View File

@@ -6,4 +6,4 @@ enableGlobalCache: false
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-4.5.1.cjs
yarnPath: .yarn/releases/yarn-4.5.3.cjs

View File

@@ -1,12 +0,0 @@
{
"extends": "../.eslintrc.json",
"rules": {
"no-console": "off",
"import/no-extraneous-dependencies": "off",
"import/extensions": "off",
"import/no-dynamic-require": "off",
"global-require": "off",
"@typescript-eslint/no-var-requires": "off",
"prefer-arrow-callback": "off"
}
}

View File

@@ -15,7 +15,7 @@ The Home Assistant build pipeline contains various steps to prepare a build.
Currently in Home Assistant we use a bundler to convert TypeScript, CSS and JSON files to JavaScript files that the browser understands.
We currently rely on Webpack but also have experimental Rollup support. Both of these programs bundle the converted files in both production and development.
We currently rely on Webpack. Both of these programs bundle the converted files in both production and development.
For development, bundling is optional. We just want to get the right files in the browser.

View File

@@ -147,6 +147,7 @@ const polyfillMap = {
...Object.fromEntries(
[
"DateTimeFormat",
"DurationFormat",
"DisplayNames",
"ListFormat",
"NumberFormat",

View File

@@ -53,6 +53,11 @@ module.exports.definedVars = ({ isProdBuild, latestBuild, defineOverlay }) => ({
__SUPERVISOR__: false,
__BACKWARDS_COMPAT__: false,
__STATIC_PATH__: "/static/",
__HASS_URL__: `\`${
"HASS_URL" in process.env
? process.env["HASS_URL"]
: "${location.protocol}//${location.host}"
}\``,
"process.env.NODE_ENV": JSON.stringify(
isProdBuild ? "production" : "development"
),
@@ -152,7 +157,6 @@ module.exports.babelOptions = ({
exclude: [
// \\ for Windows, / for Mac OS and Linux
/node_modules[\\/]core-js/,
/node_modules[\\/]webpack[\\/]buildin/,
],
sourceMaps: !isTestBuild,
overrides: [
@@ -226,13 +230,12 @@ module.exports.config = {
return {
name: "frontend" + nameSuffix(latestBuild),
entry: {
"service-worker":
!env.useRollup() && !latestBuild
? {
import: "./src/entrypoints/service-worker.ts",
layer: "sw",
}
: "./src/entrypoints/service-worker.ts",
"service-worker": !latestBuild
? {
import: "./src/entrypoints/service-worker.ts",
layer: "sw",
}
: "./src/entrypoints/service-worker.ts",
app: "./src/entrypoints/app.ts",
authorize: "./src/entrypoints/authorize.ts",
onboarding: "./src/entrypoints/onboarding.ts",
@@ -328,4 +331,17 @@ module.exports.config = {
},
};
},
landingPage({ isProdBuild, latestBuild }) {
return {
name: "landing-page" + nameSuffix(latestBuild),
entry: {
entrypoint: path.resolve(paths.landingPage_dir, "src/entrypoint.js"),
},
outputPath: outputPath(paths.landingPage_output_root, latestBuild),
publicPath: publicPath(latestBuild),
isProdBuild,
latestBuild,
};
},
};

View File

@@ -2,26 +2,22 @@ const fs = require("fs");
const path = require("path");
const paths = require("./paths.cjs");
const isTrue = (value) => value === "1" || value?.toLowerCase() === "true";
module.exports = {
useRollup() {
return process.env.ROLLUP === "1";
},
useWDS() {
return process.env.WDS === "1";
},
isProdBuild() {
return (
process.env.NODE_ENV === "production" || module.exports.isStatsBuild()
);
},
isStatsBuild() {
return process.env.STATS === "1";
return isTrue(process.env.STATS);
},
isTestBuild() {
return process.env.IS_TEST === "true";
return isTrue(process.env.IS_TEST);
},
isNetlify() {
return process.env.NETLIFY === "true";
return isTrue(process.env.NETLIFY);
},
version() {
const version = fs
@@ -33,6 +29,6 @@ module.exports = {
return version[1];
},
isDevContainer() {
return process.env.DEV_CONTAINER === "1";
return isTrue(process.env.DEV_CONTAINER);
},
};

View File

@@ -0,0 +1,16 @@
import rootConfig from "../eslint.config.mjs";
export default [
...rootConfig,
{
rules: {
"no-console": "off",
"import/no-extraneous-dependencies": "off",
"import/extensions": "off",
"import/no-dynamic-require": "off",
"global-require": "off",
"@typescript-eslint/no-var-requires": "off",
"prefer-arrow-callback": "off",
},
},
];

View File

@@ -6,11 +6,9 @@ import "./entry-html.js";
import "./gather-static.js";
import "./gen-icons-json.js";
import "./locale-data.js";
import "./rollup.js";
import "./service-worker.js";
import "./translations.js";
import "./wds.js";
import "./webpack.js";
import "./rspack.js";
gulp.task(
"develop-app",
@@ -27,11 +25,7 @@ gulp.task(
"build-locale-data"
),
"copy-static-app",
env.useWDS()
? "wds-watch-app"
: env.useRollup()
? "rollup-watch-app"
: "webpack-watch-app"
"rspack-watch-app"
)
);
@@ -44,9 +38,20 @@ gulp.task(
"clean",
gulp.parallel("gen-icons-json", "build-translations", "build-locale-data"),
"copy-static-app",
env.useRollup() ? "rollup-prod-app" : "webpack-prod-app",
"rspack-prod-app",
gulp.parallel("gen-pages-app-prod", "gen-service-worker-app-prod"),
// Don't compress running tests
...(env.isTestBuild() ? [] : ["compress-app"])
...(env.isTestBuild() || env.isStatsBuild() ? [] : ["compress-app"])
)
);
gulp.task(
"analyze-app",
gulp.series(
async function setEnv() {
process.env.STATS = "1";
},
"clean",
"rspack-prod-app"
)
);

View File

@@ -1,12 +1,10 @@
import gulp from "gulp";
import env from "../env.cjs";
import "./clean.js";
import "./entry-html.js";
import "./gather-static.js";
import "./rollup.js";
import "./service-worker.js";
import "./translations.js";
import "./webpack.js";
import "./rspack.js";
gulp.task(
"develop-cast",
@@ -19,7 +17,7 @@ gulp.task(
gulp.parallel("gen-icons-json", "build-translations", "build-locale-data"),
"copy-static-cast",
"gen-pages-cast-dev",
env.useRollup() ? "rollup-dev-server-cast" : "webpack-dev-server-cast"
"rspack-dev-server-cast"
)
);
@@ -33,7 +31,7 @@ gulp.task(
"translations-enable-merge-backend",
gulp.parallel("gen-icons-json", "build-translations", "build-locale-data"),
"copy-static-cast",
env.useRollup() ? "rollup-prod-cast" : "webpack-prod-cast",
"rspack-prod-cast",
"gen-pages-cast-prod"
)
);

View File

@@ -38,3 +38,14 @@ gulp.task(
])
)
);
gulp.task(
"clean-landing-page",
gulp.parallel("clean-translations", async () =>
deleteSync([
paths.landingPage_output_root,
paths.landingPage_build,
paths.build_dir,
])
)
);

View File

@@ -3,7 +3,6 @@
import { constants } from "node:zlib";
import gulp from "gulp";
import brotli from "gulp-brotli";
import zopfli from "gulp-zopfli-green";
import paths from "../paths.cjs";
const filesGlob = "*.{js,json,css,svg,xml}";
@@ -13,7 +12,6 @@ const brotliOptions = {
[constants.BROTLI_PARAM_QUALITY]: constants.BROTLI_MAX_QUALITY,
},
};
const zopfliOptions = { threshold: 150 };
const compressDistBrotli = (rootDir, modernDir, compressServiceWorker = true) =>
gulp
@@ -29,20 +27,6 @@ const compressDistBrotli = (rootDir, modernDir, compressServiceWorker = true) =>
.pipe(brotli(brotliOptions))
.pipe(gulp.dest(rootDir));
const compressDistZopfli = (rootDir, modernDir, compressModern = false) =>
gulp
.src(
[
`${rootDir}/**/${filesGlob}`,
compressModern ? undefined : `!${modernDir}/**/${filesGlob}`,
`!${rootDir}/{sw-modern,service_worker}.js`,
`${rootDir}/{authorize,onboarding}.html`,
].filter(Boolean),
{ base: rootDir }
)
.pipe(zopfli(zopfliOptions))
.pipe(gulp.dest(rootDir));
const compressAppBrotli = () =>
compressDistBrotli(paths.app_output_root, paths.app_output_latest);
const compressHassioBrotli = () =>
@@ -52,17 +36,5 @@ const compressHassioBrotli = () =>
false
);
const compressAppZopfli = () =>
compressDistZopfli(paths.app_output_root, paths.app_output_latest);
const compressHassioZopfli = () =>
compressDistZopfli(
paths.hassio_output_root,
paths.hassio_output_latest,
true
);
gulp.task("compress-app", gulp.parallel(compressAppBrotli, compressAppZopfli));
gulp.task(
"compress-hassio",
gulp.parallel(compressHassioBrotli, compressHassioZopfli)
);
gulp.task("compress-app", compressAppBrotli);
gulp.task("compress-hassio", compressHassioBrotli);

View File

@@ -1,13 +1,11 @@
import gulp from "gulp";
import env from "../env.cjs";
import "./clean.js";
import "./entry-html.js";
import "./gather-static.js";
import "./gen-icons-json.js";
import "./rollup.js";
import "./service-worker.js";
import "./translations.js";
import "./webpack.js";
import "./rspack.js";
gulp.task(
"develop-demo",
@@ -24,7 +22,7 @@ gulp.task(
"build-locale-data"
),
"copy-static-demo",
env.useRollup() ? "rollup-dev-server-demo" : "webpack-dev-server-demo"
"rspack-dev-server-demo"
)
);
@@ -39,7 +37,18 @@ gulp.task(
"translations-enable-merge-backend",
gulp.parallel("gen-icons-json", "build-translations", "build-locale-data"),
"copy-static-demo",
env.useRollup() ? "rollup-prod-demo" : "webpack-prod-demo",
"rspack-prod-demo",
"gen-pages-demo-prod"
)
);
gulp.task(
"analyze-demo",
gulp.series(
async function setEnv() {
process.env.STATS = "1";
},
"clean",
"rspack-prod-demo"
)
);

View File

@@ -127,6 +127,7 @@ gulp.task("fetch-lokalise", async function () {
replace_breaks: false,
json_unescaped_slashes: true,
export_empty_as: "skip",
filter_data: ["verified"],
})
.then((download) => fetch(download.bundle_url))
.then((response) => {

View File

@@ -11,7 +11,6 @@ import { minify } from "html-minifier-terser";
import template from "lodash.template";
import { dirname, extname, resolve } from "node:path";
import { htmlMinifierOptions, terserOptions } from "../bundle.cjs";
import env from "../env.cjs";
import paths from "../paths.cjs";
// macOS companion app has no way to obtain the Safari version used by WKWebView,
@@ -56,8 +55,6 @@ const getCommonTemplateVars = () => {
{ ignorePatch: true, allowHigherVersions: true }
);
return {
useRollup: env.useRollup(),
useWDS: env.useWDS(),
modernRegex: compileRegex(browserRegexes.concat(haMacOSRegex)).toString(),
};
};
@@ -93,13 +90,11 @@ const minifyHtml = (content, ext) => {
};
// Function to generate a dev task for each project's configuration
// Note Currently WDS paths are hard-coded to only work for app
const genPagesDevTask =
(
pageEntries,
inputRoot,
outputRoot,
useWDS = false,
inputSub = "src/html",
publicRoot = ""
) =>
@@ -110,17 +105,13 @@ const genPagesDevTask =
resolve(inputRoot, inputSub, `${page}.template`),
{
...commonVars,
latestEntryJS: entries.map((entry) =>
useWDS
? `http://localhost:8000/src/entrypoints/${entry}.ts`
: `${publicRoot}/frontend_latest/${entry}.js`
latestEntryJS: entries.map(
(entry) => `${publicRoot}/frontend_latest/${entry}.js`
),
es5EntryJS: entries.map(
(entry) => `${publicRoot}/frontend_es5/${entry}.js`
),
latestCustomPanelJS: useWDS
? "http://localhost:8000/src/entrypoints/custom-panel.ts"
: `${publicRoot}/frontend_latest/custom-panel.js`,
latestCustomPanelJS: `${publicRoot}/frontend_latest/custom-panel.js`,
es5CustomPanelJS: `${publicRoot}/frontend_es5/custom-panel.js`,
}
);
@@ -177,12 +168,7 @@ const APP_PAGE_ENTRIES = {
gulp.task(
"gen-pages-app-dev",
genPagesDevTask(
APP_PAGE_ENTRIES,
paths.polymer_dir,
paths.app_output_root,
env.useWDS()
)
genPagesDevTask(APP_PAGE_ENTRIES, paths.polymer_dir, paths.app_output_root)
);
gulp.task(
@@ -258,6 +244,28 @@ gulp.task(
)
);
const LANDING_PAGE_PAGE_ENTRIES = { "index.html": ["entrypoint"] };
gulp.task(
"gen-pages-landing-page-dev",
genPagesDevTask(
LANDING_PAGE_PAGE_ENTRIES,
paths.landingPage_dir,
paths.landingPage_output_root
)
);
gulp.task(
"gen-pages-landing-page-prod",
genPagesProdTask(
LANDING_PAGE_PAGE_ENTRIES,
paths.landingPage_dir,
paths.landingPage_output_root,
paths.landingPage_output_latest,
paths.landingPage_output_es5
)
);
const HASSIO_PAGE_ENTRIES = { "entrypoint.js": ["entrypoint"] };
gulp.task(
@@ -266,7 +274,6 @@ gulp.task(
HASSIO_PAGE_ENTRIES,
paths.hassio_dir,
paths.hassio_output_root,
undefined,
"src",
paths.hassio_publicPath
)

View File

@@ -66,7 +66,7 @@ gulp.task("fetch-nightly-translations", async function () {
tokenAuth = JSON.parse(await readFile(TOKEN_FILE, "utf-8"));
} catch {
if (!allowTokenSetup) {
console.log("No token found so build wil continue with English only");
console.log("No token found so build will continue with English only");
return;
}
const auth = createOAuthDeviceAuth({

View File

@@ -4,16 +4,14 @@ import gulp from "gulp";
import yaml from "js-yaml";
import { marked } from "marked";
import path from "path";
import env from "../env.cjs";
import paths from "../paths.cjs";
import "./clean.js";
import "./entry-html.js";
import "./gather-static.js";
import "./gen-icons-json.js";
import "./rollup.js";
import "./service-worker.js";
import "./translations.js";
import "./webpack.js";
import "./rspack.js";
gulp.task("gather-gallery-pages", async function gatherPages() {
const pageDir = path.resolve(paths.gallery_dir, "src/pages");
@@ -158,9 +156,7 @@ gulp.task(
"copy-static-gallery",
"gen-pages-gallery-dev",
gulp.parallel(
env.useRollup()
? "rollup-dev-server-gallery"
: "webpack-dev-server-gallery",
"rspack-dev-server-gallery",
async function watchMarkdownFiles() {
gulp.watch(
[
@@ -189,7 +185,7 @@ gulp.task(
"gather-gallery-pages"
),
"copy-static-gallery",
env.useRollup() ? "rollup-prod-gallery" : "webpack-prod-gallery",
"rspack-prod-gallery",
"gen-pages-gallery-prod"
)
);

View File

@@ -4,7 +4,6 @@ import fs from "fs-extra";
import gulp from "gulp";
import path from "path";
import paths from "../paths.cjs";
import env from "../env.cjs";
const npmPath = (...parts) =>
path.resolve(paths.polymer_dir, "node_modules", ...parts);
@@ -69,9 +68,6 @@ function copyPolyfills(staticDir) {
}
function copyLoaderJS(staticDir) {
if (!env.useRollup()) {
return;
}
const staticPath = genStaticPath(staticDir);
copyFileDir(npmPath("systemjs/dist/s.min.js"), staticPath("js"));
copyFileDir(npmPath("systemjs/dist/s.min.js.map"), staticPath("js"));
@@ -129,6 +125,11 @@ gulp.task("copy-translations-supervisor", async () => {
copyTranslations(staticDir);
});
gulp.task("copy-translations-landing-page", async () => {
const staticDir = paths.landingPage_output_static;
copyTranslations(staticDir);
});
gulp.task("copy-static-supervisor", async () => {
const staticDir = paths.hassio_output_static;
copyLocaleData(staticDir);
@@ -203,3 +204,14 @@ gulp.task("copy-static-gallery", async () => {
copyLocaleData(paths.gallery_output_static);
copyMdiIcons(paths.gallery_output_static);
});
gulp.task("copy-static-landing-page", async () => {
// Copy landing-page static files
fs.copySync(
path.resolve(paths.landingPage_dir, "public"),
paths.landingPage_output_root
);
copyFonts(paths.landingPage_output_static);
copyTranslations(paths.landingPage_output_static);
});

View File

@@ -5,9 +5,8 @@ import "./compress.js";
import "./entry-html.js";
import "./gather-static.js";
import "./gen-icons-json.js";
import "./rollup.js";
import "./translations.js";
import "./webpack.js";
import "./rspack.js";
gulp.task(
"develop-hassio",
@@ -22,7 +21,7 @@ gulp.task(
"copy-translations-supervisor",
"build-locale-data",
"copy-static-supervisor",
env.useRollup() ? "rollup-watch-hassio" : "webpack-watch-hassio"
"rspack-watch-hassio"
)
);
@@ -38,7 +37,7 @@ gulp.task(
"copy-translations-supervisor",
"build-locale-data",
"copy-static-supervisor",
env.useRollup() ? "rollup-prod-hassio" : "webpack-prod-hassio",
"rspack-prod-hassio",
"gen-pages-hassio-prod",
...// Don't compress running tests
(env.isTestBuild() ? [] : ["compress-hassio"])

View File

@@ -0,0 +1,41 @@
import gulp from "gulp";
import "./clean.js";
import "./compress.js";
import "./entry-html.js";
import "./gather-static.js";
import "./gen-icons-json.js";
import "./translations.js";
import "./rspack.js";
gulp.task(
"develop-landing-page",
gulp.series(
async function setEnv() {
process.env.NODE_ENV = "development";
},
"clean-landing-page",
"translations-enable-merge-backend",
"build-landing-page-translations",
"copy-translations-landing-page",
"build-locale-data",
"copy-static-landing-page",
"gen-pages-landing-page-dev",
"rspack-watch-landing-page"
)
);
gulp.task(
"build-landing-page",
gulp.series(
async function setEnv() {
process.env.NODE_ENV = "production";
},
"clean-landing-page",
"build-landing-page-translations",
"copy-translations-landing-page",
"build-locale-data",
"copy-static-landing-page",
"rspack-prod-landing-page",
"gen-pages-landing-page-prod"
)
);

View File

@@ -1,147 +0,0 @@
// Tasks to run Rollup
import log from "fancy-log";
import gulp from "gulp";
import http from "http";
import open from "open";
import path from "path";
import { rollup } from "rollup";
import handler from "serve-handler";
import paths from "../paths.cjs";
import rollupConfig from "../rollup.cjs";
const bothBuilds = (createConfigFunc, params) =>
gulp.series(
async function buildLatest() {
await buildRollup(
createConfigFunc({
...params,
latestBuild: true,
})
);
},
async function buildES5() {
await buildRollup(
createConfigFunc({
...params,
latestBuild: false,
})
);
}
);
function createServer(serveOptions) {
const server = http.createServer((request, response) =>
handler(request, response, {
public: serveOptions.root,
})
);
server.listen(
serveOptions.port,
serveOptions.networkAccess ? "0.0.0.0" : undefined,
() => {
log.info(`Available at http://localhost:${serveOptions.port}`);
open(`http://localhost:${serveOptions.port}`);
}
);
}
function watchRollup(createConfig, extraWatchSrc = [], serveOptions = null) {
const { inputOptions, outputOptions } = createConfig({
isProdBuild: false,
latestBuild: true,
});
const watcher = rollup.watch({
...inputOptions,
output: [outputOptions],
watch: {
include: ["src/**"] + extraWatchSrc,
},
});
let startedHttp = false;
watcher.on("event", (event) => {
if (event.code === "BUNDLE_END") {
log(`Build done @ ${new Date().toLocaleTimeString()}`);
} else if (event.code === "ERROR") {
log.error(event.error);
} else if (event.code === "END") {
if (startedHttp || !serveOptions) {
return;
}
startedHttp = true;
createServer(serveOptions);
}
});
gulp.watch(
path.join(paths.translations_src, "en.json"),
gulp.series("build-translations", "copy-translations-app")
);
}
async function buildRollup(config) {
const bundle = await rollup.rollup(config.inputOptions);
await bundle.write(config.outputOptions);
}
gulp.task("rollup-watch-app", () => {
watchRollup(rollupConfig.createAppConfig);
});
gulp.task("rollup-watch-hassio", () => {
watchRollup(rollupConfig.createHassioConfig, ["hassio/src/**"]);
});
gulp.task("rollup-dev-server-demo", () => {
watchRollup(rollupConfig.createDemoConfig, ["demo/src/**"], {
root: paths.demo_output_root,
port: 8090,
});
});
gulp.task("rollup-dev-server-cast", () => {
watchRollup(rollupConfig.createCastConfig, ["cast/src/**"], {
root: paths.cast_output_root,
port: 8080,
networkAccess: true,
});
});
gulp.task("rollup-dev-server-gallery", () => {
watchRollup(rollupConfig.createGalleryConfig, ["gallery/src/**"], {
root: paths.gallery_output_root,
port: 8100,
});
});
gulp.task(
"rollup-prod-app",
bothBuilds(rollupConfig.createAppConfig, { isProdBuild: true })
);
gulp.task(
"rollup-prod-demo",
bothBuilds(rollupConfig.createDemoConfig, { isProdBuild: true })
);
gulp.task(
"rollup-prod-cast",
bothBuilds(rollupConfig.createCastConfig, { isProdBuild: true })
);
gulp.task("rollup-prod-hassio", () =>
bothBuilds(rollupConfig.createHassioConfig, { isProdBuild: true })
);
gulp.task("rollup-prod-gallery", () =>
buildRollup(
rollupConfig.createGalleryConfig({
isProdBuild: true,
latestBuild: true,
})
)
);

View File

@@ -1,11 +1,11 @@
// Tasks to run webpack.
// Tasks to run rspack.
import fs from "fs";
import path from "path";
import log from "fancy-log";
import gulp from "gulp";
import webpack from "webpack";
import WebpackDevServer from "webpack-dev-server";
import rspack from "@rspack/core";
import { RspackDevServer } from "@rspack/dev-server";
import env from "../env.cjs";
import paths from "../paths.cjs";
import {
@@ -14,7 +14,8 @@ import {
createDemoConfig,
createGalleryConfig,
createHassioConfig,
} from "../webpack.cjs";
createLandingPageConfig,
} from "../rspack.cjs";
const bothBuilds = (createConfigFunc, params) => [
createConfigFunc({ ...params, latestBuild: true }),
@@ -30,7 +31,7 @@ const isWsl =
/**
* @param {{
* compiler: import("webpack").Compiler,
* compiler: import("@rspack/core").Compiler,
* contentBase: string,
* port: number,
* listenHost?: string
@@ -41,12 +42,13 @@ const runDevServer = async ({
contentBase,
port,
listenHost = undefined,
proxy = undefined,
}) => {
if (listenHost === undefined) {
// For dev container, we need to listen on all hosts
listenHost = env.isDevContainer() ? "0.0.0.0" : "localhost";
}
const server = new WebpackDevServer(
const server = new RspackDevServer(
{
hot: false,
open: true,
@@ -56,13 +58,14 @@ const runDevServer = async ({
directory: contentBase,
watch: true,
},
proxy,
},
compiler
);
await server.start();
// Server listening
log("[webpack-dev-server]", `Project is running at http://localhost:${port}`);
log("[rspack-dev-server]", `Project is running at http://localhost:${port}`);
};
const doneHandler = (done) => (err, stats) => {
@@ -87,16 +90,16 @@ const doneHandler = (done) => (err, stats) => {
const prodBuild = (conf) =>
new Promise((resolve) => {
webpack(
rspack(
conf,
// Resolve promise when done. Because we pass a callback, webpack closes itself
// Resolve promise when done. Because we pass a callback, rspack closes itself
doneHandler(resolve)
);
});
gulp.task("webpack-watch-app", () => {
gulp.task("rspack-watch-app", () => {
// This command will run forever because we don't close compiler
webpack(
rspack(
process.env.ES5
? bothBuilds(createAppConfig, { isProdBuild: false })
: createAppConfig({ isProdBuild: false, latestBuild: true })
@@ -107,7 +110,7 @@ gulp.task("webpack-watch-app", () => {
);
});
gulp.task("webpack-prod-app", () =>
gulp.task("rspack-prod-app", () =>
prodBuild(
bothBuilds(createAppConfig, {
isProdBuild: true,
@@ -117,9 +120,9 @@ gulp.task("webpack-prod-app", () =>
)
);
gulp.task("webpack-dev-server-demo", () =>
gulp.task("rspack-dev-server-demo", () =>
runDevServer({
compiler: webpack(
compiler: rspack(
createDemoConfig({ isProdBuild: false, latestBuild: true })
),
contentBase: paths.demo_output_root,
@@ -127,17 +130,18 @@ gulp.task("webpack-dev-server-demo", () =>
})
);
gulp.task("webpack-prod-demo", () =>
gulp.task("rspack-prod-demo", () =>
prodBuild(
bothBuilds(createDemoConfig, {
isProdBuild: true,
isStatsBuild: env.isStatsBuild(),
})
)
);
gulp.task("webpack-dev-server-cast", () =>
gulp.task("rspack-dev-server-cast", () =>
runDevServer({
compiler: webpack(
compiler: rspack(
createCastConfig({ isProdBuild: false, latestBuild: true })
),
contentBase: paths.cast_output_root,
@@ -147,7 +151,7 @@ gulp.task("webpack-dev-server-cast", () =>
})
);
gulp.task("webpack-prod-cast", () =>
gulp.task("rspack-prod-cast", () =>
prodBuild(
bothBuilds(createCastConfig, {
isProdBuild: true,
@@ -155,9 +159,9 @@ gulp.task("webpack-prod-cast", () =>
)
);
gulp.task("webpack-watch-hassio", () => {
gulp.task("rspack-watch-hassio", () => {
// This command will run forever because we don't close compiler
webpack(
rspack(
createHassioConfig({
isProdBuild: false,
latestBuild: true,
@@ -170,7 +174,7 @@ gulp.task("webpack-watch-hassio", () => {
);
});
gulp.task("webpack-prod-hassio", () =>
gulp.task("rspack-prod-hassio", () =>
prodBuild(
bothBuilds(createHassioConfig, {
isProdBuild: true,
@@ -180,9 +184,9 @@ gulp.task("webpack-prod-hassio", () =>
)
);
gulp.task("webpack-dev-server-gallery", () =>
gulp.task("rspack-dev-server-gallery", () =>
runDevServer({
compiler: webpack(
compiler: rspack(
createGalleryConfig({ isProdBuild: false, latestBuild: true })
),
contentBase: paths.gallery_output_root,
@@ -191,7 +195,7 @@ gulp.task("webpack-dev-server-gallery", () =>
})
);
gulp.task("webpack-prod-gallery", () =>
gulp.task("rspack-prod-gallery", () =>
prodBuild(
createGalleryConfig({
isProdBuild: true,
@@ -199,3 +203,30 @@ gulp.task("webpack-prod-gallery", () =>
})
)
);
gulp.task("rspack-watch-landing-page", () => {
// This command will run forever because we don't close compiler
rspack(
process.env.ES5
? bothBuilds(createLandingPageConfig, { isProdBuild: false })
: createLandingPageConfig({ isProdBuild: false, latestBuild: true })
).watch({ poll: isWsl }, doneHandler());
gulp.watch(
path.join(paths.translations_src, "en.json"),
gulp.series(
"build-landing-page-translations",
"copy-translations-landing-page"
)
);
});
gulp.task("rspack-prod-landing-page", () =>
prodBuild(
bothBuilds(createLandingPageConfig, {
isProdBuild: true,
isStatsBuild: env.isStatsBuild(),
isTestBuild: env.isTestBuild(),
})
)
);

View File

@@ -172,12 +172,14 @@ const createMasterTranslation = () =>
const FRAGMENTS = ["base"];
const toggleSupervisorFragment = async () => {
FRAGMENTS[0] = "supervisor";
const setFragment = (fragment) => async () => {
FRAGMENTS[0] = fragment;
};
const panelFragment = (fragment) =>
fragment !== "base" && fragment !== "supervisor";
fragment !== "base" &&
fragment !== "supervisor" &&
fragment !== "landing-page";
const HASHES = new Map();
@@ -224,6 +226,9 @@ const createTranslations = async () => {
case "supervisor":
// Supervisor key is at the top level
return [flatten(data.supervisor), ""];
case "landing-page":
// landing-page key is at the top level
return [flatten(data["landing-page"]), ""];
default:
// Create a fragment with only the given panel
return [
@@ -322,5 +327,10 @@ gulp.task(
gulp.task(
"build-supervisor-translations",
gulp.series(toggleSupervisorFragment, "build-translations")
gulp.series(setFragment("supervisor"), "build-translations")
);
gulp.task(
"build-landing-page-translations",
gulp.series(setFragment("landing-page"), "build-translations")
);

View File

@@ -1,10 +0,0 @@
import gulp from "gulp";
import { startDevServer } from "@web/dev-server";
gulp.task("wds-watch-app", async () => {
startDevServer({
config: {
watch: true,
},
});
});

View File

@@ -33,6 +33,22 @@ module.exports = {
),
gallery_output_static: path.resolve(__dirname, "../gallery/dist/static"),
landingPage_dir: path.resolve(__dirname, "../landing-page"),
landingPage_build: path.resolve(__dirname, "../landing-page/build"),
landingPage_output_root: path.resolve(__dirname, "../landing-page/dist"),
landingPage_output_latest: path.resolve(
__dirname,
"../landing-page/dist/frontend_latest"
),
landingPage_output_es5: path.resolve(
__dirname,
"../landing-page/dist/frontend_es5"
),
landingPage_output_static: path.resolve(
__dirname,
"../landing-page/dist/static"
),
hassio_dir: path.resolve(__dirname, "../hassio"),
hassio_output_root: path.resolve(__dirname, "../hassio/build"),
hassio_output_static: path.resolve(__dirname, "../hassio/build/static"),

View File

@@ -1,14 +0,0 @@
module.exports = function (opts = {}) {
const dontHash = opts.dontHash || new Set();
return {
name: "dont-hash",
renderChunk(_code, chunk, _options) {
if (!chunk.isEntry || !dontHash.has(chunk.name)) {
return null;
}
chunk.fileName = `${chunk.name}.js`;
return null;
},
};
};

View File

@@ -1,24 +0,0 @@
module.exports = function (userOptions = {}) {
// Files need to be absolute paths.
// This only works if the file has no exports
// and only is imported for its side effects
const files = userOptions.files || [];
if (files.length === 0) {
return {
name: "ignore",
};
}
return {
name: "ignore",
load(id) {
return files.some((toIgnorePath) => id.startsWith(toIgnorePath))
? {
code: "",
}
: null;
},
};
};

View File

@@ -1,34 +0,0 @@
const url = require("url");
const defaultOptions = {
publicPath: "",
};
module.exports = function (userOptions = {}) {
const options = { ...defaultOptions, ...userOptions };
return {
name: "manifest",
generateBundle(outputOptions, bundle) {
const manifest = {};
for (const chunk of Object.values(bundle)) {
if (!chunk.isEntry) {
continue;
}
// Add js extension to mimic Webpack manifest.
manifest[`${chunk.name}.js`] = url.resolve(
options.publicPath,
chunk.fileName
);
}
this.emitFile({
type: "asset",
source: JSON.stringify(manifest, undefined, 2),
name: "manifest.json",
fileName: "manifest.json",
});
},
};
};

View File

@@ -1,152 +0,0 @@
// Worker plugin
// Each worker will include all of its dependencies
// instead of relying on an importer.
// Forked from v.1.4.1
// https://github.com/surma/rollup-plugin-off-main-thread
/**
* Copyright 2018 Google Inc. All Rights Reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const rollup = require("rollup");
const path = require("path");
const MagicString = require("magic-string");
const defaultOpts = {
// A RegExp to find `new Workers()` calls. The second capture group _must_
// capture the provided file name without the quotes.
workerRegexp: /new Worker\((["'])(.+?)\1(,[^)]+)?\)/g,
plugins: ["node-resolve", "commonjs", "babel", "terser", "ignore"],
};
async function getBundledWorker(workerPath, rollupOptions) {
const bundle = await rollup.rollup({
...rollupOptions,
input: {
worker: workerPath,
},
});
const { output } = await bundle.generate({
// Generates cleanest output, we shouldn't have any imports/exports
// that would be incompatible with ES5.
format: "es",
// We should not export anything. This will fail build if we are.
exports: "none",
});
let code;
for (const chunkOrAsset of output) {
if (chunkOrAsset.name === "worker") {
code = chunkOrAsset.code;
} else if (chunkOrAsset.type !== "asset") {
throw new Error("Unexpected extra output");
}
}
return code;
}
module.exports = function (opts = {}) {
opts = { ...defaultOpts, ...opts };
let rollupOptions;
let refIds;
return {
name: "hass-worker",
async buildStart(options) {
refIds = {};
rollupOptions = {
plugins: options.plugins.filter((plugin) =>
opts.plugins.includes(plugin.name)
),
};
},
async transform(code, id) {
// Copy the regexp as they are stateful and this hook is async.
const workerRegexp = new RegExp(
opts.workerRegexp.source,
opts.workerRegexp.flags
);
if (!workerRegexp.test(code)) {
return undefined;
}
const ms = new MagicString(code);
// Reset the regexp
workerRegexp.lastIndex = 0;
for (;;) {
const match = workerRegexp.exec(code);
if (!match) {
break;
}
const workerFile = match[2];
let optionsObject = {};
// Parse the optional options object
if (match[3] && match[3].length > 0) {
// FIXME: ooooof!
// eslint-disable-next-line @typescript-eslint/no-implied-eval
optionsObject = new Function(`return ${match[3].slice(1)};`)();
}
delete optionsObject.type;
if (!/^.*\//.test(workerFile)) {
this.warn(
`Paths passed to the Worker constructor must be relative or absolute, i.e. start with /, ./ or ../ (just like dynamic import!). Ignoring "${workerFile}".`
);
continue;
}
// Find worker file and store it as a chunk with ID prefixed for our loader
// eslint-disable-next-line no-await-in-loop
const resolvedWorkerFile = (await this.resolve(workerFile, id)).id;
let chunkRefId;
if (resolvedWorkerFile in refIds) {
chunkRefId = refIds[resolvedWorkerFile];
} else {
this.addWatchFile(resolvedWorkerFile);
// eslint-disable-next-line no-await-in-loop
const source = await getBundledWorker(
resolvedWorkerFile,
rollupOptions
);
chunkRefId = refIds[resolvedWorkerFile] = this.emitFile({
name: path.basename(resolvedWorkerFile),
source,
type: "asset",
});
}
const workerParametersStartIndex = match.index + "new Worker(".length;
const workerParametersEndIndex =
match.index + match[0].length - ")".length;
ms.overwrite(
workerParametersStartIndex,
workerParametersEndIndex,
`import.meta.ROLLUP_FILE_URL_${chunkRefId}, ${JSON.stringify(
optionsObject
)}`
);
}
return {
code: ms.toString(),
map: ms.generateMap({ hires: true }),
};
},
};
};

View File

@@ -1,146 +0,0 @@
const path = require("path");
const commonjs = require("@rollup/plugin-commonjs");
const resolve = require("@rollup/plugin-node-resolve");
const json = require("@rollup/plugin-json");
const { babel } = require("@rollup/plugin-babel");
const replace = require("@rollup/plugin-replace");
const visualizer = require("rollup-plugin-visualizer");
const { string } = require("rollup-plugin-string");
const { terser } = require("rollup-plugin-terser");
const manifest = require("./rollup-plugins/manifest-plugin.cjs");
const worker = require("./rollup-plugins/worker-plugin.cjs");
const dontHashPlugin = require("./rollup-plugins/dont-hash-plugin.cjs");
const ignore = require("./rollup-plugins/ignore-plugin.cjs");
const bundle = require("./bundle.cjs");
const paths = require("./paths.cjs");
const extensions = [".js", ".ts"];
/**
* @param {Object} arg
* @param { import("rollup").InputOption } arg.input
*/
const createRollupConfig = ({
entry,
outputPath,
defineOverlay,
isProdBuild,
latestBuild,
isStatsBuild,
publicPath,
dontHash,
isWDS,
}) => ({
/**
* @type { import("rollup").InputOptions }
*/
inputOptions: {
input: entry,
// Some entry points contain no JavaScript. This setting silences a warning about that.
// https://rollupjs.org/configuration-options/#preserveentrysignatures
preserveEntrySignatures: false,
plugins: [
ignore({
files: bundle
.emptyPackages({ latestBuild })
// TEMP HACK: Makes Rollup build work again
.concat(
require.resolve(
"@webcomponents/scoped-custom-element-registry/scoped-custom-element-registry.min"
)
),
}),
resolve({
extensions,
preferBuiltins: false,
browser: true,
rootDir: paths.polymer_dir,
}),
commonjs(),
json(),
babel({
...bundle.babelOptions({ latestBuild, isProdBuild }),
extensions,
babelHelpers: isWDS ? "inline" : "bundled",
}),
string({
// Import certain extensions as strings
include: [path.join(paths.polymer_dir, "node_modules/**/*.css")],
}),
replace(bundle.definedVars({ isProdBuild, latestBuild, defineOverlay })),
!isWDS &&
manifest({
publicPath,
}),
!isWDS && worker(),
!isWDS && dontHashPlugin({ dontHash }),
!isWDS && isProdBuild && terser(bundle.terserOptions({ latestBuild })),
!isWDS &&
isStatsBuild &&
visualizer({
// https://github.com/btd/rollup-plugin-visualizer#options
open: true,
sourcemap: true,
}),
].filter(Boolean),
},
/**
* @type { import("rollup").OutputOptions }
*/
outputOptions: {
// https://rollupjs.org/configuration-options/#output-dir
dir: outputPath,
// https://rollupjs.org/configuration-options/#output-format
format: latestBuild ? "es" : "systemjs",
// https://rollupjs.org/configuration-options/#output-externallivebindings
externalLiveBindings: false,
// https://rollupjs.org/configuration-options/#output-entryfilenames
// https://rollupjs.org/configuration-options/#output-chunkfilenames
// https://rollupjs.org/configuration-options/#output-assetfilenames
entryFileNames:
isProdBuild && !isStatsBuild ? "[name]-[hash].js" : "[name].js",
chunkFileNames: isProdBuild && !isStatsBuild ? "c.[hash].js" : "[name].js",
assetFileNames: isProdBuild && !isStatsBuild ? "a.[hash].js" : "[name].js",
// https://rollupjs.org/configuration-options/#output-sourcemap
sourcemap: isProdBuild ? true : "inline",
},
});
const createAppConfig = ({ isProdBuild, latestBuild, isStatsBuild, isWDS }) =>
createRollupConfig(
bundle.config.app({
isProdBuild,
latestBuild,
isStatsBuild,
isWDS,
})
);
const createDemoConfig = ({ isProdBuild, latestBuild, isStatsBuild }) =>
createRollupConfig(
bundle.config.demo({
isProdBuild,
latestBuild,
isStatsBuild,
})
);
const createCastConfig = ({ isProdBuild, latestBuild }) =>
createRollupConfig(bundle.config.cast({ isProdBuild, latestBuild }));
const createHassioConfig = ({ isProdBuild, latestBuild }) =>
createRollupConfig(bundle.config.hassio({ isProdBuild, latestBuild }));
const createGalleryConfig = ({ isProdBuild, latestBuild }) =>
createRollupConfig(bundle.config.gallery({ isProdBuild, latestBuild }));
module.exports = {
createAppConfig,
createDemoConfig,
createCastConfig,
createHassioConfig,
createGalleryConfig,
createRollupConfig,
};

View File

@@ -1,16 +1,13 @@
const { existsSync } = require("fs");
const path = require("path");
const webpack = require("webpack");
const rspack = require("@rspack/core");
const { RsdoctorRspackPlugin } = require("@rsdoctor/rspack-plugin");
const { StatsWriterPlugin } = require("webpack-stats-plugin");
const filterStats = require("@bundle-stats/plugin-webpack-filter").default;
const TerserPlugin = require("terser-webpack-plugin");
const { WebpackManifestPlugin } = require("webpack-manifest-plugin");
const { WebpackManifestPlugin } = require("rspack-manifest-plugin");
const log = require("fancy-log");
const WebpackBar = require("webpackbar");
const {
TransformAsyncModulesPlugin,
} = require("transform-async-modules-webpack-plugin");
const { dependencies } = require("../package.json");
const WebpackBar = require("webpackbar/rspack");
const paths = require("./paths.cjs");
const bundle = require("./bundle.cjs");
@@ -28,7 +25,7 @@ class LogStartCompilePlugin {
}
}
const createWebpackConfig = ({
const createRspackConfig = ({
name,
entry,
outputPath,
@@ -102,13 +99,18 @@ const createWebpackConfig = ({
splitChunks: {
// Disable splitting for web workers and worklets because imports of
// external chunks are broken for:
// - ESM output: https://github.com/webpack/webpack/issues/17014
// - Worklets use `importScripts`: https://github.com/webpack/webpack/issues/11543
chunks: (chunk) =>
!chunk.canBeInitial() &&
!new RegExp(`^.+-work${latestBuild ? "(?:let|er)" : "let"}$`).test(
chunk.name
),
chunks: !isProdBuild
? // improve incremental build speed, but blows up bundle size
new RegExp(
`^(?!(${Object.keys(entry).join("|")}|.*work(?:er|let))$)`
)
: // - ESM output: https://github.com/webpack/webpack/issues/17014
// - Worklets use `importScripts`: https://github.com/webpack/webpack/issues/11543
(chunk) =>
!chunk.canBeInitial() &&
!new RegExp(
`^.+-work${latestBuild ? "(?:let|er)" : "let"}$`
).test(chunk.name),
},
},
plugins: [
@@ -117,10 +119,10 @@ const createWebpackConfig = ({
// Only include the JS of entrypoints
filter: (file) => file.isInitial && !file.name.endsWith(".map"),
}),
new webpack.DefinePlugin(
new rspack.DefinePlugin(
bundle.definedVars({ isProdBuild, latestBuild, defineOverlay })
),
new webpack.IgnorePlugin({
new rspack.IgnorePlugin({
checkResource(resource, context) {
// Only use ignore to intercept imports that we don't control
// inside node_module dependencies.
@@ -152,7 +154,7 @@ const createWebpackConfig = ({
);
},
}),
new webpack.NormalModuleReplacementPlugin(
new rspack.NormalModuleReplacementPlugin(
new RegExp(
bundle.emptyPackages({ latestBuild, isHassioBuild }).join("|")
),
@@ -168,10 +170,14 @@ const createWebpackConfig = ({
stats: { assets: true, chunks: true, modules: true },
transform: (stats) => JSON.stringify(filterStats(stats)),
}),
!latestBuild &&
new TransformAsyncModulesPlugin({
browserslistEnv: "legacy",
runtime: { version: dependencies["@babel/runtime"] },
isProdBuild &&
isStatsBuild &&
new RsdoctorRspackPlugin({
reportDir: path.join(paths.build_dir, "rsdoctor"),
features: ["plugins", "bundle"],
supports: {
generateTileGraph: true,
},
}),
].filter(Boolean),
resolve: {
@@ -188,6 +194,7 @@ const createWebpackConfig = ({
"lit/directives/cache$": "lit/directives/cache.js",
"lit/directives/repeat$": "lit/directives/repeat.js",
"lit/directives/live$": "lit/directives/live.js",
"lit/directives/keyed$": "lit/directives/keyed.js",
"lit/polyfill-support$": "lit/polyfill-support.js",
"@lit-labs/virtualizer/layouts/grid":
"@lit-labs/virtualizer/layouts/grid.js",
@@ -209,8 +216,6 @@ const createWebpackConfig = ({
isProdBuild && !isStatsBuild ? "[id].[contenthash][ext]" : "[id][ext]",
crossOriginLoading: "use-credentials",
hashFunction: "xxhash64",
hashDigest: "base64url",
hashDigestLength: 11, // full length of 64 bit base64url
path: outputPath,
publicPath,
// To silence warning in worker plugin
@@ -252,17 +257,17 @@ const createAppConfig = ({
isStatsBuild,
isTestBuild,
}) =>
createWebpackConfig(
createRspackConfig(
bundle.config.app({ isProdBuild, latestBuild, isStatsBuild, isTestBuild })
);
const createDemoConfig = ({ isProdBuild, latestBuild, isStatsBuild }) =>
createWebpackConfig(
createRspackConfig(
bundle.config.demo({ isProdBuild, latestBuild, isStatsBuild })
);
const createCastConfig = ({ isProdBuild, latestBuild }) =>
createWebpackConfig(bundle.config.cast({ isProdBuild, latestBuild }));
createRspackConfig(bundle.config.cast({ isProdBuild, latestBuild }));
const createHassioConfig = ({
isProdBuild,
@@ -270,7 +275,7 @@ const createHassioConfig = ({
isStatsBuild,
isTestBuild,
}) =>
createWebpackConfig(
createRspackConfig(
bundle.config.hassio({
isProdBuild,
latestBuild,
@@ -280,7 +285,10 @@ const createHassioConfig = ({
);
const createGalleryConfig = ({ isProdBuild, latestBuild }) =>
createWebpackConfig(bundle.config.gallery({ isProdBuild, latestBuild }));
createRspackConfig(bundle.config.gallery({ isProdBuild, latestBuild }));
const createLandingPageConfig = ({ isProdBuild, latestBuild }) =>
createRspackConfig(bundle.config.landingPage({ isProdBuild, latestBuild }));
module.exports = {
createAppConfig,
@@ -288,5 +296,6 @@ module.exports = {
createCastConfig,
createHassioConfig,
createGalleryConfig,
createWebpackConfig,
createRspackConfig,
createLandingPageConfig,
};

View File

@@ -1,10 +0,0 @@
import rollup from "../build-scripts/rollup.cjs";
import env from "../build-scripts/env.cjs";
const config = rollup.createCastConfig({
isProdBuild: env.isProdBuild(),
latestBuild: true,
isStatsBuild: env.isStatsBuild(),
});
export default { ...config.inputOptions, output: config.outputOptions };

View File

@@ -25,9 +25,9 @@ class HcLovelace extends LitElement {
@property({ attribute: false })
public lovelaceConfig!: LovelaceConfig;
@property() public viewPath?: string | number | null;
@property({ attribute: false }) public viewPath?: string | number | null;
@property() public urlPath: string | null = null;
@property({ attribute: false }) public urlPath: string | null = null;
protected render(): TemplateResult {
const index = this._viewIndex;

View File

@@ -144,10 +144,10 @@ export class HcMain extends HassElement {
}
if (senderId) {
this.sendMessage(senderId, status);
this._sendMessage(senderId, status);
} else {
for (const sender of castContext.getSenders()) {
this.sendMessage(sender.id, status);
this._sendMessage(sender.id, status);
}
}
}
@@ -164,10 +164,10 @@ export class HcMain extends HassElement {
};
if (senderId) {
this.sendMessage(senderId, error);
this._sendMessage(senderId, error);
} else {
for (const sender of castContext.getSenders()) {
this.sendMessage(sender.id, error);
this._sendMessage(sender.id, error);
}
}
}
@@ -394,7 +394,7 @@ export class HcMain extends HassElement {
}
}
private sendMessage(senderId: string, response: any) {
private _sendMessage(senderId: string, response: any) {
castContext.sendCustomMessage(CAST_NS, senderId, response);
}
}

View File

@@ -1,8 +0,0 @@
import webpack from "../build-scripts/webpack.cjs";
import env from "../build-scripts/env.cjs";
export default webpack.createCastConfig({
isProdBuild: env.isProdBuild(),
isStatsBuild: env.isStatsBuild(),
latestBuild: true,
});

View File

@@ -1,10 +0,0 @@
import rollup from "../build-scripts/rollup.cjs";
import env from "../build-scripts/env.cjs";
const config = rollup.createDemoConfig({
isProdBuild: env.isProdBuild(),
latestBuild: true,
isStatsBuild: env.isStatsBuild(),
});
export default { ...config.inputOptions, output: config.outputOptions };

View File

@@ -4,11 +4,6 @@
# Stop on errors
set -e
cd "$(dirname "$0")/.."
cd "$(dirname "$0")/../.."
export STATS=1
statsfile="compilation-stats-demo.json"
./node_modules/.bin/webpack-cli --profile --node-env=production --json=$statsfile
npx webpack-bundle-analyzer $statsfile dist/frontend_latest
rm -f $statsfile
./node_modules/.bin/gulp analyze-demo

View File

@@ -46,7 +46,6 @@ class CastDemoRow extends LitElement implements LovelaceRow {
this.requestUpdate();
});
mgr.castContext.addEventListener(
// eslint-disable-next-line no-undef
cast.framework.CastContextEventType.SESSION_STATE_CHANGED,
(ev) => {
// On Android, opening a new session always results in SESSION_RESUMED.

View File

@@ -26,7 +26,7 @@ export class HADemoCard extends LitElement implements LovelaceCard {
@state() private _switching = false;
private _hidden = localStorage.hide_demo_card;
private _hidden = window.localStorage.getItem("hide_demo_card");
public getCardSize() {
return this._hidden ? 0 : 2;

View File

@@ -1,11 +0,0 @@
import webpack from "../build-scripts/webpack.cjs";
import env from "../build-scripts/env.cjs";
// File just used for stats builds
const latestBuild = true;
export default webpack.createDemoConfig({
isProdBuild: env.isProdBuild(),
isStatsBuild: env.isStatsBuild(),
latestBuild,
});

179
eslint.config.mjs Normal file
View File

@@ -0,0 +1,179 @@
/* eslint-disable import/no-extraneous-dependencies */
import unusedImports from "eslint-plugin-unused-imports";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";
const _filename = fileURLToPath(import.meta.url);
const _dirname = path.dirname(_filename);
const compat = new FlatCompat({
baseDirectory: _dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});
export default [
...compat.extends(
"airbnb-base",
"airbnb-typescript/base",
"plugin:@typescript-eslint/recommended",
"plugin:wc/recommended",
"plugin:lit/all",
"plugin:lit-a11y/recommended",
"prettier"
),
{
plugins: {
"unused-imports": unusedImports,
},
languageOptions: {
globals: {
...globals.browser,
__DEV__: false,
__DEMO__: false,
__BUILD__: false,
__VERSION__: false,
__STATIC_PATH__: false,
__SUPERVISOR__: false,
Polymer: true,
},
parser: tsParser,
ecmaVersion: 2020,
sourceType: "module",
parserOptions: {
ecmaFeatures: {
modules: true,
},
project: "./tsconfig.json",
},
},
settings: {
"import/resolver": {
webpack: {
config: "./rspack.config.cjs",
},
},
},
rules: {
"class-methods-use-this": "off",
"new-cap": "off",
"prefer-template": "off",
"object-shorthand": "off",
"func-names": "off",
"no-underscore-dangle": "off",
strict: "off",
"no-plusplus": "off",
"no-bitwise": "error",
"comma-dangle": "off",
"vars-on-top": "off",
"no-continue": "off",
"no-param-reassign": "off",
"no-multi-assign": "off",
"no-console": "error",
radix: "off",
"no-alert": "off",
"no-nested-ternary": "off",
"prefer-destructuring": "off",
"no-restricted-globals": [2, "event"],
"prefer-promise-reject-errors": "off",
"import/prefer-default-export": "off",
"import/no-default-export": "off",
"import/no-unresolved": "off",
"import/no-cycle": "off",
"import/extensions": [
"error",
"ignorePackages",
{
ts: "never",
js: "never",
},
],
"no-restricted-syntax": ["error", "LabeledStatement", "WithStatement"],
"object-curly-newline": "off",
"default-case": "off",
"wc/no-self-class": "off",
"no-shadow": "off",
"@typescript-eslint/camelcase": "off",
"@typescript-eslint/ban-ts-comment": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-shadow": ["error"],
"@typescript-eslint/naming-convention": [
"error",
{
selector: ["objectLiteralProperty", "objectLiteralMethod"],
format: null,
},
{
selector: ["variable"],
format: ["camelCase", "snake_case", "UPPER_CASE"],
leadingUnderscore: "allow",
trailingUnderscore: "allow",
},
{
selector: ["variable"],
modifiers: ["exported"],
format: ["camelCase", "PascalCase", "UPPER_CASE"],
},
{
selector: "typeLike",
format: ["PascalCase"],
},
{
selector: "method",
modifiers: ["public"],
format: ["camelCase"],
leadingUnderscore: "forbid",
},
{
selector: "method",
modifiers: ["private"],
format: ["camelCase"],
leadingUnderscore: "require",
},
],
"@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-vars": [
"error",
{
vars: "all",
varsIgnorePattern: "^_",
args: "after-used",
argsIgnorePattern: "^_",
ignoreRestSiblings: true,
},
],
"unused-imports/no-unused-imports": "error",
"lit/attribute-names": "error",
"lit/attribute-value-entities": "off",
"lit/no-template-map": "off",
"lit/no-native-attributes": "error",
"lit/no-this-assign-in-render": "error",
"lit-a11y/click-events-have-key-events": ["off"],
"lit-a11y/no-autofocus": "off",
"lit-a11y/alt-text": "error",
"lit-a11y/anchor-is-valid": "error",
"lit-a11y/role-has-required-aria-attrs": "error",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/no-import-type-side-effects": "error",
},
},
];

View File

@@ -1,6 +0,0 @@
{
"extends": "../.eslintrc.json",
"rules": {
"no-console": 0
}
}

10
gallery/eslint.config.mjs Normal file
View File

@@ -0,0 +1,10 @@
import rootConfig from "../eslint.config.mjs";
export default [
...rootConfig,
{
rules: {
"no-console": "off",
},
},
];

View File

@@ -1,10 +0,0 @@
import rollup from "../build-scripts/rollup.cjs";
import env from "../build-scripts/env.cjs";
const config = rollup.createGalleryConfig({
isProdBuild: env.isProdBuild(),
latestBuild: true,
isStatsBuild: env.isStatsBuild(),
});
export default { ...config.inputOptions, output: config.outputOptions };

View File

@@ -9,6 +9,7 @@ import "../../../src/components/ha-card";
@customElement("demo-black-white-row")
class DemoBlackWhiteRow extends LitElement {
// eslint-disable-next-line lit/no-native-attributes
@property() title!: string;
@property() value?: any;

View File

@@ -18,7 +18,8 @@ class DemoCard extends LitElement {
@property({ attribute: false }) public config!: DemoCardConfig;
@property({ type: Boolean }) public showConfig = false;
@property({ attribute: "show-config", type: Boolean })
public showConfig = false;
@state() private _size?: number;

View File

@@ -44,11 +44,11 @@ class DemoCards extends LitElement {
`;
}
_showConfigToggled(ev) {
private _showConfigToggled(ev) {
this._showConfig = ev.target.checked;
}
_darkThemeToggled(ev) {
private _darkThemeToggled(ev) {
applyThemesOnElement(this._container, { themes: {} } as any, "default", {
dark: ev.target.checked,
});

View File

@@ -10,9 +10,10 @@ import type { HomeAssistant } from "../../../src/types";
class DemoMoreInfo extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
@property() public entityId!: string;
@property({ attribute: false }) public entityId!: string;
@property({ type: Boolean }) public showConfig = false;
@property({ attribute: "show-config", type: Boolean })
public showConfig = false;
render() {
const state = this._getState(this.entityId, this.hass.states);
@@ -23,7 +24,7 @@ class DemoMoreInfo extends LitElement {
<state-card-content
.stateObj=${state}
.hass=${this.hass}
inDialog
in-dialog
></state-card-content>
<more-info-content

View File

@@ -58,11 +58,11 @@ class DemoMoreInfos extends LitElement {
}
`;
_showConfigToggled(ev) {
private _showConfigToggled(ev) {
this._showConfig = ev.target.checked;
}
_darkThemeToggled(ev) {
private _darkThemeToggled(ev) {
applyThemesOnElement(
this.shadowRoot!.querySelector("#container"),
{

View File

@@ -182,7 +182,7 @@ class HaGallery extends LitElement {
}
}
_menuTapped() {
private _menuTapped() {
this._drawer.open = !this._drawer.open;
}

View File

@@ -1,4 +1,3 @@
/* eslint-disable lit/no-template-arrow */
import type { TemplateResult } from "lit";
import { LitElement, html, css } from "lit";
import { customElement, state } from "lit/decorators";
@@ -15,7 +14,6 @@ import { HaDelayAction } from "../../../../src/panels/config/automation/action/t
import { HaDeviceAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-device_id";
import { HaEventAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-event";
import { HaRepeatAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-repeat";
import { HaSceneAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-activate_scene";
import { HaServiceAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-service";
import { HaWaitForTriggerAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-wait_for_trigger";
import { HaWaitAction } from "../../../../src/panels/config/automation/action/types/ha-automation-action-wait_template";
@@ -33,7 +31,6 @@ const SCHEMAS: { name: string; actions: Action[] }[] = [
{ name: "Service", actions: [HaServiceAction.defaultConfig] },
{ name: "Condition", actions: [HaConditionAction.defaultConfig] },
{ name: "Delay", actions: [HaDelayAction.defaultConfig] },
{ name: "Scene", actions: [HaSceneAction.defaultConfig] },
{ name: "Play media", actions: [HaPlayMediaAction.defaultConfig] },
{ name: "Wait", actions: [HaWaitAction.defaultConfig] },
{ name: "WaitForTrigger", actions: [HaWaitForTriggerAction.defaultConfig] },
@@ -66,11 +63,6 @@ class DemoHaAutomationEditorAction extends LitElement {
}
protected render(): TemplateResult {
const valueChanged = (ev) => {
const sampleIdx = ev.target.sampleIdx;
this.data[sampleIdx] = ev.detail.value;
this.requestUpdate();
};
return html`
<div class="options">
<ha-formfield label="Disabled">
@@ -95,7 +87,7 @@ class DemoHaAutomationEditorAction extends LitElement {
.actions=${this.data[sampleIdx]}
.sampleIdx=${sampleIdx}
.disabled=${this._disabled}
@value-changed=${valueChanged}
@value-changed=${this._handleValueChange}
></ha-automation-action>
`
)}
@@ -105,6 +97,12 @@ class DemoHaAutomationEditorAction extends LitElement {
`;
}
private _handleValueChange(ev) {
const sampleIdx = ev.target.sampleIdx;
this.data[sampleIdx] = ev.detail.value;
this.requestUpdate();
}
private _handleOptionChange(ev) {
this[`_${ev.target.name}`] = ev.target.checked;
}

View File

@@ -1,4 +1,3 @@
/* eslint-disable lit/no-template-arrow */
import type { TemplateResult } from "lit";
import { LitElement, html, css } from "lit";
import { customElement, state } from "lit/decorators";
@@ -104,11 +103,6 @@ export class DemoAutomationEditorCondition extends LitElement {
}
protected render(): TemplateResult {
const valueChanged = (ev) => {
const sampleIdx = ev.target.sampleIdx;
this.data[sampleIdx] = ev.detail.value;
this.requestUpdate();
};
return html`
<div class="options">
<ha-formfield label="Disabled">
@@ -133,7 +127,7 @@ export class DemoAutomationEditorCondition extends LitElement {
.conditions=${this.data[sampleIdx]}
.sampleIdx=${sampleIdx}
.disabled=${this._disabled}
@value-changed=${valueChanged}
@value-changed=${this._handleValueChange}
></ha-automation-condition>
`
)}
@@ -143,6 +137,12 @@ export class DemoAutomationEditorCondition extends LitElement {
`;
}
private _handleValueChange(ev) {
const sampleIdx = ev.target.sampleIdx;
this.data[sampleIdx] = ev.detail.value;
this.requestUpdate();
}
private _handleOptionChange(ev) {
this[`_${ev.target.name}`] = ev.target.checked;
}

View File

@@ -1,4 +1,3 @@
/* eslint-disable lit/no-template-arrow */
import type { TemplateResult } from "lit";
import { LitElement, html, css } from "lit";
import { customElement, state } from "lit/decorators";
@@ -150,11 +149,6 @@ export class DemoAutomationEditorTrigger extends LitElement {
}
protected render(): TemplateResult {
const valueChanged = (ev) => {
const sampleIdx = ev.target.sampleIdx;
this.data[sampleIdx] = ev.detail.value;
this.requestUpdate();
};
return html`
<div class="options">
<ha-formfield label="Disabled">
@@ -179,7 +173,7 @@ export class DemoAutomationEditorTrigger extends LitElement {
.triggers=${this.data[sampleIdx]}
.sampleIdx=${sampleIdx}
.disabled=${this._disabled}
@value-changed=${valueChanged}
@value-changed=${this._handleValueChange}
></ha-automation-trigger>
`
)}
@@ -189,6 +183,12 @@ export class DemoAutomationEditorTrigger extends LitElement {
`;
}
private _handleValueChange(ev) {
const sampleIdx = ev.target.sampleIdx;
this.data[sampleIdx] = ev.detail.value;
this.requestUpdate();
}
private _handleOptionChange(ev) {
this[`_${ev.target.name}`] = ev.target.checked;
}

View File

@@ -31,22 +31,17 @@ export class DemoAutomationTrace extends LitElement {
<hat-script-graph
.trace=${trace.trace}
.selected=${this._selected[idx]}
@graph-node-selected=${(ev) => {
this._selected = { ...this._selected, [idx]: ev.detail.path };
}}
@graph-node-selected=${this._handleGraphNodeSelected}
.sampleIdx=${idx}
></hat-script-graph>
<hat-trace-timeline
allowPick
allow-pick
.hass=${this.hass}
.trace=${trace.trace}
.logbookEntries=${trace.logbookEntries}
.selectedPath=${this._selected[idx]}
@value-changed=${(ev) => {
this._selected = {
...this._selected,
[idx]: ev.detail.value,
};
}}
@value-changed=${this._handleTimelineValueChanged}
.sampleIdx=${idx}
></hat-trace-timeline>
<button @click=${() => console.log(trace)}>Log trace</button>
</div>
@@ -63,6 +58,16 @@ export class DemoAutomationTrace extends LitElement {
hass.updateTranslations("config", "en");
}
private _handleTimelineValueChanged(ev) {
const sampleIdx = ev.target.sampleIdx;
this._selected = { ...this._selected, [sampleIdx]: ev.detail.value };
}
private _handleGraphNodeSelected(ev) {
const sampleIdx = ev.target.sampleIdx;
this._selected = { ...this._selected, [sampleIdx]: ev.detail.path };
}
static get styles() {
return css`
ha-card {

View File

@@ -489,14 +489,8 @@ class DemoHaForm extends LitElement {
.title=${info.title}
.value=${this.data[idx]}
.disabled=${this.disabled[idx]}
@submitted=${() => {
this.disabled[idx] = true;
this.requestUpdate();
setTimeout(() => {
this.disabled[idx] = false;
this.requestUpdate();
}, 2000);
}}
@submitted=${this._handleSubmit}
.sampleIdx=${idx}
>
${["light", "dark"].map(
(slot) => html`
@@ -510,10 +504,9 @@ class DemoHaForm extends LitElement {
.computeError=${(error) => translations[error] || error}
.computeLabel=${(schema) =>
translations[schema.name] || schema.name}
@value-changed=${(e) => {
this.data[idx] = e.detail.value;
this.requestUpdate();
}}
.computeHelper=${() => "Helper text"}
@value-changed=${this._handleValueChanged}
.sampleIdx=${idx}
></ha-form>
`
)}
@@ -522,6 +515,22 @@ class DemoHaForm extends LitElement {
})}
`;
}
private _handleValueChanged(ev) {
const sampleIdx = ev.target.sampleIdx;
this.data[sampleIdx] = ev.detail.value;
this.requestUpdate();
}
private _handleSubmit(ev) {
const sampleIdx = ev.target.sampleIdx;
this.disabled[sampleIdx] = true;
this.requestUpdate();
setTimeout(() => {
this.disabled[sampleIdx] = false;
this.requestUpdate();
}, 2000);
}
}
declare global {

View File

@@ -1,4 +1,3 @@
/* eslint-disable lit/no-template-arrow */
import "@material/mwc-button";
import type { TemplateResult } from "lit";
import { css, html, LitElement } from "lit";
@@ -591,13 +590,6 @@ class DemoHaSelector extends LitElement implements ProvideHassElement {
</div>
${SCHEMAS.map((info, idx) => {
const data = this.data[idx];
const valueChanged = (ev) => {
this.data[idx] = {
...data,
[ev.target.key]: ev.detail.value,
};
this.requestUpdate();
};
return html`
<demo-black-white-row .title=${info.name}>
${["light", "dark"].map((slot) =>
@@ -614,7 +606,8 @@ class DemoHaSelector extends LitElement implements ProvideHassElement {
.value=${data[key] ?? value!.default}
.disabled=${this._disabled}
.required=${this._required}
@value-changed=${valueChanged}
@value-changed=${this._handleValueChanged}
.sampleIdx=${idx}
.helper=${this._helper ? "Helper text" : undefined}
></ha-selector>
</ha-settings-row>
@@ -627,6 +620,15 @@ class DemoHaSelector extends LitElement implements ProvideHassElement {
`;
}
private _handleValueChanged(ev) {
const idx = ev.target.sampleIdx;
this.data[idx] = {
...this.data[idx],
[ev.target.key]: ev.detail.value,
};
this.requestUpdate();
}
private _handleOptionChange(ev) {
this[`_${ev.target.name}`] = ev.target.checked;
}

View File

@@ -86,9 +86,11 @@ const ENTITIES = [
friendly_name: "Sensibo purifier",
fan_modes: ["low", "high"],
fan_mode: "low",
swing_modes: ["on", "off", "both", "vertical", "horizontal"],
swing_mode: "vertical",
supported_features: 41,
swing_modes: ["both", "rangefull", "off"],
swing_mode: "rangefull",
swing_horizontal_modes: ["both", "rangefull", "off"],
swing_horizontal_mode: "both",
supported_features: 553,
}),
getEntity("climate", "unavailable", "unavailable", {
supported_features: 43,
@@ -188,11 +190,13 @@ const CONFIGS = [
- type: climate-swing-modes
style: icons
swing_modes:
- 'on'
- 'off'
- 'both'
- 'vertical'
- 'horizontal'
- 'rangefull'
- 'off'
swing_horizontal_modes:
- 'both'
- 'rangefull'
- 'off'
`,
},
{

View File

@@ -4,6 +4,7 @@ import { customElement, query } from "lit/decorators";
import { CoverEntityFeature } from "../../../../src/data/cover";
import { LightColorMode } from "../../../../src/data/light";
import { LockEntityFeature } from "../../../../src/data/lock";
import { MediaPlayerEntityFeature } from "../../../../src/data/media-player";
import { VacuumEntityFeature } from "../../../../src/data/vacuum";
import { getEntity } from "../../../../src/fake_data/entity";
import { provideHass } from "../../../../src/fake_data/provide_hass";
@@ -28,6 +29,10 @@ const ENTITIES = [
device_class: "lock",
supported_features: LockEntityFeature.OPEN,
}),
getEntity("media_player", "living_room", "playing", {
friendly_name: "Living room speaker",
supported_features: MediaPlayerEntityFeature.VOLUME_SET,
}),
getEntity("climate", "thermostat", "heat", {
current_temperature: 73,
min_temp: 45,
@@ -78,16 +83,19 @@ const ENTITIES = [
fan_modes: ["on_low", "on_high", "auto_low", "auto_high", "off"],
preset_modes: ["home", "eco", "away"],
swing_modes: ["auto", "1", "2", "3", "off"],
switch_horizontal_modes: ["auto", "4", "5", "6", "off"],
current_temperature: 23,
target_temp_high: 24,
target_temp_low: 21,
fan_mode: "auto_low",
preset_mode: "home",
swing_mode: "auto",
swing_horizontal_mode: "off",
supported_features:
ClimateEntityFeature.TURN_ON +
ClimateEntityFeature.TURN_OFF +
ClimateEntityFeature.SWING_MODE +
ClimateEntityFeature.SWING_HORIZONTAL_MODE +
ClimateEntityFeature.PRESET_MODE +
ClimateEntityFeature.FAN_MODE +
ClimateEntityFeature.TARGET_TEMPERATURE_RANGE,
@@ -194,6 +202,15 @@ const CONFIGS = [
- type: "lock-open-door"
`,
},
{
heading: "Media player volume slider feature",
config: `
- type: tile
entity: media_player.living_room
features:
- type: "media-player-volume-slider"
`,
},
{
heading: "Vacuum commands feature",
config: `

View File

@@ -1,8 +0,0 @@
import webpack from "../build-scripts/webpack.cjs";
import env from "../build-scripts/env.cjs";
export default webpack.createGalleryConfig({
isProdBuild: env.isProdBuild(),
isStatsBuild: env.isStatsBuild(),
latestBuild: true,
});

View File

@@ -1,10 +0,0 @@
import rollup from "../build-scripts/rollup.cjs";
import env from "../build-scripts/env.cjs";
const config = rollup.createHassioConfig({
isProdBuild: env.isProdBuild(),
latestBuild: false,
isStatsBuild: env.isStatsBuild(),
});
export default { ...config.inputOptions, output: config.outputOptions };

View File

@@ -136,7 +136,7 @@ export class HassioAddonStore extends LitElement {
this._manageRepositories(repositoryUrl);
}
this.addEventListener("hass-api-called", (ev) => this.apiCalled(ev));
this.addEventListener("hass-api-called", (ev) => this._apiCalled(ev));
this._loadData();
}
@@ -179,7 +179,7 @@ export class HassioAddonStore extends LitElement {
}
}
private apiCalled(ev) {
private _apiCalled(ev) {
if (ev.detail.success) {
this._loadData();
}

View File

@@ -315,6 +315,7 @@ class HassioAddonConfig extends LitElement {
text: this.supervisor.localize("confirm.reset_options.text"),
confirmText: this.supervisor.localize("common.reset_options"),
dismissText: this.supervisor.localize("common.cancel"),
destructive: true,
});
if (!confirmed) {

View File

@@ -47,7 +47,6 @@ class HassioAddonLogDashboard extends LitElement {
.localizeFunc=${this.supervisor.localize}
.header=${this.addon.name}
.provider=${this.addon.slug}
show
.filter=${this._filter}
>
</error-log-card>

View File

@@ -58,7 +58,7 @@ export class HassioBackups extends LitElement {
@property({ type: Boolean }) public narrow = false;
@property({ type: Boolean }) public isWide = false;
@property({ attribute: "is-wide", type: Boolean }) public isWide = false;
@state() private _selectedBackups: string[] = [];
@@ -74,7 +74,7 @@ export class HassioBackups extends LitElement {
public connectedCallback(): void {
super.connectedCallback();
if (this.hass && this._firstUpdatedCalled) {
this.fetchBackups();
this._fetchBackups();
}
}
@@ -107,7 +107,7 @@ export class HassioBackups extends LitElement {
protected firstUpdated(changedProperties: PropertyValues): void {
super.firstUpdated(changedProperties);
if (this.hass && this.isConnected) {
this.fetchBackups();
this._fetchBackups();
}
this._firstUpdatedCalled = true;
}
@@ -198,7 +198,7 @@ export class HassioBackups extends LitElement {
@selection-changed=${this._handleSelectionChanged}
clickable
selectable
hasFab
has-fab
.mainPage=${!atLeastVersion(this.hass.config.version, 2021, 12)}
back-path=${atLeastVersion(this.hass.config.version, 2022, 5)
? "/config/system"
@@ -280,7 +280,7 @@ export class HassioBackups extends LitElement {
private _handleAction(ev: CustomEvent<ActionDetail>) {
switch (ev.detail.index) {
case 0:
this.fetchBackups();
this._fetchBackups();
break;
case 1:
showHassioBackupLocationDialog(this, { supervisor: this.supervisor });
@@ -303,13 +303,13 @@ export class HassioBackups extends LitElement {
showHassioBackupDialog(this, {
slug,
supervisor: this.supervisor,
onDelete: () => this.fetchBackups(),
onDelete: () => this._fetchBackups(),
}),
reloadBackup: () => this.fetchBackups(),
reloadBackup: () => this._fetchBackups(),
});
}
private async fetchBackups() {
private async _fetchBackups() {
this._isLoading = true;
await reloadHassioBackups(this.hass);
this._backups = await fetchHassioBackups(this.hass);
@@ -323,6 +323,7 @@ export class HassioBackups extends LitElement {
number: this._selectedBackups.length,
}),
confirmText: this.supervisor.localize("backup.delete_backup_confirm"),
destructive: true,
});
if (!confirm) {
@@ -340,7 +341,7 @@ export class HassioBackups extends LitElement {
});
return;
}
await this.fetchBackups();
await this._fetchBackups();
this._dataTable.clearSelection();
}
@@ -349,7 +350,7 @@ export class HassioBackups extends LitElement {
showHassioBackupDialog(this, {
slug,
supervisor: this.supervisor,
onDelete: () => this.fetchBackups(),
onDelete: () => this._fetchBackups(),
});
}
@@ -365,7 +366,7 @@ export class HassioBackups extends LitElement {
}
showHassioCreateBackupDialog(this, {
supervisor: this.supervisor!,
onCreate: () => this.fetchBackups(),
onCreate: () => this._fetchBackups(),
});
}

View File

@@ -9,23 +9,24 @@ import type { HomeAssistant } from "../../../src/types";
class HassioCardContent extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
// eslint-disable-next-line lit/no-native-attributes
@property() public title!: string;
@property() public description?: string;
@property({ type: Boolean }) public available = true;
@property({ type: Boolean }) public showTopbar = false;
@property({ attribute: false }) public showTopbar = false;
@property() public topbarClass?: string;
@property({ attribute: false }) public topbarClass?: string;
@property() public iconTitle?: string;
@property({ attribute: false }) public iconTitle?: string;
@property() public iconClass?: string;
@property({ attribute: false }) public iconClass?: string;
@property() public icon = mdiHelpCircle;
@property() public iconImage?: string;
@property({ attribute: false }) public iconImage?: string;
protected render(): TemplateResult {
return html`
@@ -35,7 +36,11 @@ class HassioCardContent extends LitElement {
${this.iconImage
? html`
<div class="icon_image ${this.iconClass}">
<img src=${this.iconImage} .title=${this.iconTitle} />
<img
src=${this.iconImage}
.title=${this.iconTitle}
alt=${this.iconTitle ?? ""}
/>
<div></div>
</div>
`

View File

@@ -73,23 +73,24 @@ export class SupervisorBackupContent extends LitElement {
@property({ attribute: false }) public backup?: HassioBackupDetail;
@property() public backupType: HassioBackupDetail["type"] = "full";
@property({ attribute: false })
public backupType: HassioBackupDetail["type"] = "full";
@property({ attribute: false }) public folders?: CheckboxItem[];
@property({ attribute: false }) public addons?: AddonCheckboxItem[];
@property({ type: Boolean }) public homeAssistant = false;
@property({ attribute: false }) public homeAssistant = false;
@property({ type: Boolean }) public backupHasPassword = false;
@property({ attribute: false }) public backupHasPassword = false;
@property({ type: Boolean }) public onboarding = false;
@property() public backupName = "";
@property({ attribute: false }) public backupName = "";
@property() public backupPassword = "";
@property({ attribute: false }) public backupPassword = "";
@property() public confirmBackupPassword = "";
@property({ attribute: false }) public confirmBackupPassword = "";
@query("ha-textfield, ha-radio, ha-checkbox", true) private _focusTarget;
@@ -191,7 +192,7 @@ export class SupervisorBackupContent extends LitElement {
>
<ha-checkbox
.checked=${this.homeAssistant}
@change=${this.toggleHomeAssistant}
@change=${this._toggleHomeAssistant}
>
</ha-checkbox>
</ha-formfield>`
@@ -277,7 +278,7 @@ export class SupervisorBackupContent extends LitElement {
`;
}
private toggleHomeAssistant() {
private _toggleHomeAssistant() {
this.homeAssistant = !this.homeAssistant;
}

View File

@@ -7,9 +7,9 @@ import "../../../src/components/ha-svg-icon";
class SupervisorFormfieldLabel extends LitElement {
@property({ type: String }) public label!: string;
@property({ type: String }) public imageUrl?: string;
@property({ attribute: false }) public imageUrl?: string;
@property({ type: String }) public iconPath?: string;
@property({ attribute: false }) public iconPath?: string;
@property({ type: String }) public version?: string;

View File

@@ -76,7 +76,7 @@ class HassioDashboard extends LitElement {
.mainPage=${!atLeastVersion(this.hass.config.version, 2021, 12)}
back-path="/config"
supervisor
hasFab
has-fab
>
<span slot="header">
${this.supervisor.localize(

View File

@@ -302,6 +302,7 @@ class HassioBackupDialog
text: supervisor!.localize("backup.confirm_delete_text"),
confirmText: supervisor!.localize("backup.delete"),
dismissText: supervisor!.localize("backup.cancel"),
destructive: true,
}))
) {
return;

View File

@@ -95,7 +95,7 @@ class HassioDatadiskDialog extends LitElement {
.label=${this.dialogParams.supervisor.localize(
"dialog.datadisk_move.select_device"
)}
@selected=${this._select_device}
@selected=${this._selectDevice}
dialogInitialFocus
>
${this.devices.map(
@@ -137,7 +137,7 @@ class HassioDatadiskDialog extends LitElement {
`;
}
private _select_device(ev) {
private _selectDevice(ev) {
this.selectedDevice = ev.target.value;
}

View File

@@ -12,6 +12,7 @@ import type { HassioMarkdownDialogParams } from "./show-dialog-hassio-markdown";
class HassioMarkdownDialog extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;
// eslint-disable-next-line lit/no-native-attributes
@property() public title!: string;
@property() public content!: string;

View File

@@ -394,7 +394,7 @@ export class DialogHassioNetwork
`;
}
_toArray(data: string | string[]): string[] {
private _toArray(data: string | string[]): string[] {
if (Array.isArray(data)) {
if (data && typeof data[0] === "string") {
data = data[0];
@@ -409,7 +409,7 @@ export class DialogHassioNetwork
return data;
}
_toString(data: string | string[]): string {
private _toString(data: string | string[]): string {
if (!data) {
return "";
}

View File

@@ -34,7 +34,7 @@ class HassioIngressView extends LitElement {
@property({ attribute: false }) public route!: Route;
@property({ type: Boolean }) public ingressPanel = false;
@property({ attribute: false }) public ingressPanel = false;
@property({ type: Boolean }) public narrow = false;

View File

@@ -58,10 +58,10 @@ const SUPERVISOR_UPDATE_NAMES = {
supervisor: "Home Assistant Supervisor",
};
type updateType = "os" | "supervisor" | "core" | "addon";
type UpdateType = "os" | "supervisor" | "core" | "addon";
const changelogUrl = (
entry: updateType,
entry: UpdateType,
version: string
): string | undefined => {
if (entry === "addon") {
@@ -99,7 +99,7 @@ class UpdateAvailableCard extends LitElement {
@property({ attribute: false }) public addonSlug?: string;
@state() private _updateType?: updateType;
@state() private _updateType?: UpdateType;
@state() private _changelogContent?: string;
@@ -222,7 +222,7 @@ class UpdateAvailableCard extends LitElement {
const updateType = ["core", "os", "supervisor"].includes(pathPart)
? pathPart
: "addon";
this._updateType = updateType as updateType;
this._updateType = updateType as UpdateType;
switch (updateType) {
case "addon":

View File

@@ -1,8 +0,0 @@
import webpack from "../build-scripts/webpack.cjs";
import env from "../build-scripts/env.cjs";
export default webpack.createHassioConfig({
isProdBuild: env.isProdBuild(),
isStatsBuild: env.isStatsBuild(),
latestBuild: true,
});

44
landing-page/README.md Normal file
View File

@@ -0,0 +1,44 @@
# Home Assistant OS Landingpage
On initial startup of Home Assistant, HAOS needs to download Home Assistant core before the setup can start.
In this time the [home-assistant/landingpage](https://github.com/home-assistant/landingpage) is serving a "Preparing Home Assistant" page.
## Functionality
- Progress bar to show download
- Show / hide supervisor logs
- Links
- Read our Vision
- Join our community
- Download our app
- DNS issue handler
- if the supervisor is not able to connect to the internet
- Show actions to set dns to google or cloudflare to resolve the issue
- Error handler
- if something with the installation goes wrong, we show the logs
## Develop
It is similar to the core frontend dev.
- frontend repo is building stuff
- landingpage repo can set the frontend repo path and serve the dev frontend
### landingpage dev server
- clone [home-assistant/landingpage](https://github.com/home-assistant/landingpage)
- Add frontend repo as mount to your devcontainer config
- please do not commit this changes, you can remove it after initial dev container build, because the build will keep the options as long as you don't rebuild it.
- `"mounts": ["source=/path/to/hass/frontend,target=/workspaces/frontend,type=bind,consistency=cached"]`
- use the dev container
- start the dev server with following optional env vars:
- `SUPERVISOR_HOST` to have real supervisor data, you can [setup a supervisor remote API access](https://developers.home-assistant.io/docs/supervisor/development/#supervisor-api-access) and set the host of your supervisor. e.g.: `SUPERVISOR_HOST=192.168.0.20:8888`
- `SUPERVISOR_TOKEN` the supervisor api token you get from the Remote API proxy Addon Logs
- `FRONTEND_PATH` the path inside your container should be `/workspaces/frontend`
- example: `SUPERVISOR_TOKEN=abc123 SUPERVISOR_HOST=192.168.0.20:8888 FRONTEND_PATH=/workspaces/frontend go run main.go http.go mdns.go`
- You can also add this into your devcontainer settings, but then it's not so flexible to change if you want to test something else.
### frontend dev server
- install all dependencies
- run `landing-page/script/develop`

View File

@@ -0,0 +1,8 @@
import rootConfig from "../eslint.config.mjs";
export default [
...rootConfig,
{
rules: {},
},
];

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,3 @@
<svg width="92" height="136" viewBox="0 0 92 136" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M76.38 104.9H3.03C2.24231 104.9 1.48688 105.213 0.929897 105.77C0.372914 106.327 0.0600052 107.082 0.0600052 107.87V132.47C0.0600052 133.258 0.372914 134.013 0.929897 134.57C1.48688 135.127 2.24231 135.44 3.03 135.44H12.36C13.1477 135.44 13.9031 135.127 14.4601 134.57C15.0171 134.013 15.33 133.258 15.33 132.47V120.17H76.39V132.47C76.39 133.258 76.7029 134.013 77.2599 134.57C77.8169 135.127 78.5723 135.44 79.36 135.44H88.69C89.4777 135.44 90.2331 135.127 90.7901 134.57C91.3471 134.013 91.66 133.258 91.66 132.47V107.87C91.66 107.082 91.3471 106.327 90.7901 105.77C90.2331 105.213 89.4777 104.9 88.69 104.9H76.39H76.38ZM50.04 2.24996C47.73 -0.0600439 43.95 -0.0600439 41.65 2.24996L4.25 39.65C1.94 41.96 0.0500031 46.52 0.0500031 49.78V83.7C0.0500031 86.96 2.72 89.64 5.99 89.64H85.7C88.96 89.64 91.64 86.97 91.64 83.7V49.78C91.64 46.52 89.75 41.96 87.44 39.65L50.04 2.24996Z" fill="#18BCF2"/>
</svg>

After

Width:  |  Height:  |  Size: 1011 B

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.2 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@@ -0,0 +1,10 @@
<svg width="75" height="79" viewBox="0 0 75 79" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M73.8393 17.4898C72.6973 9.00165 65.2994 2.31235 56.5296 1.01614C55.05 0.797115 49.4441 0 36.4582 0H36.3612C23.3717 0 20.585 0.797115 19.1054 1.01614C10.5798 2.27644 2.79399 8.28712 0.904997 16.8758C-0.00358524 21.1056 -0.100549 25.7949 0.0682394 30.0965C0.308852 36.2651 0.355538 42.423 0.91577 48.5665C1.30307 52.6474 1.97872 56.6957 2.93763 60.6812C4.73325 68.042 12.0019 74.1676 19.1233 76.6666C26.7478 79.2728 34.9474 79.7055 42.8039 77.9162C43.6682 77.7151 44.5217 77.4817 45.3645 77.216C47.275 76.6092 49.5123 75.9305 51.1571 74.7385C51.1797 74.7217 51.1982 74.7001 51.2112 74.6753C51.2243 74.6504 51.2316 74.6229 51.2325 74.5948V68.6416C51.2321 68.6154 51.2259 68.5896 51.2142 68.5661C51.2025 68.5426 51.1858 68.522 51.1651 68.5058C51.1444 68.4896 51.1204 68.4783 51.0948 68.4726C51.0692 68.4669 51.0426 68.467 51.0171 68.4729C45.9835 69.675 40.8254 70.2777 35.6502 70.2682C26.7439 70.2682 24.3486 66.042 23.6626 64.2826C23.1113 62.762 22.7612 61.1759 22.6212 59.5646C22.6197 59.5375 22.6247 59.5105 22.6357 59.4857C22.6466 59.4609 22.6633 59.4391 22.6843 59.422C22.7053 59.4048 22.73 59.3929 22.7565 59.3871C22.783 59.3813 22.8104 59.3818 22.8367 59.3886C27.7864 60.5826 32.8604 61.1853 37.9522 61.1839C39.1768 61.1839 40.3978 61.1839 41.6224 61.1516C46.7435 61.008 52.1411 60.7459 57.1796 59.7621C57.3053 59.7369 57.431 59.7154 57.5387 59.6831C65.4861 58.157 73.0493 53.3672 73.8178 41.2381C73.8465 40.7606 73.9184 36.2364 73.9184 35.7409C73.9219 34.0569 74.4606 23.7949 73.8393 17.4898Z" fill="url(#paint0_linear_549_34)"/>
<path d="M61.2484 27.0263V48.114H52.8916V27.6475C52.8916 23.3388 51.096 21.1413 47.4437 21.1413C43.4287 21.1413 41.4177 23.7409 41.4177 28.8755V40.0782H33.1111V28.8755C33.1111 23.7409 31.0965 21.1413 27.0815 21.1413C23.4507 21.1413 21.6371 23.3388 21.6371 27.6475V48.114H13.2839V27.0263C13.2839 22.7176 14.384 19.2946 16.5843 16.7572C18.8539 14.2258 21.8311 12.926 25.5264 12.926C29.8036 12.926 33.0357 14.5705 35.1905 17.8559L37.2698 21.346L39.3527 17.8559C41.5074 14.5705 44.7395 12.926 49.0095 12.926C52.7013 12.926 55.6784 14.2258 57.9553 16.7572C60.1531 19.2922 61.2508 22.7152 61.2484 27.0263Z" fill="white"/>
<defs>
<linearGradient id="paint0_linear_549_34" x1="37.0692" y1="0" x2="37.0692" y2="79" gradientUnits="userSpaceOnUse">
<stop stop-color="#6364FF"/>
<stop offset="1" stop-color="#563ACC"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@@ -0,0 +1,3 @@
<svg width="1200" height="1227" viewBox="0 0 1200 1227" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M714.163 519.284L1160.89 0H1055.03L667.137 450.887L357.328 0H0L468.492 681.821L0 1226.37H105.866L515.491 750.218L842.672 1226.37H1200L714.137 519.284H714.163ZM569.165 687.828L521.697 619.934L144.011 79.6944H306.615L611.412 515.685L658.88 583.579L1055.08 1150.3H892.476L569.165 687.854V687.828Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 430 B

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.2 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 52 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 69 KiB

View File

@@ -0,0 +1,9 @@
#!/bin/sh
# Run the landing-page
# Stop on errors
set -e
cd "$(dirname "$0")/../.."
./node_modules/.bin/gulp build-landing-page

9
landing-page/script/develop Executable file
View File

@@ -0,0 +1,9 @@
#!/bin/sh
# Run the landing-page
# Stop on errors
set -e
cd "$(dirname "$0")/../.."
./node_modules/.bin/gulp develop-landing-page

View File

@@ -0,0 +1,334 @@
import "@material/mwc-linear-progress/mwc-linear-progress";
import { mdiArrowCollapseDown, mdiDownload } from "@mdi/js";
// eslint-disable-next-line import/extensions
import { IntersectionController } from "@lit-labs/observers/intersection-controller.js";
import { LitElement, type PropertyValues, css, html, nothing } from "lit";
import { classMap } from "lit/directives/class-map";
import { customElement, property, query, state } from "lit/decorators";
import type {
LandingPageKeys,
LocalizeFunc,
} from "../../../src/common/translations/localize";
import "../../../src/components/ha-button";
import "../../../src/components/ha-icon-button";
import "../../../src/components/ha-svg-icon";
import "../../../src/components/ha-ansi-to-html";
import "../../../src/components/ha-alert";
import type { HaAnsiToHtml } from "../../../src/components/ha-ansi-to-html";
import {
getObserverLogs,
downloadUrl as observerLogsDownloadUrl,
} from "../data/observer";
import { fireEvent } from "../../../src/common/dom/fire_event";
import { fileDownload } from "../../../src/util/file_download";
import { getSupervisorLogs, getSupervisorLogsFollow } from "../data/supervisor";
const ERROR_CHECK = /^[\d\s-:]+(ERROR|CRITICAL)(.*)/gm;
declare global {
interface HASSDomEvents {
"landing-page-error": undefined;
}
}
const SCHEDULE_FETCH_OBSERVER_LOGS = 5;
@customElement("landing-page-logs")
class LandingPageLogs extends LitElement {
@property({ attribute: false })
public localize!: LocalizeFunc<LandingPageKeys>;
@query("ha-ansi-to-html") private _ansiToHtmlElement?: HaAnsiToHtml;
@query(".logs") private _logElement?: HTMLElement;
@query("#scroll-bottom-marker")
private _scrollBottomMarkerElement?: HTMLElement;
@state() private _show = false;
@state() private _scrolledToBottomController =
new IntersectionController<boolean>(this, {
callback(this: IntersectionController<boolean>, entries) {
return entries[0].isIntersecting;
},
});
@state() private _error = false;
@state() private _newLogsIndicator?: boolean;
@state() private _logLinesCount = 0;
protected render() {
return html`
<div class="actions">
<ha-button @click=${this._toggleLogDetails}>
${this.localize(this._show ? "hide_details" : "show_details")}
</ha-button>
${this._show
? html`<ha-icon-button
.label=${this.localize("logs.download_logs")}
.path=${mdiDownload}
@click=${this._downloadLogs}
></ha-icon-button>`
: nothing}
</div>
${this._error
? html`
<ha-alert
alert-type="error"
.title=${this.localize("logs.fetch_error")}
>
<ha-button @click=${this._startLogStream}>
${this.localize("logs.retry")}
</ha-button>
</ha-alert>
`
: nothing}
<div
class=${classMap({
logs: true,
hidden: !this._show,
})}
>
<ha-ansi-to-html></ha-ansi-to-html>
<div id="scroll-bottom-marker"></div>
</div>
<ha-button
class="new-logs-indicator ${classMap({
visible:
(this._show &&
this._newLogsIndicator &&
!this._scrolledToBottomController.value) ||
false,
})}"
@click=${this._scrollToBottom}
>
<ha-svg-icon .path=${mdiArrowCollapseDown} slot="icon"></ha-svg-icon>
${this.localize("logs.scroll_down_button")}
<ha-svg-icon
.path=${mdiArrowCollapseDown}
slot="trailingIcon"
></ha-svg-icon>
</ha-button>
`;
}
protected firstUpdated(changedProps: PropertyValues): void {
super.firstUpdated(changedProps);
this._scrolledToBottomController.observe(this._scrollBottomMarkerElement!);
this._startLogStream();
}
protected updated(changedProps: PropertyValues): void {
super.updated(changedProps);
if (this._newLogsIndicator && this._scrolledToBottomController.value) {
this._newLogsIndicator = false;
}
if (changedProps.has("_show") && this._show) {
this._scrollToBottom();
}
}
private _toggleLogDetails() {
this._show = !this._show;
}
private _scrollToBottom(): void {
if (this._logElement) {
this._newLogsIndicator = false;
this._logElement!.scrollTo(0, this._logElement!.scrollHeight);
}
}
private _displayLogs(logs: string, tempLogLine = "", clear = false): string {
if (clear) {
this._ansiToHtmlElement?.clear();
this._logLinesCount = 0;
}
const showError = ERROR_CHECK.test(logs);
const scrolledToBottom = this._scrolledToBottomController.value;
const lines = `${tempLogLine}${logs}`
.split("\n")
.filter((line) => line.trim() !== "");
// handle edge case where the last line is not complete
if (logs.endsWith("\n")) {
tempLogLine = "";
} else {
tempLogLine = lines.splice(-1, 1)[0];
}
if (lines.length) {
this._ansiToHtmlElement?.parseLinesToColoredPre(lines);
this._logLinesCount += lines.length;
}
if (showError) {
fireEvent(this, "landing-page-error");
this._show = true;
}
if (showError || (scrolledToBottom && this._logElement)) {
this._scrollToBottom();
} else {
this._newLogsIndicator = true;
}
return tempLogLine;
}
private async _startLogStream() {
this._error = false;
this._newLogsIndicator = false;
this._ansiToHtmlElement?.clear();
try {
const response = await getSupervisorLogsFollow();
if (!response.ok || !response.body) {
throw new Error("No stream body found");
}
let tempLogLine = "";
const reader = response.body.getReader();
const decoder = new TextDecoder();
let done = false;
while (!done) {
// eslint-disable-next-line no-await-in-loop
const { value, done: readerDone } = await reader.read();
done = readerDone;
if (value) {
const chunk = decoder.decode(value, { stream: !done });
tempLogLine = this._displayLogs(chunk, tempLogLine);
}
}
} catch (err: any) {
// eslint-disable-next-line no-console
console.error(err);
// fallback to observerlogs if there is a problem with supervisor
this._loadObserverLogs();
}
}
private _scheduleObserverLogs() {
setTimeout(async () => {
try {
// check if supervisor logs are available
const superVisorLogsResponse = await getSupervisorLogs(1);
if (superVisorLogsResponse.ok) {
this._startLogStream();
return;
}
} catch (err) {
// ignore and continue with observer logs
}
this._loadObserverLogs();
}, SCHEDULE_FETCH_OBSERVER_LOGS * 1000);
}
private async _loadObserverLogs() {
try {
const response = await getObserverLogs();
if (!response.ok) {
throw new Error("Error fetching observer logs");
}
const logs = await response.text();
this._displayLogs(logs, "", true);
this._scheduleObserverLogs();
} catch (err) {
// eslint-disable-next-line no-console
console.error(err);
this._error = true;
}
}
private _downloadLogs() {
const timeString = new Date().toISOString().replace(/:/g, "-");
fileDownload(observerLogsDownloadUrl, `observer_${timeString}.log`);
}
static styles = [
css`
:host {
display: flex;
flex-direction: column;
align-items: center;
position: relative;
}
ha-alert {
width: 100%;
}
.actions {
position: relative;
width: 100%;
text-align: center;
}
.actions ha-icon-button {
position: absolute;
right: 0;
top: -4px;
--icon-primary-color: var(--primary-color);
}
.logs {
width: 100%;
max-height: 300px;
overflow: auto;
border: 1px solid var(--divider-color);
border-radius: 4px;
padding: 4px;
}
.logs.hidden {
display: none;
}
.new-logs-indicator {
--mdc-theme-primary: var(--text-primary-color);
overflow: hidden;
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 0;
background-color: var(--primary-color);
border-radius: 8px;
transition: height 0.4s ease-out;
display: flex;
justify-content: space-between;
align-items: center;
}
.new-logs-indicator.visible {
height: 24px;
}
`,
];
}
declare global {
interface HTMLElementTagNameMap {
"landing-page-logs": LandingPageLogs;
}
}

View File

@@ -0,0 +1,186 @@
import "@material/mwc-linear-progress/mwc-linear-progress";
import {
type CSSResultGroup,
LitElement,
type PropertyValues,
css,
html,
nothing,
} from "lit";
import { customElement, property, state } from "lit/decorators";
import type {
LandingPageKeys,
LocalizeFunc,
} from "../../../src/common/translations/localize";
import "../../../src/components/ha-button";
import "../../../src/components/ha-alert";
import {
ALTERNATIVE_DNS_SERVERS,
getSupervisorNetworkInfo,
setSupervisorNetworkDns,
} from "../data/supervisor";
import { fireEvent } from "../../../src/common/dom/fire_event";
import { showAlertDialog } from "../../../src/dialogs/generic/show-dialog-box";
const SCHEDULE_FETCH_NETWORK_INFO_SECONDS = 5;
@customElement("landing-page-network")
class LandingPageNetwork extends LitElement {
@property({ attribute: false })
public localize!: LocalizeFunc<LandingPageKeys>;
@state() private _networkIssue = false;
@state() private _getNetworkInfoError = false;
@state() private _dnsPrimaryInterfaceNameservers?: string;
@state() private _dnsPrimaryInterface?: string;
protected render() {
if (!this._networkIssue && !this._getNetworkInfoError) {
return nothing;
}
if (this._getNetworkInfoError) {
return html`
<ha-alert alert-type="error">
<p>${this.localize("network_issue.error_get_network_info")}</p>
</ha-alert>
`;
}
return html`
<ha-alert
alert-type="warning"
.title=${this.localize("network_issue.title")}
>
<p>
${this.localize("network_issue.description", {
dns: this._dnsPrimaryInterfaceNameservers || "?",
})}
</p>
<p>${this.localize("network_issue.resolve_different")}</p>
${!this._dnsPrimaryInterfaceNameservers
? html`
<p>
<b>${this.localize("network_issue.no_primary_interface")} </b>
</p>
`
: nothing}
<div class="actions">
${ALTERNATIVE_DNS_SERVERS.map(
({ translationKey }, key) =>
html`<ha-button
.index=${key}
.disabled=${!this._dnsPrimaryInterfaceNameservers}
@click=${this._setDns}
>${this.localize(translationKey)}</ha-button
>`
)}
</div>
</ha-alert>
`;
}
protected firstUpdated(_changedProperties: PropertyValues): void {
super.firstUpdated(_changedProperties);
this._fetchSupervisorInfo();
}
private _scheduleFetchSupervisorInfo() {
setTimeout(
() => this._fetchSupervisorInfo(),
SCHEDULE_FETCH_NETWORK_INFO_SECONDS * 1000
);
}
private async _fetchSupervisorInfo() {
let data;
try {
const response = await getSupervisorNetworkInfo();
if (!response.ok) {
throw new Error("Failed to fetch network info");
}
({ data } = await response.json());
} catch (err) {
// eslint-disable-next-line no-console
console.error(err);
this._getNetworkInfoError = true;
this._dnsPrimaryInterfaceNameservers = undefined;
this._dnsPrimaryInterface = undefined;
return;
}
this._getNetworkInfoError = false;
const primaryInterface = data.interfaces.find(
(intf) => intf.primary && intf.enabled
);
if (primaryInterface) {
this._dnsPrimaryInterfaceNameservers = [
...(primaryInterface.ipv4?.nameservers || []),
...(primaryInterface.ipv6?.nameservers || []),
].join(", ");
this._dnsPrimaryInterface = primaryInterface.interface;
} else {
this._dnsPrimaryInterfaceNameservers = undefined;
this._dnsPrimaryInterface = undefined;
}
if (!data.host_internet) {
this._networkIssue = true;
} else {
this._networkIssue = false;
}
fireEvent(this, "value-changed", {
value: this._networkIssue,
});
this._scheduleFetchSupervisorInfo();
}
private async _setDns(ev) {
const index = ev.target?.index;
try {
const response = await setSupervisorNetworkDns(
index,
this._dnsPrimaryInterface!
);
if (!response.ok) {
throw new Error("Failed to set DNS");
}
this._networkIssue = false;
} catch (err: any) {
// eslint-disable-next-line no-console
console.error(err);
showAlertDialog(this, {
title: this.localize("network_issue.failed"),
warning: true,
text: `${this.localize(
"network_issue.set_dns_failed"
)}${err?.message ? ` ${this.localize("network_issue.error")}: ${err.message}` : ""}`,
confirmText: this.localize("network_issue.close"),
});
}
}
static get styles(): CSSResultGroup {
return [
css`
.actions {
display: flex;
justify-content: flex-end;
}
`,
];
}
}
declare global {
interface HTMLElementTagNameMap {
"landing-page-network": LandingPageNetwork;
}
}

Some files were not shown because too many files have changed in this diff Show More