mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-12-01 07:24:56 -10:00
Compare commits
818
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d5521b3f9 | ||
|
|
cbf011b74f | ||
|
|
37bec45aeb | ||
|
|
b9716478a0 | ||
|
|
1996d64dc7 | ||
|
|
7039bc061e | ||
|
|
526c7b850c | ||
|
|
2774595caf | ||
|
|
8d6fc2a8ea | ||
|
|
0798f0f6d2 | ||
|
|
f1136abfd4 | ||
|
|
085833d1a6 | ||
|
|
1bfddeefd6 | ||
|
|
4dfc9d3596 | ||
|
|
a66a8abf4b | ||
|
|
f32f31a57a | ||
|
|
4914c9c51a | ||
|
|
d1c52db648 | ||
|
|
0f915cfbb3 | ||
|
|
a4ed8f0031 | ||
|
|
243372dd5a | ||
|
|
91d87bd6ab | ||
|
|
772e9161b7 | ||
|
|
8c97698080 | ||
|
|
3ade7e31ff | ||
|
|
76039460d4 | ||
|
|
1f1cab1b21 | ||
|
|
6713e4ff5b | ||
|
|
7710ff64d7 | ||
|
|
b4d07595ca | ||
|
|
6b30e415e6 | ||
|
|
e3bd661f54 | ||
|
|
6e018d17d2 | ||
|
|
b5e603b784 | ||
|
|
7477cd2fab | ||
|
|
d9f045aaec | ||
|
|
c099b7e76b | ||
|
|
a024a8102f | ||
|
|
8f087a395b | ||
|
|
b345ca3fd2 | ||
|
|
baf2403d7e | ||
|
|
377ba8f00c | ||
|
|
f8f3ca5a53 | ||
|
|
a2f8a5dd6a | ||
|
|
4c3fabbaa5 | ||
|
|
e391d10831 | ||
|
|
45f0d21f25 | ||
|
|
24746da590 | ||
|
|
8ef7432e33 | ||
|
|
e4bcb13b2a | ||
|
|
275d3d0af9 | ||
|
|
02a60ce521 | ||
|
|
d033921124 | ||
|
|
4e4dc189f2 | ||
|
|
59aa4510d0 | ||
|
|
e38fab2245 | ||
|
|
7ec230b71a | ||
|
|
8f323f09bc | ||
|
|
38e4036230 | ||
|
|
658f03704f | ||
|
|
34eedcc3ac | ||
|
|
bb7c1a2073 | ||
|
|
39158dec4b | ||
|
|
28ed22824f | ||
|
|
d10ccbedac | ||
|
|
55c4e6689b | ||
|
|
0c983566f6 | ||
|
|
68c3c759d5 | ||
|
|
ac5be43448 | ||
|
|
d24919c2c3 | ||
|
|
34a9aa9a48 | ||
|
|
ae321b3409 | ||
|
|
c2fb97cc81 | ||
|
|
aa27f55ab5 | ||
|
|
8f5d500459 | ||
|
|
f7562b6fd7 | ||
|
|
fdcbdd1646 | ||
|
|
2ef9c11cd3 | ||
|
|
46c84c21fe | ||
|
|
b1b372f1d6 | ||
|
|
907b7d5ce3 | ||
|
|
ddafaaa757 | ||
|
|
2c1cca7e99 | ||
|
|
c91d0cd5a3 | ||
|
|
84ed60a404 | ||
|
|
942d138fc1 | ||
|
|
dadc8717ff | ||
|
|
9423dcada7 | ||
|
|
2941c74051 | ||
|
|
cd00af84f3 | ||
|
|
951339a6d6 | ||
|
|
f5507c0959 | ||
|
|
60bba681d3 | ||
|
|
f868aadd8d | ||
|
|
b610d9bc23 | ||
|
|
69398a6703 | ||
|
|
d7ae6029e0 | ||
|
|
343710b623 | ||
|
|
f872c5cd57 | ||
|
|
626956c950 | ||
|
|
b22bbf6d95 | ||
|
|
75117e8d6b | ||
|
|
95672018b0 | ||
|
|
d0fb9a1efc | ||
|
|
f0622d62b6 | ||
|
|
2da22f2458 | ||
|
|
849e08829d | ||
|
|
679421ec80 | ||
|
|
9a925d16e5 | ||
|
|
e49c707524 | ||
|
|
506690d109 | ||
|
|
4813fe39b0 | ||
|
|
6e44a74254 | ||
|
|
3d13dc379b | ||
|
|
aee07b052a | ||
|
|
2ed5e775e5 | ||
|
|
23e6b0f11d | ||
|
|
97d8452a1d | ||
|
|
ab32a60476 | ||
|
|
7d1303f695 | ||
|
|
f90bef159c | ||
|
|
cb30348215 | ||
|
|
3f1351e3b9 | ||
|
|
eb4a122322 | ||
|
|
358eb317d2 | ||
|
|
04a401c1b8 | ||
|
|
6f06f030d6 | ||
|
|
fac555ab3b | ||
|
|
8d111e37f5 | ||
|
|
fdf6cfe296 | ||
|
|
c6d6f9f8be | ||
|
|
68d2a06c80 | ||
|
|
0bede7969c | ||
|
|
e38926004f | ||
|
|
e8f7366a43 | ||
|
|
5e705aaa04 | ||
|
|
cc444da637 | ||
|
|
1940e430dc | ||
|
|
eaadea6593 | ||
|
|
ecd2007e63 | ||
|
|
fea741cdef | ||
|
|
98550f6f25 | ||
|
|
89b797f4c1 | ||
|
|
21cceeb7ba | ||
|
|
96024d6c2c | ||
|
|
645d346565 | ||
|
|
3e51b757db | ||
|
|
944d00cac5 | ||
|
|
e725f55043 | ||
|
|
fb35dadf1b | ||
|
|
5612b63633 | ||
|
|
97430120f4 | ||
|
|
b0567122f5 | ||
|
|
ae87be30b0 | ||
|
|
f11e6f3bc6 | ||
|
|
d2bf8f99d2 | ||
|
|
63725ea623 | ||
|
|
80746a7f55 | ||
|
|
23c7a96a94 | ||
|
|
4d9a626df2 | ||
|
|
54c5aa32f0 | ||
|
|
dd84cd7417 | ||
|
|
2a1d7d0721 | ||
|
|
34b2312113 | ||
|
|
de8713b686 | ||
|
|
7986cabadb | ||
|
|
150cfaa550 | ||
|
|
5457b4faec | ||
|
|
1c055bfaab | ||
|
|
c64a9e5cee | ||
|
|
ff2afbccda | ||
|
|
3bb6aa97b9 | ||
|
|
d5bb887b79 | ||
|
|
c2afc07a04 | ||
|
|
c8f38059f8 | ||
|
|
c7a64fff0c | ||
|
|
fd31f2d89b | ||
|
|
10256dd22c | ||
|
|
96cc520c4b | ||
|
|
8c48d5acce | ||
|
|
681b38d3d6 | ||
|
|
5a16e18b2a | ||
|
|
3c5e1b8a38 | ||
|
|
404d9f3047 | ||
|
|
c8667edacc | ||
|
|
2fa6b743fe | ||
|
|
daa8b6a5a4 | ||
|
|
39425ca7ea | ||
|
|
48e776c1af | ||
|
|
c19f79977b | ||
|
|
5c580f9dac | ||
|
|
e3b968f7e2 | ||
|
|
8f1b2bed5f | ||
|
|
c111308c67 | ||
|
|
20af96c1d9 | ||
|
|
2df0bd25c3 | ||
|
|
656daa26bc | ||
|
|
e9e7ef54f6 | ||
|
|
51662a5fe8 | ||
|
|
35a98a2975 | ||
|
|
ef6d430f97 | ||
|
|
d63362718f | ||
|
|
104b8b71e6 | ||
|
|
f635c56eab | ||
|
|
c507b35645 | ||
|
|
ba7cbd83bc | ||
|
|
69585b25e3 | ||
|
|
d117c3eace | ||
|
|
a034923695 | ||
|
|
3994312440 | ||
|
|
9a129ecf5c | ||
|
|
8e23d3509b | ||
|
|
b593b26ad7 | ||
|
|
759519782b | ||
|
|
ceb2de51fb | ||
|
|
c75c6c9695 | ||
|
|
b22158b022 | ||
|
|
e68735f98e | ||
|
|
c6e17a789b | ||
|
|
6b1e9912ef | ||
|
|
681b4033f5 | ||
|
|
4b01abe36d | ||
|
|
461ddbc872 | ||
|
|
3f082c881f | ||
|
|
faed7f81bf | ||
|
|
fd01d66070 | ||
|
|
0b922f1452 | ||
|
|
7762ab2e4c | ||
|
|
1bd4ddf377 | ||
|
|
7c8b189c71 | ||
|
|
9b3d07dc51 | ||
|
|
788fe227c6 | ||
|
|
ca44dbaf55 | ||
|
|
e907a4d574 | ||
|
|
b2265be88f | ||
|
|
049b9dbc4d | ||
|
|
79136c95be | ||
|
|
808662e3d2 | ||
|
|
2f24459344 | ||
|
|
e52a442504 | ||
|
|
5927eff059 | ||
|
|
949022cee0 | ||
|
|
0952933ede | ||
|
|
b2e5b6645c | ||
|
|
9332c7f775 | ||
|
|
0bce26c54e | ||
|
|
343cdb31a8 | ||
|
|
dcabaf1ae4 | ||
|
|
20f9780f55 | ||
|
|
eabaf82a26 | ||
|
|
85d6eda68e | ||
|
|
7af4fe4bad | ||
|
|
9bbb203da1 | ||
|
|
e00dab0dc4 | ||
|
|
5c3982fff2 | ||
|
|
3d7e85c054 | ||
|
|
95f2b3bbad | ||
|
|
515a5265fe | ||
|
|
2f65a3aee2 | ||
|
|
1964fdb99e | ||
|
|
117da97dd5 | ||
|
|
f88896a887 | ||
|
|
0eab6aa93c | ||
|
|
581bb05f5d | ||
|
|
048c458789 | ||
|
|
d241cdcb2e | ||
|
|
a770448bc9 | ||
|
|
2090e9979a | ||
|
|
a040362d4a | ||
|
|
e40fe7843d | ||
|
|
dc813e35fc | ||
|
|
f0bb2edb3d | ||
|
|
7e29fe9a31 | ||
|
|
ba0a97aefe | ||
|
|
97a43e66fb | ||
|
|
97f8113fe4 | ||
|
|
6a54dcb5da | ||
|
|
9f9899cfd0 | ||
|
|
f82b0a8fca | ||
|
|
540a4ff273 | ||
|
|
294952e152 | ||
|
|
f05a644bd9 | ||
|
|
95c1ab81f3 | ||
|
|
7ae7bda3d3 | ||
|
|
1648e33c1f | ||
|
|
8a38af5be7 | ||
|
|
7c870d9426 | ||
|
|
0882637801 | ||
|
|
9626c047a4 | ||
|
|
3e674c939b | ||
|
|
2a3f1a12a8 | ||
|
|
6ee0239b96 | ||
|
|
244b25708d | ||
|
|
a979ccd5bd | ||
|
|
fa27d53b98 | ||
|
|
cc465d6f2a | ||
|
|
21bf290013 | ||
|
|
684496109a | ||
|
|
f3faefd460 | ||
|
|
6fb6e83d68 | ||
|
|
ebbbb6bd1b | ||
|
|
03c33dc784 | ||
|
|
57ee2b00ca | ||
|
|
1158d93bb4 | ||
|
|
c1fa8ba8da | ||
|
|
f798b48b83 | ||
|
|
b286e89746 | ||
|
|
d753ce26f7 | ||
|
|
a72ac39059 | ||
|
|
1f05000238 | ||
|
|
b45cc312dd | ||
|
|
de11d29d8e | ||
|
|
194c5b2222 | ||
|
|
e8f9413e03 | ||
|
|
7bc0f042ce | ||
|
|
674b3a213f | ||
|
|
3bf32443ed | ||
|
|
5f100946f2 | ||
|
|
13abf9fa8c | ||
|
|
236ab7a11c | ||
|
|
5b008936d2 | ||
|
|
9a9436c5b9 | ||
|
|
b1d8ac0e64 | ||
|
|
a5e7a4f905 | ||
|
|
9f01e54a9b | ||
|
|
8b8cac23d1 | ||
|
|
82879c7a08 | ||
|
|
3414b32d5e | ||
|
|
971d1fb16b | ||
|
|
077d11bdba | ||
|
|
34e0fd7757 | ||
|
|
b56af15e5e | ||
|
|
cde8dd78e6 | ||
|
|
2b8ef42086 | ||
|
|
e524dff1a7 | ||
|
|
05d3d66587 | ||
|
|
26a0b901d4 | ||
|
|
97324cd852 | ||
|
|
f658665d4a | ||
|
|
a7171f5939 | ||
|
|
f2c83d2278 | ||
|
|
863b1f9993 | ||
|
|
02a40a860f | ||
|
|
b4e04e616a | ||
|
|
bc1f63ccc6 | ||
|
|
04bca4a877 | ||
|
|
cc7d700bfd | ||
|
|
2835c3b536 | ||
|
|
7a6e4f6f25 | ||
|
|
b645871dbc | ||
|
|
85ee5e41b9 | ||
|
|
d5c67eeb55 | ||
|
|
2c29d2c406 | ||
|
|
a3b62dac00 | ||
|
|
9d2071ce6a | ||
|
|
6fe1af3afe | ||
|
|
08c6d02e5b | ||
|
|
cd8ea1f554 | ||
|
|
7b9c480a8d | ||
|
|
e32ff4b7f0 | ||
|
|
78679a5ba2 | ||
|
|
51427bef5f | ||
|
|
a40e0d2887 | ||
|
|
bbbe04903f | ||
|
|
d0d9a350c7 | ||
|
|
9dccc526bb | ||
|
|
96be4ec351 | ||
|
|
62287d7893 | ||
|
|
c3b0c87cfe | ||
|
|
2770df7567 | ||
|
|
21d2994059 | ||
|
|
d5f0140f26 | ||
|
|
c4a978009a | ||
|
|
256dd26b99 | ||
|
|
06e2a049de | ||
|
|
79df7cfa87 | ||
|
|
16c7544d96 | ||
|
|
a56746c6bf | ||
|
|
456a7c868d | ||
|
|
1c9c19a697 | ||
|
|
696b625a3e | ||
|
|
4d5dce976e | ||
|
|
629a1f4b4c | ||
|
|
f6def3b911 | ||
|
|
98daa75c26 | ||
|
|
a28b9437aa | ||
|
|
6b3e4757de | ||
|
|
cb21e5960b | ||
|
|
d97fe835b5 | ||
|
|
9d876ab27d | ||
|
|
dff8ac5511 | ||
|
|
0834bff2da | ||
|
|
525e49f7e9 | ||
|
|
1596469e92 | ||
|
|
9512f7df41 | ||
|
|
24c857ddc7 | ||
|
|
2ae35a67e7 | ||
|
|
c0a8241f50 | ||
|
|
1c2ac19b16 | ||
|
|
8ae8c47fe1 | ||
|
|
023cf1bedd | ||
|
|
d106bedecd | ||
|
|
ecf94258fa | ||
|
|
22a6e0d767 | ||
|
|
9565d43481 | ||
|
|
05f6138b65 | ||
|
|
39a7c45ccd | ||
|
|
269a217cf9 | ||
|
|
5becf132e7 | ||
|
|
644e9cf91e | ||
|
|
9db91a1ac4 | ||
|
|
e59612c4ce | ||
|
|
62203cb171 | ||
|
|
21e5e06b0b | ||
|
|
b27b4c6be7 | ||
|
|
ebdb835890 | ||
|
|
de2ae29edd | ||
|
|
325e9aff06 | ||
|
|
ab7f59ca61 | ||
|
|
a0d5f418d9 | ||
|
|
9943af5248 | ||
|
|
485bac89e5 | ||
|
|
eeb1f85e25 | ||
|
|
42f4c1396b | ||
|
|
eddd742f9b | ||
|
|
0acfd3e178 | ||
|
|
29f6e686ee | ||
|
|
7cd5531730 | ||
|
|
83d03ad67d | ||
|
|
4c1974c200 | ||
|
|
4474de4662 | ||
|
|
86134c26b4 | ||
|
|
4b2430290c | ||
|
|
e686ee9f42 | ||
|
|
8cadafa063 | ||
|
|
f52009b402 | ||
|
|
ba63c26c62 | ||
|
|
0847d7b0ab | ||
|
|
5774ec215d | ||
|
|
f6c73d1c20 | ||
|
|
b6ac217b70 | ||
|
|
d44b0cd308 | ||
|
|
b152f46380 | ||
|
|
fc7348d08a | ||
|
|
6b11b47753 | ||
|
|
84fb901b5a | ||
|
|
b396d17211 | ||
|
|
cf150b5cff | ||
|
|
df8c2125d9 | ||
|
|
e0368435b9 | ||
|
|
3eba762135 | ||
|
|
881784ba66 | ||
|
|
afc2c9178e | ||
|
|
76938eb69a | ||
|
|
324b9e664c | ||
|
|
824d1162eb | ||
|
|
3d84e63ef9 | ||
|
|
7bb01c9651 | ||
|
|
c9c76df40c | ||
|
|
c32c808d5b | ||
|
|
6c0af72053 | ||
|
|
328c4f272b | ||
|
|
a59fed9d1c | ||
|
|
1444c333ab | ||
|
|
f42d12da9e | ||
|
|
fcf9396a71 | ||
|
|
e2117d9a02 | ||
|
|
d3f36a95cf | ||
|
|
c2e1208d82 | ||
|
|
6c5e3c97f8 | ||
|
|
2a2a60883d | ||
|
|
60f16d72a5 | ||
|
|
79d778a535 | ||
|
|
da45ab2f87 | ||
|
|
661e8bc569 | ||
|
|
b100892bfa | ||
|
|
b099e2faca | ||
|
|
39656d4c73 | ||
|
|
0eb440db14 | ||
|
|
211111a01f | ||
|
|
1d0337285a | ||
|
|
848ff5fd52 | ||
|
|
19aaeb374b | ||
|
|
bf269d7693 | ||
|
|
a99b2806ff | ||
|
|
e0212ca4b9 | ||
|
|
55463fe0aa | ||
|
|
4360359d60 | ||
|
|
7077e877f9 | ||
|
|
b52bf7b7d4 | ||
|
|
55115d89d5 | ||
|
|
5edb00bd9a | ||
|
|
ab822afae4 | ||
|
|
1a06d3ea80 | ||
|
|
87bd3d41df | ||
|
|
662691f32a | ||
|
|
1543d974ac | ||
|
|
79bf1ab688 | ||
|
|
211b9113a1 | ||
|
|
d41883a942 | ||
|
|
86e41a110a | ||
|
|
203910a92f | ||
|
|
a3ea6ab0af | ||
|
|
e2a142333f | ||
|
|
71ff4c937f | ||
|
|
50a618ad12 | ||
|
|
6388a32ac5 | ||
|
|
865e9713ad | ||
|
|
e529f74495 | ||
|
|
36366b34f2 | ||
|
|
11b7af61ef | ||
|
|
a10092c10c | ||
|
|
9727e14fe9 | ||
|
|
9a23b9908e | ||
|
|
4a37ce4576 | ||
|
|
5b1e1cb2fb | ||
|
|
bf486b4cb5 | ||
|
|
b7a1b3e665 | ||
|
|
342160b803 | ||
|
|
06f27f1d3a | ||
|
|
b0cc8a9243 | ||
|
|
96418e8f5d | ||
|
|
17da9ec099 | ||
|
|
d5d10fe548 | ||
|
|
4a0c2016e6 | ||
|
|
087b4cd71f | ||
|
|
9bcac1af2d | ||
|
|
ed7987c881 | ||
|
|
64fd12a1a0 | ||
|
|
0c7b5cd534 | ||
|
|
2e2c4fe180 | ||
|
|
124b17f609 | ||
|
|
eb562146ce | ||
|
|
2e842cb425 | ||
|
|
7f6571ee52 | ||
|
|
187b4c38b4 | ||
|
|
d9214c7292 | ||
|
|
df8001fca8 | ||
|
|
efd142f030 | ||
|
|
f7815d0cd0 | ||
|
|
4c45c88034 | ||
|
|
eb30ee78bc | ||
|
|
a3f88b0f96 | ||
|
|
a18b7ff79d | ||
|
|
6d0357bbcf | ||
|
|
81d0b8b8d4 | ||
|
|
116a4106c4 | ||
|
|
2ac82a10b5 | ||
|
|
90533e656f | ||
|
|
58aae4f87b | ||
|
|
095c2a6d47 | ||
|
|
35b812ccfe | ||
|
|
8e52309bb0 | ||
|
|
3a7a5f5953 | ||
|
|
b1933e3bcb | ||
|
|
2910e50b2f | ||
|
|
e7a2800665 | ||
|
|
9f9dd71e91 | ||
|
|
20501cac96 | ||
|
|
4300a885dc | ||
|
|
f06983d072 | ||
|
|
52d2b38a82 | ||
|
|
fbd2658148 | ||
|
|
3d1491ce92 | ||
|
|
5d22292072 | ||
|
|
50ef6e15cb | ||
|
|
ead914ec2b | ||
|
|
8a1dfb9d8f | ||
|
|
f00a15a4c9 | ||
|
|
5834ee9ce4 | ||
|
|
8a75c0c1e1 | ||
|
|
54a02dedd5 | ||
|
|
7cc3097acd | ||
|
|
a8b5203d6c | ||
|
|
9ecbfb7110 | ||
|
|
f1cbc4b396 | ||
|
|
81c73d11ff | ||
|
|
cde7d5f951 | ||
|
|
da7437c023 | ||
|
|
4090f6c980 | ||
|
|
e62771845f | ||
|
|
82cf8eb369 | ||
|
|
8117ddcdb3 | ||
|
|
b4679b0675 | ||
|
|
4a6cdffd84 | ||
|
|
7250b091d5 | ||
|
|
65ca8610eb | ||
|
|
3b91d02fff | ||
|
|
691d965bcf | ||
|
|
a1c1039ea1 | ||
|
|
71b4c98de7 | ||
|
|
9f2c8713ff | ||
|
|
a2d3b3f410 | ||
|
|
9d83998463 | ||
|
|
0531769c41 | ||
|
|
5aca75dcbd | ||
|
|
7ca6470656 | ||
|
|
5a1503fc98 | ||
|
|
ba177c4c5d | ||
|
|
bd1c54907d | ||
|
|
da278e0264 | ||
|
|
258748ec51 | ||
|
|
3f999bf231 | ||
|
|
6824f55929 | ||
|
|
e1357c5c34 | ||
|
|
9bf3605b85 | ||
|
|
b433ddd007 | ||
|
|
5d5993bcca | ||
|
|
e5827f2b81 | ||
|
|
f801ed72bb | ||
|
|
3571c0d577 | ||
|
|
2fe0cf7a4c | ||
|
|
3b1a51b393 | ||
|
|
723f7b14ea | ||
|
|
ed20f4ac9b | ||
|
|
20e12edd45 | ||
|
|
5b92901715 | ||
|
|
f186465220 | ||
|
|
b697cc8131 | ||
|
|
82f7dc7062 | ||
|
|
87739ff877 | ||
|
|
2f8ee1b1bf | ||
|
|
97c86125f6 | ||
|
|
df0c9dcba2 | ||
|
|
c574f58ecd | ||
|
|
84f91eb795 | ||
|
|
8738e59c21 | ||
|
|
6c10364c8c | ||
|
|
8b67840f0c | ||
|
|
f2dfd42754 | ||
|
|
1b1400b989 | ||
|
|
011bd724bc | ||
|
|
b5b896f89f | ||
|
|
119a554260 | ||
|
|
e606efd008 | ||
|
|
ea68d62ec4 | ||
|
|
cd241095a2 | ||
|
|
9ae13634d0 | ||
|
|
bb6fea95e4 | ||
|
|
f4a5c77df8 | ||
|
|
1ec75ab213 | ||
|
|
d2eaa03498 | ||
|
|
a1a9abd6a2 | ||
|
|
4cdfbb22e8 | ||
|
|
4cda1ddd29 | ||
|
|
9633de5929 | ||
|
|
0f10c242e2 | ||
|
|
2f5ccad5ea | ||
|
|
acab171bc5 | ||
|
|
5efa81df85 | ||
|
|
1a9f0a543c | ||
|
|
9c56c852ca | ||
|
|
c7e3d01e2b | ||
|
|
46989438c1 | ||
|
|
3f97ae4c57 | ||
|
|
d04def886d | ||
|
|
7e436f48f9 | ||
|
|
f36d455d03 | ||
|
|
2e297777a0 | ||
|
|
8e8428a572 | ||
|
|
ba361cdd6a | ||
|
|
910fb54c15 | ||
|
|
5ace2c9660 | ||
|
|
da518857ad | ||
|
|
390004897b | ||
|
|
ea293575e0 | ||
|
|
84e9d8c192 | ||
|
|
5fd1a24f16 | ||
|
|
19e9af3d43 | ||
|
|
3488d5b8e7 | ||
|
|
5e61d59e50 | ||
|
|
b4e9d7b9eb | ||
|
|
c07124332b | ||
|
|
a88342b8da | ||
|
|
568831bd2f | ||
|
|
ede34b1b9f | ||
|
|
7a5790744f | ||
|
|
2be7790d4d | ||
|
|
781fa7ae95 | ||
|
|
7af60e02a3 | ||
|
|
5543afd44b | ||
|
|
95d3556204 | ||
|
|
07fbcd489c | ||
|
|
fd0addf61c | ||
|
|
00718c5b61 | ||
|
|
2ffb87c9d2 | ||
|
|
915a344a05 | ||
|
|
3b55064f44 | ||
|
|
c13647aef4 | ||
|
|
c60ddcf875 | ||
|
|
73682b482b | ||
|
|
6616d1bfb1 | ||
|
|
39849c9c02 | ||
|
|
aadc989134 | ||
|
|
c46060db44 | ||
|
|
20a595db39 | ||
|
|
654a05bb41 | ||
|
|
e3ad59ad9c | ||
|
|
a6052c5819 | ||
|
|
4fea2b0fe7 | ||
|
|
479688d86b | ||
|
|
5dd11bf138 | ||
|
|
33e3a88458 | ||
|
|
d98f19bf4a | ||
|
|
1b91198b28 | ||
|
|
bd847034f3 | ||
|
|
f808e6d37c | ||
|
|
fcf32b3cff | ||
|
|
9cb856eee4 | ||
|
|
e88db022af | ||
|
|
02e3293e72 | ||
|
|
a42cad8bfb | ||
|
|
4f4ec7ffff | ||
|
|
2a59bd50bd | ||
|
|
cf85ec736f | ||
|
|
c2a29470c3 | ||
|
|
bd1f7eefdb | ||
|
|
fafc687d84 | ||
|
|
8f25eb6ca4 | ||
|
|
42440c0d0b | ||
|
|
ee2e61f38f | ||
|
|
403ab7ba31 | ||
|
|
2fa958aa79 | ||
|
|
fa45efa9e2 | ||
|
|
4ab75c9c1c | ||
|
|
0b38beb79b | ||
|
|
9f25c50ca1 | ||
|
|
63217feac6 | ||
|
|
6dea184b03 | ||
|
|
2f880fa035 | ||
|
|
415d4b578a | ||
|
|
11e2882cb2 | ||
|
|
9d26c040e9 | ||
|
|
20bbe6cdcc | ||
|
|
64ed21f694 | ||
|
|
f705d0080d | ||
|
|
123108c813 | ||
|
|
e73e524f3d | ||
|
|
c21ccf5284 | ||
|
|
d441a02e72 | ||
|
|
d16fd46399 | ||
|
|
0a5e65bc9d | ||
|
|
3000519a10 | ||
|
|
f1e8ebefc5 | ||
|
|
2c21e1a90b | ||
|
|
e99f30e633 | ||
|
|
2d6d054359 | ||
|
|
6f087eb981 | ||
|
|
14b8cdf4cb | ||
|
|
6733a24e47 | ||
|
|
b97978e91d | ||
|
|
57055e373e | ||
|
|
b4fc3d0580 | ||
|
|
820865389c | ||
|
|
e44f993095 | ||
|
|
7532bd7260 | ||
|
|
6d852f11af | ||
|
|
d6c06da878 | ||
|
|
532dc30028 | ||
|
|
90c91db550 | ||
|
|
68a9bbced0 | ||
|
|
bba771bd08 | ||
|
|
9fc98cf03f | ||
|
|
3926337b44 | ||
|
|
a6f83291b4 | ||
|
|
fb0fab0622 | ||
|
|
a5cf62a90b | ||
|
|
2e4481880e | ||
|
|
5b472a64b2 | ||
|
|
74d9c911bd | ||
|
|
8ca546c164 | ||
|
|
2ee8e56cef | ||
|
|
783ea0b437 | ||
|
|
3c4ad8b720 | ||
|
|
4581689d9c | ||
|
|
810ce40e9b | ||
|
|
6ed42d06bb | ||
|
|
39b5229df7 | ||
|
|
600fb5c28f | ||
|
|
3fd0460d03 | ||
|
|
e8ebcc2c21 | ||
|
|
94e5c8fc05 | ||
|
|
bb4516e377 | ||
|
|
406f3d93f3 | ||
|
|
221c2e9b47 | ||
|
|
f4608a6e40 | ||
|
|
8cebde76e2 | ||
|
|
ab5c87f017 | ||
|
|
8383a3afac | ||
|
|
5ebf6d6bc0 | ||
|
|
9eb8835bd5 | ||
|
|
d247b81966 | ||
|
|
eb0f019b15 | ||
|
|
117ce301b0 | ||
|
|
5ff399d3f2 | ||
|
|
96c5e3ec18 | ||
|
|
3f532e478c | ||
|
|
a932eaedcf | ||
|
|
6e66c79392 | ||
|
|
7afbeaa1f9 | ||
|
|
548e0df1a1 | ||
|
|
788e82a7d0 | ||
|
|
f61aebb777 | ||
|
|
06484ef4e0 | ||
|
|
7d739c4542 | ||
|
|
6a3b098681 | ||
|
|
57b0b9c7ed | ||
|
|
12453d2e61 | ||
|
|
85965c8b6a | ||
|
|
e751979e5c | ||
|
|
181c30bc0a | ||
|
|
ebb434692a | ||
|
|
94414adaf8 | ||
|
|
3871b6c4cf | ||
|
|
ca5785bc8f | ||
|
|
2835fbc73d | ||
|
|
ac74bd9903 | ||
|
|
0298f9a5ad |
No files matched your search
@@ -0,0 +1,2 @@
|
|||||||
|
https://github.com/Keavon/graphite-branded-assets/archive/ca7dd793caba8999ec33fde99bb721a69c3d221f.tar.gz
|
||||||
|
77e8a6b68d67a8d5fcfd6268a6b7938ac9322d877378c6563e933a57df6da821
|
||||||
+8
-1
@@ -1,4 +1,8 @@
|
|||||||
[target.wasm32-unknown-unknown]
|
# Keep `--cfg=web_sys_unstable_apis` here so the wasm wrapper crates build with the same web-sys API signatures (e.g. `put_image_data`/`get_image_data` taking `i32` rather than `f64`) on both native and the wasm target.
|
||||||
|
[target.'cfg(not(target_family = "wasm"))']
|
||||||
|
rustflags = ["--cfg=web_sys_unstable_apis"]
|
||||||
|
|
||||||
|
[target.'cfg(target_family = "wasm")']
|
||||||
rustflags = [
|
rustflags = [
|
||||||
# Currently disabled because of https://github.com/GraphiteEditor/Graphite/issues/1262
|
# Currently disabled because of https://github.com/GraphiteEditor/Graphite/issues/1262
|
||||||
# The current simd implementation leads to undefined behavior
|
# The current simd implementation leads to undefined behavior
|
||||||
@@ -9,6 +13,9 @@ rustflags = [
|
|||||||
"-C",
|
"-C",
|
||||||
"link-arg=--max-memory=4294967296",
|
"link-arg=--max-memory=4294967296",
|
||||||
"--cfg=web_sys_unstable_apis",
|
"--cfg=web_sys_unstable_apis",
|
||||||
|
# TODO: Remove this and find a better way to stay within the 25MB limit of cloudflare pages
|
||||||
|
"-C",
|
||||||
|
"opt-level=s",
|
||||||
]
|
]
|
||||||
|
|
||||||
[env]
|
[env]
|
||||||
|
|||||||
@@ -2,11 +2,25 @@
|
|||||||
"image": "mcr.microsoft.com/devcontainers/base:debian",
|
"image": "mcr.microsoft.com/devcontainers/base:debian",
|
||||||
"features": {
|
"features": {
|
||||||
"ghcr.io/devcontainers/features/rust:1": {
|
"ghcr.io/devcontainers/features/rust:1": {
|
||||||
"profile": "default"
|
"profile": "default",
|
||||||
|
"targets": "wasm32-unknown-unknown"
|
||||||
},
|
},
|
||||||
"ghcr.io/devcontainers/features/node:1": {}
|
"ghcr.io/devcontainers/features/node:1": {
|
||||||
|
// NOTICE: keep in sync with `.nvmrc`
|
||||||
|
"version": "24"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// NOTICE: keep these tool versions in sync with `.github/workflows/build.yml`, `.nix/dev.nix` and `.nix/pkgs/graphite.nix` (wasm-bindgen-cli), `tools/cargo-run/src/requirements.rs` (wasm-bindgen-cli, cargo-about), `tools/cargo-run/src/requirements/wasm_opt.rs` (Binaryen), and the `wasm-bindgen` crate in `Cargo.toml`
|
||||||
|
"containerEnv": {
|
||||||
|
"WASM_BINDGEN_CLI_VERSION": "0.2.121",
|
||||||
|
"CARGO_ABOUT_VERSION": "0.9.2",
|
||||||
|
"BINARYEN_VERSION": "130",
|
||||||
|
"CARGO_BINSTALL_VERSION": "1.23.0"
|
||||||
|
},
|
||||||
|
"onCreateCommand": {
|
||||||
|
"Install cargo-about and wasm-bindgen-cli": "curl -sSfL https://github.com/cargo-bins/cargo-binstall/releases/download/v$CARGO_BINSTALL_VERSION/cargo-binstall-$(uname -m)-unknown-linux-musl.tgz | tar xz -C $CARGO_HOME/bin && BINSTALL_DISABLE_TELEMETRY=true cargo binstall --no-confirm cargo-about@$CARGO_ABOUT_VERSION wasm-bindgen-cli@$WASM_BINDGEN_CLI_VERSION",
|
||||||
|
"Install Binaryen wasm-opt": "curl -sSfL https://github.com/WebAssembly/binaryen/releases/download/version_$BINARYEN_VERSION/binaryen-version_$BINARYEN_VERSION-$(uname -m)-linux.tar.gz | tar xz -C $CARGO_HOME/bin --strip-components=2 binaryen-version_$BINARYEN_VERSION/bin/wasm-opt"
|
||||||
},
|
},
|
||||||
"onCreateCommand": "cargo install cargo-watch wasm-pack cargo-about && cargo install -f [email protected]",
|
|
||||||
"customizations": {
|
"customizations": {
|
||||||
"vscode": {
|
"vscode": {
|
||||||
// NOTE: Keep this in sync with `.vscode/extensions.json`
|
// NOTE: Keep this in sync with `.vscode/extensions.json`
|
||||||
@@ -16,14 +30,16 @@
|
|||||||
"tamasfe.even-better-toml",
|
"tamasfe.even-better-toml",
|
||||||
// Web
|
// Web
|
||||||
"dbaeumer.vscode-eslint",
|
"dbaeumer.vscode-eslint",
|
||||||
|
"esbenp.prettier-vscode",
|
||||||
"svelte.svelte-vscode",
|
"svelte.svelte-vscode",
|
||||||
"vitaliymaz.vscode-svg-previewer",
|
"vitaliymaz.vscode-svg-previewer",
|
||||||
// Code quality
|
// Code quality
|
||||||
"wayou.vscode-todo-highlight",
|
"wayou.vscode-todo-highlight",
|
||||||
"streetsidesoftware.code-spell-checker",
|
"streetsidesoftware.code-spell-checker",
|
||||||
// Helpful
|
// Git
|
||||||
"mhutchie.git-graph",
|
"mhutchie.git-graph",
|
||||||
"qezhu.gitlink",
|
"qezhu.gitlink",
|
||||||
|
// Helpful
|
||||||
"wmaurer.change-case"
|
"wmaurer.change-case"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
# Keavon Chambers (@Keavon [email protected])
|
||||||
|
|
||||||
|
|
||||||
|
# Dennis Kobert (@TrueDoctor [email protected])
|
||||||
|
|
||||||
|
/document/format/ @TrueDoctor
|
||||||
|
|
||||||
|
/node-graph/graph-craft/ @TrueDoctor
|
||||||
|
/node-graph/preprocessor/ @TrueDoctor
|
||||||
|
/node-graph/node-macro/ @TrueDoctor
|
||||||
|
/node-graph/interpreted-executor/ @TrueDoctor
|
||||||
|
/node-graph/graphene-cli/ @TrueDoctor
|
||||||
|
|
||||||
|
# Timon Schelling (@timon-schelling [email protected])
|
||||||
|
|
||||||
|
/.nix/ @timon-schelling
|
||||||
|
/flake.nix @timon-schelling
|
||||||
|
/flake.lock @timon-schelling
|
||||||
|
|
||||||
|
/desktop/ @timon-schelling
|
||||||
|
|
||||||
|
/editor/src/messages/future/ @timon-schelling
|
||||||
|
/editor/src/messages/resource_storage/ @timon-schelling
|
||||||
|
/editor/src/messages/network/ @timon-schelling
|
||||||
|
/editor/src/messages/app_window/ @timon-schelling
|
||||||
|
/editor/src/messages/clipboard/ @timon-schelling
|
||||||
|
/editor/src/messages/viewport/ @timon-schelling
|
||||||
|
|
||||||
|
/libraries/wgpu-sync/ @timon-schelling
|
||||||
|
|
||||||
|
/node-graph/libraries/canvas-utils/ @timon-schelling
|
||||||
|
|
||||||
|
/tools/cargo-run/ @timon-schelling
|
||||||
|
/tools/third-party-licenses/ @timon-schelling
|
||||||
@@ -1,3 +1,13 @@
|
|||||||
<!-- Please reference any relevant issue number below, optionally with a "Closes"/"Resolves"/"Fixes" prefix -->
|
<!--
|
||||||
|
Graphite has ZERO-TOLERANCE for contributing undisclosed AI-generated content.
|
||||||
|
If your PR involves AI, you must read our AI contribution policy (it's short):
|
||||||
|
https://graphite.art/volunteer/guide/starting-a-task/ai-contribution-policy
|
||||||
|
|
||||||
Closes #
|
REMEMBER:
|
||||||
|
- You are responsible for thoroughly testing the successful implementation of your changes and ensuring no obvious regressions occur.
|
||||||
|
- Egregiously dysfunctional PRs may be assumed to be undisclosed AI slop. If in doubt, ask on Discord before attempting a PR.
|
||||||
|
- You are highly recommended to include a video showing the before-and-after behavior of your changes and screenshots of any new or modified UI.
|
||||||
|
- Remember that Graphite maintains high standards for quality and the project is not a classroom for inexperienced developers to gain industry experience.
|
||||||
|
- In this PR description, reference any relevant tasks by writing "Closes", "Resolves", or "Fixes" with the issue # or the URL of a Discord message documenting the task.
|
||||||
|
- To acknowledge that you've read this, you must delete these rules and fill in the (strictly human-written) PR description in its place.
|
||||||
|
-->
|
||||||
@@ -1,184 +0,0 @@
|
|||||||
name: "Editor: Dev & CI"
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- master
|
|
||||||
pull_request: {}
|
|
||||||
env:
|
|
||||||
CARGO_TERM_COLOR: always
|
|
||||||
INDEX_HTML_HEAD_REPLACEMENT: <script defer data-domain="dev.graphite.rs" data-api="https://graphite.rs/visit/event" src="https://graphite.rs/visit/script.hash.js"></script>
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: self-hosted
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
deployments: write
|
|
||||||
pull-requests: write
|
|
||||||
actions: write
|
|
||||||
env:
|
|
||||||
RUSTC_WRAPPER: /usr/bin/sccache
|
|
||||||
CARGO_INCREMENTAL: 0
|
|
||||||
SCCACHE_DIR: /var/lib/github-actions/.cache
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: 📥 Clone and checkout repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: 🗑 Clear wasm-bindgen cache
|
|
||||||
run: rm -r ~/.cache/.wasm-pack || true
|
|
||||||
|
|
||||||
- name: 🟢 Install the latest Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: "latest"
|
|
||||||
|
|
||||||
- name: 🚧 Install Node dependencies
|
|
||||||
run: |
|
|
||||||
cd frontend
|
|
||||||
npm ci
|
|
||||||
|
|
||||||
- name: 🦀 Install the latest Rust
|
|
||||||
run: |
|
|
||||||
echo "Initial system version:"
|
|
||||||
rustc --version
|
|
||||||
rustup update stable
|
|
||||||
echo "Latest updated version:"
|
|
||||||
rustc --version
|
|
||||||
|
|
||||||
- name: 🦀 Fetch Rust dependencies
|
|
||||||
run: |
|
|
||||||
echo "If it fails here, the committed Cargo.lock may be out of date"
|
|
||||||
cargo fetch --locked
|
|
||||||
|
|
||||||
- name: ✂ Replace template in <head> of index.html
|
|
||||||
run: |
|
|
||||||
# Remove the INDEX_HTML_HEAD_REPLACEMENT environment variable for build links (not master deploys)
|
|
||||||
git rev-parse --abbrev-ref HEAD | grep master > /dev/null || export INDEX_HTML_HEAD_REPLACEMENT=""
|
|
||||||
sed -i "s|<!-- INDEX_HTML_HEAD_REPLACEMENT -->|$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html
|
|
||||||
|
|
||||||
- name: 🌐 Build Graphite web code
|
|
||||||
env:
|
|
||||||
NODE_ENV: production
|
|
||||||
run: |
|
|
||||||
cd frontend
|
|
||||||
mold -run npm run build
|
|
||||||
|
|
||||||
- name: 📤 Publish to Cloudflare Pages
|
|
||||||
id: cloudflare
|
|
||||||
uses: cloudflare/pages-action@1
|
|
||||||
continue-on-error: true
|
|
||||||
with:
|
|
||||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
||||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
||||||
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
projectName: graphite-dev
|
|
||||||
directory: frontend/dist
|
|
||||||
|
|
||||||
- name: 💬 Comment build link URL to commit hash page on GitHub
|
|
||||||
if: github.ref == 'refs/heads/master'
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
gh api \
|
|
||||||
-X POST \
|
|
||||||
-H "Accept: application/vnd.github+json" \
|
|
||||||
/repos/${{ github.repository }}/commits/$(git rev-parse HEAD)/comments \
|
|
||||||
-f body="| 📦 **Build Complete for** $(git rev-parse HEAD) |
|
|
||||||
|-|
|
|
||||||
| ${{ steps.cloudflare.outputs.url }} |"
|
|
||||||
|
|
||||||
- name: 👕 Lint Graphite web formatting
|
|
||||||
env:
|
|
||||||
NODE_ENV: production
|
|
||||||
run: |
|
|
||||||
cd frontend
|
|
||||||
npm run lint
|
|
||||||
|
|
||||||
- name: 🔬 Check Rust formatting
|
|
||||||
run: |
|
|
||||||
mold -run cargo fmt --all -- --check
|
|
||||||
|
|
||||||
- name: 🦀 Build Rust code
|
|
||||||
env:
|
|
||||||
RUSTFLAGS: -Dwarnings
|
|
||||||
run: |
|
|
||||||
mold -run cargo build --all-features
|
|
||||||
|
|
||||||
- name: 🧪 Run Rust tests
|
|
||||||
run: |
|
|
||||||
mold -run cargo test --all-features
|
|
||||||
|
|
||||||
- name: 📃 Generate code documentation info for website
|
|
||||||
if: github.ref == 'refs/heads/master'
|
|
||||||
run: |
|
|
||||||
cargo test --package graphite-editor --lib -- messages::message::test::generate_message_tree
|
|
||||||
mkdir -p artifacts-generated
|
|
||||||
mv hierarchical_message_system_tree.txt artifacts-generated/hierarchical_message_system_tree.txt
|
|
||||||
|
|
||||||
- name: 💿 Obtain cache of auto-generated code docs artifacts, to check if they've changed
|
|
||||||
if: github.ref == 'refs/heads/master'
|
|
||||||
id: cache-website-code-docs
|
|
||||||
uses: actions/cache/restore@v3
|
|
||||||
with:
|
|
||||||
path: artifacts
|
|
||||||
key: website-code-docs
|
|
||||||
|
|
||||||
- name: 🔍 Check if auto-generated code docs artifacts changed
|
|
||||||
if: github.ref == 'refs/heads/master'
|
|
||||||
id: website-code-docs-changed
|
|
||||||
run: |
|
|
||||||
if ! diff --brief --recursive artifacts-generated artifacts; then
|
|
||||||
echo "Auto-generated code docs artifacts have changed."
|
|
||||||
rm -rf artifacts
|
|
||||||
mv artifacts-generated artifacts
|
|
||||||
echo "changed=true" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo "Auto-generated code docs artifacts have not changed."
|
|
||||||
rm -rf artifacts
|
|
||||||
rm -rf artifacts-generated
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: 💾 Save cache of auto-generated code docs artifacts
|
|
||||||
if: steps.website-code-docs-changed.outputs.changed == 'true'
|
|
||||||
uses: actions/cache/save@v3
|
|
||||||
with:
|
|
||||||
path: artifacts
|
|
||||||
key: ${{ steps.cache-website-code-docs.outputs.cache-primary-key }}
|
|
||||||
|
|
||||||
- name: ♻️ Trigger website rebuild if the auto-generated code docs artifacts have changed
|
|
||||||
if: steps.website-code-docs-changed.outputs.changed == 'true'
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
rm -rf artifacts
|
|
||||||
gh workflow run website.yml --ref master
|
|
||||||
|
|
||||||
# miri:
|
|
||||||
# runs-on: self-hosted
|
|
||||||
|
|
||||||
# steps:
|
|
||||||
# - uses: actions/checkout@v3
|
|
||||||
|
|
||||||
# - name: 🧪 Run Rust miri
|
|
||||||
# run: |
|
|
||||||
# mold -run cargo +nightly miri nextest run -j32 --all-features
|
|
||||||
|
|
||||||
cargo-deny:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: 📥 Clone and checkout repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: 📜 Check crate license compatibility for root workspace
|
|
||||||
uses: EmbarkStudios/cargo-deny-action@v2
|
|
||||||
with:
|
|
||||||
command: check bans licenses sources
|
|
||||||
|
|
||||||
- name: 📜 Check crate license compatibility for /libraries/rawkit
|
|
||||||
uses: EmbarkStudios/cargo-deny-action@v2
|
|
||||||
with:
|
|
||||||
command: check bans licenses sources
|
|
||||||
manifest-path: libraries/rawkit/Cargo.toml
|
|
||||||
@@ -1,79 +0,0 @@
|
|||||||
name: "Editor: Production (Latest Stable)"
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- "latest-stable"
|
|
||||||
|
|
||||||
env:
|
|
||||||
CARGO_TERM_COLOR: always
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: self-hosted
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
deployments: write
|
|
||||||
env:
|
|
||||||
RUSTC_WRAPPER: /usr/bin/sccache
|
|
||||||
CARGO_INCREMENTAL: 0
|
|
||||||
SCCACHE_DIR: /var/lib/github-actions/.cache
|
|
||||||
INDEX_HTML_HEAD_REPLACEMENT: <script defer data-domain="editor.graphite.rs" data-api="https://graphite.rs/visit/event" src="https://graphite.rs/visit/script.hash.js"></script>
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: 📥 Clone and checkout repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: 🗑 Clear wasm-bindgen cache
|
|
||||||
run: rm -r ~/.cache/.wasm-pack
|
|
||||||
|
|
||||||
- name: 🟢 Install the latest Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: "latest"
|
|
||||||
|
|
||||||
- name: 🚧 Install Node dependencies
|
|
||||||
run: |
|
|
||||||
cd frontend
|
|
||||||
npm ci
|
|
||||||
|
|
||||||
- name: 🦀 Install the latest Rust
|
|
||||||
run: |
|
|
||||||
echo "Initial system version:"
|
|
||||||
rustc --version
|
|
||||||
rustup update stable
|
|
||||||
echo "Latest updated version:"
|
|
||||||
rustc --version
|
|
||||||
|
|
||||||
- name: ✂ Replace template in <head> of index.html
|
|
||||||
run: |
|
|
||||||
sed -i "s|<!-- INDEX_HTML_HEAD_REPLACEMENT -->|$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html
|
|
||||||
|
|
||||||
- name: 🌐 Build Graphite web code
|
|
||||||
env:
|
|
||||||
NODE_ENV: production
|
|
||||||
run: |
|
|
||||||
cd frontend
|
|
||||||
mold -run npm run build
|
|
||||||
|
|
||||||
- name: 📤 Publish to Cloudflare Pages
|
|
||||||
id: cloudflare
|
|
||||||
uses: cloudflare/pages-action@1
|
|
||||||
with:
|
|
||||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
||||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
||||||
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
projectName: graphite-editor
|
|
||||||
directory: frontend/dist
|
|
||||||
branch: master
|
|
||||||
|
|
||||||
- name: 📦 Upload assets to GitHub release
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%d)
|
|
||||||
cd frontend
|
|
||||||
sed -i "s|$INDEX_HTML_HEAD_REPLACEMENT||" dist/index.html
|
|
||||||
mv dist "graphite-$DATE"
|
|
||||||
zip -r "graphite-self-hosted-build.zip" "graphite-$DATE"
|
|
||||||
gh release upload latest-stable "graphite-self-hosted-build.zip" --clobber
|
|
||||||
@@ -0,0 +1,807 @@
|
|||||||
|
name: "Build"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
tags:
|
||||||
|
- latest-stable
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
web:
|
||||||
|
description: "Web"
|
||||||
|
type: boolean
|
||||||
|
windows:
|
||||||
|
description: "Windows"
|
||||||
|
type: boolean
|
||||||
|
mac:
|
||||||
|
description: "Mac"
|
||||||
|
type: boolean
|
||||||
|
linux:
|
||||||
|
description: "Linux"
|
||||||
|
type: boolean
|
||||||
|
debug:
|
||||||
|
description: "Debug build"
|
||||||
|
type: boolean
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
web:
|
||||||
|
type: boolean
|
||||||
|
windows:
|
||||||
|
type: boolean
|
||||||
|
mac:
|
||||||
|
type: boolean
|
||||||
|
linux:
|
||||||
|
type: boolean
|
||||||
|
debug:
|
||||||
|
type: boolean
|
||||||
|
checkout_repo:
|
||||||
|
type: string
|
||||||
|
checkout_ref:
|
||||||
|
type: string
|
||||||
|
pr_number:
|
||||||
|
type: string
|
||||||
|
merge_queue:
|
||||||
|
type: boolean
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
web:
|
||||||
|
if: github.event_name == 'push' || inputs.web
|
||||||
|
runs-on: [self-hosted, target/wasm]
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
deployments: write
|
||||||
|
pull-requests: write
|
||||||
|
actions: write
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
RUSTC_WRAPPER: /usr/bin/sccache
|
||||||
|
CARGO_INCREMENTAL: 0
|
||||||
|
SCCACHE_DIR: /var/lib/github-actions/.cache
|
||||||
|
# NOTICE: keep these tool versions in sync with the other jobs in this file, `.devcontainer/devcontainer.json`, `.nix/dev.nix` and `.nix/pkgs/graphite.nix` (wasm-bindgen-cli), `tools/cargo-run/src/requirements.rs` (wasm-bindgen-cli, cargo-about), `tools/cargo-run/src/requirements/wasm_opt.rs` (Binaryen), and the `wasm-bindgen` crate in `Cargo.toml`
|
||||||
|
WASM_BINDGEN_CLI_VERSION: "0.2.121"
|
||||||
|
BINARYEN_VERSION: "130"
|
||||||
|
steps:
|
||||||
|
- name: 📥 Clone repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
repository: ${{ inputs.checkout_repo || github.repository }}
|
||||||
|
ref: ${{ inputs.checkout_ref || '' }}
|
||||||
|
|
||||||
|
- name: 🟢 Install Node.js
|
||||||
|
uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version-file: .nvmrc
|
||||||
|
|
||||||
|
- name: 🦀 Install Rust
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
cache: false
|
||||||
|
rustflags: ""
|
||||||
|
target: wasm32-unknown-unknown
|
||||||
|
|
||||||
|
- name: 🚧 Install wasm-bindgen-cli and Binaryen wasm-opt
|
||||||
|
run: |
|
||||||
|
if ! wasm-bindgen --version 2>/dev/null | grep -qF "$WASM_BINDGEN_CLI_VERSION"; then
|
||||||
|
cargo install -f "wasm-bindgen-cli@$WASM_BINDGEN_CLI_VERSION"
|
||||||
|
fi
|
||||||
|
|
||||||
|
BINARYEN_DIR="$HOME/.cache/binaryen-version_$BINARYEN_VERSION"
|
||||||
|
if [ ! -x "$BINARYEN_DIR/bin/wasm-opt" ]; then
|
||||||
|
mkdir -p "$BINARYEN_DIR"
|
||||||
|
curl -sSfL "https://github.com/WebAssembly/binaryen/releases/download/version_$BINARYEN_VERSION/binaryen-version_$BINARYEN_VERSION-x86_64-linux.tar.gz" | tar xz -C "$BINARYEN_DIR" --strip-components=1
|
||||||
|
fi
|
||||||
|
echo "$BINARYEN_DIR/bin" >> "$GITHUB_PATH"
|
||||||
|
|
||||||
|
- name: 🔀 Choose production deployment environment and insert template
|
||||||
|
id: production-env
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
run: |
|
||||||
|
if [[ "${{ github.ref }}" == "refs/tags/latest-stable" ]]; then
|
||||||
|
echo "cf_project=graphite-editor" >> $GITHUB_OUTPUT
|
||||||
|
DOMAIN="editor.graphite.art"
|
||||||
|
else
|
||||||
|
echo "cf_project=graphite-dev" >> $GITHUB_OUTPUT
|
||||||
|
DOMAIN="dev.graphite.art"
|
||||||
|
fi
|
||||||
|
TEMPLATE="<script defer data-domain=\"$DOMAIN\" data-api=\"https://graphite.art/visit/event\" src=\"https://graphite.art/visit/script.hash.js\"></script>"
|
||||||
|
echo "template=$TEMPLATE" >> $GITHUB_OUTPUT
|
||||||
|
sed -i "s|<!-- INDEX_HTML_HEAD_REPLACEMENT -->|$TEMPLATE|" frontend/index.html
|
||||||
|
|
||||||
|
- name: 🌐 Build Graphite web code
|
||||||
|
env:
|
||||||
|
NODE_ENV: production
|
||||||
|
# Split the Wasm binary to fit Cloudflare Pages' file size limit (see `wasmSplitting` in `frontend/vite.config.ts`)
|
||||||
|
SPLIT_WASM: "1"
|
||||||
|
run: mold -run cargo run build web${{ inputs.debug && ' debug' || '' }}
|
||||||
|
|
||||||
|
- name: 📤 Publish to Cloudflare Pages
|
||||||
|
if: inputs.merge_queue == false
|
||||||
|
id: cloudflare
|
||||||
|
continue-on-error: ${{ github.event_name != 'push' }}
|
||||||
|
env:
|
||||||
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||||
|
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||||
|
run: |
|
||||||
|
if [ -z "$CLOUDFLARE_API_TOKEN" ]; then
|
||||||
|
echo "No Cloudflare API token available (fork PR), skipping deploy."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "${{ github.event_name }}" = "push" ]; then
|
||||||
|
DEPLOY_BRANCH="master"
|
||||||
|
else
|
||||||
|
DEPLOY_BRANCH="${{ inputs.checkout_ref || github.head_ref || github.ref_name }}"
|
||||||
|
if [ "$DEPLOY_BRANCH" = "master" ] || [ -z "$DEPLOY_BRANCH" ]; then
|
||||||
|
DEPLOY_BRANCH="preview-${{ github.run_id }}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
MAX_ATTEMPTS=8
|
||||||
|
DELAY=15
|
||||||
|
for ATTEMPT in $(seq 1 $MAX_ATTEMPTS); do
|
||||||
|
echo "Attempt $ATTEMPT of $MAX_ATTEMPTS..."
|
||||||
|
npx wrangler@3 pages deploy "frontend/dist" --project-name="${{ steps.production-env.outputs.cf_project || 'graphite-dev' }}" --branch="$DEPLOY_BRANCH" --commit-dirty=true 2>&1 | tee /tmp/wrangler_output
|
||||||
|
if [ ${PIPESTATUS[0]} -eq 0 ]; then
|
||||||
|
URL=$(grep -oP 'https://[^\s]+\.pages\.dev' /tmp/wrangler_output | head -1)
|
||||||
|
echo "url=$URL" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "Published successfully: $URL"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
echo "Attempt $ATTEMPT failed."
|
||||||
|
if [ "$ATTEMPT" -lt "$MAX_ATTEMPTS" ]; then
|
||||||
|
echo "Retrying in ${DELAY}s..."
|
||||||
|
sleep $DELAY
|
||||||
|
DELAY=$((DELAY * 2))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo "All $MAX_ATTEMPTS Cloudflare Pages publish attempts failed."
|
||||||
|
exit 1
|
||||||
|
|
||||||
|
- name: 🚀 Create a GitHub environment deployment
|
||||||
|
if: (inputs.checkout_repo == '' || inputs.checkout_repo == github.repository) && inputs.merge_queue == false
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
CF_URL: ${{ steps.cloudflare.outputs.url }}
|
||||||
|
run: |
|
||||||
|
if [ -z "$CF_URL" ]; then
|
||||||
|
echo "No Cloudflare URL available, skipping deployment."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [ "${{ github.ref }}" = "refs/tags/latest-stable" ]; then
|
||||||
|
REF="latest-stable"
|
||||||
|
ENVIRONMENT="graphite-editor (Production)"
|
||||||
|
AUTO_INACTIVE="true"
|
||||||
|
TRANSIENT_ENVIRONMENT="false"
|
||||||
|
elif [ "${{ github.event_name }}" = "push" ]; then
|
||||||
|
REF="master"
|
||||||
|
ENVIRONMENT="graphite-dev (Production)"
|
||||||
|
AUTO_INACTIVE="true"
|
||||||
|
TRANSIENT_ENVIRONMENT="false"
|
||||||
|
else
|
||||||
|
REF="${{ inputs.checkout_ref || github.head_ref || github.ref_name }}"
|
||||||
|
ENVIRONMENT="graphite-dev (Preview)"
|
||||||
|
AUTO_INACTIVE="false"
|
||||||
|
TRANSIENT_ENVIRONMENT="true"
|
||||||
|
fi
|
||||||
|
create_deployment() {
|
||||||
|
gh api \
|
||||||
|
-X POST \
|
||||||
|
-H "Accept: application/vnd.github+json" \
|
||||||
|
repos/${{ github.repository }}/deployments \
|
||||||
|
--input - \
|
||||||
|
--jq '.id' <<EOF
|
||||||
|
{
|
||||||
|
"ref": "$1",
|
||||||
|
"environment": "$ENVIRONMENT",
|
||||||
|
"auto_merge": false,
|
||||||
|
"required_contexts": [],
|
||||||
|
"auto_inactive": $AUTO_INACTIVE,
|
||||||
|
"transient_environment": $TRANSIENT_ENVIRONMENT
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
# Try branch name first (needed for GitHub's PR "View deployment" button), fall back to commit SHA if the branch was deleted
|
||||||
|
DEPLOY_ID=$(create_deployment "$REF" 2>/dev/null) || DEPLOY_ID=$(create_deployment "$(git rev-parse HEAD)")
|
||||||
|
gh api \
|
||||||
|
-X POST \
|
||||||
|
-H "Accept: application/vnd.github+json" \
|
||||||
|
repos/${{ github.repository }}/deployments/$DEPLOY_ID/statuses \
|
||||||
|
-f state=success \
|
||||||
|
-f environment_url="$CF_URL" \
|
||||||
|
-f log_url="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
|
||||||
|
|
||||||
|
- name: 💬 Comment with the build link
|
||||||
|
if: github.event_name != 'pull_request' && inputs.merge_queue == false
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
CF_URL: ${{ steps.cloudflare.outputs.url }}
|
||||||
|
run: |
|
||||||
|
if [ -z "$CF_URL" ]; then
|
||||||
|
echo "No Cloudflare URL available, skipping comment."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
size_of() { find frontend/dist/assets "$@" -printf '%s\n' | awk '{s+=$1} END {printf "%.2f MB", s/1048576}'; }
|
||||||
|
WASM_SIZE=$(size_of -name '*.wasm')
|
||||||
|
JS_SIZE=$(size_of -name '*.js')
|
||||||
|
CSS_SIZE=$(size_of -name '*.css')
|
||||||
|
FONT_SIZE=$(size_of \( -name '*.woff2' -o -name '*.woff' -o -name '*.ttf' -o -name '*.otf' \))
|
||||||
|
IMAGE_SIZE=$(size_of \( -name '*.png' -o -name '*.jpg' -o -name '*.svg' \))
|
||||||
|
ALL_SIZE=$(size_of -type f)
|
||||||
|
|
||||||
|
COMMENT_BODY="| 📦 **Web Build Complete for** $(git rev-parse HEAD) |
|
||||||
|
|-|
|
||||||
|
| $CF_URL |
|
||||||
|
|
||||||
|
Wasm: **$WASM_SIZE** — JS: **$JS_SIZE** — CSS: **$CSS_SIZE** — Fonts: **$FONT_SIZE** — Images: **$IMAGE_SIZE** — All Assets: **$ALL_SIZE**"
|
||||||
|
|
||||||
|
if [ "${{ github.ref }}" = "refs/tags/latest-stable" ]; then
|
||||||
|
# Push tag: skip commenting (commit was already commented on master merge)
|
||||||
|
echo "Tag push, skipping comment."
|
||||||
|
elif [ "${{ github.event_name }}" = "push" ]; then
|
||||||
|
# Push master: comment on the commit hash page
|
||||||
|
gh api \
|
||||||
|
-X POST \
|
||||||
|
-H "Accept: application/vnd.github+json" \
|
||||||
|
repos/${{ github.repository }}/commits/$(git rev-parse HEAD)/comments \
|
||||||
|
-f body="$COMMENT_BODY"
|
||||||
|
elif [ "${{ github.event_name }}" != "pull_request" ]; then
|
||||||
|
# Manual trigger (workflow_dispatch, !build): comment on the PR
|
||||||
|
PR_NUMBER="${{ inputs.pr_number }}"
|
||||||
|
if [ -z "$PR_NUMBER" ]; then
|
||||||
|
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||||
|
PR_NUMBER=$(gh pr list --repo ${{ github.repository }} --head "$BRANCH" --json number --jq '.[0].number' 2>/dev/null || true)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -n "$PR_NUMBER" ]; then
|
||||||
|
gh pr comment "$PR_NUMBER" --repo ${{ github.repository }} --body "$COMMENT_BODY"
|
||||||
|
else
|
||||||
|
echo "No open PR found, skipping comment."
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: ✂ Strip template from completed build for a clean artifact
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
env:
|
||||||
|
TEMPLATE: ${{ steps.production-env.outputs.template }}
|
||||||
|
run: sed -i "s|$TEMPLATE||" frontend/dist/index.html
|
||||||
|
|
||||||
|
- name: 📦 Upload web bundle artifact
|
||||||
|
if: github.event_name != 'pull_request' && inputs.merge_queue == false
|
||||||
|
uses: actions/upload-artifact@v6
|
||||||
|
with:
|
||||||
|
name: graphite-web-bundle
|
||||||
|
path: frontend/dist
|
||||||
|
|
||||||
|
- name: 👕 Lint Graphite web formatting
|
||||||
|
env:
|
||||||
|
NODE_ENV: production
|
||||||
|
run: |
|
||||||
|
cd frontend
|
||||||
|
npm run check
|
||||||
|
|
||||||
|
- name: 📃 Trigger website rebuild if auto-generated code docs are stale
|
||||||
|
if: github.event_name == 'push' && github.ref != 'refs/tags/latest-stable'
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
cargo run -p editor-message-tree -- website/generated
|
||||||
|
TREE=volunteer/guide/codebase-overview/hierarchical-message-system-tree
|
||||||
|
curl -sf "https://graphite.art/$TREE.txt" -o "website/static/$TREE.live.txt" \
|
||||||
|
&& diff -q "website/static/$TREE.txt" "website/static/$TREE.live.txt" > /dev/null \
|
||||||
|
|| gh workflow run website.yml --ref master
|
||||||
|
|
||||||
|
windows:
|
||||||
|
if: (github.event_name == 'push' && github.ref != 'refs/tags/latest-stable') || inputs.windows
|
||||||
|
runs-on: windows-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
env:
|
||||||
|
# NOTICE: keep these tool versions in sync with the other jobs in this file, `.devcontainer/devcontainer.json`, `.nix/dev.nix` and `.nix/pkgs/graphite.nix` (wasm-bindgen-cli), `tools/cargo-run/src/requirements.rs` (wasm-bindgen-cli, cargo-about), `tools/cargo-run/src/requirements/wasm_opt.rs` (Binaryen), and the `wasm-bindgen` crate in `Cargo.toml`
|
||||||
|
WASM_BINDGEN_CLI_VERSION: "0.2.121"
|
||||||
|
BINARYEN_VERSION: "130"
|
||||||
|
CARGO_ABOUT_VERSION: "0.9.2"
|
||||||
|
CARGO_BINSTALL_VERSION: "1.23.0"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 📥 Clone repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
repository: ${{ inputs.checkout_repo || github.repository }}
|
||||||
|
ref: ${{ inputs.checkout_ref || '' }}
|
||||||
|
|
||||||
|
- name: 🦀 Install Rust
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
cache: false
|
||||||
|
rustflags: ""
|
||||||
|
target: wasm32-unknown-unknown
|
||||||
|
|
||||||
|
- name: 💾 Set up Cargo cache
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/registry
|
||||||
|
~/.cargo/git
|
||||||
|
target
|
||||||
|
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- name: 🟢 Install Node.js
|
||||||
|
uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version-file: .nvmrc
|
||||||
|
cache: npm
|
||||||
|
cache-dependency-path: |
|
||||||
|
package-lock.json
|
||||||
|
frontend/package-lock.json
|
||||||
|
|
||||||
|
- name: 📦 Install Cargo-binstall
|
||||||
|
uses: cargo-bins/[email protected]
|
||||||
|
with:
|
||||||
|
version: ${{ env.CARGO_BINSTALL_VERSION }}
|
||||||
|
|
||||||
|
- name: 🚧 Install native dependencies
|
||||||
|
shell: pwsh
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
BINSTALL_DISABLE_TELEMETRY: "true"
|
||||||
|
run: |
|
||||||
|
winget install --id LLVM.LLVM -e --accept-package-agreements --accept-source-agreements
|
||||||
|
winget install --id Kitware.CMake -e --accept-package-agreements --accept-source-agreements
|
||||||
|
winget install --id OpenSSL.OpenSSL -e --accept-package-agreements --accept-source-agreements
|
||||||
|
winget install --id GnuWin32.PkgConfig -e --accept-package-agreements --accept-source-agreements
|
||||||
|
|
||||||
|
"OPENSSL_DIR=C:\Program Files\OpenSSL-Win64" | Out-File -FilePath $env:GITHUB_ENV -Append
|
||||||
|
"PKG_CONFIG_PATH=C:\Program Files\OpenSSL-Win64\lib\pkgconfig" | Out-File -FilePath $env:GITHUB_ENV -Append
|
||||||
|
|
||||||
|
curl.exe -sSfL -o "$env:RUNNER_TEMP\binaryen.tar.gz" "https://github.com/WebAssembly/binaryen/releases/download/version_$env:BINARYEN_VERSION/binaryen-version_$env:BINARYEN_VERSION-x86_64-windows.tar.gz"
|
||||||
|
tar -xzf "$env:RUNNER_TEMP\binaryen.tar.gz" -C $env:RUNNER_TEMP
|
||||||
|
"$env:RUNNER_TEMP\binaryen-version_$env:BINARYEN_VERSION\bin" | Out-File -FilePath $env:GITHUB_PATH -Append
|
||||||
|
|
||||||
|
cargo binstall --no-confirm --force "cargo-about@$env:CARGO_ABOUT_VERSION"
|
||||||
|
cargo binstall --no-confirm --force "wasm-bindgen-cli@$env:WASM_BINDGEN_CLI_VERSION"
|
||||||
|
|
||||||
|
- name: 🏗 Build Windows bundle
|
||||||
|
shell: bash # `cargo-about` refuses to run in powershell
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
run: cargo run build desktop${{ inputs.debug && ' debug' || '' }}
|
||||||
|
|
||||||
|
- name: 📁 Stage artifacts
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
PROFILE=${{ inputs.debug && 'debug' || 'release' }}
|
||||||
|
rm -rf target/artifacts
|
||||||
|
mkdir -p target/artifacts
|
||||||
|
cp -R target/$PROFILE/Graphite target/artifacts/Graphite
|
||||||
|
|
||||||
|
- name: 📦 Upload Windows bundle
|
||||||
|
if: github.event_name != 'push'
|
||||||
|
uses: actions/upload-artifact@v6
|
||||||
|
with:
|
||||||
|
name: graphite-windows-bundle
|
||||||
|
path: target/artifacts
|
||||||
|
|
||||||
|
- name: 💬 Comment artifact link on PR
|
||||||
|
if: github.event_name != 'push'
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
ARTIFACT_ID=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts --jq '.artifacts[] | select(.name == "graphite-windows-bundle") | .id')
|
||||||
|
ARTIFACT_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/$ARTIFACT_ID"
|
||||||
|
PR_NUMBER="${{ inputs.pr_number }}"
|
||||||
|
if [ -z "$PR_NUMBER" ]; then
|
||||||
|
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||||
|
PR_NUMBER=$(gh pr list --repo ${{ github.repository }} --head "$BRANCH" --json number --jq '.[0].number' 2>/dev/null || true)
|
||||||
|
fi
|
||||||
|
if [ -n "$PR_NUMBER" ] && [ -n "$ARTIFACT_ID" ]; then
|
||||||
|
BODY="| 📦 **Windows Build Complete for** $(git rev-parse HEAD) |"$'\n'
|
||||||
|
BODY+="|-|"$'\n'
|
||||||
|
BODY+="| [Download binary]($ARTIFACT_URL) |"
|
||||||
|
gh pr comment "$PR_NUMBER" --repo ${{ github.repository }} --body "$BODY"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: 🔑 Azure login
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
uses: azure/login@v1
|
||||||
|
with:
|
||||||
|
client-id: ${{ secrets.AZURE_CLIENT_ID }}
|
||||||
|
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
|
||||||
|
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
|
||||||
|
enable-AzPSSession: true
|
||||||
|
|
||||||
|
- name: 🔏 Sign
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
uses: azure/artifact-signing-action@v1
|
||||||
|
with:
|
||||||
|
endpoint: https://eus.codesigning.azure.net/
|
||||||
|
signing-account-name: Graphite
|
||||||
|
certificate-profile-name: Graphite
|
||||||
|
files: |
|
||||||
|
${{ github.workspace }}\target\artifacts\Graphite\Graphite.exe
|
||||||
|
${{ github.workspace }}\target\artifacts\Graphite\libcef.dll
|
||||||
|
${{ github.workspace }}\target\artifacts\Graphite\chrome_elf.dll
|
||||||
|
${{ github.workspace }}\target\artifacts\Graphite\vulkan-1.dll
|
||||||
|
${{ github.workspace }}\target\artifacts\Graphite\dxcompiler.dll
|
||||||
|
${{ github.workspace }}\target\artifacts\Graphite\libEGL.dll
|
||||||
|
${{ github.workspace }}\target\artifacts\Graphite\libGLESv2.dll
|
||||||
|
${{ github.workspace }}\target\artifacts\Graphite\vk_swiftshader.dll
|
||||||
|
file-digest: SHA256
|
||||||
|
timestamp-rfc3161: http://timestamp.acs.microsoft.com
|
||||||
|
timestamp-digest: SHA256
|
||||||
|
correlation-id: ${{ github.sha }}
|
||||||
|
|
||||||
|
- name: ✅ Verify signatures
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
shell: pwsh
|
||||||
|
run: |
|
||||||
|
$ErrorActionPreference = "Stop"
|
||||||
|
|
||||||
|
$TargetDir = "target\artifacts\Graphite"
|
||||||
|
|
||||||
|
if (-not (Test-Path $TargetDir)) {
|
||||||
|
throw "TargetDir not found: $TargetDir"
|
||||||
|
}
|
||||||
|
|
||||||
|
$UnsignedOrBad = @()
|
||||||
|
|
||||||
|
Get-ChildItem -Path $TargetDir -Recurse -File -Include *.exe,*.dll | ForEach-Object {
|
||||||
|
$sig = Get-AuthenticodeSignature -FilePath $_.FullName
|
||||||
|
|
||||||
|
if ($sig.Status -ne 'Valid') {
|
||||||
|
$UnsignedOrBad += "$($_.FullName) (Status=$($sig.Status))"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($UnsignedOrBad.Count -gt 0) {
|
||||||
|
Write-Host "Unsigned or invalid binaries detected:"
|
||||||
|
$UnsignedOrBad | ForEach-Object {
|
||||||
|
Write-Host "::error::$_"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($env:GITHUB_STEP_SUMMARY) {
|
||||||
|
"### ❌ Unsigned or invalid binaries detected" |
|
||||||
|
Out-File $env:GITHUB_STEP_SUMMARY -Append -Encoding utf8
|
||||||
|
"" | Out-File $env:GITHUB_STEP_SUMMARY -Append -Encoding utf8
|
||||||
|
$UnsignedOrBad | ForEach-Object {
|
||||||
|
"* `$_" | Out-File $env:GITHUB_STEP_SUMMARY -Append -Encoding utf8
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "All binaries are signed and valid."
|
||||||
|
|
||||||
|
if ($env:GITHUB_STEP_SUMMARY) {
|
||||||
|
"### ✅ All binaries are signed and valid" |
|
||||||
|
Out-File $env:GITHUB_STEP_SUMMARY -Append -Encoding utf8
|
||||||
|
}
|
||||||
|
|
||||||
|
- name: 📦 Upload signed Windows bundle
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
uses: actions/upload-artifact@v6
|
||||||
|
with:
|
||||||
|
name: graphite-windows-bundle-signed
|
||||||
|
path: target/artifacts
|
||||||
|
|
||||||
|
mac:
|
||||||
|
if: (github.event_name == 'push' && github.ref != 'refs/tags/latest-stable') || inputs.mac
|
||||||
|
runs-on: macos-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
env:
|
||||||
|
# NOTICE: keep these tool versions in sync with the other jobs in this file, `.devcontainer/devcontainer.json`, `.nix/dev.nix` and `.nix/pkgs/graphite.nix` (wasm-bindgen-cli), `tools/cargo-run/src/requirements.rs` (wasm-bindgen-cli, cargo-about), `tools/cargo-run/src/requirements/wasm_opt.rs` (Binaryen), and the `wasm-bindgen` crate in `Cargo.toml`
|
||||||
|
WASM_BINDGEN_CLI_VERSION: "0.2.121"
|
||||||
|
BINARYEN_VERSION: "130"
|
||||||
|
CARGO_ABOUT_VERSION: "0.9.2"
|
||||||
|
CARGO_BINSTALL_VERSION: "1.23.0"
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 📥 Clone repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
repository: ${{ inputs.checkout_repo || github.repository }}
|
||||||
|
ref: ${{ inputs.checkout_ref || '' }}
|
||||||
|
|
||||||
|
- name: 🦀 Install Rust
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
cache: false
|
||||||
|
rustflags: ""
|
||||||
|
target: wasm32-unknown-unknown
|
||||||
|
|
||||||
|
- name: 💾 Set up Cargo cache
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cargo/registry
|
||||||
|
~/.cargo/git
|
||||||
|
target
|
||||||
|
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
|
||||||
|
|
||||||
|
- name: 🟢 Install Node.js
|
||||||
|
uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version-file: .nvmrc
|
||||||
|
cache: npm
|
||||||
|
cache-dependency-path: |
|
||||||
|
package-lock.json
|
||||||
|
frontend/package-lock.json
|
||||||
|
|
||||||
|
- name: 📦 Install Cargo-binstall
|
||||||
|
uses: cargo-bins/[email protected]
|
||||||
|
with:
|
||||||
|
version: ${{ env.CARGO_BINSTALL_VERSION }}
|
||||||
|
|
||||||
|
- name: 🚧 Install native dependencies
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ github.token }}
|
||||||
|
BINSTALL_DISABLE_TELEMETRY: "true"
|
||||||
|
run: |
|
||||||
|
brew update
|
||||||
|
brew install \
|
||||||
|
pkg-config \
|
||||||
|
openssl@3 \
|
||||||
|
llvm
|
||||||
|
|
||||||
|
echo "OPENSSL_DIR=$(brew --prefix openssl@3)" >> $GITHUB_ENV
|
||||||
|
echo "PKG_CONFIG_PATH=$(brew --prefix openssl@3)/lib/pkgconfig" >> $GITHUB_ENV
|
||||||
|
echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH
|
||||||
|
|
||||||
|
BINARYEN_DIR="$HOME/.cache/binaryen-version_$BINARYEN_VERSION"
|
||||||
|
if [ ! -x "$BINARYEN_DIR/bin/wasm-opt" ]; then
|
||||||
|
mkdir -p "$BINARYEN_DIR"
|
||||||
|
curl -sSfL "https://github.com/WebAssembly/binaryen/releases/download/version_$BINARYEN_VERSION/binaryen-version_$BINARYEN_VERSION-arm64-macos.tar.gz" | tar xz -C "$BINARYEN_DIR" --strip-components=1
|
||||||
|
fi
|
||||||
|
echo "$BINARYEN_DIR/bin" >> "$GITHUB_PATH"
|
||||||
|
|
||||||
|
cargo binstall --no-confirm --force "cargo-about@${CARGO_ABOUT_VERSION}"
|
||||||
|
cargo binstall --no-confirm --force "wasm-bindgen-cli@${WASM_BINDGEN_CLI_VERSION}"
|
||||||
|
|
||||||
|
- name: 🏗 Build Mac bundle
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
run: cargo run build desktop${{ inputs.debug && ' debug' || '' }}
|
||||||
|
|
||||||
|
- name: 📁 Stage artifacts
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
PROFILE=${{ inputs.debug && 'debug' || 'release' }}
|
||||||
|
rm -rf target/artifacts
|
||||||
|
mkdir -p target/artifacts
|
||||||
|
cp -R target/$PROFILE/Graphite.app target/artifacts/Graphite.app
|
||||||
|
|
||||||
|
- name: 📦 Upload Mac bundle
|
||||||
|
if: github.event_name != 'push'
|
||||||
|
uses: actions/upload-artifact@v6
|
||||||
|
with:
|
||||||
|
name: graphite-mac-bundle
|
||||||
|
path: target/artifacts
|
||||||
|
|
||||||
|
- name: 💬 Comment artifact link on PR
|
||||||
|
if: github.event_name != 'push'
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
ARTIFACT_ID=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts --jq '.artifacts[] | select(.name == "graphite-mac-bundle") | .id')
|
||||||
|
ARTIFACT_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/$ARTIFACT_ID"
|
||||||
|
PR_NUMBER="${{ inputs.pr_number }}"
|
||||||
|
if [ -z "$PR_NUMBER" ]; then
|
||||||
|
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||||
|
PR_NUMBER=$(gh pr list --repo ${{ github.repository }} --head "$BRANCH" --json number --jq '.[0].number' 2>/dev/null || true)
|
||||||
|
fi
|
||||||
|
if [ -n "$PR_NUMBER" ] && [ -n "$ARTIFACT_ID" ]; then
|
||||||
|
BODY="| 📦 **Mac Build Complete for** $(git rev-parse HEAD) |"$'\n'
|
||||||
|
BODY+="|-|"$'\n'
|
||||||
|
BODY+="| [Download binary]($ARTIFACT_URL) |"
|
||||||
|
gh pr comment "$PR_NUMBER" --repo ${{ github.repository }} --body "$BODY"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: 🔏 Sign and notarize (preparation)
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
env:
|
||||||
|
APPLE_CERT_BASE64: ${{ secrets.APPLE_CERT_BASE64 }}
|
||||||
|
APPLE_CERT_PASSWORD: ${{ secrets.APPLE_CERT_PASSWORD }}
|
||||||
|
run: |
|
||||||
|
mkdir -p .sign
|
||||||
|
echo "$APPLE_CERT_BASE64" | base64 --decode > .sign/certificate.p12
|
||||||
|
|
||||||
|
security create-keychain -p "" .sign/main.keychain
|
||||||
|
security default-keychain -s .sign/main.keychain
|
||||||
|
security unlock-keychain -p "" .sign/main.keychain
|
||||||
|
security set-keychain-settings -t 3600 -u .sign/main.keychain
|
||||||
|
|
||||||
|
security import .sign/certificate.p12 -k .sign/main.keychain -P "$APPLE_CERT_PASSWORD" -T /usr/bin/codesign -T /usr/bin/productsign
|
||||||
|
security set-key-partition-list -S apple-tool:,apple: -s -k "" .sign/main.keychain
|
||||||
|
|
||||||
|
cat > .sign/entitlements.plist <<'EOF'
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>com.apple.security.cs.allow-jit</key>
|
||||||
|
<true/>
|
||||||
|
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
|
||||||
|
<true/>
|
||||||
|
<key>com.apple.security.cs.disable-executable-page-protection</key>
|
||||||
|
<true/>
|
||||||
|
<key>com.apple.security.cs.disable-library-validation</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
|
EOF
|
||||||
|
|
||||||
|
- name: 🔏 Sign and notarize
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
env:
|
||||||
|
APPLE_EMAIL: ${{ secrets.APPLE_EMAIL }}
|
||||||
|
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
|
||||||
|
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
|
||||||
|
APPLE_CERT_NAME: ${{ secrets.APPLE_CERT_NAME }}
|
||||||
|
run: |
|
||||||
|
CERTIFICATE="$APPLE_CERT_NAME"
|
||||||
|
ENTITLEMENTS=".sign/entitlements.plist"
|
||||||
|
APP_PATH="target/artifacts/Graphite.app"
|
||||||
|
ZIP_PATH=".sign/Graphite.zip"
|
||||||
|
|
||||||
|
codesign --force --options runtime --entitlements "$ENTITLEMENTS" --sign "$CERTIFICATE" "$APP_PATH/Contents/Frameworks/Graphite Helper.app"
|
||||||
|
codesign --force --options runtime --entitlements "$ENTITLEMENTS" --sign "$CERTIFICATE" "$APP_PATH/Contents/Frameworks/Graphite Helper (GPU).app"
|
||||||
|
codesign --force --options runtime --entitlements "$ENTITLEMENTS" --sign "$CERTIFICATE" "$APP_PATH/Contents/Frameworks/Graphite Helper (Renderer).app"
|
||||||
|
find "$APP_PATH/Contents/Frameworks/Chromium Embedded Framework.framework/Libraries" -name "*.dylib" -exec codesign --force --options runtime --entitlements "$ENTITLEMENTS" --sign "$CERTIFICATE" {} \;
|
||||||
|
codesign --force --options runtime --entitlements "$ENTITLEMENTS" --sign "$CERTIFICATE" "$APP_PATH/Contents/Frameworks/Chromium Embedded Framework.framework"
|
||||||
|
codesign --force --options runtime --entitlements "$ENTITLEMENTS" --sign "$CERTIFICATE" "$APP_PATH" --deep
|
||||||
|
|
||||||
|
codesign --verify --deep --strict --verbose=4 "$APP_PATH"
|
||||||
|
|
||||||
|
ditto -c -k --keepParent "$APP_PATH" "$ZIP_PATH"
|
||||||
|
SUBMISSION_ID=$(xcrun notarytool submit "$ZIP_PATH" --wait --output-format json --apple-id "$APPLE_EMAIL" --team-id "$APPLE_TEAM_ID" --password "$APPLE_PASSWORD" | tee /dev/stderr | jq -r '.id')
|
||||||
|
STATUS=$(xcrun notarytool info "$SUBMISSION_ID" --output-format json --apple-id "$APPLE_EMAIL" --team-id "$APPLE_TEAM_ID" --password "$APPLE_PASSWORD" | jq -r '.status')
|
||||||
|
if [ "$STATUS" != "Accepted" ]; then
|
||||||
|
echo "Notarization failed with status: $STATUS"
|
||||||
|
xcrun notarytool log "$SUBMISSION_ID" --apple-id "$APPLE_EMAIL" --team-id "$APPLE_TEAM_ID" --password "$APPLE_PASSWORD"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
rm "$ZIP_PATH"
|
||||||
|
|
||||||
|
xcrun stapler staple -v "$APP_PATH"
|
||||||
|
|
||||||
|
spctl -a -vv "$APP_PATH"
|
||||||
|
|
||||||
|
- name: 📦 Upload signed Mac bundle
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
uses: actions/upload-artifact@v6
|
||||||
|
with:
|
||||||
|
name: graphite-mac-bundle-signed
|
||||||
|
path: target/artifacts
|
||||||
|
|
||||||
|
linux:
|
||||||
|
if: (github.event_name == 'push' && github.ref != 'refs/tags/latest-stable') || inputs.linux
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 📥 Clone repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
repository: ${{ inputs.checkout_repo || github.repository }}
|
||||||
|
ref: ${{ inputs.checkout_ref || '' }}
|
||||||
|
|
||||||
|
- name: ❄ Install Nix
|
||||||
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
with:
|
||||||
|
extra-conf: |
|
||||||
|
extra-substituters = https://graphite.cachix.org https://graphite-dev.cachix.org
|
||||||
|
extra-trusted-public-keys = graphite.cachix.org-1:B7Il1yMpkquN/dXM+5GRmz+4Xmu2aaCS1GcWNfFhsOo= graphite-dev.cachix.org-1:RppXYpiV1qO2TYKTkXXGHsAEQDOB5G51b3VlrN9QmbI=
|
||||||
|
|
||||||
|
- name: 🗑 Free disk space
|
||||||
|
run: sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc /opt/hostedtoolcache
|
||||||
|
|
||||||
|
- name: 📦 Build Nix package
|
||||||
|
run: nix build .#graphite${{ inputs.debug && '-dev' || '' }} --no-link --print-out-paths --print-build-logs
|
||||||
|
|
||||||
|
- name: 📤 Push to Nix cache
|
||||||
|
env:
|
||||||
|
NIX_CACHE_AUTH_TOKEN: ${{ (!inputs.debug && github.ref == 'refs/heads/master') && secrets.NIX_CACHE_AUTH_TOKEN || secrets.NIX_CACHE_AUTH_TOKEN_DEV }}
|
||||||
|
NIX_CACHE_NAME: ${{ (!inputs.debug && github.ref == 'refs/heads/master') && 'graphite' || 'graphite-dev' }}
|
||||||
|
run: |
|
||||||
|
nix run nixpkgs#cachix -- authtoken $NIX_CACHE_AUTH_TOKEN
|
||||||
|
nix build .#graphite${{ inputs.debug && '-dev' || '' }} --no-link --print-out-paths | nix run nixpkgs#cachix -- push $NIX_CACHE_NAME
|
||||||
|
|
||||||
|
- name: 📤 Push Dependencies to dev Nix cache
|
||||||
|
env:
|
||||||
|
NIX_CACHE_AUTH_TOKEN: ${{ secrets.NIX_CACHE_AUTH_TOKEN_DEV }}
|
||||||
|
NIX_CACHE_NAME: graphite-dev
|
||||||
|
run: |
|
||||||
|
nix run nixpkgs#cachix -- authtoken $NIX_CACHE_AUTH_TOKEN
|
||||||
|
nix build .#graphite${{ inputs.debug && '-dev' || '' }}.deps --no-link --print-out-paths | nix run nixpkgs#cachix -- push $NIX_CACHE_NAME
|
||||||
|
|
||||||
|
- name: 🏗 Build Linux bundle
|
||||||
|
run: nix build .#graphite-bundle${{ inputs.debug && '-dev' || '' }}.tar.xz && cp ./result ./graphite-linux-bundle.tar.xz
|
||||||
|
|
||||||
|
- name: 📦 Upload Linux bundle
|
||||||
|
uses: actions/upload-artifact@v6
|
||||||
|
with:
|
||||||
|
name: graphite-linux-bundle
|
||||||
|
path: graphite-linux-bundle.tar.xz
|
||||||
|
compression-level: 0
|
||||||
|
|
||||||
|
- name: 💬 Comment artifact link on PR
|
||||||
|
id: linux-comment
|
||||||
|
if: github.event_name != 'push'
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
ARTIFACT_ID=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts --jq '.artifacts[] | select(.name == "graphite-linux-bundle") | .id')
|
||||||
|
ARTIFACT_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/$ARTIFACT_ID"
|
||||||
|
PR_NUMBER="${{ inputs.pr_number }}"
|
||||||
|
if [ -z "$PR_NUMBER" ]; then
|
||||||
|
BRANCH=$(git rev-parse --abbrev-ref HEAD)
|
||||||
|
PR_NUMBER=$(gh pr list --repo ${{ github.repository }} --head "$BRANCH" --json number --jq '.[0].number' 2>/dev/null || true)
|
||||||
|
fi
|
||||||
|
if [ -n "$PR_NUMBER" ] && [ -n "$ARTIFACT_ID" ]; then
|
||||||
|
BODY="| 📦 **Linux Build Complete for** $(git rev-parse HEAD) |"$'\n'
|
||||||
|
BODY+="|-|"$'\n'
|
||||||
|
BODY+="| [Download binary]($ARTIFACT_URL) |"
|
||||||
|
COMMENT_ID=$(gh api repos/${{ github.repository }}/issues/$PR_NUMBER/comments -f body="$BODY" --jq '.id')
|
||||||
|
echo "comment_id=$COMMENT_ID" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: 🔧 Install Flatpak tooling
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y flatpak flatpak-builder
|
||||||
|
flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
|
||||||
|
|
||||||
|
- name: 🏗 Build Flatpak
|
||||||
|
run: |
|
||||||
|
nix build .#graphite-flatpak-manifest${{ inputs.debug && '-dev' || '' }}
|
||||||
|
|
||||||
|
rm -rf .flatpak
|
||||||
|
mkdir -p .flatpak
|
||||||
|
|
||||||
|
cp ./result .flatpak/manifest.json
|
||||||
|
|
||||||
|
cd .flatpak
|
||||||
|
mkdir -p repo
|
||||||
|
|
||||||
|
flatpak-builder --user --force-clean --install-deps-from=flathub --repo=repo build ./manifest.json
|
||||||
|
|
||||||
|
flatpak build-bundle repo Graphite.flatpak art.graphite.Graphite --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo
|
||||||
|
|
||||||
|
- name: 📦 Upload Flatpak package
|
||||||
|
uses: actions/upload-artifact@v6
|
||||||
|
with:
|
||||||
|
name: graphite-flatpak
|
||||||
|
path: .flatpak/Graphite.flatpak
|
||||||
|
compression-level: 0
|
||||||
|
|
||||||
|
- name: 💬 Update PR comment with Flatpak artifact link
|
||||||
|
if: github.event_name != 'push' && steps.linux-comment.outputs.comment_id
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: |
|
||||||
|
ARTIFACT_ID=$(gh api repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts --jq '.artifacts[] | select(.name == "graphite-flatpak") | .id')
|
||||||
|
ARTIFACT_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/artifacts/$ARTIFACT_ID"
|
||||||
|
COMMENT_ID="${{ steps.linux-comment.outputs.comment_id }}"
|
||||||
|
if [ -n "$ARTIFACT_ID" ]; then
|
||||||
|
EXISTING_BODY=$(gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID --jq '.body')
|
||||||
|
BODY="$EXISTING_BODY"$'\n'
|
||||||
|
BODY+="| [Download Flatpak]($ARTIFACT_URL) |"
|
||||||
|
gh api repos/${{ github.repository }}/issues/comments/$COMMENT_ID -X PATCH -f body="$BODY"
|
||||||
|
fi
|
||||||
@@ -1,17 +1,18 @@
|
|||||||
name: "Audit Security Advisories"
|
name: "Audit Security Advisories"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
# Run once each day
|
# Run once each week
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "0 0 * * *"
|
- cron: "0 0 * * 0"
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
cargo-deny:
|
cargo-deny:
|
||||||
|
if: github.repository == 'GraphiteEditor/Graphite' # Don't run on forks by default
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 📥 Clone and checkout repository
|
- name: 📥 Clone repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: 🔒 Check crate security advisories for root workspace
|
- name: 🔒 Check crate security advisories for root workspace
|
||||||
uses: EmbarkStudios/cargo-deny-action@v2
|
uses: EmbarkStudios/cargo-deny-action@v2
|
||||||
|
|||||||
@@ -0,0 +1,103 @@
|
|||||||
|
name: "Check"
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request: {}
|
||||||
|
merge_group: {}
|
||||||
|
|
||||||
|
env:
|
||||||
|
CARGO_TERM_COLOR: always
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# Check if CI can be skipped (for merge queue deduplication)
|
||||||
|
skip-check:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
skip: ${{ steps.check.outputs.skip-check }}
|
||||||
|
steps:
|
||||||
|
- name: 📥 Clone repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: 🚦 Check if CI can be skipped
|
||||||
|
id: check
|
||||||
|
uses: cariad-tech/merge-queue-ci-skipper@cf80db21fc70244e36487acc531b3f1118889b0a
|
||||||
|
|
||||||
|
# Build the web app via the shared build workflow
|
||||||
|
build:
|
||||||
|
needs: skip-check
|
||||||
|
if: needs.skip-check.outputs.skip != 'true'
|
||||||
|
uses: ./.github/workflows/build.yml
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
web: true
|
||||||
|
merge_queue: ${{ github.event_name == 'merge_group' }}
|
||||||
|
|
||||||
|
# Run the Rust tests on the self-hosted native runner
|
||||||
|
test:
|
||||||
|
needs: skip-check
|
||||||
|
if: needs.skip-check.outputs.skip != 'true'
|
||||||
|
runs-on: [self-hosted, target/native]
|
||||||
|
env:
|
||||||
|
RUSTC_WRAPPER: /usr/bin/sccache
|
||||||
|
CARGO_INCREMENTAL: 0
|
||||||
|
SCCACHE_DIR: /var/lib/github-actions/.cache
|
||||||
|
steps:
|
||||||
|
- name: 📥 Clone repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: 🦀 Install Rust
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
cache: false
|
||||||
|
rustflags: ""
|
||||||
|
|
||||||
|
- name: 🦀 Fetch Rust dependencies
|
||||||
|
run: cargo fetch --locked
|
||||||
|
|
||||||
|
- name: 🧪 Run Rust tests
|
||||||
|
env:
|
||||||
|
# `--cfg=web_sys_unstable_apis` mirrors the `[build]` section of `.cargo/config.toml`
|
||||||
|
RUSTFLAGS: "-Dwarnings --cfg=web_sys_unstable_apis"
|
||||||
|
run: mold -run cargo test --all-features
|
||||||
|
|
||||||
|
# Rust format check on GitHub runner
|
||||||
|
rust-fmt:
|
||||||
|
needs: skip-check
|
||||||
|
if: needs.skip-check.outputs.skip != 'true'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: 📥 Clone repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: 🦀 Install Rust
|
||||||
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
override: true
|
||||||
|
cache: false
|
||||||
|
rustflags: ""
|
||||||
|
components: rustfmt
|
||||||
|
|
||||||
|
- name: 🔬 Check Rust formatting
|
||||||
|
run: cargo fmt --all -- --check
|
||||||
|
|
||||||
|
# License compatibility check on GitHub runner
|
||||||
|
check-licenses:
|
||||||
|
needs: skip-check
|
||||||
|
if: needs.skip-check.outputs.skip != 'true'
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: 📥 Clone repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: 📜 Check crate license compatibility for root workspace
|
||||||
|
uses: EmbarkStudios/cargo-deny-action@v2
|
||||||
|
with:
|
||||||
|
command: check bans licenses sources
|
||||||
|
|
||||||
|
- name: 📜 Check crate license compatibility for /libraries/rawkit
|
||||||
|
uses: EmbarkStudios/cargo-deny-action@v2
|
||||||
|
with:
|
||||||
|
command: check bans licenses sources
|
||||||
|
manifest-path: libraries/rawkit/Cargo.toml
|
||||||
@@ -1,122 +1,137 @@
|
|||||||
# USAGE:
|
# USAGE:
|
||||||
# After reviewing the code, core team members may comment on a PR with the exact text:
|
# After reviewing the code, core team members may comment on a PR with `!build` followed by optional `<target>` and `<profile>` arguments.
|
||||||
# - `!build-dev` to build with debug symbols and optimizations disabled
|
# This matches the syntax of the `cargo run build` CLI command, but allows platforms to be specified.
|
||||||
# - `!build-profiling` to build with debug symbols and optimizations enabled
|
#
|
||||||
# - `!build` to build without debug symbols and optimizations enabled
|
# `<target>`: `web` (default), `desktop` (all platforms), or `desktop:<platforms>` (subset of `windows+mac+linux`)
|
||||||
# The comment may not contain any other text, not even whitespace or newlines.
|
# `<profile>`: `release` (default) or `debug`
|
||||||
|
#
|
||||||
|
# Examples:
|
||||||
|
# - !build
|
||||||
|
# - !build debug
|
||||||
|
# - !build desktop
|
||||||
|
# - !build desktop:windows+mac
|
||||||
|
# - !build desktop:linux debug
|
||||||
name: "!build PR Command"
|
name: "!build PR Command"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
issue_comment:
|
issue_comment:
|
||||||
types:
|
types:
|
||||||
- created
|
- created
|
||||||
env:
|
|
||||||
CARGO_TERM_COLOR: always
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
setup:
|
||||||
# Command should be limited to core team members (those in the organization) for security.
|
# Command should be limited to core team members (those in the organization) for security.
|
||||||
# From the GitHub Actions docs:
|
# From the GitHub Actions docs:
|
||||||
# author_association = 'MEMBER': Author is a member of the organization that owns the repository.
|
# author_association = 'MEMBER': Author is a member of the organization that owns the repository.
|
||||||
if: >
|
if: >
|
||||||
github.event.issue.pull_request &&
|
github.event.issue.pull_request &&
|
||||||
github.event.comment.author_association == 'MEMBER' &&
|
github.event.comment.author_association == 'MEMBER' &&
|
||||||
(github.event.comment.body == '!build-dev' || github.event.comment.body == '!build-profiling' || github.event.comment.body == '!build')
|
startsWith(github.event.comment.body, '!build')
|
||||||
runs-on: self-hosted
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
|
||||||
deployments: write
|
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
env:
|
outputs:
|
||||||
RUSTC_WRAPPER: /usr/bin/sccache
|
repo: ${{ steps.pr_info.outputs.repo }}
|
||||||
CARGO_INCREMENTAL: 0
|
ref: ${{ steps.pr_info.outputs.ref }}
|
||||||
SCCACHE_DIR: /var/lib/github-actions/.cache
|
web: ${{ steps.pr_info.outputs.web }}
|
||||||
|
windows: ${{ steps.pr_info.outputs.windows }}
|
||||||
|
mac: ${{ steps.pr_info.outputs.mac }}
|
||||||
|
linux: ${{ steps.pr_info.outputs.linux }}
|
||||||
|
debug: ${{ steps.pr_info.outputs.debug }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 🔎 Find branch for this PR
|
- name: 🔎 Parse command, find branch, and set build flags
|
||||||
id: commit_info
|
id: pr_info
|
||||||
run: |
|
run: |
|
||||||
RESPONSE=$(curl -L -H 'Accept: application/vnd.github+json' -H 'X-GitHub-Api-Version: 2022-11-28' https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.issue.number }})
|
COMMENT="${{ github.event.comment.body }}"
|
||||||
REPO=$(echo $RESPONSE | jq -r '.head.repo.full_name')
|
|
||||||
REF=$(echo $RESPONSE | jq -r '.head.ref')
|
|
||||||
SHA=$(echo $RESPONSE | jq -r '.head.sha')
|
|
||||||
echo "repo=$REPO" >> $GITHUB_OUTPUT
|
|
||||||
echo "ref=$REF" >> $GITHUB_OUTPUT
|
|
||||||
echo "sha=$SHA" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: 📥 Clone and checkout repository
|
# Split into space-separated words
|
||||||
uses: actions/checkout@v3
|
read -ra WORDS <<< "$COMMENT"
|
||||||
with:
|
|
||||||
repository: ${{ steps.commit_info.outputs.repo }}
|
|
||||||
ref: ${{ steps.commit_info.outputs.ref }}
|
|
||||||
|
|
||||||
- name: 🗑 Clear wasm-bindgen cache
|
# First word must be "!build"
|
||||||
continue-on-error: true
|
if [[ "${WORDS[0]}" != "!build" ]]; then
|
||||||
run: rm -r ~/.cache/.wasm-pack
|
echo "::error::Expected comment to start with !build"
|
||||||
|
exit 1
|
||||||
- name: 🟢 Install the latest Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: "latest"
|
|
||||||
|
|
||||||
- name: 🚧 Install Node dependencies
|
|
||||||
run: |
|
|
||||||
cd frontend
|
|
||||||
npm ci
|
|
||||||
|
|
||||||
- name: 🦀 Install the latest Rust
|
|
||||||
run: |
|
|
||||||
echo "Initial system version:"
|
|
||||||
rustc --version
|
|
||||||
rustup update stable
|
|
||||||
echo "Latest updated version:"
|
|
||||||
rustc --version
|
|
||||||
|
|
||||||
- name: ✂ Replace template in <head> of index.html
|
|
||||||
env:
|
|
||||||
INDEX_HTML_HEAD_REPLACEMENT: ""
|
|
||||||
run: |
|
|
||||||
# Remove the INDEX_HTML_HEAD_REPLACEMENT environment variable for build links (not master deploys)
|
|
||||||
sed -i "s|<!-- INDEX_HTML_HEAD_REPLACEMENT -->|$INDEX_HTML_HEAD_REPLACEMENT|" frontend/index.html
|
|
||||||
|
|
||||||
- name: ⌨ Set build command based on comment
|
|
||||||
id: build_command
|
|
||||||
run: |
|
|
||||||
if [[ "${{ github.event.comment.body }}" == "!build-dev" ]]; then
|
|
||||||
echo "command=build-dev" >> $GITHUB_OUTPUT
|
|
||||||
elif [[ "${{ github.event.comment.body }}" == "!build-profiling" ]]; then
|
|
||||||
echo "command=build-profiling" >> $GITHUB_OUTPUT
|
|
||||||
elif [[ "${{ github.event.comment.body }}" == "!build" ]]; then
|
|
||||||
echo "command=build" >> $GITHUB_OUTPUT
|
|
||||||
else
|
|
||||||
echo "Failed to detect if the build command written in the comment should have been '!build-dev', '!build-profiling', or '!build'" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: 🌐 Build Graphite web code
|
# Initialize build flags (web defaults to true, matching the CLI default target)
|
||||||
env:
|
WEB="true"
|
||||||
NODE_ENV: production
|
WINDOWS="false"
|
||||||
run: |
|
MAC="false"
|
||||||
cd frontend
|
LINUX="false"
|
||||||
mold -run npm run ${{ steps.build_command.outputs.command }}
|
DEBUG="false"
|
||||||
|
|
||||||
- name: 📤 Publish to Cloudflare Pages
|
# Parse target (optional, defaults to `web` if omitted)
|
||||||
id: cloudflare
|
IDX=1
|
||||||
uses: cloudflare/pages-action@1
|
case "${WORDS[$IDX]:-}" in
|
||||||
continue-on-error: true
|
# Target: `web` enables just the web build (already the default, but accepted explicitly)
|
||||||
with:
|
"web")
|
||||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
((IDX++)) ;;
|
||||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
# Target: `desktop` enables all three desktop platforms
|
||||||
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
|
"desktop")
|
||||||
projectName: graphite-dev
|
WEB="false"; WINDOWS="true"; MAC="true"; LINUX="true"; ((IDX++)) ;;
|
||||||
directory: frontend/dist
|
# Target: `desktop:<platforms>` enables a subset of desktop platforms, split by `+`
|
||||||
|
desktop:*)
|
||||||
|
WEB="false"
|
||||||
|
PLATFORMS="${WORDS[$IDX]#desktop:}"
|
||||||
|
IFS='+' read -ra PARTS <<< "$PLATFORMS"
|
||||||
|
for PART in "${PARTS[@]}"; do
|
||||||
|
case "$PART" in
|
||||||
|
"windows") WINDOWS="true" ;;
|
||||||
|
"mac") MAC="true" ;;
|
||||||
|
"linux") LINUX="true" ;;
|
||||||
|
*) echo "::error::Unrecognized platform: $PART"; exit 1 ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
((IDX++))
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
- name: 💬 Comment build link
|
# Parse profile (optional, defaults to `release` if omitted)
|
||||||
uses: actions/github-script@v6
|
case "${WORDS[$IDX]:-}" in
|
||||||
|
"debug") DEBUG="true"; ((IDX++)) ;;
|
||||||
|
"release") ((IDX++)) ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# Reject any unexpected trailing words
|
||||||
|
if [[ $IDX -lt ${#WORDS[@]} ]]; then
|
||||||
|
echo "::error::Unexpected argument: ${WORDS[$IDX]}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Write parsed build flags to job outputs
|
||||||
|
echo "web=$WEB" >> $GITHUB_OUTPUT
|
||||||
|
echo "windows=$WINDOWS" >> $GITHUB_OUTPUT
|
||||||
|
echo "mac=$MAC" >> $GITHUB_OUTPUT
|
||||||
|
echo "linux=$LINUX" >> $GITHUB_OUTPUT
|
||||||
|
echo "debug=$DEBUG" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
# Fetch the PR's head branch and repo (needed for forked PRs where the code lives in another repo)
|
||||||
|
RESPONSE=$(curl -L -H 'Accept: application/vnd.github+json' -H 'X-GitHub-Api-Version: 2022-11-28' https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.issue.number }})
|
||||||
|
echo "repo=$(echo $RESPONSE | jq -r '.head.repo.full_name')" >> $GITHUB_OUTPUT
|
||||||
|
echo "ref=$(echo $RESPONSE | jq -r '.head.ref')" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: 💬 Edit comment with workflow run link
|
||||||
|
uses: actions/github-script@v8
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
github.rest.issues.createComment({
|
github.rest.issues.updateComment({
|
||||||
issue_number: context.issue.number,
|
comment_id: ${{ github.event.comment.id }},
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
body: '| 📦 **Build Complete for** ${{ steps.commit_info.outputs.sha }} |\n|-|\n| ${{ steps.cloudflare.outputs.url }} |'
|
body: '${{ github.event.comment.body }} ([Run ID ' + context.runId + '](https://github.com/GraphiteEditor/Graphite/actions/runs/' + context.runId + '))'
|
||||||
})
|
});
|
||||||
|
|
||||||
|
invoke-build:
|
||||||
|
needs: setup
|
||||||
|
uses: ./.github/workflows/build.yml
|
||||||
|
secrets: inherit
|
||||||
|
with:
|
||||||
|
web: ${{ needs.setup.outputs.web == 'true' }}
|
||||||
|
windows: ${{ needs.setup.outputs.windows == 'true' }}
|
||||||
|
mac: ${{ needs.setup.outputs.mac == 'true' }}
|
||||||
|
linux: ${{ needs.setup.outputs.linux == 'true' }}
|
||||||
|
debug: ${{ needs.setup.outputs.debug == 'true' }}
|
||||||
|
checkout_repo: ${{ needs.setup.outputs.repo }}
|
||||||
|
checkout_ref: ${{ needs.setup.outputs.ref }}
|
||||||
|
pr_number: ${{ github.event.issue.number }}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Clippy Check
|
name: "Clippy Check"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -15,7 +15,7 @@ jobs:
|
|||||||
contents: read
|
contents: read
|
||||||
pull-requests: write
|
pull-requests: write
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
@@ -52,7 +52,7 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Delete previous comments
|
- name: Delete previous comments
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v8
|
||||||
with:
|
with:
|
||||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||||
script: |
|
script: |
|
||||||
@@ -76,7 +76,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Comment PR
|
- name: Comment PR
|
||||||
if: steps.clippy.outputs.CLIPPY_ISSUES_FOUND == 'true'
|
if: steps.clippy.outputs.CLIPPY_ISSUES_FOUND == 'true'
|
||||||
uses: actions/github-script@v6
|
uses: actions/github-script@v8
|
||||||
with:
|
with:
|
||||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||||
script: |
|
script: |
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
name: Profiling Changes
|
name: "Profiling Changes"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- 'node-graph/**'
|
- "node-graph/**"
|
||||||
- 'Cargo.toml'
|
- "Cargo.toml"
|
||||||
- 'Cargo.lock'
|
- "Cargo.lock"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
@@ -15,35 +15,21 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Install Rust
|
- name: Install Rust
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
|
||||||
- name: Install Valgrind
|
|
||||||
run: |
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install -y valgrind
|
|
||||||
|
|
||||||
- name: Cache Rust dependencies
|
- name: Cache Rust dependencies
|
||||||
uses: Swatinem/rust-cache@v2
|
uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
# Cache on Cargo.lock file
|
# Cache on Cargo.lock file
|
||||||
cache-on-failure: true
|
cache-on-failure: true
|
||||||
|
|
||||||
- name: Cache iai-callgrind binary
|
- name: Install gungraun-runner and valgrind
|
||||||
id: cache-iai
|
uses: gungraun/setup-gungraun@v1
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ~/.cargo/bin/iai-callgrind-runner
|
|
||||||
key: ${{ runner.os }}-iai-callgrind-runner-0.16.1
|
|
||||||
|
|
||||||
- name: Install iai-callgrind
|
|
||||||
if: steps.cache-iai.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
|
||||||
cargo install [email protected]
|
|
||||||
|
|
||||||
- name: Checkout master branch
|
- name: Checkout master branch
|
||||||
run: |
|
run: |
|
||||||
@@ -65,42 +51,41 @@ jobs:
|
|||||||
|
|
||||||
- name: Cache benchmark baselines
|
- name: Cache benchmark baselines
|
||||||
id: cache-benchmark-baselines
|
id: cache-benchmark-baselines
|
||||||
uses: actions/cache@v4
|
uses: actions/cache@v5
|
||||||
with:
|
with:
|
||||||
path: target/iai
|
path: target/gungraun
|
||||||
key: ${{ runner.os }}-${{ runner.arch }}-${{ steps.cpu-info.outputs.cpu-hash }}-benchmark-baselines-master-${{ steps.master-sha.outputs.sha }}
|
key: ${{ runner.os }}-${{ runner.arch }}-${{ steps.cpu-info.outputs.cpu-hash }}-gungraun-benchmark-baselines-master-${{ steps.master-sha.outputs.sha }}
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-${{ runner.arch }}-${{ steps.cpu-info.outputs.cpu-hash }}-benchmark-baselines-master-
|
${{ runner.os }}-${{ runner.arch }}-${{ steps.cpu-info.outputs.cpu-hash }}-gungraun-benchmark-baselines-master-
|
||||||
|
|
||||||
- name: Run baseline benchmarks
|
- name: Run baseline benchmarks
|
||||||
if: steps.cache-benchmark-baselines.outputs.cache-hit != 'true'
|
if: steps.cache-benchmark-baselines.outputs.cache-hit != 'true'
|
||||||
run: |
|
run: |
|
||||||
# Compile benchmarks
|
# Compile benchmarks
|
||||||
cargo bench --bench compile_demo_art_iai -- --save-baseline=master
|
cargo bench --bench compile_demo_art_gungraun -- --save-baseline=master
|
||||||
|
|
||||||
# Runtime benchmarks
|
# Runtime benchmarks
|
||||||
cargo bench --bench update_executor_iai -- --save-baseline=master
|
cargo bench --bench update_executor_gungraun -- --save-baseline=master
|
||||||
cargo bench --bench run_once_iai -- --save-baseline=master
|
cargo bench --bench run_once_gungraun -- --save-baseline=master
|
||||||
cargo bench --bench run_cached_iai -- --save-baseline=master
|
cargo bench --bench run_cached_gungraun -- --save-baseline=master
|
||||||
|
|
||||||
- name: Checkout PR branch
|
- name: Checkout PR branch
|
||||||
run: |
|
run: git checkout ${{ github.event.pull_request.head.sha }}
|
||||||
git checkout ${{ github.event.pull_request.head.sha }}
|
|
||||||
|
|
||||||
- name: Run PR benchmarks
|
- name: Run PR benchmarks
|
||||||
run: |
|
run: |
|
||||||
# Compile benchmarks
|
# Compile benchmarks
|
||||||
cargo bench --bench compile_demo_art_iai -- --baseline=master --output-format=json | jq -sc | sed 's/\\"//g' > /tmp/compile_output.json
|
cargo bench --bench compile_demo_art_gungraun -- --baseline=master --output-format=json | jq -sc | sed 's/\\"//g' > /tmp/compile_output.json
|
||||||
|
|
||||||
# Runtime benchmarks
|
# Runtime benchmarks
|
||||||
cargo bench --bench update_executor_iai -- --baseline=master --output-format=json | jq -sc | sed 's/\\"//g' > /tmp/update_output.json
|
cargo bench --bench update_executor_gungraun -- --baseline=master --output-format=json | jq -sc | sed 's/\\"//g' > /tmp/update_output.json
|
||||||
cargo bench --bench run_once_iai -- --baseline=master --output-format=json | jq -sc | sed 's/\\"//g' > /tmp/run_once_output.json
|
cargo bench --bench run_once_gungraun -- --baseline=master --output-format=json | jq -sc | sed 's/\\"//g' > /tmp/run_once_output.json
|
||||||
cargo bench --bench run_cached_iai -- --baseline=master --output-format=json | jq -sc | sed 's/\\"//g' > /tmp/run_cached_output.json
|
cargo bench --bench run_cached_gungraun -- --baseline=master --output-format=json | jq -sc | sed 's/\\"//g' > /tmp/run_cached_output.json
|
||||||
|
|
||||||
- name: Make old comments collapsed by default
|
- name: Make old comments collapsed by default
|
||||||
# Only run if we have write permissions (not a fork)
|
# Only run if we have write permissions (not a fork)
|
||||||
if: github.event.pull_request.head.repo.full_name == github.repository
|
if: github.event.pull_request.head.repo.full_name == github.repository
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v8
|
||||||
with:
|
with:
|
||||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||||
script: |
|
script: |
|
||||||
@@ -126,7 +111,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Analyze profiling changes
|
- name: Analyze profiling changes
|
||||||
id: analyze
|
id: analyze
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v8
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
@@ -152,6 +137,7 @@ jobs:
|
|||||||
const sectionTitles = ['Compilation', 'Update', 'Run Once', 'Cached Execution'];
|
const sectionTitles = ['Compilation', 'Update', 'Run Once', 'Cached Execution'];
|
||||||
|
|
||||||
let hasSignificantChanges = false;
|
let hasSignificantChanges = false;
|
||||||
|
let hasRegressions = false;
|
||||||
let regressionDetails = [];
|
let regressionDetails = [];
|
||||||
|
|
||||||
for (let i = 0; i < allOutputs.length; i++) {
|
for (let i = 0; i < allOutputs.length; i++) {
|
||||||
@@ -168,24 +154,30 @@ jobs:
|
|||||||
|
|
||||||
if (isSignificantChange(diffPct, absoluteChange, outputName)) {
|
if (isSignificantChange(diffPct, absoluteChange, outputName)) {
|
||||||
hasSignificantChanges = true;
|
hasSignificantChanges = true;
|
||||||
regressionDetails.push({
|
|
||||||
module_path: benchmark.module_path,
|
// Only an increase in instruction count is a regression; improvements must not fail CI.
|
||||||
id: benchmark.id,
|
if (diffPct > 0) {
|
||||||
diffPct,
|
hasRegressions = true;
|
||||||
absoluteChange,
|
regressionDetails.push({
|
||||||
sectionTitle
|
module_path: benchmark.module_path,
|
||||||
});
|
id: benchmark.id,
|
||||||
|
diffPct,
|
||||||
|
absoluteChange,
|
||||||
|
sectionTitle
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
core.setOutput('has-significant-changes', hasSignificantChanges);
|
core.setOutput('has-significant-changes', hasSignificantChanges);
|
||||||
|
core.setOutput('has-regressions', hasRegressions);
|
||||||
core.setOutput('regression-details', JSON.stringify(regressionDetails));
|
core.setOutput('regression-details', JSON.stringify(regressionDetails));
|
||||||
|
|
||||||
- name: Comment PR
|
- name: Comment PR
|
||||||
if: github.event.pull_request.head.repo.full_name == github.repository
|
if: github.event.pull_request.head.repo.full_name == github.repository
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v8
|
||||||
with:
|
with:
|
||||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||||
script: |
|
script: |
|
||||||
@@ -200,7 +192,7 @@ jobs:
|
|||||||
let commentBody = "";
|
let commentBody = "";
|
||||||
|
|
||||||
function formatNumber(num) {
|
function formatNumber(num) {
|
||||||
return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
return String(num).replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatPercentage(pct) {
|
function formatPercentage(pct) {
|
||||||
@@ -334,8 +326,8 @@ jobs:
|
|||||||
}
|
}
|
||||||
|
|
||||||
- name: Fail on significant regressions
|
- name: Fail on significant regressions
|
||||||
if: steps.analyze.outputs.has-significant-changes == 'true'
|
if: steps.analyze.outputs.has-regressions == 'true'
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v8
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
const regressionDetails = JSON.parse('${{ steps.analyze.outputs.regression-details }}');
|
const regressionDetails = JSON.parse('${{ steps.analyze.outputs.regression-details }}');
|
||||||
|
|||||||
@@ -25,19 +25,26 @@ jobs:
|
|||||||
SCCACHE_DIR: /var/lib/github-actions/.cache
|
SCCACHE_DIR: /var/lib/github-actions/.cache
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 📥 Clone and checkout repository
|
- name: 📥 Clone repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
- name: 🦀 Install the latest Rust
|
- name: 🦀 Install Rust
|
||||||
run: |
|
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||||
echo "Initial system version:"
|
with:
|
||||||
rustc --version
|
toolchain: stable
|
||||||
rustup update stable
|
override: true
|
||||||
echo "Latest updated version:"
|
cache: false
|
||||||
rustc --version
|
rustflags: ""
|
||||||
|
|
||||||
- name: 📦 Run sccache-cache
|
- name: 📦 Run sccache-cache
|
||||||
uses: mozilla-actions/[email protected]
|
uses: mozilla-actions/[email protected]
|
||||||
|
continue-on-error: true
|
||||||
|
|
||||||
|
- name: 🔧 Fallback if sccache fails
|
||||||
|
if: failure()
|
||||||
|
run: |
|
||||||
|
echo "sccache failed, disabling it"
|
||||||
|
echo "RUSTC_WRAPPER=" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: 🔬 Check Rust formatting
|
- name: 🔬 Check Rust formatting
|
||||||
run: |
|
run: |
|
||||||
@@ -56,4 +63,4 @@ jobs:
|
|||||||
|
|
||||||
- name: 📈 Run sccache stat for check
|
- name: 📈 Run sccache stat for check
|
||||||
shell: bash
|
shell: bash
|
||||||
run: sccache --show-stats
|
run: sccache --show-stats || echo "sccache stats unavailable"
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
name: "Nix Housekeeping"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
workflow_dispatch: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
cache-dev-shell:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 📥 Clone repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
with:
|
||||||
|
repository: ${{ inputs.checkout_repo || github.repository }}
|
||||||
|
ref: ${{ inputs.checkout_ref || '' }}
|
||||||
|
|
||||||
|
- name: ❄ Install Nix
|
||||||
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
with:
|
||||||
|
extra-conf: |
|
||||||
|
extra-substituters = https://graphite.cachix.org https://graphite-dev.cachix.org
|
||||||
|
extra-trusted-public-keys = graphite.cachix.org-1:B7Il1yMpkquN/dXM+5GRmz+4Xmu2aaCS1GcWNfFhsOo= graphite-dev.cachix.org-1:RppXYpiV1qO2TYKTkXXGHsAEQDOB5G51b3VlrN9QmbI=
|
||||||
|
|
||||||
|
- name: 🔎 Check whether development shell is already in binary cache
|
||||||
|
id: cache-check
|
||||||
|
run: |
|
||||||
|
out_path="$(nix eval --raw .#devShells.x86_64-linux.default.outPath)"
|
||||||
|
if nix path-info --store https://graphite-dev.cachix.org "$out_path" &>/dev/null; then
|
||||||
|
echo "cached=true" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "Development shell is already cached at $out_path"
|
||||||
|
else
|
||||||
|
echo "cached=false" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "Development shell is not cached"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: 📦 Build Nix development shell
|
||||||
|
if: steps.cache-check.outputs.cached == 'false'
|
||||||
|
run: nix build .#devShells.x86_64-linux.default --no-link --print-out-paths
|
||||||
|
|
||||||
|
- name: 📤 Push Nix development shell to binary cache
|
||||||
|
if: steps.cache-check.outputs.cached == 'false'
|
||||||
|
env:
|
||||||
|
NIX_CACHE_AUTH_TOKEN: ${{ secrets.NIX_CACHE_AUTH_TOKEN_DEV }}
|
||||||
|
run: |
|
||||||
|
nix run nixpkgs#cachix -- authtoken $NIX_CACHE_AUTH_TOKEN
|
||||||
|
nix build .#devShells.x86_64-linux.default --no-link --print-out-paths | nix run nixpkgs#cachix -- push graphite-dev
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
name: "Provide Shaders"
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
workflow_dispatch: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
steps:
|
||||||
|
- name: 📥 Clone repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: ❄ Install Nix
|
||||||
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
with:
|
||||||
|
extra-conf: |
|
||||||
|
extra-substituters = https://graphite.cachix.org https://graphite-dev.cachix.org
|
||||||
|
extra-trusted-public-keys = graphite.cachix.org-1:B7Il1yMpkquN/dXM+5GRmz+4Xmu2aaCS1GcWNfFhsOo= graphite-dev.cachix.org-1:RppXYpiV1qO2TYKTkXXGHsAEQDOB5G51b3VlrN9QmbI=
|
||||||
|
|
||||||
|
- name: 🏗 Build graphene raster nodes shaders
|
||||||
|
run: nix build .#graphite-raster-nodes-shaders && cp result raster_nodes_shaders_entrypoint.wgsl
|
||||||
|
|
||||||
|
- name: 📤 Upload graphene raster nodes shaders to artifacts repository
|
||||||
|
run: |
|
||||||
|
bash .github/workflows/scripts/artifact-upload.bash \
|
||||||
|
${{ vars.ARTIFACTS_REPO_OWNER }} \
|
||||||
|
${{ vars.ARTIFACTS_REPO_NAME }} \
|
||||||
|
${{ vars.ARTIFACTS_REPO_BRANCH }} \
|
||||||
|
rev/${{ github.sha }}/raster_nodes_shaders_entrypoint.wgsl \
|
||||||
|
raster_nodes_shaders_entrypoint.wgsl \
|
||||||
|
"${{ github.sha }} raster_nodes_shaders_entrypoint.wgsl" \
|
||||||
|
${{ secrets.ARTIFACTS_REPO_TOKEN }}
|
||||||
|
|
||||||
|
- name: 📤 Push shaders to dev Nix cache
|
||||||
|
env:
|
||||||
|
NIX_CACHE_AUTH_TOKEN: ${{ secrets.NIX_CACHE_AUTH_TOKEN_DEV }}
|
||||||
|
NIX_CACHE_NAME: graphite-dev
|
||||||
|
run: |
|
||||||
|
nix run nixpkgs#cachix -- authtoken $NIX_CACHE_AUTH_TOKEN
|
||||||
|
nix build .#graphite-raster-nodes-shaders --no-link --print-out-paths | nix run nixpkgs#cachix -- push $NIX_CACHE_NAME
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $0 <owner> <repo> <branch> <target-path> <artifact-file> <commit-message> <github-token>
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
owner : GitHub user or organization of the target repo
|
||||||
|
repo : Target repo name
|
||||||
|
branch : Branch name (e.g. main)
|
||||||
|
target-path : Full path (including folders + filename) in the target repo where to upload
|
||||||
|
artifact-file : Local file path to upload
|
||||||
|
commit-message : Commit message for creating/updating the file
|
||||||
|
github-token : GitHub token (PAT or equivalent) with write access to the target repo
|
||||||
|
|
||||||
|
This will perform a GitHub API PUT to /repos/{owner}/{repo}/contents/{target-path}.
|
||||||
|
If a file already exists at that path, it will auto-detect the SHA and update; otherwise it will create a new one.
|
||||||
|
EOF
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ $# -ne 7 ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
OWNER="$1"
|
||||||
|
REPO="$2"
|
||||||
|
BRANCH="$3"
|
||||||
|
TARGET_PATH="$4"
|
||||||
|
ARTIFACT_PATH="$5"
|
||||||
|
COMMIT_MSG="$6"
|
||||||
|
TOKEN="$7"
|
||||||
|
|
||||||
|
if [ ! -f "$ARTIFACT_PATH" ]; then
|
||||||
|
echo "Error: artifact file not found: $ARTIFACT_PATH" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
LOCAL_SHA=$(git hash-object "$ARTIFACT_PATH")
|
||||||
|
echo "Local blob SHA: $LOCAL_SHA"
|
||||||
|
|
||||||
|
GET_URL="https://api.github.com/repos/${OWNER}/${REPO}/contents/${TARGET_PATH}?ref=${BRANCH}"
|
||||||
|
GET_RESPONSE=$(curl -s -H "Authorization: token ${TOKEN}" "$GET_URL")
|
||||||
|
|
||||||
|
REMOTE_SHA=$(echo "$GET_RESPONSE" | jq -r .sha 2>/dev/null || echo "")
|
||||||
|
|
||||||
|
if [ "$REMOTE_SHA" != "null" ] && [ -n "$REMOTE_SHA" ]; then
|
||||||
|
echo "Remote blob SHA: $REMOTE_SHA"
|
||||||
|
if [ "$LOCAL_SHA" = "$REMOTE_SHA" ]; then
|
||||||
|
echo "The remote file is identical. Skipping upload."
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "Remote file differs. Preparing to upload."
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "No existing remote file or no SHA found. Creating."
|
||||||
|
fi
|
||||||
|
|
||||||
|
CONTENT_TMP_BASE64=$(mktemp)
|
||||||
|
if base64 --help 2>&1 | grep -q -- "-w"; then
|
||||||
|
base64 -w 0 "$ARTIFACT_PATH" > "$CONTENT_TMP_BASE64"
|
||||||
|
else
|
||||||
|
base64 "$ARTIFACT_PATH" | tr -d '\n' > "$CONTENT_TMP_BASE64"
|
||||||
|
fi
|
||||||
|
|
||||||
|
PAYLOAD_TMP=$(mktemp)
|
||||||
|
jq -n \
|
||||||
|
--arg message "$COMMIT_MSG" \
|
||||||
|
--arg branch "$BRANCH" \
|
||||||
|
--arg sha "$REMOTE_SHA" \
|
||||||
|
--rawfile content "$CONTENT_TMP_BASE64" \
|
||||||
|
'{
|
||||||
|
message: $message,
|
||||||
|
content: $content,
|
||||||
|
branch: $branch
|
||||||
|
} + (if ($sha != "" and $sha != "null") then { sha: $sha } else {} end)' \
|
||||||
|
> "$PAYLOAD_TMP"
|
||||||
|
|
||||||
|
UPLOAD_RESPONSE=$(curl -s -X PUT \
|
||||||
|
-H "Authorization: token ${TOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d @"$PAYLOAD_TMP" \
|
||||||
|
"https://api.github.com/repos/${OWNER}/${REPO}/contents/${TARGET_PATH}")
|
||||||
|
|
||||||
|
echo "Upload Response:"
|
||||||
|
echo "$UPLOAD_RESPONSE"
|
||||||
|
|
||||||
|
rm -f "$CONTENT_TMP_BASE64" "$PAYLOAD_TMP"
|
||||||
@@ -1,18 +1,24 @@
|
|||||||
name: "Website"
|
name: "Website"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
workflow_dispatch: {}
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
paths:
|
paths:
|
||||||
- website/**
|
- website/**
|
||||||
|
- frontend/eslint.config.js
|
||||||
|
- frontend/eslint-require-data-selectors.js
|
||||||
|
- frontend/package-lock.json
|
||||||
pull_request:
|
pull_request:
|
||||||
paths:
|
paths:
|
||||||
- website/**
|
- website/**
|
||||||
workflow_dispatch: {}
|
- frontend/eslint.config.js
|
||||||
|
- frontend/eslint-require-data-selectors.js
|
||||||
|
- frontend/package-lock.json
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
INDEX_HTML_HEAD_INCLUSION: <script defer data-domain="graphite.rs" data-api="/visit/event" src="/visit/script.hash.js"></script>
|
INDEX_HTML_HEAD_INCLUSION: <script defer data-domain="graphite.art" data-api="/visit/event" src="/visit/script.hash.js"></script>
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@@ -23,21 +29,22 @@ jobs:
|
|||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: 📥 Clone and checkout repository
|
- name: 📥 Clone repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
# We can remove this step once `ubuntu-latest` has Node.js 22 or newer for its native TypeScript support. See:
|
- name: 🟢 Install Node.js
|
||||||
# https://github.com/actions/runner-images?tab=readme-ov-file#available-images
|
uses: actions/setup-node@v6
|
||||||
# https://nodejs.org/en/learn/typescript/run-natively
|
|
||||||
- name: 📦 Install the latest Node.js
|
|
||||||
uses: actions/setup-node@v4
|
|
||||||
with:
|
with:
|
||||||
node-version: "latest"
|
node-version-file: .nvmrc
|
||||||
|
cache: npm
|
||||||
|
cache-dependency-path: |
|
||||||
|
frontend/package-lock.json
|
||||||
|
website/package-lock.json
|
||||||
|
|
||||||
- name: 🕸 Install Zola
|
- name: 🕸 Install Zola
|
||||||
uses: taiki-e/install-action@v2
|
uses: taiki-e/install-action@v2
|
||||||
with:
|
with:
|
||||||
tool: [email protected]0.0
|
tool: [email protected]2.0
|
||||||
|
|
||||||
- name: 🔍 Check if `website/other` directory changed
|
- name: 🔍 Check if `website/other` directory changed
|
||||||
uses: dorny/paths-filter@v3
|
uses: dorny/paths-filter@v3
|
||||||
@@ -52,50 +59,34 @@ jobs:
|
|||||||
# Remove the INDEX_HTML_HEAD_INCLUSION environment variable for build links (not master deploys)
|
# Remove the INDEX_HTML_HEAD_INCLUSION environment variable for build links (not master deploys)
|
||||||
git rev-parse --abbrev-ref HEAD | grep master > /dev/null || export INDEX_HTML_HEAD_INCLUSION=""
|
git rev-parse --abbrev-ref HEAD | grep master > /dev/null || export INDEX_HTML_HEAD_INCLUSION=""
|
||||||
|
|
||||||
- name: 💿 Obtain cache of auto-generated code docs artifacts
|
- name: 🦀 Produce auto-generated code docs data
|
||||||
id: cache-website-code-docs
|
|
||||||
uses: actions/cache/restore@v3
|
|
||||||
with:
|
|
||||||
path: artifacts
|
|
||||||
key: website-code-docs
|
|
||||||
|
|
||||||
- name: 📁 Fallback in case auto-generated code docs artifacts weren't cached
|
|
||||||
if: steps.cache-website-code-docs.outputs.cache-hit != 'true'
|
|
||||||
run: |
|
run: |
|
||||||
echo "🦀 Initial system version of Rust:"
|
|
||||||
rustc --version
|
|
||||||
rustup update stable
|
rustup update stable
|
||||||
echo "🦀 Latest updated version of Rust:"
|
cargo run -p crate-hierarchy-viz -- website/generated
|
||||||
rustc --version
|
cargo run -p editor-message-tree -- website/generated
|
||||||
cargo test --package graphite-editor --lib -- messages::message::test::generate_message_tree
|
|
||||||
mkdir artifacts
|
|
||||||
mv hierarchical_message_system_tree.txt artifacts/hierarchical_message_system_tree.txt
|
|
||||||
|
|
||||||
- name: 🚚 Move `artifacts` contents to the project root
|
- name: 🔧 Install website and frontend npm dependencies
|
||||||
run: |
|
run: |
|
||||||
mv artifacts/* .
|
# The website is linted by the frontend's ESLint config and the tools it installs
|
||||||
|
cd frontend
|
||||||
|
npm ci
|
||||||
|
cd ../website
|
||||||
|
npm ci
|
||||||
|
|
||||||
- name: 🔧 Build auto-generated code docs artifacts into HTML
|
- name: 📃 Generate node catalog documentation
|
||||||
run: |
|
run: cargo run -p node-docs -- website/content/learn/node-catalog
|
||||||
cd website
|
|
||||||
npm run generate-editor-structure
|
|
||||||
|
|
||||||
- name: 🌐 Build Graphite website with Zola
|
- name: 🌐 Build Graphite website with Zola
|
||||||
env:
|
env:
|
||||||
MODE: prod
|
MODE: prod
|
||||||
run: |
|
run: |
|
||||||
cd website
|
cd website
|
||||||
npm ci
|
npm run check
|
||||||
npm run lint
|
|
||||||
zola --config config.toml build --minify
|
zola --config config.toml build --minify
|
||||||
|
|
||||||
- name: 📤 Publish to Cloudflare Pages
|
- name: 📤 Publish to Cloudflare Pages
|
||||||
id: cloudflare
|
|
||||||
uses: cloudflare/pages-action@1
|
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
with:
|
env:
|
||||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||||
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||||
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
|
run: npx wrangler@3 pages deploy "website/public" --project-name="graphite-website" --commit-dirty=true
|
||||||
projectName: graphite-website
|
|
||||||
directory: website/public
|
|
||||||
+6
-2
@@ -1,5 +1,8 @@
|
|||||||
|
branding/
|
||||||
target/
|
target/
|
||||||
|
third-party-licenses.txt*
|
||||||
result/
|
result/
|
||||||
|
.flatpak-builder/
|
||||||
*.spv
|
*.spv
|
||||||
*.exrc
|
*.exrc
|
||||||
perf.data*
|
perf.data*
|
||||||
@@ -8,5 +11,6 @@ profile.json.gz
|
|||||||
flamegraph.svg
|
flamegraph.svg
|
||||||
.idea/
|
.idea/
|
||||||
.direnv
|
.direnv
|
||||||
hierarchical_message_system_tree.txt
|
.DS_Store
|
||||||
hierarchical_message_system_tree.html
|
.nvim.lua
|
||||||
|
/.devcontainer/devcontainer-lock.json
|
||||||
@@ -1,26 +0,0 @@
|
|||||||
{ pkgs }:
|
|
||||||
|
|
||||||
let
|
|
||||||
libcef = pkgs.libcef.overrideAttrs (_: _: {
|
|
||||||
postInstall = ''
|
|
||||||
strip $out/lib/*
|
|
||||||
'';
|
|
||||||
});
|
|
||||||
cefPath = pkgs.runCommand "cef-path" {} ''
|
|
||||||
mkdir -p $out
|
|
||||||
|
|
||||||
ln -s ${libcef}/include $out/include
|
|
||||||
find ${libcef}/lib -type f -name "*" -exec ln -s {} $out/ \;
|
|
||||||
find ${libcef}/libexec -type f -name "*" -exec ln -s {} $out/ \;
|
|
||||||
cp -r ${libcef}/share/cef/* $out/
|
|
||||||
|
|
||||||
echo '${builtins.toJSON {
|
|
||||||
type = "minimal";
|
|
||||||
name = builtins.baseNameOf libcef.src.url;
|
|
||||||
sha1 = "";
|
|
||||||
}}' > $out/archive.json
|
|
||||||
'';
|
|
||||||
in
|
|
||||||
{
|
|
||||||
CEF_PATH = cefPath;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
inputs:
|
||||||
|
|
||||||
|
let
|
||||||
|
systems = [
|
||||||
|
"x86_64-linux"
|
||||||
|
"aarch64-linux"
|
||||||
|
];
|
||||||
|
forAllSystems = f: inputs.nixpkgs.lib.genAttrs systems (system: f system);
|
||||||
|
args =
|
||||||
|
system:
|
||||||
|
(
|
||||||
|
let
|
||||||
|
lib = inputs.nixpkgs.lib // {
|
||||||
|
call = p: import p args;
|
||||||
|
};
|
||||||
|
|
||||||
|
pkgs = import inputs.nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
overlays = [ (import inputs.rust-overlay) ];
|
||||||
|
};
|
||||||
|
|
||||||
|
info = {
|
||||||
|
pname = "graphite";
|
||||||
|
version = "unstable";
|
||||||
|
src = inputs.nixpkgs.lib.cleanSourceWith {
|
||||||
|
src = ./..;
|
||||||
|
filter = path: type: !(type == "directory" && builtins.baseNameOf path == ".nix");
|
||||||
|
};
|
||||||
|
cargoVendored = deps.crane.lib.vendorCargoDeps { inherit (info) src; };
|
||||||
|
};
|
||||||
|
|
||||||
|
deps = {
|
||||||
|
crane = lib.call ./deps/crane.nix;
|
||||||
|
rustGPU = lib.call ./deps/rust-gpu.nix;
|
||||||
|
};
|
||||||
|
|
||||||
|
args = {
|
||||||
|
inherit system;
|
||||||
|
inherit (inputs) self;
|
||||||
|
inherit inputs;
|
||||||
|
inherit pkgs;
|
||||||
|
inherit lib;
|
||||||
|
inherit info;
|
||||||
|
inherit deps;
|
||||||
|
}
|
||||||
|
// inputs;
|
||||||
|
in
|
||||||
|
args
|
||||||
|
);
|
||||||
|
withArgs = f: forAllSystems (system: f (args system));
|
||||||
|
in
|
||||||
|
{
|
||||||
|
packages = withArgs (
|
||||||
|
{ lib, ... }:
|
||||||
|
rec {
|
||||||
|
default = graphite;
|
||||||
|
graphite = (lib.call ./pkgs/graphite.nix) { };
|
||||||
|
graphite-dev = (lib.call ./pkgs/graphite.nix) { dev = true; };
|
||||||
|
graphite-raster-nodes-shaders = lib.call ./pkgs/graphite-raster-nodes-shaders.nix;
|
||||||
|
graphite-branding = lib.call ./pkgs/graphite-branding.nix;
|
||||||
|
graphite-bundle = (lib.call ./pkgs/graphite-bundle.nix) { };
|
||||||
|
graphite-bundle-dev = (lib.call ./pkgs/graphite-bundle.nix) { graphite = graphite-dev; };
|
||||||
|
graphite-flatpak-manifest = (lib.call ./pkgs/graphite-flatpak-manifest.nix) { };
|
||||||
|
graphite-flatpak-manifest-dev = (lib.call ./pkgs/graphite-flatpak-manifest.nix) {
|
||||||
|
graphite-bundle = graphite-bundle-dev;
|
||||||
|
};
|
||||||
|
graphite-cef = lib.call ./pkgs/graphite-cef.nix;
|
||||||
|
|
||||||
|
# TODO: graphene-cli = lib.call ./pkgs/graphene-cli.nix;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
devShells = withArgs (
|
||||||
|
{ lib, ... }:
|
||||||
|
let
|
||||||
|
shell = lib.makeOverridable (lib.call ./dev.nix);
|
||||||
|
in
|
||||||
|
{
|
||||||
|
default = shell {
|
||||||
|
desktop = true;
|
||||||
|
};
|
||||||
|
full = shell {
|
||||||
|
desktop = true;
|
||||||
|
x11 = true;
|
||||||
|
playwright = true;
|
||||||
|
};
|
||||||
|
minimal = shell { };
|
||||||
|
x11 = shell {
|
||||||
|
desktop = true;
|
||||||
|
x11 = true;
|
||||||
|
};
|
||||||
|
playwright = shell {
|
||||||
|
playwright = true;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
formatter = withArgs ({ pkgs, ... }: pkgs.nixfmt-tree);
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
lib = (inputs.crane.mkLib pkgs) // {
|
||||||
|
vendorCargoDepsFlatten =
|
||||||
|
src:
|
||||||
|
pkgs.stdenvNoCC.mkDerivation (finalAttrs: {
|
||||||
|
name = "graphite-cargo-vendored";
|
||||||
|
inherit src;
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
cp -rL --no-preserve=mode "$src" "$out"
|
||||||
|
chmod -R u+w "$out"
|
||||||
|
find "$out" -type f -print0 | xargs -r -0 sed -i "s|$src|$out|g"
|
||||||
|
'';
|
||||||
|
|
||||||
|
disallowedReferences = [ finalAttrs.src ];
|
||||||
|
|
||||||
|
dontUnpack = true;
|
||||||
|
dontConfigure = true;
|
||||||
|
dontBuild = true;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
toolchain = pkgs.rust-bin.nightly."2026-07-03".default.override {
|
||||||
|
extensions = [
|
||||||
|
"rust-src"
|
||||||
|
"rust-analyzer"
|
||||||
|
"clippy"
|
||||||
|
"cargo"
|
||||||
|
"rustc-dev"
|
||||||
|
"llvm-tools"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
cargo = pkgs.writeShellScriptBin "cargo" ''
|
||||||
|
#!${pkgs.lib.getExe pkgs.bash}
|
||||||
|
|
||||||
|
filtered_args=()
|
||||||
|
for arg in "$@"; do
|
||||||
|
case "$arg" in
|
||||||
|
+nightly|+nightly-*) ;;
|
||||||
|
*) filtered_args+=("$arg") ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
exec ${toolchain}/bin/cargo ${"\${filtered_args[@]}"}
|
||||||
|
'';
|
||||||
|
rustc_codegen_spirv =
|
||||||
|
(pkgs.makeRustPlatform {
|
||||||
|
cargo = toolchain;
|
||||||
|
rustc = toolchain;
|
||||||
|
}).buildRustPackage
|
||||||
|
(finalAttrs: {
|
||||||
|
pname = "rustc_codegen_spirv";
|
||||||
|
version = "0.10.0";
|
||||||
|
src = pkgs.fetchCrate {
|
||||||
|
inherit (finalAttrs) pname version;
|
||||||
|
sha256 = "sha256-QluNI2TdJI0j2CBOeAbB9DfOv+8LqzWk7siZyT1WWLU=";
|
||||||
|
};
|
||||||
|
cargoHash = "sha256-vvviUccnip+j60Ml1vqLNJ49KyEF40VLUoV1TMALHMs=";
|
||||||
|
cargoBuildFlags = [
|
||||||
|
"-p"
|
||||||
|
"rustc_codegen_spirv"
|
||||||
|
"--features=use-compiled-tools"
|
||||||
|
"--no-default-features"
|
||||||
|
];
|
||||||
|
doCheck = false;
|
||||||
|
});
|
||||||
|
in
|
||||||
|
{
|
||||||
|
toolchain = toolchain;
|
||||||
|
env = {
|
||||||
|
RUST_GPU_PATH_OVERRIDE = "${cargo}/bin:${toolchain}/bin";
|
||||||
|
RUSTC_CODEGEN_SPIRV_PATH = "${rustc_codegen_spirv}/lib/librustc_codegen_spirv.so";
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
deps,
|
||||||
|
self,
|
||||||
|
system,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
desktop ? false,
|
||||||
|
x11 ? false,
|
||||||
|
playwright ? false,
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
features = [
|
||||||
|
{
|
||||||
|
packages = [
|
||||||
|
pkgs.pkg-config
|
||||||
|
|
||||||
|
pkgs.lld
|
||||||
|
pkgs.nodejs
|
||||||
|
pkgs.binaryen
|
||||||
|
pkgs.wasm-bindgen-cli_0_2_121
|
||||||
|
pkgs.cargo-about
|
||||||
|
|
||||||
|
pkgs.rustc
|
||||||
|
pkgs.cargo
|
||||||
|
pkgs.rust-analyzer
|
||||||
|
pkgs.clippy
|
||||||
|
pkgs.rustfmt
|
||||||
|
|
||||||
|
pkgs.git
|
||||||
|
|
||||||
|
pkgs.cargo-nextest
|
||||||
|
pkgs.cargo-expand
|
||||||
|
|
||||||
|
# Linker
|
||||||
|
pkgs.mold
|
||||||
|
|
||||||
|
# Profiling tools
|
||||||
|
pkgs.gnuplot
|
||||||
|
pkgs.samply
|
||||||
|
pkgs.cargo-flamegraph
|
||||||
|
|
||||||
|
# Plotting tools
|
||||||
|
pkgs.graphviz
|
||||||
|
];
|
||||||
|
}
|
||||||
|
deps.rustGPU
|
||||||
|
(lib.optionalAttrs desktop (
|
||||||
|
{
|
||||||
|
libs = [
|
||||||
|
pkgs.wayland
|
||||||
|
pkgs.vulkan-loader
|
||||||
|
pkgs.libGL
|
||||||
|
pkgs.libxkbcommon
|
||||||
|
self.packages.${system}.graphite-cef
|
||||||
|
];
|
||||||
|
env = {
|
||||||
|
CEF_PATH = "${self.packages.${system}.graphite-cef}/lib";
|
||||||
|
XDG_DATA_DIRS = "${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}:$XDG_DATA_DIRS";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
))
|
||||||
|
(lib.optionalAttrs x11 {
|
||||||
|
libs = [
|
||||||
|
pkgs.libXcursor
|
||||||
|
pkgs.libxcb
|
||||||
|
pkgs.libX11
|
||||||
|
];
|
||||||
|
})
|
||||||
|
(lib.optionalAttrs playwright (
|
||||||
|
assert pkgs.playwright-driver.version == (lib.importJSON ../tools/web-editor-driver/playwright/package-lock.json).packages."node_modules/playwright-core".version;
|
||||||
|
{
|
||||||
|
env = {
|
||||||
|
PLAYWRIGHT_BROWSERS_PATH = pkgs.playwright-driver.browsers-chromium;
|
||||||
|
PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS = "true";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
))
|
||||||
|
];
|
||||||
|
|
||||||
|
libs = lib.concatMap (feature: feature.libs or [ ]) features;
|
||||||
|
in
|
||||||
|
pkgs.mkShell {
|
||||||
|
packages = libs ++ lib.concatMap (feature: feature.packages or [ ]) features;
|
||||||
|
env = lib.mergeAttrsList (map (feature: feature.env or { }) features) // {
|
||||||
|
LD_LIBRARY_PATH = lib.makeLibraryPath libs;
|
||||||
|
};
|
||||||
|
}
|
||||||
Generated
-97
@@ -1,97 +0,0 @@
|
|||||||
{
|
|
||||||
"nodes": {
|
|
||||||
"flake-compat": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1733328505,
|
|
||||||
"narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=",
|
|
||||||
"rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec",
|
|
||||||
"revCount": 69,
|
|
||||||
"type": "tarball",
|
|
||||||
"url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.1.0/01948eb7-9cba-704f-bbf3-3fa956735b52/source.tar.gz"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"type": "tarball",
|
|
||||||
"url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"flake-utils": {
|
|
||||||
"inputs": {
|
|
||||||
"systems": "systems"
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1731533236,
|
|
||||||
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "numtide",
|
|
||||||
"repo": "flake-utils",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"nixpkgs": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1762363567,
|
|
||||||
"narHash": "sha256-YRqMDEtSMbitIMj+JLpheSz0pwEr0Rmy5mC7myl17xs=",
|
|
||||||
"owner": "nixos",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"rev": "ae814fd3904b621d8ab97418f1d0f2eb0d3716f4",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nixos",
|
|
||||||
"ref": "nixos-unstable",
|
|
||||||
"repo": "nixpkgs",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": {
|
|
||||||
"inputs": {
|
|
||||||
"flake-compat": "flake-compat",
|
|
||||||
"flake-utils": "flake-utils",
|
|
||||||
"nixpkgs": "nixpkgs",
|
|
||||||
"rust-overlay": "rust-overlay"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"rust-overlay": {
|
|
||||||
"inputs": {
|
|
||||||
"nixpkgs": [
|
|
||||||
"nixpkgs"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1762569282,
|
|
||||||
"narHash": "sha256-vINZAJpXQTZd5cfh06Rcw7hesH7sGSvi+Tn+HUieJn8=",
|
|
||||||
"owner": "oxalica",
|
|
||||||
"repo": "rust-overlay",
|
|
||||||
"rev": "a35a6144b976f70827c2fe2f5c89d16d8f9179d8",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "oxalica",
|
|
||||||
"repo": "rust-overlay",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"systems": {
|
|
||||||
"locked": {
|
|
||||||
"lastModified": 1681028828,
|
|
||||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
|
||||||
"type": "github"
|
|
||||||
},
|
|
||||||
"original": {
|
|
||||||
"owner": "nix-systems",
|
|
||||||
"repo": "default",
|
|
||||||
"type": "github"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"root": "root",
|
|
||||||
"version": 7
|
|
||||||
}
|
|
||||||
-159
@@ -1,159 +0,0 @@
|
|||||||
# This is a helper file for people using NixOS as their operating system.
|
|
||||||
# If you don't know what this file does, you can safely ignore it.
|
|
||||||
# This file defines the reproducible development environment for the project.
|
|
||||||
#
|
|
||||||
# Development Environment:
|
|
||||||
# - Provides all necessary tools for Rust/Wasm development
|
|
||||||
# - Includes dependencies for desktop app development
|
|
||||||
# - Sets up profiling and debugging tools
|
|
||||||
# - Configures mold as the default linker for faster builds
|
|
||||||
#
|
|
||||||
# Usage:
|
|
||||||
# - Development shell: `nix develop .nix` from the project root
|
|
||||||
# - Run in dev shell with direnv: add `use flake` to .envrc
|
|
||||||
{
|
|
||||||
inputs = {
|
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
||||||
rust-overlay = {
|
|
||||||
url = "github:oxalica/rust-overlay";
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
|
||||||
};
|
|
||||||
flake-utils.url = "github:numtide/flake-utils";
|
|
||||||
|
|
||||||
# This is used to provide a identical development shell at `shell.nix` for users that do not use flakes
|
|
||||||
flake-compat.url = "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz";
|
|
||||||
};
|
|
||||||
|
|
||||||
outputs = { nixpkgs, rust-overlay, flake-utils, ... }:
|
|
||||||
flake-utils.lib.eachDefaultSystem (system:
|
|
||||||
let
|
|
||||||
overlays = [ (import rust-overlay) ];
|
|
||||||
pkgs = import nixpkgs { inherit system overlays; };
|
|
||||||
|
|
||||||
rustExtensions = [ "rust-src" "rust-analyzer" "clippy" "cargo" ];
|
|
||||||
rust = pkgs.rust-bin.stable.latest.default.override {
|
|
||||||
targets = [ "wasm32-unknown-unknown" ];
|
|
||||||
extensions = rustExtensions;
|
|
||||||
};
|
|
||||||
|
|
||||||
# Shared build inputs; libraries that need to be in LD_LIBRARY_PATH
|
|
||||||
buildInputs = [
|
|
||||||
pkgs.wayland
|
|
||||||
pkgs.openssl
|
|
||||||
pkgs.vulkan-loader
|
|
||||||
pkgs.libraw
|
|
||||||
pkgs.libGL
|
|
||||||
|
|
||||||
# X11 libraries, not needed on wayland! Remove when x11 is finally dead
|
|
||||||
pkgs.libxkbcommon
|
|
||||||
pkgs.xorg.libXcursor
|
|
||||||
pkgs.xorg.libxcb
|
|
||||||
pkgs.xorg.libX11
|
|
||||||
];
|
|
||||||
|
|
||||||
# Packages needed to build the package
|
|
||||||
buildTools = [
|
|
||||||
rust
|
|
||||||
pkgs.nodejs
|
|
||||||
pkgs.nodePackages.npm
|
|
||||||
pkgs.binaryen
|
|
||||||
pkgs.wasm-bindgen-cli_0_2_100
|
|
||||||
pkgs.wasm-pack
|
|
||||||
pkgs.pkg-config
|
|
||||||
pkgs.cargo-about
|
|
||||||
];
|
|
||||||
|
|
||||||
# Development tools; not needed to build the package
|
|
||||||
devTools = [
|
|
||||||
pkgs.git
|
|
||||||
|
|
||||||
pkgs.cargo-watch
|
|
||||||
pkgs.cargo-nextest
|
|
||||||
pkgs.cargo-expand
|
|
||||||
|
|
||||||
# Linker
|
|
||||||
pkgs.mold
|
|
||||||
|
|
||||||
# Profiling tools
|
|
||||||
pkgs.gnuplot
|
|
||||||
pkgs.samply
|
|
||||||
pkgs.cargo-flamegraph
|
|
||||||
];
|
|
||||||
|
|
||||||
cefEnv = import ./cef.nix { inherit pkgs; };
|
|
||||||
rustGPUEnv = import ./rust-gpu.nix { inherit pkgs; };
|
|
||||||
|
|
||||||
libPath = "${pkgs.lib.makeLibraryPath buildInputs}:${cefEnv.CEF_PATH}";
|
|
||||||
in {
|
|
||||||
devShells.default = pkgs.mkShell ({
|
|
||||||
packages = buildInputs ++ buildTools ++ devTools;
|
|
||||||
|
|
||||||
LD_LIBRARY_PATH = libPath;
|
|
||||||
XDG_DATA_DIRS =
|
|
||||||
"${pkgs.gsettings-desktop-schemas}/share/gsettings-schemas/${pkgs.gsettings-desktop-schemas.name}:${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}:$XDG_DATA_DIRS";
|
|
||||||
|
|
||||||
shellHook = ''
|
|
||||||
alias cargo='mold --run cargo'
|
|
||||||
'';
|
|
||||||
} // cefEnv // rustGPUEnv);
|
|
||||||
|
|
||||||
packages.default = pkgs.rustPlatform.buildRustPackage (finalAttrs: {
|
|
||||||
pname = "graphite-editor";
|
|
||||||
version = "unstable";
|
|
||||||
src = pkgs.lib.cleanSource ./..;
|
|
||||||
|
|
||||||
cargoLock = {
|
|
||||||
lockFile = ../Cargo.lock;
|
|
||||||
allowBuiltinFetchGit = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
# TODO: Remove the need for this hash by using individual package resolutions and hashes from package-lock.json
|
|
||||||
npmDeps = pkgs.fetchNpmDeps {
|
|
||||||
inherit (finalAttrs) pname version;
|
|
||||||
src = "${finalAttrs.src}/frontend";
|
|
||||||
hash = "sha256-UWuJpKNYj2Xn34rpMDZ75pzMYUOLQjPeGuJ/QlPbX9A=";
|
|
||||||
};
|
|
||||||
|
|
||||||
npmRoot = "frontend";
|
|
||||||
npmConfigScript = "setup";
|
|
||||||
makeCacheWritable = true;
|
|
||||||
|
|
||||||
buildInputs = buildInputs;
|
|
||||||
nativeBuildInputs = buildTools ++ [
|
|
||||||
pkgs.rustPlatform.cargoSetupHook
|
|
||||||
pkgs.npmHooks.npmConfigHook
|
|
||||||
pkgs.makeWrapper
|
|
||||||
];
|
|
||||||
|
|
||||||
env = cefEnv // rustGPUEnv;
|
|
||||||
|
|
||||||
buildPhase = ''
|
|
||||||
export HOME="$TMPDIR"
|
|
||||||
|
|
||||||
pushd frontend
|
|
||||||
npm run build-native
|
|
||||||
popd
|
|
||||||
cargo build -r -p graphite-desktop
|
|
||||||
'';
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
mkdir -p $out/bin
|
|
||||||
cp target/release/graphite-desktop $out/bin/graphite-editor
|
|
||||||
|
|
||||||
mkdir -p $out/share/applications
|
|
||||||
cp $src/desktop/assets/*.desktop $out/share/applications/
|
|
||||||
|
|
||||||
mkdir -p $out/share/icons/hicolor/scalable/apps
|
|
||||||
cp $src/desktop/assets/graphite-icon-color.svg $out/share/icons/hicolor/scalable/apps/
|
|
||||||
'';
|
|
||||||
|
|
||||||
doCheck = false;
|
|
||||||
|
|
||||||
postFixup = ''
|
|
||||||
wrapProgram "$out/bin/graphite-editor" \
|
|
||||||
--prefix LD_LIBRARY_PATH : "${libPath}" \
|
|
||||||
--set CEF_PATH "${cefEnv.CEF_PATH}"
|
|
||||||
'';
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
{ info, pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
brandingTar = pkgs.fetchurl (
|
||||||
|
let
|
||||||
|
lockContent = builtins.readFile "${info.src}/.branding";
|
||||||
|
lines = builtins.filter (s: s != [ ]) (builtins.split "\n" lockContent);
|
||||||
|
url = builtins.elemAt lines 0;
|
||||||
|
hash = builtins.elemAt lines 1;
|
||||||
|
in
|
||||||
|
{
|
||||||
|
url = url;
|
||||||
|
sha256 = hash;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
in
|
||||||
|
pkgs.runCommand "${info.pname}-branding" { } ''
|
||||||
|
mkdir -p $out
|
||||||
|
tar -xvf ${brandingTar} -C $out --strip-components 1
|
||||||
|
''
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
deps,
|
||||||
|
self,
|
||||||
|
system,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
graphite ? self.packages.${system}.graphite,
|
||||||
|
}:
|
||||||
|
let
|
||||||
|
bundle =
|
||||||
|
{
|
||||||
|
archive ? false,
|
||||||
|
compression ? null,
|
||||||
|
passthru ? { },
|
||||||
|
}:
|
||||||
|
(
|
||||||
|
let
|
||||||
|
tar = if compression == null then archive else true;
|
||||||
|
nameArchiveSuffix = if tar then ".tar" else "";
|
||||||
|
nameCompressionSuffix = if compression == null then "" else "." + compression;
|
||||||
|
name = "graphite-bundle${nameArchiveSuffix}${nameCompressionSuffix}";
|
||||||
|
build = ''
|
||||||
|
mkdir -p out
|
||||||
|
mkdir -p out/bin
|
||||||
|
cp ${graphite}/bin/graphite out/bin/graphite
|
||||||
|
chmod -v +w out/bin/graphite
|
||||||
|
patchelf \
|
||||||
|
--set-rpath '$ORIGIN/../lib:$ORIGIN/../lib/cef' \
|
||||||
|
--set-interpreter '/lib64/ld-linux-x86-64.so.2' \
|
||||||
|
--remove-needed libGL.so \
|
||||||
|
out/bin/graphite
|
||||||
|
cp -r ${graphite}/share out/share
|
||||||
|
mkdir -p out/lib/cef
|
||||||
|
mkdir -p ./cef
|
||||||
|
tar -xvf ${self.packages.${system}.graphite-cef.src} -C ./cef --strip-components=1
|
||||||
|
cp -r ./cef/Release/* out/lib/cef/
|
||||||
|
cp -r ./cef/Resources/* out/lib/cef/
|
||||||
|
find "out/lib/cef/locales" -type f ! -name 'en-US*' -delete
|
||||||
|
${pkgs.bintools}/bin/strip out/lib/cef/*.so*
|
||||||
|
'';
|
||||||
|
install =
|
||||||
|
if tar then
|
||||||
|
''
|
||||||
|
cd out
|
||||||
|
tar -c \
|
||||||
|
--sort=name \
|
||||||
|
--mtime='@1' --clamp-mtime \
|
||||||
|
--owner=0 --group=0 --numeric-owner \
|
||||||
|
--mode='u=rwX,go=rX' \
|
||||||
|
--format=posix \
|
||||||
|
--pax-option=delete=atime,delete=ctime \
|
||||||
|
--no-acls --no-xattrs --no-selinux \
|
||||||
|
* ${
|
||||||
|
if compression == "xz" then
|
||||||
|
"| xz "
|
||||||
|
else if compression == "gz" then
|
||||||
|
"| gzip -n "
|
||||||
|
else
|
||||||
|
""
|
||||||
|
}> $out
|
||||||
|
''
|
||||||
|
else
|
||||||
|
''
|
||||||
|
mkdir -p $out
|
||||||
|
cp -r out/* $out/
|
||||||
|
'';
|
||||||
|
in
|
||||||
|
|
||||||
|
pkgs.runCommand name
|
||||||
|
{
|
||||||
|
inherit passthru;
|
||||||
|
}
|
||||||
|
''
|
||||||
|
${build}
|
||||||
|
${install}
|
||||||
|
''
|
||||||
|
);
|
||||||
|
in
|
||||||
|
bundle {
|
||||||
|
passthru = {
|
||||||
|
tar = bundle {
|
||||||
|
archive = true;
|
||||||
|
passthru = {
|
||||||
|
gz = bundle {
|
||||||
|
compression = "gz";
|
||||||
|
};
|
||||||
|
xz = bundle {
|
||||||
|
compression = "xz";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
{ pkgs, ... }:
|
||||||
|
|
||||||
|
let
|
||||||
|
version = "151.3.24+g2384915+chromium-151.0.7922.174";
|
||||||
|
hashes = {
|
||||||
|
aarch64-linux = "sha256-R5ZbnDallYvdbW/bP+M2DzjRfWWRTvY2q63hSIHNxZs=";
|
||||||
|
x86_64-linux = "sha256-21PEP9rOi37krw8AUSARbWlzqp2Ot3AsBhe635voaE4=";
|
||||||
|
};
|
||||||
|
|
||||||
|
selectSystem =
|
||||||
|
attrs:
|
||||||
|
attrs.${pkgs.stdenv.hostPlatform.system}
|
||||||
|
or (throw "Unsupported system ${pkgs.stdenv.hostPlatform.system}");
|
||||||
|
|
||||||
|
url = "https://cef-builds.spotifycdn.com/cef_binary_${version}_${
|
||||||
|
selectSystem {
|
||||||
|
aarch64-linux = "linuxarm64";
|
||||||
|
x86_64-linux = "linux64";
|
||||||
|
}
|
||||||
|
}_minimal.tar.bz2";
|
||||||
|
|
||||||
|
src = pkgs.fetchurl {
|
||||||
|
inherit url;
|
||||||
|
hash = selectSystem hashes;
|
||||||
|
};
|
||||||
|
in
|
||||||
|
pkgs.cef-binary.overrideAttrs {
|
||||||
|
version = builtins.head (builtins.split "\\+" version);
|
||||||
|
inherit src;
|
||||||
|
postInstall = ''
|
||||||
|
rm -r $out/* $out/.* || true
|
||||||
|
strip ./Release/*.so*
|
||||||
|
mkdir $out/lib
|
||||||
|
mv ./Release/* $out/lib/
|
||||||
|
find "./Resources/locales" -maxdepth 1 -type f ! -name 'en-US.pak' -delete
|
||||||
|
mv ./Resources/* $out/lib/
|
||||||
|
mv ./include $out/lib/
|
||||||
|
|
||||||
|
cat ./CREDITS.html | ${pkgs.xz}/bin/xz -9 -e -c > $out/lib/CREDITS.html.xz
|
||||||
|
|
||||||
|
echo '${
|
||||||
|
builtins.toJSON {
|
||||||
|
type = "minimal";
|
||||||
|
name = builtins.baseNameOf url;
|
||||||
|
sha1 = "";
|
||||||
|
}
|
||||||
|
}' > $out/lib/archive.json
|
||||||
|
'';
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
self,
|
||||||
|
system,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
graphite-bundle ? self.packages.${system}.graphite-bundle,
|
||||||
|
}:
|
||||||
|
|
||||||
|
(pkgs.formats.json { }).generate "art.graphite.Graphite.json" {
|
||||||
|
app-id = "art.graphite.Graphite";
|
||||||
|
runtime = "org.freedesktop.Platform";
|
||||||
|
runtime-version = "25.08";
|
||||||
|
sdk = "org.freedesktop.Sdk";
|
||||||
|
command = "graphite";
|
||||||
|
finish-args = [
|
||||||
|
"--device=dri"
|
||||||
|
"--share=ipc"
|
||||||
|
"--socket=wayland"
|
||||||
|
"--socket=fallback-x11"
|
||||||
|
"--share=network"
|
||||||
|
];
|
||||||
|
modules = [
|
||||||
|
{
|
||||||
|
name = "app";
|
||||||
|
buildsystem = "simple";
|
||||||
|
build-commands = [
|
||||||
|
"mkdir -p /app"
|
||||||
|
"cp -r ./* /app/"
|
||||||
|
"chmod +x /app/bin/*"
|
||||||
|
];
|
||||||
|
sources = [
|
||||||
|
{
|
||||||
|
type = "archive";
|
||||||
|
path = graphite-bundle.tar;
|
||||||
|
strip-components = 0;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
info,
|
||||||
|
deps,
|
||||||
|
self,
|
||||||
|
system,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
(deps.crane.lib.overrideToolchain (_: deps.rustGPU.toolchain)).buildPackage {
|
||||||
|
pname = "graphite-raster-nodes-shaders";
|
||||||
|
inherit (info) version src;
|
||||||
|
|
||||||
|
inherit (self.packages.${system}.graphite) cargoVendorDir cargoArtifacts;
|
||||||
|
|
||||||
|
strictDeps = true;
|
||||||
|
|
||||||
|
env = deps.rustGPU.env;
|
||||||
|
|
||||||
|
buildPhase = ''
|
||||||
|
cargo build -r -p raster-nodes-shaders
|
||||||
|
'';
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
cp target/spirv-builder/spirv-unknown-naga-wgsl/release/deps/raster_nodes_shaders_entrypoint.wgsl $out
|
||||||
|
'';
|
||||||
|
|
||||||
|
doCheck = false;
|
||||||
|
}
|
||||||
@@ -0,0 +1,160 @@
|
|||||||
|
{
|
||||||
|
info,
|
||||||
|
pkgs,
|
||||||
|
self,
|
||||||
|
deps,
|
||||||
|
system,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
dev ? false,
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
branding = self.packages.${system}.graphite-branding;
|
||||||
|
libs = [
|
||||||
|
pkgs.wayland
|
||||||
|
pkgs.vulkan-loader
|
||||||
|
pkgs.libGL
|
||||||
|
pkgs.openssl
|
||||||
|
pkgs.libraw
|
||||||
|
self.packages.${system}.graphite-cef
|
||||||
|
# X11 Support
|
||||||
|
pkgs.libxkbcommon
|
||||||
|
pkgs.libXcursor
|
||||||
|
pkgs.libxcb
|
||||||
|
pkgs.libX11
|
||||||
|
];
|
||||||
|
|
||||||
|
common = {
|
||||||
|
inherit (info) pname version src;
|
||||||
|
cargoVendorDir = deps.crane.lib.vendorCargoDepsFlatten (
|
||||||
|
deps.crane.lib.vendorMultipleCargoDeps {
|
||||||
|
inherit (deps.crane.lib.findCargoFiles (deps.crane.lib.cleanCargoSource info.src)) cargoConfigs;
|
||||||
|
cargoLockList = [
|
||||||
|
"${info.src}/Cargo.lock"
|
||||||
|
"${deps.rustGPU.toolchain.availableComponents.rust-src}/lib/rustlib/src/rust/library/Cargo.lock"
|
||||||
|
];
|
||||||
|
}
|
||||||
|
);
|
||||||
|
buildInputs = libs;
|
||||||
|
strictDeps = true;
|
||||||
|
doCheck = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
cargoArtifacts = deps.crane.lib.buildDepsOnly (
|
||||||
|
common
|
||||||
|
// {
|
||||||
|
nativeBuildInputs = [
|
||||||
|
pkgs.pkg-config
|
||||||
|
pkgs.lld
|
||||||
|
];
|
||||||
|
env.CEF_PATH = "${self.packages.${system}.graphite-cef}/lib";
|
||||||
|
buildPhase =
|
||||||
|
let
|
||||||
|
profile = if dev then "dev" else "release";
|
||||||
|
in
|
||||||
|
''
|
||||||
|
cargo check --profile ${profile} --locked -p graphite-desktop-platform-linux
|
||||||
|
cargo build --profile ${profile} --locked -p graphite-desktop-platform-linux
|
||||||
|
|
||||||
|
cargo check --profile ${profile} --target wasm32-unknown-unknown --locked -p graphite-wasm-wrapper --no-default-features --features native
|
||||||
|
cargo build --profile ${profile} --target wasm32-unknown-unknown --locked -p graphite-wasm-wrapper --no-default-features --features native
|
||||||
|
|
||||||
|
cargo check --locked -p third-party-licenses --features desktop
|
||||||
|
cargo build --locked -p third-party-licenses --features desktop
|
||||||
|
|
||||||
|
cargo check --profile ${profile} --locked -p graphite-desktop-bundle
|
||||||
|
cargo build --profile ${profile} --locked -p graphite-desktop-bundle
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
);
|
||||||
|
in
|
||||||
|
|
||||||
|
deps.crane.lib.buildPackage (
|
||||||
|
common
|
||||||
|
// {
|
||||||
|
inherit cargoArtifacts;
|
||||||
|
|
||||||
|
buildInputs = libs;
|
||||||
|
nativeBuildInputs = [
|
||||||
|
pkgs.pkg-config
|
||||||
|
pkgs.lld
|
||||||
|
pkgs.nodejs
|
||||||
|
pkgs.binaryen
|
||||||
|
pkgs.wasm-bindgen-cli_0_2_121
|
||||||
|
pkgs.cargo-about
|
||||||
|
pkgs.removeReferencesTo
|
||||||
|
pkgs.importNpmLock.npmConfigHook
|
||||||
|
];
|
||||||
|
|
||||||
|
npmDeps = pkgs.importNpmLock {
|
||||||
|
npmRoot = "${info.src}/frontend";
|
||||||
|
};
|
||||||
|
npmRoot = "frontend";
|
||||||
|
makeCacheWritable = true;
|
||||||
|
|
||||||
|
env = {
|
||||||
|
RASTER_NODES_SHADER_PATH = self.packages.${system}.graphite-raster-nodes-shaders;
|
||||||
|
GRAPHITE_GIT_COMMIT_HASH = self.rev or "unknown";
|
||||||
|
GRAPHITE_GIT_COMMIT_DATE = self.lastModified or "unknown";
|
||||||
|
CEF_PATH = "${self.packages.${system}.graphite-cef}/lib";
|
||||||
|
};
|
||||||
|
|
||||||
|
postPatch = ''
|
||||||
|
mkdir branding
|
||||||
|
cp -r ${branding}/* branding
|
||||||
|
cp ${info.src}/.branding branding/.branding
|
||||||
|
'';
|
||||||
|
|
||||||
|
preBuild = ''
|
||||||
|
# Prevent `cargo-run`'s frontend setup from trying to update npm dependencies
|
||||||
|
touch -r frontend/package-lock.json -d '+1 year' frontend/node_modules/.install-timestamp
|
||||||
|
|
||||||
|
export HOME="$TMPDIR"
|
||||||
|
''
|
||||||
|
+ (
|
||||||
|
if self ? rev then
|
||||||
|
''
|
||||||
|
export GRAPHITE_GIT_COMMIT_DATE="$(date -u -d "@$GRAPHITE_GIT_COMMIT_DATE" +"%Y-%m-%dT%H:%M:%SZ")"
|
||||||
|
''
|
||||||
|
else
|
||||||
|
""
|
||||||
|
);
|
||||||
|
|
||||||
|
buildPhaseCargoCommand = "cargo run build desktop${if dev then " debug" else ""}";
|
||||||
|
|
||||||
|
doNotPostBuildInstallCargoBinaries = true;
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
mkdir -p $out/bin
|
||||||
|
cp target/${if dev then "debug" else "release"}/graphite $out/bin/graphite
|
||||||
|
|
||||||
|
mkdir -p $out/share/applications
|
||||||
|
cp $src/desktop/assets/*.desktop $out/share/applications/
|
||||||
|
|
||||||
|
mkdir -p $out/share/icons/hicolor/scalable/apps
|
||||||
|
cp ${branding}/app-icons/graphite.svg $out/share/icons/hicolor/scalable/apps/art.graphite.Graphite.svg
|
||||||
|
mkdir -p $out/share/icons/hicolor/512x512/apps
|
||||||
|
cp ${branding}/app-icons/graphite-512.png $out/share/icons/hicolor/512x512/apps/art.graphite.Graphite.png
|
||||||
|
mkdir -p $out/share/icons/hicolor/256x256/apps
|
||||||
|
cp ${branding}/app-icons/graphite-256.png $out/share/icons/hicolor/256x256/apps/art.graphite.Graphite.png
|
||||||
|
mkdir -p $out/share/icons/hicolor/128x128/apps
|
||||||
|
cp ${branding}/app-icons/graphite-128.png $out/share/icons/hicolor/128x128/apps/art.graphite.Graphite.png
|
||||||
|
'';
|
||||||
|
|
||||||
|
postFixup = ''
|
||||||
|
remove-references-to -t "${common.cargoVendorDir}" $out/bin/graphite
|
||||||
|
|
||||||
|
patchelf \
|
||||||
|
--set-rpath "${pkgs.lib.makeLibraryPath libs}" \
|
||||||
|
--add-needed libGL.so \
|
||||||
|
--add-needed libEGL.so \
|
||||||
|
$out/bin/graphite
|
||||||
|
'';
|
||||||
|
|
||||||
|
passthru.deps = cargoArtifacts;
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
{ pkgs }:
|
|
||||||
|
|
||||||
let
|
|
||||||
toolchainPkg = pkgs.rust-bin.nightly."2025-06-23".default.override {
|
|
||||||
extensions =
|
|
||||||
[ "rust-src" "rust-analyzer" "clippy" "cargo" "rustc-dev" "llvm-tools" ];
|
|
||||||
};
|
|
||||||
toolchainRustPlatform = pkgs.makeRustPlatform {
|
|
||||||
cargo = toolchainPkg;
|
|
||||||
rustc = toolchainPkg;
|
|
||||||
};
|
|
||||||
rustc_codegen_spirv = toolchainRustPlatform.buildRustPackage (finalAttrs: {
|
|
||||||
pname = "rustc_codegen_spirv";
|
|
||||||
version = "0-unstable-2025-08-04";
|
|
||||||
src = pkgs.fetchFromGitHub {
|
|
||||||
owner = "Firestar99";
|
|
||||||
repo = "rust-gpu-new";
|
|
||||||
rev = "c12f216121820580731440ee79ebc7403d6ea04f";
|
|
||||||
hash = "sha256-rG1cZvOV0vYb1dETOzzbJ0asYdE039UZImobXZfKIno=";
|
|
||||||
};
|
|
||||||
cargoHash = "sha256-AEigcEc5wiBd3zLqWN/2HSbkfOVFneAqNvg9HsouZf4=";
|
|
||||||
cargoBuildFlags = [
|
|
||||||
"-p"
|
|
||||||
"rustc_codegen_spirv"
|
|
||||||
"--features=use-compiled-tools"
|
|
||||||
"--no-default-features"
|
|
||||||
];
|
|
||||||
doCheck = false;
|
|
||||||
});
|
|
||||||
cargoWrapper = pkgs.writeShellScriptBin "cargo" ''
|
|
||||||
#!${pkgs.lib.getExe pkgs.bash}
|
|
||||||
|
|
||||||
filtered_args=()
|
|
||||||
for arg in "$@"; do
|
|
||||||
case "$arg" in
|
|
||||||
+nightly|+nightly-*) ;;
|
|
||||||
*) filtered_args+=("$arg") ;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
exec ${toolchainPkg}/bin/cargo ${"\${filtered_args[@]}"}
|
|
||||||
'';
|
|
||||||
in {
|
|
||||||
RUST_GPU_PATH_OVERRIDE = "${cargoWrapper}/bin:${toolchainPkg}/bin";
|
|
||||||
RUSTC_CODEGEN_SPIRV_PATH =
|
|
||||||
"${rustc_codegen_spirv}/lib/librustc_codegen_spirv.so";
|
|
||||||
}
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
# This is a helper file for people using NixOS as their operating system.
|
|
||||||
# If you don't know what this file does, you can safely ignore it.
|
|
||||||
|
|
||||||
# If you are using Nix as your package manager, you can run 'nix-shell .nix'
|
|
||||||
# in the root directory of the project and Nix will open a bash shell
|
|
||||||
# with all the packages needed to build and run Graphite installed.
|
|
||||||
# A shell.nix file is used in the Nix ecosystem to define a development
|
|
||||||
# environment with specific dependencies. When you enter a Nix shell using
|
|
||||||
# this file, it ensures that all the specified tools and libraries are
|
|
||||||
# available regardless of the host system's configuration. This provides
|
|
||||||
# a reproducible development environment across different machines and developers.
|
|
||||||
|
|
||||||
# You can enter the Nix shell and run Graphite like normal with:
|
|
||||||
# > npm start
|
|
||||||
# Or you can run it like this without needing to first enter the Nix shell:
|
|
||||||
# > nix-shell .nix --command "npm start"
|
|
||||||
|
|
||||||
# Uses flake compat to provide a development shell that is identical to the one defined in the flake
|
|
||||||
(import
|
|
||||||
(
|
|
||||||
let
|
|
||||||
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
|
||||||
nodeName = lock.nodes.root.inputs.flake-compat;
|
|
||||||
in
|
|
||||||
fetchTarball {
|
|
||||||
url = lock.nodes.${nodeName}.locked.url;
|
|
||||||
sha256 = lock.nodes.${nodeName}.locked.narHash;
|
|
||||||
}
|
|
||||||
)
|
|
||||||
{ src = ./.; }
|
|
||||||
).shellNix
|
|
||||||
Vendored
+3
-1
@@ -6,14 +6,16 @@
|
|||||||
"tamasfe.even-better-toml",
|
"tamasfe.even-better-toml",
|
||||||
// Web
|
// Web
|
||||||
"dbaeumer.vscode-eslint",
|
"dbaeumer.vscode-eslint",
|
||||||
|
"esbenp.prettier-vscode",
|
||||||
"svelte.svelte-vscode",
|
"svelte.svelte-vscode",
|
||||||
"vitaliymaz.vscode-svg-previewer",
|
"vitaliymaz.vscode-svg-previewer",
|
||||||
// Code quality
|
// Code quality
|
||||||
"wayou.vscode-todo-highlight",
|
"wayou.vscode-todo-highlight",
|
||||||
"streetsidesoftware.code-spell-checker",
|
"streetsidesoftware.code-spell-checker",
|
||||||
// Helpful
|
// Git
|
||||||
"mhutchie.git-graph",
|
"mhutchie.git-graph",
|
||||||
"qezhu.gitlink",
|
"qezhu.gitlink",
|
||||||
|
// Helpful
|
||||||
"wmaurer.change-case"
|
"wmaurer.change-case"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Vendored
+26
-10
@@ -26,34 +26,50 @@
|
|||||||
// Configured in `.prettierrc`
|
// Configured in `.prettierrc`
|
||||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||||
},
|
},
|
||||||
|
// Website: don't format Zola/Tera-templated HTML on save
|
||||||
|
"[html]": {
|
||||||
|
"editor.formatOnSave": false
|
||||||
|
},
|
||||||
// Handlebars: don't save on format
|
// Handlebars: don't save on format
|
||||||
// (`about.hbs` is used by Cargo About to encode license information)
|
// (`about.hbs` is used by Cargo About to encode license information)
|
||||||
"[handlebars]": {
|
"[handlebars]": {
|
||||||
"editor.formatOnSave": false
|
"editor.formatOnSave": false
|
||||||
},
|
},
|
||||||
// Rust Analyzer config
|
// Rust Analyzer config
|
||||||
|
"rust-analyzer.check.command": "clippy",
|
||||||
"rust-analyzer.cargo.allTargets": false,
|
"rust-analyzer.cargo.allTargets": false,
|
||||||
"rust-analyzer.procMacro.ignored": {
|
"rust-analyzer.procMacro.ignored": {
|
||||||
"serde_derive": ["Serialize", "Deserialize"],
|
"serde_derive": ["Serialize", "Deserialize"]
|
||||||
"specta_macros": ["Type"] // Disabled because of: https://github.com/specta-rs/specta/issues/387
|
|
||||||
},
|
},
|
||||||
// ESLint config
|
// ESLint config
|
||||||
"eslint.format.enable": true,
|
"eslint.format.enable": true,
|
||||||
"eslint.workingDirectories": ["./frontend", "./website"],
|
"eslint.workingDirectories": ["./frontend", "./website"],
|
||||||
"eslint.validate": ["javascript", "typescript", "svelte"],
|
"eslint.validate": ["javascript", "typescript", "svelte"],
|
||||||
// Svelte config
|
// Git Graph config
|
||||||
"svelte.plugin.svelte.compilerWarnings": {
|
"git-graph.repository.fetchAndPrune": true,
|
||||||
"css-unused-selector": "ignore", // NOTICE: Keep this list in sync with the list in `frontend/vite.config.ts`
|
"git-graph.repository.showRemoteHeads": false,
|
||||||
"vite-plugin-svelte-css-no-scopable-elements": "ignore", // NOTICE: Keep this list in sync with the list in `frontend/vite.config.ts`
|
"git-graph.repository.commits.fetchAvatars": true,
|
||||||
"a11y-no-static-element-interactions": "ignore", // NOTICE: Keep this list in sync with the list in `frontend/vite.config.ts`
|
// VS Code Git config
|
||||||
"a11y-no-noninteractive-element-interactions": "ignore", // NOTICE: Keep this list in sync with the list in `frontend/vite.config.ts`
|
"git.autofetch": true,
|
||||||
"a11y-click-events-have-key-events": "ignore" // NOTICE: Keep this list in sync with the list in `frontend/vite.config.ts`
|
"git.enableStatusBarSync": false,
|
||||||
|
"git.showActionButton": {
|
||||||
|
"sync": false
|
||||||
},
|
},
|
||||||
|
// CSpell config
|
||||||
|
"cSpell.language": "en-US",
|
||||||
|
"cSpell.logLevel": "Information",
|
||||||
|
"cSpell.allowCompoundWords": true,
|
||||||
|
// Other extensions config
|
||||||
|
"evenBetterToml.formatter.alignComments": false,
|
||||||
|
"package-json-upgrade.ignorePatterns": ["source-sans-pro"],
|
||||||
// VS Code config
|
// VS Code config
|
||||||
"html.format.wrapLineLength": 200,
|
"html.format.wrapLineLength": 200,
|
||||||
"files.eol": "\n",
|
"files.eol": "\n",
|
||||||
"files.insertFinalNewline": true,
|
"files.insertFinalNewline": true,
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
"*.graphite": "json"
|
"*.graphite": "json"
|
||||||
}
|
},
|
||||||
|
"editor.renderWhitespace": "boundary",
|
||||||
|
"editor.minimap.markSectionHeaderRegex": "// ===+\\n\\s*//\\s*(?<label>[^\\n]{1,18})[^\\n]*(\\n\\s*//[^\\n]*)*\\n\\s*// ===+",
|
||||||
|
"git.addAICoAuthor": "off"
|
||||||
}
|
}
|
||||||
Generated
+2414
-2141
File diff suppressed because it is too large.
Load diff
+137
-80
@@ -2,62 +2,71 @@
|
|||||||
members = [
|
members = [
|
||||||
"desktop",
|
"desktop",
|
||||||
"desktop/wrapper",
|
"desktop/wrapper",
|
||||||
|
"desktop/ui",
|
||||||
"desktop/embedded-resources",
|
"desktop/embedded-resources",
|
||||||
"desktop/bundle",
|
"desktop/bundle",
|
||||||
"desktop/platform/linux",
|
"desktop/platform/linux",
|
||||||
"desktop/platform/mac",
|
"desktop/platform/mac",
|
||||||
"desktop/platform/win",
|
"desktop/platform/win",
|
||||||
|
"document/format",
|
||||||
|
"document/graph-storage",
|
||||||
|
"document/container",
|
||||||
"editor",
|
"editor",
|
||||||
"frontend/wasm",
|
"frontend/wrapper",
|
||||||
"libraries/dyn-any",
|
"libraries/dyn-any",
|
||||||
"libraries/path-bool",
|
|
||||||
"libraries/math-parser",
|
"libraries/math-parser",
|
||||||
"node-graph/gapplication-io",
|
"libraries/ipsum",
|
||||||
"node-graph/gbrush",
|
"libraries/snapping",
|
||||||
"node-graph/gcore",
|
"libraries/wgpu-sync",
|
||||||
"node-graph/gcore-shaders",
|
"libraries/control-protocol",
|
||||||
"node-graph/gmath-nodes",
|
"node-graph/libraries/graphene-hash",
|
||||||
"node-graph/gpath-bool",
|
"node-graph/libraries/*",
|
||||||
|
"node-graph/nodes/*",
|
||||||
|
"node-graph/nodes/raster/shaders",
|
||||||
|
"node-graph/nodes/raster/shaders/entrypoint",
|
||||||
"node-graph/graph-craft",
|
"node-graph/graph-craft",
|
||||||
"node-graph/graphene-cli",
|
"node-graph/graphene-cli",
|
||||||
"node-graph/graster-nodes",
|
"node-graph/nodes/gstd",
|
||||||
"node-graph/graster-nodes/shaders",
|
|
||||||
"node-graph/graster-nodes/shaders/entrypoint",
|
|
||||||
"node-graph/gstd",
|
|
||||||
"node-graph/gsvg-renderer",
|
|
||||||
"node-graph/interpreted-executor",
|
"node-graph/interpreted-executor",
|
||||||
"node-graph/node-macro",
|
"node-graph/node-macro",
|
||||||
"node-graph/preprocessor",
|
"node-graph/preprocessor",
|
||||||
"node-graph/wgpu-executor",
|
|
||||||
"proc-macros",
|
"proc-macros",
|
||||||
|
"tools/cargo-run",
|
||||||
|
"tools/cargo-run/internal/*",
|
||||||
|
"tools/crate-hierarchy-viz",
|
||||||
|
"tools/third-party-licenses",
|
||||||
|
"tools/editor-message-tree",
|
||||||
|
"tools/node-docs",
|
||||||
|
"tools/web-editor-driver",
|
||||||
]
|
]
|
||||||
default-members = [
|
default-members = [
|
||||||
"editor",
|
"editor",
|
||||||
"frontend/wasm",
|
"frontend/wrapper",
|
||||||
"libraries/dyn-any",
|
"libraries/dyn-any",
|
||||||
"libraries/path-bool",
|
|
||||||
"libraries/math-parser",
|
"libraries/math-parser",
|
||||||
"node-graph/gapplication-io",
|
"libraries/ipsum",
|
||||||
"node-graph/gbrush",
|
"libraries/snapping",
|
||||||
"node-graph/gcore",
|
|
||||||
"node-graph/gcore-shaders",
|
|
||||||
"node-graph/graster-nodes/shaders",
|
|
||||||
"node-graph/gmath-nodes",
|
|
||||||
"node-graph/gpath-bool",
|
|
||||||
"node-graph/graph-craft",
|
"node-graph/graph-craft",
|
||||||
"node-graph/graphene-cli",
|
|
||||||
"node-graph/graster-nodes",
|
|
||||||
"node-graph/gstd",
|
|
||||||
"node-graph/gsvg-renderer",
|
|
||||||
"node-graph/interpreted-executor",
|
"node-graph/interpreted-executor",
|
||||||
"node-graph/node-macro",
|
"node-graph/node-macro",
|
||||||
"node-graph/preprocessor",
|
"node-graph/preprocessor",
|
||||||
"node-graph/wgpu-executor",
|
# blocked by https://github.com/rust-lang/cargo/issues/16000
|
||||||
# blocked by https://github.com/rust-lang/cargo/issues/15890
|
|
||||||
# "proc-macros",
|
# "proc-macros",
|
||||||
|
"tools/cargo-run",
|
||||||
]
|
]
|
||||||
resolver = "2"
|
resolver = "2"
|
||||||
|
|
||||||
|
[workspace.package]
|
||||||
|
rust-version = "1.98"
|
||||||
|
edition = "2024"
|
||||||
|
authors = ["Graphite Authors <[email protected]>"]
|
||||||
|
homepage = "https://graphite.art"
|
||||||
|
repository = "https://github.com/GraphiteEditor/Graphite"
|
||||||
|
license = "MIT OR Apache-2.0"
|
||||||
|
version = "0.0.0"
|
||||||
|
readme = "README.md"
|
||||||
|
publish = false
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
# Local dependencies
|
# Local dependencies
|
||||||
dyn-any = { path = "libraries/dyn-any", features = [
|
dyn-any = { path = "libraries/dyn-any", features = [
|
||||||
@@ -67,56 +76,86 @@ dyn-any = { path = "libraries/dyn-any", features = [
|
|||||||
"log-bad-types",
|
"log-bad-types",
|
||||||
"rc",
|
"rc",
|
||||||
] }
|
] }
|
||||||
|
graphene-hash = { path = "node-graph/libraries/graphene-hash", features = ["derive"] }
|
||||||
preprocessor = { path = "node-graph/preprocessor" }
|
preprocessor = { path = "node-graph/preprocessor" }
|
||||||
math-parser = { path = "libraries/math-parser" }
|
math-parser = { path = "libraries/math-parser" }
|
||||||
path-bool = { path = "libraries/path-bool" }
|
graphene-application-io = { path = "node-graph/libraries/application-io" }
|
||||||
graphene-application-io = { path = "node-graph/gapplication-io" }
|
graphene-resource = { path = "node-graph/libraries/resources" }
|
||||||
graphene-brush = { path = "node-graph/gbrush" }
|
graphene-animation = { path = "node-graph/libraries/animation" }
|
||||||
graphene-core = { path = "node-graph/gcore" }
|
core-types = { path = "node-graph/libraries/core-types" }
|
||||||
graphene-core-shaders = { path = "node-graph/gcore-shaders" }
|
no-std-types = { path = "node-graph/libraries/no-std-types" }
|
||||||
graphene-math-nodes = { path = "node-graph/gmath-nodes" }
|
raster-types = { path = "node-graph/libraries/raster-types" }
|
||||||
graphene-path-bool = { path = "node-graph/gpath-bool" }
|
vector-types = { path = "node-graph/libraries/vector-types" }
|
||||||
|
graphic-types = { path = "node-graph/libraries/graphic-types" }
|
||||||
|
brush-types = { path = "node-graph/libraries/brush-types" }
|
||||||
|
rendering = { path = "node-graph/libraries/rendering" }
|
||||||
|
brush-nodes = { path = "node-graph/nodes/brush" }
|
||||||
|
blending-nodes = { path = "node-graph/nodes/blending" }
|
||||||
|
graphene-core = { path = "node-graph/nodes/gcore" }
|
||||||
|
graphic-nodes = { path = "node-graph/nodes/graphic" }
|
||||||
|
text-nodes = { path = "node-graph/nodes/text" }
|
||||||
|
transform-nodes = { path = "node-graph/nodes/transform" }
|
||||||
|
vector-nodes = { path = "node-graph/nodes/vector" }
|
||||||
|
repeat-nodes = { path = "node-graph/nodes/repeat" }
|
||||||
|
vectorize-nodes = { path = "node-graph/nodes/vectorize" }
|
||||||
|
vtrace = { path = "../vtrace/vtrace" }
|
||||||
|
math-nodes = { path = "node-graph/nodes/math" }
|
||||||
|
path-bool-nodes = { path = "node-graph/nodes/path-bool" }
|
||||||
graph-craft = { path = "node-graph/graph-craft" }
|
graph-craft = { path = "node-graph/graph-craft" }
|
||||||
graphene-raster-nodes = { path = "node-graph/graster-nodes" }
|
document-format = { path = "document/format" }
|
||||||
graphene-std = { path = "node-graph/gstd" }
|
document-graph-storage = { path = "document/graph-storage", default-features = false }
|
||||||
graphene-svg-renderer = { path = "node-graph/gsvg-renderer" }
|
document-container = { path = "document/container" }
|
||||||
|
raster-nodes = { path = "node-graph/nodes/raster" }
|
||||||
|
graphene-std = { path = "node-graph/nodes/gstd" }
|
||||||
interpreted-executor = { path = "node-graph/interpreted-executor" }
|
interpreted-executor = { path = "node-graph/interpreted-executor" }
|
||||||
node-macro = { path = "node-graph/node-macro" }
|
node-macro = { path = "node-graph/node-macro" }
|
||||||
wgpu-executor = { path = "node-graph/wgpu-executor" }
|
wgpu-executor = { path = "node-graph/libraries/wgpu-executor" }
|
||||||
|
wgpu-sync = { path = "libraries/wgpu-sync" }
|
||||||
graphite-proc-macros = { path = "proc-macros" }
|
graphite-proc-macros = { path = "proc-macros" }
|
||||||
|
graphite-editor = { path = "editor" }
|
||||||
|
control-protocol = { path = "libraries/control-protocol" }
|
||||||
|
graphene-canvas-utils = { path = "node-graph/libraries/canvas-utils" }
|
||||||
|
ipsum = { path = "libraries/ipsum" }
|
||||||
|
snapping = { path = "libraries/snapping" }
|
||||||
|
|
||||||
# Workspace dependencies
|
# Workspace dependencies
|
||||||
rustc-hash = "2.0"
|
rustc-hash = "2.0"
|
||||||
bytemuck = { version = "1.13", features = ["derive", "min_const_generics"] }
|
bytemuck = { version = "1.13", features = ["derive", "min_const_generics"] }
|
||||||
serde = { version = "1.0", features = ["derive", "rc"] }
|
serde = { version = "1.0", features = ["derive", "rc"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
|
postcard = { version = "1.1", default-features = false, features = ["use-std"] }
|
||||||
|
serde_bytes = "0.11"
|
||||||
serde-wasm-bindgen = "0.6"
|
serde-wasm-bindgen = "0.6"
|
||||||
reqwest = { version = "0.12", features = ["blocking", "rustls-tls", "json"] }
|
reqwest = { version = "0.13", features = ["blocking", "json"] }
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
env_logger = "0.11"
|
env_logger = "0.11"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
bitflags = { version = "2.4", features = ["serde"] }
|
bitflags = { version = "2.4", features = ["serde"] }
|
||||||
ctor = "0.2"
|
ctor = "0.2"
|
||||||
convert_case = "0.8"
|
convert_case = "0.12"
|
||||||
|
titlecase = "3.6"
|
||||||
|
fancy-regex = "0.18.0"
|
||||||
|
unicode-segmentation = "1.13.2"
|
||||||
|
indoc = "2.0.5"
|
||||||
derivative = "2.2"
|
derivative = "2.2"
|
||||||
thiserror = "2"
|
thiserror = "2"
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
proc-macro2 = { version = "1", features = ["span-locations"] }
|
proc-macro2 = { version = "1", features = ["span-locations"] }
|
||||||
quote = "1.0"
|
quote = "1.0"
|
||||||
chrono = "0.4"
|
chrono = "0.4"
|
||||||
ron = "0.11"
|
ron = "0.12"
|
||||||
fastnoise-lite = "1.1"
|
fastnoise-lite = "1.1"
|
||||||
wgpu = { version = "27.0", features = [
|
wgpu = { version = "29.0", features = [
|
||||||
# We don't have wgpu on multiple threads (yet) https://github.com/gfx-rs/wgpu/blob/trunk/CHANGELOG.md#wgpu-types-now-send-sync-on-wasm
|
# We don't have wgpu on multiple threads (yet) https://github.com/gfx-rs/wgpu/blob/trunk/CHANGELOG.md#wgpu-types-now-send-sync-on-wasm
|
||||||
"fragile-send-sync-non-atomic-wasm",
|
"fragile-send-sync-non-atomic-wasm",
|
||||||
"spirv",
|
"spirv",
|
||||||
"strict_asserts",
|
"strict_asserts",
|
||||||
] }
|
] }
|
||||||
once_cell = "1.13" # Remove when `core::cell::LazyCell` (<https://doc.rust-lang.org/core/cell/struct.LazyCell.html>) is stabilized in Rust 1.80 and we bump our MSRV
|
once_cell = "1.13" # Remove and replace with `core::cell::LazyCell` (<https://doc.rust-lang.org/core/cell/struct.LazyCell.html>)
|
||||||
wasm-bindgen = "=0.2.100" # NOTICE: ensure this stays in sync with the `wasm-bindgen-cli` version in `website/content/volunteer/guide/project-setup/_index.md`. We pin this version because wasm-bindgen upgrades may break various things.
|
wasm-bindgen = "=0.2.121" # NOTICE: keep in sync with the `wasm-bindgen-cli` version pinned in `.github/workflows/build.yml`, `.devcontainer/devcontainer.json`, `.nix/dev.nix`, `.nix/pkgs/graphite.nix`, and `tools/cargo-run/src/requirements.rs`. We pin this version because wasm-bindgen upgrades may break various things.
|
||||||
wasm-bindgen-futures = "0.4"
|
wasm-bindgen-futures = "0.4"
|
||||||
js-sys = "=0.3.77"
|
js-sys = "=0.3.98"
|
||||||
web-sys = { version = "=0.3.77", features = [
|
web-sys = { version = "=0.3.98", features = [
|
||||||
"Document",
|
"Document",
|
||||||
"DomRect",
|
"DomRect",
|
||||||
"Element",
|
"Element",
|
||||||
@@ -134,39 +173,52 @@ web-sys = { version = "=0.3.77", features = [
|
|||||||
"HtmlImageElement",
|
"HtmlImageElement",
|
||||||
"ImageBitmapRenderingContext",
|
"ImageBitmapRenderingContext",
|
||||||
] }
|
] }
|
||||||
winit = { git = "https://github.com/rust-windowing/winit.git" }
|
winit = "0.31.0-beta.2"
|
||||||
keyboard-types = "0.8"
|
keyboard-types = "0.8"
|
||||||
url = "2.5"
|
url = "2.5"
|
||||||
tokio = { version = "1.29", features = ["fs", "macros", "io-std", "rt"] }
|
tokio = { version = "1.29", features = ["fs", "macros", "io-std", "rt", "rt-multi-thread"] }
|
||||||
vello = { git = "https://github.com/linebender/vello" }
|
# Linebender ecosystem (BEGIN)
|
||||||
vello_encoding = { git = "https://github.com/linebender/vello" }
|
kurbo = { version = "0.13", features = ["serde"] }
|
||||||
resvg = "0.45"
|
vello = "0.10"
|
||||||
usvg = "0.45"
|
vello_encoding = "0.10"
|
||||||
|
usvg = "0.47"
|
||||||
|
simplecss = "0.2"
|
||||||
|
parley = { version = "0.9", default-features = false, features = ["std"] }
|
||||||
|
skrifa = "0.42"
|
||||||
|
polycool = "0.4"
|
||||||
|
color = "0.3"
|
||||||
|
# Linebender ecosystem (END)
|
||||||
rand = { version = "0.9", default-features = false, features = ["std_rng"] }
|
rand = { version = "0.9", default-features = false, features = ["std_rng"] }
|
||||||
rand_chacha = "0.9"
|
rand_chacha = "0.9"
|
||||||
glam = { version = "0.29", default-features = false, features = [
|
glam = { version = "0.33", default-features = false, features = [
|
||||||
"nostd-libm",
|
"nostd-libm",
|
||||||
"scalar-math",
|
"scalar-math",
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
|
"debug-glam-assert",
|
||||||
|
"all-types",
|
||||||
] }
|
] }
|
||||||
base64 = "0.22"
|
base64 = "0.22"
|
||||||
|
blake3 = "1.5"
|
||||||
|
mmap-io = { version = "0.9", features = ["hugepages"] }
|
||||||
image = { version = "0.25", default-features = false, features = [
|
image = { version = "0.25", default-features = false, features = [
|
||||||
"png",
|
"png",
|
||||||
"jpeg",
|
"jpeg",
|
||||||
"bmp",
|
"bmp",
|
||||||
|
"gif",
|
||||||
|
"webp",
|
||||||
|
"tiff",
|
||||||
|
"ico",
|
||||||
|
"tga",
|
||||||
|
"hdr",
|
||||||
|
"exr",
|
||||||
|
"serde",
|
||||||
] }
|
] }
|
||||||
parley = "0.5"
|
|
||||||
skrifa = "0.36"
|
|
||||||
pretty_assertions = "1.4"
|
pretty_assertions = "1.4"
|
||||||
fern = { version = "0.7", features = ["colored"] }
|
fern = { version = "0.7", features = ["colored"] }
|
||||||
num_enum = { version = "0.7", default-features = false }
|
num_enum = { version = "0.7", default-features = false }
|
||||||
num-derive = "0.4"
|
num-derive = "0.4"
|
||||||
num-traits = { version = "0.2", default-features = false, features = ["libm"] }
|
num-traits = { version = "0.2", default-features = false, features = ["libm"] }
|
||||||
specta = { version = "2.0.0-rc.22", features = [
|
tsify = { version = "0.5", default-features = false, features = ["js"] }
|
||||||
"glam",
|
|
||||||
"derive",
|
|
||||||
# "typescript",
|
|
||||||
] }
|
|
||||||
syn = { version = "2.0", default-features = false, features = [
|
syn = { version = "2.0", default-features = false, features = [
|
||||||
"full",
|
"full",
|
||||||
"derive",
|
"derive",
|
||||||
@@ -178,28 +230,36 @@ syn = { version = "2.0", default-features = false, features = [
|
|||||||
"extra-traits",
|
"extra-traits",
|
||||||
"proc-macro",
|
"proc-macro",
|
||||||
] }
|
] }
|
||||||
kurbo = { version = "0.12", features = ["serde"] }
|
|
||||||
lyon_geom = "1.0"
|
lyon_geom = "1.0"
|
||||||
|
delaunator = "1.0"
|
||||||
petgraph = { version = "0.7", default-features = false, features = ["graphmap"] }
|
petgraph = { version = "0.7", default-features = false, features = ["graphmap"] }
|
||||||
half = { version = "2.4", default-features = false, features = ["bytemuck"] }
|
half = { version = "2.4", default-features = false, features = ["bytemuck"] }
|
||||||
tinyvec = { version = "1", features = ["std"] }
|
tinyvec = { version = "1", features = ["std"] }
|
||||||
criterion = { version = "0.7", features = ["html_reports"] }
|
criterion = { version = "0.7", features = ["html_reports"] }
|
||||||
iai-callgrind = { version = "0.16" }
|
gungraun = { version = "0.18" }
|
||||||
ndarray = "0.16"
|
ndarray = "0.16"
|
||||||
strum = { version = "0.27", features = ["derive"] }
|
strum = { version = "0.27", features = ["derive"] }
|
||||||
dirs = "6.0"
|
dirs = "6.0"
|
||||||
cef = { version = "141", features = ["accelerated_osr"] }
|
cef = "151"
|
||||||
cef-dll-sys = "141"
|
cef-dll-sys = "151"
|
||||||
include_dir = "0.7"
|
include_dir = "0.7"
|
||||||
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||||
tracing = "0.1"
|
tracing = "0.1"
|
||||||
rfd = "0.15"
|
rfd = "0.17"
|
||||||
open = "5.3"
|
open = "5.3"
|
||||||
polycool = "0.4"
|
|
||||||
spin = "0.10"
|
spin = "0.10"
|
||||||
clap = "4.5"
|
clap = "4.5"
|
||||||
spirv-std = { git = "https://github.com/Firestar99/rust-gpu-new", rev = "c12f216121820580731440ee79ebc7403d6ea04f", features = ["bytemuck"] }
|
|
||||||
cargo-gpu = { git = "https://github.com/Firestar99/cargo-gpu", rev = "3952a22d16edbd38689f3a876e417899f21e1fe7", default-features = false }
|
# Ensure these are kept in sync with .nix/deps/rust-gpu.nix
|
||||||
|
spirv-std = { version = "0.10.0", features = ["bytemuck"] }
|
||||||
|
cargo-gpu-install = { version = "0.10.0", default-features = false }
|
||||||
|
|
||||||
|
qrcodegen = "1.8"
|
||||||
|
lzma-rust2 = { version = "0.16", default-features = false, features = ["std", "encoder", "optimization", "xz"] }
|
||||||
|
scraper = "0.25"
|
||||||
|
linesweeper = "0.4"
|
||||||
|
smallvec = "1.13.2"
|
||||||
|
zip = { version = "8", default-features = false }
|
||||||
|
|
||||||
[workspace.lints.rust]
|
[workspace.lints.rust]
|
||||||
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(target_arch, values("spirv"))'] }
|
unexpected_cfgs = { level = "allow", check-cfg = ['cfg(target_arch, values("spirv"))'] }
|
||||||
@@ -208,25 +268,22 @@ unexpected_cfgs = { level = "allow", check-cfg = ['cfg(target_arch, values("spir
|
|||||||
opt-level = 1
|
opt-level = 1
|
||||||
|
|
||||||
[profile.dev.package]
|
[profile.dev.package]
|
||||||
graphite-editor = { opt-level = 1 }
|
no-std-types = { opt-level = 1 }
|
||||||
graphene-core-shaders = { opt-level = 1 }
|
core-types= { opt-level = 1 }
|
||||||
graphene-std = { opt-level = 1 }
|
|
||||||
interpreted-executor = { opt-level = 1 } # This is a mitigation for https://github.com/rustwasm/wasm-pack/issues/981 which is needed because the node_registry function is too large
|
interpreted-executor = { opt-level = 1 } # This is a mitigation for https://github.com/rustwasm/wasm-pack/issues/981 which is needed because the node_registry function is too large
|
||||||
graphite-proc-macros = { opt-level = 1 }
|
graphite-proc-macros = { opt-level = 1 }
|
||||||
image = { opt-level = 2 }
|
image = { opt-level = 2 }
|
||||||
rustc-hash = { opt-level = 3 }
|
rustc-hash = { opt-level = 3 }
|
||||||
serde_derive = { opt-level = 1 }
|
serde_derive = { opt-level = 1 }
|
||||||
specta-macros = { opt-level = 1 }
|
|
||||||
syn = { opt-level = 1 }
|
syn = { opt-level = 1 }
|
||||||
|
node-macro = { opt-level = 2 }
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
lto = "thin"
|
lto = "thin"
|
||||||
debug = true
|
debug = true
|
||||||
|
|
||||||
[profile.profiling]
|
|
||||||
inherits = "release"
|
|
||||||
debug = true
|
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
# Force cargo to use only one version of the dpi crate (vendoring breaks without this)
|
winit = { git = "https://github.com/timon-schelling/winit", branch = "graphite" }
|
||||||
dpi = { git = "https://github.com/rust-windowing/winit.git" }
|
rfd = { git = "https://github.com/timon-schelling/rfd.git", branch = "graphite" } # TODO: Remove this once https://github.com/PolyMeilex/rfd/pull/317 is merged and released
|
||||||
|
cef = { git = "https://github.com/timon-schelling/cef-rs.git", branch = "graphite-151" }
|
||||||
|
cef-dll-sys = { git = "https://github.com/timon-schelling/cef-rs.git", branch = "graphite-151" }
|
||||||
File renamed without changes.
+19
@@ -0,0 +1,19 @@
|
|||||||
|
Copyright (c) Graphite contributors
|
||||||
|
|
||||||
|
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 NONINFRINGEMENT. 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.
|
||||||
-201
@@ -1,201 +0,0 @@
|
|||||||
Apache License
|
|
||||||
Version 2.0, January 2004
|
|
||||||
http://www.apache.org/licenses/
|
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
||||||
|
|
||||||
1. Definitions.
|
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction,
|
|
||||||
and distribution as defined by Sections 1 through 9 of this document.
|
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by
|
|
||||||
the copyright owner that is granting the License.
|
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all
|
|
||||||
other entities that control, are controlled by, or are under common
|
|
||||||
control with that entity. For the purposes of this definition,
|
|
||||||
"control" means (i) the power, direct or indirect, to cause the
|
|
||||||
direction or management of such entity, whether by contract or
|
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity
|
|
||||||
exercising permissions granted by this License.
|
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications,
|
|
||||||
including but not limited to software source code, documentation
|
|
||||||
source, and configuration files.
|
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical
|
|
||||||
transformation or translation of a Source form, including but
|
|
||||||
not limited to compiled object code, generated documentation,
|
|
||||||
and conversions to other media types.
|
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or
|
|
||||||
Object form, made available under the License, as indicated by a
|
|
||||||
copyright notice that is included in or attached to the work
|
|
||||||
(an example is provided in the Appendix below).
|
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object
|
|
||||||
form, that is based on (or derived from) the Work and for which the
|
|
||||||
editorial revisions, annotations, elaborations, or other modifications
|
|
||||||
represent, as a whole, an original work of authorship. For the purposes
|
|
||||||
of this License, Derivative Works shall not include works that remain
|
|
||||||
separable from, or merely link (or bind by name) to the interfaces of,
|
|
||||||
the Work and Derivative Works thereof.
|
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including
|
|
||||||
the original version of the Work and any modifications or additions
|
|
||||||
to that Work or Derivative Works thereof, that is intentionally
|
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of
|
|
||||||
the copyright owner. For the purposes of this definition, "submitted"
|
|
||||||
means any form of electronic, verbal, or written communication sent
|
|
||||||
to the Licensor or its representatives, including but not limited to
|
|
||||||
communication on electronic mailing lists, source code control systems,
|
|
||||||
and issue tracking systems that are managed by, or on behalf of, the
|
|
||||||
Licensor for the purpose of discussing and improving the Work, but
|
|
||||||
excluding communication that is conspicuously marked or otherwise
|
|
||||||
designated in writing by the copyright owner as "Not a Contribution."
|
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
||||||
on behalf of whom a Contribution has been received by Licensor and
|
|
||||||
subsequently incorporated within the Work.
|
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
copyright license to reproduce, prepare Derivative Works of,
|
|
||||||
publicly display, publicly perform, sublicense, and distribute the
|
|
||||||
Work and such Derivative Works in Source or Object form.
|
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of
|
|
||||||
this License, each Contributor hereby grants to You a perpetual,
|
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
||||||
(except as stated in this section) patent license to make, have made,
|
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
||||||
where such license applies only to those patent claims licensable
|
|
||||||
by such Contributor that are necessarily infringed by their
|
|
||||||
Contribution(s) alone or by combination of their Contribution(s)
|
|
||||||
with the Work to which such Contribution(s) was submitted. If You
|
|
||||||
institute patent litigation against any entity (including a
|
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
||||||
or a Contribution incorporated within the Work constitutes direct
|
|
||||||
or contributory patent infringement, then any patent licenses
|
|
||||||
granted to You under this License for that Work shall terminate
|
|
||||||
as of the date such litigation is filed.
|
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the
|
|
||||||
Work or Derivative Works thereof in any medium, with or without
|
|
||||||
modifications, and in Source or Object form, provided that You
|
|
||||||
meet the following conditions:
|
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or
|
|
||||||
Derivative Works a copy of this License; and
|
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices
|
|
||||||
stating that You changed the files; and
|
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works
|
|
||||||
that You distribute, all copyright, patent, trademark, and
|
|
||||||
attribution notices from the Source form of the Work,
|
|
||||||
excluding those notices that do not pertain to any part of
|
|
||||||
the Derivative Works; and
|
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its
|
|
||||||
distribution, then any Derivative Works that You distribute must
|
|
||||||
include a readable copy of the attribution notices contained
|
|
||||||
within such NOTICE file, excluding those notices that do not
|
|
||||||
pertain to any part of the Derivative Works, in at least one
|
|
||||||
of the following places: within a NOTICE text file distributed
|
|
||||||
as part of the Derivative Works; within the Source form or
|
|
||||||
documentation, if provided along with the Derivative Works; or,
|
|
||||||
within a display generated by the Derivative Works, if and
|
|
||||||
wherever such third-party notices normally appear. The contents
|
|
||||||
of the NOTICE file are for informational purposes only and
|
|
||||||
do not modify the License. You may add Your own attribution
|
|
||||||
notices within Derivative Works that You distribute, alongside
|
|
||||||
or as an addendum to the NOTICE text from the Work, provided
|
|
||||||
that such additional attribution notices cannot be construed
|
|
||||||
as modifying the License.
|
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and
|
|
||||||
may provide additional or different license terms and conditions
|
|
||||||
for use, reproduction, or distribution of Your modifications, or
|
|
||||||
for any such Derivative Works as a whole, provided Your use,
|
|
||||||
reproduction, and distribution of the Work otherwise complies with
|
|
||||||
the conditions stated in this License.
|
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
||||||
any Contribution intentionally submitted for inclusion in the Work
|
|
||||||
by You to the Licensor shall be under the terms and conditions of
|
|
||||||
this License, without any additional terms or conditions.
|
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify
|
|
||||||
the terms of any separate license agreement you may have executed
|
|
||||||
with Licensor regarding such Contributions.
|
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade
|
|
||||||
names, trademarks, service marks, or product names of the Licensor,
|
|
||||||
except as required for reasonable and customary use in describing the
|
|
||||||
origin of the Work and reproducing the content of the NOTICE file.
|
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
||||||
agreed to in writing, Licensor provides the Work (and each
|
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
||||||
implied, including, without limitation, any warranties or conditions
|
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
||||||
appropriateness of using or redistributing the Work and assume any
|
|
||||||
risks associated with Your exercise of permissions under this License.
|
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory,
|
|
||||||
whether in tort (including negligence), contract, or otherwise,
|
|
||||||
unless required by applicable law (such as deliberate and grossly
|
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be
|
|
||||||
liable to You for damages, including any direct, indirect, special,
|
|
||||||
incidental, or consequential damages of any character arising as a
|
|
||||||
result of this License or out of the use or inability to use the
|
|
||||||
Work (including but not limited to damages for loss of goodwill,
|
|
||||||
work stoppage, computer failure or malfunction, or any and all
|
|
||||||
other commercial damages or losses), even if such Contributor
|
|
||||||
has been advised of the possibility of such damages.
|
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing
|
|
||||||
the Work or Derivative Works thereof, You may choose to offer,
|
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
||||||
or other liability obligations and/or rights consistent with this
|
|
||||||
License. However, in accepting such obligations, You may act only
|
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf
|
|
||||||
of any other Contributor, and only if You agree to indemnify,
|
|
||||||
defend, and hold each Contributor harmless for any liability
|
|
||||||
incurred by, or claims asserted against, such Contributor by reason
|
|
||||||
of your accepting any such warranty or additional liability.
|
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work.
|
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following
|
|
||||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
||||||
replaced with your own identifying information. (Don't include
|
|
||||||
the brackets!) The text should be enclosed in the appropriate
|
|
||||||
comment syntax for the file format. We also recommend that a
|
|
||||||
file or class name and description of purpose be included on the
|
|
||||||
same "printed page" as the copyright notice for easier
|
|
||||||
identification within third-party archives.
|
|
||||||
|
|
||||||
Copyright [yyyy] [name of copyright owner]
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
|
|
||||||
<a href="https://graphite.rs/">
|
<a href="https://graphite.art/">
|
||||||
<picture>
|
<picture>
|
||||||
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/user-attachments/assets/9366c148-4405-484f-909a-9a3526eb9209">
|
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/user-attachments/assets/9366c148-4405-484f-909a-9a3526eb9209">
|
||||||
<source media="(prefers-color-scheme: light)" srcset="https://github.com/user-attachments/assets/791508ab-bcd5-4e31-a3b9-1187cfd7a2f6">
|
<source media="(prefers-color-scheme: light)" srcset="https://github.com/user-attachments/assets/791508ab-bcd5-4e31-a3b9-1187cfd7a2f6">
|
||||||
@@ -10,14 +10,14 @@
|
|||||||
|
|
||||||
# Your procedural toolbox for 2D content creation
|
# Your procedural toolbox for 2D content creation
|
||||||
|
|
||||||
**Graphite is a free, open source vector and raster graphics engine, [available now](https://editor.graphite.rs) in alpha. Get creative with a fully nondestructive editing workflow that combines layer-based compositing with node-based generative design.**
|
**Graphite is a free, open source vector and raster graphics engine, [available now](https://editor.graphite.art) in alpha. Get creative with a fully nondestructive editing workflow that combines layer-based compositing with node-based generative design.**
|
||||||
|
|
||||||
Having begun life as a vector editor, Graphite continues evolving into a generalized, all-in-one graphics toolbox that's built more like a game engine than a conventional creative app. The editor's tools wrap its node graph core, providing user-friendly workflows for vector, raster, and beyond. Photo editing, motion graphics, digital painting, desktop publishing, and VFX compositing are additional competencies on the planned [roadmap](https://graphite.rs/features/#roadmap) making Graphite into a highly versatile content creation tool.
|
Having begun life as a vector editor, Graphite continues evolving into a generalized, all-in-one graphics toolbox that's built more like a game engine than a conventional creative app. The editor's tools wrap its node graph core, providing user-friendly workflows for vector, raster, and beyond. Photo editing, motion graphics, digital painting, desktop publishing, and VFX compositing are additional competencies on the planned [roadmap](https://graphite.art/features/#roadmap) making Graphite into a highly versatile content creation tool.
|
||||||
|
|
||||||
Learn more from the [website](https://graphite.rs/), subscribe to the [newsletter](https://graphite.rs/#newsletter), consider [volunteering](https://graphite.rs/volunteer/) or [donating](https://graphite.rs/donate/), and remember to give this repository a ⭐!
|
Learn more from the [website](https://graphite.art/), subscribe to the [newsletter](https://graphite.art/#newsletter), consider [volunteering](https://graphite.art/volunteer/) or [donating](https://graphite.art/donate/), and remember to give this repository a ⭐!
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
<a href="https://discord.graphite.rs/">
|
<a href="https://discord.graphite.art/">
|
||||||
<picture>
|
<picture>
|
||||||
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/user-attachments/assets/ad185fac-3b48-446d-863c-2bcb0724abee">
|
<source media="(prefers-color-scheme: dark)" srcset="https://github.com/user-attachments/assets/ad185fac-3b48-446d-863c-2bcb0724abee">
|
||||||
<source media="(prefers-color-scheme: light)" srcset="https://github.com/user-attachments/assets/aa23f503-f3bf-444a-9080-8eaa19fa2fa8">
|
<source media="(prefers-color-scheme: light)" srcset="https://github.com/user-attachments/assets/aa23f503-f3bf-444a-9080-8eaa19fa2fa8">
|
||||||
@@ -62,7 +62,7 @@ https://github.com/user-attachments/assets/f4604aea-e8f1-45ce-9218-46ddc666f11d
|
|||||||
|
|
||||||
## Support our mission ❤️
|
## Support our mission ❤️
|
||||||
|
|
||||||
Graphite is 100% community built and funded. Please become a part of keeping the project alive and thriving with a [donation](https://graphite.rs/donate/) if you share a belief in our **mission**:
|
Graphite is 100% community built and funded. Please become a part of keeping the project alive and thriving with a [donation](https://graphite.art/donate/) if you share a belief in our **mission**:
|
||||||
|
|
||||||
> Graphite strives to unshackle the creativity of every budding artist and seasoned professional by building the best comprehensive art and design tool that's accessible to all.
|
> Graphite strives to unshackle the creativity of every budding artist and seasoned professional by building the best comprehensive art and design tool that's accessible to all.
|
||||||
>
|
>
|
||||||
@@ -78,6 +78,8 @@ Graphite is 100% community built and funded. Please become a part of keeping the
|
|||||||
|
|
||||||
## Contributing/building the code
|
## Contributing/building the code
|
||||||
|
|
||||||
Are you a graphics programmer or Rust developer? Graphite aims to be one of the most approachable projects for putting your engineering skills to use in the world of open source. See [instructions here](https://graphite.rs/volunteer/guide/) for setting up the project and getting started.
|
Are you a graphics programmer or Rust developer? Graphite aims to be one of the most approachable projects for putting your engineering skills to use in the world of open source. See [instructions here](https://graphite.art/volunteer/guide/) for setting up the project and getting started.
|
||||||
|
|
||||||
*By submitting code for inclusion in the project, you are agreeing to license your changes under the Apache 2.0 license, and that you have the authority to do so. Some directories may have other licenses, like dual-licensed MIT/Apache 2.0, and code submissions to those directories mean you agree to the applicable license(s).*
|
## License
|
||||||
|
|
||||||
|
Graphite's source code is dual-licensed under your choice of either the [MIT license](LICENSE-MIT) or the [Apache License 2.0](LICENSE-APACHE), at your option, unless otherwise noted within the repository. By submitting code for inclusion in the project, you agree to license your contributions under both licenses, and that you have the authority to do so.
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
{{!
|
|
||||||
Be careful to prevent auto-formatting from breaking this file's indentation.
|
|
||||||
Replace this file with JSON output once this is resolved: https://github.com/EmbarkStudios/cargo-about/issues/73
|
|
||||||
|
|
||||||
The `GENERATED_BY_CARGO_ABOUT` prefix is a JS labeled statement
|
|
||||||
(<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/label>)
|
|
||||||
used so the reader of the generated file can verify the file does indeed start with that string,
|
|
||||||
while remaining valid JS for subsequent parsing.
|
|
||||||
}}
|
|
||||||
GENERATED_BY_CARGO_ABOUT: [
|
|
||||||
{{#each licenses}}
|
|
||||||
{
|
|
||||||
licenseName: `{{name}}`,
|
|
||||||
licenseText: `{{text}}`,
|
|
||||||
packages: [
|
|
||||||
{{#each used_by}}
|
|
||||||
{
|
|
||||||
name: `{{crate.name}}`,
|
|
||||||
version: `{{crate.version}}`,
|
|
||||||
author: `{{crate.authors}}`,
|
|
||||||
repository: `{{crate.repository}}`,
|
|
||||||
},
|
|
||||||
{{/each}}
|
|
||||||
],
|
|
||||||
},
|
|
||||||
{{/each}}
|
|
||||||
]
|
|
||||||
+1
-2
@@ -1,4 +1,5 @@
|
|||||||
accepted = [
|
accepted = [
|
||||||
|
"0BSD", # Keep this list in sync with those in `/deny.toml`
|
||||||
"Apache-2.0 WITH LLVM-exception", # Keep this list in sync with those in `/deny.toml`
|
"Apache-2.0 WITH LLVM-exception", # Keep this list in sync with those in `/deny.toml`
|
||||||
"Apache-2.0", # Keep this list in sync with those in `/deny.toml`
|
"Apache-2.0", # Keep this list in sync with those in `/deny.toml`
|
||||||
"BSD-2-Clause", # Keep this list in sync with those in `/deny.toml`
|
"BSD-2-Clause", # Keep this list in sync with those in `/deny.toml`
|
||||||
@@ -21,8 +22,6 @@ accepted = [
|
|||||||
workarounds = ["ring"]
|
workarounds = ["ring"]
|
||||||
ignore-build-dependencies = true
|
ignore-build-dependencies = true
|
||||||
ignore-dev-dependencies = true
|
ignore-dev-dependencies = true
|
||||||
# Clearly Defined's API would occasionally (every few months) return errors for at least a full day (maybe some weird rate limiting?), but we can just disable to perform local checking (see #1653)
|
|
||||||
no-clearly-defined = true
|
|
||||||
|
|
||||||
# https://raw.githubusercontent.com/briansmith/webpki/main/LICENSE
|
# https://raw.githubusercontent.com/briansmith/webpki/main/LICENSE
|
||||||
# is the ISC license but test code within the repo is BSD-3-Clause, but is not compiled into the crate when we use it
|
# is the ISC license but test code within the repo is BSD-3-Clause, but is not compiled into the crate when we use it
|
||||||
|
|||||||
Generated
+1
-1
@@ -1 +1 @@
|
|||||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":3143874172491239000,"output_index":0}}],"nodes":[[10316247453530667000,{"inputs":[{"Node":{"node_id":9079109751490757000,"output_index":0}},{"Node":{"node_id":1250460246919467000,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::SourceNodeIdNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":false,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[7954638344846060000,{"inputs":[{"Node":{"node_id":5991296268862790000,"output_index":0}},{"Value":{"tagged_value":{"Fill":{"Solid":{"red":0.1875,"green":0.0,"blue":0.0,"alpha":0.203125}}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.19140625,"green":0.0,"blue":0.0,"alpha":0.203125}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"Gradient":{"stops":[[0.0,{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}],[1.0,{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0}]],"gradient_type":"Linear","start":[0.0,0.5],"end":[1.0,0.5]}},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[17021405646895729000,{"inputs":[{"Value":{"tagged_value":"None","exposed":false}},{"Value":{"tagged_value":{"GradientStops":[[0.0,{"red":1.0,"green":0.31764707,"blue":0.15686275,"alpha":1.0}],[0.5,{"red":1.0,"green":0.5686275,"blue":0.25490198,"alpha":1.0}],[1.0,{"red":1.0,"green":0.7294118,"blue":0.16078432,"alpha":1.0}]]},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_math_nodes::GradientValueNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[8366826746721323000,{"inputs":[{"Node":{"node_id":5591755359500854000,"output_index":0}},{"Node":{"node_id":13846904447064916285,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"imLine truncated
|
{"network_interface":{"network":{"exports":[{"Node":{"node_id":3143874172491239000,"output_index":0}}],"nodes":[[26023588519449590,{"inputs":[{"Node":{"node_id":4002029424845293600,"output_index":0}},{"Value":{"tagged_value":{"Color":{"red":0.94750905,"green":0.5567761,"blue":0.06654528,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"red":0.94750905,"green":0.5567761,"blue":0.06654528,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"GradientRamp":{"stops":{"color":[{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0,"linear":true},{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0,"linear":true}],"position":[0.0,1.0],"midpoint":[0.5,0.5]},"gradient_space":"RgbGamma"}},"exposed":false}},{"Value":{"tagged_value":{"GradientForm":"Linear"},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}},{"Value":{"tagged_value":{"DAffine2":[0.0,-92.53735521402166,92.53735521402166,0.0,9.606221358397944,-69.72678572415595]},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[213744308682803360,{"inputs":[{"Value":{"tagged_value":{"TypeDefault":{"List":{"Concrete":{"name":"graphic_types::graphic::Graphic"}}}},"exposed":true}},{"Node":{"node_id":10463288500489480000,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::AsGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::IntoGroupNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WriteAttributeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[5,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":4,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[366962978353611840,{"inputs":[{"Node":{"node_id":8366826746721323000,"output_index":0}},{"Value":{"tagged_value":{"BooleanOperation":"Union"},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"path_bool_nodes::BooleanOperationNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[799182088624980700,{"inputs":[{"Node":{"node_id":7386572856931342000,"output_index":0}},{"Value":{"tagged_value":{"Number":100.0},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"math_nodes::DivideNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1250460246919467000,{"inputs":[{"Node":{"node_id":4742778578215475000,"output_index":0}},{"Value":{"tagged_value":{"BooleanOperation":"Union"},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"path_bool_nodes::BooleanOperationNode"}},"visible":true,"skip_deduplicationLine truncated
|
||||||
Generated
+1
-1
@@ -1 +1 @@
|
|||||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":15709488322180832347,"output_index":0}}],"nodes":[[10507084483235320484,{"inputs":[{"Node":{"node_id":9157963288496356916,"output_index":0}},{"Node":{"node_id":1396768435017101055,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::SourceNodeIdNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4741515246389989284,{"inputs":[{"Node":{"node_id":14255588039347536657,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[-261.2435565297001,-70.0]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1.0,1.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64","alias":null}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4105329493214975815,{"inputs":[{"Node":{"node_id":12931264630175648107,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[-261.24355652969916,-70.0]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1.0,1.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Line truncated
|
{"network_interface":{"network":{"exports":[{"Node":{"node_id":15709488322180832347,"output_index":0}}],"nodes":[[57904581517036791,{"inputs":[{"Node":{"node_id":9393309733761233513,"output_index":0}},{"Node":{"node_id":15300421479077882117,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::AsGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::IntoGroupNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WriteAttributeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[5,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":4,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[70804263053697201,{"inputs":[{"Node":{"node_id":13942787566051910019,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[3.410605131648481e-13,3.410605131648481e-13]},"exposed":false}},{"Value":{"tagged_value":{"Number":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1268.999999999999,634.9999999999992]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"transform_nodes::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[194878846429432339,{"inputs":[{"Value":{"tagged_value":{"TypeDefault":{"Item":{"Concrete":{"name":"vector_types::vector::vector_types::Vector"}}}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2,3,4],"remove":[],"delta":[[1,[671.7691453623979,420.00000000000006]],[2,[559.8076211353317,450.0000000000001]],[3,[410.5255888325765,410.0]],[4,[522.4871130596428,380.00000000000006]]]},"segments":{"add":[1,2,3,4],"remove":[],"start_point":[[1,1],[2,2],[3,3],[4,4]],"end_point":[[1,2],[2,3],[3,4],[4,1]],"handle_primary":[[1,[0.0,0.0]],[2,[0.0,0.0]],[3,[0.0,0.0]],[4,[0.0,0.0]]],"handle_end":[[1,[0.0,0.0]],[2,[0.0,0.0]],[3,[0.0,0.0]],[4,[0.0,0.0]]]},"add_g1_continuous":[],"remove_g1_continuous":[]}},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"vector_types::vector::vector_modification::VectorModification"}},"import_index":1}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"vector_nodes::vector_modification_nodes::PathModifyNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplicLine truncated
|
||||||
Generated
+1
-1
@@ -1 +1 @@
|
|||||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":12241147352993594415,"output_index":0}}],"nodes":[[4388711862172196665,{"inputs":[],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_raster_nodes::std_nodes::MandelbrotNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"FOOTPRINT","inject":""}}],[3606681156406984991,{"inputs":[{"Node":{"node_id":6323350524796370485,"output_index":0}},{"Value":{"tagged_value":{"GradientStops":[[0.0,{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}],[0.3237704918032787,{"red":0.23828125,"green":0.0,"blue":0.08377075,"alpha":1.0}],[0.5655737704918032,{"red":0.92578125,"green":0.8676921,"blue":0.5569153,"alpha":1.0}],[0.8155737704918032,{"red":0.17333984,"green":0.625,"blue":0.625,"alpha":1.0}],[1.0,{"red":0.106292725,"green":0.3359375,"blue":0.3359375,"alpha":1.0}]]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_raster_nodes::gradient_map::GradientMapNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[6029481207635803402,{"inputs":[{"Node":{"node_id":4388711862172196665,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1000.0,1000.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64","alias":null}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[7624113397561636853,{"inputs":[{"Value":{"tagged_value":{"Graphic":{"element":[],"transform":[],"alpha_blending":[],"source_node_id":[]}},"exposed":true}},{"Node":{"node_id":3606681156406984991,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::SourceNodeIdNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProLine truncated
|
{"network_interface":{"network":{"exports":[{"Node":{"node_id":12241147352993594415,"output_index":0}}],"nodes":[[80924370013313595,{"inputs":[{"Node":{"node_id":6029481207635803402,"output_index":0}},{"Value":{"tagged_value":{"GradientRamp":{"stops":{"color":[{"red":0.06469504,"green":0.0,"blue":0.0755814,"alpha":1.0,"linear":true},{"red":0.016644126,"green":0.13212071,"blue":0.62523156,"alpha":1.0,"linear":true},{"red":1.0,"green":0.8708812,"blue":0.3485102,"alpha":1.0,"linear":true},{"red":0.30054384,"green":0.8468733,"blue":0.8468733,"alpha":0.01,"linear":true}],"position":[0.0,0.12704918032786883,0.5,1.0],"midpoint":[0.5,0.5,0.5,0.5]},"gradient_space":"RgbGamma"}},"exposed":false}},{"Value":{"tagged_value":{"Bool":false},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"raster_nodes::adjustments::GradientMapNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3606681156406984991,{"inputs":[{"Node":{"node_id":6323350524796370485,"output_index":0}},{"Value":{"tagged_value":{"GradientRamp":{"stops":{"color":[{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0,"linear":true},{"red":0.04631017,"green":0.0,"blue":0.0076861563,"alpha":1.0,"linear":true},{"red":0.83939683,"green":0.7249875,"blue":0.27055356,"alpha":1.0,"linear":true},{"red":0.025397457,"green":0.3485102,"blue":0.3485102,"alpha":1.0,"linear":true},{"red":0.01102731,"green":0.09231063,"blue":0.09231063,"alpha":1.0,"linear":true}],"position":[0.0,0.3237704918032787,0.5655737704918032,0.8155737704918032,1.0],"midpoint":[0.5,0.5,0.5,0.5,0.5]},"gradient_space":"RgbGamma"}},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"raster_nodes::adjustments::GradientMapNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4388711862172196665,{"inputs":[],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"raster_nodes::std_nodes::MandelbrotNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"FOOTPRINT","inject":""}}],[6029481207635803402,{"inputs":[{"Node":{"node_id":4388711862172196665,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Number":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1000.0,1000.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"transform_nodes::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[6323350524796370485,{"inputs":[{"Value":{"tagged_value":"None","exposed":false}},{"Value":{"tagged_value":{"Bool":false},"exposed":false}},{"Value":{"tagged_value":{"Integer":0},"exposed":false}},{"Value":{"tagged_value":{"Number":35.0},"exposed":false}},{"Value":{"tagged_value":{"NoiseType":"OpenSimplex2"},"exposed":false}},{"Value":{"tagged_value":{"DomainWarpType":"OpenSimplex2"},"exposed":false}},{"Value":{"tagged_value":{"Number":100.0},"exposed":false}},{"Value":{"tagged_value":{"FractalType":"PingPong"},"exposed":false}},{"Value":{"tagged_value":{"Integer":3},"exposed":false}},{"Value":{"tagged_value":{"Number":2.0},"exposed":false}},{"Value":{"tagged_value":{"Number":0.5},"exposed":false}},{"Value":{"tagged_value":{"Number":0.0},"exposed":false}},{"Value":{"tagged_value":{"Number":2.0},"exposed":false}},{"Value":{"tagged_value":{"CellularDistanceFunction":"Hybrid"},"exposed":false}},{"Value":{"tagged_value":{"CellularReturnType":"CellValue"},"exposed":false}},{"Value":{"tagged_value":{"Number":1.0},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"raster_nodes::std_nodes::NoisePatternNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"FOOTPRINT","inject":""}}],[6565638614909771142,{"inputs":[{"Node":{"node_id":7624113397561636853,"output_index":0}},{"Node":{"node_id":80924370013313595,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::AsGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"GeLine truncated
|
||||||
Generated
+1
-1
@@ -1 +1 @@
|
|||||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":392274448837115448,"output_index":0}}],"nodes":[[13353438235848911576,{"inputs":[{"Value":{"tagged_value":{"Vector":{"element":[{"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":0.0,"dash_lengths":[],"dash_offset":0.0,"cap":"Butt","join":"Miter","join_miter_limit":4.0,"align":"Center","transform":[1.0,0.0,0.0,1.0,0.0,0.0],"non_scaling":false,"paint_order":"StrokeAbove"},"fill":"None"},"colinear_manipulators":[],"point_domain":{"id":[],"position":[]},"segment_domain":{"id":[],"start_point":[],"end_point":[],"handles":[],"stroke":[]},"region_domain":{"id":[],"segment_range":[],"fill":[]},"upstream_nested_layers":null}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[6379137305818664393,18442321214082298093,18118267825025549699,6351696498298648253,17863574903157697896,4691860614575868200,301778328144628917,10625296323957562985,533731991408535384,13357220652574593654,15992617814592812350],"remove":[],"delta":[[533731991408535384,[501.6296296296296,175.40740740740742]],[17863574903157697896,[606.8148151308641,95.19407372365433]],[18118267825025549699,[642.0740740740741,0.0]],[18442321214082298093,[565.6296296296297,122.96296296296298]],[15992617814592812350,[621.0370370370368,0.0]],[13357220652574593654,[574.2222222222222,108.44444444444449]],[301778328144628917,[493.5149940383244,200.29629629629628]],[10625296323957562985,[473.4814814814815,272.5925925925926]],[4691860614575868200,[528.2962962962963,283.8518518518518]],[6351696498298648253,[646.8148148148149,0.0]],[6379137305818664393,[625.4814814814813,0.0]]]},"segments":{"add":[13662059715350867364,3384102572540409881,12035095010819582754,10146665273368938971,318560030360358929,8462655819889292900,3303411878775644985,8661113083384527971,2035327810332855521,11346538709718766144,3710133387837274291],"remove":[],"start_point":[[3303411878775644985,301778328144628917],[318560030360358929,17863574903157697896],[3384102572540409881,18442321214082298093],[12035095010819582754,18118267825025549699],[13662059715350867364,6379137305818664393],[11346538709718766144,13357220652574593654],[8462655819889292900,4691860614575868200],[2035327810332855521,533731991408535384],[3710133387837274291,15992617814592812350],[10146665273368938971,6351696498298648253],[8661113083384527971,10625296323957562985]],"end_point":[[8661113083384527971,533731991408535384],[12035095010819582754,6351696498298648253],[10146665273368938971,17863574903157697896],[2035327810332855521,13357220652574593654],[8462655819889292900,301778328144628917],[3384102572540409881,18118267825025549699],[3303411878775644985,10625296323957562985],[318560030360358929,4691860614575868200],[3710133387837274291,6379137305818664393],[13662059715350867364,18442321214082298093],[11346538709718766144,15992617814592812350]],"handle_primary":[[3384102572540409881,[0.0,0.0]],[8462655819889292900,[0.0,0.0]],[3710133387837274291,[0.0,0.0]],[12035095010819582754,[0.0,0.0]],[10146665273368938971,[0.0,0.0]],[2035327810332855521,[42.96296296296293,-41.7777777777778]],[3303411878775644985,[0.0,0.0]],[13662059715350867364,[0.0,0.0]],[8661113083384527971,[0.2962962962963047,0.2962962962963047]],[318560030360358929,[-46.95465552079859,46.40007297527743]],[11346538709718766144,[9.925839724176626,-9.951533978271286]]],"handle_end":[[318560030360358929,[-97.48148148148152,-81.18518518518522]],[13662059715350867364,[68.68148181185177,-54.8859262904691]],[11346538709718766144,[1.1377781018271662,63.71555518874077]],[3384102572540409881,[0.5807410754567854,77.36888852918523]],[2035327810332855521,[-8.299214014278164,8.32069754812484]],[8462655819889292900,[-21.74426522093495,47.99999999999997]],[3303411878775644985,[-6.2222222222222285,-40.59259259259261]],[3710133387837274291,[0.0,0.0]],[12035095010819582754,[0.0,0.0]],[8661113083384527971,[-42.34888386913234,41.180638796880466]],[10146665273368938971,[48.16592595101224,-47.597037061827145]]],"stroke":[[318560030360358929,0],[3303411878775644985,0],[8661113083384527971,0],[13662059715350867364,0],[12035095010819582754,0],[11346538709718766144,0],[8462655819889292900,0],[3710133387837274291,0],[10146665273368938971,0],[3384102572540409881,0],[2035327810332855521,0]]},"regions":{"add":[],"remove":[],"segment_range":[],"fill":[]},"add_g1_continuous":[[{"ty":"End","segment":10146665273368938971},{"ty":"Primary","segment":318560030360358929}],[{"ty":"End","segment":12035095010819582754},{"ty":"Primary","segment":10146665273368938971}],[{"ty":"Primary","segment":11346538709718766144},{"ty":"End","segment":2035327810332855521}],[{"ty":"End","segment":8661113083384527971},{"ty":"Primary","segment":2035327810332855521}]],"remove_g1_continuous":[]}},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":Line truncated
|
{"network_interface":{"network":{"exports":[{"Node":{"node_id":392274448837115448,"output_index":0}}],"nodes":[[57390435731316553,{"inputs":[{"Node":{"node_id":8460565235419043665,"output_index":0}},{"Node":{"node_id":13838011362258067867,"output_index":0}},{"Value":{"tagged_value":{"Number":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1.0,1.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"transform_nodes::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[140396870212231820,{"inputs":[{"Node":{"node_id":18095952297474762348,"output_index":0}},{"Value":{"tagged_value":{"BooleanOperation":"Intersect"},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"path_bool_nodes::BooleanOperationNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[294265135510952894,{"inputs":[{"Node":{"node_id":11264395591110193456,"output_index":0}},{"Value":{"tagged_value":{"Color":{"red":0.83076996,"green":0.32314324,"blue":0.027320892,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"red":0.6938719,"green":0.048171822,"blue":0.028426038,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"GradientRamp":{"stops":{"color":[{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0,"linear":true},{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0,"linear":true}],"position":[0.0,1.0],"midpoint":[0.5,0.5]},"gradient_space":"RgbGamma"}},"exposed":false}},{"Value":{"tagged_value":{"GradientForm":"Linear"},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}},{"Value":{"tagged_value":{"DAffine2":[20.0,0.0,0.0,20.0,-10.0,0.0]},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[392274448837115448,{"inputs":[{"Value":{"tagged_value":{"TypeDefault":{"List":{"Concrete":{"name":"graphic_types::artboard::Artboard"}}}},"exposed":true}},{"Node":{"node_id":6787585796949551500,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[1536.0,768.0]},"exposed":false}},{"Value":{"tagged_value":{"Color":{"red":0.8549927,"green":0.71569365,"blue":0.48514998,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Fn":[{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},{"Generic":"T"}]},"import_index":1}},{"Import":{"import_type":{"Item":{"Concrete":{"name":"graph_craft::document::value::TaggedValue"}}},"import_index":2}},{"Import":{"import_type":{"Item":{"Concrete":{"name":"graph_craft::document::value::TaggedValue"}}},"import_index":3}},{"Import":{"import_type":{"Item":{"Concrete":{"name":"graph_craft::document::value::TaggedValue"}}},"import_index":4}},{"Import":{"import_type":{"Item":{"Concrete":{"name":"graph_craft::document::value::TaggedValue"}}},"import_index":5}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::artboard::CreateArtboardNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":1,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WriteAttributeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Import":{"import_type":{"Fn":[{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},{"List":{"Concrete":{"nameLine truncated
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":4445985685181725042,"output_index":0}}],"nodes":[[17154757625902243313,{"inputs":[{"Value":{"tagged_value":"None","exposed":true}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.23529412,"green":0.23529412,"blue":0.24313726,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"F64":1670.79570439},"exposed":false}},{"Value":{"tagged_value":{"F64":24.0},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":2288754089236120499,"output_index":0}}],"nodes":[[11731553664207576737,{"inputs":[{"Node":{"node_id":757876048866560520,"output_index":0}},{"Value":{"tagged_value":{"F64":48.900000000000006},"exposed":false}},{"Node":{"node_id":7828034197076821310,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::JitterPointsNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[14158287945315818946,{"inputs":[{"Node":{"node_id":16943732999059587742,"output_index":0}},{"Node":{"node_id":14577956936089455769,"output_index":0}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.6181095265062186,3.496297826945966]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64","alias":null}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2288754089236120499,{"inputs":[{"Node":{"node_id":14158287945315818946,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::SplineNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[7828034197076821310,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":3}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_math_nodes::ToU32Node"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[640915213983348287,{"inputs":[{"Value":{"tagged_value":"None","exposed":false}},{"Value":{"tagged_value":{"F64":4000.0},"exposed":false}},{"Value":{"tagged_value":{"F64":500.0},"exposed":false}},{"Value":{"tagged_value":{"Bool":false},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::generator_nodes::RectangleNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1791308547102433540,{"inputs":[{"Node":{"node_id":640915213983348287,"output_index":0}},{"Import":{"import_type":{"Generic":"T"},"import_index":1}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.99607843,"green":0.827451,"blue":0.65882355,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"Gradient":{"stops":[[0.0,{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}],[1.0,{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0}]],"gradient_type":"Linear","start":Line truncated
|
{"network_interface":{"network":{"exports":[{"Node":{"node_id":4445985685181725042,"output_index":0}}],"nodes":[[239716716021064150,{"inputs":[{"Value":{"tagged_value":{"TypeDefault":{"List":{"Concrete":{"name":"graphic_types::graphic::Graphic"}}}},"exposed":true}},{"Node":{"node_id":7711570794020903773,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::AsGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::IntoGroupNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WriteAttributeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[5,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":4,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1801066723091712434,{"inputs":[{"Value":{"tagged_value":"None","exposed":true}},{"Value":{"tagged_value":{"Color":{"red":0.036889445,"green":0.038204364,"blue":0.043735027,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"Number":1744.31393592},"exposed":false}},{"Value":{"tagged_value":{"Number":63.0},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":2288754089236120499,"output_index":0}}],"nodes":[[640915213983348287,{"inputs":[{"Value":{"tagged_value":"None","exposed":false}},{"Value":{"tagged_value":{"Number":4000.0},"exposed":false}},{"Value":{"tagged_value":{"Number":500.0},"exposed":false}},{"Value":{"tagged_value":{"BoxCorners":[0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}},{"Value":{"tagged_value":{"Bool":false},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"vector_nodes::generator_nodes::RectangleNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1791308547102433540,{"inputs":[{"Node":{"node_id":640915213983348287,"output_index":0}},{"Import":{"import_type":{"Generic":"T"},"import_index":1}},{"Value":{"tagged_value":{"Color":{"red":0.9911022,"green":0.6514057,"blue":0.39157256,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"GradientRamp":{"stops":{"color":[{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0,"linear":true},{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0,"linear":true}],"position":[0.0,1.0],"midpoint":[0.5,0.5]},"gradient_space":"RgbGamma"}},"exposed":false}},{"Value":{"tagged_value":{"GradientForm":"Linear"},"exposed":false}},{"Value":{"tagged_value":{"Bool":false},"exposed":false}},{"Value":{"tagged_value":{"DAffine2":[1.0,0.0,0.0,1.0,0.0,0.0]},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2288754089236120499,{"inputs":[{"Node":{"node_id":1415828794531Line truncated
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":14972365039974885000,"output_index":0}}],"nodes":[[183562335973647870,{"inputs":[{"Node":{"node_id":4248875763694880300,"output_index":0}},{"Node":{"node_id":2181148486404191200,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":4,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ToGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::SourceNodeIdNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::graphic::WrapGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[665049002420596400,{"inputs":[{"Value":{"tagged_value":{"Vector":{"element":[{"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":0.0,"dash_lengths":[],"dash_offset":0.0,"cap":"Butt","join":"Miter","join_miter_limit":4.0,"align":"Center","transform":[1.0,0.0,0.0,1.0,0.0,0.0],"non_scaling":false,"paint_order":"StrokeAbove"},"fill":"None"},"colinear_manipulators":[],"point_domain":{"id":[],"position":[]},"segment_domain":{"id":[],"start_point":[],"end_point":[],"handles":[],"stroke":[]},"region_domain":{"id":[],"segment_range":[],"fill":[]},"upstream_nested_layers":null}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34],"remove":[],"delta":[[18,[145.77777777777777,-97.7777777777778]],[15,[111.11111111111114,-60.888888888888914]],[32,[9.333333333333314,38.66666666666663]],[27,[-11.111111111111144,-72.00000000000003]],[17,[123.99999999999994,-84.00000000000003]],[29,[-32.888888888888914,-14.666666666666686]],[30,[-9.333333333333371,0.0]],[14,[183.11111111111103,-19.111111111111143]],[19,[90.66666666666664,-129.33333333333334]],[1,[-103.55555555555554,126.66666666666664]],[25,[0.8888888888888573,-94.66666666666669]],[33,[-78.22222222222223,75.55555555555554]],[5,[66.22222222222223,152.88888888888886]],[3,[45.77777777777777,145.33333333333331]],[23,[19.555555555555543,-139.55555555555557]],[26,[22.66666666666663,-81.33333333333337]],[34,[-5.333333333333371,99.11111111111109]],[13,[153.77777777777777,-1.3333333333333712]],[8,[252.4444444444444,124.88888888888886]],[31,[-53.33333333333337,13.777777777777771]],[10,[216.4444444444444,72.4444444444444]],[12,[199.5555555555555,10.666666666666629]],[6,[123.99999999999994,148.4444444444444]],[24,[57.77777777777777,-129.33333333333334]],[7,[229.33333333333331,152.4444444444444]],[11,[136.88888888888886,39.111111111111086]],[20,[128.4444444444444,-142.22222222222223]],[28,[39.111111111111086,-58.22222222222226]],[4,[18.66666666666663,157.77777777777771]],[22,[71.11111111111109,-201.7777777777778]],[9,[156.4444444444444,97.33333333333331]],[21,[76.0,-202.22222222222223]],[16,[159.5555555555555,-75.55555555555557]],[2,[-67.55555555555554,158.22222222222217]]]},"segments":{"add":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34],"remove":[],"start_point":[[16,16],[29,29],[7,7],[14,14],[22,22],[20,20],[24,24],[25,25],[32,32],[23,23],[33,33],[26,26],[2,2],[13,13],[18,18],[8,8],Line truncated
|
{"network_interface":{"network":{"exports":[{"Node":{"node_id":14972365039974885000,"output_index":0}}],"nodes":[[169695252050218443,{"inputs":[{"Node":{"node_id":13907401402762847509,"output_index":0}},{"Value":{"tagged_value":{"GradientRamp":{"stops":{"color":[{"red":1.0,"green":1.0,"blue":1.0,"alpha":0.75,"linear":true},{"red":1.0,"green":1.0,"blue":1.0,"alpha":0.01,"linear":true}],"position":[0.0,1.0],"midpoint":[0.5,0.5]},"gradient_space":"RgbGamma"}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"GradientRamp":{"stops":{"color":[{"red":1.0,"green":1.0,"blue":1.0,"alpha":0.7734375,"linear":true},{"red":1.0,"green":1.0,"blue":1.0,"alpha":0.01,"linear":true}],"position":[0.0,1.0],"midpoint":[0.5,0.5]},"gradient_space":"RgbGamma"}},"exposed":false}},{"Value":{"tagged_value":{"GradientForm":"Radial"},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}},{"Value":{"tagged_value":{"DAffine2":[31.55635094002563,-2.7755575615628914e-17,2.7755575615628914e-17,31.55635094002563,-0.225779263556106,34.981204988590605]},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[183562335973647870,{"inputs":[{"Node":{"node_id":4248875763694880300,"output_index":0}},{"Node":{"node_id":2181148486404191200,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::AsGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::IntoGroupNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WriteAttributeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[5,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":4,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[655907162126315400,{"inputs":[{"Value":{"tagged_value":{"TypeDefault":{"Item":{"Concrete":{"name":"vector_types::vector::vector_types::Vector"}}}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2,3,4,5,6,7,8,9,10,11],"remove":[],"delta":[[1,[416.0,270.9999999999999]],[2,[587.0,291.9999999999999]],[3,[373.0,372.9999999999999]],[4,[484.0,446.9999999999999]],[5,[639.0,438.9999999999999]],[6,[495.0,533.9999999999999]],[7,[304.0,611.9999999999999]],[8,[475.0,671.9999999999999]],[9,[750.0,703.9999999999999]],[10,[455.0,824.9999999999999]],[11,[186.0,824.9999999999999]]]},"segments":{"add":[1,2,3,4,5,6,7,8,9,10],"remove":[],"start_point":[[1,1],[2,2],[3,3],[4,4],[5,5],[6,6],[7,7],[8,8],[9,9],[10,10]],"end_point":[[1,2],[2,3],[3,4],[4,5],[5,6],[6,7],[7,8],[8,9],[9,10],[10,11]],"handle_primary":[[1,[0.0,0.0]],[2,[0.0,0.0]],[3,[0.0,0.0]],[4,[0.0,0.0]],[5,[0.0,0.0]],[6,[0.0,0.0]],[7,[0.0,0.0]],[8,[0.0,0.0]],[9,[0.0,0.0]],[10,[0.0,0.0]]],"handle_end":Line truncated
|
||||||
Generated
+1
-1
@@ -1 +1 @@
|
|||||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":2394762731964337494,"output_index":0}}],"nodes":[[10127467043900015225,{"inputs":[{"Value":{"tagged_value":{"Vector":{"element":[{"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":0.0,"dash_lengths":[],"dash_offset":0.0,"cap":"Butt","join":"Miter","join_miter_limit":4.0,"align":"Center","transform":[1.0,0.0,0.0,1.0,0.0,0.0],"non_scaling":false,"paint_order":"StrokeAbove"},"fill":"None"},"colinear_manipulators":[],"point_domain":{"id":[],"position":[]},"segment_domain":{"id":[],"start_point":[],"end_point":[],"handles":[],"stroke":[]},"region_domain":{"id":[],"segment_range":[],"fill":[]},"upstream_nested_layers":null}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2],"remove":[],"delta":[[2,[644.0,726.6666666666666]],[1,[258.00000000000006,994.6666666666664]]]},"segments":{"add":[1],"remove":[],"start_point":[[1,1]],"end_point":[[1,2]],"handle_primary":[[1,[0.0,0.0]]],"handle_end":[[1,[-328.66666666666674,129.33333333333337]]],"stroke":[[1,0]]},"regions":{"add":[],"remove":[],"segment_range":[],"fill":[]},"add_g1_continuous":[],"remove_g1_continuous":[]}},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Concrete":{"name":"graphene_core::table::Table<graphene_core::vector::vector_types::Vector>","alias":null}},"import_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"graphene_core::vector::vector_modification::VectorModification","alias":null}},"import_index":1}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::vector::vector_modification::PathModifyNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[15961046538654083626,{"inputs":[{"Node":{"node_id":1889157037801767612,"output_index":0}},{"Node":{"node_id":4332145463108161926,"output_index":0}},{"Value":{"tagged_value":{"F64":0.5},"exposed":false}},{"Value":{"tagged_value":{"F64":10.0},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"U32":0},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"U32":0},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::CopyToPointsNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[17378885078543074499,{"inputs":[{"Value":{"tagged_value":{"Vector":{"element":[{"style":{"stroke":{"color":{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0},"weight":0.0,"dash_lengths":[],"dash_offset":0.0,"cap":"Butt","join":"Miter","join_miter_limit":4.0,"align":"Center","transform":[1.0,0.0,0.0,1.0,0.0,0.0],"non_scaling":false,"paint_order":"StrokeAbove"},"fill":"None"},"colinear_manipulators":[],"point_domain":{"id":[],"position":[]},"segment_domain":{"id":[],"start_point":[],"end_point":[],"handles":[],"stroke":[]},"region_domain":{"id":[],"segment_range":[],"fill":[]},"upstream_nested_layers":null}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2,3,4,5,6,7,8],"remove":[],"delta":[[7,[727.5555555555554,1026.6666666666663]],[3,[707.5,1026.5]],[5,[740.4444444444443,857.1111111111111]],[1,[823.2222222222221,660.4444444444445]],[8,[746.0000000000001,842.9999999999999]],[6,[725.7777777777779,1026.370370370371]],[4,[709.5555555555554,1026.6666666666667]],[2,[745.5,826.0]]]},"segments":{"add":[1,2,3,4,5,6,7,8],"remove":[],"start_point":[[8,8],[5,5],[1,1],[7,7],[2,2],[3,3],[6,6],[4,4]],"end_point":[[6,7],[7,8],[4,5],[5,6],[3,4],[1,2],[8,1],[2,3]],"handle_primary":[[3,[0.0,0.0]],[2,[-24.5,85.0]],[5,[0.0,0.0]],[4,[0.0,0.0]],[1,[0.0,0.0]],[6,[0.0,0.0]],[7,[0.0,0.0]],[8,[17.33333333333337,-84.99999999999989]]],"handle_end":[[8,[1.772016460905547,0.9591220850479658]],[2,[0.0,0.0]],[3,[0.0,0.0]],[7,[-26.8034437596026,131.4399645903585]],[5,[-7.555555555555884,-59.25925925925992]],[1,[24.5,-85.0]],[6,[0.0,0.0]],[4,[-23.11111111111109,90.44444444444456]]],"stroke":[[1,0],[7,0],[3,0],[8,0Line truncated
|
{"network_interface":{"network":{"exports":[{"Node":{"node_id":2394762731964337494,"output_index":0}}],"nodes":[[1378578509112405,{"inputs":[{"Value":{"tagged_value":{"TypeDefault":{"Item":{"Concrete":{"name":"vector_types::vector::vector_types::Vector"}}}},"exposed":true}},{"Value":{"tagged_value":{"VectorModification":{"points":{"add":[1,2,3,4,5],"remove":[],"delta":[[1,[602.6886145404666,50.91906721536352]],[2,[599.5281207133061,50.3923182441701]],[3,[590.4855967078191,66.80932784636488]],[4,[594.6410608139003,75.57872275567746]],[5,[593.3924706599604,60.59564090839812]]]},"segments":{"add":[1,2,3,4,5],"remove":[],"start_point":[[1,1],[2,2],[3,3],[4,4],[5,5]],"end_point":[[1,2],[2,3],[3,4],[4,5],[5,1]],"handle_primary":[[1,[0.0,0.0]],[2,[-1.843621399176982,0.5267489711934203]],[3,[1.9314128943758533,7.3257125438195345]],[4,[0.0,0.0]],[5,[1.248590153939972,-3.9798811156835896]]],"handle_end":[[1,[1.843621399176982,-0.5267489711934203]],[2,[-2.7532629181224593,-10.4429315732828]],[3,[0.0,0.0]],[4,[-1.704168058538812,5.432035686592322]],[5,[-4.379820149367788,0.9754610577655498]]]},"add_g1_continuous":[],"remove_g1_continuous":[]}},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"vector_types::vector::vector_modification::VectorModification"}},"import_index":1}},{"Reflection":"DocumentNodePath"}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"vector_nodes::vector_modification_nodes::PathModifyNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[172538270105470471,{"inputs":[{"Node":{"node_id":9276497172451351253,"output_index":0}},{"Value":{"tagged_value":{"Color":{"red":0.78353786,"green":0.6038274,"blue":0.33245158,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"red":0.78353786,"green":0.6038274,"blue":0.33245158,"alpha":1.0,"linear":true}},"exposed":false}},{"Value":{"tagged_value":{"GradientRamp":{"stops":{"color":[{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0,"linear":true},{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0,"linear":true}],"position":[0.0,1.0],"midpoint":[0.5,0.5]},"gradient_space":"RgbGamma"}},"exposed":false}},{"Value":{"tagged_value":{"GradientForm":"Linear"},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}},{"Value":{"tagged_value":{"DAffine2":[2.170365521878466,0.0,0.0,2.170365521878466,604.9565968314213,108.54930650815425]},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[314278016428495768,{"inputs":[{"Node":{"node_id":6282972142629473139,"output_index":0}},{"Node":{"node_id":5020096817747898028,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::AsGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::IntoGroupNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpLine truncated
|
||||||
Generated
+1
-1
@@ -1 +1 @@
|
|||||||
{"network_interface":{"network":{"exports":[{"Node":{"node_id":16815500381887058038,"output_index":0}}],"nodes":[[202,{"inputs":[{"Node":{"node_id":206,"output_index":0}},{"Value":{"tagged_value":{"Fill":{"Solid":{"red":0.5058824,"green":0.26666668,"blue":0.20392157,"alpha":1.0}}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.5058824,"green":0.26666668,"blue":0.20392157,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"Gradient":{"stops":[[0.0,{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}],[1.0,{"red":1.0,"green":1.0,"blue":1.0,"alpha":1.0}]],"gradient_type":"Linear","start":[0.0,0.5],"end":[1.0,0.5]}},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::FillNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[404,{"inputs":[{"Node":{"node_id":402,"output_index":0}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.24313726,"green":0.18431373,"blue":0.19215687,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"F64":2.0},"exposed":false}},{"Value":{"tagged_value":{"StrokeAlign":"Center"},"exposed":false}},{"Value":{"tagged_value":{"StrokeCap":"Butt"},"exposed":false}},{"Value":{"tagged_value":{"StrokeJoin":"Miter"},"exposed":false}},{"Value":{"tagged_value":{"F64":4.0},"exposed":false}},{"Value":{"tagged_value":{"PaintOrder":"StrokeAbove"},"exposed":false}},{"Value":{"tagged_value":{"VecF64":[]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::vector::StrokeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[93,{"inputs":[{"Node":{"node_id":94,"output_index":0}},{"Value":{"tagged_value":{"DVec2":[851.1666666666667,668.5377104806669]},"exposed":false}},{"Value":{"tagged_value":{"F64":0.0},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[39.677869315599935,39.67786931560005]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"DVec2":[0.0,0.0]},"exposed":false}},{"Value":{"tagged_value":{"Bool":true},"exposed":false}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":1,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":1}},{"Import":{"import_type":{"Concrete":{"name":"f64","alias":null}},"import_index":2}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":3}},{"Import":{"import_type":{"Concrete":{"name":"glam::f64::dvec2::DVec2","alias":null}},"import_index":4}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<graphene_core::context::OwnedContextImpl>>","alias":null}},"implementation":{"ProtoNode":{"name":"graphene_core::transform_nodes::TransformNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[155,{"inputs":[{"Node":{"node_id":159,"output_index":0}},{"Value":{"tagged_value":{"Fill":{"Gradient":{"stops":[[0.0,{"red":0.7529412,"green":0.34117648,"blue":0.2,"alpha":1.0}],[1.0,{"red":0.6431373,"green":0.31764707,"blue":0.21176471,"alpha":1.0}]],"gradient_type":"Linear","start":[0.9001916129448388,0.7881778212017586],"end":[0.8902470335613286,0.6662432828529555]}}},"exposed":false}},{"Value":{"tagged_value":{"Color":{"element":[{"red":0.0,"green":0.0,"blue":0.0,"alpha":1.0}],"transform":[[1.0,0.0,0.0,1.0,0.0,0.0]],"alpha_blending":[{"blend_mode":"Normal","opacity":1.0,"fill":1.0,"clip":false}],"source_node_id":[null]}},"exposed":false}},{"Value":{"tagged_value":{"Gradient":{"stops":[[0.0,{"red":0.7529412,"green":0.34117648,"blue":0.2,"alpha":1.0}],[1.0,{"red":0.6431373,"green":0.31764707,"blue":0.21176471,"alpha":1.0}]],"gradient_type":"Linear","start":[0.9001916129448388,0.7881778212017586],"end":[0.8902470335613286,0.6662432828529555]}},"exposed":false}}],"call_argument":{"ConcretLine truncated
|
{"network_interface":{"network":{"exports":[{"Node":{"node_id":16815500381887058038,"output_index":0}}],"nodes":[[74,{"inputs":[{"Node":{"node_id":75,"output_index":0}},{"Node":{"node_id":81,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::AsGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::IntoGroupNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WriteAttributeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[5,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":4,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_injections":[]}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[75,{"inputs":[{"Node":{"node_id":76,"output_index":0}},{"Node":{"node_id":161,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"Network":{"exports":[{"Node":{"node_id":5,"output_index":0}}],"nodes":[[0,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::AsGraphicNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[1,{"inputs":[{"Import":{"import_type":{"Generic":"T"},"import_index":1}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::IntoGroupNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[2,{"inputs":[{"Reflection":"DocumentNodePath"}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::PathOfSubgraphNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[3,{"inputs":[{"Node":{"node_id":1,"output_index":0}},{"Value":{"tagged_value":{"String":"editor:layer_path"},"exposed":false}},{"Node":{"node_id":2,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::WriteAttributeNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}],[4,{"inputs":[{"Node":{"node_id":3,"output_index":0}}],"call_argument":{"Concrete":{"name":"core::option::Option<alloc::sync::Arc<core_types::context::OwnedContextImpl>>"}},"implementation":{"ProtoNode":{"name":"graphene_core::memo::MonitorNode"}},"visible":true,"skip_deduplication":true,"context_features":{"extract":"","inject":""}}],[5,{"inputs":[{"Node":{"node_id":0,"output_index":0}},{"Node":{"node_id":4,"output_index":0}}],"call_argument":{"Generic":"T"},"implementation":{"ProtoNode":{"name":"graphic_nodes::graphic::ExtendNode"}},"visible":true,"skip_deduplication":false,"context_features":{"extract":"","inject":""}}]],"scope_Line truncated
|
||||||
@@ -39,9 +39,10 @@ db-urls = ["https://github.com/rustsec/advisory-db"]
|
|||||||
# A list of advisory IDs to ignore. Note that ignored advisories will still
|
# A list of advisory IDs to ignore. Note that ignored advisories will still
|
||||||
# output a note when they are encountered.
|
# output a note when they are encountered.
|
||||||
ignore = [
|
ignore = [
|
||||||
"RUSTSEC-2024-0370", # Unmaintained but still fully functional crate `proc-macro-error`
|
"RUSTSEC-2024-0388", # Unmaintained `derivative`, used directly by graphite-editor and graphite-desktop
|
||||||
"RUSTSEC-2024-0388", # Unmaintained but still fully functional crate `derivative`
|
"RUSTSEC-2024-0436", # Unmaintained `paste`, pulled in by dependencies `metal` and `wgpu-hal`
|
||||||
"RUSTSEC-2024-0436", # Unmaintained but still fully functional crate `paste`
|
"RUSTSEC-2025-0134", # Unmaintained `rustls-pemfile`, pulled in by build dependency `download-cef`
|
||||||
|
"RUSTSEC-2025-0141", # Unmaintained `bincode`, pulled in by dev dependency `gungraun`
|
||||||
]
|
]
|
||||||
# Threshold for security vulnerabilities, any vulnerability with a CVSS score
|
# Threshold for security vulnerabilities, any vulnerability with a CVSS score
|
||||||
# lower than the range specified will be ignored. Note that ignored advisories
|
# lower than the range specified will be ignored. Note that ignored advisories
|
||||||
@@ -62,6 +63,7 @@ ignore = [
|
|||||||
# [possible values: any SPDX 3.11 short identifier (+ optional exception)].
|
# [possible values: any SPDX 3.11 short identifier (+ optional exception)].
|
||||||
#
|
#
|
||||||
allow = [
|
allow = [
|
||||||
|
"0BSD", # Keep this list in sync with those in `/about.toml`
|
||||||
"Apache-2.0 WITH LLVM-exception", # Keep this list in sync with those in `/about.toml`
|
"Apache-2.0 WITH LLVM-exception", # Keep this list in sync with those in `/about.toml`
|
||||||
"Apache-2.0", # Keep this list in sync with those in `/about.toml`
|
"Apache-2.0", # Keep this list in sync with those in `/about.toml`
|
||||||
"BSD-2-Clause", # Keep this list in sync with those in `/about.toml`
|
"BSD-2-Clause", # Keep this list in sync with those in `/about.toml`
|
||||||
@@ -185,7 +187,7 @@ allow-git = []
|
|||||||
|
|
||||||
[sources.allow-org]
|
[sources.allow-org]
|
||||||
# 1 or more github.com organizations to allow git sources for
|
# 1 or more github.com organizations to allow git sources for
|
||||||
github = ["linebender", "Rust-GPU", "specta-rs"]
|
github = ["linebender", "Rust-GPU"]
|
||||||
# 1 or more gitlab.com organizations to allow git sources for
|
# 1 or more gitlab.com organizations to allow git sources for
|
||||||
#gitlab = [""]
|
#gitlab = [""]
|
||||||
# 1 or more bitbucket.org organizations to allow git sources for
|
# 1 or more bitbucket.org organizations to allow git sources for
|
||||||
|
|||||||
+39
-35
@@ -1,36 +1,43 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "graphite-desktop"
|
name = "graphite-desktop"
|
||||||
version = "0.1.0"
|
|
||||||
description = "Graphite Desktop"
|
description = "Graphite Desktop"
|
||||||
authors = ["Graphite Authors <[email protected]>"]
|
version.workspace = true
|
||||||
license = "Apache-2.0"
|
license.workspace = true
|
||||||
repository = ""
|
authors.workspace = true
|
||||||
edition = "2024"
|
edition.workspace = true
|
||||||
rust-version = "1.87"
|
repository.workspace = true
|
||||||
|
readme.workspace = true
|
||||||
|
homepage.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
publish.workspace = true
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
workspace = true
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "graphite"
|
||||||
|
path = "src/main.rs"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["recommended", "embedded_resources"]
|
default = ["recommended", "embedded_resources"]
|
||||||
recommended = ["gpu", "accelerated_paint"]
|
recommended = ["gpu", "accelerated_paint"]
|
||||||
embedded_resources = ["dep:graphite-desktop-embedded-resources"]
|
embedded_resources = ["graphite-desktop-ui/embedded_resources"]
|
||||||
gpu = ["graphite-desktop-wrapper/gpu"]
|
gpu = ["graphite-desktop-wrapper/gpu"]
|
||||||
|
accelerated_paint = ["graphite-desktop-ui/accelerated_paint"]
|
||||||
# Hardware acceleration features
|
|
||||||
accelerated_paint = ["accelerated_paint_dmabuf", "accelerated_paint_d3d11", "accelerated_paint_iosurface"]
|
|
||||||
accelerated_paint_dmabuf = ["libc", "ash"]
|
|
||||||
accelerated_paint_d3d11 = ["windows", "ash"]
|
|
||||||
accelerated_paint_iosurface = ["metal", "objc", "core-foundation"]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
# Local dependencies
|
# Local dependencies
|
||||||
graphite-desktop-wrapper = { path = "wrapper" }
|
graphite-desktop-wrapper = { path = "wrapper" }
|
||||||
graphite-desktop-embedded-resources = { path = "embedded-resources", optional = true }
|
graphite-desktop-ui = { path = "ui" }
|
||||||
|
|
||||||
wgpu = { workspace = true }
|
wgpu = { workspace = true }
|
||||||
winit = { workspace = true, features = [ "wayland-csd-adwaita-notitlebar", "serde" ] }
|
winit = { workspace = true, features = [
|
||||||
|
"wayland-csd-adwaita-notitlebar",
|
||||||
|
"serde",
|
||||||
|
] }
|
||||||
thiserror = { workspace = true }
|
thiserror = { workspace = true }
|
||||||
futures = { workspace = true }
|
futures = { workspace = true }
|
||||||
cef = { workspace = true }
|
tokio = { workspace = true }
|
||||||
cef-dll-sys = { workspace = true }
|
|
||||||
tracing-subscriber = { workspace = true }
|
tracing-subscriber = { workspace = true }
|
||||||
tracing = { workspace = true }
|
tracing = { workspace = true }
|
||||||
dirs = { workspace = true }
|
dirs = { workspace = true }
|
||||||
@@ -41,36 +48,33 @@ vello = { workspace = true }
|
|||||||
derivative = { workspace = true }
|
derivative = { workspace = true }
|
||||||
rfd = { workspace = true }
|
rfd = { workspace = true }
|
||||||
open = { workspace = true }
|
open = { workspace = true }
|
||||||
rand = { workspace = true, features = ["thread_rng"] }
|
lzma-rust2 = { workspace = true }
|
||||||
serde = { workspace = true }
|
serde = { workspace = true }
|
||||||
|
url = { workspace = true }
|
||||||
|
rand = { workspace = true, features = ["thread_rng"] }
|
||||||
clap = { workspace = true, features = ["derive"] }
|
clap = { workspace = true, features = ["derive"] }
|
||||||
|
interprocess = "2.4.2"
|
||||||
# Hardware acceleration dependencies
|
fd-lock = "4.0.4"
|
||||||
ash = { version = "0.38", optional = true }
|
ctrlc = "3.5.1"
|
||||||
|
|
||||||
# Windows-specific dependencies
|
# Windows-specific dependencies
|
||||||
[target.'cfg(target_os = "windows")'.dependencies]
|
[target.'cfg(target_os = "windows")'.dependencies]
|
||||||
windows = { version = "0.58.0", features = [
|
windows = { version = "0.62.2", features = [
|
||||||
"Win32_Foundation",
|
"Win32_Foundation",
|
||||||
"Win32_Graphics_Direct3D11",
|
|
||||||
"Win32_Graphics_Direct3D12",
|
|
||||||
"Win32_Graphics_Dxgi",
|
|
||||||
"Win32_Graphics_Dxgi_Common",
|
|
||||||
"Win32_Graphics_Dwm",
|
"Win32_Graphics_Dwm",
|
||||||
"Win32_Graphics_Gdi",
|
"Win32_Graphics_Gdi",
|
||||||
"Win32_System_LibraryLoader",
|
"Win32_System_LibraryLoader",
|
||||||
|
"Win32_System_Com",
|
||||||
|
"Win32_System_Console",
|
||||||
"Win32_UI_Controls",
|
"Win32_UI_Controls",
|
||||||
"Win32_UI_WindowsAndMessaging",
|
"Win32_UI_WindowsAndMessaging",
|
||||||
"Win32_UI_HiDpi",
|
"Win32_UI_HiDpi",
|
||||||
], optional = true }
|
"Win32_UI_Shell",
|
||||||
|
] }
|
||||||
|
|
||||||
# macOS-specific dependencies
|
# macOS-specific dependencies
|
||||||
[target.'cfg(target_os = "macos")'.dependencies]
|
[target.'cfg(target_os = "macos")'.dependencies]
|
||||||
muda = { git = "https://github.com/tauri-apps/muda.git", rev = "3f460b8fbaed59cda6d95ceea6904f000f093f15", default-features = false }
|
objc2 = { version = "0.6.1", default-features = false }
|
||||||
metal = { version = "0.31.0", optional = true }
|
objc2-foundation = { version = "0.3.2", default-features = false }
|
||||||
objc = { version = "0.2", optional = true }
|
objc2-app-kit = { version = "0.3.2", default-features = false }
|
||||||
core-foundation = { version = "0.10", optional = true }
|
muda = { git = "https://github.com/timon-schelling/muda.git", rev = "e5bc28bbd6781b18afbfc237981f9ef47eddf863", default-features = false }
|
||||||
|
|
||||||
# Linux-specific dependencies
|
|
||||||
[target.'cfg(target_os = "linux")'.dependencies]
|
|
||||||
libc = { version = "0.2", optional = true }
|
|
||||||
+3
-3
@@ -2,10 +2,10 @@
|
|||||||
Name=Graphite
|
Name=Graphite
|
||||||
GenericName=Vector & Raster Graphics Editor
|
GenericName=Vector & Raster Graphics Editor
|
||||||
Comment=Open-source vector & raster graphics editor. Featuring node based procedural nondestructive editing workflow.
|
Comment=Open-source vector & raster graphics editor. Featuring node based procedural nondestructive editing workflow.
|
||||||
Exec=graphite-editor
|
Exec=graphite
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Type=Application
|
Type=Application
|
||||||
Icon=graphite-icon-color
|
Icon=art.graphite.Graphite
|
||||||
Categories=Graphics;VectorGraphics;RasterGraphics;
|
Categories=Graphics;VectorGraphics;RasterGraphics;
|
||||||
Keywords=graphite;editor;vector;raster;procedural;design;
|
Keywords=graphite;editor;vector;raster;procedural;design;
|
||||||
StartupWMClass=rs.graphite.GraphiteEditor
|
StartupWMClass=art.graphite.Graphite
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 310 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 84 KiB |
@@ -1,9 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="1024" height="1024">
|
|
||||||
<path fill="#ffffff" d="M.0007 659.5456c.0027 11.3936.0161 22.786.0834 34.1805.069 11.996.207 23.99.533 35.983.708 26.133 2.246 52.494 6.892 78.337 4.712 26.218 12.404 50.618 24.528 74.438 11.918 23.413 27.489 44.837 46.066 63.413 18.576 18.577 40.001 34.149 63.413 46.066 23.82 12.125 48.22 19.816 74.438 24.529 25.843 4.645 52.204 6.183 78.337 6.892 11.993.325 23.987.463 35.983.532 14.243.084 28.483.084 42.726.084h278c14.243 0 28.483 0 42.726-.084 11.996-.069 23.99-.207 35.983-.532 26.134-.709 52.494-2.247 78.338-6.892 26.217-4.713 50.617-12.404 74.437-24.529 23.413-11.917 44.837-27.489 63.414-46.066 18.576-18.576 34.148-40 46.065-63.413 12.125-23.82 19.816-48.22 24.529-74.438 4.645-25.843 6.183-52.204 6.892-78.337.325-11.993.463-23.987.532-35.983.084-14.243.084-28.483.084-42.726V373c0-14.243 0-28.483-.084-42.726-.069-11.996-.207-23.99-.532-35.983-.709-26.133-2.247-52.494-6.892-78.337-4.713-26.218-12.404-50.618-24.529-74.438-11.917-23.412-27.489-44.837-46.065-63.413-18.577-18.577-40.001-34.149-63.414-46.066-23.82-12.124-48.22-19.816-74.437-24.528-25.844-4.646-52.204-6.184-78.338-6.893-11.993-.325-23.987-.463-35.983-.532C679.483 0 665.243 0 651 0c0 0-275.1519-.002-286.5455.0007-11.3936.0027-22.7861.0161-34.1805.0834-11.996.069-23.99.207-35.983.532-26.133.709-52.494 2.247-78.337 6.893-26.218 4.712-50.618 12.404-74.438 24.528-23.412 11.917-44.837 27.489-63.413 46.066-18.577 18.576-34.148 40.001-46.066 63.413-12.124 23.82-19.816 48.22-24.528 74.438-4.646 25.843-6.184 52.204-6.892 78.337-.326 11.993-.464 23.987-.533 35.983C0 344.517 0 358.757 0 373"/>
|
|
||||||
<path fill="#f1decd" d="m789.9503 428.9507-135.005-233.833c-5.642-8.618-15.035-14.043-25.327-14.632h-270.01c-10.292.589-19.685 6.014-25.327 14.632l-135.036 233.833c-4.619 9.207-4.619 20.026 0 29.233l135.036 233.864c5.642 8.618 15.035 14.043 25.327 14.601h270.01c10.292-.558 19.685-5.983 25.327-14.601l135.036-233.864c4.588-9.207 4.588-20.026-.031-29.233Z"/>
|
|
||||||
<path fill="#3ea8ff" d="m693.8813 243.5087-42.346-73.315h-235.879l200.818 346.301 176.979-100.502-99.572-172.484Z"/>
|
|
||||||
<path fill="#2180ce" d="m552.5523 325.0697-89.373-154.876h-121.148l-37.355 51.832 106.609 184.605 95.604 165.664 142.383-79.732-96.72-167.493Z"/>
|
|
||||||
<path fill="#deba92" d="m800.4283 428.0827-166.532 81.282 205.53 312.542-38.998-393.824Z"/>
|
|
||||||
<path fill="#d49b64" d="m653.4263 499.7547-141.298 81.592 290.098 176.111-148.8-257.703Z"/>
|
|
||||||
<path fill="#473a3a" d="m870.2712 818.8377-.217-2.139c-2.666-29.109-34.565-376.278-34.658-377.766-.713-8.804-3.317-17.36-7.595-25.079-.093-.279-.217-.527-.341-.775l-.186-.465-.093.093-.062-.031.124-.062-36.58-63.364-102.889-178.25c-11.098-19.189-31.558-31-53.723-31h-278.969c-22.134 0-42.594 11.811-53.692 31l-139.5 241.583c-11.067 19.189-11.067 42.811 0 62l139.5 241.583c11.067 19.189 31.527 31 53.692 31h278.969c11.966-.093 23.653-3.689 33.635-10.292l119.629 85.808c-21.607-6.758-43.958-10.757-66.557-11.873-56.141-2.697-220.72-.868-407.402 14.353-76.601 6.231-112.809 24.428-108.593 27.993 10.819 9.238 23.622 12.896 87.42 12.648 56.792-.186 222.115 5.921 272.056 8.99 35.371 2.201 72.571 8.928 99.324 9.207 28.52-.372 56.947-2.542 85.188-6.51 42.594-5.859 99.076-17.67 112.065-33.387 6.851-6.51 10.354-15.841 9.455-25.265Zm-522.939-603.446c5.177-7.905 13.795-12.896 23.25-13.423h247.969c9.424.527 18.011 5.487 23.219 13.361l103.106 178.591c-15.469 16.12-28.892 34.1-39.959 53.506l-76.7869 8.525-45.787 62.248c-22.351-.124-44.64 2.542-66.34 7.874l-174.003-301.413 5.332-9.269Zm23.25 469.774c-9.455-.527-18.073-5.518-23.25-13.423l-124-214.737c-4.247-8.432-4.247-18.414 0-26.846l82.863-143.468 184.76 320.044.124-.062c2.139 3.844 5.084 7.161 8.649 9.765l95.883 68.758-225.029-.031Zm361.956 21.917-179.49-128.743c19.809-4.309 40.021-6.479 60.295-6.479l45.7871-62.217 76.787-8.525c10.106-17.546 22.103-33.945 35.712-48.949l21.793 219.79c-25.792-2.759-50.406 11.439-60.884 35.123Zm-325.841-87.482c4.619 7.223 2.48 16.802-4.712 21.421-7.223 4.619-16.802 2.48-21.421-4.712-.248-.372-.465-.775-.682-1.178l-108.5-187.891c-4.619-7.223-2.48-16.802 4.712-21.421 7.223-4.619 16.802-2.48 21.421 4.712.248.372.465.775.682 1.178l108.5 187.891Z"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 4.1 KiB |
@@ -1,12 +1,18 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "graphite-desktop-bundle"
|
name = "graphite-desktop-bundle"
|
||||||
version = "0.0.0"
|
|
||||||
description = "Graphite Desktop Bundle"
|
description = "Graphite Desktop Bundle"
|
||||||
authors = ["Graphite Authors <[email protected]>"]
|
version.workspace = true
|
||||||
license = "Apache-2.0"
|
license.workspace = true
|
||||||
repository = ""
|
authors.workspace = true
|
||||||
edition = "2024"
|
edition.workspace = true
|
||||||
rust-version = "1.87"
|
repository.workspace = true
|
||||||
|
readme.workspace = true
|
||||||
|
homepage.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
publish.workspace = true
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
cef-dll-sys = { workspace = true }
|
cef-dll-sys = { workspace = true }
|
||||||
|
|||||||
@@ -1,9 +1,16 @@
|
|||||||
|
#![cfg_attr(target_os = "linux", allow(unused))] // TODO: Remove this when bundling for linux is implemented
|
||||||
|
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::process::{Command, Stdio};
|
use std::process::{Command, Stdio};
|
||||||
|
|
||||||
pub(crate) const APP_NAME: &str = "Graphite";
|
pub(crate) const APP_NAME: &str = "Graphite";
|
||||||
|
pub(crate) const APP_BIN: &str = "graphite";
|
||||||
|
|
||||||
|
pub(crate) fn workspace_path() -> PathBuf {
|
||||||
|
PathBuf::from(env!("CARGO_WORKSPACE_DIR"))
|
||||||
|
}
|
||||||
|
|
||||||
fn profile_name() -> &'static str {
|
fn profile_name() -> &'static str {
|
||||||
let mut profile = env!("CARGO_PROFILE");
|
let mut profile = env!("CARGO_PROFILE");
|
||||||
@@ -14,23 +21,26 @@ fn profile_name() -> &'static str {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn profile_path() -> PathBuf {
|
pub(crate) fn profile_path() -> PathBuf {
|
||||||
PathBuf::from(env!("CARGO_WORKSPACE_DIR")).join(format!("target/{}", env!("CARGO_PROFILE")))
|
workspace_path().join(format!("target/{}", env!("CARGO_PROFILE")))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn cef_path() -> PathBuf {
|
pub(crate) fn cef_path() -> PathBuf {
|
||||||
PathBuf::from(env!("CEF_PATH"))
|
PathBuf::from(env!("CEF_PATH"))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn build_bin(package: &str, bin: Option<&str>) -> Result<PathBuf, Box<dyn Error>> {
|
pub(crate) fn build_bin(package: &str, bin: Option<&str>, features: Option<&str>) -> Result<PathBuf, Box<dyn Error>> {
|
||||||
let profile = &profile_name();
|
let mut args = vec!["build", "--package", package, "--profile", profile_name()];
|
||||||
let mut args = vec!["build", "--package", package, "--profile", profile];
|
|
||||||
if let Some(bin) = bin {
|
if let Some(bin) = bin {
|
||||||
args.push("--bin");
|
args.push("--bin");
|
||||||
args.push(bin);
|
args.push(bin);
|
||||||
}
|
}
|
||||||
|
if let Some(features) = features {
|
||||||
|
args.push("--features");
|
||||||
|
args.push(features);
|
||||||
|
}
|
||||||
run_command("cargo", &args)?;
|
run_command("cargo", &args)?;
|
||||||
let profile_path = profile_path();
|
let profile_path = profile_path();
|
||||||
let mut bin_path = if let Some(bin) = bin { profile_path.join(bin) } else { profile_path.join(package) };
|
let mut bin_path = if let Some(bin) = bin { profile_path.join(bin) } else { profile_path.join(APP_BIN) };
|
||||||
if cfg!(target_os = "windows") {
|
if cfg!(target_os = "windows") {
|
||||||
bin_path.set_extension("exe");
|
bin_path.set_extension("exe");
|
||||||
}
|
}
|
||||||
@@ -40,7 +50,7 @@ pub(crate) fn build_bin(package: &str, bin: Option<&str>) -> Result<PathBuf, Box
|
|||||||
pub(crate) fn run_command(program: &str, args: &[&str]) -> Result<(), Box<dyn std::error::Error>> {
|
pub(crate) fn run_command(program: &str, args: &[&str]) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let status = Command::new(program).args(args).stdout(Stdio::inherit()).stderr(Stdio::inherit()).status()?;
|
let status = Command::new(program).args(args).stdout(Stdio::inherit()).stderr(Stdio::inherit()).status()?;
|
||||||
if !status.success() {
|
if !status.success() {
|
||||||
std::process::exit(1);
|
return Err(format!("Command '{}' with args {:?} failed with status: {}", program, args, status).into());
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,22 +1,19 @@
|
|||||||
use std::error::Error;
|
|
||||||
|
|
||||||
use crate::common::*;
|
use crate::common::*;
|
||||||
|
|
||||||
const PACKAGE: &str = "graphite-desktop-platform-linux";
|
pub fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
let app_bin = build_bin("graphite-desktop-platform-linux", None, None)?;
|
||||||
pub fn main() -> Result<(), Box<dyn Error>> {
|
|
||||||
let app_bin = build_bin(PACKAGE, None)?;
|
|
||||||
|
|
||||||
// TODO: Implement bundling for linux
|
// TODO: Implement bundling for linux
|
||||||
|
|
||||||
// TODO: Consider adding more useful cli
|
// TODO: Consider adding more useful cli
|
||||||
if std::env::args().any(|a| a == "open") {
|
let args: Vec<String> = std::env::args().collect();
|
||||||
run_command(&app_bin.to_string_lossy(), &[]).expect("failed to open app");
|
if let Some(pos) = args.iter().position(|a| a == "open") {
|
||||||
|
let extra_args: Vec<&str> = args[pos + 1..].iter().map(|s| s.as_str()).collect();
|
||||||
|
run_command(&app_bin.to_string_lossy(), &extra_args).expect("failed to open app");
|
||||||
} else {
|
} else {
|
||||||
println!("Binary built and placed at {}", app_bin.to_string_lossy());
|
eprintln!("Binary built and placed at {}", app_bin.to_string_lossy());
|
||||||
eprintln!("Bundling for Linux is not yet implemented.");
|
eprintln!("Bundling for Linux is not yet implemented.");
|
||||||
eprintln!("You can still start the app with the `open` subcommand. `cargo run -p graphite-desktop-bundle -- open`");
|
eprintln!("You can still start the app with the `open` subcommand. `cargo run -p graphite-desktop-bundle -- open`");
|
||||||
std::process::exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
+124
-32
@@ -5,26 +5,31 @@ use std::path::{Path, PathBuf};
|
|||||||
|
|
||||||
use crate::common::*;
|
use crate::common::*;
|
||||||
|
|
||||||
const APP_ID: &str = "rs.graphite.GraphiteEditor";
|
const APP_ID: &str = "art.graphite.Graphite";
|
||||||
|
|
||||||
const PACKAGE: &str = "graphite-desktop-platform-mac";
|
const ICONS_FILE_NAME: &str = "graphite.icns";
|
||||||
const HELPER_BIN: &str = "graphite-desktop-platform-mac-helper";
|
|
||||||
|
|
||||||
const EXEC_PATH: &str = "Contents/MacOS";
|
const EXEC_PATH: &str = "Contents/MacOS";
|
||||||
const FRAMEWORKS_PATH: &str = "Contents/Frameworks";
|
const FRAMEWORKS_PATH: &str = "Contents/Frameworks";
|
||||||
const FRAMEWORK: &str = "Chromium Embedded Framework.framework";
|
const RESOURCES_PATH: &str = "Contents/Resources";
|
||||||
|
const CEF_FRAMEWORK: &str = "Chromium Embedded Framework.framework";
|
||||||
|
const GRAPHITE_DOCUMENT_TYPE: &str = "art.graphite.document";
|
||||||
|
const GRAPHITE_FILE_EXTENSION: &str = "graphite";
|
||||||
|
const GRAPHITE_MIME_TYPE: &str = "application/graphite+json";
|
||||||
|
|
||||||
pub fn main() -> Result<(), Box<dyn Error>> {
|
pub fn main() -> Result<(), Box<dyn Error>> {
|
||||||
let app_bin = build_bin(PACKAGE, None)?;
|
let app_bin = build_bin("graphite-desktop-platform-mac", None, Some("main"))?;
|
||||||
let helper_bin = build_bin(PACKAGE, Some(HELPER_BIN))?;
|
let helper_bin = build_bin("graphite-desktop-platform-mac", Some("helper"), Some("helper"))?;
|
||||||
|
|
||||||
let profile_path = profile_path();
|
let profile_path = profile_path();
|
||||||
let app_dir = bundle(&profile_path, &app_bin, &helper_bin);
|
let app_dir = bundle(&profile_path, &app_bin, &helper_bin);
|
||||||
|
|
||||||
// TODO: Consider adding more useful cli
|
// TODO: Consider adding more useful cli
|
||||||
if std::env::args().any(|a| a == "open") {
|
let args: Vec<String> = std::env::args().collect();
|
||||||
let executable_path = app_dir.join(EXEC_PATH).join(APP_NAME);
|
if let Some(pos) = args.iter().position(|a| a == "open") {
|
||||||
run_command(&executable_path.to_string_lossy(), &[]).expect("failed to open app");
|
let executable = app_dir.join(EXEC_PATH).join(APP_NAME);
|
||||||
|
let extra_args: Vec<&str> = args[pos + 1..].iter().map(|s| s.as_str()).collect();
|
||||||
|
run_command(&executable.to_string_lossy(), &extra_args).expect("failed to open app");
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -37,7 +42,7 @@ fn bundle(out_dir: &Path, app_bin: &Path, helper_bin: &Path) -> PathBuf {
|
|||||||
|
|
||||||
create_app(&app_dir, APP_ID, APP_NAME, app_bin, false);
|
create_app(&app_dir, APP_ID, APP_NAME, app_bin, false);
|
||||||
|
|
||||||
for helper_type in [None, Some("GPU"), Some("Renderer"), Some("Plugin"), Some("Alerts")] {
|
for helper_type in [None, Some("GPU"), Some("Renderer")] {
|
||||||
let helper_id_suffix = helper_type.map(|t| format!(".{t}")).unwrap_or_default();
|
let helper_id_suffix = helper_type.map(|t| format!(".{t}")).unwrap_or_default();
|
||||||
let helper_id = format!("{APP_ID}.helper{helper_id_suffix}");
|
let helper_id = format!("{APP_ID}.helper{helper_id_suffix}");
|
||||||
let helper_name_suffix = helper_type.map(|t| format!(" ({t})")).unwrap_or_default();
|
let helper_name_suffix = helper_type.map(|t| format!(" ({t})")).unwrap_or_default();
|
||||||
@@ -46,7 +51,13 @@ fn bundle(out_dir: &Path, app_bin: &Path, helper_bin: &Path) -> PathBuf {
|
|||||||
create_app(&helper_app_dir, &helper_id, &helper_name, helper_bin, true);
|
create_app(&helper_app_dir, &helper_id, &helper_name, helper_bin, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
copy_dir(&cef_path().join(FRAMEWORK), &app_dir.join(FRAMEWORKS_PATH).join(FRAMEWORK));
|
copy_dir(&cef_path().join(CEF_FRAMEWORK), &app_dir.join(FRAMEWORKS_PATH).join(CEF_FRAMEWORK));
|
||||||
|
|
||||||
|
let resource_dir = app_dir.join(RESOURCES_PATH);
|
||||||
|
fs::create_dir_all(&resource_dir).expect("failed to create app resource dir");
|
||||||
|
|
||||||
|
let icon_file = workspace_path().join("branding/app-icons").join(ICONS_FILE_NAME);
|
||||||
|
fs::copy(icon_file, resource_dir.join(ICONS_FILE_NAME)).expect("failed to copy icon file");
|
||||||
|
|
||||||
app_dir
|
app_dir
|
||||||
}
|
}
|
||||||
@@ -61,25 +72,24 @@ fn create_app(app_dir: &Path, id: &str, name: &str, bin: &Path, is_helper: bool)
|
|||||||
|
|
||||||
fn create_info_plist(dir: &Path, id: &str, exec_name: &str, is_helper: bool) -> Result<(), Box<dyn std::error::Error>> {
|
fn create_info_plist(dir: &Path, id: &str, exec_name: &str, is_helper: bool) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let info = InfoPlist {
|
let info = InfoPlist {
|
||||||
cf_bundle_development_region: "en".to_string(),
|
cf_bundle_name: exec_name.to_string(),
|
||||||
|
cf_bundle_identifier: id.to_string(),
|
||||||
cf_bundle_display_name: exec_name.to_string(),
|
cf_bundle_display_name: exec_name.to_string(),
|
||||||
cf_bundle_executable: exec_name.to_string(),
|
cf_bundle_executable: exec_name.to_string(),
|
||||||
cf_bundle_identifier: id.to_string(),
|
cf_bundle_icon_file: if is_helper { None } else { Some(ICONS_FILE_NAME.to_string()) },
|
||||||
cf_bundle_info_dictionary_version: "6.0".to_string(),
|
cf_bundle_info_dictionary_version: "6.0".to_string(),
|
||||||
cf_bundle_name: exec_name.to_string(),
|
|
||||||
cf_bundle_package_type: "APPL".to_string(),
|
cf_bundle_package_type: "APPL".to_string(),
|
||||||
cf_bundle_signature: "????".to_string(),
|
cf_bundle_signature: "????".to_string(),
|
||||||
cf_bundle_version: "0.0.0".to_string(),
|
cf_bundle_version: "0.0.0".to_string(),
|
||||||
cf_bundle_short_version_string: "0.0".to_string(),
|
cf_bundle_short_version_string: "0.0".to_string(),
|
||||||
|
cf_bundle_development_region: "en".to_string(),
|
||||||
ls_environment: [("MallocNanoZone".to_string(), "0".to_string())].iter().cloned().collect(),
|
ls_environment: [("MallocNanoZone".to_string(), "0".to_string())].iter().cloned().collect(),
|
||||||
ls_file_quarantine_enabled: true,
|
ls_file_quarantine_enabled: true,
|
||||||
ls_minimum_system_version: "11.0".to_string(),
|
ls_minimum_system_version: "11.0".to_string(),
|
||||||
ls_ui_element: if is_helper { Some("1".to_string()) } else { None },
|
ls_ui_element: if is_helper { Some("1".to_string()) } else { None },
|
||||||
ns_bluetooth_always_usage_description: exec_name.to_string(),
|
|
||||||
ns_supports_automatic_graphics_switching: true,
|
ns_supports_automatic_graphics_switching: true,
|
||||||
ns_web_browser_publickey_credential_usage_description: exec_name.to_string(),
|
cf_bundle_document_types: (!is_helper).then(document_types),
|
||||||
ns_camera_usage_description: exec_name.to_string(),
|
ut_exported_type_declarations: (!is_helper).then(exported_type_declarations),
|
||||||
ns_microphone_usage_description: exec_name.to_string(),
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let plist_file = dir.join("Info.plist");
|
let plist_file = dir.join("Info.plist");
|
||||||
@@ -87,20 +97,62 @@ fn create_info_plist(dir: &Path, id: &str, exec_name: &str, is_helper: bool) ->
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn document_types() -> Vec<DocumentType> {
|
||||||
|
vec![
|
||||||
|
DocumentType {
|
||||||
|
cf_bundle_type_name: "Graphite Document".to_string(),
|
||||||
|
cf_bundle_type_role: "Editor".to_string(),
|
||||||
|
cf_bundle_type_extensions: Some(vec![GRAPHITE_FILE_EXTENSION.to_string()]),
|
||||||
|
cf_bundle_type_icon_file: Some(ICONS_FILE_NAME.to_string()),
|
||||||
|
ls_handler_rank: Some("Owner".to_string()),
|
||||||
|
ls_item_content_types: vec![GRAPHITE_DOCUMENT_TYPE.to_string()],
|
||||||
|
},
|
||||||
|
DocumentType {
|
||||||
|
cf_bundle_type_name: "SVG Image".to_string(),
|
||||||
|
cf_bundle_type_role: "Editor".to_string(),
|
||||||
|
cf_bundle_type_extensions: Some(vec!["svg".to_string()]),
|
||||||
|
cf_bundle_type_icon_file: None,
|
||||||
|
ls_handler_rank: Some("Alternate".to_string()),
|
||||||
|
ls_item_content_types: vec!["public.svg-image".to_string()],
|
||||||
|
},
|
||||||
|
DocumentType {
|
||||||
|
cf_bundle_type_name: "Image".to_string(),
|
||||||
|
cf_bundle_type_role: "Editor".to_string(),
|
||||||
|
cf_bundle_type_extensions: None,
|
||||||
|
cf_bundle_type_icon_file: None,
|
||||||
|
ls_handler_rank: Some("Alternate".to_string()),
|
||||||
|
ls_item_content_types: vec!["public.image".to_string()],
|
||||||
|
},
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
fn exported_type_declarations() -> Vec<ExportedTypeDeclaration> {
|
||||||
|
vec![ExportedTypeDeclaration {
|
||||||
|
ut_type_identifier: GRAPHITE_DOCUMENT_TYPE.to_string(),
|
||||||
|
ut_type_description: "Graphite Document".to_string(),
|
||||||
|
ut_type_conforms_to: vec!["public.json".to_string()],
|
||||||
|
ut_type_tag_specification: TypeTagSpecification {
|
||||||
|
public_filename_extension: vec![GRAPHITE_FILE_EXTENSION.to_string()],
|
||||||
|
public_mime_type: GRAPHITE_MIME_TYPE.to_string(),
|
||||||
|
},
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(serde::Serialize)]
|
#[derive(serde::Serialize)]
|
||||||
struct InfoPlist {
|
struct InfoPlist {
|
||||||
#[serde(rename = "CFBundleDevelopmentRegion")]
|
#[serde(rename = "CFBundleName")]
|
||||||
cf_bundle_development_region: String,
|
cf_bundle_name: String,
|
||||||
|
#[serde(rename = "CFBundleIdentifier")]
|
||||||
|
cf_bundle_identifier: String,
|
||||||
#[serde(rename = "CFBundleDisplayName")]
|
#[serde(rename = "CFBundleDisplayName")]
|
||||||
cf_bundle_display_name: String,
|
cf_bundle_display_name: String,
|
||||||
#[serde(rename = "CFBundleExecutable")]
|
#[serde(rename = "CFBundleExecutable")]
|
||||||
cf_bundle_executable: String,
|
cf_bundle_executable: String,
|
||||||
#[serde(rename = "CFBundleIdentifier")]
|
#[serde(rename = "CFBundleIconFile")]
|
||||||
cf_bundle_identifier: String,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
cf_bundle_icon_file: Option<String>,
|
||||||
#[serde(rename = "CFBundleInfoDictionaryVersion")]
|
#[serde(rename = "CFBundleInfoDictionaryVersion")]
|
||||||
cf_bundle_info_dictionary_version: String,
|
cf_bundle_info_dictionary_version: String,
|
||||||
#[serde(rename = "CFBundleName")]
|
|
||||||
cf_bundle_name: String,
|
|
||||||
#[serde(rename = "CFBundlePackageType")]
|
#[serde(rename = "CFBundlePackageType")]
|
||||||
cf_bundle_package_type: String,
|
cf_bundle_package_type: String,
|
||||||
#[serde(rename = "CFBundleSignature")]
|
#[serde(rename = "CFBundleSignature")]
|
||||||
@@ -109,6 +161,8 @@ struct InfoPlist {
|
|||||||
cf_bundle_version: String,
|
cf_bundle_version: String,
|
||||||
#[serde(rename = "CFBundleShortVersionString")]
|
#[serde(rename = "CFBundleShortVersionString")]
|
||||||
cf_bundle_short_version_string: String,
|
cf_bundle_short_version_string: String,
|
||||||
|
#[serde(rename = "CFBundleDevelopmentRegion")]
|
||||||
|
cf_bundle_development_region: String,
|
||||||
#[serde(rename = "LSEnvironment")]
|
#[serde(rename = "LSEnvironment")]
|
||||||
ls_environment: HashMap<String, String>,
|
ls_environment: HashMap<String, String>,
|
||||||
#[serde(rename = "LSFileQuarantineEnabled")]
|
#[serde(rename = "LSFileQuarantineEnabled")]
|
||||||
@@ -116,15 +170,53 @@ struct InfoPlist {
|
|||||||
#[serde(rename = "LSMinimumSystemVersion")]
|
#[serde(rename = "LSMinimumSystemVersion")]
|
||||||
ls_minimum_system_version: String,
|
ls_minimum_system_version: String,
|
||||||
#[serde(rename = "LSUIElement")]
|
#[serde(rename = "LSUIElement")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
ls_ui_element: Option<String>,
|
ls_ui_element: Option<String>,
|
||||||
#[serde(rename = "NSBluetoothAlwaysUsageDescription")]
|
|
||||||
ns_bluetooth_always_usage_description: String,
|
|
||||||
#[serde(rename = "NSSupportsAutomaticGraphicsSwitching")]
|
#[serde(rename = "NSSupportsAutomaticGraphicsSwitching")]
|
||||||
ns_supports_automatic_graphics_switching: bool,
|
ns_supports_automatic_graphics_switching: bool,
|
||||||
#[serde(rename = "NSWebBrowserPublicKeyCredentialUsageDescription")]
|
#[serde(rename = "CFBundleDocumentTypes")]
|
||||||
ns_web_browser_publickey_credential_usage_description: String,
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
#[serde(rename = "NSCameraUsageDescription")]
|
cf_bundle_document_types: Option<Vec<DocumentType>>,
|
||||||
ns_camera_usage_description: String,
|
#[serde(rename = "UTExportedTypeDeclarations")]
|
||||||
#[serde(rename = "NSMicrophoneUsageDescription")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
ns_microphone_usage_description: String,
|
ut_exported_type_declarations: Option<Vec<ExportedTypeDeclaration>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(serde::Serialize)]
|
||||||
|
struct DocumentType {
|
||||||
|
#[serde(rename = "CFBundleTypeName")]
|
||||||
|
cf_bundle_type_name: String,
|
||||||
|
#[serde(rename = "CFBundleTypeRole")]
|
||||||
|
cf_bundle_type_role: String,
|
||||||
|
#[serde(rename = "CFBundleTypeExtensions")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
cf_bundle_type_extensions: Option<Vec<String>>,
|
||||||
|
#[serde(rename = "CFBundleTypeIconFile")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
cf_bundle_type_icon_file: Option<String>,
|
||||||
|
#[serde(rename = "LSHandlerRank")]
|
||||||
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
|
ls_handler_rank: Option<String>,
|
||||||
|
#[serde(rename = "LSItemContentTypes")]
|
||||||
|
ls_item_content_types: Vec<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(serde::Serialize)]
|
||||||
|
struct ExportedTypeDeclaration {
|
||||||
|
#[serde(rename = "UTTypeIdentifier")]
|
||||||
|
ut_type_identifier: String,
|
||||||
|
#[serde(rename = "UTTypeDescription")]
|
||||||
|
ut_type_description: String,
|
||||||
|
#[serde(rename = "UTTypeConformsTo")]
|
||||||
|
ut_type_conforms_to: Vec<String>,
|
||||||
|
#[serde(rename = "UTTypeTagSpecification")]
|
||||||
|
ut_type_tag_specification: TypeTagSpecification,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(serde::Serialize)]
|
||||||
|
struct TypeTagSpecification {
|
||||||
|
#[serde(rename = "public.filename-extension")]
|
||||||
|
public_filename_extension: Vec<String>,
|
||||||
|
#[serde(rename = "public.mime-type")]
|
||||||
|
public_mime_type: String,
|
||||||
}
|
}
|
||||||
@@ -7,6 +7,9 @@ mod mac;
|
|||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
mod win;
|
mod win;
|
||||||
|
|
||||||
|
// Avoid incorrect warnings about an unused dependency (this crate sets `DEP_CEF_DLL_WRAPPER_CEF_DIR` which is used in `build.rs`)
|
||||||
|
use cef_dll_sys as _;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
#[cfg(target_os = "linux")]
|
#[cfg(target_os = "linux")]
|
||||||
linux::main().unwrap();
|
linux::main().unwrap();
|
||||||
|
|||||||
@@ -4,18 +4,18 @@ use std::path::{Path, PathBuf};
|
|||||||
|
|
||||||
use crate::common::*;
|
use crate::common::*;
|
||||||
|
|
||||||
const PACKAGE: &str = "graphite-desktop-platform-win";
|
const EXECUTABLE: &str = "Graphite.exe";
|
||||||
const EXECUTABLE: &str = "graphite-editor.exe";
|
|
||||||
|
|
||||||
pub fn main() -> Result<(), Box<dyn Error>> {
|
pub fn main() -> Result<(), Box<dyn Error>> {
|
||||||
let app_bin = build_bin(PACKAGE, None)?;
|
let app_bin = build_bin("graphite-desktop-platform-win", None, None)?;
|
||||||
|
|
||||||
let executable = bundle(&profile_path(), &app_bin);
|
let executable = bundle(&profile_path(), &app_bin);
|
||||||
|
|
||||||
// TODO: Consider adding more useful cli
|
// TODO: Consider adding more useful cli
|
||||||
if std::env::args().any(|a| a == "open") {
|
let args: Vec<String> = std::env::args().collect();
|
||||||
let executable_path = executable.to_string_lossy();
|
if let Some(pos) = args.iter().position(|a| a == "open") {
|
||||||
run_command(&executable_path, &[]).expect("failed to open app")
|
let extra_args: Vec<&str> = args[pos + 1..].iter().map(|s| s.as_str()).collect();
|
||||||
|
run_command(&executable.to_string_lossy(), &extra_args).expect("failed to open app")
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -28,8 +28,34 @@ fn bundle(out_dir: &Path, app_bin: &Path) -> PathBuf {
|
|||||||
|
|
||||||
copy_dir(&cef_path(), &app_dir);
|
copy_dir(&cef_path(), &app_dir);
|
||||||
|
|
||||||
|
if let Err(e) = remove_unnecessary_cef_files(&app_dir) {
|
||||||
|
eprintln!("Failed to remove unnecessary CEF files: {}", e);
|
||||||
|
}
|
||||||
|
|
||||||
let bin_path = app_dir.join(EXECUTABLE);
|
let bin_path = app_dir.join(EXECUTABLE);
|
||||||
fs::copy(app_bin, &bin_path).unwrap();
|
fs::copy(app_bin, &bin_path).unwrap();
|
||||||
|
|
||||||
bin_path
|
bin_path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn remove_unnecessary_cef_files(app_dir: &Path) -> Result<(), Box<dyn Error>> {
|
||||||
|
fs::remove_dir_all(app_dir.join("cmake"))?;
|
||||||
|
fs::remove_dir_all(app_dir.join("include"))?;
|
||||||
|
fs::remove_dir_all(app_dir.join("libcef_dll"))?;
|
||||||
|
|
||||||
|
for entry in fs::read_dir(app_dir.join("locales"))? {
|
||||||
|
let path = entry?.path();
|
||||||
|
if path.is_file() && path.file_name() != Some("en-US.pak".as_ref()) {
|
||||||
|
fs::remove_file(path)?;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fs::remove_file(app_dir.join("archive.json"))?;
|
||||||
|
fs::remove_file(app_dir.join("CMakeLists.txt"))?;
|
||||||
|
fs::remove_file(app_dir.join("bootstrapc.exe"))?;
|
||||||
|
fs::remove_file(app_dir.join("bootstrap.exe"))?;
|
||||||
|
fs::remove_file(app_dir.join("libcef.lib"))?;
|
||||||
|
fs::remove_file(app_dir.join("CREDITS.html"))?;
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
@@ -1,12 +1,15 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "graphite-desktop-embedded-resources"
|
name = "graphite-desktop-embedded-resources"
|
||||||
version = "0.1.0"
|
|
||||||
description = "Graphite Desktop Embedded Resources"
|
description = "Graphite Desktop Embedded Resources"
|
||||||
authors = ["Graphite Authors <[email protected]>"]
|
version.workspace = true
|
||||||
license = "Apache-2.0"
|
license.workspace = true
|
||||||
repository = ""
|
authors.workspace = true
|
||||||
edition = "2024"
|
edition.workspace = true
|
||||||
rust-version = "1.87"
|
repository.workspace = true
|
||||||
|
readme.workspace = true
|
||||||
|
homepage.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
publish.workspace = true
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
include_dir = { workspace = true }
|
include_dir = { workspace = true }
|
||||||
|
|||||||
@@ -1,16 +1,31 @@
|
|||||||
const RESOURCES: &str = "../../frontend/dist";
|
const EMBEDDED_RESOURCES_ENV: &str = "EMBEDDED_RESOURCES";
|
||||||
|
const DEFAULT_RESOURCES_DIR: &str = "../../frontend/dist";
|
||||||
|
|
||||||
// Check if the directory `RESOURCES` exists and sets the embedded_resources cfg accordingly
|
|
||||||
// Absolute path of `RESOURCES` available via the `EMBEDDED_RESOURCES` environment variable
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let crate_dir = std::path::PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
|
let mut embedded_resources: Option<String> = None;
|
||||||
|
|
||||||
println!("cargo:rerun-if-changed={RESOURCES}");
|
println!("cargo:rerun-if-env-changed={EMBEDDED_RESOURCES_ENV}");
|
||||||
if let Ok(resources) = crate_dir.join(RESOURCES).canonicalize()
|
if let Ok(embedded_resources_env) = std::env::var(EMBEDDED_RESOURCES_ENV)
|
||||||
&& resources.exists()
|
&& std::path::PathBuf::from(&embedded_resources_env).exists()
|
||||||
{
|
{
|
||||||
|
embedded_resources = Some(embedded_resources_env);
|
||||||
|
}
|
||||||
|
|
||||||
|
if embedded_resources.is_none() {
|
||||||
|
// Check if the directory `DEFAULT_RESOURCES_DIR` exists and sets the embedded_resources cfg accordingly
|
||||||
|
// Absolute path of `DEFAULT_RESOURCES_DIR` available via the `EMBEDDED_RESOURCES` environment variable
|
||||||
|
let crate_dir = std::path::PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
|
||||||
|
println!("cargo:rerun-if-changed={DEFAULT_RESOURCES_DIR}");
|
||||||
|
if let Ok(resources) = crate_dir.join(DEFAULT_RESOURCES_DIR).canonicalize()
|
||||||
|
&& resources.exists()
|
||||||
|
{
|
||||||
|
embedded_resources = Some(resources.to_string_lossy().to_string());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if let Some(embedded_resources) = embedded_resources {
|
||||||
println!("cargo:rustc-cfg=embedded_resources");
|
println!("cargo:rustc-cfg=embedded_resources");
|
||||||
println!("cargo:rustc-env=EMBEDDED_RESOURCES={}", resources.to_string_lossy());
|
println!("cargo:rustc-env={EMBEDDED_RESOURCES_ENV}={embedded_resources}");
|
||||||
} else {
|
} else {
|
||||||
println!("cargo:warning=Resource directory does not exist. Resources will not be embedded. Did you forget to build the frontend?");
|
println!("cargo:warning=Resource directory does not exist. Resources will not be embedded. Did you forget to build the frontend?");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,22 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "graphite-desktop-platform-linux"
|
name = "graphite-desktop-platform-linux"
|
||||||
version = "0.0.0"
|
|
||||||
description = "Graphite Desktop Platform Linux"
|
description = "Graphite Desktop Platform Linux"
|
||||||
authors = ["Graphite Authors <[email protected]>"]
|
version.workspace = true
|
||||||
license = "Apache-2.0"
|
license.workspace = true
|
||||||
repository = ""
|
authors.workspace = true
|
||||||
edition = "2024"
|
edition.workspace = true
|
||||||
rust-version = "1.87"
|
repository.workspace = true
|
||||||
|
readme.workspace = true
|
||||||
|
homepage.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
publish.workspace = true
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
workspace = true
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "graphite"
|
||||||
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
graphite-desktop = { path = "../.." }
|
graphite-desktop = { path = "../.." }
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
fn main() {
|
fn main() -> std::process::ExitCode {
|
||||||
graphite_desktop::start();
|
graphite_desktop::start()
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,33 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "graphite-desktop-platform-mac"
|
name = "graphite-desktop-platform-mac"
|
||||||
version = "0.0.0"
|
|
||||||
description = "Graphite Desktop Platform Mac"
|
description = "Graphite Desktop Platform Mac"
|
||||||
authors = ["Graphite Authors <[email protected]>"]
|
version.workspace = true
|
||||||
license = "Apache-2.0"
|
license.workspace = true
|
||||||
repository = ""
|
authors.workspace = true
|
||||||
edition = "2024"
|
edition.workspace = true
|
||||||
rust-version = "1.87"
|
repository.workspace = true
|
||||||
|
readme.workspace = true
|
||||||
|
homepage.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
publish.workspace = true
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
workspace = true
|
||||||
|
|
||||||
|
[features]
|
||||||
|
main = ["dep:graphite-desktop"]
|
||||||
|
helper = ["dep:graphite-desktop-ui"]
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "graphite-desktop-platform-mac-helper"
|
name = "graphite"
|
||||||
|
path = "src/main.rs"
|
||||||
|
required-features = ["main"]
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "helper"
|
||||||
path = "src/helper.rs"
|
path = "src/helper.rs"
|
||||||
|
required-features = ["helper"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
graphite-desktop = { path = "../.." }
|
graphite-desktop = { path = "../..", optional = true }
|
||||||
|
graphite-desktop-ui = { path = "../../ui", optional = true }
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
fn main() {
|
fn main() -> std::process::ExitCode {
|
||||||
graphite_desktop::start_helper();
|
graphite_desktop_ui::run_helper()
|
||||||
}
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
fn main() {
|
fn main() -> std::process::ExitCode {
|
||||||
graphite_desktop::start();
|
graphite_desktop::start()
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,22 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "graphite-desktop-platform-win"
|
name = "graphite-desktop-platform-win"
|
||||||
version = "0.0.0"
|
|
||||||
description = "Graphite Desktop Platform Windows"
|
description = "Graphite Desktop Platform Windows"
|
||||||
authors = ["Graphite Authors <[email protected]>"]
|
version.workspace = true
|
||||||
license = "Apache-2.0"
|
license.workspace = true
|
||||||
repository = ""
|
authors.workspace = true
|
||||||
edition = "2024"
|
edition.workspace = true
|
||||||
rust-version = "1.87"
|
repository.workspace = true
|
||||||
|
readme.workspace = true
|
||||||
|
homepage.workspace = true
|
||||||
|
rust-version.workspace = true
|
||||||
|
publish.workspace = true
|
||||||
|
|
||||||
|
[lints]
|
||||||
|
workspace = true
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "graphite"
|
||||||
|
path = "src/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
graphite-desktop = { path = "../.." }
|
graphite-desktop = { path = "../.." }
|
||||||
|
|||||||
@@ -2,7 +2,31 @@ fn main() {
|
|||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
{
|
{
|
||||||
let mut res = winres::WindowsResource::new();
|
let mut res = winres::WindowsResource::new();
|
||||||
res.set_icon("../../assets/graphite-icon-color.ico");
|
|
||||||
|
res.set_icon("../../../branding/app-icons/graphite.ico");
|
||||||
|
|
||||||
|
res.set_language(0x0409); // English (US)
|
||||||
|
|
||||||
|
// TODO: Replace with actual version
|
||||||
|
res.set_version_info(winres::VersionInfo::FILEVERSION, {
|
||||||
|
const MAJOR: u64 = 0;
|
||||||
|
const MINOR: u64 = 0;
|
||||||
|
const PATCH: u64 = 0;
|
||||||
|
const RELEASE: u64 = 0;
|
||||||
|
(MAJOR << 48) | (MINOR << 32) | (PATCH << 16) | RELEASE
|
||||||
|
});
|
||||||
|
res.set("FileVersion", "0.0.0.0");
|
||||||
|
res.set("ProductVersion", "0.0.0.0");
|
||||||
|
|
||||||
|
res.set("OriginalFilename", "Graphite.exe");
|
||||||
|
|
||||||
|
res.set("FileDescription", "Graphite");
|
||||||
|
res.set("ProductName", "Graphite");
|
||||||
|
|
||||||
|
// TODO: Pull this year from the Git commit date
|
||||||
|
res.set("LegalCopyright", "Copyright © 2026 Graphite Labs, LLC");
|
||||||
|
res.set("CompanyName", "Graphite Labs, LLC");
|
||||||
|
|
||||||
res.compile().expect("Failed to compile Windows resources");
|
res.compile().expect("Failed to compile Windows resources");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
#![windows_subsystem = "windows"]
|
#![windows_subsystem = "windows"]
|
||||||
fn main() {
|
fn main() -> std::process::ExitCode {
|
||||||
graphite_desktop::start();
|
graphite_desktop::start()
|
||||||
}
|
}
|
||||||
+490
-229
@@ -1,91 +1,207 @@
|
|||||||
|
use rand::Rng;
|
||||||
use rfd::AsyncFileDialog;
|
use rfd::AsyncFileDialog;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
|
use std::io::Read;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::mpsc::Receiver;
|
use std::sync::Arc;
|
||||||
use std::sync::mpsc::Sender;
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
use std::sync::mpsc::SyncSender;
|
use std::sync::mpsc::{Receiver, SyncSender};
|
||||||
use std::thread;
|
use std::thread;
|
||||||
use std::time::Duration;
|
use std::time::{Duration, Instant};
|
||||||
use std::time::Instant;
|
|
||||||
use winit::application::ApplicationHandler;
|
use winit::application::ApplicationHandler;
|
||||||
|
use winit::data_transfer::{DataTransferSendBuilder, TypeHint};
|
||||||
use winit::dpi::PhysicalSize;
|
use winit::dpi::PhysicalSize;
|
||||||
use winit::event::WindowEvent;
|
use winit::event::{ElementState, MouseButton, StartCause, WindowEvent};
|
||||||
use winit::event_loop::ActiveEventLoop;
|
use winit::event_loop::run_on_demand::EventLoopExtRunOnDemand;
|
||||||
use winit::event_loop::ControlFlow;
|
use winit::event_loop::{ActiveEventLoop, AsyncRequestSerial, ControlFlow, DndAction, EventLoop};
|
||||||
use winit::window::WindowId;
|
use winit::window::WindowId;
|
||||||
|
|
||||||
use crate::cef;
|
use crate::dirs;
|
||||||
use crate::consts::CEF_MESSAGE_LOOP_MAX_ITERATIONS;
|
|
||||||
use crate::event::{AppEvent, AppEventScheduler};
|
use crate::event::{AppEvent, AppEventScheduler};
|
||||||
use crate::persist::PersistentData;
|
use crate::input::InputState;
|
||||||
use crate::render::GraphicsState;
|
use crate::persist;
|
||||||
|
use crate::preferences;
|
||||||
|
use crate::render::{RenderError, RenderState};
|
||||||
|
use crate::ui::{InputEvent, UiCommand, UiInstance};
|
||||||
use crate::window::Window;
|
use crate::window::Window;
|
||||||
use crate::wrapper::messages::{DesktopFrontendMessage, DesktopWrapperMessage, Platform};
|
use crate::wrapper::messages::{DesktopFrontendMessage, DesktopWrapperMessage, IngestAction, Preferences};
|
||||||
use crate::wrapper::{DesktopWrapper, NodeGraphExecutionResult, WgpuContext, serialize_frontend_messages};
|
use crate::wrapper::{DesktopWrapper, FolderStore, MmapResourceStorage, NodeGraphExecutionResult, WgpuContext, serialize_frontend_messages};
|
||||||
|
|
||||||
pub(crate) struct App {
|
pub(crate) struct App {
|
||||||
cef_context: Box<dyn cef::CefContext>,
|
render_state: Option<RenderState>,
|
||||||
|
wgpu_context: WgpuContext,
|
||||||
window: Option<Window>,
|
window: Option<Window>,
|
||||||
window_scale: f64,
|
window_scale: f64,
|
||||||
cef_schedule: Option<Instant>,
|
window_size: PhysicalSize<u32>,
|
||||||
cef_view_info_sender: Sender<cef::ViewInfoUpdate>,
|
window_maximized: bool,
|
||||||
graphics_state: Option<GraphicsState>,
|
window_fullscreen: bool,
|
||||||
wgpu_context: WgpuContext,
|
window_pending_drag: bool,
|
||||||
|
pending_dnd_fetch: Option<AsyncRequestSerial>,
|
||||||
|
pending_clipboard_fetch: Option<AsyncRequestSerial>,
|
||||||
|
input_state: InputState,
|
||||||
|
ui_scale: f64,
|
||||||
app_event_receiver: Receiver<AppEvent>,
|
app_event_receiver: Receiver<AppEvent>,
|
||||||
app_event_scheduler: AppEventScheduler,
|
app_event_scheduler: AppEventScheduler,
|
||||||
desktop_wrapper: DesktopWrapper,
|
desktop_wrapper: DesktopWrapper,
|
||||||
last_ui_update: Instant,
|
ui: UiInstance,
|
||||||
avg_frame_time: f32,
|
ui_frame_received: bool,
|
||||||
start_render_sender: SyncSender<()>,
|
start_render_sender: SyncSender<()>,
|
||||||
web_communication_initialized: bool,
|
web_communication_initialized: bool,
|
||||||
web_communication_startup_buffer: Vec<Vec<u8>>,
|
web_communication_startup_buffer: Vec<Vec<u8>>,
|
||||||
persistent_data: PersistentData,
|
preferences: Preferences,
|
||||||
launch_documents: Vec<PathBuf>,
|
launch_documents: Option<Vec<PathBuf>>,
|
||||||
|
startup_time: Option<Instant>,
|
||||||
|
exiting: Arc<AtomicBool>,
|
||||||
|
exit_reason: ExitReason,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl App {
|
impl App {
|
||||||
|
pub(crate) fn init() {
|
||||||
|
Window::init();
|
||||||
|
}
|
||||||
|
|
||||||
pub(crate) fn new(
|
pub(crate) fn new(
|
||||||
cef_context: Box<dyn cef::CefContext>,
|
ui: UiInstance,
|
||||||
cef_view_info_sender: Sender<cef::ViewInfoUpdate>,
|
|
||||||
wgpu_context: WgpuContext,
|
wgpu_context: WgpuContext,
|
||||||
app_event_receiver: Receiver<AppEvent>,
|
app_event_receiver: Receiver<AppEvent>,
|
||||||
app_event_scheduler: AppEventScheduler,
|
app_event_scheduler: AppEventScheduler,
|
||||||
|
preferences: Preferences,
|
||||||
launch_documents: Vec<PathBuf>,
|
launch_documents: Vec<PathBuf>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
|
let ctrlc_app_event_scheduler = app_event_scheduler.clone();
|
||||||
|
ctrlc::set_handler(move || {
|
||||||
|
tracing::info!("Termination signal received, exiting...");
|
||||||
|
ctrlc_app_event_scheduler.schedule(AppEvent::Exit);
|
||||||
|
})
|
||||||
|
.expect("Error setting Ctrl-C handler");
|
||||||
|
|
||||||
|
let exiting = Arc::new(AtomicBool::new(false));
|
||||||
|
|
||||||
let rendering_app_event_scheduler = app_event_scheduler.clone();
|
let rendering_app_event_scheduler = app_event_scheduler.clone();
|
||||||
let (start_render_sender, start_render_receiver) = std::sync::mpsc::sync_channel(1);
|
let (start_render_sender, start_render_receiver) = std::sync::mpsc::sync_channel(1);
|
||||||
|
let exiting_clone = exiting.clone();
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
|
let runtime = tokio::runtime::Runtime::new().unwrap();
|
||||||
loop {
|
loop {
|
||||||
let result = futures::executor::block_on(DesktopWrapper::execute_node_graph());
|
let result = runtime.block_on(DesktopWrapper::execute_node_graph());
|
||||||
rendering_app_event_scheduler.schedule(AppEvent::NodeGraphExecutionResult(result));
|
rendering_app_event_scheduler.schedule(AppEvent::NodeGraphExecutionResult(result));
|
||||||
let _ = start_render_receiver.recv();
|
let _ = start_render_receiver.recv_timeout(Duration::from_millis(10));
|
||||||
|
if exiting_clone.load(Ordering::Relaxed) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut persistent_data = PersistentData::default();
|
let resource_storage = MmapResourceStorage::new(dirs::app_resources_dir()).expect("Failed to initialize on-disk resource storage");
|
||||||
persistent_data.load_from_disk();
|
|
||||||
|
// Wake the winit event loop when an editor future completes.
|
||||||
|
let wake_scheduler = app_event_scheduler.clone();
|
||||||
|
let wake = Arc::new(move || {
|
||||||
|
wake_scheduler.schedule(AppEvent::DesktopWrapperMessage(DesktopWrapperMessage::Wake));
|
||||||
|
});
|
||||||
|
let desktop_wrapper = DesktopWrapper::new(
|
||||||
|
rand::rng().random(),
|
||||||
|
Arc::new(resource_storage),
|
||||||
|
Arc::new(FolderStore::new(dirs::app_autosave_documents_dir())),
|
||||||
|
wgpu_context.clone(),
|
||||||
|
wake,
|
||||||
|
);
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
cef_context,
|
render_state: None,
|
||||||
window: None,
|
|
||||||
window_scale: 1.0,
|
|
||||||
cef_schedule: Some(Instant::now()),
|
|
||||||
graphics_state: None,
|
|
||||||
cef_view_info_sender,
|
|
||||||
wgpu_context,
|
wgpu_context,
|
||||||
|
window: None,
|
||||||
|
window_scale: 1.,
|
||||||
|
window_size: PhysicalSize { width: 0, height: 0 },
|
||||||
|
window_maximized: false,
|
||||||
|
window_fullscreen: false,
|
||||||
|
window_pending_drag: false,
|
||||||
|
pending_dnd_fetch: None,
|
||||||
|
pending_clipboard_fetch: None,
|
||||||
|
input_state: InputState::new(),
|
||||||
|
ui_scale: 1.,
|
||||||
app_event_receiver,
|
app_event_receiver,
|
||||||
app_event_scheduler,
|
app_event_scheduler,
|
||||||
desktop_wrapper: DesktopWrapper::new(),
|
desktop_wrapper,
|
||||||
last_ui_update: Instant::now(),
|
ui,
|
||||||
avg_frame_time: 0.,
|
ui_frame_received: false,
|
||||||
start_render_sender,
|
start_render_sender,
|
||||||
web_communication_initialized: false,
|
web_communication_initialized: false,
|
||||||
web_communication_startup_buffer: Vec::new(),
|
web_communication_startup_buffer: Vec::new(),
|
||||||
persistent_data,
|
preferences,
|
||||||
launch_documents,
|
launch_documents: Some(launch_documents),
|
||||||
|
startup_time: None,
|
||||||
|
exiting,
|
||||||
|
exit_reason: ExitReason::Shutdown,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn run(mut self, mut event_loop: EventLoop) -> ExitReason {
|
||||||
|
event_loop.run_app_on_demand(&mut self).unwrap();
|
||||||
|
self.exit_reason
|
||||||
|
}
|
||||||
|
|
||||||
|
fn exit(&mut self, reason: Option<ExitReason>) {
|
||||||
|
if self.exiting.swap(true, Ordering::Relaxed) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let _ = self.start_render_sender.send(());
|
||||||
|
if let Some(reason) = reason {
|
||||||
|
self.exit_reason = reason;
|
||||||
|
}
|
||||||
|
self.app_event_scheduler.schedule(AppEvent::Exit);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn resize(&mut self) {
|
||||||
|
let Some(window) = &self.window else {
|
||||||
|
tracing::error!("Resize failed due to missing window");
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
|
let maximized = window.is_maximized();
|
||||||
|
if maximized != self.window_maximized {
|
||||||
|
self.window_maximized = maximized;
|
||||||
|
self.app_event_scheduler.schedule(AppEvent::DesktopWrapperMessage(DesktopWrapperMessage::UpdateMaximized { maximized }));
|
||||||
|
}
|
||||||
|
|
||||||
|
let fullscreen = window.is_fullscreen();
|
||||||
|
if fullscreen != self.window_fullscreen {
|
||||||
|
self.window_fullscreen = fullscreen;
|
||||||
|
self.app_event_scheduler
|
||||||
|
.schedule(AppEvent::DesktopWrapperMessage(DesktopWrapperMessage::UpdateFullscreen { fullscreen }));
|
||||||
|
}
|
||||||
|
|
||||||
|
let size = window.surface_size();
|
||||||
|
let scale = window.scale_factor() * self.ui_scale;
|
||||||
|
let is_new_size = size != self.window_size;
|
||||||
|
let is_new_scale = scale != self.window_scale;
|
||||||
|
|
||||||
|
if !is_new_size && !is_new_scale {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if is_new_size {
|
||||||
|
self.ui.send(UiCommand::Resized {
|
||||||
|
width: size.width,
|
||||||
|
height: size.height,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if is_new_scale {
|
||||||
|
self.ui.send(UiCommand::ScaleChanged(scale));
|
||||||
|
}
|
||||||
|
|
||||||
|
self.ui.send(UiCommand::Refresh);
|
||||||
|
|
||||||
|
if let Some(render_state) = &mut self.render_state {
|
||||||
|
render_state.resize(size.width, size.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
window.request_redraw();
|
||||||
|
|
||||||
|
self.window_size = size;
|
||||||
|
self.window_scale = scale;
|
||||||
|
}
|
||||||
|
|
||||||
fn handle_desktop_frontend_message(&mut self, message: DesktopFrontendMessage, responses: &mut Vec<DesktopWrapperMessage>) {
|
fn handle_desktop_frontend_message(&mut self, message: DesktopFrontendMessage, responses: &mut Vec<DesktopWrapperMessage>) {
|
||||||
match message {
|
match message {
|
||||||
DesktopFrontendMessage::ToWeb(messages) => {
|
DesktopFrontendMessage::ToWeb(messages) => {
|
||||||
@@ -95,21 +211,30 @@ impl App {
|
|||||||
};
|
};
|
||||||
self.send_or_queue_web_message(bytes);
|
self.send_or_queue_web_message(bytes);
|
||||||
}
|
}
|
||||||
DesktopFrontendMessage::OpenFileDialog { title, filters, context } => {
|
DesktopFrontendMessage::OpenFileDialog { title, options, action } => {
|
||||||
let app_event_scheduler = self.app_event_scheduler.clone();
|
let app_event_scheduler = self.app_event_scheduler.clone();
|
||||||
let _ = thread::spawn(move || {
|
let _ = thread::spawn(move || {
|
||||||
let mut dialog = AsyncFileDialog::new().set_title(title);
|
let mut dialog = AsyncFileDialog::new().set_title(title);
|
||||||
for filter in filters {
|
for filter in options.filters {
|
||||||
dialog = dialog.add_filter(filter.name, &filter.extensions);
|
dialog = dialog.add_filter(filter.name, &filter.extensions);
|
||||||
}
|
}
|
||||||
|
|
||||||
let show_dialog = async move { dialog.pick_file().await.map(|f| f.path().to_path_buf()) };
|
let handles = if options.multiple {
|
||||||
|
futures::executor::block_on(dialog.pick_files()).unwrap_or_default()
|
||||||
|
} else {
|
||||||
|
futures::executor::block_on(dialog.pick_file()).into_iter().collect()
|
||||||
|
};
|
||||||
|
|
||||||
if let Some(path) = futures::executor::block_on(show_dialog)
|
for handle in handles {
|
||||||
&& let Ok(content) = fs::read(&path)
|
let path = handle.path().to_path_buf();
|
||||||
{
|
match fs::read(&path) {
|
||||||
let message = DesktopWrapperMessage::OpenFileDialogResult { path, content, context };
|
Ok(content) => {
|
||||||
app_event_scheduler.schedule(AppEvent::DesktopWrapperMessage(message));
|
let action = action.clone();
|
||||||
|
let message = DesktopWrapperMessage::IngestFile { path, content, action };
|
||||||
|
app_event_scheduler.schedule(AppEvent::DesktopWrapperMessage(message));
|
||||||
|
}
|
||||||
|
Err(e) => tracing::error!("Failed to read file {}: {}", path.display(), e),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -151,121 +276,131 @@ impl App {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
DesktopFrontendMessage::UpdateViewportPhysicalBounds { x, y, width, height } => {
|
DesktopFrontendMessage::UpdateViewportPhysicalBounds { x, y, width, height } => {
|
||||||
if let Some(graphics_state) = &mut self.graphics_state
|
self.input_state.set_viewport_info(x, y, width, height, self.window_scale);
|
||||||
|
|
||||||
|
if let Some(render_state) = &mut self.render_state
|
||||||
&& let Some(window) = &self.window
|
&& let Some(window) = &self.window
|
||||||
{
|
{
|
||||||
let window_size = window.surface_size();
|
let window_size = window.surface_size();
|
||||||
|
|
||||||
let viewport_offset_x = x / window_size.width as f64;
|
let viewport_offset_x = x / window_size.width as f64;
|
||||||
let viewport_offset_y = y / window_size.height as f64;
|
let viewport_offset_y = y / window_size.height as f64;
|
||||||
graphics_state.set_viewport_offset([viewport_offset_x as f32, viewport_offset_y as f32]);
|
render_state.set_viewport_offset([viewport_offset_x as f32, viewport_offset_y as f32]);
|
||||||
|
|
||||||
let viewport_scale_x = if width != 0.0 { window_size.width as f64 / width } else { 1.0 };
|
let viewport_scale_x = if width != 0. { window_size.width as f64 / width } else { 1. };
|
||||||
let viewport_scale_y = if height != 0.0 { window_size.height as f64 / height } else { 1.0 };
|
let viewport_scale_y = if height != 0. { window_size.height as f64 / height } else { 1. };
|
||||||
graphics_state.set_viewport_scale([viewport_scale_x as f32, viewport_scale_y as f32]);
|
render_state.set_viewport_scale([viewport_scale_x as f32, viewport_scale_y as f32]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DesktopFrontendMessage::WindowUpdateDirectInput { enabled } => {
|
||||||
|
self.input_state.set_direct_input(enabled);
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::UpdateUIScale { scale } => {
|
||||||
|
self.ui_scale = scale;
|
||||||
|
self.resize();
|
||||||
|
}
|
||||||
DesktopFrontendMessage::UpdateOverlays(scene) => {
|
DesktopFrontendMessage::UpdateOverlays(scene) => {
|
||||||
if let Some(graphics_state) = &mut self.graphics_state {
|
if let Some(render_state) = &mut self.render_state {
|
||||||
graphics_state.set_overlays_scene(scene);
|
render_state.set_overlays_scene(scene);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
DesktopFrontendMessage::MinimizeWindow => {
|
|
||||||
if let Some(window) = &self.window {
|
if let Some(window) = &self.window {
|
||||||
window.minimize();
|
window.request_redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
DesktopFrontendMessage::MaximizeWindow => {
|
DesktopFrontendMessage::PersistenceWriteState { state } => {
|
||||||
if let Some(window) = &self.window {
|
persist::write_state(state);
|
||||||
window.toggle_maximize();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
DesktopFrontendMessage::DragWindow => {
|
DesktopFrontendMessage::PersistenceReadState => {
|
||||||
if let Some(window) = &self.window {
|
responses.push(DesktopWrapperMessage::LoadPersistedState { state: persist::read_state() });
|
||||||
window.start_drag();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DesktopFrontendMessage::CloseWindow => {
|
|
||||||
self.app_event_scheduler.schedule(AppEvent::CloseWindow);
|
|
||||||
}
|
|
||||||
DesktopFrontendMessage::PersistenceWriteDocument { id, document } => {
|
|
||||||
self.persistent_data.write_document(id, document);
|
|
||||||
}
|
|
||||||
DesktopFrontendMessage::PersistenceDeleteDocument { id } => {
|
|
||||||
self.persistent_data.delete_document(&id);
|
|
||||||
}
|
|
||||||
DesktopFrontendMessage::PersistenceUpdateCurrentDocument { id } => {
|
|
||||||
self.persistent_data.set_current_document(id);
|
|
||||||
}
|
|
||||||
DesktopFrontendMessage::PersistenceUpdateDocumentsList { ids } => {
|
|
||||||
self.persistent_data.set_document_order(ids);
|
|
||||||
}
|
}
|
||||||
DesktopFrontendMessage::PersistenceWritePreferences { preferences } => {
|
DesktopFrontendMessage::PersistenceWritePreferences { preferences } => {
|
||||||
self.persistent_data.write_preferences(preferences);
|
preferences::write(preferences);
|
||||||
}
|
}
|
||||||
DesktopFrontendMessage::PersistenceLoadPreferences => {
|
DesktopFrontendMessage::PersistenceLoadPreferences => {
|
||||||
let preferences = self.persistent_data.load_preferences();
|
let preferences = preferences::read();
|
||||||
let message = DesktopWrapperMessage::LoadPreferences { preferences };
|
let message = DesktopWrapperMessage::LoadPreferences { preferences };
|
||||||
responses.push(message);
|
responses.push(message);
|
||||||
}
|
}
|
||||||
DesktopFrontendMessage::PersistenceLoadCurrentDocument => {
|
|
||||||
if let Some((id, document)) = self.persistent_data.current_document() {
|
|
||||||
let message = DesktopWrapperMessage::LoadDocument {
|
|
||||||
id,
|
|
||||||
document,
|
|
||||||
to_front: false,
|
|
||||||
select_after_open: true,
|
|
||||||
};
|
|
||||||
responses.push(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DesktopFrontendMessage::PersistenceLoadRemainingDocuments => {
|
|
||||||
for (id, document) in self.persistent_data.documents_before_current().into_iter().rev() {
|
|
||||||
let message = DesktopWrapperMessage::LoadDocument {
|
|
||||||
id,
|
|
||||||
document,
|
|
||||||
to_front: true,
|
|
||||||
select_after_open: false,
|
|
||||||
};
|
|
||||||
responses.push(message);
|
|
||||||
}
|
|
||||||
for (id, document) in self.persistent_data.documents_after_current() {
|
|
||||||
let message = DesktopWrapperMessage::LoadDocument {
|
|
||||||
id,
|
|
||||||
document,
|
|
||||||
to_front: false,
|
|
||||||
select_after_open: false,
|
|
||||||
};
|
|
||||||
responses.push(message);
|
|
||||||
}
|
|
||||||
if let Some(id) = self.persistent_data.current_document_id() {
|
|
||||||
let message = DesktopWrapperMessage::SelectDocument { id };
|
|
||||||
responses.push(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DesktopFrontendMessage::OpenLaunchDocuments => {
|
DesktopFrontendMessage::OpenLaunchDocuments => {
|
||||||
if self.launch_documents.is_empty() {
|
let Some(launch_documents) = std::mem::take(&mut self.launch_documents) else {
|
||||||
|
tracing::error!("OpenLaunchDocuments should only be sent once");
|
||||||
return;
|
return;
|
||||||
}
|
};
|
||||||
let app_event_scheduler = self.app_event_scheduler.clone();
|
self.app_event_scheduler.schedule(AppEvent::OpenFiles(launch_documents));
|
||||||
let launch_documents = std::mem::take(&mut self.launch_documents);
|
|
||||||
let _ = thread::spawn(move || {
|
|
||||||
for path in launch_documents {
|
|
||||||
tracing::info!("Opening file from command line: {}", path.display());
|
|
||||||
if let Ok(content) = fs::read(&path) {
|
|
||||||
let message = DesktopWrapperMessage::OpenFile { path, content };
|
|
||||||
app_event_scheduler.schedule(AppEvent::DesktopWrapperMessage(message));
|
|
||||||
} else {
|
|
||||||
tracing::error!("Failed to read file: {}", path.display());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
DesktopFrontendMessage::UpdateMenu { entries } => {
|
DesktopFrontendMessage::UpdateMenu { entries } => {
|
||||||
if let Some(window) = &self.window {
|
if let Some(window) = &self.window {
|
||||||
window.update_menu(entries);
|
window.update_menu(entries);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
DesktopFrontendMessage::ClipboardRead => {
|
||||||
|
self.app_event_scheduler.schedule(AppEvent::ClipboardRead);
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::ClipboardWrite { content } => {
|
||||||
|
self.app_event_scheduler.schedule(AppEvent::ClipboardWrite { content });
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::PointerLock => {
|
||||||
|
self.input_state.lock_pointer();
|
||||||
|
if let Some(window) = &self.window {
|
||||||
|
window.start_pointer_lock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::WindowClose => {
|
||||||
|
self.app_event_scheduler.schedule(AppEvent::Exit);
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::WindowMinimize => {
|
||||||
|
if let Some(window) = &self.window {
|
||||||
|
window.minimize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::WindowMaximize => {
|
||||||
|
if let Some(window) = &self.window {
|
||||||
|
window.toggle_maximize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::WindowFullscreen => {
|
||||||
|
if let Some(window) = &mut self.window {
|
||||||
|
window.toggle_fullscreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::WindowDrag => {
|
||||||
|
self.window_pending_drag = true;
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::WindowFocus => {
|
||||||
|
if let Some(window) = &self.window {
|
||||||
|
window.focus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::WindowHide => {
|
||||||
|
if let Some(window) = &self.window {
|
||||||
|
window.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::WindowHideOthers => {
|
||||||
|
if let Some(window) = &self.window {
|
||||||
|
window.hide_others();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::WindowShowAll => {
|
||||||
|
if let Some(window) = &self.window {
|
||||||
|
window.show_all();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::Restart => {
|
||||||
|
self.exit(Some(ExitReason::Restart));
|
||||||
|
}
|
||||||
|
DesktopFrontendMessage::LoadThirdPartyLicenses => {
|
||||||
|
let compressed = include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/third-party-licenses.txt.xz"));
|
||||||
|
let mut reader = lzma_rust2::XzReader::new(compressed.as_slice(), false);
|
||||||
|
let mut text = String::new();
|
||||||
|
if let Err(e) = reader.read_to_string(&mut text) {
|
||||||
|
tracing::error!("Failed to decompress third-party licenses: {e}");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let message = DesktopWrapperMessage::LoadThirdPartyLicenses { text };
|
||||||
|
responses.push(message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -286,7 +421,7 @@ impl App {
|
|||||||
|
|
||||||
fn send_or_queue_web_message(&mut self, message: Vec<u8>) {
|
fn send_or_queue_web_message(&mut self, message: Vec<u8>) {
|
||||||
if self.web_communication_initialized {
|
if self.web_communication_initialized {
|
||||||
self.cef_context.send_web_message(message);
|
self.ui.send(UiCommand::Message(message));
|
||||||
} else {
|
} else {
|
||||||
self.web_communication_startup_buffer.push(message);
|
self.web_communication_startup_buffer.push(message);
|
||||||
}
|
}
|
||||||
@@ -297,7 +432,7 @@ impl App {
|
|||||||
AppEvent::WebCommunicationInitialized => {
|
AppEvent::WebCommunicationInitialized => {
|
||||||
self.web_communication_initialized = true;
|
self.web_communication_initialized = true;
|
||||||
for message in self.web_communication_startup_buffer.drain(..) {
|
for message in self.web_communication_startup_buffer.drain(..) {
|
||||||
self.cef_context.send_web_message(message);
|
self.ui.send(UiCommand::Message(message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AppEvent::DesktopWrapperMessage(message) => self.dispatch_desktop_wrapper_message(message),
|
AppEvent::DesktopWrapperMessage(message) => self.dispatch_desktop_wrapper_message(message),
|
||||||
@@ -305,47 +440,93 @@ impl App {
|
|||||||
NodeGraphExecutionResult::HasRun(texture) => {
|
NodeGraphExecutionResult::HasRun(texture) => {
|
||||||
self.dispatch_desktop_wrapper_message(DesktopWrapperMessage::PollNodeGraphEvaluation);
|
self.dispatch_desktop_wrapper_message(DesktopWrapperMessage::PollNodeGraphEvaluation);
|
||||||
if let Some(texture) = texture
|
if let Some(texture) = texture
|
||||||
&& let Some(graphics_state) = self.graphics_state.as_mut()
|
&& let Some(render_state) = self.render_state.as_mut()
|
||||||
&& let Some(window) = self.window.as_ref()
|
&& let Some(window) = self.window.as_ref()
|
||||||
{
|
{
|
||||||
graphics_state.bind_viewport_texture(texture);
|
render_state.bind_viewport_texture(texture);
|
||||||
window.request_redraw();
|
window.request_redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NodeGraphExecutionResult::NotRun => {}
|
NodeGraphExecutionResult::NotRun => {}
|
||||||
},
|
},
|
||||||
AppEvent::UiUpdate(texture) => {
|
AppEvent::UiUpdate(texture) => {
|
||||||
if let Some(graphics_state) = self.graphics_state.as_mut() {
|
if let Some(render_state) = self.render_state.as_mut() {
|
||||||
graphics_state.resize(texture.width(), texture.height());
|
render_state.bind_ui_texture(texture);
|
||||||
graphics_state.bind_ui_texture(texture);
|
|
||||||
let elapsed = self.last_ui_update.elapsed().as_secs_f32();
|
|
||||||
self.last_ui_update = Instant::now();
|
|
||||||
if elapsed < 0.5 {
|
|
||||||
self.avg_frame_time = (self.avg_frame_time * 3. + elapsed) / 4.;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if let Some(window) = &self.window {
|
if let Some(window) = &self.window {
|
||||||
window.request_redraw();
|
window.request_redraw();
|
||||||
}
|
}
|
||||||
|
if !self.ui_frame_received {
|
||||||
|
self.ui_frame_received = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
AppEvent::ScheduleBrowserWork(instant) => {
|
AppEvent::ClipboardRead => {
|
||||||
if instant <= Instant::now() {
|
let result = event_loop.clipboard().and_then(|id| {
|
||||||
self.cef_context.work();
|
let Some(id) = id else { return Ok(None) };
|
||||||
} else {
|
let data_transfer = event_loop.data_transfer(id)?;
|
||||||
self.cef_schedule = Some(instant);
|
if !data_transfer.has_type(&TypeHint::Plaintext) {
|
||||||
|
return Ok(None);
|
||||||
|
}
|
||||||
|
event_loop.fetch_data_transfer(id, &TypeHint::Plaintext).map(Some)
|
||||||
|
});
|
||||||
|
match result {
|
||||||
|
Ok(Some(serial)) => self.pending_clipboard_fetch = Some(serial),
|
||||||
|
Ok(None) => self.dispatch_desktop_wrapper_message(DesktopWrapperMessage::ClipboardReadResult { content: None }),
|
||||||
|
Err(e) => {
|
||||||
|
tracing::error!("Failed to read from clipboard: {e}");
|
||||||
|
self.dispatch_desktop_wrapper_message(DesktopWrapperMessage::ClipboardReadResult { content: None });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AppEvent::ClipboardWrite { content } => {
|
||||||
|
let send_data = DataTransferSendBuilder::new(content)
|
||||||
|
.with_type(TypeHint::Plaintext, |content: &String, _| Some(content.clone()))
|
||||||
|
.build();
|
||||||
|
if let Err(e) = event_loop.set_clipboard(send_data) {
|
||||||
|
tracing::error!("Failed to write to clipboard: {e}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AppEvent::CursorChange(cursor) => {
|
AppEvent::CursorChange(cursor) => {
|
||||||
if let Some(window) = &self.window {
|
if let Some(window) = &mut self.window {
|
||||||
window.set_cursor(cursor);
|
window.set_cursor(event_loop, cursor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AppEvent::CloseWindow => {
|
AppEvent::Exit => {
|
||||||
// TODO: Implement graceful shutdown
|
|
||||||
|
|
||||||
tracing::info!("Exiting main event loop");
|
tracing::info!("Exiting main event loop");
|
||||||
event_loop.exit();
|
event_loop.exit();
|
||||||
}
|
}
|
||||||
|
AppEvent::UiCrashed => {
|
||||||
|
tracing::error!("UI process crashed, exiting.");
|
||||||
|
self.exit(Some(ExitReason::Shutdown));
|
||||||
|
}
|
||||||
|
AppEvent::OpenFiles(paths) => {
|
||||||
|
// Accumulate launch documents until OpenLaunchDocuments message is received
|
||||||
|
if let Some(launch_documents) = &mut self.launch_documents {
|
||||||
|
launch_documents.extend(paths);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if paths.is_empty() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
let app_event_scheduler = self.app_event_scheduler.clone();
|
||||||
|
let _ = thread::spawn(move || {
|
||||||
|
for path in paths {
|
||||||
|
tracing::info!("Opening file: {}", path.display());
|
||||||
|
if let Ok(content) = fs::read(&path) {
|
||||||
|
let message = DesktopWrapperMessage::IngestFile {
|
||||||
|
path,
|
||||||
|
content,
|
||||||
|
action: IngestAction::Open,
|
||||||
|
};
|
||||||
|
app_event_scheduler.schedule(AppEvent::DesktopWrapperMessage(message));
|
||||||
|
} else {
|
||||||
|
tracing::error!("Failed to read file: {}", path.display());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
AppEvent::MenuEvent { id } => {
|
AppEvent::MenuEvent { id } => {
|
||||||
self.dispatch_desktop_wrapper_message(DesktopWrapperMessage::MenuEvent { id });
|
self.dispatch_desktop_wrapper_message(DesktopWrapperMessage::MenuEvent { id });
|
||||||
}
|
}
|
||||||
@@ -355,26 +536,23 @@ impl App {
|
|||||||
impl ApplicationHandler for App {
|
impl ApplicationHandler for App {
|
||||||
fn can_create_surfaces(&mut self, event_loop: &dyn ActiveEventLoop) {
|
fn can_create_surfaces(&mut self, event_loop: &dyn ActiveEventLoop) {
|
||||||
let window = Window::new(event_loop, self.app_event_scheduler.clone());
|
let window = Window::new(event_loop, self.app_event_scheduler.clone());
|
||||||
|
|
||||||
self.window_scale = window.scale_factor();
|
|
||||||
let _ = self.cef_view_info_sender.send(cef::ViewInfoUpdate::Scale(self.window_scale));
|
|
||||||
self.cef_context.notify_view_info_changed();
|
|
||||||
|
|
||||||
self.window = Some(window);
|
self.window = Some(window);
|
||||||
|
|
||||||
let graphics_state = GraphicsState::new(self.window.as_ref().unwrap(), self.wgpu_context.clone());
|
#[cfg(not(target_os = "macos"))]
|
||||||
|
let present_mode = None;
|
||||||
self.graphics_state = Some(graphics_state);
|
|
||||||
|
|
||||||
self.desktop_wrapper.init(self.wgpu_context.clone());
|
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
|
||||||
let platform = Platform::Windows;
|
|
||||||
#[cfg(target_os = "macos")]
|
#[cfg(target_os = "macos")]
|
||||||
let platform = Platform::Mac;
|
let present_mode = if !self.preferences.vsync { Some(wgpu::PresentMode::Immediate) } else { None };
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
let platform = Platform::Linux;
|
let render_state = RenderState::new(self.window.as_ref().unwrap(), self.wgpu_context.clone(), present_mode);
|
||||||
self.dispatch_desktop_wrapper_message(DesktopWrapperMessage::UpdatePlatform(platform));
|
self.render_state = Some(render_state);
|
||||||
|
|
||||||
|
if let Some(window) = &self.window.as_ref() {
|
||||||
|
window.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
self.resize();
|
||||||
|
|
||||||
|
self.startup_time = Some(Instant::now());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn proxy_wake_up(&mut self, event_loop: &dyn ActiveEventLoop) {
|
fn proxy_wake_up(&mut self, event_loop: &dyn ActiveEventLoop) {
|
||||||
@@ -384,83 +562,166 @@ impl ApplicationHandler for App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn window_event(&mut self, event_loop: &dyn ActiveEventLoop, _window_id: WindowId, event: WindowEvent) {
|
fn window_event(&mut self, event_loop: &dyn ActiveEventLoop, _window_id: WindowId, event: WindowEvent) {
|
||||||
self.cef_context.handle_window_event(&event);
|
// Handle pointer lock release
|
||||||
|
if let WindowEvent::PointerButton {
|
||||||
|
state: ElementState::Released,
|
||||||
|
button,
|
||||||
|
..
|
||||||
|
} = &event && button.clone().mouse_button() == Some(MouseButton::Left)
|
||||||
|
&& let Some(pointer_lock_position) = self.input_state.unlock_pointer()
|
||||||
|
{
|
||||||
|
if let Some(window) = &self.window {
|
||||||
|
window.end_pointer_lock();
|
||||||
|
}
|
||||||
|
self.ui.send(UiCommand::Input(
|
||||||
|
InputEvent::pointer().position(pointer_lock_position).moved().modifiers(self.input_state.modifiers()).build(),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
self.input_state.process(
|
||||||
|
&event,
|
||||||
|
|message| self.app_event_scheduler.schedule(AppEvent::DesktopWrapperMessage(DesktopWrapperMessage::Input(message))),
|
||||||
|
|input| self.ui.send(UiCommand::Input(input)),
|
||||||
|
);
|
||||||
|
|
||||||
match event {
|
match event {
|
||||||
WindowEvent::CloseRequested => {
|
WindowEvent::CloseRequested => {
|
||||||
self.app_event_scheduler.schedule(AppEvent::CloseWindow);
|
self.app_event_scheduler.schedule(AppEvent::Exit);
|
||||||
}
|
}
|
||||||
WindowEvent::SurfaceResized(PhysicalSize { width, height }) => {
|
WindowEvent::SurfaceResized(_) | WindowEvent::ScaleFactorChanged { .. } => {
|
||||||
let _ = self.cef_view_info_sender.send(cef::ViewInfoUpdate::Size {
|
self.resize();
|
||||||
width: width as usize,
|
|
||||||
height: height as usize,
|
|
||||||
});
|
|
||||||
self.cef_context.notify_view_info_changed();
|
|
||||||
if let Some(window) = &self.window {
|
|
||||||
let maximized = window.is_maximized();
|
|
||||||
self.app_event_scheduler.schedule(AppEvent::DesktopWrapperMessage(DesktopWrapperMessage::UpdateMaximized { maximized }));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
WindowEvent::ScaleFactorChanged { scale_factor, .. } => {
|
|
||||||
self.window_scale = scale_factor;
|
|
||||||
let _ = self.cef_view_info_sender.send(cef::ViewInfoUpdate::Scale(self.window_scale));
|
|
||||||
self.cef_context.notify_view_info_changed();
|
|
||||||
}
|
}
|
||||||
WindowEvent::RedrawRequested => {
|
WindowEvent::RedrawRequested => {
|
||||||
let Some(ref mut graphics_state) = self.graphics_state else { return };
|
#[cfg(target_os = "macos")]
|
||||||
// Only rerender once we have a new UI texture to display
|
self.resize();
|
||||||
|
|
||||||
|
let Some(render_state) = &mut self.render_state else { return };
|
||||||
if let Some(window) = &self.window {
|
if let Some(window) = &self.window {
|
||||||
match graphics_state.render(window) {
|
if !window.can_render() {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
match render_state.render(window) {
|
||||||
Ok(_) => {}
|
Ok(_) => {}
|
||||||
Err(wgpu::SurfaceError::Lost) => {
|
Err(RenderError::OutdatedUITextureError) => {
|
||||||
|
self.ui.send(UiCommand::Refresh);
|
||||||
|
}
|
||||||
|
Err(RenderError::SurfaceLost) => {
|
||||||
tracing::warn!("lost surface");
|
tracing::warn!("lost surface");
|
||||||
}
|
}
|
||||||
Err(wgpu::SurfaceError::OutOfMemory) => {
|
Err(other) => tracing::error!("Render error: {:?}", other),
|
||||||
event_loop.exit();
|
|
||||||
}
|
|
||||||
Err(e) => tracing::error!("{:?}", e),
|
|
||||||
}
|
}
|
||||||
let _ = self.start_render_sender.try_send(());
|
let _ = self.start_render_sender.try_send(());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
WindowEvent::DragDropped { paths, .. } => {
|
if !self.ui_frame_received
|
||||||
for path in paths {
|
&& !self.preferences.disable_ui_acceleration
|
||||||
match fs::read(&path) {
|
&& self.web_communication_initialized
|
||||||
Ok(content) => {
|
&& let Some(startup_time) = self.startup_time
|
||||||
let message = DesktopWrapperMessage::OpenFile { path, content };
|
&& startup_time.elapsed() > Duration::from_secs(3)
|
||||||
self.app_event_scheduler.schedule(AppEvent::DesktopWrapperMessage(message));
|
{
|
||||||
}
|
tracing::error!("UI acceleration not working, exiting.");
|
||||||
Err(e) => {
|
self.exit(Some(ExitReason::UiAccelerationFailure));
|
||||||
tracing::error!("Failed to read dropped file {}: {}", path.display(), e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
WindowEvent::DragEntered { id, .. } => {
|
||||||
|
let accepts = event_loop.data_transfer(id).is_ok_and(|data_transfer| data_transfer.has_type(&TypeHint::UriList));
|
||||||
|
let actions: &[DndAction] = if accepts { &[DndAction::Copy] } else { &[] };
|
||||||
|
if let Err(e) = event_loop.set_valid_dnd_actions(id, actions) {
|
||||||
|
tracing::error!("Failed to set valid drag and drop actions: {e}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WindowEvent::DragDropped { id, .. } => match event_loop.fetch_data_transfer(id, &TypeHint::UriList) {
|
||||||
|
Ok(serial) => self.pending_dnd_fetch = Some(serial),
|
||||||
|
Err(e) => tracing::error!("Failed to fetch dropped data: {e}"),
|
||||||
|
},
|
||||||
|
WindowEvent::DataTransferReceived { serial, ref value, .. } if self.pending_clipboard_fetch == Some(serial) => match value.try_as_string() {
|
||||||
|
Ok(content) => {
|
||||||
|
self.pending_clipboard_fetch = None;
|
||||||
|
let message = DesktopWrapperMessage::ClipboardReadResult { content: Some(content) };
|
||||||
|
self.app_event_scheduler.schedule(AppEvent::DesktopWrapperMessage(message));
|
||||||
|
}
|
||||||
|
Err(e) if e.kind() == std::io::ErrorKind::WouldBlock => {}
|
||||||
|
Err(e) => {
|
||||||
|
self.pending_clipboard_fetch = None;
|
||||||
|
tracing::error!("Failed to read from clipboard: {e}");
|
||||||
|
let message = DesktopWrapperMessage::ClipboardReadResult { content: None };
|
||||||
|
self.app_event_scheduler.schedule(AppEvent::DesktopWrapperMessage(message));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
WindowEvent::DataTransferReceived { serial, ref value, .. } if self.pending_dnd_fetch == Some(serial) => match value.try_as_uris() {
|
||||||
|
Ok(uris) => {
|
||||||
|
self.pending_dnd_fetch = None;
|
||||||
|
let paths = uris.iter().filter_map(|uri| url::Url::parse(uri).ok()?.to_file_path().ok());
|
||||||
|
for path in paths {
|
||||||
|
match fs::read(&path) {
|
||||||
|
Ok(content) => {
|
||||||
|
let message = DesktopWrapperMessage::IngestFile {
|
||||||
|
path,
|
||||||
|
content,
|
||||||
|
action: IngestAction::Import,
|
||||||
|
};
|
||||||
|
self.app_event_scheduler.schedule(AppEvent::DesktopWrapperMessage(message));
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
tracing::error!("Failed to read dropped file {}: {}", path.display(), e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(e) if e.kind() == std::io::ErrorKind::WouldBlock => {}
|
||||||
|
Err(e) => {
|
||||||
|
self.pending_dnd_fetch = None;
|
||||||
|
tracing::error!("Failed to read dropped data: {e}");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
WindowEvent::PointerMoved { .. } | WindowEvent::PointerLeft { position: Some(_), .. } | WindowEvent::PointerEntered { .. }
|
||||||
|
if !self.input_state.pointer_locked() && self.window_pending_drag =>
|
||||||
|
{
|
||||||
|
self.window_pending_drag = false;
|
||||||
|
if let Some(window) = &self.window {
|
||||||
|
window.start_drag();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WindowEvent::PointerButton {
|
||||||
|
button,
|
||||||
|
state: ElementState::Released,
|
||||||
|
..
|
||||||
|
} if button.clone().mouse_button() == Some(MouseButton::Left) => {
|
||||||
|
self.window_pending_drag = false;
|
||||||
|
}
|
||||||
|
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Notify cef of possible input events
|
fn device_event(&mut self, _event_loop: &dyn ActiveEventLoop, _device_id: Option<winit::event::DeviceId>, event: winit::event::DeviceEvent) {
|
||||||
self.cef_context.work();
|
if self.input_state.pointer_locked()
|
||||||
|
&& let winit::event::DeviceEvent::PointerMotion { delta: (x, y) } = event
|
||||||
|
{
|
||||||
|
let message = DesktopWrapperMessage::PointerLockMove { x, y };
|
||||||
|
self.app_event_scheduler.schedule(AppEvent::DesktopWrapperMessage(message));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn new_events(&mut self, _event_loop: &dyn ActiveEventLoop, cause: winit::event::StartCause) {
|
||||||
|
if let StartCause::ResumeTimeReached { .. } = cause
|
||||||
|
&& let Some(window) = &self.window
|
||||||
|
{
|
||||||
|
window.request_redraw();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn about_to_wait(&mut self, event_loop: &dyn ActiveEventLoop) {
|
fn about_to_wait(&mut self, event_loop: &dyn ActiveEventLoop) {
|
||||||
// Set a timeout in case we miss any cef schedule requests
|
event_loop.set_control_flow(ControlFlow::WaitUntil(Instant::now() + Duration::from_millis(10)));
|
||||||
let timeout = Instant::now() + Duration::from_millis(10);
|
|
||||||
let wait_until = timeout.min(self.cef_schedule.unwrap_or(timeout));
|
|
||||||
if let Some(schedule) = self.cef_schedule
|
|
||||||
&& schedule < Instant::now()
|
|
||||||
{
|
|
||||||
self.cef_schedule = None;
|
|
||||||
// Poll cef message loop multiple times to avoid message loop starvation
|
|
||||||
for _ in 0..CEF_MESSAGE_LOOP_MAX_ITERATIONS {
|
|
||||||
self.cef_context.work();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if let Some(window) = &self.window.as_ref() {
|
|
||||||
window.request_redraw();
|
|
||||||
}
|
|
||||||
|
|
||||||
event_loop.set_control_flow(ControlFlow::WaitUntil(wait_until));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) enum ExitReason {
|
||||||
|
Shutdown,
|
||||||
|
Restart,
|
||||||
|
UiAccelerationFailure,
|
||||||
|
}
|
||||||
@@ -1,295 +0,0 @@
|
|||||||
//! CEF (Chromium Embedded Framework) integration for Graphite Desktop
|
|
||||||
//!
|
|
||||||
//! This module provides CEF browser integration with hardware-accelerated texture sharing.
|
|
||||||
//!
|
|
||||||
//! # Hardware Acceleration
|
|
||||||
//!
|
|
||||||
//! The texture import system supports platform-specific hardware acceleration:
|
|
||||||
//!
|
|
||||||
//! - **Linux**: DMA-BUF via Vulkan external memory (`accelerated_paint_dmabuf` feature)
|
|
||||||
//! - **Windows**: D3D11 shared textures via either Vulkan or D3D12 interop (`accelerated_paint_d3d11` feature)
|
|
||||||
//! - **macOS**: IOSurface via Metal/Vulkan interop (`accelerated_paint_iosurface` feature)
|
|
||||||
//!
|
|
||||||
//! The system gracefully falls back to CPU textures when hardware acceleration is unavailable.
|
|
||||||
|
|
||||||
use crate::event::{AppEvent, AppEventScheduler};
|
|
||||||
use crate::render::FrameBufferRef;
|
|
||||||
use crate::wrapper::{WgpuContext, deserialize_editor_message};
|
|
||||||
use std::fs::File;
|
|
||||||
use std::io::{Cursor, Read};
|
|
||||||
use std::path::PathBuf;
|
|
||||||
use std::sync::mpsc::Receiver;
|
|
||||||
use std::sync::{Arc, Mutex};
|
|
||||||
use std::time::Instant;
|
|
||||||
|
|
||||||
mod consts;
|
|
||||||
mod context;
|
|
||||||
mod dirs;
|
|
||||||
mod input;
|
|
||||||
mod internal;
|
|
||||||
mod ipc;
|
|
||||||
mod platform;
|
|
||||||
mod utility;
|
|
||||||
|
|
||||||
#[cfg(feature = "accelerated_paint")]
|
|
||||||
use cef::osr_texture_import::SharedTextureHandle;
|
|
||||||
|
|
||||||
pub(crate) use context::{CefContext, CefContextBuilder, InitError};
|
|
||||||
|
|
||||||
pub(crate) trait CefEventHandler: Send + Sync + 'static {
|
|
||||||
fn view_info(&self) -> ViewInfo;
|
|
||||||
fn draw<'a>(&self, frame_buffer: FrameBufferRef<'a>);
|
|
||||||
#[cfg(feature = "accelerated_paint")]
|
|
||||||
fn draw_gpu(&self, shared_texture: SharedTextureHandle);
|
|
||||||
fn load_resource(&self, path: PathBuf) -> Option<Resource>;
|
|
||||||
fn cursor_change(&self, cursor: winit::cursor::Cursor);
|
|
||||||
/// Schedule the main event loop to run the CEF event loop after the timeout.
|
|
||||||
/// See [`_cef_browser_process_handler_t::on_schedule_message_pump_work`] for more documentation.
|
|
||||||
fn schedule_cef_message_loop_work(&self, scheduled_time: Instant);
|
|
||||||
fn initialized_web_communication(&self);
|
|
||||||
fn receive_web_message(&self, message: &[u8]);
|
|
||||||
fn duplicate(&self) -> Self
|
|
||||||
where
|
|
||||||
Self: Sized;
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Copy)]
|
|
||||||
pub(crate) struct ViewInfo {
|
|
||||||
width: usize,
|
|
||||||
height: usize,
|
|
||||||
scale: f64,
|
|
||||||
}
|
|
||||||
impl ViewInfo {
|
|
||||||
pub(crate) fn new() -> Self {
|
|
||||||
Self { width: 1, height: 1, scale: 1. }
|
|
||||||
}
|
|
||||||
pub(crate) fn apply_update(&mut self, update: ViewInfoUpdate) {
|
|
||||||
match update {
|
|
||||||
ViewInfoUpdate::Size { width, height } if width > 0 && height > 0 => {
|
|
||||||
self.width = width;
|
|
||||||
self.height = height;
|
|
||||||
}
|
|
||||||
ViewInfoUpdate::Scale(scale) if scale > 0. => {
|
|
||||||
self.scale = scale;
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
pub(crate) fn zoom(&self) -> f64 {
|
|
||||||
self.scale.ln() / 1.2_f64.ln()
|
|
||||||
}
|
|
||||||
pub(crate) fn width(&self) -> usize {
|
|
||||||
self.width
|
|
||||||
}
|
|
||||||
pub(crate) fn height(&self) -> usize {
|
|
||||||
self.height
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl Default for ViewInfo {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::new()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) enum ViewInfoUpdate {
|
|
||||||
Size { width: usize, height: usize },
|
|
||||||
Scale(f64),
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub(crate) struct Resource {
|
|
||||||
pub(crate) reader: ResourceReader,
|
|
||||||
pub(crate) mimetype: Option<String>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[expect(dead_code)]
|
|
||||||
#[derive(Clone)]
|
|
||||||
pub(crate) enum ResourceReader {
|
|
||||||
Embedded(Cursor<&'static [u8]>),
|
|
||||||
File(Arc<File>),
|
|
||||||
}
|
|
||||||
impl Read for ResourceReader {
|
|
||||||
fn read(&mut self, buf: &mut [u8]) -> std::io::Result<usize> {
|
|
||||||
match self {
|
|
||||||
ResourceReader::Embedded(cursor) => cursor.read(buf),
|
|
||||||
ResourceReader::File(file) => file.as_ref().read(buf),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) struct CefHandler {
|
|
||||||
wgpu_context: WgpuContext,
|
|
||||||
app_event_scheduler: AppEventScheduler,
|
|
||||||
view_info_receiver: Arc<Mutex<ViewInfoReceiver>>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl CefHandler {
|
|
||||||
pub(crate) fn new(wgpu_context: WgpuContext, app_event_scheduler: AppEventScheduler, view_info_receiver: Receiver<ViewInfoUpdate>) -> Self {
|
|
||||||
Self {
|
|
||||||
wgpu_context,
|
|
||||||
app_event_scheduler,
|
|
||||||
view_info_receiver: Arc::new(Mutex::new(ViewInfoReceiver::new(view_info_receiver))),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl CefEventHandler for CefHandler {
|
|
||||||
fn view_info(&self) -> ViewInfo {
|
|
||||||
let Ok(mut guard) = self.view_info_receiver.lock() else {
|
|
||||||
tracing::error!("Failed to lock view_info_receiver");
|
|
||||||
return ViewInfo::new();
|
|
||||||
};
|
|
||||||
let ViewInfoReceiver { receiver, view_info } = &mut *guard;
|
|
||||||
for update in receiver.try_iter() {
|
|
||||||
view_info.apply_update(update);
|
|
||||||
}
|
|
||||||
*view_info
|
|
||||||
}
|
|
||||||
fn draw<'a>(&self, frame_buffer: FrameBufferRef<'a>) {
|
|
||||||
let width = frame_buffer.width() as u32;
|
|
||||||
let height = frame_buffer.height() as u32;
|
|
||||||
let texture = self.wgpu_context.device.create_texture(&wgpu::TextureDescriptor {
|
|
||||||
label: Some("CEF Texture"),
|
|
||||||
size: wgpu::Extent3d {
|
|
||||||
width,
|
|
||||||
height,
|
|
||||||
depth_or_array_layers: 1,
|
|
||||||
},
|
|
||||||
mip_level_count: 1,
|
|
||||||
sample_count: 1,
|
|
||||||
dimension: wgpu::TextureDimension::D2,
|
|
||||||
format: wgpu::TextureFormat::Bgra8UnormSrgb,
|
|
||||||
usage: wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::COPY_DST,
|
|
||||||
view_formats: &[],
|
|
||||||
});
|
|
||||||
self.wgpu_context.queue.write_texture(
|
|
||||||
wgpu::TexelCopyTextureInfo {
|
|
||||||
texture: &texture,
|
|
||||||
mip_level: 0,
|
|
||||||
origin: wgpu::Origin3d::ZERO,
|
|
||||||
aspect: wgpu::TextureAspect::All,
|
|
||||||
},
|
|
||||||
frame_buffer.buffer(),
|
|
||||||
wgpu::TexelCopyBufferLayout {
|
|
||||||
offset: 0,
|
|
||||||
bytes_per_row: Some(4 * width),
|
|
||||||
rows_per_image: Some(height),
|
|
||||||
},
|
|
||||||
wgpu::Extent3d {
|
|
||||||
width,
|
|
||||||
height,
|
|
||||||
depth_or_array_layers: 1,
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
self.app_event_scheduler.schedule(AppEvent::UiUpdate(texture));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "accelerated_paint")]
|
|
||||||
fn draw_gpu(&self, shared_texture: SharedTextureHandle) {
|
|
||||||
match shared_texture.import_texture(&self.wgpu_context.device) {
|
|
||||||
Ok(texture) => {
|
|
||||||
self.app_event_scheduler.schedule(AppEvent::UiUpdate(texture));
|
|
||||||
}
|
|
||||||
Err(e) => {
|
|
||||||
tracing::error!("Failed to import shared texture: {}", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn load_resource(&self, path: PathBuf) -> Option<Resource> {
|
|
||||||
let path = if path.as_os_str().is_empty() { PathBuf::from("index.html") } else { path };
|
|
||||||
|
|
||||||
let mimetype = match path.extension().and_then(|s| s.to_str()).unwrap_or("") {
|
|
||||||
"html" => Some("text/html".to_string()),
|
|
||||||
"css" => Some("text/css".to_string()),
|
|
||||||
"txt" => Some("text/plain".to_string()),
|
|
||||||
"wasm" => Some("application/wasm".to_string()),
|
|
||||||
"js" => Some("application/javascript".to_string()),
|
|
||||||
"png" => Some("image/png".to_string()),
|
|
||||||
"jpg" | "jpeg" => Some("image/jpeg".to_string()),
|
|
||||||
"svg" => Some("image/svg+xml".to_string()),
|
|
||||||
"xml" => Some("application/xml".to_string()),
|
|
||||||
"json" => Some("application/json".to_string()),
|
|
||||||
"ico" => Some("image/x-icon".to_string()),
|
|
||||||
"woff" => Some("font/woff".to_string()),
|
|
||||||
"woff2" => Some("font/woff2".to_string()),
|
|
||||||
"ttf" => Some("font/ttf".to_string()),
|
|
||||||
"otf" => Some("font/otf".to_string()),
|
|
||||||
"webmanifest" => Some("application/manifest+json".to_string()),
|
|
||||||
"graphite" => Some("application/graphite+json".to_string()),
|
|
||||||
_ => None,
|
|
||||||
};
|
|
||||||
|
|
||||||
#[cfg(feature = "embedded_resources")]
|
|
||||||
{
|
|
||||||
if let Some(resources) = &graphite_desktop_embedded_resources::EMBEDDED_RESOURCES
|
|
||||||
&& let Some(file) = resources.get_file(&path)
|
|
||||||
{
|
|
||||||
return Some(Resource {
|
|
||||||
reader: ResourceReader::Embedded(Cursor::new(file.contents())),
|
|
||||||
mimetype,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(feature = "embedded_resources"))]
|
|
||||||
{
|
|
||||||
use std::path::Path;
|
|
||||||
let asset_path_env = std::env::var("GRAPHITE_RESOURCES").ok()?;
|
|
||||||
let asset_path = Path::new(&asset_path_env);
|
|
||||||
let file_path = asset_path.join(path.strip_prefix("/").unwrap_or(&path));
|
|
||||||
if file_path.exists() && file_path.is_file() {
|
|
||||||
if let Ok(file) = std::fs::File::open(file_path) {
|
|
||||||
return Some(Resource {
|
|
||||||
reader: ResourceReader::File(file.into()),
|
|
||||||
mimetype,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
fn cursor_change(&self, cursor: winit::cursor::Cursor) {
|
|
||||||
self.app_event_scheduler.schedule(AppEvent::CursorChange(cursor));
|
|
||||||
}
|
|
||||||
|
|
||||||
fn schedule_cef_message_loop_work(&self, scheduled_time: std::time::Instant) {
|
|
||||||
self.app_event_scheduler.schedule(AppEvent::ScheduleBrowserWork(scheduled_time));
|
|
||||||
}
|
|
||||||
|
|
||||||
fn initialized_web_communication(&self) {
|
|
||||||
self.app_event_scheduler.schedule(AppEvent::WebCommunicationInitialized);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn receive_web_message(&self, message: &[u8]) {
|
|
||||||
let Some(desktop_wrapper_message) = deserialize_editor_message(message) else {
|
|
||||||
tracing::error!("Failed to deserialize web message");
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
self.app_event_scheduler.schedule(AppEvent::DesktopWrapperMessage(desktop_wrapper_message));
|
|
||||||
}
|
|
||||||
|
|
||||||
fn duplicate(&self) -> Self
|
|
||||||
where
|
|
||||||
Self: Sized,
|
|
||||||
{
|
|
||||||
Self {
|
|
||||||
wgpu_context: self.wgpu_context.clone(),
|
|
||||||
app_event_scheduler: self.app_event_scheduler.clone(),
|
|
||||||
view_info_receiver: self.view_info_receiver.clone(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct ViewInfoReceiver {
|
|
||||||
view_info: ViewInfo,
|
|
||||||
receiver: Receiver<ViewInfoUpdate>,
|
|
||||||
}
|
|
||||||
impl ViewInfoReceiver {
|
|
||||||
fn new(receiver: Receiver<ViewInfoUpdate>) -> Self {
|
|
||||||
Self { view_info: ViewInfo::new(), receiver }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
use std::time::Duration;
|
|
||||||
|
|
||||||
pub(crate) const RESOURCE_SCHEME: &str = "resources";
|
|
||||||
pub(crate) const RESOURCE_DOMAIN: &str = "resources";
|
|
||||||
|
|
||||||
pub(crate) const SCROLL_LINE_HEIGHT: usize = 40;
|
|
||||||
pub(crate) const SCROLL_LINE_WIDTH: usize = 40;
|
|
||||||
pub(crate) const SCROLL_SPEED_X: f32 = 3.0;
|
|
||||||
pub(crate) const SCROLL_SPEED_Y: f32 = 3.0;
|
|
||||||
|
|
||||||
pub(crate) const PINCH_ZOOM_SPEED: f64 = 300.0;
|
|
||||||
|
|
||||||
pub(crate) const MULTICLICK_TIMEOUT: Duration = Duration::from_millis(500);
|
|
||||||
pub(crate) const MULTICLICK_ALLOWED_TRAVEL: usize = 4;
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#[cfg(not(target_os = "macos"))]
|
|
||||||
mod multithreaded;
|
|
||||||
mod singlethreaded;
|
|
||||||
|
|
||||||
mod builder;
|
|
||||||
pub(crate) use builder::{CefContextBuilder, InitError};
|
|
||||||
|
|
||||||
pub(crate) trait CefContext {
|
|
||||||
fn work(&mut self);
|
|
||||||
|
|
||||||
fn handle_window_event(&mut self, event: &winit::event::WindowEvent);
|
|
||||||
|
|
||||||
fn notify_view_info_changed(&self);
|
|
||||||
|
|
||||||
fn send_web_message(&self, message: Vec<u8>);
|
|
||||||
}
|
|
||||||
@@ -1,228 +0,0 @@
|
|||||||
use std::path::{Path, PathBuf};
|
|
||||||
|
|
||||||
use cef::args::Args;
|
|
||||||
use cef::sys::{CEF_API_VERSION_LAST, cef_resultcode_t};
|
|
||||||
use cef::{
|
|
||||||
App, BrowserSettings, CefString, Client, DictionaryValue, ImplCommandLine, ImplRequestContext, RequestContextSettings, SchemeHandlerFactory, Settings, WindowInfo, api_hash,
|
|
||||||
browser_host_create_browser_sync, execute_process,
|
|
||||||
};
|
|
||||||
|
|
||||||
use super::CefContext;
|
|
||||||
use super::singlethreaded::SingleThreadedCefContext;
|
|
||||||
use crate::cef::CefEventHandler;
|
|
||||||
use crate::cef::consts::{RESOURCE_DOMAIN, RESOURCE_SCHEME};
|
|
||||||
use crate::cef::dirs::create_instance_dir;
|
|
||||||
use crate::cef::input::InputState;
|
|
||||||
use crate::cef::internal::{BrowserProcessAppImpl, BrowserProcessClientImpl, RenderProcessAppImpl, SchemeHandlerFactoryImpl};
|
|
||||||
|
|
||||||
pub(crate) struct CefContextBuilder<H: CefEventHandler> {
|
|
||||||
pub(crate) args: Args,
|
|
||||||
pub(crate) is_sub_process: bool,
|
|
||||||
_marker: std::marker::PhantomData<H>,
|
|
||||||
}
|
|
||||||
|
|
||||||
unsafe impl<H: CefEventHandler> Send for CefContextBuilder<H> {}
|
|
||||||
|
|
||||||
impl<H: CefEventHandler> CefContextBuilder<H> {
|
|
||||||
pub(crate) fn new() -> Self {
|
|
||||||
Self::new_inner(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn new_helper() -> Self {
|
|
||||||
Self::new_inner(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn new_inner(helper: bool) -> Self {
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
let _loader = {
|
|
||||||
let loader = cef::library_loader::LibraryLoader::new(&std::env::current_exe().unwrap(), helper);
|
|
||||||
assert!(loader.load());
|
|
||||||
loader
|
|
||||||
};
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
|
||||||
let _ = helper;
|
|
||||||
|
|
||||||
let _ = api_hash(CEF_API_VERSION_LAST, 0);
|
|
||||||
|
|
||||||
let args = Args::new();
|
|
||||||
let cmd = args.as_cmd_line().unwrap();
|
|
||||||
let switch = CefString::from("type");
|
|
||||||
let is_sub_process = cmd.has_switch(Some(&switch)) == 1;
|
|
||||||
|
|
||||||
Self {
|
|
||||||
args,
|
|
||||||
is_sub_process,
|
|
||||||
_marker: std::marker::PhantomData,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn is_sub_process(&self) -> bool {
|
|
||||||
self.is_sub_process
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn execute_sub_process(&self) -> SetupError {
|
|
||||||
let cmd = self.args.as_cmd_line().unwrap();
|
|
||||||
let switch = CefString::from("type");
|
|
||||||
let process_type = CefString::from(&cmd.switch_value(Some(&switch)));
|
|
||||||
let mut app = RenderProcessAppImpl::<H>::app();
|
|
||||||
let ret = execute_process(Some(self.args.as_main_args()), Some(&mut app), std::ptr::null_mut());
|
|
||||||
if ret >= 0 {
|
|
||||||
SetupError::SubprocessFailed(process_type.to_string())
|
|
||||||
} else {
|
|
||||||
SetupError::Subprocess
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn common_settings(instance_dir: &Path) -> Settings {
|
|
||||||
Settings {
|
|
||||||
windowless_rendering_enabled: 1,
|
|
||||||
root_cache_path: instance_dir.to_str().map(CefString::from).unwrap(),
|
|
||||||
cache_path: CefString::from(""),
|
|
||||||
disable_signal_handlers: 1,
|
|
||||||
..Default::default()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
pub(crate) fn initialize(self, event_handler: H, disable_gpu_acceleration: bool) -> Result<impl CefContext, InitError> {
|
|
||||||
let instance_dir = create_instance_dir();
|
|
||||||
|
|
||||||
let exe = std::env::current_exe().expect("cannot get current exe path");
|
|
||||||
let app_root = exe.parent().and_then(|p| p.parent()).expect("bad path structure").parent().expect("bad path structure");
|
|
||||||
|
|
||||||
let settings = Settings {
|
|
||||||
main_bundle_path: CefString::from(app_root.to_str().unwrap()),
|
|
||||||
multi_threaded_message_loop: 0,
|
|
||||||
external_message_pump: 1,
|
|
||||||
no_sandbox: 1, // GPU helper crashes when running with sandbox
|
|
||||||
..Self::common_settings(&instance_dir)
|
|
||||||
};
|
|
||||||
|
|
||||||
self.initialize_inner(&event_handler, settings)?;
|
|
||||||
|
|
||||||
create_browser(event_handler, instance_dir, disable_gpu_acceleration)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(target_os = "macos"))]
|
|
||||||
pub(crate) fn initialize(self, event_handler: H, disable_gpu_acceleration: bool) -> Result<impl CefContext, InitError> {
|
|
||||||
let instance_dir = create_instance_dir();
|
|
||||||
|
|
||||||
let settings = Settings {
|
|
||||||
multi_threaded_message_loop: 1,
|
|
||||||
..Self::common_settings(&instance_dir)
|
|
||||||
};
|
|
||||||
|
|
||||||
self.initialize_inner(&event_handler, settings)?;
|
|
||||||
|
|
||||||
super::multithreaded::run_on_ui_thread(move || match create_browser(event_handler, instance_dir, disable_gpu_acceleration) {
|
|
||||||
Ok(context) => {
|
|
||||||
super::multithreaded::CONTEXT.with(|b| {
|
|
||||||
*b.borrow_mut() = Some(context);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
Err(e) => {
|
|
||||||
tracing::error!("Failed to initialize CEF context: {:?}", e);
|
|
||||||
std::process::exit(1);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Ok(super::multithreaded::MultiThreadedCefContextProxy)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn initialize_inner(self, event_handler: &H, settings: Settings) -> Result<(), InitError> {
|
|
||||||
// Attention! Wrapping this in an extra App is necessary, otherwise the program still compiles but segfaults
|
|
||||||
let mut cef_app = App::new(BrowserProcessAppImpl::new(event_handler.duplicate()));
|
|
||||||
|
|
||||||
let result = cef::initialize(Some(self.args.as_main_args()), Some(&settings), Some(&mut cef_app), std::ptr::null_mut());
|
|
||||||
if result != 1 {
|
|
||||||
let cef_exit_code = cef::get_exit_code() as u32;
|
|
||||||
if cef_exit_code == cef_resultcode_t::CEF_RESULT_CODE_NORMAL_EXIT_PROCESS_NOTIFIED as u32 {
|
|
||||||
return Err(InitError::AlreadyRunning);
|
|
||||||
}
|
|
||||||
return Err(InitError::InitializationFailed(cef_exit_code));
|
|
||||||
}
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn create_browser<H: CefEventHandler>(event_handler: H, instance_dir: PathBuf, disable_gpu_acceleration: bool) -> Result<SingleThreadedCefContext, InitError> {
|
|
||||||
let mut client = Client::new(BrowserProcessClientImpl::new(&event_handler));
|
|
||||||
|
|
||||||
#[cfg(feature = "accelerated_paint")]
|
|
||||||
let use_accelerated_paint = if disable_gpu_acceleration {
|
|
||||||
false
|
|
||||||
} else {
|
|
||||||
crate::cef::platform::should_enable_hardware_acceleration()
|
|
||||||
};
|
|
||||||
|
|
||||||
let window_info = WindowInfo {
|
|
||||||
windowless_rendering_enabled: 1,
|
|
||||||
#[cfg(feature = "accelerated_paint")]
|
|
||||||
shared_texture_enabled: use_accelerated_paint as i32,
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
|
|
||||||
let settings = BrowserSettings {
|
|
||||||
windowless_frame_rate: crate::consts::CEF_WINDOWLESS_FRAME_RATE,
|
|
||||||
background_color: 0x0,
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
|
|
||||||
let Some(mut incognito_request_context) = cef::request_context_create_context(
|
|
||||||
Some(&RequestContextSettings {
|
|
||||||
persist_session_cookies: 0,
|
|
||||||
cache_path: CefString::from(""),
|
|
||||||
..Default::default()
|
|
||||||
}),
|
|
||||||
Option::<&mut cef::RequestContextHandler>::None,
|
|
||||||
) else {
|
|
||||||
return Err(InitError::RequestContextCreationFailed);
|
|
||||||
};
|
|
||||||
|
|
||||||
let mut scheme_handler_factory = SchemeHandlerFactory::new(SchemeHandlerFactoryImpl::new(event_handler.duplicate()));
|
|
||||||
incognito_request_context.clear_scheme_handler_factories();
|
|
||||||
incognito_request_context.register_scheme_handler_factory(Some(&CefString::from(RESOURCE_SCHEME)), Some(&CefString::from(RESOURCE_DOMAIN)), Some(&mut scheme_handler_factory));
|
|
||||||
|
|
||||||
let url = CefString::from(format!("{RESOURCE_SCHEME}://{RESOURCE_DOMAIN}/").as_str());
|
|
||||||
|
|
||||||
let browser = browser_host_create_browser_sync(
|
|
||||||
Some(&window_info),
|
|
||||||
Some(&mut client),
|
|
||||||
Some(&url),
|
|
||||||
Some(&settings),
|
|
||||||
Option::<&mut DictionaryValue>::None,
|
|
||||||
Some(&mut incognito_request_context),
|
|
||||||
);
|
|
||||||
|
|
||||||
if let Some(browser) = browser {
|
|
||||||
Ok(SingleThreadedCefContext {
|
|
||||||
event_handler: Box::new(event_handler),
|
|
||||||
browser,
|
|
||||||
input_state: InputState::default(),
|
|
||||||
instance_dir,
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
tracing::error!("Failed to create browser");
|
|
||||||
Err(InitError::BrowserCreationFailed)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(thiserror::Error, Debug)]
|
|
||||||
pub(crate) enum SetupError {
|
|
||||||
#[error("This is the sub process should exit immediately")]
|
|
||||||
Subprocess,
|
|
||||||
#[error("Subprocess returned non zero exit code")]
|
|
||||||
SubprocessFailed(String),
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(thiserror::Error, Debug)]
|
|
||||||
pub(crate) enum InitError {
|
|
||||||
#[error("Initialization failed")]
|
|
||||||
InitializationFailed(u32),
|
|
||||||
#[error("Browser creation failed")]
|
|
||||||
BrowserCreationFailed,
|
|
||||||
#[error("Request context creation failed")]
|
|
||||||
RequestContextCreationFailed,
|
|
||||||
#[error("Another instance is already running")]
|
|
||||||
AlreadyRunning,
|
|
||||||
}
|
|
||||||
@@ -1,67 +0,0 @@
|
|||||||
use cef::sys::cef_thread_id_t;
|
|
||||||
use cef::{Task, ThreadId, post_task};
|
|
||||||
use std::cell::RefCell;
|
|
||||||
use winit::event::WindowEvent;
|
|
||||||
|
|
||||||
use crate::cef::internal::task::ClosureTask;
|
|
||||||
|
|
||||||
use super::CefContext;
|
|
||||||
use super::singlethreaded::SingleThreadedCefContext;
|
|
||||||
|
|
||||||
thread_local! {
|
|
||||||
pub(super) static CONTEXT: RefCell<Option<SingleThreadedCefContext>> = const { RefCell::new(None) };
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(super) struct MultiThreadedCefContextProxy;
|
|
||||||
|
|
||||||
impl CefContext for MultiThreadedCefContextProxy {
|
|
||||||
fn work(&mut self) {
|
|
||||||
// CEF handles its own message loop in multi-threaded mode
|
|
||||||
}
|
|
||||||
|
|
||||||
fn handle_window_event(&mut self, event: &WindowEvent) {
|
|
||||||
let event_clone = event.clone();
|
|
||||||
run_on_ui_thread(move || {
|
|
||||||
CONTEXT.with(|b| {
|
|
||||||
if let Some(context) = b.borrow_mut().as_mut() {
|
|
||||||
context.handle_window_event(&event_clone);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
fn notify_view_info_changed(&self) {
|
|
||||||
run_on_ui_thread(move || {
|
|
||||||
CONTEXT.with(|b| {
|
|
||||||
if let Some(context) = b.borrow_mut().as_mut() {
|
|
||||||
context.notify_view_info_changed();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
fn send_web_message(&self, message: Vec<u8>) {
|
|
||||||
run_on_ui_thread(move || {
|
|
||||||
CONTEXT.with(|b| {
|
|
||||||
if let Some(context) = b.borrow_mut().as_mut() {
|
|
||||||
context.send_web_message(message);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Drop for MultiThreadedCefContextProxy {
|
|
||||||
fn drop(&mut self) {
|
|
||||||
cef::shutdown();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(super) fn run_on_ui_thread<F>(closure: F)
|
|
||||||
where
|
|
||||||
F: FnOnce() + Send + 'static,
|
|
||||||
{
|
|
||||||
let closure_task = ClosureTask::new(closure);
|
|
||||||
let mut task = Task::new(closure_task);
|
|
||||||
post_task(ThreadId::from(cef_thread_id_t::TID_UI), Some(&mut task));
|
|
||||||
}
|
|
||||||
@@ -1,54 +0,0 @@
|
|||||||
use cef::{Browser, ImplBrowser, ImplBrowserHost};
|
|
||||||
use winit::event::WindowEvent;
|
|
||||||
|
|
||||||
use crate::cef::input::InputState;
|
|
||||||
use crate::cef::ipc::{MessageType, SendMessage};
|
|
||||||
use crate::cef::{CefEventHandler, input};
|
|
||||||
|
|
||||||
use super::CefContext;
|
|
||||||
|
|
||||||
pub(super) struct SingleThreadedCefContext {
|
|
||||||
pub(super) event_handler: Box<dyn CefEventHandler>,
|
|
||||||
pub(super) browser: Browser,
|
|
||||||
pub(super) input_state: InputState,
|
|
||||||
pub(super) instance_dir: std::path::PathBuf,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl CefContext for SingleThreadedCefContext {
|
|
||||||
fn work(&mut self) {
|
|
||||||
cef::do_message_loop_work();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn handle_window_event(&mut self, event: &WindowEvent) {
|
|
||||||
input::handle_window_event(&self.browser, &mut self.input_state, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn notify_view_info_changed(&self) {
|
|
||||||
let view_info = self.event_handler.view_info();
|
|
||||||
let host = self.browser.host().unwrap();
|
|
||||||
host.set_zoom_level(view_info.zoom());
|
|
||||||
host.was_resized();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn send_web_message(&self, message: Vec<u8>) {
|
|
||||||
self.send_message(MessageType::SendToJS, &message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Drop for SingleThreadedCefContext {
|
|
||||||
fn drop(&mut self) {
|
|
||||||
cef::shutdown();
|
|
||||||
std::fs::remove_dir_all(&self.instance_dir).expect("Failed to remove CEF cache directory");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl SendMessage for SingleThreadedCefContext {
|
|
||||||
fn send_message(&self, message_type: MessageType, message: &[u8]) {
|
|
||||||
let Some(frame) = self.browser.main_frame() else {
|
|
||||||
tracing::error!("Main frame is not available, cannot send message");
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
frame.send_message(message_type, message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
use std::path::PathBuf;
|
|
||||||
|
|
||||||
use crate::dirs::{ensure_dir_exists, graphite_data_dir};
|
|
||||||
|
|
||||||
static CEF_DIR_NAME: &str = "browser";
|
|
||||||
|
|
||||||
pub(crate) fn create_instance_dir() -> PathBuf {
|
|
||||||
let instance_id: String = (0..32).map(|_| format!("{:x}", rand::random::<u8>() % 16)).collect();
|
|
||||||
let path = graphite_data_dir().join(CEF_DIR_NAME).join(instance_id);
|
|
||||||
ensure_dir_exists(&path);
|
|
||||||
path
|
|
||||||
}
|
|
||||||
@@ -1,382 +0,0 @@
|
|||||||
use cef::sys::{cef_event_flags_t, cef_key_event_type_t, cef_mouse_button_type_t};
|
|
||||||
use cef::{Browser, ImplBrowser, ImplBrowserHost, KeyEvent, KeyEventType, MouseEvent};
|
|
||||||
use std::time::Instant;
|
|
||||||
use winit::dpi::PhysicalPosition;
|
|
||||||
use winit::event::{ButtonSource, ElementState, MouseButton, MouseScrollDelta, WindowEvent};
|
|
||||||
|
|
||||||
mod keymap;
|
|
||||||
use keymap::{ToNativeKeycode, ToVKBits};
|
|
||||||
|
|
||||||
use super::consts::{MULTICLICK_ALLOWED_TRAVEL, MULTICLICK_TIMEOUT, PINCH_ZOOM_SPEED, SCROLL_LINE_HEIGHT, SCROLL_LINE_WIDTH, SCROLL_SPEED_X, SCROLL_SPEED_Y};
|
|
||||||
|
|
||||||
pub(crate) fn handle_window_event(browser: &Browser, input_state: &mut InputState, event: &WindowEvent) {
|
|
||||||
match event {
|
|
||||||
WindowEvent::PointerMoved { position, .. } | WindowEvent::PointerEntered { position, .. } => {
|
|
||||||
input_state.cursor_move(&position);
|
|
||||||
|
|
||||||
let Some(host) = browser.host() else { return };
|
|
||||||
host.send_mouse_move_event(Some(&input_state.into()), 0);
|
|
||||||
}
|
|
||||||
WindowEvent::PointerLeft { position, .. } => {
|
|
||||||
if let Some(position) = position {
|
|
||||||
input_state.cursor_move(&position);
|
|
||||||
}
|
|
||||||
|
|
||||||
let Some(host) = browser.host() else { return };
|
|
||||||
host.send_mouse_move_event(Some(&input_state.into()), 1);
|
|
||||||
}
|
|
||||||
WindowEvent::PointerButton { state, button, .. } => {
|
|
||||||
let mouse_button = match button {
|
|
||||||
ButtonSource::Mouse(mouse_button) => mouse_button,
|
|
||||||
_ => {
|
|
||||||
return; // TODO: Handle touch input
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
let cef_click_count = input_state.mouse_input(mouse_button, state).into();
|
|
||||||
let cef_mouse_up = match state {
|
|
||||||
ElementState::Pressed => 0,
|
|
||||||
ElementState::Released => 1,
|
|
||||||
};
|
|
||||||
let cef_button = match mouse_button {
|
|
||||||
MouseButton::Left => cef::MouseButtonType::from(cef_mouse_button_type_t::MBT_LEFT),
|
|
||||||
MouseButton::Right => cef::MouseButtonType::from(cef_mouse_button_type_t::MBT_RIGHT),
|
|
||||||
MouseButton::Middle => cef::MouseButtonType::from(cef_mouse_button_type_t::MBT_MIDDLE),
|
|
||||||
_ => return, //TODO: Handle Forward and Back button
|
|
||||||
};
|
|
||||||
|
|
||||||
let Some(host) = browser.host() else { return };
|
|
||||||
host.send_mouse_click_event(Some(&input_state.into()), cef_button, cef_mouse_up, cef_click_count);
|
|
||||||
}
|
|
||||||
WindowEvent::MouseWheel { delta, phase: _, device_id: _, .. } => {
|
|
||||||
let mouse_event = input_state.into();
|
|
||||||
let (mut delta_x, mut delta_y) = match delta {
|
|
||||||
MouseScrollDelta::LineDelta(x, y) => (x * SCROLL_LINE_WIDTH as f32, y * SCROLL_LINE_HEIGHT as f32),
|
|
||||||
MouseScrollDelta::PixelDelta(physical_position) => (physical_position.x as f32, physical_position.y as f32),
|
|
||||||
};
|
|
||||||
delta_x *= SCROLL_SPEED_X;
|
|
||||||
delta_y *= SCROLL_SPEED_Y;
|
|
||||||
|
|
||||||
let Some(host) = browser.host() else { return };
|
|
||||||
host.send_mouse_wheel_event(Some(&mouse_event), delta_x as i32, delta_y as i32);
|
|
||||||
}
|
|
||||||
WindowEvent::ModifiersChanged(modifiers) => {
|
|
||||||
input_state.modifiers_changed(&modifiers.state());
|
|
||||||
}
|
|
||||||
WindowEvent::KeyboardInput { device_id: _, event, is_synthetic: _ } => {
|
|
||||||
let (named_key, character) = match &event.logical_key {
|
|
||||||
winit::keyboard::Key::Named(named_key) => (
|
|
||||||
Some(named_key),
|
|
||||||
match named_key {
|
|
||||||
winit::keyboard::NamedKey::Enter => Some('\u{000d}'),
|
|
||||||
_ => None,
|
|
||||||
},
|
|
||||||
),
|
|
||||||
winit::keyboard::Key::Character(str) => {
|
|
||||||
let char = str.chars().next().unwrap_or('\0');
|
|
||||||
(None, Some(char))
|
|
||||||
}
|
|
||||||
_ => return,
|
|
||||||
};
|
|
||||||
|
|
||||||
let native_key_code = event.physical_key.to_native_keycode();
|
|
||||||
|
|
||||||
let modifiers = input_state.cef_modifiers(&event.location, event.repeat).raw();
|
|
||||||
|
|
||||||
let mut key_event = KeyEvent {
|
|
||||||
size: size_of::<KeyEvent>(),
|
|
||||||
modifiers,
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Some(named_key) = named_key {
|
|
||||||
key_event.windows_key_code = named_key.to_vk_bits();
|
|
||||||
} else if let Some(char) = character {
|
|
||||||
key_event.windows_key_code = char.to_vk_bits();
|
|
||||||
}
|
|
||||||
|
|
||||||
key_event.native_key_code = native_key_code;
|
|
||||||
|
|
||||||
let Some(host) = browser.host() else { return };
|
|
||||||
|
|
||||||
match event.state {
|
|
||||||
ElementState::Pressed => {
|
|
||||||
key_event.type_ = KeyEventType::from(cef_key_event_type_t::KEYEVENT_RAWKEYDOWN);
|
|
||||||
host.send_key_event(Some(&key_event));
|
|
||||||
|
|
||||||
if let Some(char) = character {
|
|
||||||
let mut char_key_event = KeyEvent {
|
|
||||||
size: size_of::<KeyEvent>(),
|
|
||||||
modifiers,
|
|
||||||
is_system_key: 0,
|
|
||||||
..Default::default()
|
|
||||||
};
|
|
||||||
let mut buf = [0; 2];
|
|
||||||
char.encode_utf16(&mut buf);
|
|
||||||
char_key_event.windows_key_code = buf[0] as i32;
|
|
||||||
char_key_event.character = buf[0];
|
|
||||||
char_key_event.native_key_code = native_key_code;
|
|
||||||
let mut buf = [0; 2];
|
|
||||||
char.to_lowercase().next().unwrap().encode_utf16(&mut buf);
|
|
||||||
char_key_event.unmodified_character = buf[0];
|
|
||||||
char_key_event.type_ = KeyEventType::from(cef_key_event_type_t::KEYEVENT_CHAR);
|
|
||||||
host.send_key_event(Some(&char_key_event));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ElementState::Released => {
|
|
||||||
key_event.type_ = KeyEventType::from(cef_key_event_type_t::KEYEVENT_KEYUP);
|
|
||||||
host.send_key_event(Some(&key_event));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
WindowEvent::PinchGesture { delta, .. } => {
|
|
||||||
if !delta.is_normal() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
let Some(host) = browser.host() else { return };
|
|
||||||
|
|
||||||
let mut mouse_event: MouseEvent = input_state.into();
|
|
||||||
mouse_event.modifiers |= cef_event_flags_t::EVENTFLAG_CONTROL_DOWN as u32;
|
|
||||||
mouse_event.modifiers |= cef_event_flags_t::EVENTFLAG_PRECISION_SCROLLING_DELTA as u32;
|
|
||||||
|
|
||||||
let delta = (delta * PINCH_ZOOM_SPEED).round() as i32;
|
|
||||||
|
|
||||||
host.send_mouse_wheel_event(Some(&mouse_event), 0, delta);
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Default)]
|
|
||||||
pub(crate) struct InputState {
|
|
||||||
modifiers: winit::keyboard::ModifiersState,
|
|
||||||
mouse_position: MousePosition,
|
|
||||||
mouse_state: MouseState,
|
|
||||||
mouse_click_tracker: ClickTracker,
|
|
||||||
}
|
|
||||||
impl InputState {
|
|
||||||
fn modifiers_changed(&mut self, modifiers: &winit::keyboard::ModifiersState) {
|
|
||||||
self.modifiers = *modifiers;
|
|
||||||
}
|
|
||||||
|
|
||||||
fn cursor_move(&mut self, position: &PhysicalPosition<f64>) {
|
|
||||||
self.mouse_position = position.into();
|
|
||||||
}
|
|
||||||
|
|
||||||
fn mouse_input(&mut self, button: &MouseButton, state: &ElementState) -> ClickCount {
|
|
||||||
self.mouse_state.update(button, state);
|
|
||||||
self.mouse_click_tracker.input(button, state, self.mouse_position)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn cef_modifiers(&self, location: &winit::keyboard::KeyLocation, is_repeat: bool) -> CefModifiers {
|
|
||||||
CefModifiers::new(self, location, is_repeat)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn cef_modifiers_mouse_event(&self) -> CefModifiers {
|
|
||||||
self.cef_modifiers(&winit::keyboard::KeyLocation::Standard, false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl From<InputState> for CefModifiers {
|
|
||||||
fn from(val: InputState) -> Self {
|
|
||||||
CefModifiers::new(&val, &winit::keyboard::KeyLocation::Standard, false)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl From<&InputState> for MouseEvent {
|
|
||||||
fn from(val: &InputState) -> Self {
|
|
||||||
MouseEvent {
|
|
||||||
x: val.mouse_position.x as i32,
|
|
||||||
y: val.mouse_position.y as i32,
|
|
||||||
modifiers: val.cef_modifiers_mouse_event().raw(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl From<&mut InputState> for MouseEvent {
|
|
||||||
fn from(val: &mut InputState) -> Self {
|
|
||||||
MouseEvent {
|
|
||||||
x: val.mouse_position.x as i32,
|
|
||||||
y: val.mouse_position.y as i32,
|
|
||||||
modifiers: val.cef_modifiers_mouse_event().raw(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Default, Clone, Copy)]
|
|
||||||
pub(crate) struct MousePosition {
|
|
||||||
x: usize,
|
|
||||||
y: usize,
|
|
||||||
}
|
|
||||||
impl From<&PhysicalPosition<f64>> for MousePosition {
|
|
||||||
fn from(position: &PhysicalPosition<f64>) -> Self {
|
|
||||||
Self {
|
|
||||||
x: position.x as usize,
|
|
||||||
y: position.y as usize,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Default, Clone)]
|
|
||||||
pub(crate) struct MouseState {
|
|
||||||
left: bool,
|
|
||||||
right: bool,
|
|
||||||
middle: bool,
|
|
||||||
}
|
|
||||||
impl MouseState {
|
|
||||||
pub(crate) fn update(&mut self, button: &MouseButton, state: &ElementState) {
|
|
||||||
match state {
|
|
||||||
ElementState::Pressed => match button {
|
|
||||||
MouseButton::Left => self.left = true,
|
|
||||||
MouseButton::Right => self.right = true,
|
|
||||||
MouseButton::Middle => self.middle = true,
|
|
||||||
_ => {}
|
|
||||||
},
|
|
||||||
ElementState::Released => match button {
|
|
||||||
MouseButton::Left => self.left = false,
|
|
||||||
MouseButton::Right => self.right = false,
|
|
||||||
MouseButton::Middle => self.middle = false,
|
|
||||||
_ => {}
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Default)]
|
|
||||||
struct ClickTracker {
|
|
||||||
left: Option<ClickRecord>,
|
|
||||||
middle: Option<ClickRecord>,
|
|
||||||
right: Option<ClickRecord>,
|
|
||||||
}
|
|
||||||
impl ClickTracker {
|
|
||||||
fn input(&mut self, button: &MouseButton, state: &ElementState, position: MousePosition) -> ClickCount {
|
|
||||||
let record = match button {
|
|
||||||
MouseButton::Left => &mut self.left,
|
|
||||||
MouseButton::Right => &mut self.right,
|
|
||||||
MouseButton::Middle => &mut self.middle,
|
|
||||||
_ => return ClickCount::Single,
|
|
||||||
};
|
|
||||||
|
|
||||||
let Some(record) = record else {
|
|
||||||
*record = Some(ClickRecord { position, ..Default::default() });
|
|
||||||
return ClickCount::Single;
|
|
||||||
};
|
|
||||||
|
|
||||||
let prev_time = record.time;
|
|
||||||
let prev_position = record.position;
|
|
||||||
|
|
||||||
let now = Instant::now();
|
|
||||||
record.time = now;
|
|
||||||
record.position = position;
|
|
||||||
|
|
||||||
match state {
|
|
||||||
ElementState::Pressed if record.down_count == ClickCount::Double => {
|
|
||||||
*record = ClickRecord {
|
|
||||||
down_count: ClickCount::Single,
|
|
||||||
..*record
|
|
||||||
};
|
|
||||||
return ClickCount::Single;
|
|
||||||
}
|
|
||||||
ElementState::Released if record.up_count == ClickCount::Double => {
|
|
||||||
*record = ClickRecord {
|
|
||||||
up_count: ClickCount::Single,
|
|
||||||
..*record
|
|
||||||
};
|
|
||||||
return ClickCount::Single;
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
|
|
||||||
let dx = position.x.abs_diff(prev_position.x);
|
|
||||||
let dy = position.y.abs_diff(prev_position.y);
|
|
||||||
let within_dist = dx <= MULTICLICK_ALLOWED_TRAVEL && dy <= MULTICLICK_ALLOWED_TRAVEL;
|
|
||||||
let within_time = now.saturating_duration_since(prev_time) <= MULTICLICK_TIMEOUT;
|
|
||||||
|
|
||||||
let count = if within_time && within_dist { ClickCount::Double } else { ClickCount::Single };
|
|
||||||
|
|
||||||
*record = match state {
|
|
||||||
ElementState::Pressed => ClickRecord { down_count: count, ..*record },
|
|
||||||
ElementState::Released => ClickRecord { up_count: count, ..*record },
|
|
||||||
};
|
|
||||||
count
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, PartialEq, Default)]
|
|
||||||
enum ClickCount {
|
|
||||||
#[default]
|
|
||||||
Single,
|
|
||||||
Double,
|
|
||||||
}
|
|
||||||
impl From<ClickCount> for i32 {
|
|
||||||
fn from(count: ClickCount) -> i32 {
|
|
||||||
match count {
|
|
||||||
ClickCount::Single => 1,
|
|
||||||
ClickCount::Double => 2,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Copy)]
|
|
||||||
struct ClickRecord {
|
|
||||||
time: Instant,
|
|
||||||
position: MousePosition,
|
|
||||||
down_count: ClickCount,
|
|
||||||
up_count: ClickCount,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Default for ClickRecord {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
time: Instant::now(),
|
|
||||||
position: Default::default(),
|
|
||||||
down_count: Default::default(),
|
|
||||||
up_count: Default::default(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
struct CefModifiers(u32);
|
|
||||||
impl CefModifiers {
|
|
||||||
fn new(input_state: &InputState, location: &winit::keyboard::KeyLocation, is_repeat: bool) -> Self {
|
|
||||||
let mut inner = 0;
|
|
||||||
|
|
||||||
if input_state.modifiers.shift_key() {
|
|
||||||
inner |= cef_event_flags_t::EVENTFLAG_SHIFT_DOWN as u32;
|
|
||||||
}
|
|
||||||
if input_state.modifiers.control_key() {
|
|
||||||
inner |= cef_event_flags_t::EVENTFLAG_CONTROL_DOWN as u32;
|
|
||||||
}
|
|
||||||
if input_state.modifiers.alt_key() {
|
|
||||||
inner |= cef_event_flags_t::EVENTFLAG_ALT_DOWN as u32;
|
|
||||||
}
|
|
||||||
if input_state.modifiers.meta_key() {
|
|
||||||
inner |= cef_event_flags_t::EVENTFLAG_COMMAND_DOWN as u32;
|
|
||||||
}
|
|
||||||
|
|
||||||
if input_state.mouse_state.left {
|
|
||||||
inner |= cef_event_flags_t::EVENTFLAG_LEFT_MOUSE_BUTTON as u32;
|
|
||||||
}
|
|
||||||
if input_state.mouse_state.right {
|
|
||||||
inner |= cef_event_flags_t::EVENTFLAG_RIGHT_MOUSE_BUTTON as u32;
|
|
||||||
}
|
|
||||||
if input_state.mouse_state.middle {
|
|
||||||
inner |= cef_event_flags_t::EVENTFLAG_MIDDLE_MOUSE_BUTTON as u32;
|
|
||||||
}
|
|
||||||
|
|
||||||
if is_repeat {
|
|
||||||
inner |= cef_event_flags_t::EVENTFLAG_IS_REPEAT as u32;
|
|
||||||
}
|
|
||||||
|
|
||||||
inner |= match location {
|
|
||||||
winit::keyboard::KeyLocation::Left => cef_event_flags_t::EVENTFLAG_IS_LEFT as u32,
|
|
||||||
winit::keyboard::KeyLocation::Right => cef_event_flags_t::EVENTFLAG_IS_RIGHT as u32,
|
|
||||||
winit::keyboard::KeyLocation::Numpad => cef_event_flags_t::EVENTFLAG_IS_KEY_PAD as u32,
|
|
||||||
winit::keyboard::KeyLocation::Standard => 0,
|
|
||||||
};
|
|
||||||
|
|
||||||
Self(inner)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn raw(&self) -> u32 {
|
|
||||||
self.0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,107 +0,0 @@
|
|||||||
#[cfg(target_os = "linux")]
|
|
||||||
use std::env;
|
|
||||||
|
|
||||||
use cef::rc::{Rc, RcImpl};
|
|
||||||
use cef::sys::{_cef_app_t, cef_base_ref_counted_t};
|
|
||||||
use cef::{BrowserProcessHandler, CefString, ImplApp, ImplCommandLine, SchemeRegistrar, WrapApp};
|
|
||||||
|
|
||||||
use super::browser_process_handler::BrowserProcessHandlerImpl;
|
|
||||||
use super::scheme_handler_factory::SchemeHandlerFactoryImpl;
|
|
||||||
use crate::cef::CefEventHandler;
|
|
||||||
|
|
||||||
pub(crate) struct BrowserProcessAppImpl<H: CefEventHandler> {
|
|
||||||
object: *mut RcImpl<_cef_app_t, Self>,
|
|
||||||
event_handler: H,
|
|
||||||
}
|
|
||||||
impl<H: CefEventHandler> BrowserProcessAppImpl<H> {
|
|
||||||
pub(crate) fn new(event_handler: H) -> Self {
|
|
||||||
Self {
|
|
||||||
object: std::ptr::null_mut(),
|
|
||||||
event_handler,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<H: CefEventHandler> ImplApp for BrowserProcessAppImpl<H> {
|
|
||||||
fn browser_process_handler(&self) -> Option<BrowserProcessHandler> {
|
|
||||||
Some(BrowserProcessHandler::new(BrowserProcessHandlerImpl::new(self.event_handler.duplicate())))
|
|
||||||
}
|
|
||||||
|
|
||||||
fn on_register_custom_schemes(&self, registrar: Option<&mut SchemeRegistrar>) {
|
|
||||||
SchemeHandlerFactoryImpl::<H>::register_schemes(registrar);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn on_before_command_line_processing(&self, _process_type: Option<&cef::CefString>, command_line: Option<&mut cef::CommandLine>) {
|
|
||||||
if let Some(cmd) = command_line {
|
|
||||||
#[cfg(not(feature = "accelerated_paint"))]
|
|
||||||
{
|
|
||||||
// Disable GPU acceleration when accelerated_paint feature is not enabled
|
|
||||||
cmd.append_switch(Some(&CefString::from("disable-gpu")));
|
|
||||||
cmd.append_switch(Some(&CefString::from("disable-gpu-compositing")));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "accelerated_paint")]
|
|
||||||
{
|
|
||||||
// Enable GPU acceleration switches for better performance
|
|
||||||
cmd.append_switch(Some(&CefString::from("enable-gpu-rasterization")));
|
|
||||||
cmd.append_switch(Some(&CefString::from("enable-accelerated-2d-canvas")));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(all(feature = "accelerated_paint", target_os = "linux"))]
|
|
||||||
{
|
|
||||||
// Use Vulkan for accelerated painting
|
|
||||||
cmd.append_switch_with_value(Some(&CefString::from("use-angle")), Some(&CefString::from("vulkan")));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Tell CEF to use Wayland if available
|
|
||||||
#[cfg(target_os = "linux")]
|
|
||||||
{
|
|
||||||
let use_wayland = env::var("WAYLAND_DISPLAY")
|
|
||||||
.ok()
|
|
||||||
.filter(|var| !var.is_empty())
|
|
||||||
.or_else(|| env::var("WAYLAND_SOCKET").ok())
|
|
||||||
.filter(|var| !var.is_empty())
|
|
||||||
.is_some();
|
|
||||||
if use_wayland {
|
|
||||||
cmd.append_switch_with_value(Some(&CefString::from("ozone-platform")), Some(&CefString::from("wayland")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(target_os = "macos")]
|
|
||||||
{
|
|
||||||
// Hide user prompt asking for keychain access
|
|
||||||
cmd.append_switch(Some(&CefString::from("use-mock-keychain")));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_raw(&self) -> *mut _cef_app_t {
|
|
||||||
self.object.cast()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<H: CefEventHandler> Clone for BrowserProcessAppImpl<H> {
|
|
||||||
fn clone(&self) -> Self {
|
|
||||||
unsafe {
|
|
||||||
let rc_impl = &mut *self.object;
|
|
||||||
rc_impl.interface.add_ref();
|
|
||||||
}
|
|
||||||
Self {
|
|
||||||
object: self.object,
|
|
||||||
event_handler: self.event_handler.duplicate(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl<H: CefEventHandler> Rc for BrowserProcessAppImpl<H> {
|
|
||||||
fn as_base(&self) -> &cef_base_ref_counted_t {
|
|
||||||
unsafe {
|
|
||||||
let base = &*self.object;
|
|
||||||
std::mem::transmute(&base.cef_object)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl<H: CefEventHandler> WrapApp for BrowserProcessAppImpl<H> {
|
|
||||||
fn wrap_rc(&mut self, object: *mut RcImpl<_cef_app_t, Self>) {
|
|
||||||
self.object = object;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,97 +0,0 @@
|
|||||||
use cef::rc::{Rc, RcImpl};
|
|
||||||
use cef::sys::{_cef_render_handler_t, cef_base_ref_counted_t};
|
|
||||||
use cef::{Browser, ImplRenderHandler, PaintElementType, Rect, WrapRenderHandler};
|
|
||||||
|
|
||||||
use crate::cef::CefEventHandler;
|
|
||||||
use crate::render::FrameBufferRef;
|
|
||||||
|
|
||||||
pub(crate) struct RenderHandlerImpl<H: CefEventHandler> {
|
|
||||||
object: *mut RcImpl<_cef_render_handler_t, Self>,
|
|
||||||
event_handler: H,
|
|
||||||
}
|
|
||||||
impl<H: CefEventHandler> RenderHandlerImpl<H> {
|
|
||||||
pub(crate) fn new(event_handler: H) -> Self {
|
|
||||||
Self {
|
|
||||||
object: std::ptr::null_mut(),
|
|
||||||
event_handler,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<H: CefEventHandler> ImplRenderHandler for RenderHandlerImpl<H> {
|
|
||||||
fn view_rect(&self, _browser: Option<&mut Browser>, rect: Option<&mut Rect>) {
|
|
||||||
if let Some(rect) = rect {
|
|
||||||
let view_info = self.event_handler.view_info();
|
|
||||||
*rect = Rect {
|
|
||||||
x: 0,
|
|
||||||
y: 0,
|
|
||||||
width: view_info.width() as i32,
|
|
||||||
height: view_info.height() as i32,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn on_paint(
|
|
||||||
&self,
|
|
||||||
_browser: Option<&mut Browser>,
|
|
||||||
_type_: PaintElementType,
|
|
||||||
_dirty_rect_count: usize,
|
|
||||||
_dirty_rects: Option<&Rect>,
|
|
||||||
buffer: *const u8,
|
|
||||||
width: ::std::os::raw::c_int,
|
|
||||||
height: ::std::os::raw::c_int,
|
|
||||||
) {
|
|
||||||
let buffer_size = (width * height * 4) as usize;
|
|
||||||
let buffer_slice = unsafe { std::slice::from_raw_parts(buffer, buffer_size) };
|
|
||||||
let frame_buffer = FrameBufferRef::new(buffer_slice, width as usize, height as usize).expect("Failed to create frame buffer");
|
|
||||||
|
|
||||||
self.event_handler.draw(frame_buffer)
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "accelerated_paint")]
|
|
||||||
fn on_accelerated_paint(&self, _browser: Option<&mut Browser>, type_: PaintElementType, _dirty_rect_count: usize, _dirty_rects: Option<&Rect>, info: Option<&cef::AcceleratedPaintInfo>) {
|
|
||||||
use cef::osr_texture_import::SharedTextureHandle;
|
|
||||||
|
|
||||||
if type_ != PaintElementType::default() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
let shared_handle = SharedTextureHandle::new(info.unwrap());
|
|
||||||
if let SharedTextureHandle::Unsupported = shared_handle {
|
|
||||||
tracing::error!("Platform does not support accelerated painting");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.event_handler.draw_gpu(shared_handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn get_raw(&self) -> *mut _cef_render_handler_t {
|
|
||||||
self.object.cast()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<H: CefEventHandler> Clone for RenderHandlerImpl<H> {
|
|
||||||
fn clone(&self) -> Self {
|
|
||||||
unsafe {
|
|
||||||
let rc_impl = &mut *self.object;
|
|
||||||
rc_impl.interface.add_ref();
|
|
||||||
}
|
|
||||||
Self {
|
|
||||||
object: self.object,
|
|
||||||
event_handler: self.event_handler.duplicate(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl<H: CefEventHandler> Rc for RenderHandlerImpl<H> {
|
|
||||||
fn as_base(&self) -> &cef_base_ref_counted_t {
|
|
||||||
unsafe {
|
|
||||||
let base = &*self.object;
|
|
||||||
std::mem::transmute(&base.cef_object)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl<H: CefEventHandler> WrapRenderHandler for RenderHandlerImpl<H> {
|
|
||||||
fn wrap_rc(&mut self, object: *mut RcImpl<_cef_render_handler_t, Self>) {
|
|
||||||
self.object = object;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
#[derive(clap::Parser)]
|
#[derive(clap::Parser)]
|
||||||
#[clap(name = "graphite-editor", version)]
|
#[clap(name = "graphite", version)]
|
||||||
pub struct Cli {
|
pub struct Cli {
|
||||||
#[arg(help = "Files to open on startup")]
|
#[arg(help = "Files to open on startup")]
|
||||||
pub files: Vec<std::path::PathBuf>,
|
pub files: Vec<std::path::PathBuf>,
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
pub(crate) const APP_NAME: &str = "Graphite";
|
pub(crate) const APP_NAME: &str = "Graphite";
|
||||||
pub(crate) const APP_ID: &str = "rs.graphite.GraphiteEditor";
|
#[cfg(any(target_os = "linux", target_os = "windows"))]
|
||||||
|
pub(crate) const APP_ID: &str = "art.graphite.Graphite";
|
||||||
|
|
||||||
pub(crate) const APP_DIRECTORY_NAME: &str = "graphite-editor";
|
#[cfg(target_os = "linux")]
|
||||||
|
pub(crate) const APP_DIRECTORY_NAME: &str = "graphite";
|
||||||
|
#[cfg(not(target_os = "linux"))]
|
||||||
|
pub(crate) const APP_DIRECTORY_NAME: &str = "Graphite";
|
||||||
|
pub(crate) const APP_LOCK_FILE_NAME: &str = "instance.lock";
|
||||||
|
pub(crate) const APP_SOCKET_FILE_NAME: &str = "instance.sock";
|
||||||
pub(crate) const APP_STATE_FILE_NAME: &str = "state.ron";
|
pub(crate) const APP_STATE_FILE_NAME: &str = "state.ron";
|
||||||
pub(crate) const APP_PREFERENCES_FILE_NAME: &str = "preferences.ron";
|
pub(crate) const APP_PREFERENCES_FILE_NAME: &str = "preferences.ron";
|
||||||
pub(crate) const APP_DOCUMENTS_DIRECTORY_NAME: &str = "documents";
|
pub(crate) const APP_DOCUMENTS_DIRECTORY_NAME: &str = "documents";
|
||||||
|
pub(crate) const APP_RESOURCES_DIRECTORY_NAME: &str = "resources";
|
||||||
// CEF configuration constants
|
|
||||||
pub(crate) const CEF_WINDOWLESS_FRAME_RATE: i32 = 60;
|
|
||||||
pub(crate) const CEF_MESSAGE_LOOP_MAX_ITERATIONS: usize = 10;
|
|
||||||
+39
-6
@@ -1,22 +1,55 @@
|
|||||||
use std::fs::create_dir_all;
|
use std::fs;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use crate::consts::{APP_DIRECTORY_NAME, APP_DOCUMENTS_DIRECTORY_NAME};
|
use crate::consts::{APP_DIRECTORY_NAME, APP_DOCUMENTS_DIRECTORY_NAME, APP_RESOURCES_DIRECTORY_NAME};
|
||||||
|
|
||||||
pub(crate) fn ensure_dir_exists(path: &PathBuf) {
|
pub(crate) fn ensure_dir_exists(path: &PathBuf) {
|
||||||
if !path.exists() {
|
if !path.exists() {
|
||||||
create_dir_all(path).unwrap_or_else(|_| panic!("Failed to create directory at {path:?}"));
|
fs::create_dir_all(path).unwrap_or_else(|_| panic!("Failed to create directory at {path:?}"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn graphite_data_dir() -> PathBuf {
|
pub(crate) fn clear_dir(path: &PathBuf) {
|
||||||
|
let Ok(entries) = fs::read_dir(path) else {
|
||||||
|
tracing::error!("Failed to read directory at {path:?}");
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
for entry in entries.flatten() {
|
||||||
|
let entry_path = entry.path();
|
||||||
|
if entry_path.is_dir() {
|
||||||
|
if let Err(e) = fs::remove_dir_all(&entry_path) {
|
||||||
|
tracing::error!("Failed to remove directory at {:?}: {}", entry_path, e);
|
||||||
|
}
|
||||||
|
} else if entry_path.is_file()
|
||||||
|
&& let Err(e) = fs::remove_file(&entry_path)
|
||||||
|
{
|
||||||
|
tracing::error!("Failed to remove file at {:?}: {}", entry_path, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn app_data_dir() -> PathBuf {
|
||||||
let path = dirs::data_dir().expect("Failed to get data directory").join(APP_DIRECTORY_NAME);
|
let path = dirs::data_dir().expect("Failed to get data directory").join(APP_DIRECTORY_NAME);
|
||||||
ensure_dir_exists(&path);
|
ensure_dir_exists(&path);
|
||||||
path
|
path
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn graphite_autosave_documents_dir() -> PathBuf {
|
pub(crate) fn app_autosave_documents_dir() -> PathBuf {
|
||||||
let path = graphite_data_dir().join(APP_DOCUMENTS_DIRECTORY_NAME);
|
let path = app_data_dir().join(APP_DOCUMENTS_DIRECTORY_NAME);
|
||||||
ensure_dir_exists(&path);
|
ensure_dir_exists(&path);
|
||||||
path
|
path
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) fn app_resources_dir() -> PathBuf {
|
||||||
|
let path = app_data_dir().join(APP_RESOURCES_DIRECTORY_NAME);
|
||||||
|
ensure_dir_exists(&path);
|
||||||
|
path
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Eventually remove this cleanup code for the old "browser" CEF directory
|
||||||
|
pub(crate) fn delete_old_cef_browser_directory() {
|
||||||
|
let old_browser_dir = crate::dirs::app_data_dir().join("browser");
|
||||||
|
if old_browser_dir.is_dir() {
|
||||||
|
let _ = std::fs::remove_dir_all(&old_browser_dir);
|
||||||
|
}
|
||||||
|
}
|
||||||
+13
-4
@@ -1,15 +1,24 @@
|
|||||||
|
use crate::ui::Cursor;
|
||||||
use crate::wrapper::NodeGraphExecutionResult;
|
use crate::wrapper::NodeGraphExecutionResult;
|
||||||
use crate::wrapper::messages::DesktopWrapperMessage;
|
use crate::wrapper::messages::DesktopWrapperMessage;
|
||||||
|
|
||||||
pub(crate) enum AppEvent {
|
pub(crate) enum AppEvent {
|
||||||
UiUpdate(wgpu::Texture),
|
UiUpdate(wgpu::Texture),
|
||||||
CursorChange(winit::cursor::Cursor),
|
CursorChange(Cursor),
|
||||||
ScheduleBrowserWork(std::time::Instant),
|
|
||||||
WebCommunicationInitialized,
|
WebCommunicationInitialized,
|
||||||
DesktopWrapperMessage(DesktopWrapperMessage),
|
DesktopWrapperMessage(DesktopWrapperMessage),
|
||||||
NodeGraphExecutionResult(NodeGraphExecutionResult),
|
NodeGraphExecutionResult(NodeGraphExecutionResult),
|
||||||
CloseWindow,
|
ClipboardRead,
|
||||||
MenuEvent { id: u64 },
|
ClipboardWrite {
|
||||||
|
content: String,
|
||||||
|
},
|
||||||
|
Exit,
|
||||||
|
UiCrashed,
|
||||||
|
OpenFiles(Vec<std::path::PathBuf>),
|
||||||
|
#[cfg(target_os = "macos")]
|
||||||
|
MenuEvent {
|
||||||
|
id: String,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
|||||||
@@ -1,20 +1,18 @@
|
|||||||
use crate::wrapper::{WgpuContext, WgpuContextBuilder, WgpuFeatures};
|
use crate::wrapper::{WgpuContext, WgpuContextBuilder, WgpuFeatures};
|
||||||
|
|
||||||
pub(super) async fn create_wgpu_context() -> WgpuContext {
|
pub(super) async fn create_wgpu_context() -> WgpuContext {
|
||||||
let wgpu_context_builder = WgpuContextBuilder::new().with_features(WgpuFeatures::PUSH_CONSTANTS);
|
let mut wgpu_context_builder = WgpuContextBuilder::new().with_features(WgpuFeatures::IMMEDIATES);
|
||||||
|
|
||||||
|
// TODO: make this configurable via cli flags instead
|
||||||
|
if let Some(index) = std::env::var("GRAPHITE_WGPU_ADAPTER").ok().and_then(|s| s.parse().ok()) {
|
||||||
|
tracing::info!("Overriding WGPU adapter selection with adapter index {index}");
|
||||||
|
wgpu_context_builder = wgpu_context_builder.with_selection(index);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: add a cli flag to list adapters and exit instead of always printing
|
// TODO: add a cli flag to list adapters and exit instead of always printing
|
||||||
println!("\nAvailable WGPU adapters:\n{}", wgpu_context_builder.available_adapters_fmt().await);
|
println!("\nAvailable WGPU adapters:\n{}", wgpu_context_builder.available_adapters_fmt().await);
|
||||||
|
|
||||||
// TODO: make this configurable via cli flags instead
|
let wgpu_context = wgpu_context_builder.build().await.expect("Failed to create WGPU context");
|
||||||
let wgpu_context = match std::env::var("GRAPHITE_WGPU_ADAPTER").ok().and_then(|s| s.parse().ok()) {
|
|
||||||
None => wgpu_context_builder.build().await,
|
|
||||||
Some(adapter_index) => {
|
|
||||||
tracing::info!("Overriding WGPU adapter selection with adapter index {adapter_index}");
|
|
||||||
wgpu_context_builder.build_with_adapter_selection(|_| Some(adapter_index)).await
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.expect("Failed to create WGPU context");
|
|
||||||
|
|
||||||
// TODO: add a cli flag to list adapters and exit instead of always printing
|
// TODO: add a cli flag to list adapters and exit instead of always printing
|
||||||
println!("Using WGPU adapter: {:?}", wgpu_context.adapter.get_info());
|
println!("Using WGPU adapter: {:?}", wgpu_context.adapter.get_info());
|
||||||
|
|||||||
@@ -0,0 +1,455 @@
|
|||||||
|
use std::collections::VecDeque;
|
||||||
|
use std::time::{Duration, Instant};
|
||||||
|
use winit::dpi::PhysicalPosition;
|
||||||
|
use winit::event::{ButtonSource, ElementState, MouseButton, MouseScrollDelta, PointerSource, TabletToolData, TabletToolKind, WindowEvent};
|
||||||
|
use winit::keyboard::ModifiersState;
|
||||||
|
|
||||||
|
use crate::ui::{InputEvent, MULTICLICK_ALLOWED_TRAVEL, MULTICLICK_TIMEOUT, PINCH_ZOOM_SPEED, SCROLL_LINE_HEIGHT, SCROLL_LINE_WIDTH, SCROLL_SPEED_X, SCROLL_SPEED_Y};
|
||||||
|
use crate::wrapper::messages::{EditorPointerState, InputMessage, ModifierKeys, MouseKeys, ScrollDelta};
|
||||||
|
|
||||||
|
// Marks input event as observe-only, meaning it should not result in any input messages being send by the frontend.
|
||||||
|
// And should instead be ignored by frontend input processing and only be used to update the UI state (hover, cursor).
|
||||||
|
// TODO(Timon): Remove and find a less hacky solution
|
||||||
|
trait ObserveOnlyExt {
|
||||||
|
fn observe_only(self) -> Self;
|
||||||
|
}
|
||||||
|
impl ObserveOnlyExt for crate::ui::InputEventBuilder {
|
||||||
|
fn observe_only(self) -> Self {
|
||||||
|
self.num_lock(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) struct InputState {
|
||||||
|
start: Instant,
|
||||||
|
viewport_info: Option<ViewportInfo>,
|
||||||
|
direct_input: bool,
|
||||||
|
modifiers: ModifiersState,
|
||||||
|
pointer_position: PhysicalPosition<f64>,
|
||||||
|
pointer_state: PointerState,
|
||||||
|
click_tracker: ClickTracker,
|
||||||
|
shake_tracker: ShakeTracker,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl InputState {
|
||||||
|
pub(crate) fn new() -> Self {
|
||||||
|
Self {
|
||||||
|
start: Instant::now(),
|
||||||
|
viewport_info: None,
|
||||||
|
direct_input: false,
|
||||||
|
modifiers: ModifiersState::default(),
|
||||||
|
pointer_position: PhysicalPosition::default(),
|
||||||
|
pointer_state: PointerState::Hover { route: Route::Ui },
|
||||||
|
click_tracker: ClickTracker::default(),
|
||||||
|
shake_tracker: ShakeTracker::default(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn set_viewport_info(&mut self, x: f64, y: f64, width: f64, height: f64, scale: f64) {
|
||||||
|
self.viewport_info = Some(ViewportInfo { x, y, width, height, scale });
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn set_direct_input(&mut self, enabled: bool) {
|
||||||
|
self.direct_input = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn lock_pointer(&mut self) {
|
||||||
|
self.pointer_state = match self.pointer_state {
|
||||||
|
PointerState::Hover { route } => PointerState::Locked {
|
||||||
|
route,
|
||||||
|
keys: MouseKeys::empty(),
|
||||||
|
position: self.pointer_position,
|
||||||
|
},
|
||||||
|
PointerState::Stroke { route, keys } | PointerState::Locked { route, keys, .. } => PointerState::Locked {
|
||||||
|
route,
|
||||||
|
keys,
|
||||||
|
position: self.pointer_position,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn unlock_pointer(&mut self) -> Option<PhysicalPosition<f64>> {
|
||||||
|
let PointerState::Locked {
|
||||||
|
route: resume,
|
||||||
|
keys,
|
||||||
|
position: restore,
|
||||||
|
} = self.pointer_state
|
||||||
|
else {
|
||||||
|
return None;
|
||||||
|
};
|
||||||
|
self.pointer_position = restore;
|
||||||
|
self.pointer_state = match keys.is_empty() {
|
||||||
|
true => PointerState::Hover { route: Route::Ui },
|
||||||
|
false => PointerState::Stroke { route: resume, keys },
|
||||||
|
};
|
||||||
|
Some(restore)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn pointer_locked(&self) -> bool {
|
||||||
|
matches!(self.pointer_state, PointerState::Locked { .. })
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn modifiers(&self) -> ModifiersState {
|
||||||
|
self.modifiers
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn process(&mut self, event: &WindowEvent, mut editor_callback: impl FnMut(InputMessage), mut ui_callback: impl FnMut(InputEvent)) {
|
||||||
|
match event {
|
||||||
|
WindowEvent::PointerMoved { position, source, .. } => {
|
||||||
|
self.pointer_position = *position;
|
||||||
|
|
||||||
|
let route = match self.pointer_state {
|
||||||
|
PointerState::Hover { .. } => {
|
||||||
|
let next = self.route(*position);
|
||||||
|
self.pointer_state = PointerState::Hover { route: next };
|
||||||
|
next
|
||||||
|
}
|
||||||
|
PointerState::Stroke { route, .. } => route,
|
||||||
|
PointerState::Locked { keys, route: resume, .. } => match keys.is_empty() {
|
||||||
|
true => Route::Ui,
|
||||||
|
false => resume,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
match route {
|
||||||
|
Route::Ui => ui_callback(InputEvent::pointer().position(*position).moved().modifiers(self.modifiers).build()),
|
||||||
|
Route::Editor => {
|
||||||
|
if !self.pointer_locked() {
|
||||||
|
ui_callback(InputEvent::pointer().position(*position).moved().modifiers(self.modifiers).observe_only().build());
|
||||||
|
}
|
||||||
|
let editor_mouse_state = match source {
|
||||||
|
PointerSource::TabletTool { kind, data } => self.tablet_pointer_state(kind, data),
|
||||||
|
_ => self.pointer_state(),
|
||||||
|
};
|
||||||
|
let modifier_keys = self.modifier_keys();
|
||||||
|
if self.shake_tracker.detect(*position, self.start.elapsed()) {
|
||||||
|
editor_callback(InputMessage::PointerShake { editor_mouse_state, modifier_keys });
|
||||||
|
}
|
||||||
|
editor_callback(InputMessage::PointerMove { editor_mouse_state, modifier_keys });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WindowEvent::PointerEntered { position, .. } => {
|
||||||
|
self.pointer_position = *position;
|
||||||
|
ui_callback(InputEvent::pointer().position(*position).entered().modifiers(self.modifiers).build())
|
||||||
|
}
|
||||||
|
WindowEvent::PointerLeft { position: Some(position), .. } => {
|
||||||
|
self.pointer_position = *position;
|
||||||
|
ui_callback(InputEvent::pointer().position(*position).exited().modifiers(self.modifiers).build())
|
||||||
|
}
|
||||||
|
WindowEvent::PointerLeft { position: None, .. } => ui_callback(InputEvent::pointer().exited().modifiers(self.modifiers).build()),
|
||||||
|
WindowEvent::PointerButton { state, button, position, .. } => {
|
||||||
|
self.pointer_position = *position;
|
||||||
|
|
||||||
|
let mouse_button = button.clone().mouse_button();
|
||||||
|
let keys = match mouse_button {
|
||||||
|
Some(MouseButton::Left) => MouseKeys::LEFT,
|
||||||
|
Some(MouseButton::Right) => MouseKeys::RIGHT,
|
||||||
|
Some(MouseButton::Middle) => MouseKeys::MIDDLE,
|
||||||
|
Some(MouseButton::Back) => MouseKeys::BACK,
|
||||||
|
Some(MouseButton::Forward) => MouseKeys::FORWARD,
|
||||||
|
_ => MouseKeys::NONE,
|
||||||
|
};
|
||||||
|
|
||||||
|
let (pointer, route) = match self.pointer_state {
|
||||||
|
PointerState::Hover { route } => match (state.is_pressed(), keys.is_empty()) {
|
||||||
|
(true, false) => {
|
||||||
|
let route = self.route(*position);
|
||||||
|
(PointerState::Stroke { route, keys }, route)
|
||||||
|
}
|
||||||
|
(true, true) => (PointerState::Hover { route }, self.route(*position)),
|
||||||
|
(false, _) => (PointerState::Hover { route }, route),
|
||||||
|
},
|
||||||
|
PointerState::Stroke { route, keys: mut held } => {
|
||||||
|
match state.is_pressed() {
|
||||||
|
true => held.insert(keys),
|
||||||
|
false => held.remove(keys),
|
||||||
|
}
|
||||||
|
match held.is_empty() {
|
||||||
|
true => (PointerState::Hover { route }, route),
|
||||||
|
false => (PointerState::Stroke { route, keys: held }, route),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
PointerState::Locked { route, keys: mut held, position } => {
|
||||||
|
let resume = if state.is_pressed() && held.is_empty() { Route::Ui } else { route };
|
||||||
|
match state.is_pressed() {
|
||||||
|
true => held.insert(keys),
|
||||||
|
false => held.remove(keys),
|
||||||
|
}
|
||||||
|
(PointerState::Locked { route: resume, keys: held, position }, Route::Ui)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
self.pointer_state = pointer;
|
||||||
|
|
||||||
|
let count = mouse_button.map_or(1, |button| self.click_tracker.input(*position, button, *state));
|
||||||
|
|
||||||
|
let back_or_forward = matches!(mouse_button, Some(MouseButton::Back | MouseButton::Forward));
|
||||||
|
let pointer = InputEvent::pointer().position(*position);
|
||||||
|
let input = match state {
|
||||||
|
ElementState::Pressed => pointer.pressed(button.clone(), count),
|
||||||
|
ElementState::Released => pointer.released(button.clone(), count),
|
||||||
|
}
|
||||||
|
.modifiers(self.modifiers);
|
||||||
|
if self.pointer_locked() || keys.is_empty() || !(back_or_forward || route == Route::Editor) {
|
||||||
|
ui_callback(input.build());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if route == Route::Editor {
|
||||||
|
ui_callback(input.observe_only().build());
|
||||||
|
}
|
||||||
|
|
||||||
|
let editor_mouse_state = match button {
|
||||||
|
ButtonSource::TabletTool { kind, data, .. } => self.tablet_pointer_state(kind, data),
|
||||||
|
_ => self.pointer_state(),
|
||||||
|
};
|
||||||
|
let modifier_keys = self.modifier_keys();
|
||||||
|
match state {
|
||||||
|
ElementState::Pressed => editor_callback(InputMessage::PointerDown { editor_mouse_state, modifier_keys }),
|
||||||
|
ElementState::Released if count % 2 == 0 => {
|
||||||
|
editor_callback(InputMessage::PointerUp { editor_mouse_state, modifier_keys });
|
||||||
|
editor_callback(InputMessage::DoubleClick {
|
||||||
|
editor_mouse_state: EditorPointerState {
|
||||||
|
mouse_keys: keys,
|
||||||
|
..editor_mouse_state
|
||||||
|
},
|
||||||
|
modifier_keys,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
ElementState::Released => editor_callback(InputMessage::PointerUp { editor_mouse_state, modifier_keys }),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
WindowEvent::MouseWheel { delta, .. } => {
|
||||||
|
if self.pointer_locked() || self.ui_captures(self.pointer_position) {
|
||||||
|
let input = match delta {
|
||||||
|
MouseScrollDelta::LineDelta(x, y) => InputEvent::pointer().scrolled_lines(f64::from(*x), f64::from(*y)),
|
||||||
|
MouseScrollDelta::PixelDelta(position) => InputEvent::pointer().scrolled_pixels(position.x, position.y),
|
||||||
|
_ => return,
|
||||||
|
};
|
||||||
|
ui_callback(input.modifiers(self.modifiers).build());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let (x, y) = match delta {
|
||||||
|
MouseScrollDelta::LineDelta(x, y) => (f64::from(*x) * SCROLL_LINE_WIDTH, f64::from(*y) * SCROLL_LINE_HEIGHT),
|
||||||
|
MouseScrollDelta::PixelDelta(position) => (position.x, position.y),
|
||||||
|
_ => return,
|
||||||
|
};
|
||||||
|
|
||||||
|
let scroll_delta = ScrollDelta::new(-x * SCROLL_SPEED_X, -y * SCROLL_SPEED_Y, 0.);
|
||||||
|
|
||||||
|
editor_callback(InputMessage::WheelScroll {
|
||||||
|
editor_mouse_state: EditorPointerState { scroll_delta, ..self.pointer_state() },
|
||||||
|
modifier_keys: self.modifier_keys(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
WindowEvent::PinchGesture { delta, .. } => {
|
||||||
|
if self.pointer_locked() || self.ui_captures(self.pointer_position) || !delta.is_normal() {
|
||||||
|
ui_callback(InputEvent::pointer().zoomed(*delta).modifiers(self.modifiers).build());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: This is a temporary solution to handle pinch gestures, we should handle pinch gestures editor-side instead.
|
||||||
|
let scroll_delta = ScrollDelta::new(0., -delta * PINCH_ZOOM_SPEED, 0.);
|
||||||
|
editor_callback(InputMessage::WheelScroll {
|
||||||
|
editor_mouse_state: EditorPointerState { scroll_delta, ..self.pointer_state() },
|
||||||
|
modifier_keys: self.modifier_keys() | ModifierKeys::CONTROL,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
WindowEvent::ModifiersChanged(modifiers) => {
|
||||||
|
self.modifiers = modifiers.state();
|
||||||
|
}
|
||||||
|
WindowEvent::KeyboardInput { event, .. } => ui_callback(InputEvent::key(event).modifiers(self.modifiers).build()),
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn scale(&self) -> f64 {
|
||||||
|
self.viewport_info.as_ref().map_or(1., |info| info.scale)
|
||||||
|
}
|
||||||
|
|
||||||
|
fn ui_captures(&self, position: PhysicalPosition<f64>) -> bool {
|
||||||
|
!self.direct_input || !self.viewport_info.as_ref().is_some_and(|info| info.contains(position))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn route(&self, position: PhysicalPosition<f64>) -> Route {
|
||||||
|
if self.ui_captures(position) { Route::Ui } else { Route::Editor }
|
||||||
|
}
|
||||||
|
|
||||||
|
fn pointer_keys(&self) -> MouseKeys {
|
||||||
|
match self.pointer_state {
|
||||||
|
PointerState::Hover { .. } => MouseKeys::empty(),
|
||||||
|
PointerState::Stroke { keys, .. } | PointerState::Locked { keys, .. } => keys,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn pointer_state(&self) -> EditorPointerState {
|
||||||
|
EditorPointerState {
|
||||||
|
editor_position: (self.pointer_position.x / self.scale(), self.pointer_position.y / self.scale()).into(),
|
||||||
|
mouse_keys: self.pointer_keys(),
|
||||||
|
time: Some(self.start.elapsed().as_secs_f64() * 1000.),
|
||||||
|
..Default::default()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn tablet_pointer_state(&self, kind: &TabletToolKind, data: &TabletToolData) -> EditorPointerState {
|
||||||
|
EditorPointerState {
|
||||||
|
pressure: data.force.map(|force| force.normalized(None)),
|
||||||
|
tilt: data.clone().tilt().map(|tilt| (f64::from(tilt.x), f64::from(tilt.y)).into()),
|
||||||
|
twist: data.twist.map(f64::from),
|
||||||
|
wheel: data.tangential_force.map(f64::from),
|
||||||
|
eraser: matches!(kind, TabletToolKind::Eraser),
|
||||||
|
..self.pointer_state()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn modifier_keys(&self) -> ModifierKeys {
|
||||||
|
let mut keys = ModifierKeys::empty();
|
||||||
|
keys.set(ModifierKeys::SHIFT, self.modifiers.shift_key());
|
||||||
|
keys.set(ModifierKeys::CONTROL, self.modifiers.control_key());
|
||||||
|
keys.set(ModifierKeys::ALT, self.modifiers.alt_key());
|
||||||
|
keys.set(ModifierKeys::META_OR_COMMAND, self.modifiers.meta_key());
|
||||||
|
keys
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy)]
|
||||||
|
enum PointerState {
|
||||||
|
Hover { route: Route },
|
||||||
|
Stroke { route: Route, keys: MouseKeys },
|
||||||
|
Locked { route: Route, keys: MouseKeys, position: PhysicalPosition<f64> },
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, PartialEq)]
|
||||||
|
enum Route {
|
||||||
|
Ui,
|
||||||
|
Editor,
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ViewportInfo {
|
||||||
|
x: f64,
|
||||||
|
y: f64,
|
||||||
|
width: f64,
|
||||||
|
height: f64,
|
||||||
|
scale: f64,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ViewportInfo {
|
||||||
|
fn contains(&self, position: PhysicalPosition<f64>) -> bool {
|
||||||
|
position.x >= self.x && position.y >= self.y && position.x <= self.x + self.width && position.y <= self.y + self.height
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
|
struct ClickTracker {
|
||||||
|
left: ClickChains,
|
||||||
|
right: ClickChains,
|
||||||
|
middle: ClickChains,
|
||||||
|
back: ClickChains,
|
||||||
|
forward: ClickChains,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ClickTracker {
|
||||||
|
fn input(&mut self, position: PhysicalPosition<f64>, button: MouseButton, state: ElementState) -> u32 {
|
||||||
|
let position = (position.x as i32, position.y as i32);
|
||||||
|
let clicks = match button {
|
||||||
|
MouseButton::Left => &mut self.left,
|
||||||
|
MouseButton::Right => &mut self.right,
|
||||||
|
MouseButton::Middle => &mut self.middle,
|
||||||
|
MouseButton::Back => &mut self.back,
|
||||||
|
MouseButton::Forward => &mut self.forward,
|
||||||
|
_ => return 1,
|
||||||
|
};
|
||||||
|
let chain = match state {
|
||||||
|
ElementState::Pressed => &mut clicks.down,
|
||||||
|
ElementState::Released => &mut clicks.up,
|
||||||
|
};
|
||||||
|
|
||||||
|
let now = Instant::now();
|
||||||
|
let count = match chain {
|
||||||
|
Some(previous) => {
|
||||||
|
let within_time = now.saturating_duration_since(previous.time) <= MULTICLICK_TIMEOUT;
|
||||||
|
let dx = position.0.abs_diff(previous.position.0) as usize;
|
||||||
|
let dy = position.1.abs_diff(previous.position.1) as usize;
|
||||||
|
let within_distance = dx <= MULTICLICK_ALLOWED_TRAVEL && dy <= MULTICLICK_ALLOWED_TRAVEL;
|
||||||
|
if within_time && within_distance { previous.count.saturating_add(1) } else { 1 }
|
||||||
|
}
|
||||||
|
None => 1,
|
||||||
|
};
|
||||||
|
*chain = Some(Click { time: now, position, count });
|
||||||
|
count
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
|
struct ClickChains {
|
||||||
|
down: Option<Click>,
|
||||||
|
up: Option<Click>,
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Click {
|
||||||
|
time: Instant,
|
||||||
|
position: (i32, i32),
|
||||||
|
count: u32,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Default)]
|
||||||
|
struct ShakeTracker {
|
||||||
|
samples: VecDeque<(PhysicalPosition<f64>, Duration)>,
|
||||||
|
last: Option<Duration>,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Keep heuristic and constants in sync with `detectShake` in `frontend/src/utility-functions/input.ts`.
|
||||||
|
impl ShakeTracker {
|
||||||
|
const SENSITIVITY_DIRECTION_CHANGES: usize = 3;
|
||||||
|
const SENSITIVITY_DISTANCE_TO_DISPLACEMENT_RATIO: f64 = 0.1;
|
||||||
|
const DETECTION_WINDOW: Duration = Duration::from_millis(500);
|
||||||
|
const DEBOUNCE: Duration = Duration::from_millis(1000);
|
||||||
|
|
||||||
|
fn detect(&mut self, position: PhysicalPosition<f64>, now: Duration) -> bool {
|
||||||
|
self.samples.push_back((position, now));
|
||||||
|
|
||||||
|
while self.samples.front().is_some_and(|&(_, time)| now.saturating_sub(time) > Self::DETECTION_WINDOW) {
|
||||||
|
self.samples.pop_front();
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.samples.len() <= 3 || self.last.is_some_and(|time| now.saturating_sub(time) <= Self::DEBOUNCE) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut total_distance_squared = 0.;
|
||||||
|
for i in 1..self.samples.len() {
|
||||||
|
let (p1, _) = self.samples[i - 1];
|
||||||
|
let (p2, _) = self.samples[i];
|
||||||
|
total_distance_squared += (p2.x - p1.x).powi(2) + (p2.y - p1.y).powi(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut direction_changes = 0;
|
||||||
|
let mut average = PhysicalPosition::new(0., 0.);
|
||||||
|
let interior_count = self.samples.len() - 2;
|
||||||
|
for i in 0..interior_count {
|
||||||
|
let (p1, _) = self.samples[i];
|
||||||
|
let (p2, _) = self.samples[i + 1];
|
||||||
|
let (p3, _) = self.samples[i + 2];
|
||||||
|
|
||||||
|
let vector1 = (p2.x - p1.x, p2.y - p1.y);
|
||||||
|
let vector2 = (p3.x - p2.x, p3.y - p2.y);
|
||||||
|
if vector1.0 * vector2.0 + vector1.1 * vector2.1 < 0. {
|
||||||
|
direction_changes += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
average.x += p2.x;
|
||||||
|
average.y += p2.y;
|
||||||
|
}
|
||||||
|
average.x /= interior_count as f64;
|
||||||
|
average.y /= interior_count as f64;
|
||||||
|
|
||||||
|
let (last, _) = self.samples[self.samples.len() - 1];
|
||||||
|
let displacement_squared = (last.x - average.x).powi(2) + (last.y - average.y).powi(2);
|
||||||
|
|
||||||
|
if Self::SENSITIVITY_DISTANCE_TO_DISPLACEMENT_RATIO * total_distance_squared >= displacement_squared && direction_changes >= Self::SENSITIVITY_DIRECTION_CHANGES {
|
||||||
|
self.last = Some(now);
|
||||||
|
self.samples.clear();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
+144
-50
@@ -1,82 +1,176 @@
|
|||||||
|
use crate::app::App;
|
||||||
|
use crate::cli::Cli;
|
||||||
|
use crate::consts::APP_LOCK_FILE_NAME;
|
||||||
|
use crate::event::{AppEvent, CreateAppEventSchedulerEventLoopExt};
|
||||||
use clap::Parser;
|
use clap::Parser;
|
||||||
use std::process::exit;
|
use std::io::Write;
|
||||||
|
use std::process::ExitCode;
|
||||||
use tracing_subscriber::EnvFilter;
|
use tracing_subscriber::EnvFilter;
|
||||||
|
use ui::{Acceleration, UiConfig, UiContext, UiEvent, UiSetupResult};
|
||||||
use winit::event_loop::EventLoop;
|
use winit::event_loop::EventLoop;
|
||||||
|
|
||||||
pub(crate) mod consts;
|
pub(crate) use graphite_desktop_ui as ui;
|
||||||
|
pub(crate) use graphite_desktop_wrapper as wrapper;
|
||||||
|
|
||||||
mod app;
|
mod app;
|
||||||
mod cef;
|
|
||||||
mod cli;
|
mod cli;
|
||||||
mod dirs;
|
mod dirs;
|
||||||
mod event;
|
mod event;
|
||||||
|
mod gpu_context;
|
||||||
|
mod input;
|
||||||
mod persist;
|
mod persist;
|
||||||
|
mod preferences;
|
||||||
mod render;
|
mod render;
|
||||||
|
mod socket;
|
||||||
mod window;
|
mod window;
|
||||||
|
|
||||||
mod gpu_context;
|
pub(crate) mod consts;
|
||||||
|
|
||||||
pub(crate) use graphite_desktop_wrapper as wrapper;
|
pub fn start() -> ExitCode {
|
||||||
|
|
||||||
use app::App;
|
|
||||||
use cef::CefHandler;
|
|
||||||
use cli::Cli;
|
|
||||||
use event::CreateAppEventSchedulerEventLoopExt;
|
|
||||||
|
|
||||||
pub fn start() {
|
|
||||||
tracing_subscriber::fmt().with_env_filter(EnvFilter::from_default_env()).init();
|
tracing_subscriber::fmt().with_env_filter(EnvFilter::from_default_env()).init();
|
||||||
|
|
||||||
let cef_context_builder = cef::CefContextBuilder::<CefHandler>::new();
|
let ui_context = match UiContext::setup() {
|
||||||
|
UiSetupResult::Ready(context) => context,
|
||||||
if cef_context_builder.is_sub_process() {
|
UiSetupResult::Helper(code) => return code,
|
||||||
// We are in a CEF subprocess
|
UiSetupResult::Failed => {
|
||||||
// This will block until the CEF subprocess quits
|
tracing::error!("Failed to set up the UI runtime");
|
||||||
let error = cef_context_builder.execute_sub_process();
|
return ExitCode::FAILURE;
|
||||||
tracing::warn!("Cef subprocess failed with error: {error}");
|
}
|
||||||
return;
|
};
|
||||||
}
|
|
||||||
|
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
|
|
||||||
|
let Ok(lock_file) = std::fs::OpenOptions::new()
|
||||||
|
.read(true)
|
||||||
|
.write(true)
|
||||||
|
.create(true)
|
||||||
|
.truncate(true)
|
||||||
|
.open(dirs::app_data_dir().join(APP_LOCK_FILE_NAME))
|
||||||
|
else {
|
||||||
|
tracing::error!("Failed to open lock file.");
|
||||||
|
return ExitCode::FAILURE;
|
||||||
|
};
|
||||||
|
let mut lock = fd_lock::RwLock::new(lock_file);
|
||||||
|
let lock = match lock.try_write() {
|
||||||
|
Ok(mut guard) => {
|
||||||
|
tracing::info!("Acquired application lock");
|
||||||
|
let _ = guard.set_len(0);
|
||||||
|
let _ = write!(guard, "{}", std::process::id());
|
||||||
|
let _ = guard.sync_all();
|
||||||
|
guard
|
||||||
|
}
|
||||||
|
Err(_) => {
|
||||||
|
tracing::error!("Another instance is already running, Exiting.");
|
||||||
|
if !cli.files.is_empty()
|
||||||
|
&& let Err(error) = socket::send(socket::Message::OpenFiles(cli.files))
|
||||||
|
{
|
||||||
|
tracing::error!("Failed to send socket message to running instance: {}", error);
|
||||||
|
return ExitCode::FAILURE;
|
||||||
|
}
|
||||||
|
return ExitCode::SUCCESS;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
dirs::clear_dir(&ui::temp_dir_root());
|
||||||
|
|
||||||
|
// TODO: Eventually remove this cleanup code for the old "browser" CEF directory
|
||||||
|
dirs::delete_old_cef_browser_directory();
|
||||||
|
|
||||||
|
let mut prefs = preferences::read();
|
||||||
|
|
||||||
|
// Must be called before event loop initialization or native window integrations will break
|
||||||
|
App::init();
|
||||||
|
|
||||||
let wgpu_context = futures::executor::block_on(gpu_context::create_wgpu_context());
|
let wgpu_context = futures::executor::block_on(gpu_context::create_wgpu_context());
|
||||||
|
|
||||||
let event_loop = EventLoop::new().unwrap();
|
let event_loop = EventLoop::new().unwrap();
|
||||||
let (app_event_sender, app_event_receiver) = std::sync::mpsc::channel();
|
let (app_event_sender, app_event_receiver) = std::sync::mpsc::channel();
|
||||||
let app_event_scheduler = event_loop.create_app_event_scheduler(app_event_sender);
|
let app_event_scheduler = event_loop.create_app_event_scheduler(app_event_sender);
|
||||||
|
|
||||||
let (cef_view_info_sender, cef_view_info_receiver) = std::sync::mpsc::channel();
|
let _socket_handle = socket::start(app_event_scheduler.clone());
|
||||||
|
|
||||||
let cef_handler = cef::CefHandler::new(wgpu_context.clone(), app_event_scheduler.clone(), cef_view_info_receiver);
|
if cli.disable_ui_acceleration {
|
||||||
let cef_context = match cef_context_builder.initialize(cef_handler, cli.disable_ui_acceleration) {
|
prefs.disable_ui_acceleration = true;
|
||||||
Ok(c) => {
|
}
|
||||||
tracing::info!("CEF initialized successfully");
|
if prefs.disable_ui_acceleration {
|
||||||
c
|
println!("UI acceleration is disabled");
|
||||||
}
|
}
|
||||||
Err(cef::InitError::AlreadyRunning) => {
|
|
||||||
tracing::error!("Another instance is already running, Exiting.");
|
let acceleration = if prefs.disable_ui_acceleration { Acceleration::Disabled } else { Acceleration::Auto };
|
||||||
exit(0);
|
let ui_context = match ui_context.start(UiConfig { acceleration }) {
|
||||||
}
|
Ok(context) => context,
|
||||||
Err(cef::InitError::InitializationFailed(code)) => {
|
Err(error) => {
|
||||||
tracing::error!("Cef initialization failed with code: {code}");
|
tracing::error!("Failed to start the UI runtime: {error}");
|
||||||
exit(1);
|
return ExitCode::FAILURE;
|
||||||
}
|
|
||||||
Err(cef::InitError::BrowserCreationFailed) => {
|
|
||||||
tracing::error!("Failed to create CEF browser");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
Err(cef::InitError::RequestContextCreationFailed) => {
|
|
||||||
tracing::error!("Failed to create CEF request context");
|
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
let ui = match ui_context.instance(&wgpu_context.device, &wgpu_context.queue) {
|
||||||
|
Ok(ui) => ui,
|
||||||
|
Err(error) => {
|
||||||
|
tracing::error!("Failed to start the UI: {error}");
|
||||||
|
return ExitCode::FAILURE;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
tracing::info!("UI runtime started successfully");
|
||||||
|
|
||||||
let mut app = App::new(Box::new(cef_context), cef_view_info_sender, wgpu_context, app_event_receiver, app_event_scheduler, cli.files);
|
{
|
||||||
|
let ui = ui.clone();
|
||||||
|
let scheduler = app_event_scheduler.clone();
|
||||||
|
let spawned = std::thread::Builder::new().name("ui-events".to_string()).spawn(move || {
|
||||||
|
while let Some(event) = ui.recv() {
|
||||||
|
match event {
|
||||||
|
UiEvent::Ready => scheduler.schedule(AppEvent::WebCommunicationInitialized),
|
||||||
|
UiEvent::Frame(texture) => scheduler.schedule(AppEvent::UiUpdate(texture)),
|
||||||
|
UiEvent::Cursor(cursor) => scheduler.schedule(AppEvent::CursorChange(cursor)),
|
||||||
|
UiEvent::Message(message) => match wrapper::deserialize_editor_message(&message) {
|
||||||
|
Some(message) => scheduler.schedule(AppEvent::DesktopWrapperMessage(message)),
|
||||||
|
None => tracing::error!("Failed to deserialize web message"),
|
||||||
|
},
|
||||||
|
UiEvent::Failure(error) => {
|
||||||
|
tracing::error!("UI failure: {error}");
|
||||||
|
scheduler.schedule(AppEvent::UiCrashed);
|
||||||
|
}
|
||||||
|
UiEvent::Crashed => scheduler.schedule(AppEvent::UiCrashed),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if let Err(error) = spawned {
|
||||||
|
tracing::error!("Failed to spawn the UI event bridge thread: {error}");
|
||||||
|
return ExitCode::FAILURE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
event_loop.run_app(&mut app).unwrap();
|
let app = App::new(ui.clone(), wgpu_context, app_event_receiver, app_event_scheduler, prefs, cli.files);
|
||||||
}
|
|
||||||
|
|
||||||
pub fn start_helper() {
|
let exit_reason = app.run(event_loop);
|
||||||
let cef_context_builder = cef::CefContextBuilder::<CefHandler>::new_helper();
|
|
||||||
assert!(cef_context_builder.is_sub_process());
|
// ui needs to be shutdown before restarting
|
||||||
cef_context_builder.execute_sub_process();
|
ui.shutdown();
|
||||||
|
|
||||||
|
// If exiting due to a UI acceleration failure, update preferences to disable it for next launch
|
||||||
|
if matches!(exit_reason, app::ExitReason::UiAccelerationFailure) {
|
||||||
|
tracing::error!("Disabling UI acceleration");
|
||||||
|
preferences::modify(|prefs| {
|
||||||
|
prefs.disable_ui_acceleration = true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Explicitly drop the instance lock
|
||||||
|
drop(lock);
|
||||||
|
|
||||||
|
match exit_reason {
|
||||||
|
app::ExitReason::Restart | app::ExitReason::UiAccelerationFailure => {
|
||||||
|
tracing::info!("Restarting application");
|
||||||
|
let mut command = std::process::Command::new(std::env::current_exe().unwrap());
|
||||||
|
#[cfg(target_family = "unix")]
|
||||||
|
let _ = std::os::unix::process::CommandExt::exec(&mut command);
|
||||||
|
#[cfg(target_family = "unix")]
|
||||||
|
tracing::error!("Failed to restart application");
|
||||||
|
#[cfg(not(target_family = "unix"))]
|
||||||
|
let _ = command.spawn();
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
|
}
|
||||||
|
|
||||||
|
ExitCode::SUCCESS
|
||||||
}
|
}
|
||||||
+2
-2
@@ -1,3 +1,3 @@
|
|||||||
fn main() {
|
fn main() -> std::process::ExitCode {
|
||||||
graphite_desktop::start();
|
graphite_desktop::start()
|
||||||
}
|
}
|
||||||
+78
-201
@@ -1,214 +1,91 @@
|
|||||||
use crate::wrapper::messages::{Document, DocumentId, Preferences};
|
use crate::wrapper::messages::PersistedState;
|
||||||
|
|
||||||
#[derive(Default, serde::Serialize, serde::Deserialize)]
|
pub(crate) fn read_state() -> PersistedState {
|
||||||
pub(crate) struct PersistentData {
|
if let Err(error) = migrate_documents() {
|
||||||
documents: DocumentStore,
|
tracing::error!("Autosave migration failed: {error}");
|
||||||
current_document: Option<DocumentId>,
|
}
|
||||||
#[serde(skip)]
|
let path = state_file_path();
|
||||||
document_order: Option<Vec<DocumentId>>,
|
let data = match std::fs::read_to_string(&path) {
|
||||||
|
Ok(d) => d,
|
||||||
|
Err(e) if e.kind() == std::io::ErrorKind::NotFound => {
|
||||||
|
tracing::info!("No persistent data file found at {path:?}, starting fresh");
|
||||||
|
return PersistedState::default();
|
||||||
|
}
|
||||||
|
Err(e) => {
|
||||||
|
tracing::error!("Failed to read persistent data from disk: {e}");
|
||||||
|
return PersistedState::default();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
match ron::from_str(&data) {
|
||||||
|
Ok(d) => d,
|
||||||
|
Err(e) => {
|
||||||
|
tracing::error!("Failed to deserialize persistent data: {e}");
|
||||||
|
PersistedState::default()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl PersistentData {
|
pub(crate) fn write_state(state: PersistedState) {
|
||||||
pub(crate) fn write_document(&mut self, id: DocumentId, document: Document) {
|
let state: &PersistedState = &state;
|
||||||
self.documents.write(id, document);
|
let data = match ron::ser::to_string_pretty(state, Default::default()) {
|
||||||
if let Some(order) = &self.document_order {
|
Ok(d) => d,
|
||||||
self.documents.force_order(order);
|
Err(e) => {
|
||||||
}
|
tracing::error!("Failed to serialize persistent data: {e}");
|
||||||
self.flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn delete_document(&mut self, id: &DocumentId) {
|
|
||||||
if Some(*id) == self.current_document {
|
|
||||||
self.current_document = None;
|
|
||||||
}
|
|
||||||
self.documents.delete(id);
|
|
||||||
self.flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn current_document_id(&self) -> Option<DocumentId> {
|
|
||||||
match self.current_document {
|
|
||||||
Some(id) => Some(id),
|
|
||||||
None => Some(*self.documents.document_ids().first()?),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn current_document(&self) -> Option<(DocumentId, Document)> {
|
|
||||||
let current_id = self.current_document_id()?;
|
|
||||||
Some((current_id, self.documents.read(¤t_id)?))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn documents_before_current(&self) -> Vec<(DocumentId, Document)> {
|
|
||||||
let Some(current_id) = self.current_document_id() else {
|
|
||||||
return Vec::new();
|
|
||||||
};
|
|
||||||
self.documents
|
|
||||||
.document_ids()
|
|
||||||
.into_iter()
|
|
||||||
.take_while(|id| *id != current_id)
|
|
||||||
.filter_map(|id| Some((id, self.documents.read(&id)?)))
|
|
||||||
.collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn documents_after_current(&self) -> Vec<(DocumentId, Document)> {
|
|
||||||
let Some(current_id) = self.current_document_id() else {
|
|
||||||
return Vec::new();
|
|
||||||
};
|
|
||||||
self.documents
|
|
||||||
.document_ids()
|
|
||||||
.into_iter()
|
|
||||||
.skip_while(|id| *id != current_id)
|
|
||||||
.skip(1)
|
|
||||||
.filter_map(|id| Some((id, self.documents.read(&id)?)))
|
|
||||||
.collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn set_current_document(&mut self, id: DocumentId) {
|
|
||||||
self.current_document = Some(id);
|
|
||||||
self.flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn set_document_order(&mut self, order: Vec<DocumentId>) {
|
|
||||||
self.document_order = Some(order);
|
|
||||||
self.flush();
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn write_preferences(&mut self, preferences: Preferences) {
|
|
||||||
let Ok(preferences) = ron::ser::to_string_pretty(&preferences, Default::default()) else {
|
|
||||||
tracing::error!("Failed to serialize preferences");
|
|
||||||
return;
|
return;
|
||||||
};
|
|
||||||
std::fs::write(Self::preferences_file_path(), &preferences).unwrap_or_else(|e| {
|
|
||||||
tracing::error!("Failed to write preferences to disk: {e}");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn load_preferences(&self) -> Option<Preferences> {
|
|
||||||
let data = std::fs::read_to_string(Self::preferences_file_path()).ok()?;
|
|
||||||
let preferences = ron::from_str(&data).ok()?;
|
|
||||||
Some(preferences)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn flush(&self) {
|
|
||||||
let data = match ron::ser::to_string_pretty(self, Default::default()) {
|
|
||||||
Ok(d) => d,
|
|
||||||
Err(e) => {
|
|
||||||
tracing::error!("Failed to serialize persistent data: {e}");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
if let Err(e) = std::fs::write(Self::state_file_path(), data) {
|
|
||||||
tracing::error!("Failed to write persistent data to disk: {e}");
|
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
if let Err(e) = std::fs::write(state_file_path(), data) {
|
||||||
pub(crate) fn load_from_disk(&mut self) {
|
tracing::error!("Failed to write persistent data to disk: {e}");
|
||||||
let path = Self::state_file_path();
|
|
||||||
let data = match std::fs::read_to_string(&path) {
|
|
||||||
Ok(d) => d,
|
|
||||||
Err(e) if e.kind() == std::io::ErrorKind::NotFound => {
|
|
||||||
tracing::info!("No persistent data file found at {path:?}, starting fresh");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Err(e) => {
|
|
||||||
tracing::error!("Failed to read persistent data from disk: {e}");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
let loaded = match ron::from_str(&data) {
|
|
||||||
Ok(d) => d,
|
|
||||||
Err(e) => {
|
|
||||||
tracing::error!("Failed to deserialize persistent data: {e}");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
*self = loaded;
|
|
||||||
}
|
|
||||||
|
|
||||||
fn state_file_path() -> std::path::PathBuf {
|
|
||||||
let mut path = crate::dirs::graphite_data_dir();
|
|
||||||
path.push(crate::consts::APP_STATE_FILE_NAME);
|
|
||||||
path
|
|
||||||
}
|
|
||||||
|
|
||||||
fn preferences_file_path() -> std::path::PathBuf {
|
|
||||||
let mut path = crate::dirs::graphite_data_dir();
|
|
||||||
path.push(crate::consts::APP_PREFERENCES_FILE_NAME);
|
|
||||||
path
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Default, serde::Serialize, serde::Deserialize)]
|
fn state_file_path() -> std::path::PathBuf {
|
||||||
struct DocumentStore(Vec<DocumentInfo>);
|
let mut path = crate::dirs::app_data_dir();
|
||||||
impl DocumentStore {
|
path.push(crate::consts::APP_STATE_FILE_NAME);
|
||||||
fn write(&mut self, id: DocumentId, document: Document) {
|
path
|
||||||
let meta = DocumentInfo::new(id, &document);
|
}
|
||||||
if let Some(existing) = self.0.iter_mut().find(|meta| meta.id == id) {
|
|
||||||
*existing = meta;
|
|
||||||
} else {
|
|
||||||
self.0.push(meta);
|
|
||||||
}
|
|
||||||
if let Err(e) = std::fs::write(Self::document_path(&id), document.content) {
|
|
||||||
tracing::error!("Failed to write document {id:?} to disk: {e}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn delete(&mut self, id: &DocumentId) {
|
// TODO: Remove this migration code
|
||||||
self.0.retain(|meta| meta.id != *id);
|
fn migrate_documents() -> std::io::Result<()> {
|
||||||
if let Err(e) = std::fs::remove_file(Self::document_path(id)) {
|
let root = crate::dirs::app_autosave_documents_dir();
|
||||||
tracing::error!("Failed to delete document {id:?} from disk: {e}");
|
let entries = match std::fs::read_dir(&root) {
|
||||||
}
|
Ok(entries) => entries,
|
||||||
}
|
Err(error) if error.kind() == std::io::ErrorKind::NotFound => return Ok(()),
|
||||||
|
Err(error) => return Err(error),
|
||||||
fn read(&self, id: &DocumentId) -> Option<Document> {
|
};
|
||||||
let meta = self.0.iter().find(|meta| meta.id == *id)?;
|
for entry in entries {
|
||||||
let content = std::fs::read_to_string(Self::document_path(id)).ok()?;
|
let entry = match entry {
|
||||||
Some(Document {
|
Ok(entry) => entry,
|
||||||
content,
|
Err(error) => {
|
||||||
name: meta.name.clone(),
|
tracing::error!("Skipping an unreadable autosave entry: {error}");
|
||||||
path: meta.path.clone(),
|
continue;
|
||||||
is_saved: meta.is_saved,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
fn force_order(&mut self, desired_order: &Vec<DocumentId>) {
|
|
||||||
let mut ordered_prefix_len = 0;
|
|
||||||
for id in desired_order {
|
|
||||||
if let Some(offset) = self.0[ordered_prefix_len..].iter().position(|meta| meta.id == *id) {
|
|
||||||
let found_index = ordered_prefix_len + offset;
|
|
||||||
if found_index != ordered_prefix_len {
|
|
||||||
self.0[ordered_prefix_len..=found_index].rotate_right(1);
|
|
||||||
}
|
|
||||||
ordered_prefix_len += 1;
|
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
self.0.truncate(ordered_prefix_len);
|
if let Err(error) = migrate_document(&root, &entry) {
|
||||||
}
|
tracing::error!("Autosave migration of {} failed: {error}", entry.path().display());
|
||||||
|
|
||||||
fn document_ids(&self) -> Vec<DocumentId> {
|
|
||||||
self.0.iter().map(|meta| meta.id).collect()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn document_path(id: &DocumentId) -> std::path::PathBuf {
|
|
||||||
let mut path = crate::dirs::graphite_autosave_documents_dir();
|
|
||||||
path.push(format!("{:x}.graphite", id.0));
|
|
||||||
path
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(serde::Serialize, serde::Deserialize)]
|
|
||||||
struct DocumentInfo {
|
|
||||||
id: DocumentId,
|
|
||||||
name: String,
|
|
||||||
path: Option<std::path::PathBuf>,
|
|
||||||
is_saved: bool,
|
|
||||||
}
|
|
||||||
impl DocumentInfo {
|
|
||||||
fn new(id: DocumentId, Document { name, path, is_saved, .. }: &Document) -> Self {
|
|
||||||
Self {
|
|
||||||
id,
|
|
||||||
name: name.clone(),
|
|
||||||
path: path.clone(),
|
|
||||||
is_saved: *is_saved,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn migrate_document(root: &std::path::Path, entry: &std::fs::DirEntry) -> std::io::Result<()> {
|
||||||
|
let path = entry.path();
|
||||||
|
if !entry.file_type()?.is_file() || path.extension().and_then(|s| s.to_str()) != Some(graphite_desktop_wrapper::FILE_EXTENSION) {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
let Some(id) = path.file_stem().and_then(|s| s.to_str()).and_then(|s| u64::from_str_radix(s, 16).ok()) else {
|
||||||
|
return Ok(());
|
||||||
|
};
|
||||||
|
let destination = root.join(format!("{id:016x}"));
|
||||||
|
if !destination.join("legacy.graphite").exists() && !destination.join("manifest.json").exists() {
|
||||||
|
std::fs::create_dir_all(&destination)?;
|
||||||
|
let staging = destination.join("legacy.graphite.migrating");
|
||||||
|
std::fs::copy(&path, &staging)?;
|
||||||
|
std::fs::rename(staging, destination.join("legacy.graphite"))?;
|
||||||
|
}
|
||||||
|
let backup = path.with_extension(format!("{}.migrated", graphite_desktop_wrapper::FILE_EXTENSION));
|
||||||
|
if backup.exists() {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
std::fs::rename(path, backup)
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
use graphite_desktop_wrapper::messages::Preferences;
|
||||||
|
|
||||||
|
pub(crate) fn write(preferences: Preferences) {
|
||||||
|
let Ok(preferences) = ron::ser::to_string_pretty(&preferences, Default::default()) else {
|
||||||
|
tracing::error!("Failed to serialize preferences");
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
std::fs::write(file_path(), &preferences).unwrap_or_else(|e| {
|
||||||
|
tracing::error!("Failed to write preferences to disk: {e}");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn read() -> Preferences {
|
||||||
|
let Ok(data) = std::fs::read_to_string(file_path()) else {
|
||||||
|
return Preferences::default();
|
||||||
|
};
|
||||||
|
let Ok(preferences) = ron::from_str(&data) else {
|
||||||
|
return Preferences::default();
|
||||||
|
};
|
||||||
|
preferences
|
||||||
|
}
|
||||||
|
|
||||||
|
pub(crate) fn modify(f: impl FnOnce(&mut Preferences)) {
|
||||||
|
let mut preferences = read();
|
||||||
|
f(&mut preferences);
|
||||||
|
write(preferences);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn file_path() -> std::path::PathBuf {
|
||||||
|
let mut path = crate::dirs::app_data_dir();
|
||||||
|
path.push(crate::consts::APP_PREFERENCES_FILE_NAME);
|
||||||
|
path
|
||||||
|
}
|
||||||
@@ -1,5 +1,2 @@
|
|||||||
mod frame_buffer_ref;
|
mod state;
|
||||||
pub(crate) use frame_buffer_ref::FrameBufferRef;
|
pub(crate) use state::{RenderError, RenderState};
|
||||||
|
|
||||||
mod graphics_state;
|
|
||||||
pub(crate) use graphics_state::GraphicsState;
|
|
||||||
@@ -1,3 +1,7 @@
|
|||||||
|
// =============
|
||||||
|
// VERTEX SHADER
|
||||||
|
// =============
|
||||||
|
|
||||||
struct VertexOutput {
|
struct VertexOutput {
|
||||||
@builtin(position) clip_position: vec4<f32>,
|
@builtin(position) clip_position: vec4<f32>,
|
||||||
@location(0) tex_coords: vec2<f32>,
|
@location(0) tex_coords: vec2<f32>,
|
||||||
@@ -6,26 +10,30 @@ struct VertexOutput {
|
|||||||
@vertex
|
@vertex
|
||||||
fn vs_main(@builtin(vertex_index) vertex_index: u32) -> VertexOutput {
|
fn vs_main(@builtin(vertex_index) vertex_index: u32) -> VertexOutput {
|
||||||
var out: VertexOutput;
|
var out: VertexOutput;
|
||||||
|
|
||||||
let pos = array(
|
let pos = array(
|
||||||
vec2f( -1.0, -1.0),
|
vec2f(-1.0, -1.0),
|
||||||
vec2f( 3.0, -1.0),
|
vec2f(3.0, -1.0),
|
||||||
vec2f( -1.0, 3.0),
|
vec2f(-1.0, 3.0),
|
||||||
);
|
);
|
||||||
let xy = pos[vertex_index];
|
let xy = pos[vertex_index];
|
||||||
out.clip_position = vec4f(xy , 0.0, 1.0);
|
out.clip_position = vec4f(xy, 0.0, 1.0);
|
||||||
let coords = (xy / 2. + 0.5);
|
let coords = xy / 2. + 0.5;
|
||||||
out.tex_coords = vec2f(coords.x, 1. - coords.y);
|
out.tex_coords = vec2f(coords.x, 1. - coords.y);
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ===============
|
||||||
|
// FRAGMENT SHADER
|
||||||
|
// ===============
|
||||||
|
|
||||||
struct Constants {
|
struct Immediates {
|
||||||
viewport_scale: vec2<f32>,
|
viewport_scale: vec2<f32>,
|
||||||
viewport_offset: vec2<f32>,
|
viewport_offset: vec2<f32>,
|
||||||
|
ui_scale: vec2<f32>,
|
||||||
|
background_color: vec4<f32>,
|
||||||
};
|
};
|
||||||
|
|
||||||
var<push_constant> constants: Constants;
|
var<immediate> immediates: Immediates;
|
||||||
|
|
||||||
@group(0) @binding(0)
|
@group(0) @binding(0)
|
||||||
var t_viewport: texture_2d<f32>;
|
var t_viewport: texture_2d<f32>;
|
||||||
@@ -38,18 +46,33 @@ var s_diffuse: sampler;
|
|||||||
|
|
||||||
@fragment
|
@fragment
|
||||||
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
|
fn fs_main(in: VertexOutput) -> @location(0) vec4<f32> {
|
||||||
let ui_linear = textureSample(t_ui, s_diffuse, in.tex_coords);
|
let ui_coordinate = in.tex_coords * immediates.ui_scale;
|
||||||
if (ui_linear.a >= 0.999) {
|
if (ui_coordinate.x < 0.0 || ui_coordinate.x > 1.0 ||
|
||||||
return ui_linear;
|
ui_coordinate.y < 0.0 || ui_coordinate.y > 1.0) {
|
||||||
|
return srgb_to_linear(immediates.background_color);
|
||||||
}
|
}
|
||||||
|
|
||||||
let viewport_coordinate = (in.tex_coords - constants.viewport_offset) * constants.viewport_scale;
|
let ui_sample = textureSample(t_ui, s_diffuse, ui_coordinate);
|
||||||
|
if (ui_sample.a >= 0.999) {
|
||||||
|
return srgb_to_linear(ui_sample);
|
||||||
|
}
|
||||||
|
|
||||||
|
let ui_srgb = unpremultiply(ui_sample);
|
||||||
|
|
||||||
|
let viewport_coordinate = (in.tex_coords - immediates.viewport_offset) * immediates.viewport_scale;
|
||||||
|
if (viewport_coordinate.x < 0.0 || viewport_coordinate.x > 1.0 ||
|
||||||
|
viewport_coordinate.y < 0.0 || viewport_coordinate.y > 1.0) {
|
||||||
|
return srgb_to_linear(immediates.background_color);
|
||||||
|
}
|
||||||
|
|
||||||
let overlay_srgb = textureSample(t_overlays, s_diffuse, viewport_coordinate);
|
let overlay_srgb = textureSample(t_overlays, s_diffuse, viewport_coordinate);
|
||||||
let viewport_srgb = textureSample(t_viewport, s_diffuse, viewport_coordinate);
|
var viewport_srgb = textureSample(t_viewport, s_diffuse, viewport_coordinate);
|
||||||
|
|
||||||
// UI texture is premultiplied, we need to unpremultiply before blending
|
if (viewport_srgb.a < 0.001) {
|
||||||
let ui_srgb = linear_to_srgb(unpremultiply(ui_linear));
|
viewport_srgb = immediates.background_color;
|
||||||
|
} else if (viewport_srgb.a < 0.999) {
|
||||||
|
viewport_srgb = blend(viewport_srgb, immediates.background_color);
|
||||||
|
}
|
||||||
|
|
||||||
if (overlay_srgb.a < 0.001) {
|
if (overlay_srgb.a < 0.001) {
|
||||||
if (ui_srgb.a < 0.001) {
|
if (ui_srgb.a < 0.001) {
|
||||||
|
|||||||
@@ -1,53 +0,0 @@
|
|||||||
use thiserror::Error;
|
|
||||||
|
|
||||||
pub(crate) struct FrameBufferRef<'a> {
|
|
||||||
buffer: &'a [u8],
|
|
||||||
width: usize,
|
|
||||||
height: usize,
|
|
||||||
}
|
|
||||||
impl<'a> FrameBufferRef<'a> {
|
|
||||||
pub(crate) fn new(buffer: &'a [u8], width: usize, height: usize) -> Result<Self, FrameBufferError> {
|
|
||||||
let fb = Self { buffer, width, height };
|
|
||||||
fb.validate_size()?;
|
|
||||||
Ok(fb)
|
|
||||||
}
|
|
||||||
pub(crate) fn buffer(&self) -> &[u8] {
|
|
||||||
self.buffer
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn width(&self) -> usize {
|
|
||||||
self.width
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) fn height(&self) -> usize {
|
|
||||||
self.height
|
|
||||||
}
|
|
||||||
|
|
||||||
fn validate_size(&self) -> Result<(), FrameBufferError> {
|
|
||||||
if self.buffer.len() != self.width * self.height * 4 {
|
|
||||||
Err(FrameBufferError::InvalidSize {
|
|
||||||
buffer_size: self.buffer.len(),
|
|
||||||
expected_size: self.width * self.height * 4,
|
|
||||||
width: self.width,
|
|
||||||
height: self.height,
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl<'a> std::fmt::Debug for FrameBufferRef<'a> {
|
|
||||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
||||||
f.debug_struct("FrameBuffer")
|
|
||||||
.field("width", &self.width)
|
|
||||||
.field("height", &self.height)
|
|
||||||
.field("len", &self.buffer.len())
|
|
||||||
.finish()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Error, Debug)]
|
|
||||||
pub(crate) enum FrameBufferError {
|
|
||||||
#[error("Invalid buffer size {buffer_size}, expected {expected_size} for width {width} multiplied with height {height} multiplied by 4 channels")]
|
|
||||||
InvalidSize { buffer_size: usize, expected_size: usize, width: usize, height: usize },
|
|
||||||
}
|
|
||||||
Loaded 100 of 1604 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user