mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-23 08:09:27 +00:00
Compare commits
971 Commits
add-suppor
...
20230830.0
Author | SHA1 | Date | |
---|---|---|---|
![]() |
96597b3963 | ||
![]() |
40c7bc08d9 | ||
![]() |
b8cd1760f7 | ||
![]() |
24dd45c8cd | ||
![]() |
e06bd41b5e | ||
![]() |
c0793fad83 | ||
![]() |
e002c5d96c | ||
![]() |
099e317d17 | ||
![]() |
ca1a183512 | ||
![]() |
c1cacf735e | ||
![]() |
515cfdb6d1 | ||
![]() |
3a6cffd6c1 | ||
![]() |
c84a826937 | ||
![]() |
c485e8d03e | ||
![]() |
2ab67328d4 | ||
![]() |
d350c35c4e | ||
![]() |
034ce56da5 | ||
![]() |
ae9fcebfd5 | ||
![]() |
6197b55da8 | ||
![]() |
4e5d57b5f3 | ||
![]() |
7040c6d469 | ||
![]() |
6f99a39b55 | ||
![]() |
7483833dcd | ||
![]() |
38fb48b231 | ||
![]() |
166acee1c6 | ||
![]() |
916a6df39b | ||
![]() |
70f37158fb | ||
![]() |
5011bba20e | ||
![]() |
8897bc703d | ||
![]() |
ea6e7d441a | ||
![]() |
f91396c986 | ||
![]() |
4598b530af | ||
![]() |
dfabb4bc36 | ||
![]() |
66e0100c95 | ||
![]() |
a08a989ef5 | ||
![]() |
000c28abf9 | ||
![]() |
6b67397c83 | ||
![]() |
f68823a09e | ||
![]() |
fc1782e676 | ||
![]() |
b4975344a1 | ||
![]() |
2dc08d782f | ||
![]() |
ed92958735 | ||
![]() |
5ce31f3177 | ||
![]() |
370ec9cd98 | ||
![]() |
52c12b5659 | ||
![]() |
3de4cfbc00 | ||
![]() |
4215854414 | ||
![]() |
88eba92f57 | ||
![]() |
f773c968f9 | ||
![]() |
bbb6fccaec | ||
![]() |
aa2b2b0d16 | ||
![]() |
5cc06ebf0b | ||
![]() |
85977e505b | ||
![]() |
3249a5225f | ||
![]() |
7e7205627a | ||
![]() |
d33430e53f | ||
![]() |
e3f53e90e2 | ||
![]() |
811edfcc0f | ||
![]() |
2483249b5f | ||
![]() |
3534617f81 | ||
![]() |
216a3c4c7e | ||
![]() |
567bd9831f | ||
![]() |
98d1a55d35 | ||
![]() |
92358b4859 | ||
![]() |
eca3ec7f98 | ||
![]() |
bfcdbbd70b | ||
![]() |
e764076b1a | ||
![]() |
693c77ce1c | ||
![]() |
a725b6c9de | ||
![]() |
014bbf12ce | ||
![]() |
07dceb8e6d | ||
![]() |
53f18bec53 | ||
![]() |
ac3e858738 | ||
![]() |
c76b2fb357 | ||
![]() |
5f015ac9af | ||
![]() |
ac7c354bfc | ||
![]() |
dddee87de3 | ||
![]() |
e8bd77a84e | ||
![]() |
46a036ddbe | ||
![]() |
bf912f7bd3 | ||
![]() |
196c15ff3e | ||
![]() |
d0a6e727f2 | ||
![]() |
09697148cf | ||
![]() |
76093d898d | ||
![]() |
00c69c0fc3 | ||
![]() |
93dd119ce5 | ||
![]() |
e4f3211e9f | ||
![]() |
c6ecdc9d5d | ||
![]() |
6bdd2d234d | ||
![]() |
9d169bcbeb | ||
![]() |
5c06ec1084 | ||
![]() |
38a317b7e7 | ||
![]() |
593b176ab8 | ||
![]() |
1a15c8da8c | ||
![]() |
060e67397a | ||
![]() |
d6de29ca8a | ||
![]() |
220767b347 | ||
![]() |
79e1fbe076 | ||
![]() |
cd19894ab0 | ||
![]() |
705b6aeb4b | ||
![]() |
6e27fbe10f | ||
![]() |
bbb99a6eee | ||
![]() |
8411efc1c3 | ||
![]() |
88721df637 | ||
![]() |
265faddfa9 | ||
![]() |
6584dc70b7 | ||
![]() |
d6b4dbe6a2 | ||
![]() |
d579f93aa7 | ||
![]() |
b91261a789 | ||
![]() |
872128d9a8 | ||
![]() |
4972db4648 | ||
![]() |
821cd7fe05 | ||
![]() |
8c24ffa710 | ||
![]() |
d50a130345 | ||
![]() |
ee8997fbd2 | ||
![]() |
613cf932b5 | ||
![]() |
12b61aea2f | ||
![]() |
51d9271c83 | ||
![]() |
bd5264308f | ||
![]() |
2c17d2fead | ||
![]() |
9f0b9782a0 | ||
![]() |
88ff4c2fa8 | ||
![]() |
cba246fc7f | ||
![]() |
f4d575f456 | ||
![]() |
6dff2f691e | ||
![]() |
917b7bd1dd | ||
![]() |
54a9f4592c | ||
![]() |
baba02f563 | ||
![]() |
f6087f3805 | ||
![]() |
4979e89251 | ||
![]() |
b1c826326b | ||
![]() |
961e8bc149 | ||
![]() |
3b3a37dc81 | ||
![]() |
c98cdb91e2 | ||
![]() |
255137992b | ||
![]() |
b8fcb9272a | ||
![]() |
fa3625985c | ||
![]() |
3f05712c18 | ||
![]() |
67441a63b4 | ||
![]() |
c561df70dd | ||
![]() |
aa85b87e11 | ||
![]() |
25b4d91d72 | ||
![]() |
134d1978f8 | ||
![]() |
43ac8f9a27 | ||
![]() |
bfad8a07c5 | ||
![]() |
d5cc5bd6c2 | ||
![]() |
2af3a68f94 | ||
![]() |
14c84c3d75 | ||
![]() |
4992007f13 | ||
![]() |
9e31b2bb29 | ||
![]() |
5dee92b214 | ||
![]() |
ebee8f670e | ||
![]() |
023f13cd12 | ||
![]() |
416661f3d1 | ||
![]() |
a2b1be754f | ||
![]() |
ade430f326 | ||
![]() |
782e41dcda | ||
![]() |
ac20cf292a | ||
![]() |
4986b013a2 | ||
![]() |
89e96e4681 | ||
![]() |
85733655c2 | ||
![]() |
7a446ba2ad | ||
![]() |
e40bdd5d91 | ||
![]() |
accc8bc644 | ||
![]() |
4884108123 | ||
![]() |
827a57499b | ||
![]() |
945c8e0320 | ||
![]() |
edcdc865c4 | ||
![]() |
c2123a0a90 | ||
![]() |
e9e31d51ec | ||
![]() |
2bbce135bb | ||
![]() |
27e93d63fe | ||
![]() |
068708578e | ||
![]() |
8da7eef88d | ||
![]() |
e3da4d7c39 | ||
![]() |
ccfa5c782d | ||
![]() |
716e68fc5e | ||
![]() |
0d630aa5f5 | ||
![]() |
7b6d9106d4 | ||
![]() |
7dbae75e50 | ||
![]() |
40141923b6 | ||
![]() |
725c8685fd | ||
![]() |
e01dda4379 | ||
![]() |
052ffbb1d6 | ||
![]() |
bfb439c776 | ||
![]() |
2fdd1464f8 | ||
![]() |
b4e2f4b0f5 | ||
![]() |
a8debb8daa | ||
![]() |
a81050182e | ||
![]() |
f49e103f17 | ||
![]() |
7d80eb06b0 | ||
![]() |
6653a8f634 | ||
![]() |
bde93c44bd | ||
![]() |
788e48a5a6 | ||
![]() |
0f56e8f985 | ||
![]() |
5f95968c8f | ||
![]() |
e8aa08b717 | ||
![]() |
a181189a49 | ||
![]() |
f792e708a3 | ||
![]() |
41643b20e7 | ||
![]() |
ece676e3dc | ||
![]() |
85c3d8ecd8 | ||
![]() |
3c62f5597a | ||
![]() |
76388114aa | ||
![]() |
3e60d2e850 | ||
![]() |
2a9ef7d91f | ||
![]() |
4612099e88 | ||
![]() |
f953ec6e1c | ||
![]() |
a5cd350d25 | ||
![]() |
0ee231ee85 | ||
![]() |
b154607552 | ||
![]() |
d3ba19b0e0 | ||
![]() |
626b51112f | ||
![]() |
de4d517918 | ||
![]() |
89b5a082e5 | ||
![]() |
5ed767804c | ||
![]() |
17c9e91092 | ||
![]() |
02f01aba0e | ||
![]() |
4fd5dfd6ae | ||
![]() |
2c7e17ce89 | ||
![]() |
d6e279e8f4 | ||
![]() |
e21f951368 | ||
![]() |
c7cf49de05 | ||
![]() |
ec58862f3e | ||
![]() |
0eebc9095c | ||
![]() |
3189ef0701 | ||
![]() |
308d4b0a62 | ||
![]() |
795831d4cf | ||
![]() |
406f868642 | ||
![]() |
a1748260d3 | ||
![]() |
09e26c8fd7 | ||
![]() |
11fa9d1ed8 | ||
![]() |
38ea25cf5a | ||
![]() |
3ce0fc0a2a | ||
![]() |
e6a3bd4b8c | ||
![]() |
f8fcf304d4 | ||
![]() |
efc442da5b | ||
![]() |
8171b02b75 | ||
![]() |
88259c8de0 | ||
![]() |
61ab08519f | ||
![]() |
1250eac11b | ||
![]() |
d323db8479 | ||
![]() |
c71fd055a4 | ||
![]() |
493f1d1b50 | ||
![]() |
38b68bffa6 | ||
![]() |
11b2cf9e22 | ||
![]() |
4a044fc40e | ||
![]() |
000288aecb | ||
![]() |
d56273ec25 | ||
![]() |
bc3295d851 | ||
![]() |
d7e58a00ca | ||
![]() |
0ce93263e9 | ||
![]() |
4946c00d34 | ||
![]() |
4c9066a4b0 | ||
![]() |
486cfd1d91 | ||
![]() |
2564fb91db | ||
![]() |
4b40405cc4 | ||
![]() |
3d0f2adf9f | ||
![]() |
bcfdb27e25 | ||
![]() |
c173ffd181 | ||
![]() |
e81cac0d03 | ||
![]() |
d756daded4 | ||
![]() |
cb0bc762b1 | ||
![]() |
9bf76a07b8 | ||
![]() |
7546d1950e | ||
![]() |
5e197334f6 | ||
![]() |
27bfa130f3 | ||
![]() |
9b3710f8bd | ||
![]() |
1fe02e8d6c | ||
![]() |
8bb2cbe767 | ||
![]() |
510f9dbb12 | ||
![]() |
df765515ec | ||
![]() |
56e82eab03 | ||
![]() |
efc8ed5c94 | ||
![]() |
e2ec3b63ce | ||
![]() |
158a816f7a | ||
![]() |
3a4d2db8ff | ||
![]() |
5ed348aa56 | ||
![]() |
52d717a86b | ||
![]() |
606b96f6fd | ||
![]() |
33b9786ae7 | ||
![]() |
04ec380ce0 | ||
![]() |
9866a3217e | ||
![]() |
9f55c06dfc | ||
![]() |
2298d2b7ca | ||
![]() |
e46f0224c6 | ||
![]() |
bf4cf310f3 | ||
![]() |
b1a909d302 | ||
![]() |
bffdfcf61c | ||
![]() |
228b75ae83 | ||
![]() |
35a427afad | ||
![]() |
1f5a8b4e7e | ||
![]() |
f98eaf0c2d | ||
![]() |
d66a8a65b6 | ||
![]() |
3bf8739a7c | ||
![]() |
456eba1d88 | ||
![]() |
a1771cc919 | ||
![]() |
289c380a6a | ||
![]() |
f35b493d2e | ||
![]() |
e01ad86da9 | ||
![]() |
f8e09921c3 | ||
![]() |
0974d86bfd | ||
![]() |
fdf5abd0f9 | ||
![]() |
487ff4afcf | ||
![]() |
13d686bd67 | ||
![]() |
4ea88613bd | ||
![]() |
e8c7f8cffc | ||
![]() |
1beab0449f | ||
![]() |
3191801fa7 | ||
![]() |
6a22503285 | ||
![]() |
6b66b7f1fa | ||
![]() |
0b31d9b943 | ||
![]() |
e1be4751a1 | ||
![]() |
155e9d9e95 | ||
![]() |
3d2734eb88 | ||
![]() |
9ac3f745b3 | ||
![]() |
9f74af56ed | ||
![]() |
b1f5776eb3 | ||
![]() |
c95232fecb | ||
![]() |
c60a235ad2 | ||
![]() |
cc8ab184e3 | ||
![]() |
ad8d3c7fa8 | ||
![]() |
507f22a5cd | ||
![]() |
d7e0dac4e7 | ||
![]() |
1b0423eb42 | ||
![]() |
9125520d8f | ||
![]() |
3390dda7be | ||
![]() |
dcae8b9790 | ||
![]() |
1b503a6af1 | ||
![]() |
8bd09edec0 | ||
![]() |
c8de1ff74c | ||
![]() |
44aca9688d | ||
![]() |
9d457d52e8 | ||
![]() |
72dbe8e7ab | ||
![]() |
371dadfeeb | ||
![]() |
9cf8ec4cbb | ||
![]() |
7584404d31 | ||
![]() |
75b6b9cfd9 | ||
![]() |
94808b75b3 | ||
![]() |
dc19f94bfa | ||
![]() |
9374e38db2 | ||
![]() |
b309c64d7b | ||
![]() |
db78dd8762 | ||
![]() |
4588eb3b75 | ||
![]() |
d427d9e7f6 | ||
![]() |
a3b87a6e7b | ||
![]() |
6a2cad1af3 | ||
![]() |
21caac4240 | ||
![]() |
0735b6475a | ||
![]() |
7dbb419c30 | ||
![]() |
a477120f13 | ||
![]() |
a7ed71d404 | ||
![]() |
08716c8e11 | ||
![]() |
4b8d7b27e3 | ||
![]() |
c29a2f35c3 | ||
![]() |
f8b9888636 | ||
![]() |
2d45532707 | ||
![]() |
5d4402a53b | ||
![]() |
60af8c7303 | ||
![]() |
8f3d89da4f | ||
![]() |
ff59e31530 | ||
![]() |
23ac7501b3 | ||
![]() |
d6f8941098 | ||
![]() |
e5146512d5 | ||
![]() |
b43c6f9fa3 | ||
![]() |
5579713ed5 | ||
![]() |
e7c47ef65c | ||
![]() |
ede7daad1a | ||
![]() |
5e84f2a173 | ||
![]() |
90df43c205 | ||
![]() |
3563541f8f | ||
![]() |
a09d71291b | ||
![]() |
a7100b9678 | ||
![]() |
42d6e6dc51 | ||
![]() |
a5c7f261c8 | ||
![]() |
f712b76ccf | ||
![]() |
82a8b8fd5d | ||
![]() |
a227d7a2cf | ||
![]() |
b5eb18e163 | ||
![]() |
82ae04e070 | ||
![]() |
8f617fe754 | ||
![]() |
77d24f4129 | ||
![]() |
6cc207752f | ||
![]() |
b96ad65f48 | ||
![]() |
ab1759f11d | ||
![]() |
b539a939b4 | ||
![]() |
82cc667012 | ||
![]() |
fc86c82540 | ||
![]() |
6d1ea41449 | ||
![]() |
50f4a1abc5 | ||
![]() |
f6d06f5e26 | ||
![]() |
de7f055419 | ||
![]() |
c3c6c63169 | ||
![]() |
6fea7a7106 | ||
![]() |
ce88c594b7 | ||
![]() |
e2daa89941 | ||
![]() |
81bd4a247b | ||
![]() |
345aef8d65 | ||
![]() |
eaeb37da4d | ||
![]() |
c0613545e7 | ||
![]() |
e6d77af438 | ||
![]() |
625da46da9 | ||
![]() |
7727bf7901 | ||
![]() |
24e531a16c | ||
![]() |
32a9b13af0 | ||
![]() |
c90c4d88af | ||
![]() |
cd3bec08f7 | ||
![]() |
8945650b62 | ||
![]() |
5ac9a6c9cc | ||
![]() |
ce9380e4d7 | ||
![]() |
927c6dd778 | ||
![]() |
952bcff8c8 | ||
![]() |
73e1b4b1d1 | ||
![]() |
cbe8be1573 | ||
![]() |
6b4300950d | ||
![]() |
c3c062cc29 | ||
![]() |
b15754a6a7 | ||
![]() |
343708cdaa | ||
![]() |
3b8ea5edbe | ||
![]() |
4761036816 | ||
![]() |
3bb5e95c50 | ||
![]() |
9e5774525f | ||
![]() |
349311a18d | ||
![]() |
48b6c2a925 | ||
![]() |
381c9f97d6 | ||
![]() |
9a116d4022 | ||
![]() |
d63d3a681c | ||
![]() |
3111c29049 | ||
![]() |
87aad75cc7 | ||
![]() |
d656269d75 | ||
![]() |
d169ff6a96 | ||
![]() |
06d9517e27 | ||
![]() |
a637b7db75 | ||
![]() |
96a6261a09 | ||
![]() |
a3f0c428f8 | ||
![]() |
b40a3224fc | ||
![]() |
68fb98454f | ||
![]() |
3803bdc8da | ||
![]() |
1dfd859a2d | ||
![]() |
f77f7b3c36 | ||
![]() |
82463c2ef6 | ||
![]() |
e53ae0b333 | ||
![]() |
b6ed8acd02 | ||
![]() |
897f118547 | ||
![]() |
d961f5be5f | ||
![]() |
96d6687724 | ||
![]() |
a77167e9d9 | ||
![]() |
d2199dfa34 | ||
![]() |
0f0d1d6e6f | ||
![]() |
9bcbb6f914 | ||
![]() |
2929bf5b1a | ||
![]() |
976fcab146 | ||
![]() |
655cf053c7 | ||
![]() |
152ca75499 | ||
![]() |
1645208f62 | ||
![]() |
3528f5c7aa | ||
![]() |
76490cc690 | ||
![]() |
bf18deb83c | ||
![]() |
f19dcba1ce | ||
![]() |
b3fa134198 | ||
![]() |
80c57fa326 | ||
![]() |
b748fee321 | ||
![]() |
1ee67937ec | ||
![]() |
eb552530e2 | ||
![]() |
1fe5d66a68 | ||
![]() |
7faa165558 | ||
![]() |
752bc192cd | ||
![]() |
e9961b93f9 | ||
![]() |
bbdcc021d4 | ||
![]() |
3d6cfc4037 | ||
![]() |
9b35c06eef | ||
![]() |
b46c74fe76 | ||
![]() |
5aa6ffe2e4 | ||
![]() |
07d37dd89f | ||
![]() |
33d6ad1b0b | ||
![]() |
386ed2167f | ||
![]() |
221f4f34a7 | ||
![]() |
c63c717d9f | ||
![]() |
1cb1bcf274 | ||
![]() |
1cf24ffc8d | ||
![]() |
13b864e261 | ||
![]() |
7bc2ca3b65 | ||
![]() |
922e95b895 | ||
![]() |
baaa012101 | ||
![]() |
3888b1c48b | ||
![]() |
332af4003e | ||
![]() |
044a44e114 | ||
![]() |
13c932a8f8 | ||
![]() |
be1089302f | ||
![]() |
540df024d9 | ||
![]() |
e7c8bd4c41 | ||
![]() |
7c15a65bba | ||
![]() |
5381a467e5 | ||
![]() |
a96d3594ba | ||
![]() |
1d0d4755d0 | ||
![]() |
fa75b18a6b | ||
![]() |
cdd29c8bf7 | ||
![]() |
215f5e341a | ||
![]() |
8abb58ae7d | ||
![]() |
40c8301df0 | ||
![]() |
80f3d6aacb | ||
![]() |
41310007fe | ||
![]() |
195b1eef02 | ||
![]() |
8e9b5ea66b | ||
![]() |
827d89628d | ||
![]() |
cac341a938 | ||
![]() |
2b51228665 | ||
![]() |
79c010eb7b | ||
![]() |
2a4356ce86 | ||
![]() |
afdeb36258 | ||
![]() |
d4f4ee1e59 | ||
![]() |
bcceef30bb | ||
![]() |
356935fefc | ||
![]() |
49f59d7162 | ||
![]() |
67e8357bb9 | ||
![]() |
b8da712186 | ||
![]() |
a409f494a2 | ||
![]() |
3b32825e2a | ||
![]() |
12b7b903bc | ||
![]() |
3be601a3b9 | ||
![]() |
d0641d64bd | ||
![]() |
3a64f64894 | ||
![]() |
7182abfec5 | ||
![]() |
2076a083d3 | ||
![]() |
73317a48ee | ||
![]() |
b891c53994 | ||
![]() |
c1c18affbc | ||
![]() |
3bea2cf7f9 | ||
![]() |
fa1a6affa7 | ||
![]() |
197638b282 | ||
![]() |
6e3cf0975b | ||
![]() |
9875cb2723 | ||
![]() |
f8ea7e0ef2 | ||
![]() |
c821f4296e | ||
![]() |
5fc4e7a95d | ||
![]() |
49fa7ec4ed | ||
![]() |
780de42e4b | ||
![]() |
f7722a270f | ||
![]() |
e3faa618bf | ||
![]() |
655b630fa5 | ||
![]() |
983bba357a | ||
![]() |
17a2560d94 | ||
![]() |
eaffed9ff8 | ||
![]() |
273992c8e9 | ||
![]() |
c77905bd22 | ||
![]() |
15132783d4 | ||
![]() |
2b6cf55638 | ||
![]() |
e4eaa52d53 | ||
![]() |
e1f73dac02 | ||
![]() |
36de0e5c8c | ||
![]() |
549e4e7fb3 | ||
![]() |
dd9c4e35bf | ||
![]() |
cc41dbcb0b | ||
![]() |
8580d3f9bf | ||
![]() |
6d29b764d3 | ||
![]() |
78cff3a921 | ||
![]() |
e3c312feaf | ||
![]() |
31e4166248 | ||
![]() |
fcffa1a750 | ||
![]() |
0442e3e06e | ||
![]() |
0a8252c16a | ||
![]() |
0a62d711f2 | ||
![]() |
d7c3ff3e9d | ||
![]() |
2767f866f3 | ||
![]() |
040d5af0aa | ||
![]() |
06c6e312b0 | ||
![]() |
841dffe563 | ||
![]() |
a41e0d446f | ||
![]() |
9a0f24cd8b | ||
![]() |
2e531a9006 | ||
![]() |
76255f2efb | ||
![]() |
e3ee8f307a | ||
![]() |
19fc92419a | ||
![]() |
e7c2625cf1 | ||
![]() |
c39fdcda6e | ||
![]() |
fd1381ab3b | ||
![]() |
7b8f4d1e72 | ||
![]() |
b0a278df97 | ||
![]() |
871f0f9e0d | ||
![]() |
93e31df106 | ||
![]() |
47fdae764f | ||
![]() |
b8efc06caa | ||
![]() |
fcacdf6534 | ||
![]() |
45d260f0ce | ||
![]() |
d5f46a69b0 | ||
![]() |
fe8eb333b9 | ||
![]() |
677cd2de10 | ||
![]() |
1470eb484f | ||
![]() |
10ee8fda5b | ||
![]() |
e044ddcb57 | ||
![]() |
29c564bb69 | ||
![]() |
1bf03f020e | ||
![]() |
6c684fd8ee | ||
![]() |
ddaf403378 | ||
![]() |
b337074758 | ||
![]() |
a96eff4d25 | ||
![]() |
e6bdc3a15e | ||
![]() |
33e15eec22 | ||
![]() |
3c0afd6cde | ||
![]() |
31a3fa02d9 | ||
![]() |
71954f545c | ||
![]() |
9f3e8abe69 | ||
![]() |
21f983572c | ||
![]() |
5667d71b02 | ||
![]() |
0d0e5fdaaa | ||
![]() |
b1f5ff26d9 | ||
![]() |
27451ca30e | ||
![]() |
928b4e6f1e | ||
![]() |
82fd56efe7 | ||
![]() |
b63a32109e | ||
![]() |
efb0098eac | ||
![]() |
a67b845812 | ||
![]() |
d29b7626f3 | ||
![]() |
47ac7062dc | ||
![]() |
e7f5d927b1 | ||
![]() |
6b06393559 | ||
![]() |
efa02c309b | ||
![]() |
9b2e77e781 | ||
![]() |
24b4060c97 | ||
![]() |
5e4c1ab4fc | ||
![]() |
287e6dbb60 | ||
![]() |
40c9292e16 | ||
![]() |
d51dd00ec7 | ||
![]() |
0db50d13d3 | ||
![]() |
9eb3618d97 | ||
![]() |
03eee9c7d5 | ||
![]() |
a49d59f4c6 | ||
![]() |
990ade4294 | ||
![]() |
a4c57f09ad | ||
![]() |
c1fa6d6f8c | ||
![]() |
3bfcb808f5 | ||
![]() |
9a30fe81c6 | ||
![]() |
c864edee72 | ||
![]() |
36268d5048 | ||
![]() |
5217d427e9 | ||
![]() |
aea668e754 | ||
![]() |
2219c9bbd3 | ||
![]() |
9b896c63b6 | ||
![]() |
30af576ff5 | ||
![]() |
585db6ab3f | ||
![]() |
046475e7ac | ||
![]() |
648383addd | ||
![]() |
10018b4c32 | ||
![]() |
872d3e4875 | ||
![]() |
881f5e5012 | ||
![]() |
9797950f32 | ||
![]() |
25986f239e | ||
![]() |
b586210ff1 | ||
![]() |
748925ede9 | ||
![]() |
a9f1c4a198 | ||
![]() |
d914fb0cfc | ||
![]() |
5218e1352e | ||
![]() |
eb0759a3b3 | ||
![]() |
88522ed155 | ||
![]() |
64e7fc6591 | ||
![]() |
2ad6253b72 | ||
![]() |
7e5a85dbe7 | ||
![]() |
0771a780d9 | ||
![]() |
7b350e31dd | ||
![]() |
70fbf68603 | ||
![]() |
2b4f199337 | ||
![]() |
a70d7d8de3 | ||
![]() |
e0c1f98803 | ||
![]() |
4b7a517d98 | ||
![]() |
26d4839dfd | ||
![]() |
c358d724a7 | ||
![]() |
0ab7934c09 | ||
![]() |
6eac229901 | ||
![]() |
5006dfc138 | ||
![]() |
d9d38efd93 | ||
![]() |
9fe3a500d5 | ||
![]() |
3df7c50690 | ||
![]() |
38cf774a0d | ||
![]() |
98d22d38c3 | ||
![]() |
357dbb591b | ||
![]() |
aa5df06bc3 | ||
![]() |
07a66b4bff | ||
![]() |
f466196fa8 | ||
![]() |
04ae0b34af | ||
![]() |
6f48267dae | ||
![]() |
be1f5d99c8 | ||
![]() |
27b9b4dcc5 | ||
![]() |
08b57d6168 | ||
![]() |
3e474daa32 | ||
![]() |
48c1e8b56c | ||
![]() |
fd0c0a95ca | ||
![]() |
83570f2419 | ||
![]() |
633c6cfc9b | ||
![]() |
54b4c9f347 | ||
![]() |
85e7986b44 | ||
![]() |
da0cf9d950 | ||
![]() |
ef51336770 | ||
![]() |
a09db75980 | ||
![]() |
77d1b19ecb | ||
![]() |
fba12f35ac | ||
![]() |
00198c6937 | ||
![]() |
71bb540352 | ||
![]() |
c4ff1a8646 | ||
![]() |
a9c27ad8dd | ||
![]() |
dacdc62672 | ||
![]() |
cccce5711c | ||
![]() |
50bd9da94c | ||
![]() |
dde27c3524 | ||
![]() |
85acafe8a8 | ||
![]() |
c1748138a8 | ||
![]() |
9111f58e52 | ||
![]() |
cefaaadf95 | ||
![]() |
29846a168e | ||
![]() |
31c89d70c5 | ||
![]() |
d5cea75fe4 | ||
![]() |
35d212e850 | ||
![]() |
aea098ff17 | ||
![]() |
c5205ae8db | ||
![]() |
303087d049 | ||
![]() |
e9d9d89d79 | ||
![]() |
a5b5e61ed4 | ||
![]() |
22dc757382 | ||
![]() |
4ccfd6a3fc | ||
![]() |
5a36f100a9 | ||
![]() |
847c8407de | ||
![]() |
ed1784b70f | ||
![]() |
e8521c59eb | ||
![]() |
34e59e543b | ||
![]() |
330aa23801 | ||
![]() |
06db338a15 | ||
![]() |
8cff4cda47 | ||
![]() |
f7e7c916ba | ||
![]() |
13ab5ab70a | ||
![]() |
cc61131e4b | ||
![]() |
099aa54b80 | ||
![]() |
e35d795ba8 | ||
![]() |
39de8cd6ba | ||
![]() |
fdddf27162 | ||
![]() |
cec7a24234 | ||
![]() |
ea2e9de37a | ||
![]() |
d9cb288c1d | ||
![]() |
53bd4298e7 | ||
![]() |
5bea929c1e | ||
![]() |
eb220fa1a0 | ||
![]() |
67b64b2d5c | ||
![]() |
42aa4ab7c2 | ||
![]() |
d873f26db3 | ||
![]() |
e354f5de12 | ||
![]() |
92ed62985d | ||
![]() |
cbcca6e190 | ||
![]() |
2ed48d67c6 | ||
![]() |
8fb2bf472a | ||
![]() |
51bdf85642 | ||
![]() |
b7a4eb33cf | ||
![]() |
3c2d326b54 | ||
![]() |
24e6d19e18 | ||
![]() |
9370411019 | ||
![]() |
d5c7e7849e | ||
![]() |
c5e62248b9 | ||
![]() |
c5e0efb8e0 | ||
![]() |
82f88ca7d7 | ||
![]() |
c676cddb13 | ||
![]() |
036e2a9e46 | ||
![]() |
319d8bec29 | ||
![]() |
aa864cf0b6 | ||
![]() |
eabd8b54f4 | ||
![]() |
aa063d0a3e | ||
![]() |
75f080ee85 | ||
![]() |
557fe33807 | ||
![]() |
5bd49c18d1 | ||
![]() |
a461d58df2 | ||
![]() |
ae8eafe8f9 | ||
![]() |
450565799e | ||
![]() |
72403f4276 | ||
![]() |
d66ca0467e | ||
![]() |
d46201ebd8 | ||
![]() |
689d123890 | ||
![]() |
bcdb24849d | ||
![]() |
3838d76094 | ||
![]() |
3325cbfa28 | ||
![]() |
24fc2a0ccc | ||
![]() |
d6ea6f8041 | ||
![]() |
8384ef7a5c | ||
![]() |
2869c5f26b | ||
![]() |
c098c55b8f | ||
![]() |
fec974712f | ||
![]() |
0be5aa108c | ||
![]() |
ec36d4a381 | ||
![]() |
ccf3238318 | ||
![]() |
bcfa6c5a4b | ||
![]() |
e371f5d406 | ||
![]() |
6d4e3a0de3 | ||
![]() |
b845c54948 | ||
![]() |
87951ebf82 | ||
![]() |
586079917d | ||
![]() |
aa3fd70966 | ||
![]() |
a5ba2499c0 | ||
![]() |
36a87da1fe | ||
![]() |
8f75c314f5 | ||
![]() |
d04fc53f08 | ||
![]() |
c65c6f8767 | ||
![]() |
b81668fbce | ||
![]() |
2d8e23ba48 | ||
![]() |
e947f8120c | ||
![]() |
6424020f64 | ||
![]() |
a611930fa7 | ||
![]() |
f0e990f330 | ||
![]() |
8c1d2362a4 | ||
![]() |
69067010a3 | ||
![]() |
0b0ba97aee | ||
![]() |
792fe15dac | ||
![]() |
d5b8fa482c | ||
![]() |
2fefbbfe24 | ||
![]() |
22c509533a | ||
![]() |
544dfa0973 | ||
![]() |
aac3ec353b | ||
![]() |
efbc6d9069 | ||
![]() |
4e390b4c57 | ||
![]() |
849e65a2b3 | ||
![]() |
a6fdb54697 | ||
![]() |
aa196704b7 | ||
![]() |
c93fcb8a2a | ||
![]() |
5768764282 | ||
![]() |
e6c8881b21 | ||
![]() |
ac30335fc2 | ||
![]() |
1e5c30a259 | ||
![]() |
1da009b473 | ||
![]() |
bc81499e7c | ||
![]() |
c31378ad75 | ||
![]() |
02542e528e | ||
![]() |
8ce8b63cfc | ||
![]() |
c7ec6903fe | ||
![]() |
ecb2a73e2b | ||
![]() |
59db31cdb5 | ||
![]() |
643556ded3 | ||
![]() |
4e5a18d272 | ||
![]() |
ab237f19c0 | ||
![]() |
3fa3d333c4 | ||
![]() |
1cb7e798da | ||
![]() |
11640b31f6 | ||
![]() |
4740ce685f | ||
![]() |
d2321b535c | ||
![]() |
f185e886c3 | ||
![]() |
8695bbc490 | ||
![]() |
11f77b09e6 | ||
![]() |
ba7d7556a8 | ||
![]() |
31da0d8678 | ||
![]() |
9f195534b5 | ||
![]() |
060f6ce3d8 | ||
![]() |
ed19cfeaaa | ||
![]() |
79d6453c7e | ||
![]() |
694fc7d4ba | ||
![]() |
a293e7b91c | ||
![]() |
8205a30baf | ||
![]() |
25af9a9770 | ||
![]() |
6c25e23ad2 | ||
![]() |
a39c2a314a | ||
![]() |
1ea70f3191 | ||
![]() |
02a94c04af | ||
![]() |
fc97ca324c | ||
![]() |
4a0d84d2f6 | ||
![]() |
b550c67a9f | ||
![]() |
a3ec83a684 | ||
![]() |
822f47143b | ||
![]() |
da1df9d8cc | ||
![]() |
aa155261f5 | ||
![]() |
29aa762f7c | ||
![]() |
d56e4afe92 | ||
![]() |
e766c277f5 | ||
![]() |
6c0011fb45 | ||
![]() |
a6e71f4c0a | ||
![]() |
d6382e59c6 | ||
![]() |
ab308af61f | ||
![]() |
15eab18e07 | ||
![]() |
c8e0227a5c | ||
![]() |
f2a8528429 | ||
![]() |
3ed3dab0a1 | ||
![]() |
d0c7f65256 | ||
![]() |
f99f554f19 | ||
![]() |
e069b5eed1 | ||
![]() |
3a481ebb1a | ||
![]() |
a209fadf18 | ||
![]() |
9f1bd1e085 | ||
![]() |
edc6da04f7 | ||
![]() |
2fb1dd0ec1 | ||
![]() |
3f2aac0842 | ||
![]() |
71dd822978 | ||
![]() |
d1877595a5 | ||
![]() |
6379713f57 | ||
![]() |
3b33195ff6 | ||
![]() |
c7f1f1bcd1 | ||
![]() |
c50aad8403 | ||
![]() |
fac4795f14 | ||
![]() |
062e402ef1 | ||
![]() |
29be64a858 | ||
![]() |
b3b74b8328 | ||
![]() |
37ba34cb0d | ||
![]() |
8ecdde3507 | ||
![]() |
04d34aa80c | ||
![]() |
26bb1ba146 | ||
![]() |
b7667d2cbf | ||
![]() |
0c36600a81 | ||
![]() |
feaf61a0ae | ||
![]() |
3e2844a65a | ||
![]() |
3a2d7baa25 | ||
![]() |
349cca5ff2 | ||
![]() |
5cd3ce66f6 | ||
![]() |
8cf8c41698 | ||
![]() |
ff4c01e15c | ||
![]() |
addb66f21d | ||
![]() |
a5759e36b2 | ||
![]() |
9852186ff7 | ||
![]() |
19c9486351 | ||
![]() |
8c06712ab7 | ||
![]() |
63de324224 | ||
![]() |
10d476195d | ||
![]() |
e0c4b85ef1 | ||
![]() |
3441a86613 | ||
![]() |
643b168c69 | ||
![]() |
db0e5a8a41 | ||
![]() |
64a693332b | ||
![]() |
327927baa7 | ||
![]() |
ce8fc17ef8 | ||
![]() |
62ed1d54b0 | ||
![]() |
2498f1db41 | ||
![]() |
8a50bb058d | ||
![]() |
e793675c47 | ||
![]() |
07cef18918 | ||
![]() |
a0263f25c4 | ||
![]() |
52546ab567 | ||
![]() |
c0ec7e4f09 | ||
![]() |
8b61390e19 | ||
![]() |
9ba114777e | ||
![]() |
4e1e76ccc2 | ||
![]() |
609300f40b | ||
![]() |
eac9ac4757 | ||
![]() |
708d1b81da | ||
![]() |
35baf4c779 | ||
![]() |
8d1ae71741 | ||
![]() |
9b32c9c6b4 | ||
![]() |
439f34f724 | ||
![]() |
cef3b99e16 | ||
![]() |
9dbdf611c5 | ||
![]() |
86f8d2d737 | ||
![]() |
1ded47d368 | ||
![]() |
85a27e8bb1 | ||
![]() |
878f3b8df4 | ||
![]() |
50c25a8276 | ||
![]() |
c0de3b8269 | ||
![]() |
09f4e19d4c | ||
![]() |
6e91ac2a34 | ||
![]() |
49b0c7c3d1 | ||
![]() |
be1867900e | ||
![]() |
a43f49f4af | ||
![]() |
ea0f29782d | ||
![]() |
65161ce581 | ||
![]() |
088cc69083 | ||
![]() |
be005b4c88 | ||
![]() |
aac28efd32 | ||
![]() |
0d020e0300 | ||
![]() |
eeb84f65b9 | ||
![]() |
22f5d6cacb | ||
![]() |
52a7b41096 | ||
![]() |
f9f87d1147 | ||
![]() |
0b3dff00df | ||
![]() |
d48a4ab00a | ||
![]() |
d89ac0f30d | ||
![]() |
3cb3f8d352 | ||
![]() |
f507a7b8b3 | ||
![]() |
910244f751 | ||
![]() |
a998465600 | ||
![]() |
21645c2361 | ||
![]() |
e781be885d | ||
![]() |
b15b0e25d6 | ||
![]() |
2d74873db0 | ||
![]() |
d50f2bf38c |
39
.browserslistrc
Normal file
39
.browserslistrc
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
[modern]
|
||||||
|
# Support for dynamic import is the main litmus test for serving modern builds.
|
||||||
|
# Although officially a ES2020 feature, browsers implemented it early, so this
|
||||||
|
# enables all of ES2017 and some features in ES2018.
|
||||||
|
supports es6-module-dynamic-import
|
||||||
|
|
||||||
|
# Exclude Safari 11-12 because of a bug in tagged template literals
|
||||||
|
# https://bugs.webkit.org/show_bug.cgi?id=190756
|
||||||
|
# Note: Dropping version 11 also enables several more ES2018 features
|
||||||
|
not Safari < 13
|
||||||
|
not iOS < 13
|
||||||
|
|
||||||
|
# Exclude KaiOS, QQ, and UC browsers due to lack of sufficient feature support data
|
||||||
|
# Babel ignores these automatically, but we need here for Webpack to output ESM with dynamic imports
|
||||||
|
not KaiOS > 0
|
||||||
|
not QQAndroid > 0
|
||||||
|
not UCAndroid > 0
|
||||||
|
|
||||||
|
# Exclude unsupported browsers
|
||||||
|
not dead
|
||||||
|
|
||||||
|
[legacy]
|
||||||
|
# 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 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.
|
||||||
|
unreleased versions
|
||||||
|
last 7 years
|
||||||
|
> 0.05% and supports websockets
|
@@ -1,13 +1,7 @@
|
|||||||
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.148.1/containers/python-3/.devcontainer/base.Dockerfile
|
# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.148.1/containers/python-3/.devcontainer/base.Dockerfile
|
||||||
FROM mcr.microsoft.com/vscode/devcontainers/python:0-3.10
|
FROM mcr.microsoft.com/vscode/devcontainers/python:0-3.11
|
||||||
|
|
||||||
ENV \
|
ENV \
|
||||||
DEBIAN_FRONTEND=noninteractive \
|
DEBIAN_FRONTEND=noninteractive \
|
||||||
DEVCONTAINER=true \
|
DEVCONTAINER=true \
|
||||||
PATH=$PATH:./node_modules/.bin
|
PATH=$PATH:./node_modules/.bin
|
||||||
|
|
||||||
# Install nvm
|
|
||||||
COPY .nvmrc /tmp/.nvmrc
|
|
||||||
RUN \
|
|
||||||
su vscode -c \
|
|
||||||
"source /usr/local/share/nvm/nvm.sh && nvm install $(cat /tmp/.nvmrc) 2>&1"
|
|
@@ -5,7 +5,7 @@
|
|||||||
"context": ".."
|
"context": ".."
|
||||||
},
|
},
|
||||||
"appPort": "8124:8123",
|
"appPort": "8124:8123",
|
||||||
"postCreateCommand": "script/bootstrap",
|
"postStartCommand": "script/bootstrap",
|
||||||
"containerEnv": {
|
"containerEnv": {
|
||||||
"WORKSPACE_DIRECTORY": "${containerWorkspaceFolder}"
|
"WORKSPACE_DIRECTORY": "${containerWorkspaceFolder}"
|
||||||
},
|
},
|
||||||
|
3
.github/dependabot.yml
vendored
3
.github/dependabot.yml
vendored
@@ -6,3 +6,6 @@ updates:
|
|||||||
interval: weekly
|
interval: weekly
|
||||||
time: "06:00"
|
time: "06:00"
|
||||||
open-pull-requests-limit: 10
|
open-pull-requests-limit: 10
|
||||||
|
labels:
|
||||||
|
- Dependencies
|
||||||
|
- GitHub Actions
|
||||||
|
31
.github/labeler.yml
vendored
Normal file
31
.github/labeler.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
Build:
|
||||||
|
- build-scripts/**
|
||||||
|
- .browserslistrc
|
||||||
|
- gulpfile.js
|
||||||
|
|
||||||
|
Cast:
|
||||||
|
- cast/src/**
|
||||||
|
- src/cast/**
|
||||||
|
|
||||||
|
Demo:
|
||||||
|
- demo/src/**
|
||||||
|
- src/fake_data/**
|
||||||
|
|
||||||
|
Design:
|
||||||
|
- gallery/src/**
|
||||||
|
- src/fake_data/**
|
||||||
|
|
||||||
|
Dependencies:
|
||||||
|
- package.json
|
||||||
|
- renovate.json
|
||||||
|
- yarn.lock
|
||||||
|
- .yarn/**
|
||||||
|
- .yarnrc.yml
|
||||||
|
- .nvmrc
|
||||||
|
|
||||||
|
GitHub Actions:
|
||||||
|
- .github/workflows/**
|
||||||
|
- .github/*.yml
|
||||||
|
|
||||||
|
Supervisor:
|
||||||
|
- hassio/src/**
|
5
.github/release-drafter.yml
vendored
5
.github/release-drafter.yml
vendored
@@ -1,3 +1,8 @@
|
|||||||
|
categories:
|
||||||
|
- title: "Dependency updates"
|
||||||
|
collapse-after: 3
|
||||||
|
labels:
|
||||||
|
- "Dependencies"
|
||||||
template: |
|
template: |
|
||||||
## What's Changed
|
## What's Changed
|
||||||
|
|
||||||
|
17
.github/workflows/cast_deployment.yaml
vendored
17
.github/workflows/cast_deployment.yaml
vendored
@@ -9,7 +9,6 @@ on:
|
|||||||
- master
|
- master
|
||||||
|
|
||||||
env:
|
env:
|
||||||
NODE_VERSION: 16
|
|
||||||
NODE_OPTIONS: --max_old_space_size=6144
|
NODE_OPTIONS: --max_old_space_size=6144
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -22,14 +21,14 @@ jobs:
|
|||||||
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out files from GitHub
|
- name: Check out files from GitHub
|
||||||
uses: actions/checkout@v3.5.2
|
uses: actions/checkout@v3.6.0
|
||||||
with:
|
with:
|
||||||
ref: dev
|
ref: dev
|
||||||
|
|
||||||
- name: Set up Node ${{ env.NODE_VERSION }}
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3.6.0
|
uses: actions/setup-node@v3.8.1
|
||||||
with:
|
with:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
@@ -58,14 +57,14 @@ jobs:
|
|||||||
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out files from GitHub
|
- name: Check out files from GitHub
|
||||||
uses: actions/checkout@v3.5.2
|
uses: actions/checkout@v3.6.0
|
||||||
with:
|
with:
|
||||||
ref: master
|
ref: master
|
||||||
|
|
||||||
- name: Set up Node ${{ env.NODE_VERSION }}
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3.6.0
|
uses: actions/setup-node@v3.8.1
|
||||||
with:
|
with:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
|
41
.github/workflows/ci.yaml
vendored
41
.github/workflows/ci.yaml
vendored
@@ -11,7 +11,6 @@ on:
|
|||||||
- master
|
- master
|
||||||
|
|
||||||
env:
|
env:
|
||||||
NODE_VERSION: 16
|
|
||||||
NODE_OPTIONS: --max_old_space_size=6144
|
NODE_OPTIONS: --max_old_space_size=6144
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
@@ -25,11 +24,11 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out files from GitHub
|
- name: Check out files from GitHub
|
||||||
uses: actions/checkout@v3.5.2
|
uses: actions/checkout@v3.6.0
|
||||||
- name: Set up Node ${{ env.NODE_VERSION }}
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3.6.0
|
uses: actions/setup-node@v3.8.1
|
||||||
with:
|
with:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn install --immutable
|
run: yarn install --immutable
|
||||||
@@ -37,6 +36,14 @@ jobs:
|
|||||||
run: yarn dedupe --check
|
run: yarn dedupe --check
|
||||||
- name: Build resources
|
- name: Build resources
|
||||||
run: ./node_modules/.bin/gulp gen-icons-json build-translations build-locale-data gather-gallery-pages
|
run: ./node_modules/.bin/gulp gen-icons-json build-translations build-locale-data gather-gallery-pages
|
||||||
|
- name: Setup lint cache
|
||||||
|
uses: actions/cache@v3.3.1
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
node_modules/.cache/prettier
|
||||||
|
node_modules/.cache/eslint
|
||||||
|
key: lint-${{ github.sha }}
|
||||||
|
restore-keys: lint-
|
||||||
- name: Run eslint
|
- name: Run eslint
|
||||||
run: yarn run lint:eslint --quiet
|
run: yarn run lint:eslint --quiet
|
||||||
- name: Run tsc
|
- name: Run tsc
|
||||||
@@ -48,11 +55,11 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out files from GitHub
|
- name: Check out files from GitHub
|
||||||
uses: actions/checkout@v3.5.2
|
uses: actions/checkout@v3.6.0
|
||||||
- name: Set up Node ${{ env.NODE_VERSION }}
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3.6.0
|
uses: actions/setup-node@v3.8.1
|
||||||
with:
|
with:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn install --immutable
|
run: yarn install --immutable
|
||||||
@@ -66,11 +73,11 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out files from GitHub
|
- name: Check out files from GitHub
|
||||||
uses: actions/checkout@v3.5.2
|
uses: actions/checkout@v3.6.0
|
||||||
- name: Set up Node ${{ env.NODE_VERSION }}
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3.6.0
|
uses: actions/setup-node@v3.8.1
|
||||||
with:
|
with:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn install --immutable
|
run: yarn install --immutable
|
||||||
@@ -84,11 +91,11 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out files from GitHub
|
- name: Check out files from GitHub
|
||||||
uses: actions/checkout@v3.5.2
|
uses: actions/checkout@v3.6.0
|
||||||
- name: Set up Node ${{ env.NODE_VERSION }}
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3.6.0
|
uses: actions/setup-node@v3.8.1
|
||||||
with:
|
with:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn install --immutable
|
run: yarn install --immutable
|
||||||
|
4
.github/workflows/codeql-analysis.yml
vendored
4
.github/workflows/codeql-analysis.yml
vendored
@@ -17,13 +17,13 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
# Override automatic language detection by changing the below list
|
# Override automatic language detection by changing the below list
|
||||||
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
|
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
|
||||||
language: ['javascript']
|
language: ["javascript"]
|
||||||
# Learn more...
|
# Learn more...
|
||||||
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
|
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3.5.2
|
uses: actions/checkout@v3.6.0
|
||||||
with:
|
with:
|
||||||
# We must fetch at least the immediate parents so that if this is
|
# We must fetch at least the immediate parents so that if this is
|
||||||
# a pull request then we can checkout the head.
|
# a pull request then we can checkout the head.
|
||||||
|
17
.github/workflows/demo_deployment.yaml
vendored
17
.github/workflows/demo_deployment.yaml
vendored
@@ -10,7 +10,6 @@ on:
|
|||||||
- master
|
- master
|
||||||
|
|
||||||
env:
|
env:
|
||||||
NODE_VERSION: 16
|
|
||||||
NODE_OPTIONS: --max_old_space_size=6144
|
NODE_OPTIONS: --max_old_space_size=6144
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -23,14 +22,14 @@ jobs:
|
|||||||
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out files from GitHub
|
- name: Check out files from GitHub
|
||||||
uses: actions/checkout@v3.5.2
|
uses: actions/checkout@v3.6.0
|
||||||
with:
|
with:
|
||||||
ref: dev
|
ref: dev
|
||||||
|
|
||||||
- name: Set up Node ${{ env.NODE_VERSION }}
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3.6.0
|
uses: actions/setup-node@v3.8.1
|
||||||
with:
|
with:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
@@ -59,14 +58,14 @@ jobs:
|
|||||||
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out files from GitHub
|
- name: Check out files from GitHub
|
||||||
uses: actions/checkout@v3.5.2
|
uses: actions/checkout@v3.6.0
|
||||||
with:
|
with:
|
||||||
ref: master
|
ref: master
|
||||||
|
|
||||||
- name: Set up Node ${{ env.NODE_VERSION }}
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3.6.0
|
uses: actions/setup-node@v3.8.1
|
||||||
with:
|
with:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
|
9
.github/workflows/design_deployment.yaml
vendored
9
.github/workflows/design_deployment.yaml
vendored
@@ -6,7 +6,6 @@ on:
|
|||||||
- cron: "0 0 * * *"
|
- cron: "0 0 * * *"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
NODE_VERSION: 16
|
|
||||||
NODE_OPTIONS: --max_old_space_size=6144
|
NODE_OPTIONS: --max_old_space_size=6144
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -17,12 +16,12 @@ jobs:
|
|||||||
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
||||||
steps:
|
steps:
|
||||||
- name: Check out files from GitHub
|
- name: Check out files from GitHub
|
||||||
uses: actions/checkout@v3.5.2
|
uses: actions/checkout@v3.6.0
|
||||||
|
|
||||||
- name: Set up Node ${{ env.NODE_VERSION }}
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3.6.0
|
uses: actions/setup-node@v3.8.1
|
||||||
with:
|
with:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
|
9
.github/workflows/design_preview.yaml
vendored
9
.github/workflows/design_preview.yaml
vendored
@@ -11,7 +11,6 @@ on:
|
|||||||
- dev
|
- dev
|
||||||
|
|
||||||
env:
|
env:
|
||||||
NODE_VERSION: 16
|
|
||||||
NODE_OPTIONS: --max_old_space_size=6144
|
NODE_OPTIONS: --max_old_space_size=6144
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -22,12 +21,12 @@ jobs:
|
|||||||
if: github.repository == 'home-assistant/frontend' && contains(github.event.pull_request.labels.*.name, 'needs design preview')
|
if: github.repository == 'home-assistant/frontend' && contains(github.event.pull_request.labels.*.name, 'needs design preview')
|
||||||
steps:
|
steps:
|
||||||
- name: Check out files from GitHub
|
- name: Check out files from GitHub
|
||||||
uses: actions/checkout@v3.5.2
|
uses: actions/checkout@v3.6.0
|
||||||
|
|
||||||
- name: Set up Node ${{ env.NODE_VERSION }}
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3.6.0
|
uses: actions/setup-node@v3.8.1
|
||||||
with:
|
with:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
|
15
.github/workflows/labeler.yaml
vendored
Normal file
15
.github/workflows/labeler.yaml
vendored
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
name: "Pull Request Labeler"
|
||||||
|
|
||||||
|
on: pull_request_target
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
triage:
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Apply labels
|
||||||
|
uses: actions/labeler@v4.3.0
|
||||||
|
with:
|
||||||
|
sync-labels: true
|
2
.github/workflows/lock.yml
vendored
2
.github/workflows/lock.yml
vendored
@@ -9,7 +9,7 @@ jobs:
|
|||||||
lock:
|
lock:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: dessant/lock-threads@v4.0.0
|
- uses: dessant/lock-threads@v4.0.1
|
||||||
with:
|
with:
|
||||||
github-token: ${{ github.token }}
|
github-token: ${{ github.token }}
|
||||||
issue-lock-inactive-days: "30"
|
issue-lock-inactive-days: "30"
|
||||||
|
11
.github/workflows/nightly.yaml
vendored
11
.github/workflows/nightly.yaml
vendored
@@ -6,8 +6,7 @@ on:
|
|||||||
- cron: "0 1 * * *"
|
- cron: "0 1 * * *"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
PYTHON_VERSION: "3.10"
|
PYTHON_VERSION: "3.11"
|
||||||
NODE_VERSION: 16
|
|
||||||
NODE_OPTIONS: --max_old_space_size=6144
|
NODE_OPTIONS: --max_old_space_size=6144
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
@@ -21,17 +20,17 @@ jobs:
|
|||||||
contents: write
|
contents: write
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout the repository
|
- name: Checkout the repository
|
||||||
uses: actions/checkout@v3.5.2
|
uses: actions/checkout@v3.6.0
|
||||||
|
|
||||||
- name: Set up Python ${{ env.PYTHON_VERSION }}
|
- name: Set up Python ${{ env.PYTHON_VERSION }}
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: ${{ env.PYTHON_VERSION }}
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
|
|
||||||
- name: Set up Node ${{ env.NODE_VERSION }}
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3.6.0
|
uses: actions/setup-node@v3.8.1
|
||||||
with:
|
with:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
|
9
.github/workflows/release-drafter.yaml
vendored
9
.github/workflows/release-drafter.yaml
vendored
@@ -5,8 +5,17 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- dev
|
- dev
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update_release_draft:
|
update_release_draft:
|
||||||
|
permissions:
|
||||||
|
# write permission for contents is required to create a github release
|
||||||
|
contents: write
|
||||||
|
# write permission for pull-requests is required for autolabeler
|
||||||
|
# otherwise, read permission is required at least
|
||||||
|
pull-requests: read
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: release-drafter/release-drafter@v5
|
- uses: release-drafter/release-drafter@v5
|
||||||
|
15
.github/workflows/release.yaml
vendored
15
.github/workflows/release.yaml
vendored
@@ -6,8 +6,7 @@ on:
|
|||||||
- published
|
- published
|
||||||
|
|
||||||
env:
|
env:
|
||||||
PYTHON_VERSION: "3.10"
|
PYTHON_VERSION: "3.11"
|
||||||
NODE_VERSION: 16
|
|
||||||
NODE_OPTIONS: --max_old_space_size=6144
|
NODE_OPTIONS: --max_old_space_size=6144
|
||||||
|
|
||||||
# Set default workflow permissions
|
# Set default workflow permissions
|
||||||
@@ -24,7 +23,7 @@ jobs:
|
|||||||
contents: write # Required to upload release assets
|
contents: write # Required to upload release assets
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout the repository
|
- name: Checkout the repository
|
||||||
uses: actions/checkout@v3.5.2
|
uses: actions/checkout@v3.6.0
|
||||||
|
|
||||||
- name: Verify version
|
- name: Verify version
|
||||||
uses: home-assistant/actions/helpers/verify-version@master
|
uses: home-assistant/actions/helpers/verify-version@master
|
||||||
@@ -34,10 +33,10 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
python-version: ${{ env.PYTHON_VERSION }}
|
python-version: ${{ env.PYTHON_VERSION }}
|
||||||
|
|
||||||
- name: Set up Node ${{ env.NODE_VERSION }}
|
- name: Setup Node
|
||||||
uses: actions/setup-node@v3.6.0
|
uses: actions/setup-node@v3.8.1
|
||||||
with:
|
with:
|
||||||
node-version: ${{ env.NODE_VERSION }}
|
node-version-file: ".nvmrc"
|
||||||
cache: yarn
|
cache: yarn
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
@@ -75,9 +74,9 @@ jobs:
|
|||||||
echo "home-assistant-frontend==$version" > ./requirements.txt
|
echo "home-assistant-frontend==$version" > ./requirements.txt
|
||||||
|
|
||||||
- name: Build wheels
|
- name: Build wheels
|
||||||
uses: home-assistant/wheels@2022.10.1
|
uses: home-assistant/wheels@2023.04.0
|
||||||
with:
|
with:
|
||||||
abi: cp310
|
abi: cp311
|
||||||
tag: musllinux_1_2
|
tag: musllinux_1_2
|
||||||
arch: amd64
|
arch: amd64
|
||||||
wheels-key: ${{ secrets.WHEELS_KEY }}
|
wheels-key: ${{ secrets.WHEELS_KEY }}
|
||||||
|
6
.github/workflows/translations.yaml
vendored
6
.github/workflows/translations.yaml
vendored
@@ -7,19 +7,15 @@ on:
|
|||||||
paths:
|
paths:
|
||||||
- src/translations/en.json
|
- src/translations/en.json
|
||||||
|
|
||||||
env:
|
|
||||||
NODE_VERSION: 16
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
upload:
|
upload:
|
||||||
name: Upload
|
name: Upload
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout the repository
|
- name: Checkout the repository
|
||||||
uses: actions/checkout@v3.5.2
|
uses: actions/checkout@v3.6.0
|
||||||
|
|
||||||
- name: Upload Translations
|
- name: Upload Translations
|
||||||
run: |
|
run: |
|
||||||
export LOKALISE_TOKEN="${{ secrets.LOKALISE_TOKEN }}"
|
export LOKALISE_TOKEN="${{ secrets.LOKALISE_TOKEN }}"
|
||||||
|
|
||||||
./script/translations_upload_base
|
./script/translations_upload_base
|
||||||
|
@@ -1,9 +1,3 @@
|
|||||||
build
|
CLA.md
|
||||||
translations/*
|
CODE_OF_CONDUCT.md
|
||||||
node_modules/*
|
LICENSE.md
|
||||||
hass_frontend/*
|
|
||||||
pip-selfcheck.json
|
|
||||||
|
|
||||||
# vscode
|
|
||||||
.vscode/*
|
|
||||||
!.vscode/extensions.json
|
|
||||||
|
6
.vscode/launch.json
vendored
6
.vscode/launch.json
vendored
@@ -9,9 +9,7 @@
|
|||||||
"webRoot": "${workspaceFolder}/hass_frontend",
|
"webRoot": "${workspaceFolder}/hass_frontend",
|
||||||
"disableNetworkCache": true,
|
"disableNetworkCache": true,
|
||||||
"preLaunchTask": "Develop Frontend",
|
"preLaunchTask": "Develop Frontend",
|
||||||
"outFiles": [
|
"outFiles": ["${workspaceFolder}/hass_frontend/frontend_latest/*.js"]
|
||||||
"${workspaceFolder}/hass_frontend/frontend_latest/*.js"
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Debug Gallery",
|
"name": "Debug Gallery",
|
||||||
@@ -39,6 +37,6 @@
|
|||||||
"webRoot": "${workspaceFolder}/cast/dist",
|
"webRoot": "${workspaceFolder}/cast/dist",
|
||||||
"disableNetworkCache": true,
|
"disableNetworkCache": true,
|
||||||
"preLaunchTask": "Develop Cast"
|
"preLaunchTask": "Develop Cast"
|
||||||
},
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
13
.yarn/patches/leaflet-draw-npm-1.0.4-0ca0ebcf65.patch
Normal file
13
.yarn/patches/leaflet-draw-npm-1.0.4-0ca0ebcf65.patch
Normal file
File diff suppressed because one or more lines are too long
39
.yarn/patches/sortablejs-npm-1.15.0-f3a393abcc.patch
Normal file
39
.yarn/patches/sortablejs-npm-1.15.0-f3a393abcc.patch
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
diff --git a/modular/sortable.complete.esm.js b/modular/sortable.complete.esm.js
|
||||||
|
index 02e9f2d6bebeb430fe6e7c1cc3f9c3c9df051f14..bb8268b0844a1faa4108cc92c0be2a3dbaf23f83 100644
|
||||||
|
--- a/modular/sortable.complete.esm.js
|
||||||
|
+++ b/modular/sortable.complete.esm.js
|
||||||
|
@@ -1657,7 +1657,7 @@ Sortable.prototype =
|
||||||
|
target = parent; // store last element
|
||||||
|
}
|
||||||
|
/* jshint boss:true */
|
||||||
|
- while (parent = parent.parentNode);
|
||||||
|
+ while (parent = parent.parentNode || parent.getRootNode().host);
|
||||||
|
}
|
||||||
|
|
||||||
|
_unhideGhostForTarget();
|
||||||
|
diff --git a/modular/sortable.core.esm.js b/modular/sortable.core.esm.js
|
||||||
|
index b04c8b4634f7c6b4ef1aadbb48afe6564306dea9..39a107163c8c336ebd669b5ea8a936af87e1c1e7 100644
|
||||||
|
--- a/modular/sortable.core.esm.js
|
||||||
|
+++ b/modular/sortable.core.esm.js
|
||||||
|
@@ -1657,7 +1657,7 @@ Sortable.prototype =
|
||||||
|
target = parent; // store last element
|
||||||
|
}
|
||||||
|
/* jshint boss:true */
|
||||||
|
- while (parent = parent.parentNode);
|
||||||
|
+ while (parent = parent.parentNode || parent.getRootNode().host);
|
||||||
|
}
|
||||||
|
|
||||||
|
_unhideGhostForTarget();
|
||||||
|
diff --git a/modular/sortable.esm.js b/modular/sortable.esm.js
|
||||||
|
index 6ec7ed1bb557e21c2578200161e989c65d23150b..0a05475a22904472fac6c13f524c674da76584b0 100644
|
||||||
|
--- a/modular/sortable.esm.js
|
||||||
|
+++ b/modular/sortable.esm.js
|
||||||
|
@@ -1657,7 +1657,7 @@ Sortable.prototype =
|
||||||
|
target = parent; // store last element
|
||||||
|
}
|
||||||
|
/* jshint boss:true */
|
||||||
|
- while (parent = parent.parentNode);
|
||||||
|
+ while (parent = parent.parentNode || parent.getRootNode().host);
|
||||||
|
}
|
||||||
|
|
||||||
|
_unhideGhostForTarget();
|
File diff suppressed because one or more lines are too long
@@ -8,4 +8,4 @@ plugins:
|
|||||||
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
||||||
spec: "@yarnpkg/plugin-interactive-tools"
|
spec: "@yarnpkg/plugin-interactive-tools"
|
||||||
|
|
||||||
yarnPath: .yarn/releases/yarn-3.5.0.cjs
|
yarnPath: .yarn/releases/yarn-3.6.3.cjs
|
||||||
|
@@ -8,7 +8,7 @@ module.exports.sourceMapURL = () => {
|
|||||||
const ref = env.version().endsWith("dev")
|
const ref = env.version().endsWith("dev")
|
||||||
? process.env.GITHUB_SHA || "dev"
|
? process.env.GITHUB_SHA || "dev"
|
||||||
: env.version();
|
: env.version();
|
||||||
return `https://raw.githubusercontent.com/home-assistant/frontend/${ref}`;
|
return `https://raw.githubusercontent.com/home-assistant/frontend/${ref}/`;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Files from NPM Packages that should not be imported
|
// Files from NPM Packages that should not be imported
|
||||||
@@ -76,7 +76,8 @@ module.exports.htmlMinifierOptions = {
|
|||||||
|
|
||||||
module.exports.terserOptions = ({ latestBuild, isTestBuild }) => ({
|
module.exports.terserOptions = ({ latestBuild, isTestBuild }) => ({
|
||||||
safari10: !latestBuild,
|
safari10: !latestBuild,
|
||||||
ecma: latestBuild ? undefined : 5,
|
ecma: latestBuild ? 2015 : 5,
|
||||||
|
module: latestBuild,
|
||||||
format: { comments: false },
|
format: { comments: false },
|
||||||
sourceMap: !isTestBuild,
|
sourceMap: !isTestBuild,
|
||||||
});
|
});
|
||||||
@@ -84,17 +85,25 @@ module.exports.terserOptions = ({ latestBuild, isTestBuild }) => ({
|
|||||||
module.exports.babelOptions = ({ latestBuild, isProdBuild, isTestBuild }) => ({
|
module.exports.babelOptions = ({ latestBuild, isProdBuild, isTestBuild }) => ({
|
||||||
babelrc: false,
|
babelrc: false,
|
||||||
compact: false,
|
compact: false,
|
||||||
|
assumptions: {
|
||||||
|
privateFieldsAsProperties: true,
|
||||||
|
setPublicClassFields: true,
|
||||||
|
setSpreadProperties: true,
|
||||||
|
},
|
||||||
|
browserslistEnv: latestBuild ? "modern" : "legacy",
|
||||||
|
// Must be unambiguous because some dependencies are CommonJS only
|
||||||
|
sourceType: "unambiguous",
|
||||||
presets: [
|
presets: [
|
||||||
!latestBuild && [
|
[
|
||||||
"@babel/preset-env",
|
"@babel/preset-env",
|
||||||
{
|
{
|
||||||
useBuiltIns: "entry",
|
useBuiltIns: latestBuild ? false : "entry",
|
||||||
corejs: { version: "3.30", proposals: true },
|
corejs: latestBuild ? false : { version: "3.32", proposals: true },
|
||||||
bugfixes: true,
|
bugfixes: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
"@babel/preset-typescript",
|
"@babel/preset-typescript",
|
||||||
].filter(Boolean),
|
],
|
||||||
plugins: [
|
plugins: [
|
||||||
[
|
[
|
||||||
path.resolve(
|
path.resolve(
|
||||||
@@ -106,22 +115,6 @@ module.exports.babelOptions = ({ latestBuild, isProdBuild, isTestBuild }) => ({
|
|||||||
ignoreModuleNotFound: true,
|
ignoreModuleNotFound: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
// Part of ES2018. Converts {...a, b: 2} to Object.assign({}, a, {b: 2})
|
|
||||||
!latestBuild && [
|
|
||||||
"@babel/plugin-proposal-object-rest-spread",
|
|
||||||
{ loose: true, useBuiltIns: true },
|
|
||||||
],
|
|
||||||
// Only support the syntax, Webpack will handle it.
|
|
||||||
"@babel/plugin-syntax-import-meta",
|
|
||||||
"@babel/plugin-syntax-dynamic-import",
|
|
||||||
"@babel/plugin-syntax-top-level-await",
|
|
||||||
// Support various proposals
|
|
||||||
"@babel/plugin-proposal-optional-chaining",
|
|
||||||
"@babel/plugin-proposal-nullish-coalescing-operator",
|
|
||||||
["@babel/plugin-proposal-decorators", { decoratorsBeforeExport: true }],
|
|
||||||
["@babel/plugin-proposal-private-methods", { loose: true }],
|
|
||||||
["@babel/plugin-proposal-private-property-in-object", { loose: true }],
|
|
||||||
["@babel/plugin-proposal-class-properties", { loose: true }],
|
|
||||||
// Minify template literals for production
|
// Minify template literals for production
|
||||||
isProdBuild && [
|
isProdBuild && [
|
||||||
"template-html-minifier",
|
"template-html-minifier",
|
||||||
@@ -139,6 +132,13 @@ module.exports.babelOptions = ({ latestBuild, isProdBuild, isTestBuild }) => ({
|
|||||||
failOnError: true, // we can turn this off in case of false positives
|
failOnError: true, // we can turn this off in case of false positives
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
// Import helpers and regenerator from runtime package
|
||||||
|
[
|
||||||
|
"@babel/plugin-transform-runtime",
|
||||||
|
{ version: require("../package.json").dependencies["@babel/runtime"] },
|
||||||
|
],
|
||||||
|
// Support some proposals still in TC39 process
|
||||||
|
["@babel/plugin-proposal-decorators", { decoratorsBeforeExport: true }],
|
||||||
].filter(Boolean),
|
].filter(Boolean),
|
||||||
exclude: [
|
exclude: [
|
||||||
// \\ for Windows, / for Mac OS and Linux
|
// \\ for Windows, / for Mac OS and Linux
|
||||||
@@ -260,6 +260,7 @@ module.exports.config = {
|
|||||||
isHassioBuild: true,
|
isHassioBuild: true,
|
||||||
defineOverlay: {
|
defineOverlay: {
|
||||||
__SUPERVISOR__: true,
|
__SUPERVISOR__: true,
|
||||||
|
__STATIC_PATH__: `"${paths.hassio_publicPath}/static/"`,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
@@ -1,18 +1,16 @@
|
|||||||
// Run HA develop mode
|
import gulp from "gulp";
|
||||||
|
import env from "../env.cjs";
|
||||||
const gulp = require("gulp");
|
import "./clean.js";
|
||||||
const env = require("../env.cjs");
|
import "./compress.js";
|
||||||
require("./clean.cjs");
|
import "./entry-html.js";
|
||||||
require("./translations.cjs");
|
import "./gather-static.js";
|
||||||
require("./locale-data.cjs");
|
import "./gen-icons-json.js";
|
||||||
require("./gen-icons-json.cjs");
|
import "./locale-data.js";
|
||||||
require("./gather-static.cjs");
|
import "./rollup.js";
|
||||||
require("./compress.cjs");
|
import "./service-worker.js";
|
||||||
require("./webpack.cjs");
|
import "./translations.js";
|
||||||
require("./service-worker.cjs");
|
import "./wds.js";
|
||||||
require("./entry-html.cjs");
|
import "./webpack.js";
|
||||||
require("./rollup.cjs");
|
|
||||||
require("./wds.cjs");
|
|
||||||
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
"develop-app",
|
"develop-app",
|
||||||
@@ -24,8 +22,7 @@ gulp.task(
|
|||||||
gulp.parallel(
|
gulp.parallel(
|
||||||
"gen-service-worker-app-dev",
|
"gen-service-worker-app-dev",
|
||||||
"gen-icons-json",
|
"gen-icons-json",
|
||||||
"gen-pages-dev",
|
"gen-pages-app-dev",
|
||||||
"gen-index-app-dev",
|
|
||||||
"build-translations",
|
"build-translations",
|
||||||
"build-locale-data"
|
"build-locale-data"
|
||||||
),
|
),
|
||||||
@@ -50,10 +47,6 @@ gulp.task(
|
|||||||
env.useRollup() ? "rollup-prod-app" : "webpack-prod-app",
|
env.useRollup() ? "rollup-prod-app" : "webpack-prod-app",
|
||||||
// Don't compress running tests
|
// Don't compress running tests
|
||||||
...(env.isTestBuild() ? [] : ["compress-app"]),
|
...(env.isTestBuild() ? [] : ["compress-app"]),
|
||||||
gulp.parallel(
|
gulp.parallel("gen-pages-app-prod", "gen-service-worker-app-prod")
|
||||||
"gen-pages-prod",
|
|
||||||
"gen-index-app-prod",
|
|
||||||
"gen-service-worker-app-prod"
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
);
|
);
|
@@ -1,13 +1,12 @@
|
|||||||
const gulp = require("gulp");
|
import gulp from "gulp";
|
||||||
const env = require("../env.cjs");
|
import env from "../env.cjs";
|
||||||
|
import "./clean.js";
|
||||||
require("./clean.cjs");
|
import "./entry-html.js";
|
||||||
require("./translations.cjs");
|
import "./gather-static.js";
|
||||||
require("./gather-static.cjs");
|
import "./rollup.js";
|
||||||
require("./webpack.cjs");
|
import "./service-worker.js";
|
||||||
require("./service-worker.cjs");
|
import "./translations.js";
|
||||||
require("./entry-html.cjs");
|
import "./webpack.js";
|
||||||
require("./rollup.cjs");
|
|
||||||
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
"develop-cast",
|
"develop-cast",
|
||||||
@@ -19,7 +18,7 @@ gulp.task(
|
|||||||
"translations-enable-merge-backend",
|
"translations-enable-merge-backend",
|
||||||
gulp.parallel("gen-icons-json", "build-translations", "build-locale-data"),
|
gulp.parallel("gen-icons-json", "build-translations", "build-locale-data"),
|
||||||
"copy-static-cast",
|
"copy-static-cast",
|
||||||
"gen-index-cast-dev",
|
"gen-pages-cast-dev",
|
||||||
env.useRollup() ? "rollup-dev-server-cast" : "webpack-dev-server-cast"
|
env.useRollup() ? "rollup-dev-server-cast" : "webpack-dev-server-cast"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -35,6 +34,6 @@ gulp.task(
|
|||||||
gulp.parallel("gen-icons-json", "build-translations", "build-locale-data"),
|
gulp.parallel("gen-icons-json", "build-translations", "build-locale-data"),
|
||||||
"copy-static-cast",
|
"copy-static-cast",
|
||||||
env.useRollup() ? "rollup-prod-cast" : "webpack-prod-cast",
|
env.useRollup() ? "rollup-prod-cast" : "webpack-prod-cast",
|
||||||
"gen-index-cast-prod"
|
"gen-pages-cast-prod"
|
||||||
)
|
)
|
||||||
);
|
);
|
@@ -1,37 +1,37 @@
|
|||||||
const del = import("del");
|
import { deleteSync } from "del";
|
||||||
const gulp = require("gulp");
|
import gulp from "gulp";
|
||||||
const paths = require("../paths.cjs");
|
import paths from "../paths.cjs";
|
||||||
require("./translations.cjs");
|
import "./translations.js";
|
||||||
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
"clean",
|
"clean",
|
||||||
gulp.parallel("clean-translations", async () =>
|
gulp.parallel("clean-translations", async () =>
|
||||||
(await del).deleteSync([paths.app_output_root, paths.build_dir])
|
deleteSync([paths.app_output_root, paths.build_dir])
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
"clean-demo",
|
"clean-demo",
|
||||||
gulp.parallel("clean-translations", async () =>
|
gulp.parallel("clean-translations", async () =>
|
||||||
(await del).deleteSync([paths.demo_output_root, paths.build_dir])
|
deleteSync([paths.demo_output_root, paths.build_dir])
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
"clean-cast",
|
"clean-cast",
|
||||||
gulp.parallel("clean-translations", async () =>
|
gulp.parallel("clean-translations", async () =>
|
||||||
(await del).deleteSync([paths.cast_output_root, paths.build_dir])
|
deleteSync([paths.cast_output_root, paths.build_dir])
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
gulp.task("clean-hassio", async () =>
|
gulp.task("clean-hassio", async () =>
|
||||||
(await del).deleteSync([paths.hassio_output_root, paths.build_dir])
|
deleteSync([paths.hassio_output_root, paths.build_dir])
|
||||||
);
|
);
|
||||||
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
"clean-gallery",
|
"clean-gallery",
|
||||||
gulp.parallel("clean-translations", async () =>
|
gulp.parallel("clean-translations", async () =>
|
||||||
(await del).deleteSync([
|
deleteSync([
|
||||||
paths.gallery_output_root,
|
paths.gallery_output_root,
|
||||||
paths.gallery_build,
|
paths.gallery_build,
|
||||||
paths.build_dir,
|
paths.build_dir,
|
@@ -1,45 +0,0 @@
|
|||||||
// Tasks to compress
|
|
||||||
|
|
||||||
const gulp = require("gulp");
|
|
||||||
const zopfli = require("gulp-zopfli-green");
|
|
||||||
const merge = require("merge-stream");
|
|
||||||
const path = require("path");
|
|
||||||
const paths = require("../paths.cjs");
|
|
||||||
|
|
||||||
const zopfliOptions = { threshold: 150 };
|
|
||||||
|
|
||||||
gulp.task("compress-app", function compressApp() {
|
|
||||||
const jsLatest = gulp
|
|
||||||
.src(path.resolve(paths.app_output_latest, "**/*.js"))
|
|
||||||
.pipe(zopfli(zopfliOptions))
|
|
||||||
.pipe(gulp.dest(paths.app_output_latest));
|
|
||||||
|
|
||||||
const jsEs5 = gulp
|
|
||||||
.src(path.resolve(paths.app_output_es5, "**/*.js"))
|
|
||||||
.pipe(zopfli(zopfliOptions))
|
|
||||||
.pipe(gulp.dest(paths.app_output_es5));
|
|
||||||
|
|
||||||
const polyfills = gulp
|
|
||||||
.src(path.resolve(paths.app_output_static, "polyfills/*.js"))
|
|
||||||
.pipe(zopfli(zopfliOptions))
|
|
||||||
.pipe(gulp.dest(path.resolve(paths.app_output_static, "polyfills")));
|
|
||||||
|
|
||||||
const translations = gulp
|
|
||||||
.src(path.resolve(paths.app_output_static, "translations/**/*.json"))
|
|
||||||
.pipe(zopfli(zopfliOptions))
|
|
||||||
.pipe(gulp.dest(path.resolve(paths.app_output_static, "translations")));
|
|
||||||
|
|
||||||
const icons = gulp
|
|
||||||
.src(path.resolve(paths.app_output_static, "mdi/*.json"))
|
|
||||||
.pipe(zopfli(zopfliOptions))
|
|
||||||
.pipe(gulp.dest(path.resolve(paths.app_output_static, "mdi")));
|
|
||||||
|
|
||||||
return merge(jsLatest, jsEs5, polyfills, translations, icons);
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task("compress-hassio", function compressApp() {
|
|
||||||
return gulp
|
|
||||||
.src(path.resolve(paths.hassio_output_root, "**/*.js"))
|
|
||||||
.pipe(zopfli(zopfliOptions))
|
|
||||||
.pipe(gulp.dest(paths.hassio_output_root));
|
|
||||||
});
|
|
16
build-scripts/gulp/compress.js
Normal file
16
build-scripts/gulp/compress.js
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
// Tasks to compress
|
||||||
|
|
||||||
|
import gulp from "gulp";
|
||||||
|
import zopfli from "gulp-zopfli-green";
|
||||||
|
import paths from "../paths.cjs";
|
||||||
|
|
||||||
|
const zopfliOptions = { threshold: 150 };
|
||||||
|
|
||||||
|
const compressDist = (rootDir) =>
|
||||||
|
gulp
|
||||||
|
.src([`${rootDir}/**/*.{js,json,css,svg}`])
|
||||||
|
.pipe(zopfli(zopfliOptions))
|
||||||
|
.pipe(gulp.dest(rootDir));
|
||||||
|
|
||||||
|
gulp.task("compress-app", () => compressDist(paths.app_output_root));
|
||||||
|
gulp.task("compress-hassio", () => compressDist(paths.hassio_output_root));
|
@@ -1,15 +1,13 @@
|
|||||||
// Run demo develop mode
|
import gulp from "gulp";
|
||||||
const gulp = require("gulp");
|
import env from "../env.cjs";
|
||||||
const env = require("../env.cjs");
|
import "./clean.js";
|
||||||
|
import "./entry-html.js";
|
||||||
require("./clean.cjs");
|
import "./gather-static.js";
|
||||||
require("./translations.cjs");
|
import "./gen-icons-json.js";
|
||||||
require("./gen-icons-json.cjs");
|
import "./rollup.js";
|
||||||
require("./gather-static.cjs");
|
import "./service-worker.js";
|
||||||
require("./webpack.cjs");
|
import "./translations.js";
|
||||||
require("./service-worker.cjs");
|
import "./webpack.js";
|
||||||
require("./entry-html.cjs");
|
|
||||||
require("./rollup.cjs");
|
|
||||||
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
"develop-demo",
|
"develop-demo",
|
||||||
@@ -21,7 +19,7 @@ gulp.task(
|
|||||||
"translations-enable-merge-backend",
|
"translations-enable-merge-backend",
|
||||||
gulp.parallel(
|
gulp.parallel(
|
||||||
"gen-icons-json",
|
"gen-icons-json",
|
||||||
"gen-index-demo-dev",
|
"gen-pages-demo-dev",
|
||||||
"build-translations",
|
"build-translations",
|
||||||
"build-locale-data"
|
"build-locale-data"
|
||||||
),
|
),
|
||||||
@@ -42,6 +40,6 @@ gulp.task(
|
|||||||
gulp.parallel("gen-icons-json", "build-translations", "build-locale-data"),
|
gulp.parallel("gen-icons-json", "build-translations", "build-locale-data"),
|
||||||
"copy-static-demo",
|
"copy-static-demo",
|
||||||
env.useRollup() ? "rollup-prod-demo" : "webpack-prod-demo",
|
env.useRollup() ? "rollup-prod-demo" : "webpack-prod-demo",
|
||||||
"gen-index-demo-prod"
|
"gen-pages-demo-prod"
|
||||||
)
|
)
|
||||||
);
|
);
|
@@ -1,6 +1,7 @@
|
|||||||
const gulp = require("gulp");
|
import fs from "fs/promises";
|
||||||
const fs = require("fs/promises");
|
import gulp from "gulp";
|
||||||
const mapStream = require("map-stream");
|
import mapStream from "map-stream";
|
||||||
|
import transform from "gulp-json-transform";
|
||||||
|
|
||||||
const inDirFrontend = "translations/frontend";
|
const inDirFrontend = "translations/frontend";
|
||||||
const inDirBackend = "translations/backend";
|
const inDirBackend = "translations/backend";
|
||||||
@@ -41,8 +42,33 @@ function checkHtml() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Backend translations do not currently pass HTML check so are excluded here for now
|
function convertBackendTranslations(data, _file) {
|
||||||
|
const output = { component: {} };
|
||||||
|
if (!data.component) {
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
Object.keys(data.component).forEach((domain) => {
|
||||||
|
if (!("entity_component" in data.component[domain])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
output.component[domain] = { entity_component: {} };
|
||||||
|
Object.keys(data.component[domain].entity_component).forEach((key) => {
|
||||||
|
output.component[domain].entity_component[key] =
|
||||||
|
data.component[domain].entity_component[key];
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
gulp.task("convert-backend-translations", function () {
|
||||||
|
return gulp
|
||||||
|
.src([`${inDirBackend}/*.json`])
|
||||||
|
.pipe(transform((data, file) => convertBackendTranslations(data, file)))
|
||||||
|
.pipe(gulp.dest(inDirBackend));
|
||||||
|
});
|
||||||
|
|
||||||
gulp.task("check-translations-html", function () {
|
gulp.task("check-translations-html", function () {
|
||||||
|
// We exclude backend translations because they are not compliant with the HTML rule for now
|
||||||
return gulp.src([`${inDirFrontend}/*.json`]).pipe(checkHtml());
|
return gulp.src([`${inDirFrontend}/*.json`]).pipe(checkHtml());
|
||||||
});
|
});
|
||||||
|
|
@@ -1,351 +0,0 @@
|
|||||||
// Tasks to generate entry HTML
|
|
||||||
const gulp = require("gulp");
|
|
||||||
const fs = require("fs-extra");
|
|
||||||
const path = require("path");
|
|
||||||
const template = require("lodash.template");
|
|
||||||
const { minify } = require("html-minifier-terser");
|
|
||||||
const paths = require("../paths.cjs");
|
|
||||||
const env = require("../env.cjs");
|
|
||||||
const { htmlMinifierOptions, terserOptions } = require("../bundle.cjs");
|
|
||||||
|
|
||||||
const templatePath = (tpl) =>
|
|
||||||
path.resolve(paths.polymer_dir, "src/html/", `${tpl}.html.template`);
|
|
||||||
|
|
||||||
const readFile = (pth) => fs.readFileSync(pth).toString();
|
|
||||||
|
|
||||||
const renderTemplate = (pth, data = {}, pathFunc = templatePath) => {
|
|
||||||
const compiled = template(readFile(pathFunc(pth)));
|
|
||||||
return compiled({
|
|
||||||
...data,
|
|
||||||
useRollup: env.useRollup(),
|
|
||||||
useWDS: env.useWDS(),
|
|
||||||
renderTemplate,
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const renderDemoTemplate = (pth, data = {}) =>
|
|
||||||
renderTemplate(pth, data, (tpl) =>
|
|
||||||
path.resolve(paths.demo_dir, "src/html/", `${tpl}.html.template`)
|
|
||||||
);
|
|
||||||
|
|
||||||
const renderCastTemplate = (pth, data = {}) =>
|
|
||||||
renderTemplate(pth, data, (tpl) =>
|
|
||||||
path.resolve(paths.cast_dir, "src/html/", `${tpl}.html.template`)
|
|
||||||
);
|
|
||||||
|
|
||||||
const renderGalleryTemplate = (pth, data = {}) =>
|
|
||||||
renderTemplate(pth, data, (tpl) =>
|
|
||||||
path.resolve(paths.gallery_dir, "src/html/", `${tpl}.html.template`)
|
|
||||||
);
|
|
||||||
|
|
||||||
const minifyHtml = (content) =>
|
|
||||||
minify(content, {
|
|
||||||
...htmlMinifierOptions,
|
|
||||||
conservativeCollapse: false,
|
|
||||||
minifyJS: terserOptions({
|
|
||||||
latestBuild: false, // Shared scripts should be ES5
|
|
||||||
isTestBuild: true, // Don't need source maps
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
|
|
||||||
const PAGES = ["onboarding", "authorize"];
|
|
||||||
|
|
||||||
gulp.task("gen-pages-dev", (done) => {
|
|
||||||
for (const page of PAGES) {
|
|
||||||
const content = renderTemplate(page, {
|
|
||||||
latestPageJS: `/frontend_latest/${page}.js`,
|
|
||||||
|
|
||||||
es5PageJS: `/frontend_es5/${page}.js`,
|
|
||||||
});
|
|
||||||
|
|
||||||
fs.outputFileSync(
|
|
||||||
path.resolve(paths.app_output_root, `${page}.html`),
|
|
||||||
content
|
|
||||||
);
|
|
||||||
}
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task("gen-pages-prod", async () => {
|
|
||||||
const latestManifest = require(path.resolve(
|
|
||||||
paths.app_output_latest,
|
|
||||||
"manifest.json"
|
|
||||||
));
|
|
||||||
const es5Manifest = require(path.resolve(
|
|
||||||
paths.app_output_es5,
|
|
||||||
"manifest.json"
|
|
||||||
));
|
|
||||||
|
|
||||||
const minifiedHTML = [];
|
|
||||||
for (const page of PAGES) {
|
|
||||||
const content = renderTemplate(page, {
|
|
||||||
latestPageJS: latestManifest[`${page}.js`],
|
|
||||||
es5PageJS: es5Manifest[`${page}.js`],
|
|
||||||
});
|
|
||||||
|
|
||||||
minifiedHTML.push(
|
|
||||||
minifyHtml(content).then((minified) =>
|
|
||||||
fs.outputFileSync(
|
|
||||||
path.resolve(paths.app_output_root, `${page}.html`),
|
|
||||||
minified
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
await Promise.all(minifiedHTML);
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task("gen-index-app-dev", (done) => {
|
|
||||||
let latestAppJS;
|
|
||||||
let latestCoreJS;
|
|
||||||
let latestCustomPanelJS;
|
|
||||||
|
|
||||||
if (env.useWDS()) {
|
|
||||||
latestAppJS = "http://localhost:8000/src/entrypoints/app.ts";
|
|
||||||
latestCoreJS = "http://localhost:8000/src/entrypoints/core.ts";
|
|
||||||
latestCustomPanelJS =
|
|
||||||
"http://localhost:8000/src/entrypoints/custom-panel.ts";
|
|
||||||
} else {
|
|
||||||
latestAppJS = "/frontend_latest/app.js";
|
|
||||||
latestCoreJS = "/frontend_latest/core.js";
|
|
||||||
latestCustomPanelJS = "/frontend_latest/custom-panel.js";
|
|
||||||
}
|
|
||||||
|
|
||||||
const content = renderTemplate("index", {
|
|
||||||
latestAppJS,
|
|
||||||
latestCoreJS,
|
|
||||||
latestCustomPanelJS,
|
|
||||||
|
|
||||||
es5AppJS: "/frontend_es5/app.js",
|
|
||||||
es5CoreJS: "/frontend_es5/core.js",
|
|
||||||
es5CustomPanelJS: "/frontend_es5/custom-panel.js",
|
|
||||||
}).replace(/#THEMEC/g, "{{ theme_color }}");
|
|
||||||
|
|
||||||
fs.outputFileSync(path.resolve(paths.app_output_root, "index.html"), content);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task("gen-index-app-prod", async () => {
|
|
||||||
const latestManifest = require(path.resolve(
|
|
||||||
paths.app_output_latest,
|
|
||||||
"manifest.json"
|
|
||||||
));
|
|
||||||
const es5Manifest = require(path.resolve(
|
|
||||||
paths.app_output_es5,
|
|
||||||
"manifest.json"
|
|
||||||
));
|
|
||||||
const content = renderTemplate("index", {
|
|
||||||
latestAppJS: latestManifest["app.js"],
|
|
||||||
latestCoreJS: latestManifest["core.js"],
|
|
||||||
latestCustomPanelJS: latestManifest["custom-panel.js"],
|
|
||||||
|
|
||||||
es5AppJS: es5Manifest["app.js"],
|
|
||||||
es5CoreJS: es5Manifest["core.js"],
|
|
||||||
es5CustomPanelJS: es5Manifest["custom-panel.js"],
|
|
||||||
});
|
|
||||||
const minified = (await minifyHtml(content)).replace(
|
|
||||||
/#THEMEC/g,
|
|
||||||
"{{ theme_color }}"
|
|
||||||
);
|
|
||||||
|
|
||||||
fs.outputFileSync(
|
|
||||||
path.resolve(paths.app_output_root, "index.html"),
|
|
||||||
minified
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task("gen-index-cast-dev", (done) => {
|
|
||||||
const contentReceiver = renderCastTemplate("receiver", {
|
|
||||||
latestReceiverJS: "/frontend_latest/receiver.js",
|
|
||||||
});
|
|
||||||
fs.outputFileSync(
|
|
||||||
path.resolve(paths.cast_output_root, "receiver.html"),
|
|
||||||
contentReceiver
|
|
||||||
);
|
|
||||||
|
|
||||||
const contentMedia = renderCastTemplate("media", {
|
|
||||||
latestMediaJS: "/frontend_latest/media.js",
|
|
||||||
es5MediaJS: "/frontend_es5/media.js",
|
|
||||||
});
|
|
||||||
fs.outputFileSync(
|
|
||||||
path.resolve(paths.cast_output_root, "media.html"),
|
|
||||||
contentMedia
|
|
||||||
);
|
|
||||||
|
|
||||||
const contentFAQ = renderCastTemplate("launcher-faq", {
|
|
||||||
latestLauncherJS: "/frontend_latest/launcher.js",
|
|
||||||
es5LauncherJS: "/frontend_es5/launcher.js",
|
|
||||||
});
|
|
||||||
fs.outputFileSync(
|
|
||||||
path.resolve(paths.cast_output_root, "faq.html"),
|
|
||||||
contentFAQ
|
|
||||||
);
|
|
||||||
|
|
||||||
const contentLauncher = renderCastTemplate("launcher", {
|
|
||||||
latestLauncherJS: "/frontend_latest/launcher.js",
|
|
||||||
es5LauncherJS: "/frontend_es5/launcher.js",
|
|
||||||
});
|
|
||||||
fs.outputFileSync(
|
|
||||||
path.resolve(paths.cast_output_root, "index.html"),
|
|
||||||
contentLauncher
|
|
||||||
);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task("gen-index-cast-prod", (done) => {
|
|
||||||
const latestManifest = require(path.resolve(
|
|
||||||
paths.cast_output_latest,
|
|
||||||
"manifest.json"
|
|
||||||
));
|
|
||||||
const es5Manifest = require(path.resolve(
|
|
||||||
paths.cast_output_es5,
|
|
||||||
"manifest.json"
|
|
||||||
));
|
|
||||||
|
|
||||||
const contentReceiver = renderCastTemplate("receiver", {
|
|
||||||
latestReceiverJS: latestManifest["receiver.js"],
|
|
||||||
});
|
|
||||||
fs.outputFileSync(
|
|
||||||
path.resolve(paths.cast_output_root, "receiver.html"),
|
|
||||||
contentReceiver
|
|
||||||
);
|
|
||||||
|
|
||||||
const contentMedia = renderCastTemplate("media", {
|
|
||||||
latestMediaJS: latestManifest["media.js"],
|
|
||||||
es5MediaJS: es5Manifest["media.js"],
|
|
||||||
});
|
|
||||||
fs.outputFileSync(
|
|
||||||
path.resolve(paths.cast_output_root, "media.html"),
|
|
||||||
contentMedia
|
|
||||||
);
|
|
||||||
|
|
||||||
const contentFAQ = renderCastTemplate("launcher-faq", {
|
|
||||||
latestLauncherJS: latestManifest["launcher.js"],
|
|
||||||
es5LauncherJS: es5Manifest["launcher.js"],
|
|
||||||
});
|
|
||||||
fs.outputFileSync(
|
|
||||||
path.resolve(paths.cast_output_root, "faq.html"),
|
|
||||||
contentFAQ
|
|
||||||
);
|
|
||||||
|
|
||||||
const contentLauncher = renderCastTemplate("launcher", {
|
|
||||||
latestLauncherJS: latestManifest["launcher.js"],
|
|
||||||
es5LauncherJS: es5Manifest["launcher.js"],
|
|
||||||
});
|
|
||||||
fs.outputFileSync(
|
|
||||||
path.resolve(paths.cast_output_root, "index.html"),
|
|
||||||
contentLauncher
|
|
||||||
);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task("gen-index-demo-dev", (done) => {
|
|
||||||
const content = renderDemoTemplate("index", {
|
|
||||||
latestDemoJS: "/frontend_latest/main.js",
|
|
||||||
|
|
||||||
es5DemoJS: "/frontend_es5/main.js",
|
|
||||||
});
|
|
||||||
|
|
||||||
fs.outputFileSync(
|
|
||||||
path.resolve(paths.demo_output_root, "index.html"),
|
|
||||||
content
|
|
||||||
);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task("gen-index-demo-prod", async () => {
|
|
||||||
const latestManifest = require(path.resolve(
|
|
||||||
paths.demo_output_latest,
|
|
||||||
"manifest.json"
|
|
||||||
));
|
|
||||||
const es5Manifest = require(path.resolve(
|
|
||||||
paths.demo_output_es5,
|
|
||||||
"manifest.json"
|
|
||||||
));
|
|
||||||
const content = renderDemoTemplate("index", {
|
|
||||||
latestDemoJS: latestManifest["main.js"],
|
|
||||||
|
|
||||||
es5DemoJS: es5Manifest["main.js"],
|
|
||||||
});
|
|
||||||
const minified = await minifyHtml(content);
|
|
||||||
|
|
||||||
fs.outputFileSync(
|
|
||||||
path.resolve(paths.demo_output_root, "index.html"),
|
|
||||||
minified
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task("gen-index-gallery-dev", (done) => {
|
|
||||||
const content = renderGalleryTemplate("index", {
|
|
||||||
latestGalleryJS: "./frontend_latest/entrypoint.js",
|
|
||||||
});
|
|
||||||
|
|
||||||
fs.outputFileSync(
|
|
||||||
path.resolve(paths.gallery_output_root, "index.html"),
|
|
||||||
content
|
|
||||||
);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task("gen-index-gallery-prod", async () => {
|
|
||||||
const latestManifest = require(path.resolve(
|
|
||||||
paths.gallery_output_latest,
|
|
||||||
"manifest.json"
|
|
||||||
));
|
|
||||||
const content = renderGalleryTemplate("index", {
|
|
||||||
latestGalleryJS: latestManifest["entrypoint.js"],
|
|
||||||
});
|
|
||||||
const minified = await minifyHtml(content);
|
|
||||||
|
|
||||||
fs.outputFileSync(
|
|
||||||
path.resolve(paths.gallery_output_root, "index.html"),
|
|
||||||
minified
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task("gen-index-hassio-dev", async () => {
|
|
||||||
writeHassioEntrypoint(
|
|
||||||
`${paths.hassio_publicPath}/frontend_latest/entrypoint.js`,
|
|
||||||
`${paths.hassio_publicPath}/frontend_es5/entrypoint.js`
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task("gen-index-hassio-prod", async () => {
|
|
||||||
const latestManifest = require(path.resolve(
|
|
||||||
paths.hassio_output_latest,
|
|
||||||
"manifest.json"
|
|
||||||
));
|
|
||||||
const es5Manifest = require(path.resolve(
|
|
||||||
paths.hassio_output_es5,
|
|
||||||
"manifest.json"
|
|
||||||
));
|
|
||||||
writeHassioEntrypoint(
|
|
||||||
latestManifest["entrypoint.js"],
|
|
||||||
es5Manifest["entrypoint.js"]
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
function writeHassioEntrypoint(latestEntrypoint, es5Entrypoint) {
|
|
||||||
fs.mkdirSync(paths.hassio_output_root, { recursive: true });
|
|
||||||
// Safari 12 and below does not have a compliant ES2015 implementation of template literals, so we ship ES5
|
|
||||||
fs.writeFileSync(
|
|
||||||
path.resolve(paths.hassio_output_root, "entrypoint.js"),
|
|
||||||
`
|
|
||||||
function loadES5() {
|
|
||||||
var el = document.createElement('script');
|
|
||||||
el.src = '${es5Entrypoint}';
|
|
||||||
document.body.appendChild(el);
|
|
||||||
}
|
|
||||||
if (/.*Version\\/(?:11|12)(?:\\.\\d+)*.*Safari\\//.test(navigator.userAgent)) {
|
|
||||||
loadES5();
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
new Function("import('${latestEntrypoint}')")();
|
|
||||||
} catch (err) {
|
|
||||||
loadES5();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`,
|
|
||||||
{ encoding: "utf-8" }
|
|
||||||
);
|
|
||||||
}
|
|
233
build-scripts/gulp/entry-html.js
Normal file
233
build-scripts/gulp/entry-html.js
Normal file
@@ -0,0 +1,233 @@
|
|||||||
|
// Tasks to generate entry HTML
|
||||||
|
|
||||||
|
import fs from "fs-extra";
|
||||||
|
import gulp from "gulp";
|
||||||
|
import { minify } from "html-minifier-terser";
|
||||||
|
import template from "lodash.template";
|
||||||
|
import path from "path";
|
||||||
|
import { htmlMinifierOptions, terserOptions } from "../bundle.cjs";
|
||||||
|
import env from "../env.cjs";
|
||||||
|
import paths from "../paths.cjs";
|
||||||
|
|
||||||
|
const renderTemplate = (templateFile, data = {}) => {
|
||||||
|
const compiled = template(
|
||||||
|
fs.readFileSync(templateFile, { encoding: "utf-8" })
|
||||||
|
);
|
||||||
|
return compiled({
|
||||||
|
...data,
|
||||||
|
useRollup: env.useRollup(),
|
||||||
|
useWDS: env.useWDS(),
|
||||||
|
// Resolve any child/nested templates relative to the parent and pass the same data
|
||||||
|
renderTemplate: (childTemplate) =>
|
||||||
|
renderTemplate(
|
||||||
|
path.resolve(path.dirname(templateFile), childTemplate),
|
||||||
|
data
|
||||||
|
),
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const WRAP_TAGS = { ".js": "script", ".css": "style" };
|
||||||
|
|
||||||
|
const minifyHtml = (content, ext) => {
|
||||||
|
const wrapTag = WRAP_TAGS[ext] || "";
|
||||||
|
const begTag = wrapTag && `<${wrapTag}>`;
|
||||||
|
const endTag = wrapTag && `</${wrapTag}>`;
|
||||||
|
return minify(begTag + content + endTag, {
|
||||||
|
...htmlMinifierOptions,
|
||||||
|
conservativeCollapse: false,
|
||||||
|
minifyJS: terserOptions({
|
||||||
|
latestBuild: false, // Shared scripts should be ES5
|
||||||
|
isTestBuild: true, // Don't need source maps
|
||||||
|
}),
|
||||||
|
}).then((wrapped) =>
|
||||||
|
wrapTag ? wrapped.slice(begTag.length, -endTag.length) : wrapped
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
// 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 = ""
|
||||||
|
) =>
|
||||||
|
async () => {
|
||||||
|
for (const [page, entries] of Object.entries(pageEntries)) {
|
||||||
|
const content = renderTemplate(
|
||||||
|
path.resolve(inputRoot, inputSub, `${page}.template`),
|
||||||
|
{
|
||||||
|
latestEntryJS: entries.map((entry) =>
|
||||||
|
useWDS
|
||||||
|
? `http://localhost:8000/src/entrypoints/${entry}.ts`
|
||||||
|
: `${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`,
|
||||||
|
es5CustomPanelJS: `${publicRoot}/frontend_es5/custom-panel.js`,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
fs.outputFileSync(path.resolve(outputRoot, page), content);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Same as previous but for production builds
|
||||||
|
// (includes minification and hashed file names from manifest)
|
||||||
|
const genPagesProdTask =
|
||||||
|
(
|
||||||
|
pageEntries,
|
||||||
|
inputRoot,
|
||||||
|
outputRoot,
|
||||||
|
outputLatest,
|
||||||
|
outputES5,
|
||||||
|
inputSub = "src/html"
|
||||||
|
) =>
|
||||||
|
async () => {
|
||||||
|
const latestManifest = fs.readJsonSync(
|
||||||
|
path.resolve(outputLatest, "manifest.json")
|
||||||
|
);
|
||||||
|
const es5Manifest = outputES5
|
||||||
|
? fs.readJsonSync(path.resolve(outputES5, "manifest.json"))
|
||||||
|
: {};
|
||||||
|
const minifiedHTML = [];
|
||||||
|
for (const [page, entries] of Object.entries(pageEntries)) {
|
||||||
|
const content = renderTemplate(
|
||||||
|
path.resolve(inputRoot, inputSub, `${page}.template`),
|
||||||
|
{
|
||||||
|
latestEntryJS: entries.map((entry) => latestManifest[`${entry}.js`]),
|
||||||
|
es5EntryJS: entries.map((entry) => es5Manifest[`${entry}.js`]),
|
||||||
|
latestCustomPanelJS: latestManifest["custom-panel.js"],
|
||||||
|
es5CustomPanelJS: es5Manifest["custom-panel.js"],
|
||||||
|
}
|
||||||
|
);
|
||||||
|
minifiedHTML.push(
|
||||||
|
minifyHtml(content, path.extname(page)).then((minified) =>
|
||||||
|
fs.outputFileSync(path.resolve(outputRoot, page), minified)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
await Promise.all(minifiedHTML);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Map HTML pages to their required entrypoints
|
||||||
|
const APP_PAGE_ENTRIES = {
|
||||||
|
"authorize.html": ["authorize"],
|
||||||
|
"onboarding.html": ["onboarding"],
|
||||||
|
"index.html": ["core", "app"],
|
||||||
|
};
|
||||||
|
|
||||||
|
gulp.task(
|
||||||
|
"gen-pages-app-dev",
|
||||||
|
genPagesDevTask(
|
||||||
|
APP_PAGE_ENTRIES,
|
||||||
|
paths.polymer_dir,
|
||||||
|
paths.app_output_root,
|
||||||
|
env.useWDS()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
gulp.task(
|
||||||
|
"gen-pages-app-prod",
|
||||||
|
genPagesProdTask(
|
||||||
|
APP_PAGE_ENTRIES,
|
||||||
|
paths.polymer_dir,
|
||||||
|
paths.app_output_root,
|
||||||
|
paths.app_output_latest,
|
||||||
|
paths.app_output_es5
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
const CAST_PAGE_ENTRIES = {
|
||||||
|
"faq.html": ["launcher"],
|
||||||
|
"index.html": ["launcher"],
|
||||||
|
"media.html": ["media"],
|
||||||
|
"receiver.html": ["receiver"],
|
||||||
|
};
|
||||||
|
|
||||||
|
gulp.task(
|
||||||
|
"gen-pages-cast-dev",
|
||||||
|
genPagesDevTask(CAST_PAGE_ENTRIES, paths.cast_dir, paths.cast_output_root)
|
||||||
|
);
|
||||||
|
|
||||||
|
gulp.task(
|
||||||
|
"gen-pages-cast-prod",
|
||||||
|
genPagesProdTask(
|
||||||
|
CAST_PAGE_ENTRIES,
|
||||||
|
paths.cast_dir,
|
||||||
|
paths.cast_output_root,
|
||||||
|
paths.cast_output_latest,
|
||||||
|
paths.cast_output_es5
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
const DEMO_PAGE_ENTRIES = { "index.html": ["main"] };
|
||||||
|
|
||||||
|
gulp.task(
|
||||||
|
"gen-pages-demo-dev",
|
||||||
|
genPagesDevTask(DEMO_PAGE_ENTRIES, paths.demo_dir, paths.demo_output_root)
|
||||||
|
);
|
||||||
|
|
||||||
|
gulp.task(
|
||||||
|
"gen-pages-demo-prod",
|
||||||
|
genPagesProdTask(
|
||||||
|
DEMO_PAGE_ENTRIES,
|
||||||
|
paths.demo_dir,
|
||||||
|
paths.demo_output_root,
|
||||||
|
paths.demo_output_latest,
|
||||||
|
paths.demo_output_es5
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
const GALLERY_PAGE_ENTRIES = { "index.html": ["entrypoint"] };
|
||||||
|
|
||||||
|
gulp.task(
|
||||||
|
"gen-pages-gallery-dev",
|
||||||
|
genPagesDevTask(
|
||||||
|
GALLERY_PAGE_ENTRIES,
|
||||||
|
paths.gallery_dir,
|
||||||
|
paths.gallery_output_root
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
gulp.task(
|
||||||
|
"gen-pages-gallery-prod",
|
||||||
|
genPagesProdTask(
|
||||||
|
GALLERY_PAGE_ENTRIES,
|
||||||
|
paths.gallery_dir,
|
||||||
|
paths.gallery_output_root,
|
||||||
|
paths.gallery_output_latest
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
const HASSIO_PAGE_ENTRIES = { "entrypoint.js": ["entrypoint"] };
|
||||||
|
|
||||||
|
gulp.task(
|
||||||
|
"gen-pages-hassio-dev",
|
||||||
|
genPagesDevTask(
|
||||||
|
HASSIO_PAGE_ENTRIES,
|
||||||
|
paths.hassio_dir,
|
||||||
|
paths.hassio_output_root,
|
||||||
|
undefined,
|
||||||
|
"src",
|
||||||
|
paths.hassio_publicPath
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
gulp.task(
|
||||||
|
"gen-pages-hassio-prod",
|
||||||
|
genPagesProdTask(
|
||||||
|
HASSIO_PAGE_ENTRIES,
|
||||||
|
paths.hassio_dir,
|
||||||
|
paths.hassio_output_root,
|
||||||
|
paths.hassio_output_latest,
|
||||||
|
paths.hassio_output_es5,
|
||||||
|
"src"
|
||||||
|
)
|
||||||
|
);
|
@@ -1,15 +1,15 @@
|
|||||||
// Task to download the latest Lokalise translations from the nightly workflow artifacts
|
// Task to download the latest Lokalise translations from the nightly workflow artifacts
|
||||||
|
|
||||||
const del = import("del");
|
import { createOAuthDeviceAuth } from "@octokit/auth-oauth-device";
|
||||||
const fs = require("fs/promises");
|
import { retry } from "@octokit/plugin-retry";
|
||||||
const path = require("path");
|
import { Octokit } from "@octokit/rest";
|
||||||
const process = require("process");
|
import { deleteAsync } from "del";
|
||||||
const gulp = require("gulp");
|
import { mkdir, readFile, writeFile } from "fs/promises";
|
||||||
const jszip = require("jszip");
|
import gulp from "gulp";
|
||||||
const tar = require("tar");
|
import jszip from "jszip";
|
||||||
const { Octokit } = require("@octokit/rest");
|
import path from "path";
|
||||||
const { retry } = require("@octokit/plugin-retry");
|
import process from "process";
|
||||||
const { createOAuthDeviceAuth } = require("@octokit/auth-oauth-device");
|
import tar from "tar";
|
||||||
|
|
||||||
const MAX_AGE = 24; // hours
|
const MAX_AGE = 24; // hours
|
||||||
const OWNER = "home-assistant";
|
const OWNER = "home-assistant";
|
||||||
@@ -38,7 +38,7 @@ gulp.task("fetch-nightly-translations", async function () {
|
|||||||
// and stop if they are not old enough
|
// and stop if they are not old enough
|
||||||
let currentArtifact;
|
let currentArtifact;
|
||||||
try {
|
try {
|
||||||
currentArtifact = JSON.parse(await fs.readFile(ARTIFACT_FILE, "utf-8"));
|
currentArtifact = JSON.parse(await readFile(ARTIFACT_FILE, "utf-8"));
|
||||||
const currentAge =
|
const currentAge =
|
||||||
(Date.now() - Date.parse(currentArtifact.created_at)) / 3600000;
|
(Date.now() - Date.parse(currentArtifact.created_at)) / 3600000;
|
||||||
if (currentAge < MAX_AGE) {
|
if (currentAge < MAX_AGE) {
|
||||||
@@ -53,7 +53,7 @@ gulp.task("fetch-nightly-translations", async function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// To store file writing promises
|
// To store file writing promises
|
||||||
const createExtractDir = fs.mkdir(EXTRACT_DIR, { recursive: true });
|
const createExtractDir = mkdir(EXTRACT_DIR, { recursive: true });
|
||||||
const writings = [];
|
const writings = [];
|
||||||
|
|
||||||
// Authenticate to GitHub using GitHub action token if it exists,
|
// Authenticate to GitHub using GitHub action token if it exists,
|
||||||
@@ -63,7 +63,7 @@ gulp.task("fetch-nightly-translations", async function () {
|
|||||||
tokenAuth = { token: process.env.GITHUB_TOKEN };
|
tokenAuth = { token: process.env.GITHUB_TOKEN };
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
tokenAuth = JSON.parse(await fs.readFile(TOKEN_FILE, "utf-8"));
|
tokenAuth = JSON.parse(await readFile(TOKEN_FILE, "utf-8"));
|
||||||
} catch {
|
} catch {
|
||||||
if (!allowTokenSetup) {
|
if (!allowTokenSetup) {
|
||||||
console.log("No token found so build wil continue with English only");
|
console.log("No token found so build wil continue with English only");
|
||||||
@@ -88,7 +88,7 @@ gulp.task("fetch-nightly-translations", async function () {
|
|||||||
tokenAuth = await auth({ type: "oauth" });
|
tokenAuth = await auth({ type: "oauth" });
|
||||||
writings.push(
|
writings.push(
|
||||||
createExtractDir.then(
|
createExtractDir.then(
|
||||||
fs.writeFile(TOKEN_FILE, JSON.stringify(tokenAuth, null, 2))
|
writeFile(TOKEN_FILE, JSON.stringify(tokenAuth, null, 2))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -132,17 +132,13 @@ gulp.task("fetch-nightly-translations", async function () {
|
|||||||
}
|
}
|
||||||
writings.push(
|
writings.push(
|
||||||
createExtractDir.then(
|
createExtractDir.then(
|
||||||
fs.writeFile(ARTIFACT_FILE, JSON.stringify(latestArtifact, null, 2))
|
writeFile(ARTIFACT_FILE, JSON.stringify(latestArtifact, null, 2))
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Remove the current translations
|
// Remove the current translations
|
||||||
const deleteCurrent = Promise.all(writings).then(
|
const deleteCurrent = Promise.all(writings).then(
|
||||||
(await del).deleteAsync([
|
deleteAsync([`${EXTRACT_DIR}/*`, `!${ARTIFACT_FILE}`, `!${TOKEN_FILE}`])
|
||||||
`${EXTRACT_DIR}/*`,
|
|
||||||
`!${ARTIFACT_FILE}`,
|
|
||||||
`!${TOKEN_FILE}`,
|
|
||||||
])
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// Get the download URL and follow the redirect to download (stored as ArrayBuffer)
|
// Get the download URL and follow the redirect to download (stored as ArrayBuffer)
|
@@ -1,22 +1,19 @@
|
|||||||
// Run demo develop mode
|
import fs from "fs";
|
||||||
const gulp = require("gulp");
|
import { glob } from "glob";
|
||||||
const fs = require("fs");
|
import gulp from "gulp";
|
||||||
const path = require("path");
|
import yaml from "js-yaml";
|
||||||
const { marked } = require("marked");
|
import { marked } from "marked";
|
||||||
const { glob } = require("glob");
|
import path from "path";
|
||||||
const yaml = require("js-yaml");
|
import env from "../env.cjs";
|
||||||
|
import paths from "../paths.cjs";
|
||||||
const env = require("../env.cjs");
|
import "./clean.js";
|
||||||
const paths = require("../paths.cjs");
|
import "./entry-html.js";
|
||||||
|
import "./gather-static.js";
|
||||||
require("./clean.cjs");
|
import "./gen-icons-json.js";
|
||||||
require("./translations.cjs");
|
import "./rollup.js";
|
||||||
require("./gen-icons-json.cjs");
|
import "./service-worker.js";
|
||||||
require("./gather-static.cjs");
|
import "./translations.js";
|
||||||
require("./webpack.cjs");
|
import "./webpack.js";
|
||||||
require("./service-worker.cjs");
|
|
||||||
require("./entry-html.cjs");
|
|
||||||
require("./rollup.cjs");
|
|
||||||
|
|
||||||
gulp.task("gather-gallery-pages", async function gatherPages() {
|
gulp.task("gather-gallery-pages", async function gatherPages() {
|
||||||
const pageDir = path.resolve(paths.gallery_dir, "src/pages");
|
const pageDir = path.resolve(paths.gallery_dir, "src/pages");
|
||||||
@@ -159,7 +156,7 @@ gulp.task(
|
|||||||
"gather-gallery-pages"
|
"gather-gallery-pages"
|
||||||
),
|
),
|
||||||
"copy-static-gallery",
|
"copy-static-gallery",
|
||||||
"gen-index-gallery-dev",
|
"gen-pages-gallery-dev",
|
||||||
gulp.parallel(
|
gulp.parallel(
|
||||||
env.useRollup()
|
env.useRollup()
|
||||||
? "rollup-dev-server-gallery"
|
? "rollup-dev-server-gallery"
|
||||||
@@ -193,6 +190,6 @@ gulp.task(
|
|||||||
),
|
),
|
||||||
"copy-static-gallery",
|
"copy-static-gallery",
|
||||||
env.useRollup() ? "rollup-prod-gallery" : "webpack-prod-gallery",
|
env.useRollup() ? "rollup-prod-gallery" : "webpack-prod-gallery",
|
||||||
"gen-index-gallery-prod"
|
"gen-pages-gallery-prod"
|
||||||
)
|
)
|
||||||
);
|
);
|
@@ -1,9 +1,9 @@
|
|||||||
// Gulp task to gather all static files.
|
// Gulp task to gather all static files.
|
||||||
|
|
||||||
const gulp = require("gulp");
|
import fs from "fs-extra";
|
||||||
const path = require("path");
|
import gulp from "gulp";
|
||||||
const fs = require("fs-extra");
|
import path from "path";
|
||||||
const paths = require("../paths.cjs");
|
import paths from "../paths.cjs";
|
||||||
|
|
||||||
const npmPath = (...parts) =>
|
const npmPath = (...parts) =>
|
||||||
path.resolve(paths.polymer_dir, "node_modules", ...parts);
|
path.resolve(paths.polymer_dir, "node_modules", ...parts);
|
||||||
@@ -111,9 +111,10 @@ gulp.task("copy-translations-supervisor", async () => {
|
|||||||
copyTranslations(staticDir);
|
copyTranslations(staticDir);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task("copy-locale-data-supervisor", async () => {
|
gulp.task("copy-static-supervisor", async () => {
|
||||||
const staticDir = paths.hassio_output_static;
|
const staticDir = paths.hassio_output_static;
|
||||||
copyLocaleData(staticDir);
|
copyLocaleData(staticDir);
|
||||||
|
copyFonts(staticDir);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task("copy-static-app", async () => {
|
gulp.task("copy-static-app", async () => {
|
@@ -1,17 +1,15 @@
|
|||||||
const gulp = require("gulp");
|
import fs from "fs";
|
||||||
const path = require("path");
|
import gulp from "gulp";
|
||||||
const fs = require("fs");
|
import hash from "object-hash";
|
||||||
const hash = require("object-hash");
|
import path from "path";
|
||||||
|
import paths from "../paths.cjs";
|
||||||
|
|
||||||
const ICON_PACKAGE_PATH = path.resolve(
|
const ICON_PACKAGE_PATH = path.resolve("node_modules/@mdi/svg/");
|
||||||
__dirname,
|
|
||||||
"../../node_modules/@mdi/svg/"
|
|
||||||
);
|
|
||||||
const META_PATH = path.resolve(ICON_PACKAGE_PATH, "meta.json");
|
const META_PATH = path.resolve(ICON_PACKAGE_PATH, "meta.json");
|
||||||
const PACKAGE_PATH = path.resolve(ICON_PACKAGE_PATH, "package.json");
|
const PACKAGE_PATH = path.resolve(ICON_PACKAGE_PATH, "package.json");
|
||||||
const ICON_PATH = path.resolve(ICON_PACKAGE_PATH, "svg");
|
const ICON_PATH = path.resolve(ICON_PACKAGE_PATH, "svg");
|
||||||
const OUTPUT_DIR = path.resolve(__dirname, "../../build/mdi");
|
const OUTPUT_DIR = path.resolve(paths.build_dir, "mdi");
|
||||||
const REMOVED_ICONS_PATH = path.resolve(__dirname, "../removedIcons.json");
|
const REMOVED_ICONS_PATH = new URL("../removedIcons.json", import.meta.url);
|
||||||
|
|
||||||
const encoding = "utf8";
|
const encoding = "utf8";
|
||||||
|
|
@@ -1,13 +1,13 @@
|
|||||||
const gulp = require("gulp");
|
import gulp from "gulp";
|
||||||
const env = require("../env.cjs");
|
import env from "../env.cjs";
|
||||||
require("./clean.cjs");
|
import "./clean.js";
|
||||||
require("./compress.cjs");
|
import "./compress.js";
|
||||||
require("./entry-html.cjs");
|
import "./entry-html.js";
|
||||||
require("./gather-static.cjs");
|
import "./gather-static.js";
|
||||||
require("./gen-icons-json.cjs");
|
import "./gen-icons-json.js";
|
||||||
require("./rollup.cjs");
|
import "./rollup.js";
|
||||||
require("./translations.cjs");
|
import "./translations.js";
|
||||||
require("./webpack.cjs");
|
import "./webpack.js";
|
||||||
|
|
||||||
gulp.task(
|
gulp.task(
|
||||||
"develop-hassio",
|
"develop-hassio",
|
||||||
@@ -17,11 +17,11 @@ gulp.task(
|
|||||||
},
|
},
|
||||||
"clean-hassio",
|
"clean-hassio",
|
||||||
"gen-dummy-icons-json",
|
"gen-dummy-icons-json",
|
||||||
"gen-index-hassio-dev",
|
"gen-pages-hassio-dev",
|
||||||
"build-supervisor-translations",
|
"build-supervisor-translations",
|
||||||
"copy-translations-supervisor",
|
"copy-translations-supervisor",
|
||||||
"build-locale-data",
|
"build-locale-data",
|
||||||
"copy-locale-data-supervisor",
|
"copy-static-supervisor",
|
||||||
env.useRollup() ? "rollup-watch-hassio" : "webpack-watch-hassio"
|
env.useRollup() ? "rollup-watch-hassio" : "webpack-watch-hassio"
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -37,9 +37,9 @@ gulp.task(
|
|||||||
"build-supervisor-translations",
|
"build-supervisor-translations",
|
||||||
"copy-translations-supervisor",
|
"copy-translations-supervisor",
|
||||||
"build-locale-data",
|
"build-locale-data",
|
||||||
"copy-locale-data-supervisor",
|
"copy-static-supervisor",
|
||||||
env.useRollup() ? "rollup-prod-hassio" : "webpack-prod-hassio",
|
env.useRollup() ? "rollup-prod-hassio" : "webpack-prod-hassio",
|
||||||
"gen-index-hassio-prod",
|
"gen-pages-hassio-prod",
|
||||||
...// Don't compress running tests
|
...// Don't compress running tests
|
||||||
(env.isTestBuild() ? [] : ["compress-hassio"])
|
(env.isTestBuild() ? [] : ["compress-hassio"])
|
||||||
)
|
)
|
@@ -1,72 +0,0 @@
|
|||||||
const del = import("del");
|
|
||||||
const path = require("path");
|
|
||||||
const gulp = require("gulp");
|
|
||||||
const fs = require("fs");
|
|
||||||
const paths = require("../paths.cjs");
|
|
||||||
|
|
||||||
const outDir = "build/locale-data";
|
|
||||||
|
|
||||||
gulp.task("clean-locale-data", async () => (await del).deleteSync([outDir]));
|
|
||||||
|
|
||||||
gulp.task("ensure-locale-data-build-dir", (done) => {
|
|
||||||
if (!fs.existsSync(outDir)) {
|
|
||||||
fs.mkdirSync(outDir, { recursive: true });
|
|
||||||
}
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
|
|
||||||
const modules = {
|
|
||||||
"intl-relativetimeformat": "RelativeTimeFormat",
|
|
||||||
"intl-datetimeformat": "DateTimeFormat",
|
|
||||||
"intl-numberformat": "NumberFormat",
|
|
||||||
};
|
|
||||||
|
|
||||||
gulp.task("create-locale-data", (done) => {
|
|
||||||
const translationMeta = JSON.parse(
|
|
||||||
fs.readFileSync(
|
|
||||||
path.join(paths.translations_src, "translationMetadata.json")
|
|
||||||
)
|
|
||||||
);
|
|
||||||
Object.entries(modules).forEach(([module, className]) => {
|
|
||||||
Object.keys(translationMeta).forEach((lang) => {
|
|
||||||
try {
|
|
||||||
const localeData = String(
|
|
||||||
fs.readFileSync(
|
|
||||||
require.resolve(`@formatjs/${module}/locale-data/${lang}.js`)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.replace(
|
|
||||||
new RegExp(
|
|
||||||
`\\/\\*\\s*@generated\\s*\\*\\/\\s*\\/\\/\\s*prettier-ignore\\s*if\\s*\\(Intl\\.${className}\\s*&&\\s*typeof\\s*Intl\\.${className}\\.__addLocaleData\\s*===\\s*'function'\\)\\s*{\\s*Intl\\.${className}\\.__addLocaleData\\(`,
|
|
||||||
"im"
|
|
||||||
),
|
|
||||||
""
|
|
||||||
)
|
|
||||||
.replace(/\)\s*}/im, "");
|
|
||||||
// make sure we have valid JSON
|
|
||||||
JSON.parse(localeData);
|
|
||||||
if (!fs.existsSync(path.join(outDir, module))) {
|
|
||||||
fs.mkdirSync(path.join(outDir, module), { recursive: true });
|
|
||||||
}
|
|
||||||
fs.writeFileSync(
|
|
||||||
path.join(outDir, `${module}/${lang}.json`),
|
|
||||||
localeData
|
|
||||||
);
|
|
||||||
} catch (e) {
|
|
||||||
if (e.code !== "MODULE_NOT_FOUND") {
|
|
||||||
throw e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
gulp.task(
|
|
||||||
"build-locale-data",
|
|
||||||
gulp.series(
|
|
||||||
"clean-locale-data",
|
|
||||||
"ensure-locale-data-build-dir",
|
|
||||||
"create-locale-data"
|
|
||||||
)
|
|
||||||
);
|
|
73
build-scripts/gulp/locale-data.js
Executable file
73
build-scripts/gulp/locale-data.js
Executable file
@@ -0,0 +1,73 @@
|
|||||||
|
import { deleteSync } from "del";
|
||||||
|
import { mkdir, readFile, writeFile } from "fs/promises";
|
||||||
|
import gulp from "gulp";
|
||||||
|
import path from "path";
|
||||||
|
import paths from "../paths.cjs";
|
||||||
|
|
||||||
|
const outDir = path.join(paths.build_dir, "locale-data");
|
||||||
|
|
||||||
|
const INTL_PACKAGES = {
|
||||||
|
"intl-relativetimeformat": "RelativeTimeFormat",
|
||||||
|
"intl-datetimeformat": "DateTimeFormat",
|
||||||
|
"intl-numberformat": "NumberFormat",
|
||||||
|
"intl-displaynames": "DisplayNames",
|
||||||
|
"intl-listformat": "ListFormat",
|
||||||
|
};
|
||||||
|
|
||||||
|
const convertToJSON = async (pkg, lang) => {
|
||||||
|
let localeData;
|
||||||
|
try {
|
||||||
|
localeData = await readFile(
|
||||||
|
path.resolve(
|
||||||
|
paths.polymer_dir,
|
||||||
|
`node_modules/@formatjs/${pkg}/locale-data/${lang}.js`
|
||||||
|
),
|
||||||
|
"utf-8"
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
// Ignore if language is missing (i.e. not supported by @formatjs)
|
||||||
|
if (e.code === "ENOENT") {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Convert to JSON
|
||||||
|
const className = INTL_PACKAGES[pkg];
|
||||||
|
localeData = localeData
|
||||||
|
.replace(
|
||||||
|
new RegExp(
|
||||||
|
`\\/\\*\\s*@generated\\s*\\*\\/\\s*\\/\\/\\s*prettier-ignore\\s*if\\s*\\(Intl\\.${className}\\s*&&\\s*typeof\\s*Intl\\.${className}\\.__addLocaleData\\s*===\\s*'function'\\)\\s*{\\s*Intl\\.${className}\\.__addLocaleData\\(`,
|
||||||
|
"im"
|
||||||
|
),
|
||||||
|
""
|
||||||
|
)
|
||||||
|
.replace(/\)\s*}/im, "");
|
||||||
|
// Parse to validate JSON, then stringify to minify
|
||||||
|
localeData = JSON.stringify(JSON.parse(localeData));
|
||||||
|
await writeFile(path.join(outDir, `${pkg}/${lang}.json`), localeData);
|
||||||
|
};
|
||||||
|
|
||||||
|
gulp.task("clean-locale-data", async () => deleteSync([outDir]));
|
||||||
|
|
||||||
|
gulp.task("create-locale-data", async () => {
|
||||||
|
const translationMeta = JSON.parse(
|
||||||
|
await readFile(
|
||||||
|
path.resolve(paths.translations_src, "translationMetadata.json"),
|
||||||
|
"utf-8"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
const conversions = [];
|
||||||
|
for (const pkg of Object.keys(INTL_PACKAGES)) {
|
||||||
|
await mkdir(path.join(outDir, pkg), { recursive: true });
|
||||||
|
for (const lang of Object.keys(translationMeta)) {
|
||||||
|
conversions.push(convertToJSON(pkg, lang));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
await Promise.all(conversions);
|
||||||
|
});
|
||||||
|
|
||||||
|
gulp.task(
|
||||||
|
"build-locale-data",
|
||||||
|
gulp.series("clean-locale-data", "create-locale-data")
|
||||||
|
);
|
@@ -1,13 +1,14 @@
|
|||||||
// Tasks to run Rollup
|
// Tasks to run Rollup
|
||||||
const path = require("path");
|
|
||||||
const gulp = require("gulp");
|
import log from "fancy-log";
|
||||||
const rollup = require("rollup");
|
import gulp from "gulp";
|
||||||
const handler = require("serve-handler");
|
import http from "http";
|
||||||
const http = require("http");
|
import open from "open";
|
||||||
const log = require("fancy-log");
|
import path from "path";
|
||||||
const open = require("open");
|
import { rollup } from "rollup";
|
||||||
const rollupConfig = require("../rollup.cjs");
|
import handler from "serve-handler";
|
||||||
const paths = require("../paths.cjs");
|
import paths from "../paths.cjs";
|
||||||
|
import rollupConfig from "../rollup.cjs";
|
||||||
|
|
||||||
const bothBuilds = (createConfigFunc, params) =>
|
const bothBuilds = (createConfigFunc, params) =>
|
||||||
gulp.series(
|
gulp.series(
|
@@ -1,11 +1,12 @@
|
|||||||
// Generate service worker.
|
// Generate service worker.
|
||||||
// Based on manifest, create a file with the content as service_worker.js
|
// Based on manifest, create a file with the content as service_worker.js
|
||||||
const gulp = require("gulp");
|
|
||||||
const path = require("path");
|
import fs from "fs-extra";
|
||||||
const fs = require("fs-extra");
|
import gulp from "gulp";
|
||||||
const workboxBuild = require("workbox-build");
|
import path from "path";
|
||||||
const sourceMapUrl = require("source-map-url");
|
import sourceMapUrl from "source-map-url";
|
||||||
const paths = require("../paths.cjs");
|
import workboxBuild from "workbox-build";
|
||||||
|
import paths from "../paths.cjs";
|
||||||
|
|
||||||
const swDest = path.resolve(paths.app_output_root, "service_worker.js");
|
const swDest = path.resolve(paths.app_output_root, "service_worker.js");
|
||||||
|
|
||||||
@@ -28,10 +29,9 @@ self.addEventListener('install', (event) => {
|
|||||||
|
|
||||||
gulp.task("gen-service-worker-app-prod", async () => {
|
gulp.task("gen-service-worker-app-prod", async () => {
|
||||||
// Read bundled source file
|
// Read bundled source file
|
||||||
const bundleManifestLatest = require(path.resolve(
|
const bundleManifestLatest = fs.readJsonSync(
|
||||||
paths.app_output_latest,
|
path.resolve(paths.app_output_latest, "manifest.json")
|
||||||
"manifest.json"
|
);
|
||||||
));
|
|
||||||
let serviceWorkerContent = fs.readFileSync(
|
let serviceWorkerContent = fs.readFileSync(
|
||||||
paths.app_output_root + bundleManifestLatest["service_worker.js"],
|
paths.app_output_root + bundleManifestLatest["service_worker.js"],
|
||||||
"utf-8"
|
"utf-8"
|
||||||
@@ -46,10 +46,9 @@ gulp.task("gen-service-worker-app-prod", async () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Remove ES5
|
// Remove ES5
|
||||||
const bundleManifestES5 = require(path.resolve(
|
const bundleManifestES5 = fs.readJsonSync(
|
||||||
paths.app_output_es5,
|
path.resolve(paths.app_output_es5, "manifest.json")
|
||||||
"manifest.json"
|
);
|
||||||
));
|
|
||||||
fs.removeSync(paths.app_output_root + bundleManifestES5["service_worker.js"]);
|
fs.removeSync(paths.app_output_root + bundleManifestES5["service_worker.js"]);
|
||||||
fs.removeSync(
|
fs.removeSync(
|
||||||
paths.app_output_root + bundleManifestES5["service_worker.js.map"]
|
paths.app_output_root + bundleManifestES5["service_worker.js.map"]
|
@@ -1,19 +1,24 @@
|
|||||||
const del = import("del");
|
import { createHash } from "crypto";
|
||||||
const crypto = require("crypto");
|
import { deleteSync } from "del";
|
||||||
const path = require("path");
|
import {
|
||||||
const source = require("vinyl-source-stream");
|
mkdirSync,
|
||||||
const vinylBuffer = require("vinyl-buffer");
|
readdirSync,
|
||||||
const gulp = require("gulp");
|
readFileSync,
|
||||||
const fs = require("fs");
|
renameSync,
|
||||||
const flatmap = require("gulp-flatmap");
|
writeFile,
|
||||||
const merge = require("gulp-merge-json");
|
} from "fs";
|
||||||
const rename = require("gulp-rename");
|
import gulp from "gulp";
|
||||||
const transform = require("gulp-json-transform");
|
import flatmap from "gulp-flatmap";
|
||||||
const { mapFiles } = require("../util.cjs");
|
import transform from "gulp-json-transform";
|
||||||
const env = require("../env.cjs");
|
import merge from "gulp-merge-json";
|
||||||
const paths = require("../paths.cjs");
|
import rename from "gulp-rename";
|
||||||
|
import path from "path";
|
||||||
require("./fetch-nightly-translations.cjs");
|
import vinylBuffer from "vinyl-buffer";
|
||||||
|
import source from "vinyl-source-stream";
|
||||||
|
import env from "../env.cjs";
|
||||||
|
import paths from "../paths.cjs";
|
||||||
|
import { mapFiles } from "../util.cjs";
|
||||||
|
import "./fetch-nightly-translations.js";
|
||||||
|
|
||||||
const inFrontendDir = "translations/frontend";
|
const inFrontendDir = "translations/frontend";
|
||||||
const inBackendDir = "translations/backend";
|
const inBackendDir = "translations/backend";
|
||||||
@@ -33,7 +38,12 @@ gulp.task(
|
|||||||
|
|
||||||
// Panel translations which should be split from the core translations.
|
// Panel translations which should be split from the core translations.
|
||||||
const TRANSLATION_FRAGMENTS = Object.keys(
|
const TRANSLATION_FRAGMENTS = Object.keys(
|
||||||
require("../../src/translations/en.json").ui.panel
|
JSON.parse(
|
||||||
|
readFileSync(
|
||||||
|
path.resolve(paths.polymer_dir, "src/translations/en.json"),
|
||||||
|
"utf-8"
|
||||||
|
)
|
||||||
|
).ui.panel
|
||||||
);
|
);
|
||||||
|
|
||||||
function recursiveFlatten(prefix, data) {
|
function recursiveFlatten(prefix, data) {
|
||||||
@@ -120,17 +130,14 @@ function lokaliseTransform(data, original, file) {
|
|||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
gulp.task("clean-translations", async () => (await del).deleteSync([workDir]));
|
gulp.task("clean-translations", async () => deleteSync([workDir]));
|
||||||
|
|
||||||
gulp.task("ensure-translations-build-dir", (done) => {
|
gulp.task("ensure-translations-build-dir", async () => {
|
||||||
if (!fs.existsSync(workDir)) {
|
mkdirSync(workDir, { recursive: true });
|
||||||
fs.mkdirSync(workDir, { recursive: true });
|
|
||||||
}
|
|
||||||
done();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task("create-test-metadata", (cb) => {
|
gulp.task("create-test-metadata", (cb) => {
|
||||||
fs.writeFile(
|
writeFile(
|
||||||
workDir + "/testMetadata.json",
|
workDir + "/testMetadata.json",
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
test: {
|
test: {
|
||||||
@@ -303,15 +310,14 @@ const fingerprints = {};
|
|||||||
|
|
||||||
gulp.task("build-translation-fingerprints", () => {
|
gulp.task("build-translation-fingerprints", () => {
|
||||||
// Fingerprint full file of each language
|
// Fingerprint full file of each language
|
||||||
const files = fs.readdirSync(fullDir);
|
const files = readdirSync(fullDir);
|
||||||
|
|
||||||
for (let i = 0; i < files.length; i++) {
|
for (let i = 0; i < files.length; i++) {
|
||||||
fingerprints[files[i].split(".")[0]] = {
|
fingerprints[files[i].split(".")[0]] = {
|
||||||
// In dev we create fake hashes
|
// In dev we create fake hashes
|
||||||
hash: env.isProdBuild()
|
hash: env.isProdBuild()
|
||||||
? crypto
|
? createHash("md5")
|
||||||
.createHash("md5")
|
.update(readFileSync(path.join(fullDir, files[i]), "utf-8"))
|
||||||
.update(fs.readFileSync(path.join(fullDir, files[i]), "utf-8"))
|
|
||||||
.digest("hex")
|
.digest("hex")
|
||||||
: "dev",
|
: "dev",
|
||||||
};
|
};
|
||||||
@@ -327,7 +333,7 @@ gulp.task("build-translation-fingerprints", () => {
|
|||||||
throw new Error(`Unable to find hash for ${filename}`);
|
throw new Error(`Unable to find hash for ${filename}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.renameSync(
|
renameSync(
|
||||||
filename,
|
filename,
|
||||||
`${parsed.dir}/${parsed.name}-${fingerprints[parsed.name].hash}${
|
`${parsed.dir}/${parsed.name}-${fingerprints[parsed.name].hash}${
|
||||||
parsed.ext
|
parsed.ext
|
||||||
@@ -409,7 +415,7 @@ gulp.task("build-translation-write-metadata", () =>
|
|||||||
gulp.task(
|
gulp.task(
|
||||||
"create-translations",
|
"create-translations",
|
||||||
gulp.series(
|
gulp.series(
|
||||||
env.isProdBuild() ? (done) => done() : "create-test-translation",
|
...(env.isProdBuild() ? [] : ["create-test-translation"]),
|
||||||
"build-master-translation",
|
"build-master-translation",
|
||||||
"build-merged-translations",
|
"build-merged-translations",
|
||||||
gulp.parallel(...splitTasks),
|
gulp.parallel(...splitTasks),
|
@@ -1,11 +0,0 @@
|
|||||||
// Tasks to run Rollup
|
|
||||||
const gulp = require("gulp");
|
|
||||||
const { startDevServer } = require("@web/dev-server");
|
|
||||||
|
|
||||||
gulp.task("wds-watch-app", () => {
|
|
||||||
startDevServer({
|
|
||||||
config: {
|
|
||||||
watch: true,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
});
|
|
10
build-scripts/gulp/wds.js
Normal file
10
build-scripts/gulp/wds.js
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import gulp from "gulp";
|
||||||
|
import { startDevServer } from "@web/dev-server";
|
||||||
|
|
||||||
|
gulp.task("wds-watch-app", async () => {
|
||||||
|
startDevServer({
|
||||||
|
config: {
|
||||||
|
watch: true,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
});
|
@@ -1,19 +1,20 @@
|
|||||||
// Tasks to run webpack.
|
// Tasks to run webpack.
|
||||||
const fs = require("fs");
|
|
||||||
const gulp = require("gulp");
|
import fs from "fs";
|
||||||
const webpack = require("webpack");
|
import path from "path";
|
||||||
const WebpackDevServer = require("webpack-dev-server");
|
import log from "fancy-log";
|
||||||
const log = require("fancy-log");
|
import gulp from "gulp";
|
||||||
const path = require("path");
|
import webpack from "webpack";
|
||||||
const env = require("../env.cjs");
|
import WebpackDevServer from "webpack-dev-server";
|
||||||
const paths = require("../paths.cjs");
|
import env from "../env.cjs";
|
||||||
const {
|
import paths from "../paths.cjs";
|
||||||
|
import {
|
||||||
createAppConfig,
|
createAppConfig,
|
||||||
createDemoConfig,
|
|
||||||
createCastConfig,
|
createCastConfig,
|
||||||
createHassioConfig,
|
createDemoConfig,
|
||||||
createGalleryConfig,
|
createGalleryConfig,
|
||||||
} = require("../webpack.cjs");
|
createHassioConfig,
|
||||||
|
} from "../webpack.cjs";
|
||||||
|
|
||||||
const bothBuilds = (createConfigFunc, params) => [
|
const bothBuilds = (createConfigFunc, params) => [
|
||||||
createConfigFunc({ ...params, latestBuild: true }),
|
createConfigFunc({ ...params, latestBuild: true }),
|
||||||
@@ -43,6 +44,7 @@ const runDevServer = async ({
|
|||||||
}) => {
|
}) => {
|
||||||
const server = new WebpackDevServer(
|
const server = new WebpackDevServer(
|
||||||
{
|
{
|
||||||
|
hot: false,
|
||||||
open: true,
|
open: true,
|
||||||
host: listenHost,
|
host: listenHost,
|
||||||
port,
|
port,
|
59
build-scripts/list-plugins-and-polyfills.js
Executable file
59
build-scripts/list-plugins-and-polyfills.js
Executable file
@@ -0,0 +1,59 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
// Script to print Babel plugins and Core JS polyfills that will be used by browserslist environments
|
||||||
|
|
||||||
|
import { version as babelVersion } from "@babel/core";
|
||||||
|
import presetEnv from "@babel/preset-env";
|
||||||
|
import compilationTargets from "@babel/helper-compilation-targets";
|
||||||
|
import coreJSCompat from "core-js-compat";
|
||||||
|
import { logPlugin } from "@babel/preset-env/lib/debug.js";
|
||||||
|
import { babelOptions } from "./bundle.cjs";
|
||||||
|
|
||||||
|
const detailsOpen = (heading) =>
|
||||||
|
`<details>\n<summary><h4>${heading}</h4></summary>\n`;
|
||||||
|
const detailsClose = "</details>\n";
|
||||||
|
|
||||||
|
const dummyAPI = {
|
||||||
|
version: babelVersion,
|
||||||
|
assertVersion: () => {},
|
||||||
|
caller: (callback) =>
|
||||||
|
callback({
|
||||||
|
name: "Dummy Bundler",
|
||||||
|
supportsStaticESM: true,
|
||||||
|
supportsDynamicImport: true,
|
||||||
|
supportsTopLevelAwait: true,
|
||||||
|
supportsExportNamespaceFrom: true,
|
||||||
|
}),
|
||||||
|
targets: () => ({}),
|
||||||
|
};
|
||||||
|
|
||||||
|
for (const buildType of ["Modern", "Legacy"]) {
|
||||||
|
const browserslistEnv = buildType.toLowerCase();
|
||||||
|
const babelOpts = babelOptions({ latestBuild: browserslistEnv === "modern" });
|
||||||
|
const presetEnvOpts = babelOpts.presets[0][1];
|
||||||
|
|
||||||
|
// Invoking preset-env in debug mode will log the included plugins
|
||||||
|
console.log(detailsOpen(`${buildType} Build Babel Plugins`));
|
||||||
|
presetEnv.default(dummyAPI, {
|
||||||
|
...presetEnvOpts,
|
||||||
|
browserslistEnv,
|
||||||
|
debug: true,
|
||||||
|
});
|
||||||
|
console.log(detailsClose);
|
||||||
|
|
||||||
|
// Manually log the Core-JS polyfills using the same technique
|
||||||
|
if (presetEnvOpts.useBuiltIns) {
|
||||||
|
console.log(detailsOpen(`${buildType} Build Core-JS Polyfills`));
|
||||||
|
const targets = compilationTargets.default(babelOpts?.targets, {
|
||||||
|
browserslistEnv,
|
||||||
|
});
|
||||||
|
const polyfillList = coreJSCompat({ targets }).list;
|
||||||
|
console.log(
|
||||||
|
"The following %i polyfills may be injected by Babel:\n",
|
||||||
|
polyfillList.length
|
||||||
|
);
|
||||||
|
for (const polyfill of polyfillList) {
|
||||||
|
logPlugin(polyfill, targets, coreJSCompat.data);
|
||||||
|
}
|
||||||
|
console.log(detailsClose);
|
||||||
|
}
|
||||||
|
}
|
@@ -142,4 +142,5 @@ module.exports = {
|
|||||||
createCastConfig,
|
createCastConfig,
|
||||||
createHassioConfig,
|
createHassioConfig,
|
||||||
createGalleryConfig,
|
createGalleryConfig,
|
||||||
|
createRollupConfig,
|
||||||
};
|
};
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
const webpack = require("webpack");
|
const { existsSync } = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
const webpack = require("webpack");
|
||||||
const TerserPlugin = require("terser-webpack-plugin");
|
const TerserPlugin = require("terser-webpack-plugin");
|
||||||
const { WebpackManifestPlugin } = require("webpack-manifest-plugin");
|
const { WebpackManifestPlugin } = require("webpack-manifest-plugin");
|
||||||
const log = require("fancy-log");
|
const log = require("fancy-log");
|
||||||
@@ -41,7 +42,7 @@ const createWebpackConfig = ({
|
|||||||
return {
|
return {
|
||||||
name,
|
name,
|
||||||
mode: isProdBuild ? "production" : "development",
|
mode: isProdBuild ? "production" : "development",
|
||||||
target: ["web", latestBuild ? "es2017" : "es5"],
|
target: `browserslist:${latestBuild ? "modern" : "legacy"}`,
|
||||||
// For tests/CI, source maps are skipped to gain build speed
|
// For tests/CI, source maps are skipped to gain build speed
|
||||||
// For production, generate source maps for accurate stack traces without source code
|
// For production, generate source maps for accurate stack traces without source code
|
||||||
// For development, generate "cheap" versions that can map to original line numbers
|
// For development, generate "cheap" versions that can map to original line numbers
|
||||||
@@ -84,6 +85,13 @@ const createWebpackConfig = ({
|
|||||||
],
|
],
|
||||||
moduleIds: isProdBuild && !isStatsBuild ? "deterministic" : "named",
|
moduleIds: isProdBuild && !isStatsBuild ? "deterministic" : "named",
|
||||||
chunkIds: isProdBuild && !isStatsBuild ? "deterministic" : "named",
|
chunkIds: isProdBuild && !isStatsBuild ? "deterministic" : "named",
|
||||||
|
splitChunks: {
|
||||||
|
// Disable splitting for web workers with ESM output
|
||||||
|
// Imports of external chunks are broken
|
||||||
|
chunks: latestBuild
|
||||||
|
? (chunk) => !chunk.canBeInitial() && !/^.+-worker$/.test(chunk.name)
|
||||||
|
: undefined,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
!isStatsBuild && new WebpackBar({ fancy: !isProdBuild }),
|
!isStatsBuild && new WebpackBar({ fancy: !isProdBuild }),
|
||||||
@@ -132,6 +140,17 @@ const createWebpackConfig = ({
|
|||||||
),
|
),
|
||||||
path.resolve(paths.polymer_dir, "src/util/empty.js")
|
path.resolve(paths.polymer_dir, "src/util/empty.js")
|
||||||
),
|
),
|
||||||
|
// See `src/resources/intl-polyfill-legacy.ts` for explanation
|
||||||
|
!latestBuild &&
|
||||||
|
new webpack.NormalModuleReplacementPlugin(
|
||||||
|
new RegExp(
|
||||||
|
path.resolve(paths.polymer_dir, "src/resources/intl-polyfill.ts")
|
||||||
|
),
|
||||||
|
path.resolve(
|
||||||
|
paths.polymer_dir,
|
||||||
|
"src/resources/intl-polyfill-legacy.ts"
|
||||||
|
)
|
||||||
|
),
|
||||||
!isProdBuild && new LogStartCompilePlugin(),
|
!isProdBuild && new LogStartCompilePlugin(),
|
||||||
].filter(Boolean),
|
].filter(Boolean),
|
||||||
resolve: {
|
resolve: {
|
||||||
@@ -149,9 +168,12 @@ const createWebpackConfig = ({
|
|||||||
"lit/polyfill-support$": "lit/polyfill-support.js",
|
"lit/polyfill-support$": "lit/polyfill-support.js",
|
||||||
"@lit-labs/virtualizer/layouts/grid":
|
"@lit-labs/virtualizer/layouts/grid":
|
||||||
"@lit-labs/virtualizer/layouts/grid.js",
|
"@lit-labs/virtualizer/layouts/grid.js",
|
||||||
|
"@lit-labs/virtualizer/polyfills/resize-observer-polyfill/ResizeObserver":
|
||||||
|
"@lit-labs/virtualizer/polyfills/resize-observer-polyfill/ResizeObserver.js",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
|
module: latestBuild,
|
||||||
filename: ({ chunk }) =>
|
filename: ({ chunk }) =>
|
||||||
!isProdBuild || isStatsBuild || dontHash.has(chunk.name)
|
!isProdBuild || isStatsBuild || dontHash.has(chunk.name)
|
||||||
? "[name].js"
|
? "[name].js"
|
||||||
@@ -170,22 +192,29 @@ const createWebpackConfig = ({
|
|||||||
// Since production source maps don't include sources, we need to point to them elsewhere
|
// Since production source maps don't include sources, we need to point to them elsewhere
|
||||||
// For dependencies, just provide the path (no source in browser)
|
// For dependencies, just provide the path (no source in browser)
|
||||||
// Otherwise, point to the raw code on GitHub for browser to load
|
// Otherwise, point to the raw code on GitHub for browser to load
|
||||||
devtoolModuleFilenameTemplate:
|
...Object.fromEntries(
|
||||||
|
["", "Fallback"].map((v) => [
|
||||||
|
`devtool${v}ModuleFilenameTemplate`,
|
||||||
!isTestBuild && isProdBuild
|
!isTestBuild && isProdBuild
|
||||||
? (info) => {
|
? (info) => {
|
||||||
const sourcePath = info.resourcePath.replace(/^\.\//, "");
|
|
||||||
if (
|
if (
|
||||||
sourcePath.startsWith("node_modules") ||
|
!path.isAbsolute(info.absoluteResourcePath) ||
|
||||||
sourcePath.startsWith("webpack")
|
!existsSync(info.resourcePath) ||
|
||||||
|
info.resourcePath.startsWith("./node_modules")
|
||||||
) {
|
) {
|
||||||
return `no-source/${sourcePath}`;
|
// Source URLs are unknown for dependencies, so we use a relative URL with a
|
||||||
|
// non - existent top directory. This results in a clean source tree in browser
|
||||||
|
// dev tools, and they stay happy getting 404s with valid requests.
|
||||||
|
return `/unknown${path.resolve("/", info.resourcePath)}`;
|
||||||
}
|
}
|
||||||
return `${bundle.sourceMapURL()}/${sourcePath}`;
|
return new URL(info.resourcePath, bundle.sourceMapURL()).href;
|
||||||
}
|
}
|
||||||
: undefined,
|
: undefined,
|
||||||
|
])
|
||||||
|
),
|
||||||
},
|
},
|
||||||
experiments: {
|
experiments: {
|
||||||
topLevelAwait: true,
|
outputModule: true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@@ -232,4 +261,5 @@ module.exports = {
|
|||||||
createCastConfig,
|
createCastConfig,
|
||||||
createHassioConfig,
|
createHassioConfig,
|
||||||
createGalleryConfig,
|
createGalleryConfig,
|
||||||
|
createWebpackConfig,
|
||||||
};
|
};
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
self.addEventListener("fetch", function(event) {
|
self.addEventListener("fetch", (event) => {
|
||||||
event.respondWith(fetch(event.request));
|
event.respondWith(fetch(event.request));
|
||||||
});
|
});
|
||||||
|
24
cast/src/html/_social_meta.html.template
Normal file
24
cast/src/html/_social_meta.html.template
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
<meta property="fb:app_id" content="338291289691179" />
|
||||||
|
<meta property="og:title" content="Home Assistant Cast" />
|
||||||
|
<meta property="og:site_name" content="Home Assistant Cast" />
|
||||||
|
<meta property="og:url" content="https://cast.home-assistant.io/" />
|
||||||
|
<meta property="og:type" content="website" />
|
||||||
|
<meta
|
||||||
|
property="og:description"
|
||||||
|
content="Show Home Assistant on your Chromecast or Google Assistant devices with a screen."
|
||||||
|
/>
|
||||||
|
<meta
|
||||||
|
property="og:image"
|
||||||
|
content="https://cast.home-assistant.io/images/google-nest-hub.png"
|
||||||
|
/>
|
||||||
|
<meta name="twitter:card" content="summary_large_image" />
|
||||||
|
<meta name="twitter:site" content="@home_assistant" />
|
||||||
|
<meta name="twitter:title" content="Home Assistant Cast" />
|
||||||
|
<meta
|
||||||
|
name="twitter:description"
|
||||||
|
content="Show Home Assistant on your Chromecast or Google Assistant devices with a screen."
|
||||||
|
/>
|
||||||
|
<meta
|
||||||
|
name="twitter:image"
|
||||||
|
content="https://cast.home-assistant.io/images/google-nest-hub.png"
|
||||||
|
/>
|
@@ -3,7 +3,7 @@
|
|||||||
<head>
|
<head>
|
||||||
<title>Home Assistant Cast - FAQ</title>
|
<title>Home Assistant Cast - FAQ</title>
|
||||||
<link rel="icon" href="/images/ha-cast-icon.png" type="image/png" />
|
<link rel="icon" href="/images/ha-cast-icon.png" type="image/png" />
|
||||||
<%= renderTemplate('_style_base') %>
|
<%= renderTemplate("../../../src/html/_style_base.html.template") %>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
background-color: #e5e5e5;
|
background-color: #e5e5e5;
|
||||||
@@ -35,25 +35,14 @@
|
|||||||
/>
|
/>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<%= renderTemplate('_js_base') %>
|
<%= renderTemplate("../../../src/html/_js_base.html.template") %>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import("<%= latestLauncherJS %>");
|
<% for (const entry of latestEntryJS) { %>
|
||||||
|
import("<%= entry %>");
|
||||||
|
<% } %>
|
||||||
window.latestJS = true;
|
window.latestJS = true;
|
||||||
</script>
|
</script>
|
||||||
|
<%= renderTemplate("../../../src/html/_script_load_es5.html.template") %>
|
||||||
<script>
|
|
||||||
if (!window.latestJS) {
|
|
||||||
<% if (useRollup) { %>
|
|
||||||
_ls("/static/js/s.min.js").onload = function() {
|
|
||||||
System.import("<%= es5LauncherJS %>");
|
|
||||||
};
|
|
||||||
<% } else { %>
|
|
||||||
_ls("<%= es5LauncherJS %>");
|
|
||||||
<% } %>
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<hc-layout subtitle="FAQ">
|
<hc-layout subtitle="FAQ">
|
||||||
<style>
|
<style>
|
||||||
a {
|
a {
|
35
cast/src/html/index.html.template
Normal file
35
cast/src/html/index.html.template
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Home Assistant Cast</title>
|
||||||
|
<link rel="manifest" href="/manifest.json" />
|
||||||
|
<link rel="icon" href="/images/ha-cast-icon.png" type="image/png" />
|
||||||
|
<%= renderTemplate("../../../src/html/_style_base.html.template") %>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
background-color: #e5e5e5;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<%= renderTemplate("_social_meta.html.template") %>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<%= renderTemplate("../../../src/html/_js_base.html.template") %>
|
||||||
|
<hc-connect></hc-connect>
|
||||||
|
<script>
|
||||||
|
<% for (const entry of latestEntryJS) { %>
|
||||||
|
import("<%= entry %>");
|
||||||
|
<% } %>
|
||||||
|
window.latestJS = true;
|
||||||
|
</script>
|
||||||
|
<%= renderTemplate("../../../src/html/_script_load_es5.html.template") %>
|
||||||
|
<script>
|
||||||
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
||||||
|
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
||||||
|
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
||||||
|
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
||||||
|
|
||||||
|
ga('create', 'UA-57927901-9', 'auto');
|
||||||
|
ga('send', 'pageview', location.pathname.includes("auth_callback") === -1 ? location.pathname : "/");
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@@ -1,57 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Home Assistant Cast</title>
|
|
||||||
<link rel="manifest" href="/manifest.json" />
|
|
||||||
<link rel="icon" href="/images/ha-cast-icon.png" type="image/png" />
|
|
||||||
<%= renderTemplate('_style_base') %>
|
|
||||||
<style>
|
|
||||||
body {
|
|
||||||
background-color: #e5e5e5;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<meta property="fb:app_id" content="338291289691179">
|
|
||||||
<meta property="og:title" content="Home Assistant Cast">
|
|
||||||
<meta property="og:site_name" content="Home Assistant Cast">
|
|
||||||
<meta property="og:url" content="https://cast.home-assistant.io/">
|
|
||||||
<meta property="og:type" content="website">
|
|
||||||
<meta property="og:description" content="Show Home Assistant on your Chromecast or Google Assistant devices with a screen.">
|
|
||||||
<meta property="og:image" content="https://cast.home-assistant.io/images/google-nest-hub.png">
|
|
||||||
<meta name="twitter:card" content="summary_large_image">
|
|
||||||
<meta name="twitter:site" content="@home_assistant">
|
|
||||||
<meta name="twitter:title" content="Home Assistant Cast">
|
|
||||||
<meta name="twitter:description" content="Show Home Assistant on your Chromecast or Google Assistant devices with a screen.">
|
|
||||||
<meta name="twitter:image" content="https://cast.home-assistant.io/images/google-nest-hub.png">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<%= renderTemplate('_js_base') %>
|
|
||||||
|
|
||||||
<hc-connect></hc-connect>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import("<%= latestLauncherJS %>");
|
|
||||||
window.latestJS = true;
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
if (!window.latestJS) {
|
|
||||||
<% if (useRollup) { %>
|
|
||||||
_ls("/static/js/s.min.js").onload = function() {
|
|
||||||
System.import("<%= es5LauncherJS %>");
|
|
||||||
};
|
|
||||||
<% } else { %>
|
|
||||||
_ls("<%= es5LauncherJS %>");
|
|
||||||
<% } %>
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script>
|
|
||||||
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
|
||||||
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
|
||||||
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
|
||||||
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
|
||||||
|
|
||||||
ga('create', 'UA-57927901-9', 'auto');
|
|
||||||
ga('send', 'pageview', location.pathname.includes("auth_callback") === -1 ? location.pathname : "/");
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@@ -22,25 +22,14 @@
|
|||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<%= renderTemplate('_js_base') %>
|
<%= renderTemplate("../../../src/html/_js_base.html.template") %>
|
||||||
|
|
||||||
<cast-media-player></cast-media-player>
|
<cast-media-player></cast-media-player>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import("<%= latestMediaJS %>");
|
<% for (const entry of latestEntryJS) { %>
|
||||||
|
import("<%= entry %>");
|
||||||
|
<% } %>
|
||||||
window.latestJS = true;
|
window.latestJS = true;
|
||||||
</script>
|
</script>
|
||||||
|
<%= renderTemplate("../../../src/html/_script_load_es5.html.template") %>
|
||||||
<script>
|
|
||||||
if (!window.latestJS) {
|
|
||||||
<% if (useRollup) { %>
|
|
||||||
_ls("/static/js/s.min.js").onload = function() {
|
|
||||||
System.import("<%= es5MediaJS %>");
|
|
||||||
};
|
|
||||||
<% } else { %>
|
|
||||||
_ls("<%= es5MediaJS %>");
|
|
||||||
<% } %>
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@@ -1,8 +1,10 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<script src="//www.gstatic.com/cast/sdk/libs/caf_receiver/v3/cast_receiver_framework.js"></script>
|
<script src="//www.gstatic.com/cast/sdk/libs/caf_receiver/v3/cast_receiver_framework.js"></script>
|
||||||
<script type="module" src="<%= latestReceiverJS %>"></script>
|
<% for (const entry of latestEntryJS) { %>
|
||||||
<%= renderTemplate('_style_base') %>
|
<script type="module" src="<%= entry %>"></script>
|
||||||
|
<% } %>
|
||||||
|
<%= renderTemplate("../../../src/html/_style_base.html.template") %>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
background-color: white;
|
background-color: white;
|
||||||
|
@@ -190,7 +190,7 @@ export class HcConnect extends LitElement {
|
|||||||
|
|
||||||
private _handleInputKeyDown(ev: KeyboardEvent) {
|
private _handleInputKeyDown(ev: KeyboardEvent) {
|
||||||
// Handle pressing enter.
|
// Handle pressing enter.
|
||||||
if (ev.keyCode === 13) {
|
if (ev.key === "Enter") {
|
||||||
this._handleConnect();
|
this._handleConnect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,19 +1,21 @@
|
|||||||
const castContext = cast.framework.CastReceiverContext.getInstance();
|
import { framework } from "../receiver/cast_framework";
|
||||||
|
|
||||||
|
const castContext = framework.CastReceiverContext.getInstance();
|
||||||
|
|
||||||
const playerManager = castContext.getPlayerManager();
|
const playerManager = castContext.getPlayerManager();
|
||||||
|
|
||||||
playerManager.setMessageInterceptor(
|
playerManager.setMessageInterceptor(
|
||||||
cast.framework.messages.MessageType.LOAD,
|
framework.messages.MessageType.LOAD,
|
||||||
(loadRequestData) => {
|
(loadRequestData) => {
|
||||||
const media = loadRequestData.media;
|
const media = loadRequestData.media;
|
||||||
// Special handling if it came from Google Assistant
|
// Special handling if it came from Google Assistant
|
||||||
if (media.entity) {
|
if (media.entity) {
|
||||||
media.contentId = media.entity;
|
media.contentId = media.entity;
|
||||||
media.streamType = cast.framework.messages.StreamType.LIVE;
|
media.streamType = framework.messages.StreamType.LIVE;
|
||||||
media.contentType = "application/vnd.apple.mpegurl";
|
media.contentType = "application/vnd.apple.mpegurl";
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
media.hlsVideoSegmentFormat =
|
media.hlsVideoSegmentFormat =
|
||||||
cast.framework.messages.HlsVideoSegmentFormat.FMP4;
|
framework.messages.HlsVideoSegmentFormat.FMP4;
|
||||||
}
|
}
|
||||||
return loadRequestData;
|
return loadRequestData;
|
||||||
}
|
}
|
||||||
|
@@ -1,2 +1,3 @@
|
|||||||
/* eslint-disable no-undef */
|
import { framework } from "./cast_framework";
|
||||||
export const castContext = cast.framework.CastReceiverContext.getInstance();
|
|
||||||
|
export const castContext = framework.CastReceiverContext.getInstance();
|
||||||
|
3
cast/src/receiver/cast_framework.ts
Normal file
3
cast/src/receiver/cast_framework.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
import type { cast as ReceiverCast } from "chromecast-caf-receiver";
|
||||||
|
|
||||||
|
export const framework = (cast as unknown as typeof ReceiverCast).framework;
|
@@ -1,4 +1,4 @@
|
|||||||
/* eslint-disable no-undef */
|
import { framework } from "./cast_framework";
|
||||||
import { CAST_NS } from "../../../src/cast/const";
|
import { CAST_NS } from "../../../src/cast/const";
|
||||||
import { HassMessage } from "../../../src/cast/receiver_messages";
|
import { HassMessage } from "../../../src/cast/receiver_messages";
|
||||||
import "../../../src/resources/custom-card-support";
|
import "../../../src/resources/custom-card-support";
|
||||||
@@ -34,14 +34,14 @@ const setTouchControlsVisibility = (visible: boolean) => {
|
|||||||
let timeOut: number | undefined;
|
let timeOut: number | undefined;
|
||||||
|
|
||||||
const playDummyMedia = (viewTitle?: string) => {
|
const playDummyMedia = (viewTitle?: string) => {
|
||||||
const loadRequestData = new cast.framework.messages.LoadRequestData();
|
const loadRequestData = new framework.messages.LoadRequestData();
|
||||||
loadRequestData.autoplay = true;
|
loadRequestData.autoplay = true;
|
||||||
loadRequestData.media = new cast.framework.messages.MediaInformation();
|
loadRequestData.media = new framework.messages.MediaInformation();
|
||||||
loadRequestData.media.contentId =
|
loadRequestData.media.contentId =
|
||||||
"https://cast.home-assistant.io/images/google-nest-hub.png";
|
"https://cast.home-assistant.io/images/google-nest-hub.png";
|
||||||
loadRequestData.media.contentType = "image/jpeg";
|
loadRequestData.media.contentType = "image/jpeg";
|
||||||
loadRequestData.media.streamType = cast.framework.messages.StreamType.NONE;
|
loadRequestData.media.streamType = framework.messages.StreamType.NONE;
|
||||||
const metadata = new cast.framework.messages.GenericMediaMetadata();
|
const metadata = new framework.messages.GenericMediaMetadata();
|
||||||
metadata.title = viewTitle;
|
metadata.title = viewTitle;
|
||||||
loadRequestData.media.metadata = metadata;
|
loadRequestData.media.metadata = metadata;
|
||||||
|
|
||||||
@@ -86,10 +86,10 @@ const showMediaPlayer = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const options = new cast.framework.CastReceiverOptions();
|
const options = new framework.CastReceiverOptions();
|
||||||
options.disableIdleTimeout = true;
|
options.disableIdleTimeout = true;
|
||||||
options.customNamespaces = {
|
options.customNamespaces = {
|
||||||
[CAST_NS]: cast.framework.system.MessageType.JSON,
|
[CAST_NS]: framework.system.MessageType.JSON,
|
||||||
};
|
};
|
||||||
|
|
||||||
castContext.addCustomMessageListener(
|
castContext.addCustomMessageListener(
|
||||||
@@ -98,8 +98,7 @@ castContext.addCustomMessageListener(
|
|||||||
(ev: ReceivedMessage<HassMessage>) => {
|
(ev: ReceivedMessage<HassMessage>) => {
|
||||||
// We received a show Lovelace command, stop media from playing, hide media player and show Lovelace controller
|
// We received a show Lovelace command, stop media from playing, hide media player and show Lovelace controller
|
||||||
if (
|
if (
|
||||||
playerManager.getPlayerState() !==
|
playerManager.getPlayerState() !== framework.messages.PlayerState.IDLE
|
||||||
cast.framework.messages.PlayerState.IDLE
|
|
||||||
) {
|
) {
|
||||||
playerManager.stop();
|
playerManager.stop();
|
||||||
} else {
|
} else {
|
||||||
@@ -114,7 +113,7 @@ castContext.addCustomMessageListener(
|
|||||||
const playerManager = castContext.getPlayerManager();
|
const playerManager = castContext.getPlayerManager();
|
||||||
|
|
||||||
playerManager.setMessageInterceptor(
|
playerManager.setMessageInterceptor(
|
||||||
cast.framework.messages.MessageType.LOAD,
|
framework.messages.MessageType.LOAD,
|
||||||
(loadRequestData) => {
|
(loadRequestData) => {
|
||||||
if (
|
if (
|
||||||
loadRequestData.media.contentId ===
|
loadRequestData.media.contentId ===
|
||||||
@@ -128,25 +127,24 @@ playerManager.setMessageInterceptor(
|
|||||||
// Special handling if it came from Google Assistant
|
// Special handling if it came from Google Assistant
|
||||||
if (media.entity) {
|
if (media.entity) {
|
||||||
media.contentId = media.entity;
|
media.contentId = media.entity;
|
||||||
media.streamType = cast.framework.messages.StreamType.LIVE;
|
media.streamType = framework.messages.StreamType.LIVE;
|
||||||
media.contentType = "application/vnd.apple.mpegurl";
|
media.contentType = "application/vnd.apple.mpegurl";
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
media.hlsVideoSegmentFormat =
|
media.hlsVideoSegmentFormat =
|
||||||
cast.framework.messages.HlsVideoSegmentFormat.FMP4;
|
framework.messages.HlsVideoSegmentFormat.FMP4;
|
||||||
}
|
}
|
||||||
return loadRequestData;
|
return loadRequestData;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
playerManager.addEventListener(
|
playerManager.addEventListener(
|
||||||
cast.framework.events.EventType.MEDIA_STATUS,
|
framework.events.EventType.MEDIA_STATUS,
|
||||||
(event) => {
|
(event) => {
|
||||||
if (
|
if (
|
||||||
event.mediaStatus?.playerState ===
|
event.mediaStatus?.playerState === framework.messages.PlayerState.IDLE &&
|
||||||
cast.framework.messages.PlayerState.IDLE &&
|
|
||||||
event.mediaStatus?.idleReason &&
|
event.mediaStatus?.idleReason &&
|
||||||
event.mediaStatus?.idleReason !==
|
event.mediaStatus?.idleReason !==
|
||||||
cast.framework.messages.IdleReason.INTERRUPTED
|
framework.messages.IdleReason.INTERRUPTED
|
||||||
) {
|
) {
|
||||||
// media finished or stopped, return to default Lovelace
|
// media finished or stopped, return to default Lovelace
|
||||||
showLovelaceController();
|
showLovelaceController();
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
self.addEventListener("fetch", function(event) {
|
self.addEventListener("fetch", (event) => {
|
||||||
event.respondWith(fetch(event.request));
|
event.respondWith(fetch(event.request));
|
||||||
});
|
});
|
||||||
|
26
demo/src/html/_social_meta.html.template
Normal file
26
demo/src/html/_social_meta.html.template
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<meta property="fb:app_id" content="338291289691179" />
|
||||||
|
<meta property="og:title" content="Home Assistant Demo" />
|
||||||
|
<meta property="og:site_name" content="Home Assistant" />
|
||||||
|
<meta property="og:url" content="https://demo.home-assistant.io/" />
|
||||||
|
<meta property="og:type" content="website" />
|
||||||
|
<meta
|
||||||
|
property="og:description"
|
||||||
|
content="Open source home automation that puts local control and privacy first."
|
||||||
|
/>
|
||||||
|
<meta
|
||||||
|
property="og:image"
|
||||||
|
content="https://www.home-assistant.io/images/default-social.png"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<meta name="twitter:card" content="summary_large_image" />
|
||||||
|
<meta name="twitter:site" content="@home_assistant" />
|
||||||
|
|
||||||
|
<meta name="twitter:title" content="Home Assistant" />
|
||||||
|
<meta
|
||||||
|
name="twitter:description"
|
||||||
|
content="Open source home automation that puts local control and privacy first."
|
||||||
|
/>
|
||||||
|
<meta
|
||||||
|
name="twitter:image"
|
||||||
|
content="https://www.home-assistant.io/images/default-social.png"
|
||||||
|
/>
|
@@ -1,9 +1,8 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<title>Home Assistant Demo</title>
|
||||||
<link rel="manifest" href="/manifest.json" crossorigin="use-credentials" />
|
<%= renderTemplate("../../../src/html/_header.html.template") %>
|
||||||
<link rel="icon" href="/static/icons/favicon.ico" />
|
|
||||||
<link rel="mask-icon" href="/static/icons/mask-icon.svg" color="#03a9f4" />
|
<link rel="mask-icon" href="/static/icons/mask-icon.svg" color="#03a9f4" />
|
||||||
<link
|
<link
|
||||||
rel="apple-touch-icon"
|
rel="apple-touch-icon"
|
||||||
@@ -35,33 +34,7 @@
|
|||||||
content="width=device-width, initial-scale=1, shrink-to-fit=no"
|
content="width=device-width, initial-scale=1, shrink-to-fit=no"
|
||||||
/>
|
/>
|
||||||
<meta name="theme-color" content="#03a9f4" />
|
<meta name="theme-color" content="#03a9f4" />
|
||||||
<meta property="fb:app_id" content="338291289691179" />
|
<%= renderTemplate("_social_meta.html.template") %>
|
||||||
<meta property="og:title" content="Home Assistant Demo" />
|
|
||||||
<meta property="og:site_name" content="Home Assistant" />
|
|
||||||
<meta property="og:url" content="https://demo.home-assistant.io/" />
|
|
||||||
<meta property="og:type" content="website" />
|
|
||||||
<meta
|
|
||||||
property="og:description"
|
|
||||||
content="Open source home automation that puts local control and privacy first."
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
property="og:image"
|
|
||||||
content="https://www.home-assistant.io/images/default-social.png"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<meta name="twitter:card" content="summary_large_image" />
|
|
||||||
<meta name="twitter:site" content="@home_assistant" />
|
|
||||||
|
|
||||||
<meta name="twitter:title" content="Home Assistant" />
|
|
||||||
<meta
|
|
||||||
name="twitter:description"
|
|
||||||
content="Open source home automation that puts local control and privacy first."
|
|
||||||
/>
|
|
||||||
<meta
|
|
||||||
name="twitter:image"
|
|
||||||
content="https://www.home-assistant.io/images/default-social.png"
|
|
||||||
/>
|
|
||||||
<title>Home Assistant Demo</title>
|
|
||||||
<style>
|
<style>
|
||||||
html {
|
html {
|
||||||
background-color: var(--primary-background-color, #fafafa);
|
background-color: var(--primary-background-color, #fafafa);
|
||||||
@@ -107,29 +80,19 @@
|
|||||||
</svg>
|
</svg>
|
||||||
<div id="ha-launch-screen-info-box" class="ha-launch-screen-spacer"></div>
|
<div id="ha-launch-screen-info-box" class="ha-launch-screen-spacer"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ha-demo></ha-demo>
|
<ha-demo></ha-demo>
|
||||||
|
<%= renderTemplate("../../../src/html/_js_base.html.template") %>
|
||||||
<%= renderTemplate('_js_base') %>
|
<%= renderTemplate("../../../src/html/_preload_roboto.html.template") %>
|
||||||
<%= renderTemplate('_preload_roboto') %>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import("<%= latestDemoJS %>");
|
// Safari 12 and below does not have a compliant ES2015 implementation of template literals, so we ship ES5
|
||||||
window.latestJS = true;
|
if (!isS11_12) {
|
||||||
</script>
|
<% for (const entry of latestEntryJS) { %>
|
||||||
|
import("<%= entry %>");
|
||||||
<script>
|
|
||||||
if (!window.latestJS) {
|
|
||||||
<% if (useRollup) { %>
|
|
||||||
_ls("/static/js/s.min.js").onload = function() {
|
|
||||||
System.import("<%= es5DemoJS %>");
|
|
||||||
};
|
|
||||||
<% } else { %>
|
|
||||||
_ls("<%= es5DemoJS %>");
|
|
||||||
<% } %>
|
<% } %>
|
||||||
|
window.latestJS = true;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
<%= renderTemplate("../../../src/html/_script_load_es5.html.template") %>
|
||||||
<script>
|
<script>
|
||||||
var _gaq = [["_setAccount", "UA-57927901-5"], ["_trackPageview"]];
|
var _gaq = [["_setAccount", "UA-57927901-5"], ["_trackPageview"]];
|
||||||
(function (d, t) {
|
(function (d, t) {
|
||||||
|
@@ -1,11 +1,10 @@
|
|||||||
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
export const mockConfigEntries = (hass: MockHomeAssistant) => {
|
export const mockConfigEntries = (hass: MockHomeAssistant) => {
|
||||||
hass.mockWS("config_entries/get", () => [
|
hass.mockWS("config_entries/get", () => ({
|
||||||
{
|
|
||||||
entry_id: "co2signal",
|
entry_id: "co2signal",
|
||||||
domain: "co2signal",
|
domain: "co2signal",
|
||||||
title: "CO2 Signal",
|
title: "Electricity Maps",
|
||||||
source: "user",
|
source: "user",
|
||||||
state: "loaded",
|
state: "loaded",
|
||||||
supports_options: false,
|
supports_options: false,
|
||||||
@@ -15,6 +14,5 @@ export const mockConfigEntries = (hass: MockHomeAssistant) => {
|
|||||||
pref_disable_polling: false,
|
pref_disable_polling: false,
|
||||||
disabled_by: null,
|
disabled_by: null,
|
||||||
reason: null,
|
reason: null,
|
||||||
},
|
}));
|
||||||
]);
|
|
||||||
};
|
};
|
||||||
|
@@ -1,16 +1,20 @@
|
|||||||
import { PersistentNotification } from "../../../src/data/persistent_notification";
|
import { PersistentNotificationMessage } from "../../../src/data/persistent_notification";
|
||||||
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||||
|
|
||||||
export const mockPersistentNotification = (hass: MockHomeAssistant) => {
|
export const mockPersistentNotification = (hass: MockHomeAssistant) => {
|
||||||
hass.mockWS("persistent_notification/get", () =>
|
hass.mockWS("persistent_notification/subscribe", (_msg, _hass, onChange) => {
|
||||||
Promise.resolve([
|
onChange!({
|
||||||
{
|
type: "added",
|
||||||
|
notifications: {
|
||||||
|
"demo-1": {
|
||||||
created_at: new Date().toISOString(),
|
created_at: new Date().toISOString(),
|
||||||
message: "There was motion detected in the backyard.",
|
message: "There was motion detected in the backyard.",
|
||||||
notification_id: "demo-1",
|
notification_id: "demo-1",
|
||||||
title: "Motion Detected!",
|
title: "Motion Detected!",
|
||||||
status: "unread",
|
status: "unread",
|
||||||
},
|
},
|
||||||
] as PersistentNotification[])
|
},
|
||||||
);
|
} as PersistentNotificationMessage);
|
||||||
|
return () => {};
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
@@ -72,6 +72,7 @@ const generateSumStatistics = (
|
|||||||
min: null,
|
min: null,
|
||||||
max: null,
|
max: null,
|
||||||
last_reset: 0,
|
last_reset: 0,
|
||||||
|
change: add,
|
||||||
state: initValue + sum,
|
state: initValue + sum,
|
||||||
sum,
|
sum,
|
||||||
});
|
});
|
||||||
@@ -103,8 +104,8 @@ const generateCurvedStatistics = (
|
|||||||
let half = false;
|
let half = false;
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
while (end > currentDate && currentDate < now) {
|
while (end > currentDate && currentDate < now) {
|
||||||
const add = Math.random() * maxDiff;
|
const add = i * (Math.random() * maxDiff);
|
||||||
sum += i * add;
|
sum += add;
|
||||||
statistics.push({
|
statistics.push({
|
||||||
start: currentDate.getTime(),
|
start: currentDate.getTime(),
|
||||||
end: currentDate.getTime(),
|
end: currentDate.getTime(),
|
||||||
@@ -112,6 +113,7 @@ const generateCurvedStatistics = (
|
|||||||
min: null,
|
min: null,
|
||||||
max: null,
|
max: null,
|
||||||
last_reset: 0,
|
last_reset: 0,
|
||||||
|
change: add,
|
||||||
state: initValue + sum,
|
state: initValue + sum,
|
||||||
sum: metered ? sum : null,
|
sum: metered ? sum : null,
|
||||||
});
|
});
|
||||||
|
@@ -45,6 +45,10 @@ export default [
|
|||||||
header: "Users",
|
header: "Users",
|
||||||
pages: ["user-types", "configuration-menu"],
|
pages: ["user-types", "configuration-menu"],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
category: "date-time",
|
||||||
|
header: "Date and Time",
|
||||||
|
},
|
||||||
{
|
{
|
||||||
category: "design.home-assistant.io",
|
category: "design.home-assistant.io",
|
||||||
header: "About",
|
header: "About",
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
import "@polymer/app-layout/app-toolbar/app-toolbar";
|
|
||||||
import { html, css, LitElement } from "lit";
|
import { html, css, LitElement } from "lit";
|
||||||
import { customElement, property, query, state } from "lit/decorators";
|
import { customElement, property, query, state } from "lit/decorators";
|
||||||
import { applyThemesOnElement } from "../../../src/common/dom/apply_themes_on_element";
|
import { applyThemesOnElement } from "../../../src/common/dom/apply_themes_on_element";
|
||||||
@@ -7,6 +6,7 @@ import "../../../src/components/ha-switch";
|
|||||||
import { HomeAssistant } from "../../../src/types";
|
import { HomeAssistant } from "../../../src/types";
|
||||||
import "./demo-card";
|
import "./demo-card";
|
||||||
import type { DemoCardConfig } from "./demo-card";
|
import type { DemoCardConfig } from "./demo-card";
|
||||||
|
import "../ha-demo-options";
|
||||||
|
|
||||||
@customElement("demo-cards")
|
@customElement("demo-cards")
|
||||||
class DemoCards extends LitElement {
|
class DemoCards extends LitElement {
|
||||||
@@ -20,20 +20,14 @@ class DemoCards extends LitElement {
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
return html`
|
return html`
|
||||||
<app-toolbar>
|
<ha-demo-options>
|
||||||
<div class="filters">
|
|
||||||
<ha-formfield label="Show config">
|
<ha-formfield label="Show config">
|
||||||
<ha-switch
|
<ha-switch @change=${this._showConfigToggled}> </ha-switch>
|
||||||
.checked=${this._showConfig}
|
|
||||||
@change=${this._showConfigToggled}
|
|
||||||
>
|
|
||||||
</ha-switch>
|
|
||||||
</ha-formfield>
|
</ha-formfield>
|
||||||
<ha-formfield label="Dark theme">
|
<ha-formfield label="Dark theme">
|
||||||
<ha-switch @change=${this._darkThemeToggled}> </ha-switch>
|
<ha-switch @change=${this._darkThemeToggled}> </ha-switch>
|
||||||
</ha-formfield>
|
</ha-formfield>
|
||||||
</div>
|
</ha-demo-options>
|
||||||
</app-toolbar>
|
|
||||||
<div id="container">
|
<div id="container">
|
||||||
<div class="cards">
|
<div class="cards">
|
||||||
${this.configs.map(
|
${this.configs.map(
|
||||||
@@ -69,12 +63,6 @@ class DemoCards extends LitElement {
|
|||||||
demo-card {
|
demo-card {
|
||||||
margin: 16px 16px 32px;
|
margin: 16px 16px 32px;
|
||||||
}
|
}
|
||||||
app-toolbar {
|
|
||||||
background-color: var(--light-primary-color);
|
|
||||||
}
|
|
||||||
.filters {
|
|
||||||
margin-left: 60px;
|
|
||||||
}
|
|
||||||
ha-formfield {
|
ha-formfield {
|
||||||
margin-right: 16px;
|
margin-right: 16px;
|
||||||
}
|
}
|
||||||
|
@@ -1,93 +0,0 @@
|
|||||||
import { html } from "@polymer/polymer/lib/utils/html-tag";
|
|
||||||
/* eslint-plugin-disable lit */
|
|
||||||
import { PolymerElement } from "@polymer/polymer/polymer-element";
|
|
||||||
import "../../../src/components/ha-card";
|
|
||||||
import "../../../src/dialogs/more-info/more-info-content";
|
|
||||||
import "../../../src/state-summary/state-card-content";
|
|
||||||
|
|
||||||
class DemoMoreInfo extends PolymerElement {
|
|
||||||
static get template() {
|
|
||||||
return html`
|
|
||||||
<style>
|
|
||||||
.root {
|
|
||||||
display: flex;
|
|
||||||
}
|
|
||||||
#card {
|
|
||||||
max-width: 400px;
|
|
||||||
width: 100vw;
|
|
||||||
}
|
|
||||||
ha-card {
|
|
||||||
width: 352px;
|
|
||||||
padding: 20px 24px;
|
|
||||||
}
|
|
||||||
state-card-content {
|
|
||||||
display: block;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
pre {
|
|
||||||
width: 400px;
|
|
||||||
margin: 0 16px;
|
|
||||||
overflow: auto;
|
|
||||||
color: var(--primary-text-color);
|
|
||||||
}
|
|
||||||
@media only screen and (max-width: 800px) {
|
|
||||||
.root {
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
pre {
|
|
||||||
margin: 16px 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<div class="root">
|
|
||||||
<div id="card">
|
|
||||||
<ha-card>
|
|
||||||
<state-card-content
|
|
||||||
state-obj="[[_stateObj]]"
|
|
||||||
hass="[[hass]]"
|
|
||||||
in-dialog
|
|
||||||
></state-card-content>
|
|
||||||
|
|
||||||
<more-info-content
|
|
||||||
hass="[[hass]]"
|
|
||||||
state-obj="[[_stateObj]]"
|
|
||||||
></more-info-content>
|
|
||||||
</ha-card>
|
|
||||||
</div>
|
|
||||||
<template is="dom-if" if="[[showConfig]]">
|
|
||||||
<pre>[[_jsonEntity(_stateObj)]]</pre>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
|
|
||||||
static get properties() {
|
|
||||||
return {
|
|
||||||
hass: Object,
|
|
||||||
entityId: String,
|
|
||||||
showConfig: Boolean,
|
|
||||||
_stateObj: {
|
|
||||||
type: Object,
|
|
||||||
computed: "_getState(entityId, hass.states)",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
_getState(entityId, states) {
|
|
||||||
return states[entityId];
|
|
||||||
}
|
|
||||||
|
|
||||||
_jsonEntity(stateObj) {
|
|
||||||
// We are caching some things on stateObj
|
|
||||||
// (it sucks, we will remove in the future)
|
|
||||||
const tmp = {};
|
|
||||||
Object.keys(stateObj).forEach((key) => {
|
|
||||||
if (key[0] !== "_") {
|
|
||||||
tmp[key] = stateObj[key];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return JSON.stringify(tmp, null, 2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
customElements.define("demo-more-info", DemoMoreInfo);
|
|
93
gallery/src/components/demo-more-info.ts
Normal file
93
gallery/src/components/demo-more-info.ts
Normal file
@@ -0,0 +1,93 @@
|
|||||||
|
import { LitElement, css, html } from "lit";
|
||||||
|
import { customElement, property } from "lit/decorators";
|
||||||
|
import "../../../src/components/ha-card";
|
||||||
|
import "../../../src/dialogs/more-info/more-info-content";
|
||||||
|
import "../../../src/state-summary/state-card-content";
|
||||||
|
import "../ha-demo-options";
|
||||||
|
import { HomeAssistant } from "../../../src/types";
|
||||||
|
|
||||||
|
@customElement("demo-more-info")
|
||||||
|
class DemoMoreInfo extends LitElement {
|
||||||
|
@property() public hass!: HomeAssistant;
|
||||||
|
|
||||||
|
@property() public entityId!: string;
|
||||||
|
|
||||||
|
@property() public showConfig!: boolean;
|
||||||
|
|
||||||
|
render() {
|
||||||
|
const state = this._getState(this.entityId, this.hass.states);
|
||||||
|
return html`
|
||||||
|
<div class="root">
|
||||||
|
<div id="card">
|
||||||
|
<ha-card>
|
||||||
|
<state-card-content
|
||||||
|
.stateObj=${state}
|
||||||
|
.hass=${this.hass}
|
||||||
|
in-dialog
|
||||||
|
></state-card-content>
|
||||||
|
|
||||||
|
<more-info-content
|
||||||
|
.hass=${this.hass}
|
||||||
|
.stateObj=${state}
|
||||||
|
></more-info-content>
|
||||||
|
</ha-card>
|
||||||
|
</div>
|
||||||
|
${this.showConfig ? html`<pre>${this._jsonEntity(state)}</pre>` : ""}
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
private _getState(entityId, states) {
|
||||||
|
return states[entityId];
|
||||||
|
}
|
||||||
|
|
||||||
|
private _jsonEntity(stateObj) {
|
||||||
|
// We are caching some things on stateObj
|
||||||
|
// (it sucks, we will remove in the future)
|
||||||
|
const tmp = {};
|
||||||
|
Object.keys(stateObj).forEach((key) => {
|
||||||
|
if (key[0] !== "_") {
|
||||||
|
tmp[key] = stateObj[key];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return JSON.stringify(tmp, null, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
static styles = css`
|
||||||
|
.root {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
#card {
|
||||||
|
max-width: 400px;
|
||||||
|
width: 100vw;
|
||||||
|
}
|
||||||
|
ha-card {
|
||||||
|
width: 352px;
|
||||||
|
padding: 20px 24px;
|
||||||
|
}
|
||||||
|
state-card-content {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
pre {
|
||||||
|
width: 400px;
|
||||||
|
margin: 0 16px;
|
||||||
|
overflow: auto;
|
||||||
|
color: var(--primary-text-color);
|
||||||
|
}
|
||||||
|
@media only screen and (max-width: 800px) {
|
||||||
|
.root {
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
pre {
|
||||||
|
margin: 16px 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
"demo-more-info": DemoMoreInfo;
|
||||||
|
}
|
||||||
|
}
|
@@ -1,83 +0,0 @@
|
|||||||
import "@polymer/app-layout/app-toolbar/app-toolbar";
|
|
||||||
import { html } from "@polymer/polymer/lib/utils/html-tag";
|
|
||||||
/* eslint-plugin-disable lit */
|
|
||||||
import { PolymerElement } from "@polymer/polymer/polymer-element";
|
|
||||||
import { applyThemesOnElement } from "../../../src/common/dom/apply_themes_on_element";
|
|
||||||
import "../../../src/components/ha-formfield";
|
|
||||||
import "../../../src/components/ha-switch";
|
|
||||||
import "./demo-more-info";
|
|
||||||
|
|
||||||
class DemoMoreInfos extends PolymerElement {
|
|
||||||
static get template() {
|
|
||||||
return html`
|
|
||||||
<style>
|
|
||||||
#container {
|
|
||||||
min-height: calc(100vh - 128px);
|
|
||||||
background: var(--primary-background-color);
|
|
||||||
}
|
|
||||||
.cards {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
demo-more-info {
|
|
||||||
margin: 16px 16px 32px;
|
|
||||||
}
|
|
||||||
app-toolbar {
|
|
||||||
background-color: var(--light-primary-color);
|
|
||||||
}
|
|
||||||
.filters {
|
|
||||||
margin-left: 60px;
|
|
||||||
}
|
|
||||||
ha-formfield {
|
|
||||||
margin-right: 16px;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
<app-toolbar>
|
|
||||||
<div class="filters">
|
|
||||||
<ha-formfield label="Show entities">
|
|
||||||
<ha-switch checked="[[_showConfig]]" on-change="_showConfigToggled">
|
|
||||||
</ha-switch>
|
|
||||||
</ha-formfield>
|
|
||||||
<ha-formfield label="Dark theme">
|
|
||||||
<ha-switch on-change="_darkThemeToggled"> </ha-switch>
|
|
||||||
</ha-formfield>
|
|
||||||
</div>
|
|
||||||
</app-toolbar>
|
|
||||||
<div id="container">
|
|
||||||
<div class="cards">
|
|
||||||
<template is="dom-repeat" items="[[entities]]">
|
|
||||||
<demo-more-info
|
|
||||||
entity-id="[[item]]"
|
|
||||||
show-config="[[_showConfig]]"
|
|
||||||
hass="[[hass]]"
|
|
||||||
></demo-more-info>
|
|
||||||
</template>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
}
|
|
||||||
|
|
||||||
static get properties() {
|
|
||||||
return {
|
|
||||||
entities: Array,
|
|
||||||
hass: Object,
|
|
||||||
_showConfig: {
|
|
||||||
type: Boolean,
|
|
||||||
value: false,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
_showConfigToggled(ev) {
|
|
||||||
this._showConfig = ev.target.checked;
|
|
||||||
}
|
|
||||||
|
|
||||||
_darkThemeToggled(ev) {
|
|
||||||
applyThemesOnElement(this.$.container, { themes: {} }, "default", {
|
|
||||||
dark: ev.target.checked,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
customElements.define("demo-more-infos", DemoMoreInfos);
|
|
87
gallery/src/components/demo-more-infos.ts
Normal file
87
gallery/src/components/demo-more-infos.ts
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
import { LitElement, css, html } from "lit";
|
||||||
|
import { customElement, property } from "lit/decorators";
|
||||||
|
import { applyThemesOnElement } from "../../../src/common/dom/apply_themes_on_element";
|
||||||
|
import "../../../src/components/ha-formfield";
|
||||||
|
import "../../../src/components/ha-switch";
|
||||||
|
import "./demo-more-info";
|
||||||
|
import "../ha-demo-options";
|
||||||
|
import { HomeAssistant } from "../../../src/types";
|
||||||
|
|
||||||
|
@customElement("demo-more-infos")
|
||||||
|
class DemoMoreInfos extends LitElement {
|
||||||
|
@property() public hass!: HomeAssistant;
|
||||||
|
|
||||||
|
@property() public entities!: [];
|
||||||
|
|
||||||
|
@property({ attribute: false }) _showConfig: boolean = false;
|
||||||
|
|
||||||
|
render() {
|
||||||
|
return html`
|
||||||
|
<ha-demo-options>
|
||||||
|
<ha-formfield label="Show config">
|
||||||
|
<ha-switch @change=${this._showConfigToggled}> </ha-switch>
|
||||||
|
</ha-formfield>
|
||||||
|
<ha-formfield label="Dark theme">
|
||||||
|
<ha-switch @change=${this._darkThemeToggled}> </ha-switch>
|
||||||
|
</ha-formfield>
|
||||||
|
</ha-demo-options>
|
||||||
|
<div id="container">
|
||||||
|
<div class="cards">
|
||||||
|
${this.entities.map(
|
||||||
|
(item) =>
|
||||||
|
html`<demo-more-info
|
||||||
|
.entityId=${item}
|
||||||
|
.showConfig=${this._showConfig}
|
||||||
|
.hass=${this.hass}
|
||||||
|
></demo-more-info>`
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
static styles = css`
|
||||||
|
#container {
|
||||||
|
min-height: calc(100vh - 128px);
|
||||||
|
background: var(--primary-background-color);
|
||||||
|
}
|
||||||
|
.cards {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
demo-more-info {
|
||||||
|
margin: 16px 16px 32px;
|
||||||
|
}
|
||||||
|
ha-formfield {
|
||||||
|
margin-right: 16px;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
||||||
|
_showConfigToggled(ev) {
|
||||||
|
this._showConfig = ev.target.checked;
|
||||||
|
}
|
||||||
|
|
||||||
|
_darkThemeToggled(ev) {
|
||||||
|
applyThemesOnElement(
|
||||||
|
this.shadowRoot!.querySelector("#container"),
|
||||||
|
{
|
||||||
|
default_theme: "default",
|
||||||
|
default_dark_theme: "default",
|
||||||
|
themes: {},
|
||||||
|
darkMode: false,
|
||||||
|
theme: "default",
|
||||||
|
},
|
||||||
|
"default",
|
||||||
|
{
|
||||||
|
dark: ev.target.checked,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
"demo-more-infos": DemoMoreInfos;
|
||||||
|
}
|
||||||
|
}
|
24
gallery/src/data/date-options.ts
Normal file
24
gallery/src/data/date-options.ts
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import type { ControlSelectOption } from "../../../src/components/ha-control-select";
|
||||||
|
|
||||||
|
export const timeOptions: ControlSelectOption[] = [
|
||||||
|
{
|
||||||
|
value: "now",
|
||||||
|
label: "Now",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "00:15:30",
|
||||||
|
label: "12:15:30 AM",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "06:15:30",
|
||||||
|
label: "06:15:30 AM",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "12:15:30",
|
||||||
|
label: "12:15:30 PM",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "18:15:30",
|
||||||
|
label: "06:15:30 PM",
|
||||||
|
},
|
||||||
|
];
|
@@ -1,5 +1,3 @@
|
|||||||
import "@polymer/polymer/lib/elements/dom-if";
|
|
||||||
import "@polymer/polymer/lib/elements/dom-repeat";
|
|
||||||
import "../../src/resources/ha-style";
|
import "../../src/resources/ha-style";
|
||||||
import "../../src/resources/roboto";
|
import "../../src/resources/roboto";
|
||||||
import "./ha-gallery";
|
import "./ha-gallery";
|
||||||
|
47
gallery/src/ha-demo-options.ts
Normal file
47
gallery/src/ha-demo-options.ts
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
import "@material/mwc-drawer";
|
||||||
|
import "@material/mwc-top-app-bar-fixed";
|
||||||
|
import { html, css, LitElement } from "lit";
|
||||||
|
import { customElement } from "lit/decorators";
|
||||||
|
import "../../src/components/ha-icon-button";
|
||||||
|
import "../../src/managers/notification-manager";
|
||||||
|
import { haStyle } from "../../src/resources/styles";
|
||||||
|
import "./components/page-description";
|
||||||
|
|
||||||
|
@customElement("ha-demo-options")
|
||||||
|
class HaDemoOptions extends LitElement {
|
||||||
|
render() {
|
||||||
|
return html`<slot></slot>`;
|
||||||
|
}
|
||||||
|
|
||||||
|
static styles = [
|
||||||
|
haStyle,
|
||||||
|
css`
|
||||||
|
:host {
|
||||||
|
display: block;
|
||||||
|
background-color: var(--light-primary-color);
|
||||||
|
margin-left: 60px
|
||||||
|
margin-right: 60px;
|
||||||
|
display: var(--layout-horizontal_-_display);
|
||||||
|
-ms-flex-direction: var(--layout-horizontal_-_-ms-flex-direction);
|
||||||
|
-webkit-flex-direction: var(
|
||||||
|
--layout-horizontal_-_-webkit-flex-direction
|
||||||
|
);
|
||||||
|
flex-direction: var(--layout-horizontal_-_flex-direction);
|
||||||
|
-ms-flex-align: var(--layout-center_-_-ms-flex-align);
|
||||||
|
-webkit-align-items: var(--layout-center_-_-webkit-align-items);
|
||||||
|
align-items: var(--layout-center_-_align-items);
|
||||||
|
position: relative;
|
||||||
|
height: 64px;
|
||||||
|
padding: 0 16px;
|
||||||
|
pointer-events: none;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
"ha-demo-options": HaDemoOptions;
|
||||||
|
}
|
||||||
|
}
|
@@ -8,8 +8,9 @@
|
|||||||
/>
|
/>
|
||||||
<meta name="theme-color" content="#2157BC" />
|
<meta name="theme-color" content="#2157BC" />
|
||||||
<title>Home Assistant Design</title>
|
<title>Home Assistant Design</title>
|
||||||
|
<% for (const entry of latestEntryJS) { %>
|
||||||
<script type="module" src="<%= latestGalleryJS %>"></script>
|
<script type="module" src="<%= entry %>"></script>
|
||||||
|
<% } %>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
font-family: Roboto, Noto, sans-serif;
|
font-family: Roboto, Noto, sans-serif;
|
||||||
|
@@ -4,53 +4,63 @@ subtitle: The difference between remove/delete and add/create.
|
|||||||
---
|
---
|
||||||
|
|
||||||
# Remove vs Delete
|
# Remove vs Delete
|
||||||
|
|
||||||
Remove and Delete are quite similar, but can be frustrating if used inconsistently.
|
Remove and Delete are quite similar, but can be frustrating if used inconsistently.
|
||||||
|
|
||||||
## Remove
|
## Remove
|
||||||
|
|
||||||
Take away and set aside, but kept in existence.
|
Take away and set aside, but kept in existence.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
* Removing a user's permission
|
|
||||||
* Removing a user from a group
|
- Removing a user's permission
|
||||||
* Removing links between items
|
- Removing a user from a group
|
||||||
* Removing a widget
|
- Removing links between items
|
||||||
* Removing a link
|
- Removing a widget
|
||||||
* Removing an item from a cart
|
- Removing a link
|
||||||
|
- Removing an item from a cart
|
||||||
|
|
||||||
## Delete
|
## Delete
|
||||||
|
|
||||||
Erase, rendered nonexistent or nonrecoverable.
|
Erase, rendered nonexistent or nonrecoverable.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
* Deleting a field
|
|
||||||
* Deleting a value in a field
|
- Deleting a field
|
||||||
* Deleting a task
|
- Deleting a value in a field
|
||||||
* Deleting a group
|
- Deleting a task
|
||||||
* Deleting a permission
|
- Deleting a group
|
||||||
* Deleting a calendar event
|
- Deleting a permission
|
||||||
|
- Deleting a calendar event
|
||||||
|
|
||||||
# Add vs Create
|
# Add vs Create
|
||||||
|
|
||||||
In most cases, Create can be paired with Delete, and Add can be paired with Remove.
|
In most cases, Create can be paired with Delete, and Add can be paired with Remove.
|
||||||
|
|
||||||
## Add
|
## Add
|
||||||
|
|
||||||
An already-exisiting item.
|
An already-exisiting item.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
* Adding a permission to a user
|
|
||||||
* Adding a user to a group
|
- Adding a permission to a user
|
||||||
* Adding links between items
|
- Adding a user to a group
|
||||||
* Adding a widget
|
- Adding links between items
|
||||||
* Adding a link
|
- Adding a widget
|
||||||
* Adding an item to a cart
|
- Adding a link
|
||||||
|
- Adding an item to a cart
|
||||||
|
|
||||||
## Create
|
## Create
|
||||||
|
|
||||||
Something made from scratch.
|
Something made from scratch.
|
||||||
|
|
||||||
For example:
|
For example:
|
||||||
* Creating a new field
|
|
||||||
* Creating a new value in a field
|
- Creating a new field
|
||||||
* Creating a new task
|
- Creating a new value in a field
|
||||||
* Creating a new group
|
- Creating a new task
|
||||||
* Creating a new permission
|
- Creating a new group
|
||||||
* Creating a new calendar event
|
- Creating a new permission
|
||||||
|
- Creating a new calendar event
|
||||||
|
|
||||||
Based on this is [UX magazine article](https://uxmag.com/articles/ui-copy-remove-vs-delete2-banner).
|
Based on this is [UX magazine article](https://uxmag.com/articles/ui-copy-remove-vs-delete2-banner).
|
||||||
|
@@ -162,6 +162,7 @@ export class DemoAutomationDescribeAction extends LitElement {
|
|||||||
super.firstUpdated(changedProps);
|
super.firstUpdated(changedProps);
|
||||||
const hass = provideHass(this);
|
const hass = provideHass(this);
|
||||||
hass.updateTranslations(null, "en");
|
hass.updateTranslations(null, "en");
|
||||||
|
hass.updateTranslations("config", "en");
|
||||||
hass.addEntities(ENTITIES);
|
hass.addEntities(ENTITIES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -63,7 +63,7 @@ export class DemoAutomationDescribeCondition extends LitElement {
|
|||||||
<div class="condition">
|
<div class="condition">
|
||||||
<span>
|
<span>
|
||||||
${this._condition
|
${this._condition
|
||||||
? describeCondition(this._condition, this.hass)
|
? describeCondition(this._condition, this.hass, [])
|
||||||
: "<invalid YAML>"}
|
: "<invalid YAML>"}
|
||||||
</span>
|
</span>
|
||||||
<ha-yaml-editor
|
<ha-yaml-editor
|
||||||
@@ -76,7 +76,7 @@ export class DemoAutomationDescribeCondition extends LitElement {
|
|||||||
${conditions.map(
|
${conditions.map(
|
||||||
(conf) => html`
|
(conf) => html`
|
||||||
<div class="condition">
|
<div class="condition">
|
||||||
<span>${describeCondition(conf as any, this.hass)}</span>
|
<span>${describeCondition(conf as any, this.hass, [])}</span>
|
||||||
<pre>${dump(conf)}</pre>
|
<pre>${dump(conf)}</pre>
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
@@ -89,6 +89,7 @@ export class DemoAutomationDescribeCondition extends LitElement {
|
|||||||
super.firstUpdated(changedProps);
|
super.firstUpdated(changedProps);
|
||||||
const hass = provideHass(this);
|
const hass = provideHass(this);
|
||||||
hass.updateTranslations(null, "en");
|
hass.updateTranslations(null, "en");
|
||||||
|
hass.updateTranslations("config", "en");
|
||||||
hass.addEntities(ENTITIES);
|
hass.addEntities(ENTITIES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -40,7 +40,9 @@ const triggers = [
|
|||||||
},
|
},
|
||||||
{ platform: "sun", event: "sunset" },
|
{ platform: "sun", event: "sunset" },
|
||||||
{ platform: "time_pattern" },
|
{ platform: "time_pattern" },
|
||||||
|
{ platform: "time_pattern", hours: "*", minutes: "/5", seconds: "10" },
|
||||||
{ platform: "webhook" },
|
{ platform: "webhook" },
|
||||||
|
{ platform: "persistent_notification" },
|
||||||
{
|
{
|
||||||
platform: "zone",
|
platform: "zone",
|
||||||
entity_id: "person.person",
|
entity_id: "person.person",
|
||||||
@@ -50,6 +52,11 @@ const triggers = [
|
|||||||
{ platform: "tag" },
|
{ platform: "tag" },
|
||||||
{ platform: "time", at: "15:32" },
|
{ platform: "time", at: "15:32" },
|
||||||
{ platform: "template" },
|
{ platform: "template" },
|
||||||
|
{ platform: "conversation", command: "Turn on the lights" },
|
||||||
|
{
|
||||||
|
platform: "conversation",
|
||||||
|
command: ["Turn on the lights", "Turn the lights on"],
|
||||||
|
},
|
||||||
{ platform: "event", event_type: "homeassistant_started" },
|
{ platform: "event", event_type: "homeassistant_started" },
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -74,7 +81,7 @@ export class DemoAutomationDescribeTrigger extends LitElement {
|
|||||||
<div class="trigger">
|
<div class="trigger">
|
||||||
<span>
|
<span>
|
||||||
${this._trigger
|
${this._trigger
|
||||||
? describeTrigger(this._trigger, this.hass)
|
? describeTrigger(this._trigger, this.hass, [])
|
||||||
: "<invalid YAML>"}
|
: "<invalid YAML>"}
|
||||||
</span>
|
</span>
|
||||||
<ha-yaml-editor
|
<ha-yaml-editor
|
||||||
@@ -86,7 +93,7 @@ export class DemoAutomationDescribeTrigger extends LitElement {
|
|||||||
${triggers.map(
|
${triggers.map(
|
||||||
(conf) => html`
|
(conf) => html`
|
||||||
<div class="trigger">
|
<div class="trigger">
|
||||||
<span>${describeTrigger(conf as any, this.hass)}</span>
|
<span>${describeTrigger(conf as any, this.hass, [])}</span>
|
||||||
<pre>${dump(conf)}</pre>
|
<pre>${dump(conf)}</pre>
|
||||||
</div>
|
</div>
|
||||||
`
|
`
|
||||||
@@ -99,6 +106,7 @@ export class DemoAutomationDescribeTrigger extends LitElement {
|
|||||||
super.firstUpdated(changedProps);
|
super.firstUpdated(changedProps);
|
||||||
const hass = provideHass(this);
|
const hass = provideHass(this);
|
||||||
hass.updateTranslations(null, "en");
|
hass.updateTranslations(null, "en");
|
||||||
|
hass.updateTranslations("config", "en");
|
||||||
hass.addEntities(ENTITIES);
|
hass.addEntities(ENTITIES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -85,8 +85,7 @@ class DemoHaAutomationEditorAction extends LitElement {
|
|||||||
.value=${this.data[sampleIdx]}
|
.value=${this.data[sampleIdx]}
|
||||||
>
|
>
|
||||||
${["light", "dark"].map(
|
${["light", "dark"].map(
|
||||||
(slot) =>
|
(slot) => html`
|
||||||
html`
|
|
||||||
<ha-automation-action
|
<ha-automation-action
|
||||||
slot=${slot}
|
slot=${slot}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
@@ -121,8 +121,7 @@ class DemoHaAutomationEditorCondition extends LitElement {
|
|||||||
.value=${this.data[sampleIdx]}
|
.value=${this.data[sampleIdx]}
|
||||||
>
|
>
|
||||||
${["light", "dark"].map(
|
${["light", "dark"].map(
|
||||||
(slot) =>
|
(slot) => html`
|
||||||
html`
|
|
||||||
<ha-automation-condition
|
<ha-automation-condition
|
||||||
slot=${slot}
|
slot=${slot}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
@@ -19,11 +19,13 @@ import { HaTemplateTrigger } from "../../../../src/panels/config/automation/trig
|
|||||||
import { HaTimeTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-time";
|
import { HaTimeTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-time";
|
||||||
import { HaTimePatternTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-time_pattern";
|
import { HaTimePatternTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-time_pattern";
|
||||||
import { HaWebhookTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-webhook";
|
import { HaWebhookTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-webhook";
|
||||||
|
import { HaPersistentNotificationTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-persistent_notification";
|
||||||
import { HaZoneTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-zone";
|
import { HaZoneTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-zone";
|
||||||
import { HaDeviceTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-device";
|
import { HaDeviceTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-device";
|
||||||
import { HaStateTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-state";
|
import { HaStateTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-state";
|
||||||
import { HaMQTTTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-mqtt";
|
import { HaMQTTTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-mqtt";
|
||||||
import "../../../../src/panels/config/automation/trigger/ha-automation-trigger";
|
import "../../../../src/panels/config/automation/trigger/ha-automation-trigger";
|
||||||
|
import { HaConversationTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-conversation";
|
||||||
|
|
||||||
const SCHEMAS: { name: string; triggers: Trigger[] }[] = [
|
const SCHEMAS: { name: string; triggers: Trigger[] }[] = [
|
||||||
{
|
{
|
||||||
@@ -72,6 +74,16 @@ const SCHEMAS: { name: string; triggers: Trigger[] }[] = [
|
|||||||
triggers: [{ platform: "webhook", ...HaWebhookTrigger.defaultConfig }],
|
triggers: [{ platform: "webhook", ...HaWebhookTrigger.defaultConfig }],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: "Persistent Notification",
|
||||||
|
triggers: [
|
||||||
|
{
|
||||||
|
platform: "persistent_notification",
|
||||||
|
...HaPersistentNotificationTrigger.defaultConfig,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
name: "Zone",
|
name: "Zone",
|
||||||
triggers: [{ platform: "zone", ...HaZoneTrigger.defaultConfig }],
|
triggers: [{ platform: "zone", ...HaZoneTrigger.defaultConfig }],
|
||||||
@@ -101,6 +113,16 @@ const SCHEMAS: { name: string; triggers: Trigger[] }[] = [
|
|||||||
name: "Device Trigger",
|
name: "Device Trigger",
|
||||||
triggers: [{ platform: "device", ...HaDeviceTrigger.defaultConfig }],
|
triggers: [{ platform: "device", ...HaDeviceTrigger.defaultConfig }],
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Sentence",
|
||||||
|
triggers: [
|
||||||
|
{ platform: "conversation", ...HaConversationTrigger.defaultConfig },
|
||||||
|
{
|
||||||
|
platform: "conversation",
|
||||||
|
command: ["Turn on the lights", "Turn the lights on"],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@customElement("demo-automation-editor-trigger")
|
@customElement("demo-automation-editor-trigger")
|
||||||
@@ -145,8 +167,7 @@ class DemoHaAutomationEditorTrigger extends LitElement {
|
|||||||
.value=${this.data[sampleIdx]}
|
.value=${this.data[sampleIdx]}
|
||||||
>
|
>
|
||||||
${["light", "dark"].map(
|
${["light", "dark"].map(
|
||||||
(slot) =>
|
(slot) => html`
|
||||||
html`
|
|
||||||
<ha-automation-trigger
|
<ha-automation-trigger
|
||||||
slot=${slot}
|
slot=${slot}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
|
@@ -10,7 +10,6 @@ As a community, we are proud of our logo. Follow these guidelines to ensure it a
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
||||||
## Using the icon
|
## Using the icon
|
||||||
|
|
||||||
Our icon is a shorter and most used version of our logo. The icon can exist without the wordmark, the wordmark should never exist without the icon.
|
Our icon is a shorter and most used version of our logo. The icon can exist without the wordmark, the wordmark should never exist without the icon.
|
||||||
|
@@ -11,6 +11,7 @@ subtitle: An alert displays a short, important message in a way that attracts th
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
# Alert `<ha-alert>`
|
# Alert `<ha-alert>`
|
||||||
|
|
||||||
The alert offers four severity levels that set a distinctive icon and color.
|
The alert offers four severity levels that set a distinctive icon and color.
|
||||||
|
|
||||||
<ha-alert alert-type="error">
|
<ha-alert alert-type="error">
|
||||||
@@ -35,38 +36,46 @@ The alert offers four severity levels that set a distinctive icon and color.
|
|||||||
2. [Implementation](#implementation)
|
2. [Implementation](#implementation)
|
||||||
|
|
||||||
### Resources
|
### Resources
|
||||||
|
|
||||||
| Type | Link | Status |
|
| Type | Link | Status |
|
||||||
|----------------|----------------------------------|-----------|
|
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- |
|
||||||
| Design | <a href="https://www.figma.com/community/file/967153512097289521/Home-Assistant-DesignKit" rel="noopener noreferrer" target="_blank">Home Assistant DesignKit</a> (Figma) | Available |
|
| Design | <a href="https://www.figma.com/community/file/967153512097289521/Home-Assistant-DesignKit" rel="noopener noreferrer" target="_blank">Home Assistant DesignKit</a> (Figma) | Available |
|
||||||
| Implementation | <a href="https://github.com/home-assistant/frontend/blob/dev/src/components/ha-alert.ts" rel="noopener noreferrer" target="_blank">Web Component</a> (GitHub) | Available |
|
| Implementation | <a href="https://github.com/home-assistant/frontend/blob/dev/src/components/ha-alert.ts" rel="noopener noreferrer" target="_blank">Web Component</a> (GitHub) | Available |
|
||||||
|
|
||||||
## Guidelines
|
## Guidelines
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
An alert displays a short, important message in a way that attracts the user's attention without interrupting the user's task.
|
An alert displays a short, important message in a way that attracts the user's attention without interrupting the user's task.
|
||||||
|
|
||||||
### Anatomy
|
### Anatomy
|
||||||
*Documentation coming soon*
|
|
||||||
|
_Documentation coming soon_
|
||||||
|
|
||||||
### Error alert
|
### Error alert
|
||||||
|
|
||||||
Error alerts
|
Error alerts
|
||||||
*Real world example coming soon*
|
_Real world example coming soon_
|
||||||
|
|
||||||
### Warning alert
|
### Warning alert
|
||||||
|
|
||||||
Warning alerts
|
Warning alerts
|
||||||
*Real world example coming soon*
|
_Real world example coming soon_
|
||||||
|
|
||||||
### Info alert
|
### Info alert
|
||||||
|
|
||||||
Info alerts
|
Info alerts
|
||||||
*Real world example coming soon*
|
_Real world example coming soon_
|
||||||
|
|
||||||
### Success alert
|
### Success alert
|
||||||
|
|
||||||
Success alerts
|
Success alerts
|
||||||
*Real world example coming soon*
|
_Real world example coming soon_
|
||||||
|
|
||||||
### Placement
|
### Placement
|
||||||
|
|
||||||
|
|
||||||
### Accessibility
|
### Accessibility
|
||||||
|
|
||||||
(WAI-ARIA: [https://www.w3.org/TR/wai-aria-practices/#alert](https://www.w3.org/TR/wai-aria-practices/#alert))
|
(WAI-ARIA: [https://www.w3.org/TR/wai-aria-practices/#alert](https://www.w3.org/TR/wai-aria-practices/#alert))
|
||||||
|
|
||||||
When the component is dynamically displayed, the content is automatically announced by most screen readers. At this time, screen readers do not inform users of alerts that are present when the page loads.
|
When the component is dynamically displayed, the content is automatically announced by most screen readers. At this time, screen readers do not inform users of alerts that are present when the page loads.
|
||||||
@@ -78,6 +87,7 @@ Actions must have a tab index of 0 so that they can be reached by keyboard-only
|
|||||||
## Implementation
|
## Implementation
|
||||||
|
|
||||||
### Example Usage
|
### Example Usage
|
||||||
|
|
||||||
**Alert type**
|
**Alert type**
|
||||||
|
|
||||||
<ha-alert alert-type="error">
|
<ha-alert alert-type="error">
|
||||||
@@ -96,17 +106,12 @@ Actions must have a tab index of 0 so that they can be reached by keyboard-only
|
|||||||
This is an success alert — check it out!
|
This is an success alert — check it out!
|
||||||
</ha-alert>
|
</ha-alert>
|
||||||
|
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<ha-alert alert-type="error">
|
<ha-alert alert-type="error"> This is an error alert — check it out! </ha-alert>
|
||||||
This is an error alert — check it out!
|
|
||||||
</ha-alert>
|
|
||||||
<ha-alert alert-type="warning">
|
<ha-alert alert-type="warning">
|
||||||
This is a warning alert — check it out!
|
This is a warning alert — check it out!
|
||||||
</ha-alert>
|
</ha-alert>
|
||||||
<ha-alert alert-type="info">
|
<ha-alert alert-type="info"> This is an info alert — check it out! </ha-alert>
|
||||||
This is an info alert — check it out!
|
|
||||||
</ha-alert>
|
|
||||||
<ha-alert alert-type="success">
|
<ha-alert alert-type="success">
|
||||||
This is a success alert — check it out!
|
This is a success alert — check it out!
|
||||||
</ha-alert>
|
</ha-alert>
|
||||||
@@ -154,13 +159,14 @@ The `title ` option should not be used without a description.
|
|||||||
|
|
||||||
**Slotted icon**
|
**Slotted icon**
|
||||||
|
|
||||||
*Documentation coming soon*
|
_Documentation coming soon_
|
||||||
|
|
||||||
### API
|
### API
|
||||||
|
|
||||||
**Properties/Attributes**
|
**Properties/Attributes**
|
||||||
|
|
||||||
| Name | Type | Default | Description |
|
| Name | Type | Default | Description |
|
||||||
|-------------|---------|---------|-------------------------------------------------------|
|
| ----------- | ------- | ------- | ----------------------------------------------------- |
|
||||||
| title | string | `` | Title to display. |
|
| title | string | `` | Title to display. |
|
||||||
| alertType | string | `info` | Severity level that set a distinctive icon and color. |
|
| alertType | string | `info` | Severity level that set a distinctive icon and color. |
|
||||||
| dismissable | boolean | `false` | Gives the option to close the alert. |
|
| dismissable | boolean | `false` | Gives the option to close the alert. |
|
||||||
@@ -170,8 +176,8 @@ The `title ` option should not be used without a description.
|
|||||||
|
|
||||||
**Events**
|
**Events**
|
||||||
|
|
||||||
*Documentation coming soon*
|
_Documentation coming soon_
|
||||||
|
|
||||||
**CSS Custom Properties**
|
**CSS Custom Properties**
|
||||||
|
|
||||||
*Documentation coming soon*
|
_Documentation coming soon_
|
||||||
|
@@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
title: Control Circular Slider
|
||||||
|
---
|
174
gallery/src/pages/components/ha-control-circular-slider.ts
Normal file
174
gallery/src/pages/components/ha-control-circular-slider.ts
Normal file
@@ -0,0 +1,174 @@
|
|||||||
|
import { css, html, LitElement, TemplateResult } from "lit";
|
||||||
|
import { customElement, state } from "lit/decorators";
|
||||||
|
import "../../../../src/components/ha-card";
|
||||||
|
import "../../../../src/components/ha-control-circular-slider";
|
||||||
|
import "../../../../src/components/ha-slider";
|
||||||
|
|
||||||
|
@customElement("demo-components-ha-control-circular-slider")
|
||||||
|
export class DemoHaCircularSlider extends LitElement {
|
||||||
|
@state()
|
||||||
|
private current = 22;
|
||||||
|
|
||||||
|
@state()
|
||||||
|
private low = 19;
|
||||||
|
|
||||||
|
@state()
|
||||||
|
private high = 25;
|
||||||
|
|
||||||
|
@state()
|
||||||
|
private changingLow?: number;
|
||||||
|
|
||||||
|
@state()
|
||||||
|
private changingHigh?: number;
|
||||||
|
|
||||||
|
private _lowChanged(ev) {
|
||||||
|
this.low = ev.detail.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private _lowChanging(ev) {
|
||||||
|
this.changingLow = ev.detail.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private _highChanged(ev) {
|
||||||
|
this.high = ev.detail.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private _highChanging(ev) {
|
||||||
|
this.changingHigh = ev.detail.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private _currentChanged(ev) {
|
||||||
|
this.current = ev.currentTarget.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected render(): TemplateResult {
|
||||||
|
return html`
|
||||||
|
<ha-card>
|
||||||
|
<div class="card-content">
|
||||||
|
<p class="title"><b>Config</b></p>
|
||||||
|
<div class="field">
|
||||||
|
<p>Current</p>
|
||||||
|
<ha-slider
|
||||||
|
min="10"
|
||||||
|
max="30"
|
||||||
|
.value=${this.current}
|
||||||
|
@change=${this._currentChanged}
|
||||||
|
pin
|
||||||
|
></ha-slider>
|
||||||
|
<p>${this.current} °C</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ha-card>
|
||||||
|
<ha-card>
|
||||||
|
<div class="card-content">
|
||||||
|
<p class="title"><b>Single</b></p>
|
||||||
|
<ha-control-circular-slider
|
||||||
|
@value-changed=${this._lowChanged}
|
||||||
|
@value-changing=${this._lowChanging}
|
||||||
|
.value=${this.low}
|
||||||
|
.current=${this.current}
|
||||||
|
step="1"
|
||||||
|
min="10"
|
||||||
|
max="30"
|
||||||
|
></ha-control-circular-slider>
|
||||||
|
<div>
|
||||||
|
Low: ${this.low} °C
|
||||||
|
<br />
|
||||||
|
Changing:
|
||||||
|
${this.changingLow != null ? `${this.changingLow} °C` : "-"}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ha-card>
|
||||||
|
<ha-card>
|
||||||
|
<div class="card-content">
|
||||||
|
<p class="title"><b>Inverted</b></p>
|
||||||
|
<ha-control-circular-slider
|
||||||
|
inverted
|
||||||
|
@value-changed=${this._highChanged}
|
||||||
|
@value-changing=${this._highChanging}
|
||||||
|
.value=${this.high}
|
||||||
|
.current=${this.current}
|
||||||
|
step="1"
|
||||||
|
min="10"
|
||||||
|
max="30"
|
||||||
|
></ha-control-circular-slider>
|
||||||
|
<div>
|
||||||
|
High: ${this.high} °C
|
||||||
|
<br />
|
||||||
|
Changing:
|
||||||
|
${this.changingHigh != null ? `${this.changingHigh} °C` : "-"}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ha-card>
|
||||||
|
<ha-card>
|
||||||
|
<div class="card-content">
|
||||||
|
<p class="title"><b>Dual</b></p>
|
||||||
|
<ha-control-circular-slider
|
||||||
|
dual
|
||||||
|
@low-changed=${this._lowChanged}
|
||||||
|
@low-changing=${this._lowChanging}
|
||||||
|
@high-changed=${this._highChanged}
|
||||||
|
@high-changing=${this._highChanging}
|
||||||
|
.low=${this.low}
|
||||||
|
.high=${this.high}
|
||||||
|
.current=${this.current}
|
||||||
|
step="1"
|
||||||
|
min="10"
|
||||||
|
max="30"
|
||||||
|
></ha-control-circular-slider>
|
||||||
|
<div>
|
||||||
|
Low value: ${this.low} °C
|
||||||
|
<br />
|
||||||
|
Low changing:
|
||||||
|
${this.changingLow != null ? `${this.changingLow} °C` : "-"}
|
||||||
|
<br />
|
||||||
|
High value: ${this.high} °C
|
||||||
|
<br />
|
||||||
|
High changing:
|
||||||
|
${this.changingHigh != null ? `${this.changingHigh} °C` : "-"}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ha-card>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get styles() {
|
||||||
|
return css`
|
||||||
|
ha-card {
|
||||||
|
max-width: 600px;
|
||||||
|
margin: 24px auto;
|
||||||
|
}
|
||||||
|
pre {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
p.title {
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
ha-control-circular-slider {
|
||||||
|
--control-circular-slider-color: #ff9800;
|
||||||
|
}
|
||||||
|
ha-control-circular-slider[inverted] {
|
||||||
|
--control-circular-slider-color: #2196f3;
|
||||||
|
}
|
||||||
|
ha-control-circular-slider[dual] {
|
||||||
|
--control-circular-slider-high-color: #2196f3;
|
||||||
|
--control-circular-slider-low-color: #ff9800;
|
||||||
|
}
|
||||||
|
.field {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
"demo-components-ha-control-circular-slider": DemoHaCircularSlider;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
title: Control Number Buttons
|
||||||
|
---
|
100
gallery/src/pages/components/ha-control-number-buttons.ts
Normal file
100
gallery/src/pages/components/ha-control-number-buttons.ts
Normal file
@@ -0,0 +1,100 @@
|
|||||||
|
import { LitElement, TemplateResult, css, html } from "lit";
|
||||||
|
import { customElement, state } from "lit/decorators";
|
||||||
|
import "../../../../src/components/ha-card";
|
||||||
|
import "../../../../src/components/ha-control-number-buttons";
|
||||||
|
import { repeat } from "lit/directives/repeat";
|
||||||
|
import { ifDefined } from "lit/directives/if-defined";
|
||||||
|
|
||||||
|
const buttons: {
|
||||||
|
id: string;
|
||||||
|
label: string;
|
||||||
|
min?: number;
|
||||||
|
max?: number;
|
||||||
|
step?: number;
|
||||||
|
class?: string;
|
||||||
|
}[] = [
|
||||||
|
{
|
||||||
|
id: "basic",
|
||||||
|
label: "Basic",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "min_max_step",
|
||||||
|
label: "With min/max and step",
|
||||||
|
min: 5,
|
||||||
|
max: 25,
|
||||||
|
step: 0.5,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: "custom",
|
||||||
|
label: "Custom",
|
||||||
|
class: "custom",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
@customElement("demo-components-ha-control-number-buttons")
|
||||||
|
export class DemoHarControlNumberButtons extends LitElement {
|
||||||
|
@state() value = 5;
|
||||||
|
|
||||||
|
private _valueChanged(ev) {
|
||||||
|
this.value = ev.detail.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected render(): TemplateResult {
|
||||||
|
return html`
|
||||||
|
${repeat(buttons, (button) => {
|
||||||
|
const { id, label, ...config } = button;
|
||||||
|
return html`
|
||||||
|
<ha-card>
|
||||||
|
<div class="card-content">
|
||||||
|
<label id=${id}>${label}</label>
|
||||||
|
<pre>Config: ${JSON.stringify(config)}</pre>
|
||||||
|
<ha-control-number-buttons
|
||||||
|
.value=${this.value}
|
||||||
|
.min=${config.min}
|
||||||
|
.max=${config.max}
|
||||||
|
.step=${config.step}
|
||||||
|
class=${ifDefined(config.class)}
|
||||||
|
@value-changed=${this._valueChanged}
|
||||||
|
.label=${label}
|
||||||
|
>
|
||||||
|
</ha-control-number-buttons>
|
||||||
|
</div>
|
||||||
|
</ha-card>
|
||||||
|
`;
|
||||||
|
})}
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get styles() {
|
||||||
|
return css`
|
||||||
|
ha-card {
|
||||||
|
max-width: 600px;
|
||||||
|
margin: 24px auto;
|
||||||
|
}
|
||||||
|
pre {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
label {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
.custom {
|
||||||
|
color: #2196f3;
|
||||||
|
--control-number-buttons-color: #2196f3;
|
||||||
|
--control-number-buttons-background-color: #2196f3;
|
||||||
|
--control-number-buttons-background-opacity: 0.1;
|
||||||
|
--control-number-buttons-thickness: 100px;
|
||||||
|
--control-number-buttons-border-radius: 24px;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
"demo-components-ha-control-number-buttons": DemoHarControlNumberButtons;
|
||||||
|
}
|
||||||
|
}
|
@@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
title: Control Select Menu
|
||||||
|
---
|
146
gallery/src/pages/components/ha-control-select-menu.ts
Normal file
146
gallery/src/pages/components/ha-control-select-menu.ts
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
import { mdiFan, mdiFanSpeed1, mdiFanSpeed2, mdiFanSpeed3 } from "@mdi/js";
|
||||||
|
import { LitElement, TemplateResult, css, html, nothing } from "lit";
|
||||||
|
import { customElement } from "lit/decorators";
|
||||||
|
import { repeat } from "lit/directives/repeat";
|
||||||
|
import "../../../../src/components/ha-card";
|
||||||
|
import "../../../../src/components/ha-control-select-menu";
|
||||||
|
import "../../../../src/components/ha-list-item";
|
||||||
|
import "../../../../src/components/ha-svg-icon";
|
||||||
|
|
||||||
|
type SelectMenuOptions = {
|
||||||
|
label: string;
|
||||||
|
value: string;
|
||||||
|
icon?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
type SelectMenu = {
|
||||||
|
label: string;
|
||||||
|
icon: string;
|
||||||
|
class?: string;
|
||||||
|
disabled?: boolean;
|
||||||
|
options: SelectMenuOptions[];
|
||||||
|
};
|
||||||
|
|
||||||
|
const selects: SelectMenu[] = [
|
||||||
|
{
|
||||||
|
label: "Basic select",
|
||||||
|
icon: mdiFan,
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
value: "low",
|
||||||
|
label: "Low",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "medium",
|
||||||
|
label: "Medium",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "high",
|
||||||
|
label: "High",
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Select with icons",
|
||||||
|
icon: mdiFan,
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
value: "low",
|
||||||
|
label: "Low",
|
||||||
|
icon: mdiFanSpeed1,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "medium",
|
||||||
|
label: "Medium",
|
||||||
|
icon: mdiFanSpeed2,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
value: "high",
|
||||||
|
label: "High",
|
||||||
|
icon: mdiFanSpeed3,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Disabled select",
|
||||||
|
icon: mdiFan,
|
||||||
|
options: [],
|
||||||
|
disabled: true,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
@customElement("demo-components-ha-control-select-menu")
|
||||||
|
export class DemoHaControlSelectMenu extends LitElement {
|
||||||
|
protected render(): TemplateResult {
|
||||||
|
return html`
|
||||||
|
<ha-card>
|
||||||
|
${repeat(
|
||||||
|
selects,
|
||||||
|
(select) => html`
|
||||||
|
<div class="card-content">
|
||||||
|
<ha-control-select-menu
|
||||||
|
.label=${select.label}
|
||||||
|
?disabled=${select.disabled}
|
||||||
|
fixedMenuPosition
|
||||||
|
naturalMenuWidth
|
||||||
|
>
|
||||||
|
<ha-svg-icon slot="icon" .path=${select.icon}></ha-svg-icon>
|
||||||
|
${select.options.map(
|
||||||
|
(option) => html`
|
||||||
|
<ha-list-item
|
||||||
|
.value=${option.value}
|
||||||
|
.graphic=${option.icon ? "icon" : undefined}
|
||||||
|
>
|
||||||
|
${option.icon
|
||||||
|
? html`
|
||||||
|
<ha-svg-icon
|
||||||
|
slot="graphic"
|
||||||
|
.path=${option.icon}
|
||||||
|
></ha-svg-icon>
|
||||||
|
`
|
||||||
|
: nothing}
|
||||||
|
${option.label ?? option.value}
|
||||||
|
</ha-list-item>
|
||||||
|
`
|
||||||
|
)}
|
||||||
|
</ha-control-select-menu>
|
||||||
|
</div>
|
||||||
|
`
|
||||||
|
)}
|
||||||
|
</ha-card>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get styles() {
|
||||||
|
return css`
|
||||||
|
ha-card {
|
||||||
|
max-width: 600px;
|
||||||
|
margin: 24px auto;
|
||||||
|
}
|
||||||
|
pre {
|
||||||
|
margin-top: 0;
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
p {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
label {
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
.custom {
|
||||||
|
--control-button-icon-color: var(--primary-color);
|
||||||
|
--control-button-background-color: var(--primary-color);
|
||||||
|
--control-button-background-opacity: 0.2;
|
||||||
|
--control-button-border-radius: 18px;
|
||||||
|
height: 100px;
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
"demo-components-ha-control-select-menu": DemoHaControlSelectMenu;
|
||||||
|
}
|
||||||
|
}
|
@@ -10,21 +10,25 @@ Our dialogs are based on the latest version of Material Design. Specs and guidel
|
|||||||
# Highlighted guidelines
|
# Highlighted guidelines
|
||||||
|
|
||||||
## Content
|
## Content
|
||||||
* A best practice is to always use a title, even if it is optional by Material guidelines.
|
|
||||||
* People mainly read the title and a button. Put the most important information in those two.
|
- A best practice is to always use a title, even if it is optional by Material guidelines.
|
||||||
* Try to avoid user generated content in the title, this could make the title unreadable long.
|
- People mainly read the title and a button. Put the most important information in those two.
|
||||||
* If users become unsure, they read the description. Make sure this explains what will happen.
|
- Try to avoid user generated content in the title, this could make the title unreadable long.
|
||||||
* Strive for minimalism.
|
- If users become unsure, they read the description. Make sure this explains what will happen.
|
||||||
|
- Strive for minimalism.
|
||||||
|
|
||||||
## Buttons and X-icon
|
## Buttons and X-icon
|
||||||
* Keep the labels short, for example `Save`, `Delete`, `Enable`.
|
|
||||||
* Dialog with actions must always have a discard button. On desktop a `Cancel` button and X-icon, on mobile only the X-icon.
|
- Keep the labels short, for example `Save`, `Delete`, `Enable`.
|
||||||
* Destructive actions should be a red warning button.
|
- Dialog with actions must always have a discard button. On desktop a `Cancel` button and X-icon, on mobile only the X-icon.
|
||||||
* Alert or confirmation dialogs only have buttons and no X-icon.
|
- Destructive actions should be a red warning button.
|
||||||
* Try to avoid three buttons in one dialog. Especially when you leave the dialog task unfinished.
|
- Alert or confirmation dialogs only have buttons and no X-icon.
|
||||||
|
- Try to avoid three buttons in one dialog. Especially when you leave the dialog task unfinished.
|
||||||
|
|
||||||
## Example
|
## Example
|
||||||
|
|
||||||
### Confirmation dialog
|
### Confirmation dialog
|
||||||
|
|
||||||
> **Delete dashboard?**
|
> **Delete dashboard?**
|
||||||
>
|
>
|
||||||
> Dashboard [dashboard name] will be permanently deleted from Home Assistant.
|
> Dashboard [dashboard name] will be permanently deleted from Home Assistant.
|
||||||
|
@@ -336,7 +336,7 @@ const SCHEMAS: {
|
|||||||
["and", "another_one"],
|
["and", "another_one"],
|
||||||
["option", "1000"],
|
["option", "1000"],
|
||||||
],
|
],
|
||||||
name: "select many otions",
|
name: "select many options",
|
||||||
default: "default",
|
default: "default",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -364,7 +364,7 @@ const SCHEMAS: {
|
|||||||
and: "another_one",
|
and: "another_one",
|
||||||
option: "1000",
|
option: "1000",
|
||||||
},
|
},
|
||||||
name: "multi many otions",
|
name: "multi many options",
|
||||||
default: ["default"],
|
default: ["default"],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
@@ -32,7 +32,6 @@ Error color gauge
|
|||||||
Gauge with background color
|
Gauge with background color
|
||||||
<ha-gauge value="75" style="--gauge-color: var(--info-color); --primary-background-color: lightgray"></ha-gauge>
|
<ha-gauge value="75" style="--gauge-color: var(--info-color); --primary-background-color: lightgray"></ha-gauge>
|
||||||
|
|
||||||
|
|
||||||
## CSS variables
|
## CSS variables
|
||||||
|
|
||||||
### Gauge
|
### Gauge
|
||||||
|
3
gallery/src/pages/components/ha-hs-color-picker.markdown
Normal file
3
gallery/src/pages/components/ha-hs-color-picker.markdown
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
---
|
||||||
|
title: HS Color Picker
|
||||||
|
---
|
120
gallery/src/pages/components/ha-hs-color-picker.ts
Normal file
120
gallery/src/pages/components/ha-hs-color-picker.ts
Normal file
@@ -0,0 +1,120 @@
|
|||||||
|
import "../../../../src/components/ha-hs-color-picker";
|
||||||
|
|
||||||
|
import { css, html, LitElement, TemplateResult } from "lit";
|
||||||
|
import { customElement, state } from "lit/decorators";
|
||||||
|
|
||||||
|
import "../../../../src/components/ha-card";
|
||||||
|
import "../../../../src/components/ha-slider";
|
||||||
|
import { hsv2rgb } from "../../../../src/common/color/convert-color";
|
||||||
|
|
||||||
|
@customElement("demo-components-ha-hs-color-picker")
|
||||||
|
export class DemoHaHsColorPicker extends LitElement {
|
||||||
|
@state()
|
||||||
|
brightness = 255;
|
||||||
|
|
||||||
|
@state()
|
||||||
|
value: [number, number] = [0, 0];
|
||||||
|
|
||||||
|
@state()
|
||||||
|
liveValue?: [number, number];
|
||||||
|
|
||||||
|
private _brightnessChanged(ev) {
|
||||||
|
this.brightness = Number(ev.target.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private _hsColorCursor(ev) {
|
||||||
|
this.liveValue = ev.detail.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private _hsColorChanged(ev) {
|
||||||
|
this.value = ev.detail.value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private _hueChanged(ev) {
|
||||||
|
this.value = [ev.target.value, this.value[1]];
|
||||||
|
}
|
||||||
|
|
||||||
|
private _saturationChanged(ev) {
|
||||||
|
this.value = [this.value[0], ev.target.value];
|
||||||
|
}
|
||||||
|
|
||||||
|
protected render(): TemplateResult {
|
||||||
|
const h = (this.liveValue ?? this.value)[0];
|
||||||
|
const s = (this.liveValue ?? this.value)[1];
|
||||||
|
|
||||||
|
const rgb = hsv2rgb([h, s, this.brightness]);
|
||||||
|
|
||||||
|
return html`
|
||||||
|
<ha-card>
|
||||||
|
<div class="card-content">
|
||||||
|
<p class="value">${h}° - ${Math.round(s * 100)}%</p>
|
||||||
|
<p class="value">${rgb.map((v) => Math.round(v)).join(", ")}</p>
|
||||||
|
<ha-hs-color-picker
|
||||||
|
colorBrightness=${this.brightness}
|
||||||
|
.value=${this.value}
|
||||||
|
@value-changed=${this._hsColorChanged}
|
||||||
|
@cursor-moved=${this._hsColorCursor}
|
||||||
|
></ha-hs-color-picker>
|
||||||
|
<p>Hue : ${this.value[0]}</p>
|
||||||
|
<ha-slider
|
||||||
|
step="1"
|
||||||
|
pin
|
||||||
|
min="0"
|
||||||
|
max="360"
|
||||||
|
.value=${this.value[0]}
|
||||||
|
@change=${this._hueChanged}
|
||||||
|
>
|
||||||
|
</ha-slider>
|
||||||
|
<p>Saturation : ${this.value[1]}</p>
|
||||||
|
<ha-slider
|
||||||
|
step="0.01"
|
||||||
|
pin
|
||||||
|
min="0"
|
||||||
|
max="1"
|
||||||
|
.value=${this.value[1]}
|
||||||
|
@change=${this._saturationChanged}
|
||||||
|
>
|
||||||
|
</ha-slider>
|
||||||
|
<p>Color Brighness : ${this.brightness}</p>
|
||||||
|
<ha-slider
|
||||||
|
step="1"
|
||||||
|
pin
|
||||||
|
min="0"
|
||||||
|
max="255"
|
||||||
|
.value=${this.brightness}
|
||||||
|
@change=${this._brightnessChanged}
|
||||||
|
>
|
||||||
|
</ha-slider>
|
||||||
|
</div>
|
||||||
|
</ha-card>
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
static get styles() {
|
||||||
|
return css`
|
||||||
|
ha-card {
|
||||||
|
max-width: 600px;
|
||||||
|
margin: 24px auto;
|
||||||
|
}
|
||||||
|
.card-content {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
ha-hs-color-picker {
|
||||||
|
width: 400px;
|
||||||
|
}
|
||||||
|
.value {
|
||||||
|
font-size: 22px;
|
||||||
|
font-weight: bold;
|
||||||
|
margin: 0 0 12px 0;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
declare global {
|
||||||
|
interface HTMLElementTagNameMap {
|
||||||
|
"demo-components-ha-hs-color-picker": DemoHaHsColorPicker;
|
||||||
|
}
|
||||||
|
}
|
@@ -497,8 +497,7 @@ class DemoHaSelector extends LitElement implements ProvideHassElement {
|
|||||||
<demo-black-white-row .title=${info.name} .value=${this.data[idx]}>
|
<demo-black-white-row .title=${info.name} .value=${this.data[idx]}>
|
||||||
${["light", "dark"].map((slot) =>
|
${["light", "dark"].map((slot) =>
|
||||||
Object.entries(info.input).map(
|
Object.entries(info.input).map(
|
||||||
([key, value]) =>
|
([key, value]) => html`
|
||||||
html`
|
|
||||||
<ha-settings-row narrow slot=${slot}>
|
<ha-settings-row narrow slot=${slot}>
|
||||||
<span slot="heading">${value?.name || key}</span>
|
<span slot="heading">${value?.name || key}</span>
|
||||||
<span slot="description">${value?.description}</span>
|
<span slot="description">${value?.description}</span>
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user