mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-13 19:29:27 +00:00
Compare commits
617 Commits
ha-form-co
...
20230905.0
Author | SHA1 | Date | |
---|---|---|---|
![]() |
8acf557137 | ||
![]() |
d6e7ebe71d | ||
![]() |
085b26d5ea | ||
![]() |
32472ca627 | ||
![]() |
c3c4bb4421 | ||
![]() |
f7f1a0c32d | ||
![]() |
d4872b177f | ||
![]() |
5bb8c51d25 | ||
![]() |
4e62370d18 | ||
![]() |
77c08fd00f | ||
![]() |
d8894a0078 | ||
![]() |
4fd9c63633 | ||
![]() |
5e1583f925 | ||
![]() |
5d5894cae6 | ||
![]() |
5417513f49 | ||
![]() |
546ba8f12f | ||
![]() |
a398b37380 | ||
![]() |
321f35f30e | ||
![]() |
82dfb06a04 | ||
![]() |
e666aac1bd | ||
![]() |
9e9a0e377e | ||
![]() |
ba3f9a318b | ||
![]() |
f3b4eefb72 | ||
![]() |
6ac1db6953 | ||
![]() |
1b42189dd6 | ||
![]() |
0d893b3d2b | ||
![]() |
7b167a4d7e | ||
![]() |
8e2f1026e7 | ||
![]() |
fe3a63af80 | ||
![]() |
f90ab60354 | ||
![]() |
5da4e1860a | ||
![]() |
6dcb7f2273 | ||
![]() |
53ae7e5a0c | ||
![]() |
56381f9914 | ||
![]() |
be31aecf00 | ||
![]() |
cc5fffc174 | ||
![]() |
dd8a50af31 | ||
![]() |
c8feded4f2 | ||
![]() |
0d0fe75f4e | ||
![]() |
fb69deb617 | ||
![]() |
c291af5d97 | ||
![]() |
6d63028406 | ||
![]() |
3917739ad2 | ||
![]() |
e98e59a265 | ||
![]() |
16ed60902d | ||
![]() |
6c7efc17c2 | ||
![]() |
d187aa0ac6 | ||
![]() |
9c60a047c1 | ||
![]() |
1825749036 | ||
![]() |
93846a2867 | ||
![]() |
f3ed0160af | ||
![]() |
38b275f7f9 | ||
![]() |
c3a36efaa4 | ||
![]() |
68fa67e77a | ||
![]() |
806cebb024 | ||
![]() |
fa788a8223 | ||
![]() |
dfbaee1649 | ||
![]() |
cfb698d0a6 | ||
![]() |
63c3d6406d | ||
![]() |
d817e92a57 | ||
![]() |
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 | ||
![]() |
fcffa1a750 | ||
![]() |
e3ee8f307a | ||
![]() |
871f0f9e0d | ||
![]() |
82fd56efe7 |
@@ -10,6 +10,12 @@ supports es6-module-dynamic-import
|
||||
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
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
# 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 \
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
|
3
.github/dependabot.yml
vendored
3
.github/dependabot.yml
vendored
@@ -6,3 +6,6 @@ updates:
|
||||
interval: weekly
|
||||
time: "06:00"
|
||||
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: |
|
||||
## What's Changed
|
||||
|
||||
|
8
.github/workflows/cast_deployment.yaml
vendored
8
.github/workflows/cast_deployment.yaml
vendored
@@ -21,12 +21,12 @@ jobs:
|
||||
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@v3.5.2
|
||||
uses: actions/checkout@v3.6.0
|
||||
with:
|
||||
ref: dev
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3.6.0
|
||||
uses: actions/setup-node@v3.8.1
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
cache: yarn
|
||||
@@ -57,12 +57,12 @@ jobs:
|
||||
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@v3.5.2
|
||||
uses: actions/checkout@v3.6.0
|
||||
with:
|
||||
ref: master
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3.6.0
|
||||
uses: actions/setup-node@v3.8.1
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
cache: yarn
|
||||
|
24
.github/workflows/ci.yaml
vendored
24
.github/workflows/ci.yaml
vendored
@@ -24,9 +24,9 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@v3.5.2
|
||||
uses: actions/checkout@v3.6.0
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3.6.0
|
||||
uses: actions/setup-node@v3.8.1
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
cache: yarn
|
||||
@@ -36,6 +36,14 @@ jobs:
|
||||
run: yarn dedupe --check
|
||||
- name: Build resources
|
||||
run: ./node_modules/.bin/gulp gen-icons-json build-translations build-locale-data gather-gallery-pages
|
||||
- name: Setup lint cache
|
||||
uses: actions/cache@v3.3.1
|
||||
with:
|
||||
path: |
|
||||
node_modules/.cache/prettier
|
||||
node_modules/.cache/eslint
|
||||
key: lint-${{ github.sha }}
|
||||
restore-keys: lint-
|
||||
- name: Run eslint
|
||||
run: yarn run lint:eslint --quiet
|
||||
- name: Run tsc
|
||||
@@ -47,9 +55,9 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@v3.5.2
|
||||
uses: actions/checkout@v3.6.0
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3.6.0
|
||||
uses: actions/setup-node@v3.8.1
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
cache: yarn
|
||||
@@ -65,9 +73,9 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@v3.5.2
|
||||
uses: actions/checkout@v3.6.0
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3.6.0
|
||||
uses: actions/setup-node@v3.8.1
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
cache: yarn
|
||||
@@ -83,9 +91,9 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@v3.5.2
|
||||
uses: actions/checkout@v3.6.0
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3.6.0
|
||||
uses: actions/setup-node@v3.8.1
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
cache: yarn
|
||||
|
60
.github/workflows/codeql-analysis.yml
vendored
60
.github/workflows/codeql-analysis.yml
vendored
@@ -17,44 +17,44 @@ jobs:
|
||||
matrix:
|
||||
# Override automatic language detection by changing the below list
|
||||
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
|
||||
language: ['javascript']
|
||||
language: ["javascript"]
|
||||
# Learn more...
|
||||
# https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#overriding-automatic-language-detection
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3.5.2
|
||||
with:
|
||||
# We must fetch at least the immediate parents so that if this is
|
||||
# a pull request then we can checkout the head.
|
||||
fetch-depth: 2
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3.6.0
|
||||
with:
|
||||
# We must fetch at least the immediate parents so that if this is
|
||||
# a pull request then we can checkout the head.
|
||||
fetch-depth: 2
|
||||
|
||||
# If this run was triggered by a pull request event, then checkout
|
||||
# the head of the pull request instead of the merge commit.
|
||||
- run: git checkout HEAD^2
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
# If this run was triggered by a pull request event, then checkout
|
||||
# the head of the pull request instead of the merge commit.
|
||||
- run: git checkout HEAD^2
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
uses: github/codeql-action/init@v2
|
||||
with:
|
||||
languages: ${{ matrix.language }}
|
||||
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
|
||||
# If this step fails, then you should remove it and run the build manually (see below)
|
||||
- name: Autobuild
|
||||
uses: github/codeql-action/autobuild@v2
|
||||
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
# ℹ️ Command-line programs to run using the OS shell.
|
||||
# 📚 https://git.io/JvXDl
|
||||
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
|
||||
# and modify them (or add more) to build your code if your project
|
||||
# uses a compiled language
|
||||
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
#- run: |
|
||||
# make bootstrap
|
||||
# make release
|
||||
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
- name: Perform CodeQL Analysis
|
||||
uses: github/codeql-action/analyze@v2
|
||||
|
8
.github/workflows/demo_deployment.yaml
vendored
8
.github/workflows/demo_deployment.yaml
vendored
@@ -22,12 +22,12 @@ jobs:
|
||||
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@v3.5.2
|
||||
uses: actions/checkout@v3.6.0
|
||||
with:
|
||||
ref: dev
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3.6.0
|
||||
uses: actions/setup-node@v3.8.1
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
cache: yarn
|
||||
@@ -58,12 +58,12 @@ jobs:
|
||||
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@v3.5.2
|
||||
uses: actions/checkout@v3.6.0
|
||||
with:
|
||||
ref: master
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3.6.0
|
||||
uses: actions/setup-node@v3.8.1
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
cache: yarn
|
||||
|
4
.github/workflows/design_deployment.yaml
vendored
4
.github/workflows/design_deployment.yaml
vendored
@@ -16,10 +16,10 @@ jobs:
|
||||
url: ${{ steps.deploy.outputs.NETLIFY_LIVE_URL || steps.deploy.outputs.NETLIFY_URL }}
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@v3.5.2
|
||||
uses: actions/checkout@v3.6.0
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3.6.0
|
||||
uses: actions/setup-node@v3.8.1
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
cache: yarn
|
||||
|
4
.github/workflows/design_preview.yaml
vendored
4
.github/workflows/design_preview.yaml
vendored
@@ -21,10 +21,10 @@ jobs:
|
||||
if: github.repository == 'home-assistant/frontend' && contains(github.event.pull_request.labels.*.name, 'needs design preview')
|
||||
steps:
|
||||
- name: Check out files from GitHub
|
||||
uses: actions/checkout@v3.5.2
|
||||
uses: actions/checkout@v3.6.0
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3.6.0
|
||||
uses: actions/setup-node@v3.8.1
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
cache: yarn
|
||||
|
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:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: dessant/lock-threads@v4.0.0
|
||||
- uses: dessant/lock-threads@v4.0.1
|
||||
with:
|
||||
github-token: ${{ github.token }}
|
||||
issue-lock-inactive-days: "30"
|
||||
|
6
.github/workflows/nightly.yaml
vendored
6
.github/workflows/nightly.yaml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
- cron: "0 1 * * *"
|
||||
|
||||
env:
|
||||
PYTHON_VERSION: "3.10"
|
||||
PYTHON_VERSION: "3.11"
|
||||
NODE_OPTIONS: --max_old_space_size=6144
|
||||
|
||||
permissions:
|
||||
@@ -20,7 +20,7 @@ jobs:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Checkout the repository
|
||||
uses: actions/checkout@v3.5.2
|
||||
uses: actions/checkout@v3.6.0
|
||||
|
||||
- name: Set up Python ${{ env.PYTHON_VERSION }}
|
||||
uses: actions/setup-python@v4
|
||||
@@ -28,7 +28,7 @@ jobs:
|
||||
python-version: ${{ env.PYTHON_VERSION }}
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3.6.0
|
||||
uses: actions/setup-node@v3.8.1
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
cache: yarn
|
||||
|
9
.github/workflows/release-drafter.yaml
vendored
9
.github/workflows/release-drafter.yaml
vendored
@@ -5,8 +5,17 @@ on:
|
||||
branches:
|
||||
- dev
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
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
|
||||
steps:
|
||||
- uses: release-drafter/release-drafter@v5
|
||||
|
8
.github/workflows/release.yaml
vendored
8
.github/workflows/release.yaml
vendored
@@ -6,7 +6,7 @@ on:
|
||||
- published
|
||||
|
||||
env:
|
||||
PYTHON_VERSION: "3.10"
|
||||
PYTHON_VERSION: "3.11"
|
||||
NODE_OPTIONS: --max_old_space_size=6144
|
||||
|
||||
# Set default workflow permissions
|
||||
@@ -23,7 +23,7 @@ jobs:
|
||||
contents: write # Required to upload release assets
|
||||
steps:
|
||||
- name: Checkout the repository
|
||||
uses: actions/checkout@v3.5.2
|
||||
uses: actions/checkout@v3.6.0
|
||||
|
||||
- name: Verify version
|
||||
uses: home-assistant/actions/helpers/verify-version@master
|
||||
@@ -34,7 +34,7 @@ jobs:
|
||||
python-version: ${{ env.PYTHON_VERSION }}
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3.6.0
|
||||
uses: actions/setup-node@v3.8.1
|
||||
with:
|
||||
node-version-file: ".nvmrc"
|
||||
cache: yarn
|
||||
@@ -76,7 +76,7 @@ jobs:
|
||||
- name: Build wheels
|
||||
uses: home-assistant/wheels@2023.04.0
|
||||
with:
|
||||
abi: cp310
|
||||
abi: cp311
|
||||
tag: musllinux_1_2
|
||||
arch: amd64
|
||||
wheels-key: ${{ secrets.WHEELS_KEY }}
|
||||
|
2
.github/workflows/translations.yaml
vendored
2
.github/workflows/translations.yaml
vendored
@@ -13,7 +13,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout the repository
|
||||
uses: actions/checkout@v3.5.2
|
||||
uses: actions/checkout@v3.6.0
|
||||
|
||||
- name: Upload Translations
|
||||
run: |
|
||||
|
@@ -1,9 +1,3 @@
|
||||
build
|
||||
translations/*
|
||||
node_modules/*
|
||||
hass_frontend/*
|
||||
pip-selfcheck.json
|
||||
|
||||
# vscode
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
CLA.md
|
||||
CODE_OF_CONDUCT.md
|
||||
LICENSE.md
|
||||
|
6
.vscode/launch.json
vendored
6
.vscode/launch.json
vendored
@@ -9,9 +9,7 @@
|
||||
"webRoot": "${workspaceFolder}/hass_frontend",
|
||||
"disableNetworkCache": true,
|
||||
"preLaunchTask": "Develop Frontend",
|
||||
"outFiles": [
|
||||
"${workspaceFolder}/hass_frontend/frontend_latest/*.js"
|
||||
]
|
||||
"outFiles": ["${workspaceFolder}/hass_frontend/frontend_latest/*.js"]
|
||||
},
|
||||
{
|
||||
"name": "Debug Gallery",
|
||||
@@ -39,6 +37,6 @@
|
||||
"webRoot": "${workspaceFolder}/cast/dist",
|
||||
"disableNetworkCache": true,
|
||||
"preLaunchTask": "Develop Cast"
|
||||
},
|
||||
}
|
||||
]
|
||||
}
|
||||
|
2
.vscode/tasks.json
vendored
2
.vscode/tasks.json
vendored
@@ -197,7 +197,7 @@
|
||||
"type": "gulp",
|
||||
"task": "setup-and-fetch-nightly-translations",
|
||||
"problemMatcher": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"inputs": [
|
||||
{
|
||||
|
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
File diff suppressed because one or more lines are too long
@@ -8,4 +8,4 @@ plugins:
|
||||
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
|
||||
spec: "@yarnpkg/plugin-interactive-tools"
|
||||
|
||||
yarnPath: .yarn/releases/yarn-3.6.0.cjs
|
||||
yarnPath: .yarn/releases/yarn-3.6.3.cjs
|
||||
|
@@ -8,7 +8,7 @@ module.exports.sourceMapURL = () => {
|
||||
const ref = env.version().endsWith("dev")
|
||||
? process.env.GITHUB_SHA || "dev"
|
||||
: 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
|
||||
@@ -77,6 +77,7 @@ module.exports.htmlMinifierOptions = {
|
||||
module.exports.terserOptions = ({ latestBuild, isTestBuild }) => ({
|
||||
safari10: !latestBuild,
|
||||
ecma: latestBuild ? 2015 : 5,
|
||||
module: latestBuild,
|
||||
format: { comments: false },
|
||||
sourceMap: !isTestBuild,
|
||||
});
|
||||
@@ -97,7 +98,7 @@ module.exports.babelOptions = ({ latestBuild, isProdBuild, isTestBuild }) => ({
|
||||
"@babel/preset-env",
|
||||
{
|
||||
useBuiltIns: latestBuild ? false : "entry",
|
||||
corejs: latestBuild ? false : { version: "3.30", proposals: true },
|
||||
corejs: latestBuild ? false : { version: "3.32", proposals: true },
|
||||
bugfixes: true,
|
||||
},
|
||||
],
|
||||
|
@@ -2,44 +2,15 @@
|
||||
|
||||
import gulp from "gulp";
|
||||
import zopfli from "gulp-zopfli-green";
|
||||
import merge from "merge-stream";
|
||||
import path from "path";
|
||||
import paths from "../paths.cjs";
|
||||
|
||||
const zopfliOptions = { threshold: 150 };
|
||||
|
||||
gulp.task("compress-app", function compressApp() {
|
||||
const jsLatest = gulp
|
||||
.src(path.resolve(paths.app_output_latest, "**/*.js"))
|
||||
const compressDist = (rootDir) =>
|
||||
gulp
|
||||
.src([`${rootDir}/**/*.{js,json,css,svg}`])
|
||||
.pipe(zopfli(zopfliOptions))
|
||||
.pipe(gulp.dest(paths.app_output_latest));
|
||||
.pipe(gulp.dest(rootDir));
|
||||
|
||||
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));
|
||||
});
|
||||
gulp.task("compress-app", () => compressDist(paths.app_output_root));
|
||||
gulp.task("compress-hassio", () => compressDist(paths.hassio_output_root));
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import fs from "fs/promises";
|
||||
import gulp from "gulp";
|
||||
import mapStream from "map-stream";
|
||||
import transform from "gulp-json-transform";
|
||||
|
||||
const inDirFrontend = "translations/frontend";
|
||||
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 () {
|
||||
// We exclude backend translations because they are not compliant with the HTML rule for now
|
||||
return gulp.src([`${inDirFrontend}/*.json`]).pipe(checkHtml());
|
||||
});
|
||||
|
||||
|
@@ -1,71 +1,73 @@
|
||||
import { deleteSync } from "del";
|
||||
import fs from "fs";
|
||||
import { mkdir, readFile, writeFile } from "fs/promises";
|
||||
import gulp from "gulp";
|
||||
import path from "path";
|
||||
import paths from "../paths.cjs";
|
||||
|
||||
const outDir = "build/locale-data";
|
||||
const outDir = path.join(paths.build_dir, "locale-data");
|
||||
|
||||
gulp.task("clean-locale-data", async () => deleteSync([outDir]));
|
||||
|
||||
gulp.task("ensure-locale-data-build-dir", async () => {
|
||||
fs.mkdirSync(outDir, { recursive: true });
|
||||
});
|
||||
|
||||
const modules = {
|
||||
const INTL_PACKAGES = {
|
||||
"intl-relativetimeformat": "RelativeTimeFormat",
|
||||
"intl-datetimeformat": "DateTimeFormat",
|
||||
"intl-numberformat": "NumberFormat",
|
||||
"intl-displaynames": "DisplayNames",
|
||||
"intl-listformat": "ListFormat",
|
||||
};
|
||||
|
||||
gulp.task("create-locale-data", (done) => {
|
||||
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(
|
||||
fs.readFileSync(
|
||||
path.join(paths.translations_src, "translationMetadata.json")
|
||||
await readFile(
|
||||
path.resolve(paths.translations_src, "translationMetadata.json"),
|
||||
"utf-8"
|
||||
)
|
||||
);
|
||||
Object.entries(modules).forEach(([module, className]) => {
|
||||
Object.keys(translationMeta).forEach((lang) => {
|
||||
try {
|
||||
const localeData = fs
|
||||
.readFileSync(
|
||||
path.resolve(
|
||||
paths.polymer_dir,
|
||||
`node_modules/@formatjs/${module}/locale-data/${lang}.js`
|
||||
),
|
||||
"utf-8"
|
||||
)
|
||||
.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);
|
||||
fs.mkdirSync(path.join(outDir, module), { recursive: true });
|
||||
fs.writeFileSync(
|
||||
path.join(outDir, `${module}/${lang}.json`),
|
||||
localeData
|
||||
);
|
||||
} catch (e) {
|
||||
if (e.code !== "ENOENT") {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
});
|
||||
done();
|
||||
});
|
||||
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",
|
||||
"ensure-locale-data-build-dir",
|
||||
"create-locale-data"
|
||||
)
|
||||
gulp.series("clean-locale-data", "create-locale-data")
|
||||
);
|
||||
|
@@ -415,7 +415,7 @@ gulp.task("build-translation-write-metadata", () =>
|
||||
gulp.task(
|
||||
"create-translations",
|
||||
gulp.series(
|
||||
env.isProdBuild() ? (done) => done() : "create-test-translation",
|
||||
...(env.isProdBuild() ? [] : ["create-test-translation"]),
|
||||
"build-master-translation",
|
||||
"build-merged-translations",
|
||||
gulp.parallel(...splitTasks),
|
||||
|
@@ -1,9 +1,9 @@
|
||||
// Tasks to run webpack.
|
||||
|
||||
import log from "fancy-log";
|
||||
import fs from "fs";
|
||||
import gulp from "gulp";
|
||||
import path from "path";
|
||||
import log from "fancy-log";
|
||||
import gulp from "gulp";
|
||||
import webpack from "webpack";
|
||||
import WebpackDevServer from "webpack-dev-server";
|
||||
import env from "../env.cjs";
|
||||
@@ -44,6 +44,7 @@ const runDevServer = async ({
|
||||
}) => {
|
||||
const server = new WebpackDevServer(
|
||||
{
|
||||
hot: false,
|
||||
open: true,
|
||||
host: listenHost,
|
||||
port,
|
||||
|
@@ -142,4 +142,5 @@ module.exports = {
|
||||
createCastConfig,
|
||||
createHassioConfig,
|
||||
createGalleryConfig,
|
||||
createRollupConfig,
|
||||
};
|
||||
|
@@ -1,5 +1,6 @@
|
||||
const webpack = require("webpack");
|
||||
const { existsSync } = require("fs");
|
||||
const path = require("path");
|
||||
const webpack = require("webpack");
|
||||
const TerserPlugin = require("terser-webpack-plugin");
|
||||
const { WebpackManifestPlugin } = require("webpack-manifest-plugin");
|
||||
const log = require("fancy-log");
|
||||
@@ -41,7 +42,7 @@ const createWebpackConfig = ({
|
||||
return {
|
||||
name,
|
||||
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 production, generate source maps for accurate stack traces without source code
|
||||
// For development, generate "cheap" versions that can map to original line numbers
|
||||
@@ -84,6 +85,13 @@ const createWebpackConfig = ({
|
||||
],
|
||||
moduleIds: 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: [
|
||||
!isStatsBuild && new WebpackBar({ fancy: !isProdBuild }),
|
||||
@@ -160,9 +168,12 @@ const createWebpackConfig = ({
|
||||
"lit/polyfill-support$": "lit/polyfill-support.js",
|
||||
"@lit-labs/virtualizer/layouts/grid":
|
||||
"@lit-labs/virtualizer/layouts/grid.js",
|
||||
"@lit-labs/virtualizer/polyfills/resize-observer-polyfill/ResizeObserver":
|
||||
"@lit-labs/virtualizer/polyfills/resize-observer-polyfill/ResizeObserver.js",
|
||||
},
|
||||
},
|
||||
output: {
|
||||
module: latestBuild,
|
||||
filename: ({ chunk }) =>
|
||||
!isProdBuild || isStatsBuild || dontHash.has(chunk.name)
|
||||
? "[name].js"
|
||||
@@ -181,22 +192,29 @@ const createWebpackConfig = ({
|
||||
// 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)
|
||||
// Otherwise, point to the raw code on GitHub for browser to load
|
||||
devtoolModuleFilenameTemplate:
|
||||
!isTestBuild && isProdBuild
|
||||
? (info) => {
|
||||
const sourcePath = info.resourcePath.replace(/^\.\//, "");
|
||||
if (
|
||||
sourcePath.startsWith("node_modules") ||
|
||||
sourcePath.startsWith("webpack")
|
||||
) {
|
||||
return `no-source/${sourcePath}`;
|
||||
...Object.fromEntries(
|
||||
["", "Fallback"].map((v) => [
|
||||
`devtool${v}ModuleFilenameTemplate`,
|
||||
!isTestBuild && isProdBuild
|
||||
? (info) => {
|
||||
if (
|
||||
!path.isAbsolute(info.absoluteResourcePath) ||
|
||||
!existsSync(info.resourcePath) ||
|
||||
info.resourcePath.startsWith("./node_modules")
|
||||
) {
|
||||
// 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 new URL(info.resourcePath, bundle.sourceMapURL()).href;
|
||||
}
|
||||
return `${bundle.sourceMapURL()}/${sourcePath}`;
|
||||
}
|
||||
: undefined,
|
||||
: undefined,
|
||||
])
|
||||
),
|
||||
},
|
||||
experiments: {
|
||||
topLevelAwait: true,
|
||||
outputModule: true,
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -243,4 +261,5 @@ module.exports = {
|
||||
createCastConfig,
|
||||
createHassioConfig,
|
||||
createGalleryConfig,
|
||||
createWebpackConfig,
|
||||
};
|
||||
|
@@ -1,3 +1,3 @@
|
||||
self.addEventListener("fetch", function(event) {
|
||||
self.addEventListener("fetch", (event) => {
|
||||
event.respondWith(fetch(event.request));
|
||||
});
|
||||
|
@@ -1,21 +1,21 @@
|
||||
import { cast } from "chromecast-caf-receiver";
|
||||
import { framework } from "../receiver/cast_framework";
|
||||
|
||||
const castContext = cast.framework.CastReceiverContext.getInstance();
|
||||
const castContext = framework.CastReceiverContext.getInstance();
|
||||
|
||||
const playerManager = castContext.getPlayerManager();
|
||||
|
||||
playerManager.setMessageInterceptor(
|
||||
cast.framework.messages.MessageType.LOAD,
|
||||
framework.messages.MessageType.LOAD,
|
||||
(loadRequestData) => {
|
||||
const media = loadRequestData.media;
|
||||
// Special handling if it came from Google Assistant
|
||||
if (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";
|
||||
// @ts-ignore
|
||||
media.hlsVideoSegmentFormat =
|
||||
cast.framework.messages.HlsVideoSegmentFormat.FMP4;
|
||||
framework.messages.HlsVideoSegmentFormat.FMP4;
|
||||
}
|
||||
return loadRequestData;
|
||||
}
|
||||
|
@@ -1,3 +1,3 @@
|
||||
import { cast } from "chromecast-caf-receiver";
|
||||
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 @@
|
||||
import { cast } from "chromecast-caf-receiver";
|
||||
import { framework } from "./cast_framework";
|
||||
import { CAST_NS } from "../../../src/cast/const";
|
||||
import { HassMessage } from "../../../src/cast/receiver_messages";
|
||||
import "../../../src/resources/custom-card-support";
|
||||
@@ -34,14 +34,14 @@ const setTouchControlsVisibility = (visible: boolean) => {
|
||||
let timeOut: number | undefined;
|
||||
|
||||
const playDummyMedia = (viewTitle?: string) => {
|
||||
const loadRequestData = new cast.framework.messages.LoadRequestData();
|
||||
const loadRequestData = new framework.messages.LoadRequestData();
|
||||
loadRequestData.autoplay = true;
|
||||
loadRequestData.media = new cast.framework.messages.MediaInformation();
|
||||
loadRequestData.media = new framework.messages.MediaInformation();
|
||||
loadRequestData.media.contentId =
|
||||
"https://cast.home-assistant.io/images/google-nest-hub.png";
|
||||
loadRequestData.media.contentType = "image/jpeg";
|
||||
loadRequestData.media.streamType = cast.framework.messages.StreamType.NONE;
|
||||
const metadata = new cast.framework.messages.GenericMediaMetadata();
|
||||
loadRequestData.media.streamType = framework.messages.StreamType.NONE;
|
||||
const metadata = new framework.messages.GenericMediaMetadata();
|
||||
metadata.title = viewTitle;
|
||||
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.customNamespaces = {
|
||||
[CAST_NS]: cast.framework.system.MessageType.JSON,
|
||||
[CAST_NS]: framework.system.MessageType.JSON,
|
||||
};
|
||||
|
||||
castContext.addCustomMessageListener(
|
||||
@@ -98,8 +98,7 @@ castContext.addCustomMessageListener(
|
||||
(ev: ReceivedMessage<HassMessage>) => {
|
||||
// We received a show Lovelace command, stop media from playing, hide media player and show Lovelace controller
|
||||
if (
|
||||
playerManager.getPlayerState() !==
|
||||
cast.framework.messages.PlayerState.IDLE
|
||||
playerManager.getPlayerState() !== framework.messages.PlayerState.IDLE
|
||||
) {
|
||||
playerManager.stop();
|
||||
} else {
|
||||
@@ -114,7 +113,7 @@ castContext.addCustomMessageListener(
|
||||
const playerManager = castContext.getPlayerManager();
|
||||
|
||||
playerManager.setMessageInterceptor(
|
||||
cast.framework.messages.MessageType.LOAD,
|
||||
framework.messages.MessageType.LOAD,
|
||||
(loadRequestData) => {
|
||||
if (
|
||||
loadRequestData.media.contentId ===
|
||||
@@ -128,25 +127,24 @@ playerManager.setMessageInterceptor(
|
||||
// Special handling if it came from Google Assistant
|
||||
if (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";
|
||||
// @ts-ignore
|
||||
media.hlsVideoSegmentFormat =
|
||||
cast.framework.messages.HlsVideoSegmentFormat.FMP4;
|
||||
framework.messages.HlsVideoSegmentFormat.FMP4;
|
||||
}
|
||||
return loadRequestData;
|
||||
}
|
||||
);
|
||||
|
||||
playerManager.addEventListener(
|
||||
cast.framework.events.EventType.MEDIA_STATUS,
|
||||
framework.events.EventType.MEDIA_STATUS,
|
||||
(event) => {
|
||||
if (
|
||||
event.mediaStatus?.playerState ===
|
||||
cast.framework.messages.PlayerState.IDLE &&
|
||||
event.mediaStatus?.playerState === framework.messages.PlayerState.IDLE &&
|
||||
event.mediaStatus?.idleReason &&
|
||||
event.mediaStatus?.idleReason !==
|
||||
cast.framework.messages.IdleReason.INTERRUPTED
|
||||
framework.messages.IdleReason.INTERRUPTED
|
||||
) {
|
||||
// media finished or stopped, return to default Lovelace
|
||||
showLovelaceController();
|
||||
|
@@ -1,3 +1,3 @@
|
||||
self.addEventListener("fetch", function(event) {
|
||||
self.addEventListener("fetch", (event) => {
|
||||
event.respondWith(fetch(event.request));
|
||||
});
|
||||
|
@@ -1,20 +1,18 @@
|
||||
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
|
||||
|
||||
export const mockConfigEntries = (hass: MockHomeAssistant) => {
|
||||
hass.mockWS("config_entries/get_matching", () => [
|
||||
{
|
||||
entry_id: "co2signal",
|
||||
domain: "co2signal",
|
||||
title: "CO2 Signal",
|
||||
source: "user",
|
||||
state: "loaded",
|
||||
supports_options: false,
|
||||
supports_remove_device: false,
|
||||
supports_unload: true,
|
||||
pref_disable_new_entities: false,
|
||||
pref_disable_polling: false,
|
||||
disabled_by: null,
|
||||
reason: null,
|
||||
},
|
||||
]);
|
||||
hass.mockWS("config_entries/get", () => ({
|
||||
entry_id: "co2signal",
|
||||
domain: "co2signal",
|
||||
title: "Electricity Maps",
|
||||
source: "user",
|
||||
state: "loaded",
|
||||
supports_options: false,
|
||||
supports_remove_device: false,
|
||||
supports_unload: true,
|
||||
pref_disable_new_entities: false,
|
||||
pref_disable_polling: false,
|
||||
disabled_by: 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";
|
||||
|
||||
export const mockPersistentNotification = (hass: MockHomeAssistant) => {
|
||||
hass.mockWS("persistent_notification/get", () =>
|
||||
Promise.resolve([
|
||||
{
|
||||
created_at: new Date().toISOString(),
|
||||
message: "There was motion detected in the backyard.",
|
||||
notification_id: "demo-1",
|
||||
title: "Motion Detected!",
|
||||
status: "unread",
|
||||
hass.mockWS("persistent_notification/subscribe", (_msg, _hass, onChange) => {
|
||||
onChange!({
|
||||
type: "added",
|
||||
notifications: {
|
||||
"demo-1": {
|
||||
created_at: new Date().toISOString(),
|
||||
message: "There was motion detected in the backyard.",
|
||||
notification_id: "demo-1",
|
||||
title: "Motion Detected!",
|
||||
status: "unread",
|
||||
},
|
||||
},
|
||||
] as PersistentNotification[])
|
||||
);
|
||||
} as PersistentNotificationMessage);
|
||||
return () => {};
|
||||
});
|
||||
};
|
||||
|
@@ -72,6 +72,7 @@ const generateSumStatistics = (
|
||||
min: null,
|
||||
max: null,
|
||||
last_reset: 0,
|
||||
change: add,
|
||||
state: initValue + sum,
|
||||
sum,
|
||||
});
|
||||
@@ -103,8 +104,8 @@ const generateCurvedStatistics = (
|
||||
let half = false;
|
||||
const now = new Date();
|
||||
while (end > currentDate && currentDate < now) {
|
||||
const add = Math.random() * maxDiff;
|
||||
sum += i * add;
|
||||
const add = i * (Math.random() * maxDiff);
|
||||
sum += add;
|
||||
statistics.push({
|
||||
start: currentDate.getTime(),
|
||||
end: currentDate.getTime(),
|
||||
@@ -112,6 +113,7 @@ const generateCurvedStatistics = (
|
||||
min: null,
|
||||
max: null,
|
||||
last_reset: 0,
|
||||
change: add,
|
||||
state: initValue + sum,
|
||||
sum: metered ? sum : null,
|
||||
});
|
||||
|
@@ -1,4 +1,3 @@
|
||||
import "@polymer/app-layout/app-toolbar/app-toolbar";
|
||||
import { html, css, LitElement } from "lit";
|
||||
import { customElement, property, query, state } from "lit/decorators";
|
||||
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 "./demo-card";
|
||||
import type { DemoCardConfig } from "./demo-card";
|
||||
import "../ha-demo-options";
|
||||
|
||||
@customElement("demo-cards")
|
||||
class DemoCards extends LitElement {
|
||||
@@ -20,20 +20,14 @@ class DemoCards extends LitElement {
|
||||
|
||||
render() {
|
||||
return html`
|
||||
<app-toolbar>
|
||||
<div class="filters">
|
||||
<ha-formfield label="Show config">
|
||||
<ha-switch
|
||||
.checked=${this._showConfig}
|
||||
@change=${this._showConfigToggled}
|
||||
>
|
||||
</ha-switch>
|
||||
</ha-formfield>
|
||||
<ha-formfield label="Dark theme">
|
||||
<ha-switch @change=${this._darkThemeToggled}> </ha-switch>
|
||||
</ha-formfield>
|
||||
</div>
|
||||
</app-toolbar>
|
||||
<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.configs.map(
|
||||
@@ -69,12 +63,6 @@ class DemoCards extends LitElement {
|
||||
demo-card {
|
||||
margin: 16px 16px 32px;
|
||||
}
|
||||
app-toolbar {
|
||||
background-color: var(--light-primary-color);
|
||||
}
|
||||
.filters {
|
||||
margin-left: 60px;
|
||||
}
|
||||
ha-formfield {
|
||||
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",
|
||||
},
|
||||
];
|
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;
|
||||
}
|
||||
}
|
@@ -4,53 +4,63 @@ subtitle: The difference between remove/delete and add/create.
|
||||
---
|
||||
|
||||
# Remove vs Delete
|
||||
|
||||
Remove and Delete are quite similar, but can be frustrating if used inconsistently.
|
||||
|
||||
## Remove
|
||||
|
||||
Take away and set aside, but kept in existence.
|
||||
|
||||
For example:
|
||||
* Removing a user's permission
|
||||
* Removing a user from a group
|
||||
* Removing links between items
|
||||
* Removing a widget
|
||||
* Removing a link
|
||||
* Removing an item from a cart
|
||||
|
||||
- Removing a user's permission
|
||||
- Removing a user from a group
|
||||
- Removing links between items
|
||||
- Removing a widget
|
||||
- Removing a link
|
||||
- Removing an item from a cart
|
||||
|
||||
## Delete
|
||||
|
||||
Erase, rendered nonexistent or nonrecoverable.
|
||||
|
||||
For example:
|
||||
* Deleting a field
|
||||
* Deleting a value in a field
|
||||
* Deleting a task
|
||||
* Deleting a group
|
||||
* Deleting a permission
|
||||
* Deleting a calendar event
|
||||
|
||||
- Deleting a field
|
||||
- Deleting a value in a field
|
||||
- Deleting a task
|
||||
- Deleting a group
|
||||
- Deleting a permission
|
||||
- Deleting a calendar event
|
||||
|
||||
# Add vs Create
|
||||
|
||||
In most cases, Create can be paired with Delete, and Add can be paired with Remove.
|
||||
|
||||
## Add
|
||||
|
||||
An already-exisiting item.
|
||||
|
||||
For example:
|
||||
* Adding a permission to a user
|
||||
* Adding a user to a group
|
||||
* Adding links between items
|
||||
* Adding a widget
|
||||
* Adding a link
|
||||
* Adding an item to a cart
|
||||
|
||||
- Adding a permission to a user
|
||||
- Adding a user to a group
|
||||
- Adding links between items
|
||||
- Adding a widget
|
||||
- Adding a link
|
||||
- Adding an item to a cart
|
||||
|
||||
## Create
|
||||
|
||||
Something made from scratch.
|
||||
|
||||
For example:
|
||||
* Creating a new field
|
||||
* Creating a new value in a field
|
||||
* Creating a new task
|
||||
* Creating a new group
|
||||
* Creating a new permission
|
||||
* Creating a new calendar event
|
||||
|
||||
- Creating a new field
|
||||
- Creating a new value in a field
|
||||
- Creating a new task
|
||||
- Creating a new group
|
||||
- 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).
|
||||
|
@@ -162,6 +162,7 @@ export class DemoAutomationDescribeAction extends LitElement {
|
||||
super.firstUpdated(changedProps);
|
||||
const hass = provideHass(this);
|
||||
hass.updateTranslations(null, "en");
|
||||
hass.updateTranslations("config", "en");
|
||||
hass.addEntities(ENTITIES);
|
||||
}
|
||||
|
||||
|
@@ -89,6 +89,7 @@ export class DemoAutomationDescribeCondition extends LitElement {
|
||||
super.firstUpdated(changedProps);
|
||||
const hass = provideHass(this);
|
||||
hass.updateTranslations(null, "en");
|
||||
hass.updateTranslations("config", "en");
|
||||
hass.addEntities(ENTITIES);
|
||||
}
|
||||
|
||||
|
@@ -40,7 +40,9 @@ const triggers = [
|
||||
},
|
||||
{ platform: "sun", event: "sunset" },
|
||||
{ platform: "time_pattern" },
|
||||
{ platform: "time_pattern", hours: "*", minutes: "/5", seconds: "10" },
|
||||
{ platform: "webhook" },
|
||||
{ platform: "persistent_notification" },
|
||||
{
|
||||
platform: "zone",
|
||||
entity_id: "person.person",
|
||||
@@ -50,6 +52,11 @@ const triggers = [
|
||||
{ platform: "tag" },
|
||||
{ platform: "time", at: "15:32" },
|
||||
{ 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" },
|
||||
];
|
||||
|
||||
@@ -99,6 +106,7 @@ export class DemoAutomationDescribeTrigger extends LitElement {
|
||||
super.firstUpdated(changedProps);
|
||||
const hass = provideHass(this);
|
||||
hass.updateTranslations(null, "en");
|
||||
hass.updateTranslations("config", "en");
|
||||
hass.addEntities(ENTITIES);
|
||||
}
|
||||
|
||||
|
@@ -85,17 +85,16 @@ class DemoHaAutomationEditorAction extends LitElement {
|
||||
.value=${this.data[sampleIdx]}
|
||||
>
|
||||
${["light", "dark"].map(
|
||||
(slot) =>
|
||||
html`
|
||||
<ha-automation-action
|
||||
slot=${slot}
|
||||
.hass=${this.hass}
|
||||
.actions=${this.data[sampleIdx]}
|
||||
.sampleIdx=${sampleIdx}
|
||||
.disabled=${this._disabled}
|
||||
@value-changed=${valueChanged}
|
||||
></ha-automation-action>
|
||||
`
|
||||
(slot) => html`
|
||||
<ha-automation-action
|
||||
slot=${slot}
|
||||
.hass=${this.hass}
|
||||
.actions=${this.data[sampleIdx]}
|
||||
.sampleIdx=${sampleIdx}
|
||||
.disabled=${this._disabled}
|
||||
@value-changed=${valueChanged}
|
||||
></ha-automation-action>
|
||||
`
|
||||
)}
|
||||
</demo-black-white-row>
|
||||
`
|
||||
|
@@ -121,17 +121,16 @@ class DemoHaAutomationEditorCondition extends LitElement {
|
||||
.value=${this.data[sampleIdx]}
|
||||
>
|
||||
${["light", "dark"].map(
|
||||
(slot) =>
|
||||
html`
|
||||
<ha-automation-condition
|
||||
slot=${slot}
|
||||
.hass=${this.hass}
|
||||
.conditions=${this.data[sampleIdx]}
|
||||
.sampleIdx=${sampleIdx}
|
||||
.disabled=${this._disabled}
|
||||
@value-changed=${valueChanged}
|
||||
></ha-automation-condition>
|
||||
`
|
||||
(slot) => html`
|
||||
<ha-automation-condition
|
||||
slot=${slot}
|
||||
.hass=${this.hass}
|
||||
.conditions=${this.data[sampleIdx]}
|
||||
.sampleIdx=${sampleIdx}
|
||||
.disabled=${this._disabled}
|
||||
@value-changed=${valueChanged}
|
||||
></ha-automation-condition>
|
||||
`
|
||||
)}
|
||||
</demo-black-white-row>
|
||||
`
|
||||
|
@@ -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 { 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 { 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 { 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 { HaMQTTTrigger } from "../../../../src/panels/config/automation/trigger/types/ha-automation-trigger-mqtt";
|
||||
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[] }[] = [
|
||||
{
|
||||
@@ -72,6 +74,16 @@ const SCHEMAS: { name: string; triggers: Trigger[] }[] = [
|
||||
triggers: [{ platform: "webhook", ...HaWebhookTrigger.defaultConfig }],
|
||||
},
|
||||
|
||||
{
|
||||
name: "Persistent Notification",
|
||||
triggers: [
|
||||
{
|
||||
platform: "persistent_notification",
|
||||
...HaPersistentNotificationTrigger.defaultConfig,
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
{
|
||||
name: "Zone",
|
||||
triggers: [{ platform: "zone", ...HaZoneTrigger.defaultConfig }],
|
||||
@@ -101,6 +113,16 @@ const SCHEMAS: { name: string; triggers: Trigger[] }[] = [
|
||||
name: "Device Trigger",
|
||||
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")
|
||||
@@ -145,17 +167,16 @@ class DemoHaAutomationEditorTrigger extends LitElement {
|
||||
.value=${this.data[sampleIdx]}
|
||||
>
|
||||
${["light", "dark"].map(
|
||||
(slot) =>
|
||||
html`
|
||||
<ha-automation-trigger
|
||||
slot=${slot}
|
||||
.hass=${this.hass}
|
||||
.triggers=${this.data[sampleIdx]}
|
||||
.sampleIdx=${sampleIdx}
|
||||
.disabled=${this._disabled}
|
||||
@value-changed=${valueChanged}
|
||||
></ha-automation-trigger>
|
||||
`
|
||||
(slot) => html`
|
||||
<ha-automation-trigger
|
||||
slot=${slot}
|
||||
.hass=${this.hass}
|
||||
.triggers=${this.data[sampleIdx]}
|
||||
.sampleIdx=${sampleIdx}
|
||||
.disabled=${this._disabled}
|
||||
@value-changed=${valueChanged}
|
||||
></ha-automation-trigger>
|
||||
`
|
||||
)}
|
||||
</demo-black-white-row>
|
||||
`
|
||||
|
@@ -10,7 +10,6 @@ As a community, we are proud of our logo. Follow these guidelines to ensure it a
|
||||
|
||||

|
||||
|
||||
|
||||
## 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.
|
||||
@@ -21,7 +20,7 @@ Our icon is a shorter and most used version of our logo. The icon can exist with
|
||||
|
||||
The pretty blue logo with a background shadow, pictured top left, is our primary logo. It should only be used with black, white, and non-duotone photography.
|
||||
|
||||
When needed you can use our logo without a shadow, as seen as the second variant.
|
||||
When needed you can use our logo without a shadow, as seen as the second variant.
|
||||
|
||||
The outlined logo should only be used on packaging.
|
||||
|
||||
|
@@ -11,6 +11,7 @@ subtitle: An alert displays a short, important message in a way that attracts th
|
||||
</style>
|
||||
|
||||
# Alert `<ha-alert>`
|
||||
|
||||
The alert offers four severity levels that set a distinctive icon and color.
|
||||
|
||||
<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)
|
||||
|
||||
### 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 |
|
||||
| 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
|
||||
|
||||
### Usage
|
||||
|
||||
An alert displays a short, important message in a way that attracts the user's attention without interrupting the user's task.
|
||||
|
||||
### Anatomy
|
||||
*Documentation coming soon*
|
||||
|
||||
_Documentation coming soon_
|
||||
|
||||
### Error alert
|
||||
|
||||
Error alerts
|
||||
*Real world example coming soon*
|
||||
_Real world example coming soon_
|
||||
|
||||
### Warning alert
|
||||
|
||||
Warning alerts
|
||||
*Real world example coming soon*
|
||||
_Real world example coming soon_
|
||||
|
||||
### Info alert
|
||||
|
||||
Info alerts
|
||||
*Real world example coming soon*
|
||||
_Real world example coming soon_
|
||||
|
||||
### Success alert
|
||||
|
||||
Success alerts
|
||||
*Real world example coming soon*
|
||||
_Real world example coming soon_
|
||||
|
||||
### Placement
|
||||
|
||||
|
||||
### Accessibility
|
||||
|
||||
(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.
|
||||
@@ -78,6 +87,7 @@ Actions must have a tab index of 0 so that they can be reached by keyboard-only
|
||||
## Implementation
|
||||
|
||||
### Example Usage
|
||||
|
||||
**Alert type**
|
||||
|
||||
<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!
|
||||
</ha-alert>
|
||||
|
||||
|
||||
```html
|
||||
<ha-alert alert-type="error">
|
||||
This is an error alert — check it out!
|
||||
</ha-alert>
|
||||
<ha-alert alert-type="error"> This is an error alert — check it out! </ha-alert>
|
||||
<ha-alert alert-type="warning">
|
||||
This is a warning alert — check it out!
|
||||
</ha-alert>
|
||||
<ha-alert alert-type="info">
|
||||
This is an info alert — check it out!
|
||||
</ha-alert>
|
||||
<ha-alert alert-type="info"> This is an info alert — check it out! </ha-alert>
|
||||
<ha-alert alert-type="success">
|
||||
This is a success alert — check it out!
|
||||
</ha-alert>
|
||||
@@ -154,13 +159,14 @@ The `title ` option should not be used without a description.
|
||||
|
||||
**Slotted icon**
|
||||
|
||||
*Documentation coming soon*
|
||||
_Documentation coming soon_
|
||||
|
||||
### API
|
||||
|
||||
**Properties/Attributes**
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
|-------------|---------|---------|-------------------------------------------------------|
|
||||
| ----------- | ------- | ------- | ----------------------------------------------------- |
|
||||
| title | string | `` | Title to display. |
|
||||
| alertType | string | `info` | Severity level that set a distinctive icon and color. |
|
||||
| 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**
|
||||
|
||||
*Documentation coming soon*
|
||||
_Documentation coming soon_
|
||||
|
||||
**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;
|
||||
}
|
||||
}
|
@@ -5,28 +5,32 @@ subtitle: Dialogs provide important prompts in a user flow.
|
||||
|
||||
# Material Design 3
|
||||
|
||||
Our dialogs are based on the latest version of Material Design. Specs and guidelines can be found on its [website](https://m3.material.io/components/dialogs/overview).
|
||||
Our dialogs are based on the latest version of Material Design. Specs and guidelines can be found on its [website](https://m3.material.io/components/dialogs/overview).
|
||||
|
||||
# Highlighted guidelines
|
||||
|
||||
## 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.
|
||||
* Try to avoid user generated content in the title, this could make the title unreadable long.
|
||||
* If users become unsure, they read the description. Make sure this explains what will happen.
|
||||
* Strive for minimalism.
|
||||
|
||||
- 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.
|
||||
- Try to avoid user generated content in the title, this could make the title unreadable long.
|
||||
- If users become unsure, they read the description. Make sure this explains what will happen.
|
||||
- Strive for minimalism.
|
||||
|
||||
## 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.
|
||||
* Destructive actions should be a red warning button.
|
||||
* 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.
|
||||
|
||||
- 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.
|
||||
- Destructive actions should be a red warning button.
|
||||
- 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
|
||||
|
||||
### Confirmation dialog
|
||||
|
||||
> **Delete dashboard?**
|
||||
>
|
||||
>
|
||||
> Dashboard [dashboard name] will be permanently deleted from Home Assistant.
|
||||
>
|
||||
>
|
||||
> Cancel / Delete
|
||||
|
@@ -32,7 +32,6 @@ Error color gauge
|
||||
Gauge with background color
|
||||
<ha-gauge value="75" style="--gauge-color: var(--info-color); --primary-background-color: lightgray"></ha-gauge>
|
||||
|
||||
|
||||
## CSS variables
|
||||
|
||||
### Gauge
|
||||
|
@@ -497,24 +497,23 @@ class DemoHaSelector extends LitElement implements ProvideHassElement {
|
||||
<demo-black-white-row .title=${info.name} .value=${this.data[idx]}>
|
||||
${["light", "dark"].map((slot) =>
|
||||
Object.entries(info.input).map(
|
||||
([key, value]) =>
|
||||
html`
|
||||
<ha-settings-row narrow slot=${slot}>
|
||||
<span slot="heading">${value?.name || key}</span>
|
||||
<span slot="description">${value?.description}</span>
|
||||
<ha-selector
|
||||
.hass=${this.hass}
|
||||
.selector=${value!.selector}
|
||||
.key=${key}
|
||||
.label=${this._label ? value!.name : undefined}
|
||||
.value=${data[key] ?? value!.default}
|
||||
.disabled=${this._disabled}
|
||||
.required=${this._required}
|
||||
@value-changed=${valueChanged}
|
||||
.helper=${this._helper ? "Helper text" : undefined}
|
||||
></ha-selector>
|
||||
</ha-settings-row>
|
||||
`
|
||||
([key, value]) => html`
|
||||
<ha-settings-row narrow slot=${slot}>
|
||||
<span slot="heading">${value?.name || key}</span>
|
||||
<span slot="description">${value?.description}</span>
|
||||
<ha-selector
|
||||
.hass=${this.hass}
|
||||
.selector=${value!.selector}
|
||||
.key=${key}
|
||||
.label=${this._label ? value!.name : undefined}
|
||||
.value=${data[key] ?? value!.default}
|
||||
.disabled=${this._disabled}
|
||||
.required=${this._required}
|
||||
@value-changed=${valueChanged}
|
||||
.helper=${this._helper ? "Helper text" : undefined}
|
||||
></ha-selector>
|
||||
</ha-settings-row>
|
||||
`
|
||||
)
|
||||
)}
|
||||
</demo-black-white-row>
|
||||
|
@@ -30,7 +30,7 @@ For the switch / toggle there are always two variables, one for the on / checked
|
||||
The track element (background rounded rectangle that the round circular handle travels on) is set to being half transparent, so the final color will also be impacted by the color behind the track.
|
||||
|
||||
`switch-checked-color` / `switch-unchecked-color`
|
||||
Set both the color of the round handle and the track behind it. If you want to control them separately, use the variables below instead.
|
||||
Set both the color of the round handle and the track behind it. If you want to control them separately, use the variables below instead.
|
||||
|
||||
`switch-checked-button-color` / `switch-unchecked-button-color`
|
||||
Color of the round handle
|
||||
|
@@ -1,3 +0,0 @@
|
||||
---
|
||||
title: Temp Color Picker
|
||||
---
|
@@ -1,117 +0,0 @@
|
||||
import "../../../../src/components/ha-temp-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";
|
||||
|
||||
@customElement("demo-components-ha-temp-color-picker")
|
||||
export class DemoHaTempColorPicker extends LitElement {
|
||||
@state()
|
||||
min = 3000;
|
||||
|
||||
@state()
|
||||
max = 7000;
|
||||
|
||||
@state()
|
||||
value = 4000;
|
||||
|
||||
@state()
|
||||
liveValue?: number;
|
||||
|
||||
private _minChanged(ev) {
|
||||
this.min = Number(ev.target.value);
|
||||
}
|
||||
|
||||
private _maxChanged(ev) {
|
||||
this.max = Number(ev.target.value);
|
||||
}
|
||||
|
||||
private _valueChanged(ev) {
|
||||
this.value = Number(ev.target.value);
|
||||
}
|
||||
|
||||
private _tempColorCursor(ev) {
|
||||
this.liveValue = ev.detail.value;
|
||||
}
|
||||
|
||||
private _tempColorChanged(ev) {
|
||||
this.value = ev.detail.value;
|
||||
}
|
||||
|
||||
protected render(): TemplateResult {
|
||||
return html`
|
||||
<ha-card>
|
||||
<div class="card-content">
|
||||
<p class="value">${this.liveValue ?? this.value} K</p>
|
||||
<ha-temp-color-picker
|
||||
.min=${this.min}
|
||||
.max=${this.max}
|
||||
.value=${this.value}
|
||||
@value-changed=${this._tempColorChanged}
|
||||
@cursor-moved=${this._tempColorCursor}
|
||||
></ha-temp-color-picker>
|
||||
<p>Min temp : ${this.min} K</p>
|
||||
<ha-slider
|
||||
step="1"
|
||||
pin
|
||||
min="2000"
|
||||
max="10000"
|
||||
.value=${this.min}
|
||||
@change=${this._minChanged}
|
||||
>
|
||||
</ha-slider>
|
||||
<p>Max temp : ${this.max} K</p>
|
||||
<ha-slider
|
||||
step="1"
|
||||
pin
|
||||
min="2000"
|
||||
max="10000"
|
||||
.value=${this.max}
|
||||
@change=${this._maxChanged}
|
||||
>
|
||||
</ha-slider>
|
||||
<p>Value : ${this.value} K</p>
|
||||
<ha-slider
|
||||
step="1"
|
||||
pin
|
||||
min=${this.min}
|
||||
max=${this.max}
|
||||
.value=${this.value}
|
||||
@change=${this._valueChanged}
|
||||
>
|
||||
</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-temp-color-picker {
|
||||
width: 400px;
|
||||
}
|
||||
.value {
|
||||
font-size: 22px;
|
||||
font-weight: bold;
|
||||
margin: 0 0 12px 0;
|
||||
}
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"demo-components-ha-temp-color-picker": DemoHaTempColorPicker;
|
||||
}
|
||||
}
|
@@ -20,9 +20,8 @@ export class DemoHaTip extends LitElement {
|
||||
<ha-card header="ha-tip ${mode} demo">
|
||||
<div class="card-content">
|
||||
${tips.map(
|
||||
(tip) => html`<ha-tip .hass=${provideHass(this)}
|
||||
>${tip}</ha-tip
|
||||
>`
|
||||
(tip) =>
|
||||
html`<ha-tip .hass=${provideHass(this)}>${tip}</ha-tip>`
|
||||
)}
|
||||
</div>
|
||||
</ha-card>
|
||||
|
@@ -7,18 +7,21 @@ title: Home
|
||||
This portal aims to aid designers and developers on improving the Home Assistant interface. It consists of working code, resources and guidelines.
|
||||
|
||||
## Home Assistant interface
|
||||
|
||||
The Home Assistant frontend allows users to browse and control the state of their home, manage their automations and configure integrations. The frontend is designed as a mobile-first experience. It is a progressive web application and offers an app-like experience to our users. The Home Assistant frontend needs to be fast. But it also needs to work on a wide range of old devices.
|
||||
|
||||
### Material Design
|
||||
|
||||
The Home Assistant interface is based on Material Design. It's a design system created by Google to quickly build high-quality digital experiences. Components and guidelines that are custom made for Home Assistant are documented on this portal. For all other components check <a href="https://material.io" rel="noopener noreferrer" target="_blank">material.io</a>.
|
||||
|
||||
## Designers
|
||||
|
||||
We want to make it as easy for designers to contribute as it is for developers. There’s a lot a designer can contribute to:
|
||||
|
||||
- Meet us at <a href="https://discord.gg/BPBc8rZ9" rel="noopener noreferrer" target="_blank">devs_ux Discord</a>. Feel free to share your designs, user test or strategic ideas.
|
||||
- Start designing with our <a href="https://www.figma.com/community/file/967153512097289521/Home-Assistant-DesignKit" rel="noopener noreferrer" target="_blank">Figma DesignKit</a>.
|
||||
- Find the lates UX <a href="https://github.com/home-assistant/frontend/discussions?discussions_q=label%3Aux" rel="noopener noreferrer" target="_blank">discussions</a> and <a href="https://github.com/home-assistant/frontend/labels/ux" rel="noopener noreferrer" target="_blank">issues</a> on GitHub. Everyone can start a new issue or discussion!
|
||||
|
||||
- Find the latest UX <a href="https://github.com/home-assistant/frontend/discussions?discussions_q=label%3Aux" rel="noopener noreferrer" target="_blank">discussions</a> and <a href="https://github.com/home-assistant/frontend/labels/ux" rel="noopener noreferrer" target="_blank">issues</a> on GitHub. Everyone can start a new issue or discussion!
|
||||
|
||||
## Developers
|
||||
|
||||
Everything you need to get started developing can be found in our <a href="https://developers.home-assistant.io" rel="noopener noreferrer" target="_blank">Home Assistant Developer Docs</a>.
|
||||
|
7
gallery/src/pages/date-time/date-time-numeric.markdown
Normal file
7
gallery/src/pages/date-time/date-time-numeric.markdown
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
title: Date-Time Format (Numeric)
|
||||
---
|
||||
|
||||
This pages lists all supported languages with their available date-time formats.
|
||||
|
||||
Formatting function: `const formatDateTimeNumeric: (dateObj: Date, locale: FrontendLocaleData) => string`
|
136
gallery/src/pages/date-time/date-time-numeric.ts
Normal file
136
gallery/src/pages/date-time/date-time-numeric.ts
Normal file
@@ -0,0 +1,136 @@
|
||||
import { html, css, LitElement } from "lit";
|
||||
import { customElement, state } from "lit/decorators";
|
||||
import "../../../../src/components/ha-card";
|
||||
import "../../../../src/components/ha-control-select";
|
||||
import { translationMetadata } from "../../../../src/resources/translations-metadata";
|
||||
import { formatDateTimeNumeric } from "../../../../src/common/datetime/format_date_time";
|
||||
import { timeOptions } from "../../data/date-options";
|
||||
import { demoConfig } from "../../../../src/fake_data/demo_config";
|
||||
import {
|
||||
FrontendLocaleData,
|
||||
NumberFormat,
|
||||
TimeFormat,
|
||||
DateFormat,
|
||||
FirstWeekday,
|
||||
TimeZone,
|
||||
} from "../../../../src/data/translation";
|
||||
|
||||
@customElement("demo-date-time-date-time-numeric")
|
||||
export class DemoDateTimeDateTimeNumeric extends LitElement {
|
||||
@state() private selection?: string = "now";
|
||||
|
||||
@state() private date: Date = new Date();
|
||||
|
||||
handleValueChanged(e: CustomEvent) {
|
||||
this.selection = e.detail.value as string;
|
||||
this.date = new Date();
|
||||
if (this.selection !== "now") {
|
||||
const [hours, minutes, seconds] = this.selection.split(":").map(Number);
|
||||
this.date.setHours(hours);
|
||||
this.date.setMinutes(minutes);
|
||||
this.date.setSeconds(seconds);
|
||||
}
|
||||
}
|
||||
|
||||
protected render() {
|
||||
const defaultLocale: FrontendLocaleData = {
|
||||
language: "en",
|
||||
number_format: NumberFormat.language,
|
||||
time_format: TimeFormat.language,
|
||||
date_format: DateFormat.language,
|
||||
first_weekday: FirstWeekday.language,
|
||||
time_zone: TimeZone.local,
|
||||
};
|
||||
return html`
|
||||
<ha-control-select
|
||||
.value=${this.selection}
|
||||
.options=${timeOptions}
|
||||
@value-changed=${this.handleValueChanged}
|
||||
>
|
||||
</ha-control-select>
|
||||
<mwc-list>
|
||||
<div class="container header">
|
||||
<div>Language</div>
|
||||
<div class="center">Default (lang)</div>
|
||||
<div class="center">12 Hours</div>
|
||||
<div class="center">24 Hours</div>
|
||||
</div>
|
||||
${Object.entries(translationMetadata.translations)
|
||||
.filter(([key, _]) => key !== "test")
|
||||
.map(
|
||||
([key, value]) => html`
|
||||
<div class="container">
|
||||
<div>${value.nativeName}</div>
|
||||
<div class="center">
|
||||
${formatDateTimeNumeric(
|
||||
this.date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
time_format: TimeFormat.language,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
<div class="center">
|
||||
${formatDateTimeNumeric(
|
||||
this.date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
time_format: TimeFormat.am_pm,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
<div class="center">
|
||||
${formatDateTimeNumeric(
|
||||
this.date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
time_format: TimeFormat.twenty_four,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
)}
|
||||
</mwc-list>
|
||||
`;
|
||||
}
|
||||
|
||||
static get styles() {
|
||||
return css`
|
||||
ha-control-select {
|
||||
max-width: 800px;
|
||||
margin: 12px auto;
|
||||
}
|
||||
.header {
|
||||
font-weight: bold;
|
||||
}
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
.container {
|
||||
max-width: 900px;
|
||||
margin: 12px auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
|
||||
.container > div {
|
||||
flex-grow: 1;
|
||||
width: 20%;
|
||||
}
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"demo-date-time-date-time-numeric": DemoDateTimeDateTimeNumeric;
|
||||
}
|
||||
}
|
7
gallery/src/pages/date-time/date-time-seconds.markdown
Normal file
7
gallery/src/pages/date-time/date-time-seconds.markdown
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
title: Date-Time Format (Seconds)
|
||||
---
|
||||
|
||||
This pages lists all supported languages with their available date-time formats.
|
||||
|
||||
Formatting function: `const formatDateTimeWithSeconds: (dateObj: Date, locale: FrontendLocaleData) => string`
|
136
gallery/src/pages/date-time/date-time-seconds.ts
Normal file
136
gallery/src/pages/date-time/date-time-seconds.ts
Normal file
@@ -0,0 +1,136 @@
|
||||
import { html, css, LitElement } from "lit";
|
||||
import { customElement, state } from "lit/decorators";
|
||||
import "../../../../src/components/ha-card";
|
||||
import "../../../../src/components/ha-control-select";
|
||||
import { translationMetadata } from "../../../../src/resources/translations-metadata";
|
||||
import { formatDateTimeWithSeconds } from "../../../../src/common/datetime/format_date_time";
|
||||
import { timeOptions } from "../../data/date-options";
|
||||
import { demoConfig } from "../../../../src/fake_data/demo_config";
|
||||
import {
|
||||
FrontendLocaleData,
|
||||
NumberFormat,
|
||||
TimeFormat,
|
||||
DateFormat,
|
||||
FirstWeekday,
|
||||
TimeZone,
|
||||
} from "../../../../src/data/translation";
|
||||
|
||||
@customElement("demo-date-time-date-time-seconds")
|
||||
export class DemoDateTimeDateTimeSeconds extends LitElement {
|
||||
@state() private selection?: string = "now";
|
||||
|
||||
@state() private date: Date = new Date();
|
||||
|
||||
handleValueChanged(e: CustomEvent) {
|
||||
this.selection = e.detail.value as string;
|
||||
this.date = new Date();
|
||||
if (this.selection !== "now") {
|
||||
const [hours, minutes, seconds] = this.selection.split(":").map(Number);
|
||||
this.date.setHours(hours);
|
||||
this.date.setMinutes(minutes);
|
||||
this.date.setSeconds(seconds);
|
||||
}
|
||||
}
|
||||
|
||||
protected render() {
|
||||
const defaultLocale: FrontendLocaleData = {
|
||||
language: "en",
|
||||
number_format: NumberFormat.language,
|
||||
time_format: TimeFormat.language,
|
||||
date_format: DateFormat.language,
|
||||
first_weekday: FirstWeekday.language,
|
||||
time_zone: TimeZone.local,
|
||||
};
|
||||
return html`
|
||||
<ha-control-select
|
||||
.value=${this.selection}
|
||||
.options=${timeOptions}
|
||||
@value-changed=${this.handleValueChanged}
|
||||
>
|
||||
</ha-control-select>
|
||||
<mwc-list>
|
||||
<div class="container header">
|
||||
<div>Language</div>
|
||||
<div class="center">Default (lang)</div>
|
||||
<div class="center">12 Hours</div>
|
||||
<div class="center">24 Hours</div>
|
||||
</div>
|
||||
${Object.entries(translationMetadata.translations)
|
||||
.filter(([key, _]) => key !== "test")
|
||||
.map(
|
||||
([key, value]) => html`
|
||||
<div class="container">
|
||||
<div>${value.nativeName}</div>
|
||||
<div class="center">
|
||||
${formatDateTimeWithSeconds(
|
||||
this.date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
time_format: TimeFormat.language,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
<div class="center">
|
||||
${formatDateTimeWithSeconds(
|
||||
this.date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
time_format: TimeFormat.am_pm,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
<div class="center">
|
||||
${formatDateTimeWithSeconds(
|
||||
this.date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
time_format: TimeFormat.twenty_four,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
)}
|
||||
</mwc-list>
|
||||
`;
|
||||
}
|
||||
|
||||
static get styles() {
|
||||
return css`
|
||||
ha-control-select {
|
||||
max-width: 800px;
|
||||
margin: 12px auto;
|
||||
}
|
||||
.header {
|
||||
font-weight: bold;
|
||||
}
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
.container {
|
||||
max-width: 900px;
|
||||
margin: 12px auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
|
||||
.container > div {
|
||||
flex-grow: 1;
|
||||
width: 20%;
|
||||
}
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"demo-date-time-date-time-seconds": DemoDateTimeDateTimeSeconds;
|
||||
}
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
---
|
||||
title: Date-Time Format (Short w/ Year)
|
||||
---
|
||||
|
||||
This pages lists all supported languages with their available date-time formats.
|
||||
|
||||
Formatting function: `const formatShortDateTimeWithYear: (dateObj: Date, locale: FrontendLocaleData) => string`
|
136
gallery/src/pages/date-time/date-time-short-year.ts
Normal file
136
gallery/src/pages/date-time/date-time-short-year.ts
Normal file
@@ -0,0 +1,136 @@
|
||||
import { html, css, LitElement } from "lit";
|
||||
import { customElement, state } from "lit/decorators";
|
||||
import "../../../../src/components/ha-card";
|
||||
import "../../../../src/components/ha-control-select";
|
||||
import { translationMetadata } from "../../../../src/resources/translations-metadata";
|
||||
import { formatShortDateTimeWithYear } from "../../../../src/common/datetime/format_date_time";
|
||||
import { timeOptions } from "../../data/date-options";
|
||||
import { demoConfig } from "../../../../src/fake_data/demo_config";
|
||||
import {
|
||||
FrontendLocaleData,
|
||||
NumberFormat,
|
||||
TimeFormat,
|
||||
DateFormat,
|
||||
FirstWeekday,
|
||||
TimeZone,
|
||||
} from "../../../../src/data/translation";
|
||||
|
||||
@customElement("demo-date-time-date-time-short-year")
|
||||
export class DemoDateTimeDateTimeShortYear extends LitElement {
|
||||
@state() private selection?: string = "now";
|
||||
|
||||
@state() private date: Date = new Date();
|
||||
|
||||
handleValueChanged(e: CustomEvent) {
|
||||
this.selection = e.detail.value as string;
|
||||
this.date = new Date();
|
||||
if (this.selection !== "now") {
|
||||
const [hours, minutes, seconds] = this.selection.split(":").map(Number);
|
||||
this.date.setHours(hours);
|
||||
this.date.setMinutes(minutes);
|
||||
this.date.setSeconds(seconds);
|
||||
}
|
||||
}
|
||||
|
||||
protected render() {
|
||||
const defaultLocale: FrontendLocaleData = {
|
||||
language: "en",
|
||||
number_format: NumberFormat.language,
|
||||
time_format: TimeFormat.language,
|
||||
date_format: DateFormat.language,
|
||||
first_weekday: FirstWeekday.language,
|
||||
time_zone: TimeZone.local,
|
||||
};
|
||||
return html`
|
||||
<ha-control-select
|
||||
.value=${this.selection}
|
||||
.options=${timeOptions}
|
||||
@value-changed=${this.handleValueChanged}
|
||||
>
|
||||
</ha-control-select>
|
||||
<mwc-list>
|
||||
<div class="container header">
|
||||
<div>Language</div>
|
||||
<div class="center">Default (lang)</div>
|
||||
<div class="center">12 Hours</div>
|
||||
<div class="center">24 Hours</div>
|
||||
</div>
|
||||
${Object.entries(translationMetadata.translations)
|
||||
.filter(([key, _]) => key !== "test")
|
||||
.map(
|
||||
([key, value]) => html`
|
||||
<div class="container">
|
||||
<div>${value.nativeName}</div>
|
||||
<div class="center">
|
||||
${formatShortDateTimeWithYear(
|
||||
this.date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
time_format: TimeFormat.language,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
<div class="center">
|
||||
${formatShortDateTimeWithYear(
|
||||
this.date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
time_format: TimeFormat.am_pm,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
<div class="center">
|
||||
${formatShortDateTimeWithYear(
|
||||
this.date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
time_format: TimeFormat.twenty_four,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
)}
|
||||
</mwc-list>
|
||||
`;
|
||||
}
|
||||
|
||||
static get styles() {
|
||||
return css`
|
||||
ha-control-select {
|
||||
max-width: 800px;
|
||||
margin: 12px auto;
|
||||
}
|
||||
.header {
|
||||
font-weight: bold;
|
||||
}
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
.container {
|
||||
max-width: 900px;
|
||||
margin: 12px auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
|
||||
.container > div {
|
||||
flex-grow: 1;
|
||||
width: 20%;
|
||||
}
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"demo-date-time-date-time-short-year": DemoDateTimeDateTimeShortYear;
|
||||
}
|
||||
}
|
7
gallery/src/pages/date-time/date-time-short.markdown
Normal file
7
gallery/src/pages/date-time/date-time-short.markdown
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
title: Date-Time Format (Short)
|
||||
---
|
||||
|
||||
This pages lists all supported languages with their available date-time formats.
|
||||
|
||||
Formatting function: `const formatShortDateTime: (dateObj: Date, locale: FrontendLocaleData) => string`
|
136
gallery/src/pages/date-time/date-time-short.ts
Normal file
136
gallery/src/pages/date-time/date-time-short.ts
Normal file
@@ -0,0 +1,136 @@
|
||||
import { html, css, LitElement } from "lit";
|
||||
import { customElement, state } from "lit/decorators";
|
||||
import "../../../../src/components/ha-card";
|
||||
import "../../../../src/components/ha-control-select";
|
||||
import { translationMetadata } from "../../../../src/resources/translations-metadata";
|
||||
import { formatShortDateTime } from "../../../../src/common/datetime/format_date_time";
|
||||
import { timeOptions } from "../../data/date-options";
|
||||
import { demoConfig } from "../../../../src/fake_data/demo_config";
|
||||
import {
|
||||
FrontendLocaleData,
|
||||
NumberFormat,
|
||||
TimeFormat,
|
||||
DateFormat,
|
||||
FirstWeekday,
|
||||
TimeZone,
|
||||
} from "../../../../src/data/translation";
|
||||
|
||||
@customElement("demo-date-time-date-time-short")
|
||||
export class DemoDateTimeDateTimeShort extends LitElement {
|
||||
@state() private selection?: string = "now";
|
||||
|
||||
@state() private date: Date = new Date();
|
||||
|
||||
handleValueChanged(e: CustomEvent) {
|
||||
this.selection = e.detail.value as string;
|
||||
this.date = new Date();
|
||||
if (this.selection !== "now") {
|
||||
const [hours, minutes, seconds] = this.selection.split(":").map(Number);
|
||||
this.date.setHours(hours);
|
||||
this.date.setMinutes(minutes);
|
||||
this.date.setSeconds(seconds);
|
||||
}
|
||||
}
|
||||
|
||||
protected render() {
|
||||
const defaultLocale: FrontendLocaleData = {
|
||||
language: "en",
|
||||
number_format: NumberFormat.language,
|
||||
time_format: TimeFormat.language,
|
||||
date_format: DateFormat.language,
|
||||
first_weekday: FirstWeekday.language,
|
||||
time_zone: TimeZone.local,
|
||||
};
|
||||
return html`
|
||||
<ha-control-select
|
||||
.value=${this.selection}
|
||||
.options=${timeOptions}
|
||||
@value-changed=${this.handleValueChanged}
|
||||
>
|
||||
</ha-control-select>
|
||||
<mwc-list>
|
||||
<div class="container header">
|
||||
<div>Language</div>
|
||||
<div class="center">Default (lang)</div>
|
||||
<div class="center">12 Hours</div>
|
||||
<div class="center">24 Hours</div>
|
||||
</div>
|
||||
${Object.entries(translationMetadata.translations)
|
||||
.filter(([key, _]) => key !== "test")
|
||||
.map(
|
||||
([key, value]) => html`
|
||||
<div class="container">
|
||||
<div>${value.nativeName}</div>
|
||||
<div class="center">
|
||||
${formatShortDateTime(
|
||||
this.date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
time_format: TimeFormat.language,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
<div class="center">
|
||||
${formatShortDateTime(
|
||||
this.date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
time_format: TimeFormat.am_pm,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
<div class="center">
|
||||
${formatShortDateTime(
|
||||
this.date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
time_format: TimeFormat.twenty_four,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
)}
|
||||
</mwc-list>
|
||||
`;
|
||||
}
|
||||
|
||||
static get styles() {
|
||||
return css`
|
||||
ha-control-select {
|
||||
max-width: 800px;
|
||||
margin: 12px auto;
|
||||
}
|
||||
.header {
|
||||
font-weight: bold;
|
||||
}
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
.container {
|
||||
max-width: 900px;
|
||||
margin: 12px auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
|
||||
.container > div {
|
||||
flex-grow: 1;
|
||||
width: 20%;
|
||||
}
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"demo-date-time-date-time-short": DemoDateTimeDateTimeShort;
|
||||
}
|
||||
}
|
7
gallery/src/pages/date-time/date-time.markdown
Normal file
7
gallery/src/pages/date-time/date-time.markdown
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
title: Date-Time Format
|
||||
---
|
||||
|
||||
This pages lists all supported languages with their available date-time formats.
|
||||
|
||||
Formatting function: `const formatDateTime: (dateObj: Date, locale: FrontendLocaleData) => string`
|
136
gallery/src/pages/date-time/date-time.ts
Normal file
136
gallery/src/pages/date-time/date-time.ts
Normal file
@@ -0,0 +1,136 @@
|
||||
import { html, css, LitElement } from "lit";
|
||||
import { customElement, state } from "lit/decorators";
|
||||
import "../../../../src/components/ha-card";
|
||||
import "../../../../src/components/ha-control-select";
|
||||
import { translationMetadata } from "../../../../src/resources/translations-metadata";
|
||||
import { formatDateTime } from "../../../../src/common/datetime/format_date_time";
|
||||
import { timeOptions } from "../../data/date-options";
|
||||
import { demoConfig } from "../../../../src/fake_data/demo_config";
|
||||
import {
|
||||
FrontendLocaleData,
|
||||
NumberFormat,
|
||||
TimeFormat,
|
||||
DateFormat,
|
||||
FirstWeekday,
|
||||
TimeZone,
|
||||
} from "../../../../src/data/translation";
|
||||
|
||||
@customElement("demo-date-time-date-time")
|
||||
export class DemoDateTimeDateTime extends LitElement {
|
||||
@state() private selection?: string = "now";
|
||||
|
||||
@state() private date: Date = new Date();
|
||||
|
||||
handleValueChanged(e: CustomEvent) {
|
||||
this.selection = e.detail.value as string;
|
||||
this.date = new Date();
|
||||
if (this.selection !== "now") {
|
||||
const [hours, minutes, seconds] = this.selection.split(":").map(Number);
|
||||
this.date.setHours(hours);
|
||||
this.date.setMinutes(minutes);
|
||||
this.date.setSeconds(seconds);
|
||||
}
|
||||
}
|
||||
|
||||
protected render() {
|
||||
const defaultLocale: FrontendLocaleData = {
|
||||
language: "en",
|
||||
number_format: NumberFormat.language,
|
||||
time_format: TimeFormat.language,
|
||||
date_format: DateFormat.language,
|
||||
first_weekday: FirstWeekday.language,
|
||||
time_zone: TimeZone.local,
|
||||
};
|
||||
return html`
|
||||
<ha-control-select
|
||||
.value=${this.selection}
|
||||
.options=${timeOptions}
|
||||
@value-changed=${this.handleValueChanged}
|
||||
>
|
||||
</ha-control-select>
|
||||
<mwc-list>
|
||||
<div class="container header">
|
||||
<div>Language</div>
|
||||
<div class="center">Default (lang)</div>
|
||||
<div class="center">12 Hours</div>
|
||||
<div class="center">24 Hours</div>
|
||||
</div>
|
||||
${Object.entries(translationMetadata.translations)
|
||||
.filter(([key, _]) => key !== "test")
|
||||
.map(
|
||||
([key, value]) => html`
|
||||
<div class="container">
|
||||
<div>${value.nativeName}</div>
|
||||
<div class="center">
|
||||
${formatDateTime(
|
||||
this.date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
time_format: TimeFormat.language,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
<div class="center">
|
||||
${formatDateTime(
|
||||
this.date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
time_format: TimeFormat.am_pm,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
<div class="center">
|
||||
${formatDateTime(
|
||||
this.date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
time_format: TimeFormat.twenty_four,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
)}
|
||||
</mwc-list>
|
||||
`;
|
||||
}
|
||||
|
||||
static get styles() {
|
||||
return css`
|
||||
ha-control-select {
|
||||
max-width: 800px;
|
||||
margin: 12px auto;
|
||||
}
|
||||
.header {
|
||||
font-weight: bold;
|
||||
}
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
.container {
|
||||
max-width: 900px;
|
||||
margin: 12px auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
|
||||
.container > div {
|
||||
flex-grow: 1;
|
||||
width: 20%;
|
||||
}
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"demo-date-time-date-time": DemoDateTimeDateTime;
|
||||
}
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
---
|
||||
title: (Numeric) Date Formatting
|
||||
title: Date Format (Numeric)
|
||||
---
|
||||
|
||||
This pages lists all supported languages with their available (numeric) date formats.
|
||||
|
||||
Formatting function: `const formatDateNumeric: (dateObj: Date, locale: FrontendLocaleData) => string`
|
||||
Formatting function: `const formatDateNumeric: (dateObj: Date, locale: FrontendLocaleData) => string`
|
||||
|
@@ -1,27 +1,28 @@
|
||||
import { html, css, LitElement } from "lit";
|
||||
import { customElement, property } from "lit/decorators";
|
||||
import "../../../../src/components/ha-card";
|
||||
import { HomeAssistant } from "../../../../src/types";
|
||||
import { translationMetadata } from "../../../../src/resources/translations-metadata";
|
||||
import "@material/mwc-list/mwc-list";
|
||||
import { css, html, LitElement } from "lit";
|
||||
import { customElement } from "lit/decorators";
|
||||
import { formatDateNumeric } from "../../../../src/common/datetime/format_date";
|
||||
import "../../../../src/components/ha-card";
|
||||
import {
|
||||
DateFormat,
|
||||
FirstWeekday,
|
||||
FrontendLocaleData,
|
||||
NumberFormat,
|
||||
TimeFormat,
|
||||
DateFormat,
|
||||
FirstWeekday,
|
||||
TimeZone,
|
||||
} from "../../../../src/data/translation";
|
||||
import { demoConfig } from "../../../../src/fake_data/demo_config";
|
||||
import { translationMetadata } from "../../../../src/resources/translations-metadata";
|
||||
|
||||
@customElement("demo-date-time-date")
|
||||
export class DemoDateTimeDate extends LitElement {
|
||||
@property({ attribute: false }) hass!: HomeAssistant;
|
||||
|
||||
protected render() {
|
||||
const defaultLocale: FrontendLocaleData = {
|
||||
language: "en",
|
||||
number_format: NumberFormat.language,
|
||||
time_format: TimeFormat.language,
|
||||
date_format: DateFormat.language,
|
||||
time_zone: TimeZone.local,
|
||||
first_weekday: FirstWeekday.language,
|
||||
};
|
||||
const date = new Date();
|
||||
@@ -41,32 +42,48 @@ export class DemoDateTimeDate extends LitElement {
|
||||
<div class="container">
|
||||
<div>${value.nativeName}</div>
|
||||
<div class="center">
|
||||
${formatDateNumeric(date, {
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
date_format: DateFormat.language,
|
||||
})}
|
||||
${formatDateNumeric(
|
||||
date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
date_format: DateFormat.language,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
<div class="center">
|
||||
${formatDateNumeric(date, {
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
date_format: DateFormat.DMY,
|
||||
})}
|
||||
${formatDateNumeric(
|
||||
date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
date_format: DateFormat.DMY,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
<div class="center">
|
||||
${formatDateNumeric(date, {
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
date_format: DateFormat.MDY,
|
||||
})}
|
||||
${formatDateNumeric(
|
||||
date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
date_format: DateFormat.MDY,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
<div class="center">
|
||||
${formatDateNumeric(date, {
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
date_format: DateFormat.YMD,
|
||||
})}
|
||||
${formatDateNumeric(
|
||||
date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
date_format: DateFormat.YMD,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
|
7
gallery/src/pages/date-time/time-seconds.markdown
Normal file
7
gallery/src/pages/date-time/time-seconds.markdown
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
title: Time Format (Seconds)
|
||||
---
|
||||
|
||||
This pages lists all supported languages with their available time formats.
|
||||
|
||||
Formatting function: `const formatTimeWithSeconds: (dateObj: Date, locale: FrontendLocaleData) => string`
|
135
gallery/src/pages/date-time/time-seconds.ts
Normal file
135
gallery/src/pages/date-time/time-seconds.ts
Normal file
@@ -0,0 +1,135 @@
|
||||
import { html, css, LitElement } from "lit";
|
||||
import { customElement, state } from "lit/decorators";
|
||||
import "../../../../src/components/ha-card";
|
||||
import { translationMetadata } from "../../../../src/resources/translations-metadata";
|
||||
import { formatTimeWithSeconds } from "../../../../src/common/datetime/format_time";
|
||||
import { timeOptions } from "../../data/date-options";
|
||||
import { demoConfig } from "../../../../src/fake_data/demo_config";
|
||||
import {
|
||||
FrontendLocaleData,
|
||||
NumberFormat,
|
||||
TimeFormat,
|
||||
DateFormat,
|
||||
FirstWeekday,
|
||||
TimeZone,
|
||||
} from "../../../../src/data/translation";
|
||||
|
||||
@customElement("demo-date-time-time-seconds")
|
||||
export class DemoDateTimeTimeSeconds extends LitElement {
|
||||
@state() private selection?: string = "now";
|
||||
|
||||
@state() private date: Date = new Date();
|
||||
|
||||
handleValueChanged(e: CustomEvent) {
|
||||
this.selection = e.detail.value as string;
|
||||
this.date = new Date();
|
||||
if (this.selection !== "now") {
|
||||
const [hours, minutes, seconds] = this.selection.split(":").map(Number);
|
||||
this.date.setHours(hours);
|
||||
this.date.setMinutes(minutes);
|
||||
this.date.setSeconds(seconds);
|
||||
}
|
||||
}
|
||||
|
||||
protected render() {
|
||||
const defaultLocale: FrontendLocaleData = {
|
||||
language: "en",
|
||||
number_format: NumberFormat.language,
|
||||
time_format: TimeFormat.language,
|
||||
date_format: DateFormat.language,
|
||||
first_weekday: FirstWeekday.language,
|
||||
time_zone: TimeZone.local,
|
||||
};
|
||||
return html`
|
||||
<ha-control-select
|
||||
.value=${this.selection}
|
||||
.options=${timeOptions}
|
||||
@value-changed=${this.handleValueChanged}
|
||||
>
|
||||
</ha-control-select>
|
||||
<mwc-list>
|
||||
<div class="container header">
|
||||
<div>Language</div>
|
||||
<div class="center">Default (lang)</div>
|
||||
<div class="center">12 Hours</div>
|
||||
<div class="center">24 Hours</div>
|
||||
</div>
|
||||
${Object.entries(translationMetadata.translations)
|
||||
.filter(([key, _]) => key !== "test")
|
||||
.map(
|
||||
([key, value]) => html`
|
||||
<div class="container">
|
||||
<div>${value.nativeName}</div>
|
||||
<div class="center">
|
||||
${formatTimeWithSeconds(
|
||||
this.date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
time_format: TimeFormat.language,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
<div class="center">
|
||||
${formatTimeWithSeconds(
|
||||
this.date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
time_format: TimeFormat.am_pm,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
<div class="center">
|
||||
${formatTimeWithSeconds(
|
||||
this.date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
time_format: TimeFormat.twenty_four,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
)}
|
||||
</mwc-list>
|
||||
`;
|
||||
}
|
||||
|
||||
static get styles() {
|
||||
return css`
|
||||
ha-control-select {
|
||||
max-width: 800px;
|
||||
margin: 12px auto;
|
||||
}
|
||||
.header {
|
||||
font-weight: bold;
|
||||
}
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
.container {
|
||||
max-width: 600px;
|
||||
margin: 12px auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
|
||||
.container > div {
|
||||
flex-grow: 1;
|
||||
width: 20%;
|
||||
}
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"demo-date-time-time-seconds": DemoDateTimeTimeSeconds;
|
||||
}
|
||||
}
|
7
gallery/src/pages/date-time/time-weekday.markdown
Normal file
7
gallery/src/pages/date-time/time-weekday.markdown
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
title: Time Format (Weekday)
|
||||
---
|
||||
|
||||
This pages lists all supported languages with their available time formats.
|
||||
|
||||
Formatting function: `const formatTimeWeekday: (dateObj: Date, locale: FrontendLocaleData) => string`
|
135
gallery/src/pages/date-time/time-weekday.ts
Normal file
135
gallery/src/pages/date-time/time-weekday.ts
Normal file
@@ -0,0 +1,135 @@
|
||||
import { html, css, LitElement } from "lit";
|
||||
import { customElement, state } from "lit/decorators";
|
||||
import "../../../../src/components/ha-card";
|
||||
import { translationMetadata } from "../../../../src/resources/translations-metadata";
|
||||
import { formatTimeWeekday } from "../../../../src/common/datetime/format_time";
|
||||
import { timeOptions } from "../../data/date-options";
|
||||
import { demoConfig } from "../../../../src/fake_data/demo_config";
|
||||
import {
|
||||
FrontendLocaleData,
|
||||
NumberFormat,
|
||||
TimeFormat,
|
||||
DateFormat,
|
||||
FirstWeekday,
|
||||
TimeZone,
|
||||
} from "../../../../src/data/translation";
|
||||
|
||||
@customElement("demo-date-time-time-weekday")
|
||||
export class DemoDateTimeTimeWeekday extends LitElement {
|
||||
@state() private selection?: string = "now";
|
||||
|
||||
@state() private date: Date = new Date();
|
||||
|
||||
handleValueChanged(e: CustomEvent) {
|
||||
this.selection = e.detail.value as string;
|
||||
this.date = new Date();
|
||||
if (this.selection !== "now") {
|
||||
const [hours, minutes, seconds] = this.selection.split(":").map(Number);
|
||||
this.date.setHours(hours);
|
||||
this.date.setMinutes(minutes);
|
||||
this.date.setSeconds(seconds);
|
||||
}
|
||||
}
|
||||
|
||||
protected render() {
|
||||
const defaultLocale: FrontendLocaleData = {
|
||||
language: "en",
|
||||
number_format: NumberFormat.language,
|
||||
time_format: TimeFormat.language,
|
||||
date_format: DateFormat.language,
|
||||
first_weekday: FirstWeekday.language,
|
||||
time_zone: TimeZone.local,
|
||||
};
|
||||
return html`
|
||||
<ha-control-select
|
||||
.value=${this.selection}
|
||||
.options=${timeOptions}
|
||||
@value-changed=${this.handleValueChanged}
|
||||
>
|
||||
</ha-control-select>
|
||||
<mwc-list>
|
||||
<div class="container header">
|
||||
<div>Language</div>
|
||||
<div class="center">Default (lang)</div>
|
||||
<div class="center">12 Hours</div>
|
||||
<div class="center">24 Hours</div>
|
||||
</div>
|
||||
${Object.entries(translationMetadata.translations)
|
||||
.filter(([key, _]) => key !== "test")
|
||||
.map(
|
||||
([key, value]) => html`
|
||||
<div class="container">
|
||||
<div>${value.nativeName}</div>
|
||||
<div class="center">
|
||||
${formatTimeWeekday(
|
||||
this.date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
time_format: TimeFormat.language,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
<div class="center">
|
||||
${formatTimeWeekday(
|
||||
this.date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
time_format: TimeFormat.am_pm,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
<div class="center">
|
||||
${formatTimeWeekday(
|
||||
this.date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
time_format: TimeFormat.twenty_four,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
)}
|
||||
</mwc-list>
|
||||
`;
|
||||
}
|
||||
|
||||
static get styles() {
|
||||
return css`
|
||||
ha-control-select {
|
||||
max-width: 800px;
|
||||
margin: 12px auto;
|
||||
}
|
||||
.header {
|
||||
font-weight: bold;
|
||||
}
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
.container {
|
||||
max-width: 800px;
|
||||
margin: 12px auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
|
||||
.container > div {
|
||||
flex-grow: 1;
|
||||
width: 20%;
|
||||
}
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"demo-date-time-time-weekday": DemoDateTimeTimeWeekday;
|
||||
}
|
||||
}
|
7
gallery/src/pages/date-time/time.markdown
Normal file
7
gallery/src/pages/date-time/time.markdown
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
title: Time Format
|
||||
---
|
||||
|
||||
This pages lists all supported languages with their available time formats.
|
||||
|
||||
Formatting function: `const formatTime: (dateObj: Date, locale: FrontendLocaleData) => string`
|
136
gallery/src/pages/date-time/time.ts
Normal file
136
gallery/src/pages/date-time/time.ts
Normal file
@@ -0,0 +1,136 @@
|
||||
import { html, css, LitElement } from "lit";
|
||||
import { customElement, state } from "lit/decorators";
|
||||
import "../../../../src/components/ha-card";
|
||||
import "../../../../src/components/ha-control-select";
|
||||
import { translationMetadata } from "../../../../src/resources/translations-metadata";
|
||||
import { formatTime } from "../../../../src/common/datetime/format_time";
|
||||
import { timeOptions } from "../../data/date-options";
|
||||
import { demoConfig } from "../../../../src/fake_data/demo_config";
|
||||
import {
|
||||
FrontendLocaleData,
|
||||
NumberFormat,
|
||||
TimeFormat,
|
||||
DateFormat,
|
||||
FirstWeekday,
|
||||
TimeZone,
|
||||
} from "../../../../src/data/translation";
|
||||
|
||||
@customElement("demo-date-time-time")
|
||||
export class DemoDateTimeTime extends LitElement {
|
||||
@state() private selection?: string = "now";
|
||||
|
||||
@state() private date: Date = new Date();
|
||||
|
||||
handleValueChanged(e: CustomEvent) {
|
||||
this.selection = e.detail.value as string;
|
||||
this.date = new Date();
|
||||
if (this.selection !== "now") {
|
||||
const [hours, minutes, seconds] = this.selection.split(":").map(Number);
|
||||
this.date.setHours(hours);
|
||||
this.date.setMinutes(minutes);
|
||||
this.date.setSeconds(seconds);
|
||||
}
|
||||
}
|
||||
|
||||
protected render() {
|
||||
const defaultLocale: FrontendLocaleData = {
|
||||
language: "en",
|
||||
number_format: NumberFormat.language,
|
||||
time_format: TimeFormat.language,
|
||||
date_format: DateFormat.language,
|
||||
first_weekday: FirstWeekday.language,
|
||||
time_zone: TimeZone.local,
|
||||
};
|
||||
return html`
|
||||
<ha-control-select
|
||||
.value=${this.selection}
|
||||
.options=${timeOptions}
|
||||
@value-changed=${this.handleValueChanged}
|
||||
>
|
||||
</ha-control-select>
|
||||
<mwc-list>
|
||||
<div class="container header">
|
||||
<div>Language</div>
|
||||
<div class="center">Default (lang)</div>
|
||||
<div class="center">12 Hours</div>
|
||||
<div class="center">24 Hours</div>
|
||||
</div>
|
||||
${Object.entries(translationMetadata.translations)
|
||||
.filter(([key, _]) => key !== "test")
|
||||
.map(
|
||||
([key, value]) => html`
|
||||
<div class="container">
|
||||
<div>${value.nativeName}</div>
|
||||
<div class="center">
|
||||
${formatTime(
|
||||
this.date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
time_format: TimeFormat.language,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
<div class="center">
|
||||
${formatTime(
|
||||
this.date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
time_format: TimeFormat.am_pm,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
<div class="center">
|
||||
${formatTime(
|
||||
this.date,
|
||||
{
|
||||
...defaultLocale,
|
||||
language: key,
|
||||
time_format: TimeFormat.twenty_four,
|
||||
},
|
||||
demoConfig
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
`
|
||||
)}
|
||||
</mwc-list>
|
||||
`;
|
||||
}
|
||||
|
||||
static get styles() {
|
||||
return css`
|
||||
ha-control-select {
|
||||
max-width: 800px;
|
||||
margin: 12px auto;
|
||||
}
|
||||
.header {
|
||||
font-weight: bold;
|
||||
}
|
||||
.center {
|
||||
text-align: center;
|
||||
}
|
||||
.container {
|
||||
max-width: 600px;
|
||||
margin: 12px auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-evenly;
|
||||
}
|
||||
|
||||
.container > div {
|
||||
flex-grow: 1;
|
||||
width: 20%;
|
||||
}
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"demo-date-time-time": DemoDateTimeTime;
|
||||
}
|
||||
}
|
@@ -135,6 +135,14 @@ const ENTITIES = [
|
||||
getEntity("text", "unavailable", "unavailable", {
|
||||
friendly_name: "Message",
|
||||
}),
|
||||
getEntity("event", "unavailable", "unavailable", {
|
||||
friendly_name: "Empty remote",
|
||||
}),
|
||||
getEntity("event", "doorbell", "2023-07-17T21:26:11.615+00:00", {
|
||||
friendly_name: "Doorbell",
|
||||
device_class: "doorbell",
|
||||
event_type: "Ding-Dong",
|
||||
}),
|
||||
];
|
||||
|
||||
const CONFIGS = [
|
||||
@@ -154,6 +162,7 @@ const CONFIGS = [
|
||||
- input_number.number
|
||||
- sensor.humidity
|
||||
- text.message
|
||||
- event.doorbell
|
||||
`,
|
||||
},
|
||||
{
|
||||
@@ -246,6 +255,7 @@ const CONFIGS = [
|
||||
- input_number.unavailable
|
||||
- input_select.unavailable
|
||||
- text.unavailable
|
||||
- event.unavailable
|
||||
`,
|
||||
},
|
||||
{
|
||||
|
@@ -1,6 +1,7 @@
|
||||
---
|
||||
title: Introduction
|
||||
---
|
||||
|
||||
Dashboards have many different cards. Each card allows the user to tell
|
||||
a different story about what is going on in their house. These cards
|
||||
are very customizable, as no household is the same.
|
||||
|
@@ -9,7 +9,7 @@ const CONFIGS = [
|
||||
heading: "markdown-it demo",
|
||||
config: `
|
||||
- type: markdown
|
||||
content: >-
|
||||
content: |
|
||||
# h1 Heading 8-)
|
||||
|
||||
## h2 Heading
|
||||
@@ -65,6 +65,15 @@ const CONFIGS = [
|
||||
>> ...by using additional greater-than signs right next to each other...
|
||||
> > > ...or with spaces between arrows.
|
||||
|
||||
> **Warning** Hey there
|
||||
> This is a warning with a title
|
||||
|
||||
> **Note**
|
||||
> This is a note
|
||||
|
||||
> **Note**
|
||||
> This is a multiline note
|
||||
> Lorem ipsum...
|
||||
|
||||
## Lists
|
||||
|
||||
|
@@ -14,7 +14,7 @@ const ENTITIES = [
|
||||
}),
|
||||
getEntity("light", "bed_light", "on", {
|
||||
friendly_name: "Bed Light",
|
||||
supported_color_modes: [LightColorMode.HS],
|
||||
supported_color_modes: [LightColorMode.HS, LightColorMode.COLOR_TEMP],
|
||||
}),
|
||||
getEntity("light", "unavailable", "unavailable", {
|
||||
friendly_name: "Unavailable entity",
|
||||
@@ -116,6 +116,15 @@ const CONFIGS = [
|
||||
- type: "light-brightness"
|
||||
`,
|
||||
},
|
||||
{
|
||||
heading: "Light color temperature feature",
|
||||
config: `
|
||||
- type: tile
|
||||
entity: light.bed_light
|
||||
features:
|
||||
- type: "color-temp"
|
||||
`,
|
||||
},
|
||||
{
|
||||
heading: "Vacuum commands feature",
|
||||
config: `
|
||||
|
@@ -35,6 +35,7 @@ const SENSOR_DEVICE_CLASSES = [
|
||||
"nitrogen_monoxide",
|
||||
"nitrous_oxide",
|
||||
"ozone",
|
||||
"ph",
|
||||
"pm1",
|
||||
"pm10",
|
||||
"pm25",
|
||||
@@ -135,6 +136,9 @@ const ENTITIES: HassEntity[] = [
|
||||
createEntity("climate.fan_only", "fan_only"),
|
||||
createEntity("climate.auto_idle", "auto", undefined, { hvac_action: "idle" }),
|
||||
createEntity("climate.auto_off", "auto", undefined, { hvac_action: "off" }),
|
||||
createEntity("climate.auto_preheating", "auto", undefined, {
|
||||
hvac_action: "preheating",
|
||||
}),
|
||||
createEntity("climate.auto_heating", "auto", undefined, {
|
||||
hvac_action: "heating",
|
||||
}),
|
||||
@@ -280,6 +284,13 @@ const ENTITIES: HassEntity[] = [
|
||||
installed_version: "1.0.0",
|
||||
latest_version: "2.0.0",
|
||||
}),
|
||||
createEntity("water_heater.off", "off"),
|
||||
createEntity("water_heater.eco", "eco"),
|
||||
createEntity("water_heater.electric", "electric"),
|
||||
createEntity("water_heater.performance", "performance"),
|
||||
createEntity("water_heater.high_demand", "high_demand"),
|
||||
createEntity("water_heater.heat_pump", "heat_pump"),
|
||||
createEntity("water_heater.gas", "gas"),
|
||||
];
|
||||
|
||||
function createEntity(
|
||||
@@ -354,6 +365,7 @@ export class DemoEntityState extends LitElement {
|
||||
hass.localize,
|
||||
entry.stateObj,
|
||||
hass.locale,
|
||||
hass.config,
|
||||
hass.entities
|
||||
)}`,
|
||||
},
|
||||
|
@@ -265,6 +265,8 @@ export class DemoIntegrationCard extends LitElement {
|
||||
></ha-config-flow-card>
|
||||
`
|
||||
)}
|
||||
</div>
|
||||
<div class="container">
|
||||
${configEntries.map(
|
||||
(info) => html`
|
||||
<ha-integration-card
|
||||
@@ -338,10 +340,10 @@ export class DemoIntegrationCard extends LitElement {
|
||||
return css`
|
||||
.container {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
||||
grid-gap: 16px 16px;
|
||||
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||
grid-gap: 8px 8px;
|
||||
padding: 8px 16px 16px;
|
||||
margin-bottom: 64px;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.container > * {
|
||||
|
3
gallery/src/pages/more-info/climate.markdown
Normal file
3
gallery/src/pages/more-info/climate.markdown
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
title: Climate
|
||||
---
|
105
gallery/src/pages/more-info/climate.ts
Normal file
105
gallery/src/pages/more-info/climate.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
import { html, LitElement, PropertyValues, TemplateResult } from "lit";
|
||||
import { customElement, property, query } from "lit/decorators";
|
||||
import "../../../../src/components/ha-card";
|
||||
import "../../../../src/dialogs/more-info/more-info-content";
|
||||
import { getEntity } from "../../../../src/fake_data/entity";
|
||||
import {
|
||||
MockHomeAssistant,
|
||||
provideHass,
|
||||
} from "../../../../src/fake_data/provide_hass";
|
||||
import "../../components/demo-more-infos";
|
||||
import { ClimateEntityFeature } from "../../../../src/data/climate";
|
||||
|
||||
const ENTITIES = [
|
||||
getEntity("climate", "thermostat", "heat", {
|
||||
friendly_name: "Basic heater",
|
||||
hvac_modes: ["heat", "off"],
|
||||
hvac_mode: "heat",
|
||||
current_temperature: 18,
|
||||
temperature: 20,
|
||||
min_temp: 10,
|
||||
max_temp: 30,
|
||||
supported_features: ClimateEntityFeature.TARGET_TEMPERATURE,
|
||||
}),
|
||||
getEntity("climate", "ac", "cool", {
|
||||
friendly_name: "Basic air conditioning",
|
||||
hvac_modes: ["cool", "off"],
|
||||
hvac_mode: "cool",
|
||||
current_temperature: 18,
|
||||
temperature: 20,
|
||||
min_temp: 10,
|
||||
max_temp: 30,
|
||||
supported_features: ClimateEntityFeature.TARGET_TEMPERATURE,
|
||||
}),
|
||||
getEntity("climate", "hvac", "auto", {
|
||||
friendly_name: "Basic hvac",
|
||||
hvac_modes: ["auto", "off"],
|
||||
hvac_mode: "auto",
|
||||
current_temperature: 18,
|
||||
min_temp: 10,
|
||||
max_temp: 30,
|
||||
target_temp_step: 1,
|
||||
supported_features: ClimateEntityFeature.TARGET_TEMPERATURE_RANGE,
|
||||
target_temp_low: 20,
|
||||
target_temp_high: 25,
|
||||
}),
|
||||
getEntity("climate", "advanced", "auto", {
|
||||
friendly_name: "Advanced hvac",
|
||||
supported_features:
|
||||
// eslint-disable-next-line no-bitwise
|
||||
ClimateEntityFeature.TARGET_TEMPERATURE_RANGE |
|
||||
ClimateEntityFeature.TARGET_HUMIDITY |
|
||||
ClimateEntityFeature.PRESET_MODE,
|
||||
hvac_modes: ["auto", "off"],
|
||||
hvac_mode: "auto",
|
||||
preset_modes: ["eco", "comfort", "boost"],
|
||||
preset_mode: "eco",
|
||||
current_temperature: 18,
|
||||
min_temp: 10,
|
||||
max_temp: 30,
|
||||
target_temp_step: 1,
|
||||
target_temp_low: 20,
|
||||
target_temp_high: 25,
|
||||
current_humidity: 40,
|
||||
min_humidity: 0,
|
||||
max_humidity: 100,
|
||||
humidity: 50,
|
||||
}),
|
||||
getEntity("climate", "unavailable", "unavailable", {
|
||||
friendly_name: "Unavailable heater",
|
||||
hvac_modes: ["heat", "off"],
|
||||
hvac_mode: "heat",
|
||||
min_temp: 10,
|
||||
max_temp: 30,
|
||||
supported_features: ClimateEntityFeature.TARGET_TEMPERATURE,
|
||||
}),
|
||||
];
|
||||
|
||||
@customElement("demo-more-info-climate")
|
||||
class DemoMoreInfoClimate extends LitElement {
|
||||
@property() public hass!: MockHomeAssistant;
|
||||
|
||||
@query("demo-more-infos") private _demoRoot!: HTMLElement;
|
||||
|
||||
protected render(): TemplateResult {
|
||||
return html`
|
||||
<demo-more-infos
|
||||
.hass=${this.hass}
|
||||
.entities=${ENTITIES.map((ent) => ent.entityId)}
|
||||
></demo-more-infos>
|
||||
`;
|
||||
}
|
||||
|
||||
protected firstUpdated(changedProperties: PropertyValues) {
|
||||
super.firstUpdated(changedProperties);
|
||||
const hass = provideHass(this._demoRoot);
|
||||
hass.updateTranslations(null, "en");
|
||||
hass.addEntities(ENTITIES);
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"demo-more-info-climate": DemoMoreInfoClimate;
|
||||
}
|
||||
}
|
3
gallery/src/pages/more-info/humidifier.markdown
Normal file
3
gallery/src/pages/more-info/humidifier.markdown
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
title: Humidifier
|
||||
---
|
57
gallery/src/pages/more-info/humidifier.ts
Normal file
57
gallery/src/pages/more-info/humidifier.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import { html, LitElement, PropertyValues, TemplateResult } from "lit";
|
||||
import { customElement, property, query } from "lit/decorators";
|
||||
import "../../../../src/components/ha-card";
|
||||
import "../../../../src/dialogs/more-info/more-info-content";
|
||||
import { getEntity } from "../../../../src/fake_data/entity";
|
||||
import {
|
||||
MockHomeAssistant,
|
||||
provideHass,
|
||||
} from "../../../../src/fake_data/provide_hass";
|
||||
import "../../components/demo-more-infos";
|
||||
|
||||
const ENTITIES = [
|
||||
getEntity("humidifier", "humidifier", "on", {
|
||||
friendly_name: "Humidifier",
|
||||
device_class: "humidifier",
|
||||
current_humidity: 50,
|
||||
humidity: 30,
|
||||
}),
|
||||
getEntity("humidifier", "dehumidifier", "on", {
|
||||
friendly_name: "Dehumidifier",
|
||||
device_class: "dehumidifier",
|
||||
current_humidity: 50,
|
||||
humidity: 30,
|
||||
}),
|
||||
getEntity("humidifier", "unavailable", "unavailable", {
|
||||
friendly_name: "Unavailable humidifier",
|
||||
}),
|
||||
];
|
||||
|
||||
@customElement("demo-more-info-humidifier")
|
||||
class DemoMoreInfoHumidifier extends LitElement {
|
||||
@property() public hass!: MockHomeAssistant;
|
||||
|
||||
@query("demo-more-infos") private _demoRoot!: HTMLElement;
|
||||
|
||||
protected render(): TemplateResult {
|
||||
return html`
|
||||
<demo-more-infos
|
||||
.hass=${this.hass}
|
||||
.entities=${ENTITIES.map((ent) => ent.entityId)}
|
||||
></demo-more-infos>
|
||||
`;
|
||||
}
|
||||
|
||||
protected firstUpdated(changedProperties: PropertyValues) {
|
||||
super.firstUpdated(changedProperties);
|
||||
const hass = provideHass(this._demoRoot);
|
||||
hass.updateTranslations(null, "en");
|
||||
hass.addEntities(ENTITIES);
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"demo-more-info-humidifier": DemoMoreInfoHumidifier;
|
||||
}
|
||||
}
|
3
gallery/src/pages/more-info/water-heater.markdown
Normal file
3
gallery/src/pages/more-info/water-heater.markdown
Normal file
@@ -0,0 +1,3 @@
|
||||
---
|
||||
title: Water Heater
|
||||
---
|
70
gallery/src/pages/more-info/water-heater.ts
Normal file
70
gallery/src/pages/more-info/water-heater.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
import { html, LitElement, PropertyValues, TemplateResult } from "lit";
|
||||
import { customElement, property, query } from "lit/decorators";
|
||||
import "../../../../src/components/ha-card";
|
||||
import { WaterHeaterEntityFeature } from "../../../../src/data/water_heater";
|
||||
import "../../../../src/dialogs/more-info/more-info-content";
|
||||
import { getEntity } from "../../../../src/fake_data/entity";
|
||||
import {
|
||||
MockHomeAssistant,
|
||||
provideHass,
|
||||
} from "../../../../src/fake_data/provide_hass";
|
||||
import "../../components/demo-more-infos";
|
||||
|
||||
const ENTITIES = [
|
||||
getEntity("water_heater", "basic", "eco", {
|
||||
friendly_name: "Basic heater",
|
||||
operation_list: ["heat_pump", "eco", "performance", "off"],
|
||||
operation_mode: "eco",
|
||||
away_mode: "off",
|
||||
target_temp_step: 1,
|
||||
current_temperature: 55,
|
||||
temperature: 60,
|
||||
min_temp: 20,
|
||||
max_temp: 70,
|
||||
supported_features:
|
||||
// eslint-disable-next-line no-bitwise
|
||||
WaterHeaterEntityFeature.TARGET_TEMPERATURE |
|
||||
WaterHeaterEntityFeature.OPERATION_MODE |
|
||||
WaterHeaterEntityFeature.AWAY_MODE,
|
||||
}),
|
||||
getEntity("water_heater", "unavailable", "unavailable", {
|
||||
friendly_name: "Unavailable heater",
|
||||
operation_list: ["heat_pump", "eco", "performance", "off"],
|
||||
operation_mode: "off",
|
||||
min_temp: 20,
|
||||
max_temp: 70,
|
||||
supported_features:
|
||||
// eslint-disable-next-line no-bitwise
|
||||
WaterHeaterEntityFeature.TARGET_TEMPERATURE |
|
||||
WaterHeaterEntityFeature.OPERATION_MODE,
|
||||
}),
|
||||
];
|
||||
|
||||
@customElement("demo-more-info-water-heater")
|
||||
class DemoMoreInfoWaterHeater extends LitElement {
|
||||
@property() public hass!: MockHomeAssistant;
|
||||
|
||||
@query("demo-more-infos") private _demoRoot!: HTMLElement;
|
||||
|
||||
protected render(): TemplateResult {
|
||||
return html`
|
||||
<demo-more-infos
|
||||
.hass=${this.hass}
|
||||
.entities=${ENTITIES.map((ent) => ent.entityId)}
|
||||
></demo-more-infos>
|
||||
`;
|
||||
}
|
||||
|
||||
protected firstUpdated(changedProperties: PropertyValues) {
|
||||
super.firstUpdated(changedProperties);
|
||||
const hass = provideHass(this._demoRoot);
|
||||
hass.updateTranslations(null, "en");
|
||||
hass.addEntities(ENTITIES);
|
||||
}
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface HTMLElementTagNameMap {
|
||||
"demo-more-info-water-heater": DemoMoreInfoWaterHeater;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user