Compare commits
572 commits
master
...
vk-b645-fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e510f8d897 | ||
|
|
f28c9515ad |
||
|
|
c6ecbd56e5 | ||
|
|
144567410d | ||
|
|
1b850662ed | ||
|
|
c7c4cacc29 | ||
|
|
7e63355353 | ||
|
|
01652c7940 | ||
|
|
b379e3b0eb | ||
|
|
a2fde7f2c3 | ||
|
|
2beb452207 | ||
|
|
73384a562b | ||
|
|
985c5bf8e2 | ||
|
|
daec8a9a64 |
||
|
|
f88a7a6f99 |
||
|
|
dc16d145c2 |
||
|
|
8432ddc2a8 |
||
|
|
d072393149 |
||
|
|
a8e95bf7f1 |
||
|
|
1735bdc9a2 |
||
|
|
f00685d592 |
||
|
|
ee194f3e46 |
||
|
|
82a9c5b1dd |
||
|
|
fdd8875986 |
||
|
|
3b50e0cbc5 |
||
|
|
fb7fda2256 |
||
|
|
d9beb6126e |
||
|
|
a81581129a | ||
|
|
e95a91861a | ||
|
|
fa5948f40e | ||
|
|
ad4c8aacfb | ||
|
|
afbc09f1e7 | ||
|
|
1a1e5b743a | ||
|
|
24853a7e3b |
||
|
|
1ce83913bd |
||
|
|
1650e26da7 |
||
|
|
bc01fd8ea3 | ||
|
|
3422c40e19 |
||
|
|
e661052c89 |
||
|
|
ff08a5ca2b |
||
|
|
f8250fb0d8 |
||
|
|
d1c3f8af7a | ||
|
|
36b4b3695b |
||
|
|
fb17ec8064 |
||
|
|
51f52656cc |
||
|
|
18746c7819 |
||
|
|
8463c01123 |
||
|
|
8e0671306a |
||
|
|
131a6da554 |
||
|
|
59273fcdab |
||
|
|
7795a2a46f |
||
|
|
2269f64b0a |
||
|
|
439da97573 |
||
|
|
2b478a4608 |
||
|
|
3b95725f09 |
||
|
|
3a23ad1382 |
||
|
|
61a7f1fba5 |
||
|
|
a8641672cd |
||
|
|
320fc20461 |
||
|
|
69f05c39ec |
||
|
|
e55ffedc35 |
||
|
|
0577fefd75 |
||
|
|
02713670c9 |
||
|
|
e6de878395 |
||
|
|
4c75b288bb |
||
|
|
263e1b527a | ||
|
|
3d88bf8795 |
||
|
|
740b2b0979 |
||
|
|
2b843fc12e |
||
|
|
473cf1cae3 |
||
|
|
65d4266400 |
||
|
|
8d5b86fff7 |
||
|
|
92843c8237 |
||
|
|
13b588b555 |
||
|
|
839a9ff498 |
||
|
|
ef8c16d773 |
||
|
|
602fafafea |
||
|
|
83ed7fd2df |
||
|
|
f07e4093be |
||
|
|
bf13afd895 |
||
|
|
9ffc06d42e |
||
|
|
ebe91ba11d | ||
|
|
48aef46f57 | ||
|
|
c77c823c3c | ||
|
|
ccccea1e50 | ||
|
|
a6163849c6 | ||
|
|
130aab3598 | ||
|
|
78b85ce0cc | ||
|
|
dbcf65b2d6 | ||
|
|
d8e27aa5f9 |
||
|
|
ce6d587771 |
||
|
|
81d7bc2d68 |
||
|
|
a49350f300 |
||
|
|
9ac6359e56 |
||
|
|
5958d9c646 |
||
|
|
9b88c8afda |
||
|
|
1b71fef89f |
||
|
|
8ddd29d285 |
||
|
|
dc8cbcf410 |
||
|
|
757a4383e6 | ||
|
|
7c98ee329a | ||
|
|
9d615463f4 |
||
|
|
aea0db5919 |
||
|
|
fc593d90cf |
||
|
|
2524f7b5a0 |
||
|
|
5a0cb1baef |
||
|
|
255690eee0 | ||
|
|
86b6e10620 |
||
|
|
b757292211 | ||
|
|
af54419a0b | ||
|
|
7b84b1c79c | ||
|
|
d047c22526 | ||
|
|
6feab70a72 | ||
|
|
5e1b5ca4e8 | ||
|
|
1726cdb0ad | ||
|
|
2b2828ea41 | ||
|
|
29859ceedf | ||
|
|
8e2527ad35 | ||
|
|
92b26488da | ||
|
|
efa67cb01c | ||
|
|
71fc222059 | ||
|
|
fa6adad4ab | ||
|
|
1c48d567e1 | ||
|
|
2c3216ba36 | ||
|
|
74e2a7e225 | ||
|
|
ff2c92451d | ||
|
|
2a83402d4a | ||
|
|
2449b473c0 | ||
|
|
60c44c44ff | ||
|
|
7e1d685167 | ||
|
|
a9d4a393ba | ||
|
|
a0953fea93 | ||
|
|
02d76835c9 | ||
|
|
dfe03f1347 | ||
|
|
c87489adf3 | ||
|
|
a428a730d5 | ||
|
|
7f7c642339 | ||
|
|
03b79e9a67 | ||
|
|
56b0fcebba | ||
|
|
d9a5130311 |
||
|
|
4663a45e59 |
||
|
|
fb820bcdad |
||
|
|
31c167b412 |
||
|
|
7cdab16ba9 |
||
|
|
05262134ca | ||
|
|
fe48b9d03d |
||
|
|
013ec1d726 |
||
|
|
27b4a984d5 | ||
|
|
d6b6111395 | ||
|
|
af8ee6703e | ||
|
|
793191a479 |
||
|
|
efc86c1056 |
||
|
|
39d44d2644 |
||
|
|
9584a2ce5a |
||
|
|
95b8ceb87a |
||
|
|
37b99b9cb8 |
||
|
|
86354e9fc0 | ||
|
|
b49f135e31 |
||
|
|
fff266f50d | ||
|
|
7cfea7c22c | ||
|
|
6141e5a8ce | ||
|
|
ed58949d24 |
||
|
|
c1d85bd3d9 |
||
|
|
8d3324465e |
||
|
|
8c72746edb |
||
|
|
ea3509d2e7 |
||
|
|
bb3a0cc54f |
||
|
|
d808654d99 | ||
|
|
a6cfdbb403 | ||
|
|
2f7c6834d0 | ||
|
|
ebdd57a7c4 | ||
|
|
4ff6d74054 |
||
|
|
0d8b4aafd5 |
||
|
|
0cca7e9189 |
||
|
|
a5812578c5 |
||
|
|
350b411afe |
||
|
|
9ca86c6093 |
||
|
|
01729ae22a |
||
|
|
9196dc2216 |
||
|
|
b925335bbb |
||
|
|
965f939967 |
||
|
|
00feccbb77 |
||
|
|
b6fc66ba0d |
||
|
|
c40debc0e9 |
||
|
|
3b31d70865 |
||
|
|
afa8b62de7 |
||
|
|
70fd15de2d |
||
|
|
c54d330f89 |
||
|
|
4028560d12 |
||
|
|
3c28c28623 |
||
|
|
a958fa06e7 |
||
|
|
4d39e9e15a |
||
|
|
679ec49e64 |
||
|
|
d98e1d3693 | ||
|
|
be3b7d754e |
||
|
|
ae524c4f84 |
||
|
|
d390cac8db |
||
|
|
17e20ab029 |
||
|
|
34b9b9b508 |
||
|
|
47fd06a445 |
||
|
|
b140ce546f | ||
|
|
08ec2beb7c |
||
|
|
5833f0f109 |
||
|
|
eb2ad258ed |
||
|
|
708aef53e4 |
||
|
|
e893c1c205 |
||
|
|
3e74255127 |
||
|
|
b8d7eed607 |
||
|
|
8eb62fb483 |
||
|
|
ee67bff9e3 |
||
|
|
21e47dcccf |
||
|
|
38ddcf59f8 |
||
|
|
4a62b6a5c7 | ||
|
|
6afbcb69f3 |
||
|
|
4bb522d303 |
||
|
|
f107173a73 |
||
|
|
eb5aff755f |
||
|
|
2384ae0819 |
||
|
|
4a5663c1cb |
||
|
|
9416e01042 | ||
|
|
54fcacfed1 | ||
|
|
69ac5caa4b |
||
|
|
cecbc156d5 |
||
|
|
8ca550cc9e |
||
|
|
d44c8eba1c |
||
|
|
6edd667bdf |
||
|
|
499ff50903 |
||
|
|
5e1f29eda3 |
||
|
|
e5571defb7 |
||
|
|
125d8a6f78 |
||
|
|
21790dc3ee |
||
|
|
cdf48e0589 |
||
|
|
2f9f63771b | ||
|
|
93335b3843 |
||
|
|
f50c8f447e | ||
|
|
bd9f7deb98 | ||
|
|
2171192934 | ||
|
|
3352ebef6e |
||
|
|
2a51ddadfc |
||
|
|
0745aea4d6 |
||
|
|
4804b34208 |
||
|
|
841289f1d1 |
||
|
|
c367ef461e |
||
|
|
ffed41553a | ||
|
|
79deb37675 |
||
|
|
77ca8fe9e6 |
||
|
|
25e58edf28 | ||
|
|
0f2d19c56e | ||
|
|
8bde3d7522 | ||
|
|
c169d26d95 | ||
|
|
946a4c56a0 | ||
|
|
23e87e0ad7 |
||
|
|
7d678154c6 |
||
|
|
0b9fec3f87 |
||
|
|
763c7708f4 |
||
|
|
5f2c1f4534 |
||
|
|
3ac557ccb1 |
||
|
|
e6c691a376 |
||
|
|
ee8eb001c2 |
||
|
|
db836b7a48 |
||
|
|
543b18dd54 |
||
|
|
ec0731d5d8 |
||
|
|
cc5c7d1d29 |
||
|
|
e79c1b7ea3 | ||
|
|
6cbead5bfe |
||
|
|
429bb2bf17 |
||
|
|
c03c41cb21 |
||
|
|
ee29faecbf |
||
|
|
d1d0105276 |
||
|
|
1059e36b52 |
||
|
|
15f602f867 |
||
|
|
13be4a333f |
||
|
|
2553fa1f74 |
||
|
|
f0f5011484 |
||
|
|
5671f3527b |
||
|
|
adb26fa99f |
||
|
|
805429a7c6 |
||
|
|
39af86e59d |
||
|
|
ecf970d6fe | ||
|
|
c9ce17a4d5 |
||
|
|
a6e279f0d3 | ||
|
|
842bc3733e | ||
|
|
5e76a5e76a | ||
|
|
52c3c49f25 |
||
|
|
705239ad7d |
||
|
|
dc865404a9 |
||
|
|
ba7ab2e607 |
||
|
|
d6cfe4414d |
||
|
|
ecbb135949 |
||
|
|
fcb98e6523 |
||
|
|
e7e5597c95 | ||
|
|
7f0479d8b4 | ||
|
|
f5c78f365d |
||
|
|
1fc5f9b12d |
||
|
|
3f55ce6dfc |
||
|
|
1d562d3c27 |
||
|
|
f3974deb88 |
||
|
|
1945616328 |
||
|
|
7db6604227 |
||
|
|
12ce6c5ac3 |
||
|
|
5d9bc4ca81 | ||
|
|
c0b4a3ff35 |
||
|
|
f0bf8cd827 |
||
|
|
10144adf61 |
||
|
|
3efab5ba23 |
||
|
|
3d323ab9d2 | ||
|
|
16ce9e562f | ||
|
|
90e66a7ad4 |
||
|
|
6b59216b32 |
||
|
|
9764ba6334 |
||
|
|
da5929ff34 |
||
|
|
e419822c77 |
||
|
|
b62ce4440e |
||
|
|
3c81fb06e8 |
||
|
|
c27366a270 |
||
|
|
5b6f6c1bff |
||
|
|
3fcac435b2 |
||
|
|
03a3edcdc9 |
||
|
|
5737b3cc7b | ||
|
|
b898b79aaf |
||
|
|
3827ca2d78 |
||
|
|
4de5e1b9f1 |
||
|
|
eb18f02fd2 | ||
|
|
1a7d105917 | ||
|
|
de5cff799e | ||
|
|
67cada78f6 | ||
|
|
5a40f25d03 | ||
|
|
1a09a8a4c8 | ||
|
|
daa0cf83d9 | ||
|
|
e92858f64d | ||
|
|
d52c26e82f | ||
|
|
83900b03d4 | ||
|
|
c123430f22 | ||
|
|
33e20cbc77 | ||
|
|
e942312c4c | ||
|
|
de2e78b507 | ||
|
|
da4a7ac64b | ||
|
|
e44fbc26ba | ||
|
|
bef454f950 | ||
|
|
94e1ec91ad | ||
|
|
56d11ab419 |
||
|
|
c96cccab2e |
||
|
|
989ef1b4a8 |
||
|
|
45cfbe917e |
||
|
|
2e313005e0 |
||
|
|
722c3a653c |
||
|
|
76672facfe |
||
|
|
8f075b5d8d | ||
|
|
b317efaf2c | ||
|
|
29b9c5200f |
||
|
|
4d2b4b4ee7 |
||
|
|
9f8f095a78 |
||
|
|
59c09ebee1 |
||
|
|
5f81a87912 |
||
|
|
7f6151d573 |
||
|
|
9816960995 |
||
|
|
3355d5f0af |
||
|
|
ab38b20444 |
||
|
|
f278229179 | ||
|
|
552390fb84 | ||
|
|
68573cdc48 |
||
|
|
cdf397aaa9 | ||
|
|
ed27558011 |
||
|
|
50387948df | ||
|
|
9b48cc1799 | ||
|
|
86f2ac0e96 | ||
|
|
1537a002cc |
||
|
|
ae9b158b04 |
||
|
|
72ec10b181 | ||
|
|
eed4002a4a | ||
|
|
155e34c7a8 | ||
|
|
22cc649e81 |
||
|
|
367ca745c3 |
||
|
|
01e2e46e0d |
||
|
|
c03078ca16 |
||
|
|
49e62aebe3 |
||
|
|
dc4daaebac |
||
|
|
f855b30c9f | ||
|
|
b614e2b100 | ||
|
|
eafbbab233 | ||
|
|
72a4e9cf6e |
||
|
|
1dbe100a43 |
||
|
|
287d3d066c |
||
|
|
9387d18e88 |
||
|
|
1600bcb1d0 |
||
|
|
2b2defb7c0 |
||
|
|
6d786902eb |
||
|
|
286ce206f0 |
||
|
|
7535f098bd |
||
|
|
b517461fbe |
||
|
|
ffbe67e21f |
||
|
|
833671d30c |
||
|
|
ae691b8e52 |
||
|
|
2b56b7b6b9 |
||
|
|
81a5380f67 |
||
|
|
7c45e3ac13 |
||
|
|
d1932c36ce |
||
|
|
adb7ddf8d2 |
||
|
|
3b0a57ca6d |
||
|
|
4ee75e93c9 |
||
|
|
ff218e5323 |
||
|
|
df0969d1c6 |
||
|
|
23d7ac0e58 |
||
|
|
f9a87944cf |
||
|
|
eff456aa1a |
||
|
|
1ce07cd67c |
||
|
|
fc7952ff3b |
||
|
|
bb28bdf565 |
||
|
|
04d5842124 |
||
|
|
1a12890556 |
||
|
|
d021d885ca |
||
|
|
3433b8ce8f |
||
|
|
6092730acc |
||
|
|
ba4ffe4ecc |
||
|
|
55b3e2d35a |
||
|
|
6b926ec463 |
||
|
|
9b686b5417 |
||
|
|
82ec56bc7d |
||
|
|
798e51d4d3 |
||
|
|
35c41552de |
||
|
|
19be7f61ac | ||
|
|
bbf0e8cdad | ||
|
|
7e2d2a29a1 | ||
|
|
671dc2aa3a | ||
|
|
294a2c701e | ||
|
|
01f03c552d | ||
|
|
dc46154d94 | ||
|
|
87737c23eb | ||
|
|
6e6f099a99 | ||
|
|
4cb3321c39 | ||
|
|
6a2343a1a0 | ||
|
|
f2d6dba2cf | ||
|
|
dd1ef7fae9 | ||
|
|
527cff9ec3 | ||
|
|
ba150eccae | ||
|
|
fa74986f1e | ||
|
|
d1085b5bea | ||
|
|
4d0a14d2eb | ||
|
|
8c3439b733 | ||
|
|
a0534d527a | ||
|
|
a5b52f2795 | ||
|
|
b526ebd679 | ||
|
|
51b9315ae9 | ||
|
|
8edf44dc31 | ||
|
|
9b7626e59e | ||
|
|
6dd092c7a9 | ||
|
|
46a0d467c0 | ||
|
|
e3b164ae93 | ||
|
|
d8f58ab20f | ||
|
|
0de2bccd28 | ||
|
|
2eaf724710 | ||
|
|
58138ac09b | ||
|
|
143f090422 | ||
|
|
f8f466ba7e | ||
|
|
cb28de47f8 | ||
|
|
4ad2475ed6 | ||
|
|
0172078536 | ||
|
|
0bb1fb512a | ||
|
|
b6940d95a2 | ||
|
|
75f0457375 | ||
|
|
ffe31b6265 | ||
|
|
8963610722 | ||
|
|
66bfcf0e36 | ||
|
|
0b3559abfe | ||
|
|
773389ee5e | ||
|
|
4c04991d4d | ||
|
|
d56bb59b72 | ||
|
|
6e92a4f71e | ||
|
|
1f6217c0d8 | ||
|
|
17204bebd0 | ||
|
|
728e2019d8 | ||
|
|
7f3fdd6977 | ||
|
|
e8798f8371 | ||
|
|
402b743553 | ||
|
|
f08ae2fc62 | ||
|
|
178ea9c8c5 | ||
|
|
7c63cee9e8 | ||
|
|
4a60dfc373 | ||
|
|
829a829cb4 | ||
|
|
34896ccb4e | ||
|
|
5df5eb6a04 | ||
|
|
31ba36baf3 | ||
|
|
bf10f71760 | ||
|
|
8aa61fff6d | ||
|
|
f645b530da |
||
|
|
27573d191e | ||
|
|
d6b4fdf979 |
||
|
|
39c834b83f |
||
|
|
f210357bfe |
||
|
|
3094c19cf3 | ||
|
|
225437f1e8 | ||
|
|
a23bb1e350 |
||
|
|
2fbb21a84e | ||
|
|
5c08fcb43e | ||
|
|
cc59655cb1 | ||
|
|
8ff0a2b0ff | ||
|
|
fe549af784 | ||
|
|
a4549c94c1 | ||
|
|
706256d3f0 | ||
|
|
3049773e7f | ||
|
|
9da5df354e | ||
|
|
54ba6d47f4 | ||
|
|
17647e2c2f | ||
|
|
9da5cea88d | ||
|
|
3784746ddb | ||
|
|
281f6335c1 | ||
|
|
5129c0f4e2 | ||
|
|
5078e89a71 | ||
|
|
41aef27631 | ||
|
|
754d0934bf | ||
|
|
be2d616190 | ||
|
|
ba34e47c4b | ||
|
|
a485b188b3 | ||
|
|
718e89ad1e | ||
|
|
9453a60254 | ||
|
|
f87ec9d401 | ||
|
|
cb1859a710 | ||
|
|
1ed95164db | ||
|
|
ac5d0e54f0 | ||
|
|
b1e79411e7 | ||
|
|
a9d834d715 | ||
|
|
68cfd130d3 | ||
|
|
93a4b823c8 | ||
|
|
769662d77a | ||
|
|
7fd627f169 |
||
|
|
b91468b6f2 | ||
|
|
0b9cd4be5d |
||
|
|
4c587ee1b8 |
||
|
|
19e1e8b8a6 |
||
|
|
67e9522c67 |
||
|
|
a829b38a34 |
||
|
|
c8dae94b5b |
||
|
|
87267758ac | ||
|
|
5f72df81fb | ||
|
|
1ed270fe05 |
||
|
|
19a654a2b1 |
||
|
|
f9bbc11711 |
||
|
|
42b1807c36 |
||
|
|
647982de1a |
||
|
|
f5557c612a |
||
|
|
f4749db8b3 | ||
|
|
86a1de6788 | ||
|
|
792c5e2d95 | ||
|
|
6758580be9 |
||
|
|
6f246eed4a | ||
|
|
fc3725d3f4 | ||
|
|
00c6f0dfdb |
||
|
|
cf7b4e2458 |
||
|
|
f682e44367 |
||
|
|
9d1f86c410 |
||
|
|
dac281ac32 |
||
|
|
29a58086a3 |
||
|
|
cb8eb755a7 |
||
|
|
1e8fc29ee4 |
||
|
|
9a05b49e3d |
||
|
|
79f8d92084 |
||
|
|
6e56542586 |
||
|
|
c53443b62b |
||
|
|
1128662c89 |
||
|
|
676787417f |
||
|
|
57422dccf3 |
||
|
|
7f3f51e36b |
||
|
|
ef184ec8bf | ||
|
|
9bfe3094dd |
||
|
|
3547b4d010 |
||
|
|
1222e3aa1b |
||
|
|
cff3ee5079 |
||
|
|
c91aa462aa |
||
|
|
62b3775e2f |
||
|
|
54bf8c1142 |
||
|
|
c4f613e4c5 |
||
|
|
a66d9ab0b1 |
140
.github/workflows/build-and-test-alpha.yml
vendored
Normal file
|
|
@ -0,0 +1,140 @@
|
|||
name: Build + Test v3 alpha
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [v3-alpha]
|
||||
paths-ignore:
|
||||
- 'mkdocs-website/**/*'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
test_go:
|
||||
name: Run Go Tests
|
||||
if: github.repository == 'wailsapp/wails'
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [windows-latest, macos-latest, ubuntu-latest]
|
||||
go-version: [1.21]
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install linux dependencies
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev build-essential pkg-config
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
|
||||
- name: Install Task
|
||||
uses: arduino/setup-task@v1
|
||||
with:
|
||||
version: 3.x
|
||||
repo-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build Examples
|
||||
working-directory: ./v3
|
||||
run: task test:examples
|
||||
|
||||
- name: Run tests (mac)
|
||||
if: matrix.os == 'macos-latest'
|
||||
env:
|
||||
CGO_LDFLAGS: -framework UniformTypeIdentifiers -mmacosx-version-min=10.13
|
||||
working-directory: ./v3
|
||||
run: go test -v ./...
|
||||
|
||||
- name: Run tests (!mac)
|
||||
if: matrix.os != 'macos-latest'
|
||||
working-directory: ./v3
|
||||
run: go test -v ./...
|
||||
|
||||
test_js:
|
||||
name: Run JS Tests
|
||||
if: github.repository == 'wailsapp/wails'
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [18.x]
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Use Node.js ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
working-directory: v2/internal/frontend/runtime
|
||||
|
||||
- name: Run tests
|
||||
run: npm test
|
||||
working-directory: v2/internal/frontend/runtime
|
||||
|
||||
test_templates:
|
||||
name: Test Templates
|
||||
needs: test_go
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: true
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||
template:
|
||||
[
|
||||
svelte,
|
||||
svelte-ts,
|
||||
vue,
|
||||
vue-ts,
|
||||
react,
|
||||
react-ts,
|
||||
preact,
|
||||
preact-ts,
|
||||
lit,
|
||||
lit-ts,
|
||||
vanilla,
|
||||
vanilla-ts,
|
||||
]
|
||||
go-version: [1.21]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup Go
|
||||
uses: actions/setup-go@v3
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
|
||||
- name: Setup Golang caches
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
path: |
|
||||
~/.cache/go-build
|
||||
~/go/pkg/mod
|
||||
key: ${{ runner.os }}-golang-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-golang-
|
||||
|
||||
- name: Build Wails3 CLI
|
||||
run: |
|
||||
cd ./v3/cmd/wails3
|
||||
go install
|
||||
wails3 -help
|
||||
|
||||
- name: Install linux dependencies
|
||||
if: matrix.os == 'ubuntu-latest'
|
||||
run: sudo apt-get update -y && sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libayatana-appindicator3-dev build-essential pkg-config
|
||||
|
||||
- name: Generate template '${{ matrix.template }}'
|
||||
run: |
|
||||
go install github.com/go-task/task/v3/cmd/task@latest
|
||||
mkdir -p ./test-${{ matrix.template }}
|
||||
cd ./test-${{ matrix.template }}
|
||||
wails3 init -n ${{ matrix.template }} -t ${{ matrix.template }}
|
||||
cd ${{ matrix.template }}
|
||||
wails3 build
|
||||
35
.github/workflows/v3-docs.yml
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
name: v3 docs
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- v3-alpha
|
||||
paths:
|
||||
- 'mkdocs-website/**/*'
|
||||
permissions:
|
||||
contents: write
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
if: github.event.repository.fork == false
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./mkdocs-website
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: 3.x
|
||||
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
key: mkdocs-material-${{ env.cache_id }}
|
||||
path: .cache
|
||||
restore-keys: |
|
||||
mkdocs-material-
|
||||
- run: sudo apt-get install pngquant
|
||||
- run: pip install pillow cairosvg
|
||||
- run: pip install git+https://${GH_TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git
|
||||
- run: mkdocs build --config-file mkdocs.insiders.yml
|
||||
- run: mkdocs gh-deploy --force
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
1
CNAME
Normal file
|
|
@ -0,0 +1 @@
|
|||
v3alpha.wails.io
|
||||
|
|
@ -16,6 +16,11 @@ includes:
|
|||
dir: v3
|
||||
optional: true
|
||||
|
||||
docs:
|
||||
taskfile: mkdocs-website
|
||||
dir: mkdocs-website
|
||||
optional: true
|
||||
|
||||
tasks:
|
||||
contributors:check:
|
||||
cmds:
|
||||
|
|
|
|||
1
mkdocs-website/CNAME
Normal file
|
|
@ -0,0 +1 @@
|
|||
v3alpha.wails.io
|
||||
45
mkdocs-website/README.md
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
# v3 Docs
|
||||
|
||||
This is the documentation for Wails v3. It is currently a work in progress.
|
||||
|
||||
If you do not wish to build it locally, it is available online at
|
||||
[https://wailsapp.github.io/wails/](https://wailsapp.github.io/wails/).
|
||||
|
||||
## Recommended Setup Steps
|
||||
|
||||
Install the wails3 CLI if you haven't already:
|
||||
|
||||
```shell
|
||||
go install github.com/wailsapp/wails/v3/cmd/wails3@latest
|
||||
```
|
||||
|
||||
The documentation uses mkdocs, so you will need to install
|
||||
[Python](https://www.python.org/). Once installed, you can setup the
|
||||
documentation by running the following command:
|
||||
|
||||
```bash
|
||||
wails3 task docs:setup
|
||||
```
|
||||
|
||||
This will install the required dependencies for you.
|
||||
|
||||
If you have installed the wails3 CLI, you can run the following command to build
|
||||
the documentation and serve it locally:
|
||||
|
||||
```bash
|
||||
wails3 task docs:serve
|
||||
```
|
||||
|
||||
### Manual Setup
|
||||
|
||||
To install manually, you will need to do the following:
|
||||
|
||||
- Install [Python](https://www.python.org/)
|
||||
- Run `pip install -r requirements.txt` to install the required dependencies
|
||||
- Run `mkdocs serve` to serve the documentation locally
|
||||
- Run `mkdocs build` to build the documentation
|
||||
|
||||
## Contributing
|
||||
|
||||
If you would like to contribute to the documentation, please feel free to open a
|
||||
PR!
|
||||
59
mkdocs-website/Taskfile.yml
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
# https://taskfile.dev
|
||||
|
||||
version: '3'
|
||||
|
||||
tasks:
|
||||
|
||||
setup:
|
||||
summary: Setup the project
|
||||
preconditions:
|
||||
- sh: python{{exeExt}} --version
|
||||
msg: "Looks like Python isn't installed. Python is required to build the documentation: https://www.python.org/downloads/"
|
||||
cmds:
|
||||
- python -m pip install -r requirements.txt --user
|
||||
|
||||
setup:insiders:
|
||||
summary: Setup the project (insiders)
|
||||
preconditions:
|
||||
- sh: python{{exeExt}} --version
|
||||
msg: "Looks like Python isn't installed. Python is required to build the documentation: https://www.python.org/downloads/"
|
||||
cmds:
|
||||
- python -m pip install -r requirements.insiders.txt --user
|
||||
|
||||
upgrade:insiders:
|
||||
summary: Upgrade the project (insiders)
|
||||
preconditions:
|
||||
- sh: python{{exeExt}} --version
|
||||
msg: "Looks like Python isn't installed. Python is required to build the documentation: https://www.python.org/downloads/"
|
||||
cmds:
|
||||
- python -m pip install -r requirements.insiders.txt --upgrade --user
|
||||
|
||||
build:
|
||||
summary: Builds the documentation
|
||||
preconditions:
|
||||
- sh: mkdocs --version
|
||||
msg: "Looks like mkdocs isn't installed. Run `wails3 task setup` or `task setup` in the documentation directory to install it."
|
||||
cmds:
|
||||
- mkdocs build
|
||||
|
||||
serve:
|
||||
summary: Builds the documentation and serves it locally
|
||||
preconditions:
|
||||
- sh: mkdocs --version
|
||||
msg: "Looks like mkdocs isn't installed. Run `wails3 task setup` or `task setup` in the documentation directory to install it."
|
||||
cmds:
|
||||
- mkdocs serve
|
||||
|
||||
serve:insiders:
|
||||
summary: Builds the documentation and serves it locally
|
||||
preconditions:
|
||||
- sh: mkdocs --version
|
||||
msg: "Looks like mkdocs isn't installed. Run `wails3 task setup` or `task setup` in the documentation directory to install it."
|
||||
cmds:
|
||||
- mkdocs serve --config-file mkdocs.insiders.yml
|
||||
|
||||
update:api:
|
||||
summary: Updates the API documentation
|
||||
dir: generate
|
||||
cmds:
|
||||
- go run .
|
||||
1
mkdocs-website/docs/CNAME
Normal file
|
|
@ -0,0 +1 @@
|
|||
v3alpha.wails.io
|
||||
358
mkdocs-website/docs/en/API/application.md
Normal file
|
|
@ -0,0 +1,358 @@
|
|||
# Application
|
||||
|
||||
The application API assists in creating an application using the Wails framework.
|
||||
|
||||
### New
|
||||
|
||||
API: `New(appOptions Options) *App`
|
||||
|
||||
`New(appOptions Options)` creates a new application using the given application
|
||||
options . It applies default values for unspecified options, merges them with
|
||||
the provided ones, initializes and returns an instance of the application.
|
||||
|
||||
In case of an error during initialization, the application is stopped with the
|
||||
error message provided.
|
||||
|
||||
It should be noted that if a global application instance already exists, that
|
||||
instance will be returned instead of creating a new one.
|
||||
|
||||
```go title="main.go" hl_lines="6-9"
|
||||
package main
|
||||
|
||||
import "github.com/wailsapp/wails/v3/pkg/application"
|
||||
|
||||
func main() {
|
||||
app := application.New(application.Options{
|
||||
Name: "WebviewWindow Demo",
|
||||
// Other options
|
||||
})
|
||||
|
||||
// Rest of application
|
||||
}
|
||||
```
|
||||
|
||||
### Get
|
||||
|
||||
`Get()` returns the global application instance. It's useful when you need to
|
||||
access the application from different parts of your code.
|
||||
|
||||
```go
|
||||
// Get the application instance
|
||||
app := application.Get()
|
||||
```
|
||||
|
||||
### Capabilities
|
||||
|
||||
API: `Capabilities() capabilities.Capabilities`
|
||||
|
||||
`Capabilities()` retrieves a map of capabilities that the application currently
|
||||
has. Capabilities can be about different features the operating system provides,
|
||||
like webview features.
|
||||
|
||||
```go
|
||||
// Get the application capabilities
|
||||
capabilities := app.Capabilities()
|
||||
if capabilities.HasNativeDrag {
|
||||
// Do something
|
||||
}
|
||||
```
|
||||
|
||||
### GetPID
|
||||
|
||||
API: `GetPID() int`
|
||||
|
||||
`GetPID()` returns the Process ID of the application.
|
||||
|
||||
```go
|
||||
pid := app.GetPID()
|
||||
```
|
||||
|
||||
### Run
|
||||
|
||||
API: `Run() error`
|
||||
|
||||
`Run()` starts the execution of the application and its components.
|
||||
|
||||
```go
|
||||
app := application.New(application.Options{
|
||||
//options
|
||||
})
|
||||
// Run the application
|
||||
err := application.Run()
|
||||
if err != nil {
|
||||
// Handle error
|
||||
}
|
||||
```
|
||||
|
||||
### Quit
|
||||
|
||||
API: `Quit()`
|
||||
|
||||
`Quit()` quits the application by destroying windows and potentially other
|
||||
components.
|
||||
|
||||
```go
|
||||
// Quit the application
|
||||
app.Quit()
|
||||
```
|
||||
|
||||
### IsDarkMode
|
||||
|
||||
API: `IsDarkMode() bool`
|
||||
|
||||
`IsDarkMode()` checks if the application is running in dark mode. It returns a
|
||||
boolean indicating whether dark mode is enabled.
|
||||
|
||||
```go
|
||||
// Check if dark mode is enabled
|
||||
if app.IsDarkMode() {
|
||||
// Do something
|
||||
}
|
||||
```
|
||||
|
||||
### Hide
|
||||
|
||||
API: `Hide()`
|
||||
|
||||
`Hide()` hides the application window.
|
||||
|
||||
```go
|
||||
// Hide the application window
|
||||
app.Hide()
|
||||
```
|
||||
|
||||
### Show
|
||||
|
||||
API: `Show()`
|
||||
|
||||
`Show()` shows the application window.
|
||||
|
||||
```go
|
||||
// Show the application window
|
||||
app.Show()
|
||||
```
|
||||
|
||||
### NewWebviewWindow
|
||||
|
||||
API: `NewWebviewWindow() *WebviewWindow`
|
||||
|
||||
`NewWebviewWindow()` creates a new Webview window with default options, and
|
||||
returns it.
|
||||
|
||||
```go
|
||||
// Create a new webview window
|
||||
window := app.NewWebviewWindow()
|
||||
```
|
||||
|
||||
### NewWebviewWindowWithOptions
|
||||
|
||||
API:
|
||||
`NewWebviewWindowWithOptions(windowOptions WebviewWindowOptions) *WebviewWindow`
|
||||
|
||||
`NewWebviewWindowWithOptions()` creates a new webview window with custom
|
||||
options. The newly created window is added to a map of windows managed by the
|
||||
application.
|
||||
|
||||
```go
|
||||
// Create a new webview window with custom options
|
||||
window := app.NewWebviewWindowWithOptions(WebviewWindowOptions{
|
||||
Name: "Main",
|
||||
Title: "My Window",
|
||||
Width: 800,
|
||||
Height: 600,
|
||||
})
|
||||
```
|
||||
|
||||
### OnWindowCreation
|
||||
|
||||
API: `OnWindowCreation(callback func(window *WebviewWindow))`
|
||||
|
||||
`OnWindowCreation()` registers a callback function to be called when a window is
|
||||
created.
|
||||
|
||||
```go
|
||||
// Register a callback to be called when a window is created
|
||||
app.OnWindowCreation(func(window *WebviewWindow) {
|
||||
// Do something
|
||||
})
|
||||
```
|
||||
|
||||
### GetWindowByName
|
||||
|
||||
API: `GetWindowByName(name string) *WebviewWindow`
|
||||
|
||||
`GetWindowByName()` fetches and returns a window with a specific name.
|
||||
|
||||
```go
|
||||
// Get a window by name
|
||||
window := app.GetWindowByName("Main")
|
||||
```
|
||||
|
||||
### CurrentWindow
|
||||
|
||||
API: `CurrentWindow() *WebviewWindow`
|
||||
|
||||
`CurrentWindow()` fetches and returns a pointer to the currently active window
|
||||
in the application. If there is no window, it returns nil.
|
||||
|
||||
```go
|
||||
// Get the current window
|
||||
window := app.CurrentWindow()
|
||||
```
|
||||
|
||||
### RegisterContextMenu
|
||||
|
||||
API: `RegisterContextMenu(name string, menu *Menu)`
|
||||
|
||||
`RegisterContextMenu()` registers a context menu with a given name. This menu
|
||||
can be used later in the application.
|
||||
|
||||
```go
|
||||
|
||||
// Create a new menu
|
||||
ctxmenu := app.NewMenu()
|
||||
|
||||
// Register the menu as a context menu
|
||||
app.RegisterContextMenu("MyContextMenu", ctxmenu)
|
||||
```
|
||||
|
||||
### SetMenu
|
||||
|
||||
API: `SetMenu(menu *Menu)`
|
||||
|
||||
`SetMenu()` sets the menu for the application. On Mac, this will be the global
|
||||
menu. For Windows and Linux, this will be the default menu for any new window
|
||||
created.
|
||||
|
||||
```go
|
||||
// Create a new menu
|
||||
menu := app.NewMenu()
|
||||
|
||||
// Set the menu for the application
|
||||
app.SetMenu(menu)
|
||||
```
|
||||
|
||||
### ShowAboutDialog
|
||||
|
||||
API: `ShowAboutDialog()`
|
||||
|
||||
`ShowAboutDialog()` shows an "About" dialog box. It can show the application's
|
||||
name, description and icon.
|
||||
|
||||
```go
|
||||
// Show the about dialog
|
||||
app.ShowAboutDialog()
|
||||
```
|
||||
|
||||
### Info
|
||||
|
||||
API: `InfoDialog()`
|
||||
|
||||
`InfoDialog()` creates and returns a new instance of `MessageDialog` with an
|
||||
`InfoDialogType`. This dialog is typically used to display informational
|
||||
messages to the user.
|
||||
|
||||
### Question
|
||||
|
||||
API: `QuestionDialog()`
|
||||
|
||||
`QuestionDialog()` creates and returns a new instance of `MessageDialog` with a
|
||||
`QuestionDialogType`. This dialog is often used to ask a question to the user
|
||||
and expect a response.
|
||||
|
||||
### Warning
|
||||
|
||||
API: `WarningDialog()`
|
||||
|
||||
`WarningDialog()` creates and returns a new instance of `MessageDialog` with a
|
||||
`WarningDialogType`. As the name suggests, this dialog is primarily used to
|
||||
display warning messages to the user.
|
||||
|
||||
### Error
|
||||
|
||||
API: `ErrorDialog()`
|
||||
|
||||
`ErrorDialog()` creates and returns a new instance of `MessageDialog` with an
|
||||
`ErrorDialogType`. This dialog is designed to be used when you need to display
|
||||
an error message to the user.
|
||||
|
||||
### OpenFile
|
||||
|
||||
API: `OpenFileDialog()`
|
||||
|
||||
`OpenFileDialog()` creates and returns a new `OpenFileDialogStruct`. This dialog
|
||||
prompts the user to select one or more files from their file system.
|
||||
|
||||
### SaveFile
|
||||
|
||||
API: `SaveFileDialog()`
|
||||
|
||||
`SaveFileDialog()` creates and returns a new `SaveFileDialogStruct`. This dialog
|
||||
prompts the user to choose a location on their file system where a file should
|
||||
be saved.
|
||||
|
||||
### OpenDirectory
|
||||
|
||||
API: `OpenDirectoryDialog()`
|
||||
|
||||
`OpenDirectoryDialog()` creates and returns a new instance of `MessageDialog`
|
||||
with an `OpenDirectoryDialogType`. This dialog enables the user to choose a
|
||||
directory from their file system.
|
||||
|
||||
### On
|
||||
|
||||
API:
|
||||
`On(eventType events.ApplicationEventType, callback func(event *Event)) func()`
|
||||
|
||||
`On()` registers an event listener for specific application events. The callback
|
||||
function provided will be triggered when the corresponding event occurs. The
|
||||
function returns a function that can be called to remove the listener.
|
||||
|
||||
### RegisterHook
|
||||
|
||||
API:
|
||||
`RegisterHook(eventType events.ApplicationEventType, callback func(event *Event)) func()`
|
||||
|
||||
`RegisterHook()` registers a callback to be run as a hook during specific
|
||||
events. These hooks are run before listeners attached with `On()`. The function
|
||||
returns a function that can be called to remove the hook.
|
||||
|
||||
### GetPrimaryScreen
|
||||
|
||||
API: `GetPrimaryScreen() (*Screen, error)`
|
||||
|
||||
`GetPrimaryScreen()` returns the primary screen of the system.
|
||||
|
||||
### GetScreens
|
||||
|
||||
API: `GetScreens() ([]*Screen, error)`
|
||||
|
||||
`GetScreens()` returns information about all screens attached to the system.
|
||||
|
||||
This is a brief summary of the exported methods in the provided `App` struct. Do
|
||||
note that for more detailed functionality or considerations, refer to the actual
|
||||
Go code or further internal documentation.
|
||||
|
||||
## Options
|
||||
|
||||
```go title="application_options.go"
|
||||
--8<--
|
||||
../v3/pkg/application/options_application.go
|
||||
--8<--
|
||||
```
|
||||
|
||||
### Windows Options
|
||||
|
||||
```go title="application_options_windows.go"
|
||||
--8<--
|
||||
../v3/pkg/application/options_application_win.go
|
||||
--8<--
|
||||
```
|
||||
|
||||
### Mac Options
|
||||
|
||||
```go title="options_application_mac.go"
|
||||
--8<--
|
||||
../v3/pkg/application/options_application_mac.go
|
||||
--8<--
|
||||
```
|
||||
4336
mkdocs-website/docs/en/API/fullapi.md
Normal file
50
mkdocs-website/docs/en/API/mainthread.md
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
# Main Thread Functions
|
||||
|
||||
These methods are utility functions to run code on the main thread. This is
|
||||
required when you want to run custom code on the UI thread.
|
||||
|
||||
### InvokeSync
|
||||
|
||||
API: `InvokeSync(fn func())`
|
||||
|
||||
This function runs the passed function (`fn`) synchronously. It uses a WaitGroup
|
||||
(`wg`) to ensure that the main thread waits for the `fn` function to finish
|
||||
before it continues. If a panic occurs inside `fn`, it will be passed to the
|
||||
handler function `PanicHandler`, defined in the application options.
|
||||
|
||||
### InvokeSyncWithResult
|
||||
|
||||
API: `InvokeSyncWithResult[T any](fn func() T) (res T)`
|
||||
|
||||
This function works similarly to `InvokeSync(fn func())`, however, it yields a
|
||||
result. Use this for calling any function with a single return.
|
||||
|
||||
### InvokeSyncWithError
|
||||
|
||||
API: `InvokeSyncWithError(fn func() error) (err error)`
|
||||
|
||||
This function runs `fn` synchronously and returns any error that `fn` produces.
|
||||
Note that this function will recover from a panic if one occurs during `fn`'s
|
||||
execution.
|
||||
|
||||
### InvokeSyncWithResultAndError
|
||||
|
||||
API:
|
||||
`InvokeSyncWithResultAndError[T any](fn func() (T, error)) (res T, err error)`
|
||||
|
||||
This function runs `fn` synchronously and returns both a result of type `T` and
|
||||
an error.
|
||||
|
||||
### InvokeAsync
|
||||
|
||||
API: `InvokeAsync(fn func())`
|
||||
|
||||
This function runs `fn` asynchronously. It runs the given function on the main
|
||||
thread. If a panic occurs inside `fn`, it will be passed to the handler function
|
||||
`PanicHandler`, defined in the application options.
|
||||
|
||||
---
|
||||
|
||||
_Note_: These functions will block execution until `fn` has finished. It's
|
||||
critical to ensure that `fn` doesn't block. If you need to run a function that
|
||||
blocks, use `InvokeAsync` instead.
|
||||
69
mkdocs-website/docs/en/API/menu.md
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
# Menu
|
||||
|
||||
Menus can be created and added to the application. They can be used to create
|
||||
context menus, system tray menus and application menus.
|
||||
|
||||
To create a new menu, call:
|
||||
|
||||
```go
|
||||
// Create a new menu
|
||||
menu := app.NewMenu()
|
||||
```
|
||||
|
||||
The following operations are then available on the `Menu` type:
|
||||
|
||||
### Add
|
||||
|
||||
API: `Add(label string) *MenuItem`
|
||||
|
||||
This method takes a `label` of type `string` as an input and adds a new
|
||||
`MenuItem` with the given label to the menu. It returns the `MenuItem` added.
|
||||
|
||||
### AddSeparator
|
||||
|
||||
API: `AddSeparator()`
|
||||
|
||||
This method adds a new separator `MenuItem` to the menu.
|
||||
|
||||
### AddCheckbox
|
||||
|
||||
API: `AddCheckbox(label string, enabled bool) *MenuItem`
|
||||
|
||||
This method takes a `label` of type `string` and `enabled` of type `bool` as
|
||||
inputs and adds a new checkbox `MenuItem` with the given label and enabled state
|
||||
to the menu. It returns the `MenuItem` added.
|
||||
|
||||
### AddRadio
|
||||
|
||||
API: `AddRadio(label string, enabled bool) *MenuItem`
|
||||
|
||||
This method takes a `label` of type `string` and `enabled` of type `bool` as
|
||||
inputs and adds a new radio `MenuItem` with the given label and enabled state to
|
||||
the menu. It returns the `MenuItem` added.
|
||||
|
||||
### Update
|
||||
|
||||
API: `Update()`
|
||||
|
||||
This method processes any radio groups and updates the menu if a menu
|
||||
implementation is not initialized.
|
||||
|
||||
### AddSubmenu
|
||||
|
||||
API: `AddSubmenu(s string) *Menu`
|
||||
|
||||
This method takes a `s` of type `string` as input and adds a new submenu
|
||||
`MenuItem` with the given label to the menu. It returns the submenu added.
|
||||
|
||||
### AddRole
|
||||
|
||||
API: `AddRole(role Role) *Menu`
|
||||
|
||||
This method takes `role` of type `Role` as input, adds it to the menu if it is
|
||||
not `nil` and returns the `Menu`.
|
||||
|
||||
### SetLabel
|
||||
|
||||
API: `SetLabel(label string)`
|
||||
|
||||
This method sets the `label` of the `Menu`.
|
||||
112
mkdocs-website/docs/en/API/systray.md
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
# System Tray
|
||||
|
||||
The system tray houses notification area on a desktop environment, which can
|
||||
contain both icons of currently-running applications and specific system
|
||||
notifications.
|
||||
|
||||
You create a system tray by calling `app.NewSystemTray()`:
|
||||
|
||||
```go
|
||||
// Create a new system tray
|
||||
tray := app.NewSystemTray()
|
||||
```
|
||||
|
||||
The following methods are available on the `SystemTray` type:
|
||||
|
||||
### SetLabel
|
||||
|
||||
API: `SetLabel(label string)`
|
||||
|
||||
The `SetLabel` method sets the tray's label.
|
||||
|
||||
### Label
|
||||
|
||||
API: `Label() string`
|
||||
|
||||
The `Label` method retrieves the tray's label.
|
||||
|
||||
### PositionWindow
|
||||
|
||||
API: `PositionWindow(*WebviewWindow, offset int) error`
|
||||
|
||||
The `PositionWindow` method calls both `AttachWindow` and `WindowOffset`
|
||||
methods.
|
||||
|
||||
### SetIcon
|
||||
|
||||
API: `SetIcon(icon []byte) *SystemTray`
|
||||
|
||||
The `SetIcon` method sets the system tray's icon.
|
||||
|
||||
### SetDarkModeIcon
|
||||
|
||||
API: `SetDarkModeIcon(icon []byte) *SystemTray`
|
||||
|
||||
The `SetDarkModeIcon` method sets the system tray's icon when in dark mode.
|
||||
|
||||
### SetMenu
|
||||
|
||||
API: `SetMenu(menu *Menu) *SystemTray`
|
||||
|
||||
The `SetMenu` method sets the system tray's menu.
|
||||
|
||||
### Destroy
|
||||
|
||||
API: `Destroy()`
|
||||
|
||||
The `Destroy` method destroys the system tray instance.
|
||||
|
||||
### OnClick
|
||||
|
||||
API: `OnClick(handler func()) *SystemTray`
|
||||
|
||||
The `OnClick` method sets the function to execute when the tray icon is clicked.
|
||||
|
||||
### OnRightClick
|
||||
|
||||
API: `OnRightClick(handler func()) *SystemTray`
|
||||
|
||||
The `OnRightClick` method sets the function to execute when right-clicking the
|
||||
tray icon.
|
||||
|
||||
### OnDoubleClick
|
||||
|
||||
API: `OnDoubleClick(handler func()) *SystemTray`
|
||||
|
||||
The `OnDoubleClick` method sets the function to execute when double-clicking the
|
||||
tray icon.
|
||||
|
||||
### OnRightDoubleClick
|
||||
|
||||
API: `OnRightDoubleClick(handler func()) *SystemTray`
|
||||
|
||||
The `OnRightDoubleClick` method sets the function to execute when right
|
||||
double-clicking the tray icon.
|
||||
|
||||
### AttachWindow
|
||||
|
||||
API: `AttachWindow(window *WebviewWindow) *SystemTray`
|
||||
|
||||
The `AttachWindow` method attaches a window to the system tray. The window will
|
||||
be shown when the system tray icon is clicked.
|
||||
|
||||
### WindowOffset
|
||||
|
||||
API: `WindowOffset(offset int) *SystemTray`
|
||||
|
||||
The `WindowOffset` method sets the gap in pixels between the system tray and the
|
||||
window.
|
||||
|
||||
### WindowDebounce
|
||||
|
||||
API: `WindowDebounce(debounce time.Duration) *SystemTray`
|
||||
|
||||
The `WindowDebounce` method sets a debounce time. In the context of Windows,
|
||||
this is used to specify how long to wait before responding to a mouse up event
|
||||
on the notification icon.
|
||||
|
||||
### OpenMenu
|
||||
|
||||
API: `OpenMenu()`
|
||||
|
||||
The `OpenMenu` method opens the menu associated with the system tray.
|
||||
114
mkdocs-website/docs/en/API/window.md
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
# Window
|
||||
|
||||
To create a window, use
|
||||
[Application.NewWebviewWindow](application.md#newwebviewwindow) or
|
||||
[Application.NewWebviewWindowWithOptions](application.md#newwebviewwindowwithoptions).
|
||||
The former creates a window with default options, while the latter allows you to
|
||||
specify custom options.
|
||||
|
||||
These methods are callable on the returned WebviewWindow object:
|
||||
|
||||
### SetTitle
|
||||
|
||||
API: `SetTitle(title string) *WebviewWindow`
|
||||
|
||||
This method updates the window title to the provided string. It returns the
|
||||
WebviewWindow object, allowing for method chaining.
|
||||
|
||||
### Name
|
||||
|
||||
API: `Name() string`
|
||||
|
||||
This function returns the name of the WebviewWindow.
|
||||
|
||||
### SetSize
|
||||
|
||||
API: `SetSize(width, height int) *WebviewWindow`
|
||||
|
||||
This method sets the size of the WebviewWindow to the provided width and height
|
||||
parameters. If the dimensions provided exceed the constraints, they are adjusted
|
||||
appropriately.
|
||||
|
||||
### SetAlwaysOnTop
|
||||
|
||||
API: `SetAlwaysOnTop(b bool) *WebviewWindow`
|
||||
|
||||
This function sets the window to stay on top based on the boolean flag provided.
|
||||
|
||||
### Show
|
||||
|
||||
API: `Show() *WebviewWindow`
|
||||
|
||||
`Show` method is used to make the window visible. If the window is not running,
|
||||
it first invokes the `run` method to start the window and then makes it visible.
|
||||
|
||||
### Hide
|
||||
|
||||
API: `Hide() *WebviewWindow`
|
||||
|
||||
`Hide` method is used to hide the window. It sets the hidden status of the
|
||||
window to true and emits the window hide event.
|
||||
|
||||
### SetURL
|
||||
|
||||
API: `SetURL(s string) *WebviewWindow`
|
||||
|
||||
`SetURL` method is used to set the URL of the window to the given URL string.
|
||||
|
||||
### SetZoom
|
||||
|
||||
API: `SetZoom(magnification float64) *WebviewWindow`
|
||||
|
||||
`SetZoom` method sets the zoom level of the window content to the provided
|
||||
magnification level.
|
||||
|
||||
### GetZoom
|
||||
|
||||
API: `GetZoom() float64`
|
||||
|
||||
`GetZoom` function returns the current zoom level of the window content.
|
||||
|
||||
### GetScreen
|
||||
|
||||
API: `GetScreen() (*Screen, error)`
|
||||
|
||||
`GetScreen` method returns the screen on which the window is displayed.
|
||||
|
||||
#### SetFrameless
|
||||
|
||||
API: `SetFrameless(frameless bool) *WebviewWindow`
|
||||
|
||||
This function is used to remove the window frame and title bar. It toggles the
|
||||
framelessness of the window according to the boolean value provided (true for
|
||||
frameless, false for framed).
|
||||
|
||||
#### RegisterContextMenu
|
||||
|
||||
API: `RegisterContextMenu(name string, menu *Menu)`
|
||||
|
||||
This function is used to register a context menu and assigns it the given name.
|
||||
|
||||
#### NativeWindowHandle
|
||||
|
||||
API: `NativeWindowHandle() (uintptr, error)`
|
||||
|
||||
This function is used to fetch the platform native window handle for the window.
|
||||
|
||||
#### Focus
|
||||
|
||||
API: `Focus()`
|
||||
|
||||
This function is used to focus the window.
|
||||
|
||||
#### SetEnabled
|
||||
|
||||
API: `SetEnabled(enabled bool)`
|
||||
|
||||
This function is used to enable/disable the window based on the provided boolean
|
||||
value.
|
||||
|
||||
#### SetAbsolutePosition
|
||||
|
||||
API: `SetAbsolutePosition(x int, y int)`
|
||||
|
||||
This function sets the absolute position of the window in the screen.
|
||||
39
mkdocs-website/docs/en/changelog.md
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# Changelog
|
||||
|
||||
<!--
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
- `Added` for new features.
|
||||
- `Changed` for changes in existing functionality.
|
||||
- `Deprecated` for soon-to-be removed features.
|
||||
- `Removed` for now removed features.
|
||||
- `Fixed` for any bug fixes.
|
||||
- `Security` in case of vulnerabilities.
|
||||
|
||||
-->
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Added
|
||||
|
||||
- [darwin] add Event ApplicationShouldHandleReopen to able handle dock icon click by @5aaee9 in [#2991](https://github.com/wailsapp/wails/pull/2991)
|
||||
- [darwin] add getPrimaryScreen/getScreens to impl by @tmclane in [#2618](https://github.com/wailsapp/wails/pull/2618)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed Doctor apt package verify by [Atterpac](https://github.com/Atterpac) in [#2972](https://github.com/wailsapp/wails/pull/2972).
|
||||
- Fixed application frozen when quit (Darwin) by @5aaee9 in [#2982](https://github.com/wailsapp/wails/pull/2982)
|
||||
- Fixed background colours of examples on Windows by [mmgvh](https://github.com/mmghv) in [#2750](https://github.com/wailsapp/wails/pull/2750).
|
||||
- Fixed default context menus by [mmgvh](https://github.com/mmghv) in [#2753](https://github.com/wailsapp/wails/pull/2753).
|
||||
|
||||
|
||||
### Changed
|
||||
|
||||
### Removed
|
||||
|
||||
### Deprecated
|
||||
|
||||
### Security
|
||||
454
mkdocs-website/docs/en/development/changes.md
Normal file
|
|
@ -0,0 +1,454 @@
|
|||
# Changes for v3
|
||||
|
||||
!!! note
|
||||
This is currently an unsorted brain dump of changes. It will be organised into a more readable format soon.
|
||||
|
||||
## Options
|
||||
|
||||
The application options have been revised since v2.
|
||||
|
||||
## Events
|
||||
|
||||
In v3, there are 3 types of events:
|
||||
|
||||
- Application Events
|
||||
- Window Events
|
||||
- Custom Events
|
||||
|
||||
### Application Events
|
||||
|
||||
Application events are events that are emitted by the application. These events
|
||||
include native events such as `ApplicationDidFinishLaunching` on macOS.
|
||||
|
||||
### Window Events
|
||||
|
||||
Window events are events that are emitted by a window. These events include
|
||||
native events such as `WindowDidBecomeMain` on macOS. Common events are also
|
||||
defined, so they work cross-platform, e.g. `WindowClosing`.
|
||||
|
||||
### Custom Events
|
||||
|
||||
Events that the user defines are called `WailsEvents`. This is to differentiate
|
||||
them from the `Event` object that is used to communicate with the browser.
|
||||
WailsEvents are now objects that encapsulate all the details of an event. This
|
||||
includes the event name, the data, and the source of the event.
|
||||
|
||||
The data associated with a WailsEvent is now a single value. If multiple values
|
||||
are required, then a struct can be used.
|
||||
|
||||
### Event callbacks and `Emit` function signature
|
||||
|
||||
The signatures events callbacks (as used by `On`, `Once` & `OnMultiple`) have
|
||||
changed. In v2, the callback function received optional data. In v3, the
|
||||
callback function receives a `WailsEvent` object that contains all data related
|
||||
to the event.
|
||||
|
||||
Similarly, the `Emit` function has changed. Instead of taking a name and
|
||||
optional data, it now takes a single `WailsEvent` object that it will emit.
|
||||
|
||||
### `Off` and `OffAll`
|
||||
|
||||
In v2, `Off` and `OffAll` calls would remove events in both JS and Go. Due to
|
||||
the multi-window nature of v3, this has been changed so that these methods only
|
||||
apply to the context they are called in. For example, if you call `Off` in a
|
||||
window, it will only remove events for that window. If you use `Off` in Go, it
|
||||
will only remove events for Go.
|
||||
|
||||
### Hooks
|
||||
|
||||
Event Hooks are a new feature in v3. They allow you to hook into the event
|
||||
system and perform actions when certain events are emitted. For example, you can
|
||||
hook into the `WindowClosing` event and perform some cleanup before the window
|
||||
closes. Hooks can be registered at the application level or at the window level
|
||||
using `RegisterHook`. Application level are for application events. Window level
|
||||
hooks will only be called for the window they are registered with.
|
||||
|
||||
### Logging
|
||||
|
||||
Logging in v2 was confusing as both application logs and system (internal) logs
|
||||
were using the same logger. We have simplified this as follows:
|
||||
|
||||
- Internal logs are now handled using the standard Go `slog` logger. This is
|
||||
configured using the `logger` option in the application options. By default,
|
||||
this uses the [tint](https://github.com/lmittmann/tint) logger.
|
||||
- Application logs can now be achieved through the new `log` plugin which
|
||||
utilises `slog` under the hood. This plugin provides a simple API for logging
|
||||
to the console. It is available in both Go and JS.
|
||||
|
||||
### Developer notes
|
||||
|
||||
When emitting an event in Go, it will dispatch the event to local Go listeners
|
||||
and also each window in the application. When emitting an event in JS, it now
|
||||
sends the event to the application. This will be processed as if it was emitted
|
||||
in Go, however the sender ID will be that of the window.
|
||||
|
||||
## Window
|
||||
|
||||
The Window API has largely remained the same, however the methods are now on an
|
||||
instance of a window rather than the runtime. Some notable differences are:
|
||||
|
||||
- Windows now have a Name that identifies them. This is used to identify the
|
||||
window when emitting events.
|
||||
- Windows have even more methods on the that were previously unavailable, such
|
||||
as `AbsolutePosition` and `ToggleDevTools`.
|
||||
- Windows can now accept files via native drag and drop. See the Drag and Drop
|
||||
section for more details.
|
||||
|
||||
## ClipBoard
|
||||
|
||||
The clipboard API has been simplified. There is now a single `Clipboard` object
|
||||
that can be used to read and write to the clipboard. The `Clipboard` object is
|
||||
available in both Go and JS. `SetText()` to set the text and `Text()` to get the
|
||||
text.
|
||||
|
||||
## Bindings
|
||||
|
||||
Bindings work in a similar way to v2, by providing a means to bind struct
|
||||
methods to the frontend. These can be called in the frontend using the binding
|
||||
wrappers generated by the `wails3 generate bindings` command:
|
||||
|
||||
```javascript
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import { main } from "./models";
|
||||
|
||||
window.go = window.go || {};
|
||||
window.go.main = {
|
||||
GreetService: {
|
||||
/**
|
||||
* GreetService.Greet
|
||||
* Greet greets a person
|
||||
* @param name {string}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
Greet: function (name) {
|
||||
wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0));
|
||||
},
|
||||
|
||||
/**
|
||||
* GreetService.GreetPerson
|
||||
* GreetPerson greets a person
|
||||
* @param person {main.Person}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
GreetPerson: function (person) {
|
||||
wails.CallByID(4021313248, ...Array.prototype.slice.call(arguments, 0));
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
Bound methods are obfuscated by default, and are identified using uint32 IDs,
|
||||
calculated using the
|
||||
[FNV hashing algorithm](https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function).
|
||||
This is to prevent the method name from being exposed in production builds. In
|
||||
debug mode, the method IDs are logged along with the calculated ID of the method
|
||||
to aid in debugging. If you wish to add an extra layer of obfuscation, you can
|
||||
use the `BindAliases` option. This allows you to specify a map of alias IDs to
|
||||
method IDs. When the frontend calls a method using an ID, the method ID will be
|
||||
looked up in the alias map first for a match. If it does not find it, it assumes
|
||||
it's a standard method ID and tries to find the method in the usual way.
|
||||
|
||||
Example:
|
||||
|
||||
```go
|
||||
app := application.New(application.Options{
|
||||
Bind: []any{
|
||||
&GreetService{},
|
||||
},
|
||||
BindAliases: map[uint32]uint32{
|
||||
1: 1411160069,
|
||||
2: 4021313248,
|
||||
},
|
||||
Assets: application.AssetOptions{
|
||||
FS: assets,
|
||||
},
|
||||
Mac: application.MacOptions{
|
||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
We can now call using this alias in the frontend: `wails.Call(1, "world!")`.
|
||||
|
||||
### Insecure calls
|
||||
|
||||
If you don't mind your calls being available in plain text in your binary and
|
||||
have no intention of using [garble](https://github.com/burrowers/garble), then
|
||||
you can use the insecure `wails.CallByName()` method. This method takes the
|
||||
fully qualified name of the method to call and the arguments to pass to it.
|
||||
Example:
|
||||
|
||||
```go
|
||||
wails.CallByName("main.GreetService.Greet", "world!")
|
||||
```
|
||||
|
||||
!!! danger
|
||||
|
||||
This is only provided as a convenience method for development. It is not recommended to use this in production.
|
||||
|
||||
## Dialogs
|
||||
|
||||
Dialogs are now available in JavaScript!
|
||||
|
||||
### Windows
|
||||
|
||||
Dialog buttons in Windows are not configurable and are constant depending on the
|
||||
type of dialog. To trigger a callback when a button is pressed, create a button
|
||||
with the same name as the button you wish to have the callback attached to.
|
||||
Example: Create a button with the label `Ok` and use `OnClick()` to set the
|
||||
callback method:
|
||||
|
||||
```go
|
||||
dialog := app.QuestionDialog().
|
||||
SetTitle("Update").
|
||||
SetMessage("The cancel button is selected when pressing escape")
|
||||
ok := dialog.AddButton("Ok")
|
||||
ok.OnClick(func() {
|
||||
// Do something
|
||||
})
|
||||
no := dialog.AddButton("Cancel")
|
||||
dialog.SetDefaultButton(ok)
|
||||
dialog.SetCancelButton(no)
|
||||
dialog.Show()
|
||||
```
|
||||
|
||||
## Drag and Drop
|
||||
|
||||
Native drag and drop can be enabled per-window. Simply set the
|
||||
`EnableDragAndDrop` window config option to `true` and the window will allow
|
||||
files to be dragged onto it. When this happens, the `events.FilesDropped` event
|
||||
will be emitted. The filenames can then be retrieved from the
|
||||
`WindowEvent.Context()` using the `DroppedFiles()` method. This returns a slice
|
||||
of strings containing the filenames.
|
||||
|
||||
## Context Menus
|
||||
|
||||
Context menus are contextual menus that are shown when the user right-clicks on
|
||||
an element. Creating a context menu is the same as creating a standard menu , by
|
||||
using `app.NewMenu()`. To make the context menu available to a window, call
|
||||
`window.RegisterContextMenu(name, menu)`. The name will be the id of the context
|
||||
menu and used by the frontend.
|
||||
|
||||
To indicate that an element has a context menu, add the `data-contextmenu`
|
||||
attribute to the element. The value of this attribute should be the name of a
|
||||
context menu previously registered with the window.
|
||||
|
||||
It is possible to register a context menu at the application level, making it
|
||||
available to all windows. This can be done using
|
||||
`app.RegisterContextMenu(name, menu)`. If a context menu cannot be found at the
|
||||
window level, the application context menus will be checked. A demo of this can
|
||||
be found in `v3/examples/contextmenus`.
|
||||
|
||||
## Wails Markup Language (WML)
|
||||
|
||||
The Wails Markup Language is a simple markup language that allows you to add
|
||||
functionality to standard HTML elements without the use of Javascript.
|
||||
|
||||
The following tags are currently supported:
|
||||
|
||||
### `data-wml-event`
|
||||
|
||||
This specifies that a Wails event will be emitted when the element is clicked.
|
||||
The value of the attribute should be the name of the event to emit.
|
||||
|
||||
Example:
|
||||
|
||||
```html
|
||||
<button data-wml-event="myevent">Click Me</button>
|
||||
```
|
||||
|
||||
Sometimes you need the user to confirm an action. This can be done by adding the
|
||||
`data-wml-confirm` attribute to the element. The value of this attribute will be
|
||||
the message to display to the user.
|
||||
|
||||
Example:
|
||||
|
||||
```html
|
||||
<button data-wml-event="delete-all-items" data-wml-confirm="Are you sure?">
|
||||
Delete All Items
|
||||
</button>
|
||||
```
|
||||
|
||||
### `data-wml-window`
|
||||
|
||||
Any `wails.window` method can be called by adding the `data-wml-window`
|
||||
attribute to an element. The value of the attribute should be the name of the
|
||||
method to call. The method name should be in the same case as the method.
|
||||
|
||||
```html
|
||||
<button data-wml-window="Close">Close Window</button>
|
||||
```
|
||||
|
||||
### `data-wml-trigger`
|
||||
|
||||
This attribute specifies which javascript event should trigger the action. The
|
||||
default is `click`.
|
||||
|
||||
```html
|
||||
<button data-wml-event="hover-box" data-wml-trigger="mouseover">
|
||||
Hover over me!
|
||||
</button>
|
||||
```
|
||||
|
||||
## Systray
|
||||
|
||||
Wails 3 comes with a built-in systray. This is a fully featured systray that has
|
||||
been designed to be as simple as possible to use. It is possible to set the
|
||||
icon, tooltip and menu of the systray. It is possible to also "attach" a window
|
||||
to the systray. Doing this will provide the following functionality:
|
||||
|
||||
- Clicking the systray icon with toggle the window visibility
|
||||
- Right-clicking the systray will open the menu, if there is one
|
||||
|
||||
On macOS, if there is no attached window, the systray will use the default
|
||||
method of displaying the menu (any button). If there is an attached window but
|
||||
no menu, the systray will toggle the window regardless of the button pressed.
|
||||
|
||||
## Plugins
|
||||
|
||||
Plugins are a way to extend the functionality of your Wails application.
|
||||
|
||||
### Creating a plugin
|
||||
|
||||
Plugins are standard Go structure that adhere to the following interface:
|
||||
|
||||
```go
|
||||
type Plugin interface {
|
||||
Name() string
|
||||
Init(*application.App) error
|
||||
Shutdown()
|
||||
CallableByJS() []string
|
||||
InjectJS() string
|
||||
}
|
||||
```
|
||||
|
||||
The `Name()` method returns the name of the plugin. This is used for logging
|
||||
purposes.
|
||||
|
||||
The `Init(*application.App) error` method is called when the plugin is loaded.
|
||||
The `*application.App` parameter is the application that the plugin is being
|
||||
loaded into. Any errors will prevent the application from starting.
|
||||
|
||||
The `Shutdown()` method is called when the application is shutting down.
|
||||
|
||||
The `CallableByJS()` method returns a list of exported functions that can be
|
||||
called from the frontend. These method names must exactly match the names of the
|
||||
methods exported by the plugin.
|
||||
|
||||
The `InjectJS()` method returns JavaScript that should be injected into all
|
||||
windows as they are created. This is useful for adding custom JavaScript
|
||||
functions that complement the plugin.
|
||||
|
||||
### Tips
|
||||
|
||||
#### Enums
|
||||
|
||||
In Go, enums are often defined as a type and a set of constants. For example:
|
||||
|
||||
```go
|
||||
type MyEnum int
|
||||
|
||||
const (
|
||||
MyEnumOne MyEnum = iota
|
||||
MyEnumTwo
|
||||
MyEnumThree
|
||||
)
|
||||
```
|
||||
|
||||
Due to incompatibility between Go and JavaScript, custom types cannot be used in
|
||||
this way. The best strategy is to use a type alias for float64:
|
||||
|
||||
```go
|
||||
type MyEnum = float64
|
||||
|
||||
const (
|
||||
MyEnumOne MyEnum = iota
|
||||
MyEnumTwo
|
||||
MyEnumThree
|
||||
)
|
||||
```
|
||||
|
||||
In Javascript, you can then use the following:
|
||||
|
||||
```js
|
||||
const MyEnum = {
|
||||
MyEnumOne: 0,
|
||||
MyEnumTwo: 1,
|
||||
MyEnumThree: 2,
|
||||
};
|
||||
```
|
||||
|
||||
- Why use `float64`? Can't we use `int`?
|
||||
- Because JavaScript doesn't have a concept of `int`. Everything is a
|
||||
`number`, which translates to `float64` in Go. There are also restrictions
|
||||
on casting types in Go's reflection package, which means using `int` doesn't
|
||||
work.
|
||||
|
||||
### BackgroundColour
|
||||
|
||||
In v2, this was a pointer to an `RGBA` struct. In v3, this is an `RGBA` struct
|
||||
value.
|
||||
|
||||
### WindowIsTranslucent
|
||||
|
||||
This flag has been removed. Now there is a `BackgroundType` flag that can be
|
||||
used to set the type of background the window should have. This flag can be set
|
||||
to any of the following values:
|
||||
|
||||
- `BackgroundTypeSolid` - The window will have a solid background
|
||||
- `BackgroundTypeTransparent` - The window will have a transparent background
|
||||
- `BackgroundTypeTranslucent` - The window will have a translucent background
|
||||
|
||||
On Windows, if the `BackgroundType` is set to `BackgroundTypeTranslucent`, the
|
||||
type of translucency can be set using the `BackdropType` flag in the
|
||||
`WindowsWindow` options. This can be set to any of the following values:
|
||||
|
||||
- `Auto` - The window will use an effect determined by the system
|
||||
- `None` - The window will have no background
|
||||
- `Mica` - The window will use the Mica effect
|
||||
- `Acrylic` - The window will use the acrylic effect
|
||||
- `Tabbed` - The window will use the tabbed effect
|
||||
|
||||
## Windows Application Options
|
||||
|
||||
### WndProcInterceptor
|
||||
|
||||
If this is set, the WndProc will be intercepted and the function will be called.
|
||||
This allows you to handle Windows messages directly. The function should have
|
||||
the following signature:
|
||||
|
||||
```go
|
||||
func(hwnd uintptr, msg uint32, wParam, lParam uintptr) (returnValue uintptr, shouldReturn)
|
||||
```
|
||||
|
||||
The `shouldReturn` value should be set to `true` if the returnValue should be
|
||||
returned by the main wndProc method. If it is set to `false`, the return value
|
||||
will be ignored and the message will continue to be processed by the main
|
||||
wndProc method.
|
||||
|
||||
## Hide Window on Close + OnBeforeClose
|
||||
|
||||
In v2, there was the `HideWindowOnClose` flag to hide the window when it closed.
|
||||
There was a logical overlap between this flag and the `OnBeforeClose` callback.
|
||||
In v3, the `HideWindowOnClose` flag has been removed and the `OnBeforeClose`
|
||||
callback has been renamed to `ShouldClose`. The `ShouldClose` callback is called
|
||||
when the user attempts to close a window. If the callback returns `true`, the
|
||||
window will close. If it returns `false`, the window will not close. This can be
|
||||
used to hide the window instead of closing it.
|
||||
|
||||
## Window Drag
|
||||
|
||||
In v2, the `--wails-drag` attribute was used to indicate that an element could
|
||||
be used to drag the window. In v3, this has been replaced with
|
||||
`--webkit-app-region` to be more in line with the way other frameworks handle
|
||||
this. The `--webkit-app-region` attribute can be set to any of the following
|
||||
values:
|
||||
|
||||
- `drag` - The element can be used to drag the window
|
||||
- `no-drag` - The element cannot be used to drag the window
|
||||
|
||||
We would have ideally liked to use `app-region`, however this is not supported
|
||||
by the `getComputedStyle` call on webkit on macOS.
|
||||
209
mkdocs-website/docs/en/development/introduction.md
Normal file
|
|
@ -0,0 +1,209 @@
|
|||
# Introduction
|
||||
|
||||
!!! note This guide is a work in progress.
|
||||
|
||||
Thanks for wanting to help out with development of Wails! This guide will help
|
||||
you get started.
|
||||
|
||||
## Getting Started
|
||||
|
||||
- Git clone this repository. Checkout the `v3-alpha` branch.
|
||||
- Install the CLI: `cd v3/cmd/wails3 && go install`
|
||||
|
||||
- Optional: If you are wanting to use the build system to build frontend code,
|
||||
you will need to install [npm](https://nodejs.org/en/download).
|
||||
|
||||
## Building
|
||||
|
||||
For simple programs, you can use the standard `go build` command. It's also
|
||||
possible to use `go run`.
|
||||
|
||||
Wails also comes with a build system that can be used to build more complex
|
||||
projects. It utilises the awesome [Task](https://taskfile.dev) build system. For
|
||||
more information, check out the task homepage or run `wails task --help`.
|
||||
|
||||
## Project layout
|
||||
|
||||
The project has the following structure:
|
||||
|
||||
```
|
||||
v3
|
||||
├── cmd/wails3 // CLI
|
||||
├── examples // Examples of Wails apps
|
||||
├── internal // Internal packages
|
||||
| ├── runtime // The Wails JS runtime
|
||||
| └── templates // The supported project templates
|
||||
├── pkg
|
||||
| ├── application // The core Wails library
|
||||
| └── events // The event definitions
|
||||
| └── mac // macOS specific code used by plugins
|
||||
| └── w32 // Windows specific code
|
||||
├── plugins // Supported plugins
|
||||
├── tasks // General tasks
|
||||
└── Taskfile.yaml // Development tasks configuration
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
### Adding window functionality
|
||||
|
||||
The preferred way to add window functionality is to add a new function to the
|
||||
`pkg/application/webview_window.go` file. This should implement all the
|
||||
functionality required for all platforms. Any platform specific code should be
|
||||
called via a `webviewWindowImpl` interface method. This interface is implemented
|
||||
by each of the target platforms to provide the platform specific functionality.
|
||||
In some cases, this may do nothing. Once you've added the interface method,
|
||||
ensure each platform implements it. A good example of this is the `SetMinSize`
|
||||
method.
|
||||
|
||||
- Mac: `webview_window_darwin.go`
|
||||
- Windows: `webview_window_windows.go`
|
||||
- Linux: `webview_window_linux.go`
|
||||
|
||||
Most, if not all, of the platform specific code should be run on the main
|
||||
thread. To simplify this, there are a number of `invokeSync` methods defined in
|
||||
`application.go`.
|
||||
|
||||
### Updating the runtime
|
||||
|
||||
The runtime is located in `v3/internal/runtime`. When the runtime is updated,
|
||||
the following steps need to be taken:
|
||||
|
||||
```shell
|
||||
wails3 task runtime:build
|
||||
```
|
||||
|
||||
### Events
|
||||
|
||||
Events are defined in `v3/pkg/events`. When adding a new event, the following
|
||||
steps need to be taken:
|
||||
|
||||
- Add the event to the `events.txt` file
|
||||
- Run `wails3 task events:generate`
|
||||
|
||||
There are a number of types of events: platform specific application and window
|
||||
events + common events. The common events are useful for cross-platform event
|
||||
handling, but you aren't limited to the "lowest common denominator". You can use
|
||||
the platform specific events if you need to.
|
||||
|
||||
When adding a common event, ensure that the platform specific events are mapped.
|
||||
An example of this is in `window_webview_darwin.go`:
|
||||
|
||||
```go
|
||||
// Translate ShouldClose to common WindowClosing event
|
||||
w.parent.On(events.Mac.WindowShouldClose, func(_ *WindowEventContext) {
|
||||
w.parent.emit(events.Common.WindowClosing)
|
||||
})
|
||||
```
|
||||
|
||||
NOTE: We may try to automate this in the future by adding the mapping to the
|
||||
event definition.
|
||||
|
||||
### Plugins
|
||||
|
||||
Plugins are a way to extend the functionality of your Wails application.
|
||||
|
||||
#### Creating a plugin
|
||||
|
||||
Plugins are standard Go structure that adhere to the following interface:
|
||||
|
||||
```go
|
||||
type Plugin interface {
|
||||
Name() string
|
||||
Init(*application.App) error
|
||||
Shutdown()
|
||||
CallableByJS() []string
|
||||
InjectJS() string
|
||||
}
|
||||
```
|
||||
|
||||
The `Name()` method returns the name of the plugin. This is used for logging
|
||||
purposes.
|
||||
|
||||
The `Init(*application.App) error` method is called when the plugin is loaded.
|
||||
The `*application.App` parameter is the application that the plugin is being
|
||||
loaded into. Any errors will prevent the application from starting.
|
||||
|
||||
The `Shutdown()` method is called when the application is shutting down.
|
||||
|
||||
The `CallableByJS()` method returns a list of exported functions that can be
|
||||
called from the frontend. These method names must exactly match the names of the
|
||||
methods exported by the plugin.
|
||||
|
||||
The `InjectJS()` method returns JavaScript that should be injected into all
|
||||
windows as they are created. This is useful for adding custom JavaScript
|
||||
functions that complement the plugin.
|
||||
|
||||
The built-in plugins can be found in the `v3/plugins` directory.
|
||||
Check them out for inspiration.
|
||||
|
||||
## Tasks
|
||||
|
||||
The Wails CLI uses the [Task](https://taskfile.dev) build system. It is imported
|
||||
as a library and used to run the tasks defined in `Taskfile.yaml`. The main
|
||||
interfacing with Task happens in `v3/internal/commands/task.go`.
|
||||
|
||||
### Upgrading Taskfile
|
||||
|
||||
To check if there's an upgrade for Taskfile, run `wails3 task -version` and
|
||||
check against the Task website.
|
||||
|
||||
To upgrade the version of Taskfile used, run:
|
||||
|
||||
```shell
|
||||
wails3 task taskfile:upgrade
|
||||
```
|
||||
|
||||
If there are incompatibilities then they should appear in the
|
||||
`v3/internal/commands/task.go` file.
|
||||
|
||||
Usually the best way to fix incompatibilities is to clone the task repo at
|
||||
`https://github.com/go-task/task` and look at the git history to determine what
|
||||
has changed and why.
|
||||
|
||||
To check all changes have worked correctly, re-install the CLI and check the
|
||||
version again:
|
||||
|
||||
```shell
|
||||
wails3 task cli:install
|
||||
wails3 task -version
|
||||
```
|
||||
|
||||
## Opening a PR
|
||||
|
||||
Make sure that all PRs have a ticket associated with them providing context to
|
||||
the change. If there is no ticket, please create one first. Ensure that all PRs
|
||||
have updated the CHANGELOG.md file with the changes made. The CHANGELOG.md file
|
||||
is located in the `mkdocs-website/docs` directory.
|
||||
|
||||
## Misc Tasks
|
||||
|
||||
### Upgrading Taskfile
|
||||
|
||||
The Wails CLI uses the [Task](https://taskfile.dev) build system. It is imported
|
||||
as a library and used to run the tasks defined in `Taskfile.yaml`. The main
|
||||
interfacing with Task happens in `v3/internal/commands/task.go`.
|
||||
|
||||
To check if there's an upgrade for Taskfile, run `wails3 task -version` and
|
||||
check against the Task website.
|
||||
|
||||
To upgrade the version of Taskfile used, run:
|
||||
|
||||
```shell
|
||||
wails3 task taskfile:upgrade
|
||||
```
|
||||
|
||||
If there are incompatibilities then they should appear in the
|
||||
`v3/internal/commands/task.go` file.
|
||||
|
||||
Usually the best way to fix incompatibilities is to clone the task repo at
|
||||
`https://github.com/go-task/task` and look at the git history to determine what
|
||||
has changed and why.
|
||||
|
||||
To check all changes have worked correctly, re-install the CLI and check the
|
||||
version again:
|
||||
|
||||
```shell
|
||||
wails3 task cli:install
|
||||
wails3 task -version
|
||||
```
|
||||
388
mkdocs-website/docs/en/development/status.md
Normal file
|
|
@ -0,0 +1,388 @@
|
|||
# Status
|
||||
|
||||
Status of features in v3.
|
||||
|
||||
!!! note
|
||||
|
||||
This list is a mixture of public and internal API support.<br/>
|
||||
It is not complete and probably not up to date.
|
||||
|
||||
## Known Issues
|
||||
|
||||
- Linux is not yet up to feature parity with Windows/Mac
|
||||
|
||||
## Application
|
||||
|
||||
Application interface methods
|
||||
|
||||
| Method | Windows | Linux | Mac | Notes |
|
||||
|---------------------------------------------------------------|---------|-------|-----|-------|
|
||||
| run() error | Y | Y | Y | |
|
||||
| destroy() | | Y | Y | |
|
||||
| setApplicationMenu(menu \*Menu) | Y | Y | Y | |
|
||||
| name() string | | Y | Y | |
|
||||
| getCurrentWindowID() uint | Y | Y | Y | |
|
||||
| showAboutDialog(name string, description string, icon []byte) | | Y | Y | |
|
||||
| setIcon(icon []byte) | - | Y | Y | |
|
||||
| on(id uint) | | | Y | |
|
||||
| dispatchOnMainThread(fn func()) | Y | Y | Y | |
|
||||
| hide() | Y | Y | Y | |
|
||||
| show() | Y | Y | Y | |
|
||||
| getPrimaryScreen() (\*Screen, error) | | Y | Y | |
|
||||
| getScreens() ([]\*Screen, error) | | Y | Y | |
|
||||
|
||||
## Webview Window
|
||||
|
||||
Webview Window Interface Methods
|
||||
|
||||
| Method | Windows | Linux | Mac | Notes |
|
||||
|----------------------------------------------------|---------|-------|-----|------------------------------------------|
|
||||
| center() | Y | Y | Y | |
|
||||
| close() | y | Y | Y | |
|
||||
| destroy() | | Y | Y | |
|
||||
| execJS(js string) | y | Y | Y | |
|
||||
| focus() | Y | Y | | |
|
||||
| forceReload() | | Y | Y | |
|
||||
| fullscreen() | Y | Y | Y | |
|
||||
| getScreen() (\*Screen, error) | y | Y | Y | |
|
||||
| getZoom() float64 | | Y | Y | |
|
||||
| height() int | Y | Y | Y | |
|
||||
| hide() | Y | Y | Y | |
|
||||
| isFullscreen() bool | Y | Y | Y | |
|
||||
| isMaximised() bool | Y | Y | Y | |
|
||||
| isMinimised() bool | Y | Y | Y | |
|
||||
| maximise() | Y | Y | Y | |
|
||||
| minimise() | Y | Y | Y | |
|
||||
| nativeWindowHandle() (uintptr, error) | Y | Y | | |
|
||||
| on(eventID uint) | y | | Y | |
|
||||
| openContextMenu(menu *Menu, data *ContextMenuData) | y | | Y | |
|
||||
| relativePosition() (int, int) | Y | Y | Y | |
|
||||
| reload() | y | Y | Y | |
|
||||
| run() | Y | Y | Y | |
|
||||
| setAlwaysOnTop(alwaysOnTop bool) | Y | Y | Y | |
|
||||
| setBackgroundColour(color RGBA) | Y | Y | Y | |
|
||||
| setEnabled(bool) | | Y | Y | |
|
||||
| setFrameless(bool) | | Y | Y | |
|
||||
| setFullscreenButtonEnabled(enabled bool) | - | Y | Y | There is no fullscreen button in Windows |
|
||||
| setHTML(html string) | Y | Y | Y | |
|
||||
| setMaxSize(width, height int) | Y | Y | Y | |
|
||||
| setMinSize(width, height int) | Y | Y | Y | |
|
||||
| setRelativePosition(x int, y int) | Y | Y | Y | |
|
||||
| setResizable(resizable bool) | Y | Y | Y | |
|
||||
| setSize(width, height int) | Y | Y | Y | |
|
||||
| setTitle(title string) | Y | Y | Y | |
|
||||
| setURL(url string) | Y | Y | Y | |
|
||||
| setZoom(zoom float64) | Y | Y | Y | |
|
||||
| show() | Y | Y | Y | |
|
||||
| size() (int, int) | Y | Y | Y | |
|
||||
| toggleDevTools() | Y | Y | Y | |
|
||||
| unfullscreen() | Y | Y | Y | |
|
||||
| unmaximise() | Y | Y | Y | |
|
||||
| unminimise() | Y | Y | Y | |
|
||||
| width() int | Y | Y | Y | |
|
||||
| zoom() | | Y | Y | |
|
||||
| zoomIn() | Y | Y | Y | |
|
||||
| zoomOut() | Y | Y | Y | |
|
||||
| zoomReset() | Y | Y | Y | |
|
||||
|
||||
## Runtime
|
||||
|
||||
### Application
|
||||
|
||||
| Feature | Windows | Linux | Mac | Notes |
|
||||
|---------|---------|-------|-----|-------|
|
||||
| Quit | Y | Y | Y | |
|
||||
| Hide | Y | | Y | |
|
||||
| Show | Y | | Y | |
|
||||
|
||||
### Dialogs
|
||||
|
||||
| Feature | Windows | Linux | Mac | Notes |
|
||||
|----------|---------|-------|-----|-------|
|
||||
| Info | Y | Y | Y | |
|
||||
| Warning | Y | Y | Y | |
|
||||
| Error | Y | Y | Y | |
|
||||
| Question | Y | Y | Y | |
|
||||
| OpenFile | Y | | Y | |
|
||||
| SaveFile | Y | | Y | |
|
||||
|
||||
### Clipboard
|
||||
|
||||
| Feature | Windows | Linux | Mac | Notes |
|
||||
|---------|---------|-------|-----|-------|
|
||||
| SetText | Y | | Y | |
|
||||
| Text | Y | | Y | |
|
||||
|
||||
### ContextMenu
|
||||
|
||||
| Feature | Windows | Linux | Mac | Notes |
|
||||
|------------------|---------|-------|-----|-------|
|
||||
| OpenContextMenu | Y | | Y | |
|
||||
| On By Default | | | | |
|
||||
| Control via HTML | Y | | | |
|
||||
|
||||
The default context menu is enabled by default for all elements that are
|
||||
`contentEditable: true`, `<input>` or `<textarea>` tags or have the
|
||||
`--default-contextmenu: true` style set. The `--default-contextmenu: show` style
|
||||
will always show the context menu The `--default-contextmenu: hide` style will
|
||||
always hide the context menu
|
||||
|
||||
Anything nested under a tag with `--default-contextmenu: hide` style will not
|
||||
show the context menu unless it is explicitly set with
|
||||
`--default-contextmenu: show`.
|
||||
|
||||
### Screens
|
||||
|
||||
| Feature | Windows | Linux | Mac | Notes |
|
||||
|------------|---------|-------|-----|-------|
|
||||
| GetAll | Y | Y | Y | |
|
||||
| GetPrimary | Y | Y | Y | |
|
||||
| GetCurrent | Y | Y | Y | |
|
||||
|
||||
### System
|
||||
|
||||
| Feature | Windows | Linux | Mac | Notes |
|
||||
|------------|---------|-------|-----|-------|
|
||||
| IsDarkMode | | | Y | |
|
||||
|
||||
### Window
|
||||
|
||||
Y = Supported U = Untested
|
||||
|
||||
- = Not available
|
||||
|
||||
| Feature | Windows | Linux | Mac | Notes |
|
||||
|---------------------|---------|-------|-----|--------------------------------------------------------------------------------------|
|
||||
| Center | Y | Y | Y | |
|
||||
| Focus | Y | Y | | |
|
||||
| FullScreen | Y | Y | Y | |
|
||||
| GetZoom | Y | Y | Y | Get current view scale |
|
||||
| Height | Y | Y | Y | |
|
||||
| Hide | Y | Y | Y | |
|
||||
| Maximise | Y | Y | Y | |
|
||||
| Minimise | Y | Y | Y | |
|
||||
| RelativePosition | Y | Y | Y | |
|
||||
| Screen | Y | Y | Y | Get screen for window |
|
||||
| SetAlwaysOnTop | Y | Y | Y | |
|
||||
| SetBackgroundColour | Y | Y | Y | https://github.com/MicrosoftEdge/WebView2Feedback/issues/1621#issuecomment-938234294 |
|
||||
| SetEnabled | Y | U | - | Set the window to be enabled/disabled |
|
||||
| SetMaxSize | Y | Y | Y | |
|
||||
| SetMinSize | Y | Y | Y | |
|
||||
| SetRelativePosition | Y | Y | Y | |
|
||||
| SetResizable | Y | Y | Y | |
|
||||
| SetSize | Y | Y | Y | |
|
||||
| SetTitle | Y | Y | Y | |
|
||||
| SetZoom | Y | Y | Y | Set view scale |
|
||||
| Show | Y | Y | Y | |
|
||||
| Size | Y | Y | Y | |
|
||||
| UnFullscreen | Y | Y | Y | |
|
||||
| UnMaximise | Y | Y | Y | |
|
||||
| UnMinimise | Y | Y | Y | |
|
||||
| Width | Y | Y | Y | |
|
||||
| ZoomIn | Y | Y | Y | Increase view scale |
|
||||
| ZoomOut | Y | Y | Y | Decrease view scale |
|
||||
| ZoomReset | Y | Y | Y | Reset view scale |
|
||||
|
||||
### Window Options
|
||||
|
||||
A 'Y' in the table below indicates that the option has been tested and is
|
||||
applied when the window is created. An 'X' indicates that the option is not
|
||||
supported by the platform.
|
||||
|
||||
| Feature | Windows | Linux | Mac | Notes |
|
||||
|---------------------------------|---------|-------|-----|--------------------------------------------|
|
||||
| AlwaysOnTop | Y | | | |
|
||||
| BackgroundColour | Y | Y | | |
|
||||
| BackgroundType | | | | Acrylic seems to work but the others don't |
|
||||
| CSS | Y | Y | | |
|
||||
| DevToolsEnabled | Y | Y | Y | |
|
||||
| DisableResize | Y | Y | | |
|
||||
| EnableDragAndDrop | | Y | | |
|
||||
| EnableFraudulentWebsiteWarnings | | | | |
|
||||
| Focused | Y | Y | | |
|
||||
| Frameless | Y | Y | | |
|
||||
| FullscreenButtonEnabled | Y | | | |
|
||||
| Height | Y | Y | | |
|
||||
| Hidden | Y | Y | | |
|
||||
| HTML | Y | Y | | |
|
||||
| JS | Y | Y | | |
|
||||
| Mac | - | - | | |
|
||||
| MaxHeight | Y | Y | | |
|
||||
| MaxWidth | Y | Y | | |
|
||||
| MinHeight | Y | Y | | |
|
||||
| MinWidth | Y | Y | | |
|
||||
| Name | Y | Y | | |
|
||||
| OpenInspectorOnStartup | | | | |
|
||||
| StartState | Y | | | |
|
||||
| Title | Y | Y | | |
|
||||
| URL | Y | Y | | |
|
||||
| Width | Y | Y | | |
|
||||
| Windows | Y | - | - | |
|
||||
| X | Y | Y | | |
|
||||
| Y | Y | Y | | |
|
||||
| Zoom | | | | |
|
||||
| ZoomControlEnabled | | | | |
|
||||
|
||||
### Log
|
||||
|
||||
To log or not to log? System logger vs custom logger.
|
||||
|
||||
## Menu
|
||||
|
||||
| Event | Windows | Linux | Mac | Notes |
|
||||
|--------------------------|---------|-------|-----|-------|
|
||||
| Default Application Menu | Y | Y | Y | |
|
||||
|
||||
## Tray Menus
|
||||
|
||||
| Feature | Windows | Linux | Mac | Notes |
|
||||
|--------------------|---------|-------|-----|----------------------------------------------------------------------|
|
||||
| Icon | Y | | Y | Windows has default icons for light/dark mode & supports PNG or ICO. |
|
||||
| Label | - | | Y | |
|
||||
| Label (ANSI Codes) | - | | | |
|
||||
| Menu | Y | | Y | |
|
||||
|
||||
### Methods
|
||||
|
||||
| Method | Windows | Linux | Mac | Notes |
|
||||
|-------------------------------|---------|-------|-----|-------|
|
||||
| setLabel(label string) | - | | Y | |
|
||||
| run() | Y | | Y | |
|
||||
| setIcon(icon []byte) | Y | | Y | |
|
||||
| setMenu(menu \*Menu) | Y | | Y | |
|
||||
| setIconPosition(position int) | - | | Y | |
|
||||
| setTemplateIcon(icon []byte) | - | | Y | |
|
||||
| destroy() | Y | | Y | |
|
||||
| setDarkModeIcon(icon []byte) | Y | | Y | |
|
||||
|
||||
## Cross Platform Events
|
||||
|
||||
Mapping native events to cross-platform events.
|
||||
|
||||
| Event | Windows | Linux | Mac | Notes |
|
||||
|--------------------------|---------|-------|-----------------|-------|
|
||||
| WindowWillClose | | | WindowWillClose | |
|
||||
| WindowDidClose | | | | |
|
||||
| WindowDidResize | | | | |
|
||||
| WindowDidHide | | | | |
|
||||
| ApplicationWillTerminate | | | | |
|
||||
|
||||
... Add more
|
||||
|
||||
## Bindings Generation
|
||||
|
||||
Working well.
|
||||
|
||||
## Models Generation
|
||||
|
||||
Working well.
|
||||
|
||||
## Task file
|
||||
|
||||
Contains a lot needed for development.
|
||||
|
||||
## Theme
|
||||
|
||||
| Mode | Windows | Linux | Mac | Notes |
|
||||
|--------|---------|-------|-----|-------|
|
||||
| Dark | Y | | | |
|
||||
| Light | Y | | | |
|
||||
| System | Y | | | |
|
||||
|
||||
## NSIS Installer
|
||||
|
||||
TBD
|
||||
|
||||
## Templates
|
||||
|
||||
All templates are working.
|
||||
|
||||
## Plugins
|
||||
|
||||
Built-in plugin support:
|
||||
|
||||
| Plugin | Windows | Linux | Mac | Notes |
|
||||
|-----------------|---------|-------|-----|-------|
|
||||
| Browser | Y | | Y | |
|
||||
| KV Store | Y | Y | Y | |
|
||||
| Log | Y | Y | Y | |
|
||||
| Single Instance | Y | | Y | |
|
||||
| SQLite | Y | Y | Y | |
|
||||
| Start at login | Y | | Y | |
|
||||
| Server | | | | |
|
||||
|
||||
TODO:
|
||||
|
||||
- Ensure each plugin has a JS wrapper that can be injected into the window.
|
||||
|
||||
## Packaging
|
||||
|
||||
| | Windows | Linux | Mac | Notes |
|
||||
|-----------------|---------|-------|-----|-------|
|
||||
| Icon Generation | Y | | Y | |
|
||||
| Icon Embedding | Y | | Y | |
|
||||
| Info.plist | - | | Y | |
|
||||
| NSIS Installer | | | - | |
|
||||
| Mac bundle | - | | Y | |
|
||||
| Windows exe | Y | | - | |
|
||||
|
||||
## Frameless Windows
|
||||
|
||||
| Feature | Windows | Linux | Mac | Notes |
|
||||
|---------|---------|-------|-----|------------------------------------------------|
|
||||
| Resize | Y | | Y | |
|
||||
| Drag | Y | Y | Y | Linux - can always drag with `Meta`+left mouse |
|
||||
|
||||
## Mac Specific
|
||||
|
||||
- [x] Translucency
|
||||
|
||||
### Mac Options
|
||||
|
||||
| Feature | Default | Notes |
|
||||
|-------------------------|-------------------|------------------------------------------------------|
|
||||
| Backdrop | MacBackdropNormal | Standard solid window |
|
||||
| DisableShadow | false | |
|
||||
| TitleBar | | Standard window decorations by default |
|
||||
| Appearance | DefaultAppearance | |
|
||||
| InvisibleTitleBarHeight | 0 | Creates an invisible title bar for frameless windows |
|
||||
| DisableShadow | false | Disables the window drop shadow |
|
||||
|
||||
## Windows Specific
|
||||
|
||||
- [x] Translucency
|
||||
- [x] Custom Themes
|
||||
|
||||
### Windows Options
|
||||
|
||||
| Feature | Default | Notes |
|
||||
|-----------------------------------|---------------|---------------------------------------------|
|
||||
| BackdropType | Solid | |
|
||||
| DisableIcon | false | |
|
||||
| Theme | SystemDefault | |
|
||||
| CustomTheme | nil | |
|
||||
| DisableFramelessWindowDecorations | false | |
|
||||
| WindowMask | nil | Makes the window the contents of the bitmap |
|
||||
|
||||
## Linux Specific
|
||||
|
||||
Implementation details for the functions utilized by the `*_linux.go` files are
|
||||
located in the following files:
|
||||
|
||||
- linux_cgo.go: CGo implementation
|
||||
- linux_purego.go: PureGo implementation
|
||||
|
||||
### CGO
|
||||
|
||||
By default CGO is utilized to compile the Linux port. This prevents easy
|
||||
cross-compilation and so the PureGo implementation is also being simultaneously
|
||||
developed.
|
||||
|
||||
### Purego
|
||||
|
||||
The examples can be compiled using the following command:
|
||||
|
||||
CGO_ENABLED=0 go build -tags purego
|
||||
|
||||
Note: things are currently not working after the refactor
|
||||
|
||||
BIN
mkdocs-website/docs/en/favicon.ico
Normal file
|
After Width: | Height: | Size: 15 KiB |
58
mkdocs-website/docs/en/getting-started/feedback.md
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
# Feedback
|
||||
|
||||
We welcome (and encourage) your feedback! Please search for existing tickets or posts before creating new ones.
|
||||
Here are the different ways to provide feedback:
|
||||
|
||||
=== "Bugs"
|
||||
|
||||
If you find a bug, please let us know by posting into the [v3 Alpha Feedback](https://discord.gg/3mgVyGua) channel on Discord:
|
||||
|
||||
- The post should clearly state what the bug is and have a simple reproducible example. If the docs are unclear what *should* happen, please include that in the post.
|
||||
- The post should be given the `Bug` tag.
|
||||
- Please include the output of `wails doctor` in your post.
|
||||
- *Remember* unexpected behaviour isn't necessarily a bug - it might just not do what you expect it to do. Use [Suggestions](#suggestions) for this.
|
||||
|
||||
=== "Fixes"
|
||||
|
||||
If you have a fix for a bug or an update for documentation, please do the following:
|
||||
|
||||
- Open a pull request on the [Wails repository](https://github.com/wailsapp/wails). The title of the PR should start with `[v3 alpha]`.
|
||||
- Create a post in the [v3 Alpha Feedback](https://discord.gg/3mgVyGua) channel.
|
||||
- The post should be given the `PR` tag.
|
||||
- Please include a link to the PR in your post.
|
||||
|
||||
=== "Suggestions"
|
||||
|
||||
If you have a suggestion, please let us know by posting into the [v3 Alpha Feedback](https://discord.gg/3mgVyGua) channel on Discord:
|
||||
|
||||
- The post should be given the `Suggestion` tag.
|
||||
|
||||
Please feel free to reach out to us on [Discord](https://discord.gg/3mgVyGua) if you have any questions.
|
||||
|
||||
=== "Upvoting"
|
||||
|
||||
- Posts can be "upvoted" by using the :thumbsup: emoji. Please apply to any posts that are a priority for you.
|
||||
- Please *don't* just add comments like "+1" or "me too".
|
||||
- Please feel free to comment if there is more to add to the post, such as "this bug also affect ARM builds" or "Another option would be to ....."
|
||||
|
||||
There is a list of known issues & work in progress can be found [here](https://github.com/orgs/wailsapp/projects/6).
|
||||
|
||||
## Things we are looking for feedback on
|
||||
|
||||
- The API
|
||||
- Is it easy to use?
|
||||
- Does it do what you expect?
|
||||
- Is it missing anything?
|
||||
- Is there anything that should be removed?
|
||||
- Is it consistent between Go and JS?
|
||||
- The build system
|
||||
- Is it easy to use?
|
||||
- Can we improve it?
|
||||
- The examples
|
||||
- Are they clear?
|
||||
- Do they cover the basics?
|
||||
- Features
|
||||
- What features are missing?
|
||||
- What features are not needed?
|
||||
- Documentation
|
||||
- What could be clearer?
|
||||
81
mkdocs-website/docs/en/getting-started/installation.md
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
# Installation
|
||||
|
||||
To install the Wails CLI, ensure you have [Go 1.21+](https://go.dev/dl/)
|
||||
installed and run:
|
||||
|
||||
```shell
|
||||
git clone https://github.com/wailsapp/wails.git
|
||||
cd wails
|
||||
git checkout v3-alpha
|
||||
cd v3/cmd/wails3
|
||||
go install
|
||||
```
|
||||
|
||||
## Supported Platforms
|
||||
|
||||
- Windows 10/11 AMD64/ARM64
|
||||
- MacOS 10.13+ AMD64
|
||||
- MacOS 11.0+ ARM64
|
||||
- Ubuntu 22.04 AMD64/ARM64 (other Linux may work too!)
|
||||
|
||||
## Dependencies
|
||||
|
||||
Wails has a number of common dependencies that are required before installation:
|
||||
|
||||
=== "Go 1.21+"
|
||||
|
||||
Download Go from the [Go Downloads Page](https://go.dev/dl/).
|
||||
|
||||
Ensure that you follow the official [Go installation instructions](https://go.dev/doc/install). You will also need to ensure that your `PATH` environment variable also includes the path to your `~/go/bin` directory. Restart your terminal and do the following checks:
|
||||
|
||||
- Check Go is installed correctly: `go version`
|
||||
- Check `~/go/bin` is in your PATH variable: `echo $PATH | grep go/bin`
|
||||
|
||||
=== "npm (Optional)"
|
||||
|
||||
Although Wails doesn't require npm to be installed, it is needed if you want to use the bundled templates.
|
||||
|
||||
Download the latest node installer from the [Node Downloads Page](https://nodejs.org/en/download/). It is best to use the latest release as that is what we generally test against.
|
||||
|
||||
Run `npm --version` to verify.
|
||||
|
||||
=== "Task (Optional)"
|
||||
|
||||
The Wails CLI embeds a task runner called [Task](https://taskfile.dev/#/installation). It is optional, but recommended. If you do not wish to install Task, you can use the `wails3 task` command instead of `task`.
|
||||
Installing Task will give you the greatest flexibility.
|
||||
|
||||
## Platform Specific Dependencies
|
||||
|
||||
You will also need to install platform specific dependencies:
|
||||
|
||||
=== "Mac"
|
||||
|
||||
Wails requires that the xcode command line tools are installed. This can be
|
||||
done by running:
|
||||
|
||||
```
|
||||
xcode-select --install
|
||||
```
|
||||
|
||||
=== "Windows"
|
||||
|
||||
Wails requires that the [WebView2 Runtime](https://developer.microsoft.com/en-us/microsoft-edge/webview2/) is installed. Some Windows installations will already have this installed. You can check using the `wails doctor` command.
|
||||
|
||||
=== "Linux"
|
||||
|
||||
Linux requires the standard `gcc` build tools plus `libgtk3` and `libwebkit`. Rather than list a ton of commands for different distros, Wails can try to determine what the installation commands are for your specific distribution. Run <code>wails doctor</code> after installation to be shown how to install the dependencies. If your distro/package manager is not supported, please let us know on discord.
|
||||
|
||||
## System Check
|
||||
|
||||
Running `wails3 doctor` will check if you have the correct dependencies
|
||||
installed. If not, it will advise on what is missing and help on how to rectify
|
||||
any problems.
|
||||
|
||||
## The `wails3` command appears to be missing?
|
||||
|
||||
If your system is reporting that the `wails3` command is missing, check the
|
||||
following:
|
||||
|
||||
- Make sure you have followed the Go installation guide correctly.
|
||||
- Check that the `go/bin` directory is in the `PATH` environment variable.
|
||||
- Close/Reopen current terminals to pick up the new `PATH` variable.
|
||||
39
mkdocs-website/docs/en/getting-started/next-steps.md
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# Next Steps
|
||||
|
||||
Now that you have Wails installed, you can start exploring the alpha version.
|
||||
|
||||
The best place to start is the `examples` directory in the Wails repository.
|
||||
This contains a number of examples that you can run and play with.
|
||||
|
||||
## Running an example
|
||||
|
||||
To run an example, you can simply use:
|
||||
|
||||
```shell
|
||||
go run .
|
||||
```
|
||||
|
||||
in the example directory.
|
||||
|
||||
The status of the examples is on the [roadmap](../roadmap.md).
|
||||
|
||||
## Creating a new project
|
||||
|
||||
To create a new project, you can use the `wails3 init` command. This will create
|
||||
a new project in the current directory.
|
||||
|
||||
Wails3 uses [Task](https://taskfile.dev) as its build system by default,
|
||||
although there is no reason why you can't use your own build system, or use
|
||||
`go build` directly. Wails has the task build system built in and can be run
|
||||
using `wails3 task`.
|
||||
|
||||
If you look through the `Taskfile.yaml` file, you will see that there are a
|
||||
number of tasks defined. The most important one is the `build` task. This is the
|
||||
task that is run when you use `wails3 build`.
|
||||
|
||||
The task file is unlikely to be complete and is subject to change over time.
|
||||
|
||||
## Building a project
|
||||
|
||||
To build a project, you can use the `wails3 build` command. This is a shortcut
|
||||
for `wails3 task build`.
|
||||
5
mkdocs-website/docs/en/index.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
template: home.en.html
|
||||
---
|
||||
|
||||
Welcome to The Wails Project
|
||||
50
mkdocs-website/docs/en/roadmap.md
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
# Roadmap
|
||||
|
||||
The roadmap is a living document and is subject to change. If you have any suggestions, please open an issue.
|
||||
Each milestone will have a set of goals that we are aiming to achieve. These are subject to change.
|
||||
|
||||
## Alpha milestones
|
||||
|
||||
### Alpha 1
|
||||
|
||||
#### Goals
|
||||
|
||||
Alpha 1 is the initial release. It is intended to get feedback on the new API and to get people experimenting with it.
|
||||
The main goal is to get most of the examples working on all platforms.
|
||||
|
||||
#### Status
|
||||
|
||||
- W - Working
|
||||
- P - Partially working
|
||||
- N - Not working
|
||||
|
||||
| Example | Mac | Windows | Linux |
|
||||
|---------------|-----|---------|-------|
|
||||
| binding | W | W | |
|
||||
| build | W | W | |
|
||||
| clipboard | W | W | |
|
||||
| context menus | W | W | |
|
||||
| dialogs | P | W | |
|
||||
| drag-n-drop | W | N | |
|
||||
| events | W | W | |
|
||||
| frameless | W | W | |
|
||||
| keybindings | W | W | |
|
||||
| plain | W | W | |
|
||||
| screen | W | W | |
|
||||
| systray | W | W | |
|
||||
| video | | W | |
|
||||
| window | P | W | |
|
||||
| wml | W | W | |
|
||||
|
||||
- Mac Dialogs work, however the file dialogs issue a warning that needs to be fixed.
|
||||
|
||||
#### TODO:
|
||||
|
||||
- [ ] Fix `+[CATransaction synchronize] called within transaction` warnings on Mac
|
||||
- [ ] When hiding window, application terminates
|
||||
|
||||
### Alpha 2
|
||||
|
||||
- [ ] Most examples working on Linux
|
||||
- [ ] Project creation via `wails init`
|
||||
|
||||
22
mkdocs-website/docs/en/stylesheets/extra.css
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
|
||||
[data-md-color-scheme="slate"] {
|
||||
--md-hue: 208;
|
||||
--md-primary-fg-color--light: #ECB7B7;
|
||||
--md-primary-fg-color--dark: #90030C;
|
||||
--md-accent-fg-color: #ff4646;
|
||||
--md-primary-fg-color: #2a2a2a;
|
||||
--md-default-bg-color: #191919;
|
||||
--md-footer-bg-color--dark: #2a2a2a;
|
||||
--md-default-fg-color: #e0e0e0;
|
||||
}
|
||||
|
||||
.md-header__button.md-logo img, .md-header__button.md-logo svg {
|
||||
fill: currentcolor;
|
||||
display: block;
|
||||
height: 2rem;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.md-typeset {
|
||||
font-weight: 100;
|
||||
}
|
||||
337
mkdocs-website/docs/en/whats-new.md
Normal file
|
|
@ -0,0 +1,337 @@
|
|||
# What's new in v3?
|
||||
|
||||
!!! note
|
||||
The features that will be included in the v3 release may change from this list.
|
||||
|
||||
## Multiple Windows
|
||||
|
||||
It's now possible to create multiple windows and configure each one
|
||||
independently.
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"log"
|
||||
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
)
|
||||
|
||||
//go:embed assets/*
|
||||
var assets embed.FS
|
||||
|
||||
func main() {
|
||||
|
||||
app := application.New(application.Options{
|
||||
Name: "Multi Window Demo",
|
||||
Assets: application.AssetOptions{
|
||||
FS: assets,
|
||||
},
|
||||
})
|
||||
|
||||
window1 := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
|
||||
Title: "Window 1",
|
||||
})
|
||||
|
||||
window2 := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
|
||||
Title: "Window 2",
|
||||
})
|
||||
|
||||
// load the embedded html from the embed.FS
|
||||
window1.SetURL("/")
|
||||
window1.Center()
|
||||
|
||||
// Load an external URL
|
||||
window2.SetURL("https://wails.app")
|
||||
|
||||
err := app.Run()
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Systrays
|
||||
|
||||
Systrays allow you to add an icon in the system tray area of your desktop and
|
||||
have the following features:
|
||||
|
||||
- Attach window (the window will be centered to the systray icon)
|
||||
- Full menu support
|
||||
- Light/Dark mode icons
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"log"
|
||||
"runtime"
|
||||
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
"github.com/wailsapp/wails/v3/pkg/icons"
|
||||
)
|
||||
|
||||
func main() {
|
||||
app := application.New(application.Options{
|
||||
Name: "Systray Demo",
|
||||
Mac: application.MacOptions{
|
||||
ActivationPolicy: application.ActivationPolicyAccessory,
|
||||
},
|
||||
})
|
||||
|
||||
window := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
|
||||
Width: 500,
|
||||
Height: 800,
|
||||
Frameless: true,
|
||||
AlwaysOnTop: true,
|
||||
Hidden: true,
|
||||
Windows: application.WindowsWindow{
|
||||
HiddenOnTaskbar: true,
|
||||
},
|
||||
})
|
||||
|
||||
systemTray := app.NewSystemTray()
|
||||
|
||||
// Support for template icons on macOS
|
||||
if runtime.GOOS == "darwin" {
|
||||
systemTray.SetTemplateIcon(icons.SystrayMacTemplate)
|
||||
} else {
|
||||
// Support for light/dark mode icons
|
||||
systemTray.SetDarkModeIcon(icons.SystrayDark)
|
||||
systemTray.SetIcon(icons.SystrayLight)
|
||||
}
|
||||
|
||||
// Support for menu
|
||||
myMenu := app.NewMenu()
|
||||
myMenu.Add("Hello World!").OnClick(func(_ *application.Context) {
|
||||
println("Hello World!")
|
||||
})
|
||||
systemTray.SetMenu(myMenu)
|
||||
|
||||
// This will center the window to the systray icon with a 5px offset
|
||||
// It will automatically be shown when the systray icon is clicked
|
||||
// and hidden when the window loses focus
|
||||
systemTray.AttachWindow(window).WindowOffset(5)
|
||||
|
||||
err := app.Run()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Plugins
|
||||
|
||||
Plugins allow you to extend the functionality of the Wails system. Not only can
|
||||
plugin methods be used in Go, but also called from Javascript. Included plugins:
|
||||
|
||||
- kvstore - A key/value store
|
||||
- browser - open links in a browser
|
||||
- log - custom logger
|
||||
- oauth - handles oauth authentication and supports 60 providers
|
||||
- single_instance - only allow one copy of your app to be run
|
||||
- sqlite - add a sqlite db to your app. Uses the modernc pure go library
|
||||
- start_at_login - Register/Unregister your application to start at login
|
||||
|
||||
## Improved bindings generation
|
||||
|
||||
v3 uses a new static analyser to generate bindings. This makes it extremely fast
|
||||
and maintains comments and parameter names in your bindings. By default,
|
||||
bindings are generated with calls using IDs instead of strings. This provides a
|
||||
performance boost and allows for using obfuscation tools such as
|
||||
[garble](https://github.com/burrowers/garble).
|
||||
|
||||
Bindings are generated by simply running `wails3 generate bindings` in the
|
||||
project directory.
|
||||
|
||||
```js
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import { main } from "./models";
|
||||
|
||||
window.go = window.go || {};
|
||||
window.go.main = {
|
||||
GreetService: {
|
||||
/**
|
||||
* GreetService.Greet
|
||||
* Greet greets a person
|
||||
* @param name {string}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
Greet: function (name) {
|
||||
wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0));
|
||||
},
|
||||
|
||||
/**
|
||||
* GreetService.GreetPerson
|
||||
* GreetPerson greets a person
|
||||
* @param person {main.Person}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
GreetPerson: function (person) {
|
||||
wails.CallByID(4021313248, ...Array.prototype.slice.call(arguments, 0));
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
## Improved build system
|
||||
|
||||
In v2, the build system was completely opaque and hard to customise. In v3, it's
|
||||
possible to build everything using standard Go tooling.
|
||||
|
||||
All the heavy lifting that the v2 build system did, such as icon generation,
|
||||
have been added as tool commands in the CLI. We have incorporated
|
||||
[Taskfile](https://taskfile.dev) into the CLI to orchestrate these calls to
|
||||
bring the same developer experience as v2. However, this approach brings the
|
||||
ultimate balance of flexibility and ease of use as you can now customise the
|
||||
build process to your needs.
|
||||
|
||||
You can even use make if that's your thing!
|
||||
|
||||
```yaml title="Snippet from Taskfile.yml"
|
||||
build:darwin:
|
||||
summary: Builds the application
|
||||
platforms:
|
||||
- darwin
|
||||
cmds:
|
||||
- task: pre-build
|
||||
- task: build-frontend
|
||||
- go build -gcflags=all="-N -l" -o bin/{{.APP_NAME}}
|
||||
- task: post-build
|
||||
env:
|
||||
CGO_CFLAGS: "-mmacosx-version-min=10.13"
|
||||
CGO_LDFLAGS: "-mmacosx-version-min=10.13"
|
||||
MACOSX_DEPLOYMENT_TARGET: "10.13"
|
||||
```
|
||||
|
||||
## Improved events
|
||||
|
||||
Events are now emitted for a lot of the runtime operations, allowing you to hook
|
||||
into application/system events. Cross-platform (common) events are also emitted
|
||||
where there are common platform events, allowing you to write the same event
|
||||
handling methods cross platform.
|
||||
|
||||
Event hooks can also be registered. These are like the `On` method but are
|
||||
synchronous and allow you to cancel the event. An example of this would be to
|
||||
show a confirmation dialog before closing a window.
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
"github.com/wailsapp/wails/v3/pkg/events"
|
||||
)
|
||||
|
||||
//go:embed assets
|
||||
var assets embed.FS
|
||||
|
||||
func main() {
|
||||
|
||||
app := application.New(application.Options{
|
||||
Name: "Events Demo",
|
||||
Description: "A demo of the Events API",
|
||||
Assets: application.AssetOptions{
|
||||
FS: assets,
|
||||
},
|
||||
Mac: application.MacOptions{
|
||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||
},
|
||||
})
|
||||
|
||||
// Custom event handling
|
||||
app.Events.On("myevent", func(e *application.WailsEvent) {
|
||||
log.Printf("[Go] WailsEvent received: %+v\n", e)
|
||||
})
|
||||
|
||||
// OS specific application events
|
||||
app.On(events.Mac.ApplicationDidFinishLaunching, func(event *application.Event) {
|
||||
println("events.Mac.ApplicationDidFinishLaunching fired!")
|
||||
})
|
||||
|
||||
// Platform agnostic events
|
||||
app.On(events.Common.ApplicationStarted, func(event *application.Event) {
|
||||
println("events.Common.ApplicationStarted fired!")
|
||||
})
|
||||
|
||||
win1 := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
|
||||
Title: "Takes 3 attempts to close me!",
|
||||
})
|
||||
|
||||
var countdown = 3
|
||||
|
||||
// Register a hook to cancel the window closing
|
||||
win1.RegisterHook(events.Common.WindowClosing, func(e *application.WindowEvent) {
|
||||
countdown--
|
||||
if countdown == 0 {
|
||||
println("Closing!")
|
||||
return
|
||||
}
|
||||
println("Nope! Not closing!")
|
||||
e.Cancel()
|
||||
})
|
||||
|
||||
win1.On(events.Common.WindowFocus, func(e *application.WindowEvent) {
|
||||
println("[Event] Window focus!")
|
||||
})
|
||||
|
||||
err := app.Run()
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Wails Markup Language (wml)
|
||||
|
||||
An experimental feature to call runtime methods using plain html, similar to
|
||||
[htmx](https://htmx.org).
|
||||
|
||||
```html
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Wails ML Demo</title>
|
||||
</head>
|
||||
<body style="margin-top:50px; color: white; background-color: #191919">
|
||||
<h2>Wails ML Demo</h2>
|
||||
<p>This application contains no Javascript!</p>
|
||||
<button wml-event="button-pressed">Press me!</button>
|
||||
<button wml-event="delete-things" wml-confirm="Are you sure?">
|
||||
Delete all the things!
|
||||
</button>
|
||||
<button wml-window="Close" wml-confirm="Are you sure?">
|
||||
Close the Window?
|
||||
</button>
|
||||
<button wml-window="Center">Center</button>
|
||||
<button wml-window="Minimise">Minimise</button>
|
||||
<button wml-window="Maximise">Maximise</button>
|
||||
<button wml-window="UnMaximise">UnMaximise</button>
|
||||
<button wml-window="Fullscreen">Fullscreen</button>
|
||||
<button wml-window="UnFullscreen">UnFullscreen</button>
|
||||
<button wml-window="Restore">Restore</button>
|
||||
<div
|
||||
style="width: 200px; height: 200px; border: 2px solid white;"
|
||||
wml-event="hover"
|
||||
wml-trigger="mouseover"
|
||||
>
|
||||
Hover over me
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
318
mkdocs-website/docs/zh/API/application.md
Normal file
|
|
@ -0,0 +1,318 @@
|
|||
# 应用程序
|
||||
|
||||
应用程序 API 用于使用 Wails 框架创建应用程序。
|
||||
|
||||
### New
|
||||
|
||||
API:`New(appOptions Options) *App`
|
||||
|
||||
`New(appOptions Options)` 使用给定的应用程序选项创建一个新的应用程序。它对未指定的选项应用默认值,将其与提供的选项合并,然后初始化并返回应用程序的实例。
|
||||
|
||||
如果在初始化过程中出现错误,应用程序将停止,并显示提供的错误消息。
|
||||
|
||||
需要注意的是,如果全局应用程序实例已经存在,将返回该实例,而不是创建新的实例。
|
||||
|
||||
```go title="main.go" hl_lines="6-9"
|
||||
package main
|
||||
|
||||
import "github.com/wailsapp/wails/v3/pkg/application"
|
||||
|
||||
func main() {
|
||||
app := application.New(application.Options{
|
||||
Name: "WebviewWindow Demo",
|
||||
// 其他选项
|
||||
})
|
||||
|
||||
// 其余的应用程序逻辑
|
||||
}
|
||||
```
|
||||
|
||||
### Get
|
||||
|
||||
`Get()` 返回全局应用程序实例。在代码的不同部分需要访问应用程序时非常有用。
|
||||
|
||||
```go
|
||||
// 获取应用程序实例
|
||||
app := application.Get()
|
||||
```
|
||||
|
||||
### Capabilities
|
||||
|
||||
API:`Capabilities() capabilities.Capabilities`
|
||||
|
||||
`Capabilities()` 返回应用程序当前具有的功能的映射。这些功能可以是操作系统提供的不同功能,如 webview 功能。
|
||||
|
||||
```go
|
||||
// 获取应用程序的功能
|
||||
capabilities := app.Capabilities()
|
||||
if capabilities.HasNativeDrag {
|
||||
// 做一些事情
|
||||
}
|
||||
```
|
||||
|
||||
### GetPID
|
||||
|
||||
API:`GetPID() int`
|
||||
|
||||
`GetPID()` 返回应用程序的进程 ID。
|
||||
|
||||
```go
|
||||
pid := app.GetPID()
|
||||
```
|
||||
|
||||
### Run
|
||||
|
||||
API:`Run() error`
|
||||
|
||||
`Run()` 启动应用程序及其组件的执行。
|
||||
|
||||
```go
|
||||
app := application.New(application.Options{
|
||||
// 选项
|
||||
})
|
||||
// 运行应用程序
|
||||
err := application.Run()
|
||||
if err != nil {
|
||||
// 处理错误
|
||||
}
|
||||
```
|
||||
|
||||
### Quit
|
||||
|
||||
API:`Quit()`
|
||||
|
||||
`Quit()` 通过销毁窗口和可能的其他组件退出应用程序。
|
||||
|
||||
```go
|
||||
// 退出应用程序
|
||||
app.Quit()
|
||||
```
|
||||
|
||||
### IsDarkMode
|
||||
|
||||
API:`IsDarkMode() bool`
|
||||
|
||||
`IsDarkMode()` 检查应用程序是否在暗模式下运行。它返回一个布尔值,指示是否启用了暗模式。
|
||||
|
||||
```go
|
||||
// 检查是否启用了暗模式
|
||||
if app.IsDarkMode() {
|
||||
// 做一些事情
|
||||
}
|
||||
```
|
||||
|
||||
### Hide
|
||||
|
||||
API:`Hide()`
|
||||
|
||||
`Hide()` 隐藏应用程序窗口。
|
||||
|
||||
```go
|
||||
// 隐藏应用程序窗口
|
||||
app.Hide()
|
||||
```
|
||||
|
||||
### Show
|
||||
|
||||
API:`Show()`
|
||||
|
||||
`Show()` 显示应用程序窗口。
|
||||
|
||||
```go
|
||||
// 显示应用程序窗口
|
||||
app.Show()
|
||||
```
|
||||
|
||||
### NewWebviewWindow
|
||||
|
||||
API:`NewWebviewWindow() *WebviewWindow`
|
||||
|
||||
`NewWebviewWindow()` 使用默认选项创建一个新的 Webview 窗口,并返回它。
|
||||
|
||||
```go
|
||||
// 创建一个新的 Webview 窗口
|
||||
window := app.NewWebviewWindow()
|
||||
```
|
||||
|
||||
### NewWebviewWindowWithOptions
|
||||
|
||||
API:`NewWebviewWindowWithOptions(windowOptions WebviewWindowOptions) *WebviewWindow`
|
||||
|
||||
`NewWebviewWindowWithOptions()` 使用自定义选项创建一个新的 Webview 窗口。新创建的窗口将添加到应用程序管理的窗口映射中。
|
||||
|
||||
```go
|
||||
// 使用自定义选项创建一个新的 Webview 窗口
|
||||
window := app.NewWebviewWindowWithOptions(WebviewWindowOptions{
|
||||
Name: "Main",
|
||||
Title: "My Window",
|
||||
Width: 800,
|
||||
Height: 600,
|
||||
})
|
||||
```
|
||||
|
||||
### OnWindowCreation
|
||||
|
||||
API:`OnWindowCreation(callback func(window *WebviewWindow))`
|
||||
|
||||
`OnWindowCreation()` 注册一个回调函数,当创建窗口时调用该函数。
|
||||
|
||||
```go
|
||||
// 注册一个回调函数,当创建窗口时调用该函数
|
||||
app.OnWindowCreation(func(window *WebviewWindow) {
|
||||
// 做一些事情
|
||||
})
|
||||
```
|
||||
|
||||
### GetWindowByName
|
||||
|
||||
API:`GetWindowByName(name string) *WebviewWindow`
|
||||
|
||||
`GetWindowByName()` 获取并返回具有特定名称的窗口。
|
||||
|
||||
```go
|
||||
// 通过名称获取窗口
|
||||
window := app.GetWindowByName("Main")
|
||||
```
|
||||
|
||||
### CurrentWindow
|
||||
|
||||
API:`CurrentWindow() *WebviewWindow`
|
||||
|
||||
`CurrentWindow()` 获取并返回应用程序中当前活动窗口的指针。如果没有窗口,则返回 nil。
|
||||
|
||||
```go
|
||||
// 获取当前窗口
|
||||
window := app.CurrentWindow()
|
||||
```
|
||||
|
||||
### RegisterContextMenu
|
||||
|
||||
API:`RegisterContextMenu(name string, menu *Menu)`
|
||||
|
||||
`RegisterContextMenu()` 注册具有给定名称的上下文菜单。稍后可以在应用程序中使用该菜单。
|
||||
|
||||
```go
|
||||
|
||||
// 创建一个新的菜单
|
||||
ctxmenu := app.NewMenu()
|
||||
|
||||
// 将菜单注册为上下文菜单
|
||||
app.RegisterContextMenu("MyContextMenu", ctxmenu)
|
||||
```
|
||||
|
||||
### SetMenu
|
||||
|
||||
API:`SetMenu(menu *Menu)`
|
||||
|
||||
`SetMenu()` 设置应用程序的菜单。在 Mac 上,这将是全局菜单。对于 Windows 和 Linux,这将是任何新窗口的默认菜单。
|
||||
|
||||
```go
|
||||
// 创建一个新的菜单
|
||||
menu := app.NewMenu()
|
||||
|
||||
// 设置应用程序的菜单
|
||||
app.SetMenu(menu)
|
||||
```
|
||||
|
||||
### ShowAboutDialog
|
||||
|
||||
API:`ShowAboutDialog()`
|
||||
|
||||
`ShowAboutDialog()` 显示一个 "关于" 对话框。可以显示应用程序的名称、描述和图标。
|
||||
|
||||
```go
|
||||
// 显示关于对话框
|
||||
app.ShowAboutDialog()
|
||||
```
|
||||
|
||||
### Info
|
||||
|
||||
API:`InfoDialog()`
|
||||
|
||||
`InfoDialog()` 创建并返回一个具有 `InfoDialogType` 的 `MessageDialog` 的新实例。此对话框通常用于向用户显示信息消息。
|
||||
|
||||
### Question
|
||||
|
||||
API:`QuestionDialog()`
|
||||
|
||||
`QuestionDialog()` 创建并返回一个具有 `QuestionDialogType` 的 `MessageDialog` 的新实例。此对话框通常用于向用户提问并期望回应。
|
||||
|
||||
### Warning
|
||||
|
||||
API:`WarningDialog()`
|
||||
|
||||
`WarningDialog()` 创建并返回一个具有 `WarningDialogType` 的 `MessageDialog` 的新实例。如其名称所示,此对话框主要用于向用户显示警告消息。
|
||||
|
||||
### Error
|
||||
|
||||
API:`ErrorDialog()`
|
||||
|
||||
`ErrorDialog()` 创建并返回一个具有 `ErrorDialogType` 的 `MessageDialog` 的新实例。此对话框设计用于在需要向用户显示错误消息时使用。
|
||||
|
||||
### OpenFile
|
||||
|
||||
API:`OpenFileDialog()`
|
||||
|
||||
`OpenFileDialog()` 创建并返回一个新的 `OpenFileDialogStruct`。此对话框提示用户从其文件系统中选择一个或多个文件。
|
||||
|
||||
### SaveFile
|
||||
|
||||
API:`SaveFileDialog()`
|
||||
|
||||
`SaveFileDialog()` 创建并返回一个新的 `SaveFileDialogStruct`。此对话框提示用户选择其文件系统上的位置以保存文件。
|
||||
|
||||
### OpenDirectory
|
||||
|
||||
API:`OpenDirectoryDialog()`
|
||||
|
||||
`OpenDirectoryDialog()` 创建并返回一个具有 `OpenDirectoryDialogType` 的 `MessageDialog` 的新实例。此对话框使用户能够从其文件系统中选择目录。
|
||||
|
||||
### On
|
||||
|
||||
API:`On(eventType events.ApplicationEventType, callback func(event *Event)) func()`
|
||||
|
||||
`On()` 注册特定应用程序事件的事件侦听器。提供的回调函数将在相应事件发生时触发。该函数返回一个可调用的函数,用于删除侦听器。
|
||||
|
||||
### RegisterHook
|
||||
|
||||
API:`RegisterHook(eventType events.ApplicationEventType, callback func(event *Event)) func()`
|
||||
|
||||
`RegisterHook()` 注册要在特定事件期间作为钩子运行的回调函数。这些钩子在使用 `On()` 附加的侦听器之前运行。该函数返回一个可调用的函数,用于删除钩子。
|
||||
|
||||
### GetPrimaryScreen
|
||||
|
||||
API:`GetPrimaryScreen() (*Screen, error)`
|
||||
|
||||
`GetPrimaryScreen()` 返回系统的主屏幕。
|
||||
|
||||
### GetScreens
|
||||
|
||||
API:`GetScreens() ([]*Screen, error)`
|
||||
|
||||
`GetScreens()` 返回有关连接到系统的所有屏幕的信息。
|
||||
|
||||
这是提供的 `App` 结构中导出的方法的简要摘要。请注意,有关更详细的功能或注意事项,请参考实际的 Go 代码或进一步的内部文档。
|
||||
|
||||
## Options
|
||||
|
||||
```go title="application_options.go"
|
||||
--8<--
|
||||
../v3/pkg/application/options_application.go
|
||||
--8<--
|
||||
```
|
||||
|
||||
### Windows 选项
|
||||
|
||||
```go title="application_options_windows.go"
|
||||
--8<--
|
||||
../v3/pkg/application/options_application_win.go
|
||||
--8<--
|
||||
```
|
||||
|
||||
### Mac 选项
|
||||
|
||||
```go title="options_application_mac.go"
|
||||
--8<--
|
||||
../v3/pkg/application/options_application_mac.go
|
||||
--8<--
|
||||
```
|
||||
37
mkdocs-website/docs/zh/API/mainthread.md
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
# 主线程函数
|
||||
|
||||
这些方法是在主线程上运行代码的实用函数。当您想要在UI线程上运行自定义代码时,这是必需的。
|
||||
|
||||
### InvokeSync
|
||||
|
||||
API: `InvokeSync(fn func())`
|
||||
|
||||
此函数以同步方式运行传入的函数(`fn`)。它使用一个`WaitGroup`(`wg`)确保主线程在`fn`函数完成之前等待,然后才继续执行。如果在`fn`内部发生恐慌,它将传递给应用程序选项中定义的处理程序函数`PanicHandler`。
|
||||
|
||||
### InvokeSyncWithResult
|
||||
|
||||
API: `InvokeSyncWithResult[T any](fn func() T) (res T)`
|
||||
|
||||
此函数与`InvokeSync(fn func())`类似,但它返回一个结果。可用于调用具有单个返回值的任何函数。
|
||||
|
||||
### InvokeSyncWithError
|
||||
|
||||
API: `InvokeSyncWithError(fn func() error) (err error)`
|
||||
|
||||
此函数同步运行`fn`并返回`fn`产生的任何错误。请注意,如果在`fn`执行期间发生恐慌,此函数将从恢复。
|
||||
|
||||
### InvokeSyncWithResultAndError
|
||||
|
||||
API: `InvokeSyncWithResultAndError[T any](fn func() (T, error)) (res T, err error)`
|
||||
|
||||
此函数同步运行`fn`并返回类型为`T`的结果和一个错误。
|
||||
|
||||
### InvokeAsync
|
||||
|
||||
API: `InvokeAsync(fn func())`
|
||||
|
||||
此函数以异步方式运行`fn`。它在主线程上运行给定的函数。如果在`fn`内部发生恐慌,它将传递给应用程序选项中定义的处理程序函数`PanicHandler`。
|
||||
|
||||
---
|
||||
|
||||
注意:这些函数将阻塞执行,直到`fn`完成。确保`fn`不会阻塞至关重要。如果需要运行阻塞函数,请改用`InvokeAsync`。
|
||||
60
mkdocs-website/docs/zh/API/menu.md
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
# 菜单
|
||||
|
||||
可以创建菜单并添加到应用程序中。它们可以用于创建上下文菜单、系统托盘菜单和应用程序菜单。
|
||||
|
||||
要创建一个新菜单,请调用:
|
||||
|
||||
```go
|
||||
// 创建一个新菜单
|
||||
menu := app.NewMenu()
|
||||
```
|
||||
|
||||
然后,`Menu` 类型上可用以下操作:
|
||||
|
||||
### 添加
|
||||
|
||||
API:`Add(label string) *MenuItem`
|
||||
|
||||
此方法以 `string` 类型的 `label` 作为输入,并将具有给定标签的新 `MenuItem` 添加到菜单中。它返回添加的 `MenuItem`。
|
||||
|
||||
### 添加分隔符
|
||||
|
||||
API:`AddSeparator()`
|
||||
|
||||
此方法将一个新的分隔符 `MenuItem` 添加到菜单中。
|
||||
|
||||
### 添加复选框
|
||||
|
||||
API:`AddCheckbox(label string, enabled bool) *MenuItem`
|
||||
|
||||
此方法以 `string` 类型的 `label` 和 `bool` 类型的 `enabled` 作为输入,并将具有给定标签和启用状态的新复选框 `MenuItem` 添加到菜单中。它返回添加的 `MenuItem`。
|
||||
|
||||
### 添加单选按钮
|
||||
|
||||
API:`AddRadio(label string, enabled bool) *MenuItem`
|
||||
|
||||
此方法以 `string` 类型的 `label` 和 `bool` 类型的 `enabled` 作为输入,并将具有给定标签和启用状态的新单选按钮 `MenuItem` 添加到菜单中。它返回添加的 `MenuItem`。
|
||||
|
||||
### 更新
|
||||
|
||||
API:`Update()`
|
||||
|
||||
此方法处理任何单选按钮组,并在菜单未初始化时更新菜单。
|
||||
|
||||
### 添加子菜单
|
||||
|
||||
API:`AddSubmenu(s string) *Menu`
|
||||
|
||||
此方法以 `string` 类型的 `s` 作为输入,并将具有给定标签的新子菜单 `MenuItem` 添加到菜单中。它返回添加的子菜单。
|
||||
|
||||
### 添加角色
|
||||
|
||||
API:`AddRole(role Role) *Menu`
|
||||
|
||||
此方法以 `Role` 类型的 `role` 作为输入,如果不为 `nil`,则将其添加到菜单中,并返回 `Menu`。
|
||||
|
||||
### 设置标签
|
||||
|
||||
API:`SetLabel(label string)`
|
||||
|
||||
此方法设置 `Menu` 的 `label`。
|
||||
102
mkdocs-website/docs/zh/API/systray.md
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
# 系统托盘
|
||||
|
||||
系统托盘位于桌面环境的通知区域,可以包含当前运行应用程序的图标和特定系统通知。
|
||||
|
||||
您可以通过调用 `app.NewSystemTray()` 来创建一个系统托盘:
|
||||
|
||||
```go
|
||||
// 创建一个新的系统托盘
|
||||
tray := app.NewSystemTray()
|
||||
```
|
||||
|
||||
`SystemTray` 类型上提供了以下方法:
|
||||
|
||||
### SetLabel
|
||||
|
||||
API:`SetLabel(label string)`
|
||||
|
||||
`SetLabel` 方法设置托盘的标签。
|
||||
|
||||
### Label
|
||||
|
||||
API:`Label() string`
|
||||
|
||||
`Label` 方法获取托盘的标签。
|
||||
|
||||
### PositionWindow
|
||||
|
||||
API:`PositionWindow(*WebviewWindow, offset int) error`
|
||||
|
||||
`PositionWindow` 方法调用了 `AttachWindow` 和 `WindowOffset` 方法。
|
||||
|
||||
### SetIcon
|
||||
|
||||
API:`SetIcon(icon []byte) *SystemTray`
|
||||
|
||||
`SetIcon` 方法设置系统托盘的图标。
|
||||
|
||||
### SetDarkModeIcon
|
||||
|
||||
API:`SetDarkModeIcon(icon []byte) *SystemTray`
|
||||
|
||||
`SetDarkModeIcon` 方法设置暗黑模式下系统托盘的图标。
|
||||
|
||||
### SetMenu
|
||||
|
||||
API:`SetMenu(menu *Menu) *SystemTray`
|
||||
|
||||
`SetMenu` 方法设置系统托盘的菜单。
|
||||
|
||||
### Destroy
|
||||
|
||||
API:`Destroy()`
|
||||
|
||||
`Destroy` 方法销毁系统托盘实例。
|
||||
|
||||
### OnClick
|
||||
|
||||
API:`OnClick(handler func()) *SystemTray`
|
||||
|
||||
`OnClick` 方法设置点击托盘图标时执行的函数。
|
||||
|
||||
### OnRightClick
|
||||
|
||||
API:`OnRightClick(handler func()) *SystemTray`
|
||||
|
||||
`OnRightClick` 方法设置右键点击托盘图标时执行的函数。
|
||||
|
||||
### OnDoubleClick
|
||||
|
||||
API:`OnDoubleClick(handler func()) *SystemTray`
|
||||
|
||||
`OnDoubleClick` 方法设置双击托盘图标时执行的函数。
|
||||
|
||||
### OnRightDoubleClick
|
||||
|
||||
API:`OnRightDoubleClick(handler func()) *SystemTray`
|
||||
|
||||
`OnRightDoubleClick` 方法设置右键双击托盘图标时执行的函数。
|
||||
|
||||
### AttachWindow
|
||||
|
||||
API:`AttachWindow(window *WebviewWindow) *SystemTray`
|
||||
|
||||
`AttachWindow` 方法将窗口附加到系统托盘。当点击系统托盘图标时,窗口将显示出来。
|
||||
|
||||
### WindowOffset
|
||||
|
||||
API:`WindowOffset(offset int) *SystemTray`
|
||||
|
||||
`WindowOffset` 方法设置系统托盘与窗口之间的像素间隔。
|
||||
|
||||
### WindowDebounce
|
||||
|
||||
API:`WindowDebounce(debounce time.Duration) *SystemTray`
|
||||
|
||||
`WindowDebounce` 方法设置防抖时间。在 Windows 上,它用于指定在响应通知图标上的鼠标松开事件之前等待多长时间。
|
||||
|
||||
### OpenMenu
|
||||
|
||||
API:`OpenMenu()`
|
||||
|
||||
`OpenMenu` 方法打开与系统托盘关联的菜单。
|
||||
101
mkdocs-website/docs/zh/API/window.md
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
# 窗口
|
||||
|
||||
要创建一个窗口,可以使用[Application.NewWebviewWindow](application.md#newwebviewwindow)或[Application.NewWebviewWindowWithOptions](application.md#newwebviewwindowwithoptions)。前者创建一个具有默认选项的窗口,而后者允许您指定自定义选项。
|
||||
|
||||
这些方法可在返回的WebviewWindow对象上调用:
|
||||
|
||||
### SetTitle
|
||||
|
||||
API: `SetTitle(title string) *WebviewWindow`
|
||||
|
||||
此方法将窗口标题更新为提供的字符串。它返回WebviewWindow对象,允许进行方法链接。
|
||||
|
||||
### Name
|
||||
|
||||
API: `Name() string`
|
||||
|
||||
此函数返回WebviewWindow的名称。
|
||||
|
||||
### SetSize
|
||||
|
||||
API: `SetSize(width, height int) *WebviewWindow`
|
||||
|
||||
此方法将WebviewWindow的大小设置为提供的宽度和高度参数。如果提供的尺寸超过约束条件,它们将被相应调整。
|
||||
|
||||
### SetAlwaysOnTop
|
||||
|
||||
API: `SetAlwaysOnTop(b bool) *WebviewWindow`
|
||||
|
||||
此函数根据提供的布尔标志设置窗口始终置顶。
|
||||
|
||||
### Show
|
||||
|
||||
API: `Show() *WebviewWindow`
|
||||
|
||||
`Show`方法用于使窗口可见。如果窗口未运行,它首先调用`run`方法启动窗口,然后使其可见。
|
||||
|
||||
### Hide
|
||||
|
||||
API: `Hide() *WebviewWindow`
|
||||
|
||||
`Hide`方法用于隐藏窗口。它将窗口的隐藏状态设置为true,并触发窗口隐藏事件。
|
||||
|
||||
### SetURL
|
||||
|
||||
API: `SetURL(s string) *WebviewWindow`
|
||||
|
||||
`SetURL`方法用于将窗口的URL设置为给定的URL字符串。
|
||||
|
||||
### SetZoom
|
||||
|
||||
API: `SetZoom(magnification float64) *WebviewWindow`
|
||||
|
||||
`SetZoom`方法将窗口内容的缩放级别设置为提供的放大倍数。
|
||||
|
||||
### GetZoom
|
||||
|
||||
API: `GetZoom() float64`
|
||||
|
||||
`GetZoom`函数返回窗口内容的当前缩放级别。
|
||||
|
||||
### GetScreen
|
||||
|
||||
API: `GetScreen() (*Screen, error)`
|
||||
|
||||
`GetScreen`方法返回窗口所显示的屏幕。
|
||||
|
||||
#### SetFrameless
|
||||
|
||||
API: `SetFrameless(frameless bool) *WebviewWindow`
|
||||
|
||||
此函数用于移除窗口边框和标题栏。它根据提供的布尔值(true表示无边框,false表示有边框)切换窗口的无边框状态。
|
||||
|
||||
#### RegisterContextMenu
|
||||
|
||||
API: `RegisterContextMenu(name string, menu *Menu)`
|
||||
|
||||
此函数用于注册上下文菜单并为其指定给定的名称。
|
||||
|
||||
#### NativeWindowHandle
|
||||
|
||||
API: `NativeWindowHandle() (uintptr, error)`
|
||||
|
||||
此函数用于获取窗口的平台本机窗口句柄。
|
||||
|
||||
#### Focus
|
||||
|
||||
API: `Focus()`
|
||||
|
||||
此函数用于将焦点设置到窗口。
|
||||
|
||||
#### SetEnabled
|
||||
|
||||
API: `SetEnabled(enabled bool)`
|
||||
|
||||
此函数用于根据提供的布尔值启用/禁用窗口。
|
||||
|
||||
#### SetAbsolutePosition
|
||||
|
||||
API: `SetAbsolutePosition(x int, y int)`
|
||||
|
||||
此函数设置窗口在屏幕上的绝对位置。
|
||||
39
mkdocs-website/docs/zh/changelog.md
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
# 更新日志
|
||||
|
||||
<!--
|
||||
此项目的所有重要更改将在此文件中记录。
|
||||
|
||||
格式基于[保持一个更改日志](https://keepachangelog.com/en/1.0.0/),
|
||||
并且该项目遵循[语义化版本](https://semver.org/spec/v2.0.0.html)。
|
||||
|
||||
- `Added` 用于新增功能。
|
||||
- `Changed` 用于现有功能的更改。
|
||||
- `Deprecated` 用于即将移除的功能。
|
||||
- `Removed` 用于已移除的功能。
|
||||
- `Fixed` 用于修复错误。
|
||||
- `Security` 用于安全漏洞。
|
||||
|
||||
-->
|
||||
|
||||
## [未发布]
|
||||
|
||||
### Added
|
||||
|
||||
- [darwin] 添加Event ApplicationShouldHandleReopen以处理单击dock图标的功能 @5aaee9 in [#2991](https://github.com/wailsapp/wails/pull/2991)
|
||||
- [darwin] 添加getPrimaryScreen/getScreens的实现 @tmclane in [#2618](https://github.com/wailsapp/wails/pull/2618)
|
||||
|
||||
### Fixed
|
||||
|
||||
- 修复Doctor apt软件包验证问题 [Atterpac](https://github.com/Atterpac) in [#2972](https://github.com/wailsapp/wails/pull/2972)。
|
||||
- 修复应用程序在退出时冻结的问题 (Darwin) @5aaee9 in [#2982](https://github.com/wailsapp/wails/pull/2982)
|
||||
- 修复Windows上示例的背景颜色问题 [mmgvh](https://github.com/mmghv) in [#2750](https://github.com/wailsapp/wails/pull/2750)。
|
||||
- 修复默认上下文菜单问题 [mmgvh](https://github.com/mmghv) in [#2753](https://github.com/wailsapp/wails/pull/2753)。
|
||||
|
||||
|
||||
### Changed
|
||||
|
||||
### Removed
|
||||
|
||||
### Deprecated
|
||||
|
||||
### Security
|
||||
341
mkdocs-website/docs/zh/development/changes.md
Normal file
|
|
@ -0,0 +1,341 @@
|
|||
# v3的更改
|
||||
|
||||
!!! note
|
||||
这是当前的无序更改脑升级。很快它将组织成一个更易读的格式。
|
||||
|
||||
## 选项
|
||||
|
||||
自v2以来,应用程序选项已经进行了修订。
|
||||
|
||||
## 事件
|
||||
|
||||
在v3中,有3种类型的事件:
|
||||
|
||||
- 应用程序事件
|
||||
- 窗口事件
|
||||
- 自定义事件
|
||||
|
||||
### 应用程序事件
|
||||
|
||||
应用程序事件是由应用程序发出的事件。这些事件包括macOS上的`ApplicationDidFinishLaunching`等本机事件。
|
||||
|
||||
### 窗口事件
|
||||
|
||||
窗口事件是由窗口发出的事件。这些事件包括macOS上的`WindowDidBecomeMain`等本机事件。还定义了常见事件,以便它们在跨平台上工作,例如`WindowClosing`。
|
||||
|
||||
### 自定义事件
|
||||
|
||||
用户定义的事件称为`WailsEvents`。这是为了将它们与用于与浏览器通信的`Event`对象区分开来。WailsEvents现在是封装事件的对象。这包括事件名称,数据和事件的源。
|
||||
|
||||
与WailsEvent关联的数据现在是单个值。如果需要多个值,则可以使用struct。
|
||||
|
||||
### 事件回调和`Emit`函数签名
|
||||
|
||||
事件回调的签名(由`On`,`Once`和`OnMultiple`使用)已更改。在v2中,回调函数接收可选数据。在v3中,回调函数接收包含与事件相关的所有数据的`WailsEvent`对象。
|
||||
|
||||
类似地,`Emit`函数已更改。它现在不再接受名称和可选数据,而是接受一个`WailsEvent`对象,它将发出该对象。
|
||||
|
||||
### `Off`和`OffAll`
|
||||
|
||||
在v2中,`Off`和`OffAll`调用将删除JS和Go中的事件。由于v3具有多窗口的特性,因此已更改为这些方法仅适用于调用它们的上下文。例如,如果你在一个窗口中调用`Off`,它仅会删除该窗口的事件。如果你在Go中使用`Off`,它只会删除Go的事件。
|
||||
|
||||
### Hooks
|
||||
|
||||
事件钩子是v3中的新功能。它们允许您钩入事件系统,并在发出某些事件时执行操作。例如,您可以钩入`WindowClosing`事件,在窗口关闭之前执行一些清理操作。钩子可以在应用程序级别或窗口级别使用`RegisterHook`进行注册。应用程序级别适用于应用程序事件。仅当窗口级别钩子与其注册的窗口一起调用。
|
||||
|
||||
### 日志记录
|
||||
|
||||
在v2中,日志记录会混淆,因为应用程序日志和系统(内部)日志都使用相同的记录器。我们已经对此进行了简化:
|
||||
|
||||
- 内部日志现在使用标准的Go `slog`记录器处理。这是通过应用程序选项中的`logger`选项进行配置的。默认情况下,这使用[tint](https://github.com/lmittmann/tint)记录器。
|
||||
- 现在可以通过新的`log`插件进行应用程序日志记录,它在底层使用`slog`。此插件提供了一个简单的用于记录到控制台的API。它在Go和JS中都可用。
|
||||
|
||||
### 开发人员注意事项
|
||||
|
||||
在Go中发出事件时,它会将事件分派到本地的Go侦听器以及应用程序中的每个窗口。在JS中发出事件时,它现在会将事件发送到应用程序。这将被处理,就好像它是在Go中发出的,但是发送者ID将是窗口的ID。
|
||||
|
||||
## 窗口
|
||||
|
||||
Window API在很大程度上保持不变,但方法现在是在窗口实例而不是运行时上。一些值得注意的变化是:
|
||||
|
||||
- 窗口现在具有标识它们的名称。用于在发出事件时标识窗口。
|
||||
- 窗口上现在有更多以前不可用的方法,例如`AbsolutePosition`和`ToggleDevTools`。
|
||||
- 窗口现在可以通过本机拖放接受文件。有关详细信息,请参阅拖放部分。
|
||||
|
||||
## 剪切板
|
||||
|
||||
剪贴板API已经简化。现在有一个单独的`Clipboard`对象,可以用于读取和写入剪贴板。`Clipboard`对象在Go和JS中都可用。`SetText()`用于设置文本,`Text()`用于获取文本。
|
||||
|
||||
## 绑定
|
||||
|
||||
绑定的工作方式与v2类似,通过提供一种将结构方法绑定到前端的方式。这些可以在前端使用由`wails3 generate bindings`命令生成的绑定包装器来调用:
|
||||
|
||||
```javascript
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import { main } from "./models";
|
||||
|
||||
window.go = window.go || {};
|
||||
window.go.main = {
|
||||
GreetService: {
|
||||
/**
|
||||
* GreetService.Greet
|
||||
* Greet greets a person
|
||||
* @param name {string}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
Greet: function (name) {
|
||||
wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0));
|
||||
},
|
||||
|
||||
/**
|
||||
* GreetService.GreetPerson
|
||||
* GreetPerson greets a person
|
||||
* @param person {main.Person}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
GreetPerson: function (person) {
|
||||
wails.CallByID(4021313248, ...Array.prototype.slice.call(arguments, 0));
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
默认情况下,绑定的方法是混淆的,并使用uint32 ID进行标识,该ID是使用[FNV哈希算法](https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function)计算的。这是为了防止方法名称在生产构建中被暴露出来。在调试模式下,方法ID与计算的方法ID一起记录,以帮助调试。如果您希望增加额外的混淆层,可以使用`BindAliases`选项。这允许您指定别名ID与方法ID的映射。当前端使用ID调用方法时,方法ID将首先在别名映射中查找匹配项。如果找不到,它将假定是标准方法ID,并尝试以通常的方式查找方法。
|
||||
|
||||
示例:
|
||||
|
||||
```go
|
||||
app := application.New(application.Options{
|
||||
Bind: []any{
|
||||
&GreetService{},
|
||||
},
|
||||
BindAliases: map[uint32]uint32{
|
||||
1: 1411160069,
|
||||
2: 4021313248,
|
||||
},
|
||||
Assets: application.AssetOptions{
|
||||
FS: assets,
|
||||
},
|
||||
Mac: application.MacOptions{
|
||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||
},
|
||||
})
|
||||
```
|
||||
|
||||
现在我们可以使用此别名在前端调用:`wails.Call(1, "world!")`。
|
||||
|
||||
### 不安全调用
|
||||
|
||||
如果您不介意在二进制文件中以明文形式提供调用,并且不打算使用[garble](https://github.com/burrowers/garble),那么可以使用不安全的`wails.CallByName()`方法。此方法接受要调用的方法的完全限定名称和要传递给它的参数。示例:
|
||||
|
||||
```go
|
||||
wails.CallByName("main.GreetService.Greet", "world!")
|
||||
```
|
||||
|
||||
!!! danger
|
||||
|
||||
这仅作为开发的便利方法提供。不建议在生产中使用此方法。
|
||||
|
||||
## 对话框
|
||||
|
||||
对话框现在在JavaScript中可用!
|
||||
|
||||
### Windows
|
||||
|
||||
Windows中的对话框按钮是不可配置的,根据对话框的类型是恒定的。要在按下按钮时触发回调,请创建一个具有与您希望附加回调的按钮相同名称的按钮。示例:创建一个标签为“确定”的按钮,并使用`OnClick()`方法设置回调方法:
|
||||
|
||||
```go
|
||||
dialog := app.QuestionDialog().
|
||||
SetTitle("Update").
|
||||
SetMessage("The cancel button is selected when pressing escape")
|
||||
ok := dialog.AddButton("Ok")
|
||||
ok.OnClick(func() {
|
||||
// Do something
|
||||
})
|
||||
no := dialog.AddButton("Cancel")
|
||||
dialog.SetDefaultButton(ok)
|
||||
dialog.SetCancelButton(no)
|
||||
dialog.Show()
|
||||
```
|
||||
|
||||
## 拖放
|
||||
|
||||
可以按窗口启用本机拖放。只需将`EnableDragAndDrop`窗口配置选项设置为`true`,窗口将允许将文件拖放到其上。当这种情况发生时,将发出`events.FilesDropped`事件。然后可以使用`WindowEvent.Context()`中的`DroppedFiles()`方法检索文件名。这将返回一个包含文件名的字符串切片。
|
||||
|
||||
## 上下文菜单
|
||||
|
||||
上下文菜单是当用户右键单击元素时显示的上下文菜单。创建上下文菜单与创建标准菜单相同,使用`app.NewMenu()`。要使上下文菜单对窗口可用,请调用`window.RegisterContextMenu(name, menu)`。名称将是上下文菜单的ID,并由前端使用。
|
||||
|
||||
要指示元素具有上下文菜单,请将`data-contextmenu`属性添加到元素。此属性的值应为先前在窗口中注册的上下文菜单的名称。
|
||||
|
||||
可以在应用程序级别注册上下文菜单,使其对所有窗口可用。可以使用`app.RegisterContextMenu(name, menu)`完成此操作。如果在窗口级别找不到上下文菜单,则将检查应用程序上下文菜单。`v3/examples/contextmenus`中可以找到此演示。
|
||||
|
||||
## Wails标记语言(WML)
|
||||
|
||||
Wails标记语言是一种简单的标记语言,允许您在没有JavaScript的情况下向标准HTML元素添加功能。
|
||||
|
||||
当前支持以下标签:
|
||||
|
||||
### `data-wml-event`
|
||||
|
||||
这指定单击元素时将发出Wails事件。属性的值应为要发出的事件的名称。
|
||||
|
||||
示例:
|
||||
|
||||
```html
|
||||
<button data-wml-event="myevent">Click Me</button>
|
||||
```
|
||||
|
||||
有时您需要用户确认操作。可以通过向元素添加`data-wml-confirm`属性来完成。此属性的值将是要显示给用户的消息。
|
||||
|
||||
示例:
|
||||
|
||||
```html
|
||||
<button data-wml-event="delete-all-items" data-wml-confirm="Are you sure?">
|
||||
Delete All Items
|
||||
</button>
|
||||
```
|
||||
|
||||
### `data-wml-window`
|
||||
|
||||
可以通过将`data-wml-window`属性添加到元素中来调用任何`wails.window`方法。属性的值应为要调用的方法的名称。方法名称应与导出的方法的名称完全匹配。
|
||||
|
||||
```html
|
||||
<button data-wml-window="Close">Close Window</button>
|
||||
```
|
||||
|
||||
### `data-wml-trigger`
|
||||
|
||||
此属性指定应触发操作的javascript事件。默认为`click`。
|
||||
|
||||
```html
|
||||
<button data-wml-event="hover-box" data-wml-trigger="mouseover">
|
||||
Hover over me!
|
||||
</button>
|
||||
```
|
||||
|
||||
## 系统托盘
|
||||
|
||||
Wails 3附带了一个内置的系统托盘。这是一个完全功能的系统托盘,旨在尽可能简单地使用。可以设置托盘的图标、工具提示和菜单。还可以“附加”窗口到系统托盘。这样做将提供以下功能:
|
||||
|
||||
- 单击托盘图标会切换窗口可见性
|
||||
- 右键单击托盘将打开菜单(如果有)
|
||||
|
||||
在macOS上,如果没有附加的窗口,则托盘将使用显示菜单的默认方法(任何按钮)。如果有附加的窗口但没有菜单,则托盘将切换窗口,而不管按下的按钮如何。
|
||||
|
||||
## 插件
|
||||
|
||||
插件是扩展Wails应用程序功能的一种方式。
|
||||
|
||||
### 创建插件
|
||||
|
||||
插件是符合以下接口的标准Go结构:
|
||||
|
||||
```go
|
||||
type Plugin interface {
|
||||
Name() string
|
||||
Init(*application.App) error
|
||||
Shutdown()
|
||||
CallableByJS() []string
|
||||
InjectJS() string
|
||||
}
|
||||
```
|
||||
|
||||
`Name()`方法返回插件的名称。这用于记录目的。
|
||||
|
||||
`Init(*application.App) error`方法在加载插件时调用。`*application.App`参数是加载插件的应用程序。任何错误都将阻止应用程序启动。
|
||||
|
||||
`Shutdown()`方法在应用程序关闭时调用。
|
||||
|
||||
`CallableByJS()`方法返回可以从前端调用的导出函数列表。这些方法名称必须与插件导出的方法名称完全匹配。
|
||||
|
||||
`InjectJS()`方法返回应注入到创建的所有窗口中的JavaScript。这对于添加与插件补充的自定义JavaScript函数很有用。
|
||||
|
||||
### 提示
|
||||
|
||||
#### 枚举
|
||||
|
||||
在Go中,枚举通常被定义为类型和一组常量。例如:
|
||||
|
||||
```go
|
||||
type MyEnum int
|
||||
|
||||
const (
|
||||
MyEnumOne MyEnum = iota
|
||||
MyEnumTwo
|
||||
MyEnumThree
|
||||
)
|
||||
```
|
||||
|
||||
由于Go和JavaScript之间的不兼容性,无法以这种方式使用自定义类型。最好的策略是为float64使用类型别名:
|
||||
|
||||
```go
|
||||
type MyEnum = float64
|
||||
|
||||
const (
|
||||
MyEnumOne MyEnum = iota
|
||||
MyEnumTwo
|
||||
MyEnumThree
|
||||
)
|
||||
```
|
||||
|
||||
在Javascript中,您可以使用以下代码:
|
||||
|
||||
```js
|
||||
const MyEnum = {
|
||||
MyEnumOne: 0,
|
||||
MyEnumTwo: 1,
|
||||
MyEnumThree: 2,
|
||||
};
|
||||
```
|
||||
|
||||
- 为什么使用`float64`?不能使用`int`吗?
|
||||
- 因为JavaScript没有“int”的概念。一切都是`number`,在Go中会转换为`float64`。Go的反射包中还有类型转换的限制,这意味着使用`int`是行不通的。
|
||||
|
||||
### BackgroundColour
|
||||
|
||||
在v2中,这是指向`RGBA`结构的指针。在v3中,这是`RGBA`结构的值。
|
||||
|
||||
### WindowIsTranslucent
|
||||
|
||||
已删除此标志。现在有一个`BackgroundType`标志,可用于设置窗口应具有的背景类型。此标志可以设置为以下任何值:
|
||||
|
||||
- `BackgroundTypeSolid` - 窗口将具有实心背景
|
||||
- `BackgroundTypeTransparent` - 窗口将具有透明背景
|
||||
- `BackgroundTypeTranslucent` - 窗口将具有半透明背景
|
||||
|
||||
在Windows上,如果`BackgroundType`设置为`BackgroundTypeTranslucent`,则可以使用`WindowsWindow`选项中的`BackdropType`标志设置透明度的类型。这可以设置为以下任何值:
|
||||
|
||||
- `Auto` - 窗口将使用系统确定的效果
|
||||
- `None` - 窗口没有背景
|
||||
- `Mica` - 窗口使用Mica效果
|
||||
- `Acrylic` - 窗口使用丙烯酸效果
|
||||
- `Tabbed` - 窗口使用选项卡效果
|
||||
|
||||
## Windows Application Options
|
||||
|
||||
### WndProcInterceptor
|
||||
|
||||
如果设置了此标志,将拦截WndProc并调用该函数。这允许您直接处理Windows消息。该函数应具有以下签名:
|
||||
|
||||
```go
|
||||
func(hwnd uintptr, msg uint32, wParam, lParam uintptr) (returnValue uintptr, shouldReturn)
|
||||
```
|
||||
|
||||
如果`shouldReturn`值设置为`true`,则`returnValue`将由主wndProc方法返回。如果设置为`false`,将忽略返回值,并且消息将继续由主wndProc方法处理。
|
||||
|
||||
## 在关闭时隐藏窗口+OnBeforeClose
|
||||
|
||||
在v2中,有一个`HideWindowOnClose`标志,用于在关闭窗口时隐藏窗口。`HideWindowOnClose`标志与`OnBeforeClose`回调之间存在逻辑重叠。在v3中,已删除`HideWindowOnClose`标志,并将`OnBeforeClose`回调重命名为`ShouldClose`。当用户尝试关闭窗口时,将调用`ShouldClose`回调。如果回调返回`true`,窗口将关闭。如果返回`false`,窗口将不会关闭。这可以用于隐藏窗口而不是关闭窗口。
|
||||
|
||||
## 窗口拖动
|
||||
|
||||
在v2中,使用`--wails-drag`属性来指示可以使用元素拖动窗口。在v3中,已将其替换为`--webkit-app-region`,以更符合其他框架处理方式。`--webkit-app-region`属性可以设置为以下任何值:
|
||||
|
||||
- `drag` - 可使用该元素拖动窗口
|
||||
- `no-drag` - 该元素无法用于拖动窗口
|
||||
|
||||
我们本来希望使用`app-region`,但是在webkit在macOS上的`getComputedStyle`调用不支持它。
|
||||
163
mkdocs-website/docs/zh/development/introduction.md
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
# 介绍
|
||||
|
||||
!!! note 这个指南仍在制作中。
|
||||
|
||||
感谢您想要帮助开发Wails!本指南将帮助您入门。
|
||||
|
||||
## 入门指南
|
||||
|
||||
- Git 克隆此存储库。切换到 `v3-alpha` 分支。
|
||||
- 安装 CLI:`cd v3/cmd/wails3 && go install`
|
||||
|
||||
- 可选:如果您想要使用构建系统构建前端代码,您需要安装 [npm](https://nodejs.org/en/download)。
|
||||
|
||||
## 构建
|
||||
|
||||
对于简单的程序,您可以使用标准的 `go build` 命令。也可以使用 `go run`。
|
||||
|
||||
Wails 还配备了一个构建系统,可用于构建更复杂的项目。它使用了强大的 [Task](https://taskfile.dev) 构建系统。要了解更多信息,请查看任务主页或运行 `wails task --help`。
|
||||
|
||||
## 项目结构
|
||||
|
||||
该项目具有以下结构:
|
||||
|
||||
```
|
||||
v3
|
||||
├── cmd/wails3 // CLI
|
||||
├── examples // Wails 应用示例
|
||||
├── internal // 内部包
|
||||
| ├── runtime // Wails JS 运行时
|
||||
| └── templates // 支持的项目模板
|
||||
├── pkg
|
||||
| ├── application // 核心 Wails 库
|
||||
| └── events // 事件定义
|
||||
| └── mac // 由插件使用的 macOS 特定代码
|
||||
| └── w32 // Windows 特定代码
|
||||
├── plugins // 支持的插件
|
||||
├── tasks // 通用任务
|
||||
└── Taskfile.yaml // 开发任务配置
|
||||
```
|
||||
|
||||
## 开发
|
||||
|
||||
### 添加窗口功能
|
||||
|
||||
添加窗口功能的首选方法是在 `pkg/application/webview_window.go` 文件中添加一个新函数。这应该实现所有平台所需的功能。任何特定于平台的代码都应通过 `webviewWindowImpl` 接口方法调用。该接口由每个目标平台实现,以提供平台特定的功能。在某些情况下,这可能不执行任何操作。添加接口方法后,请确保每个平台都实现了它。一个很好的例子是 `SetMinSize` 方法。
|
||||
|
||||
- Mac: `webview_window_darwin.go`
|
||||
- Windows: `webview_window_windows.go`
|
||||
- Linux: `webview_window_linux.go`
|
||||
|
||||
大多数,如果不是全部,特定于平台的代码应在主线程上运行。为了简化这一点,在 `application.go` 中定义了一些 `invokeSync` 方法。
|
||||
|
||||
### 更新运行时
|
||||
|
||||
运行时位于 `v3/internal/runtime`。更新运行时时,需要执行以下步骤:
|
||||
|
||||
```shell
|
||||
wails3 task runtime:build
|
||||
```
|
||||
|
||||
### 事件
|
||||
|
||||
事件定义在 `v3/pkg/events` 中。当添加新事件时,需要执行以下步骤:
|
||||
|
||||
- 将事件添加到 `events.txt` 文件中
|
||||
- 运行 `wails3 task events:generate`
|
||||
|
||||
有几种类型的事件:特定于平台的应用程序和窗口事件 + 通用事件。通用事件对于跨平台事件处理很有用,但您不必局限于“最低公共分母”。如果需要,可以使用特定于平台的事件。
|
||||
|
||||
添加通用事件时,请确保映射了特定于平台的事件。一个示例是在 `window_webview_darwin.go` 中:
|
||||
|
||||
```go
|
||||
// 将 ShouldClose 转化为通用的 WindowClosing 事件
|
||||
w.parent.On(events.Mac.WindowShouldClose, func(_ *WindowEventContext) {
|
||||
w.parent.emit(events.Common.WindowClosing)
|
||||
})
|
||||
```
|
||||
|
||||
注意:我们可能会尝试通过将映射添加到事件定义中来自动化此过程。
|
||||
|
||||
### 插件
|
||||
|
||||
插件是扩展 Wails 应用功能的一种方式。
|
||||
|
||||
#### 创建插件
|
||||
|
||||
插件是符合以下接口的标准 Go 结构:
|
||||
|
||||
```go
|
||||
type Plugin interface {
|
||||
Name() string
|
||||
Init(*application.App) error
|
||||
Shutdown()
|
||||
CallableByJS() []string
|
||||
InjectJS() string
|
||||
}
|
||||
```
|
||||
|
||||
`Name()` 方法返回插件的名称。这用于日志记录。
|
||||
|
||||
`Init(*application.App) error` 方法在加载插件时调用。`*application.App` 参数是加载插件的应用程序。任何错误都将阻止应用程序启动。
|
||||
|
||||
`Shutdown()` 方法在应用程序关闭时调用。
|
||||
|
||||
`CallableByJS()` 方法返回可以从前端调用的导出函数列表。这些方法的名称必须与插件导出的方法的名称完全匹配。
|
||||
|
||||
`InjectJS()` 方法返回应注入到所有窗口中的 JavaScript。这对于添加与插件相补充的自定义 JavaScript 函数非常有用。
|
||||
|
||||
内置插件可以在 `v3/plugins` 目录中找到。参考它们以获得灵感。
|
||||
|
||||
## 任务
|
||||
|
||||
Wails CLI 使用 [Task](https://taskfile.dev) 构建系统。它作为库导入并用于运行 `Taskfile.yaml` 中定义的任务。与 Task 的主要交互发生在 `v3/internal/commands/task.go` 中。
|
||||
|
||||
### 升级 Taskfile
|
||||
|
||||
要检查是否有 Taskfile 的升级,请运行 `wails3 task -version` 并检查 Task 网站。
|
||||
|
||||
要升级使用的 Taskfile 版本,请运行:
|
||||
|
||||
```shell
|
||||
wails3 task taskfile:upgrade
|
||||
```
|
||||
|
||||
如果存在不兼容性,则应在 `v3/internal/commands/task.go` 文件中显示。
|
||||
|
||||
通常,修复不兼容性的最佳方法是克隆 `https://github.com/go-task/task` 上的任务存储库,并查看 git 历史记录以确定发生了什么变化以及原因。
|
||||
|
||||
要检查所有更改是否正确工作,请重新安装 CLI 并再次检查版本:
|
||||
|
||||
```shell
|
||||
wails3 task cli:install
|
||||
wails3 task -version
|
||||
```
|
||||
|
||||
## 打开 PR
|
||||
|
||||
确保所有 PR 都有与之关联的工单,以提供更改的上下文。如果没有工单,请先创建一个。确保所有 PR 都已使用所做的更改更新了 CHANGELOG.md 文件。CHANGELOG.md 文件位于 `mkdocs-website/docs` 目录中。
|
||||
|
||||
## 其他任务
|
||||
|
||||
### 升级 Taskfile
|
||||
|
||||
Wails CLI 使用 [Task](https://taskfile.dev) 构建系统。它作为库导入并用于运行 `Taskfile.yaml` 中定义的任务。与 Task 的主要交互发生在 `v3/internal/commands/task.go` 中。
|
||||
|
||||
要检查是否有 Taskfile 的升级,请运行 `wails3 task -version` 并检查 Task 网站。
|
||||
|
||||
要升级使用的 Taskfile 版本,请运行:
|
||||
|
||||
```shell
|
||||
wails3 task taskfile:upgrade
|
||||
```
|
||||
|
||||
如果存在不兼容性,则应在 `v3/internal/commands/task.go` 文件中显示。
|
||||
|
||||
通常,修复不兼容性的最佳方法是克隆 `https://github.com/go-task/task` 上的任务存储库,并查看 git 历史记录以确定发生了什么变化以及原因。
|
||||
|
||||
要检查所有更改是否正确工作,请重新安装 CLI 并再次检查版本:
|
||||
|
||||
```shell
|
||||
wails3 task cli:install
|
||||
wails3 task -version
|
||||
```
|
||||
378
mkdocs-website/docs/zh/development/status.md
Normal file
|
|
@ -0,0 +1,378 @@
|
|||
将以下文本翻译为中文,并不要翻译 `!!! note` 或 `!!! tip` 或以此格式的字符串:
|
||||
|
||||
# 状态
|
||||
|
||||
v3版功能的状态。
|
||||
|
||||
!!! note
|
||||
|
||||
此列表包含公有和内部API支持的混合内容。<br/>
|
||||
它不完整且可能不是最新的。
|
||||
|
||||
## 已知问题
|
||||
|
||||
- Linux尚未与Windows/Mac达到功能平衡
|
||||
|
||||
## 应用程序
|
||||
|
||||
应用程序接口方法
|
||||
|
||||
| 方法 | Windows | Linux | Mac | 备注 |
|
||||
|--------------------------------------------------------------|---------|-------|-----|-------|
|
||||
| run() error | Y | Y | Y | |
|
||||
| destroy() | | Y | Y | |
|
||||
| setApplicationMenu(menu *Menu) | Y | Y | Y | |
|
||||
| name() string | | Y | Y | |
|
||||
| getCurrentWindowID() uint | Y | Y | Y | |
|
||||
| showAboutDialog(name string, description string, icon []byte) | | Y | Y | |
|
||||
| setIcon(icon []byte) | - | Y | Y | |
|
||||
| on(id uint) | | | Y | |
|
||||
| dispatchOnMainThread(fn func()) | Y | Y | Y | |
|
||||
| hide() | Y | Y | Y | |
|
||||
| show() | Y | Y | Y | |
|
||||
| getPrimaryScreen() (*Screen, error) | | Y | Y | |
|
||||
| getScreens() ([]*Screen, error) | | Y | Y | |
|
||||
|
||||
## Webview 窗口
|
||||
|
||||
Webview 窗口接口方法
|
||||
|
||||
| 方法 | Windows | Linux | Mac | 备注 |
|
||||
|--------------------------------------------------|---------|-------|-----|-----------------------------------------|
|
||||
| center() | Y | Y | Y | |
|
||||
| close() | y | Y | Y | |
|
||||
| destroy() | | Y | Y | |
|
||||
| execJS(js string) | y | Y | Y | |
|
||||
| focus() | Y | Y | | |
|
||||
| forceReload() | | Y | Y | |
|
||||
| fullscreen() | Y | Y | Y | |
|
||||
| getScreen() (*Screen, error) | y | Y | Y | |
|
||||
| getZoom() float64 | | Y | Y | |
|
||||
| height() int | Y | Y | Y | |
|
||||
| hide() | Y | Y | Y | |
|
||||
| isFullscreen() bool | Y | Y | Y | |
|
||||
| isMaximised() bool | Y | Y | Y | |
|
||||
| isMinimised() bool | Y | Y | Y | |
|
||||
| maximise() | Y | Y | Y | |
|
||||
| minimise() | Y | Y | Y | |
|
||||
| nativeWindowHandle() (uintptr, error) | Y | Y | | |
|
||||
| on(eventID uint) | y | | Y | |
|
||||
| openContextMenu(menu *Menu, data *ContextMenuData) | y | | Y | |
|
||||
| relativePosition() (int, int) | Y | Y | Y | |
|
||||
| reload() | y | Y | Y | |
|
||||
| run() | Y | Y | Y | |
|
||||
| setAlwaysOnTop(alwaysOnTop bool) | Y | Y | Y | |
|
||||
| setBackgroundColour(color RGBA) | Y | Y | Y | |
|
||||
| setEnabled(bool) | | Y | Y | |
|
||||
| setFrameless(bool) | | Y | Y | |
|
||||
| setFullscreenButtonEnabled(enabled bool) | - | Y | Y | Windows 没有全屏按钮 |
|
||||
| setHTML(html string) | Y | Y | Y | |
|
||||
| setMaxSize(width, height int) | Y | Y | Y | |
|
||||
| setMinSize(width, height int) | Y | Y | Y | |
|
||||
| setRelativePosition(x int, y int) | Y | Y | Y | |
|
||||
| setResizable(resizable bool) | Y | Y | Y | |
|
||||
| setSize(width, height int) | Y | Y | Y | |
|
||||
| setTitle(title string) | Y | Y | Y | |
|
||||
| setURL(url string) | Y | Y | Y | |
|
||||
| setZoom(zoom float64) | Y | Y | Y | |
|
||||
| show() | Y | Y | Y | |
|
||||
| size() (int, int) | Y | Y | Y | |
|
||||
| toggleDevTools() | Y | Y | Y | |
|
||||
| unfullscreen() | Y | Y | Y | |
|
||||
| unmaximise() | Y | Y | Y | |
|
||||
| unminimise() | Y | Y | Y | |
|
||||
| width() int | Y | Y | Y | |
|
||||
| zoom() | | Y | Y | |
|
||||
| zoomIn() | Y | Y | Y | |
|
||||
| zoomOut() | Y | Y | Y | |
|
||||
| zoomReset() | Y | Y | Y | |
|
||||
|
||||
## 运行时
|
||||
|
||||
### 应用程序
|
||||
|
||||
| 功能 | Windows | Linux | Mac | 备注 |
|
||||
|-------|---------|-------|-----|-------|
|
||||
| 退出 | Y | Y | Y | |
|
||||
| 隐藏 | Y | | Y | |
|
||||
| 显示 | Y | | Y | |
|
||||
|
||||
### 对话框
|
||||
|
||||
| 功能 | Windows | Linux | Mac | 备注 |
|
||||
|------------|---------|-------|-----|-------|
|
||||
| 信息 | Y | Y | Y | |
|
||||
| 警告 | Y | Y | Y | |
|
||||
| 错误 | Y | Y | Y | |
|
||||
| 问题 | Y | Y | Y | |
|
||||
| 打开文件 | Y | | Y | |
|
||||
| 保存文件 | Y | | Y | |
|
||||
|
||||
### 剪贴板
|
||||
|
||||
| 功能 | Windows | Linux | Mac | 备注 |
|
||||
|--------|---------|-------|-----|-------|
|
||||
| 设置文本 | Y | | Y | |
|
||||
| 文本 | Y | | Y | |
|
||||
|
||||
### 上下文菜单
|
||||
|
||||
| 功能 | Windows | Linux | Mac | 备注 |
|
||||
|----------------------|---------|-------|-----|-------|
|
||||
| 打开上下文菜单 | Y | | Y | |
|
||||
| 默认开启 | | | | |
|
||||
| 通过 HTML 控制 | Y | | | |
|
||||
|
||||
默认上下文菜单默认对所有`contentEditable: true`、`<input>`或`<textarea>`标签的元素或具有`--default-contextmenu: true`样式的元素启用。`--default-contextmenu: show`样式将始终显示上下文菜单。`--default-contextmenu: hide`样式将始终隐藏上下文菜单。
|
||||
|
||||
嵌套在带有`--default-contextmenu: hide`样式的标签下的任何内容,除非使用`--default-contextmenu: show`进行显式设置,否则不会显示上下文菜单。
|
||||
|
||||
### 屏幕
|
||||
|
||||
| 功能 | Windows | Linux | Mac | 备注 |
|
||||
|--------------|---------|-------|-----|-------|
|
||||
| 获取所有 | Y | Y | Y | |
|
||||
| 获取主屏幕 | Y | Y | Y | |
|
||||
| 获取当前屏幕 | Y | Y | Y | |
|
||||
|
||||
### 系统
|
||||
|
||||
| 功能 | Windows | Linux | Mac | 备注 |
|
||||
|--------------|---------|-------|-----|-------|
|
||||
| 是否为暗模式 | | | Y | |
|
||||
|
||||
### 窗口
|
||||
|
||||
Y = 支持 U = 未经测试
|
||||
|
||||
- = 不可用
|
||||
|
||||
| 功能 | Windows | Linux | Mac | 备注 |
|
||||
|----------------------|---------|-------|-----|--------------------------------------------------------------------------------------|
|
||||
| 居中 | Y | Y | Y | |
|
||||
| 获得焦点 | Y | Y | | |
|
||||
| 全屏 | Y | Y | Y | |
|
||||
| 获得缩放比例 | Y | Y | Y | 获取当前视图比例 |
|
||||
| 高度 | Y | Y | Y | |
|
||||
| 隐藏 | Y | Y | Y | |
|
||||
| 最大化 | Y | Y | Y | |
|
||||
| 最小化 | Y | Y | Y | |
|
||||
| 相对位置 | Y | Y | Y | |
|
||||
| 屏幕 | Y | Y | Y | 获取窗口的屏幕 |
|
||||
| 设置始终在顶部 | Y | Y | Y | |
|
||||
| 设置背景颜色 | Y | Y | Y | https://github.com/MicrosoftEdge/WebView2Feedback/issues/1621#issuecomment-938234294 |
|
||||
| 设置启用状态 | Y | U | - | 设置窗口是否可用 |
|
||||
| 设置最大尺寸 | Y | Y | Y | |
|
||||
| 设置最小尺寸 | Y | Y | Y | |
|
||||
| 设置相对位置 | Y | Y | Y | |
|
||||
| 设置是否可调整大小 | Y | Y | Y | |
|
||||
| 设置大小 | Y | Y | Y | |
|
||||
| 设置标题 | Y | Y | Y | |
|
||||
| 设置缩放比例 | Y | Y | Y | 设置视图比例 |
|
||||
| 显示 | Y | Y | Y | |
|
||||
| 尺寸 | Y | Y | Y | |
|
||||
| 取消全屏 | Y | Y | Y | |
|
||||
| 取消最大化 | Y | Y | Y | |
|
||||
| 取消最小化 | Y | Y | Y | |
|
||||
| 宽度 | Y | Y | Y | |
|
||||
| 缩放 | | Y | Y | |
|
||||
| 放大 | Y | Y | Y | 增加视图比例 |
|
||||
| 缩小 | Y | Y | Y | 减小视图比例 |
|
||||
| 重置缩放 | Y | Y | Y | 重置视图比例 |
|
||||
|
||||
### 窗口选项
|
||||
|
||||
下表中的'Y'表示已经测试并且在窗口创建时应用了该选项。'X'表示该平台不支持该选项。
|
||||
|
||||
| 功能 | Windows | Linux | Mac | 备注 |
|
||||
|--------------------------------|---------|-------|-----|-------------------------------------------|
|
||||
| 始终在顶部 | Y | | | |
|
||||
| 背景颜色 | Y | Y | | |
|
||||
| 背景类型 | | | | 默认情况下,亚克力效果有效,其他无效 |
|
||||
| CSS | Y | Y | | |
|
||||
| DevToolsEnabled | Y | Y | Y | |
|
||||
| DisableResize | Y | Y | | |
|
||||
| 启用拖放 | | Y | | |
|
||||
| 启用欺诈网站警告 | | | | |
|
||||
| 获得焦点 | Y | Y | | |
|
||||
| 无边框 | Y | Y | | |
|
||||
| 启用全屏按钮 | Y | | | Windows上没有全屏按钮 |
|
||||
| HTML | Y | Y | | |
|
||||
| JS | Y | Y | | |
|
||||
| Mac | - | - | | |
|
||||
| 最大高度 | Y | Y | | |
|
||||
| 最大宽度 | Y | Y | | |
|
||||
| 最小高度 | Y | Y | | |
|
||||
| 最小宽度 | Y | Y | | |
|
||||
| 名称 | Y | Y | | |
|
||||
| 启动时打开检查器 | | | | |
|
||||
| 启动状态 | Y | | | |
|
||||
| 标题 | Y | Y | | |
|
||||
| URL | Y | Y | | |
|
||||
| 宽度 | Y | Y | | |
|
||||
| Windows | Y | - | - | |
|
||||
| X | Y | Y | | |
|
||||
| Y | Y | Y | | |
|
||||
| 缩放 | | | | |
|
||||
| 启用缩放控件 | | | | |
|
||||
|
||||
### 日志
|
||||
|
||||
要记录还是不要记录?系统日志器与自定义日志器。
|
||||
|
||||
## 菜单
|
||||
|
||||
| 事件 | Windows | Linux | Mac | 备注 |
|
||||
|-------------------------|---------|-------|-----|-------|
|
||||
| 默认应用程序菜单 | Y | Y | Y | |
|
||||
|
||||
## 托盘菜单
|
||||
|
||||
| 功能 | Windows | Linux | Mac | 备注 |
|
||||
|-------------------|---------|-------|-----|-------|
|
||||
| 图标 | Y | | Y | Windows具有默认的浅色/深色模式图标并支持PNG或ICO。 |
|
||||
| 标签 | - | | Y | |
|
||||
| 标签(ANSI码) | - | | | |
|
||||
| 菜单 | Y | | Y | |
|
||||
|
||||
### 方法
|
||||
|
||||
| 方法 | Windows | Linux | Mac | 备注 |
|
||||
|-----------------------------|---------|-------|-----|-------|
|
||||
| setLabel(label string) | - | | Y | |
|
||||
| run() | Y | | Y | |
|
||||
| setIcon(icon []byte) | Y | | Y | |
|
||||
| setMenu(menu *Menu) | Y | | Y | |
|
||||
| setIconPosition(position int) | - | | Y | |
|
||||
| setTemplateIcon(icon []byte) | - | | Y | |
|
||||
| destroy() | Y | | Y | |
|
||||
| setDarkModeIcon(icon []byte) | Y | | Y | |
|
||||
|
||||
## 跨平台事件
|
||||
|
||||
将本机事件映射到跨平台事件。
|
||||
|
||||
| 事件 | Windows | Linux | Mac | 备注 |
|
||||
|--------------------------|---------|-------|-----------------|-------|
|
||||
| WindowWillClose | | | WindowWillClose | |
|
||||
| WindowDidClose | | | | |
|
||||
| WindowDidResize | | | | |
|
||||
| WindowDidHide | | | | |
|
||||
| ApplicationWillTerminate | | | | |
|
||||
|
||||
... 添加更多
|
||||
|
||||
## 绑定生成
|
||||
|
||||
工作正常。
|
||||
|
||||
## 模型生成
|
||||
|
||||
工作正常。
|
||||
|
||||
## 任务文件
|
||||
|
||||
包含很多开发所需的内容。
|
||||
|
||||
## 主题
|
||||
|
||||
| 模式 | Windows | Linux | Mac | 备注 |
|
||||
|--------|---------|-------|-----|-------|
|
||||
| 暗 | Y | | | |
|
||||
| 亮 | Y | | | |
|
||||
| 系统 | Y | | | |
|
||||
|
||||
## NSIS安装程序
|
||||
|
||||
待定
|
||||
|
||||
## 模板
|
||||
|
||||
所有模板都可用。
|
||||
|
||||
## 插件
|
||||
|
||||
内置插件支持:
|
||||
|
||||
| 插件 | Windows | Linux | Mac | 备注 |
|
||||
|---------------|---------|-------|-----|-------|
|
||||
| 浏览器 | Y | | Y | |
|
||||
| KV 存储 | Y | Y | Y | |
|
||||
| 日志 | Y | Y | Y | |
|
||||
| 单实例 | Y | | Y | |
|
||||
| SQLite | Y | Y | Y | |
|
||||
| 开机自启动 | Y | | Y | |
|
||||
| 服务器 | | | | |
|
||||
|
||||
待办事项:
|
||||
|
||||
- 确保每个插件都有一个可以注入到窗口中的JS包装器。
|
||||
|
||||
## 打包
|
||||
|
||||
| | Windows | Linux | Mac | 备注 |
|
||||
|-----------------|---------|-------|-----|-------|
|
||||
| 图标生成 | Y | | Y | |
|
||||
| 图标嵌入 | Y | | Y | |
|
||||
| Info.plist | - | | Y | |
|
||||
| NSIS 安装程序 | | | - | |
|
||||
| Mac 包 | - | | Y | |
|
||||
| Windows 可执行文件 | Y | | - | |
|
||||
|
||||
## 无边框窗口
|
||||
|
||||
| 功能 | Windows | Linux | Mac | 备注 |
|
||||
|---------|---------|-------|-----|-------|
|
||||
| 调整大小 | Y | | Y | |
|
||||
| 拖拽 | Y | Y | Y | Linux-始终可以使用 `Meta`+左键拖拽 |
|
||||
|
||||
|
||||
## Mac 特定
|
||||
|
||||
- [x] 半透明
|
||||
|
||||
### Mac 选项
|
||||
|
||||
| 功能 | 默认值 | 备注 |
|
||||
|---------------|------------------|-----------------------------------------------------|
|
||||
| 背景 | MacBackdropNormal | 标准的实心窗口 |
|
||||
| 禁用阴影 | false | |
|
||||
| 标题栏 | | 默认情况下使用标准的窗口装饰 |
|
||||
| 外观 | DefaultAppearance | |
|
||||
| 隐藏标题栏高度 | 0 | 为无边框窗口创建一个不可见的标题栏 |
|
||||
| 禁用阴影 | false | 禁用窗口投影阴影 |
|
||||
|
||||
## Windows 特定
|
||||
|
||||
- [x] 半透明
|
||||
- [x] 自定义主题
|
||||
|
||||
### Windows 选项
|
||||
|
||||
| 功能 | 默认值 | 备注 |
|
||||
|--------------------------------|----------------|--------------------------------------------|
|
||||
| 背景类型 | Solid | |
|
||||
| 禁用图标 | false | |
|
||||
| 主题 | SystemDefault | |
|
||||
| 自定义主题 | nil | |
|
||||
| 禁用无边框窗口装饰 | false | |
|
||||
| 窗口遮罩 | nil | 使窗口成为位图的内容 |
|
||||
|
||||
## Linux 特定
|
||||
|
||||
由`*_linux.go`文件使用的函数的实现详细信息位于以下文件中:
|
||||
|
||||
- linux_cgo.go:CGo 实现
|
||||
- linux_purego.go:PureGo 实现
|
||||
|
||||
### CGO
|
||||
|
||||
默认情况下,使用 CGO 编译 Linux 端口。这会阻止轻松的交叉编译,因此同时也正在同时开发 PureGo 实现。
|
||||
|
||||
### Purego
|
||||
|
||||
可以使用以下命令编译示例:
|
||||
|
||||
CGO_ENABLED=0 go build -tags purego
|
||||
|
||||
注意:重构之后的功能目前无法正常工作。
|
||||
58
mkdocs-website/docs/zh/getting-started/feedback.md
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
# 反馈
|
||||
|
||||
我们欢迎(并鼓励)您的反馈!在创建新的反馈之前,请先搜索现有的票据或帖子。
|
||||
以下是提供反馈的不同方式:
|
||||
|
||||
=== "错误"
|
||||
|
||||
如果您发现错误,请在Discord的[v3 Alpha Feedback](https://discord.gg/3mgVyGua)频道中发布信息:
|
||||
|
||||
- 帖子应清楚地说明错误所在,并提供一个简单的可重现示例。如果文档不清楚应该发生什么,请在帖子中说明。
|
||||
- 帖子应标记为`Bug`。
|
||||
- 请在帖子中包含`wails doctor`的输出。
|
||||
- 请记住,意外行为不一定是错误-它可能只是不符合您的期望。请使用[建议](#suggestions)。
|
||||
|
||||
=== "修复"
|
||||
|
||||
如果您有一个错误的修复或文档的更新,请执行以下操作:
|
||||
|
||||
- 在[Wails存储库](https://github.com/wailsapp/wails)上创建一个拉取请求。PR的标题应以`[v3 alpha]`开头。
|
||||
- 在[v3 Alpha Feedback](https://discord.gg/3mgVyGua)频道中发布帖子。
|
||||
- 帖子应标记为`PR`。
|
||||
- 请在帖子中包含PR的链接。
|
||||
|
||||
=== "建议"
|
||||
|
||||
如果您有建议,请在Discord的[v3 Alpha Feedback](https://discord.gg/3mgVyGua)频道中发布信息:
|
||||
|
||||
- 帖子应标记为`Suggestion`。
|
||||
|
||||
如果您有任何问题,请随时在[Discord](https://discord.gg/3mgVyGua)上联系我们。
|
||||
|
||||
=== "投票"
|
||||
|
||||
- 可以使用:thumbsup:表情符号给帖子投票。请对您认为优先级较高的帖子进行投票。
|
||||
- 请*不要*只添加"+1"或"me too"等评论。
|
||||
- 如果帖子还有更多内容可补充,请随时发表评论,例如"此错误也影响ARM构建"或"另一种选项是......"
|
||||
|
||||
已知问题和正在进行的工作列表可以在[此处](https://github.com/orgs/wailsapp/projects/6)找到。
|
||||
|
||||
## 我们寻求反馈的内容
|
||||
|
||||
- API
|
||||
- 使用起来方便吗?
|
||||
- 它是否按照您的期望工作?
|
||||
- 有什么遗漏的功能吗?
|
||||
- 应该删除什么?
|
||||
- Go和JS之间是否一致?
|
||||
- 构建系统
|
||||
- 使用起来方便吗?
|
||||
- 我们能改进吗?
|
||||
- 示例
|
||||
- 是否清晰?
|
||||
- 是否涵盖了基础知识?
|
||||
- 功能
|
||||
- 哪些功能缺失?
|
||||
- 哪些功能是不需要的?
|
||||
- 文档
|
||||
- 有什么可以更清晰的地方?
|
||||
76
mkdocs-website/docs/zh/getting-started/installation.md
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
# 安装
|
||||
|
||||
要安装Wails CLI,请确保已经安装[Go 1.21+](https://go.dev/dl/)并运行以下命令:
|
||||
|
||||
```shell
|
||||
git clone https://github.com/wailsapp/wails.git
|
||||
cd wails
|
||||
git checkout v3-alpha
|
||||
cd v3/cmd/wails3
|
||||
go install
|
||||
```
|
||||
|
||||
## 支持的平台
|
||||
|
||||
- Windows 10/11 AMD64/ARM64
|
||||
- MacOS 10.13+ AMD64
|
||||
- MacOS 11.0+ ARM64
|
||||
- Ubuntu 22.04 AMD64/ARM64(其他Linux可能也可以工作!)
|
||||
|
||||
## 依赖项
|
||||
|
||||
在安装之前,Wails有一些常见的依赖项需要安装:
|
||||
|
||||
=== "Go 1.21+"
|
||||
|
||||
从[Go下载页面](https://go.dev/dl/)下载Go。
|
||||
|
||||
确保按照官方的[Go安装指南](https://go.dev/doc/install)进行操作。您还需要确保您的`PATH`环境变量中包含`~/go/bin`目录的路径。重新启动终端并进行以下检查:
|
||||
|
||||
- 检查Go是否已正确安装:`go version`
|
||||
- 检查`~/go/bin`是否在您的PATH变量中:`echo $PATH | grep go/bin`
|
||||
|
||||
=== "npm(可选)"
|
||||
|
||||
虽然Wails不需要安装npm,但如果您想使用捆绑的模板,则需要安装npm。
|
||||
|
||||
从[Node下载页面](https://nodejs.org/en/download/)下载最新的node安装程序。最好使用最新的版本,因为这是我们通常进行测试的版本。
|
||||
|
||||
运行`npm --version`进行验证。
|
||||
|
||||
=== "Task(可选)"
|
||||
|
||||
Wails CLI嵌入了一个名为[Task](https://taskfile.dev/#/installation)的任务运行器。这是可选的,但建议安装。如果您不想安装Task,可以使用`wails3 task`命令代替`task`。
|
||||
安装Task将给您最大的灵活性。
|
||||
|
||||
## 平台特定的依赖项
|
||||
|
||||
您还需要安装特定于平台的依赖项:
|
||||
|
||||
=== "Mac"
|
||||
|
||||
Wails要求安装xcode命令行工具。可以通过运行以下命令来完成:
|
||||
|
||||
```
|
||||
xcode-select --install
|
||||
```
|
||||
|
||||
=== "Windows"
|
||||
|
||||
Wails要求安装[WebView2 Runtime](https://developer.microsoft.com/en-us/microsoft-edge/webview2/)。一些Windows安装可能已经安装了此软件。您可以使用`wails doctor`命令检查。
|
||||
|
||||
=== "Linux"
|
||||
|
||||
Linux需要标准的`gcc`构建工具以及`libgtk3`和`libwebkit`。而不是列出不同发行版的大量命令,Wails可以尝试确定您特定发行版的安装命令。安装后运行<code>wails doctor</code>,将显示如何安装依赖项。如果您的发行版/软件包管理器不受支持,请在discord上告诉我们。
|
||||
|
||||
## 系统检查
|
||||
|
||||
运行`wails3 doctor`将检查您是否安装了正确的依赖项。如果没有安装,它将提供缺失的内容,并帮助您解决任何问题。
|
||||
|
||||
## 看起来缺少`wails3`命令?
|
||||
|
||||
如果系统报告缺少`wails3`命令,请检查以下内容:
|
||||
|
||||
- 确保您已正确按照Go安装指南进行操作。
|
||||
- 检查`go/bin`目录是否在`PATH`环境变量中。
|
||||
- 关闭/重新打开当前终端以使用新的`PATH`变量。
|
||||
32
mkdocs-website/docs/zh/getting-started/next-steps.md
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# 下一步
|
||||
|
||||
现在您已经安装了Wails,可以开始探索alpha版本。
|
||||
|
||||
最好的起点是Wails存储库中的`examples`目录。
|
||||
其中包含了一些可以运行和玩耍的示例。
|
||||
|
||||
## 运行示例
|
||||
|
||||
要运行示例,您可以简单地使用:
|
||||
|
||||
```shell
|
||||
go run .
|
||||
```
|
||||
|
||||
在示例目录中。
|
||||
|
||||
示例的状态在[路线图](../roadmap.md)中说明。
|
||||
|
||||
## 创建新项目
|
||||
|
||||
要创建新项目,可以使用`wails3 init`命令。这将在当前目录中创建一个新项目。
|
||||
|
||||
Wails3默认使用[Task](https://taskfile.dev)作为其构建系统,尽管您可以使用自己的构建系统,或直接使用`go build`。Wails内置了任务构建系统,可以使用`wails3 task`运行。
|
||||
|
||||
如果查看`Taskfile.yaml`文件,您会看到有一些任务被定义。最重要的任务是`build`任务。这是在使用`wails3 build`时运行的任务。
|
||||
|
||||
任务文件可能不完整,并且可能会随时间变化而改变。
|
||||
|
||||
## 构建项目
|
||||
|
||||
要构建项目,可以使用`wails3 build`命令。这是`wails3 task build`的快捷方式。
|
||||
4
mkdocs-website/docs/zh/index.md
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
---
|
||||
template: home.zh.html
|
||||
---
|
||||
欢迎来到 Wails 项目
|
||||
49
mkdocs-website/docs/zh/roadmap.md
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
# 路线图
|
||||
|
||||
路线图是一个活动文档,可能会有所变动。如果您有任何建议,请提出一个问题。
|
||||
每个里程碑都会有一系列我们力争实现的目标。这些目标可能会有所变动。
|
||||
|
||||
## Alpha 里程碑
|
||||
|
||||
### Alpha 1
|
||||
|
||||
#### 目标
|
||||
|
||||
Alpha 1 是最初的发布版本。旨在收集关于新 API 的反馈,并让人们进行实验。
|
||||
主要目标是使大多数示例在所有平台上都能正常工作。
|
||||
|
||||
#### 状态
|
||||
|
||||
- W - 工作正常
|
||||
- P - 部分工作
|
||||
- N - 无法工作
|
||||
|
||||
| 示例 | Mac | Windows | Linux |
|
||||
|---------------|-----|---------|-------|
|
||||
| binding | W | W | |
|
||||
| build | W | W | |
|
||||
| clipboard | W | W | |
|
||||
| context menus | W | W | |
|
||||
| dialogs | P | W | |
|
||||
| drag-n-drop | W | N | |
|
||||
| events | W | W | |
|
||||
| frameless | W | W | |
|
||||
| keybindings | W | W | |
|
||||
| plain | W | W | |
|
||||
| screen | W | W | |
|
||||
| systray | W | W | |
|
||||
| video | | W | |
|
||||
| window | P | W | |
|
||||
| wml | W | W | |
|
||||
|
||||
- Mac 上的 Dialogs 可以工作,但是文件对话框会发出一个需要解决的警告。
|
||||
|
||||
#### TODO:
|
||||
|
||||
- [ ] 修复 Mac 上的 `+[CATransaction synchronize] called within transaction` 警告
|
||||
- [ ] 隐藏窗口时,应用程序终止
|
||||
|
||||
### Alpha 2
|
||||
|
||||
- [ ] 在 Linux 上使大多数示例正常工作
|
||||
- [ ] 通过 `wails init` 创建项目
|
||||
317
mkdocs-website/docs/zh/whats-new.md
Normal file
|
|
@ -0,0 +1,317 @@
|
|||
# v3有哪些新功能?
|
||||
|
||||
!!! note
|
||||
v3版本中将包含的功能可能会有所更改。
|
||||
|
||||
## 多窗口
|
||||
|
||||
现在可以创建多个窗口,并对每个窗口进行独立配置。
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"log"
|
||||
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
)
|
||||
|
||||
//go:embed assets/*
|
||||
var assets embed.FS
|
||||
|
||||
func main() {
|
||||
|
||||
app := application.New(application.Options{
|
||||
Name: "多窗口演示",
|
||||
Assets: application.AssetOptions{
|
||||
FS: assets,
|
||||
},
|
||||
})
|
||||
|
||||
window1 := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
|
||||
Title: "窗口1",
|
||||
})
|
||||
|
||||
window2 := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
|
||||
Title: "窗口2",
|
||||
})
|
||||
|
||||
// 从embed.FS加载嵌入的html
|
||||
window1.SetURL("/")
|
||||
window1.Center()
|
||||
|
||||
// 加载外部URL
|
||||
window2.SetURL("https://wails.app")
|
||||
|
||||
err := app.Run()
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## 系统托盘
|
||||
|
||||
系统托盘允许您在桌面的系统托盘区域添加一个图标,并具有以下功能:
|
||||
|
||||
- 附加窗口(窗口将居中于系统托盘图标)
|
||||
- 完整的菜单支持
|
||||
- 亮/暗模式图标
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"log"
|
||||
"runtime"
|
||||
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
"github.com/wailsapp/wails/v3/pkg/icons"
|
||||
)
|
||||
|
||||
func main() {
|
||||
app := application.New(application.Options{
|
||||
Name: "系统托盘演示",
|
||||
Mac: application.MacOptions{
|
||||
ActivationPolicy: application.ActivationPolicyAccessory,
|
||||
},
|
||||
})
|
||||
|
||||
window := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
|
||||
Width: 500,
|
||||
Height: 800,
|
||||
Frameless: true,
|
||||
AlwaysOnTop: true,
|
||||
Hidden: true,
|
||||
Windows: application.WindowsWindow{
|
||||
HiddenOnTaskbar: true,
|
||||
},
|
||||
})
|
||||
|
||||
systemTray := app.NewSystemTray()
|
||||
|
||||
// macOS上的模板图标支持
|
||||
if runtime.GOOS == "darwin" {
|
||||
systemTray.SetTemplateIcon(icons.SystrayMacTemplate)
|
||||
} else {
|
||||
// 亮/暗模式图标支持
|
||||
systemTray.SetDarkModeIcon(icons.SystrayDark)
|
||||
systemTray.SetIcon(icons.SystrayLight)
|
||||
}
|
||||
|
||||
// 菜单支持
|
||||
myMenu := app.NewMenu()
|
||||
myMenu.Add("Hello World!").OnClick(func(_ *application.Context) {
|
||||
println("Hello World!")
|
||||
})
|
||||
systemTray.SetMenu(myMenu)
|
||||
|
||||
// 这将使窗口居中于系统托盘图标,偏移量为5px
|
||||
// 单击系统托盘图标时,它将自动显示
|
||||
// 当窗口失去焦点时隐藏
|
||||
systemTray.AttachWindow(window).WindowOffset(5)
|
||||
|
||||
err := app.Run()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## 插件
|
||||
|
||||
插件允许您扩展Wails系统的功能。不仅可以在Go中使用插件方法,还可以从Javascript中调用插件方法。包含的插件有:
|
||||
|
||||
- kvstore - 键/值存储
|
||||
- browser - 在浏览器中打开链接
|
||||
- log - 自定义日志记录器
|
||||
- oauth - 处理OAuth身份验证并支持60个提供商
|
||||
- single_instance - 仅允许运行一个应用程序副本
|
||||
- sqlite - 向应用程序添加SQLite数据库。使用现代纯Go库
|
||||
- start_at_login - 注册/注销应用程序以在登录时启动
|
||||
|
||||
## 改进的绑定生成
|
||||
|
||||
v3使用新的静态分析器生成绑定。这使得生成绑定非常快速,并保留了绑定中的注释和参数名称。默认情况下,绑定使用ID而不是字符串进行调用。这提供了性能提升,并允许使用混淆工具,如[garble](https://github.com/burrowers/garble)。
|
||||
|
||||
通过在项目目录中运行 `wails3 generate bindings` 来生成绑定。
|
||||
|
||||
```js
|
||||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
import { main } from "./models";
|
||||
|
||||
window.go = window.go || {};
|
||||
window.go.main = {
|
||||
GreetService: {
|
||||
/**
|
||||
* GreetService.Greet
|
||||
* Greet greets a person
|
||||
* @param name {string}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
Greet: function (name) {
|
||||
wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0));
|
||||
},
|
||||
|
||||
/**
|
||||
* GreetService.GreetPerson
|
||||
* GreetPerson greets a person
|
||||
* @param person {main.Person}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
GreetPerson: function (person) {
|
||||
wails.CallByID(4021313248, ...Array.prototype.slice.call(arguments, 0));
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
|
||||
## 改进的构建系统
|
||||
|
||||
在v2中,构建系统完全不透明且难以自定义。在v3中,可以使用标准的Go工具构建所有内容。
|
||||
|
||||
v2构建系统完成的所有繁重工作,例如图标生成,已作为CLI中的工具命令添加。我们将[Taskfile](https://taskfile.dev)整合到CLI中,以协调这些调用,以带来与v2相同的开发人员体验。然而,这种方法在灵活性和易用性之间达到了最佳平衡,因为现在您可以根据需要自定义构建过程。
|
||||
|
||||
您甚至可以使用make,如果那是您的菜!
|
||||
|
||||
```yaml title="来自Taskfile.yml的片段"
|
||||
build:darwin:
|
||||
summary: 构建应用程序
|
||||
platforms:
|
||||
- darwin
|
||||
cmds:
|
||||
- task: pre-build
|
||||
- task: build-frontend
|
||||
- go build -gcflags=all="-N -l" -o bin/{{.APP_NAME}}
|
||||
- task: post-build
|
||||
env:
|
||||
CGO_CFLAGS: "-mmacosx-version-min=10.13"
|
||||
CGO_LDFLAGS: "-mmacosx-version-min=10.13"
|
||||
MACOSX_DEPLOYMENT_TARGET: "10.13"
|
||||
```
|
||||
|
||||
## 改进的事件
|
||||
|
||||
现在为许多运行时操作发出事件,允许您挂钩应用程序/系统事件。在存在常见平台事件的地方,还发出了跨平台(通用)事件,允许您在跨平台上编写相同的事件处理方法。
|
||||
|
||||
还可以注册事件钩子。这些钩子类似于`On`方法,但是是同步的,并允许您取消事件。例如,在关闭窗口之前显示确认对话框的示例。
|
||||
|
||||
```go
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"log"
|
||||
"time"
|
||||
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
"github.com/wailsapp/wails/v3/pkg/events"
|
||||
)
|
||||
|
||||
//go:embed assets
|
||||
var assets embed.FS
|
||||
|
||||
func main() {
|
||||
|
||||
app := application.New(application.Options{
|
||||
Name: "Events Demo",
|
||||
Description: "Events API演示",
|
||||
Assets: application.AssetOptions{
|
||||
FS: assets,
|
||||
},
|
||||
Mac: application.MacOptions{
|
||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||
},
|
||||
})
|
||||
|
||||
// 自定义事件处理
|
||||
app.Events.On("myevent", func(e *application.WailsEvent) {
|
||||
log.Printf("[Go] 收到WailsEvent事件: %+v\n", e)
|
||||
})
|
||||
|
||||
// 特定于操作系统的应用程序事件
|
||||
app.On(events.Mac.ApplicationDidFinishLaunching, func(event *application.Event) {
|
||||
println("events.Mac.ApplicationDidFinishLaunching触发!")
|
||||
})
|
||||
|
||||
// 平台无关事件
|
||||
app.On(events.Common.ApplicationStarted, func(event *application.Event) {
|
||||
println("events.Common.ApplicationStarted触发!")
|
||||
})
|
||||
|
||||
win1 := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
|
||||
Title: "关闭我需要3次确认!",
|
||||
})
|
||||
|
||||
var countdown = 3
|
||||
|
||||
// 注册钩子以取消窗口关闭
|
||||
win1.RegisterHook(events.Common.WindowClosing, func(e *application.WindowEvent) {
|
||||
countdown--
|
||||
if countdown == 0 {
|
||||
println("关闭!")
|
||||
return
|
||||
}
|
||||
println("不行!不关闭!")
|
||||
e.Cancel()
|
||||
})
|
||||
|
||||
win1.On(events.Common.WindowFocus, func(e *application.WindowEvent) {
|
||||
println("[事件] 窗口焦点!")
|
||||
})
|
||||
|
||||
err := app.Run()
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
## Wails标记语言(wml)
|
||||
|
||||
一种实验性的功能,使用纯HTML调用运行时方法,类似于[htmx](https://htmx.org)。
|
||||
|
||||
```html
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Wails ML演示</title>
|
||||
</head>
|
||||
<body style="margin-top:50px; color: white; background-color: #191919">
|
||||
<h2>Wails ML演示</h2>
|
||||
<p>此应用程序不包含任何Javascript!</p>
|
||||
<button wml-event="button-pressed">按我!</button>
|
||||
<button wml-event="delete-things" wml-confirm="确定吗?">
|
||||
删除所有内容!
|
||||
</button>
|
||||
<button wml-window="Close" wml-confirm="确定吗?">
|
||||
关闭窗口?
|
||||
</button>
|
||||
<button wml-window="Center">居中</button>
|
||||
<button wml-window="Minimise">最小化</button>
|
||||
<button wml-window="Maximise">最大化</button>
|
||||
<button wml-window="UnMaximise">取消最大化</button>
|
||||
<button wml-window="Fullscreen">全屏</button>
|
||||
<button wml-window="UnFullscreen">取消全屏</button>
|
||||
<button wml-window="Restore">还原</button>
|
||||
<div
|
||||
style="width: 200px; height: 200px; border: 2px solid white;"
|
||||
wml-event="hover"
|
||||
wml-trigger="mouseover"
|
||||
>
|
||||
悬停在我上面
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
57
mkdocs-website/generate/generate.go
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"go/build"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/princjef/gomarkdoc"
|
||||
"github.com/princjef/gomarkdoc/lang"
|
||||
"github.com/princjef/gomarkdoc/logger"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create a renderer to output data
|
||||
out, err := gomarkdoc.NewRenderer()
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
|
||||
wd, err := os.Getwd()
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
|
||||
packagePath := filepath.Join(wd, "../../v3/pkg/application")
|
||||
|
||||
buildPkg, err := build.ImportDir(packagePath, build.ImportComment)
|
||||
if err != nil {
|
||||
// handle error
|
||||
}
|
||||
|
||||
// Create a documentation package from the build representation of our
|
||||
// package.
|
||||
log := logger.New(logger.DebugLevel)
|
||||
pkg, err := lang.NewPackageFromBuild(log, buildPkg)
|
||||
if err != nil {
|
||||
// handle error
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// Write the documentation out to console.
|
||||
data, err := out.Package(pkg)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
cwd, err := os.Getwd()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
println(cwd)
|
||||
|
||||
err = os.WriteFile(filepath.Join("..", "docs", "API", "fullapi.md"), []byte(data), 0644)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
39
mkdocs-website/generate/go.mod
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
module generate
|
||||
|
||||
go 1.21
|
||||
|
||||
require github.com/princjef/gomarkdoc v1.1.0
|
||||
|
||||
require (
|
||||
github.com/Microsoft/go-winio v0.5.0 // indirect
|
||||
github.com/VividCortex/ewma v1.2.0 // indirect
|
||||
github.com/cheggaaa/pb/v3 v3.0.8 // indirect
|
||||
github.com/emirpasic/gods v1.12.0 // indirect
|
||||
github.com/fatih/color v1.11.0 // indirect
|
||||
github.com/go-git/gcfg v1.5.0 // indirect
|
||||
github.com/go-git/go-billy/v5 v5.3.1 // indirect
|
||||
github.com/go-git/go-git/v5 v5.3.0 // indirect
|
||||
github.com/imdario/mergo v0.3.12 // indirect
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
||||
github.com/kevinburke/ssh_config v1.1.0 // indirect
|
||||
github.com/mattn/go-colorable v0.1.8 // indirect
|
||||
github.com/mattn/go-isatty v0.0.12 // indirect
|
||||
github.com/mattn/go-runewidth v0.0.12 // indirect
|
||||
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/nxadm/tail v1.4.8 // indirect
|
||||
github.com/princjef/mageutil v1.0.0 // indirect
|
||||
github.com/rivo/uniseg v0.2.0 // indirect
|
||||
github.com/russross/blackfriday/v2 v2.1.0 // indirect
|
||||
github.com/sergi/go-diff v1.3.1 // indirect
|
||||
github.com/sirupsen/logrus v1.8.1 // indirect
|
||||
github.com/x-cray/logrus-prefixed-formatter v0.5.2 // indirect
|
||||
github.com/xanzy/ssh-agent v0.3.0 // indirect
|
||||
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect
|
||||
golang.org/x/net v0.0.0-20210520170846-37e1c6afe023 // indirect
|
||||
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 // indirect
|
||||
golang.org/x/term v0.0.0-20210503060354-a79de5458b56 // indirect
|
||||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
|
||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||
mvdan.cc/xurls/v2 v2.2.0 // indirect
|
||||
)
|
||||
178
mkdocs-website/generate/go.sum
Normal file
|
|
@ -0,0 +1,178 @@
|
|||
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
|
||||
github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0=
|
||||
github.com/Microsoft/go-winio v0.5.0 h1:Elr9Wn+sGKPlkaBvwu4mTrxtmOp3F3yV9qhaHbXGjwU=
|
||||
github.com/Microsoft/go-winio v0.5.0/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84=
|
||||
github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA=
|
||||
github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow=
|
||||
github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4=
|
||||
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7 h1:uSoVVbwJiQipAclBbw+8quDsfcvFjOpI5iCf4p/cqCs=
|
||||
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs=
|
||||
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA=
|
||||
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
|
||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
|
||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
|
||||
github.com/cheggaaa/pb v2.0.7+incompatible/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s=
|
||||
github.com/cheggaaa/pb/v3 v3.0.4/go.mod h1:7rgWxLrAUcFMkvJuv09+DYi7mMUYi8nO9iOWcvGJPfw=
|
||||
github.com/cheggaaa/pb/v3 v3.0.8 h1:bC8oemdChbke2FHIIGy9mn4DPJ2caZYQnfbRqwmdCoA=
|
||||
github.com/cheggaaa/pb/v3 v3.0.8/go.mod h1:UICbiLec/XO6Hw6k+BHEtHeQFzzBH4i2/qk/ow1EJTA=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=
|
||||
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
|
||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||
github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=
|
||||
github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
|
||||
github.com/fatih/color v1.11.0 h1:l4iX0RqNnx/pU7rY2DB/I+znuYY0K3x6Ywac6EIr0PA=
|
||||
github.com/fatih/color v1.11.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
|
||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
|
||||
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
|
||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||
github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0=
|
||||
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
|
||||
github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4=
|
||||
github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E=
|
||||
github.com/go-git/go-billy/v5 v5.0.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
|
||||
github.com/go-git/go-billy/v5 v5.1.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
|
||||
github.com/go-git/go-billy/v5 v5.3.1 h1:CPiOUAzKtMRvolEKw+bG1PLRpT7D3LIs3/3ey4Aiu34=
|
||||
github.com/go-git/go-billy/v5 v5.3.1/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
|
||||
github.com/go-git/go-git-fixtures/v4 v4.0.2-0.20200613231340-f56387b50c12 h1:PbKy9zOy4aAKrJ5pibIRpVO2BXnK1Tlcg+caKI7Ox5M=
|
||||
github.com/go-git/go-git-fixtures/v4 v4.0.2-0.20200613231340-f56387b50c12/go.mod h1:m+ICp2rF3jDhFgEZ/8yziagdT1C+ZpZcrJjappBCDSw=
|
||||
github.com/go-git/go-git/v5 v5.3.0 h1:8WKMtJR2j8RntEXR/uvTKagfEt4GYlwQ7mntE4+0GWc=
|
||||
github.com/go-git/go-git/v5 v5.3.0/go.mod h1:xdX4bWJ48aOrdhnl2XqHYstHbbp6+LFS4r4X+lNVprw=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
|
||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
|
||||
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
|
||||
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
|
||||
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
|
||||
github.com/kevinburke/ssh_config v1.1.0 h1:pH/t1WS9NzT8go394IqZeJTMHVm6Cr6ZJ6AQ+mdNo/o=
|
||||
github.com/kevinburke/ssh_config v1.1.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
|
||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/matryer/is v1.3.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA=
|
||||
github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE=
|
||||
github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
|
||||
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
||||
github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8=
|
||||
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
|
||||
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84=
|
||||
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
|
||||
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
github.com/mattn/go-runewidth v0.0.12 h1:Y41i/hVW3Pgwr8gV+J23B9YEY0zxjptBuCWEaxmAOow=
|
||||
github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
|
||||
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d h1:5PJl274Y63IEHC+7izoQE9x6ikvDFZS2mDVS3drnohI=
|
||||
github.com/mgutz/ansi v0.0.0-20200706080929-d51e80ef957d/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
|
||||
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
|
||||
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
|
||||
github.com/onsi/ginkgo v1.14.2 h1:8mVmC9kjFFmA8H4pKMUhcblgifdkOIXPvbhN1T36q1M=
|
||||
github.com/onsi/ginkgo v1.14.2/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY=
|
||||
github.com/onsi/gomega v1.10.3 h1:gph6h/qe9GSUw1NhH1gp+qb+h8rXD8Cy60Z32Qw3ELA=
|
||||
github.com/onsi/gomega v1.10.3/go.mod h1:V9xEwhxec5O8UDM77eCW8vLymOMltsqPVYWrpDsH8xc=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/princjef/gomarkdoc v1.1.0 h1:xtl7mESKQWVuGiFdd1AO3dFA6OenWG86bZu97IqBNPE=
|
||||
github.com/princjef/gomarkdoc v1.1.0/go.mod h1:HI3w0Zv8H03ecak/IqVAcPFTuPt7sn7Top6xbgCs1Qk=
|
||||
github.com/princjef/mageutil v1.0.0 h1:1OfZcJUMsooPqieOz2ooLjI+uHUo618pdaJsbCXcFjQ=
|
||||
github.com/princjef/mageutil v1.0.0/go.mod h1:mkShhaUomCYfAoVvTKRcbAs8YSVPdtezI5j6K+VXhrs=
|
||||
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rogpeppe/go-internal v1.5.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
|
||||
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
|
||||
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
|
||||
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
|
||||
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
|
||||
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
|
||||
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/x-cray/logrus-prefixed-formatter v0.5.2 h1:00txxvfBM9muc0jiLIEAkAcIMJzfthRT6usrui8uGmg=
|
||||
github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE=
|
||||
github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI=
|
||||
github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0=
|
||||
golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
||||
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a h1:kr2P4QFmQr29mSLA43kwrOcgcReGTfbE9N577tCTuBc=
|
||||
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k=
|
||||
golang.org/x/net v0.0.0-20210520170846-37e1c6afe023 h1:ADo5wSpq2gqaCGQWzk7S5vd//0iyyLeAratkEoG5dLE=
|
||||
golang.org/x/net v0.0.0-20210520170846-37e1c6afe023/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191128015809-6d18c012aee9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 h1:hZR0X1kPW+nwyJ9xRxqZk1vx5RUObAPBdKVvXPDUH/E=
|
||||
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210503060354-a79de5458b56 h1:b8jxX3zqjpqb2LklXPzKSGJhzyxCOZSz8ncv8Nv+y7w=
|
||||
golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk=
|
||||
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8=
|
||||
gopkg.in/VividCortex/ewma.v1 v1.1.1/go.mod h1:TekXuFipeiHWiAlO1+wSS23vTcyFau5u3rxXUSXj710=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/cheggaaa/pb.v2 v2.0.7/go.mod h1:0CiZ1p8pvtxBlQpLXkHuUTpdJ1shm3OqCF1QugkjHL4=
|
||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
||||
gopkg.in/fatih/color.v1 v1.7.0/go.mod h1:P7yosIhqIl/sX8J8UypY5M+dDpD2KmyfP5IRs5v/fo0=
|
||||
gopkg.in/mattn/go-colorable.v0 v0.1.0/go.mod h1:BVJlBXzARQxdi3nZo6f6bnl5yR20/tOL6p+V0KejgSY=
|
||||
gopkg.in/mattn/go-isatty.v0 v0.0.4/go.mod h1:wt691ab7g0X4ilKZNmMII3egK0bTxl37fEn/Fwbd8gc=
|
||||
gopkg.in/mattn/go-runewidth.v0 v0.0.4/go.mod h1:BmXejnxvhwdaATwiJbB1vZ2dtXkQKZGu9yLFCZb4msQ=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
|
||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
||||
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
|
||||
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
mvdan.cc/xurls/v2 v2.2.0 h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A=
|
||||
mvdan.cc/xurls/v2 v2.2.0/go.mod h1:EV1RMtya9D6G5DMYPGD8zTQzaHet6Jh8gFlRgGRJeO8=
|
||||
5
mkdocs-website/mkdocs.insiders.yml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
INHERIT: mkdocs.yml
|
||||
plugins:
|
||||
- search
|
||||
- social
|
||||
- tags
|
||||
187
mkdocs-website/mkdocs.yml
Normal file
|
|
@ -0,0 +1,187 @@
|
|||
site_name: "alpha"
|
||||
repo_url: https://github.com/wailsapp/wails
|
||||
edit_uri: edit/v3-alpha/mkdocs-website/docs/
|
||||
site_url: https://v3alpha.wails.io
|
||||
site_description: The Wails Project - Build beautiful cross-platform applications using Go
|
||||
site_author: Lea Anthony
|
||||
theme:
|
||||
name: material
|
||||
custom_dir: overrides
|
||||
logo: assets/images/wails-logo-horizontal-dark.svg
|
||||
icon:
|
||||
repo: fontawesome/brands/github
|
||||
favicon: /favicon.ico
|
||||
features:
|
||||
- navigation.tabs
|
||||
- navigation.sections
|
||||
- navigation.expand
|
||||
- navigation.instant.prefetch
|
||||
- navigation.top
|
||||
- navigation.footer
|
||||
- navigation.path
|
||||
- navigation.prune
|
||||
|
||||
- toc.integrate
|
||||
- toc.follow
|
||||
|
||||
- search.suggest
|
||||
- search.highlight
|
||||
- search.share
|
||||
|
||||
- content.tabs.link
|
||||
- content.tabs.annotation
|
||||
- content.tabs.copy
|
||||
- content.code.copy
|
||||
- content.action.edit
|
||||
language: en
|
||||
palette:
|
||||
# Palette toggle for light mode
|
||||
- media: "(prefers-color-scheme: light)"
|
||||
scheme: default
|
||||
toggle:
|
||||
icon: material/toggle-switch-off-outline
|
||||
name: Switch to dark mode
|
||||
|
||||
# Palette toggle for dark mode
|
||||
- media: "(prefers-color-scheme: dark)"
|
||||
scheme: slate
|
||||
toggle:
|
||||
icon: material/toggle-switch
|
||||
name: Switch to light mode
|
||||
|
||||
plugins:
|
||||
- i18n:
|
||||
docs_structure: folder
|
||||
languages:
|
||||
- locale: en
|
||||
default: true
|
||||
name: English
|
||||
build: true
|
||||
- locale: zh
|
||||
name: 简体中文
|
||||
build: true
|
||||
site_description: Wails 项目 - 使用 Go 构建美观的跨平台应用程序
|
||||
extra:
|
||||
announcement: 这些文档是自动生成的。 如有错误,请告知我们。
|
||||
nav:
|
||||
- 主页: index.md
|
||||
- 入门:
|
||||
# - 介绍: introduction.md
|
||||
- 安装: getting-started/installation.md
|
||||
# - 创建项目: getting-started/creating-a-project.md
|
||||
# - 它是如何工作的: how-does-it-work.md
|
||||
# - 开发您的应用程序: getting-started/developing-your-application.md
|
||||
# - 编译您的项目: getting-started/compiling-your-project.md
|
||||
# - API 参考:
|
||||
# - 运行时:
|
||||
# - 介绍: reference/runtime/introduction.md
|
||||
# - CLI: reference/cli.md
|
||||
# - 社区:
|
||||
# - 模板: community/templates.md
|
||||
# - 指南:
|
||||
# - Angular: guides/angular.md
|
||||
# - 展示:
|
||||
# - Emaillit: community/showcase/emailit.md
|
||||
# - 贡献: community/contributing.md
|
||||
# - 链接: community/links.md
|
||||
- 下一步: getting-started/next-steps.md
|
||||
- 反馈: getting-started/feedback.md
|
||||
- v3 版本中的新内容是什么?: whats-new.md
|
||||
- API:
|
||||
- 应用程序: API/application.md
|
||||
- 窗口: API/window.md
|
||||
- 系统托盘: API/systray.md
|
||||
- 菜单: API/menu.md
|
||||
- 主线程: API/mainthread.md
|
||||
- 完整 API: API/fullapi.md
|
||||
- 开发:
|
||||
- 介绍: development/introduction.md
|
||||
- 状态: development/status.md
|
||||
- v3 变更: development/changes.md
|
||||
- 路线图: roadmap.md
|
||||
- 更改日志: changelog.md
|
||||
- 赞助❤️: https://github.com/sponsors/leaanthony
|
||||
|
||||
|
||||
extra:
|
||||
alternate:
|
||||
- name: English
|
||||
link: /
|
||||
lang: en
|
||||
- name: 简体中文
|
||||
link: /zh/
|
||||
lang: zh
|
||||
|
||||
social:
|
||||
- icon: fontawesome/brands/github-alt
|
||||
link: https://github.com/wailsapp/wails
|
||||
- icon: fontawesome/brands/twitter
|
||||
link: https://twitter.com/wailsapp
|
||||
- icon: fontawesome/brands/discord
|
||||
link: https://discord.gg/JDdSxwjhGf
|
||||
|
||||
extra_css:
|
||||
- stylesheets/extra.css
|
||||
|
||||
nav:
|
||||
- Home: index.md
|
||||
- Getting started:
|
||||
# - Introduction: introduction.md
|
||||
- Installation: getting-started/installation.md
|
||||
# - Creating a Project: getting-started/creating-a-project.md
|
||||
# - How does it work: how-does-it-work.md
|
||||
# - Developing your Application: getting-started/developing-your-application.md
|
||||
# - Compiling your Project: getting-started/compiling-your-project.md
|
||||
# - API Reference:
|
||||
# - Runtime:
|
||||
# - Introduction: reference/runtime/introduction.md
|
||||
# - CLI: reference/cli.md
|
||||
# - Community:
|
||||
# - Template: community/templates.md
|
||||
# - Guides:
|
||||
# - Angular: guides/angular.md
|
||||
# - Showcase:
|
||||
# - Emaillit: community/showcase/emailit.md
|
||||
# - Contributing: community/contributing.md
|
||||
# - Links: community/links.md
|
||||
- Next Steps: getting-started/next-steps.md
|
||||
- Feedback: getting-started/feedback.md
|
||||
- What's New in v3?: whats-new.md
|
||||
- API:
|
||||
- Application: API/application.md
|
||||
- Window: API/window.md
|
||||
- System Tray: API/systray.md
|
||||
- Menu: API/menu.md
|
||||
- Main Thread: API/mainthread.md
|
||||
- Full API: API/fullapi.md
|
||||
- Development:
|
||||
- Introduction: development/introduction.md
|
||||
- Status: development/status.md
|
||||
- v3 Changes: development/changes.md
|
||||
- Roadmap: roadmap.md
|
||||
- Change Log: changelog.md
|
||||
- Sponsor❤️: https://github.com/sponsors/leaanthony
|
||||
|
||||
|
||||
markdown_extensions:
|
||||
- pymdownx.tabbed:
|
||||
alternate_style: true
|
||||
- pymdownx.highlight:
|
||||
anchor_linenums: true
|
||||
- pymdownx.tasklist:
|
||||
custom_checkbox: true
|
||||
- pymdownx.inlinehilite
|
||||
- pymdownx.snippets:
|
||||
restrict_base_path: false
|
||||
- pymdownx.details
|
||||
- pymdownx.superfences
|
||||
- pymdownx.mark
|
||||
- attr_list
|
||||
- admonition
|
||||
- footnotes
|
||||
- pymdownx.emoji:
|
||||
emoji_index: !!python/name:material.extensions.emoji.twemoji
|
||||
emoji_generator: !!python/name:material.extensions.emoji.to_svg
|
||||
|
||||
copyright:
|
||||
Copyright © 2023 Lea Anthony
|
||||
BIN
mkdocs-website/overrides/assets/images/favicon.ico
Normal file
|
After Width: | Height: | Size: 109 KiB |
1
mkdocs-website/overrides/assets/images/favicon.svg
Normal file
|
|
@ -0,0 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%" version="1.1" viewBox="0 0 180 167" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"><g><path d="M196,19.285C196,14.712 192.095,11 187.286,11L27.714,11C22.905,11 19,14.712 19,19.285L19,158.715C19,163.288 22.905,167 27.714,167L187.286,167C192.095,167 196,163.288 196,158.715L196,19.285Z" transform="matrix(1.00565,0,0,1.05769,-18.1073,-10.6346)" style="fill:#fff"/></g><g><path d="M0,-51.891L14.429,-51.891L13.043,-21.183L22.568,-51.891L34.226,-51.891L34.084,-21.183L42.365,-51.891L56.794,-51.891L38.526,0L25.198,0L25.34,-32.45L15.211,0L1.919,0L0,-51.891Z" transform="matrix(2.51258,0,0,2.51258,20.0103,151.138)" style="fill-rule:nonzero"/></g></svg>
|
||||
|
After Width: | Height: | Size: 774 B |
|
After Width: | Height: | Size: 5.4 KiB |
|
After Width: | Height: | Size: 5.4 KiB |
144
mkdocs-website/overrides/home.en.html
Normal file
|
|
@ -0,0 +1,144 @@
|
|||
<!--
|
||||
Copyright (c) 2016-2023 Martin Donath <martin.donath@squidfunk.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
-->
|
||||
|
||||
{% extends "main.html" %}
|
||||
|
||||
<!-- Render hero under tabs -->
|
||||
{% block tabs %}
|
||||
{{ super() }}
|
||||
|
||||
<!-- Additional styles for landing page -->
|
||||
<style>
|
||||
|
||||
/* Application header should be static for the landing page */
|
||||
.md-header {
|
||||
position: initial;
|
||||
}
|
||||
|
||||
/* Remove spacing, as we cannot hide it completely */
|
||||
.md-main__inner {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* Hide main content for now */
|
||||
.md-content {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Hide table of contents */
|
||||
@media screen and (min-width: 60em) {
|
||||
.md-sidebar--secondary {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* Hide navigation */
|
||||
@media screen and (min-width: 76.25em) {
|
||||
.md-sidebar--primary {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- Hero for landing page -->
|
||||
<section class="mdx-container">
|
||||
<div class="md-grid md-typeset">
|
||||
<div class="mdx-hero">
|
||||
|
||||
<!-- Hero content -->
|
||||
<div class="mdx-hero__content">
|
||||
<br/>
|
||||
<br/>
|
||||
<div style="text-align: center">
|
||||
This is the Wails v3 Alpha website.
|
||||
|
||||
This site will be updated as we progress through the alpha and beta releases.<br/><br/>
|
||||
|
||||
<div class="admonition warning">
|
||||
<p class="admonition-title">Warning</p>
|
||||
<h3>The v3 alpha release is intended for testers and contributors. It is not ready for use in any other capacity. Expect things to fail. Expect things to change. Expect the documentation to be wrong.<br/><br/>
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<h2>Status</h2>
|
||||
<br/>
|
||||
<table border="1">
|
||||
<tr>
|
||||
<th>Operating System</th>
|
||||
<th>Status</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Windows</td>
|
||||
<td>All examples are working</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Mac</td>
|
||||
<td>Most examples are working</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Linux</td>
|
||||
<td>Some examples are working</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br/><br/>
|
||||
|
||||
<div style="width: 50%; margin: 0 auto; text-align: justify; padding-bottom: 75px;">
|
||||
<h2>FAQ</h2>
|
||||
<h3>What is the aim of the alpha release?</h3>
|
||||
The aim of the alpha release is to get feedback on the new API and to get people experimenting with it.
|
||||
We want to make sure that the API is easy to use and that it is possible to build applications with it.
|
||||
<br/><br/>
|
||||
<h3>How do I provide feedback?</h3>
|
||||
Please read <a href="/getting-started/feedback/">this page</a> for details on how to provide feedback.
|
||||
</div>
|
||||
<h3>Is there a Roadmap</h3>
|
||||
Yes, you can find it <a href="/roadmap/">here</a>.
|
||||
|
||||
Please feel free to raise PRs against this website. Every single PR helps us get closer to a release.<br/><br/>
|
||||
Thank you for sharing this journey with us.<br/><br/>
|
||||
<br/>
|
||||
<a
|
||||
href="{{ page.next_page.url | url }}"
|
||||
title="{{ page.next_page.title | e }}"
|
||||
class="md-button md-button--primary"
|
||||
>
|
||||
Get started
|
||||
</a>
|
||||
</div>
|
||||
<!-- <a-->
|
||||
<!-- href="{{ 'introduction' | url }}"-->
|
||||
<!-- title="Material for MkDocs Insiders"-->
|
||||
<!-- class="md-button"-->
|
||||
<!-- >-->
|
||||
<!-- Learn more-->
|
||||
<!-- </a>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
||||
<!-- Content -->
|
||||
{% block content %}{% endblock %}
|
||||
|
||||
<!-- Application footer -->
|
||||
{% block footer %}{% endblock %}
|
||||
145
mkdocs-website/overrides/home.zh.html
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
<!--
|
||||
Copyright (c) 2016-2023 Martin Donath <martin.donath@squidfunk.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
-->
|
||||
|
||||
{% extends "main.zh.html" %}
|
||||
|
||||
<!-- Render hero under tabs -->
|
||||
{% block tabs %}
|
||||
{{ super() }}
|
||||
|
||||
<!-- Additional styles for landing page -->
|
||||
<style>
|
||||
|
||||
/* Application header should be static for the landing page */
|
||||
.md-header {
|
||||
position: initial;
|
||||
}
|
||||
|
||||
/* Remove spacing, as we cannot hide it completely */
|
||||
.md-main__inner {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* Hide main content for now */
|
||||
.md-content {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* Hide table of contents */
|
||||
@media screen and (min-width: 60em) {
|
||||
.md-sidebar--secondary {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
/* Hide navigation */
|
||||
@media screen and (min-width: 76.25em) {
|
||||
.md-sidebar--primary {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- Hero for landing page -->
|
||||
<section class="mdx-container">
|
||||
<div class="md-grid md-typeset">
|
||||
<div class="mdx-hero">
|
||||
|
||||
<!-- Hero content -->
|
||||
<div class="mdx-hero__content">
|
||||
<br/>
|
||||
<br/>
|
||||
<div style="text-align: center">
|
||||
这是 Wails v3 Alpha 网站。
|
||||
|
||||
随着 alpha 和 beta 版本的推进,本站将会有所更新。<br/><br/>
|
||||
|
||||
<div class="admonition warning">
|
||||
<p class="admonition-title">警告</p>
|
||||
<h3>v3 alpha版本主要用于测试和贡献者。它还不适用于其他任何容量。请预料可能会出现故障,可能会有变化,文档可能会有错误。<br/><br/>
|
||||
</h3>
|
||||
</div>
|
||||
|
||||
<h2>状态</h2>
|
||||
<br/>
|
||||
<table border="1">
|
||||
<tr>
|
||||
<th>操作系统</th>
|
||||
<th>状态</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Windows</td>
|
||||
<td>所有示例都可以运行</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Mac</td>
|
||||
<td>大多数示例可以运行</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Linux</td>
|
||||
<td>一些示例可以运行</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br/><br/>
|
||||
|
||||
<div style="width: 50%; margin: 0 auto; text-align: justify; padding-bottom: 75px;">
|
||||
<h2>常见问题</h2>
|
||||
<h3>alpha版本的目的是什么?</h3>
|
||||
alpha版本的目的是获得有关新 API 的反馈,并让人们尝试使用它。
|
||||
我们想确保 API 易于使用,并且可以使用它构建应用程序。
|
||||
<br/><br/>
|
||||
<h3>如何提供反馈?</h3>
|
||||
请阅读 <a href="/getting-started/feedback/">此页面</a>以获取有关如何提供反馈的详细信息。
|
||||
</div>
|
||||
<h3>有路线图吗?</h3>
|
||||
是的,你可以在 <a href="/roadmap/">这里</a> 找到它。
|
||||
|
||||
请随时提出针对此网站的PR。每一个PR都会帮助我们更接近发布。<br/><br/>
|
||||
感谢您与我们共度此旅程。<br/><br/>
|
||||
<br/>
|
||||
<a
|
||||
href="{{ page.next_page.url | url }}"
|
||||
title="{{ page.next_page.title | e }}"
|
||||
class="md-button md-button--primary"
|
||||
>
|
||||
开始
|
||||
</a>
|
||||
</div>
|
||||
<!-- <a-->
|
||||
<!-- href="{{ 'introduction' | url }}"-->
|
||||
<!-- title="Material for MkDocs Insiders"-->
|
||||
<!-- class="md-button"-->
|
||||
<!-- >-->
|
||||
<!-- 了解更多-->
|
||||
<!-- </a>-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
{% endblock %}
|
||||
|
||||
<!-- Content -->
|
||||
{% block content %}{% endblock %}
|
||||
|
||||
<!-- Application footer -->
|
||||
{% block footer %}{% endblock %}
|
||||
44
mkdocs-website/overrides/main.html
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
<!--
|
||||
Copyright (c) 2016-2023 Martin Donath <martin.donath@squidfunk.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
-->
|
||||
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block announce %}
|
||||
{%
|
||||
set announcement = {
|
||||
"en": "Translations are autogenerated. Please report mistakes.",
|
||||
"zh": "这些文档是自动生成的。 如有错误,请告知我们。",
|
||||
}
|
||||
%}
|
||||
|
||||
<div class="announcement__translation">
|
||||
{{ announcement[i18n_page_locale] }}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
<!-- Theme-related JavaScript -->
|
||||
{% block scripts %}
|
||||
{{ super() }}
|
||||
|
||||
<!-- Extra JavaScript (can't be set in mkdocs.yml due to content hash) -->
|
||||
<script src="{{ 'assets/javascripts/custom.js' | url }}"></script>
|
||||
{% endblock %}
|
||||
35
mkdocs-website/overrides/main.zh.html
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<!--
|
||||
Copyright (c) 2016-2023 Martin Donath <martin.donath@squidfunk.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
-->
|
||||
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block announce %}
|
||||
这些文档是自动生成的。 如有错误,请告知我们。
|
||||
{% endblock %}
|
||||
|
||||
<!-- Theme-related JavaScript -->
|
||||
{% block scripts %}
|
||||
{{ super() }}
|
||||
|
||||
<!-- Extra JavaScript (can't be set in mkdocs.yml due to content hash) -->
|
||||
<script src="{{ 'assets/javascripts/custom.js' | url }}"></script>
|
||||
{% endblock %}
|
||||
BIN
mkdocs-website/requirements.insiders.txt
Normal file
29
qodana.yaml
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#-------------------------------------------------------------------------------#
|
||||
# Qodana analysis is configured by qodana.yaml file #
|
||||
# https://www.jetbrains.com/help/qodana/qodana-yaml.html #
|
||||
#-------------------------------------------------------------------------------#
|
||||
version: "1.0"
|
||||
|
||||
#Specify inspection profile for code analysis
|
||||
profile:
|
||||
name: qodana.starter
|
||||
|
||||
#Enable inspections
|
||||
#include:
|
||||
# - name: <SomeEnabledInspectionId>
|
||||
|
||||
#Disable inspections
|
||||
#exclude:
|
||||
# - name: <SomeDisabledInspectionId>
|
||||
# paths:
|
||||
# - <path/where/not/run/inspection>
|
||||
|
||||
#Execute shell command before Qodana execution (Applied in CI/CD pipeline)
|
||||
#bootstrap: sh ./prepare-qodana.sh
|
||||
|
||||
#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline)
|
||||
#plugins:
|
||||
# - id: <plugin.id> #(plugin id can be found at https://plugins.jetbrains.com)
|
||||
|
||||
#Specify Qodana linter for analysis (Applied in CI/CD pipeline)
|
||||
linter: jetbrains/qodana-go:latest
|
||||
|
|
@ -1,6 +1,8 @@
|
|||
module changeme
|
||||
|
||||
go 1.18
|
||||
go 1.21
|
||||
|
||||
toolchain go1.21.0
|
||||
|
||||
require github.com/wailsapp/wails/v2 v2.1.0
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
module github.com/wailsapp/wails/v2
|
||||
|
||||
go 1.18
|
||||
go 1.21
|
||||
|
||||
toolchain go1.21.0
|
||||
|
||||
require (
|
||||
github.com/Masterminds/semver v1.5.0
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
//go:build devtools
|
||||
|
||||
package app
|
||||
|
||||
// Note: devtools flag is also added in debug builds
|
||||
func IsDevtoolsEnabled() bool {
|
||||
return true
|
||||
}
|
||||
//go:build devtools
|
||||
|
||||
package app
|
||||
|
||||
// Note: devtools flag is also added in debug builds
|
||||
func IsDevtoolsEnabled() bool {
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
//go:build !devtools
|
||||
|
||||
package app
|
||||
|
||||
// Note: devtools flag is also added in debug builds
|
||||
func IsDevtoolsEnabled() bool {
|
||||
return false
|
||||
}
|
||||
//go:build !devtools
|
||||
|
||||
package app
|
||||
|
||||
// Note: devtools flag is also added in debug builds
|
||||
func IsDevtoolsEnabled() bool {
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
9
v3/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
examples/kitchensink/kitchensink
|
||||
cmd/wails3/wails
|
||||
/examples/systray/systray
|
||||
/examples/window/window
|
||||
/examples/dialogs/dialogs
|
||||
/examples/menu/menu
|
||||
/examples/clipboard/clipboard
|
||||
/examples/plain/plain
|
||||
/cmd/wails3/ui/.task/
|
||||
1
v3/.prettierignore
Normal file
|
|
@ -0,0 +1 @@
|
|||
website
|
||||
6
v3/.prettierrc.yml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
overrides:
|
||||
- files:
|
||||
- "**/*.md"
|
||||
options:
|
||||
printWidth: 80
|
||||
proseWrap: always
|
||||
9
v3/README.md
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
# v3 Alpha
|
||||
|
||||
Thanks for wanting to help out with testing/developing Wails v3! This guide will help you get started.
|
||||
|
||||
## Getting Started
|
||||
|
||||
All the instructions for getting started are in the v3 documentation directory: `mkdocs-website`.
|
||||
Please read the README.md file in that directory for more information.
|
||||
|
||||
167
v3/Taskfile.yaml
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
# https://taskfile.dev
|
||||
|
||||
version: "3"
|
||||
|
||||
includes:
|
||||
runtime:
|
||||
taskfile: ./internal/runtime
|
||||
dir: ./internal/runtime
|
||||
|
||||
website:
|
||||
taskfile: ./website
|
||||
dir: ./website
|
||||
optional: true
|
||||
|
||||
docs:
|
||||
taskfile: ../mkdocs-website
|
||||
dir: ../mkdocs-website
|
||||
optional: true
|
||||
|
||||
tasks:
|
||||
recreate-template-dir:
|
||||
dir: internal/templates
|
||||
internal: true
|
||||
silent: true
|
||||
cmds:
|
||||
- rm -rf {{.TEMPLATE_DIR}}
|
||||
- mkdir -p {{.TEMPLATE_DIR}}
|
||||
|
||||
cli:install:
|
||||
dir: cmd/wails3
|
||||
cmds:
|
||||
- go install
|
||||
- echo "Installed wails CLI"
|
||||
|
||||
generate:template:
|
||||
dir: internal/templates/{{.TEMPLATE}}
|
||||
deps:
|
||||
- task: recreate-template-dir
|
||||
vars:
|
||||
TEMPLATE_DIR: "{{.TEMPLATE}}"
|
||||
silent: true
|
||||
cmds:
|
||||
- cmd: pnpm create vite frontend --template {{.TEMPLATE}}
|
||||
- cmd: cp -rf ../_base/{{.TEMPLATE}}/* .
|
||||
ignore_error: true
|
||||
- cmd: cp -rf ../_base/default/* .
|
||||
ignore_error: true
|
||||
- cmd: rm frontend/public/vite.svg
|
||||
- cmd: go run ../../../tasks/sed/sed.go replace -dir frontend -old Vite -new Wails -ext .ts,.js,.html -ignore vite.config.js,vite.config.ts,vite-env.d.ts
|
||||
- cmd: go run ../../../tasks/sed/sed.go replace -dir frontend -old vite -new wails -ext .ts,.js,.html -ignore vite.config.js,vite.config.ts,vite-env.d.ts
|
||||
- cmd: go run ../../../tasks/sed/sed.go replace -dir frontend -old wails.svg -new wails.png -ext .ts,.js,.html -ignore vite.config.js,vite.config.ts,vite-env.d.ts
|
||||
- cmd: go run ../../../tasks/sed/sed.go replace -dir frontend -old wailsjs.dev -new wails.io -ext .ts,.js,.html -ignore vite.config.js,vite.config.ts,vite-env.d.ts
|
||||
- cmd: go run ../../../tasks/sed/sed.go replace -dir frontend -old "framework powered by Wails" -new "framework powered by Vite" -ext .ts,.js,.html,.svelte -ignore vite.config.js,vite.config.ts,vite-env.d.ts
|
||||
|
||||
taskfile:upgrade:
|
||||
cmds:
|
||||
- go get -u github.com/go-task/task/v3
|
||||
|
||||
reinstall-cli:
|
||||
dir: cmd/wails
|
||||
internal: true
|
||||
cmds:
|
||||
- go install
|
||||
- echo "Reinstalled wails CLI"
|
||||
|
||||
generate:events:
|
||||
dir: tasks/events
|
||||
cmds:
|
||||
- go run generate.go
|
||||
|
||||
generate:templates:
|
||||
dir: internal/templates/
|
||||
deps:
|
||||
- task: generate:template
|
||||
vars:
|
||||
TEMPLATE: svelte
|
||||
- task: generate:template
|
||||
vars:
|
||||
TEMPLATE: svelte-ts
|
||||
- task: generate:template
|
||||
vars:
|
||||
TEMPLATE: vue
|
||||
- task: generate:template
|
||||
vars:
|
||||
TEMPLATE: vue-ts
|
||||
- task: generate:template
|
||||
vars:
|
||||
TEMPLATE: react
|
||||
- task: generate:template
|
||||
vars:
|
||||
TEMPLATE: react-ts
|
||||
- task: generate:template
|
||||
vars:
|
||||
TEMPLATE: preact
|
||||
- task: generate:template
|
||||
vars:
|
||||
TEMPLATE: preact-ts
|
||||
- task: generate:template
|
||||
vars:
|
||||
TEMPLATE: lit
|
||||
- task: generate:template
|
||||
vars:
|
||||
TEMPLATE: lit-ts
|
||||
- task: generate:template
|
||||
vars:
|
||||
TEMPLATE: vanilla
|
||||
- task: generate:template
|
||||
vars:
|
||||
TEMPLATE: vanilla-ts
|
||||
- task: generate:template
|
||||
vars:
|
||||
TEMPLATE: react-swc
|
||||
- task: generate:template
|
||||
vars:
|
||||
TEMPLATE: react-swc-ts
|
||||
cmds:
|
||||
- task: reinstall-cli
|
||||
- echo "Generated templates"
|
||||
|
||||
format:md:
|
||||
dir: ../mkdocs-website
|
||||
cmds:
|
||||
- npx prettier --write "**/*.md"
|
||||
|
||||
format:
|
||||
cmds:
|
||||
- task: format:md
|
||||
|
||||
precommit:
|
||||
cmds:
|
||||
- go test ./...
|
||||
- task: format
|
||||
- task: docs:update:api
|
||||
|
||||
test:example:
|
||||
dir: 'examples/{{.DIR}}'
|
||||
cmds:
|
||||
- echo "Building example {{.DIR}}"
|
||||
- go mod tidy
|
||||
- go build -o "testbuild-{{.DIR}}{{exeExt}}"
|
||||
|
||||
test:examples:
|
||||
summary: Builds the examples
|
||||
dir: examples
|
||||
vars:
|
||||
EXAMPLEDIRS: |
|
||||
binding
|
||||
build
|
||||
clipboard
|
||||
contextmenus
|
||||
dialogs
|
||||
drag-n-drop
|
||||
events
|
||||
frameless
|
||||
keybindings
|
||||
menu
|
||||
plain
|
||||
plugins
|
||||
screen
|
||||
systray
|
||||
window
|
||||
wml
|
||||
cmds:
|
||||
- for: { var: EXAMPLEDIRS }
|
||||
task: test:example
|
||||
vars:
|
||||
DIR: "{{.ITEM}}"
|
||||
83
v3/cmd/wails3/README.md
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
# The Wails CLI
|
||||
|
||||
The Wails CLI is a command line tool that allows you to create, build and run Wails applications.
|
||||
There are a number of commands related to tooling, such as icon generation and asset bundling.
|
||||
|
||||
## Commands
|
||||
|
||||
### task
|
||||
|
||||
The `task` command is for running tasks defined in `Taskfile.yml`. It is a wrapper around [Task](https://taskfile.dev).
|
||||
|
||||
### generate
|
||||
|
||||
The `generate` command is used to generate resources and assets for your Wails project.
|
||||
It can be used to generate many things including:
|
||||
- application icons,
|
||||
- resource files for Windows applications
|
||||
- Info.plist files for macOS deployments
|
||||
|
||||
#### icon
|
||||
|
||||
The `icon` command generates icons for your project.
|
||||
|
||||
| Flag | Type | Description | Default |
|
||||
|--------------------|--------|------------------------------------------------------|-----------------------|
|
||||
| `-example` | bool | Generates example icon file (appicon.png) | |
|
||||
| `-input` | string | The input image file | |
|
||||
| `-sizes` | string | The sizes to generate in .ico file (comma separated) | "256,128,64,48,32,16" |
|
||||
| `-windowsFilename` | string | The output filename for the Windows icon | icons.ico |
|
||||
| `-macFilename` | string | The output filename for the Mac icon bundle | icons.icns |
|
||||
|
||||
```bash
|
||||
wails3 generate icon -input myicon.png -sizes "32,64,128" -windowsFilename myicon.ico -macFilename myicon.icns
|
||||
```
|
||||
|
||||
This will generate icons for mac and windows and save them in the current directory as `myicon.ico`
|
||||
and `myicons.icns`.
|
||||
|
||||
#### syso
|
||||
|
||||
The `syso` command generates a Windows resource file (aka `.syso`).
|
||||
|
||||
```bash
|
||||
wails3 generate syso <options>
|
||||
```
|
||||
|
||||
| Flag | Type | Description | Default |
|
||||
|-------------|--------|--------------------------------------------|------------------|
|
||||
| `-example` | bool | Generates example manifest & info files | |
|
||||
| `-manifest` | string | The manifest file | |
|
||||
| `-info` | string | The info.json file | |
|
||||
| `-icon` | string | The icon file | |
|
||||
| `-out` | string | The output filename for the syso file | `wails.exe.syso` |
|
||||
| `-arch` | string | The target architecture (amd64,arm64,386) | `runtime.GOOS` |
|
||||
|
||||
If `-example` is provided, the command will generate example manifest and info files
|
||||
in the current directory and exit.
|
||||
|
||||
If `-manifest` is provided, the command will use the provided manifest file to generate
|
||||
the syso file.
|
||||
|
||||
If `-info` is provided, the command will use the provided info.json file to set the version
|
||||
information in the syso file.
|
||||
|
||||
NOTE: We use [winres](https://github.com/tc-hib/winres) to generate the syso file. Please
|
||||
refer to the winres documentation for more information.
|
||||
|
||||
NOTE: Whilst the tool will work for 32-bit Windows, it is not supported. Please use 64-bit.
|
||||
|
||||
#### defaults
|
||||
|
||||
```bash
|
||||
wails3 generate defaults
|
||||
```
|
||||
This will generate all the default assets and resources in the current directory.
|
||||
|
||||
#### bindings
|
||||
|
||||
```bash
|
||||
wails3 generate bindings
|
||||
```
|
||||
|
||||
Generates bindings and models for your bound Go methods and structs.
|
||||
59
v3/cmd/wails3/main.go
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/pterm/pterm"
|
||||
"github.com/samber/lo"
|
||||
"os"
|
||||
"runtime/debug"
|
||||
|
||||
"github.com/leaanthony/clir"
|
||||
"github.com/wailsapp/wails/v3/internal/commands"
|
||||
)
|
||||
|
||||
func init() {
|
||||
buildInfo, ok := debug.ReadBuildInfo()
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
commands.BuildSettings = lo.Associate(buildInfo.Settings, func(setting debug.BuildSetting) (string, string) {
|
||||
return setting.Key, setting.Value
|
||||
})
|
||||
// Iterate over the Deps and add them to the build settings using a prefix of "mod."
|
||||
for _, dep := range buildInfo.Deps {
|
||||
commands.BuildSettings["mod."+dep.Path] = dep.Version
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
app := clir.NewCli("wails", "The Wails CLI", "v3")
|
||||
app.NewSubCommandFunction("build", "Build the project", commands.Build)
|
||||
app.NewSubCommandFunction("doctor", "System status report", commands.Doctor)
|
||||
app.NewSubCommandFunction("init", "Initialise a new project", commands.Init)
|
||||
task := app.NewSubCommand("task", "Run and list tasks")
|
||||
var taskFlags commands.RunTaskOptions
|
||||
task.AddFlags(&taskFlags)
|
||||
task.Action(func() error {
|
||||
return commands.RunTask(&taskFlags, task.OtherArgs())
|
||||
})
|
||||
task.LongDescription("\nUsage: wails task [taskname] [flags]\n\nTasks are defined in the `Taskfile.yaml` file. See https://taskfile.dev for more information.")
|
||||
generate := app.NewSubCommand("generate", "Generation tools")
|
||||
generate.NewSubCommandFunction("build-assets", "Generate build assets", commands.GenerateBuildAssets)
|
||||
generate.NewSubCommandFunction("icons", "Generate icons", commands.GenerateIcons)
|
||||
generate.NewSubCommandFunction("syso", "Generate Windows .syso file", commands.GenerateSyso)
|
||||
generate.NewSubCommandFunction("bindings", "Generate bindings + models", commands.GenerateBindings)
|
||||
generate.NewSubCommandFunction("constants", "Generate JS constants from Go", commands.GenerateConstants)
|
||||
plugin := app.NewSubCommand("plugin", "Plugin tools")
|
||||
//plugin.NewSubCommandFunction("list", "List plugins", commands.PluginList)
|
||||
plugin.NewSubCommandFunction("init", "Initialise a new plugin", commands.PluginInit)
|
||||
//plugin.NewSubCommandFunction("add", "Add a plugin", commands.PluginAdd)
|
||||
tool := app.NewSubCommand("tool", "Various tools")
|
||||
tool.NewSubCommandFunction("checkport", "Checks if a port is open. Useful for testing if vite is running.", commands.ToolCheckPort)
|
||||
|
||||
app.NewSubCommandFunction("version", "Print the version", commands.Version)
|
||||
|
||||
err := app.Run()
|
||||
if err != nil {
|
||||
pterm.Error.Println(err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
18
v3/examples/README.md
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# v3
|
||||
|
||||
This directory is experimental. It probably won't work for you. There's no support for this directory. Dragons be here. You have been warned!
|
||||
|
||||
The examples in this directory may or may not compile / run at any given time. But the general method to try them out is as follows:
|
||||
|
||||
## Running the examples
|
||||
|
||||
cd v3/examples/<example>
|
||||
go mod tidy
|
||||
go run .
|
||||
|
||||
## Compiling the examples
|
||||
|
||||
cd v3/examples/<example>
|
||||
go mod tidy
|
||||
go build
|
||||
./<example>
|
||||
19
v3/examples/binding/GreetService.go
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
package main
|
||||
|
||||
type Person struct {
|
||||
name string
|
||||
}
|
||||
|
||||
// GreetService is a service that greets people
|
||||
type GreetService struct {
|
||||
}
|
||||
|
||||
// Greet greets a person
|
||||
func (*GreetService) Greet(name string) string {
|
||||
return "Hello " + name
|
||||
}
|
||||
|
||||
// GreetPerson greets a person
|
||||
func (*GreetService) GreetPerson(person Person) string {
|
||||
return "Hello " + person.name
|
||||
}
|
||||
11
v3/examples/binding/README.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# Bindings Example
|
||||
|
||||
This example demonstrates how to generate bindings for your application.
|
||||
|
||||
To generate bindings, run `wails3 generate bindings -d assets` in this directory.
|
||||
|
||||
See more options by running `wails3 generate bindings --help`.
|
||||
|
||||
## Notes
|
||||
- The bindings generator is still a work in progress and is subject to change.
|
||||
- The generated code uses `wails.CallByID` by default. This is the most secure and quickest way to call a function. In a future release, we will look at generating `wails.CallByName` too.
|
||||
26
v3/examples/binding/assets/bindings_main.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
|
||||
window.go = window.go || {};
|
||||
window.go.main = {
|
||||
GreetService: {
|
||||
|
||||
/**
|
||||
* GreetService.Greet
|
||||
* Greet greets a person
|
||||
* @param name {string}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
Greet: function(name) { return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.GreetPerson
|
||||
* GreetPerson greets a person
|
||||
* @param person {main.Person}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
GreetPerson: function(person) { return wails.CallByID(4021313248, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
},
|
||||
};
|
||||
94
v3/examples/binding/assets/index.html
Normal file
24
v3/examples/binding/assets/models.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
export namespace main {
|
||||
|
||||
export class Person {
|
||||
name: string; // Warning: this is unexported in the Go struct.
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new Person(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) {
|
||||
source = JSON.parse(source);
|
||||
}
|
||||
|
||||
this.name = source['name'];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
26
v3/examples/binding/bindings_main.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
|
||||
window.go = window.go || {};
|
||||
window.go.main = {
|
||||
GreetService: {
|
||||
|
||||
/**
|
||||
* GreetService.Greet
|
||||
* Greet greets a person
|
||||
* @param name {string}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
Greet: function(name) { return wails.CallByID(1411160069, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
|
||||
/**
|
||||
* GreetService.GreetPerson
|
||||
* GreetPerson greets a person
|
||||
* @param person {main.Person}
|
||||
* @returns {Promise<string>}
|
||||
**/
|
||||
GreetPerson: function(person) { return wails.CallByID(4021313248, ...Array.prototype.slice.call(arguments, 0)); },
|
||||
},
|
||||
};
|
||||
52
v3/examples/binding/go.mod
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
module binding
|
||||
|
||||
go 1.21
|
||||
|
||||
toolchain go1.21.0
|
||||
|
||||
require github.com/wailsapp/wails/v3 v3.0.0-alpha.0
|
||||
|
||||
require (
|
||||
github.com/Microsoft/go-winio v0.4.16 // indirect
|
||||
github.com/bep/debounce v1.2.1 // indirect
|
||||
github.com/ebitengine/purego v0.4.0-alpha.4 // indirect
|
||||
github.com/emirpasic/gods v1.12.0 // indirect
|
||||
github.com/go-git/gcfg v1.5.0 // indirect
|
||||
github.com/go-git/go-billy/v5 v5.2.0 // indirect
|
||||
github.com/go-git/go-git/v5 v5.3.0 // indirect
|
||||
github.com/go-ole/go-ole v1.2.6 // indirect
|
||||
github.com/godbus/dbus/v5 v5.1.0 // indirect
|
||||
github.com/google/uuid v1.3.0 // indirect
|
||||
github.com/imdario/mergo v0.3.12 // indirect
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
|
||||
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
|
||||
github.com/kr/pretty v0.3.1 // indirect
|
||||
github.com/leaanthony/go-ansi-parser v1.6.1 // indirect
|
||||
github.com/leaanthony/u v1.1.0 // indirect
|
||||
github.com/lmittmann/tint v1.0.0 // indirect
|
||||
github.com/mattn/go-colorable v0.1.13 // indirect
|
||||
github.com/mattn/go-isatty v0.0.19 // indirect
|
||||
github.com/mitchellh/go-homedir v1.1.0 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
|
||||
github.com/rivo/uniseg v0.4.4 // indirect
|
||||
github.com/rogpeppe/go-internal v1.10.1-0.20230524175051-ec119421bb97 // indirect
|
||||
github.com/samber/lo v1.38.1 // indirect
|
||||
github.com/sergi/go-diff v1.2.0 // indirect
|
||||
github.com/stretchr/testify v1.8.4 // indirect
|
||||
github.com/wailsapp/go-webview2 v1.0.9 // indirect
|
||||
github.com/wailsapp/mimetype v1.4.1 // indirect
|
||||
github.com/xanzy/ssh-agent v0.3.0 // indirect
|
||||
golang.org/x/crypto v0.9.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect
|
||||
golang.org/x/net v0.10.0 // indirect
|
||||
golang.org/x/sys v0.13.0 // indirect
|
||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||
)
|
||||
|
||||
replace github.com/wailsapp/wails/v3 => ../..
|
||||
|
||||
replace github.com/ebitengine/purego v0.4.0-alpha.4 => github.com/tmclane/purego v0.0.0-20230601213035-1f25e70d7b01
|
||||
162
v3/examples/binding/go.sum
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA=
|
||||
github.com/Microsoft/go-winio v0.4.16 h1:FtSW/jqD+l4ba5iPBj9CODVtgfYAD8w2wS923g/cFDk=
|
||||
github.com/Microsoft/go-winio v0.4.16/go.mod h1:XB6nPKklQyQ7GC9LdcBEcBl8PF76WugXOPRXwdLnMv0=
|
||||
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7 h1:uSoVVbwJiQipAclBbw+8quDsfcvFjOpI5iCf4p/cqCs=
|
||||
github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs=
|
||||
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo4JG6LR5AXSUEsOjtdm0kw0FtQtMJA=
|
||||
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
|
||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
|
||||
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
|
||||
github.com/bep/debounce v1.2.1 h1:v67fRdBA9UQu2NhLFXrSg0Brw7CexQekrBwDMM8bzeY=
|
||||
github.com/bep/debounce v1.2.1/go.mod h1:H8yggRPQKLUhUoqrJC1bO2xNya7vanpDl7xR3ISbCJ0=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg=
|
||||
github.com/emirpasic/gods v1.12.0/go.mod h1:YfzfFFoVP/catgzJb4IKIqXjX78Ha8FMSDh3ymbK86o=
|
||||
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
|
||||
github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0=
|
||||
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
|
||||
github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4=
|
||||
github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E=
|
||||
github.com/go-git/go-billy/v5 v5.0.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
|
||||
github.com/go-git/go-billy/v5 v5.1.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
|
||||
github.com/go-git/go-billy/v5 v5.2.0 h1:GcoouCP9J+5slw2uXAocL70z8ml4A8B/H8nEPt6CLPk=
|
||||
github.com/go-git/go-billy/v5 v5.2.0/go.mod h1:pmpqyWchKfYfrkb/UVH4otLvyi/5gJlGI4Hb3ZqZ3W0=
|
||||
github.com/go-git/go-git-fixtures/v4 v4.0.2-0.20200613231340-f56387b50c12 h1:PbKy9zOy4aAKrJ5pibIRpVO2BXnK1Tlcg+caKI7Ox5M=
|
||||
github.com/go-git/go-git-fixtures/v4 v4.0.2-0.20200613231340-f56387b50c12/go.mod h1:m+ICp2rF3jDhFgEZ/8yziagdT1C+ZpZcrJjappBCDSw=
|
||||
github.com/go-git/go-git/v5 v5.3.0 h1:8WKMtJR2j8RntEXR/uvTKagfEt4GYlwQ7mntE4+0GWc=
|
||||
github.com/go-git/go-git/v5 v5.3.0/go.mod h1:xdX4bWJ48aOrdhnl2XqHYstHbbp6+LFS4r4X+lNVprw=
|
||||
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
|
||||
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
|
||||
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
|
||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
||||
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
|
||||
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
|
||||
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
|
||||
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
|
||||
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e h1:Q3+PugElBCf4PFpxhErSzU3/PY5sFL5Z6rfv4AbGAck=
|
||||
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs=
|
||||
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 h1:DowS9hvgyYSX4TO5NpyC606/Z4SxnNYbT+WX27or6Ck=
|
||||
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
|
||||
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
|
||||
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
|
||||
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
|
||||
github.com/leaanthony/go-ansi-parser v1.6.1 h1:xd8bzARK3dErqkPFtoF9F3/HgN8UQk0ed1YDKpEz01A=
|
||||
github.com/leaanthony/go-ansi-parser v1.6.1/go.mod h1:+vva/2y4alzVmmIEpk9QDhA7vLC5zKDTRwfZGOp3IWU=
|
||||
github.com/leaanthony/u v1.1.0 h1:2n0d2BwPVXSUq5yhe8lJPHdxevE2qK5G99PMStMZMaI=
|
||||
github.com/leaanthony/u v1.1.0/go.mod h1:9+o6hejoRljvZ3BzdYlVL0JYCwtnAsVuN9pVTQcaRfI=
|
||||
github.com/lmittmann/tint v1.0.0 h1:fzEj70K1L58uyoePQxKe+ezDZJ5pybiWGdA0JeFvvyw=
|
||||
github.com/lmittmann/tint v1.0.0/go.mod h1:HIS3gSy7qNwGCj+5oRjAutErFBl4BzdQP6cJZ0NfMwE=
|
||||
github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE=
|
||||
github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
|
||||
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
|
||||
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
|
||||
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
|
||||
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
|
||||
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
|
||||
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU=
|
||||
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI=
|
||||
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
|
||||
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
|
||||
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
|
||||
github.com/rogpeppe/go-internal v1.10.1-0.20230524175051-ec119421bb97 h1:3RPlVWzZ/PDqmVuf/FKHARG5EMid/tl7cv54Sw/QRVY=
|
||||
github.com/rogpeppe/go-internal v1.10.1-0.20230524175051-ec119421bb97/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA=
|
||||
github.com/samber/lo v1.38.1 h1:j2XEAqXKb09Am4ebOg31SpvzUTTs6EN3VfgeLUhPdXM=
|
||||
github.com/samber/lo v1.38.1/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA=
|
||||
github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||
github.com/sergi/go-diff v1.2.0 h1:XU+rvMAioB0UC3q1MFrIQy4Vo5/4VsRDQQXHsEya6xQ=
|
||||
github.com/sergi/go-diff v1.2.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
|
||||
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/tmclane/purego v0.0.0-20230601213035-1f25e70d7b01 h1:oQwu3iNDywGp1Hry+PDvz+grwbCGpzY+ckSnWKCnX5Y=
|
||||
github.com/tmclane/purego v0.0.0-20230601213035-1f25e70d7b01/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ=
|
||||
github.com/wailsapp/go-webview2 v1.0.9 h1:lrU+q0cf1wgLdR69rN+ZnRtMJNaJRrcQ4ELxoO7/xjs=
|
||||
github.com/wailsapp/go-webview2 v1.0.9/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo=
|
||||
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
|
||||
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
|
||||
github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI=
|
||||
github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0=
|
||||
golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
|
||||
golang.org/x/crypto v0.9.0 h1:LF6fAI+IutBocDJ2OT0Q1g8plpYljMZ4+lty+dsqw3g=
|
||||
golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0=
|
||||
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME=
|
||||
golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210326060303-6b1517762897/go.mod h1:uSPa2vr4CLtc/ILN5odXGNXS6mhrKVzTaCXzk9m6W3k=
|
||||
golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M=
|
||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200810151505-1b9f1253b3ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
|
||||
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek=
|
||||
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
|
||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
|
||||
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
|
||||
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
|
||||
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
|
||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
|
||||
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
38
v3/examples/binding/main.go
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"embed"
|
||||
_ "embed"
|
||||
"log"
|
||||
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
)
|
||||
|
||||
//go:embed assets/*
|
||||
var assets embed.FS
|
||||
|
||||
func main() {
|
||||
app := application.New(application.Options{
|
||||
Bind: []any{
|
||||
&GreetService{},
|
||||
},
|
||||
Assets: application.AssetOptions{
|
||||
FS: assets,
|
||||
},
|
||||
Mac: application.MacOptions{
|
||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||
},
|
||||
})
|
||||
|
||||
app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
|
||||
URL: "/",
|
||||
DevToolsEnabled: true,
|
||||
})
|
||||
|
||||
err := app.Run()
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
}
|
||||
24
v3/examples/binding/models.ts
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
// @ts-check
|
||||
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
|
||||
// This file is automatically generated. DO NOT EDIT
|
||||
|
||||
export namespace main {
|
||||
|
||||
export class Person {
|
||||
name: string; // Warning: this is unexported in the Go struct.
|
||||
|
||||
static createFrom(source: any = {}) {
|
||||
return new Person(source);
|
||||
}
|
||||
|
||||
constructor(source: any = {}) {
|
||||
if ('string' === typeof source) {
|
||||
source = JSON.parse(source);
|
||||
}
|
||||
|
||||
this.name = source['name'];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
23
v3/examples/build/README.md
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# Build
|
||||
|
||||
Wails has adopted [Taskfile](https://taskfile.dev) as its build tool. This is optional
|
||||
and any build tool can be used. However, Taskfile is a great tool, and we recommend it.
|
||||
|
||||
The Wails CLI has built-in integration with Taskfile so the standalone version is not a
|
||||
requirement.
|
||||
|
||||
## Building
|
||||
|
||||
To build the example, run:
|
||||
|
||||
```bash
|
||||
wails3 task build
|
||||
```
|
||||
|
||||
# Status
|
||||
|
||||
| Platform | Status |
|
||||
|----------|---------|
|
||||
| Mac | Working |
|
||||
| Windows | Working |
|
||||
| Linux | |
|
||||
107
v3/examples/build/Taskfile.yml
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
version: '3'
|
||||
|
||||
vars:
|
||||
APP_NAME: "buildtest{{exeExt}}"
|
||||
tasks:
|
||||
|
||||
build:
|
||||
summary: Builds the application
|
||||
cmds:
|
||||
- go build -gcflags=all="-N -l" -o bin/{{.APP_NAME}}
|
||||
env:
|
||||
CGO_CFLAGS: "-mmacosx-version-min=10.13"
|
||||
CGO_LDFLAGS: "-mmacosx-version-min=10.13"
|
||||
MACOSX_DEPLOYMENT_TARGET: "10.13"
|
||||
|
||||
package:
|
||||
summary: Packages a production build of the application into a `.app` or `.exe` bundle
|
||||
deps:
|
||||
- task: build
|
||||
cmds:
|
||||
- task: package:darwin
|
||||
- task: package:windows
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
||||
generate:icons:
|
||||
summary: Generates Windows `.ico` and Mac `.icns` files from an image
|
||||
dir: build
|
||||
cmds:
|
||||
# Generates both .ico and .icns files
|
||||
- wails3 generate icons -input appicon.png
|
||||
|
||||
build:production:darwin:
|
||||
summary: Creates a production build of the application
|
||||
cmds:
|
||||
- GOOS=darwin GOARCH={{.GOARCH}} go build -tags production -ldflags="-w -s" -o build/bin/{{.APP_NAME}}
|
||||
env:
|
||||
CGO_CFLAGS: "-mmacosx-version-min=10.13"
|
||||
CGO_LDFLAGS: "-mmacosx-version-min=10.13"
|
||||
MACOSX_DEPLOYMENT_TARGET: "10.13"
|
||||
GOARCH: '{{.GOARCH}}'
|
||||
|
||||
generate:app_bundle:
|
||||
summary: Builds a `.app` bundle
|
||||
cmds:
|
||||
- mkdir -p {{.APP_NAME}}.app/Contents/{MacOS,Resources}
|
||||
- cp build/icons.icns {{.APP_NAME}}.app/Contents/Resources
|
||||
- cp build/bin/{{.APP_NAME}} {{.APP_NAME}}.app/Contents/MacOS
|
||||
- cp build/Info.plist {{.APP_NAME}}.app/Contents
|
||||
|
||||
package:darwin:arm64:
|
||||
summary: Packages a production build of the application into a `.app` bundle
|
||||
platforms:
|
||||
- darwin
|
||||
deps:
|
||||
- task: build:production:darwin
|
||||
vars:
|
||||
ARCH: arm64
|
||||
- generate:icons
|
||||
cmds:
|
||||
- task: generate:app_bundle
|
||||
|
||||
package:darwin:
|
||||
summary: Packages a production build of the application into a `.app` bundle
|
||||
platforms:
|
||||
- darwin
|
||||
deps:
|
||||
- task: build:production:darwin
|
||||
- generate:icons
|
||||
cmds:
|
||||
- task: generate:app_bundle
|
||||
|
||||
generate:syso:
|
||||
dir: build
|
||||
platforms:
|
||||
- windows
|
||||
cmds:
|
||||
- wails3 generate syso -arch {{.GOARCH}} -icon icon.ico -manifest wails.exe.manifest -info info.json -out ../wails.syso
|
||||
vars:
|
||||
GOARCH: '{{.GOARCH}}'
|
||||
|
||||
package:windows:
|
||||
summary: Packages a production build of the application into a `.exe` bundle
|
||||
platforms:
|
||||
- windows/amd64
|
||||
deps:
|
||||
- generate:icons
|
||||
cmds:
|
||||
- task: generate:syso
|
||||
vars:
|
||||
GOARCH: amd64
|
||||
- go build -tags production -ldflags="-w -s -H windowsgui" -o bin/{{.APP_NAME}}
|
||||
- powershell Remove-item wails.syso
|
||||
|
||||
|
||||
package:windows:arm64:
|
||||
summary: Packages a production build of the application into a `.exe` bundle (ARM64)
|
||||
platforms:
|
||||
- windows
|
||||
cmds:
|
||||
- task: generate:syso
|
||||
vars:
|
||||
GOARCH: arm64
|
||||
- go build -tags production -ldflags="-w -s -H windowsgui" -o bin/buildtest.arm64.exe
|
||||
- powershell Remove-item wails.syso
|
||||
env:
|
||||
GOARCH: arm64
|
||||
35
v3/examples/build/build/Info.dev.plist
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>My App</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>app</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.wails.app</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>v1.0.0</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>The ultimate thing</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>v1</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>icons</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.13.0</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<string>true</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>(c) Me</string>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsLocalNetworking</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
</dict>
|
||||
</plist>
|
||||
27
v3/examples/build/build/Info.plist
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>My App</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>app</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.wails.app</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>v1.0.0</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>The ultimate thing</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>v1</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>icons</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.13.0</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<string>true</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>(c) Me</string>
|
||||
</dict>
|
||||
</plist>
|
||||
BIN
v3/examples/build/build/appicon.png
Normal file
|
After Width: | Height: | Size: 130 KiB |
BIN
v3/examples/build/build/icon.ico
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
v3/examples/build/build/icons.icns
Normal file
15
v3/examples/build/build/info.json
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"fixed": {
|
||||
"file_version": "v1.0.0"
|
||||
},
|
||||
"info": {
|
||||
"0000": {
|
||||
"ProductVersion": "v1.0.0",
|
||||
"CompanyName": "My Company Name",
|
||||
"FileDescription": "A thing that does a thing",
|
||||
"LegalCopyright": "(c) 2023 My Company Name",
|
||||
"ProductName": "My Product Name",
|
||||
"Comments": "This is a comment"
|
||||
}
|
||||
}
|
||||
}
|
||||
15
v3/examples/build/build/wails.exe.manifest
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3">
|
||||
<assemblyIdentity type="win32" name="com.wails.myproductname" version="v1.0.0.0" processorArchitecture="*"/>
|
||||
<dependency>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" language="*"/>
|
||||
</dependentAssembly>
|
||||
</dependency>
|
||||
<asmv3:application>
|
||||
<asmv3:windowsSettings>
|
||||
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/pm</dpiAware> <!-- fallback for Windows 7 and 8 -->
|
||||
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">permonitorv2,permonitor</dpiAwareness> <!-- falls back to per-monitor if per-monitor v2 is not supported -->
|
||||
</asmv3:windowsSettings>
|
||||
</asmv3:application>
|
||||
</assembly>
|
||||
280
v3/examples/build/main.go
Executable file
|
|
@ -0,0 +1,280 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"fmt"
|
||||
"log"
|
||||
"math/rand"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/wailsapp/wails/v3/pkg/events"
|
||||
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
app := application.New(application.Options{
|
||||
Name: "WebviewWindow Demo (debug)",
|
||||
Description: "A demo of the WebviewWindow API",
|
||||
Assets: application.AlphaAssets,
|
||||
Mac: application.MacOptions{
|
||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||
},
|
||||
})
|
||||
|
||||
app.On(events.Mac.ApplicationDidFinishLaunching, func(*application.Event) {
|
||||
log.Println("ApplicationDidFinishLaunching")
|
||||
})
|
||||
|
||||
currentWindow := func(fn func(window *application.WebviewWindow)) {
|
||||
if app.CurrentWindow() != nil {
|
||||
fn(app.CurrentWindow())
|
||||
} else {
|
||||
println("Current WebviewWindow is nil")
|
||||
}
|
||||
}
|
||||
|
||||
// Create a custom menu
|
||||
menu := app.NewMenu()
|
||||
if runtime.GOOS == "darwin" {
|
||||
menu.AddRole(application.AppMenu)
|
||||
}
|
||||
|
||||
windowCounter := 1
|
||||
|
||||
// Let's make a "Demo" menu
|
||||
myMenu := menu.AddSubmenu("New")
|
||||
|
||||
myMenu.Add("New WebviewWindow").
|
||||
SetAccelerator("CmdOrCtrl+N").
|
||||
OnClick(func(ctx *application.Context) {
|
||||
app.NewWebviewWindow().
|
||||
SetTitle("WebviewWindow "+strconv.Itoa(windowCounter)).
|
||||
SetRelativePosition(rand.Intn(1000), rand.Intn(800)).
|
||||
SetURL("https://wails.io").
|
||||
Show()
|
||||
windowCounter++
|
||||
})
|
||||
myMenu.Add("New Frameless WebviewWindow").
|
||||
SetAccelerator("CmdOrCtrl+F").
|
||||
OnClick(func(ctx *application.Context) {
|
||||
app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
|
||||
X: rand.Intn(1000),
|
||||
Y: rand.Intn(800),
|
||||
Frameless: true,
|
||||
Mac: application.MacWindow{
|
||||
InvisibleTitleBarHeight: 50,
|
||||
},
|
||||
}).Show()
|
||||
windowCounter++
|
||||
})
|
||||
if runtime.GOOS == "darwin" {
|
||||
myMenu.Add("New WebviewWindow (MacTitleBarHiddenInset)").
|
||||
OnClick(func(ctx *application.Context) {
|
||||
app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
|
||||
Mac: application.MacWindow{
|
||||
TitleBar: application.MacTitleBarHiddenInset,
|
||||
InvisibleTitleBarHeight: 25,
|
||||
},
|
||||
}).
|
||||
SetTitle("WebviewWindow "+strconv.Itoa(windowCounter)).
|
||||
SetRelativePosition(rand.Intn(1000), rand.Intn(800)).
|
||||
SetHTML("<br/><br/><p>A MacTitleBarHiddenInset WebviewWindow example</p>").
|
||||
Show()
|
||||
windowCounter++
|
||||
})
|
||||
myMenu.Add("New WebviewWindow (MacTitleBarHiddenInsetUnified)").
|
||||
OnClick(func(ctx *application.Context) {
|
||||
app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
|
||||
Mac: application.MacWindow{
|
||||
TitleBar: application.MacTitleBarHiddenInsetUnified,
|
||||
InvisibleTitleBarHeight: 50,
|
||||
},
|
||||
}).
|
||||
SetTitle("WebviewWindow "+strconv.Itoa(windowCounter)).
|
||||
SetRelativePosition(rand.Intn(1000), rand.Intn(800)).
|
||||
SetHTML("<br/><br/><p>A MacTitleBarHiddenInsetUnified WebviewWindow example</p>").
|
||||
Show()
|
||||
windowCounter++
|
||||
})
|
||||
myMenu.Add("New WebviewWindow (MacTitleBarHidden)").
|
||||
OnClick(func(ctx *application.Context) {
|
||||
app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
|
||||
Mac: application.MacWindow{
|
||||
TitleBar: application.MacTitleBarHidden,
|
||||
InvisibleTitleBarHeight: 25,
|
||||
},
|
||||
}).
|
||||
SetTitle("WebviewWindow "+strconv.Itoa(windowCounter)).
|
||||
SetRelativePosition(rand.Intn(1000), rand.Intn(800)).
|
||||
SetHTML("<br/><br/><p>A MacTitleBarHidden WebviewWindow example</p>").
|
||||
Show()
|
||||
windowCounter++
|
||||
})
|
||||
}
|
||||
|
||||
sizeMenu := menu.AddSubmenu("Size")
|
||||
sizeMenu.Add("Set Size (800,600)").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
w.SetSize(800, 600)
|
||||
})
|
||||
})
|
||||
|
||||
sizeMenu.Add("Set Size (Random)").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
w.SetSize(rand.Intn(800)+200, rand.Intn(600)+200)
|
||||
})
|
||||
})
|
||||
sizeMenu.Add("Set Min Size (200,200)").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
w.SetMinSize(200, 200)
|
||||
})
|
||||
})
|
||||
sizeMenu.Add("Set Max Size (600,600)").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
w.SetFullscreenButtonEnabled(false)
|
||||
w.SetMaxSize(600, 600)
|
||||
})
|
||||
})
|
||||
sizeMenu.Add("Get Current WebviewWindow Size").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
width, height := w.Size()
|
||||
application.InfoDialog().SetTitle("Current WebviewWindow Size").SetMessage("Width: " + strconv.Itoa(width) + " Height: " + strconv.Itoa(height)).Show()
|
||||
})
|
||||
})
|
||||
|
||||
sizeMenu.Add("Reset Min Size").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
w.SetMinSize(0, 0)
|
||||
})
|
||||
})
|
||||
|
||||
sizeMenu.Add("Reset Max Size").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
w.SetMaxSize(0, 0)
|
||||
w.SetFullscreenButtonEnabled(true)
|
||||
})
|
||||
})
|
||||
positionMenu := menu.AddSubmenu("Position")
|
||||
positionMenu.Add("Set Relative Position (0,0)").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
w.SetRelativePosition(0, 0)
|
||||
})
|
||||
})
|
||||
positionMenu.Add("Set Relative Position (Random)").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
w.SetRelativePosition(rand.Intn(1000), rand.Intn(800))
|
||||
})
|
||||
})
|
||||
|
||||
positionMenu.Add("Get Relative Position").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
x, y := w.RelativePosition()
|
||||
application.InfoDialog().SetTitle("Current WebviewWindow Relative Position").SetMessage("X: " + strconv.Itoa(x) + " Y: " + strconv.Itoa(y)).Show()
|
||||
})
|
||||
})
|
||||
|
||||
positionMenu.Add("Center").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
w.Center()
|
||||
})
|
||||
})
|
||||
stateMenu := menu.AddSubmenu("State")
|
||||
stateMenu.Add("Minimise (for 2 secs)").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
w.Minimise()
|
||||
time.Sleep(2 * time.Second)
|
||||
w.Restore()
|
||||
})
|
||||
})
|
||||
stateMenu.Add("Maximise").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
w.Maximise()
|
||||
})
|
||||
})
|
||||
stateMenu.Add("Fullscreen").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
w.Fullscreen()
|
||||
})
|
||||
})
|
||||
stateMenu.Add("UnFullscreen").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
w.UnFullscreen()
|
||||
})
|
||||
})
|
||||
stateMenu.Add("Restore").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
w.Restore()
|
||||
})
|
||||
})
|
||||
stateMenu.Add("Hide (for 2 seconds)").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
w.Hide()
|
||||
time.Sleep(2 * time.Second)
|
||||
w.Show()
|
||||
})
|
||||
})
|
||||
stateMenu.Add("Always on Top").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
w.SetAlwaysOnTop(true)
|
||||
})
|
||||
})
|
||||
stateMenu.Add("Not always on Top").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
w.SetAlwaysOnTop(false)
|
||||
})
|
||||
})
|
||||
stateMenu.Add("Google.com").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
w.SetURL("https://google.com")
|
||||
})
|
||||
})
|
||||
stateMenu.Add("wails.io").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
w.SetURL("https://wails.io")
|
||||
})
|
||||
})
|
||||
stateMenu.Add("Get Primary Screen").OnClick(func(ctx *application.Context) {
|
||||
screen, err := app.GetPrimaryScreen()
|
||||
if err != nil {
|
||||
application.ErrorDialog().SetTitle("Error").SetMessage(err.Error()).Show()
|
||||
return
|
||||
}
|
||||
msg := fmt.Sprintf("Screen: %+v", screen)
|
||||
application.InfoDialog().SetTitle("Primary Screen").SetMessage(msg).Show()
|
||||
})
|
||||
stateMenu.Add("Get Screens").OnClick(func(ctx *application.Context) {
|
||||
screens, err := app.GetScreens()
|
||||
if err != nil {
|
||||
application.ErrorDialog().SetTitle("Error").SetMessage(err.Error()).Show()
|
||||
return
|
||||
}
|
||||
for _, screen := range screens {
|
||||
msg := fmt.Sprintf("Screen: %+v", screen)
|
||||
application.InfoDialog().SetTitle(fmt.Sprintf("Screen %s", screen.ID)).SetMessage(msg).Show()
|
||||
}
|
||||
})
|
||||
stateMenu.Add("Get Screen for WebviewWindow").OnClick(func(ctx *application.Context) {
|
||||
currentWindow(func(w *application.WebviewWindow) {
|
||||
screen, err := w.GetScreen()
|
||||
if err != nil {
|
||||
application.ErrorDialog().SetTitle("Error").SetMessage(err.Error()).Show()
|
||||
return
|
||||
}
|
||||
msg := fmt.Sprintf("Screen: %+v", screen)
|
||||
application.InfoDialog().SetTitle(fmt.Sprintf("Screen %s", screen.ID)).SetMessage(msg).Show()
|
||||
})
|
||||
})
|
||||
app.NewWebviewWindow()
|
||||
|
||||
app.SetMenu(menu)
|
||||
err := app.Run()
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
}
|
||||
11
v3/examples/clipboard/README.md
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
# clipboard
|
||||
|
||||
This example demonstrates how to use the clipboard API.
|
||||
|
||||
# Status
|
||||
|
||||
| Platform | Status |
|
||||
|----------|---------|
|
||||
| Mac | Working |
|
||||
| Windows | Working |
|
||||
| Linux | |
|
||||
77
v3/examples/clipboard/main.go
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"log"
|
||||
"runtime"
|
||||
"time"
|
||||
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
app := application.New(application.Options{
|
||||
Name: "Clipboard Demo",
|
||||
Description: "A demo of the clipboard API",
|
||||
Assets: application.AlphaAssets,
|
||||
Mac: application.MacOptions{
|
||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||
},
|
||||
})
|
||||
|
||||
// Create a custom menu
|
||||
menu := app.NewMenu()
|
||||
if runtime.GOOS == "darwin" {
|
||||
menu.AddRole(application.AppMenu)
|
||||
}
|
||||
|
||||
setClipboardMenu := menu.AddSubmenu("Set Clipboard")
|
||||
setClipboardMenu.Add("Set Text 'Hello'").OnClick(func(ctx *application.Context) {
|
||||
success := app.Clipboard().SetText("Hello")
|
||||
if !success {
|
||||
application.InfoDialog().SetMessage("Failed to set clipboard text").Show()
|
||||
}
|
||||
})
|
||||
setClipboardMenu.Add("Set Text 'World'").OnClick(func(ctx *application.Context) {
|
||||
success := app.Clipboard().SetText("World")
|
||||
if !success {
|
||||
application.InfoDialog().SetMessage("Failed to set clipboard text").Show()
|
||||
}
|
||||
})
|
||||
setClipboardMenu.Add("Set Text (current time)").OnClick(func(ctx *application.Context) {
|
||||
success := app.Clipboard().SetText(time.Now().String())
|
||||
if !success {
|
||||
application.InfoDialog().SetMessage("Failed to set clipboard text").Show()
|
||||
}
|
||||
})
|
||||
getClipboardMenu := menu.AddSubmenu("Get Clipboard")
|
||||
getClipboardMenu.Add("Get Text").OnClick(func(ctx *application.Context) {
|
||||
result, ok := app.Clipboard().Text()
|
||||
if !ok {
|
||||
application.InfoDialog().SetMessage("Failed to get clipboard text").Show()
|
||||
} else {
|
||||
application.InfoDialog().SetMessage("Got:\n\n" + result).Show()
|
||||
}
|
||||
})
|
||||
|
||||
clearClipboardMenu := menu.AddSubmenu("Clear Clipboard")
|
||||
clearClipboardMenu.Add("Clear Text").OnClick(func(ctx *application.Context) {
|
||||
success := app.Clipboard().SetText("")
|
||||
if success {
|
||||
application.InfoDialog().SetMessage("Clipboard text cleared").Show()
|
||||
} else {
|
||||
application.InfoDialog().SetMessage("Clipboard text not cleared").Show()
|
||||
}
|
||||
})
|
||||
|
||||
app.SetMenu(menu)
|
||||
|
||||
app.NewWebviewWindow()
|
||||
|
||||
err := app.Run()
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err.Error())
|
||||
}
|
||||
}
|
||||
30
v3/examples/contextmenus/README.md
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# contextmenus
|
||||
|
||||
This example shows how to create a context menu for your application.
|
||||
It demonstrates window level and global context menus.
|
||||
|
||||
A simple menu is registered with the window and the application with the id "test".
|
||||
In our frontend html, we then use the `--custom-contextmenu` style to attach the menu to an element.
|
||||
We also use the `--custom-contextmenu-data` style to pass data to the menu callback which can be read in Go.
|
||||
This is really useful when using components to distinguish between different elements.
|
||||
|
||||
```go
|
||||
|
||||
```html
|
||||
|
||||
<div class="region" id="123abc" style="--custom-contextmenu: test; --custom-contextmenu-data: 1">
|
||||
<h1>1</h1>
|
||||
</div>
|
||||
<div class="region" id="234abc" style="--custom-contextmenu: test; --custom-contextmenu-data: 2">
|
||||
<h1>2</h1>
|
||||
</div>
|
||||
```
|
||||
|
||||
# Status
|
||||
|
||||
| Platform | Status |
|
||||
|----------|---------|
|
||||
| Mac | Working |
|
||||
| Windows | Working |
|
||||
| Linux | |
|
||||
|
||||
64
v3/examples/contextmenus/assets/index.html
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
<style>body{ text-align: center; color: white; background-color: #191919; user-select: none; -ms-user-select: none; -webkit-user-select: none; }</style>
|
||||
<style>.region{ width: 100%; border: 3px solid #00a4db; }</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Context Menu Demo</h1>
|
||||
<p>
|
||||
You need to run this example in production for it to work :
|
||||
<pre style="user-select: text; color: rgb(219, 219, 134)">go run -tags production .</pre>
|
||||
</p>
|
||||
<br/>
|
||||
<div class="region" id="123abc" style="--custom-contextmenu: test; --custom-contextmenu-data: 1">
|
||||
<h1>1</h1>
|
||||
</div>
|
||||
<div class="region" id="234abc" style="--custom-contextmenu: test; --custom-contextmenu-data: 2">
|
||||
<h1>2</h1>
|
||||
</div>
|
||||
<div class="region" id="123abcg" style="--default-contextmenu: show">
|
||||
<h1>Default Context Menu shown here</h1>
|
||||
<label>
|
||||
<input type="text" placeholder="context menu hidden here" style="--default-contextmenu: hide"/>
|
||||
</label>
|
||||
</div>
|
||||
<div class="region" id="123abcgr">
|
||||
<h1>Default auto (smart) Context Menu here</h1>
|
||||
<label>
|
||||
<input type="text" placeholder="context menu shown here"/>
|
||||
</label>
|
||||
<br/>
|
||||
<div style="user-select: text">
|
||||
<p>Context menu shown here only if you select text</p>
|
||||
<p>Selecting text here and right-clicking the box below or its border shouldn't show the context menu</p>
|
||||
<div style="user-select: none; padding: 10px; width: 50px; margin: auto; background: #00a4db;">
|
||||
<div style="user-select: auto; height: 20px; background: white;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<input type="text" value="input">
|
||||
<input type="text" value="disabled" disabled>
|
||||
<input type="text" value="readonly" readonly>
|
||||
<textarea placeholder="context menu shown here"></textarea>
|
||||
<p contenteditable="true">content editable</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="region" id="234abcs" style="--default-contextmenu: hide">
|
||||
<h1>Default Context Menu hidden here</h1>
|
||||
<p style="user-select: text">Context Menu hidden here even if text is selected</p>
|
||||
<label>
|
||||
<input type="text" placeholder="context menu works here" style="--default-contextmenu: show"/>
|
||||
</label>
|
||||
<div style="--default-contextmenu: auto">
|
||||
<div style="border: solid 2px white; margin: 10px">
|
||||
<h2>Nested section reverted to auto (smart) default Context Menu</h2>
|
||||
<p style="user-select: text">Context menu shown here only if you select text</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
59
v3/examples/contextmenus/main.go
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"embed"
|
||||
_ "embed"
|
||||
"log"
|
||||
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
)
|
||||
|
||||
//go:embed assets
|
||||
var assets embed.FS
|
||||
|
||||
func main() {
|
||||
|
||||
app := application.New(application.Options{
|
||||
Name: "Context Menu Demo",
|
||||
Description: "A demo of the Context Menu API",
|
||||
Assets: application.AssetOptions{
|
||||
FS: assets,
|
||||
},
|
||||
Mac: application.MacOptions{
|
||||
ApplicationShouldTerminateAfterLastWindowClosed: true,
|
||||
},
|
||||
})
|
||||
|
||||
mainWindow := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
|
||||
Title: "Context Menu Demo",
|
||||
Width: 1024,
|
||||
Height: 1024,
|
||||
Mac: application.MacWindow{
|
||||
Backdrop: application.MacBackdropTranslucent,
|
||||
TitleBar: application.MacTitleBarHiddenInsetUnified,
|
||||
InvisibleTitleBarHeight: 50,
|
||||
},
|
||||
})
|
||||
|
||||
contextMenu := app.NewMenu()
|
||||
contextMenu.Add("Click Me").OnClick(func(data *application.Context) {
|
||||
app.Logger.Info("Context menu", "context data", data.ContextMenuData())
|
||||
})
|
||||
|
||||
globalContextMenu := app.NewMenu()
|
||||
globalContextMenu.Add("Default context menu item").OnClick(func(data *application.Context) {
|
||||
app.Logger.Info("Context menu", "context data", data.ContextMenuData())
|
||||
})
|
||||
|
||||
// Registering the menu with a window will make it available to that window only
|
||||
mainWindow.RegisterContextMenu("test", contextMenu)
|
||||
|
||||
// Registering the menu with the app will make it available to all windows
|
||||
app.RegisterContextMenu("test", globalContextMenu)
|
||||
|
||||
err := app.Run()
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err.Error())
|
||||
}
|
||||
}
|
||||
1
v3/examples/dev/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
.task
|
||||
4
v3/examples/dev/README.md
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# Dev Example
|
||||
|
||||
**NOTE**: This example is currently a work in progress. It is not yet ready for use.
|
||||
|
||||
183
v3/examples/dev/Taskfile.yml
Normal file
|
|
@ -0,0 +1,183 @@
|
|||
version: '3'
|
||||
|
||||
vars:
|
||||
APP_NAME: "dev{{exeExt}}"
|
||||
|
||||
tasks:
|
||||
|
||||
pre-build:
|
||||
summary: Pre-build hooks
|
||||
|
||||
post-build:
|
||||
summary: Post-build hooks
|
||||
|
||||
install-frontend-deps:
|
||||
summary: Install frontend dependencies
|
||||
dir: frontend
|
||||
sources:
|
||||
- package.json
|
||||
- package-lock.json
|
||||
generates:
|
||||
- node_modules/*
|
||||
preconditions:
|
||||
- sh: npm version
|
||||
msg: "Looks like npm isn't installed. Npm is part of the Node installer: https://nodejs.org/en/download/"
|
||||
cmds:
|
||||
- npm install
|
||||
|
||||
build-frontend:
|
||||
summary: Build the frontend project
|
||||
dir: frontend
|
||||
sources:
|
||||
- src/*
|
||||
generates:
|
||||
- dist/*
|
||||
deps:
|
||||
- install-frontend-deps
|
||||
cmds:
|
||||
- npm run build
|
||||
|
||||
build:darwin:
|
||||
summary: Builds the application
|
||||
platforms:
|
||||
- darwin
|
||||
cmds:
|
||||
- task: pre-build
|
||||
- task: build-frontend
|
||||
- go build -gcflags=all="-N -l" -o bin/{{.APP_NAME}}
|
||||
- task: post-build
|
||||
env:
|
||||
CGO_CFLAGS: "-mmacosx-version-min=10.13"
|
||||
CGO_LDFLAGS: "-mmacosx-version-min=10.13"
|
||||
MACOSX_DEPLOYMENT_TARGET: "10.13"
|
||||
|
||||
build:backend:darwin:
|
||||
summary: Builds the application
|
||||
platforms:
|
||||
- darwin
|
||||
cmds:
|
||||
- task: pre-build
|
||||
- go build -gcflags=all="-N -l" -o bin/{{.APP_NAME}}
|
||||
- task: post-build
|
||||
env:
|
||||
CGO_CFLAGS: "-mmacosx-version-min=10.13"
|
||||
CGO_LDFLAGS: "-mmacosx-version-min=10.13"
|
||||
MACOSX_DEPLOYMENT_TARGET: "10.13"
|
||||
|
||||
build:windows:
|
||||
summary: Builds the application for Windows
|
||||
platforms:
|
||||
- windows
|
||||
cmds:
|
||||
- task: pre-build
|
||||
- task: build-frontend
|
||||
- go build -gcflags=all="-N -l" -o bin/{{.APP_NAME}}
|
||||
- task: post-build
|
||||
|
||||
|
||||
build:backend:windows:
|
||||
summary: Builds the backend application for Windows
|
||||
platforms:
|
||||
- windows
|
||||
cmds:
|
||||
- task: pre-build
|
||||
- go build -gcflags=all="-N -l" -o bin/{{.APP_NAME}}
|
||||
- task: post-build
|
||||
|
||||
build:
|
||||
summary: Builds the application
|
||||
watch: true
|
||||
sources:
|
||||
- main.go
|
||||
cmds:
|
||||
- task: build:darwin
|
||||
- task: build:windows
|
||||
- task: run
|
||||
|
||||
build:backend:
|
||||
summary: Builds the backend application
|
||||
cmds:
|
||||
- task: build:backend:darwin
|
||||
- task: build:backend:windows
|
||||
|
||||
generate-icons:
|
||||
summary: Generates Windows `.ico` and Mac `.icns` files from an image
|
||||
dir: build
|
||||
cmds:
|
||||
# Generates both .ico and .icns files
|
||||
- wails generate icons -input appicon.png
|
||||
|
||||
build-app-prod-darwin:
|
||||
summary: Creates a production build of the application
|
||||
cmds:
|
||||
- task: pre-build
|
||||
- task: build-frontend
|
||||
- GOOS=darwin GOARCH={{.ARCH}} go build -tags production -ldflags="-w -s" -o build/bin/{{.APP_NAME}}
|
||||
- task: post-build
|
||||
env:
|
||||
CGO_CFLAGS: "-mmacosx-version-min=10.13"
|
||||
CGO_LDFLAGS: "-mmacosx-version-min=10.13"
|
||||
MACOSX_DEPLOYMENT_TARGET: "10.13"
|
||||
vars:
|
||||
ARCH: $GOARCH
|
||||
|
||||
frontend:dev:
|
||||
summary: Runs the frontend in development mode
|
||||
deps:
|
||||
- task: install-frontend-deps
|
||||
dir: frontend
|
||||
cmds:
|
||||
- npm run dev
|
||||
|
||||
run:
|
||||
summary: Runs the application
|
||||
cmds:
|
||||
- ./bin/{{.APP_NAME}}
|
||||
|
||||
dev:
|
||||
summary: Runs the application in development mode
|
||||
watch: true
|
||||
preconditions:
|
||||
- sh: 'wails3 tool checkport -p 5173'
|
||||
msg: "Vite does not appear to be running. Please run `wails3 task frontend:dev` in another terminal."
|
||||
cmds:
|
||||
- task: build:backend
|
||||
|
||||
create-app-bundle:
|
||||
summary: Builds a `.app` bundle
|
||||
cmds:
|
||||
- mkdir -p {{.APP_NAME}}.app/Contents/{MacOS,Resources}
|
||||
- cp build/icons.icns {{.APP_NAME}}.app/Contents/Resources
|
||||
- cp build/bin/{{.APP_NAME}} {{.APP_NAME}}.app/Contents/MacOS
|
||||
- cp build/Info.plist {{.APP_NAME}}.app/Contents
|
||||
|
||||
package-darwin-arm64:
|
||||
summary: Packages a production build of the application into a `.app` bundle
|
||||
platform: darwin
|
||||
deps:
|
||||
- task: build-app-prod-darwin
|
||||
vars:
|
||||
ARCH: arm64
|
||||
- generate-icons
|
||||
cmds:
|
||||
- task: create-app-bundle
|
||||
|
||||
generate:syso:
|
||||
dir: build
|
||||
platform: windows
|
||||
cmds:
|
||||
- wails generate syso -arch {{.ARCH}} -icon icon.ico -manifest wails.exe.manifest -info info.json -out ../wails.syso
|
||||
vars:
|
||||
ARCH: $GOARCH
|
||||
|
||||
package:windows:
|
||||
summary: Packages a production build of the application into a `.exe` bundle
|
||||
platform: windows
|
||||
deps:
|
||||
- generate-icons
|
||||
cmds:
|
||||
- task: generate:syso
|
||||
vars:
|
||||
ARCH: amd64
|
||||
- go build -tags production -ldflags="-w -s -H windowsgui" -o bin/{{.APP_NAME}}.exe
|
||||
- powershell Remove-item wails.syso
|
||||
32
v3/examples/dev/build/Info.dev.plist
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>My Product Name</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>dev</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.wails.dev</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>v1.0.0</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>This is a comment</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>v1.0.0</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>icons</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.13.0</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<string>true</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>(c) 2023 My Company Name</string>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<key>NSAllowsLocalNetworking</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
27
v3/examples/dev/build/Info.plist
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>My Product Name</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>dev</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.wails.dev</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>v1.0.0</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>This is a comment</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>v1.0.0</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>icons</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.13.0</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<string>true</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>(c) 2023 My Company Name</string>
|
||||
</dict>
|
||||
</plist>
|
||||
BIN
v3/examples/dev/build/appicon.png
Normal file
|
After Width: | Height: | Size: 130 KiB |