mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-08-29 05:06:43 +02:00
Compare commits
879 Commits
sidv/fixFl
...
sidv/class
Author | SHA1 | Date | |
---|---|---|---|
![]() |
345b75cc0e | ||
![]() |
0ebea7744b | ||
![]() |
44b93c039a | ||
![]() |
4d5313699e | ||
![]() |
cd198290d7 | ||
![]() |
60ed7d3273 | ||
![]() |
9bcfba6620 | ||
![]() |
7ea3c64268 | ||
![]() |
2b6a34e9e0 | ||
![]() |
458b90c78d | ||
![]() |
dd284c0986 | ||
![]() |
ed819e96d5 | ||
![]() |
21539dfb6a | ||
![]() |
91785b8284 | ||
![]() |
f202770b70 | ||
![]() |
8186a54962 | ||
![]() |
979dcb073d | ||
![]() |
ecf14cd4e3 | ||
![]() |
92d9f35f89 | ||
![]() |
15c7c37227 | ||
![]() |
267935713c | ||
![]() |
8ef5f38861 | ||
![]() |
47af4760bc | ||
![]() |
8e5275d844 | ||
![]() |
c51afa4dd2 | ||
![]() |
671ad82ad3 | ||
![]() |
1bfa1a8c88 | ||
![]() |
ab140a0fc7 | ||
![]() |
7d395e176e | ||
![]() |
3d35015ee9 | ||
![]() |
2676130146 | ||
![]() |
fb3814bf85 | ||
![]() |
2dd1415849 | ||
![]() |
866909b803 | ||
![]() |
9fa6dc23ca | ||
![]() |
9dccf4d9c9 | ||
![]() |
f248a22c71 | ||
![]() |
6563a6ea26 | ||
![]() |
87d2899e4e | ||
![]() |
a3a6eb9bf5 | ||
![]() |
c28c285711 | ||
![]() |
5f8f79fc3e | ||
![]() |
a4ba192aad | ||
![]() |
f553fa5eb8 | ||
![]() |
c3939d3fb3 | ||
![]() |
32d1783390 | ||
![]() |
58afdd1baa | ||
![]() |
eba5fcca6b | ||
![]() |
52cbf9fd28 | ||
![]() |
fc19bf93aa | ||
![]() |
54de763a66 | ||
![]() |
56419f7459 | ||
![]() |
2537152c7a | ||
![]() |
14c1c1cc59 | ||
![]() |
108c25f19f | ||
![]() |
72b4a74bee | ||
![]() |
408910e6e8 | ||
![]() |
c3160b2693 | ||
![]() |
2ab393cd16 | ||
![]() |
bd98da16a0 | ||
![]() |
cee2a458f1 | ||
![]() |
24c8e575f4 | ||
![]() |
4a06bc1a68 | ||
![]() |
8d0ca2c876 | ||
![]() |
fc96ebefd4 | ||
![]() |
394330175f | ||
![]() |
a7ae1b6890 | ||
![]() |
ce6992ea9b | ||
![]() |
0114a87f15 | ||
![]() |
f946c3da06 | ||
![]() |
adfed1e432 | ||
![]() |
11b599d77c | ||
![]() |
3944e9ac00 | ||
![]() |
37aa6632aa | ||
![]() |
156fbd1958 | ||
![]() |
7e251ee8bc | ||
![]() |
6e0f41180f | ||
![]() |
52f05552a1 | ||
![]() |
bb01b3972d | ||
![]() |
1a50a326cb | ||
![]() |
7dd0d126e2 | ||
![]() |
cc8b4572d5 | ||
![]() |
e5315f2933 | ||
![]() |
d21eb29672 | ||
![]() |
fd45dbfc14 | ||
![]() |
5c9eafabae | ||
![]() |
2b9dc0ea80 | ||
![]() |
8ac7dc81e0 | ||
![]() |
2967b3c1bb | ||
![]() |
534fd85339 | ||
![]() |
7298008374 | ||
![]() |
844a175039 | ||
![]() |
fd35a54735 | ||
![]() |
a6e6c3fb18 | ||
![]() |
31c0a0cbab | ||
![]() |
767baa4ec6 | ||
![]() |
f422a66dde | ||
![]() |
fae976e994 | ||
![]() |
f4c62436ea | ||
![]() |
21d0998db8 | ||
![]() |
0899f7918a | ||
![]() |
205360c109 | ||
![]() |
984a0e6d06 | ||
![]() |
eb63568ceb | ||
![]() |
cc6f896b69 | ||
![]() |
83e47a7216 | ||
![]() |
1d64549cce | ||
![]() |
7a547abd89 | ||
![]() |
4d84f1cd71 | ||
![]() |
4ae361bd1f | ||
![]() |
6502496a2c | ||
![]() |
8678ceeb3c | ||
![]() |
9cb62f4d2e | ||
![]() |
6c0ef54e18 | ||
![]() |
fd731c5ccd | ||
![]() |
72fa3488b5 | ||
![]() |
cbe9490dc0 | ||
![]() |
82054bfabc | ||
![]() |
963dd75c39 | ||
![]() |
1c24617f98 | ||
![]() |
1559c2ca21 | ||
![]() |
6141722b1f | ||
![]() |
cfffba2817 | ||
![]() |
222d8eed4e | ||
![]() |
e7ee3eb9ea | ||
![]() |
7b45dbea1a | ||
![]() |
341130856f | ||
![]() |
b85c011cd1 | ||
![]() |
aec97d68cc | ||
![]() |
718d52a72c | ||
![]() |
fe1a06271a | ||
![]() |
bd2370555b | ||
![]() |
86c9ee4e90 | ||
![]() |
7b7e281ec7 | ||
![]() |
35cc34d422 | ||
![]() |
edb6ceae43 | ||
![]() |
ef8b75a6da | ||
![]() |
b26bcf1343 | ||
![]() |
5d5c6275f9 | ||
![]() |
02daf5417b | ||
![]() |
77d8e15dc4 | ||
![]() |
62142089f1 | ||
![]() |
defe40692a | ||
![]() |
337ff3c32b | ||
![]() |
9c1a47d1fc | ||
![]() |
744cc792f4 | ||
![]() |
99978da55b | ||
![]() |
50eb3cf1c9 | ||
![]() |
c1b9c54fc9 | ||
![]() |
0d179c501e | ||
![]() |
085e8f78b3 | ||
![]() |
f9d4a62609 | ||
![]() |
13852b7f4e | ||
![]() |
4fd7a88a15 | ||
![]() |
2a8374312f | ||
![]() |
5c2a6b5eb1 | ||
![]() |
9cbebbb8a0 | ||
![]() |
e26d987c4e | ||
![]() |
53669efaf8 | ||
![]() |
b68f45ef59 | ||
![]() |
b60410161d | ||
![]() |
8f44de651b | ||
![]() |
2ede244da0 | ||
![]() |
77a181978e | ||
![]() |
170bbce0d3 | ||
![]() |
fc99d9be41 | ||
![]() |
9fb9bed806 | ||
![]() |
01b2f80a95 | ||
![]() |
da7ff777d1 | ||
![]() |
d219f92a19 | ||
![]() |
3f3a7340e3 | ||
![]() |
cb5f70c139 | ||
![]() |
99c1758490 | ||
![]() |
43217e1395 | ||
![]() |
aa34b99203 | ||
![]() |
541ee1eade | ||
![]() |
f01ad644e3 | ||
![]() |
9538233573 | ||
![]() |
5a2ea7c297 | ||
![]() |
22b172d873 | ||
![]() |
92098e23eb | ||
![]() |
591cb794eb | ||
![]() |
f9d978859e | ||
![]() |
6170538c47 | ||
![]() |
c37c494a1e | ||
![]() |
65c93807d8 | ||
![]() |
8ed9ddc7aa | ||
![]() |
a0b80f5490 | ||
![]() |
493023118f | ||
![]() |
c5e7e6040c | ||
![]() |
c938c7a438 | ||
![]() |
c7bcf72c69 | ||
![]() |
da602add5d | ||
![]() |
9049a99c8d | ||
![]() |
60957519c8 | ||
![]() |
8a8e062342 | ||
![]() |
1721282182 | ||
![]() |
d8dd68cad2 | ||
![]() |
9b9ad1da7d | ||
![]() |
0d380bb2c7 | ||
![]() |
120bdabee1 | ||
![]() |
9ab048c7e9 | ||
![]() |
a5a3ffc768 | ||
![]() |
1078b1c8f6 | ||
![]() |
dfeb25127b | ||
![]() |
396bda8d95 | ||
![]() |
cc70d37166 | ||
![]() |
3f5da06bb0 | ||
![]() |
be106befff | ||
![]() |
980a5ac8b5 | ||
![]() |
d5f11fc80a | ||
![]() |
46de343785 | ||
![]() |
c4113541e1 | ||
![]() |
fb49f25eef | ||
![]() |
a9681d1b1c | ||
![]() |
545d361d3f | ||
![]() |
66b579cd89 | ||
![]() |
c55a0947be | ||
![]() |
0b9f6d1ff9 | ||
![]() |
7742a6c485 | ||
![]() |
3e598f4e8e | ||
![]() |
eb397fdb04 | ||
![]() |
6c1afb7a8d | ||
![]() |
fee6f459a8 | ||
![]() |
e128a11f3b | ||
![]() |
38dc17f426 | ||
![]() |
453c67e5ea | ||
![]() |
a69a97fdd9 | ||
![]() |
820cc48c11 | ||
![]() |
06e4a6398c | ||
![]() |
85a988c31c | ||
![]() |
776035553a | ||
![]() |
ca1cdb1d94 | ||
![]() |
5485517b27 | ||
![]() |
96380600d9 | ||
![]() |
da8112afa5 | ||
![]() |
bae9a7c1b8 | ||
![]() |
776b219c03 | ||
![]() |
4471001ef2 | ||
![]() |
bcb0817ecd | ||
![]() |
646f7662d0 | ||
![]() |
9563b22132 | ||
![]() |
6df76d93e5 | ||
![]() |
e6a18eea91 | ||
![]() |
7da38b9afe | ||
![]() |
71205f5bd6 | ||
![]() |
1802f5d0c0 | ||
![]() |
ef29388d68 | ||
![]() |
e1379ee048 | ||
![]() |
4845635f48 | ||
![]() |
34bf618ecb | ||
![]() |
c9db0ee749 | ||
![]() |
850513fa3d | ||
![]() |
aaf333676c | ||
![]() |
5a165e4c1d | ||
![]() |
ee6fa94aa2 | ||
![]() |
23b6d53f80 | ||
![]() |
f4671e4e3a | ||
![]() |
971215e353 | ||
![]() |
199fdce982 | ||
![]() |
90c8dd1dab | ||
![]() |
f8ebfeefec | ||
![]() |
8db2fb8f90 | ||
![]() |
e2fac72166 | ||
![]() |
c954e0eb1d | ||
![]() |
de37efefd7 | ||
![]() |
bdfd8974d4 | ||
![]() |
95efc1786f | ||
![]() |
0c55e4c2ad | ||
![]() |
10d5b5d1d6 | ||
![]() |
23fea41fb4 | ||
![]() |
a4f778f4de | ||
![]() |
bb6664a2c6 | ||
![]() |
939d082a8e | ||
![]() |
b26449f338 | ||
![]() |
b99eb8b624 | ||
![]() |
ffdfe11f10 | ||
![]() |
7465384e1d | ||
![]() |
aecf451ed1 | ||
![]() |
7d69ad2d5b | ||
![]() |
74fa9956a3 | ||
![]() |
e33340331a | ||
![]() |
bdd9394d0b | ||
![]() |
7ebfc272e4 | ||
![]() |
b87f1f2098 | ||
![]() |
c9c2f6c121 | ||
![]() |
585834c561 | ||
![]() |
dc57fcf7e7 | ||
![]() |
8b79060829 | ||
![]() |
daf43f8d34 | ||
![]() |
4cdb43f791 | ||
![]() |
660162686b | ||
![]() |
6e2bf00a43 | ||
![]() |
cc01ff9129 | ||
![]() |
7dc985712a | ||
![]() |
e3c5e6f095 | ||
![]() |
ef4f22841f | ||
![]() |
c292c897a1 | ||
![]() |
cc7fd337ac | ||
![]() |
6b41420ddd | ||
![]() |
351b229c37 | ||
![]() |
266a5e8133 | ||
![]() |
55963107d0 | ||
![]() |
a7e37d0c8b | ||
![]() |
ead48600be | ||
![]() |
834c67ecaa | ||
![]() |
1a99825ab2 | ||
![]() |
b5456813e8 | ||
![]() |
ed4feaebf2 | ||
![]() |
844f9d96e7 | ||
![]() |
bed05ce061 | ||
![]() |
f269f8cc5b | ||
![]() |
e25763d645 | ||
![]() |
6c12bbb80f | ||
![]() |
d8897426cd | ||
![]() |
9eed2e278b | ||
![]() |
1df68f9a5f | ||
![]() |
1397a873c2 | ||
![]() |
1dfb400a46 | ||
![]() |
35299978a4 | ||
![]() |
165e0b6c68 | ||
![]() |
9c92f779ae | ||
![]() |
304d8844f0 | ||
![]() |
aa54127784 | ||
![]() |
21b90cbcd2 | ||
![]() |
e1ca108b00 | ||
![]() |
29d078c822 | ||
![]() |
40d30b7045 | ||
![]() |
dbee34aba7 | ||
![]() |
9655ba9e63 | ||
![]() |
fd461b7860 | ||
![]() |
30a9b5574d | ||
![]() |
edf94790f2 | ||
![]() |
68909a43f7 | ||
![]() |
d178626bac | ||
![]() |
d69a2f7895 | ||
![]() |
97f457ca4a | ||
![]() |
48c8311369 | ||
![]() |
c99e1c689e | ||
![]() |
15c6dfcbb5 | ||
![]() |
651bc980d2 | ||
![]() |
841ae15fb5 | ||
![]() |
a7d40724b4 | ||
![]() |
409dedb3ef | ||
![]() |
4ea1227e29 | ||
![]() |
68305fea9e | ||
![]() |
ea192ccf4d | ||
![]() |
509a580f9d | ||
![]() |
db9051b03e | ||
![]() |
91ae9a2901 | ||
![]() |
27d98728a6 | ||
![]() |
cfbd38d5fa | ||
![]() |
c67b4178bd | ||
![]() |
9ea4b1388f | ||
![]() |
934735372f | ||
![]() |
28bb0df6c8 | ||
![]() |
20cd685ae3 | ||
![]() |
47c100809b | ||
![]() |
651274bc6f | ||
![]() |
4cfbd0d380 | ||
![]() |
45d92769aa | ||
![]() |
3e3e784fd9 | ||
![]() |
1f3902e598 | ||
![]() |
3ef02ee66f | ||
![]() |
474e0b9c82 | ||
![]() |
087738df78 | ||
![]() |
fa8e02721a | ||
![]() |
4b9773a272 | ||
![]() |
45400240d4 | ||
![]() |
e4699ef02a | ||
![]() |
60cf043c3d | ||
![]() |
fd88b424b4 | ||
![]() |
3ab0e9998d | ||
![]() |
f48a9c8696 | ||
![]() |
eea0ea5e07 | ||
![]() |
20011c6882 | ||
![]() |
0cc8f89115 | ||
![]() |
8ff06e88ce | ||
![]() |
3fa3ed7b18 | ||
![]() |
0a4e5f5f6b | ||
![]() |
0d7cc748b8 | ||
![]() |
a3c645c3eb | ||
![]() |
bb7b3491e5 | ||
![]() |
69c91ae5ed | ||
![]() |
7adb1bccb3 | ||
![]() |
38f2ff0bca | ||
![]() |
cd0da4e060 | ||
![]() |
df89b92e2c | ||
![]() |
5b987dee93 | ||
![]() |
114f918417 | ||
![]() |
346a7fe8b2 | ||
![]() |
8ae35c1382 | ||
![]() |
687a9a08d7 | ||
![]() |
478d350188 | ||
![]() |
4795204719 | ||
![]() |
99e88e4d0d | ||
![]() |
a171903088 | ||
![]() |
1b2340ba75 | ||
![]() |
3496f275bc | ||
![]() |
b46c28425e | ||
![]() |
4d2d790cc8 | ||
![]() |
477bb4308d | ||
![]() |
8cd8714aaf | ||
![]() |
e25faeee4c | ||
![]() |
cba5b5a7e3 | ||
![]() |
66e5f8ae18 | ||
![]() |
52a4f8f077 | ||
![]() |
d81e4fabd5 | ||
![]() |
863d1bfd4d | ||
![]() |
9c2afac319 | ||
![]() |
568d686d2f | ||
![]() |
3fcb071592 | ||
![]() |
483385b2f6 | ||
![]() |
fff3acd064 | ||
![]() |
e66135b67e | ||
![]() |
072638ce9d | ||
![]() |
d9314a869a | ||
![]() |
662eb431ab | ||
![]() |
bed8710dbb | ||
![]() |
38c0a94067 | ||
![]() |
d3006f6298 | ||
![]() |
24f04bb24d | ||
![]() |
b5bcc3b992 | ||
![]() |
48a49b1b4d | ||
![]() |
5e6d42cb5b | ||
![]() |
417c69d7e2 | ||
![]() |
855f6ef9bf | ||
![]() |
a0a25ed756 | ||
![]() |
af9b3f77cb | ||
![]() |
57ee181fad | ||
![]() |
39ccad8e5e | ||
![]() |
7e39c13836 | ||
![]() |
85515bcf8d | ||
![]() |
383bbefa9e | ||
![]() |
9b9671b57c | ||
![]() |
d6c88ab589 | ||
![]() |
840609af63 | ||
![]() |
eff9f7e5db | ||
![]() |
803cd826ed | ||
![]() |
90c68f5069 | ||
![]() |
103321bf72 | ||
![]() |
d0afc3bffe | ||
![]() |
11f2e31ff1 | ||
![]() |
d9c15b1e7a | ||
![]() |
4e8eeda30e | ||
![]() |
cfe31fe89f | ||
![]() |
ebf639377b | ||
![]() |
37adc23ae2 | ||
![]() |
5f7212c769 | ||
![]() |
cd92c46f31 | ||
![]() |
df10ab501a | ||
![]() |
0d7427ed20 | ||
![]() |
e360e90f88 | ||
![]() |
03ce2810b5 | ||
![]() |
5631a218d1 | ||
![]() |
7cb009cd38 | ||
![]() |
bb220b8b87 | ||
![]() |
80add648e6 | ||
![]() |
081d1b1144 | ||
![]() |
946b5f161e | ||
![]() |
e9f032cceb | ||
![]() |
aeba7a1d0e | ||
![]() |
14d3d203d7 | ||
![]() |
584b51d7c5 | ||
![]() |
12c657f514 | ||
![]() |
d47c9d754a | ||
![]() |
d2ab132a18 | ||
![]() |
d46ef4cc91 | ||
![]() |
0a493c79ff | ||
![]() |
3664ff4463 | ||
![]() |
9e5ccbe13f | ||
![]() |
cd1765a012 | ||
![]() |
1bafc7b84f | ||
![]() |
7bf1d38bad | ||
![]() |
8e0cb185e9 | ||
![]() |
47f46c8a46 | ||
![]() |
e127b146e9 | ||
![]() |
c59fee8de2 | ||
![]() |
00bb2a1f68 | ||
![]() |
007724a7c7 | ||
![]() |
f82407a2f0 | ||
![]() |
4bec3188de | ||
![]() |
fbb6eb849e | ||
![]() |
6a40f4b955 | ||
![]() |
58b2b0993a | ||
![]() |
d05d249080 | ||
![]() |
1e781c0c90 | ||
![]() |
eca2efa46d | ||
![]() |
23f27d151a | ||
![]() |
cd118ad5cb | ||
![]() |
cf0a9c3016 | ||
![]() |
0cdf801884 | ||
![]() |
07df9eeb60 | ||
![]() |
962ff73fc3 | ||
![]() |
f0bf6bf574 | ||
![]() |
79d38cef4b | ||
![]() |
88856a721f | ||
![]() |
60c2d494a1 | ||
![]() |
0f4af09398 | ||
![]() |
052e9db16a | ||
![]() |
4648532814 | ||
![]() |
9263f75e5b | ||
![]() |
8348a2f2d8 | ||
![]() |
28406fc9c4 | ||
![]() |
d58c41dbc0 | ||
![]() |
5d76c033f0 | ||
![]() |
fad11bce95 | ||
![]() |
42da53f58a | ||
![]() |
8167f8c1df | ||
![]() |
2b53e02153 | ||
![]() |
4af2fca339 | ||
![]() |
b14bcda12a | ||
![]() |
1682fa1e53 | ||
![]() |
355586f297 | ||
![]() |
7d996c3d33 | ||
![]() |
194ef202ac | ||
![]() |
bcffff3b7b | ||
![]() |
d4281d365d | ||
![]() |
5ac70bbc00 | ||
![]() |
60a93f7377 | ||
![]() |
f5484636aa | ||
![]() |
b0a104e3da | ||
![]() |
48050333a0 | ||
![]() |
c17dc15c57 | ||
![]() |
34abbcadae | ||
![]() |
2b5da79cdf | ||
![]() |
2366ca85b3 | ||
![]() |
aaec16ed6c | ||
![]() |
a3d95ceec4 | ||
![]() |
4d0c461fa3 | ||
![]() |
db30f21ac5 | ||
![]() |
d2e62022f1 | ||
![]() |
29291c8901 | ||
![]() |
1a4e5d9c5a | ||
![]() |
e80e281a66 | ||
![]() |
04597d29c0 | ||
![]() |
43df84a4d5 | ||
![]() |
a753b1f18b | ||
![]() |
d80095bbef | ||
![]() |
4d79f42d0e | ||
![]() |
c29088af01 | ||
![]() |
23d6a0dab7 | ||
![]() |
70a5a13273 | ||
![]() |
063cb124cd | ||
![]() |
eb5d65fabc | ||
![]() |
7c3a73d4a8 | ||
![]() |
0230722d36 | ||
![]() |
52a1243da5 | ||
![]() |
58b43976ff | ||
![]() |
4372a54dba | ||
![]() |
a862565a24 | ||
![]() |
6ceee7f253 | ||
![]() |
f731853e01 | ||
![]() |
5885f5f82a | ||
![]() |
38013de711 | ||
![]() |
9251e520ab | ||
![]() |
5e7e3e21c8 | ||
![]() |
fcb25aee7c | ||
![]() |
95d62367e9 | ||
![]() |
1d5f3bb64d | ||
![]() |
bd772e1bf4 | ||
![]() |
34b2b5ba35 | ||
![]() |
c742ac71a4 | ||
![]() |
62b988a09f | ||
![]() |
382026ed33 | ||
![]() |
34e89098f5 | ||
![]() |
e3c90ac084 | ||
![]() |
099f85f014 | ||
![]() |
49747b314d | ||
![]() |
9f5f0a6e66 | ||
![]() |
6f03e22cc4 | ||
![]() |
8449a44607 | ||
![]() |
12fe6ff26e | ||
![]() |
451b6b687e | ||
![]() |
f431bae0ba | ||
![]() |
5a94256e4f | ||
![]() |
d5021cab1d | ||
![]() |
288f51216d | ||
![]() |
1b190b2892 | ||
![]() |
8e15e534ea | ||
![]() |
6d7cd2b41f | ||
![]() |
15b2105ce6 | ||
![]() |
d6731a07db | ||
![]() |
79688a1dc1 | ||
![]() |
fbf79ffcc0 | ||
![]() |
b989ff5362 | ||
![]() |
592e9c959b | ||
![]() |
406df57f81 | ||
![]() |
9c011abbd4 | ||
![]() |
dfc466514d | ||
![]() |
29c866b09a | ||
![]() |
2a1759aab4 | ||
![]() |
28ce5e780f | ||
![]() |
b55a9328f4 | ||
![]() |
19325777e5 | ||
![]() |
f0b8e5bc37 | ||
![]() |
1995f62b3c | ||
![]() |
78377daf2f | ||
![]() |
4a95589b5a | ||
![]() |
812e44183b | ||
![]() |
afb979f32b | ||
![]() |
4d19db8d0c | ||
![]() |
c327ea9f21 | ||
![]() |
abb7bb23d6 | ||
![]() |
8ed2ee30ec | ||
![]() |
084b765e9f | ||
![]() |
4570f824f7 | ||
![]() |
a62719826a | ||
![]() |
ddbe977fcc | ||
![]() |
cd7fce4e4d | ||
![]() |
ae4d81cdfd | ||
![]() |
b90c8402cb | ||
![]() |
181a8498a3 | ||
![]() |
738ba3d012 | ||
![]() |
eb37e6886c | ||
![]() |
64f5d34465 | ||
![]() |
032830d7e0 | ||
![]() |
04d79b16c3 | ||
![]() |
1645bf0479 | ||
![]() |
4217bfc15d | ||
![]() |
598addf506 | ||
![]() |
959a773b64 | ||
![]() |
efa3ba6397 | ||
![]() |
02d4be23cf | ||
![]() |
ec1e34c4f1 | ||
![]() |
04b11d1ba6 | ||
![]() |
453b337e6e | ||
![]() |
3fe0c8b13d | ||
![]() |
824dfbd574 | ||
![]() |
a1dfc3dac9 | ||
![]() |
0cab66c9d8 | ||
![]() |
163a4b819b | ||
![]() |
36df7260cc | ||
![]() |
b2f6858ff7 | ||
![]() |
06cb0c3be9 | ||
![]() |
9177350a39 | ||
![]() |
e24dce10a2 | ||
![]() |
e7ad294283 | ||
![]() |
95a436595e | ||
![]() |
8e3f8b1a57 | ||
![]() |
408c32781e | ||
![]() |
a712e61888 | ||
![]() |
8066d94c1d | ||
![]() |
3a03070f5d | ||
![]() |
562910e831 | ||
![]() |
85fdbab6b9 | ||
![]() |
3fac8d7be5 | ||
![]() |
47db1a3c9f | ||
![]() |
491f8c1259 | ||
![]() |
83bda9febd | ||
![]() |
0d833fb4ce | ||
![]() |
c11ac644a1 | ||
![]() |
6aae7450aa | ||
![]() |
c042c4a5ef | ||
![]() |
0a3dcfaa4c | ||
![]() |
777f6d9749 | ||
![]() |
191309a79d | ||
![]() |
346daa2327 | ||
![]() |
21e3001f4f | ||
![]() |
38ba45f735 | ||
![]() |
925e76e283 | ||
![]() |
b11c38ea00 | ||
![]() |
2b0f078c99 | ||
![]() |
9e024fd5f5 | ||
![]() |
48fc60f866 | ||
![]() |
a2cf41c9c0 | ||
![]() |
6cbd24f704 | ||
![]() |
226960ef46 | ||
![]() |
228bafa909 | ||
![]() |
19bea10983 | ||
![]() |
8b111760b1 | ||
![]() |
301073a60d | ||
![]() |
d9db2edf5a | ||
![]() |
149cc44c39 | ||
![]() |
f7c999a6b3 | ||
![]() |
7fe9c9e139 | ||
![]() |
e1c9aec775 | ||
![]() |
f0231ad9b1 | ||
![]() |
0bbf0555d3 | ||
![]() |
d4d7ce5a4b | ||
![]() |
0b663ecbba | ||
![]() |
bbba643288 | ||
![]() |
830319e3db | ||
![]() |
32c8524317 | ||
![]() |
616c5e6914 | ||
![]() |
22a1813e9e | ||
![]() |
f27015fcf8 | ||
![]() |
d2ff3a63e8 | ||
![]() |
605e8d4a92 | ||
![]() |
e2f21a2d98 | ||
![]() |
f606ad2d9d | ||
![]() |
1730a229a5 | ||
![]() |
dff0f1e7d4 | ||
![]() |
b7af9bace4 | ||
![]() |
a167d61d2a | ||
![]() |
f48652322d | ||
![]() |
b95b2790dc | ||
![]() |
fa81bf113b | ||
![]() |
120029913d | ||
![]() |
aa67646b5a | ||
![]() |
a20aa4f0f5 | ||
![]() |
b60ec8e5ff | ||
![]() |
2b463237b0 | ||
![]() |
7bd4e03005 | ||
![]() |
8565a3106d | ||
![]() |
2bec82707f | ||
![]() |
5baeda0b5e | ||
![]() |
d15590f0a5 | ||
![]() |
760548335c | ||
![]() |
5a96bd1b9f | ||
![]() |
64a28be5e3 | ||
![]() |
8b67200717 | ||
![]() |
3106ddbd1e | ||
![]() |
f020f4a292 | ||
![]() |
0a6fc1b582 | ||
![]() |
c439424511 | ||
![]() |
2fe5750be1 | ||
![]() |
b0825ebb35 | ||
![]() |
20eb28e1a4 | ||
![]() |
f2c40271b2 | ||
![]() |
f90a7dc784 | ||
![]() |
a38733346f | ||
![]() |
c5b89d127d | ||
![]() |
95ab598ea4 | ||
![]() |
2a22bae1f9 | ||
![]() |
61e5dbeaa6 | ||
![]() |
6a893a758b | ||
![]() |
1d6074dbfa | ||
![]() |
db2a556f62 | ||
![]() |
b23e86aea3 | ||
![]() |
1674f12b62 | ||
![]() |
07f6358a80 | ||
![]() |
2f281ba228 | ||
![]() |
0a7d429192 | ||
![]() |
30a66533bc | ||
![]() |
b117265fcb | ||
![]() |
7f098c069c | ||
![]() |
d766ac6d20 | ||
![]() |
73840ead05 | ||
![]() |
7ace602a6c | ||
![]() |
c75c106490 | ||
![]() |
d9036c7af1 | ||
![]() |
518da3236f | ||
![]() |
104aece46e | ||
![]() |
9a29066426 | ||
![]() |
be9cd480aa | ||
![]() |
41c5152015 | ||
![]() |
b0ae0708e1 | ||
![]() |
272615e580 | ||
![]() |
bc33c8210c | ||
![]() |
7bc5c1930e | ||
![]() |
24d9f59d69 | ||
![]() |
6c6efb24f4 | ||
![]() |
362648b74b | ||
![]() |
a2c055ba5d | ||
![]() |
796a761a7d | ||
![]() |
09c4a26509 | ||
![]() |
e5907ec5ea | ||
![]() |
daa98a2f54 | ||
![]() |
99da3d7cd5 | ||
![]() |
3d11781542 | ||
![]() |
ecc5289c5f | ||
![]() |
6077ba5405 | ||
![]() |
53eada8028 | ||
![]() |
ce9d0e2e6a | ||
![]() |
ae8860eec3 | ||
![]() |
67d287f85e | ||
![]() |
9c2b95fc3c | ||
![]() |
3a22d4a501 | ||
![]() |
cecf759b0b | ||
![]() |
35c6b671de | ||
![]() |
c894c1f5b5 | ||
![]() |
a92571d588 | ||
![]() |
34a47706fd | ||
![]() |
906d909d87 | ||
![]() |
b041e5168b | ||
![]() |
14582fb13d | ||
![]() |
fd3ffdc22a | ||
![]() |
1009bb8fb7 | ||
![]() |
6722ac7540 | ||
![]() |
726efdad53 | ||
![]() |
9dbb9872bc | ||
![]() |
19f858b73b | ||
![]() |
d22131e2fb | ||
![]() |
f5add81e29 | ||
![]() |
c41fc67254 | ||
![]() |
81542142f5 | ||
![]() |
afaf87e414 | ||
![]() |
1782f69c8f | ||
![]() |
40f7105ae4 | ||
![]() |
5eae790740 | ||
![]() |
f71769e07b | ||
![]() |
b4b535f997 | ||
![]() |
d2226604e4 | ||
![]() |
567686e140 | ||
![]() |
ad95c99cc2 | ||
![]() |
c874d74faf | ||
![]() |
fe3dd5a531 | ||
![]() |
8e001b92f2 | ||
![]() |
6b40b394c8 | ||
![]() |
c2417de5f1 | ||
![]() |
116453d2a7 | ||
![]() |
7f19e50403 | ||
![]() |
4018fad416 | ||
![]() |
1d0aa763de | ||
![]() |
f6dc089ddf | ||
![]() |
2cc9a52e9e | ||
![]() |
0c2b5d0d79 | ||
![]() |
e3e12bbc78 | ||
![]() |
bfa76af434 | ||
![]() |
2ee37752c8 | ||
![]() |
95e01b4935 | ||
![]() |
a76097a843 | ||
![]() |
2dd2f310af | ||
![]() |
3340240b9f | ||
![]() |
7ee971eb9e | ||
![]() |
548874eb6a | ||
![]() |
152b295837 | ||
![]() |
f8540e9468 | ||
![]() |
9145a9e69e | ||
![]() |
7bebe2b348 | ||
![]() |
0f45124f84 | ||
![]() |
2ad32f9208 | ||
![]() |
8d244062e2 | ||
![]() |
1e84668270 | ||
![]() |
6941814729 | ||
![]() |
32d3001e2a | ||
![]() |
702c3ea80f | ||
![]() |
452e543e77 | ||
![]() |
cc7f555160 | ||
![]() |
8d38ccc44c | ||
![]() |
299b423e6b | ||
![]() |
6c96650043 | ||
![]() |
f98087ebce | ||
![]() |
23a5832fc9 | ||
![]() |
8794fa0b38 | ||
![]() |
f2338f5b66 | ||
![]() |
5aba2fed8b | ||
![]() |
bd6795032f | ||
![]() |
c17b723295 | ||
![]() |
231a9630df | ||
![]() |
bdb967e0a8 | ||
![]() |
ea3fbbd58d | ||
![]() |
afea3e8f37 | ||
![]() |
4e7dbf76cc | ||
![]() |
8a0a874d1c | ||
![]() |
a3901f691a | ||
![]() |
7434031003 | ||
![]() |
3011b7a1ea | ||
![]() |
9efd9e8a45 | ||
![]() |
69d9c09f33 | ||
![]() |
ecc4aa734b | ||
![]() |
547358fc7e | ||
![]() |
270586095f | ||
![]() |
aa1b998fbf | ||
![]() |
8b6485035e | ||
![]() |
1a31dc4be8 | ||
![]() |
9a692b3437 | ||
![]() |
cf706ea917 | ||
![]() |
445da58b51 | ||
![]() |
25a85eef69 | ||
![]() |
b36a0177db | ||
![]() |
dd4e14690d | ||
![]() |
5903792207 | ||
![]() |
c85e479f88 | ||
![]() |
a379cd02e7 | ||
![]() |
b3ce56c7fc | ||
![]() |
3f080e5bc8 | ||
![]() |
7b4601762a | ||
![]() |
d4edd98b8a | ||
![]() |
0a437f5800 | ||
![]() |
c41df420d7 | ||
![]() |
b79f9bdced | ||
![]() |
d06bb05c5f | ||
![]() |
dfb15901f4 | ||
![]() |
c9da36dc8b | ||
![]() |
c15326b896 | ||
![]() |
c0391c8a15 | ||
![]() |
2055f89bf7 |
25
.build/common.ts
Normal file
25
.build/common.ts
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
/**
|
||||||
|
* Shared common options for both ESBuild and Vite
|
||||||
|
*/
|
||||||
|
export const packageOptions = {
|
||||||
|
parser: {
|
||||||
|
name: 'mermaid-parser',
|
||||||
|
packageName: 'parser',
|
||||||
|
file: 'index.ts',
|
||||||
|
},
|
||||||
|
mermaid: {
|
||||||
|
name: 'mermaid',
|
||||||
|
packageName: 'mermaid',
|
||||||
|
file: 'mermaid.ts',
|
||||||
|
},
|
||||||
|
'mermaid-example-diagram': {
|
||||||
|
name: 'mermaid-example-diagram',
|
||||||
|
packageName: 'mermaid-example-diagram',
|
||||||
|
file: 'detector.ts',
|
||||||
|
},
|
||||||
|
'mermaid-zenuml': {
|
||||||
|
name: 'mermaid-zenuml',
|
||||||
|
packageName: 'mermaid-zenuml',
|
||||||
|
file: 'detector.ts',
|
||||||
|
},
|
||||||
|
} as const;
|
5
.build/generateLangium.ts
Normal file
5
.build/generateLangium.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import { generate } from 'langium-cli';
|
||||||
|
|
||||||
|
export async function generateLangium() {
|
||||||
|
await generate({ file: `./packages/parser/langium-config.json` });
|
||||||
|
}
|
122
.build/jsonSchema.ts
Normal file
122
.build/jsonSchema.ts
Normal file
@@ -0,0 +1,122 @@
|
|||||||
|
import { load, JSON_SCHEMA } from 'js-yaml';
|
||||||
|
import assert from 'node:assert';
|
||||||
|
import Ajv2019, { type JSONSchemaType } from 'ajv/dist/2019.js';
|
||||||
|
|
||||||
|
import type { MermaidConfig, BaseDiagramConfig } from '../packages/mermaid/src/config.type.js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* All of the keys in the mermaid config that have a mermaid diagram config.
|
||||||
|
*/
|
||||||
|
const MERMAID_CONFIG_DIAGRAM_KEYS = [
|
||||||
|
'flowchart',
|
||||||
|
'sequence',
|
||||||
|
'gantt',
|
||||||
|
'journey',
|
||||||
|
'class',
|
||||||
|
'state',
|
||||||
|
'er',
|
||||||
|
'pie',
|
||||||
|
'quadrantChart',
|
||||||
|
'requirement',
|
||||||
|
'mindmap',
|
||||||
|
'timeline',
|
||||||
|
'gitGraph',
|
||||||
|
'c4',
|
||||||
|
'sankey',
|
||||||
|
] as const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generate default values from the JSON Schema.
|
||||||
|
*
|
||||||
|
* AJV does not support nested default values yet (or default values with $ref),
|
||||||
|
* so we need to manually find them (this may be fixed in ajv v9).
|
||||||
|
*
|
||||||
|
* @param mermaidConfigSchema - The Mermaid JSON Schema to use.
|
||||||
|
* @returns The default mermaid config object.
|
||||||
|
*/
|
||||||
|
export function generateDefaults(mermaidConfigSchema: JSONSchemaType<MermaidConfig>) {
|
||||||
|
const ajv = new Ajv2019({
|
||||||
|
useDefaults: true,
|
||||||
|
allowUnionTypes: true,
|
||||||
|
strict: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
ajv.addKeyword({
|
||||||
|
keyword: 'meta:enum', // used by jsonschema2md
|
||||||
|
errors: false,
|
||||||
|
});
|
||||||
|
ajv.addKeyword({
|
||||||
|
keyword: 'tsType', // used by json-schema-to-typescript
|
||||||
|
errors: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
// ajv currently doesn't support nested default values, see https://github.com/ajv-validator/ajv/issues/1718
|
||||||
|
// (may be fixed in v9) so we need to manually use sub-schemas
|
||||||
|
const mermaidDefaultConfig = {};
|
||||||
|
|
||||||
|
assert.ok(mermaidConfigSchema.$defs);
|
||||||
|
const baseDiagramConfig = mermaidConfigSchema.$defs.BaseDiagramConfig;
|
||||||
|
|
||||||
|
for (const key of MERMAID_CONFIG_DIAGRAM_KEYS) {
|
||||||
|
const subSchemaRef = mermaidConfigSchema.properties[key].$ref;
|
||||||
|
const [root, defs, defName] = subSchemaRef.split('/');
|
||||||
|
assert.strictEqual(root, '#');
|
||||||
|
assert.strictEqual(defs, '$defs');
|
||||||
|
const subSchema = {
|
||||||
|
$schema: mermaidConfigSchema.$schema,
|
||||||
|
$defs: mermaidConfigSchema.$defs,
|
||||||
|
...mermaidConfigSchema.$defs[defName],
|
||||||
|
} as JSONSchemaType<BaseDiagramConfig>;
|
||||||
|
|
||||||
|
const validate = ajv.compile(subSchema);
|
||||||
|
|
||||||
|
mermaidDefaultConfig[key] = {};
|
||||||
|
|
||||||
|
for (const required of subSchema.required ?? []) {
|
||||||
|
if (subSchema.properties[required] === undefined && baseDiagramConfig.properties[required]) {
|
||||||
|
mermaidDefaultConfig[key][required] = baseDiagramConfig.properties[required].default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!validate(mermaidDefaultConfig[key])) {
|
||||||
|
throw new Error(
|
||||||
|
`schema for subconfig ${key} does not have valid defaults! Errors were ${JSON.stringify(
|
||||||
|
validate.errors,
|
||||||
|
undefined,
|
||||||
|
2
|
||||||
|
)}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const validate = ajv.compile(mermaidConfigSchema);
|
||||||
|
|
||||||
|
if (!validate(mermaidDefaultConfig)) {
|
||||||
|
throw new Error(
|
||||||
|
`Mermaid config JSON Schema does not have valid defaults! Errors were ${JSON.stringify(
|
||||||
|
validate.errors,
|
||||||
|
undefined,
|
||||||
|
2
|
||||||
|
)}`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return mermaidDefaultConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const loadSchema = (src: string, filename: string): JSONSchemaType<MermaidConfig> => {
|
||||||
|
const jsonSchema = load(src, {
|
||||||
|
filename,
|
||||||
|
// only allow JSON types in our YAML doc (will probably be default in YAML 1.3)
|
||||||
|
// e.g. `true` will be parsed a boolean `true`, `True` will be parsed as string `"True"`.
|
||||||
|
schema: JSON_SCHEMA,
|
||||||
|
}) as JSONSchemaType<MermaidConfig>;
|
||||||
|
return jsonSchema;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getDefaults = (schema: JSONSchemaType<MermaidConfig>) => {
|
||||||
|
return `export default ${JSON.stringify(generateDefaults(schema), undefined, 2)};`;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getSchema = (schema: JSONSchemaType<MermaidConfig>) => {
|
||||||
|
return `export default ${JSON.stringify(schema, undefined, 2)};`;
|
||||||
|
};
|
9
.build/langium-cli.d.ts
vendored
Normal file
9
.build/langium-cli.d.ts
vendored
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
declare module 'langium-cli' {
|
||||||
|
export interface GenerateOptions {
|
||||||
|
file?: string;
|
||||||
|
mode?: 'development' | 'production';
|
||||||
|
watch?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function generate(options: GenerateOptions): Promise<boolean>;
|
||||||
|
}
|
65
.esbuild/build.ts
Normal file
65
.esbuild/build.ts
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
import { build } from 'esbuild';
|
||||||
|
import { mkdir, writeFile } from 'node:fs/promises';
|
||||||
|
import { MermaidBuildOptions, defaultOptions, getBuildConfig } from './util.js';
|
||||||
|
import { packageOptions } from '../.build/common.js';
|
||||||
|
import { generateLangium } from '../.build/generateLangium.js';
|
||||||
|
|
||||||
|
const shouldVisualize = process.argv.includes('--visualize');
|
||||||
|
|
||||||
|
const buildPackage = async (entryName: keyof typeof packageOptions) => {
|
||||||
|
const commonOptions = { ...defaultOptions, entryName } as const;
|
||||||
|
const buildConfigs = [
|
||||||
|
// package.mjs
|
||||||
|
{ ...commonOptions },
|
||||||
|
// package.min.mjs
|
||||||
|
{
|
||||||
|
...commonOptions,
|
||||||
|
minify: true,
|
||||||
|
metafile: shouldVisualize,
|
||||||
|
},
|
||||||
|
// package.core.mjs
|
||||||
|
{ ...commonOptions, core: true },
|
||||||
|
];
|
||||||
|
|
||||||
|
if (entryName === 'mermaid') {
|
||||||
|
const iifeOptions: MermaidBuildOptions = { ...commonOptions, format: 'iife' };
|
||||||
|
buildConfigs.push(
|
||||||
|
// mermaid.js
|
||||||
|
{ ...iifeOptions },
|
||||||
|
// mermaid.min.js
|
||||||
|
{ ...iifeOptions, minify: true, metafile: shouldVisualize }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const results = await Promise.all(buildConfigs.map((option) => build(getBuildConfig(option))));
|
||||||
|
|
||||||
|
if (shouldVisualize) {
|
||||||
|
for (const { metafile } of results) {
|
||||||
|
if (!metafile) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const fileName = Object.keys(metafile.outputs)
|
||||||
|
.filter((file) => !file.includes('chunks') && file.endsWith('js'))[0]
|
||||||
|
.replace('dist/', '');
|
||||||
|
// Upload metafile into https://esbuild.github.io/analyze/
|
||||||
|
await writeFile(`stats/${fileName}.meta.json`, JSON.stringify(metafile));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handler = (e) => {
|
||||||
|
console.error(e);
|
||||||
|
process.exit(1);
|
||||||
|
};
|
||||||
|
|
||||||
|
const main = async () => {
|
||||||
|
await generateLangium();
|
||||||
|
await mkdir('stats').catch(() => {});
|
||||||
|
const packageNames = Object.keys(packageOptions) as (keyof typeof packageOptions)[];
|
||||||
|
// it should build `parser` before `mermaid` because it's a dependecy
|
||||||
|
for (const pkg of packageNames) {
|
||||||
|
await buildPackage(pkg).catch(handler);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
void main();
|
15
.esbuild/jisonPlugin.ts
Normal file
15
.esbuild/jisonPlugin.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { readFile } from 'node:fs/promises';
|
||||||
|
import { transformJison } from '../.build/jisonTransformer.js';
|
||||||
|
import { Plugin } from 'esbuild';
|
||||||
|
|
||||||
|
export const jisonPlugin: Plugin = {
|
||||||
|
name: 'jison',
|
||||||
|
setup(build) {
|
||||||
|
build.onLoad({ filter: /\.jison$/ }, async (args) => {
|
||||||
|
// Load the file from the file system
|
||||||
|
const source = await readFile(args.path, 'utf8');
|
||||||
|
const contents = transformJison(source);
|
||||||
|
return { contents, warnings: [] };
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
35
.esbuild/jsonSchemaPlugin.ts
Normal file
35
.esbuild/jsonSchemaPlugin.ts
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import type { JSONSchemaType } from 'ajv/dist/2019.js';
|
||||||
|
import type { MermaidConfig } from '../packages/mermaid/src/config.type.js';
|
||||||
|
import { readFile } from 'node:fs/promises';
|
||||||
|
import { getDefaults, getSchema, loadSchema } from '../.build/jsonSchema.js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ESBuild plugin that handles JSON Schemas saved as a `.schema.yaml` file.
|
||||||
|
*
|
||||||
|
* Use `my-example.schema.yaml?only-defaults=true` to only load the default values.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const jsonSchemaPlugin = {
|
||||||
|
name: 'json-schema-plugin',
|
||||||
|
setup(build) {
|
||||||
|
let schema: JSONSchemaType<MermaidConfig> | undefined = undefined;
|
||||||
|
let content = '';
|
||||||
|
|
||||||
|
build.onLoad({ filter: /config\.schema\.yaml$/ }, async (args) => {
|
||||||
|
// Load the file from the file system
|
||||||
|
const source = await readFile(args.path, 'utf8');
|
||||||
|
const resolvedSchema: JSONSchemaType<MermaidConfig> =
|
||||||
|
content === source && schema ? schema : loadSchema(source, args.path);
|
||||||
|
if (content !== source) {
|
||||||
|
content = source;
|
||||||
|
schema = resolvedSchema;
|
||||||
|
}
|
||||||
|
const contents = args.suffix.includes('only-defaults')
|
||||||
|
? getDefaults(resolvedSchema)
|
||||||
|
: getSchema(resolvedSchema);
|
||||||
|
return { contents, warnings: [] };
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export default jsonSchemaPlugin;
|
116
.esbuild/server.ts
Normal file
116
.esbuild/server.ts
Normal file
@@ -0,0 +1,116 @@
|
|||||||
|
import express from 'express';
|
||||||
|
import type { NextFunction, Request, Response } from 'express';
|
||||||
|
import cors from 'cors';
|
||||||
|
import { getBuildConfig, defaultOptions } from './util.js';
|
||||||
|
import { context } from 'esbuild';
|
||||||
|
import chokidar from 'chokidar';
|
||||||
|
import { generateLangium } from '../.build/generateLangium.js';
|
||||||
|
|
||||||
|
const parserCtx = await context(
|
||||||
|
getBuildConfig({ ...defaultOptions, minify: false, core: false, entryName: 'parser' })
|
||||||
|
);
|
||||||
|
const mermaidCtx = await context(
|
||||||
|
getBuildConfig({ ...defaultOptions, minify: false, core: false, entryName: 'mermaid' })
|
||||||
|
);
|
||||||
|
const mermaidIIFECtx = await context(
|
||||||
|
getBuildConfig({
|
||||||
|
...defaultOptions,
|
||||||
|
minify: false,
|
||||||
|
core: false,
|
||||||
|
entryName: 'mermaid',
|
||||||
|
format: 'iife',
|
||||||
|
})
|
||||||
|
);
|
||||||
|
const externalCtx = await context(
|
||||||
|
getBuildConfig({
|
||||||
|
...defaultOptions,
|
||||||
|
minify: false,
|
||||||
|
core: false,
|
||||||
|
entryName: 'mermaid-example-diagram',
|
||||||
|
})
|
||||||
|
);
|
||||||
|
const zenumlCtx = await context(
|
||||||
|
getBuildConfig({ ...defaultOptions, minify: false, core: false, entryName: 'mermaid-zenuml' })
|
||||||
|
);
|
||||||
|
const contexts = [parserCtx, mermaidCtx, mermaidIIFECtx, externalCtx, zenumlCtx];
|
||||||
|
|
||||||
|
const rebuildAll = async () => {
|
||||||
|
console.time('Rebuild time');
|
||||||
|
await Promise.all(contexts.map((ctx) => ctx.rebuild()));
|
||||||
|
console.timeEnd('Rebuild time');
|
||||||
|
};
|
||||||
|
|
||||||
|
let clients: { id: number; response: Response }[] = [];
|
||||||
|
function eventsHandler(request: Request, response: Response, next: NextFunction) {
|
||||||
|
const headers = {
|
||||||
|
'Content-Type': 'text/event-stream',
|
||||||
|
Connection: 'keep-alive',
|
||||||
|
'Cache-Control': 'no-cache',
|
||||||
|
};
|
||||||
|
response.writeHead(200, headers);
|
||||||
|
const clientId = Date.now();
|
||||||
|
clients.push({
|
||||||
|
id: clientId,
|
||||||
|
response,
|
||||||
|
});
|
||||||
|
request.on('close', () => {
|
||||||
|
clients = clients.filter((client) => client.id !== clientId);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
let timeoutId: NodeJS.Timeout | undefined = undefined;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Debounce file change events to avoid rebuilding multiple times.
|
||||||
|
*/
|
||||||
|
function handleFileChange() {
|
||||||
|
if (timeoutId !== undefined) {
|
||||||
|
clearTimeout(timeoutId);
|
||||||
|
}
|
||||||
|
timeoutId = setTimeout(async () => {
|
||||||
|
await rebuildAll();
|
||||||
|
sendEventsToAll();
|
||||||
|
timeoutId = undefined;
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendEventsToAll() {
|
||||||
|
clients.forEach(({ response }) => response.write(`data: ${Date.now()}\n\n`));
|
||||||
|
}
|
||||||
|
|
||||||
|
async function createServer() {
|
||||||
|
await generateLangium();
|
||||||
|
handleFileChange();
|
||||||
|
const app = express();
|
||||||
|
chokidar
|
||||||
|
.watch('**/src/**/*.{js,ts,langium,yaml,json}', {
|
||||||
|
ignoreInitial: true,
|
||||||
|
ignored: [/node_modules/, /dist/, /docs/, /coverage/],
|
||||||
|
})
|
||||||
|
.on('all', async (event, path) => {
|
||||||
|
// Ignore other events.
|
||||||
|
if (!['add', 'change'].includes(event)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (/\.langium$/.test(path)) {
|
||||||
|
await generateLangium();
|
||||||
|
}
|
||||||
|
console.log(`${path} changed. Rebuilding...`);
|
||||||
|
handleFileChange();
|
||||||
|
});
|
||||||
|
|
||||||
|
app.use(cors());
|
||||||
|
app.get('/events', eventsHandler);
|
||||||
|
app.use(express.static('./packages/parser/dist'));
|
||||||
|
app.use(express.static('./packages/mermaid/dist'));
|
||||||
|
app.use(express.static('./packages/mermaid-zenuml/dist'));
|
||||||
|
app.use(express.static('./packages/mermaid-example-diagram/dist'));
|
||||||
|
app.use(express.static('demos'));
|
||||||
|
app.use(express.static('cypress/platform'));
|
||||||
|
|
||||||
|
app.listen(9000, () => {
|
||||||
|
console.log(`Listening on http://localhost:9000`);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
createServer();
|
98
.esbuild/util.ts
Normal file
98
.esbuild/util.ts
Normal file
@@ -0,0 +1,98 @@
|
|||||||
|
import { resolve } from 'path';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
import type { BuildOptions } from 'esbuild';
|
||||||
|
import { readFileSync } from 'fs';
|
||||||
|
import jsonSchemaPlugin from './jsonSchemaPlugin.js';
|
||||||
|
import { packageOptions } from '../.build/common.js';
|
||||||
|
import { jisonPlugin } from './jisonPlugin.js';
|
||||||
|
|
||||||
|
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
||||||
|
|
||||||
|
export interface MermaidBuildOptions {
|
||||||
|
minify: boolean;
|
||||||
|
core: boolean;
|
||||||
|
metafile: boolean;
|
||||||
|
format: 'esm' | 'iife';
|
||||||
|
entryName: keyof typeof packageOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const defaultOptions: Omit<MermaidBuildOptions, 'entryName'> = {
|
||||||
|
minify: false,
|
||||||
|
metafile: false,
|
||||||
|
core: false,
|
||||||
|
format: 'esm',
|
||||||
|
} as const;
|
||||||
|
|
||||||
|
const buildOptions = (override: BuildOptions): BuildOptions => {
|
||||||
|
return {
|
||||||
|
bundle: true,
|
||||||
|
minify: true,
|
||||||
|
keepNames: true,
|
||||||
|
platform: 'browser',
|
||||||
|
tsconfig: 'tsconfig.json',
|
||||||
|
resolveExtensions: ['.ts', '.js', '.json', '.jison', '.yaml'],
|
||||||
|
external: ['require', 'fs', 'path'],
|
||||||
|
outdir: 'dist',
|
||||||
|
plugins: [jisonPlugin, jsonSchemaPlugin],
|
||||||
|
sourcemap: 'external',
|
||||||
|
...override,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
const getFileName = (fileName: string, { core, format, minify }: MermaidBuildOptions) => {
|
||||||
|
if (core) {
|
||||||
|
fileName += '.core';
|
||||||
|
} else if (format === 'esm') {
|
||||||
|
fileName += '.esm';
|
||||||
|
}
|
||||||
|
if (minify) {
|
||||||
|
fileName += '.min';
|
||||||
|
}
|
||||||
|
return fileName;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const getBuildConfig = (options: MermaidBuildOptions): BuildOptions => {
|
||||||
|
const { core, entryName, metafile, format, minify } = options;
|
||||||
|
const external: string[] = ['require', 'fs', 'path'];
|
||||||
|
const { name, file, packageName } = packageOptions[entryName];
|
||||||
|
const outFileName = getFileName(name, options);
|
||||||
|
let output: BuildOptions = buildOptions({
|
||||||
|
absWorkingDir: resolve(__dirname, `../packages/${packageName}`),
|
||||||
|
entryPoints: {
|
||||||
|
[outFileName]: `src/${file}`,
|
||||||
|
},
|
||||||
|
metafile,
|
||||||
|
minify,
|
||||||
|
logLevel: 'info',
|
||||||
|
chunkNames: `chunks/${outFileName}/[name]-[hash]`,
|
||||||
|
});
|
||||||
|
|
||||||
|
if (core) {
|
||||||
|
const { dependencies } = JSON.parse(
|
||||||
|
readFileSync(resolve(__dirname, `../packages/${packageName}/package.json`), 'utf-8')
|
||||||
|
);
|
||||||
|
// Core build is used to generate file without bundled dependencies.
|
||||||
|
// This is used by downstream projects to bundle dependencies themselves.
|
||||||
|
// Ignore dependencies and any dependencies of dependencies
|
||||||
|
external.push(...Object.keys(dependencies));
|
||||||
|
output.external = external;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (format === 'iife') {
|
||||||
|
output.format = 'iife';
|
||||||
|
output.splitting = false;
|
||||||
|
output.globalName = '__esbuild_esm_mermaid';
|
||||||
|
// Workaround for removing the .default access in esbuild IIFE.
|
||||||
|
// https://github.com/mermaid-js/mermaid/pull/4109#discussion_r1292317396
|
||||||
|
output.footer = {
|
||||||
|
js: 'globalThis.mermaid = globalThis.__esbuild_esm_mermaid.default;',
|
||||||
|
};
|
||||||
|
output.outExtension = { '.js': '.js' };
|
||||||
|
} else {
|
||||||
|
output.format = 'esm';
|
||||||
|
output.splitting = true;
|
||||||
|
output.outExtension = { '.js': '.mjs' };
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
|
};
|
@@ -6,3 +6,6 @@ cypress/plugins/index.js
|
|||||||
coverage
|
coverage
|
||||||
*.json
|
*.json
|
||||||
node_modules
|
node_modules
|
||||||
|
|
||||||
|
# autogenereated by langium-cli
|
||||||
|
generated/
|
||||||
|
@@ -38,12 +38,17 @@ module.exports = {
|
|||||||
'lodash',
|
'lodash',
|
||||||
'unicorn',
|
'unicorn',
|
||||||
],
|
],
|
||||||
|
ignorePatterns: [
|
||||||
|
// this file is automatically generated by `pnpm run --filter mermaid types:build-config`
|
||||||
|
'packages/mermaid/src/config.type.ts',
|
||||||
|
],
|
||||||
rules: {
|
rules: {
|
||||||
curly: 'error',
|
curly: 'error',
|
||||||
'no-console': 'error',
|
'no-console': 'error',
|
||||||
'no-prototype-builtins': 'off',
|
'no-prototype-builtins': 'off',
|
||||||
'no-unused-vars': 'off',
|
'no-unused-vars': 'off',
|
||||||
'cypress/no-async-tests': 'off',
|
'cypress/no-async-tests': 'off',
|
||||||
|
'@typescript-eslint/consistent-type-imports': 'error',
|
||||||
'@typescript-eslint/no-floating-promises': 'error',
|
'@typescript-eslint/no-floating-promises': 'error',
|
||||||
'@typescript-eslint/no-misused-promises': 'error',
|
'@typescript-eslint/no-misused-promises': 'error',
|
||||||
'@typescript-eslint/ban-ts-comment': [
|
'@typescript-eslint/ban-ts-comment': [
|
||||||
@@ -123,6 +128,14 @@ module.exports = {
|
|||||||
files: ['*.{ts,tsx}'],
|
files: ['*.{ts,tsx}'],
|
||||||
plugins: ['tsdoc'],
|
plugins: ['tsdoc'],
|
||||||
rules: {
|
rules: {
|
||||||
|
'no-restricted-syntax': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
selector: 'TSEnumDeclaration',
|
||||||
|
message:
|
||||||
|
'Prefer using TypeScript union types over TypeScript enum, since TypeScript enums have a bunch of issues, see https://dev.to/dvddpl/whats-the-problem-with-typescript-enums-2okj',
|
||||||
|
},
|
||||||
|
],
|
||||||
'tsdoc/syntax': 'error',
|
'tsdoc/syntax': 'error',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
11
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
11
.github/ISSUE_TEMPLATE/bug_report.yml
vendored
@@ -53,8 +53,17 @@ body:
|
|||||||
Please fill out the info below.
|
Please fill out the info below.
|
||||||
Note that you only need to fill out the relevant section
|
Note that you only need to fill out the relevant section
|
||||||
value: |-
|
value: |-
|
||||||
- Mermaid version:
|
- Mermaid version:
|
||||||
- Browser and Version: [Chrome, Edge, Firefox]
|
- Browser and Version: [Chrome, Edge, Firefox]
|
||||||
|
- type: textarea
|
||||||
|
attributes:
|
||||||
|
label: Suggested Solutions
|
||||||
|
description: >
|
||||||
|
If applicable, suggest solutions that could resolve the bug.
|
||||||
|
It would help maintainers/contributors to not waste time looking for the solution. Even pointing the line causing the bug would be great!
|
||||||
|
placeholder: |-
|
||||||
|
- Variable `parser` in file <filepath> is not initialised ...
|
||||||
|
- Add a new type for ...
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Additional Context
|
label: Additional Context
|
||||||
|
17
.github/codecov.yaml
vendored
Normal file
17
.github/codecov.yaml
vendored
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
codecov:
|
||||||
|
branch: develop
|
||||||
|
|
||||||
|
comment:
|
||||||
|
layout: 'reach, diff, flags, files'
|
||||||
|
behavior: default
|
||||||
|
require_changes: false # if true: only post the comment if coverage changes
|
||||||
|
require_base: no # [yes :: must have a base report to post]
|
||||||
|
require_head: yes # [yes :: must have a head report to post]
|
||||||
|
|
||||||
|
coverage:
|
||||||
|
status:
|
||||||
|
project:
|
||||||
|
off
|
||||||
|
# Turing off for now as code coverage isn't stable and causes unnecessary build failures.
|
||||||
|
# default:
|
||||||
|
# threshold: 2%
|
44
.github/lychee.toml
vendored
Normal file
44
.github/lychee.toml
vendored
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
############################# Display #############################
|
||||||
|
|
||||||
|
# Verbose program output
|
||||||
|
# Accepts log level: "error", "warn", "info", "debug", "trace"
|
||||||
|
verbose = "debug"
|
||||||
|
|
||||||
|
# Don't show interactive progress bar while checking links.
|
||||||
|
no_progress = true
|
||||||
|
|
||||||
|
############################# Cache ###############################
|
||||||
|
|
||||||
|
# Enable link caching. This can be helpful to avoid checking the same links on
|
||||||
|
# multiple runs.
|
||||||
|
cache = true
|
||||||
|
|
||||||
|
# Discard all cached requests older than this duration.
|
||||||
|
max_cache_age = "1d"
|
||||||
|
|
||||||
|
############################# Requests ############################
|
||||||
|
|
||||||
|
# Comma-separated list of accepted status codes for valid links.
|
||||||
|
accept = [200, 429]
|
||||||
|
|
||||||
|
############################# Exclusions ##########################
|
||||||
|
|
||||||
|
# Exclude URLs and mail addresses from checking (supports regex).
|
||||||
|
exclude = [
|
||||||
|
# Network error: Forbidden
|
||||||
|
"https://codepen.io",
|
||||||
|
|
||||||
|
# Timeout error, maybe Twitter has anti-bot defenses against GitHub's CI servers?
|
||||||
|
"https://twitter.com/mermaidjs_",
|
||||||
|
|
||||||
|
# Don't check files that are generated during the build via `pnpm docs:code`
|
||||||
|
'packages/mermaid/src/docs/config/setup/*',
|
||||||
|
|
||||||
|
# Ignore slack invite
|
||||||
|
"https://join.slack.com/"
|
||||||
|
]
|
||||||
|
|
||||||
|
# Exclude all private IPs from checking.
|
||||||
|
# Equivalent to setting `exclude_private`, `exclude_link_local`, and
|
||||||
|
# `exclude_loopback` to true.
|
||||||
|
exclude_all_private = true
|
7
.github/pr-labeler.yml
vendored
7
.github/pr-labeler.yml
vendored
@@ -1,3 +1,4 @@
|
|||||||
'Type: Bug / Error': 'bug/*'
|
'Type: Bug / Error': ['bug/*', fix/*]
|
||||||
'Type: Enhancement': 'feature/*'
|
'Type: Enhancement': ['feature/*', 'feat/*']
|
||||||
'Type: Other': 'other/*'
|
'Type: Other': ['other/*', 'chore/*', 'test/*', 'refactor/*']
|
||||||
|
'Area: Documentation': ['docs/*']
|
||||||
|
4
.github/pull_request_template.md
vendored
4
.github/pull_request_template.md
vendored
@@ -13,6 +13,6 @@ Describe the way your implementation works or what design decisions you made if
|
|||||||
Make sure you
|
Make sure you
|
||||||
|
|
||||||
- [ ] :book: have read the [contribution guidelines](https://github.com/mermaid-js/mermaid/blob/develop/CONTRIBUTING.md)
|
- [ ] :book: have read the [contribution guidelines](https://github.com/mermaid-js/mermaid/blob/develop/CONTRIBUTING.md)
|
||||||
- [ ] :computer: have added unit/e2e tests (if appropriate)
|
- [ ] :computer: have added necessary unit/e2e tests.
|
||||||
- [ ] :notebook: have added documentation (if appropriate)
|
- [ ] :notebook: have added documentation. Make sure [`MERMAID_RELEASE_VERSION`](https://github.com/mermaid-js/mermaid/blob/develop/packages/mermaid/src/docs/community/development.md#3-update-documentation) is used for all new features.
|
||||||
- [ ] :bookmark: targeted `develop` branch
|
- [ ] :bookmark: targeted `develop` branch
|
||||||
|
15
.github/release-drafter.yml
vendored
15
.github/release-drafter.yml
vendored
@@ -1,14 +1,27 @@
|
|||||||
name-template: '$NEXT_PATCH_VERSION'
|
name-template: '$NEXT_PATCH_VERSION'
|
||||||
tag-template: '$NEXT_PATCH_VERSION'
|
tag-template: '$NEXT_PATCH_VERSION'
|
||||||
categories:
|
categories:
|
||||||
|
- title: '🚨 **Breaking Changes**'
|
||||||
|
labels:
|
||||||
|
- 'Breaking Change'
|
||||||
- title: '🚀 Features'
|
- title: '🚀 Features'
|
||||||
labels:
|
labels:
|
||||||
- 'Type: Enhancement'
|
- 'Type: Enhancement'
|
||||||
|
- 'feature' # deprecated, new PRs shouldn't have this
|
||||||
- title: '🐛 Bug Fixes'
|
- title: '🐛 Bug Fixes'
|
||||||
labels:
|
labels:
|
||||||
- 'Type: Bug / Error'
|
- 'Type: Bug / Error'
|
||||||
|
- 'fix' # deprecated, new PRs shouldn't have this
|
||||||
- title: '🧰 Maintenance'
|
- title: '🧰 Maintenance'
|
||||||
label: 'Type: Other'
|
labels:
|
||||||
|
- 'Type: Other'
|
||||||
|
- 'chore' # deprecated, new PRs shouldn't have this
|
||||||
|
- title: '⚡️ Performance'
|
||||||
|
labels:
|
||||||
|
- 'Type: Performance'
|
||||||
|
- title: '📚 Documentation'
|
||||||
|
labels:
|
||||||
|
- 'Area: Documentation'
|
||||||
change-template: '- $TITLE (#$NUMBER) @$AUTHOR'
|
change-template: '- $TITLE (#$NUMBER) @$AUTHOR'
|
||||||
sort-by: title
|
sort-by: title
|
||||||
sort-direction: ascending
|
sort-direction: ascending
|
||||||
|
12
.github/workflows/build-docs.yml
vendored
12
.github/workflows/build-docs.yml
vendored
@@ -1,14 +1,18 @@
|
|||||||
name: Build Vitepress docs
|
name: Build Vitepress docs
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- release/*
|
||||||
pull_request:
|
pull_request:
|
||||||
|
merge_group:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Build job
|
build-docs:
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -25,5 +29,9 @@ jobs:
|
|||||||
- name: Install Packages
|
- name: Install Packages
|
||||||
run: pnpm install --frozen-lockfile
|
run: pnpm install --frozen-lockfile
|
||||||
|
|
||||||
|
- name: Verify release verion
|
||||||
|
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release')) }}
|
||||||
|
run: pnpm --filter mermaid run docs:verify-version
|
||||||
|
|
||||||
- name: Run Build
|
- name: Run Build
|
||||||
run: pnpm --filter mermaid run docs:build:vitepress
|
run: pnpm --filter mermaid run docs:build:vitepress
|
||||||
|
3
.github/workflows/build.yml
vendored
3
.github/workflows/build.yml
vendored
@@ -2,6 +2,7 @@ name: Build
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push: {}
|
push: {}
|
||||||
|
merge_group:
|
||||||
pull_request:
|
pull_request:
|
||||||
types:
|
types:
|
||||||
- opened
|
- opened
|
||||||
@@ -12,7 +13,7 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build-mermaid:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
2
.github/workflows/check-readme-in-sync.yml
vendored
2
.github/workflows/check-readme-in-sync.yml
vendored
@@ -14,7 +14,7 @@ permissions:
|
|||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check:
|
check-readme:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
|
7
.github/workflows/checks.yml
vendored
7
.github/workflows/checks.yml
vendored
@@ -1,15 +1,16 @@
|
|||||||
on:
|
on:
|
||||||
push: {}
|
push:
|
||||||
|
merge_group:
|
||||||
pull_request:
|
pull_request:
|
||||||
types:
|
types:
|
||||||
- opened
|
- opened
|
||||||
- synchronize
|
- synchronize
|
||||||
- ready_for_review
|
- ready_for_review
|
||||||
|
|
||||||
name: Static analysis
|
name: Static analysis on Test files
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
check-tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
name: check tests
|
name: check tests
|
||||||
if: github.repository_owner == 'mermaid-js'
|
if: github.repository_owner == 'mermaid-js'
|
||||||
|
2
.github/workflows/e2e-applitools.yml
vendored
2
.github/workflows/e2e-applitools.yml
vendored
@@ -19,7 +19,7 @@ env:
|
|||||||
USE_APPLI: ${{ secrets.APPLITOOLS_API_KEY && 'true' || '' }}
|
USE_APPLI: ${{ secrets.APPLITOOLS_API_KEY && 'true' || '' }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
e2e-applitools:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
|
23
.github/workflows/e2e.yml
vendored
23
.github/workflows/e2e.yml
vendored
@@ -1,12 +1,15 @@
|
|||||||
name: E2E
|
name: E2E
|
||||||
|
|
||||||
on: [push, pull_request]
|
on:
|
||||||
|
push:
|
||||||
|
pull_request:
|
||||||
|
merge_group:
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
e2e:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
@@ -33,7 +36,7 @@ jobs:
|
|||||||
# Otherwise (e.g. if running from fork), we run on a single container only
|
# Otherwise (e.g. if running from fork), we run on a single container only
|
||||||
if: ${{ ( env.CYPRESS_RECORD_KEY != '' ) || ( matrix.containers == 1 ) }}
|
if: ${{ ( env.CYPRESS_RECORD_KEY != '' ) || ( matrix.containers == 1 ) }}
|
||||||
with:
|
with:
|
||||||
start: pnpm run dev
|
start: pnpm run dev:coverage
|
||||||
wait-on: 'http://localhost:9000'
|
wait-on: 'http://localhost:9000'
|
||||||
# Disable recording if we don't have an API key
|
# Disable recording if we don't have an API key
|
||||||
# e.g. if this action was run from a fork
|
# e.g. if this action was run from a fork
|
||||||
@@ -41,7 +44,19 @@ jobs:
|
|||||||
parallel: ${{ secrets.CYPRESS_RECORD_KEY != '' }}
|
parallel: ${{ secrets.CYPRESS_RECORD_KEY != '' }}
|
||||||
env:
|
env:
|
||||||
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
|
||||||
|
VITEST_COVERAGE: true
|
||||||
|
CYPRESS_COMMIT: ${{ github.sha }}
|
||||||
|
- name: Upload Coverage to Codecov
|
||||||
|
uses: codecov/codecov-action@v3
|
||||||
|
# Run step only pushes to develop and pull_requests
|
||||||
|
if: ${{ steps.cypress.conclusion == 'success' && (github.event_name == 'pull_request' || github.ref == 'refs/heads/develop')}}
|
||||||
|
with:
|
||||||
|
files: coverage/cypress/lcov.info
|
||||||
|
flags: e2e
|
||||||
|
name: mermaid-codecov
|
||||||
|
fail_ci_if_error: false
|
||||||
|
verbose: true
|
||||||
|
token: 6845cc80-77ee-4e17-85a1-026cd95e0766
|
||||||
- name: Upload Artifacts
|
- name: Upload Artifacts
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v3
|
||||||
if: ${{ failure() && steps.cypress.conclusion == 'failure' }}
|
if: ${{ failure() && steps.cypress.conclusion == 'failure' }}
|
||||||
|
7
.github/workflows/link-checker.yml
vendored
7
.github/workflows/link-checker.yml
vendored
@@ -20,7 +20,7 @@ on:
|
|||||||
- cron: '30 8 * * *'
|
- cron: '30 8 * * *'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
linkChecker:
|
link-checker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
# lychee only uses the GITHUB_TOKEN to avoid rate-limiting
|
# lychee only uses the GITHUB_TOKEN to avoid rate-limiting
|
||||||
@@ -39,10 +39,7 @@ jobs:
|
|||||||
uses: lycheeverse/lychee-action@v1.8.0
|
uses: lycheeverse/lychee-action@v1.8.0
|
||||||
with:
|
with:
|
||||||
args: >-
|
args: >-
|
||||||
--verbose
|
--config .github/lychee.toml
|
||||||
--no-progress
|
|
||||||
--cache
|
|
||||||
--max-cache-age 1d
|
|
||||||
packages/mermaid/src/docs/**/*.md
|
packages/mermaid/src/docs/**/*.md
|
||||||
README.md
|
README.md
|
||||||
README.zh-CN.md
|
README.zh-CN.md
|
||||||
|
30
.github/workflows/lint.yml
vendored
30
.github/workflows/lint.yml
vendored
@@ -1,7 +1,8 @@
|
|||||||
name: Lint
|
name: Lint
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push: {}
|
push:
|
||||||
|
merge_group:
|
||||||
pull_request:
|
pull_request:
|
||||||
types:
|
types:
|
||||||
- opened
|
- opened
|
||||||
@@ -52,6 +53,33 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
- name: Verify `./src/config.type.ts` is in sync with `./src/schemas/config.schema.yaml`
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if ! pnpm run --filter mermaid types:verify-config; then
|
||||||
|
ERROR_MESSAGE='Running `pnpm run --filter mermaid types:verify-config` failed.'
|
||||||
|
ERROR_MESSAGE+=' This should be fixed by running'
|
||||||
|
ERROR_MESSAGE+=' `pnpm run --filter mermaid types:build-config`'
|
||||||
|
ERROR_MESSAGE+=' on your local machine.'
|
||||||
|
echo "::error title=Lint failure::${ERROR_MESSAGE}"
|
||||||
|
# make sure to return an error exitcode so that GitHub actions shows a red-cross
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Verify no circular dependencies
|
||||||
|
working-directory: ./packages/mermaid
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
if ! pnpm run --filter mermaid checkCircle; then
|
||||||
|
ERROR_MESSAGE='Circular dependency detected.'
|
||||||
|
ERROR_MESSAGE+=' This should be fixed by removing the circular dependency.'
|
||||||
|
ERROR_MESSAGE+=' Run `pnpm run --filter mermaid checkCircle` on your local machine'
|
||||||
|
ERROR_MESSAGE+=' to see the circular dependency.'
|
||||||
|
echo "::error title=Lint failure::${ERROR_MESSAGE}"
|
||||||
|
# make sure to return an error exitcode so that GitHub actions shows a red-cross
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Verify Docs
|
- name: Verify Docs
|
||||||
id: verifyDocs
|
id: verifyDocs
|
||||||
working-directory: ./packages/mermaid
|
working-directory: ./packages/mermaid
|
||||||
|
@@ -1,11 +1,15 @@
|
|||||||
name: Validate PR Labeler Configuration
|
name: Validate PR Labeler Configuration
|
||||||
on:
|
on:
|
||||||
push: {}
|
push:
|
||||||
|
paths:
|
||||||
|
- .github/workflows/pr-labeler-config-validator.yml
|
||||||
|
- .github/workflows/pr-labeler.yml
|
||||||
|
- .github/pr-labeler.yml
|
||||||
pull_request:
|
pull_request:
|
||||||
types:
|
paths:
|
||||||
- opened
|
- .github/workflows/pr-labeler-config-validator.yml
|
||||||
- synchronize
|
- .github/workflows/pr-labeler.yml
|
||||||
- ready_for_review
|
- .github/pr-labeler.yml
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
pr-labeler:
|
pr-labeler:
|
||||||
|
6
.github/workflows/publish-docs.yml
vendored
6
.github/workflows/publish-docs.yml
vendored
@@ -19,7 +19,7 @@ concurrency:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# Build job
|
# Build job
|
||||||
build:
|
build-docs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -48,11 +48,11 @@ jobs:
|
|||||||
path: packages/mermaid/src/vitepress/.vitepress/dist
|
path: packages/mermaid/src/vitepress/.vitepress/dist
|
||||||
|
|
||||||
# Deployment job
|
# Deployment job
|
||||||
deploy:
|
deploy-docs:
|
||||||
environment:
|
environment:
|
||||||
name: github-pages
|
name: github-pages
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: build
|
needs: build-docs
|
||||||
steps:
|
steps:
|
||||||
- name: Deploy to GitHub Pages
|
- name: Deploy to GitHub Pages
|
||||||
id: deployment
|
id: deployment
|
||||||
|
@@ -6,7 +6,7 @@ on:
|
|||||||
- 'release/**'
|
- 'release/**'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
publish:
|
publish-preview:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
25
.github/workflows/test.yml
vendored
25
.github/workflows/test.yml
vendored
@@ -1,12 +1,12 @@
|
|||||||
name: Unit Tests
|
name: Unit Tests
|
||||||
|
|
||||||
on: [push, pull_request]
|
on: [push, pull_request, merge_group]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
unit-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
@@ -31,7 +31,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Run Unit Tests
|
- name: Run Unit Tests
|
||||||
run: |
|
run: |
|
||||||
pnpm run ci --coverage
|
pnpm test:coverage
|
||||||
|
|
||||||
- name: Run ganttDb tests using California timezone
|
- name: Run ganttDb tests using California timezone
|
||||||
env:
|
env:
|
||||||
@@ -39,11 +39,16 @@ jobs:
|
|||||||
# since some days have 25 hours instead of 24.
|
# since some days have 25 hours instead of 24.
|
||||||
TZ: America/Los_Angeles
|
TZ: America/Los_Angeles
|
||||||
run: |
|
run: |
|
||||||
pnpm exec vitest run ./packages/mermaid/src/diagrams/gantt/ganttDb.spec.ts
|
pnpm exec vitest run ./packages/mermaid/src/diagrams/gantt/ganttDb.spec.ts --coverage
|
||||||
|
|
||||||
# Coveralls is throwing 500. Disabled for now.
|
- name: Upload Coverage to Codecov
|
||||||
# - name: Upload Coverage to Coveralls
|
uses: codecov/codecov-action@v3
|
||||||
# uses: coverallsapp/github-action@v2
|
# Run step only pushes to develop and pull_requests
|
||||||
# with:
|
if: ${{ github.event_name == 'pull_request' || github.ref == 'refs/heads/develop' }}
|
||||||
# github-token: ${{ secrets.GITHUB_TOKEN }}
|
with:
|
||||||
# flag-name: unit
|
files: ./coverage/vitest/lcov.info
|
||||||
|
flags: unit
|
||||||
|
name: mermaid-codecov
|
||||||
|
fail_ci_if_error: false
|
||||||
|
verbose: true
|
||||||
|
token: 6845cc80-77ee-4e17-85a1-026cd95e0766
|
||||||
|
2
.github/workflows/update-browserlist.yml
vendored
2
.github/workflows/update-browserlist.yml
vendored
@@ -5,7 +5,7 @@ on:
|
|||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
update-browser-list:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
8
.gitignore
vendored
8
.gitignore
vendored
@@ -42,3 +42,11 @@ stats/
|
|||||||
**/user-avatars/*
|
**/user-avatars/*
|
||||||
**/contributor-names.json
|
**/contributor-names.json
|
||||||
.pnpm-store
|
.pnpm-store
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
demos/dev/**
|
||||||
|
!/demos/dev/example.html
|
||||||
|
!/demos/dev/reload.js
|
||||||
|
|
||||||
|
# autogenereated by langium-cli
|
||||||
|
generated/
|
||||||
|
@@ -1,17 +0,0 @@
|
|||||||
# These links are ignored by our link checker https://github.com/lycheeverse/lychee
|
|
||||||
# The file allows you to list multiple regular expressions for exclusion (one pattern per line).
|
|
||||||
|
|
||||||
# Network error: Forbidden
|
|
||||||
https://codepen.io
|
|
||||||
|
|
||||||
# Timeout error, maybe Twitter has anti-bot defenses against GitHub's CI servers?
|
|
||||||
https://twitter.com/mermaidjs_
|
|
||||||
|
|
||||||
# Don't check files that are generated during the build via `pnpm docs:code`
|
|
||||||
packages/mermaid/src/docs/config/setup/*
|
|
||||||
|
|
||||||
# Ignore localhost
|
|
||||||
http://localhost:3333/
|
|
||||||
|
|
||||||
# Ignore slack invite
|
|
||||||
https://join.slack.com/
|
|
@@ -5,4 +5,11 @@ coverage
|
|||||||
# Autogenerated by PNPM
|
# Autogenerated by PNPM
|
||||||
pnpm-lock.yaml
|
pnpm-lock.yaml
|
||||||
stats
|
stats
|
||||||
packages/mermaid/src/docs/.vitepress/components.d.ts
|
**/.vitepress/components.d.ts
|
||||||
|
**/.vitepress/cache
|
||||||
|
.nyc_output
|
||||||
|
# Autogenerated by `pnpm run --filter mermaid types:build-config`
|
||||||
|
packages/mermaid/src/config.type.ts
|
||||||
|
|
||||||
|
# autogenereated by langium-cli
|
||||||
|
generated/
|
||||||
|
@@ -2,14 +2,18 @@ import { build, InlineConfig, type PluginOption } from 'vite';
|
|||||||
import { resolve } from 'path';
|
import { resolve } from 'path';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
import jisonPlugin from './jisonPlugin.js';
|
import jisonPlugin from './jisonPlugin.js';
|
||||||
import { readFileSync } from 'fs';
|
import jsonSchemaPlugin from './jsonSchemaPlugin.js';
|
||||||
import typescript from '@rollup/plugin-typescript';
|
import typescript from '@rollup/plugin-typescript';
|
||||||
import { visualizer } from 'rollup-plugin-visualizer';
|
import { visualizer } from 'rollup-plugin-visualizer';
|
||||||
import type { TemplateType } from 'rollup-plugin-visualizer/dist/plugin/template-types.js';
|
import type { TemplateType } from 'rollup-plugin-visualizer/dist/plugin/template-types.js';
|
||||||
|
import istanbul from 'vite-plugin-istanbul';
|
||||||
|
import { packageOptions } from '../.build/common.js';
|
||||||
|
import { generateLangium } from '../.build/generateLangium.js';
|
||||||
|
|
||||||
const visualize = process.argv.includes('--visualize');
|
const visualize = process.argv.includes('--visualize');
|
||||||
const watch = process.argv.includes('--watch');
|
const watch = process.argv.includes('--watch');
|
||||||
const mermaidOnly = process.argv.includes('--mermaid');
|
const mermaidOnly = process.argv.includes('--mermaid');
|
||||||
|
const coverage = process.env.VITE_COVERAGE === 'true';
|
||||||
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
const __dirname = fileURLToPath(new URL('.', import.meta.url));
|
||||||
const sourcemap = false;
|
const sourcemap = false;
|
||||||
|
|
||||||
@@ -33,24 +37,6 @@ const visualizerOptions = (packageName: string, core = false): PluginOption[] =>
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const packageOptions = {
|
|
||||||
mermaid: {
|
|
||||||
name: 'mermaid',
|
|
||||||
packageName: 'mermaid',
|
|
||||||
file: 'mermaid.ts',
|
|
||||||
},
|
|
||||||
'mermaid-example-diagram': {
|
|
||||||
name: 'mermaid-example-diagram',
|
|
||||||
packageName: 'mermaid-example-diagram',
|
|
||||||
file: 'detector.ts',
|
|
||||||
},
|
|
||||||
'mermaid-zenuml': {
|
|
||||||
name: 'mermaid-zenuml',
|
|
||||||
packageName: 'mermaid-zenuml',
|
|
||||||
file: 'detector.ts',
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
interface BuildOptions {
|
interface BuildOptions {
|
||||||
minify: boolean | 'esbuild';
|
minify: boolean | 'esbuild';
|
||||||
core?: boolean;
|
core?: boolean;
|
||||||
@@ -69,34 +55,8 @@ export const getBuildConfig = ({ minify, core, watch, entryName }: BuildOptions)
|
|||||||
sourcemap,
|
sourcemap,
|
||||||
entryFileNames: `${name}.esm${minify ? '.min' : ''}.mjs`,
|
entryFileNames: `${name}.esm${minify ? '.min' : ''}.mjs`,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name,
|
|
||||||
format: 'umd',
|
|
||||||
sourcemap,
|
|
||||||
entryFileNames: `${name}${minify ? '.min' : ''}.js`,
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
if (core) {
|
|
||||||
const { dependencies } = JSON.parse(
|
|
||||||
readFileSync(resolve(__dirname, `../packages/${packageName}/package.json`), 'utf-8')
|
|
||||||
);
|
|
||||||
// Core build is used to generate file without bundled dependencies.
|
|
||||||
// This is used by downstream projects to bundle dependencies themselves.
|
|
||||||
// Ignore dependencies and any dependencies of dependencies
|
|
||||||
// Adapted from the RegEx used by `rollup-plugin-node`
|
|
||||||
external.push(new RegExp('^(?:' + Object.keys(dependencies).join('|') + ')(?:/.+)?$'));
|
|
||||||
// This needs to be an array. Otherwise vite will build esm & umd with same name and overwrite esm with umd.
|
|
||||||
output = [
|
|
||||||
{
|
|
||||||
name,
|
|
||||||
format: 'esm',
|
|
||||||
sourcemap,
|
|
||||||
entryFileNames: `${name}.core.mjs`,
|
|
||||||
},
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
const config: InlineConfig = {
|
const config: InlineConfig = {
|
||||||
configFile: false,
|
configFile: false,
|
||||||
build: {
|
build: {
|
||||||
@@ -119,8 +79,15 @@ export const getBuildConfig = ({ minify, core, watch, entryName }: BuildOptions)
|
|||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
jisonPlugin(),
|
jisonPlugin(),
|
||||||
|
jsonSchemaPlugin(), // handles `.schema.yaml` files
|
||||||
// @ts-expect-error According to the type definitions, rollup plugins are incompatible with vite
|
// @ts-expect-error According to the type definitions, rollup plugins are incompatible with vite
|
||||||
typescript({ compilerOptions: { declaration: false } }),
|
typescript({ compilerOptions: { declaration: false } }),
|
||||||
|
istanbul({
|
||||||
|
exclude: ['node_modules', 'test/', '__mocks__', 'generated'],
|
||||||
|
extension: ['.js', '.ts'],
|
||||||
|
requireEnv: true,
|
||||||
|
forceBuildInstrument: coverage,
|
||||||
|
}),
|
||||||
...visualizerOptions(packageName, core),
|
...visualizerOptions(packageName, core),
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
@@ -136,24 +103,28 @@ export const getBuildConfig = ({ minify, core, watch, entryName }: BuildOptions)
|
|||||||
|
|
||||||
const buildPackage = async (entryName: keyof typeof packageOptions) => {
|
const buildPackage = async (entryName: keyof typeof packageOptions) => {
|
||||||
await build(getBuildConfig({ minify: false, entryName }));
|
await build(getBuildConfig({ minify: false, entryName }));
|
||||||
await build(getBuildConfig({ minify: 'esbuild', entryName }));
|
|
||||||
await build(getBuildConfig({ minify: false, core: true, entryName }));
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const main = async () => {
|
const main = async () => {
|
||||||
const packageNames = Object.keys(packageOptions) as (keyof typeof packageOptions)[];
|
const packageNames = Object.keys(packageOptions) as (keyof typeof packageOptions)[];
|
||||||
for (const pkg of packageNames.filter((pkg) => !mermaidOnly || pkg === 'mermaid')) {
|
for (const pkg of packageNames.filter(
|
||||||
|
(pkg) => !mermaidOnly || pkg === 'mermaid' || pkg === 'parser'
|
||||||
|
)) {
|
||||||
await buildPackage(pkg);
|
await buildPackage(pkg);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
await generateLangium();
|
||||||
|
|
||||||
if (watch) {
|
if (watch) {
|
||||||
|
await build(getBuildConfig({ minify: false, watch, core: false, entryName: 'parser' }));
|
||||||
build(getBuildConfig({ minify: false, watch, core: false, entryName: 'mermaid' }));
|
build(getBuildConfig({ minify: false, watch, core: false, entryName: 'mermaid' }));
|
||||||
if (!mermaidOnly) {
|
if (!mermaidOnly) {
|
||||||
build(getBuildConfig({ minify: false, watch, entryName: 'mermaid-example-diagram' }));
|
build(getBuildConfig({ minify: false, watch, entryName: 'mermaid-example-diagram' }));
|
||||||
build(getBuildConfig({ minify: false, watch, entryName: 'mermaid-zenuml' }));
|
build(getBuildConfig({ minify: false, watch, entryName: 'mermaid-zenuml' }));
|
||||||
}
|
}
|
||||||
} else if (visualize) {
|
} else if (visualize) {
|
||||||
|
await build(getBuildConfig({ minify: false, watch, core: false, entryName: 'parser' }));
|
||||||
await build(getBuildConfig({ minify: false, core: true, entryName: 'mermaid' }));
|
await build(getBuildConfig({ minify: false, core: true, entryName: 'mermaid' }));
|
||||||
await build(getBuildConfig({ minify: false, core: false, entryName: 'mermaid' }));
|
await build(getBuildConfig({ minify: false, core: false, entryName: 'mermaid' }));
|
||||||
} else {
|
} else {
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
import { transformJison } from './jisonTransformer.js';
|
import { transformJison } from '../.build/jisonTransformer.js';
|
||||||
|
|
||||||
const fileRegex = /\.(jison)$/;
|
const fileRegex = /\.(jison)$/;
|
||||||
|
|
||||||
export default function jison() {
|
export default function jison() {
|
||||||
return {
|
return {
|
||||||
name: 'jison',
|
name: 'jison',
|
||||||
|
|
||||||
transform(src: string, id: string) {
|
transform(src: string, id: string) {
|
||||||
if (fileRegex.test(id)) {
|
if (fileRegex.test(id)) {
|
||||||
return {
|
return {
|
||||||
|
28
.vite/jsonSchemaPlugin.ts
Normal file
28
.vite/jsonSchemaPlugin.ts
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import { PluginOption } from 'vite';
|
||||||
|
import { getDefaults, getSchema, loadSchema } from '../.build/jsonSchema.js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Vite plugin that handles JSON Schemas saved as a `.schema.yaml` file.
|
||||||
|
*
|
||||||
|
* Use `my-example.schema.yaml?only-defaults=true` to only load the default values.
|
||||||
|
*/
|
||||||
|
export default function jsonSchemaPlugin(): PluginOption {
|
||||||
|
return {
|
||||||
|
name: 'json-schema-plugin',
|
||||||
|
transform(src: string, id: string) {
|
||||||
|
const idAsUrl = new URL(id, 'file:///');
|
||||||
|
|
||||||
|
if (!idAsUrl.pathname.endsWith('schema.yaml')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const jsonSchema = loadSchema(src, idAsUrl.pathname);
|
||||||
|
return {
|
||||||
|
code: idAsUrl.searchParams.get('only-defaults')
|
||||||
|
? getDefaults(jsonSchema)
|
||||||
|
: getSchema(jsonSchema),
|
||||||
|
map: null, // no source map
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
|
}
|
@@ -14,6 +14,7 @@ async function createServer() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
app.use(cors());
|
app.use(cors());
|
||||||
|
app.use(express.static('./packages/parser/dist'));
|
||||||
app.use(express.static('./packages/mermaid/dist'));
|
app.use(express.static('./packages/mermaid/dist'));
|
||||||
app.use(express.static('./packages/mermaid-zenuml/dist'));
|
app.use(express.static('./packages/mermaid-zenuml/dist'));
|
||||||
app.use(express.static('./packages/mermaid-example-diagram/dist'));
|
app.use(express.static('./packages/mermaid-example-diagram/dist'));
|
||||||
|
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -17,7 +17,7 @@
|
|||||||
"name": "Docs generation",
|
"name": "Docs generation",
|
||||||
"type": "node",
|
"type": "node",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"args": ["src/docs.mts"],
|
"args": ["scripts/docs.cli.mts"],
|
||||||
"runtimeArgs": ["--loader", "ts-node/esm"],
|
"runtimeArgs": ["--loader", "ts-node/esm"],
|
||||||
"cwd": "${workspaceRoot}/packages/mermaid",
|
"cwd": "${workspaceRoot}/packages/mermaid",
|
||||||
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
|
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
|
||||||
|
16
CITATION.cff
Normal file
16
CITATION.cff
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
cff-version: 1.2.0
|
||||||
|
title: 'Mermaid: Generate diagrams from markdown-like text'
|
||||||
|
message: >-
|
||||||
|
If you use this software, please cite it using the metadata from this file.
|
||||||
|
type: software
|
||||||
|
authors:
|
||||||
|
- family-names: Sveidqvist
|
||||||
|
given-names: Knut
|
||||||
|
- name: 'Contributors to Mermaid'
|
||||||
|
repository-code: 'https://github.com/mermaid-js/mermaid'
|
||||||
|
date-released: 2014-12-02
|
||||||
|
url: 'https://mermaid.js.org/'
|
||||||
|
abstract: >-
|
||||||
|
JavaScript based diagramming and charting tool that renders Markdown-inspired
|
||||||
|
text definitions to create and modify diagrams dynamically.
|
||||||
|
license: MIT
|
@@ -26,9 +26,14 @@ Install required packages:
|
|||||||
```bash
|
```bash
|
||||||
# npx is required for first install as volta support for pnpm is not added yet.
|
# npx is required for first install as volta support for pnpm is not added yet.
|
||||||
npx pnpm install
|
npx pnpm install
|
||||||
pnpm test
|
pnpm test # run unit tests
|
||||||
|
pnpm dev # starts a dev server
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Open <http://localhost:9000> in your browser after starting the dev server.
|
||||||
|
You can also duplicate the `example.html` file in `demos/dev`, rename it and add your own mermaid code to it.
|
||||||
|
That will be served at <http://localhost:9000/dev/your-file-name.html>.
|
||||||
|
|
||||||
### Docker
|
### Docker
|
||||||
|
|
||||||
If you are using docker and docker-compose, you have self-documented `run` bash script, which is a convenient alias for docker-compose commands:
|
If you are using docker and docker-compose, you have self-documented `run` bash script, which is a convenient alias for docker-compose commands:
|
||||||
@@ -64,7 +69,7 @@ eg: `feature/2945_state-diagram-new-arrow-florbs`, `bug/1123_fix_random_ugly_red
|
|||||||
|
|
||||||
Documentation is necessary for all non bugfix/refactoring changes.
|
Documentation is necessary for all non bugfix/refactoring changes.
|
||||||
|
|
||||||
Only make changes to files are in [`/packages/mermaid/src/docs`](packages/mermaid/src/docs)
|
Only make changes to files that are in [`/packages/mermaid/src/docs`](packages/mermaid/src/docs)
|
||||||
|
|
||||||
**_DO NOT CHANGE FILES IN `/docs`_**
|
**_DO NOT CHANGE FILES IN `/docs`_**
|
||||||
|
|
||||||
|
10
README.md
10
README.md
@@ -27,7 +27,7 @@ Generate diagrams from markdown-like text.
|
|||||||
[](https://www.npmjs.com/package/mermaid)
|
[](https://www.npmjs.com/package/mermaid)
|
||||||
[](https://github.com/mermaid-js/mermaid/actions/workflows/build.yml)
|
[](https://github.com/mermaid-js/mermaid/actions/workflows/build.yml)
|
||||||
[](https://bundlephobia.com/package/mermaid)
|
[](https://bundlephobia.com/package/mermaid)
|
||||||
[](https://coveralls.io/github/mermaid-js/mermaid?branch=master)
|
[](https://app.codecov.io/github/mermaid-js/mermaid/tree/develop)
|
||||||
[](https://www.jsdelivr.com/package/npm/mermaid)
|
[](https://www.jsdelivr.com/package/npm/mermaid)
|
||||||
[](https://www.npmjs.com/package/mermaid)
|
[](https://www.npmjs.com/package/mermaid)
|
||||||
[](https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE)
|
[](https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE)
|
||||||
@@ -60,7 +60,7 @@ Use Mermaid with your favorite applications, check out the list of [Integrations
|
|||||||
|
|
||||||
You can also use Mermaid within [GitHub](https://github.blog/2022-02-14-include-diagrams-markdown-files-mermaid/) as well many of your other favorite applications—check out the list of [Integrations and Usages of Mermaid](./docs/ecosystem/integrations.md).
|
You can also use Mermaid within [GitHub](https://github.blog/2022-02-14-include-diagrams-markdown-files-mermaid/) as well many of your other favorite applications—check out the list of [Integrations and Usages of Mermaid](./docs/ecosystem/integrations.md).
|
||||||
|
|
||||||
For a more detailed introduction to Mermaid and some of its more basic uses, look to the [Beginner's Guide](./docs/community/n00b-overview.md), [Usage](./docs/config/usage.md) and [Tutorials](./docs/config/Tutorials.md).
|
For a more detailed introduction to Mermaid and some of its more basic uses, look to the [Beginner's Guide](./docs/intro/getting-started.md), [Usage](./docs/config/usage.md) and [Tutorials](./docs/config/Tutorials.md).
|
||||||
|
|
||||||
In our release process we rely heavily on visual regression tests using [applitools](https://applitools.com/). Applitools is a great service which has been easy to use and integrate with our tests.
|
In our release process we rely heavily on visual regression tests using [applitools](https://applitools.com/). Applitools is a great service which has been easy to use and integrate with our tests.
|
||||||
|
|
||||||
@@ -386,7 +386,7 @@ Update version number in `package.json`.
|
|||||||
npm publish
|
npm publish
|
||||||
```
|
```
|
||||||
|
|
||||||
The above command generates files into the `dist` folder and publishes them to npmjs.org.
|
The above command generates files into the `dist` folder and publishes them to <https://www.npmjs.com>.
|
||||||
|
|
||||||
## Related projects
|
## Related projects
|
||||||
|
|
||||||
@@ -402,7 +402,7 @@ Detailed information about how to contribute can be found in the [contribution g
|
|||||||
|
|
||||||
## Security and safe diagrams
|
## Security and safe diagrams
|
||||||
|
|
||||||
For public sites, it can be precarious to retrieve text from users on the internet, storing that content for presentation in a browser at a later stage. The reason is that the user content can contain embedded malicious scripts that will run when the data is presented. For Mermaid this is a risk, specially as mermaid diagrams contain many characters that are used in html which makes the standard sanitation unusable as it also breaks the diagrams. We still make an effort to sanitise the incoming code and keep refining the process but it is hard to guarantee that there are no loop holes.
|
For public sites, it can be precarious to retrieve text from users on the internet, storing that content for presentation in a browser at a later stage. The reason is that the user content can contain embedded malicious scripts that will run when the data is presented. For Mermaid this is a risk, specially as mermaid diagrams contain many characters that are used in html which makes the standard sanitation unusable as it also breaks the diagrams. We still make an effort to sanitize the incoming code and keep refining the process but it is hard to guarantee that there are no loop holes.
|
||||||
|
|
||||||
As an extra level of security for sites with external users we are happy to introduce a new security level in which the diagram is rendered in a sandboxed iframe preventing javascript in the code from being executed. This is a great step forward for better security.
|
As an extra level of security for sites with external users we are happy to introduce a new security level in which the diagram is rendered in a sandboxed iframe preventing javascript in the code from being executed. This is a great step forward for better security.
|
||||||
|
|
||||||
@@ -410,7 +410,7 @@ _Unfortunately you can not have a cake and eat it at the same time which in this
|
|||||||
|
|
||||||
## Reporting vulnerabilities
|
## Reporting vulnerabilities
|
||||||
|
|
||||||
To report a vulnerability, please e-mail security@mermaid.live with a description of the issue, the steps you took to create the issue, affected versions, and if known, mitigations for the issue.
|
To report a vulnerability, please e-mail <security@mermaid.live> with a description of the issue, the steps you took to create the issue, affected versions, and if known, mitigations for the issue.
|
||||||
|
|
||||||
## Appreciation
|
## Appreciation
|
||||||
|
|
||||||
|
@@ -27,7 +27,7 @@ Mermaid
|
|||||||
[](https://www.npmjs.com/package/mermaid)
|
[](https://www.npmjs.com/package/mermaid)
|
||||||
[](https://github.com/mermaid-js/mermaid/actions/workflows/build.yml)
|
[](https://github.com/mermaid-js/mermaid/actions/workflows/build.yml)
|
||||||
[](https://bundlephobia.com/package/mermaid)
|
[](https://bundlephobia.com/package/mermaid)
|
||||||
[](https://coveralls.io/github/mermaid-js/mermaid?branch=master)
|
[](https://app.codecov.io/github/mermaid-js/mermaid/tree/develop)
|
||||||
[](https://www.jsdelivr.com/package/npm/mermaid)
|
[](https://www.jsdelivr.com/package/npm/mermaid)
|
||||||
[](https://www.npmjs.com/package/mermaid)
|
[](https://www.npmjs.com/package/mermaid)
|
||||||
[](https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE)
|
[](https://join.slack.com/t/mermaid-talk/shared_invite/enQtNzc4NDIyNzk4OTAyLWVhYjQxOTI2OTg4YmE1ZmJkY2Y4MTU3ODliYmIwOTY3NDJlYjA0YjIyZTdkMDMyZTUwOGI0NjEzYmEwODcwOTE)
|
||||||
@@ -55,7 +55,7 @@ Mermaid 通过允许用户创建便于修改的图表来解决这一难题,它
|
|||||||
Mermaid 甚至能让非程序员也能通过 [Mermaid Live Editor](https://mermaid.live/) 轻松创建详细的图表。<br/>
|
Mermaid 甚至能让非程序员也能通过 [Mermaid Live Editor](https://mermaid.live/) 轻松创建详细的图表。<br/>
|
||||||
你可以访问 [教程](./docs/config/Tutorials.md) 来查看 Live Editor 的视频教程,也可以查看 [Mermaid 的集成和使用](./docs/ecosystem/integrations.md) 这个清单来检查你的文档工具是否已经集成了 Mermaid 支持。
|
你可以访问 [教程](./docs/config/Tutorials.md) 来查看 Live Editor 的视频教程,也可以查看 [Mermaid 的集成和使用](./docs/ecosystem/integrations.md) 这个清单来检查你的文档工具是否已经集成了 Mermaid 支持。
|
||||||
|
|
||||||
如果想要查看关于 Mermaid 更详细的介绍及基础使用方式,可以查看 [入门指引](./docs/community/n00b-overview.md), [用法](./docs/config/usage.md) 和 [教程](./docs/config/Tutorials.md).
|
如果想要查看关于 Mermaid 更详细的介绍及基础使用方式,可以查看 [入门指引](./docs/intro/getting-started.md), [用法](./docs/config/usage.md) 和 [教程](./docs/config/Tutorials.md).
|
||||||
|
|
||||||
<!-- </Main description> -->
|
<!-- </Main description> -->
|
||||||
|
|
||||||
@@ -322,7 +322,7 @@ Rel(SystemC, customerA, "Sends e-mails to")
|
|||||||
npm publish
|
npm publish
|
||||||
```
|
```
|
||||||
|
|
||||||
以上的命令会将文件打包到 `dist` 目录并发布至 npmjs.org.
|
以上的命令会将文件打包到 `dist` 目录并发布至 <https://www.npmjs.com>.
|
||||||
|
|
||||||
## 相关项目
|
## 相关项目
|
||||||
|
|
||||||
|
8
__mocks__/pieRenderer.ts
Normal file
8
__mocks__/pieRenderer.ts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* Mocked pie (picChart) diagram renderer
|
||||||
|
*/
|
||||||
|
import { vi } from 'vitest';
|
||||||
|
|
||||||
|
const draw = vi.fn().mockImplementation(() => '');
|
||||||
|
|
||||||
|
export const renderer = { draw };
|
@@ -1,5 +1,5 @@
|
|||||||
/**
|
/**
|
||||||
* Mocked pie (picChart) diagram renderer
|
* Mocked Sankey diagram renderer
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { vi } from 'vitest';
|
import { vi } from 'vitest';
|
22
cSpell.json
22
cSpell.json
@@ -40,8 +40,11 @@
|
|||||||
"dompurify",
|
"dompurify",
|
||||||
"edgechromium",
|
"edgechromium",
|
||||||
"elkjs",
|
"elkjs",
|
||||||
|
"elle",
|
||||||
"faber",
|
"faber",
|
||||||
"flatmap",
|
"flatmap",
|
||||||
|
"foswiki",
|
||||||
|
"frontmatter",
|
||||||
"ftplugin",
|
"ftplugin",
|
||||||
"gantt",
|
"gantt",
|
||||||
"gitea",
|
"gitea",
|
||||||
@@ -51,8 +54,10 @@
|
|||||||
"graphviz",
|
"graphviz",
|
||||||
"grav",
|
"grav",
|
||||||
"greywolf",
|
"greywolf",
|
||||||
|
"gzipped",
|
||||||
"huynh",
|
"huynh",
|
||||||
"huynhicode",
|
"huynhicode",
|
||||||
|
"iife",
|
||||||
"inkdrop",
|
"inkdrop",
|
||||||
"jaoude",
|
"jaoude",
|
||||||
"jgreywolf",
|
"jgreywolf",
|
||||||
@@ -66,6 +71,7 @@
|
|||||||
"knut",
|
"knut",
|
||||||
"knutsveidqvist",
|
"knutsveidqvist",
|
||||||
"laganeckas",
|
"laganeckas",
|
||||||
|
"langium",
|
||||||
"linetype",
|
"linetype",
|
||||||
"lintstagedrc",
|
"lintstagedrc",
|
||||||
"logmsg",
|
"logmsg",
|
||||||
@@ -77,6 +83,7 @@
|
|||||||
"mdbook",
|
"mdbook",
|
||||||
"mermaidjs",
|
"mermaidjs",
|
||||||
"mermerd",
|
"mermerd",
|
||||||
|
"metafile",
|
||||||
"mindaugas",
|
"mindaugas",
|
||||||
"mindmap",
|
"mindmap",
|
||||||
"mindmaps",
|
"mindmaps",
|
||||||
@@ -84,8 +91,13 @@
|
|||||||
"mkdocs",
|
"mkdocs",
|
||||||
"mmorel",
|
"mmorel",
|
||||||
"mult",
|
"mult",
|
||||||
|
"neurodiverse",
|
||||||
"nextra",
|
"nextra",
|
||||||
|
"nikolay",
|
||||||
|
"nirname",
|
||||||
|
"npmjs",
|
||||||
"orlandoni",
|
"orlandoni",
|
||||||
|
"outdir",
|
||||||
"pathe",
|
"pathe",
|
||||||
"pbrolin",
|
"pbrolin",
|
||||||
"phpbb",
|
"phpbb",
|
||||||
@@ -98,10 +110,14 @@
|
|||||||
"ranksep",
|
"ranksep",
|
||||||
"rect",
|
"rect",
|
||||||
"rects",
|
"rects",
|
||||||
|
"reda",
|
||||||
"redmine",
|
"redmine",
|
||||||
|
"regexes",
|
||||||
"rehype",
|
"rehype",
|
||||||
"roledescription",
|
"roledescription",
|
||||||
|
"rozhkov",
|
||||||
"sandboxed",
|
"sandboxed",
|
||||||
|
"sankey",
|
||||||
"setupgraphviewbox",
|
"setupgraphviewbox",
|
||||||
"shiki",
|
"shiki",
|
||||||
"sidharth",
|
"sidharth",
|
||||||
@@ -116,6 +132,7 @@
|
|||||||
"stylis",
|
"stylis",
|
||||||
"subhash-halder",
|
"subhash-halder",
|
||||||
"substate",
|
"substate",
|
||||||
|
"sulais",
|
||||||
"sveidqvist",
|
"sveidqvist",
|
||||||
"swimm",
|
"swimm",
|
||||||
"techn",
|
"techn",
|
||||||
@@ -126,6 +143,7 @@
|
|||||||
"tsdoc",
|
"tsdoc",
|
||||||
"tuleap",
|
"tuleap",
|
||||||
"tylerlong",
|
"tylerlong",
|
||||||
|
"typora",
|
||||||
"ugge",
|
"ugge",
|
||||||
"unist",
|
"unist",
|
||||||
"unocss",
|
"unocss",
|
||||||
@@ -139,7 +157,9 @@
|
|||||||
"vueuse",
|
"vueuse",
|
||||||
"xlink",
|
"xlink",
|
||||||
"yash",
|
"yash",
|
||||||
"zenuml"
|
"yokozuna",
|
||||||
|
"zenuml",
|
||||||
|
"zune"
|
||||||
],
|
],
|
||||||
"patterns": [
|
"patterns": [
|
||||||
{ "name": "Markdown links", "pattern": "\\((.*)\\)", "description": "" },
|
{ "name": "Markdown links", "pattern": "\\((.*)\\)", "description": "" },
|
||||||
|
@@ -2,12 +2,14 @@
|
|||||||
|
|
||||||
const { defineConfig } = require('cypress');
|
const { defineConfig } = require('cypress');
|
||||||
const { addMatchImageSnapshotPlugin } = require('cypress-image-snapshot/plugin');
|
const { addMatchImageSnapshotPlugin } = require('cypress-image-snapshot/plugin');
|
||||||
|
const coverage = require('@cypress/code-coverage/task');
|
||||||
|
|
||||||
module.exports = defineConfig({
|
module.exports = defineConfig({
|
||||||
projectId: 'n2sma2',
|
projectId: 'n2sma2',
|
||||||
e2e: {
|
e2e: {
|
||||||
specPattern: 'cypress/integration/**/*.{js,jsx,ts,tsx}',
|
specPattern: 'cypress/integration/**/*.{js,jsx,ts,tsx}',
|
||||||
setupNodeEvents(on, config) {
|
setupNodeEvents(on, config) {
|
||||||
|
coverage(on, config);
|
||||||
addMatchImageSnapshotPlugin(on, config);
|
addMatchImageSnapshotPlugin(on, config);
|
||||||
// copy any needed variables from process.env to config.env
|
// copy any needed variables from process.env to config.env
|
||||||
config.env.useAppli = process.env.USE_APPLI ? true : false;
|
config.env.useAppli = process.env.USE_APPLI ? true : false;
|
||||||
|
@@ -1,93 +0,0 @@
|
|||||||
const utf8ToB64 = (str) => {
|
|
||||||
return window.btoa(unescape(encodeURIComponent(str)));
|
|
||||||
};
|
|
||||||
|
|
||||||
const batchId = 'mermaid-batch' + new Date().getTime();
|
|
||||||
|
|
||||||
export const mermaidUrl = (graphStr, options, api) => {
|
|
||||||
const obj = {
|
|
||||||
code: graphStr,
|
|
||||||
mermaid: options,
|
|
||||||
};
|
|
||||||
const objStr = JSON.stringify(obj);
|
|
||||||
let url = 'http://localhost:9000/e2e.html?graph=' + utf8ToB64(objStr);
|
|
||||||
if (api) {
|
|
||||||
url = 'http://localhost:9000/xss.html?graph=' + graphStr;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.listUrl) {
|
|
||||||
cy.log(options.listId, ' ', url);
|
|
||||||
}
|
|
||||||
|
|
||||||
return url;
|
|
||||||
};
|
|
||||||
|
|
||||||
export const imgSnapshotTest = (graphStr, _options = {}, api = false, validation = undefined) => {
|
|
||||||
cy.log(_options);
|
|
||||||
const options = Object.assign(_options);
|
|
||||||
if (!options.fontFamily) {
|
|
||||||
options.fontFamily = 'courier';
|
|
||||||
}
|
|
||||||
if (!options.sequence) {
|
|
||||||
options.sequence = {};
|
|
||||||
}
|
|
||||||
if (!options.sequence || (options.sequence && !options.sequence.actorFontFamily)) {
|
|
||||||
options.sequence.actorFontFamily = 'courier';
|
|
||||||
}
|
|
||||||
if (options.sequence && !options.sequence.noteFontFamily) {
|
|
||||||
options.sequence.noteFontFamily = 'courier';
|
|
||||||
}
|
|
||||||
options.sequence.actorFontFamily = 'courier';
|
|
||||||
options.sequence.noteFontFamily = 'courier';
|
|
||||||
options.sequence.messageFontFamily = 'courier';
|
|
||||||
if (options.sequence && !options.sequence.actorFontFamily) {
|
|
||||||
options.sequence.actorFontFamily = 'courier';
|
|
||||||
}
|
|
||||||
if (!options.fontSize) {
|
|
||||||
options.fontSize = '16px';
|
|
||||||
}
|
|
||||||
const url = mermaidUrl(graphStr, options, api);
|
|
||||||
openURLAndVerifyRendering(url, options, validation);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const urlSnapshotTest = (url, _options, api = false, validation) => {
|
|
||||||
const options = Object.assign(_options);
|
|
||||||
openURLAndVerifyRendering(url, options, validation);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const renderGraph = (graphStr, options, api) => {
|
|
||||||
const url = mermaidUrl(graphStr, options, api);
|
|
||||||
openURLAndVerifyRendering(url, options);
|
|
||||||
};
|
|
||||||
|
|
||||||
export const openURLAndVerifyRendering = (url, options, validation = undefined) => {
|
|
||||||
const useAppli = Cypress.env('useAppli');
|
|
||||||
const name = (options.name || cy.state('runnable').fullTitle()).replace(/\s+/g, '-');
|
|
||||||
|
|
||||||
if (useAppli) {
|
|
||||||
cy.log('Opening eyes ' + Cypress.spec.name + ' --- ' + name);
|
|
||||||
cy.eyesOpen({
|
|
||||||
appName: 'Mermaid',
|
|
||||||
testName: name,
|
|
||||||
batchName: Cypress.spec.name,
|
|
||||||
batchId: batchId + Cypress.spec.name,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
cy.visit(url);
|
|
||||||
cy.window().should('have.property', 'rendered', true);
|
|
||||||
cy.get('svg').should('be.visible');
|
|
||||||
|
|
||||||
if (validation) {
|
|
||||||
cy.get('svg').should(validation);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (useAppli) {
|
|
||||||
cy.log('Check eyes' + Cypress.spec.name);
|
|
||||||
cy.eyesCheckWindow('Click!');
|
|
||||||
cy.log('Closing eyes' + Cypress.spec.name);
|
|
||||||
cy.eyesClose();
|
|
||||||
} else {
|
|
||||||
cy.matchImageSnapshot(name);
|
|
||||||
}
|
|
||||||
};
|
|
136
cypress/helpers/util.ts
Normal file
136
cypress/helpers/util.ts
Normal file
@@ -0,0 +1,136 @@
|
|||||||
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||||
|
import { Buffer } from 'buffer';
|
||||||
|
import type { MermaidConfig } from '../../packages/mermaid/src/config.type.js';
|
||||||
|
|
||||||
|
interface CypressConfig {
|
||||||
|
listUrl?: boolean;
|
||||||
|
listId?: string;
|
||||||
|
name?: string;
|
||||||
|
}
|
||||||
|
type CypressMermaidConfig = MermaidConfig & CypressConfig;
|
||||||
|
|
||||||
|
interface CodeObject {
|
||||||
|
code: string;
|
||||||
|
mermaid: CypressMermaidConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
const utf8ToB64 = (str: string): string => {
|
||||||
|
return Buffer.from(decodeURIComponent(encodeURIComponent(str))).toString('base64');
|
||||||
|
};
|
||||||
|
|
||||||
|
const batchId: string =
|
||||||
|
'mermaid-batch-' +
|
||||||
|
(Cypress.env('useAppli')
|
||||||
|
? Date.now().toString()
|
||||||
|
: Cypress.env('CYPRESS_COMMIT') || Date.now().toString());
|
||||||
|
|
||||||
|
export const mermaidUrl = (
|
||||||
|
graphStr: string,
|
||||||
|
options: CypressMermaidConfig,
|
||||||
|
api: boolean
|
||||||
|
): string => {
|
||||||
|
const codeObject: CodeObject = {
|
||||||
|
code: graphStr,
|
||||||
|
mermaid: options,
|
||||||
|
};
|
||||||
|
const objStr: string = JSON.stringify(codeObject);
|
||||||
|
let url = `http://localhost:9000/e2e.html?graph=${utf8ToB64(objStr)}`;
|
||||||
|
if (api) {
|
||||||
|
url = `http://localhost:9000/xss.html?graph=${graphStr}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (options.listUrl) {
|
||||||
|
cy.log(options.listId, ' ', url);
|
||||||
|
}
|
||||||
|
|
||||||
|
return url;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const imgSnapshotTest = (
|
||||||
|
graphStr: string,
|
||||||
|
_options: CypressMermaidConfig = {},
|
||||||
|
api = false,
|
||||||
|
validation?: any
|
||||||
|
): void => {
|
||||||
|
cy.log(JSON.stringify(_options));
|
||||||
|
const options: CypressMermaidConfig = Object.assign(_options);
|
||||||
|
if (!options.fontFamily) {
|
||||||
|
options.fontFamily = 'courier';
|
||||||
|
}
|
||||||
|
if (!options.sequence) {
|
||||||
|
options.sequence = {};
|
||||||
|
}
|
||||||
|
if (!options.sequence || (options.sequence && !options.sequence.actorFontFamily)) {
|
||||||
|
options.sequence.actorFontFamily = 'courier';
|
||||||
|
}
|
||||||
|
if (options.sequence && !options.sequence.noteFontFamily) {
|
||||||
|
options.sequence.noteFontFamily = 'courier';
|
||||||
|
}
|
||||||
|
options.sequence.actorFontFamily = 'courier';
|
||||||
|
options.sequence.noteFontFamily = 'courier';
|
||||||
|
options.sequence.messageFontFamily = 'courier';
|
||||||
|
if (options.sequence && !options.sequence.actorFontFamily) {
|
||||||
|
options.sequence.actorFontFamily = 'courier';
|
||||||
|
}
|
||||||
|
if (!options.fontSize) {
|
||||||
|
options.fontSize = 16;
|
||||||
|
}
|
||||||
|
|
||||||
|
const url: string = mermaidUrl(graphStr, options, api);
|
||||||
|
openURLAndVerifyRendering(url, options, validation);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const urlSnapshotTest = (
|
||||||
|
url: string,
|
||||||
|
_options: CypressMermaidConfig,
|
||||||
|
_api = false,
|
||||||
|
validation?: any
|
||||||
|
): void => {
|
||||||
|
const options: CypressMermaidConfig = Object.assign(_options);
|
||||||
|
openURLAndVerifyRendering(url, options, validation);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const renderGraph = (
|
||||||
|
graphStr: string,
|
||||||
|
options: CypressMermaidConfig = {},
|
||||||
|
api = false
|
||||||
|
): void => {
|
||||||
|
const url: string = mermaidUrl(graphStr, options, api);
|
||||||
|
openURLAndVerifyRendering(url, options);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const openURLAndVerifyRendering = (
|
||||||
|
url: string,
|
||||||
|
options: CypressMermaidConfig,
|
||||||
|
validation?: any
|
||||||
|
): void => {
|
||||||
|
const useAppli: boolean = Cypress.env('useAppli');
|
||||||
|
const name: string = (options.name || cy.state('runnable').fullTitle()).replace(/\s+/g, '-');
|
||||||
|
|
||||||
|
if (useAppli) {
|
||||||
|
cy.log(`Opening eyes ${Cypress.spec.name} --- ${name}`);
|
||||||
|
cy.eyesOpen({
|
||||||
|
appName: 'Mermaid',
|
||||||
|
testName: name,
|
||||||
|
batchName: Cypress.spec.name,
|
||||||
|
batchId: batchId + Cypress.spec.name,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
cy.visit(url);
|
||||||
|
cy.window().should('have.property', 'rendered', true);
|
||||||
|
cy.get('svg').should('be.visible');
|
||||||
|
|
||||||
|
if (validation) {
|
||||||
|
cy.get('svg').should(validation);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (useAppli) {
|
||||||
|
cy.log(`Check eyes ${Cypress.spec.name}`);
|
||||||
|
cy.eyesCheckWindow('Click!');
|
||||||
|
cy.log(`Closing eyes ${Cypress.spec.name}`);
|
||||||
|
cy.eyesClose();
|
||||||
|
} else {
|
||||||
|
cy.matchImageSnapshot(name);
|
||||||
|
}
|
||||||
|
};
|
@@ -1,4 +1,4 @@
|
|||||||
import { renderGraph } from '../../helpers/util.js';
|
import { renderGraph } from '../../helpers/util.ts';
|
||||||
describe('Configuration', () => {
|
describe('Configuration', () => {
|
||||||
describe('arrowMarkerAbsolute', () => {
|
describe('arrowMarkerAbsolute', () => {
|
||||||
it('should handle default value false of arrowMarkerAbsolute', () => {
|
it('should handle default value false of arrowMarkerAbsolute', () => {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { urlSnapshotTest } from '../../helpers/util.js';
|
import { urlSnapshotTest } from '../../helpers/util.ts';
|
||||||
|
|
||||||
describe('mermaid', () => {
|
describe('mermaid', () => {
|
||||||
describe('registerDiagram', () => {
|
describe('registerDiagram', () => {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { urlSnapshotTest, openURLAndVerifyRendering } from '../../helpers/util.js';
|
import { urlSnapshotTest, openURLAndVerifyRendering } from '../../helpers/util.ts';
|
||||||
|
|
||||||
describe('CSS injections', () => {
|
describe('CSS injections', () => {
|
||||||
it('should not allow CSS injections outside of the diagram', () => {
|
it('should not allow CSS injections outside of the diagram', () => {
|
||||||
|
11
cypress/integration/other/iife.spec.js
Normal file
11
cypress/integration/other/iife.spec.js
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
describe('IIFE', () => {
|
||||||
|
beforeEach(() => {
|
||||||
|
cy.visit('http://localhost:9000/iife.html');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should render when using mermaid.min.js', () => {
|
||||||
|
cy.window().should('have.property', 'rendered', true);
|
||||||
|
cy.get('svg').should('be.visible');
|
||||||
|
cy.get('#d2').should('contain', 'Hello');
|
||||||
|
});
|
||||||
|
});
|
@@ -1,16 +0,0 @@
|
|||||||
describe('Sequencediagram', () => {
|
|
||||||
it('should render a simple sequence diagrams', () => {
|
|
||||||
const url = 'http://localhost:9000/webpackUsage.html';
|
|
||||||
|
|
||||||
cy.visit(url);
|
|
||||||
cy.get('body').find('svg').should('have.length', 1);
|
|
||||||
});
|
|
||||||
it('should handle html escapings properly', () => {
|
|
||||||
const url = 'http://localhost:9000/webpackUsage.html?test-html-escaping=true';
|
|
||||||
|
|
||||||
cy.visit(url);
|
|
||||||
cy.get('body').find('svg').should('have.length', 1);
|
|
||||||
|
|
||||||
cy.get('g.label > foreignobject > div').should('not.contain.text', '<b>');
|
|
||||||
});
|
|
||||||
});
|
|
@@ -1,4 +1,4 @@
|
|||||||
import { mermaidUrl } from '../../helpers/util.js';
|
import { mermaidUrl } from '../../helpers/util.ts';
|
||||||
describe('XSS', () => {
|
describe('XSS', () => {
|
||||||
it('should handle xss in tags', () => {
|
it('should handle xss in tags', () => {
|
||||||
const str =
|
const str =
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest } from '../../helpers/util.js';
|
import { imgSnapshotTest } from '../../helpers/util.ts';
|
||||||
|
|
||||||
describe('Git Graph diagram', () => {
|
describe('Git Graph diagram', () => {
|
||||||
it('1: should render a simple gitgraph with commit on main branch', () => {
|
it('1: should render a simple gitgraph with commit on main branch', () => {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
||||||
|
|
||||||
describe('C4 diagram', () => {
|
describe('C4 diagram', () => {
|
||||||
it('should render a simple C4Context diagram', () => {
|
it('should render a simple C4Context diagram', () => {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest } from '../../helpers/util.js';
|
import { imgSnapshotTest } from '../../helpers/util.ts';
|
||||||
describe('Class diagram V2', () => {
|
describe('Class diagram V2', () => {
|
||||||
it('0: should render a simple class diagram', () => {
|
it('0: should render a simple class diagram', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
||||||
|
|
||||||
describe('Class diagram', () => {
|
describe('Class diagram', () => {
|
||||||
it('1: should render a simple class diagram', () => {
|
it('1: should render a simple class diagram', () => {
|
||||||
@@ -423,4 +423,82 @@ describe('Class diagram', () => {
|
|||||||
);
|
);
|
||||||
cy.get('svg');
|
cy.get('svg');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should render class diagram with newlines in title', () => {
|
||||||
|
imgSnapshotTest(`
|
||||||
|
classDiagram
|
||||||
|
Animal <|-- \`Du\nck\`
|
||||||
|
Animal : +int age
|
||||||
|
Animal : +String gender
|
||||||
|
Animal: +isMammal()
|
||||||
|
Animal: +mate()
|
||||||
|
class \`Du\nck\` {
|
||||||
|
+String beakColor
|
||||||
|
+String featherColor
|
||||||
|
+swim()
|
||||||
|
+quack()
|
||||||
|
}
|
||||||
|
`);
|
||||||
|
cy.get('svg');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should render class diagram with many newlines in title', () => {
|
||||||
|
imgSnapshotTest(`
|
||||||
|
classDiagram
|
||||||
|
class \`This\nTitle\nHas\nMany\nNewlines\` {
|
||||||
|
+String Also
|
||||||
|
-Stirng Many
|
||||||
|
#int Members
|
||||||
|
+And()
|
||||||
|
-Many()
|
||||||
|
#Methods()
|
||||||
|
}
|
||||||
|
`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should render with newlines in title and an annotation', () => {
|
||||||
|
imgSnapshotTest(`
|
||||||
|
classDiagram
|
||||||
|
class \`This\nTitle\nHas\nMany\nNewlines\` {
|
||||||
|
+String Also
|
||||||
|
-Stirng Many
|
||||||
|
#int Members
|
||||||
|
+And()
|
||||||
|
-Many()
|
||||||
|
#Methods()
|
||||||
|
}
|
||||||
|
<<Interface>> \`This\nTitle\nHas\nMany\nNewlines\`
|
||||||
|
`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle newline title in namespace', () => {
|
||||||
|
imgSnapshotTest(`
|
||||||
|
classDiagram
|
||||||
|
namespace testingNamespace {
|
||||||
|
class \`This\nTitle\nHas\nMany\nNewlines\` {
|
||||||
|
+String Also
|
||||||
|
-Stirng Many
|
||||||
|
#int Members
|
||||||
|
+And()
|
||||||
|
-Many()
|
||||||
|
#Methods()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
`);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should handle newline in string label', () => {
|
||||||
|
imgSnapshotTest(`
|
||||||
|
classDiagram
|
||||||
|
class A["This has\na newline!"] {
|
||||||
|
+String boop
|
||||||
|
-Int beep
|
||||||
|
#double bop
|
||||||
|
}
|
||||||
|
|
||||||
|
class B["This title also has\na newline"]
|
||||||
|
B : +with(more)
|
||||||
|
B : -methods()
|
||||||
|
`);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest } from '../../helpers/util.js';
|
import { imgSnapshotTest } from '../../helpers/util.ts';
|
||||||
|
|
||||||
describe('Configuration and directives - nodes should be light blue', () => {
|
describe('Configuration and directives - nodes should be light blue', () => {
|
||||||
it('No config - use default', () => {
|
it('No config - use default', () => {
|
||||||
@@ -14,7 +14,6 @@ describe('Configuration and directives - nodes should be light blue', () => {
|
|||||||
`,
|
`,
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
cy.get('svg');
|
|
||||||
});
|
});
|
||||||
it('Settings from initialize - nodes should be green', () => {
|
it('Settings from initialize - nodes should be green', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
@@ -28,7 +27,6 @@ graph TD
|
|||||||
end `,
|
end `,
|
||||||
{ theme: 'forest' }
|
{ theme: 'forest' }
|
||||||
);
|
);
|
||||||
cy.get('svg');
|
|
||||||
});
|
});
|
||||||
it('Settings from initialize overriding themeVariable - nodes should be red', () => {
|
it('Settings from initialize overriding themeVariable - nodes should be red', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
@@ -46,7 +44,6 @@ graph TD
|
|||||||
`,
|
`,
|
||||||
{ theme: 'base', themeVariables: { primaryColor: '#ff0000' }, logLevel: 0 }
|
{ theme: 'base', themeVariables: { primaryColor: '#ff0000' }, logLevel: 0 }
|
||||||
);
|
);
|
||||||
cy.get('svg');
|
|
||||||
});
|
});
|
||||||
it('Settings from directive - nodes should be grey', () => {
|
it('Settings from directive - nodes should be grey', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
@@ -62,7 +59,24 @@ graph TD
|
|||||||
`,
|
`,
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
cy.get('svg');
|
});
|
||||||
|
it('Settings from frontmatter - nodes should be grey', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
---
|
||||||
|
config:
|
||||||
|
theme: neutral
|
||||||
|
---
|
||||||
|
graph TD
|
||||||
|
A(Start) --> B[/Another/]
|
||||||
|
A[/Another/] --> C[End]
|
||||||
|
subgraph section
|
||||||
|
B
|
||||||
|
C
|
||||||
|
end
|
||||||
|
`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Settings from directive overriding theme variable - nodes should be red', () => {
|
it('Settings from directive overriding theme variable - nodes should be red', () => {
|
||||||
@@ -79,7 +93,6 @@ graph TD
|
|||||||
`,
|
`,
|
||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
cy.get('svg');
|
|
||||||
});
|
});
|
||||||
it('Settings from initialize and directive - nodes should be grey', () => {
|
it('Settings from initialize and directive - nodes should be grey', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
@@ -95,7 +108,6 @@ graph TD
|
|||||||
`,
|
`,
|
||||||
{ theme: 'forest' }
|
{ theme: 'forest' }
|
||||||
);
|
);
|
||||||
cy.get('svg');
|
|
||||||
});
|
});
|
||||||
it('Theme from initialize, directive overriding theme variable - nodes should be red', () => {
|
it('Theme from initialize, directive overriding theme variable - nodes should be red', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
@@ -111,8 +123,71 @@ graph TD
|
|||||||
`,
|
`,
|
||||||
{ theme: 'base' }
|
{ theme: 'base' }
|
||||||
);
|
);
|
||||||
cy.get('svg');
|
|
||||||
});
|
});
|
||||||
|
it('Theme from initialize, frontmatter overriding theme variable - nodes should be red', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
---
|
||||||
|
config:
|
||||||
|
theme: base
|
||||||
|
themeVariables:
|
||||||
|
primaryColor: '#ff0000'
|
||||||
|
---
|
||||||
|
graph TD
|
||||||
|
A(Start) --> B[/Another/]
|
||||||
|
A[/Another/] --> C[End]
|
||||||
|
subgraph section
|
||||||
|
B
|
||||||
|
C
|
||||||
|
end
|
||||||
|
`,
|
||||||
|
{ theme: 'forest' }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('Theme from initialize, frontmatter overriding theme variable, directive overriding primaryColor - nodes should be red', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
---
|
||||||
|
config:
|
||||||
|
theme: base
|
||||||
|
themeVariables:
|
||||||
|
primaryColor: '#00ff00'
|
||||||
|
---
|
||||||
|
%%{init: {'theme': 'base', 'themeVariables':{ 'primaryColor': '#ff0000'}}}%%
|
||||||
|
graph TD
|
||||||
|
A(Start) --> B[/Another/]
|
||||||
|
A[/Another/] --> C[End]
|
||||||
|
subgraph section
|
||||||
|
B
|
||||||
|
C
|
||||||
|
end
|
||||||
|
`,
|
||||||
|
{ theme: 'forest' }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should render if values are not quoted properly', () => {
|
||||||
|
// #ff0000 is not quoted properly, and will evaluate to null.
|
||||||
|
// This test ensures that the rendering still works.
|
||||||
|
imgSnapshotTest(
|
||||||
|
`---
|
||||||
|
config:
|
||||||
|
theme: base
|
||||||
|
themeVariables:
|
||||||
|
primaryColor: #ff0000
|
||||||
|
---
|
||||||
|
graph TD
|
||||||
|
A(Start) --> B[/Another/]
|
||||||
|
A[/Another/] --> C[End]
|
||||||
|
subgraph section
|
||||||
|
B
|
||||||
|
C
|
||||||
|
end
|
||||||
|
`,
|
||||||
|
{ theme: 'forest' }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('Theme variable from initialize, theme from directive - nodes should be red', () => {
|
it('Theme variable from initialize, theme from directive - nodes should be red', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
@@ -127,13 +202,11 @@ graph TD
|
|||||||
`,
|
`,
|
||||||
{ themeVariables: { primaryColor: '#ff0000' } }
|
{ themeVariables: { primaryColor: '#ff0000' } }
|
||||||
);
|
);
|
||||||
cy.get('svg');
|
|
||||||
});
|
});
|
||||||
describe('when rendering several diagrams', () => {
|
describe('when rendering several diagrams', () => {
|
||||||
it('diagrams should not taint later diagrams', () => {
|
it('diagrams should not taint later diagrams', () => {
|
||||||
const url = 'http://localhost:9000/theme-directives.html';
|
const url = 'http://localhost:9000/theme-directives.html';
|
||||||
cy.visit(url);
|
cy.visit(url);
|
||||||
cy.get('svg');
|
|
||||||
cy.matchImageSnapshot('conf-and-directives.spec-when-rendering-several-diagrams-diagram-1');
|
cy.matchImageSnapshot('conf-and-directives.spec-when-rendering-several-diagrams-diagram-1');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest } from '../../helpers/util.js';
|
import { imgSnapshotTest } from '../../helpers/util.ts';
|
||||||
|
|
||||||
describe('Current diagram', () => {
|
describe('Current diagram', () => {
|
||||||
it('should render a state with states in it', () => {
|
it('should render a state with states in it', () => {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest } from '../../helpers/util.js';
|
import { imgSnapshotTest } from '../../helpers/util.ts';
|
||||||
|
|
||||||
describe('Flowchart', () => {
|
describe('Flowchart', () => {
|
||||||
it('34: testing the label width in percy', () => {
|
it('34: testing the label width in percy', () => {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
||||||
|
|
||||||
describe('Entity Relationship Diagram', () => {
|
describe('Entity Relationship Diagram', () => {
|
||||||
it('should render a simple ER diagram', () => {
|
it('should render a simple ER diagram', () => {
|
||||||
@@ -200,6 +200,27 @@ describe('Entity Relationship Diagram', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should render entities with attributes that begin with asterisk', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
erDiagram
|
||||||
|
BOOK {
|
||||||
|
int *id
|
||||||
|
string name
|
||||||
|
varchar(99) summary
|
||||||
|
}
|
||||||
|
BOOK }o..o{ STORE : soldBy
|
||||||
|
STORE {
|
||||||
|
int *id
|
||||||
|
string name
|
||||||
|
varchar(50) address
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
{ loglevel: 1 }
|
||||||
|
);
|
||||||
|
cy.get('svg');
|
||||||
|
});
|
||||||
|
|
||||||
it('should render entities with keys', () => {
|
it('should render entities with keys', () => {
|
||||||
renderGraph(
|
renderGraph(
|
||||||
`
|
`
|
||||||
@@ -284,4 +305,21 @@ ORDER ||--|{ LINE-ITEM : contains
|
|||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should render entities with entity name aliases', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
erDiagram
|
||||||
|
p[Person] {
|
||||||
|
varchar(64) firstName
|
||||||
|
varchar(64) lastName
|
||||||
|
}
|
||||||
|
c["Customer Account"] {
|
||||||
|
varchar(128) email
|
||||||
|
}
|
||||||
|
p ||--o| c : has
|
||||||
|
`,
|
||||||
|
{ logLevel: 1 }
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
||||||
|
|
||||||
describe.skip('Flowchart ELK', () => {
|
describe.skip('Flowchart ELK', () => {
|
||||||
it('1-elk: should render a simple flowchart', () => {
|
it('1-elk: should render a simple flowchart', () => {
|
||||||
@@ -681,7 +681,7 @@ title: Simple flowchart
|
|||||||
flowchart-elk TD
|
flowchart-elk TD
|
||||||
A --> B
|
A --> B
|
||||||
`,
|
`,
|
||||||
{ titleTopMargin: 0 }
|
{ flowchart: { titleTopMargin: 0 } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('elk: should include classes on the edges', () => {
|
it('elk: should include classes on the edges', () => {
|
||||||
@@ -710,7 +710,7 @@ flowchart-elk LR
|
|||||||
style id2 fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5
|
style id2 fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5
|
||||||
classDef someclass fill:#f96
|
classDef someclass fill:#f96
|
||||||
`,
|
`,
|
||||||
{ titleTopMargin: 0 }
|
{ flowchart: { titleTopMargin: 0 } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('With formatting in a node', () => {
|
it('With formatting in a node', () => {
|
||||||
@@ -726,7 +726,7 @@ flowchart-elk LR
|
|||||||
b --> d(The dog in the hog)
|
b --> d(The dog in the hog)
|
||||||
c --> d
|
c --> d
|
||||||
`,
|
`,
|
||||||
{ titleTopMargin: 0 }
|
{ flowchart: { titleTopMargin: 0 } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('New line in node and formatted edge label', () => {
|
it('New line in node and formatted edge label', () => {
|
||||||
@@ -736,7 +736,7 @@ flowchart-elk LR
|
|||||||
b("\`The dog in **the** hog.(1)
|
b("\`The dog in **the** hog.(1)
|
||||||
NL\`") --"\`1o **bold**\`"--> c
|
NL\`") --"\`1o **bold**\`"--> c
|
||||||
`,
|
`,
|
||||||
{ titleTopMargin: 0 }
|
{ flowchart: { titleTopMargin: 0 } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('Wrapping long text with a new line', () => {
|
it('Wrapping long text with a new line', () => {
|
||||||
@@ -749,7 +749,7 @@ Word!
|
|||||||
Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. \`) --> c
|
Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. \`) --> c
|
||||||
|
|
||||||
`,
|
`,
|
||||||
{ titleTopMargin: 0 }
|
{ flowchart: { titleTopMargin: 0 } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('Sub graphs and markdown strings', () => {
|
it('Sub graphs and markdown strings', () => {
|
||||||
@@ -766,7 +766,7 @@ subgraph "\`**Two**\`"
|
|||||||
end
|
end
|
||||||
|
|
||||||
`,
|
`,
|
||||||
{ titleTopMargin: 0 }
|
{ flowchart: { titleTopMargin: 0 } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -782,7 +782,7 @@ flowchart-elk LR
|
|||||||
style id2 fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5
|
style id2 fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5
|
||||||
classDef someclass fill:#f96
|
classDef someclass fill:#f96
|
||||||
`,
|
`,
|
||||||
{ titleTopMargin: 0 }
|
{ flowchart: { titleTopMargin: 0 } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('With formatting in a node', () => {
|
it('With formatting in a node', () => {
|
||||||
@@ -798,7 +798,7 @@ flowchart-elk LR
|
|||||||
b --> d(The dog in the hog)
|
b --> d(The dog in the hog)
|
||||||
c --> d
|
c --> d
|
||||||
`,
|
`,
|
||||||
{ titleTopMargin: 0 }
|
{ flowchart: { titleTopMargin: 0 } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('New line in node and formatted edge label', () => {
|
it('New line in node and formatted edge label', () => {
|
||||||
@@ -808,7 +808,7 @@ flowchart-elk LR
|
|||||||
b("\`The dog in **the** hog.(1)
|
b("\`The dog in **the** hog.(1)
|
||||||
NL\`") --"\`1o **bold**\`"--> c
|
NL\`") --"\`1o **bold**\`"--> c
|
||||||
`,
|
`,
|
||||||
{ titleTopMargin: 0 }
|
{ flowchart: { titleTopMargin: 0 } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('Wrapping long text with a new line', () => {
|
it('Wrapping long text with a new line', () => {
|
||||||
@@ -821,7 +821,7 @@ Word!
|
|||||||
Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. \`") --> c
|
Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. \`") --> c
|
||||||
|
|
||||||
`,
|
`,
|
||||||
{ titleTopMargin: 0 }
|
{ flowchart: { titleTopMargin: 0 } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('Sub graphs and markdown strings', () => {
|
it('Sub graphs and markdown strings', () => {
|
||||||
@@ -838,7 +838,7 @@ subgraph "\`**Two**\`"
|
|||||||
end
|
end
|
||||||
|
|
||||||
`,
|
`,
|
||||||
{ titleTopMargin: 0 }
|
{ flowchart: { titleTopMargin: 0 } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
||||||
|
|
||||||
describe('Flowchart v2', () => {
|
describe('Flowchart v2', () => {
|
||||||
it('1: should render a simple flowchart', () => {
|
it('1: should render a simple flowchart', () => {
|
||||||
@@ -449,7 +449,7 @@ flowchart TD
|
|||||||
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
|
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('65: text-color from classes', () => {
|
it('65-1: text-color from classes', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
flowchart LR
|
flowchart LR
|
||||||
@@ -460,6 +460,31 @@ flowchart TD
|
|||||||
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
|
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
it('65-2: bold text from classes', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
flowchart
|
||||||
|
classDef cat fill:#f9d5e5, stroke:#233d4d,stroke-width:2px, font-weight:bold;
|
||||||
|
CS(A long bold text to be viewed):::cat
|
||||||
|
`,
|
||||||
|
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('65-3: bigger font from classes', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
flowchart
|
||||||
|
Node1:::class1 --> Node2:::class2
|
||||||
|
Node1:::class1 --> Node3:::class2
|
||||||
|
Node3 --> Node4((I am a circle)):::larger
|
||||||
|
|
||||||
|
classDef class1 fill:lightblue
|
||||||
|
classDef class2 fill:pink
|
||||||
|
classDef larger font-size:30px,fill:yellow
|
||||||
|
`,
|
||||||
|
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
|
||||||
|
);
|
||||||
|
});
|
||||||
it('66: More nested subgraph cases (TB)', () => {
|
it('66: More nested subgraph cases (TB)', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
@@ -671,7 +696,7 @@ title: Simple flowchart
|
|||||||
flowchart TD
|
flowchart TD
|
||||||
A --> B
|
A --> B
|
||||||
`,
|
`,
|
||||||
{ titleTopMargin: 0 }
|
{ flowchart: { titleTopMargin: 10 } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('3192: It should be possieble to render flowcharts with invisible edges', () => {
|
it('3192: It should be possieble to render flowcharts with invisible edges', () => {
|
||||||
@@ -682,7 +707,7 @@ title: Simple flowchart with invisible edges
|
|||||||
flowchart TD
|
flowchart TD
|
||||||
A ~~~ B
|
A ~~~ B
|
||||||
`,
|
`,
|
||||||
{ titleTopMargin: 0 }
|
{ flowchart: { titleTopMargin: 10 } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('4023: Should render html labels with images and-or text correctly', () => {
|
it('4023: Should render html labels with images and-or text correctly', () => {
|
||||||
@@ -695,6 +720,15 @@ A ~~~ B
|
|||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('4439: Should render the graph even if some images are missing', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`flowchart TD
|
||||||
|
B[<img>]
|
||||||
|
B-->C[<img>]`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
});
|
||||||
describe('Markdown strings flowchart (#4220)', () => {
|
describe('Markdown strings flowchart (#4220)', () => {
|
||||||
describe('html labels', () => {
|
describe('html labels', () => {
|
||||||
it('With styling and classes', () => {
|
it('With styling and classes', () => {
|
||||||
@@ -707,7 +741,7 @@ flowchart LR
|
|||||||
style id2 fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5
|
style id2 fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5
|
||||||
classDef someclass fill:#f96
|
classDef someclass fill:#f96
|
||||||
`,
|
`,
|
||||||
{ titleTopMargin: 0 }
|
{ flowchart: { titleTopMargin: 0 } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('With formatting in a node', () => {
|
it('With formatting in a node', () => {
|
||||||
@@ -723,7 +757,7 @@ flowchart LR
|
|||||||
b --> d(The dog in the hog)
|
b --> d(The dog in the hog)
|
||||||
c --> d
|
c --> d
|
||||||
`,
|
`,
|
||||||
{ titleTopMargin: 0 }
|
{ flowchart: { titleTopMargin: 0 } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('New line in node and formatted edge label', () => {
|
it('New line in node and formatted edge label', () => {
|
||||||
@@ -733,7 +767,7 @@ flowchart LR
|
|||||||
b("\`The dog in **the** hog.(1)
|
b("\`The dog in **the** hog.(1)
|
||||||
NL\`") --"\`1o **bold**\`"--> c
|
NL\`") --"\`1o **bold**\`"--> c
|
||||||
`,
|
`,
|
||||||
{ titleTopMargin: 0 }
|
{ flowchart: { titleTopMargin: 0 } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('Wrapping long text with a new line', () => {
|
it('Wrapping long text with a new line', () => {
|
||||||
@@ -746,7 +780,7 @@ Word!
|
|||||||
Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. \`") --> c
|
Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. \`") --> c
|
||||||
|
|
||||||
`,
|
`,
|
||||||
{ titleTopMargin: 0 }
|
{ flowchart: { titleTopMargin: 0 } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('Sub graphs and markdown strings', () => {
|
it('Sub graphs and markdown strings', () => {
|
||||||
@@ -763,7 +797,7 @@ subgraph "\`**Two**\`"
|
|||||||
end
|
end
|
||||||
|
|
||||||
`,
|
`,
|
||||||
{ titleTopMargin: 0 }
|
{ flowchart: { titleTopMargin: 0 } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -779,7 +813,7 @@ flowchart LR
|
|||||||
style id2 fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5
|
style id2 fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5
|
||||||
classDef someclass fill:#f96
|
classDef someclass fill:#f96
|
||||||
`,
|
`,
|
||||||
{ titleTopMargin: 0 }
|
{ flowchart: { titleTopMargin: 0 } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('With formatting in a node', () => {
|
it('With formatting in a node', () => {
|
||||||
@@ -795,7 +829,7 @@ flowchart LR
|
|||||||
b --> d(The dog in the hog)
|
b --> d(The dog in the hog)
|
||||||
c --> d
|
c --> d
|
||||||
`,
|
`,
|
||||||
{ titleTopMargin: 0 }
|
{ flowchart: { titleTopMargin: 0 } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('New line in node and formatted edge label', () => {
|
it('New line in node and formatted edge label', () => {
|
||||||
@@ -805,7 +839,7 @@ flowchart LR
|
|||||||
b("\`The dog in **the** hog.(1)
|
b("\`The dog in **the** hog.(1)
|
||||||
NL\`") --"\`1o **bold**\`"--> c
|
NL\`") --"\`1o **bold**\`"--> c
|
||||||
`,
|
`,
|
||||||
{ titleTopMargin: 0 }
|
{ flowchart: { titleTopMargin: 0 } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('Wrapping long text with a new line', () => {
|
it('Wrapping long text with a new line', () => {
|
||||||
@@ -818,7 +852,7 @@ Word!
|
|||||||
Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. \`") --> c
|
Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. Another line with many, many words. \`") --> c
|
||||||
|
|
||||||
`,
|
`,
|
||||||
{ titleTopMargin: 0 }
|
{ flowchart: { titleTopMargin: 0 } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('Sub graphs and markdown strings', () => {
|
it('Sub graphs and markdown strings', () => {
|
||||||
@@ -835,7 +869,7 @@ subgraph "\`**Two**\`"
|
|||||||
end
|
end
|
||||||
|
|
||||||
`,
|
`,
|
||||||
{ titleTopMargin: 0 }
|
{ flowchart: { titleTopMargin: 0 } }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
||||||
|
|
||||||
describe('Graph', () => {
|
describe('Graph', () => {
|
||||||
it('1: should render a simple flowchart no htmlLabels', () => {
|
it('1: should render a simple flowchart no htmlLabels', () => {
|
||||||
@@ -891,4 +891,27 @@ graph TD
|
|||||||
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
|
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
it('66: apply class called default on node called default', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
graph TD
|
||||||
|
classDef default fill:#a34,stroke:#000,stroke-width:4px,color:#fff
|
||||||
|
hello --> default
|
||||||
|
`,
|
||||||
|
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('67: should be able to style default node independently', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
flowchart TD
|
||||||
|
classDef default fill:#a34
|
||||||
|
hello --> default
|
||||||
|
|
||||||
|
style default stroke:#000,stroke-width:4px
|
||||||
|
`,
|
||||||
|
{ htmlLabels: true, flowchart: { htmlLabels: true }, securityLevel: 'loose' }
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
||||||
|
|
||||||
describe('Gantt diagram', () => {
|
describe('Gantt diagram', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
@@ -414,6 +414,28 @@ describe('Gantt diagram', () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should render a gantt diagram with tick is 1 week, with the day starting on monday', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
gantt
|
||||||
|
title A Gantt Diagram
|
||||||
|
dateFormat YYYY-MM-DD
|
||||||
|
axisFormat %m-%d
|
||||||
|
tickInterval 1week
|
||||||
|
weekday monday
|
||||||
|
excludes weekends
|
||||||
|
|
||||||
|
section Section
|
||||||
|
A task : a1, 2022-10-01, 30d
|
||||||
|
Another task : after a1, 20d
|
||||||
|
section Another
|
||||||
|
Task in sec : 2022-10-20, 12d
|
||||||
|
another task : 24d
|
||||||
|
`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
it('should render a gantt diagram with tick is 1 month', () => {
|
it('should render a gantt diagram with tick is 1 month', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest } from '../../helpers/util.js';
|
import { imgSnapshotTest } from '../../helpers/util.ts';
|
||||||
|
|
||||||
describe('Git Graph diagram', () => {
|
describe('Git Graph diagram', () => {
|
||||||
it('1: should render a simple gitgraph with commit on main branch', () => {
|
it('1: should render a simple gitgraph with commit on main branch', () => {
|
||||||
@@ -333,4 +333,372 @@ gitGraph
|
|||||||
{}
|
{}
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
it('15: should render a simple gitgraph with commit on main branch | Vertical Branch', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`gitGraph TB:
|
||||||
|
commit id: "1"
|
||||||
|
commit id: "2"
|
||||||
|
commit id: "3"
|
||||||
|
`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('16: should render a simple gitgraph with commit on main branch with Id | Vertical Branch', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`gitGraph TB:
|
||||||
|
commit id: "One"
|
||||||
|
commit id: "Two"
|
||||||
|
commit id: "Three"
|
||||||
|
`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('17: should render a simple gitgraph with different commitTypes on main branch | Vertical Branch', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`gitGraph TB:
|
||||||
|
commit id: "Normal Commit"
|
||||||
|
commit id: "Reverse Commit" type: REVERSE
|
||||||
|
commit id: "Hightlight Commit" type: HIGHLIGHT
|
||||||
|
`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('18: should render a simple gitgraph with tags commitTypes on main branch | Vertical Branch', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`gitGraph TB:
|
||||||
|
commit id: "Normal Commit with tag" tag: "v1.0.0"
|
||||||
|
commit id: "Reverse Commit with tag" type: REVERSE tag: "RC_1"
|
||||||
|
commit id: "Hightlight Commit" type: HIGHLIGHT tag: "8.8.4"
|
||||||
|
`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('19: should render a simple gitgraph with two branches | Vertical Branch', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`gitGraph TB:
|
||||||
|
commit id: "1"
|
||||||
|
commit id: "2"
|
||||||
|
branch develop
|
||||||
|
checkout develop
|
||||||
|
commit id: "3"
|
||||||
|
commit id: "4"
|
||||||
|
checkout main
|
||||||
|
commit id: "5"
|
||||||
|
commit id: "6"
|
||||||
|
`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('20: should render a simple gitgraph with two branches and merge commit | Vertical Branch', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`gitGraph TB:
|
||||||
|
commit id: "1"
|
||||||
|
commit id: "2"
|
||||||
|
branch develop
|
||||||
|
checkout develop
|
||||||
|
commit id: "3"
|
||||||
|
commit id: "4"
|
||||||
|
checkout main
|
||||||
|
merge develop
|
||||||
|
commit id: "5"
|
||||||
|
commit id: "6"
|
||||||
|
`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('21: should render a simple gitgraph with three branches and tagged merge commit | Vertical Branch', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`gitGraph TB:
|
||||||
|
commit id: "1"
|
||||||
|
commit id: "2"
|
||||||
|
branch nice_feature
|
||||||
|
checkout nice_feature
|
||||||
|
commit id: "3"
|
||||||
|
checkout main
|
||||||
|
commit id: "4"
|
||||||
|
checkout nice_feature
|
||||||
|
branch very_nice_feature
|
||||||
|
checkout very_nice_feature
|
||||||
|
commit id: "5"
|
||||||
|
checkout main
|
||||||
|
commit id: "6"
|
||||||
|
checkout nice_feature
|
||||||
|
commit id: "7"
|
||||||
|
checkout main
|
||||||
|
merge nice_feature id: "12345" tag: "my merge commit"
|
||||||
|
checkout very_nice_feature
|
||||||
|
commit id: "8"
|
||||||
|
checkout main
|
||||||
|
commit id: "9"
|
||||||
|
`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('22: should render a simple gitgraph with more than 8 branchs & overriding variables | Vertical Branch', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`%%{init: { 'logLevel': 'debug', 'theme': 'default' , 'themeVariables': {
|
||||||
|
'gitBranchLabel0': '#ffffff',
|
||||||
|
'gitBranchLabel1': '#ffffff',
|
||||||
|
'gitBranchLabel2': '#ffffff',
|
||||||
|
'gitBranchLabel3': '#ffffff',
|
||||||
|
'gitBranchLabel4': '#ffffff',
|
||||||
|
'gitBranchLabel5': '#ffffff',
|
||||||
|
'gitBranchLabel6': '#ffffff',
|
||||||
|
'gitBranchLabel7': '#ffffff',
|
||||||
|
} } }%%
|
||||||
|
gitGraph TB:
|
||||||
|
checkout main
|
||||||
|
branch branch1
|
||||||
|
branch branch2
|
||||||
|
branch branch3
|
||||||
|
branch branch4
|
||||||
|
branch branch5
|
||||||
|
branch branch6
|
||||||
|
branch branch7
|
||||||
|
branch branch8
|
||||||
|
branch branch9
|
||||||
|
checkout branch1
|
||||||
|
commit id: "1"
|
||||||
|
`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('23: should render a simple gitgraph with rotated labels | Vertical Branch', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`%%{init: { 'logLevel': 'debug', 'theme': 'default' , 'gitGraph': {
|
||||||
|
'rotateCommitLabel': true
|
||||||
|
} } }%%
|
||||||
|
gitGraph TB:
|
||||||
|
commit id: "75f7219e83b321cd3fdde7dcf83bc7c1000a6828"
|
||||||
|
commit id: "0db4784daf82736dec4569e0dc92980d328c1f2e"
|
||||||
|
commit id: "7067e9973f9eaa6cd4a4b723c506d1eab598e83e"
|
||||||
|
commit id: "66972321ad6c199013b5b31f03b3a86fa3f9817d"
|
||||||
|
`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('24: should render a simple gitgraph with horizontal labels | Vertical Branch', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`%%{init: { 'logLevel': 'debug', 'theme': 'default' , 'gitGraph': {
|
||||||
|
'rotateCommitLabel': false
|
||||||
|
} } }%%
|
||||||
|
gitGraph TB:
|
||||||
|
commit id: "Alpha"
|
||||||
|
commit id: "Beta"
|
||||||
|
commit id: "Gamma"
|
||||||
|
commit id: "Delta"
|
||||||
|
`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('25: should render a simple gitgraph with cherry pick commit | Vertical Branch', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
gitGraph TB:
|
||||||
|
commit id: "ZERO"
|
||||||
|
branch develop
|
||||||
|
commit id:"A"
|
||||||
|
checkout main
|
||||||
|
commit id:"ONE"
|
||||||
|
checkout develop
|
||||||
|
commit id:"B"
|
||||||
|
checkout main
|
||||||
|
commit id:"TWO"
|
||||||
|
cherry-pick id:"A"
|
||||||
|
commit id:"THREE"
|
||||||
|
checkout develop
|
||||||
|
commit id:"C"
|
||||||
|
`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('26: should render a gitgraph with cherry pick commit with custom tag | Vertical Branch', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
gitGraph TB:
|
||||||
|
commit id: "ZERO"
|
||||||
|
branch develop
|
||||||
|
commit id:"A"
|
||||||
|
checkout main
|
||||||
|
commit id:"ONE"
|
||||||
|
checkout develop
|
||||||
|
commit id:"B"
|
||||||
|
checkout main
|
||||||
|
commit id:"TWO"
|
||||||
|
cherry-pick id:"A" tag: "snapshot"
|
||||||
|
commit id:"THREE"
|
||||||
|
checkout develop
|
||||||
|
commit id:"C"
|
||||||
|
`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('27: should render a gitgraph with cherry pick commit with no tag | Vertical Branch', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
gitGraph TB:
|
||||||
|
commit id: "ZERO"
|
||||||
|
branch develop
|
||||||
|
commit id:"A"
|
||||||
|
checkout main
|
||||||
|
commit id:"ONE"
|
||||||
|
checkout develop
|
||||||
|
commit id:"B"
|
||||||
|
checkout main
|
||||||
|
commit id:"TWO"
|
||||||
|
cherry-pick id:"A" tag: ""
|
||||||
|
commit id:"THREE"
|
||||||
|
checkout develop
|
||||||
|
commit id:"C"
|
||||||
|
`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('28: should render a simple gitgraph with two cherry pick commit | Vertical Branch', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
gitGraph TB:
|
||||||
|
commit id: "ZERO"
|
||||||
|
branch develop
|
||||||
|
commit id:"A"
|
||||||
|
checkout main
|
||||||
|
commit id:"ONE"
|
||||||
|
checkout develop
|
||||||
|
commit id:"B"
|
||||||
|
branch featureA
|
||||||
|
commit id:"FIX"
|
||||||
|
commit id: "FIX-2"
|
||||||
|
checkout main
|
||||||
|
commit id:"TWO"
|
||||||
|
cherry-pick id:"A"
|
||||||
|
commit id:"THREE"
|
||||||
|
cherry-pick id:"FIX"
|
||||||
|
checkout develop
|
||||||
|
commit id:"C"
|
||||||
|
merge featureA
|
||||||
|
`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('29: should render commits for more than 8 branches | Vertical Branch', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
gitGraph TB:
|
||||||
|
checkout main
|
||||||
|
%% Make sure to manually set the ID of all commits, for consistent visual tests
|
||||||
|
commit id: "1-abcdefg"
|
||||||
|
checkout main
|
||||||
|
branch branch1
|
||||||
|
commit id: "2-abcdefg"
|
||||||
|
checkout main
|
||||||
|
merge branch1
|
||||||
|
branch branch2
|
||||||
|
commit id: "3-abcdefg"
|
||||||
|
checkout main
|
||||||
|
merge branch2
|
||||||
|
branch branch3
|
||||||
|
commit id: "4-abcdefg"
|
||||||
|
checkout main
|
||||||
|
merge branch3
|
||||||
|
branch branch4
|
||||||
|
commit id: "5-abcdefg"
|
||||||
|
checkout main
|
||||||
|
merge branch4
|
||||||
|
branch branch5
|
||||||
|
commit id: "6-abcdefg"
|
||||||
|
checkout main
|
||||||
|
merge branch5
|
||||||
|
branch branch6
|
||||||
|
commit id: "7-abcdefg"
|
||||||
|
checkout main
|
||||||
|
merge branch6
|
||||||
|
branch branch7
|
||||||
|
commit id: "8-abcdefg"
|
||||||
|
checkout main
|
||||||
|
merge branch7
|
||||||
|
branch branch8
|
||||||
|
commit id: "9-abcdefg"
|
||||||
|
checkout main
|
||||||
|
merge branch8
|
||||||
|
branch branch9
|
||||||
|
commit id: "10-abcdefg"
|
||||||
|
`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('30: should render a simple gitgraph with three branches,custom merge commit id,tag,type | Vertical Branch', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`gitGraph TB:
|
||||||
|
commit id: "1"
|
||||||
|
commit id: "2"
|
||||||
|
branch nice_feature
|
||||||
|
checkout nice_feature
|
||||||
|
commit id: "3"
|
||||||
|
checkout main
|
||||||
|
commit id: "4"
|
||||||
|
checkout nice_feature
|
||||||
|
branch very_nice_feature
|
||||||
|
checkout very_nice_feature
|
||||||
|
commit id: "5"
|
||||||
|
checkout main
|
||||||
|
commit id: "6"
|
||||||
|
checkout nice_feature
|
||||||
|
commit id: "7"
|
||||||
|
checkout main
|
||||||
|
merge nice_feature id: "customID" tag: "customTag" type: REVERSE
|
||||||
|
checkout very_nice_feature
|
||||||
|
commit id: "8"
|
||||||
|
checkout main
|
||||||
|
commit id: "9"
|
||||||
|
`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('31: should render a simple gitgraph with a title | Vertical Branch', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`---
|
||||||
|
title: simple gitGraph
|
||||||
|
---
|
||||||
|
gitGraph TB:
|
||||||
|
commit id: "1-abcdefg"
|
||||||
|
`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('32: should render a simple gitgraph overlapping commits | Vertical Branch', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`gitGraph TB:
|
||||||
|
commit id:"s1"
|
||||||
|
commit id:"s2"
|
||||||
|
branch branch1
|
||||||
|
commit id:"s3"
|
||||||
|
commit id:"s4"
|
||||||
|
checkout main
|
||||||
|
commit id:"s5"
|
||||||
|
checkout branch1
|
||||||
|
commit id:"s6"
|
||||||
|
commit id:"s7"
|
||||||
|
merge main
|
||||||
|
`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('33: should render a simple gitgraph overlapping commits', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`gitGraph
|
||||||
|
commit id:"s1"
|
||||||
|
commit id:"s2"
|
||||||
|
branch branch1
|
||||||
|
commit id:"s3"
|
||||||
|
commit id:"s4"
|
||||||
|
checkout main
|
||||||
|
commit id:"s5"
|
||||||
|
checkout branch1
|
||||||
|
commit id:"s6"
|
||||||
|
commit id:"s7"
|
||||||
|
merge main
|
||||||
|
`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest } from '../../helpers/util.js';
|
import { imgSnapshotTest } from '../../helpers/util.ts';
|
||||||
|
|
||||||
describe('info diagram', () => {
|
describe('info diagram', () => {
|
||||||
it('should handle an info definition', () => {
|
it('should handle an info definition', () => {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
||||||
|
|
||||||
describe('User journey diagram', () => {
|
describe('User journey diagram', () => {
|
||||||
it('Simple test', () => {
|
it('Simple test', () => {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest } from '../../helpers/util.js';
|
import { imgSnapshotTest } from '../../helpers/util.ts';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether the SVG Element has a Mindmap root
|
* Check whether the SVG Element has a Mindmap root
|
||||||
@@ -242,8 +242,7 @@ mindmap
|
|||||||
a second line 😎\`]
|
a second line 😎\`]
|
||||||
id2[\`The dog in **the** hog... a *very long text* about it
|
id2[\`The dog in **the** hog... a *very long text* about it
|
||||||
Word!\`]
|
Word!\`]
|
||||||
`,
|
`
|
||||||
{ titleTopMargin: 0 }
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@@ -1,89 +1,85 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
||||||
|
|
||||||
describe('Pie Chart', () => {
|
describe('pie chart', () => {
|
||||||
it('should render a simple pie diagram', () => {
|
it('should render a simple pie diagram', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
|
`pie title Sports in Sweden
|
||||||
|
"Bandy": 40
|
||||||
|
"Ice-Hockey": 80
|
||||||
|
"Football": 90
|
||||||
`
|
`
|
||||||
pie title Sports in Sweden
|
|
||||||
"Bandy" : 40
|
|
||||||
"Ice-Hockey" : 80
|
|
||||||
"Football" : 90
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
);
|
||||||
cy.get('svg');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should render a simple pie diagram with long labels', () => {
|
it('should render a simple pie diagram with long labels', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
|
`pie title NETFLIX
|
||||||
|
"Time spent looking for movie": 90
|
||||||
|
"Time spent watching it": 10
|
||||||
`
|
`
|
||||||
pie title NETFLIX
|
|
||||||
"Time spent looking for movie" : 90
|
|
||||||
"Time spent watching it" : 10
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
);
|
||||||
cy.get('svg');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should render a simple pie diagram with capital letters for labels', () => {
|
it('should render a simple pie diagram with capital letters for labels', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
|
`pie title What Voldemort doesn't have?
|
||||||
|
"FRIENDS": 2
|
||||||
|
"FAMILY": 3
|
||||||
|
"NOSE": 45
|
||||||
`
|
`
|
||||||
pie title What Voldemort doesn't have?
|
|
||||||
"FRIENDS" : 2
|
|
||||||
"FAMILY" : 3
|
|
||||||
"NOSE" : 45
|
|
||||||
`,
|
|
||||||
{}
|
|
||||||
);
|
);
|
||||||
cy.get('svg');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should render a pie diagram when useMaxWidth is true (default)', () => {
|
it('should render a pie diagram when useMaxWidth is true (default)', () => {
|
||||||
renderGraph(
|
renderGraph(
|
||||||
`
|
`pie title Sports in Sweden
|
||||||
pie title Sports in Sweden
|
"Bandy": 40
|
||||||
"Bandy" : 40
|
"Ice-Hockey": 80
|
||||||
"Ice-Hockey" : 80
|
"Football": 90
|
||||||
"Football" : 90
|
|
||||||
`,
|
`,
|
||||||
{ pie: { useMaxWidth: true } }
|
{ pie: { useMaxWidth: true } }
|
||||||
);
|
);
|
||||||
cy.get('svg').should((svg) => {
|
cy.get('svg').should((svg) => {
|
||||||
expect(svg).to.have.attr('width', '100%');
|
expect(svg).to.have.attr('width', '100%');
|
||||||
// expect(svg).to.have.attr('height');
|
|
||||||
// const height = parseFloat(svg.attr('height'));
|
|
||||||
// expect(height).to.eq(450);
|
|
||||||
const style = svg.attr('style');
|
const style = svg.attr('style');
|
||||||
expect(style).to.match(/^max-width: [\d.]+px;$/);
|
expect(style).to.match(/^max-width: [\d.]+px;$/);
|
||||||
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
|
const maxWidthValue = parseFloat(style.match(/[\d.]+/g).join(''));
|
||||||
expect(maxWidthValue).to.eq(984);
|
expect(maxWidthValue).to.eq(984);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should render a pie diagram when useMaxWidth is false', () => {
|
it('should render a pie diagram when useMaxWidth is false', () => {
|
||||||
renderGraph(
|
renderGraph(
|
||||||
`
|
`pie title Sports in Sweden
|
||||||
pie title Sports in Sweden
|
"Bandy": 40
|
||||||
"Bandy" : 40
|
"Ice-Hockey": 80
|
||||||
"Ice-Hockey" : 80
|
"Football": 90
|
||||||
"Football" : 90
|
|
||||||
`,
|
`,
|
||||||
{ pie: { useMaxWidth: false } }
|
{ pie: { useMaxWidth: false } }
|
||||||
);
|
);
|
||||||
cy.get('svg').should((svg) => {
|
cy.get('svg').should((svg) => {
|
||||||
// const height = parseFloat(svg.attr('height'));
|
|
||||||
const width = parseFloat(svg.attr('width'));
|
const width = parseFloat(svg.attr('width'));
|
||||||
// expect(height).to.eq(450);
|
|
||||||
expect(width).to.eq(984);
|
expect(width).to.eq(984);
|
||||||
expect(svg).to.not.have.attr('style');
|
expect(svg).to.not.have.attr('style');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it('should render a pie diagram when textPosition is set', () => {
|
|
||||||
|
it('should render a pie diagram when textPosition is setted', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
`
|
`pie
|
||||||
pie
|
"Dogs": 50
|
||||||
"Dogs": 50
|
"Cats": 25
|
||||||
"Cats": 25
|
`,
|
||||||
`,
|
|
||||||
{ logLevel: 1, pie: { textPosition: 0.9 } }
|
{ logLevel: 1, pie: { textPosition: 0.9 } }
|
||||||
);
|
);
|
||||||
cy.get('svg');
|
});
|
||||||
|
|
||||||
|
it('should render a pie diagram with showData', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`pie showData
|
||||||
|
"Dogs": 50
|
||||||
|
"Cats": 25
|
||||||
|
`
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
||||||
|
|
||||||
describe('Quadrant Chart', () => {
|
describe('Quadrant Chart', () => {
|
||||||
it('should render if only chart type is provided', () => {
|
it('should render if only chart type is provided', () => {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
||||||
|
|
||||||
describe('Requirement diagram', () => {
|
describe('Requirement diagram', () => {
|
||||||
it('sample', () => {
|
it('sample', () => {
|
||||||
|
144
cypress/integration/rendering/sankey.spec.ts
Normal file
144
cypress/integration/rendering/sankey.spec.ts
Normal file
@@ -0,0 +1,144 @@
|
|||||||
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
||||||
|
|
||||||
|
describe('Sankey Diagram', () => {
|
||||||
|
it('should render a simple example', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
sankey-beta
|
||||||
|
|
||||||
|
sourceNode,targetNode,10
|
||||||
|
`,
|
||||||
|
{}
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when given a linkColor', function () {
|
||||||
|
this.beforeAll(() => {
|
||||||
|
cy.wrap(
|
||||||
|
`sankey-beta
|
||||||
|
a,b,10
|
||||||
|
`
|
||||||
|
).as('graph');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('links should use hex color', function () {
|
||||||
|
renderGraph(this.graph, { sankey: { linkColor: '#636465' } });
|
||||||
|
|
||||||
|
cy.get('.link path').should((link) => {
|
||||||
|
expect(link.attr('stroke')).to.equal('#636465');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('links should be the same color as source node', function () {
|
||||||
|
renderGraph(this.graph, { sankey: { linkColor: 'source' } });
|
||||||
|
|
||||||
|
cy.get('.link path').then((link) => {
|
||||||
|
cy.get('.node[id="node-1"] rect').should((node) =>
|
||||||
|
expect(link.attr('stroke')).to.equal(node.attr('fill'))
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('links should be the same color as target node', function () {
|
||||||
|
renderGraph(this.graph, { sankey: { linkColor: 'target' } });
|
||||||
|
|
||||||
|
cy.get('.link path').then((link) => {
|
||||||
|
cy.get('.node[id="node-2"] rect').should((node) =>
|
||||||
|
expect(link.attr('stroke')).to.equal(node.attr('fill'))
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('links must be gradient', function () {
|
||||||
|
renderGraph(this.graph, { sankey: { linkColor: 'gradient' } });
|
||||||
|
|
||||||
|
cy.get('.link path').should((link) => {
|
||||||
|
expect(link.attr('stroke')).to.equal('url(#linearGradient-3)');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('when given a nodeAlignment', function () {
|
||||||
|
this.beforeAll(() => {
|
||||||
|
cy.wrap(
|
||||||
|
`
|
||||||
|
sankey-beta
|
||||||
|
|
||||||
|
a,b,8
|
||||||
|
b,c,8
|
||||||
|
c,d,8
|
||||||
|
d,e,8
|
||||||
|
|
||||||
|
x,c,4
|
||||||
|
c,y,4
|
||||||
|
`
|
||||||
|
).as('graph');
|
||||||
|
});
|
||||||
|
|
||||||
|
this.afterEach(() => {
|
||||||
|
cy.get('.node[id="node-1"]').should((node) => {
|
||||||
|
expect(node.attr('x')).to.equal('0');
|
||||||
|
});
|
||||||
|
cy.get('.node[id="node-2"]').should((node) => {
|
||||||
|
expect(node.attr('x')).to.equal('100');
|
||||||
|
});
|
||||||
|
cy.get('.node[id="node-3"]').should((node) => {
|
||||||
|
expect(node.attr('x')).to.equal('200');
|
||||||
|
});
|
||||||
|
cy.get('.node[id="node-4"]').should((node) => {
|
||||||
|
expect(node.attr('x')).to.equal('300');
|
||||||
|
});
|
||||||
|
cy.get('.node[id="node-5"]').should((node) => {
|
||||||
|
expect(node.attr('x')).to.equal('400');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should justify nodes', function () {
|
||||||
|
renderGraph(this.graph, {
|
||||||
|
sankey: { nodeAlignment: 'justify', width: 410, useMaxWidth: false },
|
||||||
|
});
|
||||||
|
cy.get('.node[id="node-6"]').should((node) => {
|
||||||
|
expect(node.attr('x')).to.equal('0');
|
||||||
|
});
|
||||||
|
cy.get('.node[id="node-7"]').should((node) => {
|
||||||
|
expect(node.attr('x')).to.equal('400');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should align nodes left', function () {
|
||||||
|
renderGraph(this.graph, {
|
||||||
|
sankey: { nodeAlignment: 'left', width: 410, useMaxWidth: false },
|
||||||
|
});
|
||||||
|
cy.get('.node[id="node-6"]').should((node) => {
|
||||||
|
expect(node.attr('x')).to.equal('0');
|
||||||
|
});
|
||||||
|
cy.get('.node[id="node-7"]').should((node) => {
|
||||||
|
expect(node.attr('x')).to.equal('300');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should align nodes right', function () {
|
||||||
|
renderGraph(this.graph, {
|
||||||
|
sankey: { nodeAlignment: 'right', width: 410, useMaxWidth: false },
|
||||||
|
});
|
||||||
|
cy.get('.node[id="node-6"]').should((node) => {
|
||||||
|
expect(node.attr('x')).to.equal('100');
|
||||||
|
});
|
||||||
|
cy.get('.node[id="node-7"]').should((node) => {
|
||||||
|
expect(node.attr('x')).to.equal('400');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should center nodes', function () {
|
||||||
|
renderGraph(this.graph, {
|
||||||
|
sankey: { nodeAlignment: 'center', width: 410, useMaxWidth: false },
|
||||||
|
});
|
||||||
|
cy.get('.node[id="node-6"]').should((node) => {
|
||||||
|
expect(node.attr('x')).to.equal('100');
|
||||||
|
});
|
||||||
|
cy.get('.node[id="node-7"]').should((node) => {
|
||||||
|
expect(node.attr('x')).to.equal('300');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
@@ -1,6 +1,6 @@
|
|||||||
/// <reference types="Cypress" />
|
/// <reference types="Cypress" />
|
||||||
|
|
||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
||||||
|
|
||||||
context('Sequence diagram', () => {
|
context('Sequence diagram', () => {
|
||||||
it('should render a sequence diagram with boxes', () => {
|
it('should render a sequence diagram with boxes', () => {
|
||||||
@@ -156,6 +156,81 @@ context('Sequence diagram', () => {
|
|||||||
`
|
`
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
it('should render a sequence diagram with basic actor creation and destruction', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
sequenceDiagram
|
||||||
|
Alice ->> Bob: Hello Bob, how are you ?
|
||||||
|
Bob ->> Alice: Fine, thank you. And you?
|
||||||
|
create participant Polo
|
||||||
|
Alice ->> Polo: Hi Polo!
|
||||||
|
create actor Ola1 as Ola
|
||||||
|
Polo ->> Ola1: Hiii
|
||||||
|
Ola1 ->> Alice: Hi too
|
||||||
|
destroy Ola1
|
||||||
|
Alice --x Ola1: Bye!
|
||||||
|
Alice ->> Bob: And now?
|
||||||
|
create participant Ola2 as Ola
|
||||||
|
Alice ->> Ola2: Hello again
|
||||||
|
destroy Alice
|
||||||
|
Alice --x Ola2: Bye for me!
|
||||||
|
destroy Bob
|
||||||
|
Ola2 --> Bob: The end
|
||||||
|
`
|
||||||
|
);
|
||||||
|
});
|
||||||
|
it('should render a sequence diagram with actor creation and destruction coupled with backgrounds, loops and notes', () => {
|
||||||
|
imgSnapshotTest(
|
||||||
|
`
|
||||||
|
sequenceDiagram
|
||||||
|
accTitle: test the accTitle
|
||||||
|
accDescr: Test a description
|
||||||
|
|
||||||
|
participant Alice
|
||||||
|
participant Bob
|
||||||
|
autonumber 10 10
|
||||||
|
rect rgb(200, 220, 100)
|
||||||
|
rect rgb(200, 255, 200)
|
||||||
|
|
||||||
|
Alice ->> Bob: Hello Bob, how are you?
|
||||||
|
create participant John as John<br />Second Line
|
||||||
|
Bob-->>John: How about you John?
|
||||||
|
end
|
||||||
|
|
||||||
|
Bob--x Alice: I am good thanks!
|
||||||
|
Bob-x John: I am good thanks!
|
||||||
|
Note right of John: John thinks a long<br />long time, so long<br />that the text does<br />not fit on a row.
|
||||||
|
|
||||||
|
Bob-->Alice: Checking with John...
|
||||||
|
Note over John:wrap: John looks like he's still thinking, so Bob prods him a bit.
|
||||||
|
Bob-x John: Hey John - we're still waiting to know<br />how you're doing
|
||||||
|
Note over John:nowrap: John's trying hard not to break his train of thought.
|
||||||
|
destroy John
|
||||||
|
Bob-x John: John! Cmon!
|
||||||
|
Note over John: After a few more moments, John<br />finally snaps out of it.
|
||||||
|
end
|
||||||
|
|
||||||
|
autonumber off
|
||||||
|
alt either this
|
||||||
|
create actor Lola
|
||||||
|
Alice->>+Lola: Yes
|
||||||
|
Lola-->>-Alice: OK
|
||||||
|
else or this
|
||||||
|
autonumber
|
||||||
|
Alice->>Lola: No
|
||||||
|
else or this will happen
|
||||||
|
Alice->Lola: Maybe
|
||||||
|
end
|
||||||
|
autonumber 200
|
||||||
|
par this happens in parallel
|
||||||
|
destroy Bob
|
||||||
|
Alice -->> Bob: Parallel message 1
|
||||||
|
and
|
||||||
|
Alice -->> Lola: Parallel message 2
|
||||||
|
end
|
||||||
|
`
|
||||||
|
);
|
||||||
|
});
|
||||||
context('font settings', () => {
|
context('font settings', () => {
|
||||||
it('should render different note fonts when configured', () => {
|
it('should render different note fonts when configured', () => {
|
||||||
imgSnapshotTest(
|
imgSnapshotTest(
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
||||||
|
|
||||||
describe('State diagram', () => {
|
describe('State diagram', () => {
|
||||||
it('v2 should render a simple info', () => {
|
it('v2 should render a simple info', () => {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest, renderGraph } from '../../helpers/util.js';
|
import { imgSnapshotTest, renderGraph } from '../../helpers/util.ts';
|
||||||
|
|
||||||
describe('State diagram', () => {
|
describe('State diagram', () => {
|
||||||
it('should render a simple state diagrams', () => {
|
it('should render a simple state diagrams', () => {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest } from '../../helpers/util.js';
|
import { imgSnapshotTest } from '../../helpers/util.ts';
|
||||||
|
|
||||||
describe('themeCSS balancing, it', () => {
|
describe('themeCSS balancing, it', () => {
|
||||||
it('should not allow unbalanced CSS definitions', () => {
|
it('should not allow unbalanced CSS definitions', () => {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest } from '../../helpers/util.js';
|
import { imgSnapshotTest } from '../../helpers/util.ts';
|
||||||
|
|
||||||
describe('Timeline diagram', () => {
|
describe('Timeline diagram', () => {
|
||||||
it('1: should render a simple timeline with no specific sections', () => {
|
it('1: should render a simple timeline with no specific sections', () => {
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
import { imgSnapshotTest } from '../../helpers/util.js';
|
import { imgSnapshotTest } from '../../helpers/util.ts';
|
||||||
|
|
||||||
describe('Zen UML', () => {
|
describe('Zen UML', () => {
|
||||||
it('Basic Zen UML diagram', () => {
|
it('Basic Zen UML diagram', () => {
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<script src="./viewer.js" type="module"></script>
|
<script type="module" src="./viewer.js"></script>
|
||||||
<link
|
<link
|
||||||
href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap"
|
href="https://fonts.googleapis.com/css?family=Noto+Sans+SC&display=swap"
|
||||||
rel="stylesheet"
|
rel="stylesheet"
|
||||||
|
@@ -11,8 +11,7 @@ example-diagram
|
|||||||
<!-- <script src="//cdn.jsdelivr.net/npm/mermaid@9.1.7/dist/mermaid.min.js"></script> -->
|
<!-- <script src="//cdn.jsdelivr.net/npm/mermaid@9.1.7/dist/mermaid.min.js"></script> -->
|
||||||
<!-- <script type="module" src="./external-diagrams-mindmap.mjs" /> -->
|
<!-- <script type="module" src="./external-diagrams-mindmap.mjs" /> -->
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import exampleDiagram from '../../packages/mermaid-example-diagram/dist/mermaid-example-diagram.core.mjs';
|
import exampleDiagram from './mermaid-example-diagram.esm.mjs';
|
||||||
// import example from '../../packages/mermaid-example-diagram/src/detector';
|
|
||||||
import mermaid from './mermaid.esm.mjs';
|
import mermaid from './mermaid.esm.mjs';
|
||||||
|
|
||||||
await mermaid.registerExternalDiagrams([exampleDiagram]);
|
await mermaid.registerExternalDiagrams([exampleDiagram]);
|
||||||
|
29
cypress/platform/iife.html
Normal file
29
cypress/platform/iife.html
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<pre id="diagram" class="mermaid">
|
||||||
|
graph TB
|
||||||
|
a --> b
|
||||||
|
a --> c
|
||||||
|
b --> d
|
||||||
|
c --> d
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<div id="d2"></div>
|
||||||
|
|
||||||
|
<script src="/mermaid.min.js"></script>
|
||||||
|
<script>
|
||||||
|
mermaid.initialize({
|
||||||
|
startOnLoad: true,
|
||||||
|
});
|
||||||
|
const value = `graph TD\nHello --> World`;
|
||||||
|
const el = document.getElementById('d2');
|
||||||
|
mermaid.render('did', value).then(({ svg }) => {
|
||||||
|
console.log(svg);
|
||||||
|
el.innerHTML = svg;
|
||||||
|
if (window.Cypress) {
|
||||||
|
window.rendered = true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@@ -17,20 +17,20 @@
|
|||||||
graph TB
|
graph TB
|
||||||
Function-->URL
|
Function-->URL
|
||||||
click Function clickByFlow "Add a div"
|
click Function clickByFlow "Add a div"
|
||||||
click URL "http://localhost:9000/webpackUsage.html" "Visit <strong>mermaid docs</strong>"
|
click URL "http://localhost:9000/info.html" "Visit <strong>mermaid docs</strong>"
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="FirstLine" class="mermaid2">
|
<pre id="FirstLine" class="mermaid2">
|
||||||
graph TB
|
graph TB
|
||||||
1Function-->2URL
|
1Function-->2URL
|
||||||
click 1Function clickByFlow "Add a div"
|
click 1Function clickByFlow "Add a div"
|
||||||
click 2URL "http://localhost:9000/webpackUsage.html" "Visit <strong>mermaid docs</strong>"
|
click 2URL "http://localhost:9000/info.html" "Visit <strong>mermaid docs</strong>"
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<pre id="FirstLine" class="mermaid2">
|
<pre id="FirstLine" class="mermaid2">
|
||||||
classDiagram
|
classDiagram
|
||||||
class Test
|
class Test
|
||||||
class ShapeLink
|
class ShapeLink
|
||||||
link ShapeLink "http://localhost:9000/webpackUsage.html" "This is a tooltip for a link"
|
link ShapeLink "http://localhost:9000/info.html" "This is a tooltip for a link"
|
||||||
class ShapeCallback
|
class ShapeCallback
|
||||||
callback ShapeCallback "clickByClass" "This is a tooltip for a callback"
|
callback ShapeCallback "clickByClass" "This is a tooltip for a callback"
|
||||||
</pre>
|
</pre>
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
<pre id="FirstLine" class="mermaid">
|
<pre id="FirstLine" class="mermaid">
|
||||||
classDiagram-v2
|
classDiagram-v2
|
||||||
class ShapeLink
|
class ShapeLink
|
||||||
link ShapeLink "http://localhost:9000/webpackUsage.html" "This is a tooltip for a link"
|
link ShapeLink "http://localhost:9000/info.html" "This is a tooltip for a link"
|
||||||
</pre>
|
</pre>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@
|
|||||||
Calling a Callback (look at the console log) :cl2, after cl1, 3d
|
Calling a Callback (look at the console log) :cl2, after cl1, 3d
|
||||||
Calling a Callback with args :cl3, after cl1, 3d
|
Calling a Callback with args :cl3, after cl1, 3d
|
||||||
|
|
||||||
click cl1 href "http://localhost:9000/webpackUsage.html"
|
click cl1 href "http://localhost:9000/info.html"
|
||||||
click cl2 call clickByGantt()
|
click cl2 call clickByGantt()
|
||||||
click cl3 call clickByGantt("test1", test2, test3)
|
click cl3 call clickByGantt("test1", test2, test3)
|
||||||
|
|
||||||
@@ -102,9 +102,15 @@
|
|||||||
div.className = 'created-by-gant-click';
|
div.className = 'created-by-gant-click';
|
||||||
div.style = 'padding: 20px; background: green; color: white;';
|
div.style = 'padding: 20px; background: green; color: white;';
|
||||||
div.innerText = 'Clicked By Gant';
|
div.innerText = 'Clicked By Gant';
|
||||||
if (arg1) div.innerText += ' ' + arg1;
|
if (arg1) {
|
||||||
if (arg2) div.innerText += ' ' + arg2;
|
div.innerText += ' ' + arg1;
|
||||||
if (arg3) div.innerText += ' ' + arg3;
|
}
|
||||||
|
if (arg2) {
|
||||||
|
div.innerText += ' ' + arg2;
|
||||||
|
}
|
||||||
|
if (arg3) {
|
||||||
|
div.innerText += ' ' + arg3;
|
||||||
|
}
|
||||||
|
|
||||||
document.getElementsByTagName('body')[0].appendChild(div);
|
document.getElementsByTagName('body')[0].appendChild(div);
|
||||||
}
|
}
|
||||||
|
@@ -58,6 +58,23 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<pre id="diagram" class="mermaid">
|
<pre id="diagram" class="mermaid">
|
||||||
|
flowchart
|
||||||
|
classDef mainCategories fill:#f9d5e5, stroke:#233d4d,stroke-width:2px, font-weight:bold;
|
||||||
|
CS(Customer Awareness Journey):::mainCategories
|
||||||
|
</pre
|
||||||
|
>
|
||||||
|
<pre id="diagram" class="mermaid">
|
||||||
|
flowchart
|
||||||
|
Node1:::class1 --> Node2:::class2
|
||||||
|
Node1:::class1 --> Node3:::class2
|
||||||
|
Node3 --> Node4((I am a circle)):::larger
|
||||||
|
|
||||||
|
classDef class1 fill:lightblue
|
||||||
|
classDef class2 fill:pink
|
||||||
|
classDef larger font-size:30px,fill:yellow
|
||||||
|
</pre
|
||||||
|
>
|
||||||
|
<pre id="diagram" class="mermaid2">
|
||||||
stateDiagram-v2
|
stateDiagram-v2
|
||||||
[*] --> Still
|
[*] --> Still
|
||||||
Still --> [*]
|
Still --> [*]
|
||||||
@@ -73,7 +90,7 @@ flowchart RL
|
|||||||
a1 -- l2 --> a2
|
a1 -- l2 --> a2
|
||||||
end
|
end
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram" class="mermaid">
|
<pre id="diagram" class="mermaid2">
|
||||||
flowchart RL
|
flowchart RL
|
||||||
subgraph "`one`"
|
subgraph "`one`"
|
||||||
a1 -- l1 --> a2
|
a1 -- l1 --> a2
|
||||||
@@ -98,11 +115,11 @@ flowchart LR
|
|||||||
way`"]
|
way`"]
|
||||||
</pre
|
</pre
|
||||||
>
|
>
|
||||||
<pre id="diagram" class="mermaid">
|
<pre id="diagram" class="mermaid2">
|
||||||
classDiagram-v2
|
classDiagram-v2
|
||||||
note "I love this diagram!\nDo you love it?"
|
note "I love this diagram!\nDo you love it?"
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram" class="mermaid">
|
<pre id="diagram" class="mermaid2">
|
||||||
stateDiagram-v2
|
stateDiagram-v2
|
||||||
State1: The state with a note with minus - and plus + in it
|
State1: The state with a note with minus - and plus + in it
|
||||||
note left of State1
|
note left of State1
|
||||||
@@ -147,7 +164,7 @@ mindmap
|
|||||||
शान्तिः سلام 和平 `"]
|
शान्तिः سلام 和平 `"]
|
||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
<pre id="diagram" class="mermaid">
|
<pre id="diagram" class="mermaid2">
|
||||||
%%{init: {"flowchart": {"defaultRenderer": "elk"}} }%%
|
%%{init: {"flowchart": {"defaultRenderer": "elk"}} }%%
|
||||||
flowchart TB
|
flowchart TB
|
||||||
%% I could not figure out how to use double quotes in labels in Mermaid
|
%% I could not figure out how to use double quotes in labels in Mermaid
|
||||||
@@ -399,21 +416,31 @@ mindmap
|
|||||||
mermaid.parseError = function (err, hash) {
|
mermaid.parseError = function (err, hash) {
|
||||||
// console.error('Mermaid error: ', err);
|
// console.error('Mermaid error: ', err);
|
||||||
};
|
};
|
||||||
|
// mermaid.initialize({
|
||||||
|
// // theme: 'forest',
|
||||||
|
// startOnLoad: true,
|
||||||
|
// logLevel: 0,
|
||||||
|
// flowchart: {
|
||||||
|
// // defaultRenderer: 'elk',
|
||||||
|
// useMaxWidth: false,
|
||||||
|
// // htmlLabels: false,
|
||||||
|
// htmlLabels: true,
|
||||||
|
// },
|
||||||
|
// // htmlLabels: false,
|
||||||
|
// gantt: {
|
||||||
|
// useMaxWidth: false,
|
||||||
|
// },
|
||||||
|
// useMaxWidth: false,
|
||||||
|
// });
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
// theme: 'forest',
|
flowchart: { titleTopMargin: 10 },
|
||||||
startOnLoad: true,
|
fontFamily: 'courier',
|
||||||
logLevel: 0,
|
sequence: {
|
||||||
flowchart: {
|
actorFontFamily: 'courier',
|
||||||
// defaultRenderer: 'elk',
|
noteFontFamily: 'courier',
|
||||||
useMaxWidth: false,
|
messageFontFamily: 'courier',
|
||||||
// htmlLabels: false,
|
|
||||||
htmlLabels: true,
|
|
||||||
},
|
},
|
||||||
// htmlLabels: false,
|
fontSize: 16,
|
||||||
gantt: {
|
|
||||||
useMaxWidth: false,
|
|
||||||
},
|
|
||||||
useMaxWidth: false,
|
|
||||||
});
|
});
|
||||||
function callback() {
|
function callback() {
|
||||||
alert('It worked');
|
alert('It worked');
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
import mermaid2 from './mermaid.esm.mjs';
|
import mermaid from './mermaid.esm.mjs';
|
||||||
import externalExample from '../../packages/mermaid-example-diagram/dist/mermaid-example-diagram.core.mjs';
|
import externalExample from './mermaid-example-diagram.esm.mjs';
|
||||||
import zenUml from '../../packages/mermaid-zenuml/dist/mermaid-zenuml.core.mjs';
|
import zenUml from './mermaid-zenuml.esm.mjs';
|
||||||
|
|
||||||
function b64ToUtf8(str) {
|
function b64ToUtf8(str) {
|
||||||
return decodeURIComponent(escape(window.atob(str)));
|
return decodeURIComponent(escape(window.atob(str)));
|
||||||
@@ -45,9 +45,9 @@ const contentLoaded = async function () {
|
|||||||
document.getElementsByTagName('body')[0].appendChild(div);
|
document.getElementsByTagName('body')[0].appendChild(div);
|
||||||
}
|
}
|
||||||
|
|
||||||
await mermaid2.registerExternalDiagrams([externalExample, zenUml]);
|
await mermaid.registerExternalDiagrams([externalExample, zenUml]);
|
||||||
mermaid2.initialize(graphObj.mermaid);
|
mermaid.initialize(graphObj.mermaid);
|
||||||
await mermaid2.run();
|
await mermaid.run();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -95,18 +95,14 @@ const contentLoadedApi = async function () {
|
|||||||
divs[i] = div;
|
divs[i] = div;
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultE2eCnf = { theme: 'forest' };
|
const defaultE2eCnf = { theme: 'forest', startOnLoad: false };
|
||||||
|
|
||||||
const cnf = merge(defaultE2eCnf, graphObj.mermaid);
|
const cnf = merge(defaultE2eCnf, graphObj.mermaid);
|
||||||
|
|
||||||
mermaid2.initialize(cnf);
|
mermaid.initialize(cnf);
|
||||||
|
|
||||||
for (let i = 0; i < numCodes; i++) {
|
for (let i = 0; i < numCodes; i++) {
|
||||||
const { svg, bindFunctions } = await mermaid2.render(
|
const { svg, bindFunctions } = await mermaid.render('newid' + i, graphObj.code[i], divs[i]);
|
||||||
'newid' + i,
|
|
||||||
graphObj.code[i],
|
|
||||||
divs[i]
|
|
||||||
);
|
|
||||||
div.innerHTML = svg;
|
div.innerHTML = svg;
|
||||||
bindFunctions(div);
|
bindFunctions(div);
|
||||||
}
|
}
|
||||||
@@ -114,18 +110,21 @@ const contentLoadedApi = async function () {
|
|||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
div.id = 'block';
|
div.id = 'block';
|
||||||
div.className = 'mermaid';
|
div.className = 'mermaid';
|
||||||
console.warn('graphObj.mermaid', graphObj.mermaid);
|
console.warn('graphObj', graphObj);
|
||||||
document.getElementsByTagName('body')[0].appendChild(div);
|
document.getElementsByTagName('body')[0].appendChild(div);
|
||||||
mermaid2.initialize(graphObj.mermaid);
|
mermaid.initialize(graphObj.mermaid);
|
||||||
|
const { svg, bindFunctions } = await mermaid.render('newid', graphObj.code, div);
|
||||||
const { svg, bindFunctions } = await mermaid2.render('newid', graphObj.code, div);
|
|
||||||
div.innerHTML = svg;
|
div.innerHTML = svg;
|
||||||
|
console.log(div.innerHTML);
|
||||||
bindFunctions(div);
|
bindFunctions(div);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (typeof document !== 'undefined') {
|
if (typeof document !== 'undefined') {
|
||||||
|
mermaid.initialize({
|
||||||
|
startOnLoad: false,
|
||||||
|
});
|
||||||
/*!
|
/*!
|
||||||
* Wait for document loaded before starting the execution
|
* Wait for document loaded before starting the execution
|
||||||
*/
|
*/
|
||||||
|
@@ -1,19 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<style>
|
|
||||||
/* .mermaid {
|
|
||||||
font-family: "trebuchet ms", verdana, arial;;
|
|
||||||
} */
|
|
||||||
/* .mermaid {
|
|
||||||
font-family: 'arial';
|
|
||||||
} */
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="graph-to-be"></div>
|
|
||||||
<script type="module" charset="utf-8">
|
|
||||||
import './bundle-test.js';
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@@ -1,6 +1,5 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<script src="./viewer.js" type="module"></script>
|
|
||||||
<link href="https://fonts.googleapis.com/css?family=Montserrat&display=swap" rel="stylesheet" />
|
<link href="https://fonts.googleapis.com/css?family=Montserrat&display=swap" rel="stylesheet" />
|
||||||
<style>
|
<style>
|
||||||
.malware {
|
.malware {
|
||||||
@@ -33,12 +32,6 @@
|
|||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<script type="module">
|
<script type="module" src="./viewer.js"></script>
|
||||||
import mermaid from './mermaid.esm.mjs';
|
|
||||||
mermaid.initialize({
|
|
||||||
startOnLoad: false,
|
|
||||||
useMaxWidth: true,
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@@ -13,8 +13,8 @@
|
|||||||
// https://on.cypress.io/configuration
|
// https://on.cypress.io/configuration
|
||||||
// ***********************************************************
|
// ***********************************************************
|
||||||
|
|
||||||
|
import '@cypress/code-coverage/support';
|
||||||
import '@applitools/eyes-cypress/commands';
|
import '@applitools/eyes-cypress/commands';
|
||||||
|
|
||||||
// Import commands.js using ES2015 syntax:
|
// Import commands.js using ES2015 syntax:
|
||||||
import './commands';
|
import './commands';
|
||||||
|
|
||||||
|
@@ -2,7 +2,9 @@
|
|||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es2020",
|
"target": "es2020",
|
||||||
"lib": ["es2020", "dom"],
|
"lib": ["es2020", "dom"],
|
||||||
"types": ["cypress", "node"]
|
"types": ["cypress", "node"],
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"noEmit": true
|
||||||
},
|
},
|
||||||
"include": ["**/*.ts"]
|
"include": ["**/*.ts"]
|
||||||
}
|
}
|
||||||
|
@@ -154,6 +154,29 @@
|
|||||||
</pre>
|
</pre>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
|
<pre class="mermaid">
|
||||||
|
classDiagram
|
||||||
|
A1 --> B1
|
||||||
|
namespace A {
|
||||||
|
class A1 {
|
||||||
|
+foo : string
|
||||||
|
}
|
||||||
|
class A2 {
|
||||||
|
+bar : int
|
||||||
|
}
|
||||||
|
}
|
||||||
|
namespace B {
|
||||||
|
class B1 {
|
||||||
|
+foo : bool
|
||||||
|
}
|
||||||
|
class B2 {
|
||||||
|
+bar : float
|
||||||
|
}
|
||||||
|
}
|
||||||
|
A2 --> B2
|
||||||
|
</pre>
|
||||||
|
<hr />
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import mermaid from './mermaid.esm.mjs';
|
import mermaid from './mermaid.esm.mjs';
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
|
38
demos/dev/example.html
Normal file
38
demos/dev/example.html
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<!--Do not edit this file-->
|
||||||
|
<!--Duplicate this file to any name you like, run `pnpm dev`, open http://localhost:9000/dev/name.html to view-->
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>Mermaid development page</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<pre class="mermaid">info</pre>
|
||||||
|
|
||||||
|
<pre id="diagram" class="mermaid">
|
||||||
|
graph TB
|
||||||
|
a --> b
|
||||||
|
a --> c
|
||||||
|
b --> d
|
||||||
|
c --> d
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<div id="dynamicDiagram"></div>
|
||||||
|
|
||||||
|
<script type="module">
|
||||||
|
import mermaid from '/mermaid.esm.mjs';
|
||||||
|
mermaid.parseError = function (err, hash) {
|
||||||
|
console.error('Mermaid error: ', err);
|
||||||
|
};
|
||||||
|
mermaid.initialize({
|
||||||
|
startOnLoad: true,
|
||||||
|
logLevel: 0,
|
||||||
|
});
|
||||||
|
const value = `graph TD\nHello --> World`;
|
||||||
|
const el = document.getElementById('dynamicDiagram');
|
||||||
|
const { svg } = await mermaid.render('dd', value);
|
||||||
|
console.log(svg);
|
||||||
|
el.innerHTML = svg;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script src="/dev/reload.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
22
demos/dev/reload.js
Normal file
22
demos/dev/reload.js
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
// Connect to the server and reload the page if the server sends a reload message
|
||||||
|
const connectToEvents = () => {
|
||||||
|
const events = new EventSource('/events');
|
||||||
|
const loadTime = Date.now();
|
||||||
|
events.onmessage = (event) => {
|
||||||
|
const time = JSON.parse(event.data);
|
||||||
|
if (time && time > loadTime) {
|
||||||
|
location.reload();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
events.onerror = (error) => {
|
||||||
|
console.error(error);
|
||||||
|
events.close();
|
||||||
|
// Try to reconnect after 1 second in case of errors
|
||||||
|
setTimeout(connectToEvents, 1000);
|
||||||
|
};
|
||||||
|
events.onopen = () => {
|
||||||
|
console.log('Connected to live reload server');
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
setTimeout(connectToEvents, 500);
|
@@ -21,6 +21,8 @@
|
|||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
---
|
---
|
||||||
title: This is a title
|
title: This is a title
|
||||||
|
config:
|
||||||
|
theme: forest
|
||||||
---
|
---
|
||||||
erDiagram
|
erDiagram
|
||||||
%% title This is a title
|
%% title This is a title
|
||||||
@@ -108,6 +110,20 @@
|
|||||||
}
|
}
|
||||||
MANUFACTURER only one to zero or more CAR : makes
|
MANUFACTURER only one to zero or more CAR : makes
|
||||||
</pre>
|
</pre>
|
||||||
|
<hr />
|
||||||
|
|
||||||
|
<pre class="mermaid">
|
||||||
|
erDiagram
|
||||||
|
p[Person] {
|
||||||
|
string firstName
|
||||||
|
string lastName
|
||||||
|
}
|
||||||
|
a["Customer Account"] {
|
||||||
|
string email
|
||||||
|
}
|
||||||
|
p ||--o| a : has
|
||||||
|
</pre>
|
||||||
|
<hr />
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import mermaid from './mermaid.esm.mjs';
|
import mermaid from './mermaid.esm.mjs';
|
||||||
|
@@ -123,6 +123,13 @@
|
|||||||
|
|
||||||
<h3>flowchart</h3>
|
<h3>flowchart</h3>
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
|
---
|
||||||
|
title: This is another complicated flow
|
||||||
|
config:
|
||||||
|
theme: base
|
||||||
|
flowchart:
|
||||||
|
curve: cardinal
|
||||||
|
---
|
||||||
flowchart LR
|
flowchart LR
|
||||||
sid-B3655226-6C29-4D00-B685-3D5C734DC7E1["
|
sid-B3655226-6C29-4D00-B685-3D5C734DC7E1["
|
||||||
|
|
||||||
@@ -1505,6 +1512,34 @@
|
|||||||
</pre>
|
</pre>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
|
<pre class="mermaid">
|
||||||
|
graph TD
|
||||||
|
A([Start]) ==> B[Step 1]
|
||||||
|
B ==> C{Flow 1}
|
||||||
|
C -- Choice 1.1 --> D[Step 2.1]
|
||||||
|
C -- Choice 1.3 --> I[Step 2.3]
|
||||||
|
C == Choice 1.2 ==> E[Step 2.2]
|
||||||
|
D --> F{Flow 2}
|
||||||
|
E ==> F{Flow 2}
|
||||||
|
F{Flow 2} == Choice 2.1 ==> H[Feedback node]
|
||||||
|
H[Feedback node] ==> B[Step 1]
|
||||||
|
F{Flow 2} == Choice 2.2 ==> G((Finish))
|
||||||
|
|
||||||
|
linkStyle 0,1,4,6,7,8,9 stroke:gold, stroke-width:4px
|
||||||
|
|
||||||
|
classDef active_node fill:#0CF,stroke:#09F,stroke-width:6px
|
||||||
|
classDef unactive_node fill:#e0e0e0,stroke:#bdbdbd,stroke-width:3px
|
||||||
|
classDef bugged_node fill:#F88,stroke:#F22,stroke-width:3px
|
||||||
|
classDef start_node,finish_node fill:#3B1,stroke:#391,stroke-width:8px
|
||||||
|
|
||||||
|
class A start_node;
|
||||||
|
class B,C,E,F,H active_node;
|
||||||
|
class D unactive_node;
|
||||||
|
class G finish_node;
|
||||||
|
class I bugged_node
|
||||||
|
</pre>
|
||||||
|
<hr />
|
||||||
|
|
||||||
<h1 id="link-clicked">Anchor for "link-clicked" test</h1>
|
<h1 id="link-clicked">Anchor for "link-clicked" test</h1>
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
|
@@ -75,6 +75,9 @@
|
|||||||
<li>
|
<li>
|
||||||
<h2><a href="./zenuml.html">ZenUML</a></h2>
|
<h2><a href="./zenuml.html">ZenUML</a></h2>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<h2><a href="./sankey.html">Sankey</a></h2>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@@ -7,7 +7,6 @@
|
|||||||
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgo=" />
|
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgo=" />
|
||||||
<style>
|
<style>
|
||||||
div.mermaid {
|
div.mermaid {
|
||||||
/* font-family: 'trebuchet ms', verdana, arial; */
|
|
||||||
font-family: 'Courier New', Courier, monospace !important;
|
font-family: 'Courier New', Courier, monospace !important;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -17,37 +16,32 @@
|
|||||||
<h1>Pie chart demos</h1>
|
<h1>Pie chart demos</h1>
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
pie title Pets adopted by volunteers
|
pie title Pets adopted by volunteers
|
||||||
accTitle: simple pie char demo
|
accTitle: simple pie char demo
|
||||||
accDescr: pie chart with 3 sections: dogs, cats, rats. Most are dogs.
|
accDescr: pie chart with 3 sections: dogs, cats, rats. Most are dogs.
|
||||||
"Dogs" : 386
|
"Dogs": 386
|
||||||
"Cats" : 85
|
"Cats": 85
|
||||||
"Rats" : 15
|
"Rats": 15
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
%%{init: {"pie": {"textPosition": 0.9}, "themeVariables": {"pieOuterStrokeWidth": "5px"}} }%%
|
%%{init: {"pie": {"textPosition": 0.9}, "themeVariables": {"pieOuterStrokeWidth": "5px"}}}%%
|
||||||
pie
|
pie
|
||||||
title Key elements in Product X
|
title Key elements in Product X
|
||||||
accTitle: Key elements in Product X
|
accTitle: Key elements in Product X
|
||||||
accDescr: This is a pie chart showing the key elements in Product X.
|
accDescr: This is a pie chart showing the key elements in Product X.
|
||||||
"Calcium" : 42.96
|
"Calcium": 42.96
|
||||||
"Potassium" : 50.05
|
"Potassium": 50.05
|
||||||
"Magnesium" : 10.01
|
"Magnesium": 10.01
|
||||||
"Iron" : 5
|
"Iron": 5
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import mermaid from './mermaid.esm.mjs';
|
import mermaid from '/mermaid.esm.mjs';
|
||||||
mermaid.initialize({
|
mermaid.initialize({
|
||||||
theme: 'forest',
|
theme: 'forest',
|
||||||
// themeCSS: '.node rect { fill: red; }',
|
|
||||||
logLevel: 3,
|
logLevel: 3,
|
||||||
securityLevel: 'loose',
|
securityLevel: 'loose',
|
||||||
// flowchart: { curve: 'basis' },
|
|
||||||
// gantt: { axisFormat: '%m/%d/%Y' },
|
|
||||||
sequence: { actorMargin: 50 },
|
|
||||||
// sequenceDiagram: { actorMargin: 300 } // deprecated
|
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
124
demos/sankey.html
Normal file
124
demos/sankey.html
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en" xmlns="http://www.w3.org/1999/html">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||||
|
<title>Sankey Mermaid Quick Test Page</title>
|
||||||
|
<link rel="icon" type="image/png" href="data:image/png;base64,iVBORw0KGgo=" />
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<h1>Sankey diagram demos</h1>
|
||||||
|
<h2>FY20-21 Performance</h2>
|
||||||
|
<pre class="mermaid">
|
||||||
|
---
|
||||||
|
config:
|
||||||
|
sankey:
|
||||||
|
showValues: true
|
||||||
|
prefix: $
|
||||||
|
suffix: B
|
||||||
|
width: 800
|
||||||
|
nodeAlignment: left
|
||||||
|
---
|
||||||
|
sankey-beta
|
||||||
|
Revenue,Expenses,10
|
||||||
|
Revenue,Profit,10
|
||||||
|
Expenses,Manufacturing,5
|
||||||
|
Expenses,Tax,3
|
||||||
|
Expenses,Research,2
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<h2>Energy flow</h2>
|
||||||
|
<pre class="mermaid">
|
||||||
|
---
|
||||||
|
config:
|
||||||
|
sankey:
|
||||||
|
showValues: false
|
||||||
|
width: 1200
|
||||||
|
height: 600
|
||||||
|
linkColor: gradient
|
||||||
|
nodeAlignment: justify
|
||||||
|
---
|
||||||
|
sankey-beta
|
||||||
|
|
||||||
|
Agricultural 'waste',Bio-conversion,124.729
|
||||||
|
Bio-conversion,Liquid,0.597
|
||||||
|
Bio-conversion,Losses,26.862
|
||||||
|
Bio-conversion,Solid,280.322
|
||||||
|
Bio-conversion,Gas,81.144
|
||||||
|
Biofuel imports,Liquid,35
|
||||||
|
Biomass imports,Solid,35
|
||||||
|
Coal imports,Coal,11.606
|
||||||
|
Coal reserves,Coal,63.965
|
||||||
|
Coal,Solid,75.571
|
||||||
|
District heating,Industry,10.639
|
||||||
|
District heating,Heating and cooling - commercial,22.505
|
||||||
|
District heating,Heating and cooling - homes,46.184
|
||||||
|
Electricity grid,Over generation / exports,104.453
|
||||||
|
Electricity grid,Heating and cooling - homes,113.726
|
||||||
|
Electricity grid,H2 conversion,27.14
|
||||||
|
Electricity grid,Industry,342.165
|
||||||
|
Electricity grid,Road transport,37.797
|
||||||
|
Electricity grid,Agriculture,4.412
|
||||||
|
Electricity grid,Heating and cooling - commercial,40.858
|
||||||
|
Electricity grid,Losses,56.691
|
||||||
|
Electricity grid,Rail transport,7.863
|
||||||
|
Electricity grid,Lighting & appliances - commercial,90.008
|
||||||
|
Electricity grid,Lighting & appliances - homes,93.494
|
||||||
|
Gas imports,Ngas,40.719
|
||||||
|
Gas reserves,Ngas,82.233
|
||||||
|
Gas,Heating and cooling - commercial,0.129
|
||||||
|
Gas,Losses,1.401
|
||||||
|
Gas,Thermal generation,151.891
|
||||||
|
Gas,Agriculture,2.096
|
||||||
|
Gas,Industry,48.58
|
||||||
|
Geothermal,Electricity grid,7.013
|
||||||
|
H2 conversion,H2,20.897
|
||||||
|
H2 conversion,Losses,6.242
|
||||||
|
H2,Road transport,20.897
|
||||||
|
Hydro,Electricity grid,6.995
|
||||||
|
Liquid,Industry,121.066
|
||||||
|
Liquid,International shipping,128.69
|
||||||
|
Liquid,Road transport,135.835
|
||||||
|
Liquid,Domestic aviation,14.458
|
||||||
|
Liquid,International aviation,206.267
|
||||||
|
Liquid,Agriculture,3.64
|
||||||
|
Liquid,National navigation,33.218
|
||||||
|
Liquid,Rail transport,4.413
|
||||||
|
Marine algae,Bio-conversion,4.375
|
||||||
|
Ngas,Gas,122.952
|
||||||
|
Nuclear,Thermal generation,839.978
|
||||||
|
Oil imports,Oil,504.287
|
||||||
|
Oil reserves,Oil,107.703
|
||||||
|
Oil,Liquid,611.99
|
||||||
|
Other waste,Solid,56.587
|
||||||
|
Other waste,Bio-conversion,77.81
|
||||||
|
Pumped heat,Heating and cooling - homes,193.026
|
||||||
|
Pumped heat,Heating and cooling - commercial,70.672
|
||||||
|
Solar PV,Electricity grid,59.901
|
||||||
|
Solar Thermal,Heating and cooling - homes,19.263
|
||||||
|
Solar,Solar Thermal,19.263
|
||||||
|
Solar,Solar PV,59.901
|
||||||
|
Solid,Agriculture,0.882
|
||||||
|
Solid,Thermal generation,400.12
|
||||||
|
Solid,Industry,46.477
|
||||||
|
Thermal generation,Electricity grid,525.531
|
||||||
|
Thermal generation,Losses,787.129
|
||||||
|
Thermal generation,District heating,79.329
|
||||||
|
Tidal,Electricity grid,9.452
|
||||||
|
UK land based bioenergy,Bio-conversion,182.01
|
||||||
|
Wave,Electricity grid,19.013
|
||||||
|
Wind,Electricity grid,289.366
|
||||||
|
</pre>
|
||||||
|
|
||||||
|
<script type="module">
|
||||||
|
import mermaid from './mermaid.esm.mjs';
|
||||||
|
mermaid.initialize({
|
||||||
|
theme: 'default',
|
||||||
|
logLevel: 3,
|
||||||
|
securityLevel: 'loose',
|
||||||
|
startOnLoad: true,
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@@ -1,9 +1,36 @@
|
|||||||
version: '3.9'
|
version: '3.9'
|
||||||
services:
|
services:
|
||||||
mermaid:
|
mermaid:
|
||||||
image: node:18.16.0-alpine3.18
|
image: node:18.17.1-alpine3.18
|
||||||
stdin_open: true
|
stdin_open: true
|
||||||
tty: true
|
tty: true
|
||||||
working_dir: /mermaid
|
working_dir: /mermaid
|
||||||
|
mem_limit: '4G'
|
||||||
|
environment:
|
||||||
|
- NODE_OPTIONS=--max_old_space_size=4096
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/mermaid
|
- ./:/mermaid
|
||||||
|
- root_cache:/root/.cache
|
||||||
|
- root_local:/root/.local
|
||||||
|
- root_npm:/root/.npm
|
||||||
|
ports:
|
||||||
|
- 9000:9000
|
||||||
|
- 3333:3333
|
||||||
|
cypress:
|
||||||
|
image: cypress/included:12.17.4
|
||||||
|
stdin_open: true
|
||||||
|
tty: true
|
||||||
|
working_dir: /mermaid
|
||||||
|
mem_limit: '2G'
|
||||||
|
entrypoint: cypress
|
||||||
|
environment:
|
||||||
|
- DISPLAY
|
||||||
|
volumes:
|
||||||
|
- ./:/mermaid
|
||||||
|
- /tmp/.X11-unix:/tmp/.X11-unix
|
||||||
|
network_mode: host
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
root_cache:
|
||||||
|
root_local:
|
||||||
|
root_npm:
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user