forked from Mirrors/elk
Compare commits
1656 commits
perf/lazy-
...
main
Author | SHA1 | Date | |
---|---|---|---|
b217b4dc25 | |||
f2edec194f | |||
087f8cc992 | |||
6efbf8768b | |||
cd934fcd55 | |||
7f1e97a37c | |||
58c84b2f9b | |||
322ffeef12 | |||
4a8110a52e | |||
d481c0ae7a | |||
68ffb627e7 | |||
b221687139 | |||
7b10620cca | |||
498face3cf | |||
672ff46072 | |||
81b5f8b8e7 | |||
721e55be06 | |||
eba4cc0757 | |||
80818ed52d | |||
|
25fb7c1c97 | ||
|
839aa52e86 | ||
|
9ff55289ea | ||
|
73293fbcd3 | ||
|
a27c218802 | ||
|
f8fc0efadc | ||
|
618a5b2df3 | ||
|
1146dca5f6 | ||
|
f86e856ee6 | ||
|
6d13d61227 | ||
|
0de9825bf2 | ||
|
3f0b234cc4 | ||
|
8f04ea8eee | ||
|
7dcafa3fe0 | ||
|
bead2183b2 | ||
|
59dda09cd4 | ||
|
d0b115751f | ||
|
c6787aae3f | ||
|
9025416ab3 | ||
|
aa28257754 | ||
|
d807e06fa0 | ||
|
611d556936 | ||
|
4313002950 | ||
|
de11a60b17 | ||
|
5064b269e7 | ||
|
d8d9975756 | ||
|
eee671cdc3 | ||
|
587c063aba | ||
|
28514e956d | ||
|
42aeb8fa35 | ||
|
f6f50a582e | ||
|
f86818867b | ||
|
82d962a54b | ||
|
1b189043e4 | ||
|
a4867566d9 | ||
|
0757db69b2 | ||
|
f0de25c992 | ||
|
660549b08b | ||
|
7807730118 | ||
|
b526db0860 | ||
|
0133324ded | ||
|
e9ab0cd40b | ||
|
9251ec496b | ||
|
bd4cd02b2b | ||
|
74ccfece5d | ||
35b4c80311 | |||
f6a081d199 | |||
5e419045ed | |||
cfdbb66b96 | |||
c717aace86 | |||
6713329a5e | |||
7470468077 | |||
9044b3bcad | |||
5bd9dce91e | |||
12e14cfc05 | |||
1ea4399765 | |||
991cb812da | |||
|
c89e499f96 | ||
|
89e3582dd7 | ||
|
48c013709a | ||
|
f90f0a2e61 | ||
|
c58b585855 | ||
|
ded2e0f3d7 | ||
9b77efe1d7 | |||
aec670a903 | |||
1218f92133 | |||
7c0986a005 | |||
ac01207283 | |||
ef169d682f | |||
|
21d5633233 | ||
|
7703565c75 | ||
|
5a9546ec0a | ||
|
bc30a8bd82 | ||
|
c432c2bd0d | ||
|
364fbd350b | ||
|
c64580f782 | ||
|
e7dfdafd59 | ||
|
b06ec9356d | ||
|
3b1a66c93c | ||
|
ed8a1811cc | ||
|
dfbe2e080d | ||
|
0fd9374e8c | ||
|
1c8e48bee4 | ||
|
3448335356 | ||
|
4954473f50 | ||
|
efa17caf5e | ||
|
df165f0023 | ||
|
0f583ece28 | ||
|
d579977790 | ||
|
8786c83db7 | ||
|
1ce913e69d | ||
|
48a8b74e7c | ||
|
1ff13952b0 | ||
|
02f7c4b291 | ||
|
9da77637b2 | ||
|
62f70250d5 | ||
|
873c62e9ef | ||
|
b1ff1e6277 | ||
|
f644148844 | ||
|
3120bbb77f | ||
|
6cbe65c9d8 | ||
|
1c908363cb | ||
|
c01a15c930 | ||
|
0c15aa55d8 | ||
|
9f04e17e57 | ||
|
308b50cbad | ||
|
e44833b18a | ||
|
0fa87f71a4 | ||
|
edfbe2c3ed | ||
|
70c7e93919 | ||
|
95e466146d | ||
|
efec212a9f | ||
|
1844af0a41 | ||
|
72b80d4984 | ||
|
6dc5a68c80 | ||
|
310b32c123 | ||
|
748dd5e19f | ||
|
c00d6f7bf8 | ||
|
fc5d248094 | ||
|
6f20ce5bba | ||
|
edcc8741bf | ||
|
3584151fab | ||
|
efb6967e6a | ||
|
eddbb1eee9 | ||
|
6b40319723 | ||
|
913e2892f7 | ||
|
a3c5272e07 | ||
|
55037f04cd | ||
|
1fefb6e5b6 | ||
|
3769176eaa | ||
|
082650d458 | ||
|
36004a7eba | ||
|
81ef8ff9aa | ||
|
da163903b1 | ||
|
ccfa7a8d10 | ||
|
b9394c2fa5 | ||
|
1954c34628 | ||
|
9f005a0a59 | ||
|
bf0c562794 | ||
|
54fe0c1ab9 | ||
|
1bbc2eca24 | ||
|
dcc1b74824 | ||
|
8eb6b2378a | ||
|
40415f34a4 | ||
|
be4752ee0c | ||
|
30e2295af4 | ||
|
285f83e2fa | ||
|
8db37617d4 | ||
|
172883a499 | ||
|
2a59543836 | ||
|
77b917a921 | ||
|
af8a6e6809 | ||
|
6d8b33a58a | ||
|
7322711609 | ||
|
b8e8693342 | ||
|
f0bc78ba2c | ||
|
cadf1b4a7c | ||
|
f79d84ad6e | ||
|
b0125eb3fc | ||
|
77175416a6 | ||
|
7836edd10a | ||
|
0ae189207f | ||
|
56d4967eb7 | ||
|
0451ac98c9 | ||
|
54e53889e5 | ||
|
149963c304 | ||
|
44f5ec1fa2 | ||
|
6c5bb83ac3 | ||
|
d8ea685803 | ||
|
3fa1fc349c | ||
|
3adf92ea56 | ||
|
b016320eaf | ||
|
77588c1890 | ||
|
e43993770d | ||
|
9070fa4053 | ||
|
7f041c3ac8 | ||
|
b7c22287d6 | ||
|
07042b9f31 | ||
|
c0bb6e293c | ||
|
74138a9a58 | ||
|
e63473a5f8 | ||
|
24378e0be8 | ||
|
5ce005b55a | ||
|
3ae2d50bff | ||
|
2b421f1039 | ||
|
e0ddbc1da2 | ||
|
ca3a818678 | ||
|
9155c32ece | ||
|
3dbdb99118 | ||
|
c3d96d2811 | ||
|
429d1d7ce8 | ||
|
5503ecbea2 | ||
|
21376e013a | ||
|
17f6d93c7c | ||
|
0e701afb98 | ||
|
cdcc89518a | ||
|
1f6a7186f8 | ||
|
ad1461bd2d | ||
|
7ba9b05d12 | ||
|
9c39eed209 | ||
|
7ed95e317f | ||
|
46105c86c6 | ||
|
7785f4fe06 | ||
|
585d8c6f0b | ||
|
1f752e65ed | ||
|
7595162a0e | ||
|
20c30e92a3 | ||
|
e00e4074e1 | ||
|
7ec76ffed9 | ||
|
c41b427c2e | ||
|
c55545612e | ||
|
dab0502319 | ||
|
10bd555926 | ||
|
53dc1f37ca | ||
|
68f92e07b7 | ||
|
957f0d3b17 | ||
|
0bd1209bee | ||
|
00c4a369cc | ||
|
8a5ddb7c87 | ||
|
90878f97b5 | ||
|
09189378e0 | ||
|
769968c2e8 | ||
|
5d09e7d2ab | ||
|
0924c9d9be | ||
|
293534fb8b | ||
|
5fceb70971 | ||
|
d825a71d1f | ||
|
a47071d341 | ||
|
52c947f9e5 | ||
|
07b7f38386 | ||
|
291f99cbea | ||
|
1fe598f554 | ||
|
e9f274f304 | ||
|
ca0afe585d | ||
|
1a0e83365a | ||
|
77a3bd833d | ||
|
02abe2d920 | ||
|
c8d9c4b871 | ||
|
fee811dd75 | ||
|
1910a1d782 | ||
|
c387702bb1 | ||
|
e015adcf4e | ||
|
12eaae6bbb | ||
|
e199e02e79 | ||
|
b42e77af24 | ||
|
0343898146 | ||
|
b5f2cea1dc | ||
|
2a9f607049 | ||
|
043883bd8e | ||
|
ed5592260f | ||
|
f4b0be8aed | ||
|
b723d51786 | ||
|
25d4325bd0 | ||
|
319f9c4ece | ||
|
06ef226440 | ||
|
3691ec389a | ||
|
ca2ca2bef4 | ||
|
907d9999dc | ||
|
e9c5de577e | ||
|
87d6ed39eb | ||
|
cf20ac29db | ||
|
1a96f87da0 | ||
|
0f825a6efb | ||
|
1b8d72105d | ||
|
5ef2996b40 | ||
|
1ac3164d0c | ||
|
e4725d433e | ||
|
3716e3af6e | ||
|
366f3e07df | ||
|
6801ea6c2d | ||
|
4b37d19f65 | ||
|
c1bca79c50 | ||
|
ee88c111f2 | ||
|
067550720a | ||
|
c5b1b32f2c | ||
|
bd7436e5d2 | ||
|
8b883dc957 | ||
|
06808da616 | ||
|
0b900128c1 | ||
|
b74eec6a03 | ||
|
92d0f18389 | ||
|
c0f936f8fe | ||
|
7e492422fe | ||
|
4325bca22b | ||
|
5a765187ab | ||
|
e9a02ca337 | ||
|
221a6f2fc3 | ||
|
2267db11c6 | ||
|
a4d34323ed | ||
|
91db9b03a8 | ||
|
0be47261c7 | ||
|
49b39b7fa8 | ||
|
1f37e3ab8b | ||
|
e183c62036 | ||
|
370c8dd58e | ||
|
b19f73c870 | ||
|
dccdcbbbe2 | ||
|
280911b233 | ||
|
f3d17d3be2 | ||
|
3f6cc16850 | ||
|
4ebc8b6798 | ||
|
7079564ffe | ||
|
991034115b | ||
|
57814915d6 | ||
|
8181738d48 | ||
|
0a8cc317a9 | ||
|
8df73b13bd | ||
|
d975c6fc2c | ||
|
67d5d5c00a | ||
|
603e10b6ca | ||
|
9ae0d9b744 | ||
|
28f9540113 | ||
|
468a17ad58 | ||
|
b84a6ccc32 | ||
|
a45b7173e5 | ||
|
d23f1d39eb | ||
|
e6172ad38b | ||
|
5870e8d6e6 | ||
|
3d696646c5 | ||
|
6edb6ccb15 | ||
|
6cb7fca3ab | ||
|
3375563e64 | ||
|
832ee35a93 | ||
|
550540fad0 | ||
|
e59c2af818 | ||
|
ee6ee30df1 | ||
|
675f5184a0 | ||
|
0a9f2d99d5 | ||
|
35dcf91a06 | ||
|
7876727a41 | ||
|
3c3fad808d | ||
|
357fac4d49 | ||
|
f45f51d44b | ||
|
5bbbf14c92 | ||
|
0a933614fa | ||
|
22a1388d50 | ||
|
0719ad0afd | ||
|
1671dfb617 | ||
|
b730fab643 | ||
|
81e1383da5 | ||
|
cdc43775a6 | ||
|
2a57c64fa0 | ||
|
8a86282951 | ||
|
da31709677 | ||
|
b14a8e63c6 | ||
|
cc89692d80 | ||
|
5782c326b2 | ||
|
af444391b5 | ||
|
9bc44f44a0 | ||
|
f7f4167b06 | ||
|
8fa9c40e86 | ||
|
31a4924186 | ||
|
a6b9d4a82b | ||
|
ca897bdd2f | ||
|
fa44850686 | ||
|
a6e4da8c41 | ||
|
895c1ecd8d | ||
|
ae35f9d11d | ||
|
2506c02c39 | ||
|
a08d9d147c | ||
|
cb109b49b8 | ||
|
d51303cb8b | ||
|
c00354c833 | ||
|
1ee0ec68c5 | ||
|
5c1411b3de | ||
|
2d8ec4ab89 | ||
|
c7e20296a2 | ||
|
a98ca69382 | ||
|
886fc89df6 | ||
|
112502155e | ||
|
be446f5433 | ||
|
a9f5e4b5e7 | ||
|
78b8b441ba | ||
|
d52755a153 | ||
|
d5856b83c6 | ||
|
338e203b6f | ||
|
026ef988c4 | ||
|
5f2dca1979 | ||
|
676470bae2 | ||
|
e0525e5f55 | ||
|
d4ce90a7e8 | ||
|
171f0ec857 | ||
|
fbf49368c1 | ||
|
3f8d68c7f7 | ||
|
0c6260367e | ||
|
0b5797249f | ||
|
e453a316f7 | ||
|
25a5d3fe7b | ||
|
34aca66fef | ||
|
5ea09d323f | ||
|
4541486d0d | ||
|
a94fe1c9d0 | ||
|
58f3ff6cd6 | ||
|
fbc779d174 | ||
|
7c1873c4e3 | ||
|
123cf13145 | ||
|
58053d0b53 | ||
|
68d0d55532 | ||
|
b6304ab18c | ||
|
e996e53a64 | ||
|
f15150c40d | ||
|
01486c2aef | ||
|
5ad32c9e26 | ||
|
2b1a5072d7 | ||
|
c6c4d52556 | ||
|
d601a117c0 | ||
|
0767df3f78 | ||
|
670a4ef632 | ||
|
0633c09726 | ||
|
d535ae6ee1 | ||
|
209013af09 | ||
|
dfa0e5f300 | ||
|
897968027c | ||
|
ad0725e9ae | ||
|
4a167c5bf5 | ||
|
4c0c6f1325 | ||
|
dff36d5c43 | ||
|
a50f97e5f3 | ||
|
9c9a1f7c35 | ||
|
e251a8a50b | ||
|
dfb5a665f0 | ||
|
22556984fa | ||
|
1fda33848e | ||
|
d9add9f670 | ||
|
49ee431676 | ||
|
0092c8cbe9 | ||
|
d0a4c51ef5 | ||
|
52b2d12bf9 | ||
|
5e5fb0e287 | ||
|
886488a3c9 | ||
|
69f9004917 | ||
|
f635e0a634 | ||
|
29f6a73de1 | ||
|
f28c90498b | ||
|
66484bac80 | ||
|
99077da1bf | ||
|
fc97e8ff5b | ||
|
9d3c7ef116 | ||
|
e9740fe693 | ||
|
1fbd88c826 | ||
|
d3cdadd444 | ||
|
582a9847a1 | ||
|
126cd4d535 | ||
|
c9265028d2 | ||
|
77717c960c | ||
|
454ad18f1b | ||
|
4be5d81f17 | ||
|
5ffb96baf6 | ||
|
1487932c1d | ||
|
d9e7a09d24 | ||
|
a3116e703a | ||
|
8dd29039cd | ||
|
0034b22da4 | ||
|
eebe57840b | ||
|
d59cdb0aa4 | ||
|
16561845f8 | ||
|
e9de11000b | ||
|
c6c844f3fd | ||
|
fb61891c29 | ||
|
94323c8fe1 | ||
|
f1f5a96929 | ||
|
df0c30c2f2 | ||
|
68f2c3fc5b | ||
|
d0ede35e89 | ||
|
c54aed62fb | ||
|
5adc5eecf1 | ||
|
4c1e37caa2 | ||
|
847de1b39b | ||
|
0a98c5f13d | ||
|
835269fa1d | ||
|
61526df93f | ||
|
076c47b7b0 | ||
|
98777f078c | ||
|
dcf0f93eb9 | ||
|
656b789e7c | ||
|
70cb620ccd | ||
|
3c3324f070 | ||
|
f3e1b6db67 | ||
|
d4e0d5c5f5 | ||
|
ccf115ca4c | ||
|
c7b77216c1 | ||
|
8b8de1182c | ||
|
99dc8a0479 | ||
|
28a68f47eb | ||
|
9cc4c23e50 | ||
|
2b42f225dd | ||
|
320ed81555 | ||
|
5bd17d3006 | ||
|
5dc136372b | ||
|
5c3b8be055 | ||
|
cbba846c4f | ||
|
574d72af61 | ||
|
a0d036952d | ||
|
23c1dfec10 | ||
|
1ceb3e2857 | ||
|
3f1cdbbfa9 | ||
|
59e418e2e0 | ||
|
ac4188274c | ||
|
450908ecb2 | ||
|
85260e8aaa | ||
|
b2c1a4ddef | ||
|
85ac040c2f | ||
|
94d22fd488 | ||
|
5b1ad44875 | ||
|
21f57f1cfa | ||
|
6727e63626 | ||
|
54e2afa56b | ||
|
56405f52bb | ||
|
9564985a4e | ||
|
aa77919925 | ||
|
1eb47b98f5 | ||
|
acb2b80cdd | ||
|
dbbbe8aa01 | ||
|
bda18e7ac5 | ||
|
ce149e4cb4 | ||
|
6f19d54586 | ||
|
6fc6517811 | ||
|
58a7f15216 | ||
|
ea44f8bc30 | ||
|
d34a5e6e96 | ||
|
1f559fae08 | ||
|
ca8d785d9e | ||
|
18ea4ffb6e | ||
|
f07d32375a | ||
|
c71259334c | ||
|
13581323b0 | ||
|
587f73c4a0 | ||
|
2267556b8b | ||
|
dac044e6ad | ||
|
3442dfe75d | ||
|
ce5e81e160 | ||
|
621d280a96 | ||
|
fb1ca7d8f1 | ||
|
189d358b2a | ||
|
3acf87d5b6 | ||
|
d33ac87c64 | ||
|
a037583631 | ||
|
d6e199b83a | ||
|
79538a65ee | ||
|
2dc7ad27bf | ||
|
921eaae949 | ||
|
2f79f53877 | ||
|
973805f16d | ||
|
685b16d403 | ||
|
ab2881b9a2 | ||
|
60a37e0bf8 | ||
|
da94117f61 | ||
|
605359b9df | ||
|
c513907dbb | ||
|
4cc0101a06 | ||
|
f4f6208420 | ||
|
3c43a1cdd1 | ||
|
2838e18ff7 | ||
|
da2ac06d8a | ||
|
881a49e0d9 | ||
|
e062fb5e52 | ||
|
a1026d3aab | ||
|
42dc99929e | ||
|
0916b05afd | ||
|
331d652ef0 | ||
|
e9ddf3e6a0 | ||
|
5dd3a52865 | ||
|
a82558130a | ||
|
b51bae5361 | ||
|
c94ff39982 | ||
|
5717e5e677 | ||
|
0dbea5915f | ||
|
f533a10097 | ||
|
c0561e7eed | ||
|
0418d05753 | ||
|
01d1a30413 | ||
|
55e0f040a3 | ||
|
60924e5f5d | ||
|
776594ec3d | ||
|
189695c767 | ||
|
791642fac4 | ||
|
5dd3f4bfa3 | ||
|
a25376b60d | ||
|
eea2511e1d | ||
|
01ed4f68dc | ||
|
6abd2a8770 | ||
|
9465c2fe89 | ||
|
c7558ee7c5 | ||
|
8c7dc5a6df | ||
|
ae268de5bf | ||
|
05f3f04578 | ||
|
dc397e133c | ||
|
3732a2cc16 | ||
|
fa3cfd6059 | ||
|
c76e8e8f5e | ||
|
9589bbae3a | ||
|
ecd17c6709 | ||
|
0f477236ac | ||
|
82d6b2ad29 | ||
|
c4d8137186 | ||
|
69c1bd8b6a | ||
|
bc09a28af6 | ||
|
cb0b7b58bb | ||
|
8fd697126b | ||
|
b72809c048 | ||
|
73a8e4f545 | ||
|
cd6d328266 | ||
|
dbfb450e23 | ||
|
f3ad179c69 | ||
|
4d88c79019 | ||
|
b7ebf31bd9 | ||
|
1445a57d8d | ||
|
ddb765c4a2 | ||
|
32eaee82e2 | ||
|
2842a5f383 | ||
|
a5cece7b42 | ||
|
baba3faa34 | ||
|
2ccec5e09c | ||
|
1356f86b54 | ||
|
5259f6940f | ||
|
5edf713bcc | ||
|
981d777682 | ||
|
9e455499b9 | ||
|
3596d8bec3 | ||
|
d810b2de3a | ||
|
8c783204d3 | ||
|
958f5967b9 | ||
|
bcf0965795 | ||
|
f98c667613 | ||
|
29b37e67c7 | ||
|
015d8a944e | ||
|
41175b02ca | ||
|
75ca138c6e | ||
|
aeba239964 | ||
|
fb01c467cb | ||
|
6b649df218 | ||
|
2a06cf26d8 | ||
|
3ad0abce3b | ||
|
1be6a8c6ec | ||
|
ff070ea9da | ||
|
76efc724eb | ||
|
b7e565dedc | ||
|
acf719775f | ||
|
1003a2a898 | ||
|
6f96c732f7 | ||
|
aa8f8ddd79 | ||
|
4cc213c5b1 | ||
|
3ff39fb79f | ||
|
b1dbd22cd4 | ||
|
436489461c | ||
|
523578ba7b | ||
|
769b84867a | ||
|
33a53de8d7 | ||
|
24eb181d6d | ||
|
0fdbb17591 | ||
|
3118ed6012 | ||
|
fbe1463f17 | ||
|
52fbb70a08 | ||
|
f73019c1fd | ||
|
ef680ab8b3 | ||
|
1153421915 | ||
|
f091e06d19 | ||
|
271c78fdbb | ||
|
379f56795d | ||
|
635d55befb | ||
|
171963ae25 | ||
|
a3cc2cecfd | ||
|
f295ddbcd2 | ||
|
da7cc78a7e | ||
|
54f020b165 | ||
|
37036b4ca6 | ||
|
059c1c7b33 | ||
|
90c98857ce | ||
|
788819ac97 | ||
|
898a43b783 | ||
|
d7a95eab3b | ||
|
c6f0432d8d | ||
|
79d43515f5 | ||
|
148fd63c24 | ||
|
efaeb67261 | ||
|
73dc060578 | ||
|
b9c2bc5c70 | ||
|
c2ffdcf78b | ||
|
a9427e2ea0 | ||
|
c5fe184281 | ||
|
3e648f6fbc | ||
|
db2892c4c0 | ||
|
972a13499f | ||
|
0eefcfa281 | ||
|
328fd1bf70 | ||
|
943b5f151d | ||
|
9578ed1e5d | ||
|
44c3dd762e | ||
|
4400818a31 | ||
|
11eaeeebbe | ||
|
acd7010fbc | ||
|
f04b09a40d | ||
|
7da49afde5 | ||
|
c25715b26d | ||
|
a3310b6ea2 | ||
|
11d179b13b | ||
|
36191c500f | ||
|
2128d11238 | ||
|
9e09c9072f | ||
|
f1087fd270 | ||
|
65bbc7c790 | ||
|
32cfe6371f | ||
|
f7a8d471a6 | ||
|
6e7ac24821 | ||
|
6dc38c7d8e | ||
|
357dff2140 | ||
|
4ff2dce87f | ||
|
e31fc4087c | ||
|
2bd8dc2dd5 | ||
|
04c4ff5225 | ||
|
b7a3e93097 | ||
|
7380e243c4 | ||
|
76bad723ab | ||
|
297b104e1c | ||
|
0fbe34c1e8 | ||
|
a1b2da3d5e | ||
|
7dfe91bb9d | ||
|
53d0812efd | ||
|
61428cd9cd | ||
|
d204b6b1fd | ||
|
5f2b5a584a | ||
|
8d9c043b7a | ||
|
0cc4c41315 | ||
|
2cf8f591e8 | ||
|
e92d1c6adf | ||
|
0258894484 | ||
|
4a74b16d24 | ||
|
87496e01af | ||
|
97964ede5c | ||
|
34949e063e | ||
|
347b9ef43d | ||
|
3f5f0d11fc | ||
|
6784f3a090 | ||
|
eb5748ac65 | ||
|
95233b30d0 | ||
|
832e15bf68 | ||
|
a8e7fd52a9 | ||
|
faa96c7705 | ||
|
6eedaa98bc | ||
|
f8ff30d31b | ||
|
080f4afef0 | ||
|
7f1b443f65 | ||
|
6c1ec2a252 | ||
|
2daaad90a1 | ||
|
4fc468539e | ||
|
4b1b18768d | ||
|
a2fb458696 | ||
|
a46ec605e1 | ||
|
073ca13d7c | ||
|
5947323538 | ||
|
3b3d4906be | ||
|
fc706f9050 | ||
|
e58d09b6cc | ||
|
809d4a6eb3 | ||
|
cf76ba3114 | ||
|
a025b3b434 | ||
|
a287284664 | ||
|
b41b9353b8 | ||
|
4c054a37fd | ||
|
22fea9d53a | ||
|
2481071b2b | ||
|
94f3a2c6fb | ||
|
9190aeccdf | ||
|
611b6bece7 | ||
|
d39e23ebff | ||
|
54f3695f50 | ||
|
e18fe70f80 | ||
|
bd77d467c3 | ||
|
b62fd01057 | ||
|
04404e0c0b | ||
|
80a4ec502e | ||
|
9c3a3de41d | ||
|
e277832b61 | ||
|
2a4862fb42 | ||
|
8d792d003d | ||
|
fbdaf8bbef | ||
|
a29f52ee1a | ||
|
72bf6fb6f0 | ||
|
fa44fae991 | ||
|
415d36ce32 | ||
|
1c9004a731 | ||
|
6dbf7ae74f | ||
|
b48b7f4c16 | ||
|
e197a1dbe9 | ||
|
fda85e31bc | ||
|
7d127d397a | ||
|
8c76dad3c0 | ||
|
ca65f7379e | ||
|
4f23bebf2e | ||
|
2ce7c462ae | ||
|
bdcb8f46fd | ||
|
664c0a2ab7 | ||
|
1924ec8d07 | ||
|
3e365fc30a | ||
|
e393049f04 | ||
|
9d353fa07b | ||
|
a15fd7b2ca | ||
|
068daf7a77 | ||
|
541a1f93bc | ||
|
3904bc4d2d | ||
|
901463301c | ||
|
d26510a766 | ||
|
75c4fa54d7 | ||
|
5eac588d6d | ||
|
050092b87a | ||
|
bc78b50ee0 | ||
|
d5653076f9 | ||
|
adb17d7f14 | ||
|
255c341a78 | ||
|
eda218de0b | ||
|
f96cdae1ba | ||
|
3c888d3914 | ||
|
18af058e4d | ||
|
1d1f4bccca | ||
|
0e021e4388 | ||
|
5527468258 | ||
|
46a8472001 | ||
|
4e97c31caf | ||
|
3c59263f21 | ||
|
7545921385 | ||
|
d7bba4dbc9 | ||
|
84f45809ea | ||
|
727cc5d495 | ||
|
82694b87b6 | ||
|
8b34b8b6e6 | ||
|
73ee6a0c2c | ||
|
897ec00498 | ||
|
f1a3c8873c | ||
|
065d8a1c2d | ||
|
66c9212a6f | ||
|
dc23784c00 | ||
|
a08f56676d | ||
|
1a7ae6f0ef | ||
|
677d6188b4 | ||
|
804f66f203 | ||
|
9d94a09319 | ||
|
8b72e178d8 | ||
|
2a836eda3d | ||
|
f504f778da | ||
|
1a577343da | ||
|
85be61a316 | ||
|
c28c95e36c | ||
|
edba79f6db | ||
|
45431ef504 | ||
|
844fb26d27 | ||
|
29e5d6ddf7 | ||
|
c35f8fdd33 | ||
|
31d9308043 | ||
|
331f517d75 | ||
|
745e57fbe1 | ||
|
c1b5f4361b | ||
|
329c0fca8d | ||
|
8f4ce68b97 | ||
|
db1d91a5e4 | ||
|
1cf123b62b | ||
|
adbe31d523 | ||
|
be5d32cb4a | ||
|
801b8fe027 | ||
|
5d94eabff6 | ||
|
55e8c6b6f7 | ||
|
855f71ac22 | ||
|
25dad31461 | ||
|
2667899b14 | ||
|
e422bf9edb | ||
|
86d62fd5de | ||
|
126619be92 | ||
|
33b5947170 | ||
|
691ef029a4 | ||
|
d8bf96fd70 | ||
|
abaf4a2f54 | ||
|
1a074aaff6 | ||
|
5465409fcb | ||
|
0f5476c190 | ||
|
eb966976db | ||
|
c200abcc90 | ||
|
61f2237121 | ||
|
ae05d3bee5 | ||
|
f49d8619a1 | ||
|
644d761ee7 | ||
|
359cc4935b | ||
|
fab1eb13b3 | ||
|
c3b9f8fc2a | ||
|
09997c2f90 | ||
|
a48524e7ad | ||
|
1f427e2538 | ||
|
a81e8742d1 | ||
|
86192fad48 | ||
|
5785047856 | ||
|
3132f4fdea | ||
|
da2f19fb23 | ||
|
cce467a54a | ||
|
fb1f407016 | ||
|
88080573db | ||
|
40c0afb09d | ||
|
9c82df0a7a | ||
|
bc08ef07d3 | ||
|
dded8d929e | ||
|
6c1d0e7121 | ||
|
0b77ad3f43 | ||
|
a7e1dad3d2 | ||
|
5b849baec7 | ||
|
448b303106 | ||
|
db69a54090 | ||
|
2975a38650 | ||
|
dd0333a6bb | ||
|
53b37a1cfb | ||
|
fd662b8864 | ||
|
85e163a0ad | ||
|
0b2b9a713b | ||
|
bb41c468bb | ||
|
7aa8aeba3f | ||
|
8a74e1abef | ||
|
db9fb61134 | ||
|
08eebb651d | ||
|
8d3be0f3cf | ||
|
3050350f25 | ||
|
21b277ffce | ||
|
a91d3c1e92 | ||
|
7059cfc7b4 | ||
|
8adb9f403b | ||
|
486f1baf37 | ||
|
406fe18302 | ||
|
98a4e8caaf | ||
|
295eb97a7a | ||
|
2587225b95 | ||
|
80da856402 | ||
|
c4c15cf1c2 | ||
|
5354e58c2d | ||
|
1a1c0e4c5d | ||
|
f3a3a299e0 | ||
|
8c170961cb | ||
|
9df47ea6c2 | ||
|
470da9a1be | ||
|
b759e21826 | ||
|
b049b40298 | ||
|
7389226c38 | ||
|
8bb6ee7639 | ||
|
00379e23aa | ||
|
8753a94aae | ||
|
2e79f3aa37 | ||
|
998fa9ccb1 | ||
|
46bd13310a | ||
|
d21860487b | ||
|
e847f8ef1d | ||
|
9898a19358 | ||
|
d745bd0583 | ||
|
3b73d11fd3 | ||
|
e04972d5e2 | ||
|
2d96d1358b | ||
|
741eccf929 | ||
|
1cd9f61b3a | ||
|
57c820b701 | ||
|
512d0901ce | ||
|
46d350f442 | ||
|
bb2e3ab44f | ||
|
d24c1da35e | ||
|
7c58d89044 | ||
|
95dda1fdb6 | ||
|
97a02ef837 | ||
|
61740ac665 | ||
|
b9d998bca5 | ||
|
fe07c7effe | ||
|
cd8e2cb6a4 | ||
|
a594f6f167 | ||
|
656fd4b62c | ||
|
6dd8fb3fa1 | ||
|
18069356f9 | ||
|
3781e2f8d2 | ||
|
bf25339bc9 | ||
|
3513f09148 | ||
|
9f19e56b0f | ||
|
92b9746cd7 | ||
|
185bfd1ee3 | ||
|
6b90131783 | ||
|
f96a9417da | ||
|
0cbbf914b9 | ||
|
0dc0a1baa6 | ||
|
5a6248a08f | ||
|
5da5f9ac7d | ||
|
88c96cb304 | ||
|
ccad8bf22b | ||
|
18ad1c2333 | ||
|
83a1980273 | ||
|
b34147db4e | ||
|
c15df78cbb | ||
|
1a4fd19720 | ||
|
e7ccd00ad3 | ||
|
08293a107c | ||
|
5247b36b6d | ||
|
ba5b89d5b8 | ||
|
2e7979817a | ||
|
20a90cc949 | ||
|
4422a57f49 | ||
|
eb1f769e32 | ||
|
274e182bdf | ||
|
4c25a27c8d | ||
|
3353649147 | ||
|
bfcdd02a0a | ||
|
e9479da2a2 | ||
|
399d7851e3 | ||
|
2ed3373352 | ||
|
896681d5b9 | ||
|
d46ddbe2b4 | ||
|
a8e1cb86f3 | ||
|
9a8e645e16 | ||
|
5f7feac96b | ||
|
bede92404b | ||
|
a6a825e553 | ||
|
b3ff8a457d | ||
|
1cbaf68ea4 | ||
|
72e2650702 | ||
|
f227ad6e2f | ||
|
81e24440e7 | ||
|
c280ee389c | ||
|
10bf774a6b | ||
|
1d50616949 | ||
|
7e321e906a | ||
|
b0164deb27 | ||
|
6b9ea79a66 | ||
|
bef1371516 | ||
|
680b3493b3 | ||
|
55a58f5509 | ||
|
d2ef57bcfa | ||
|
55aff4778b | ||
|
dcf0dd7018 | ||
|
cfbb93045c | ||
|
11fc2572d5 | ||
|
b6c916517c | ||
|
3defa7f110 | ||
|
53349604de | ||
|
313efddd64 | ||
|
04480eef44 | ||
|
88ac29ea14 | ||
|
190caf0437 | ||
|
1e5b648a71 | ||
|
f76628d4ab | ||
|
0407ef353f | ||
|
1275c41bd2 | ||
|
9b1ac596d3 | ||
|
341de5ffaa | ||
|
1d151c53c4 | ||
|
a733fbba08 | ||
|
f16465258d | ||
|
0b120e8b42 | ||
|
b51fa37b34 | ||
|
5c9a21eb9a | ||
|
3367ba6e30 | ||
|
f78a7cd98d | ||
|
39f9e7b6ad | ||
|
23532062f5 | ||
|
6cb3183c2e | ||
|
5e940e58cb | ||
|
f758fc6bea | ||
|
9571d7338a | ||
|
9476d14d6c | ||
|
36ae8be40a | ||
|
d39ea9a6de | ||
|
7f4a5587d7 | ||
|
1e538cb8cd | ||
|
8c2aed0590 | ||
|
27d1328c13 | ||
|
839331ae67 | ||
|
63adaaf4f9 | ||
|
3886ef69a5 | ||
|
bc2a64ac58 | ||
|
884227f560 | ||
|
a41a31732b | ||
|
e9dccc9ef5 | ||
|
c484117657 | ||
|
11f1f62523 | ||
|
cb2e39e854 | ||
|
4f696175b3 | ||
|
cafc995dde | ||
|
9a41b9b7d7 | ||
|
32aa47e701 | ||
|
dcec32338c | ||
|
cd490fffec | ||
|
4139be32f9 | ||
|
d0d0503a13 | ||
|
ad70d9c475 | ||
|
b352fbf3f9 | ||
|
78530bfe68 | ||
|
9f368e50d2 | ||
|
79753fd508 | ||
|
70a4475eac | ||
|
3e83ca375f | ||
|
22e6b13151 | ||
|
34aef0a55f | ||
|
2ddfdffa3d | ||
|
523846e0ef | ||
|
49ff5f8ab1 | ||
|
25223d026b | ||
|
4e0777d723 | ||
|
50c54144e6 | ||
|
3ef1f8185d | ||
|
2e64cd6c98 | ||
|
8da4a8e78a | ||
|
a12d3d09b1 | ||
|
da8594dbf1 | ||
|
3add7a5f40 | ||
|
3a66944080 | ||
|
3f9e39d244 | ||
|
07808384bf | ||
|
e34bfee4a5 | ||
|
2b3b5fe4cb | ||
|
bf60ca05fa | ||
|
67f58a3335 | ||
|
689ae0c701 | ||
|
c1e89582f8 | ||
|
c2850a34ae | ||
|
f9509f8987 | ||
|
24d43699bb | ||
|
f04d7ac067 | ||
|
c92fd7939e | ||
|
af85a5ea8d | ||
|
dfed02efee | ||
|
0cc75a10b5 | ||
|
46109d6dfa | ||
|
2af1fec425 | ||
|
e690422266 | ||
|
c757e45762 | ||
|
2281dc6bd0 | ||
|
d36e21c5f1 | ||
|
0cb974fcf7 | ||
|
7a821fa648 | ||
|
7c651d450d | ||
|
62b6020895 | ||
|
1b9fb99032 | ||
|
6e7813020e | ||
|
74148d71b0 | ||
|
ba9a91a34e | ||
|
81c8a74748 | ||
|
0ef99f2c8e | ||
|
df37e7c4de | ||
|
de696d0300 | ||
|
60ccfc84fa | ||
|
fa801f9912 | ||
|
4131949b1a | ||
|
ad1e597b5c | ||
|
971e273dc3 | ||
|
34be0078c2 | ||
|
217f1ea567 | ||
|
88731ee18d | ||
|
b4cda4338f | ||
|
8fb9739f69 | ||
|
c75a9092c7 | ||
|
315ade28e2 | ||
|
645aa9ead9 | ||
|
caa02446c7 | ||
|
e1332345ad | ||
|
7a061c1ff9 | ||
|
ee2f9f44c2 | ||
|
6f7bdf274f | ||
|
3e0a29dff5 | ||
|
04aac652cf | ||
|
d0675cb391 | ||
|
3dedc0dbbd | ||
|
fcc16dfbe4 | ||
|
0a75205309 | ||
|
56ab163369 | ||
|
8d77f9e9fb | ||
|
333cab0858 | ||
|
01a24a6015 | ||
|
162b56f5cb | ||
|
0651c50a43 | ||
|
9721bbf12b | ||
|
675a14db80 | ||
|
2de0974d6b | ||
|
83db9f0c38 | ||
|
efe7d639c1 | ||
|
6a6e6bfb74 | ||
|
46c4fe1e5a | ||
|
71b19dbe68 | ||
|
571deed157 | ||
|
68d0d48199 | ||
|
886e2d6b73 | ||
|
52f81a34c3 | ||
|
e336ac928b | ||
|
173ec8ff46 | ||
|
5c8faca620 | ||
|
c28d1e1537 | ||
|
509eec5f87 | ||
|
7c83bd05a5 | ||
|
88b428dc09 | ||
|
759d9e257e | ||
|
9e24cbe5aa | ||
|
e621c93b95 | ||
|
1125bd1970 | ||
|
a8e0e06d84 | ||
|
80d3d8dd1d | ||
|
4203778f57 | ||
|
3c90fee07e | ||
|
7e191d7296 | ||
|
19e4aa4ada | ||
|
1dcaf41c0f | ||
|
efe406df5b | ||
|
f8692ed480 | ||
|
e92a983947 | ||
|
5f07fd2515 | ||
|
fcae855eea | ||
|
805f7731ad | ||
|
95a875f47b | ||
|
7e17bdfd83 | ||
|
fd2c433644 | ||
|
b7b6f0d1ca | ||
|
5075fdf194 | ||
|
6e0ce3c916 | ||
|
0297ed868b | ||
|
c647a87ba1 | ||
|
559e3219f1 | ||
|
9f71fd005f | ||
|
51e5540d36 | ||
|
2df2fefdc9 | ||
|
c7f4b33bf1 | ||
|
c5573cb10b | ||
|
d415638bd9 | ||
|
2211383258 | ||
|
c64106c98a | ||
|
6308aa5c9a | ||
|
3d25243166 | ||
|
a4c0e9dd2e | ||
|
76ccf5775e | ||
|
4ca2053bb2 | ||
|
b30ebc12f8 | ||
|
5c8f75b9b7 | ||
|
39034c5777 | ||
|
3dc20ea2f9 | ||
|
1817afdb23 | ||
|
c1aac9d2dc | ||
|
1f92cdc1c9 | ||
|
57fd9aeae2 | ||
|
697a88ac3d | ||
|
b5e14810af | ||
|
31ae413da4 | ||
|
0bf76fdf86 | ||
|
2b5badf235 | ||
|
1957a5c681 | ||
|
cf561870f0 | ||
|
d386a2dbbe | ||
|
30e4ef57df | ||
|
bbc1580010 | ||
|
6944a74653 | ||
|
d76e4bfaa5 | ||
|
2ff46bb8cb | ||
|
6a78f9c9e3 | ||
|
0a79f4dc28 | ||
|
5e38a768c9 | ||
|
907abd0b41 | ||
|
e04513d24c | ||
|
a81de95d3d | ||
|
5f7f7573c6 | ||
|
731d68d53d | ||
|
c48ee6c35b | ||
|
230c8b68a4 | ||
|
2bbbfd51c1 | ||
|
c7756add7d | ||
|
e2dc90a889 | ||
|
e0741d58a9 | ||
|
bf8070c4b9 | ||
|
79e4841f87 | ||
|
a311e0ec80 | ||
|
1aa118283e | ||
|
35c9a871be | ||
|
413f2e1fea | ||
|
c713add727 | ||
|
cffcddefb9 | ||
|
85ac005570 | ||
|
18056038c7 | ||
|
37fa2b9117 | ||
|
915923162a | ||
|
7c6a81961b | ||
|
779fcf4177 | ||
|
36f11e48da | ||
|
c11a7cc225 | ||
|
573bf48eda | ||
|
d8eec1ed5e | ||
|
b1fbac6ba3 | ||
|
b4012a11bf | ||
|
916793f5ae | ||
|
954a6bd5a1 | ||
|
a35884c0a7 | ||
|
6bb9fd9553 | ||
|
7e794aa641 | ||
|
c68c7ad507 | ||
|
85316d0518 | ||
|
acdb94de62 | ||
|
272fb4a13d | ||
|
9d5269e0c0 | ||
|
dede688bf2 | ||
|
79bd9830c9 | ||
|
31ee71c0d1 | ||
|
f177ea1ea8 | ||
|
b4408422a8 | ||
|
597ebae042 | ||
|
e5a9bd7370 | ||
|
640075fed1 | ||
|
1c2c4a251e | ||
|
95c825522e | ||
|
d279d618a5 | ||
|
bd1b9fb5c8 | ||
|
d4e99566b8 | ||
|
0d66038eaa | ||
|
22729eed70 | ||
|
614bc274bc | ||
|
5c0e1790fa | ||
|
777066508e | ||
|
fc48f8b90c | ||
|
1ff584bf8b | ||
|
9d7b7b66ed | ||
|
6b5b1f2aed | ||
|
4eb9d52fc2 | ||
|
7d6904d73b | ||
|
733c4003c9 | ||
|
59761c1c04 | ||
|
3468c13e75 | ||
|
2f88bf6824 | ||
|
8840205c98 | ||
|
482e8c1c3a | ||
|
377c015c91 | ||
|
9a167ee990 | ||
|
8a66174477 | ||
|
f892722220 | ||
|
9d5dc1bc3d | ||
|
6a7633b758 | ||
|
9890656477 | ||
|
bf0c3425fc | ||
|
73fe063a8f | ||
|
9677f742c8 | ||
|
b0d6f310a8 | ||
|
154885ca96 | ||
|
8983edd1bb | ||
|
a8135197c9 | ||
|
9f7c5a2040 | ||
|
4354dd6a2e | ||
|
710511e589 | ||
|
b419f34b63 | ||
|
1ac1ce19fa | ||
|
012432bf19 | ||
|
cc666ca8b7 | ||
|
c0602555de | ||
|
364acd998e | ||
|
69b528fc0c | ||
|
9871327a72 | ||
|
564a754a4d | ||
|
64fa8d2bf4 | ||
|
db32d9343a | ||
|
d353f38ac9 | ||
|
f8703fc1c1 | ||
|
61a141ae69 | ||
|
8b219cdb73 | ||
|
055df9d28c | ||
|
f4ff6ee35d | ||
|
b14add8c83 | ||
|
ef417f3ccf | ||
|
4a3cef9a01 | ||
|
a4eda1ce66 | ||
|
fe7bd2d7e3 | ||
|
1d9bd6a9d4 | ||
|
4308491e9c | ||
|
f0ed98c6ad | ||
|
7ef26330fb | ||
|
9727568d34 | ||
|
b18bc7fad1 | ||
|
b0766ab52f | ||
|
4ea5d8ba60 | ||
|
245a37db19 | ||
|
177df4aed7 | ||
|
6729666170 | ||
|
6092b27da6 | ||
|
6e12402987 | ||
|
269fc30afd | ||
|
f467958cd9 | ||
|
20598c6648 | ||
|
34b0f28e75 | ||
|
c6f292a68c | ||
|
029440421d | ||
|
8a3cfcd089 | ||
|
964a67fbf5 | ||
|
f844648cbf | ||
|
2d5038d046 | ||
|
33589acaee | ||
|
26be3e5894 | ||
|
8a0f9176fb | ||
|
7bc9f390db | ||
|
5dffd380b0 | ||
|
ddb6e90e21 | ||
|
296a7b6eae | ||
|
bb4fd74ce3 | ||
|
c0a2aca98a | ||
|
3563b58651 | ||
|
75f1a6b16e | ||
|
190fb46fd9 | ||
|
5c773149c9 | ||
|
b593977421 | ||
|
05e7dd2b2d | ||
|
c89dca05a0 | ||
|
95bedb5335 | ||
|
bf9d7ee7fa | ||
|
2756732c33 | ||
|
c216c81bb7 | ||
|
f942ddc5a3 | ||
|
e728ee0556 | ||
|
c2261370b4 | ||
|
5e3156a638 | ||
|
da7d85b1d0 | ||
|
fa9c418e21 | ||
|
41c5f94fbf | ||
|
74249737d3 | ||
|
5d3aa5886e | ||
|
72ce43dde9 | ||
|
451c4a0701 | ||
|
0187763c29 | ||
|
b48a893614 | ||
|
72e03f8109 | ||
|
aca6f16245 | ||
|
b8c7ed8157 | ||
|
d4268cfff8 | ||
|
23c7e68755 | ||
|
645da2f945 | ||
|
64611083a5 | ||
|
bd72ecd0e5 | ||
|
9e8ee0da41 | ||
|
fbf1906bd4 | ||
|
496da96072 | ||
|
ca93f1a813 | ||
|
d0567c0d18 | ||
|
d8abea75aa | ||
|
6c38477bc2 | ||
|
f0db2e9013 | ||
|
016da2e8c0 | ||
|
9d6801ba46 | ||
|
29fe2a10ac | ||
|
e596953ada | ||
|
22fcc1d68b | ||
|
d62292d219 | ||
|
ca1b7169f1 | ||
|
727d05915f | ||
|
c5304be775 | ||
|
9b33c7c884 | ||
|
17fecebcae | ||
|
4713db9adc | ||
|
53fc28bf61 | ||
|
943a0b66fe | ||
|
4da2fd05bb | ||
|
b64d1add86 | ||
|
a347515781 | ||
|
4bc72905de | ||
|
58e51d4358 | ||
|
b2153fa12e | ||
|
d0b8c9b493 | ||
|
6356c79eb4 | ||
|
ff73614228 | ||
|
6a5383b595 | ||
|
78a1981d87 | ||
|
6c59791682 | ||
|
1a532265fb | ||
|
5a4ec04661 | ||
|
ca37b65962 | ||
|
1bb8963d98 | ||
|
13887a33da | ||
|
d8b8c4e94d | ||
|
9de4a14b32 | ||
|
861afe79b2 | ||
|
27419dc124 | ||
|
61349c6f0a | ||
|
28e26f6b12 | ||
|
b0b0bb2f9c | ||
|
7380609c93 | ||
|
81869df4bd | ||
|
55236dac98 | ||
|
40481c91e8 | ||
|
fd93462f42 | ||
|
2332d7091a | ||
|
f1f2449559 | ||
|
4460d0f59d | ||
|
f4d4e415fb | ||
|
1054e556e8 | ||
|
524f7005aa | ||
|
87eebd520e | ||
|
ca5cb2cfde | ||
|
8b06c48514 | ||
|
0420e3b288 | ||
|
0c882a3576 | ||
|
c8baff3186 | ||
|
7aa3a571bc | ||
|
3afbf712b3 | ||
|
bc868da226 | ||
|
12280afe70 | ||
|
86a604ae9c | ||
|
6cae9505ae | ||
|
bbc029c52f | ||
|
28af2f2efc | ||
|
2a4e1bf8f6 | ||
|
3922db012f | ||
|
b81ca280e5 | ||
|
7c594c68f7 | ||
|
7a36fb8efd | ||
|
6fdcc558fc | ||
|
121c90fc3a | ||
|
4787250df0 | ||
|
468ae88814 | ||
|
aebb02c27e | ||
|
f65f9c9a1c | ||
|
b6f0bd356a | ||
|
e9b1f17235 | ||
|
ab4ceae1e3 | ||
|
8a338ed021 | ||
|
5c1a149358 | ||
|
347cfff358 | ||
|
732011b520 | ||
|
80d952efa3 | ||
|
f780ed9be0 | ||
|
5e86d2a3da | ||
|
a775203bdc | ||
|
d585d4eeb7 | ||
|
34dc2f7736 | ||
|
abe6af40f3 | ||
|
aeb5a40948 | ||
|
d569754b09 | ||
|
377072bea7 | ||
|
5c73a6f98e | ||
|
ae32cf87a7 | ||
|
726a581add | ||
|
73cec49cf0 | ||
|
0501b98a2b | ||
|
75047e878b | ||
|
15fee71c14 | ||
|
010bfc4179 | ||
|
107ac8a6b9 | ||
|
f4de4d3e3b | ||
|
8fbf4a7628 | ||
|
3079867e2a | ||
|
970b6538e2 | ||
|
d09b4deb52 | ||
|
d8d163dbd0 | ||
|
fd7d30a38a | ||
|
7305a01d5b | ||
|
ba91e0421e | ||
|
12942095de | ||
|
378ba25997 | ||
|
4638a38deb | ||
|
26a26ba9f7 | ||
|
ff0ad77676 | ||
|
6412127283 | ||
|
29b7cb3838 | ||
|
c38b8c13ca | ||
|
2f8e47c947 | ||
|
6388b5287c | ||
|
5c4cd7e992 | ||
|
2d2dc64efc | ||
|
dc94d707b0 | ||
|
c19dd3ee0f | ||
|
fd5f817087 | ||
|
45d1a9a2bd | ||
|
b1109c2ceb | ||
|
8bd93722e2 | ||
|
2d4f5ddf76 | ||
|
8f68fa12e4 | ||
|
e97068f000 | ||
|
4d21d27f94 | ||
|
847e64ef6d | ||
|
d9b0e85f63 | ||
|
30c8e82dbf | ||
|
93c31cb2d1 | ||
|
c11f94a7e9 | ||
|
f621ef8b4b | ||
|
cf5e6ed5b5 | ||
|
841959b51f | ||
|
1b35b70e5c | ||
|
4f3a065927 | ||
|
1c61aef83b | ||
|
f4bd2cab5c | ||
|
8a062f5573 | ||
|
93218f9d49 | ||
|
e8dde2c2ba | ||
|
ee63bcb1b2 | ||
|
1bf60dc4a2 | ||
|
e16b7dd9fe | ||
|
53109e7f23 | ||
|
61df1e2da6 | ||
|
4e79246df3 | ||
|
f28923f86f | ||
|
613c5315b3 | ||
|
c8a7e6e7e7 | ||
|
59d0cfa10e | ||
|
3e3a241474 | ||
|
72855d7725 | ||
|
d9e8703882 | ||
|
baa2696d31 | ||
|
db7f82422e | ||
|
0530c6004e | ||
|
5675d5aef9 | ||
|
7405dee7f6 | ||
|
cf261c36cd | ||
|
12522d2a0c | ||
|
a04c84299f | ||
|
cca222ca6b | ||
|
dc76ab2477 | ||
|
720b5114af | ||
|
03d3775011 | ||
|
c8de9c45fa | ||
|
a1400b7fea | ||
|
bf99eca956 | ||
|
95985d14a9 | ||
|
73fd577aaa | ||
|
e7b9b5b8a6 | ||
|
ffe592cc57 | ||
|
32f22f81d9 | ||
|
fdf2d75d86 | ||
|
b30e8a2b03 | ||
|
52a8ae47fe | ||
|
6c9908d030 | ||
|
b40832a7eb | ||
|
597617b7e6 | ||
|
41ef187379 | ||
|
99abb78ef1 | ||
|
823820e7c7 | ||
|
55443e4d8a | ||
|
6037700197 | ||
|
cd268c9bc7 | ||
|
589cf463bd | ||
|
41568b2c2d | ||
|
8bdc6d40cf | ||
|
4b70c6b3e7 | ||
|
0d4df4b269 | ||
|
8c53fff9af | ||
|
cc0472b9e6 | ||
|
ef4a240800 | ||
|
2e5270f453 | ||
|
4f09794021 | ||
|
43515b243b | ||
|
84ea17e0cf | ||
|
4d8b402b04 | ||
|
fef082af13 | ||
|
6b7a8baa8e | ||
|
2124e8046a | ||
|
301c8b2612 |
543 changed files with 51615 additions and 12486 deletions
18
.dockerignore
Normal file
18
.dockerignore
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# Modified from .gitignore
|
||||||
|
node_modules
|
||||||
|
*.log
|
||||||
|
dist
|
||||||
|
.output
|
||||||
|
.nuxt
|
||||||
|
#.env # Not ignoring this file because it can contain build-related settings.
|
||||||
|
.DS_Store
|
||||||
|
.idea/
|
||||||
|
.vite-inspect
|
||||||
|
.netlify/
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
public/emojis
|
||||||
|
|
||||||
|
*~
|
||||||
|
*swp
|
||||||
|
*swo
|
|
@ -1,14 +1,19 @@
|
||||||
NUXT_PUBLIC_TRANSLATE_API=
|
NUXT_PUBLIC_TRANSLATE_API=
|
||||||
|
NUXT_PUBLIC_DEFAULT_SERVER=
|
||||||
|
NUXT_PUBLIC_SINGLE_INSTANCE=
|
||||||
|
NUXT_PUBLIC_PRIVACY_POLICY_URL=
|
||||||
|
|
||||||
# Production only
|
# Production only
|
||||||
NUXT_CLOUDFLARE_ACCOUNT_ID=
|
NUXT_CLOUDFLARE_ACCOUNT_ID=
|
||||||
NUXT_CLOUDFLARE_NAMESPACE_ID=
|
NUXT_CLOUDFLARE_NAMESPACE_ID=
|
||||||
NUXT_CLOUDFLARE_API_TOKEN=
|
NUXT_CLOUDFLARE_API_TOKEN=
|
||||||
|
|
||||||
# 'cloudflare' | 'fs'
|
# 'cloudflare' | 'vercel' | 'fs'
|
||||||
NUXT_STORAGE_DRIVER=
|
NUXT_STORAGE_DRIVER=
|
||||||
NUXT_STORAGE_FS_BASE=
|
NUXT_STORAGE_FS_BASE=
|
||||||
|
|
||||||
|
NUXT_ADMIN_KEY=
|
||||||
|
|
||||||
NUXT_PUBLIC_DISABLE_VERSION_CHECK=
|
NUXT_PUBLIC_DISABLE_VERSION_CHECK=
|
||||||
|
|
||||||
NUXT_GITHUB_CLIENT_ID=
|
NUXT_GITHUB_CLIENT_ID=
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
*.css
|
|
||||||
*.png
|
|
||||||
*.ico
|
|
||||||
*.toml
|
|
||||||
https-dev-config/localhost.crt
|
|
||||||
https-dev-config/localhost.key
|
|
12
.eslintrc
12
.eslintrc
|
@ -1,12 +0,0 @@
|
||||||
{
|
|
||||||
"extends": "@antfu",
|
|
||||||
"ignorePatterns": ["!pages/public"],
|
|
||||||
"overrides": [
|
|
||||||
{
|
|
||||||
"files": ["locales/**.json"],
|
|
||||||
"rules": {
|
|
||||||
"jsonc/sort-keys": "error"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
1
.gitattributes
vendored
Normal file
1
.gitattributes
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
* text=auto eol=lf
|
3
.github/FUNDING.yml
vendored
3
.github/FUNDING.yml
vendored
|
@ -1 +1,2 @@
|
||||||
github: [antfu, patak-dev, sxzz, danielroe]
|
github: [elk-zone]
|
||||||
|
open_collective: elk
|
||||||
|
|
5
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
5
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
name: 🐞 Bug report
|
||||||
|
about: Report an issue
|
||||||
|
labels: ['s: pending triage', 'c: bug']
|
||||||
|
---
|
56
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
56
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
|
@ -1,56 +0,0 @@
|
||||||
name: 🐞 Bug report
|
|
||||||
description: Report an issue
|
|
||||||
labels: ['s: pending triage', 'c: bug']
|
|
||||||
body:
|
|
||||||
- type: markdown
|
|
||||||
attributes:
|
|
||||||
value: |
|
|
||||||
Thanks for taking the time to fill out this bug report!
|
|
||||||
|
|
||||||
If you are unsure whether your problem is a bug or not, you can check the following:
|
|
||||||
|
|
||||||
- use our [Discord community](https://chat.elk.zone)
|
|
||||||
- open a new [discussion](https://github.com/elk-zone/elk/discussions) and ask your question there
|
|
||||||
|
|
||||||
- type: checkboxes
|
|
||||||
id: checkboxes
|
|
||||||
attributes:
|
|
||||||
label: Pre-Checks
|
|
||||||
description: Before submitting the issue, please make sure you do the following
|
|
||||||
options:
|
|
||||||
# - label: Follow our [Code of Conduct](https://github.com/elk-zone/elk/blob/main/CODE_OF_CONDUCT.md).
|
|
||||||
# required: true
|
|
||||||
# - label: Read the [Contributing Guidelines](https://github.com/elk-zone/elk/blob/main/CONTRIBUTING.md).
|
|
||||||
# required: true
|
|
||||||
- label: Check that there isn't [already an issue](https://github.com/elk-zone/elk/issues) that reports the same bug to avoid creating a duplicate.
|
|
||||||
required: true
|
|
||||||
- label: Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/elk-zone/elk/discussions) or join our [Discord Chat Server](https://chat.elk.zone).
|
|
||||||
required: true
|
|
||||||
- label: Providing a screenshot or video to reproduce the issue or show visually what was meant.
|
|
||||||
required: true
|
|
||||||
- label: I am willing to provide a PR.
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
id: bug-description
|
|
||||||
attributes:
|
|
||||||
label: Describe the bug
|
|
||||||
description: A clear and concise description of what the bug is.
|
|
||||||
placeholder: I am doing ... What I expect is ... What actually happening is ...
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
id: reproduction
|
|
||||||
attributes:
|
|
||||||
label: Reproduction video or screenshot
|
|
||||||
description: |
|
|
||||||
A video or screenshot that visually shows the issue.
|
|
||||||
**Tip:** You can attach images or recordings files by clicking this area to highlight it and then dragging files in.
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
id: additional-context
|
|
||||||
attributes:
|
|
||||||
label: Additional Context
|
|
||||||
description: |
|
|
||||||
Anything else relevant? Please tell us here, e.g. your used web browser and/or you are on desktop or mobile.
|
|
||||||
**Tip:** You can attach images or recordings files by clicking this area to highlight it and then dragging files in.
|
|
5
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
5
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
name: 🚀 New feature proposal
|
||||||
|
about: Propose a new feature
|
||||||
|
labels: 's: pending triage'
|
||||||
|
---
|
35
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
35
.github/ISSUE_TEMPLATE/feature_request.yml
vendored
|
@ -1,35 +0,0 @@
|
||||||
name: 🚀 New feature proposal
|
|
||||||
description: Propose a new feature
|
|
||||||
labels: ['s: pending triage'] # This will automatically assign the 's: pending triage' label
|
|
||||||
body:
|
|
||||||
- type: markdown
|
|
||||||
attributes:
|
|
||||||
value: Thanks for your interest in the project and taking the time to fill out this feature report!
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
id: feature-description
|
|
||||||
attributes:
|
|
||||||
label: Clear and concise description of the problem
|
|
||||||
description: 'As a user I want [goal / wish] so that [benefit]. If you intend to submit a PR for this issue, tell us in the description. Thanks!'
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
id: suggested-solution
|
|
||||||
attributes:
|
|
||||||
label: Suggested solution
|
|
||||||
description: 'In section [xy] we could provide following feature...'
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
id: alternative
|
|
||||||
attributes:
|
|
||||||
label: Alternative
|
|
||||||
description: Clear and concise description of any alternative solutions or features you've considered.
|
|
||||||
|
|
||||||
- type: textarea
|
|
||||||
id: additional-context
|
|
||||||
attributes:
|
|
||||||
label: Additional context
|
|
||||||
description: Any other context about the feature request here.
|
|
5
.github/ISSUE_TEMPLATE/freestyle.md
vendored
5
.github/ISSUE_TEMPLATE/freestyle.md
vendored
|
@ -1,5 +0,0 @@
|
||||||
---
|
|
||||||
name: Freestyle Report
|
|
||||||
about: Create a report to help us improve
|
|
||||||
labels: 'pending triage' # This will automatically assign the 'pending triage' label
|
|
||||||
---
|
|
1
.github/_workflows/README.md
vendored
1
.github/_workflows/README.md
vendored
|
@ -1 +0,0 @@
|
||||||
GitHub Actions is temporary disabled as we are reaching the usage limit as a private repo. Tests have been moved to Netlify pipeline as an workaround. We shall recover this once we open up.
|
|
12
.github/renovate.json5
vendored
12
.github/renovate.json5
vendored
|
@ -3,6 +3,14 @@
|
||||||
"extends": ["config:base", "schedule:weekly", "group:allNonMajor"],
|
"extends": ["config:base", "schedule:weekly", "group:allNonMajor"],
|
||||||
"labels": ["c: dependencies"],
|
"labels": ["c: dependencies"],
|
||||||
"rangeStrategy": "bump",
|
"rangeStrategy": "bump",
|
||||||
|
"ignoreDeps": [
|
||||||
|
"vue",
|
||||||
|
"vue-tsc",
|
||||||
|
"typescript",
|
||||||
|
|
||||||
|
// Intl.Segmenter is not supported in Firefox
|
||||||
|
"string-length"
|
||||||
|
],
|
||||||
"packageRules": [
|
"packageRules": [
|
||||||
{
|
{
|
||||||
"groupName": "devDependencies",
|
"groupName": "devDependencies",
|
||||||
|
@ -56,6 +64,10 @@
|
||||||
{
|
{
|
||||||
"groupName": "typescript",
|
"groupName": "typescript",
|
||||||
"matchPackageNames": ["typescript"]
|
"matchPackageNames": ["typescript"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"matchDatasources": ["node-version"],
|
||||||
|
"enabled": false
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"vulnerabilityAlerts": {
|
"vulnerabilityAlerts": {
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
name: ci
|
name: ci
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
|
@ -7,17 +9,19 @@ on:
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
|
workflow_dispatch: {}
|
||||||
|
merge_group: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
ci:
|
ci:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- run: corepack enable
|
- run: corepack enable
|
||||||
- uses: actions/setup-node@v3
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: 16
|
node-version: 20
|
||||||
cache: pnpm
|
cache: pnpm
|
||||||
|
|
||||||
- name: 📦 Install dependencies
|
- name: 📦 Install dependencies
|
||||||
|
@ -27,7 +31,8 @@ jobs:
|
||||||
run: pnpm nuxi prepare
|
run: pnpm nuxi prepare
|
||||||
|
|
||||||
- name: 🧪 Test project
|
- name: 🧪 Test project
|
||||||
run: pnpm test
|
run: pnpm test:ci
|
||||||
|
timeout-minutes: 10
|
||||||
|
|
||||||
- name: 📝 Lint
|
- name: 📝 Lint
|
||||||
run: pnpm lint
|
run: pnpm lint
|
46
.github/workflows/docker.yml
vendored
Normal file
46
.github/workflows/docker.yml
vendored
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
name: build & push docker container
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
jobs:
|
||||||
|
docker:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
packages: write
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Docker meta
|
||||||
|
id: metal
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
ghcr.io/${{ github.repository }}
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
- name: Login to GitHub Container Registry
|
||||||
|
if: github.event_name != 'pull_request'
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ github.token }}
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.metal.outputs.tags }}
|
||||||
|
labels: ${{ steps.metal.outputs.labels }}
|
||||||
|
cache-from: type=gha
|
||||||
|
cache-to: type=gha,mode=max
|
26
.github/workflows/release.yml
vendored
Normal file
26
.github/workflows/release.yml
vendored
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
name: Release
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- 'v*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Set node
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 18
|
||||||
|
|
||||||
|
- run: npx changelogithub
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
|
@ -19,6 +19,6 @@ jobs:
|
||||||
name: Semantic Pull Request
|
name: Semantic Pull Request
|
||||||
steps:
|
steps:
|
||||||
- name: Validate PR title
|
- name: Validate PR title
|
||||||
uses: amannn/action-semantic-pull-request@v5.0.2
|
uses: amannn/action-semantic-pull-request@v5.4.0
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -2,14 +2,17 @@ node_modules
|
||||||
*.log
|
*.log
|
||||||
dist
|
dist
|
||||||
.output
|
.output
|
||||||
|
.pnpm-store
|
||||||
.nuxt
|
.nuxt
|
||||||
.env
|
.env
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.idea/
|
.idea/
|
||||||
.vite-inspect
|
.vite-inspect
|
||||||
.netlify/
|
.netlify/
|
||||||
|
.eslintcache
|
||||||
|
elk-translation-status.json
|
||||||
|
|
||||||
public/shiki
|
public/emojis
|
||||||
|
|
||||||
*~
|
*~
|
||||||
*swp
|
*swp
|
||||||
|
|
2
.npmrc
2
.npmrc
|
@ -1,3 +1,3 @@
|
||||||
shamefully-hoist=true
|
shamefully-hoist=true
|
||||||
strict-peer-dependencies=false
|
|
||||||
shell-emulator=true
|
shell-emulator=true
|
||||||
|
ignore-workspace-root-check=true
|
||||||
|
|
1
.nvmrc
Normal file
1
.nvmrc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
20
|
7
.stackblitz/codeflow.json
Normal file
7
.stackblitz/codeflow.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"bot": {
|
||||||
|
"issues": {
|
||||||
|
"trigger": "all-issues"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
61
.vscode/settings.json
vendored
61
.vscode/settings.json
vendored
|
@ -1,23 +1,62 @@
|
||||||
{
|
{
|
||||||
"prettier.enable": false,
|
|
||||||
"editor.codeActionsOnSave": {
|
|
||||||
"source.fixAll.eslint": true
|
|
||||||
},
|
|
||||||
"files.associations": {
|
|
||||||
"*.css": "postcss"
|
|
||||||
},
|
|
||||||
"editor.formatOnSave": false,
|
|
||||||
"cSpell.words": [
|
"cSpell.words": [
|
||||||
"masto",
|
"masto",
|
||||||
"Nuxtodon",
|
"Nuxtodon",
|
||||||
"unmute",
|
"unmute",
|
||||||
"unstorage"
|
"unstorage"
|
||||||
],
|
],
|
||||||
|
"files.associations": {
|
||||||
|
"*.css": "postcss"
|
||||||
|
},
|
||||||
|
"i18n-ally.keysInUse": [
|
||||||
|
"time_ago_options.*",
|
||||||
|
"visibility.*"
|
||||||
|
],
|
||||||
|
"i18n-ally.keystyle": "nested",
|
||||||
"i18n-ally.localesPaths": [
|
"i18n-ally.localesPaths": [
|
||||||
"locales"
|
"locales"
|
||||||
],
|
],
|
||||||
"i18n-ally.keystyle": "nested",
|
|
||||||
"i18n-ally.sourceLanguage": "en-US",
|
|
||||||
"i18n-ally.preferredDelimiter": "_",
|
"i18n-ally.preferredDelimiter": "_",
|
||||||
"i18n-ally.sortKeys": true
|
"i18n-ally.sortKeys": true,
|
||||||
|
"i18n-ally.sourceLanguage": "en",
|
||||||
|
|
||||||
|
// Enable the ESlint flat config support
|
||||||
|
"eslint.experimental.useFlatConfig": true,
|
||||||
|
|
||||||
|
// Disable the default formatter, use eslint instead
|
||||||
|
"prettier.enable": false,
|
||||||
|
"editor.formatOnSave": false,
|
||||||
|
|
||||||
|
// Auto fix
|
||||||
|
"editor.codeActionsOnSave": {
|
||||||
|
"source.fixAll": "explicit",
|
||||||
|
"source.organizeImports": "never"
|
||||||
|
},
|
||||||
|
|
||||||
|
// Silent the stylistic rules in you IDE, but still auto fix them
|
||||||
|
"eslint.rules.customizations": [
|
||||||
|
{ "rule": "style/*", "severity": "off" },
|
||||||
|
{ "rule": "*-indent", "severity": "off" },
|
||||||
|
{ "rule": "*-spacing", "severity": "off" },
|
||||||
|
{ "rule": "*-spaces", "severity": "off" },
|
||||||
|
{ "rule": "*-order", "severity": "off" },
|
||||||
|
{ "rule": "*-dangle", "severity": "off" },
|
||||||
|
{ "rule": "*-newline", "severity": "off" },
|
||||||
|
{ "rule": "*quotes", "severity": "off" },
|
||||||
|
{ "rule": "*semi", "severity": "off" }
|
||||||
|
],
|
||||||
|
|
||||||
|
// Enable eslint for all supported languages
|
||||||
|
"eslint.validate": [
|
||||||
|
"javascript",
|
||||||
|
"javascriptreact",
|
||||||
|
"typescript",
|
||||||
|
"typescriptreact",
|
||||||
|
"vue",
|
||||||
|
"html",
|
||||||
|
"markdown",
|
||||||
|
"json",
|
||||||
|
"jsonc",
|
||||||
|
"yaml"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
22
.woodpecker.yml
Normal file
22
.woodpecker.yml
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
steps:
|
||||||
|
- name: build docker
|
||||||
|
image: docker:25-cli
|
||||||
|
secrets: [user, pass]
|
||||||
|
commands:
|
||||||
|
- apk add git
|
||||||
|
- REPO=$(echo "$CI_REPO" | tr '[:upper:]' '[:lower:]')
|
||||||
|
- REGISTRY="dev.cat-enby.club"
|
||||||
|
- MAJOR=$(echo ${CI_COMMIT_TAG} | cut -d '.' -f 1 | tr -d 'v')
|
||||||
|
- MINOR=$(echo ${CI_COMMIT_TAG} | cut -d '.' -f 2)
|
||||||
|
- PATCH=$(echo ${CI_COMMIT_TAG} | cut -d '.' -f 3 | cut -d '-' -f 1)
|
||||||
|
- docker buildx build -t $${REGISTRY}/$${REPO}:v$${MAJOR:-0}.$${MINOR:-0}.$${PATCH-0} -t $${REGISTRY}/$${REPO}:v$${MAJOR:-0}.$${MINOR} -t $${REGISTRY}/$$REPO:v$${MAJOR:-0} -t $${REGISTRY}/$$REPO:latest .
|
||||||
|
- docker login --username $USER --password $PASS $${REGISTRY}
|
||||||
|
- docker push $${REGISTRY}/$${REPO}:v$${MAJOR:-0}.$${MINOR:-0}.$${PATCH-0}
|
||||||
|
- docker push $${REGISTRY}/$${REPO}:v$${MAJOR:-0}.$${MINOR}
|
||||||
|
- docker push $${REGISTRY}/$${REPO}:v$${MAJOR:-0}
|
||||||
|
- docker push $${REGISTRY}/$${REPO}:latest
|
||||||
|
volumes:
|
||||||
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
when:
|
||||||
|
- repo: nikurasu:elk-test-ci
|
||||||
|
- event: tag
|
45
CODE_OF_CONDUCT.md
Normal file
45
CODE_OF_CONDUCT.md
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
# Code Of Conduct
|
||||||
|
|
||||||
|
## Our Pledge
|
||||||
|
|
||||||
|
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, political party, or sexual identity and orientation. Note, however, that religion, political party, or other ideological affiliation provide no exemptions for the behavior we outline as unacceptable in this Code of Conduct.
|
||||||
|
|
||||||
|
## Our Standards
|
||||||
|
|
||||||
|
Examples of behavior that contributes to creating a positive environment include:
|
||||||
|
|
||||||
|
- Using welcoming and inclusive language
|
||||||
|
- Being respectful of differing viewpoints and experiences
|
||||||
|
- Gracefully accepting constructive criticism
|
||||||
|
- Focusing on what is best for the community
|
||||||
|
- Showing empathy towards other community members
|
||||||
|
|
||||||
|
Examples of unacceptable behavior by participants include:
|
||||||
|
|
||||||
|
- The use of sexualized language or imagery and unwelcome sexual attention or advances
|
||||||
|
- Trolling, insulting/derogatory comments, and personal or political attacks
|
||||||
|
- Public or private harassment
|
||||||
|
- Publishing others' private information, such as a physical or electronic address, without explicit permission
|
||||||
|
- Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||||
|
|
||||||
|
## Our Responsibilities
|
||||||
|
|
||||||
|
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
||||||
|
|
||||||
|
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
||||||
|
|
||||||
|
## Enforcement
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team by DM at [the Elk Discord](https://chat.elk.zone). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||||
|
|
||||||
|
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
||||||
|
|
||||||
|
## Attribution
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
||||||
|
|
||||||
|
[homepage]: https://www.contributor-covenant.org
|
189
CONTRIBUTING.md
Normal file
189
CONTRIBUTING.md
Normal file
|
@ -0,0 +1,189 @@
|
||||||
|
# Contributing Guide
|
||||||
|
|
||||||
|
Hi! We are excited that you are interested in contributing to Elk. Before submitting your contribution, please make sure to take a moment and read through the following guide.
|
||||||
|
|
||||||
|
Refer also to https://github.com/antfu/contribute.
|
||||||
|
|
||||||
|
For guidelines on contributing to the documentation, refer to the [docs README](./docs/README.md).
|
||||||
|
|
||||||
|
### Online
|
||||||
|
|
||||||
|
You can use [StackBlitz Codeflow](https://stackblitz.com/codeflow) to fix bugs or implement features. You'll also see a Codeflow button on PRs to review them without a local setup. Once the elk repo has been cloned in Codeflow, the dev server will start automatically and print the URL to open the App. You should receive a prompt in the bottom-right suggesting to open it in the Editor or in another Tab. To learn more, check out the [Codeflow docs](https://developer.stackblitz.com/codeflow/what-is-codeflow).
|
||||||
|
|
||||||
|
[![Open in Codeflow](https://developer.stackblitz.com/img/open_in_codeflow.svg)](https://pr.new/elk-zone/elk)
|
||||||
|
|
||||||
|
### Local Setup
|
||||||
|
|
||||||
|
To develop and test the Elk package:
|
||||||
|
|
||||||
|
1. Fork the Elk repository to your own GitHub account and then clone it to your local device.
|
||||||
|
|
||||||
|
2. Ensure using the latest Node.js (16.x).
|
||||||
|
If you have [nvm](https://github.com/nvm-sh/nvm), you can run `nvm i` to install the required version.
|
||||||
|
|
||||||
|
3. The package manager used to install and link dependencies must be [pnpm](https://pnpm.io/) v7. To use it you must first enable [Corepack](https://github.com/nodejs/corepack) by running `corepack enable`. (Note: on Linux in a standard Node 16+ environment, you should follow the instructions to install via Node's `corepack` rather than using the `curl` command)
|
||||||
|
|
||||||
|
4. Check out a branch where you can work and commit your changes:
|
||||||
|
```shell
|
||||||
|
git checkout -b my-new-branch
|
||||||
|
```
|
||||||
|
|
||||||
|
1. Run `pnpm i` in Elk's root folder
|
||||||
|
|
||||||
|
2. Run `pnpm nuxi prepare` in Elk's root folder
|
||||||
|
|
||||||
|
3. Run `pnpm dev` in Elk's root folder to start dev server or `pnpm dev:mocked` to start dev server with `@elkdev@universeodon.com` user.
|
||||||
|
|
||||||
|
We recommend installing [ni](https://github.com/antfu/ni#ni), that will use the right package manager in each of your projects. If `ni` is installed, you can instead run:
|
||||||
|
|
||||||
|
```
|
||||||
|
ni
|
||||||
|
nr dev
|
||||||
|
```
|
||||||
|
|
||||||
|
### Testing
|
||||||
|
|
||||||
|
Elk uses [Vitest](https://vitest.dev). You can run the test suite with:
|
||||||
|
|
||||||
|
```
|
||||||
|
nr test
|
||||||
|
```
|
||||||
|
|
||||||
|
### Running PWA on dev server
|
||||||
|
|
||||||
|
In order to run Elk with PWA enabled, run `pnpm dev:pwa` in Elk's root folder to start dev server or `pnpm dev:mocked:pwa` to start dev server with `@elkdev@universeodon.com` user.
|
||||||
|
|
||||||
|
You should test the Elk PWA application on private browsing mode on any Chromium-based browser: will not work on Firefox and Safari.
|
||||||
|
|
||||||
|
If not using private browsing mode, you will need to uninstall the PWA application from your browser once you finish testing:
|
||||||
|
- Open `Dev Tools` (`Option + ⌘ + J` on macOS, `Shift + CTRL + J` on Windows/Linux)
|
||||||
|
- Go to `Application > Storage`, you should check the following checkboxes:
|
||||||
|
- Application: [x] Unregister service worker
|
||||||
|
- Storage: [x] IndexedDB and [x] Local and session storage
|
||||||
|
- Cache: [x] Cache storage and [x] Application cache
|
||||||
|
- Click on `Clear site data` button
|
||||||
|
- Go to `Application > Service Workers` and check if the current `service worker` is missing or has the state `deleted` or `redundant`
|
||||||
|
|
||||||
|
## CI errors
|
||||||
|
|
||||||
|
Sometimes when you push your changes to create a new pull request (PR), the CI can fail, but we cannot check the logs to see what went wrong.
|
||||||
|
|
||||||
|
If you are getting **Semantic Pull Request** error, please check the [Semantic Pull Request](https://www.conventionalcommits.org/en/v1.0.0/#summary) documentation.
|
||||||
|
|
||||||
|
You can run the following commands on your local environment to fix CI errors:
|
||||||
|
- `pnpm test:unit` to run unit tests, maybe you also need to update snapshots
|
||||||
|
- `pnpm test:typecheck` to run TypeScript checks run on CI
|
||||||
|
|
||||||
|
## RTL Support
|
||||||
|
|
||||||
|
Elk supports `right-to-left` languages, we need to make sure that the UI is working correctly in both directions.
|
||||||
|
|
||||||
|
Simple approach used by most websites of relying on direction set in HTML element does not work because direction for various items, such as timeline, does not always match direction set in HTML.
|
||||||
|
|
||||||
|
We've added some `UnoCSS` utilities styles to help you with that:
|
||||||
|
- Do not use `left/right` padding and margin: for example `pl-1`. Use `padding-inline-start/end` instead. So `pl-1` should be `ps-1`, `pr-1` should be `pe-1`. The same rules apply to margin.
|
||||||
|
- Do not use `rtl-` classes, such as `rtl-left-0`.
|
||||||
|
- For icons that should be rotated for RTL, add `class="rtl-flip"`. This can only be used for icons outside of elements with `dir="auto"`, such as timeline, and is the only exception to the rule above. For icons inside the timeline, it might not work as expected.
|
||||||
|
- For absolute positioned elements, don't use `left/right`: for example `left-0`. Use `inset-inline-start/end` instead. `UnoCSS` shortcuts are `inset-is` for `inset-inline-start` and `inset-ie` for `inset-inline-end`. Example: `left-0` should be replaced with `inset-is-0`.
|
||||||
|
- If you need to change the border radius for an entire left or right side, use `border-inline-start/end`. `UnoCSS` shortcuts are `rounded-is` for left side, `rounded-ie` for right side. Example: `rounded-l-5` should be replaced with `rounded-ie-5`.
|
||||||
|
- If you need to change the border radius for one corner, use `border-start-end-radius` and similar rules. `UnoCSS` shortcuts are `rounded` + top/bottom as either `-bs` (top) or `-be` (bottom) + left/right as either `-is` (left) or `-ie` (right). Example: `rounded-tl-0` should be replaced with `rounded-bs-is-0`.
|
||||||
|
|
||||||
|
## Internationalization
|
||||||
|
|
||||||
|
We are using [vue-i18n](https://vue-i18n.intlify.dev/) via [nuxt-i18n](https://v8.i18n.nuxtjs.org/) to handle internationalization.
|
||||||
|
|
||||||
|
You can check the current [translation status](https://docs.elk.zone/docs/guide/contributing#translation-status): more instructions on the table caption.
|
||||||
|
|
||||||
|
If you are updating a translation in your local environment, you can run the following commands to check the status:
|
||||||
|
- from root folder: `nr prepare-translation-status`
|
||||||
|
- change to `docs` folder and run docs dev server `nr dev`
|
||||||
|
- open `http://localhost:3000/docs/guide/contributing#translation-status` in your browser
|
||||||
|
|
||||||
|
### Adding a new language
|
||||||
|
|
||||||
|
1. Add a new file in [locales](./locales) folder with the language code as the filename.
|
||||||
|
2. Copy [en](./locales/en.json) and translate the strings.
|
||||||
|
3. Add the language to the `locales` array in [config/i18n.ts](./config/i18n.ts#L61), below `en` and `ar`:
|
||||||
|
- If your language has multiple country variants, add the generic one for language only (only if there are a lot of common entries, you can always add it as a new one)
|
||||||
|
- Add all country variants in [country variants object](./config/i18n.ts#L12)
|
||||||
|
- Add all country variants files with empty `messages` object: `{}`
|
||||||
|
- Translate the strings in the generic language file
|
||||||
|
- Later, when anyone wants to add the corresponding translations for the country variant, just override any entry in the corresponding file: you can see an example with `en` variants.
|
||||||
|
- If the generic language already exists:
|
||||||
|
- If the translation doesn't differ from the generic language, then add the corresponding translations in the corresponding file
|
||||||
|
- If the translation differs from the generic language, then add the corresponding translations in the corresponding file and remove it from the country variants entry
|
||||||
|
4. If the language is `right-to-left`, add `dir` option with `rtl` value, for example, for [ar](./config/i18n.ts#L71)
|
||||||
|
5. If the language requires special pluralization rules, add `pluralRule` callback option, for example, for [ar](./config/i18n.ts#L72)
|
||||||
|
|
||||||
|
Check [Pluralization rule callback](https://vue-i18n.intlify.dev/guide/essentials/pluralization.html#custom-pluralization) for more info.
|
||||||
|
|
||||||
|
### Messages interpolation
|
||||||
|
|
||||||
|
Most of the messages used in Elk do not require any interpolation, however, some messages require interpolation: check [Message Format Syntax](https://vue-i18n.intlify.dev/guide/essentials/syntax.html) for more info.
|
||||||
|
|
||||||
|
We're using these types of interpolation:
|
||||||
|
- [List interpolation](https://vue-i18n.intlify.dev/guide/essentials/syntax.html#list-interpolation)
|
||||||
|
- [Named interpolation](https://vue-i18n.intlify.dev/guide/essentials/syntax.html#interpolations)
|
||||||
|
- [Linked messages](https://vue-i18n.intlify.dev/guide/essentials/syntax.html#linked-messages)
|
||||||
|
- [Literal interpolation](https://vue-i18n.intlify.dev/guide/essentials/syntax.html#literal-interpolation)
|
||||||
|
|
||||||
|
#### List interpolation
|
||||||
|
|
||||||
|
You can access the elements of the list using the object notation using the index: for example, `{0}` for the first element, `{1}` for the second, `{2}` for the third and so on.
|
||||||
|
|
||||||
|
#### Named interpolation
|
||||||
|
|
||||||
|
Elk will use named interpolation only to handle plurals for number formatting. We have 2 scenarios for this:
|
||||||
|
- using `plural` **with** `i18n-t` component
|
||||||
|
- using `plural` **without** `i18n-t` component
|
||||||
|
|
||||||
|
Check [Custom Plural Number Formatting Entries](#custom-plural-number-formatting-entries) for custom plural entries in Elk with available values for interpolation.
|
||||||
|
|
||||||
|
When using plural number formatting, we'll have always `{n}` available in the message, for example, `You have {n} new notifications|You have {n} new notification|You have {n} new notifications` or `You have no new notifications|You have 1 new notification|You have {n} new notifications`.
|
||||||
|
|
||||||
|
We've included `v` named parameter, it will be used to pass the formatted number using [Intl.NumberFormat::format](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/format): will be the number with separators symbols. The exception to the previous rule is when we're using `plural` **with** `i18n-t` component, in this case, we'll need to use `{0}` instead `{v}` to access the number.
|
||||||
|
|
||||||
|
Additionally, Elk will use [compact notation for numbers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#parameters) for some entries, check `notation` and `compactDisplay` options: for example, `1K` for `1000`, `1M` for `1000000`, `1B` for `1000000000` and so on. That entry will be available in the message using `{v}` named parameter (or `{0}` if using the message **with** `i18n-t` component).
|
||||||
|
|
||||||
|
You can run this code in your browser console to see how it works:
|
||||||
|
```ts
|
||||||
|
[1, 12, 123, 1234, 12345, 123456, 1234567].forEach((n) => {
|
||||||
|
const acc = {}
|
||||||
|
|
||||||
|
Array.from(['en-US', 'en-GB', 'de-DE', 'zh-CN', 'ja-JP', 'es-ES', 'fr-FR', 'cs-CZ', 'ar-EG']).forEach((l) => {
|
||||||
|
const nf = new Intl.NumberFormat(l, {
|
||||||
|
style: 'decimal',
|
||||||
|
maximumFractionDigits: 0,
|
||||||
|
})
|
||||||
|
const nf2 = new Intl.NumberFormat(l, {
|
||||||
|
notation: 'compact',
|
||||||
|
compactDisplay: 'short',
|
||||||
|
maximumFractionDigits: 1,
|
||||||
|
})
|
||||||
|
acc[l] = {
|
||||||
|
number: n,
|
||||||
|
format: nf.format(n),
|
||||||
|
compact: nf2.format(n),
|
||||||
|
}
|
||||||
|
})
|
||||||
|
console.table(acc)
|
||||||
|
})
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Custom Plural Number Formatting Entries
|
||||||
|
|
||||||
|
**Warning**:
|
||||||
|
Either **{0}** or **{v}** should be used with the exception being custom plurals entries using the `{n}` placeholder.
|
||||||
|
|
||||||
|
This is the full list of entries that will be available for number formatting in Elk:
|
||||||
|
- `action.boost_count` (no need to be included, we should use always `en-US` entry): `{0}` for formatted number and `{n}` for raw number - **{0} should be used**
|
||||||
|
- `action.favourite_count` (no need to be included, we should use always `en-US` entry): `{0}` for formatted number and `{n}` for raw number - **{0} should be used**
|
||||||
|
- `action.reply_count` (no need to be included, we should use always `en-US` entry): `{0}` for formatted number and `{n}` for raw number - **{0} should be used**
|
||||||
|
- `account.followers_count`: `{0}` for formatted number and `{n}` for raw number - **{0} should be used**
|
||||||
|
- `account.following_count`: `{0}` for formatted number and `{n}` for raw number - **{0} should be used**
|
||||||
|
- `account.posts_count`: `{0}` for formatted number and `{n}` for raw number - **{0} should be used**
|
||||||
|
- `compose.drafts`: `{v}` for formatted number and `{n}` for raw number - **{v} should be used**
|
||||||
|
- `notification.followed_you_count`: `{0}` for formatted number and `{n}` for raw number - **{0} should be used**
|
||||||
|
- `status.poll.count`: `{0}` for formatted number and `{n}` for raw number - **{0} should be used**
|
||||||
|
- `time_ago_options.*`: `{0}` for formatted number and `{n}` for raw number - **{0} should be used**: since numbers will be always small, we can also use `{n}`
|
||||||
|
- `timeline.show_new_items`: `{v}` for formatted number and `{n}` for raw number - **{v} should be used**
|
57
Dockerfile
Normal file
57
Dockerfile
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
FROM docker.io/library/node:lts-alpine AS base
|
||||||
|
|
||||||
|
# Prepare work directory
|
||||||
|
WORKDIR /elk
|
||||||
|
|
||||||
|
FROM base AS builder
|
||||||
|
|
||||||
|
# Prepare pnpm https://pnpm.io/installation#using-corepack
|
||||||
|
RUN corepack enable
|
||||||
|
|
||||||
|
# Prepare deps
|
||||||
|
RUN apk update
|
||||||
|
RUN apk add git --no-cache
|
||||||
|
|
||||||
|
# Prepare build deps ( ignore postinstall scripts for now )
|
||||||
|
COPY package.json ./
|
||||||
|
COPY .npmrc ./
|
||||||
|
COPY pnpm-lock.yaml ./
|
||||||
|
COPY patches ./patches
|
||||||
|
RUN pnpm i --frozen-lockfile --ignore-scripts
|
||||||
|
|
||||||
|
# Copy all source files
|
||||||
|
COPY . ./
|
||||||
|
|
||||||
|
# Run full install with every postinstall script ( This needs project file )
|
||||||
|
RUN pnpm i --frozen-lockfile
|
||||||
|
|
||||||
|
# Build
|
||||||
|
RUN pnpm build
|
||||||
|
|
||||||
|
FROM base AS runner
|
||||||
|
|
||||||
|
ARG UID=911
|
||||||
|
ARG GID=911
|
||||||
|
|
||||||
|
# Create a dedicated user and group
|
||||||
|
RUN set -eux; \
|
||||||
|
addgroup -g $GID elk; \
|
||||||
|
adduser -u $UID -D -G elk elk;
|
||||||
|
|
||||||
|
USER elk
|
||||||
|
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
|
COPY --from=builder /elk/.output ./.output
|
||||||
|
|
||||||
|
EXPOSE 5314/tcp
|
||||||
|
|
||||||
|
ENV PORT=5314
|
||||||
|
|
||||||
|
# Specify container only environment variables ( can be overwritten by runtime env )
|
||||||
|
ENV NUXT_STORAGE_FS_BASE='/elk/data'
|
||||||
|
|
||||||
|
# Persistent storage data
|
||||||
|
VOLUME [ "/elk/data" ]
|
||||||
|
|
||||||
|
CMD ["node", ".output/server/index.mjs"]
|
129
README.md
129
README.md
|
@ -1,35 +1,116 @@
|
||||||
# Elk
|
|
||||||
*A nimble Mastodon web client*
|
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://viteconf.org" target="_blank" rel="noopener noreferrer">
|
<a href="https://elk.zone" target="_blank" rel="noopener noreferrer">
|
||||||
<img width="180" src="https://elk.zone/logo.svg" alt="Vite logo">
|
<img width="160" height="160" src="./public/logo.svg" alt="Elk logo">
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
<h1 align="center"/>Elk <sup><em>alpha</em></sup></h1>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
A nimble Mastodon web client
|
||||||
|
</p>
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://chat.elk.zone"><img src="https://img.shields.io/badge/chat-discord-blue?style=flat&logo=discord" alt="discord chat"></a>
|
<a href="https://chat.elk.zone"><img src="https://img.shields.io/badge/chat-discord-blue?style=flat&logo=discord" alt="discord chat"></a>
|
||||||
<a href="https://pr.new/elk-zone/elk"><img src="https://developer.stackblitz.com/img/start_pr_dark_small.svg" alt="Start new PR in StackBlitz Codeflow"></a>
|
<a href="https://pr.new/elk-zone/elk"><img src="https://developer.stackblitz.com/img/start_pr_dark_small.svg" alt="Start new PR in StackBlitz Codeflow"></a>
|
||||||
|
<a href="https://volta.net/elk-zone/elk?utm_source=elk_readme"><img src="https://user-images.githubusercontent.com/904724/209143798-32345f6c-3cf8-4e06-9659-f4ace4a6acde.svg" alt="Open board on Volta"></a>
|
||||||
</p>
|
</p>
|
||||||
<br/>
|
<br/>
|
||||||
|
|
||||||
# Elk is in early alpha ⚠️
|
<p align="center">
|
||||||
|
<a href="https://elk.zone/" target="_blank" rel="noopener noreferrer" >
|
||||||
|
<img src="./public/elk-og.png" alt="Elk screenshots" width="600" height="auto">
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
|
||||||
It is already quite usable, but it isn't ready for wide adoption yet. We recommend you to use if if you would like to help us building it. We appreciate your feedback and contributions. Check out the [Open Issues](https://github.com/elk-zone/elk/issues) and jump in the action. Join the [Elk discord server](https://chat.elk.zone) to chat with us and learn more about the project.
|
## ⚠️ Elk is in Alpha
|
||||||
|
|
||||||
The client is deployed to [elk.zone](https://elk.zone), you can share screenshots on social media but we prefer you avoid sharing this URL directly until the app is more polished. Feel free to share the URL with your friedns and invite others you think could be interested in helping to improve Elk.
|
It is already quite usable, but it isn't ready for wide adoption yet. We recommend you use it if you would like to help us build it. We appreciate your feedback and contributions. Check out the [Open Issues](https://github.com/elk-zone/elk/issues) and jump in the action. Join the [Elk discord server](https://chat.elk.zone) to chat with us and learn more about the project.
|
||||||
|
|
||||||
# Contributing
|
## Deployment
|
||||||
|
|
||||||
|
### Official Deployment
|
||||||
|
|
||||||
|
The Elk team maintains a deployment at:
|
||||||
|
|
||||||
|
- 🦌 Production: [elk.zone](https://elk.zone)
|
||||||
|
- 🐙 Canary: [main.elk.zone](https://main.elk.zone) (deploys on every commit to `main` branch)
|
||||||
|
|
||||||
|
### Self-Host Docker Deployment
|
||||||
|
|
||||||
|
In order to host Elk yourself you can use the provided Dockerfile to build a container with elk. Be aware, that Elk only loads properly if the connection is done via SSL/TLS. The Docker container itself does not provide any SSL/TLS handling. You'll have to add this bit yourself.
|
||||||
|
One could put Elk behind popular reverse proxies with SSL Handling like Traefik, NGINX etc.
|
||||||
|
|
||||||
|
1. checkout source ```git clone https://github.com/elk-zone/elk.git```
|
||||||
|
1. got into new source dir: ```cd elk```
|
||||||
|
1. build Docker image: ```docker build .```
|
||||||
|
1. create local storage directory for settings: ```mkdir elk-storage```
|
||||||
|
1. adjust permissions of storage dir: ```sudo chown 911:911 ./elk-storage```
|
||||||
|
1. start container: ```docker-compose up -d```
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> The provided Dockerfile creates a container which will eventually run Elk as non-root user and create a persistent named Docker volume upon first start (if that volume does not yet exist). This volume is always created with root permission. Failing to change the permissions of ```/elk/data``` inside this volume to UID:GID 911 (as specified for Elk in the Dockerfile) will prevent Elk from storing it's config for user accounts. You either have to fix the permission in the created named volume, or mount a directory with the correct permission to ```/elk/data``` into the container.
|
||||||
|
|
||||||
|
### Ecosystem
|
||||||
|
|
||||||
|
These are known deployments using Elk as an alternative Web client for Mastodon servers or as a base for other projects in the fediverse:
|
||||||
|
|
||||||
|
- [elk.fedified.com](https://elk.fedified.com) - Use Elk to log into any compatible instance
|
||||||
|
- [elk.me.uk](https://elk.me.uk) - Use Elk to log into any compatible instance, hosted on Google Cloud Run with no Cloudflare proxy
|
||||||
|
- [elk.h4.io](https://elk.h4.io) - Use Elk for the `h4.io` Server
|
||||||
|
- [elk.universeodon.com](https://elk.universeodon.com) - Use Elk for the Universeodon Server
|
||||||
|
- [elk.vmst.io](https://elk.vmst.io) - Use Elk for the `vmst.io` Server
|
||||||
|
- [elk.hostux.social](https://elk.hostux.social) - Use Elk for the `hostux.social` Server
|
||||||
|
- [elk.cupoftea.social](https://elk.cupoftea.social) - Use Elk for the `cupoftea.social` Server
|
||||||
|
- [elk.aus.social](https://elk.aus.social) - Use Elk for the `aus.social` Server
|
||||||
|
- [elk.mstdn.ca](https://elk.mstdn.ca) - Use Elk for the `mstdn.ca` Server
|
||||||
|
- [elk.mastodonapp.uk](https://elk.mastodonapp.uk) - Use Elk for the `mastodonapp.uk` Server
|
||||||
|
- [elk.bolha.us](https://elk.bolha.us) - Use Elk for the `bolha.us` Server
|
||||||
|
|
||||||
|
> **Note**: Community deployments are **NOT** maintained by the Elk team. It may not be synced with Elk's source code. Please do your own research about the host servers before using them.
|
||||||
|
|
||||||
|
## 💖 Sponsors
|
||||||
|
|
||||||
|
We are grateful for the generous sponsorship and help of:
|
||||||
|
|
||||||
|
<a href="https://nuxtlabs.com/" target="_blank" rel="noopener noreferrer" >
|
||||||
|
<img src="./images/nuxtlabs.svg" alt="NuxtLabs" height="85">
|
||||||
|
</a>
|
||||||
|
<br><br>
|
||||||
|
<a href="https://stackblitz.com/" target="_blank" rel="noopener noreferrer" >
|
||||||
|
<img src="./images/stackblitz.svg" alt="StackBlitz" height="85">
|
||||||
|
</a>
|
||||||
|
<br><br>
|
||||||
|
|
||||||
|
And all the companies and individuals sponsoring Elk Team and the members. If you're enjoying the app, consider sponsoring us:
|
||||||
|
|
||||||
|
- [Elk Team's GitHub Sponsors](https://github.com/sponsors/elk-zone)
|
||||||
|
|
||||||
|
Or you can sponsor our core team members individually:
|
||||||
|
|
||||||
|
- [Anthony Fu](https://github.com/sponsors/antfu)
|
||||||
|
- [Daniel Roe](https://github.com/sponsors/danielroe)
|
||||||
|
- [三咲智子 Kevin Deng](https://github.com/sponsors/sxzz)
|
||||||
|
- [Patak](https://github.com/sponsors/patak-dev)
|
||||||
|
|
||||||
|
We would also appreciate sponsoring other contributors to the Elk project. If someone helps you solve an issue or implement a feature you wanted, supporting them would help make this project and OS more sustainable.
|
||||||
|
|
||||||
|
## 📍 Roadmap
|
||||||
|
|
||||||
|
[Open board on Volta](https://volta.net/elk-zone/elk)
|
||||||
|
|
||||||
|
## 🧑💻 Contributing
|
||||||
|
|
||||||
We're really excited that you're interested in contributing to Elk! Before submitting your contribution, please read through the following guide.
|
We're really excited that you're interested in contributing to Elk! Before submitting your contribution, please read through the following guide.
|
||||||
|
|
||||||
## Online
|
### Online
|
||||||
|
|
||||||
You can use [StackBlitz CodeFlow](https://stackblitz.com/codeflow) to fix bugs or implement features. You'll also see a CodeFlow button on PRs to review them without a local setup.
|
You can use [StackBlitz Codeflow](https://stackblitz.com/codeflow) to fix bugs or implement features. You'll also see a Codeflow button on PRs to review them without a local setup. Once the elk repo has been cloned in Codeflow, the dev server will start automatically and print the URL to open the App. You should receive a prompt in the bottom-right suggesting to open it in the Editor or in another Tab. To learn more, check out the [Codeflow docs](https://developer.stackblitz.com/codeflow/what-is-codeflow).
|
||||||
|
|
||||||
[![Open in Codeflow](https://developer.stackblitz.com/img/open_in_codeflow.svg)](https://pr.new/elk-zone/elk)
|
[![Open in Codeflow](https://developer.stackblitz.com/img/open_in_codeflow.svg)](https://pr.new/elk-zone/elk)
|
||||||
|
|
||||||
## Local Setup
|
### Local Setup
|
||||||
|
|
||||||
Clone the repository and run on the root folder:
|
Clone the repository and run on the root folder:
|
||||||
|
|
||||||
|
@ -38,6 +119,8 @@ pnpm i
|
||||||
pnpm run dev
|
pnpm run dev
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`Warning`: you will need `corepack` enabled, check out the [Elk Contributing Guide](./CONTRIBUTING.md) for a detailed guide on how to set up the project locally.
|
||||||
|
|
||||||
We recommend installing [ni](https://github.com/antfu/ni#ni), that will use the right package manager in each of your projects. If `ni` is installed, you can instead run:
|
We recommend installing [ni](https://github.com/antfu/ni#ni), that will use the right package manager in each of your projects. If `ni` is installed, you can instead run:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -45,7 +128,7 @@ ni
|
||||||
nr dev
|
nr dev
|
||||||
```
|
```
|
||||||
|
|
||||||
## Testing
|
### Testing
|
||||||
|
|
||||||
Elk uses [Vitest](https://vitest.dev). You can run the test suite with:
|
Elk uses [Vitest](https://vitest.dev). You can run the test suite with:
|
||||||
|
|
||||||
|
@ -53,7 +136,11 @@ Elk uses [Vitest](https://vitest.dev). You can run the test suite with:
|
||||||
nr test
|
nr test
|
||||||
```
|
```
|
||||||
|
|
||||||
# Stack
|
## 📲 PWA
|
||||||
|
|
||||||
|
You can consult the [PWA documentation](https://docs.elk.zone/pwa) to learn more about the PWA capabilities on Elk, how to install Elk PWA in your desktop or mobile device and some hints about PWA stuff on Elk.
|
||||||
|
|
||||||
|
## 🦄 Stack
|
||||||
|
|
||||||
- [Vite](https://vitejs.dev/) - Next Generation Frontend Tooling
|
- [Vite](https://vitejs.dev/) - Next Generation Frontend Tooling
|
||||||
- [Nuxt](https://nuxt.com/) - The Intuitive Web Framework
|
- [Nuxt](https://nuxt.com/) - The Intuitive Web Framework
|
||||||
|
@ -64,9 +151,15 @@ nr test
|
||||||
- [UnoCSS](https://uno.antfu.me/) - The instant on-demand atomic CSS engine
|
- [UnoCSS](https://uno.antfu.me/) - The instant on-demand atomic CSS engine
|
||||||
- [Iconify](https://github.com/iconify/icon-sets#iconify-icon-sets-in-json-format) - Iconify icon sets in JSON format
|
- [Iconify](https://github.com/iconify/icon-sets#iconify-icon-sets-in-json-format) - Iconify icon sets in JSON format
|
||||||
- [Masto.js](https://neet.github.io/masto.js) - Mastodon API client in TypeScript
|
- [Masto.js](https://neet.github.io/masto.js) - Mastodon API client in TypeScript
|
||||||
- [shiki](https://shiki.matsu.io/) - A beautiful Syntax Highlighter
|
- [shiki](https://shiki.style/) - A beautiful yet powerful syntax highlighter
|
||||||
- [vite-plugin-pwa](https://github.com/vite-pwa/vite-plugin-pwa) - Prompt for update and push notifications
|
- [vite-plugin-pwa](https://github.com/vite-pwa/vite-plugin-pwa) - Prompt for update, Web Push Notifications and Web Share Target API
|
||||||
|
|
||||||
# License
|
## 👨💻 Contributors
|
||||||
|
|
||||||
MIT
|
<a href="https://github.com/elk-zone/elk/graphs/contributors">
|
||||||
|
<img src="https://contrib.rocks/image?repo=elk-zone/elk" />
|
||||||
|
</a>
|
||||||
|
|
||||||
|
## 📄 License
|
||||||
|
|
||||||
|
[MIT](./LICENSE) © 2022-PRESENT Elk contributors
|
||||||
|
|
26
app.vue
26
app.vue
|
@ -1,8 +1,19 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
setupI18n()
|
|
||||||
setupPageHeader()
|
setupPageHeader()
|
||||||
provideGlobalCommands()
|
provideGlobalCommands()
|
||||||
|
|
||||||
|
const route = useRoute()
|
||||||
|
|
||||||
|
if (import.meta.server && !route.path.startsWith('/settings')) {
|
||||||
|
const url = useRequestURL()
|
||||||
|
|
||||||
|
useHead({
|
||||||
|
meta: [
|
||||||
|
{ property: 'og:url', content: `${url.origin}${route.path}` },
|
||||||
|
],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// We want to trigger rerendering the page when account changes
|
// We want to trigger rerendering the page when account changes
|
||||||
const key = computed(() => `${currentUser.value?.server ?? currentServer.value}:${currentUser.value?.account.id || ''}`)
|
const key = computed(() => `${currentUser.value?.server ?? currentServer.value}:${currentUser.value?.account.id || ''}`)
|
||||||
</script>
|
</script>
|
||||||
|
@ -10,7 +21,16 @@ const key = computed(() => `${currentUser.value?.server ?? currentServer.value}:
|
||||||
<template>
|
<template>
|
||||||
<NuxtLoadingIndicator color="repeating-linear-gradient(to right,var(--c-primary) 0%,var(--c-primary-active) 100%)" />
|
<NuxtLoadingIndicator color="repeating-linear-gradient(to right,var(--c-primary) 0%,var(--c-primary-active) 100%)" />
|
||||||
<NuxtLayout :key="key">
|
<NuxtLayout :key="key">
|
||||||
<NuxtPage v-if="isMastoInitialised" />
|
<NuxtPage />
|
||||||
</NuxtLayout>
|
</NuxtLayout>
|
||||||
<PWAPrompt />
|
<AriaAnnouncer />
|
||||||
|
|
||||||
|
<!-- Avatar Mask -->
|
||||||
|
<svg absolute op0 width="0" height="0">
|
||||||
|
<defs>
|
||||||
|
<clipPath id="avatar-mask" clipPathUnits="objectBoundingBox">
|
||||||
|
<path d="M 0,0.5 C 0,0 0,0 0.5,0 S 1,0 1,0.5 1,1 0.5,1 0,1 0,0.5" />
|
||||||
|
</clipPath>
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,43 +0,0 @@
|
||||||
<script setup>
|
|
||||||
import { usePWA } from '~/composables/pwa'
|
|
||||||
|
|
||||||
const { close, needRefresh, updateServiceWorker } = usePWA()
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<!-- TODO: remove shadow on mobile and position it above the bottom nav -->
|
|
||||||
<template>
|
|
||||||
<div
|
|
||||||
v-if="needRefresh"
|
|
||||||
role="alertdialog"
|
|
||||||
aria-labelledby="pwa-toast-title"
|
|
||||||
aria-describedby="pwa-toast-description"
|
|
||||||
animate animate-back-in-up md:animate-back-in-right
|
|
||||||
z11
|
|
||||||
fixed
|
|
||||||
bottom-14 md:bottom-0 right-0
|
|
||||||
m-2 p-4 w-100
|
|
||||||
bg-base border="~ base"
|
|
||||||
rounded
|
|
||||||
text-left
|
|
||||||
shadow
|
|
||||||
flex="~ gap-4"
|
|
||||||
>
|
|
||||||
<img src="/logo.svg" w-12 h-12 height="10" width="10" ma alt="logo">
|
|
||||||
<div>
|
|
||||||
<h2 id="pwa-toast-title" sr-only>
|
|
||||||
{{ $t('pwa.title') }}
|
|
||||||
</h2>
|
|
||||||
<div id="pwa-toast-message">
|
|
||||||
{{ $t('pwa.message') }}
|
|
||||||
</div>
|
|
||||||
<div mt2 flex="~ gap-4">
|
|
||||||
<button type="button" btn-solid px-4 py-1 text-center text-sm @click="updateServiceWorker()">
|
|
||||||
{{ $t('pwa.reload') }}
|
|
||||||
</button>
|
|
||||||
<button type="button" btn-outline filter-saturate-0 px-4 py-1 text-center text-sm @click="close">
|
|
||||||
{{ $t('pwa.dismiss') }}
|
|
||||||
</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</template>
|
|
|
@ -1,22 +1,27 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Account } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
account: Account
|
account: mastodon.v1.Account
|
||||||
|
square?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const loaded = $ref(false)
|
const loaded = ref(false)
|
||||||
const error = $ref(false)
|
const error = ref(false)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<img
|
<img
|
||||||
:key="account.avatar"
|
:key="account.avatar"
|
||||||
:src="error ? 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' : account.avatar"
|
width="400"
|
||||||
|
height="400"
|
||||||
|
select-none
|
||||||
|
:src="(error || !loaded) ? 'data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7' : account.avatar"
|
||||||
:alt="$t('account.avatar_description', [account.username])"
|
:alt="$t('account.avatar_description', [account.username])"
|
||||||
loading="lazy"
|
loading="lazy"
|
||||||
rounded-full
|
class="account-avatar"
|
||||||
:class="loaded ? 'bg-base' : 'bg-gray:10'"
|
:class="(loaded ? 'bg-base' : 'bg-gray:10') + (square ? ' ' : ' rounded-full')"
|
||||||
|
:style="{ 'clip-path': square ? `url(#avatar-mask)` : 'none' }"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
@load="loaded = true"
|
@load="loaded = true"
|
||||||
@error="error = true"
|
@error="error = true"
|
||||||
|
|
17
components/account/AccountBigAvatar.vue
Normal file
17
components/account/AccountBigAvatar.vue
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
|
// Avatar with a background base achieving a 3px border to be used in status cards
|
||||||
|
// The border is used for Avatar on Avatar for reblogs and connecting replies
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
account: mastodon.v1.Account
|
||||||
|
square?: boolean
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div :key="account.avatar" v-bind="$attrs" :style="{ 'clip-path': square ? `url(#avatar-mask)` : 'none' }" :class="{ 'rounded-full': !square }" bg-base w-54px h-54px flex items-center justify-center>
|
||||||
|
<AccountAvatar :account="account" w-48px h-48px :square="square" />
|
||||||
|
</div>
|
||||||
|
</template>
|
|
@ -1,15 +1,16 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { Account } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
const { account, as = 'div' } = $defineProps<{
|
|
||||||
account: Account
|
|
||||||
as?: string
|
|
||||||
}>()
|
|
||||||
|
|
||||||
cacheAccount(account)
|
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { account, as = 'div' } = defineProps<{
|
||||||
|
account: mastodon.v1.Account
|
||||||
|
as?: string
|
||||||
|
}>()
|
||||||
|
|
||||||
|
cacheAccount(account)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -24,37 +25,30 @@ defineOptions({
|
||||||
<!-- User info -->
|
<!-- User info -->
|
||||||
<div flex sm:flex-row flex-col flex-gap-2>
|
<div flex sm:flex-row flex-col flex-gap-2>
|
||||||
<div flex items-center justify-between>
|
<div flex items-center justify-between>
|
||||||
<div w-17 h-17 rounded-full border-4 border-bg-base z-2 mt--2 ml--1>
|
<div w-17 h-17 rounded-full border-4 border-bg-base z-2 mt--2 ms--1>
|
||||||
<AccountAvatar :account="account" />
|
<AccountAvatar :account="account" />
|
||||||
</div>
|
</div>
|
||||||
<a block sm:hidden href="javascript:;" @click.stop>
|
<NuxtLink block sm:hidden href="javascript:;" @click.stop>
|
||||||
<AccountFollowButton :account="account" />
|
<AccountFollowButton :account="account" />
|
||||||
</a>
|
</NuxtLink>
|
||||||
</div>
|
</div>
|
||||||
<div sm:mt-2>
|
<div sm:mt-2>
|
||||||
<div>
|
<AccountDisplayName :account="account" font-bold text-lg line-clamp-1 ws-pre-wrap break-all />
|
||||||
<ContentRich
|
|
||||||
font-bold text-lg line-clamp-1 ws-pre-wrap break-all
|
|
||||||
:content="getDisplayName(account, { rich: true })"
|
|
||||||
:emojis="account.emojis"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<AccountHandle text-sm :account="account" />
|
<AccountHandle text-sm :account="account" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- Note -->
|
<!-- Note -->
|
||||||
<div v-if="account.note">
|
<div v-if="account.note" max-h-100 overflow-y-auto>
|
||||||
<ContentRich
|
<ContentRich
|
||||||
:content="account.note" :emojis="account.emojis"
|
:content="account.note" :emojis="account.emojis"
|
||||||
line-clamp-2
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<!-- Follow info -->
|
<!-- Follow info -->
|
||||||
<div flex justify-between items-center>
|
<div flex justify-between items-center>
|
||||||
<AccountPostsFollowers text-sm :account="account" />
|
<AccountPostsFollowers text-sm :account="account" />
|
||||||
<a sm:block hidden href="javascript:;" @click.stop>
|
<NuxtLink sm:block hidden href="javascript:;" @click.stop>
|
||||||
<AccountFollowButton :account="account" />
|
<AccountFollowButton :account="account" />
|
||||||
</a>
|
</NuxtLink>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</component>
|
</component>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<!-- User info -->
|
<!-- User info -->
|
||||||
<div flex sm:flex-row flex-col flex-gap-2>
|
<div flex sm:flex-row flex-col flex-gap-2>
|
||||||
<div flex items-center justify-between>
|
<div flex items-center justify-between>
|
||||||
<div w-17 h-17 rounded-full border-4 border-bg-base z-2 mt--2 ml--1 of-hidden bg-base>
|
<div w-17 h-17 rounded-full border-4 border-bg-base z-2 mt--2 ms--1 of-hidden bg-base>
|
||||||
<div class="flex skeleton-loading-bg" w-full h-full />
|
<div class="flex skeleton-loading-bg" w-full h-full />
|
||||||
</div>
|
</div>
|
||||||
<div block sm:hidden class="skeleton-loading-bg" h-8 w-30 rounded-full />
|
<div block sm:hidden class="skeleton-loading-bg" h-8 w-30 rounded-full />
|
||||||
|
|
|
@ -1,5 +1,21 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
defineProps<{
|
||||||
|
showLabel?: boolean
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div flex="~" items-center border="~ base" text-secondary-light rounded-md px-1 text-xs my-auto>
|
<div
|
||||||
{{ $t('account.bot') }}
|
flex="~ gap1" items-center
|
||||||
|
:class="{ 'border border-base rounded-md px-1': showLabel }"
|
||||||
|
text-secondary-light
|
||||||
|
>
|
||||||
|
<slot name="prepend" />
|
||||||
|
<CommonTooltip no-auto-focus :content="$t('account.bot')" :disabled="showLabel">
|
||||||
|
<div i-mdi:robot-outline />
|
||||||
|
</CommonTooltip>
|
||||||
|
<div v-if="showLabel">
|
||||||
|
{{ $t('account.bot') }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Account } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
const { account } = defineProps<{
|
const { account } = defineProps<{
|
||||||
account: Account
|
account: mastodon.v1.Account
|
||||||
hoverCard?: boolean
|
hoverCard?: boolean
|
||||||
|
relationshipContext?: 'followedBy' | 'following'
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
cacheAccount(account)
|
cacheAccount(account)
|
||||||
|
@ -18,8 +19,10 @@ cacheAccount(account)
|
||||||
overflow-hidden
|
overflow-hidden
|
||||||
:to="getAccountRoute(account)"
|
:to="getAccountRoute(account)"
|
||||||
/>
|
/>
|
||||||
<div h-full p1 shrink-0>
|
<slot>
|
||||||
<AccountFollowButton :account="account" />
|
<div h-full p1 shrink-0>
|
||||||
</div>
|
<AccountFollowButton :account="account" :context="relationshipContext" />
|
||||||
|
</div>
|
||||||
|
</slot>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
17
components/account/AccountDisplayName.vue
Normal file
17
components/account/AccountDisplayName.vue
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
|
const { account, hideEmojis = false } = defineProps<{
|
||||||
|
account: mastodon.v1.Account
|
||||||
|
hideEmojis?: boolean
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<ContentRich
|
||||||
|
:content="getDisplayName(account, { rich: true })"
|
||||||
|
:emojis="account.emojis"
|
||||||
|
:hide-emojis="hideEmojis"
|
||||||
|
:markdown="false"
|
||||||
|
/>
|
||||||
|
</template>
|
|
@ -1,77 +1,71 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Account, Relationship } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
|
import { toggleFollowAccount, useRelationship } from '~~/composables/masto/relationship'
|
||||||
|
|
||||||
const { account, command, ...props } = defineProps<{
|
const { account, command, context, ...props } = defineProps<{
|
||||||
account: Account
|
account: mastodon.v1.Account
|
||||||
relationship?: Relationship
|
relationship?: mastodon.v1.Relationship
|
||||||
|
context?: 'followedBy' | 'following'
|
||||||
command?: boolean
|
command?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const isSelf = $computed(() => currentUser.value?.account.id === account.id)
|
const { t } = useI18n()
|
||||||
const enable = $computed(() => !isSelf && currentUser.value)
|
const isSelf = useSelfAccount(() => account)
|
||||||
const relationship = $computed(() => props.relationship || useRelationship(account).value)
|
const enable = computed(() => !isSelf.value && currentUser.value)
|
||||||
|
const relationship = computed(() => props.relationship || useRelationship(account).value)
|
||||||
|
const isLoading = computed(() => relationship.value === undefined)
|
||||||
|
|
||||||
async function toggleFollow() {
|
const { client } = useMasto()
|
||||||
relationship!.following = !relationship!.following
|
|
||||||
try {
|
|
||||||
const newRel = await useMasto().accounts[relationship!.following ? 'follow' : 'unfollow'](account.id)
|
|
||||||
Object.assign(relationship!, newRel)
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
// TODO error handling
|
|
||||||
relationship!.following = !relationship!.following
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function unblock() {
|
async function unblock() {
|
||||||
relationship!.blocking = false
|
relationship.value!.blocking = false
|
||||||
try {
|
try {
|
||||||
const newRel = await useMasto().accounts.unblock(account.id)
|
const newRel = await client.value.v1.accounts.$select(account.id).unblock()
|
||||||
Object.assign(relationship!, newRel)
|
Object.assign(relationship!, newRel)
|
||||||
}
|
}
|
||||||
catch {
|
catch (err) {
|
||||||
|
console.error(err)
|
||||||
// TODO error handling
|
// TODO error handling
|
||||||
relationship!.blocking = true
|
relationship.value!.blocking = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function unmute() {
|
async function unmute() {
|
||||||
relationship!.muting = false
|
relationship.value!.muting = false
|
||||||
try {
|
try {
|
||||||
const newRel = await useMasto().accounts.unmute(account.id)
|
const newRel = await client.value.v1.accounts.$select(account.id).unmute()
|
||||||
Object.assign(relationship!, newRel)
|
Object.assign(relationship!, newRel)
|
||||||
}
|
}
|
||||||
catch {
|
catch (err) {
|
||||||
|
console.error(err)
|
||||||
// TODO error handling
|
// TODO error handling
|
||||||
relationship!.muting = true
|
relationship.value!.muting = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const { t } = useI18n()
|
|
||||||
|
|
||||||
useCommand({
|
useCommand({
|
||||||
scope: 'Actions',
|
scope: 'Actions',
|
||||||
order: -2,
|
order: -2,
|
||||||
visible: () => command && enable,
|
visible: () => command && enable,
|
||||||
name: () => `${relationship?.following ? t('account.unfollow') : t('account.follow')} ${getShortHandle(account)}`,
|
name: () => `${relationship.value?.following ? t('account.unfollow') : t('account.follow')} ${getShortHandle(account)}`,
|
||||||
icon: 'i-ri:star-line',
|
icon: 'i-ri:star-line',
|
||||||
onActivate: () => toggleFollow(),
|
onActivate: () => toggleFollowAccount(relationship.value!, account),
|
||||||
})
|
})
|
||||||
|
|
||||||
const buttonStyle = $computed(() => {
|
const buttonStyle = computed(() => {
|
||||||
// Skeleton while loading, avoid primary color flash
|
if (relationship.value?.blocking)
|
||||||
if (!relationship)
|
|
||||||
return 'text-inverted'
|
|
||||||
|
|
||||||
if (relationship.blocking)
|
|
||||||
return 'text-inverted bg-red border-red'
|
return 'text-inverted bg-red border-red'
|
||||||
|
|
||||||
if (relationship.muting)
|
if (relationship.value?.muting)
|
||||||
return 'text-base bg-code border-base'
|
return 'text-base bg-card border-base'
|
||||||
|
|
||||||
// If following, use a label style with a strong border for Mutuals
|
// If following, use a label style with a strong border for Mutuals
|
||||||
if (relationship.following)
|
if (relationship.value ? relationship.value.following : context === 'following')
|
||||||
return `text-base ${relationship.followedBy ? 'border-strong' : 'border-base'}`
|
return `text-base ${relationship.value?.followedBy ? 'border-strong' : 'border-base'}`
|
||||||
|
|
||||||
|
// If loading, use a plain style
|
||||||
|
if (isLoading.value)
|
||||||
|
return 'text-base border-base'
|
||||||
|
|
||||||
// If not following, use a button style
|
// If not following, use a button style
|
||||||
return 'text-inverted bg-primary border-primary'
|
return 'text-inverted bg-primary border-primary'
|
||||||
|
@ -82,34 +76,39 @@ const buttonStyle = $computed(() => {
|
||||||
<button
|
<button
|
||||||
v-if="enable"
|
v-if="enable"
|
||||||
gap-1 items-center group
|
gap-1 items-center group
|
||||||
:disabled="relationship?.requested"
|
|
||||||
border-1
|
border-1
|
||||||
rounded-full flex="~ gap2 center" font-500 w-30 h-fit py1
|
rounded-full flex="~ gap2 center" font-500 min-w-30 h-fit px3 py1
|
||||||
:class="buttonStyle"
|
:class="buttonStyle"
|
||||||
:hover="!relationship?.blocking && !relationship?.muting && relationship?.following ? 'border-red text-red' : 'bg-base border-primary text-primary'"
|
:hover="!relationship?.blocking && !relationship?.muting && relationship?.following ? 'border-red text-red' : 'bg-base border-primary text-primary'"
|
||||||
@click="relationship?.blocking ? unblock() : relationship?.muting ? unmute() : toggleFollow()"
|
@click="relationship?.blocking ? unblock() : relationship?.muting ? unmute() : toggleFollowAccount(relationship!, account)"
|
||||||
>
|
>
|
||||||
<template v-if="relationship?.blocking">
|
<template v-if="isLoading">
|
||||||
<span group-hover="hidden">{{ $t('account.blocking') }}</span>
|
<span i-svg-spinners-180-ring-with-bg />
|
||||||
<span hidden group-hover="inline">{{ $t('account.unblock') }}</span>
|
|
||||||
</template>
|
|
||||||
<template v-if="relationship?.muting">
|
|
||||||
<span group-hover="hidden">{{ $t('account.muting') }}</span>
|
|
||||||
<span hidden group-hover="inline">{{ $t('account.unmute') }}</span>
|
|
||||||
</template>
|
|
||||||
<template v-else-if="relationship?.following">
|
|
||||||
<span group-hover="hidden">{{ relationship?.followedBy ? $t('account.mutuals') : $t('account.following') }}</span>
|
|
||||||
<span hidden group-hover="inline">{{ $t('account.unfollow') }}</span>
|
|
||||||
</template>
|
|
||||||
<template v-else-if="relationship?.requested">
|
|
||||||
<span>{{ $t('account.follow_requested') }}</span>
|
|
||||||
</template>
|
|
||||||
<template v-else-if="relationship?.followedBy">
|
|
||||||
<span group-hover="hidden">{{ $t('account.follows_you') }}</span>
|
|
||||||
<span hidden group-hover="inline">{{ $t('account.follow_back') }}</span>
|
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<span>{{ $t('account.follow') }}</span>
|
<template v-if="relationship?.blocking">
|
||||||
|
<span elk-group-hover="hidden">{{ $t('account.blocking') }}</span>
|
||||||
|
<span hidden elk-group-hover="inline">{{ $t('account.unblock') }}</span>
|
||||||
|
</template>
|
||||||
|
<template v-if="relationship?.muting">
|
||||||
|
<span elk-group-hover="hidden">{{ $t('account.muting') }}</span>
|
||||||
|
<span hidden elk-group-hover="inline">{{ $t('account.unmute') }}</span>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="relationship ? relationship.following : context === 'following'">
|
||||||
|
<span elk-group-hover="hidden">{{ relationship?.followedBy ? $t('account.mutuals') : $t('account.following') }}</span>
|
||||||
|
<span hidden elk-group-hover="inline">{{ $t('account.unfollow') }}</span>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="relationship?.requested">
|
||||||
|
<span elk-group-hover="hidden">{{ $t('account.follow_requested') }}</span>
|
||||||
|
<span hidden elk-group-hover="inline">{{ $t('account.withdraw_follow_request') }}</span>
|
||||||
|
</template>
|
||||||
|
<template v-else-if="relationship ? relationship.followedBy : context === 'followedBy'">
|
||||||
|
<span elk-group-hover="hidden">{{ $t('account.follows_you') }}</span>
|
||||||
|
<span hidden elk-group-hover="inline">{{ account.locked ? $t('account.request_follow') : $t('account.follow_back') }}</span>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<span>{{ account.locked ? $t('account.request_follow') : $t('account.follow') }}</span>
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
|
|
68
components/account/AccountFollowRequestButton.vue
Normal file
68
components/account/AccountFollowRequestButton.vue
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
|
const { account, ...props } = defineProps<{
|
||||||
|
account: mastodon.v1.Account
|
||||||
|
relationship?: mastodon.v1.Relationship
|
||||||
|
}>()
|
||||||
|
const relationship = computed(() => props.relationship || useRelationship(account).value)
|
||||||
|
const { client } = useMasto()
|
||||||
|
|
||||||
|
async function authorizeFollowRequest() {
|
||||||
|
relationship.value!.requestedBy = false
|
||||||
|
relationship.value!.followedBy = true
|
||||||
|
try {
|
||||||
|
const newRel = await client.value.v1.followRequests.$select(account.id).authorize()
|
||||||
|
Object.assign(relationship!, newRel)
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.error(err)
|
||||||
|
relationship.value!.requestedBy = true
|
||||||
|
relationship.value!.followedBy = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function rejectFollowRequest() {
|
||||||
|
relationship.value!.requestedBy = false
|
||||||
|
try {
|
||||||
|
const newRel = await client.value.v1.followRequests.$select(account.id).reject()
|
||||||
|
Object.assign(relationship!, newRel)
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.error(err)
|
||||||
|
relationship.value!.requestedBy = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div flex gap-4>
|
||||||
|
<template v-if="relationship?.requestedBy">
|
||||||
|
<CommonTooltip :content="$t('account.authorize')" no-auto-focus>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
rounded-full text-sm p2 border-1
|
||||||
|
hover:text-green transition-colors
|
||||||
|
@click="authorizeFollowRequest"
|
||||||
|
>
|
||||||
|
<span block text-current i-ri:check-fill />
|
||||||
|
</button>
|
||||||
|
</CommonTooltip>
|
||||||
|
<CommonTooltip :content="$t('account.reject')" no-auto-focus>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
rounded-full text-sm p2 border-1
|
||||||
|
hover:text-red transition-colors
|
||||||
|
@click="rejectFollowRequest"
|
||||||
|
>
|
||||||
|
<span block text-current i-ri:close-fill />
|
||||||
|
</button>
|
||||||
|
</CommonTooltip>
|
||||||
|
</template>
|
||||||
|
<template v-else>
|
||||||
|
<span text-secondary>
|
||||||
|
{{ relationship?.followedBy ? $t('account.authorized') : $t('account.rejected') }}
|
||||||
|
</span>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</template>
|
|
@ -1,15 +1,15 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Account } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
const { account } = defineProps<{
|
const { account } = defineProps<{
|
||||||
account: Account
|
account: mastodon.v1.Account
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const serverName = $computed(() => getServerName(account))
|
const serverName = computed(() => getServerName(account))
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<p line-clamp-1 whitespace-pre-wrap break-all text-secondary-light>
|
<p line-clamp-1 whitespace-pre-wrap break-all text-secondary-light leading-tight dir="ltr">
|
||||||
<!-- fix: #274 only line-clamp-1 can be used here, using text-ellipsis is not valid -->
|
<!-- fix: #274 only line-clamp-1 can be used here, using text-ellipsis is not valid -->
|
||||||
<span text-secondary>{{ getShortHandle(account) }}</span>
|
<span text-secondary>{{ getShortHandle(account) }}</span>
|
||||||
<span v-if="serverName" text-secondary-light>@{{ serverName }}</span>
|
<span v-if="serverName" text-secondary-light>@{{ serverName }}</span>
|
||||||
|
|
|
@ -1,30 +1,37 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Account, Field } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
const { account } = defineProps<{
|
const { account } = defineProps<{
|
||||||
account: Account
|
account: mastodon.v1.Account
|
||||||
command?: boolean
|
command?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const { client } = useMasto()
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
|
|
||||||
const createdAt = $(useFormattedDateTime(() => account.createdAt, {
|
const createdAt = useFormattedDateTime(() => account.createdAt, {
|
||||||
month: 'long',
|
month: 'long',
|
||||||
day: 'numeric',
|
day: 'numeric',
|
||||||
year: 'numeric',
|
year: 'numeric',
|
||||||
}))
|
})
|
||||||
|
|
||||||
const namedFields = ref<Field[]>([])
|
const relationship = useRelationship(account)
|
||||||
const iconFields = ref<Field[]>([])
|
|
||||||
|
const namedFields = ref<mastodon.v1.AccountField[]>([])
|
||||||
|
const iconFields = ref<mastodon.v1.AccountField[]>([])
|
||||||
|
const isEditingPersonalNote = ref<boolean>(false)
|
||||||
|
const hasHeader = computed(() => !account.header.endsWith('/original/missing.png'))
|
||||||
|
const isCopied = ref<boolean>(false)
|
||||||
|
|
||||||
function getFieldNameIcon(fieldName: string) {
|
|
||||||
const name = fieldName.trim().toLowerCase()
|
|
||||||
return ACCOUNT_FIELD_ICONS[name] || undefined
|
|
||||||
}
|
|
||||||
function getFieldIconTitle(fieldName: string) {
|
function getFieldIconTitle(fieldName: string) {
|
||||||
return fieldName === 'Joined' ? t('account.joined') : fieldName
|
return fieldName === 'Joined' ? t('account.joined') : fieldName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getNotificationIconTitle() {
|
||||||
|
return relationship.value?.notifying ? t('account.notifications_on_post_disable', { username: `@${account.username}` }) : t('account.notifications_on_post_enable', { username: `@${account.username}` })
|
||||||
|
}
|
||||||
|
|
||||||
function previewHeader() {
|
function previewHeader() {
|
||||||
openMediaPreview([{
|
openMediaPreview([{
|
||||||
id: `${account.acct}:header`,
|
id: `${account.acct}:header`,
|
||||||
|
@ -43,12 +50,24 @@ function previewAvatar() {
|
||||||
}])
|
}])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function toggleNotifications() {
|
||||||
|
relationship.value!.notifying = !relationship.value?.notifying
|
||||||
|
try {
|
||||||
|
const newRel = await client.value.v1.accounts.$select(account.id).follow({ notify: relationship.value?.notifying })
|
||||||
|
Object.assign(relationship!, newRel)
|
||||||
|
}
|
||||||
|
catch {
|
||||||
|
// TODO error handling
|
||||||
|
relationship.value!.notifying = !relationship.value?.notifying
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
const named: Field[] = []
|
const named: mastodon.v1.AccountField[] = []
|
||||||
const icons: Field[] = []
|
const icons: mastodon.v1.AccountField[] = []
|
||||||
|
|
||||||
account.fields?.forEach((field) => {
|
account.fields?.forEach((field) => {
|
||||||
const icon = getFieldNameIcon(field.name)
|
const icon = getAccountFieldIcon(field.name)
|
||||||
if (icon)
|
if (icon)
|
||||||
icons.push(field)
|
icons.push(field)
|
||||||
else
|
else
|
||||||
|
@ -56,66 +75,200 @@ watchEffect(() => {
|
||||||
})
|
})
|
||||||
icons.push({
|
icons.push({
|
||||||
name: 'Joined',
|
name: 'Joined',
|
||||||
value: createdAt,
|
value: createdAt.value,
|
||||||
})
|
})
|
||||||
|
|
||||||
namedFields.value = named
|
namedFields.value = named
|
||||||
iconFields.value = icons
|
iconFields.value = icons
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const personalNoteDraft = ref(relationship.value?.note ?? '')
|
||||||
|
watch(relationship, (relationship, oldValue) => {
|
||||||
|
if (!oldValue && relationship)
|
||||||
|
personalNoteDraft.value = relationship.note ?? ''
|
||||||
|
})
|
||||||
|
|
||||||
|
async function editNote(event: Event) {
|
||||||
|
if (!event.target || !('value' in event.target) || !relationship.value)
|
||||||
|
return
|
||||||
|
|
||||||
|
const newNote = event.target?.value as string
|
||||||
|
|
||||||
|
if (relationship.value.note?.trim() === newNote.trim())
|
||||||
|
return
|
||||||
|
|
||||||
|
const newNoteApiResult = await client.value.v1.accounts.$select(account.id).note.create({ comment: newNote })
|
||||||
|
relationship.value.note = newNoteApiResult.note
|
||||||
|
personalNoteDraft.value = relationship.value.note ?? ''
|
||||||
|
}
|
||||||
|
|
||||||
|
const isSelf = useSelfAccount(() => account)
|
||||||
|
const isNotifiedOnPost = computed(() => !!relationship.value?.notifying)
|
||||||
|
|
||||||
|
const personalNoteMaxLength = 2000
|
||||||
|
|
||||||
|
async function copyAccountName() {
|
||||||
|
try {
|
||||||
|
const shortHandle = getShortHandle(account)
|
||||||
|
const serverName = getServerName(account)
|
||||||
|
const accountName = `${shortHandle}@${serverName}`
|
||||||
|
await navigator.clipboard.writeText(accountName)
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.error('Failed to copy account name:', err)
|
||||||
|
}
|
||||||
|
|
||||||
|
isCopied.value = true
|
||||||
|
setTimeout(() => {
|
||||||
|
isCopied.value = false
|
||||||
|
}, 2000)
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div flex flex-col>
|
<div flex flex-col>
|
||||||
<button border="b base" z-1>
|
<div v-if="relationship?.requestedBy" p-4 flex justify-between items-center bg-card>
|
||||||
<img h-50 height="200" w-full object-cover :src="account.header" :alt="t('account.profile_description', [account.username])" @click="previewHeader">
|
<span text-primary font-bold>{{ $t('account.requested', [account.displayName]) }}</span>
|
||||||
</button>
|
<AccountFollowRequestButton :account="account" :relationship="relationship" />
|
||||||
|
</div>
|
||||||
|
<component :is="hasHeader ? 'button' : 'div'" border="b base" z-1 @click="hasHeader ? previewHeader() : undefined">
|
||||||
|
<img h-50 height="200" w-full object-cover :src="account.header" :alt="t('account.profile_description', [account.username])">
|
||||||
|
</component>
|
||||||
<div p4 mt--18 flex flex-col gap-4>
|
<div p4 mt--18 flex flex-col gap-4>
|
||||||
<div relative>
|
<div relative>
|
||||||
<div flex="~ col gap-2 1">
|
<div flex justify-between>
|
||||||
<button w-30 h-30 rounded-full border-4 border-bg-base z-2 @click="previewAvatar">
|
<button shrink-0 h-full :class="{ 'rounded-full': !isSelf, 'squircle': isSelf }" p1 bg-base border-bg-base z-2 @click="previewAvatar">
|
||||||
<AccountAvatar :account="account" hover:opacity-90 transition-opacity />
|
<AccountAvatar :square="isSelf" :account="account" hover:opacity-90 transition-opacity w-28 h-28 />
|
||||||
</button>
|
</button>
|
||||||
<div flex flex-col>
|
<div inset-ie-0 flex="~ wrap row-reverse" gap-2 items-center pt18 justify-start>
|
||||||
<div flex justify-between>
|
<!-- Edit profile -->
|
||||||
<ContentRich
|
<NuxtLink
|
||||||
font-bold sm:text-2xl text-xl
|
v-if="isSelf"
|
||||||
:content="getDisplayName(account, { rich: true })"
|
to="/settings/profile/appearance"
|
||||||
:emojis="account.emojis"
|
gap-1 items-center border="1" rounded-full flex="~ gap2 center" font-500 min-w-30 h-fit px3 py1
|
||||||
:markdown="false"
|
hover="border-primary text-primary bg-active"
|
||||||
|
>
|
||||||
|
{{ $t('settings.profile.appearance.title') }}
|
||||||
|
</NuxtLink>
|
||||||
|
<AccountFollowButton :account="account" :command="command" />
|
||||||
|
<span inset-ie-0 flex gap-2 items-center>
|
||||||
|
<AccountMoreButton
|
||||||
|
:account="account" :command="command"
|
||||||
|
@add-note="isEditingPersonalNote = true"
|
||||||
|
@remove-note="() => { isEditingPersonalNote = false; personalNoteDraft = '' }"
|
||||||
/>
|
/>
|
||||||
<AccountBotIndicator v-if="account.bot" />
|
<CommonTooltip v-if="!isSelf && relationship?.following" :content="getNotificationIconTitle()">
|
||||||
</div>
|
<button
|
||||||
<AccountHandle :account="account" />
|
:aria-pressed="isNotifiedOnPost"
|
||||||
|
:aria-label="t('account.notifications_on_post_enable', { username: `@${account.username}` })"
|
||||||
|
rounded-full text-sm p2 border-1 transition-colors
|
||||||
|
:class="isNotifiedOnPost ? 'text-primary border-primary hover:bg-red/20 hover:text-red hover:border-red' : 'border-base hover:text-primary'"
|
||||||
|
@click="toggleNotifications"
|
||||||
|
>
|
||||||
|
<span v-if="isNotifiedOnPost" i-ri:notification-4-fill block text-current />
|
||||||
|
<span v-else i-ri-notification-4-line block text-current />
|
||||||
|
</button>
|
||||||
|
</CommonTooltip>
|
||||||
|
<CommonTooltip :content="$t('list.modify_account')">
|
||||||
|
<VDropdown v-if="!isSelf && relationship?.following">
|
||||||
|
<button
|
||||||
|
:aria-label="$t('list.modify_account')"
|
||||||
|
rounded-full text-sm p2 border-1 transition-colors
|
||||||
|
border-base hover:text-primary
|
||||||
|
>
|
||||||
|
<span i-ri:play-list-add-fill block text-current />
|
||||||
|
</button>
|
||||||
|
<template #popper>
|
||||||
|
<ListLists :user-id="account.id" />
|
||||||
|
</template>
|
||||||
|
</VDropdown>
|
||||||
|
</CommonTooltip>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div absolute top-18 right-0 flex gap-2 items-center>
|
<div flex="~ col gap1" pt2>
|
||||||
<AccountMoreButton :account="account" :command="command" />
|
<div flex gap2 items-center flex-wrap>
|
||||||
<AccountFollowButton :account="account" :command="command" />
|
<AccountDisplayName :account="account" font-bold sm:text-2xl text-xl />
|
||||||
<!-- <button flex gap-1 items-center w-full rounded op75 hover="op100 text-purple" group>
|
<AccountRolesIndicator v-if="account.roles?.length" :account="account" />
|
||||||
<div rounded p2 group-hover="bg-rose/10">
|
<AccountLockIndicator v-if="account.locked" show-label />
|
||||||
<div i-ri:bell-line />
|
<AccountBotIndicator v-if="account.bot" show-label />
|
||||||
</div>
|
</div>
|
||||||
</button> -->
|
|
||||||
|
<div flex items-center gap-1>
|
||||||
|
<AccountHandle :account="account" overflow-unset line-clamp-unset />
|
||||||
|
<CommonTooltip placement="bottom" :content="$t('account.copy_account_name')" no-auto-focus flex>
|
||||||
|
<button text-secondary-light text-sm :class="isCopied ? 'i-ri:check-fill text-green' : 'i-ri:file-copy-line'" @click="copyAccountName">
|
||||||
|
<span sr-only>{{ $t('account.copy_account_name') }}</span>
|
||||||
|
</button>
|
||||||
|
</CommonTooltip>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="account.note">
|
<label
|
||||||
<ContentRich text-4 text-secondary :content="account.note" :emojis="account.emojis" />
|
v-if="isEditingPersonalNote || (relationship?.note && relationship.note.length > 0)"
|
||||||
|
space-y-2
|
||||||
|
pb-4
|
||||||
|
block
|
||||||
|
border="b base"
|
||||||
|
>
|
||||||
|
<div flex flex-row space-x-2 flex-v-center>
|
||||||
|
<div i-ri-edit-2-line />
|
||||||
|
<p font-medium>
|
||||||
|
{{ $t('account.profile_personal_note') }}
|
||||||
|
</p>
|
||||||
|
<p text-secondary text-sm :class="{ 'text-orange': personalNoteDraft.length > (personalNoteMaxLength - 100) }">
|
||||||
|
{{ personalNoteDraft.length }} / {{ personalNoteMaxLength }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div position-relative>
|
||||||
|
<div
|
||||||
|
input-base
|
||||||
|
min-h-10ex
|
||||||
|
whitespace-pre-wrap
|
||||||
|
opacity-0
|
||||||
|
:class="{ 'trailing-newline': personalNoteDraft.endsWith('\n') }"
|
||||||
|
>
|
||||||
|
{{ personalNoteDraft }}
|
||||||
|
</div>
|
||||||
|
<textarea
|
||||||
|
v-model="personalNoteDraft"
|
||||||
|
input-base
|
||||||
|
position-absolute
|
||||||
|
style="height: 100%"
|
||||||
|
top-0
|
||||||
|
resize-none
|
||||||
|
:maxlength="personalNoteMaxLength"
|
||||||
|
@change="editNote"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</label>
|
||||||
|
<div v-if="account.note" max-h-100 overflow-y-auto>
|
||||||
|
<ContentRich text-4 text-base :content="account.note" :emojis="account.emojis" />
|
||||||
</div>
|
</div>
|
||||||
<div v-if="namedFields.length" flex="~ col wrap gap1">
|
<div v-if="namedFields.length" flex="~ col wrap gap1">
|
||||||
<div v-for="field in namedFields" :key="field.name" flex="~ gap-1" items-center>
|
<div v-for="field in namedFields" :key="field.name" flex="~ gap-1" items-center>
|
||||||
<div text-secondary uppercase text-xs font-bold>
|
<div mt="0.5" text-secondary uppercase text-xs font-bold>
|
||||||
{{ field.name }} |
|
<ContentRich :content="field.name" :emojis="account.emojis" />
|
||||||
</div>
|
</div>
|
||||||
|
<span text-secondary text-xs font-bold>|</span>
|
||||||
<ContentRich :content="field.value" :emojis="account.emojis" />
|
<ContentRich :content="field.value" :emojis="account.emojis" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="iconFields.length" flex="~ wrap gap-4">
|
<div v-if="iconFields.length" flex="~ wrap gap-2">
|
||||||
<div v-for="field in iconFields" :key="field.name" flex="~ gap-1" items-center>
|
<div v-for="field in iconFields" :key="field.name" flex="~ gap-1" px1 items-center :class="`${field.verifiedAt ? 'border-1 rounded-full border-dark' : ''}`">
|
||||||
<div text-secondary :class="getFieldNameIcon(field.name)" :title="getFieldIconTitle(field.name)" />
|
<CommonTooltip :content="getFieldIconTitle(field.name)">
|
||||||
<ContentRich text-sm filter-saturate-0 :content="field.value" :emojis="account.emojis" />
|
<div text-secondary :class="getAccountFieldIcon(field.name)" :title="getFieldIconTitle(field.name)" />
|
||||||
|
</CommonTooltip>
|
||||||
|
<ContentRich text-sm :content="field.value" :emojis="account.emojis" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<AccountPostsFollowers :account="account" />
|
<AccountPostsFollowers :account="account" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.trailing-newline::after {
|
||||||
|
content: '\a';
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
|
@ -1,22 +1,24 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Account } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
const { account } = defineProps<{
|
const { account } = defineProps<{
|
||||||
account: Account
|
account: mastodon.v1.Account
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const relationship = $(useRelationship(account))
|
const relationship = useRelationship(account)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div v-show="relationship" flex="~ col gap2" rounded min-w-90 max-w-120 z-100 overflow-hidden p-4>
|
<div v-show="relationship" flex="~ col gap2" rounded min-w-90 max-w-120 z-100 overflow-hidden p-4>
|
||||||
<div flex="~ gap2" items-center>
|
<div flex="~ gap2" items-center>
|
||||||
<NuxtLink :to="getAccountRoute(account)" flex-auto rounded-full hover:bg-active transition-100 pr5 mr-a>
|
<NuxtLink :to="getAccountRoute(account)" flex-auto rounded-full hover:bg-active transition-100 pe5 me-a>
|
||||||
<AccountInfo :account="account" />
|
<AccountInfo :account="account" />
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
<AccountFollowButton text-sm :account="account" :relationship="relationship" />
|
<AccountFollowButton text-sm :account="account" :relationship="relationship" />
|
||||||
</div>
|
</div>
|
||||||
<ContentRich text-4 text-secondary :content="account.note" :emojis="account.emojis" />
|
<div v-if="account.note" max-h-100 overflow-y-auto>
|
||||||
<AccountPostsFollowers text-sm :account="account" />
|
<ContentRich text-4 text-secondary :content="account.note" :emojis="account.emojis" />
|
||||||
|
</div>
|
||||||
|
<AccountPostsFollowers text-sm :account="account" :is-hover-card="true" />
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,24 +1,69 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Account } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
|
import { fetchAccountByHandle } from '~/composables/cache'
|
||||||
|
|
||||||
|
type WatcherType = [acc?: mastodon.v1.Account | null, h?: string, v?: boolean]
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
inheritAttrs: false,
|
||||||
|
})
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
account?: Account
|
account?: mastodon.v1.Account | null
|
||||||
handle?: string
|
handle?: string
|
||||||
disabled?: boolean
|
disabled?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const account = props.account || (props.handle ? useAccountByHandle(props.handle!) : undefined)
|
const accountHover = ref()
|
||||||
defineOptions({
|
const hovered = useElementHover(accountHover)
|
||||||
inheritAttrs: false,
|
const account = ref<mastodon.v1.Account | null | undefined>(props.account)
|
||||||
})
|
|
||||||
|
watch(
|
||||||
|
() => [props.account, props.handle, hovered.value] satisfies WatcherType,
|
||||||
|
([newAccount, newHandle, newVisible], oldProps) => {
|
||||||
|
if (!newVisible || process.test)
|
||||||
|
return
|
||||||
|
|
||||||
|
if (newAccount) {
|
||||||
|
account.value = newAccount
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newHandle) {
|
||||||
|
const [_oldAccount, oldHandle, _oldVisible] = oldProps ?? [undefined, undefined, false]
|
||||||
|
if (!oldHandle || newHandle !== oldHandle || !account.value) {
|
||||||
|
// new handle can be wrong: using server instead of webDomain
|
||||||
|
fetchAccountByHandle(newHandle).then((acc) => {
|
||||||
|
if (newHandle === props.handle)
|
||||||
|
account.value = acc
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
account.value = undefined
|
||||||
|
},
|
||||||
|
{ immediate: true, flush: 'post' },
|
||||||
|
)
|
||||||
|
|
||||||
|
const userSettings = useUserSettings()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VMenu v-if="!disabled && account" placement="bottom-start" :delay="{ show: 500, hide: 100 }" v-bind="$attrs" :close-on-content-click="false">
|
<span ref="accountHover">
|
||||||
<slot />
|
<VMenu
|
||||||
<template #popper>
|
v-if="!disabled && account && !getPreferences(userSettings, 'hideAccountHoverCard')"
|
||||||
<AccountHoverCard v-if="account" :account="account" />
|
placement="bottom-start"
|
||||||
</template>
|
:delay="{ show: 500, hide: 100 }"
|
||||||
</VMenu>
|
v-bind="$attrs"
|
||||||
<slot v-else />
|
:close-on-content-click="false"
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
<template #popper>
|
||||||
|
<AccountHoverCard v-if="account" :account="account" />
|
||||||
|
</template>
|
||||||
|
</VMenu>
|
||||||
|
<slot v-else />
|
||||||
|
</span>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,34 +1,33 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Account } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
const { account, as = 'div' } = defineProps<{
|
|
||||||
account: Account
|
|
||||||
as?: string
|
|
||||||
hoverCard?: boolean
|
|
||||||
}>()
|
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
inheritAttrs: false,
|
inheritAttrs: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const { account, as = 'div' } = defineProps<{
|
||||||
|
account: mastodon.v1.Account
|
||||||
|
as?: string
|
||||||
|
hoverCard?: boolean
|
||||||
|
square?: boolean
|
||||||
|
}>()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<!-- TODO: Make this work for both buttons and links -->
|
<!-- TODO: Make this work for both buttons and links -->
|
||||||
<!-- This is sometimes (like in the sidebar) used directly as a button, and sometimes, like in follow notifications, as a link. I think this component may need a second refactor that either lets an implementation pass in a link or an action and adapt to what's passed in, or the implementations need to be updated to wrap in the action they want to take and this be just the layout for these items -->
|
<!-- This is sometimes (like in the sidebar) used directly as a button, and sometimes, like in follow notifications, as a link. I think this component may need a second refactor that either lets an implementation pass in a link or an action and adapt to what's passed in, or the implementations need to be updated to wrap in the action they want to take and this be just the layout for these items -->
|
||||||
<template>
|
<template>
|
||||||
<component :is="as" flex gap-3 v-bind="$attrs">
|
<component :is="as" flex gap-3 v-bind="$attrs">
|
||||||
<AccountHoverWrapper :disabled="!hoverCard" :account="account" shrink-0>
|
<AccountHoverWrapper :disabled="!hoverCard" :account="account">
|
||||||
<AccountAvatar :account="account" w-12 h-12 />
|
<AccountBigAvatar :account="account" shrink-0 :square="square" />
|
||||||
</AccountHoverWrapper>
|
</AccountHoverWrapper>
|
||||||
<div flex="~ col" shrink overflow-hidden>
|
<div flex="~ col" shrink pt-1 h-full overflow-hidden justify-center leading-none select-none>
|
||||||
<div flex="~" gap-2>
|
<div flex="~" gap-2>
|
||||||
<ContentRich
|
<AccountDisplayName :account="account" font-bold line-clamp-1 ws-pre-wrap break-all text-lg />
|
||||||
font-bold line-clamp-1 ws-pre-wrap break-all
|
<AccountRolesIndicator v-if="account.roles?.length" :account="account" :limit="1" />
|
||||||
:content="getDisplayName(account, { rich: true })"
|
<AccountLockIndicator v-if="account.locked" text-xs />
|
||||||
:emojis="account.emojis"
|
<AccountBotIndicator v-if="account.bot" text-xs />
|
||||||
/>
|
|
||||||
<AccountBotIndicator v-if="account.bot" />
|
|
||||||
</div>
|
</div>
|
||||||
<AccountHandle :account="account" text-sm text-secondary-light />
|
<AccountHandle :account="account" text-secondary-light />
|
||||||
</div>
|
</div>
|
||||||
</component>
|
</component>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,26 +1,31 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Account } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
const { link = true, avatar = true } = defineProps<{
|
const { link = true, avatar = true } = defineProps<{
|
||||||
account: Account
|
account: mastodon.v1.Account
|
||||||
link?: boolean
|
link?: boolean
|
||||||
avatar?: boolean
|
avatar?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const userSettings = useUserSettings()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script lang="ts">
|
||||||
|
export default {
|
||||||
|
inheritAttrs: false,
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<AccountHoverWrapper :account="account">
|
<AccountHoverWrapper :account="account">
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
:to="link ? getAccountRoute(account) : undefined"
|
:to="link ? getAccountRoute(account) : undefined"
|
||||||
:class="link ? 'text-link-rounded ml-0 pl-0' : ''"
|
:class="link ? 'text-link-rounded -ml-1.5rem pl-1.5rem rtl-(ml0 pl-0.5rem -mr-1.5rem pr-1.5rem)' : ''"
|
||||||
|
v-bind="$attrs"
|
||||||
min-w-0 flex gap-2 items-center
|
min-w-0 flex gap-2 items-center
|
||||||
>
|
>
|
||||||
<AccountAvatar v-if="avatar" :account="account" w-5 h-5 />
|
<AccountAvatar v-if="avatar" :account="account" w-5 h-5 />
|
||||||
<ContentRich
|
<AccountDisplayName :account="account" :hide-emojis="getPreferences(userSettings, 'hideUsernameEmojis')" line-clamp-1 ws-pre-wrap break-all />
|
||||||
line-clamp-1 ws-pre-wrap break-all
|
|
||||||
:content="getDisplayName(account, { rich: true })"
|
|
||||||
:emojis="account.emojis"
|
|
||||||
/>
|
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</AccountHoverWrapper>
|
</AccountHoverWrapper>
|
||||||
</template>
|
</template>
|
||||||
|
|
23
components/account/AccountLockIndicator.vue
Normal file
23
components/account/AccountLockIndicator.vue
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
defineProps<{
|
||||||
|
showLabel?: boolean
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div
|
||||||
|
flex="~ gap1" items-center
|
||||||
|
:class="{ 'border border-base rounded-md px-1': showLabel }"
|
||||||
|
text-secondary-light
|
||||||
|
>
|
||||||
|
<slot name="prepend" />
|
||||||
|
<CommonTooltip no-auto-focus content="Lock" :disabled="showLabel">
|
||||||
|
<div i-ri:lock-line />
|
||||||
|
</CommonTooltip>
|
||||||
|
<div v-if="showLabel">
|
||||||
|
{{ t('account.lock') }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
|
@ -1,44 +1,63 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Account } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
|
import { toggleBlockAccount, toggleBlockDomain, toggleMuteAccount } from '~~/composables/masto/relationship'
|
||||||
|
|
||||||
const { account } = defineProps<{
|
const { account } = defineProps<{
|
||||||
account: Account
|
account: mastodon.v1.Account
|
||||||
command?: boolean
|
command?: boolean
|
||||||
}>()
|
}>()
|
||||||
let relationship = $(useRelationship(account))
|
const emit = defineEmits<{
|
||||||
|
(evt: 'addNote'): void
|
||||||
|
(evt: 'removeNote'): void
|
||||||
|
}>()
|
||||||
|
|
||||||
const isSelf = $computed(() => currentUser.value?.account.id === account.id)
|
const relationship = useRelationship(account)
|
||||||
|
|
||||||
const toggleMute = async () => {
|
const isSelf = useSelfAccount(() => account)
|
||||||
// TODO: Add confirmation
|
|
||||||
|
|
||||||
relationship!.muting = !relationship!.muting
|
const { t } = useI18n()
|
||||||
relationship = relationship!.muting
|
const { client } = useMasto()
|
||||||
? await useMasto().accounts.mute(account.id, {
|
const useStarFavoriteIcon = usePreferences('useStarFavoriteIcon')
|
||||||
// TODO support more options
|
const { share, isSupported: isShareSupported } = useShare()
|
||||||
|
|
||||||
|
function shareAccount() {
|
||||||
|
share({ url: location.href })
|
||||||
|
}
|
||||||
|
|
||||||
|
async function toggleReblogs() {
|
||||||
|
if (!relationship.value!.showingReblogs) {
|
||||||
|
const dialogChoice = await openConfirmDialog({
|
||||||
|
title: t('confirm.show_reblogs.title'),
|
||||||
|
description: t('confirm.show_reblogs.description', [account.acct]),
|
||||||
|
confirm: t('confirm.show_reblogs.confirm'),
|
||||||
|
cancel: t('confirm.show_reblogs.cancel'),
|
||||||
})
|
})
|
||||||
: await useMasto().accounts.unmute(account.id)
|
if (dialogChoice.choice !== 'confirm')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const showingReblogs = !relationship.value?.showingReblogs
|
||||||
|
relationship.value = await client.value.v1.accounts.$select(account.id).follow({ reblogs: showingReblogs })
|
||||||
}
|
}
|
||||||
|
|
||||||
const toggleBlockUser = async () => {
|
async function addUserNote() {
|
||||||
// TODO: Add confirmation
|
emit('addNote')
|
||||||
|
|
||||||
relationship!.blocking = !relationship!.blocking
|
|
||||||
relationship = await useMasto().accounts[relationship!.blocking ? 'block' : 'unblock'](account.id)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const toggleBlockDomain = async () => {
|
async function removeUserNote() {
|
||||||
// TODO: Add confirmation
|
if (!relationship.value!.note || relationship.value!.note.length === 0)
|
||||||
|
return
|
||||||
|
|
||||||
relationship!.domainBlocking = !relationship!.domainBlocking
|
const newNote = await client.value.v1.accounts.$select(account.id).note.create({ comment: '' })
|
||||||
await useMasto().domainBlocks[relationship!.domainBlocking ? 'block' : 'unblock'](getServerName(account))
|
relationship.value!.note = newNote.note
|
||||||
|
emit('removeNote')
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CommonDropdown :eager-mount="command">
|
<CommonDropdown :eager-mount="command">
|
||||||
<button flex gap-1 items-center w-full rounded op75 hover="op100 text-purple" group aria-label="More actions">
|
<button flex gap-1 items-center w-full rounded op75 hover="op100 text-purple" group aria-label="More actions">
|
||||||
<div rounded-5 p2 group-hover="bg-purple/10">
|
<div rounded-5 p2 elk-group-hover="bg-purple/10">
|
||||||
<div i-ri:more-2-fill />
|
<div i-ri:more-2-fill />
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
@ -51,6 +70,13 @@ const toggleBlockDomain = async () => {
|
||||||
:command="command"
|
:command="command"
|
||||||
/>
|
/>
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
|
<CommonDropdownItem
|
||||||
|
v-if="isShareSupported"
|
||||||
|
:text="$t('menu.share_account', [`@${account.acct}`])"
|
||||||
|
icon="i-ri:share-line"
|
||||||
|
:command="command"
|
||||||
|
@click="shareAccount()"
|
||||||
|
/>
|
||||||
|
|
||||||
<template v-if="currentUser">
|
<template v-if="currentUser">
|
||||||
<template v-if="!isSelf">
|
<template v-if="!isSelf">
|
||||||
|
@ -67,19 +93,49 @@ const toggleBlockDomain = async () => {
|
||||||
@click="directMessageUser(account)"
|
@click="directMessageUser(account)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<CommonDropdownItem
|
||||||
|
v-if="!relationship?.showingReblogs"
|
||||||
|
icon="i-ri:repeat-line"
|
||||||
|
:text="$t('menu.show_reblogs', [`@${account.acct}`])"
|
||||||
|
:command="command"
|
||||||
|
@click="toggleReblogs()"
|
||||||
|
/>
|
||||||
|
<CommonDropdownItem
|
||||||
|
v-else
|
||||||
|
:text="$t('menu.hide_reblogs', [`@${account.acct}`])"
|
||||||
|
icon="i-ri:repeat-line"
|
||||||
|
:command="command"
|
||||||
|
@click="toggleReblogs()"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<CommonDropdownItem
|
||||||
|
v-if="!relationship?.note || relationship?.note?.length === 0"
|
||||||
|
:text="$t('menu.add_personal_note', [`@${account.acct}`])"
|
||||||
|
icon="i-ri-edit-2-line"
|
||||||
|
:command="command"
|
||||||
|
@click="addUserNote()"
|
||||||
|
/>
|
||||||
|
<CommonDropdownItem
|
||||||
|
v-else
|
||||||
|
:text="$t('menu.remove_personal_note', [`@${account.acct}`])"
|
||||||
|
icon="i-ri-edit-2-line"
|
||||||
|
:command="command"
|
||||||
|
@click="removeUserNote()"
|
||||||
|
/>
|
||||||
|
|
||||||
<CommonDropdownItem
|
<CommonDropdownItem
|
||||||
v-if="!relationship?.muting"
|
v-if="!relationship?.muting"
|
||||||
:text="$t('menu.mute_account', [`@${account.acct}`])"
|
:text="$t('menu.mute_account', [`@${account.acct}`])"
|
||||||
icon="i-ri:volume-up-fill"
|
icon="i-ri:volume-mute-line"
|
||||||
:command="command"
|
:command="command"
|
||||||
@click="toggleMute"
|
@click="toggleMuteAccount (relationship!, account)"
|
||||||
/>
|
/>
|
||||||
<CommonDropdownItem
|
<CommonDropdownItem
|
||||||
v-else
|
v-else
|
||||||
:text="$t('menu.unmute_account', [`@${account.acct}`])"
|
:text="$t('menu.unmute_account', [`@${account.acct}`])"
|
||||||
icon="i-ri:volume-mute-line"
|
icon="i-ri:volume-up-fill"
|
||||||
:command="command"
|
:command="command"
|
||||||
@click="toggleMute"
|
@click="toggleMuteAccount (relationship!, account)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<CommonDropdownItem
|
<CommonDropdownItem
|
||||||
|
@ -87,14 +143,14 @@ const toggleBlockDomain = async () => {
|
||||||
:text="$t('menu.block_account', [`@${account.acct}`])"
|
:text="$t('menu.block_account', [`@${account.acct}`])"
|
||||||
icon="i-ri:forbid-2-line"
|
icon="i-ri:forbid-2-line"
|
||||||
:command="command"
|
:command="command"
|
||||||
@click="toggleBlockUser"
|
@click="toggleBlockAccount (relationship!, account)"
|
||||||
/>
|
/>
|
||||||
<CommonDropdownItem
|
<CommonDropdownItem
|
||||||
v-else
|
v-else
|
||||||
:text="$t('menu.unblock_account', [`@${account.acct}`])"
|
:text="$t('menu.unblock_account', [`@${account.acct}`])"
|
||||||
icon="i-ri:checkbox-circle-line"
|
icon="i-ri:checkbox-circle-line"
|
||||||
:command="command"
|
:command="command"
|
||||||
@click="toggleBlockUser"
|
@click="toggleBlockAccount (relationship!, account)"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<template v-if="getServerName(account) !== currentServer">
|
<template v-if="getServerName(account) !== currentServer">
|
||||||
|
@ -103,16 +159,23 @@ const toggleBlockDomain = async () => {
|
||||||
:text="$t('menu.block_domain', [getServerName(account)])"
|
:text="$t('menu.block_domain', [getServerName(account)])"
|
||||||
icon="i-ri:shut-down-line"
|
icon="i-ri:shut-down-line"
|
||||||
:command="command"
|
:command="command"
|
||||||
@click="toggleBlockDomain"
|
@click="toggleBlockDomain(relationship!, account)"
|
||||||
/>
|
/>
|
||||||
<CommonDropdownItem
|
<CommonDropdownItem
|
||||||
v-else
|
v-else
|
||||||
:text="$t('menu.unblock_domain', [getServerName(account)])"
|
:text="$t('menu.unblock_domain', [getServerName(account)])"
|
||||||
icon="i-ri:restart-line"
|
icon="i-ri:restart-line"
|
||||||
:command="command"
|
:command="command"
|
||||||
@click="toggleBlockDomain"
|
@click="toggleBlockDomain(relationship!, account)"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<CommonDropdownItem
|
||||||
|
:text="$t('menu.report_account', [`@${account.acct}`])"
|
||||||
|
icon="i-ri:flag-2-line"
|
||||||
|
:command="command"
|
||||||
|
@click="openReportDialog(account)"
|
||||||
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template v-else>
|
<template v-else>
|
||||||
|
@ -120,7 +183,7 @@ const toggleBlockDomain = async () => {
|
||||||
<CommonDropdownItem :text="$t('account.pinned')" icon="i-ri:pushpin-line" :command="command" />
|
<CommonDropdownItem :text="$t('account.pinned')" icon="i-ri:pushpin-line" :command="command" />
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
<NuxtLink to="/favourites">
|
<NuxtLink to="/favourites">
|
||||||
<CommonDropdownItem :text="$t('account.favourites')" icon="i-ri:heart-3-line" :command="command" />
|
<CommonDropdownItem :text="$t('account.favourites')" :icon="useStarFavoriteIcon ? 'i-ri:star-line' : 'i-ri:heart-3-line'" :command="command" />
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
<NuxtLink to="/mutes">
|
<NuxtLink to="/mutes">
|
||||||
<CommonDropdownItem :text="$t('account.muted_users')" icon="i-ri:volume-mute-line" :command="command" />
|
<CommonDropdownItem :text="$t('account.muted_users')" icon="i-ri:volume-mute-line" :command="command" />
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Account } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
account: Account
|
account: mastodon.v1.Account
|
||||||
}>()
|
}>()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -14,15 +14,13 @@ defineProps<{
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div flex>
|
<div flex>
|
||||||
<NuxtLink :to="getAccountRoute(account.moved as any)">
|
<NuxtLink :to="getAccountRoute(account.moved!)">
|
||||||
<AccountInfo :account="account.moved" />
|
<AccountInfo :account="account.moved!" />
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
<div flex-auto />
|
<div flex-auto />
|
||||||
<div flex items-center>
|
<div flex items-center>
|
||||||
<NuxtLink :to="getAccountRoute(account.moved as any)">
|
<NuxtLink :to="getAccountRoute(account.moved as any)" btn-solid inline-block h-fit>
|
||||||
<button btn-solid h-fit>
|
{{ $t('account.go_to_profile') }}
|
||||||
{{ $t('account.go_to_profile') }}
|
|
||||||
</button>
|
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,9 +1,19 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Account, Paginator } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
const { paginator } = defineProps<{
|
const { paginator, account, context } = defineProps<{
|
||||||
paginator: Paginator<any, Account[]>
|
paginator: mastodon.Paginator<mastodon.v1.Account[], mastodon.DefaultPaginationParams | undefined>
|
||||||
|
context?: 'following' | 'followers'
|
||||||
|
account?: mastodon.v1.Account
|
||||||
|
relationshipContext?: 'followedBy' | 'following'
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const fallbackContext = computed(() => {
|
||||||
|
return ['following', 'followers'].includes(context!)
|
||||||
|
})
|
||||||
|
const showOriginSite = computed(() =>
|
||||||
|
account && account.id !== currentUser.value?.account.id && getServerName(account) !== currentServer.value,
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -11,9 +21,23 @@ const { paginator } = defineProps<{
|
||||||
<template #default="{ item }">
|
<template #default="{ item }">
|
||||||
<AccountCard
|
<AccountCard
|
||||||
:account="item"
|
:account="item"
|
||||||
|
:relationship-context="relationshipContext"
|
||||||
hover-card
|
hover-card
|
||||||
border="b base" py2 px4
|
border="b base" py2 px4
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-if="fallbackContext && showOriginSite" #done>
|
||||||
|
<div p5 text-secondary text-center flex flex-col items-center gap1>
|
||||||
|
<span italic>{{ $t(`account.view_other_${context}`) }}</span>
|
||||||
|
<NuxtLink
|
||||||
|
:href="account!.url" target="_blank" external
|
||||||
|
flex="~ gap-1" items-center text-primary
|
||||||
|
hover="underline text-primary-active"
|
||||||
|
>
|
||||||
|
<div i-ri:external-link-fill />
|
||||||
|
{{ $t('menu.open_in_original_site') }}
|
||||||
|
</NuxtLink>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
</CommonPaginator>
|
</CommonPaginator>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,65 +1,77 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Account } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
const props = defineProps<{
|
defineProps<{
|
||||||
account: Account
|
account: mastodon.v1.Account
|
||||||
|
isHoverCard?: boolean
|
||||||
}>()
|
}>()
|
||||||
const { formatHumanReadableNumber, formatNumber, forSR } = useHumanReadableNumber()
|
|
||||||
|
|
||||||
const statusesCount = $computed(() => formatHumanReadableNumber(props.account.statusesCount))
|
const userSettings = useUserSettings()
|
||||||
const statusesCountSR = $computed(() => forSR(props.account.statusesCount))
|
|
||||||
const followingCount = $computed(() => formatHumanReadableNumber(props.account.followingCount))
|
|
||||||
const followingCountSR = $computed(() => forSR(props.account.followingCount))
|
|
||||||
const followersCount = $computed(() => formatHumanReadableNumber(props.account.followersCount))
|
|
||||||
const followersCountSR = $computed(() => forSR(props.account.followersCount))
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div flex gap-5>
|
<div flex gap-5>
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
:to="getAccountRoute(account)"
|
:to="getAccountRoute(account)"
|
||||||
|
replace
|
||||||
text-secondary
|
text-secondary
|
||||||
exact-active-class="text-primary"
|
exact-active-class="text-primary"
|
||||||
:class="statusesCountSR ? 'flex gap-x-1' : null"
|
|
||||||
>
|
>
|
||||||
<template #default="{ isExactActive }">
|
<template #default="{ isExactActive }">
|
||||||
<i18n-t keypath="account.posts_count" :plural="account.statusesCount">
|
<CommonLocalizedNumber
|
||||||
<CommonTooltip v-if="statusesCountSR" :content="formatNumber(account.statusesCount)" placement="bottom">
|
keypath="account.posts_count"
|
||||||
<span aria-hidden="true" font-bold :class="isExactActive ? 'text-primary' : 'text-base'">{{ statusesCount }}</span>
|
:count="account.statusesCount"
|
||||||
<span sr-only font-bold>{{ account.statusesCount }}</span>
|
font-bold
|
||||||
</CommonTooltip>
|
:class="isExactActive ? 'text-primary' : 'text-base'"
|
||||||
<span v-else font-bold :class="isExactActive ? 'text-primary' : 'text-base'">{{ statusesCount }}</span>
|
/>
|
||||||
</i18n-t>
|
|
||||||
</template>
|
</template>
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
|
v-if="!(isHoverCard && getPreferences(userSettings, 'hideFollowerCount'))"
|
||||||
:to="getAccountFollowingRoute(account)"
|
:to="getAccountFollowingRoute(account)"
|
||||||
|
replace
|
||||||
text-secondary exact-active-class="text-primary"
|
text-secondary exact-active-class="text-primary"
|
||||||
:class="followingCountSR ? 'flex gap-x-1' : null"
|
|
||||||
>
|
>
|
||||||
<template #default="{ isExactActive }">
|
<template #default="{ isExactActive }">
|
||||||
<i18n-t keypath="account.following_count" :plural="account.followingCount">
|
<template
|
||||||
<CommonTooltip v-if="followingCountSR" :content="formatNumber(account.followingCount)" placement="bottom">
|
v-if="!getPreferences(userSettings, 'hideFollowerCount')"
|
||||||
<span aria-hidden="true" font-bold :class="isExactActive ? 'text-primary' : 'text-base'">{{ followingCount }}</span>
|
>
|
||||||
<span sr-only font-bold>{{ account.followingCount }}</span>
|
<CommonLocalizedNumber
|
||||||
</CommonTooltip>
|
v-if="account.followingCount >= 0"
|
||||||
<span v-else font-bold :class="isExactActive ? 'text-primary' : 'text-base'">{{ followingCount }}</span>
|
keypath="account.following_count"
|
||||||
</i18n-t>
|
:count="account.followingCount"
|
||||||
|
font-bold
|
||||||
|
:class="isExactActive ? 'text-primary' : 'text-base'"
|
||||||
|
/>
|
||||||
|
<div v-else flex gap-x-1>
|
||||||
|
<span font-bold text-base>Hidden</span>
|
||||||
|
<span>{{ $t('account.following') }}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<span v-else>{{ $t('account.following') }}</span>
|
||||||
</template>
|
</template>
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
<NuxtLink
|
<NuxtLink
|
||||||
|
v-if="!(isHoverCard && getPreferences(userSettings, 'hideFollowerCount'))"
|
||||||
:to="getAccountFollowersRoute(account)"
|
:to="getAccountFollowersRoute(account)"
|
||||||
text-secondary exact-active-class="text-primary"
|
replace text-secondary
|
||||||
:class="followersCountSR ? 'flex gap-x-1' : null"
|
exact-active-class="text-primary"
|
||||||
>
|
>
|
||||||
<template #default="{ isExactActive }">
|
<template #default="{ isExactActive }">
|
||||||
<i18n-t keypath="account.followers_count" :plural="account.followersCount">
|
<template v-if="!getPreferences(userSettings, 'hideFollowerCount')">
|
||||||
<CommonTooltip v-if="followersCountSR" :content="formatNumber(account.followersCount)" placement="bottom">
|
<CommonLocalizedNumber
|
||||||
<span aria-hidden="true" font-bold :class="isExactActive ? 'text-primary' : 'text-base'">{{ followersCount }}</span>
|
v-if="account.followersCount >= 0"
|
||||||
<span sr-only font-bold>{{ account.followersCount }}</span>
|
keypath="account.followers_count"
|
||||||
</CommonTooltip>
|
:count="account.followersCount"
|
||||||
<span v-else font-bold :class="isExactActive ? 'text-primary' : 'text-base'">{{ followersCount }}</span>
|
font-bold
|
||||||
</i18n-t>
|
:class="isExactActive ? 'text-primary' : 'text-base'"
|
||||||
|
/>
|
||||||
|
<div v-else flex gap-x-1>
|
||||||
|
<span font-bold text-base>Hidden</span>
|
||||||
|
<span>{{ $t('account.followers') }}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<span v-else>{{ $t('account.followers') }}</span>
|
||||||
</template>
|
</template>
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</div>
|
</div>
|
||||||
|
|
31
components/account/AccountRolesIndicator.vue
Normal file
31
components/account/AccountRolesIndicator.vue
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
|
defineProps<{
|
||||||
|
account: mastodon.v1.Account
|
||||||
|
limit?: number
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div
|
||||||
|
flex="~ gap1" items-center
|
||||||
|
class="border border-base rounded-md px-1"
|
||||||
|
text-secondary-light
|
||||||
|
>
|
||||||
|
<slot name="prepend" />
|
||||||
|
<div v-for="role in account.roles?.slice(0, limit)" :key="role.id" flex>
|
||||||
|
<div :style="`color: ${role.color}; border-color: ${role.color}`">
|
||||||
|
{{ role.name }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="limit && account.roles?.length > limit"
|
||||||
|
flex="~ gap1" items-center
|
||||||
|
class="border border-base rounded-md px-1"
|
||||||
|
text-secondary-light
|
||||||
|
>
|
||||||
|
+{{ account.roles?.length - limit }}
|
||||||
|
</div>
|
||||||
|
</template>
|
|
@ -1,16 +1,18 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import type { CommonRouteTabOption } from '~/types'
|
||||||
|
|
||||||
const { t } = useI18n()
|
const { t } = useI18n()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
const server = $(computedEager(() => route.params.server as string))
|
const server = computed(() => route.params.server as string)
|
||||||
const account = $(computedEager(() => route.params.account as string))
|
const account = computed(() => route.params.account as string)
|
||||||
|
|
||||||
const tabs = $computed(() => [
|
const tabs = computed<CommonRouteTabOption[]>(() => [
|
||||||
{
|
{
|
||||||
name: 'account-index',
|
name: 'account-index',
|
||||||
to: {
|
to: {
|
||||||
name: 'account-index',
|
name: 'account-index',
|
||||||
params: { server, account },
|
params: { server: server.value, account: account.value },
|
||||||
},
|
},
|
||||||
display: t('tab.posts'),
|
display: t('tab.posts'),
|
||||||
icon: 'i-ri:file-list-2-line',
|
icon: 'i-ri:file-list-2-line',
|
||||||
|
@ -19,23 +21,23 @@ const tabs = $computed(() => [
|
||||||
name: 'account-replies',
|
name: 'account-replies',
|
||||||
to: {
|
to: {
|
||||||
name: 'account-replies',
|
name: 'account-replies',
|
||||||
params: { server, account },
|
params: { server: server.value, account: account.value },
|
||||||
},
|
},
|
||||||
display: t('tab.posts_with_replies'),
|
display: t('tab.posts_with_replies'),
|
||||||
icon: 'i-ri:chat-3-line',
|
icon: 'i-ri:chat-1-line',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'account-media',
|
name: 'account-media',
|
||||||
to: {
|
to: {
|
||||||
name: 'account-media',
|
name: 'account-media',
|
||||||
params: { server, account },
|
params: { server: server.value, account: account.value },
|
||||||
},
|
},
|
||||||
display: t('tab.media'),
|
display: t('tab.media'),
|
||||||
icon: 'i-ri:camera-2-line',
|
icon: 'i-ri:camera-2-line',
|
||||||
},
|
},
|
||||||
] as const)
|
])
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CommonRouteTabs force :options="tabs" prevent-scroll-top command />
|
<CommonRouteTabs force replace :options="tabs" prevent-scroll-top command border="base b" />
|
||||||
</template>
|
</template>
|
||||||
|
|
45
components/account/TagHoverWrapper.vue
Normal file
45
components/account/TagHoverWrapper.vue
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
inheritAttrs: false,
|
||||||
|
})
|
||||||
|
|
||||||
|
const { tagName, disabled } = defineProps<{
|
||||||
|
tagName?: string
|
||||||
|
disabled?: boolean
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const tag = ref<mastodon.v1.Tag>()
|
||||||
|
const tagHover = ref()
|
||||||
|
const hovered = useElementHover(tagHover)
|
||||||
|
|
||||||
|
watch(hovered, (newHovered) => {
|
||||||
|
if (newHovered && tagName) {
|
||||||
|
fetchTag(tagName).then((t) => {
|
||||||
|
tag.value = t
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const userSettings = useUserSettings()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<span ref="tagHover">
|
||||||
|
<VMenu
|
||||||
|
v-if="!disabled && !getPreferences(userSettings, 'hideTagHoverCard')"
|
||||||
|
placement="bottom-start"
|
||||||
|
:delay="{ show: 500, hide: 100 }"
|
||||||
|
v-bind="$attrs"
|
||||||
|
:close-on-content-click="false"
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
<template #popper>
|
||||||
|
<TagCardSkeleton v-if="!tag" />
|
||||||
|
<TagCard v-else :tag="tag" />
|
||||||
|
</template>
|
||||||
|
</VMenu>
|
||||||
|
<slot v-else />
|
||||||
|
</span>
|
||||||
|
</template>
|
55
components/aria/AriaAnnouncer.vue
Normal file
55
components/aria/AriaAnnouncer.vue
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { LocaleObject } from '@nuxtjs/i18n'
|
||||||
|
import type { AriaAnnounceType, AriaLive } from '~/composables/aria'
|
||||||
|
|
||||||
|
const router = useRouter()
|
||||||
|
const { t, locale, locales } = useI18n()
|
||||||
|
const { ariaAnnouncer, announce } = useAriaAnnouncer()
|
||||||
|
|
||||||
|
const localeMap = (locales.value as LocaleObject[]).reduce((acc, l) => {
|
||||||
|
acc[l.code!] = l.name!
|
||||||
|
return acc
|
||||||
|
}, {} as Record<string, string>)
|
||||||
|
|
||||||
|
const ariaLive = ref<AriaLive>('polite')
|
||||||
|
const ariaMessage = ref<string>('')
|
||||||
|
|
||||||
|
function onMessage(event: AriaAnnounceType, message?: string) {
|
||||||
|
if (event === 'announce')
|
||||||
|
ariaMessage.value = message!
|
||||||
|
else if (event === 'mute')
|
||||||
|
ariaLive.value = 'off'
|
||||||
|
else
|
||||||
|
ariaLive.value = 'polite'
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(locale, (l, ol) => {
|
||||||
|
if (ol) {
|
||||||
|
announce(t('a11y.locale_changing', [localeMap[ol] ?? ol]))
|
||||||
|
setTimeout(() => {
|
||||||
|
announce(t('a11y.locale_changed', [localeMap[l] ?? l]))
|
||||||
|
}, 1000)
|
||||||
|
}
|
||||||
|
}, { immediate: true })
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
ariaAnnouncer.on(onMessage)
|
||||||
|
router.beforeEach(() => {
|
||||||
|
announce(t('a11y.loading_page'))
|
||||||
|
})
|
||||||
|
router.afterEach((to, from) => {
|
||||||
|
from && setTimeout(() => {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
const title = document.title.trim().split('|')
|
||||||
|
announce(t('a11y.route_loaded', [title[0]]))
|
||||||
|
})
|
||||||
|
}, 512)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<p sr-only role="status" :aria-live="ariaLive">
|
||||||
|
{{ ariaMessage }}
|
||||||
|
</p>
|
||||||
|
</template>
|
39
components/aria/AriaLog.vue
Normal file
39
components/aria/AriaLog.vue
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { AriaLive } from '~/composables/aria'
|
||||||
|
|
||||||
|
// tsc complaining when using $defineProps
|
||||||
|
withDefaults(defineProps<{
|
||||||
|
title: string
|
||||||
|
ariaLive?: AriaLive
|
||||||
|
messageKey?: (message: any) => any
|
||||||
|
heading?: 'h2' | 'h3' | 'h4' | 'h5' | 'h6'
|
||||||
|
}>(), {
|
||||||
|
heading: 'h2',
|
||||||
|
messageKey: (message: any) => message,
|
||||||
|
ariaLive: 'polite',
|
||||||
|
})
|
||||||
|
|
||||||
|
const { announceLogs, appendLogs, clearLogs, logs } = useAriaLog()
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
announceLogs,
|
||||||
|
appendLogs,
|
||||||
|
clearLogs,
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<slot />
|
||||||
|
<div sr-only role="log" :aria-live="ariaLive">
|
||||||
|
<component :is="heading">
|
||||||
|
{{ title }}
|
||||||
|
</component>
|
||||||
|
<ul>
|
||||||
|
<li v-for="log in logs" :key="messageKey(log)">
|
||||||
|
<slot name="log" :log="log">
|
||||||
|
{{ log }}
|
||||||
|
</slot>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</template>
|
26
components/aria/AriaStatus.vue
Normal file
26
components/aria/AriaStatus.vue
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { AriaLive } from '~/composables/aria'
|
||||||
|
|
||||||
|
// tsc complaining when using $defineProps
|
||||||
|
withDefaults(defineProps<{
|
||||||
|
ariaLive?: AriaLive
|
||||||
|
}>(), {
|
||||||
|
ariaLive: 'polite',
|
||||||
|
})
|
||||||
|
|
||||||
|
const { announceStatus, clearStatus, status } = useAriaStatus()
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
announceStatus,
|
||||||
|
clearStatus,
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<slot />
|
||||||
|
<p sr-only role="status" :aria-live="ariaLive">
|
||||||
|
<slot name="status" :status="status">
|
||||||
|
{{ status }}
|
||||||
|
</slot>
|
||||||
|
</p>
|
||||||
|
</template>
|
58
components/command/CommandItem.vue
Normal file
58
components/command/CommandItem.vue
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import type { ResolvedCommand } from '~/composables/command'
|
||||||
|
|
||||||
|
const {
|
||||||
|
cmd,
|
||||||
|
index,
|
||||||
|
active = false,
|
||||||
|
} = defineProps<{
|
||||||
|
cmd: ResolvedCommand
|
||||||
|
index: number
|
||||||
|
active?: boolean
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(event: 'activate'): void
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div
|
||||||
|
class="flex px-3 py-2 my-1 items-center rounded-lg hover:bg-active transition-all duration-65 ease-in-out cursor-pointer scroll-m-10"
|
||||||
|
:class="{ 'bg-active': active }"
|
||||||
|
:data-index="index"
|
||||||
|
@click="emit('activate')"
|
||||||
|
>
|
||||||
|
<div v-if="cmd.icon" me-2 :class="cmd.icon" />
|
||||||
|
|
||||||
|
<div class="flex-1 flex items-baseline gap-2">
|
||||||
|
<div :class="{ 'font-medium': active }">
|
||||||
|
{{ cmd.name }}
|
||||||
|
</div>
|
||||||
|
<div v-if="cmd.description" class="text-xs text-secondary">
|
||||||
|
{{ cmd.description }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div
|
||||||
|
v-if="cmd.onComplete"
|
||||||
|
class="flex items-center gap-1 transition-all duration-65 ease-in-out"
|
||||||
|
:class="active ? 'opacity-100' : 'opacity-0'"
|
||||||
|
>
|
||||||
|
<div class="text-xs text-secondary">
|
||||||
|
{{ $t('command.complete') }}
|
||||||
|
</div>
|
||||||
|
<CommandKey name="Tab" />
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
v-if="cmd.onActivate"
|
||||||
|
class="flex items-center gap-1 transition-all duration-65 ease-in-out"
|
||||||
|
:class="active ? 'opacity-100' : 'opacity-0'"
|
||||||
|
>
|
||||||
|
<div class="text-xs text-secondary">
|
||||||
|
{{ $t('command.activate') }}
|
||||||
|
</div>
|
||||||
|
<CommandKey name="Enter" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
|
@ -5,7 +5,7 @@ const props = defineProps<{
|
||||||
|
|
||||||
const isMac = useIsMac()
|
const isMac = useIsMac()
|
||||||
|
|
||||||
const keys = $computed(() => props.name.toLowerCase().split('+'))
|
const keys = computed(() => props.name.toLowerCase().split('+'))
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { CommandScope, QueryIndexedCommand } from '@/composables/command'
|
import type { SearchResult as SearchResultType } from '~/composables/masto/search'
|
||||||
|
import type { CommandScope, QueryResult, QueryResultItem } from '~/composables/command'
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(event: 'close'): void
|
(event: 'close'): void
|
||||||
|
@ -7,60 +8,109 @@ const emit = defineEmits<{
|
||||||
|
|
||||||
const registry = useCommandRegistry()
|
const registry = useCommandRegistry()
|
||||||
|
|
||||||
const inputEl = $ref<HTMLInputElement>()
|
const router = useRouter()
|
||||||
const resultEl = $ref<HTMLDivElement>()
|
|
||||||
|
|
||||||
const scopes = $ref<CommandScope[]>([])
|
const inputEl = ref<HTMLInputElement>()
|
||||||
let input = $(commandPanelInput)
|
const resultEl = ref<HTMLDivElement>()
|
||||||
|
|
||||||
|
const scopes = ref<CommandScope[]>([])
|
||||||
|
const input = commandPanelInput
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
inputEl?.focus()
|
inputEl.value?.focus()
|
||||||
})
|
})
|
||||||
|
|
||||||
const commandMode = $computed(() => input.startsWith('>'))
|
const commandMode = computed(() => input.value.startsWith('>'))
|
||||||
const result = $computed(() => commandMode
|
|
||||||
? registry.query(scopes.map(s => s.id).join('.'), input.slice(1))
|
const query = computed(() => commandMode.value ? '' : input.value.trim())
|
||||||
: { length: 0, items: [], grouped: {} })
|
|
||||||
let active = $ref(0)
|
const { accounts, hashtags, loading } = useSearch(query)
|
||||||
watch($$(result), (n, o) => {
|
|
||||||
|
function toSearchQueryResultItem(search: SearchResultType): QueryResultItem {
|
||||||
|
return {
|
||||||
|
index: 0,
|
||||||
|
type: 'search',
|
||||||
|
search,
|
||||||
|
onActivate: () => router.push(search.to),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const searchResult = computed<QueryResult>(() => {
|
||||||
|
if (query.value.length === 0 || loading.value)
|
||||||
|
return { length: 0, items: [], grouped: {} as any }
|
||||||
|
|
||||||
|
// TODO extract this scope
|
||||||
|
// duplicate in SearchWidget.vue
|
||||||
|
const hashtagList = hashtags.value.slice(0, 3).map(toSearchQueryResultItem)
|
||||||
|
const accountList = accounts.value.map(toSearchQueryResultItem)
|
||||||
|
|
||||||
|
const grouped: QueryResult['grouped'] = new Map()
|
||||||
|
grouped.set('Hashtags', hashtagList)
|
||||||
|
grouped.set('Users', accountList)
|
||||||
|
|
||||||
|
let index = 0
|
||||||
|
for (const items of grouped.values()) {
|
||||||
|
for (const item of items)
|
||||||
|
item.index = index++
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
grouped,
|
||||||
|
items: [...hashtagList, ...accountList],
|
||||||
|
length: hashtagList.length + accountList.length,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const result = computed<QueryResult>(() => commandMode.value
|
||||||
|
? registry.query(scopes.value.map(s => s.id).join('.'), input.value.slice(1).trim())
|
||||||
|
: searchResult.value,
|
||||||
|
)
|
||||||
|
|
||||||
|
const isMac = useIsMac()
|
||||||
|
const modifierKeyName = computed(() => isMac.value ? '⌘' : 'Ctrl')
|
||||||
|
|
||||||
|
const active = ref(0)
|
||||||
|
watch(result, (n, o) => {
|
||||||
if (n.length !== o.length || !n.items.every((i, idx) => i === o.items[idx]))
|
if (n.length !== o.length || !n.items.every((i, idx) => i === o.items[idx]))
|
||||||
active = 0
|
active.value = 0
|
||||||
})
|
})
|
||||||
|
|
||||||
const findItemEl = (index: number) =>
|
function findItemEl(index: number) {
|
||||||
resultEl?.querySelector(`[data-index="${index}"]`) as HTMLDivElement | null
|
return resultEl.value?.querySelector(`[data-index="${index}"]`) as HTMLDivElement | null
|
||||||
const onCommandActivate = (item: QueryIndexedCommand) => {
|
}
|
||||||
|
function onCommandActivate(item: QueryResultItem) {
|
||||||
if (item.onActivate) {
|
if (item.onActivate) {
|
||||||
item.onActivate()
|
item.onActivate()
|
||||||
emit('close')
|
emit('close')
|
||||||
}
|
}
|
||||||
else if (item.onComplete) {
|
else if (item.onComplete) {
|
||||||
scopes.push(item.onComplete())
|
scopes.value.push(item.onComplete())
|
||||||
input = '>'
|
input.value = '> '
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const onCommandComplete = (item: QueryIndexedCommand) => {
|
function onCommandComplete(item: QueryResultItem) {
|
||||||
if (item.onComplete) {
|
if (item.onComplete) {
|
||||||
scopes.push(item.onComplete())
|
scopes.value.push(item.onComplete())
|
||||||
input = '>'
|
input.value = '> '
|
||||||
}
|
}
|
||||||
else if (item.onActivate) {
|
else if (item.onActivate) {
|
||||||
item.onActivate()
|
item.onActivate()
|
||||||
|
emit('close')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const intoView = (index: number) => {
|
function intoView(index: number) {
|
||||||
const el = findItemEl(index)
|
const el = findItemEl(index)
|
||||||
if (el)
|
if (el)
|
||||||
el.scrollIntoView({ block: 'nearest' })
|
el.scrollIntoView({ block: 'nearest' })
|
||||||
}
|
}
|
||||||
|
|
||||||
function setActive(index: number) {
|
function setActive(index: number) {
|
||||||
const len = result.length
|
const len = result.value.length
|
||||||
active = (index + len) % len
|
active.value = (index + len) % len
|
||||||
intoView(active)
|
intoView(active.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
const onKeyDown = (e: KeyboardEvent) => {
|
function onKeyDown(e: KeyboardEvent) {
|
||||||
switch (e.key) {
|
switch (e.key) {
|
||||||
case 'p':
|
case 'p':
|
||||||
case 'ArrowUp': {
|
case 'ArrowUp': {
|
||||||
|
@ -68,7 +118,7 @@ const onKeyDown = (e: KeyboardEvent) => {
|
||||||
break
|
break
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
setActive(active - 1)
|
setActive(active.value - 1)
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -78,7 +128,7 @@ const onKeyDown = (e: KeyboardEvent) => {
|
||||||
break
|
break
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
setActive(active + 1)
|
setActive(active.value + 1)
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -86,9 +136,9 @@ const onKeyDown = (e: KeyboardEvent) => {
|
||||||
case 'Home': {
|
case 'Home': {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
active = 0
|
active.value = 0
|
||||||
|
|
||||||
intoView(active)
|
intoView(active.value)
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -96,7 +146,7 @@ const onKeyDown = (e: KeyboardEvent) => {
|
||||||
case 'End': {
|
case 'End': {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
setActive(result.length - 1)
|
setActive(result.value.length - 1)
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -104,7 +154,7 @@ const onKeyDown = (e: KeyboardEvent) => {
|
||||||
case 'Enter': {
|
case 'Enter': {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
const cmd = result.items[active]
|
const cmd = result.value.items[active.value]
|
||||||
if (cmd)
|
if (cmd)
|
||||||
onCommandActivate(cmd)
|
onCommandActivate(cmd)
|
||||||
|
|
||||||
|
@ -114,7 +164,7 @@ const onKeyDown = (e: KeyboardEvent) => {
|
||||||
case 'Tab': {
|
case 'Tab': {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
||||||
const cmd = result.items[active]
|
const cmd = result.value.items[active.value]
|
||||||
if (cmd)
|
if (cmd)
|
||||||
onCommandComplete(cmd)
|
onCommandComplete(cmd)
|
||||||
|
|
||||||
|
@ -122,9 +172,9 @@ const onKeyDown = (e: KeyboardEvent) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'Backspace': {
|
case 'Backspace': {
|
||||||
if (input === '>' && scopes.length) {
|
if (input.value === '>' && scopes.value.length) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
scopes.pop()
|
scopes.value.pop()
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
@ -158,52 +208,30 @@ const onKeyDown = (e: KeyboardEvent) => {
|
||||||
|
|
||||||
<!-- Results -->
|
<!-- Results -->
|
||||||
<div ref="resultEl" class="flex-1 mx-1 overflow-y-auto">
|
<div ref="resultEl" class="flex-1 mx-1 overflow-y-auto">
|
||||||
<template v-for="[scope, group] in result.grouped" :key="scope">
|
<template v-if="loading">
|
||||||
<div class="mt-2 px-2 py-1 text-sm text-secondary">
|
<SearchResultSkeleton />
|
||||||
{{ scope }}
|
<SearchResultSkeleton />
|
||||||
</div>
|
<SearchResultSkeleton />
|
||||||
|
</template>
|
||||||
<template v-for="cmd in group" :key="cmd.index">
|
<template v-else-if="result.length">
|
||||||
<div
|
<template v-for="[scope, group] in result.grouped" :key="scope">
|
||||||
class="flex px-3 py-2 my-1 items-center rounded-lg hover:bg-active transition-all duration-65 ease-in-out cursor-pointer scroll-m-10"
|
<div class="mt-2 px-2 py-1 text-sm text-secondary">
|
||||||
:class="{ 'bg-active': active === cmd.index }"
|
{{ scope }}
|
||||||
:data-index="cmd.index"
|
|
||||||
@click="onCommandActivate(cmd)"
|
|
||||||
>
|
|
||||||
<div v-if="cmd.icon" mr-2 :class="cmd.icon" />
|
|
||||||
|
|
||||||
<div class="flex-1 flex items-baseline gap-2">
|
|
||||||
<div :class="{ 'font-medium': active === cmd.index }">
|
|
||||||
{{ cmd.name }}
|
|
||||||
</div>
|
|
||||||
<div v-if="cmd.description" class="text-xs text-secondary">
|
|
||||||
{{ cmd.description }}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div
|
|
||||||
v-if="cmd.onComplete"
|
|
||||||
class="flex items-center gap-1 transition-all duration-65 ease-in-out"
|
|
||||||
:class="active === cmd.index ? 'opacity-100' : 'opacity-0'"
|
|
||||||
>
|
|
||||||
<div class="text-xs text-secondary">
|
|
||||||
{{ $t('command.complete') }}
|
|
||||||
</div>
|
|
||||||
<CommandKey name="Tab" />
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
v-if="cmd.onActivate"
|
|
||||||
class="flex items-center gap-1 transition-all duration-65 ease-in-out"
|
|
||||||
:class="active === cmd.index ? 'opacity-100' : 'opacity-0'"
|
|
||||||
>
|
|
||||||
<div class="text-xs text-secondary">
|
|
||||||
{{ $t('command.activate') }}
|
|
||||||
</div>
|
|
||||||
<CommandKey name="Enter" />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<template v-for="item in group" :key="item.index">
|
||||||
|
<SearchResult v-if="item.type === 'search'" :active="active === item.index" :result="item.search" />
|
||||||
|
<CommandItem v-else :index="item.index" :cmd="item.cmd" :active="active === item.index" @activate="onCommandActivate(item)" />
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
<div v-else p5 text-center text-secondary italic>
|
||||||
|
{{
|
||||||
|
input.trim().length
|
||||||
|
? $t('common.not_found')
|
||||||
|
: $t('search.search_desc')
|
||||||
|
}}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="w-full border-b-1 border-base" />
|
<div class="w-full border-b-1 border-base" />
|
||||||
|
@ -211,8 +239,8 @@ const onKeyDown = (e: KeyboardEvent) => {
|
||||||
<!-- Footer -->
|
<!-- Footer -->
|
||||||
<div class="flex items-center px-3 py-1 text-xs">
|
<div class="flex items-center px-3 py-1 text-xs">
|
||||||
<div i-ri:lightbulb-flash-line /> Tip: Use
|
<div i-ri:lightbulb-flash-line /> Tip: Use
|
||||||
<!-- <CommandKey name="Ctrl+K" /> to search, -->
|
<CommandKey :name="`${modifierKeyName}+K`" /> to search,
|
||||||
<CommandKey name="Ctrl+/" /> to activate command mode.
|
<CommandKey :name="`${modifierKeyName}+/`" /> to activate command mode.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,17 +1,11 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
const props = withDefaults(defineProps<{
|
const emit = defineEmits<{
|
||||||
modelValue?: boolean
|
|
||||||
}>(), {
|
|
||||||
modelValue: true,
|
|
||||||
})
|
|
||||||
const emits = defineEmits<{
|
|
||||||
(e: 'update:modelValue', v: boolean): void
|
|
||||||
(event: 'close'): void
|
(event: 'close'): void
|
||||||
}>()
|
}>()
|
||||||
const visible = useVModel(props, 'modelValue', emits, { passive: true })
|
const visible = defineModel<boolean>()
|
||||||
|
|
||||||
function close() {
|
function close() {
|
||||||
emits('close')
|
emit('close')
|
||||||
visible.value = false
|
visible.value = false
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -19,12 +13,12 @@ function close() {
|
||||||
<template>
|
<template>
|
||||||
<div
|
<div
|
||||||
flex="~ gap-2" justify-between items-center
|
flex="~ gap-2" justify-between items-center
|
||||||
class="border-b border-base text-sm text-secondary px4 py2 sm:py4"
|
border="b base" text-sm text-secondary px4 py2 sm:py4
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<slot />
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
<button text-xl hover:text-primary bg-hover-overflow w-1.4em h-1.4em @click="close()">
|
<button text-xl hover:text-primary bg-hover-overflow w="1.2em" h="1.2em" @click="close()">
|
||||||
<div i-ri:close-line />
|
<div i-ri:close-line />
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,46 +0,0 @@
|
||||||
import { decode } from 'blurhash'
|
|
||||||
import { getDataUrlFromArr } from '~/composables/utils'
|
|
||||||
|
|
||||||
export default defineComponent({
|
|
||||||
inheritAttrs: false,
|
|
||||||
props: {
|
|
||||||
blurhash: {
|
|
||||||
type: String,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
src: {
|
|
||||||
type: String,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
srcset: {
|
|
||||||
type: String,
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
setup(props, { attrs }) {
|
|
||||||
const placeholderSrc = ref<string>()
|
|
||||||
const isLoaded = ref(false)
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
const img = document.createElement('img')
|
|
||||||
img.onload = () => {
|
|
||||||
isLoaded.value = true
|
|
||||||
}
|
|
||||||
img.src = props.src
|
|
||||||
if (props.srcset)
|
|
||||||
img.srcset = props.srcset
|
|
||||||
setTimeout(() => {
|
|
||||||
isLoaded.value = true
|
|
||||||
}, 3_000)
|
|
||||||
|
|
||||||
if (props.blurhash) {
|
|
||||||
const pixels = decode(props.blurhash, 32, 32)
|
|
||||||
placeholderSrc.value = getDataUrlFromArr(pixels, 32, 32)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return () => isLoaded.value || !placeholderSrc.value
|
|
||||||
? h('img', { ...attrs, src: props.src, srcset: props.srcset })
|
|
||||||
: h('img', { ...attrs, src: placeholderSrc.value })
|
|
||||||
},
|
|
||||||
})
|
|
16
components/common/CommonBlurhash.vue
Normal file
16
components/common/CommonBlurhash.vue
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
defineOptions({
|
||||||
|
inheritAttrs: false,
|
||||||
|
})
|
||||||
|
|
||||||
|
const { blurhash = '', src, srcset, shouldLoadImage = true } = defineProps<{
|
||||||
|
blurhash?: string
|
||||||
|
src: string
|
||||||
|
srcset?: string
|
||||||
|
shouldLoadImage?: boolean
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<UnLazyImage v-bind="$attrs" :blurhash="blurhash" :src="src" :src-set="srcset" :lazy-load="shouldLoadImage" auto-sizes />
|
||||||
|
</template>
|
|
@ -1,21 +1,29 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
defineProps<{
|
defineProps<{
|
||||||
label: string
|
label?: string
|
||||||
hover?: boolean
|
hover?: boolean
|
||||||
|
iconChecked?: string
|
||||||
|
iconUnchecked?: string
|
||||||
|
checkedIconColor?: string
|
||||||
|
prependCheckbox?: boolean
|
||||||
}>()
|
}>()
|
||||||
const { modelValue } = defineModel<{
|
const modelValue = defineModel<boolean | null>()
|
||||||
modelValue: boolean
|
|
||||||
}>()
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<label
|
<label
|
||||||
class="common-checkbox flex items-center cursor-pointer py-1 text-md w-full gap-y-1"
|
class="common-checkbox flex items-center cursor-pointer py-1 text-md w-full gap-y-1"
|
||||||
:class="hover ? 'hover:bg-active ml--2 pl-4' : null"
|
:class="hover ? 'hover:bg-active ms--2 px-4 py-2' : null"
|
||||||
|
v-bind="$attrs"
|
||||||
@click.prevent="modelValue = !modelValue"
|
@click.prevent="modelValue = !modelValue"
|
||||||
>
|
>
|
||||||
|
<span v-if="label && !prependCheckbox" flex-1 ms-2 pointer-events-none>{{ label }}</span>
|
||||||
<span
|
<span
|
||||||
:class="modelValue ? 'i-ri:checkbox-line' : 'i-ri:checkbox-blank-line'"
|
:class="[
|
||||||
|
modelValue ? (iconChecked ?? 'i-ri:checkbox-line') : (iconUnchecked ?? 'i-ri:checkbox-blank-line'),
|
||||||
|
modelValue && checkedIconColor,
|
||||||
|
]"
|
||||||
|
text-lg
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
/>
|
/>
|
||||||
<input
|
<input
|
||||||
|
@ -23,7 +31,7 @@ const { modelValue } = defineModel<{
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
sr-only
|
sr-only
|
||||||
>
|
>
|
||||||
<span ml-2 pointer-events-none>{{ label }}</span>
|
<span v-if="label && prependCheckbox" flex-1 ms-2 pointer-events-none>{{ label }}</span>
|
||||||
</label>
|
</label>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
103
components/common/CommonCropImage.vue
Normal file
103
components/common/CommonCropImage.vue
Normal file
|
@ -0,0 +1,103 @@
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import type { Boundaries } from 'vue-advanced-cropper'
|
||||||
|
import { Cropper } from 'vue-advanced-cropper'
|
||||||
|
import 'vue-advanced-cropper/dist/style.css'
|
||||||
|
|
||||||
|
export interface Props {
|
||||||
|
/** Crop frame aspect ratio (width/height), default 1/1 */
|
||||||
|
stencilAspectRatio?: number
|
||||||
|
/** The ratio of the longest edge of the cut box to the length of the cut screen, default 0.9, not more than 1 */
|
||||||
|
stencilSizePercentage?: number
|
||||||
|
}
|
||||||
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
|
stencilAspectRatio: 1 / 1,
|
||||||
|
stencilSizePercentage: 0.9,
|
||||||
|
})
|
||||||
|
|
||||||
|
const file = defineModel<File | null>()
|
||||||
|
|
||||||
|
const cropperDialog = ref(false)
|
||||||
|
|
||||||
|
const cropper = ref<InstanceType<typeof Cropper>>()
|
||||||
|
|
||||||
|
const cropperFlag = ref(false)
|
||||||
|
|
||||||
|
const cropperImage = reactive({
|
||||||
|
src: '',
|
||||||
|
type: 'image/jpg',
|
||||||
|
})
|
||||||
|
|
||||||
|
function stencilSize({ boundaries }: { boundaries: Boundaries }) {
|
||||||
|
return {
|
||||||
|
width: boundaries.width * props.stencilSizePercentage,
|
||||||
|
height: boundaries.height * props.stencilSizePercentage,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(file, (file, _, onCleanup) => {
|
||||||
|
let expired = false
|
||||||
|
onCleanup(() => expired = true)
|
||||||
|
|
||||||
|
if (file && !cropperFlag.value) {
|
||||||
|
cropperDialog.value = true
|
||||||
|
const reader = new FileReader()
|
||||||
|
reader.readAsDataURL(file)
|
||||||
|
reader.onload = (e) => {
|
||||||
|
if (expired)
|
||||||
|
return
|
||||||
|
cropperImage.src = e.target?.result as string
|
||||||
|
cropperImage.type = file.type
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cropperFlag.value = false
|
||||||
|
})
|
||||||
|
|
||||||
|
function cropImage() {
|
||||||
|
if (cropper.value && file.value) {
|
||||||
|
cropperFlag.value = true
|
||||||
|
cropperDialog.value = false
|
||||||
|
const { canvas } = cropper.value.getResult()
|
||||||
|
canvas?.toBlob((blob) => {
|
||||||
|
file.value = new File([blob as any], `cropped${file.value?.name}` as string, { type: blob?.type })
|
||||||
|
}, cropperImage.type)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<ModalDialog v-model="cropperDialog" :use-v-if="false" max-w-500px flex>
|
||||||
|
<div flex-1 w-0>
|
||||||
|
<div text-lg text-center my2 px3>
|
||||||
|
<h1>
|
||||||
|
{{ $t('action.edit') }}
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
<div aspect-ratio-1>
|
||||||
|
<Cropper
|
||||||
|
ref="cropper"
|
||||||
|
class="overflow-hidden w-full h-full"
|
||||||
|
:src="cropperImage.src"
|
||||||
|
:resize-image="{
|
||||||
|
adjustStencil: false,
|
||||||
|
}"
|
||||||
|
:stencil-size="stencilSize"
|
||||||
|
:stencil-props="{
|
||||||
|
aspectRatio: props.stencilAspectRatio,
|
||||||
|
movable: false,
|
||||||
|
resizable: false,
|
||||||
|
handlers: {},
|
||||||
|
}"
|
||||||
|
image-restriction="stencil"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div m-4>
|
||||||
|
<button
|
||||||
|
btn-solid w-full rounded text-sm
|
||||||
|
@click="cropImage()"
|
||||||
|
>
|
||||||
|
{{ $t('action.confirm') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ModalDialog>
|
||||||
|
</template>
|
19
components/common/CommonErrorMessage.vue
Normal file
19
components/common/CommonErrorMessage.vue
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
defineProps<{ describedBy: string }>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div
|
||||||
|
role="alert"
|
||||||
|
aria-live="polite"
|
||||||
|
:aria-describedby="describedBy"
|
||||||
|
flex="~ col"
|
||||||
|
gap-1 text-sm
|
||||||
|
pt-1 ps-2 pe-1 pb-2
|
||||||
|
text-red-600 dark:text-red-400
|
||||||
|
border="~ base rounded red-600 dark:red-400"
|
||||||
|
v-bind="$attrs"
|
||||||
|
>
|
||||||
|
<slot />
|
||||||
|
</div>
|
||||||
|
</template>
|
106
components/common/CommonInputImage.vue
Normal file
106
components/common/CommonInputImage.vue
Normal file
|
@ -0,0 +1,106 @@
|
||||||
|
<script lang="ts" setup>
|
||||||
|
import { fileOpen } from 'browser-fs-access'
|
||||||
|
import type { FileWithHandle } from 'browser-fs-access'
|
||||||
|
|
||||||
|
const props = withDefaults(defineProps<{
|
||||||
|
/** The image src before change */
|
||||||
|
original?: string
|
||||||
|
/** Allowed file types */
|
||||||
|
allowedFileTypes?: string[]
|
||||||
|
/** Allowed file size */
|
||||||
|
allowedFileSize?: number
|
||||||
|
|
||||||
|
imgClass?: string
|
||||||
|
|
||||||
|
loading?: boolean
|
||||||
|
}>(), {
|
||||||
|
allowedFileTypes: () => ['image/jpeg', 'image/png'],
|
||||||
|
allowedFileSize: 1024 * 1024 * 5, // 5 MB
|
||||||
|
})
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(event: 'pick', value: FileWithHandle): void
|
||||||
|
(event: 'error', code: number, message: string): void
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const file = defineModel<FileWithHandle | null>()
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
|
||||||
|
const defaultImage = computed(() => props.original || '')
|
||||||
|
/** Preview of selected images */
|
||||||
|
const previewImage = ref('')
|
||||||
|
/** The current images on display */
|
||||||
|
const imageSrc = computed<string>(() => previewImage.value || defaultImage.value)
|
||||||
|
|
||||||
|
async function pickImage() {
|
||||||
|
if (import.meta.server)
|
||||||
|
return
|
||||||
|
const image = await fileOpen({
|
||||||
|
description: 'Image',
|
||||||
|
mimeTypes: props.allowedFileTypes,
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!props.allowedFileTypes.includes(image.type)) {
|
||||||
|
emit('error', 1, t('error.unsupported_file_format'))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
else if (image.size > props.allowedFileSize) {
|
||||||
|
emit('error', 2, t('error.file_size_cannot_exceed_n_mb', [5]))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
file.value = image
|
||||||
|
emit('pick', file.value)
|
||||||
|
}
|
||||||
|
|
||||||
|
watch(file, (image, _, onCleanup) => {
|
||||||
|
let expired = false
|
||||||
|
onCleanup(() => expired = true)
|
||||||
|
|
||||||
|
if (!image) {
|
||||||
|
previewImage.value = ''
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const reader = new FileReader()
|
||||||
|
reader.readAsDataURL(image)
|
||||||
|
reader.onload = (evt) => {
|
||||||
|
if (expired)
|
||||||
|
return
|
||||||
|
previewImage.value = evt.target?.result as string
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<label
|
||||||
|
class="bg-slate-500/10 focus-within:(outline outline-primary)"
|
||||||
|
relative
|
||||||
|
flex justify-center items-center
|
||||||
|
cursor-pointer
|
||||||
|
of-hidden
|
||||||
|
@click="pickImage"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
v-if="imageSrc"
|
||||||
|
:src="imageSrc"
|
||||||
|
:class="imgClass || ''"
|
||||||
|
object-cover
|
||||||
|
w-full
|
||||||
|
h-full
|
||||||
|
>
|
||||||
|
<span absolute bg="black/50" text-white rounded-full text-xl w12 h12 flex justify-center items-center hover="bg-black/40 text-primary">
|
||||||
|
<span block i-ri:upload-line />
|
||||||
|
</span>
|
||||||
|
|
||||||
|
<span
|
||||||
|
v-if="loading"
|
||||||
|
absolute inset-0
|
||||||
|
bg="black/30" text-white
|
||||||
|
flex justify-center items-center
|
||||||
|
>
|
||||||
|
<span class="animate-spin animate-duration-[2.5s] preserve-3d">
|
||||||
|
<span block i-ri:loader-4-line text-4xl />
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</template>
|
13
components/common/CommonMask.vue
Normal file
13
components/common/CommonMask.vue
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
const {
|
||||||
|
zIndex = 100,
|
||||||
|
background = 'transparent',
|
||||||
|
} = $defineProps<{
|
||||||
|
zIndex?: number
|
||||||
|
background?: string
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div fixed top-0 bottom-0 left-0 right-0 :style="{ background, zIndex }" />
|
||||||
|
</template>
|
|
@ -1,30 +1,74 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts" generic="T, O, U = T">
|
||||||
// @ts-expect-error missing types
|
// @ts-expect-error missing types
|
||||||
import { DynamicScroller } from 'vue-virtual-scroller'
|
import { DynamicScroller } from 'vue-virtual-scroller'
|
||||||
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css'
|
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css'
|
||||||
import type { Paginator, WsEvents } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
|
import type { UnwrapRef } from 'vue'
|
||||||
|
|
||||||
const { paginator, stream, keyProp = 'id', virtualScroller = false, eventType = 'update' } = defineProps<{
|
const {
|
||||||
paginator: Paginator<any, any[]>
|
paginator,
|
||||||
keyProp?: string
|
stream,
|
||||||
|
eventType,
|
||||||
|
keyProp = 'id',
|
||||||
|
virtualScroller = false,
|
||||||
|
preprocess,
|
||||||
|
endMessage = true,
|
||||||
|
} = defineProps<{
|
||||||
|
paginator: mastodon.Paginator<T[], O>
|
||||||
|
keyProp?: keyof T
|
||||||
virtualScroller?: boolean
|
virtualScroller?: boolean
|
||||||
stream?: WsEvents
|
stream?: mastodon.streaming.Subscription
|
||||||
eventType?: 'notification' | 'update'
|
eventType?: 'update' | 'notification'
|
||||||
|
preprocess?: (items: (U | T)[]) => U[]
|
||||||
|
endMessage?: boolean | string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
defineSlots<{
|
defineSlots<{
|
||||||
default: {
|
default: (props: {
|
||||||
item: any
|
items: U[]
|
||||||
|
item: U
|
||||||
|
index: number
|
||||||
active?: boolean
|
active?: boolean
|
||||||
}
|
older: U
|
||||||
updater: {
|
newer: U // newer is undefined when index === 0
|
||||||
|
}) => void
|
||||||
|
items: (props: {
|
||||||
|
items: UnwrapRef<U[]>
|
||||||
|
}) => void
|
||||||
|
updater: (props: {
|
||||||
number: number
|
number: number
|
||||||
update: () => void
|
update: () => void
|
||||||
}
|
}) => void
|
||||||
loading: {}
|
loading: (props: object) => void
|
||||||
|
done: (props: { items: U[] }) => void
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const { items, prevItems, update, state, endAnchor, error } = usePaginator(paginator, stream, eventType)
|
const { t } = useI18n()
|
||||||
|
const nuxtApp = useNuxtApp()
|
||||||
|
|
||||||
|
const { items, prevItems, update, state, endAnchor, error } = usePaginator(paginator, toRef(() => stream), eventType, preprocess)
|
||||||
|
|
||||||
|
nuxtApp.hook('elk-logo:click', () => {
|
||||||
|
update()
|
||||||
|
nuxtApp.$scrollToTop()
|
||||||
|
})
|
||||||
|
|
||||||
|
function createEntry(item: any) {
|
||||||
|
items.value = [...items.value, preprocess?.([item]) ?? item]
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateEntry(item: any) {
|
||||||
|
const id = item[keyProp]
|
||||||
|
const index = items.value.findIndex(i => (i as any)[keyProp] === id)
|
||||||
|
if (index > -1)
|
||||||
|
items.value = [...items.value.slice(0, index), preprocess?.([item]) ?? item, ...items.value.slice(index + 1)]
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeEntry(entryId: any) {
|
||||||
|
items.value = items.value.filter(i => (i as any)[keyProp] !== entryId)
|
||||||
|
}
|
||||||
|
|
||||||
|
defineExpose({ createEntry, removeEntry, updateEntry })
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -33,35 +77,46 @@ const { items, prevItems, update, state, endAnchor, error } = usePaginator(pagin
|
||||||
<slot name="items" :items="items">
|
<slot name="items" :items="items">
|
||||||
<template v-if="virtualScroller">
|
<template v-if="virtualScroller">
|
||||||
<DynamicScroller
|
<DynamicScroller
|
||||||
v-slot="{ item, active }"
|
v-slot="{ item, active, index }"
|
||||||
:items="items"
|
:items="items"
|
||||||
:min-item-size="200"
|
:min-item-size="200"
|
||||||
:key-field="keyProp"
|
:key-field="keyProp"
|
||||||
page-mode
|
page-mode
|
||||||
>
|
>
|
||||||
<slot :item="item" :active="active" />
|
<slot
|
||||||
|
v-bind="{ key: item[keyProp] }"
|
||||||
|
:item="item"
|
||||||
|
:active="active"
|
||||||
|
:older="items[index + 1] as U"
|
||||||
|
:newer="items[index - 1] as U"
|
||||||
|
:index="index"
|
||||||
|
:items="items as U[]"
|
||||||
|
/>
|
||||||
</DynamicScroller>
|
</DynamicScroller>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<slot
|
<slot
|
||||||
v-for="item of items"
|
v-for="(item, index) of items"
|
||||||
:key="item[keyProp]"
|
v-bind="{ key: (item as U)[keyProp as keyof U] }"
|
||||||
:item="item"
|
:item="item as U"
|
||||||
|
:older="items[index + 1] as U"
|
||||||
|
:newer="items[index - 1] as U"
|
||||||
|
:index="index"
|
||||||
|
:items="items as U[]"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</slot>
|
</slot>
|
||||||
<div ref="endAnchor" />
|
<div ref="endAnchor" />
|
||||||
<slot v-if="state === 'loading'" name="loading">
|
<slot v-if="state === 'loading'" name="loading">
|
||||||
<div p5 text-center flex="~ col" items-center animate-pulse>
|
<TimelineSkeleton />
|
||||||
<div text-secondary i-ri:loader-2-fill animate-spin text-2xl />
|
</slot>
|
||||||
<span text-secondary>{{ $t('state.loading') }}</span>
|
<slot v-else-if="state === 'done' && endMessage !== false" name="done" :items="items as U[]">
|
||||||
|
<div p5 text-secondary italic text-center>
|
||||||
|
{{ t(typeof endMessage === 'string' && items.length <= 0 ? endMessage : 'common.end_of_list') }}
|
||||||
</div>
|
</div>
|
||||||
</slot>
|
</slot>
|
||||||
<div v-else-if="state === 'done'" p5 text-secondary italic text-center>
|
|
||||||
{{ $t('common.end_of_list') }}
|
|
||||||
</div>
|
|
||||||
<div v-else-if="state === 'error'" p5 text-secondary>
|
<div v-else-if="state === 'error'" p5 text-secondary>
|
||||||
{{ $t('common.error') }}: {{ error }}
|
{{ t('common.error') }}: {{ error }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
27
components/common/CommonPreviewPrompt.vue
Normal file
27
components/common/CommonPreviewPrompt.vue
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
const build = useBuildInfo()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div
|
||||||
|
m-2 p5 bg-rose:10 relative
|
||||||
|
rounded-lg of-hidden
|
||||||
|
flex="~ col gap-3"
|
||||||
|
>
|
||||||
|
<h2 font-bold text-rose>
|
||||||
|
{{ $t('help.build_preview.title') }}
|
||||||
|
</h2>
|
||||||
|
<p>
|
||||||
|
<i18n-t keypath="help.build_preview.desc1">
|
||||||
|
<NuxtLink :href="`https://github.com/elk-zone/elk/commit/${build.commit}`" target="_blank" text-rose hover:underline>
|
||||||
|
<code>{{ build.shortCommit }}</code>
|
||||||
|
</NuxtLink>
|
||||||
|
</i18n-t>
|
||||||
|
</p>
|
||||||
|
<p>{{ $t('help.build_preview.desc2') }}</p>
|
||||||
|
<p font-bold>
|
||||||
|
{{ $t('help.build_preview.desc3') }}
|
||||||
|
</p>
|
||||||
|
<div i-ri-git-pull-request-line absolute text-10em bottom--10 inset-ie--10 text-rose op10 class="-z-1" />
|
||||||
|
</div>
|
||||||
|
</template>
|
|
@ -4,17 +4,16 @@ defineProps<{
|
||||||
value: any
|
value: any
|
||||||
hover?: boolean
|
hover?: boolean
|
||||||
}>()
|
}>()
|
||||||
const { modelValue } = defineModel<{
|
const modelValue = defineModel()
|
||||||
modelValue: any
|
|
||||||
}>()
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<label
|
<label
|
||||||
class="common-radio flex items-center cursor-pointer py-1 text-md w-full gap-y-1"
|
class="common-radio flex items-center cursor-pointer py-1 text-md w-full gap-y-1"
|
||||||
:class="hover ? 'hover:bg-active ml--2 pl-4' : null"
|
:class="hover ? 'hover:bg-active ms--2 px-4 py-2' : null"
|
||||||
@click.prevent="modelValue = value"
|
@click.prevent="modelValue = value"
|
||||||
>
|
>
|
||||||
|
<span flex-1 ms-2 pointer-events-none>{{ label }}</span>
|
||||||
<span
|
<span
|
||||||
:class="modelValue === value ? 'i-ri:radio-button-line' : 'i-ri:checkbox-blank-circle-line'"
|
:class="modelValue === value ? 'i-ri:radio-button-line' : 'i-ri:checkbox-blank-circle-line'"
|
||||||
aria-hidden="true"
|
aria-hidden="true"
|
||||||
|
@ -25,7 +24,6 @@ const { modelValue } = defineModel<{
|
||||||
:value="value"
|
:value="value"
|
||||||
sr-only
|
sr-only
|
||||||
>
|
>
|
||||||
<span ml-2 pointer-events-none>{{ label }}</span>
|
|
||||||
</label>
|
</label>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -1,24 +1,20 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { RouteLocationRaw } from 'vue-router'
|
import type { CommonRouteTabMoreOption, CommonRouteTabOption } from '~/types'
|
||||||
|
|
||||||
const { options, command, replace, preventScrollTop = false } = $defineProps<{
|
const { options, command, replace, preventScrollTop = false, moreOptions } = defineProps<{
|
||||||
options: {
|
options: CommonRouteTabOption[]
|
||||||
to: RouteLocationRaw
|
moreOptions?: CommonRouteTabMoreOption
|
||||||
display: string
|
|
||||||
name?: string
|
|
||||||
icon?: string
|
|
||||||
}[]
|
|
||||||
command?: boolean
|
command?: boolean
|
||||||
replace?: boolean
|
replace?: boolean
|
||||||
preventScrollTop?: boolean
|
preventScrollTop?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
|
|
||||||
useCommands(() => command
|
useCommands(() => command
|
||||||
? options.map(tab => ({
|
? options.map(tab => ({
|
||||||
scope: 'Tabs',
|
scope: 'Tabs',
|
||||||
|
|
||||||
name: tab.display,
|
name: tab.display,
|
||||||
icon: tab.icon ?? 'i-ri:file-list-2-line',
|
icon: tab.icon ?? 'i-ri:file-list-2-line',
|
||||||
onActivate: () => router.replace(tab.to),
|
onActivate: () => router.replace(tab.to),
|
||||||
|
@ -27,19 +23,64 @@ useCommands(() => command
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div flex w-full items-center lg:text-lg of-x-auto scrollbar-hide>
|
<div flex w-full items-center lg:text-lg of-x-auto scrollbar-hide border="b base">
|
||||||
<NuxtLink
|
<template
|
||||||
v-for="(option, index) in options"
|
v-for="(option, index) in options.filter(item => !item.hide)"
|
||||||
:key="option?.name || index"
|
:key="option?.name || index"
|
||||||
:to="option.to"
|
|
||||||
:replace="replace"
|
|
||||||
relative flex flex-auto cursor-pointer sm:px6 px2 rounded transition-all
|
|
||||||
tabindex="1"
|
|
||||||
hover:bg-active transition-100
|
|
||||||
exact-active-class="children:(font-bold !border-primary !op100)"
|
|
||||||
@click="!preventScrollTop && $scrollToTop()"
|
|
||||||
>
|
>
|
||||||
<span ws-nowrap mxa sm:px2 sm:py3 py2 text-center border-b-3 op50 hover:op70 border-transparent>{{ option.display }}</span>
|
<NuxtLink
|
||||||
</NuxtLink>
|
v-if="!option.disabled"
|
||||||
|
:to="option.to"
|
||||||
|
:replace="replace"
|
||||||
|
relative flex flex-auto cursor-pointer sm:px6 px2 rounded transition-all
|
||||||
|
tabindex="0"
|
||||||
|
hover:bg-active transition-100
|
||||||
|
exact-active-class="children:(text-secondary !border-primary !op100 !text-base)"
|
||||||
|
@click="!preventScrollTop && $scrollToTop()"
|
||||||
|
>
|
||||||
|
<span ws-nowrap mxa sm:px2 sm:py3 xl:pb4 xl:pt5 py2 text-center border-b-3 text-secondary-light hover:text-secondary border-transparent>{{ option.display || ' ' }}</span>
|
||||||
|
</NuxtLink>
|
||||||
|
<div v-else flex flex-auto sm:px6 px2 xl:pb4 xl:pt5>
|
||||||
|
<span ws-nowrap mxa sm:px2 sm:py3 py2 text-center text-secondary-light op50>{{ option.display }}</span>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<template v-if="isHydrated && moreOptions?.options?.length">
|
||||||
|
<CommonDropdown placement="bottom" flex cursor-pointer mx-1.25rem>
|
||||||
|
<CommonTooltip placement="top" no-auto-focus :content="moreOptions.tooltip || t('action.more')">
|
||||||
|
<button
|
||||||
|
cursor-pointer
|
||||||
|
flex
|
||||||
|
gap-1
|
||||||
|
w-12
|
||||||
|
rounded
|
||||||
|
hover:bg-active
|
||||||
|
btn-action-icon
|
||||||
|
op75
|
||||||
|
px4
|
||||||
|
group
|
||||||
|
:aria-label="t('action.more')"
|
||||||
|
:class="moreOptions.match ? 'text-primary' : 'text-secondary'"
|
||||||
|
>
|
||||||
|
<span v-if="moreOptions.icon" :class="moreOptions.icon" text-sm me--1 block />
|
||||||
|
<span i-ri:arrow-down-s-line text-sm me--1 block />
|
||||||
|
</button>
|
||||||
|
</CommonTooltip>
|
||||||
|
<template #popper>
|
||||||
|
<NuxtLink
|
||||||
|
v-for="(option, index) in moreOptions.options.filter(item => !item.hide)"
|
||||||
|
:key="option?.name || index"
|
||||||
|
:to="option.to"
|
||||||
|
>
|
||||||
|
<CommonDropdownItem>
|
||||||
|
<span flex="~ row" gap-x-4 items-center :class="option.match ? 'text-primary' : ''">
|
||||||
|
<span v-if="option.icon" :class="[option.icon, option.match ? 'text-primary' : 'text.secondary']" text-md me--1 block />
|
||||||
|
<span v-else block> </span>
|
||||||
|
<span>{{ option.display }}</span>
|
||||||
|
</span>
|
||||||
|
</CommonDropdownItem>
|
||||||
|
</NuxtLink>
|
||||||
|
</template>
|
||||||
|
</commondropdown>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const { as = 'div', active } = defineProps<{ as: any; active: boolean }>()
|
const { as = 'div', active } = defineProps<{
|
||||||
|
as: any
|
||||||
|
active: boolean
|
||||||
|
}>()
|
||||||
|
|
||||||
const el = ref()
|
const el = ref()
|
||||||
|
|
||||||
watch(() => active, (active) => {
|
watch(() => active, (active) => {
|
||||||
|
|
|
@ -8,11 +8,9 @@ const { options, command } = defineProps<{
|
||||||
command?: boolean
|
command?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const { modelValue } = defineModel<{
|
const modelValue = defineModel<string>({ required: true })
|
||||||
modelValue: string
|
|
||||||
}>()
|
|
||||||
|
|
||||||
const tabs = $computed(() => {
|
const tabs = computed(() => {
|
||||||
return options.map((option) => {
|
return options.map((option) => {
|
||||||
if (typeof option === 'string')
|
if (typeof option === 'string')
|
||||||
return { name: option, display: option }
|
return { name: option, display: option }
|
||||||
|
@ -21,12 +19,12 @@ const tabs = $computed(() => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
function toValidName(otpion: string) {
|
function toValidName(option: string) {
|
||||||
return otpion.toLowerCase().replace(/[^a-zA-Z0-9]/g, '-')
|
return option.toLowerCase().replace(/[^a-zA-Z0-9]/g, '-')
|
||||||
}
|
}
|
||||||
|
|
||||||
useCommands(() => command
|
useCommands(() => command
|
||||||
? tabs.map(tab => ({
|
? tabs.value.map(tab => ({
|
||||||
scope: 'Tabs',
|
scope: 'Tabs',
|
||||||
|
|
||||||
name: tab.display,
|
name: tab.display,
|
||||||
|
@ -51,7 +49,7 @@ useCommands(() => command
|
||||||
><label
|
><label
|
||||||
flex flex-auto cursor-pointer px3 m1 rounded transition-all
|
flex flex-auto cursor-pointer px3 m1 rounded transition-all
|
||||||
:for="`tab-${toValidName(option.name)}`"
|
:for="`tab-${toValidName(option.name)}`"
|
||||||
tabindex="1"
|
tabindex="0"
|
||||||
hover:bg-active transition-100
|
hover:bg-active transition-100
|
||||||
@keypress.enter="modelValue = option.name"
|
@keypress.enter="modelValue = option.name"
|
||||||
><span
|
><span
|
||||||
|
|
|
@ -1,14 +1,18 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Popper as VTooltipType } from 'floating-vue/dist'
|
import type { Popper as VTooltipType } from 'floating-vue'
|
||||||
|
|
||||||
defineProps<{
|
export interface Props extends Partial<typeof VTooltipType> {
|
||||||
content?: string
|
content?: string
|
||||||
} & Partial<typeof VTooltipType>>()
|
}
|
||||||
|
|
||||||
|
defineProps<Props>()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VTooltip
|
<VTooltip
|
||||||
|
v-if="isHydrated"
|
||||||
v-bind="$attrs"
|
v-bind="$attrs"
|
||||||
|
auto-hide
|
||||||
>
|
>
|
||||||
<slot />
|
<slot />
|
||||||
<template #popper>
|
<template #popper>
|
||||||
|
|
|
@ -1,23 +1,23 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { History } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
const {
|
const {
|
||||||
history,
|
history,
|
||||||
maxDay = 2,
|
maxDay = 2,
|
||||||
} = $defineProps<{
|
} = defineProps<{
|
||||||
history: History[]
|
history: mastodon.v1.TagHistory[]
|
||||||
maxDay?: number
|
maxDay?: number
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const ongoingHot = $computed(() => history.slice(0, maxDay))
|
const ongoingHot = computed(() => history.slice(0, maxDay))
|
||||||
|
|
||||||
const people = $computed(() =>
|
const people = computed(() =>
|
||||||
ongoingHot.reduce((total: number, item) => total + (Number(item.accounts) || 0), 0),
|
ongoingHot.value.reduce((total: number, item) => total + (Number(item.accounts) || 0), 0),
|
||||||
)
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<p>
|
<p>
|
||||||
{{ $t('command.n-people-in-the-past-n-days', [people, maxDay]) }}
|
{{ $t('command.n_people_in_the_past_n_days', [people, maxDay]) }}
|
||||||
</p>
|
</p>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,28 +1,33 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import type { History } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
import sparkline from '@fnando/sparkline'
|
import sparkline from '@fnando/sparkline'
|
||||||
|
|
||||||
const {
|
const {
|
||||||
history,
|
history,
|
||||||
} = $defineProps<{
|
width = 60,
|
||||||
history?: History[]
|
height = 40,
|
||||||
|
} = defineProps<{
|
||||||
|
history?: mastodon.v1.TagHistory[]
|
||||||
|
width?: number
|
||||||
|
height?: number
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const historyNum = $computed(() => {
|
const historyNum = computed(() => {
|
||||||
if (!history)
|
if (!history)
|
||||||
return [1, 1, 1, 1, 1, 1, 1]
|
return [1, 1, 1, 1, 1, 1, 1]
|
||||||
return [...history].reverse().map(item => Number(item.accounts) || 0)
|
return [...history].reverse().map(item => Number(item.accounts) || 0)
|
||||||
})
|
})
|
||||||
|
|
||||||
const sparklineEl = $ref<SVGSVGElement>()
|
const sparklineEl = ref<SVGSVGElement>()
|
||||||
|
const sparklineFn = typeof sparkline !== 'function' ? (sparkline as any).default : sparkline
|
||||||
|
|
||||||
watch([$$(historyNum), $$(sparklineEl)], ([historyNum, sparklineEl]) => {
|
watch([historyNum, sparklineEl], ([historyNum, sparklineEl]) => {
|
||||||
if (!sparklineEl)
|
if (!sparklineEl)
|
||||||
return
|
return
|
||||||
sparkline(sparklineEl, historyNum)
|
sparklineFn(sparklineEl, historyNum)
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<svg ref="sparklineEl" class="sparkline" width="60" height="40" stroke-width="3" />
|
<svg ref="sparklineEl" class="sparkline" :width="width" :height="height" stroke-width="3" />
|
||||||
</template>
|
</template>
|
||||||
|
|
26
components/common/LocalizedNumber.vue
Normal file
26
components/common/LocalizedNumber.vue
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
defineOptions({
|
||||||
|
inheritAttrs: false,
|
||||||
|
})
|
||||||
|
|
||||||
|
const props = defineProps<{
|
||||||
|
count: number
|
||||||
|
keypath: string
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const { formatHumanReadableNumber, formatNumber, forSR } = useHumanReadableNumber()
|
||||||
|
|
||||||
|
const useSR = computed(() => forSR(props.count))
|
||||||
|
const rawNumber = computed(() => formatNumber(props.count))
|
||||||
|
const humanReadableNumber = computed(() => formatHumanReadableNumber(props.count))
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<i18n-t :keypath="keypath" :plural="count" tag="span" class="flex gap-x-1">
|
||||||
|
<CommonTooltip v-if="useSR" :content="rawNumber" placement="bottom">
|
||||||
|
<span aria-hidden="true" v-bind="$attrs">{{ humanReadableNumber }}</span>
|
||||||
|
<span sr-only>{{ rawNumber }}</span>
|
||||||
|
</CommonTooltip>
|
||||||
|
<span v-else v-bind="$attrs">{{ humanReadableNumber }}</span>
|
||||||
|
</i18n-t>
|
||||||
|
</template>
|
|
@ -1,7 +1,4 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
defineProps<{
|
|
||||||
smallScreen: boolean
|
|
||||||
}>()
|
|
||||||
const online = useOnline()
|
const online = useOnline()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,18 +1,28 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { dropdownContextKey } from './ctx'
|
import { InjectionKeyDropdownContext } from '~/constants/symbols'
|
||||||
|
|
||||||
defineProps<{
|
defineProps<{
|
||||||
placement?: string
|
placement?: string
|
||||||
|
autoBoundaryMaxSize?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const dropdown = $ref<any>()
|
const dropdown = ref<any>()
|
||||||
|
const colorMode = useColorMode()
|
||||||
|
|
||||||
provide(dropdownContextKey, {
|
function hide() {
|
||||||
hide: () => dropdown.hide(),
|
return dropdown.value.hide()
|
||||||
|
}
|
||||||
|
provide(InjectionKeyDropdownContext, {
|
||||||
|
hide,
|
||||||
|
})
|
||||||
|
|
||||||
|
defineExpose({
|
||||||
|
hide,
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<VDropdown v-bind="$attrs" ref="dropdown" :class="{ dark: isDark }" :placement="placement || 'auto'">
|
<VDropdown v-bind="$attrs" ref="dropdown" :class="colorMode.value" :placement="placement || 'auto'" :auto-boundary-max-size="autoBoundaryMaxSize">
|
||||||
<slot />
|
<slot />
|
||||||
<template #popper="scope">
|
<template #popper="scope">
|
||||||
<slot name="popper" v-bind="scope" />
|
<slot name="popper" v-bind="scope" />
|
||||||
|
|
|
@ -1,20 +1,21 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { dropdownContextKey } from './ctx'
|
const props = withDefaults(defineProps<{
|
||||||
|
is?: string
|
||||||
const props = defineProps<{
|
|
||||||
text?: string
|
text?: string
|
||||||
description?: string
|
description?: string
|
||||||
icon?: string
|
icon?: string
|
||||||
checked?: boolean
|
checked?: boolean
|
||||||
command?: boolean
|
command?: boolean
|
||||||
}>()
|
}>(), {
|
||||||
|
is: 'div',
|
||||||
|
})
|
||||||
const emit = defineEmits(['click'])
|
const emit = defineEmits(['click'])
|
||||||
|
|
||||||
const { hide } = inject(dropdownContextKey, undefined) || {}
|
const { hide } = useDropdownContext() || {}
|
||||||
|
|
||||||
const el = ref<HTMLDivElement>()
|
const el = ref<HTMLDivElement>()
|
||||||
|
|
||||||
const handleClick = (evt: MouseEvent) => {
|
function handleClick(evt: MouseEvent) {
|
||||||
hide?.()
|
hide?.()
|
||||||
emit('click', evt)
|
emit('click', evt)
|
||||||
}
|
}
|
||||||
|
@ -41,9 +42,13 @@ useCommand({
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div
|
<component
|
||||||
v-bind="$attrs" ref="el"
|
v-bind="$attrs"
|
||||||
|
:is="is"
|
||||||
|
ref="el"
|
||||||
|
w-full
|
||||||
flex gap-3 items-center cursor-pointer px4 py3
|
flex gap-3 items-center cursor-pointer px4 py3
|
||||||
|
select-none
|
||||||
hover-bg-active
|
hover-bg-active
|
||||||
:aria-label="text"
|
:aria-label="text"
|
||||||
@click="handleClick"
|
@click="handleClick"
|
||||||
|
@ -68,5 +73,5 @@ useCommand({
|
||||||
|
|
||||||
<div v-if="checked" i-ri:check-line />
|
<div v-if="checked" i-ri:check-line />
|
||||||
<slot name="actions" />
|
<slot name="actions" />
|
||||||
</div>
|
</component>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
import type { InjectionKey } from 'vue'
|
|
||||||
|
|
||||||
export const dropdownContextKey: InjectionKey<{
|
|
||||||
hide: () => void
|
|
||||||
}> = Symbol('dropdownContextKey')
|
|
|
@ -4,7 +4,7 @@ const props = defineProps<{
|
||||||
lang?: string
|
lang?: string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const raw = $computed(() => decodeURIComponent(props.code).replace(/'/g, '\''))
|
const raw = computed(() => decodeURIComponent(props.code).replace(/'/g, '\''))
|
||||||
|
|
||||||
const langMap: Record<string, string> = {
|
const langMap: Record<string, string> = {
|
||||||
js: 'javascript',
|
js: 'javascript',
|
||||||
|
@ -13,10 +13,11 @@ const langMap: Record<string, string> = {
|
||||||
}
|
}
|
||||||
|
|
||||||
const highlighted = computed(() => {
|
const highlighted = computed(() => {
|
||||||
return props.lang ? highlightCode(raw, (langMap[props.lang] || props.lang) as any) : raw
|
return props.lang ? highlightCode(raw.value, (langMap[props.lang] || props.lang) as any) : raw
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<pre class="code-block" v-html="highlighted" />
|
<pre v-if="lang" class="code-block" v-html="highlighted" />
|
||||||
|
<pre v-else class="code-block">{{ raw }}</pre>
|
||||||
</template>
|
</template>
|
||||||
|
|
11
components/content/ContentMentionGroup.vue
Normal file
11
components/content/ContentMentionGroup.vue
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
defineProps<{
|
||||||
|
replying?: boolean
|
||||||
|
}>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<p flex="~ gap-1 wrap" items-center text-sm :class="{ 'zen-none': !replying }">
|
||||||
|
<span i-ri-arrow-right-line ml--1 text-secondary-light /><slot />
|
||||||
|
</p>
|
||||||
|
</template>
|
|
@ -1,21 +1,29 @@
|
||||||
import type { Emoji } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
import { emojisArrayToObject } from '~/composables/utils'
|
|
||||||
|
|
||||||
defineOptions({
|
defineOptions({
|
||||||
name: 'ContentRich',
|
name: 'ContentRich',
|
||||||
})
|
})
|
||||||
|
|
||||||
const { content, emojis, markdown = true } = defineProps<{
|
const {
|
||||||
|
content,
|
||||||
|
emojis,
|
||||||
|
hideEmojis = false,
|
||||||
|
markdown = true,
|
||||||
|
} = defineProps<{
|
||||||
content: string
|
content: string
|
||||||
|
emojis?: mastodon.v1.CustomEmoji[]
|
||||||
|
hideEmojis?: boolean
|
||||||
markdown?: boolean
|
markdown?: boolean
|
||||||
emojis?: Emoji[]
|
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const emojisObject = useEmojisFallback(() => emojis)
|
||||||
|
|
||||||
export default () => h(
|
export default () => h(
|
||||||
'span',
|
'span',
|
||||||
{ class: 'content-rich' },
|
{ class: 'content-rich', dir: 'auto' },
|
||||||
contentToVNode(content, {
|
contentToVNode(content, {
|
||||||
emojis: emojisArrayToObject(emojis || []),
|
emojis: emojisObject.value,
|
||||||
|
hideEmojis,
|
||||||
markdown,
|
markdown,
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Conversation } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
const { conversation } = defineProps<{
|
const { conversation } = defineProps<{
|
||||||
conversation: Conversation
|
conversation: mastodon.v1.Conversation
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const withAccounts = $computed(() =>
|
const withAccounts = computed(() =>
|
||||||
conversation.accounts.filter(account => account.id !== conversation.lastStatus?.account.id),
|
conversation.accounts.filter(account => account.id !== conversation.lastStatus?.account.id),
|
||||||
)
|
)
|
||||||
</script>
|
</script>
|
||||||
|
@ -15,7 +15,7 @@ const withAccounts = $computed(() =>
|
||||||
<StatusCard v-if="conversation.lastStatus" :status="conversation.lastStatus" :actions="false">
|
<StatusCard v-if="conversation.lastStatus" :status="conversation.lastStatus" :actions="false">
|
||||||
<template #meta>
|
<template #meta>
|
||||||
<div flex gap-2 text-sm text-secondary font-bold>
|
<div flex gap-2 text-sm text-secondary font-bold>
|
||||||
<p mr-1>
|
<p me-1>
|
||||||
{{ $t('conversation.with') }}
|
{{ $t('conversation.with') }}
|
||||||
</p>
|
</p>
|
||||||
<AccountAvatar v-for="account in withAccounts" :key="account.id" h-5 w-5 :account="account" />
|
<AccountAvatar v-for="account in withAccounts" :key="account.id" h-5 w-5 :account="account" />
|
||||||
|
|
|
@ -1,13 +1,20 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Conversation, Paginator } from 'masto'
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
const { paginator } = defineProps<{
|
const { paginator } = defineProps<{
|
||||||
paginator: Paginator<any, Conversation[]>
|
paginator: mastodon.Paginator<mastodon.v1.Conversation[], mastodon.DefaultPaginationParams>
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
function preprocess(items: mastodon.v1.Conversation[]): mastodon.v1.Conversation[] {
|
||||||
|
const isAuthored = (conversation: mastodon.v1.Conversation) => conversation.lastStatus ? conversation.lastStatus.account.id === currentUser.value?.account.id : false
|
||||||
|
return items.filter(item => isAuthored(item) || !item.lastStatus?.filtered?.find(
|
||||||
|
filter => filter.filter.filterAction === 'hide' && filter.filter.context.includes('thread'),
|
||||||
|
))
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CommonPaginator :paginator="paginator">
|
<CommonPaginator :paginator="paginator" :preprocess="preprocess">
|
||||||
<template #default="{ item }">
|
<template #default="{ item }">
|
||||||
<ConversationCard
|
<ConversationCard
|
||||||
:conversation="item"
|
:conversation="item"
|
||||||
|
|
30
components/emoji/Emoji.vue
Normal file
30
components/emoji/Emoji.vue
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
const { as, alt, dataEmojiId } = defineProps<{
|
||||||
|
as: string
|
||||||
|
alt?: string
|
||||||
|
dataEmojiId?: string
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const title = ref<string | undefined>()
|
||||||
|
|
||||||
|
if (alt) {
|
||||||
|
if (alt.startsWith(':')) {
|
||||||
|
title.value = alt.replace(/:/g, '')
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
import('node-emoji').then(({ find }) => {
|
||||||
|
title.value = find(alt)?.key.replace(/_/g, ' ')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if it has a data-emoji-id, use that as the title instead
|
||||||
|
if (dataEmojiId)
|
||||||
|
title.value = dataEmojiId
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<component :is="as" v-bind="$attrs" :alt="alt" :data-emoji-id="dataEmojiId" :title="title">
|
||||||
|
<slot />
|
||||||
|
</component>
|
||||||
|
</template>
|
|
@ -1,50 +1,18 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
interface Team {
|
|
||||||
github: string
|
|
||||||
display: string
|
|
||||||
twitter: string
|
|
||||||
mastodon: string
|
|
||||||
}
|
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
(event: 'close'): void
|
(event: 'close'): void
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const teams: Team[] = [
|
const vAutoFocus = (el: HTMLElement) => el.focus()
|
||||||
{
|
|
||||||
github: 'antfu',
|
|
||||||
display: 'Anthony Fu',
|
|
||||||
twitter: 'antfu7',
|
|
||||||
mastodon: 'antfu@mas.to',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
github: 'patak-dev',
|
|
||||||
display: 'Patak',
|
|
||||||
twitter: 'patak_dev',
|
|
||||||
mastodon: 'patak@webtoo.ls',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
github: 'danielroe',
|
|
||||||
display: 'Daniel Roe',
|
|
||||||
twitter: 'danielcroe',
|
|
||||||
mastodon: 'daniel@roe.dev',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
github: 'sxzz',
|
|
||||||
display: 'sxzz',
|
|
||||||
twitter: 'sanxiaozhizi',
|
|
||||||
mastodon: 'sxzz@mas.to',
|
|
||||||
},
|
|
||||||
].sort(() => Math.random() - 0.5)
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div my-8 px-3 sm:px-8 md:max-w-200 flex="~ col gap-4" relative>
|
<div my-8 px-3 sm:px-8 md:max-w-200 flex="~ col gap-4" relative>
|
||||||
<button btn-action-icon absolute top--8 right-0 m1 aria-label="Close" @click="emit('close')">
|
<button v-auto-focus type="button" btn-action-icon absolute top--8 right-0 m1 aria-label="Close" @click="emit('close')">
|
||||||
<div i-ri:close-line />
|
<span i-ri:close-line />
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<img src="/logo.svg" w-20 h-20 height="80" width="80" mxa alt="logo">
|
<img :alt="$t('app_logo')" :src="`/${''}logo.svg`" w-20 h-20 height="80" width="80" mxa class="rtl-flip">
|
||||||
<h1 mxa text-4xl mb4>
|
<h1 mxa text-4xl mb4>
|
||||||
{{ $t('help.title') }}
|
{{ $t('help.title') }}
|
||||||
</h1>
|
</h1>
|
||||||
|
@ -56,23 +24,29 @@ const teams: Team[] = [
|
||||||
{{ $t('help.desc_para2') }}
|
{{ $t('help.desc_para2') }}
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
Before that, if you'd like to help with testing, giving feedback, or contributing, <a font-bold text-primary href="/m.webtoo.ls/@elk" target="_blank">
|
{{ $t('help.desc_para4') }}
|
||||||
reach out to us on Mastodon
|
<NuxtLink font-bold text-primary href="https://github.com/elk-zone/elk" target="_blank">
|
||||||
</a> and get involved.
|
{{ $t('help.desc_para5') }}
|
||||||
|
</NuxtLink>
|
||||||
|
{{ $t('help.desc_para6') }}
|
||||||
</p>
|
</p>
|
||||||
{{ $t('help.desc_para3') }}
|
<NuxtLink hover:text-primary href="https://github.com/sponsors/elk-zone" target="_blank">
|
||||||
<p flex="~ gap-2 wrap" mxa>
|
{{ $t('help.desc_para3') }}
|
||||||
<template v-for="team of teams" :key="team.github">
|
</NuxtLink>
|
||||||
<a :href="`https://github.com/sponsors/${team.github}`" target="_blank" rounded-full transition duration-300 border="~ transparent" hover="scale-105 border-primary">
|
<p flex="~ gap-2 wrap justify-center" mxa>
|
||||||
<img :src="`https://res.cloudinary.com/dchoja2nb/image/twitter_name/h_120,w_120/f_auto/${team.twitter}.jpg`" :alt="team.display" rounded-full w-15 h-15 height="60" width="60">
|
<template v-for="team of elkTeamMembers" :key="team.github">
|
||||||
</a>
|
<NuxtLink :href="team.link" target="_blank" external rounded-full transition duration-300 border="~ transparent" hover="scale-105 border-primary">
|
||||||
|
<img :src="`/avatars/${team.github}-100x100.png`" :alt="team.display" rounded-full w-15 h-15 height="60" width="60">
|
||||||
|
</NuxtLink>
|
||||||
</template>
|
</template>
|
||||||
</p>
|
</p>
|
||||||
<p italic flex justify-center w-full>
|
<p italic flex justify-center w-full>
|
||||||
<span text-xl font-script>The Elk Team</span>
|
<NuxtLink href="https://github.com/sponsors/elk-zone" target="_blank">
|
||||||
|
<span text-xl font-script hover:text-primary transition duration-300>{{ $t('help.footer_team') }}</span>
|
||||||
|
</NuxtLink>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<button btn-solid mxa tabindex="2" @click="emit('close')">
|
<button type="button" btn-solid mxa @click="emit('close')">
|
||||||
{{ $t('action.enter_app') }}
|
{{ $t('action.enter_app') }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
55
components/list/Account.vue
Normal file
55
components/list/Account.vue
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
|
const { account, list } = defineProps<{
|
||||||
|
account: mastodon.v1.Account
|
||||||
|
hoverCard?: boolean
|
||||||
|
list: string
|
||||||
|
}>()
|
||||||
|
|
||||||
|
cacheAccount(account)
|
||||||
|
|
||||||
|
const client = useMastoClient()
|
||||||
|
|
||||||
|
const isRemoved = ref(false)
|
||||||
|
|
||||||
|
async function edit() {
|
||||||
|
try {
|
||||||
|
isRemoved.value
|
||||||
|
? await client.v1.lists.$select(list).accounts.create({ accountIds: [account.id] })
|
||||||
|
: await client.v1.lists.$select(list).accounts.remove({ accountIds: [account.id] })
|
||||||
|
isRemoved.value = !isRemoved.value
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.error(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div flex justify-between hover:bg-active transition-100 items-center>
|
||||||
|
<AccountInfo
|
||||||
|
:account="account" hover p1 as="router-link"
|
||||||
|
:hover-card="hoverCard"
|
||||||
|
shrink
|
||||||
|
overflow-hidden
|
||||||
|
:to="getAccountRoute(account)"
|
||||||
|
/>
|
||||||
|
<div>
|
||||||
|
<CommonTooltip
|
||||||
|
:content="isRemoved ? $t('list.add_account') : $t('list.remove_account')"
|
||||||
|
:hover="isRemoved ? 'text-green' : 'text-red'"
|
||||||
|
no-auto-focus
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
text-sm p2 border-1 transition-colors
|
||||||
|
border-dark
|
||||||
|
btn-action-icon
|
||||||
|
@click="edit"
|
||||||
|
>
|
||||||
|
<span :class="isRemoved ? 'i-ri:user-add-line' : 'i-ri:user-unfollow-line'" />
|
||||||
|
</button>
|
||||||
|
</CommonTooltip>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
211
components/list/ListEntry.vue
Normal file
211
components/list/ListEntry.vue
Normal file
|
@ -0,0 +1,211 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { mastodon } from 'masto'
|
||||||
|
import { useForm } from 'slimeform'
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(e: 'listUpdated', list: mastodon.v1.List): void
|
||||||
|
(e: 'listRemoved', id: string): void
|
||||||
|
}>()
|
||||||
|
const list = defineModel<mastodon.v1.List>({ required: true })
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
const client = useMastoClient()
|
||||||
|
|
||||||
|
const { form, isDirty, submitter, reset } = useForm({
|
||||||
|
form: () => ({ ...list.value }),
|
||||||
|
})
|
||||||
|
|
||||||
|
const isEditing = ref<boolean>(false)
|
||||||
|
const deleting = ref<boolean>(false)
|
||||||
|
const actionError = ref<string | undefined>(undefined)
|
||||||
|
|
||||||
|
const input = ref<HTMLInputElement>()
|
||||||
|
const editBtn = ref<HTMLButtonElement>()
|
||||||
|
const deleteBtn = ref<HTMLButtonElement>()
|
||||||
|
|
||||||
|
async function prepareEdit() {
|
||||||
|
isEditing.value = true
|
||||||
|
actionError.value = undefined
|
||||||
|
await nextTick()
|
||||||
|
input.value?.focus()
|
||||||
|
}
|
||||||
|
async function cancelEdit() {
|
||||||
|
isEditing.value = false
|
||||||
|
actionError.value = undefined
|
||||||
|
reset()
|
||||||
|
|
||||||
|
await nextTick()
|
||||||
|
editBtn.value?.focus()
|
||||||
|
}
|
||||||
|
|
||||||
|
const { submit, submitting } = submitter(async () => {
|
||||||
|
try {
|
||||||
|
list.value = await client.v1.lists.$select(form.id).update({
|
||||||
|
title: form.title,
|
||||||
|
})
|
||||||
|
cancelEdit()
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.error(err)
|
||||||
|
actionError.value = (err as Error).message
|
||||||
|
await nextTick()
|
||||||
|
input.value?.focus()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
async function removeList() {
|
||||||
|
if (deleting.value)
|
||||||
|
return
|
||||||
|
|
||||||
|
const confirmDelete = await openConfirmDialog({
|
||||||
|
title: t('confirm.delete_list.title'),
|
||||||
|
description: t('confirm.delete_list.description', [list.value.title]),
|
||||||
|
confirm: t('confirm.delete_list.confirm'),
|
||||||
|
cancel: t('confirm.delete_list.cancel'),
|
||||||
|
})
|
||||||
|
|
||||||
|
deleting.value = true
|
||||||
|
actionError.value = undefined
|
||||||
|
await nextTick()
|
||||||
|
|
||||||
|
if (confirmDelete.choice === 'confirm') {
|
||||||
|
await nextTick()
|
||||||
|
try {
|
||||||
|
await client.v1.lists.$select(list.value.id).remove()
|
||||||
|
emit('listRemoved', list.value.id)
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.error(err)
|
||||||
|
actionError.value = (err as Error).message
|
||||||
|
await nextTick()
|
||||||
|
deleteBtn.value?.focus()
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
deleting.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
deleting.value = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function clearError() {
|
||||||
|
actionError.value = undefined
|
||||||
|
await nextTick()
|
||||||
|
if (isEditing.value)
|
||||||
|
input.value?.focus()
|
||||||
|
else
|
||||||
|
deleteBtn.value?.focus()
|
||||||
|
}
|
||||||
|
|
||||||
|
onDeactivated(cancelEdit)
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<form
|
||||||
|
hover:bg-active flex justify-between items-center gap-x-2
|
||||||
|
:aria-describedby="actionError ? `action-list-error-${list.id}` : undefined"
|
||||||
|
:class="actionError ? 'border border-base border-rounded rounded-be-is-0 rounded-be-ie-0 border-b-unset border-$c-danger-active' : null"
|
||||||
|
@submit.prevent="submit"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
v-if="isEditing"
|
||||||
|
bg-base border="~ base" h10 m2 ps-1 pe-4 rounded-3 w-full flex="~ row"
|
||||||
|
items-center relative focus-within:box-shadow-outline gap-3
|
||||||
|
>
|
||||||
|
<CommonTooltip v-if="isEditing" :content="$t('list.cancel_edit')" no-auto-focus>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
rounded-full text-sm p2 transition-colors
|
||||||
|
hover:text-primary
|
||||||
|
@click="cancelEdit()"
|
||||||
|
>
|
||||||
|
<span block text-current i-ri:close-fill />
|
||||||
|
</button>
|
||||||
|
</CommonTooltip>
|
||||||
|
<input
|
||||||
|
ref="input"
|
||||||
|
v-model="form.title"
|
||||||
|
rounded-3 w-full bg-transparent
|
||||||
|
outline="focus:none" pe-4 pb="1px"
|
||||||
|
flex-1 placeholder-text-secondary
|
||||||
|
@keydown.esc="cancelEdit()"
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
<NuxtLink v-else :to="`list/${list.id}`" block grow p4>
|
||||||
|
{{ form.title }}
|
||||||
|
</NuxtLink>
|
||||||
|
<div mr4 flex gap2>
|
||||||
|
<CommonTooltip v-if="isEditing" :content="$t('list.save')" no-auto-focus>
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
text-sm p2 border-1 transition-colors
|
||||||
|
border-dark hover:text-primary
|
||||||
|
btn-action-icon
|
||||||
|
:disabled="deleting || !isDirty || submitting"
|
||||||
|
>
|
||||||
|
<template v-if="isEditing">
|
||||||
|
<span v-if="submitting" aria-hidden="true" block animate animate-spin preserve-3d class="rtl-flip">
|
||||||
|
<span block i-ri:loader-2-fill aria-hidden="true" />
|
||||||
|
</span>
|
||||||
|
<span v-else block text-current i-ri:save-2-fill class="rtl-flip" />
|
||||||
|
</template>
|
||||||
|
</button>
|
||||||
|
</CommonTooltip>
|
||||||
|
<CommonTooltip v-else :content="$t('list.edit')" no-auto-focus>
|
||||||
|
<button
|
||||||
|
ref="editBtn"
|
||||||
|
type="button"
|
||||||
|
text-sm p2 border-1 transition-colors
|
||||||
|
border-dark hover:text-primary
|
||||||
|
btn-action-icon
|
||||||
|
@click.prevent="prepareEdit"
|
||||||
|
>
|
||||||
|
<span block text-current i-ri:edit-2-line class="rtl-flip" />
|
||||||
|
</button>
|
||||||
|
</CommonTooltip>
|
||||||
|
<CommonTooltip :content="$t('list.delete')" no-auto-focus>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
text-sm p2 border-1 transition-colors
|
||||||
|
border-dark hover:text-primary
|
||||||
|
btn-action-icon
|
||||||
|
:disabled="isEditing"
|
||||||
|
@click.prevent="removeList"
|
||||||
|
>
|
||||||
|
<span v-if="deleting" aria-hidden="true" block animate animate-spin preserve-3d class="rtl-flip">
|
||||||
|
<span block i-ri:loader-2-fill aria-hidden="true" />
|
||||||
|
</span>
|
||||||
|
<span v-else block text-current i-ri:delete-bin-2-line class="rtl-flip" />
|
||||||
|
</button>
|
||||||
|
</CommonTooltip>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<CommonErrorMessage
|
||||||
|
v-if="actionError"
|
||||||
|
:id="`action-list-error-${list.id}`"
|
||||||
|
:described-by="`action-list-failed-${list.id}`"
|
||||||
|
class="rounded-bs-is-0 rounded-bs-ie-0 border-t-dashed m-b-2"
|
||||||
|
>
|
||||||
|
<header :id="`action-list-failed-${list.id}`" flex justify-between>
|
||||||
|
<div flex items-center gap-x-2 font-bold>
|
||||||
|
<div aria-hidden="true" i-ri:error-warning-fill />
|
||||||
|
<p>{{ $t(`list.${isEditing ? 'edit_error' : 'delete_error'}`) }}</p>
|
||||||
|
</div>
|
||||||
|
<CommonTooltip placement="bottom" :content="$t('list.clear_error')" no-auto-focus>
|
||||||
|
<button
|
||||||
|
flex rounded-4 p1 hover:bg-active cursor-pointer transition-100 :aria-label="$t('list.clear_error')"
|
||||||
|
@click="clearError"
|
||||||
|
>
|
||||||
|
<span aria-hidden="true" w="1.75em" h="1.75em" i-ri:close-line />
|
||||||
|
</button>
|
||||||
|
</CommonTooltip>
|
||||||
|
</header>
|
||||||
|
<ol ps-2 sm:ps-1>
|
||||||
|
<li flex="~ col sm:row" gap-y-1 sm:gap-x-2>
|
||||||
|
<strong sr-only>{{ $t('list.error_prefix') }}</strong>
|
||||||
|
<span>{{ actionError }}</span>
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</CommonErrorMessage>
|
||||||
|
</template>
|
53
components/list/Lists.vue
Normal file
53
components/list/Lists.vue
Normal file
|
@ -0,0 +1,53 @@
|
||||||
|
<script lang="ts" setup>
|
||||||
|
const { userId } = defineProps<{
|
||||||
|
userId: string
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const { client } = useMasto()
|
||||||
|
const paginator = client.value.v1.lists.list()
|
||||||
|
const listsWithUser = ref((await client.value.v1.accounts.$select(userId).lists.list()).map(list => list.id))
|
||||||
|
|
||||||
|
function indexOfUserInList(listId: string) {
|
||||||
|
return listsWithUser.value.indexOf(listId)
|
||||||
|
}
|
||||||
|
|
||||||
|
async function edit(listId: string) {
|
||||||
|
try {
|
||||||
|
const index = indexOfUserInList(listId)
|
||||||
|
if (index === -1) {
|
||||||
|
await client.value.v1.lists.$select(listId).accounts.create({ accountIds: [userId] })
|
||||||
|
listsWithUser.value.push(listId)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
await client.value.v1.lists.$select(listId).accounts.remove({ accountIds: [userId] })
|
||||||
|
listsWithUser.value = listsWithUser.value.filter(id => id !== listId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
console.error(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<CommonPaginator :end-message="false" :paginator="paginator">
|
||||||
|
<template #default="{ item }">
|
||||||
|
<div p4 hover:bg-active block w="100%" flex justify-between items-center gap-4>
|
||||||
|
<p>{{ item.title }}</p>
|
||||||
|
<CommonTooltip
|
||||||
|
:content="indexOfUserInList(item.id) === -1 ? $t('list.add_account') : $t('list.remove_account')"
|
||||||
|
:hover="indexOfUserInList(item.id) === -1 ? 'text-green' : 'text-red'"
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
text-sm p2 border-1 transition-colors
|
||||||
|
border-dark
|
||||||
|
btn-action-icon
|
||||||
|
@click="() => edit(item.id)"
|
||||||
|
>
|
||||||
|
<span :class="indexOfUserInList(item.id) === -1 ? 'i-ri:user-add-line' : 'i-ri:user-unfollow-line'" />
|
||||||
|
</button>
|
||||||
|
</CommonTooltip>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
</CommonPaginator>
|
||||||
|
</template>
|
166
components/magickeys/MagickeysKeyboardShortcuts.vue
Normal file
166
components/magickeys/MagickeysKeyboardShortcuts.vue
Normal file
|
@ -0,0 +1,166 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
const emit = defineEmits(['close'])
|
||||||
|
const { t } = useI18n()
|
||||||
|
|
||||||
|
/* TODOs:
|
||||||
|
* - I18n
|
||||||
|
*/
|
||||||
|
|
||||||
|
interface ShortcutDef {
|
||||||
|
keys: string[]
|
||||||
|
isSequence: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ShortcutItem {
|
||||||
|
description: string
|
||||||
|
shortcut: ShortcutDef
|
||||||
|
}
|
||||||
|
|
||||||
|
interface ShortcutItemGroup {
|
||||||
|
name: string
|
||||||
|
items: ShortcutItem[]
|
||||||
|
}
|
||||||
|
|
||||||
|
const isMac = useIsMac()
|
||||||
|
const modifierKeyName = computed(() => isMac.value ? '⌘' : 'Ctrl')
|
||||||
|
|
||||||
|
const shortcutItemGroups = computed<ShortcutItemGroup[]>(() => [
|
||||||
|
{
|
||||||
|
name: t('magic_keys.groups.navigation.title'),
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.navigation.shortcut_help'),
|
||||||
|
shortcut: { keys: ['?'], isSequence: false },
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// description: t('magic_keys.groups.navigation.next_status'),
|
||||||
|
// shortcut: { keys: ['j'], isSequence: false },
|
||||||
|
// },
|
||||||
|
// {
|
||||||
|
// description: t('magic_keys.groups.navigation.previous_status'),
|
||||||
|
// shortcut: { keys: ['k'], isSequence: false },
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.navigation.go_to_search'),
|
||||||
|
shortcut: { keys: ['/'], isSequence: false },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.navigation.go_to_home'),
|
||||||
|
shortcut: { keys: ['g', 'h'], isSequence: true },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.navigation.go_to_notifications'),
|
||||||
|
shortcut: { keys: ['g', 'n'], isSequence: true },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.navigation.go_to_conversations'),
|
||||||
|
shortcut: { keys: ['g', 'c'], isSequence: true },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.navigation.go_to_favourites'),
|
||||||
|
shortcut: { keys: ['g', 'f'], isSequence: true },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.navigation.go_to_bookmarks'),
|
||||||
|
shortcut: { keys: ['g', 'b'], isSequence: true },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.navigation.go_to_explore'),
|
||||||
|
shortcut: { keys: ['g', 'e'], isSequence: true },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.navigation.go_to_local'),
|
||||||
|
shortcut: { keys: ['g', 'l'], isSequence: true },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.navigation.go_to_federated'),
|
||||||
|
shortcut: { keys: ['g', 't'], isSequence: true },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.navigation.go_to_lists'),
|
||||||
|
shortcut: { keys: ['g', 'i'], isSequence: true },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.navigation.go_to_settings'),
|
||||||
|
shortcut: { keys: ['g', 's'], isSequence: true },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.navigation.go_to_profile'),
|
||||||
|
shortcut: { keys: ['g', 'p'], isSequence: true },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: t('magic_keys.groups.actions.title'),
|
||||||
|
items: [
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.actions.search'),
|
||||||
|
shortcut: { keys: [modifierKeyName.value, 'k'], isSequence: false },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.actions.command_mode'),
|
||||||
|
shortcut: { keys: [modifierKeyName.value, '/'], isSequence: false },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.actions.compose'),
|
||||||
|
shortcut: { keys: ['c'], isSequence: false },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.actions.show_new_items'),
|
||||||
|
shortcut: { keys: ['.'], isSequence: false },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.actions.favourite'),
|
||||||
|
shortcut: { keys: ['f'], isSequence: false },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.actions.boost'),
|
||||||
|
shortcut: { keys: ['b'], isSequence: false },
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: t('magic_keys.groups.media.title'),
|
||||||
|
items: [],
|
||||||
|
},
|
||||||
|
])
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div px-3 sm:px-5 py-2 sm:py-4 max-w-220 relative max-h-screen>
|
||||||
|
<button btn-action-icon absolute top-1 sm:top-2 right-1 sm:right-2 m1 :aria-label="$t('modals.aria_label_close')" @click="emit('close')">
|
||||||
|
<div i-ri:close-fill />
|
||||||
|
</button>
|
||||||
|
<h2 text-xl font-700 mb3>
|
||||||
|
{{ $t('magic_keys.dialog_header') }}
|
||||||
|
</h2>
|
||||||
|
<div mb2 grid grid-cols-1 md:grid-cols-3 gap-y- md:gap-x-6 lg:gap-x-8>
|
||||||
|
<div
|
||||||
|
v-for="group in shortcutItemGroups"
|
||||||
|
:key="group.name"
|
||||||
|
>
|
||||||
|
<h3 font-700 my-2 text-lg>
|
||||||
|
{{ group.name }}
|
||||||
|
</h3>
|
||||||
|
<div
|
||||||
|
v-for="item in group.items"
|
||||||
|
:key="item.description"
|
||||||
|
flex my-1 lg:my-2 justify-between place-items-center max-w-full text-base
|
||||||
|
>
|
||||||
|
<div mr-2 break-words overflow-hidden leading-4 h-full inline-block align-middle>
|
||||||
|
{{ item.description }}
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<template
|
||||||
|
v-for="(key, idx) in item.shortcut.keys"
|
||||||
|
:key="idx"
|
||||||
|
>
|
||||||
|
<span v-if="idx !== 0" mx1 text-sm op80>{{ item.shortcut.isSequence ? $t('magic_keys.sequence_then') : '+' }}</span>
|
||||||
|
<code class="px2 md:px1.5 lg:px2 lg:px2 py0 lg:py-0.5" rounded bg-code border="px $c-border-code" shadow-sm my1 font-mono font-600>{{ key }}</code>
|
||||||
|
</template>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
|
@ -1,32 +1,69 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
defineProps<{
|
defineProps<{
|
||||||
|
/** Show the back button on small screens */
|
||||||
|
backOnSmallScreen?: boolean
|
||||||
|
/** Show the back button on both small and big screens */
|
||||||
back?: boolean
|
back?: boolean
|
||||||
|
/** Do not applying overflow hidden to let use floatable components in title */
|
||||||
|
noOverflowHidden?: boolean
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const container = ref()
|
||||||
|
const route = useRoute()
|
||||||
|
const userSettings = useUserSettings()
|
||||||
|
const { height: windowHeight } = useWindowSize()
|
||||||
|
const { height: containerHeight } = useElementBounding(container)
|
||||||
|
const wideLayout = computed(() => route.meta.wideLayout ?? false)
|
||||||
|
const sticky = computed(() => route.path?.startsWith('/settings/'))
|
||||||
|
const containerClass = computed(() => {
|
||||||
|
// we keep original behavior when not in settings page and when the window height is smaller than the container height
|
||||||
|
if (!isHydrated.value || !sticky.value || (windowHeight.value < containerHeight.value))
|
||||||
|
return null
|
||||||
|
|
||||||
|
return 'lg:sticky lg:top-0'
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div relative>
|
<div ref="container" :class="containerClass">
|
||||||
<div
|
<div
|
||||||
sticky top-0 z10
|
sticky top-0 z10
|
||||||
border="b base" bg-base
|
pt="[env(safe-area-inset-top,0)]"
|
||||||
|
bg="[rgba(var(--rgb-bg-base),0.7)]"
|
||||||
|
class="native:lg:w-[calc(100vw-5rem)] native:xl:w-[calc(135%+(100vw-1200px)/2)]"
|
||||||
|
:class="{
|
||||||
|
'backdrop-blur': !getPreferences(userSettings, 'optimizeForLowPerformanceDevice'),
|
||||||
|
}"
|
||||||
>
|
>
|
||||||
<div flex justify-between px5 py4>
|
<div flex justify-between px5 py2 :class="{ 'xl:hidden': $route.name !== 'tag' }" class="native:xl:flex" border="b base">
|
||||||
<div flex gap-3 items-center overflow-hidden>
|
<div flex gap-3 items-center :overflow-hidden="!noOverflowHidden ? '' : false" py2 w-full>
|
||||||
<NuxtLink v-if="back" flex="~ gap1" items-center btn-text p-0 @click="$router.go(-1)">
|
<NuxtLink
|
||||||
<div i-ri:arrow-left-line />
|
v-if="backOnSmallScreen || back" flex="~ gap1" items-center btn-text p-0 xl:hidden
|
||||||
|
:aria-label="$t('nav.back')"
|
||||||
|
@click="$router.go(-1)"
|
||||||
|
>
|
||||||
|
<div i-ri:arrow-left-line class="rtl-flip" />
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
<div truncate>
|
<div :truncate="!noOverflowHidden ? '' : false" flex w-full data-tauri-drag-region class="native-mac:justify-start native-mac:text-center">
|
||||||
<slot name="title" />
|
<slot name="title" />
|
||||||
</div>
|
</div>
|
||||||
<div h-7 w-1px />
|
<div sm:hidden h-7 w-1px />
|
||||||
</div>
|
</div>
|
||||||
<div flex items-center flex-shrink-0 gap-x-2>
|
<div flex items-center flex-shrink-0 gap-x-2>
|
||||||
<slot name="actions" />
|
<slot name="actions" />
|
||||||
<NavUser v-if="isHydrated.value" />
|
<PwaBadge xl:hidden />
|
||||||
|
<NavUser v-if="isHydrated" />
|
||||||
|
<NavUserSkeleton v-else />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<slot name="header" />
|
<slot name="header">
|
||||||
|
<div hidden />
|
||||||
|
</slot>
|
||||||
|
</div>
|
||||||
|
<PwaInstallPrompt xl:hidden />
|
||||||
|
<div :class="isHydrated && wideLayout ? 'xl:w-full sm:max-w-600px' : 'sm:max-w-600px md:shrink-0'" m-auto>
|
||||||
|
<div hidden :class="{ 'xl:block': $route.name !== 'tag' && !$slots.header }" h-6 />
|
||||||
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
<slot />
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
45
components/modal/DurationPicker.vue
Normal file
45
components/modal/DurationPicker.vue
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
const model = defineModel<number>()
|
||||||
|
const isValid = defineModel<boolean>('isValid')
|
||||||
|
|
||||||
|
const days = ref<number | ''>(0)
|
||||||
|
const hours = ref<number | ''>(1)
|
||||||
|
const minutes = ref<number | ''>(0)
|
||||||
|
|
||||||
|
watchEffect(() => {
|
||||||
|
if (days.value === '' || hours.value === '' || minutes.value === '') {
|
||||||
|
isValid.value = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const duration
|
||||||
|
= days.value * 24 * 60 * 60
|
||||||
|
+ hours.value * 60 * 60
|
||||||
|
+ minutes.value * 60
|
||||||
|
|
||||||
|
if (duration <= 0) {
|
||||||
|
isValid.value = false
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
isValid.value = true
|
||||||
|
model.value = duration
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div flex flex-grow-0 gap-2>
|
||||||
|
<label flex items-center gap-2>
|
||||||
|
<input v-model="days" type="number" min="0" max="1999" input-base :class="!isValid ? 'input-error' : null">
|
||||||
|
{{ $t('confirm.mute_account.days', days === '' ? 0 : days) }}
|
||||||
|
</label>
|
||||||
|
<label flex items-center gap-2>
|
||||||
|
<input v-model="hours" type="number" min="0" max="24" input-base :class="!isValid ? 'input-error' : null">
|
||||||
|
{{ $t('confirm.mute_account.hours', hours === '' ? 0 : hours) }}
|
||||||
|
</label>
|
||||||
|
<label flex items-center gap-2>
|
||||||
|
<input v-model="minutes" type="number" min="0" max="59" step="5" input-base :class="!isValid ? 'input-error' : null">
|
||||||
|
{{ $t('confirm.mute_account.minute', minutes === '' ? 0 : minutes) }}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</template>
|
57
components/modal/ModalConfirm.vue
Normal file
57
components/modal/ModalConfirm.vue
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { ConfirmDialogChoice, ConfirmDialogOptions } from '~/types'
|
||||||
|
import DurationPicker from '~/components/modal/DurationPicker.vue'
|
||||||
|
|
||||||
|
const props = defineProps<ConfirmDialogOptions>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(evt: 'choice', choice: ConfirmDialogChoice): void
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const hasDuration = ref(false)
|
||||||
|
const isValidDuration = ref(true)
|
||||||
|
const duration = ref(60 * 60) // default to 1 hour
|
||||||
|
const shouldMuteNotifications = ref(true)
|
||||||
|
const isMute = computed(() => props.extraOptionType === 'mute')
|
||||||
|
|
||||||
|
function handleChoice(choice: ConfirmDialogChoice['choice']) {
|
||||||
|
const dialogChoice = {
|
||||||
|
choice,
|
||||||
|
...isMute.value && {
|
||||||
|
extraOptions: {
|
||||||
|
mute: {
|
||||||
|
duration: hasDuration.value ? duration.value : 0,
|
||||||
|
notifications: shouldMuteNotifications.value,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
emit('choice', dialogChoice)
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div flex="~ col" gap-6>
|
||||||
|
<div font-bold text-lg>
|
||||||
|
{{ title }}
|
||||||
|
</div>
|
||||||
|
<div v-if="description">
|
||||||
|
{{ description }}
|
||||||
|
</div>
|
||||||
|
<div v-if="isMute" flex-col flex gap-4>
|
||||||
|
<CommonCheckbox v-model="hasDuration" :label="$t('confirm.mute_account.specify_duration')" prepend-checkbox checked-icon-color="text-primary" />
|
||||||
|
<DurationPicker v-if="hasDuration" v-model="duration" v-model:is-valid="isValidDuration" />
|
||||||
|
<CommonCheckbox v-model="shouldMuteNotifications" :label="$t('confirm.mute_account.notifications')" prepend-checkbox checked-icon-color="text-primary" />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div flex justify-end gap-2>
|
||||||
|
<button btn-text @click="handleChoice('cancel')">
|
||||||
|
{{ cancel || $t('confirm.common.cancel') }}
|
||||||
|
</button>
|
||||||
|
<button btn-solid :disabled="!isValidDuration" @click="handleChoice('confirm')">
|
||||||
|
{{ confirm || $t('confirm.common.confirm') }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
|
@ -1,10 +1,17 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
|
import type { mastodon } from 'masto'
|
||||||
|
import type { ConfirmDialogChoice } from '~/types'
|
||||||
import {
|
import {
|
||||||
isCommandPanelOpen,
|
isCommandPanelOpen,
|
||||||
|
isConfirmDialogOpen,
|
||||||
isEditHistoryDialogOpen,
|
isEditHistoryDialogOpen,
|
||||||
|
isErrorDialogOpen,
|
||||||
|
isFavouritedBoostedByDialogOpen,
|
||||||
|
isKeyboardShortcutsDialogOpen,
|
||||||
isMediaPreviewOpen,
|
isMediaPreviewOpen,
|
||||||
isPreviewHelpOpen,
|
isPreviewHelpOpen,
|
||||||
isPublishDialogOpen,
|
isPublishDialogOpen,
|
||||||
|
isReportDialogOpen,
|
||||||
isSigninDialogOpen,
|
isSigninDialogOpen,
|
||||||
} from '~/composables/dialog'
|
} from '~/composables/dialog'
|
||||||
|
|
||||||
|
@ -17,41 +24,87 @@ const isMac = useIsMac()
|
||||||
// listen to ctrl+/ on windows/linux or cmd+/ on mac
|
// listen to ctrl+/ on windows/linux or cmd+/ on mac
|
||||||
// or shift+ctrl+k on windows/linux or shift+cmd+k on mac
|
// or shift+ctrl+k on windows/linux or shift+cmd+k on mac
|
||||||
useEventListener('keydown', (e: KeyboardEvent) => {
|
useEventListener('keydown', (e: KeyboardEvent) => {
|
||||||
if (e.key === 'k' && (isMac.value ? e.metaKey : e.ctrlKey)) {
|
if ((e.key === 'k' || e.key === 'л') && (isMac.value ? e.metaKey : e.ctrlKey)) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
openCommandPanel(e.shiftKey)
|
openCommandPanel(e.shiftKey)
|
||||||
}
|
}
|
||||||
if (e.key === '/' && (isMac.value ? e.metaKey : e.ctrlKey)) {
|
if ((e.key === '/' || e.key === ',') && (isMac.value ? e.metaKey : e.ctrlKey)) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
openCommandPanel(true)
|
openCommandPanel(true)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function handlePublished(status: mastodon.v1.Status) {
|
||||||
|
lastPublishDialogStatus.value = status
|
||||||
|
isPublishDialogOpen.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
function handlePublishClose() {
|
||||||
|
lastPublishDialogStatus.value = null
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleConfirmChoice(choice: ConfirmDialogChoice) {
|
||||||
|
confirmDialogChoice.value = choice
|
||||||
|
isConfirmDialogOpen.value = false
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleFavouritedBoostedByClose() {
|
||||||
|
isFavouritedBoostedByDialogOpen.value = false
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<template v-if="isMastoInitialised">
|
<template v-if="isHydrated">
|
||||||
<ModalDialog v-model="isSigninDialogOpen" py-4 px-8 max-w-125>
|
<ModalDialog v-model="isSigninDialogOpen" py-4 px-8 max-w-125>
|
||||||
<UserSignIn />
|
<UserSignIn />
|
||||||
</ModalDialog>
|
</ModalDialog>
|
||||||
<ModalDialog v-model="isPreviewHelpOpen" max-w-125>
|
<ModalDialog v-model="isPreviewHelpOpen" keep-alive max-w-125>
|
||||||
<HelpPreview @close="closePreviewHelp()" />
|
<HelpPreview @close="closePreviewHelp()" />
|
||||||
</ModalDialog>
|
</ModalDialog>
|
||||||
<ModalDialog v-model="isPublishDialogOpen" max-w-180 flex>
|
<ModalDialog
|
||||||
|
v-model="isPublishDialogOpen"
|
||||||
|
max-w-180 flex
|
||||||
|
@close="handlePublishClose"
|
||||||
|
>
|
||||||
<!-- This `w-0` style is used to avoid overflow problems in flex layouts,so don't remove it unless you know what you're doing -->
|
<!-- This `w-0` style is used to avoid overflow problems in flex layouts,so don't remove it unless you know what you're doing -->
|
||||||
<PublishWidget :draft-key="dialogDraftKey" expanded flex-1 w-0 />
|
<PublishWidget
|
||||||
|
v-if="dialogDraftKey"
|
||||||
|
:draft-key="dialogDraftKey" expanded flex-1 w-0
|
||||||
|
@published="handlePublished"
|
||||||
|
/>
|
||||||
</ModalDialog>
|
</ModalDialog>
|
||||||
<ModalDialog
|
<ModalDialog
|
||||||
v-model="isMediaPreviewOpen"
|
:model-value="isMediaPreviewOpen"
|
||||||
w-full max-w-full h-full max-h-full
|
w-full max-w-full h-full max-h-full
|
||||||
bg-transparent border-0 shadow-none
|
bg-transparent border-0 shadow-none
|
||||||
|
@update:model-value="closeMediaPreview"
|
||||||
>
|
>
|
||||||
<ModalMediaPreview v-if="isMediaPreviewOpen" @close="closeMediaPreview()" />
|
<ModalMediaPreview v-if="isMediaPreviewOpen" @close="closeMediaPreview()" />
|
||||||
</ModalDialog>
|
</ModalDialog>
|
||||||
<ModalDialog v-model="isEditHistoryDialogOpen" max-w-125>
|
<ModalDialog v-model="isEditHistoryDialogOpen" max-w-125>
|
||||||
<StatusEditPreview :edit="statusEdit" />
|
<StatusEditPreview v-if="statusEdit" :edit="statusEdit" />
|
||||||
</ModalDialog>
|
</ModalDialog>
|
||||||
<ModalDialog v-model="isCommandPanelOpen" max-w-fit flex>
|
<ModalDialog v-model="isCommandPanelOpen" max-w-fit flex>
|
||||||
<CommandPanel @close="closeCommandPanel()" />
|
<CommandPanel @close="closeCommandPanel()" />
|
||||||
</ModalDialog>
|
</ModalDialog>
|
||||||
|
<ModalDialog v-model="isConfirmDialogOpen" py-4 px-8 max-w-125>
|
||||||
|
<ModalConfirm v-if="confirmDialogLabel" v-bind="confirmDialogLabel" @choice="handleConfirmChoice" />
|
||||||
|
</ModalDialog>
|
||||||
|
<ModalDialog v-model="isErrorDialogOpen" py-4 px-8 max-w-125>
|
||||||
|
<ModalError v-if="errorDialogData" v-bind="errorDialogData" />
|
||||||
|
</ModalDialog>
|
||||||
|
<ModalDialog
|
||||||
|
v-model="isFavouritedBoostedByDialogOpen"
|
||||||
|
max-w-180
|
||||||
|
@close="handleFavouritedBoostedByClose"
|
||||||
|
>
|
||||||
|
<StatusFavouritedBoostedBy />
|
||||||
|
</ModalDialog>
|
||||||
|
<ModalDialog v-model="isKeyboardShortcutsDialogOpen" max-w-full sm:max-w-140 md:max-w-170 lg:max-w-220 md:min-w-160>
|
||||||
|
<MagickeysKeyboardShortcuts @close="closeKeyboardShortcuts()" />
|
||||||
|
</ModalDialog>
|
||||||
|
<ModalDialog v-model="isReportDialogOpen" keep-alive max-w-175>
|
||||||
|
<ReportModal v-if="reportAccount" :account="reportAccount" :status="reportStatus" @close="closeReportDialog()" />
|
||||||
|
</ModalDialog>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { useFocusTrap } from '@vueuse/integrations/useFocusTrap'
|
import { useFocusTrap } from '@vueuse/integrations/useFocusTrap'
|
||||||
import { useDeactivated } from '~/composables/lifecycle'
|
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
/** v-model dislog visibility */
|
|
||||||
modelValue: boolean
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* level of depth
|
* level of depth
|
||||||
*
|
*
|
||||||
|
@ -40,6 +36,10 @@ export interface Props {
|
||||||
dialogLabelledBy?: string
|
dialogLabelledBy?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
defineOptions({
|
||||||
|
inheritAttrs: false,
|
||||||
|
})
|
||||||
|
|
||||||
const props = withDefaults(defineProps<Props>(), {
|
const props = withDefaults(defineProps<Props>(), {
|
||||||
zIndex: 100,
|
zIndex: 100,
|
||||||
closeByMask: true,
|
closeByMask: true,
|
||||||
|
@ -47,15 +47,16 @@ const props = withDefaults(defineProps<Props>(), {
|
||||||
keepAlive: false,
|
keepAlive: false,
|
||||||
})
|
})
|
||||||
|
|
||||||
const emits = defineEmits<{
|
const emit = defineEmits<{
|
||||||
/** v-model dialog visibility */
|
/** v-model dialog visibility */
|
||||||
(event: 'update:modelValue', value: boolean): void
|
(event: 'close'): void
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const visible = useVModel(props, 'modelValue', emits, { passive: true })
|
const visible = defineModel<boolean>({ required: true })
|
||||||
|
|
||||||
const deactivated = useDeactivated()
|
const deactivated = useDeactivated()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
const userSettings = useUserSettings()
|
||||||
|
|
||||||
/** scrollable HTML element */
|
/** scrollable HTML element */
|
||||||
const elDialogMain = ref<HTMLDivElement>()
|
const elDialogMain = ref<HTMLDivElement>()
|
||||||
|
@ -66,6 +67,8 @@ const { activate } = useFocusTrap(elDialogRoot, {
|
||||||
allowOutsideClick: true,
|
allowOutsideClick: true,
|
||||||
clickOutsideDeactivates: true,
|
clickOutsideDeactivates: true,
|
||||||
escapeDeactivates: true,
|
escapeDeactivates: true,
|
||||||
|
preventScroll: true,
|
||||||
|
returnFocusOnDeactivate: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
defineExpose({
|
defineExpose({
|
||||||
|
@ -75,7 +78,10 @@ defineExpose({
|
||||||
|
|
||||||
/** close the dialog */
|
/** close the dialog */
|
||||||
function close() {
|
function close() {
|
||||||
|
if (!visible.value)
|
||||||
|
return
|
||||||
visible.value = false
|
visible.value = false
|
||||||
|
emit('close')
|
||||||
}
|
}
|
||||||
|
|
||||||
function clickMask() {
|
function clickMask() {
|
||||||
|
@ -113,9 +119,11 @@ const isVShow = computed(() => {
|
||||||
: true
|
: true
|
||||||
})
|
})
|
||||||
|
|
||||||
const bindTypeToAny = ($attrs: any) => $attrs as any
|
function bindTypeToAny($attrs: any) {
|
||||||
|
return $attrs as any
|
||||||
|
}
|
||||||
|
|
||||||
const trapFocusDialog = () => {
|
function trapFocusDialog() {
|
||||||
if (isVShow.value)
|
if (isVShow.value)
|
||||||
nextTick().then(() => activate())
|
nextTick().then(() => activate())
|
||||||
}
|
}
|
||||||
|
@ -130,12 +138,6 @@ useEventListener('keydown', (e: KeyboardEvent) => {
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script lang="ts">
|
|
||||||
export default {
|
|
||||||
inheritAttrs: false,
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<Teleport to="body">
|
<Teleport to="body">
|
||||||
<!-- Dialog component -->
|
<!-- Dialog component -->
|
||||||
|
@ -155,7 +157,13 @@ export default {
|
||||||
<!-- corresponding to issue: #106, so please don't remove it. -->
|
<!-- corresponding to issue: #106, so please don't remove it. -->
|
||||||
|
|
||||||
<!-- Mask layer: blur -->
|
<!-- Mask layer: blur -->
|
||||||
<div class="dialog-mask" absolute inset-0 z-0 bg-transparent opacity-100 backdrop-filter backdrop-blur-sm touch-none />
|
<div
|
||||||
|
class="dialog-mask"
|
||||||
|
:class="{
|
||||||
|
'backdrop-blur-sm': !getPreferences(userSettings, 'optimizeForLowPerformanceDevice'),
|
||||||
|
}"
|
||||||
|
absolute inset-0 z-0 bg-transparent opacity-100 backdrop-filter touch-none
|
||||||
|
/>
|
||||||
<!-- Mask layer: dimming -->
|
<!-- Mask layer: dimming -->
|
||||||
<div class="dialog-mask" absolute inset-0 z-0 bg-black opacity-48 touch-none h="[calc(100%+0.5px)]" @click="clickMask" />
|
<div class="dialog-mask" absolute inset-0 z-0 bg-black opacity-48 touch-none h="[calc(100%+0.5px)]" @click="clickMask" />
|
||||||
<!-- Dialog container -->
|
<!-- Dialog container -->
|
||||||
|
|
31
components/modal/ModalError.vue
Normal file
31
components/modal/ModalError.vue
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { ErrorDialogData } from '~/types'
|
||||||
|
|
||||||
|
defineProps<ErrorDialogData>()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div flex="~ col" gap-6>
|
||||||
|
<div font-bold text-lg text-center>
|
||||||
|
{{ title }}
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
flex="~ col"
|
||||||
|
gap-1 text-sm
|
||||||
|
pt-1 ps-2 pe-1 pb-2
|
||||||
|
text-red-600 dark:text-red-400
|
||||||
|
border="~ base rounded red-600 dark:red-400"
|
||||||
|
>
|
||||||
|
<ol ps-2 sm:ps-1>
|
||||||
|
<li v-for="(message, i) in messages" :key="i" flex="~ col sm:row" gap-y-1 sm:gap-x-2>
|
||||||
|
{{ message }}
|
||||||
|
</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
<div flex justify-end gap-2>
|
||||||
|
<button btn-text @click="closeErrorDialog()">
|
||||||
|
{{ close }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
|
@ -1,9 +1,14 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const emit = defineEmits(['close'])
|
const emit = defineEmits(['close'])
|
||||||
|
|
||||||
|
const locked = useScrollLock(document.body)
|
||||||
|
|
||||||
|
// Use to avoid strange error when directlying assigning to v-model on ModelMediaPreviewCarousel
|
||||||
|
const index = mediaPreviewIndex
|
||||||
|
|
||||||
const current = computed(() => mediaPreviewList.value[mediaPreviewIndex.value])
|
const current = computed(() => mediaPreviewList.value[mediaPreviewIndex.value])
|
||||||
const hasNext = computed(() => mediaPreviewIndex.value < mediaPreviewList.value.length - 1)
|
const hasNext = computed(() => index.value < mediaPreviewList.value.length - 1)
|
||||||
const hasPrev = computed(() => mediaPreviewIndex.value > 0)
|
const hasPrev = computed(() => index.value > 0)
|
||||||
|
|
||||||
const keys = useMagicKeys()
|
const keys = useMagicKeys()
|
||||||
|
|
||||||
|
@ -12,12 +17,12 @@ whenever(keys.arrowRight, next)
|
||||||
|
|
||||||
function next() {
|
function next() {
|
||||||
if (hasNext.value)
|
if (hasNext.value)
|
||||||
mediaPreviewIndex.value++
|
index.value++
|
||||||
}
|
}
|
||||||
|
|
||||||
function prev() {
|
function prev() {
|
||||||
if (hasPrev.value)
|
if (hasPrev.value)
|
||||||
mediaPreviewIndex.value--
|
index.value--
|
||||||
}
|
}
|
||||||
|
|
||||||
function onClick(e: MouseEvent) {
|
function onClick(e: MouseEvent) {
|
||||||
|
@ -26,46 +31,51 @@ function onClick(e: MouseEvent) {
|
||||||
if (!el)
|
if (!el)
|
||||||
emit('close')
|
emit('close')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onMounted(() => locked.value = true)
|
||||||
|
onUnmounted(() => locked.value = false)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div relative h-full w-full flex pt-12 @click="onClick">
|
<div relative h-full w-full flex pt-12 @click="onClick">
|
||||||
<button
|
<button
|
||||||
v-if="hasNext" pointer-events-auto btn-action-icon bg="black/20" :aria-label="$t('action.previous')"
|
v-if="hasNext" pointer-events-auto btn-action-icon bg="black/20" :aria-label="$t('action.previous')"
|
||||||
hover:bg="black/40" dark:bg="white/30" dark:hover:bg="white/20" absolute top="1/2" right-1
|
hover:bg="black/40" dark:bg="white/30" dark-hover:bg="white/20" absolute top="1/2" right-1 z5
|
||||||
:title="$t('action.next')" @click="next"
|
:title="$t('action.next')" @click="next"
|
||||||
>
|
>
|
||||||
<div i-ri:arrow-right-s-line text-white />
|
<div i-ri:arrow-right-s-line text-white />
|
||||||
</button>
|
</button>
|
||||||
<button
|
<button
|
||||||
v-if="hasPrev" pointer-events-auto btn-action-icon bg="black/20" aria-label="action.next"
|
v-if="hasPrev" pointer-events-auto btn-action-icon bg="black/20" aria-label="action.next"
|
||||||
hover:bg="black/40" dark:bg="white/30" dark:hover:bg="white/20" absolute top="1/2" left-1
|
hover:bg="black/40" dark:bg="white/30" dark:hover-bg="white/20" absolute top="1/2" left-1 z5
|
||||||
:title="$t('action.prev')" @click="prev"
|
:title="$t('action.prev')" @click="prev"
|
||||||
>
|
>
|
||||||
<div i-ri:arrow-left-s-line text-white />
|
<div i-ri:arrow-left-s-line text-white />
|
||||||
</button>
|
</button>
|
||||||
<img
|
|
||||||
:src="current.url || current.previewUrl" :alt="current.description || ''" max-h-full max-w-full ma
|
|
||||||
>
|
|
||||||
|
|
||||||
<div absolute top-0 w-full flex justify-between>
|
<div flex="~ col center" h-full w-full>
|
||||||
<button
|
<ModalMediaPreviewCarousel v-model="index" :media="mediaPreviewList" @close="emit('close')" />
|
||||||
btn-action-icon bg="black/30" aria-label="action.close" hover:bg="black/40" dark:bg="white/30"
|
|
||||||
dark:hover:bg="white/20" pointer-events-auto shrink-0 @click="emit('close')"
|
<div bg="black/30" dark:bg="white/10" mb-6 mt-4 text-white rounded-full flex="~ center shrink-0" overflow-hidden>
|
||||||
>
|
<div v-if="mediaPreviewList.length > 1" p="y-1 x-3" rounded-r-0 shrink-0>
|
||||||
<div i-ri:close-line text-white />
|
{{ index + 1 }} / {{ mediaPreviewList.length }}
|
||||||
</button>
|
|
||||||
<div bg="black/30" dark:bg="white/10" ml-4 my-auto text-white rounded-full flex="~ center" overflow-hidden>
|
|
||||||
<div v-if="mediaPreviewList.length > 1" p="y-1 x-2" rounded-r-0 shrink-0>
|
|
||||||
{{ mediaPreviewIndex + 1 }} / {{ mediaPreviewList.length }}
|
|
||||||
</div>
|
</div>
|
||||||
<p
|
<p
|
||||||
v-if="current.description" bg="dark/30" dark:bg="white/10" p="y-1 x-2" rounded-r-full line-clamp-1
|
v-if="current.description" bg="dark/30" dark:bg="white/10" p="y-1 x-3" rounded-ie-full line-clamp-1
|
||||||
ws-pre-wrap break-all :title="current.description" w-full
|
ws-pre-wrap break-all :title="current.description" w-full
|
||||||
>
|
>
|
||||||
{{ current.description }}
|
{{ current.description }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div absolute top-0 w-full flex justify-end>
|
||||||
|
<button
|
||||||
|
btn-action-icon bg="black/30" aria-label="action.close" hover:bg="black/40" dark:bg="white/30"
|
||||||
|
dark:hover-bg="white/20" pointer-events-auto shrink-0 @click="emit('close')"
|
||||||
|
>
|
||||||
|
<div i-ri:close-line text-white />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
286
components/modal/ModalMediaPreviewCarousel.vue
Normal file
286
components/modal/ModalMediaPreviewCarousel.vue
Normal file
|
@ -0,0 +1,286 @@
|
||||||
|
<script setup lang="ts">
|
||||||
|
import type { Vector2 } from '@vueuse/gesture'
|
||||||
|
import { useGesture } from '@vueuse/gesture'
|
||||||
|
import { useReducedMotion } from '@vueuse/motion'
|
||||||
|
import type { mastodon } from 'masto'
|
||||||
|
|
||||||
|
const { media = [] } = defineProps<{
|
||||||
|
media?: mastodon.v1.MediaAttachment[]
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const emit = defineEmits<{
|
||||||
|
(event: 'close'): void
|
||||||
|
}>()
|
||||||
|
|
||||||
|
const modelValue = defineModel<number>({ required: true })
|
||||||
|
|
||||||
|
const slideGap = 20
|
||||||
|
const doubleTapThreshold = 250
|
||||||
|
|
||||||
|
const view = ref()
|
||||||
|
const slider = ref()
|
||||||
|
const slide = ref()
|
||||||
|
const image = ref()
|
||||||
|
|
||||||
|
const reduceMotion = import.meta.server ? ref(false) : useReducedMotion()
|
||||||
|
const isInitialScrollDone = useTimeout(350)
|
||||||
|
const canAnimate = computed(() => isInitialScrollDone.value && !reduceMotion.value)
|
||||||
|
|
||||||
|
const scale = ref(1)
|
||||||
|
const x = ref(0)
|
||||||
|
const y = ref(0)
|
||||||
|
|
||||||
|
const isDragging = ref(false)
|
||||||
|
const isPinching = ref(false)
|
||||||
|
|
||||||
|
const maxZoomOut = ref(1)
|
||||||
|
const isZoomedIn = computed(() => scale.value > 1)
|
||||||
|
|
||||||
|
const enableAutoplay = usePreferences('enableAutoplay')
|
||||||
|
|
||||||
|
function goToFocusedSlide() {
|
||||||
|
scale.value = 1
|
||||||
|
x.value = slide.value[modelValue.value].offsetLeft * scale.value
|
||||||
|
y.value = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
const slideGapAsScale = slideGap / view.value.clientWidth
|
||||||
|
maxZoomOut.value = 1 - slideGapAsScale
|
||||||
|
|
||||||
|
goToFocusedSlide()
|
||||||
|
})
|
||||||
|
watch(modelValue, goToFocusedSlide)
|
||||||
|
|
||||||
|
let lastOrigin = [0, 0]
|
||||||
|
let initialScale = 0
|
||||||
|
useGesture({
|
||||||
|
onPinch({ first, initial: [initialDistance], movement: [deltaDistance], da: [distance], origin, touches }) {
|
||||||
|
isPinching.value = true
|
||||||
|
|
||||||
|
if (first) {
|
||||||
|
initialScale = scale.value
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (touches === 0)
|
||||||
|
handleMouseWheelZoom(initialScale, deltaDistance, origin)
|
||||||
|
else
|
||||||
|
handlePinchZoom(initialScale, initialDistance, distance, origin)
|
||||||
|
}
|
||||||
|
|
||||||
|
lastOrigin = origin
|
||||||
|
},
|
||||||
|
onPinchEnd() {
|
||||||
|
isPinching.value = false
|
||||||
|
isDragging.value = false
|
||||||
|
|
||||||
|
if (!isZoomedIn.value)
|
||||||
|
goToFocusedSlide()
|
||||||
|
},
|
||||||
|
onDrag({ movement, delta, pinching, tap, last, swipe, event, xy }) {
|
||||||
|
event.preventDefault()
|
||||||
|
|
||||||
|
if (pinching)
|
||||||
|
return
|
||||||
|
|
||||||
|
if (last)
|
||||||
|
handleLastDrag(tap, swipe, movement, xy)
|
||||||
|
else
|
||||||
|
handleDrag(delta, movement)
|
||||||
|
},
|
||||||
|
}, {
|
||||||
|
domTarget: view,
|
||||||
|
eventOptions: {
|
||||||
|
passive: false,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const shiftRestrictions = computed(() => {
|
||||||
|
const focusedImage = image.value[modelValue.value]
|
||||||
|
const focusedSlide = slide.value[modelValue.value]
|
||||||
|
|
||||||
|
const scaledImageWidth = focusedImage.offsetWidth * scale.value
|
||||||
|
const scaledHorizontalOverflow = scaledImageWidth / 2 - view.value.clientWidth / 2 + slideGap
|
||||||
|
const horizontalOverflow = Math.max(0, scaledHorizontalOverflow / scale.value)
|
||||||
|
|
||||||
|
const scaledImageHeight = focusedImage.offsetHeight * scale.value
|
||||||
|
const scaledVerticalOverflow = scaledImageHeight / 2 - view.value.clientHeight / 2 + slideGap
|
||||||
|
const verticalOverflow = Math.max(0, scaledVerticalOverflow / scale.value)
|
||||||
|
|
||||||
|
return {
|
||||||
|
left: focusedSlide.offsetLeft - horizontalOverflow,
|
||||||
|
right: focusedSlide.offsetLeft + horizontalOverflow,
|
||||||
|
top: focusedSlide.offsetTop - verticalOverflow,
|
||||||
|
bottom: focusedSlide.offsetTop + verticalOverflow,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
function handlePinchZoom(initialScale: number, initialDistance: number, distance: number, [originX, originY]: Vector2) {
|
||||||
|
scale.value = initialScale * (distance / initialDistance)
|
||||||
|
scale.value = Math.max(maxZoomOut.value, scale.value)
|
||||||
|
|
||||||
|
const deltaCenterX = originX - lastOrigin[0]
|
||||||
|
const deltaCenterY = originY - lastOrigin[1]
|
||||||
|
|
||||||
|
handleZoomDrag([deltaCenterX, deltaCenterY])
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMouseWheelZoom(initialScale: number, deltaDistance: number, [originX, originY]: Vector2) {
|
||||||
|
scale.value = initialScale + (deltaDistance / 1000)
|
||||||
|
scale.value = Math.max(maxZoomOut.value, scale.value)
|
||||||
|
|
||||||
|
const deltaCenterX = lastOrigin[0] - originX
|
||||||
|
const deltaCenterY = lastOrigin[1] - originY
|
||||||
|
|
||||||
|
handleZoomDrag([deltaCenterX, deltaCenterY])
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleLastDrag(tap: boolean, swipe: Vector2, movement: Vector2, position: Vector2) {
|
||||||
|
isDragging.value = false
|
||||||
|
|
||||||
|
if (tap)
|
||||||
|
handleTap(position)
|
||||||
|
else if (swipe[0] || swipe[1])
|
||||||
|
handleSwipe(swipe, movement)
|
||||||
|
else if (!isZoomedIn.value)
|
||||||
|
slideToClosestSlide()
|
||||||
|
}
|
||||||
|
|
||||||
|
let lastTapAt = 0
|
||||||
|
function handleTap([positionX, positionY]: Vector2) {
|
||||||
|
const now = Date.now()
|
||||||
|
const isDoubleTap = now - lastTapAt < doubleTapThreshold
|
||||||
|
lastTapAt = now
|
||||||
|
|
||||||
|
if (!isDoubleTap)
|
||||||
|
return
|
||||||
|
|
||||||
|
if (isZoomedIn.value) {
|
||||||
|
goToFocusedSlide()
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const focusedSlideBounding = slide.value[modelValue.value].getBoundingClientRect()
|
||||||
|
const slideCenterX = focusedSlideBounding.left + focusedSlideBounding.width / 2
|
||||||
|
const slideCenterY = focusedSlideBounding.top + focusedSlideBounding.height / 2
|
||||||
|
|
||||||
|
scale.value = 3
|
||||||
|
x.value += positionX - slideCenterX
|
||||||
|
y.value += positionY - slideCenterY
|
||||||
|
restrictShiftToInsideSlide()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSwipe([horiz, vert]: Vector2, [movementX, movementY]: Vector2) {
|
||||||
|
if (isZoomedIn.value || isPinching.value)
|
||||||
|
return
|
||||||
|
|
||||||
|
const isHorizontalDrag = Math.abs(movementX) >= Math.abs(movementY)
|
||||||
|
|
||||||
|
if (isHorizontalDrag) {
|
||||||
|
if (horiz === 1) // left
|
||||||
|
modelValue.value = Math.max(0, modelValue.value - 1)
|
||||||
|
if (horiz === -1) // right
|
||||||
|
modelValue.value = Math.min(media.length - 1, modelValue.value + 1)
|
||||||
|
}
|
||||||
|
else if (vert === 1 || vert === -1) {
|
||||||
|
emit('close')
|
||||||
|
}
|
||||||
|
|
||||||
|
goToFocusedSlide()
|
||||||
|
}
|
||||||
|
|
||||||
|
function slideToClosestSlide() {
|
||||||
|
const startOfFocusedSlide = slide.value[modelValue.value].offsetLeft * scale.value
|
||||||
|
const slideWidth = slide.value[modelValue.value].offsetWidth * scale.value
|
||||||
|
|
||||||
|
if (x.value > startOfFocusedSlide + slideWidth / 2)
|
||||||
|
modelValue.value = Math.min(media.length - 1, modelValue.value + 1)
|
||||||
|
else if (x.value < startOfFocusedSlide - slideWidth / 2)
|
||||||
|
modelValue.value = Math.max(0, modelValue.value - 1)
|
||||||
|
|
||||||
|
goToFocusedSlide()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDrag(delta: Vector2, movement: Vector2) {
|
||||||
|
isDragging.value = true
|
||||||
|
|
||||||
|
if (isZoomedIn.value)
|
||||||
|
handleZoomDrag(delta)
|
||||||
|
else
|
||||||
|
handleSlideDrag(movement)
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleZoomDrag([deltaX, deltaY]: Vector2) {
|
||||||
|
x.value -= deltaX / scale.value
|
||||||
|
y.value -= deltaY / scale.value
|
||||||
|
|
||||||
|
restrictShiftToInsideSlide()
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSlideDrag([movementX, movementY]: Vector2) {
|
||||||
|
goToFocusedSlide()
|
||||||
|
|
||||||
|
if (Math.abs(movementY) > Math.abs(movementX)) // vertical movement is more than horizontal
|
||||||
|
y.value -= movementY / scale.value
|
||||||
|
else
|
||||||
|
x.value -= movementX / scale.value
|
||||||
|
|
||||||
|
if (media.length === 1)
|
||||||
|
x.value = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
function restrictShiftToInsideSlide() {
|
||||||
|
x.value = Math.min(shiftRestrictions.value.right, Math.max(shiftRestrictions.value.left, x.value))
|
||||||
|
y.value = Math.min(shiftRestrictions.value.bottom, Math.max(shiftRestrictions.value.top, y.value))
|
||||||
|
}
|
||||||
|
|
||||||
|
const sliderStyle = computed(() => {
|
||||||
|
const style = {
|
||||||
|
transform: `scale(${scale.value}) translate(${-x.value}px, ${-y.value}px)`,
|
||||||
|
transition: 'none',
|
||||||
|
gap: `${slideGap}px`,
|
||||||
|
}
|
||||||
|
|
||||||
|
if (canAnimate.value && !isDragging.value && !isPinching.value)
|
||||||
|
style.transition = 'all 0.3s ease'
|
||||||
|
|
||||||
|
return style
|
||||||
|
})
|
||||||
|
|
||||||
|
const imageStyle = computed(() => ({
|
||||||
|
cursor: isDragging.value ? 'grabbing' : 'grab',
|
||||||
|
}))
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div ref="view" flex flex-row h-full w-full overflow-hidden>
|
||||||
|
<div ref="slider" :style="sliderStyle" w-full h-full flex items-center>
|
||||||
|
<div
|
||||||
|
v-for="item in media"
|
||||||
|
:key="item.id"
|
||||||
|
ref="slide"
|
||||||
|
flex-shrink-0
|
||||||
|
w-full
|
||||||
|
h-full
|
||||||
|
flex
|
||||||
|
items-center
|
||||||
|
justify-center
|
||||||
|
>
|
||||||
|
<component
|
||||||
|
:is="item.type === 'gifv' ? 'video' : 'img'"
|
||||||
|
ref="image"
|
||||||
|
:autoplay="enableAutoplay"
|
||||||
|
controls
|
||||||
|
loop
|
||||||
|
select-none
|
||||||
|
max-w-full
|
||||||
|
max-h-full
|
||||||
|
:style="imageStyle"
|
||||||
|
:draggable="false"
|
||||||
|
:src="item.url || item.previewUrl"
|
||||||
|
:alt="item.description || ''"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
|
@ -1,6 +1,12 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
// only one icon can be lit up at the same time
|
// only one icon can be lit up at the same time
|
||||||
|
import { STORAGE_KEY_LAST_ACCESSED_EXPLORE_ROUTE, STORAGE_KEY_LAST_ACCESSED_NOTIFICATION_ROUTE } from '~/constants'
|
||||||
|
|
||||||
const moreMenuVisible = ref(false)
|
const moreMenuVisible = ref(false)
|
||||||
|
|
||||||
|
const { notifications } = useNotifications()
|
||||||
|
const lastAccessedNotificationRoute = useLocalStorage(STORAGE_KEY_LAST_ACCESSED_NOTIFICATION_ROUTE, '')
|
||||||
|
const lastAccessedExploreRoute = useLocalStorage(STORAGE_KEY_LAST_ACCESSED_EXPLORE_ROUTE, '')
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -10,39 +16,45 @@ const moreMenuVisible = ref(false)
|
||||||
class="after-content-empty after:(h-[calc(100%+0.5px)] w-0.1px pointer-events-none)"
|
class="after-content-empty after:(h-[calc(100%+0.5px)] w-0.1px pointer-events-none)"
|
||||||
>
|
>
|
||||||
<!-- These weird styles above are used for scroll locking, don't change it unless you know exactly what you're doing. -->
|
<!-- These weird styles above are used for scroll locking, don't change it unless you know exactly what you're doing. -->
|
||||||
<template v-if="isMastoInitialised && currentUser">
|
<template v-if="currentUser">
|
||||||
<NuxtLink to="/home" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 @click="$scrollToTop">
|
<NuxtLink to="/home" :aria-label="$t('nav.home')" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||||
<div i-ri:home-5-line />
|
<div i-ri:home-5-line />
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
<NuxtLink to="/notifications" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 @click="$scrollToTop">
|
<NuxtLink to="/search" :aria-label="$t('nav.search')" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||||
<div i-ri:notification-4-line />
|
<div i-ri:search-line />
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</template>
|
<NuxtLink :to="`/notifications/${lastAccessedNotificationRoute}`" :aria-label="$t('nav.notifications')" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||||
<NuxtLink :to="`/${currentServer}/explore`" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 @click="$scrollToTop">
|
<div flex relative>
|
||||||
<div i-ri:hashtag />
|
<div class="i-ri:notification-4-line" text-xl />
|
||||||
</NuxtLink>
|
<div v-if="notifications" class="top-[-0.3rem] right-[-0.3rem]" absolute font-bold rounded-full h-4 w-4 text-xs bg-primary text-inverted flex items-center justify-center>
|
||||||
<NuxtLink group :to="`/${currentServer}/public/local`" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 @click="$scrollToTop">
|
{{ notifications < 10 ? notifications : '•' }}
|
||||||
<div i-ri:group-2-line />
|
</div>
|
||||||
</NuxtLink>
|
</div>
|
||||||
<template v-if="!isMastoInitialised || !currentUser">
|
|
||||||
<NuxtLink :to="`/${currentServer}/public`" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 @click="$scrollToTop">
|
|
||||||
<div i-ri:earth-line />
|
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</template>
|
<NuxtLink to="/conversations" :aria-label="$t('nav.conversations')" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||||
<template v-if="isMastoInitialised && currentUser">
|
|
||||||
<NuxtLink to="/conversations" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 @click="$scrollToTop">
|
|
||||||
<div i-ri:at-line />
|
<div i-ri:at-line />
|
||||||
</NuxtLink>
|
</NuxtLink>
|
||||||
</template>
|
</template>
|
||||||
<NavBottomMoreMenu v-slot="{ changeShow, show }" v-model="moreMenuVisible" flex flex-row items-center place-content-center h-full flex-1 cursor-pointer>
|
<template v-else>
|
||||||
<label
|
<NuxtLink :to="`/${currentServer}/explore/${lastAccessedExploreRoute}`" :aria-label="$t('nav.explore')" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||||
|
<div i-ri:compass-3-line />
|
||||||
|
</NuxtLink>
|
||||||
|
<NuxtLink group :to="`/${currentServer}/public/local`" :aria-label="$t('nav.local')" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||||
|
<div i-ri:group-2-line />
|
||||||
|
</NuxtLink>
|
||||||
|
<NuxtLink :to="`/${currentServer}/public`" :aria-label="$t('nav.federated')" :active-class="moreMenuVisible ? '' : 'text-primary'" flex flex-row items-center place-content-center h-full flex-1 class="coarse-pointer:select-none" @click="$scrollToTop">
|
||||||
|
<div i-ri:earth-line />
|
||||||
|
</NuxtLink>
|
||||||
|
</template>
|
||||||
|
<NavBottomMoreMenu v-slot="{ toggleVisible, show }" v-model="moreMenuVisible" flex flex-row items-center place-content-center h-full flex-1 cursor-pointer>
|
||||||
|
<button
|
||||||
flex items-center place-content-center h-full flex-1 class="select-none"
|
flex items-center place-content-center h-full flex-1 class="select-none"
|
||||||
:class="show ? '!text-primary' : ''"
|
:class="show ? '!text-primary' : ''"
|
||||||
|
aria-label="More menu"
|
||||||
|
@click="toggleVisible"
|
||||||
>
|
>
|
||||||
<input type="checkbox" z="-1" absolute inset-0 opacity-0 @click="changeShow">
|
<span :class="show ? 'i-ri:close-fill' : 'i-ri:more-fill'" />
|
||||||
<span v-show="show" i-ri:close-fill />
|
</button>
|
||||||
<span v-show="!show" i-ri:more-fill />
|
|
||||||
</label>
|
|
||||||
</NavBottomMoreMenu>
|
</NavBottomMoreMenu>
|
||||||
</nav>
|
</nav>
|
||||||
</template>
|
</template>
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue