@figtreejs/core 0.0.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/CHANGELOG.md +9 -0
  2. package/eslint.config.js +9 -0
  3. package/package.json +76 -0
  4. package/src/@custom-types/normalize-svg-path.d.ts +13 -0
  5. package/src/@custom-types/parse-svg-path.d.ts +8 -0
  6. package/src/@custom-types/svg-path-types.d.ts +37 -0
  7. package/src/bauble-makers/makers.ts +112 -0
  8. package/src/bauble-makers/set-up-baubles.ts +197 -0
  9. package/src/bauble-makers/utils.ts +61 -0
  10. package/src/components/baubles/bauble.tsx +61 -0
  11. package/src/components/baubles/branches.tsx +13 -0
  12. package/src/components/baubles/clades/cartoon.tsx +68 -0
  13. package/src/components/baubles/clades/highlight.tsx +96 -0
  14. package/src/components/baubles/clades/index.ts +1 -0
  15. package/src/components/baubles/clades.tsx +45 -0
  16. package/src/components/baubles/helpers.tsx +62 -0
  17. package/src/components/baubles/index.ts +16 -0
  18. package/src/components/baubles/labels.tsx +38 -0
  19. package/src/components/baubles/nodes.tsx +51 -0
  20. package/src/components/baubles/shapes/branch.tsx +53 -0
  21. package/src/components/baubles/shapes/circle.tsx +64 -0
  22. package/src/components/baubles/shapes/index.ts +9 -0
  23. package/src/components/baubles/shapes/label.tsx +104 -0
  24. package/src/components/baubles/shapes/rectangle.tsx +83 -0
  25. package/src/components/baubles/types.ts +99 -0
  26. package/src/components/decorations/axis/axis-types.ts +123 -0
  27. package/src/components/decorations/axis/axis.tsx +21 -0
  28. package/src/components/decorations/axis/index.ts +2 -0
  29. package/src/components/decorations/axis/polar-axis-bars.tsx +102 -0
  30. package/src/components/decorations/axis/polar-axis.tsx +175 -0
  31. package/src/components/decorations/axis/rectangular-axis-bars.tsx +53 -0
  32. package/src/components/decorations/axis/rectangular-axis.tsx +151 -0
  33. package/src/components/decorations/index.ts +2 -0
  34. package/src/components/decorations/legend/discrete-legend.tsx +93 -0
  35. package/src/components/decorations/legend/index.ts +1 -0
  36. package/src/components/decorations/legend/legend.tsx +1 -0
  37. package/src/components/figtree/figtree-types.ts +69 -0
  38. package/src/components/figtree/figtree.tsx +136 -0
  39. package/src/components/figtree/index.ts +3 -0
  40. package/src/components/hoc/index.ts +7 -0
  41. package/src/components/hoc/with-branch.tsx +148 -0
  42. package/src/components/hoc/with-branches.tsx +54 -0
  43. package/src/components/hoc/with-clades.tsx +47 -0
  44. package/src/components/hoc/with-node.tsx +183 -0
  45. package/src/components/hoc/with-nodes.tsx +45 -0
  46. package/src/components/index.ts +4 -0
  47. package/src/context/aminated-context.ts +3 -0
  48. package/src/context/dimension-context.ts +22 -0
  49. package/src/context/layout-context.ts +20 -0
  50. package/src/context/scale-context.ts +12 -0
  51. package/src/evo/index.ts +1 -0
  52. package/src/evo/tree/index.ts +5 -0
  53. package/src/evo/tree/mcc-tree.ts +0 -0
  54. package/src/evo/tree/normalized-tree/immutable-tree-helpers.ts +136 -0
  55. package/src/evo/tree/normalized-tree/immutable-tree.test.ts +158 -0
  56. package/src/evo/tree/normalized-tree/immutable-tree.ts +1365 -0
  57. package/src/evo/tree/normalized-tree/index.ts +3 -0
  58. package/src/evo/tree/parsers/annotation-parser.ts +276 -0
  59. package/src/evo/tree/parsers/index.ts +3 -0
  60. package/src/evo/tree/parsers/newick-character-parser.ts +246 -0
  61. package/src/evo/tree/parsers/newick-parsing.ts +22 -0
  62. package/src/evo/tree/parsers/nexus-parser.ts +12 -0
  63. package/src/evo/tree/parsers/nexus-parsing.ts +68 -0
  64. package/src/evo/tree/parsers/parsing.test.ts +289 -0
  65. package/src/evo/tree/parsers/stream-reader/index.ts +1 -0
  66. package/src/evo/tree/parsers/stream-reader/newick-importer.txt +395 -0
  67. package/src/evo/tree/parsers/stream-reader/nexus-importer.test.ts +99 -0
  68. package/src/evo/tree/parsers/stream-reader/nexus-importer.ts +293 -0
  69. package/src/evo/tree/parsers/stream-reader/nexus-tokenizer.ts +77 -0
  70. package/src/evo/tree/parsers/stream-reader/nexus-transform-stream.txt +109 -0
  71. package/src/evo/tree/taxa/helper-functions.ts +46 -0
  72. package/src/evo/tree/taxa/index.ts +1 -0
  73. package/src/evo/tree/taxa/taxon.ts +116 -0
  74. package/src/evo/tree/traversals/index.ts +1 -0
  75. package/src/evo/tree/traversals/preorder-traversal.ts +89 -0
  76. package/src/evo/tree/traversals/traversal-types.ts +6 -0
  77. package/src/evo/tree/tree-types.ts +197 -0
  78. package/src/evo/tree/utilities.ts +44 -0
  79. package/src/index.ts +6 -0
  80. package/src/layouts/functional/index.ts +2 -0
  81. package/src/layouts/functional/radial-layout.ts +150 -0
  82. package/src/layouts/functional/rectangular-layout.ts +71 -0
  83. package/src/layouts/index.ts +3 -0
  84. package/src/layouts/layout-interface.ts +90 -0
  85. package/src/layouts/types.ts +32 -0
  86. package/src/path.helpers.ts +81 -0
  87. package/src/store/polar-scale.ts +145 -0
  88. package/src/store/store.ts +144 -0
  89. package/src/tests/baubles/__snapshots__/branch-labels.test.tsx.snap +901 -0
  90. package/src/tests/baubles/__snapshots__/node-labels.test.tsx.snap +1516 -0
  91. package/src/tests/baubles/branch-labels.test.tsx +103 -0
  92. package/src/tests/baubles/label.svg +131 -0
  93. package/src/tests/baubles/node-labels.test.tsx +126 -0
  94. package/src/tests/clades/__snapshots__/cartoon.test.tsx.snap +327 -0
  95. package/src/tests/clades/__snapshots__/highlight.test.tsx.snap +337 -0
  96. package/src/tests/clades/cartoon.test.tsx +65 -0
  97. package/src/tests/clades/highlight.test.tsx +66 -0
  98. package/src/tests/figtree/__snapshots__/figtree.test.tsx.snap +761 -0
  99. package/src/tests/figtree/figtree.test.tsx +123 -0
  100. package/src/tests/figtree/simple.svg +47 -0
  101. package/src/tests/layouts/radiallayout.test.ts +23 -0
  102. package/src/tests/layouts/rectangularlayout.test.ts +65 -0
  103. package/src/tests/shapes/branch.test.tsx +40 -0
  104. package/src/tests/shapes/circle.test.tsx +47 -0
  105. package/src/tests/shapes/label.test.tsx +101 -0
  106. package/src/tests/shapes/rectangle.test.tsx +67 -0
  107. package/src/tests/shapes/types.ts +1 -0
  108. package/src/utils.ts +57 -0
  109. package/tsconfig.json +12 -0
  110. package/vite.config.ts +34 -0
  111. package/vitetest.config.ts +11 -0
@@ -0,0 +1,337 @@
1
+ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+ exports[`Figures > renders a single highlight 1`] = `
4
+ {
5
+ "asFragment": [Function],
6
+ "baseElement": <body>
7
+ <div>
8
+ <svg
9
+ data-testid="figure"
10
+ height="400px"
11
+ width="400px"
12
+ xmlns="http://www.w3.org/2000/svg"
13
+ >
14
+ <g>
15
+ <g
16
+ transform="translate(10,10)"
17
+ >
18
+ <g
19
+ class="branch-layer"
20
+ >
21
+ <path
22
+ d="M 0.001 237.5 C0.001,237.5 0,95 0,95 C0,95 126.66666666666666,95.0005 190,95.00075000000001 C190,95.00075000000001 221.66666666666666,95.00087500000001 237.5,95.0009375 C237.5,95.0009375 245.41666666666666,95.00096875 249.375,95.000984375 C249.375,95.000984375 251.35416666666666,95.0009921875 252.34375,95.00099609375 C252.34375,95.00099609375 253.33333333333331,95.001 253.33333333333331,95.001 "
23
+ fill="none"
24
+ stroke="black"
25
+ stroke-width="2"
26
+ />
27
+ <path
28
+ d="M 253.33433333333332 95 C253.33433333333332,95 253.33333333333331,0 253.33333333333331,0 C253.33333333333331,0 316.66666666666663,0.0005 348.3333333333333,0.00075 C348.3333333333333,0.00075 364.16666666666663,0.000875 372.0833333333333,0.0009375 C372.0833333333333,0.0009375 376.04166666666663,0.00096875 378.0208333333333,0.000984375 C378.0208333333333,0.000984375 379.01041666666663,0.0009921875 379.5052083333333,0.00099609375 C379.5052083333333,0.00099609375 380,0.001 380,0.001 "
29
+ fill="none"
30
+ stroke="black"
31
+ stroke-width="2"
32
+ />
33
+ <path
34
+ d="M 253.33433333333332 95 C253.33433333333332,95 253.33333333333331,190 253.33333333333331,190 C253.33333333333331,190 316.66666666666663,190.0005 348.3333333333333,190.00074999999998 C348.3333333333333,190.00074999999998 364.16666666666663,190.000875 372.0833333333333,190.00093750000002 C372.0833333333333,190.00093750000002 376.04166666666663,190.00096875000003 378.0208333333333,190.00098437500003 C378.0208333333333,190.00098437500003 379.01041666666663,190.0009921875 379.5052083333333,190.00099609375002 C379.5052083333333,190.00099609375002 380,190.001 380,190.001 "
35
+ fill="none"
36
+ stroke="black"
37
+ stroke-width="2"
38
+ />
39
+ <path
40
+ d="M 0.001 237.5 C0.001,237.5 0,380 0,380 C0,380 63.33333333333333,380.0005 95,380.00075 C95,380.00075 110.83333333333333,380.00087499999995 118.75,380.00093749999996 C118.75,380.00093749999996 122.70833333333333,380.00096874999997 124.6875,380.000984375 C124.6875,380.000984375 125.67708333333333,380.00099218749995 126.171875,380.00099609374996 C126.171875,380.00099609374996 126.66666666666666,380.001 126.66666666666666,380.001 "
41
+ fill="none"
42
+ stroke="black"
43
+ stroke-width="2"
44
+ />
45
+ </g>
46
+ <g
47
+ class="node-layer"
48
+ >
49
+ <rect
50
+ class="node-shape"
51
+ fill="red"
52
+ height="190"
53
+ opacity="0.5"
54
+ width="126.66666666666669"
55
+ x="253.33333333333331"
56
+ y="0"
57
+ />
58
+ </g>
59
+ </g>
60
+ </g>
61
+ </svg>
62
+ </div>
63
+ </body>,
64
+ "container": <div>
65
+ <svg
66
+ data-testid="figure"
67
+ height="400px"
68
+ width="400px"
69
+ xmlns="http://www.w3.org/2000/svg"
70
+ >
71
+ <g>
72
+ <g
73
+ transform="translate(10,10)"
74
+ >
75
+ <g
76
+ class="branch-layer"
77
+ >
78
+ <path
79
+ d="M 0.001 237.5 C0.001,237.5 0,95 0,95 C0,95 126.66666666666666,95.0005 190,95.00075000000001 C190,95.00075000000001 221.66666666666666,95.00087500000001 237.5,95.0009375 C237.5,95.0009375 245.41666666666666,95.00096875 249.375,95.000984375 C249.375,95.000984375 251.35416666666666,95.0009921875 252.34375,95.00099609375 C252.34375,95.00099609375 253.33333333333331,95.001 253.33333333333331,95.001 "
80
+ fill="none"
81
+ stroke="black"
82
+ stroke-width="2"
83
+ />
84
+ <path
85
+ d="M 253.33433333333332 95 C253.33433333333332,95 253.33333333333331,0 253.33333333333331,0 C253.33333333333331,0 316.66666666666663,0.0005 348.3333333333333,0.00075 C348.3333333333333,0.00075 364.16666666666663,0.000875 372.0833333333333,0.0009375 C372.0833333333333,0.0009375 376.04166666666663,0.00096875 378.0208333333333,0.000984375 C378.0208333333333,0.000984375 379.01041666666663,0.0009921875 379.5052083333333,0.00099609375 C379.5052083333333,0.00099609375 380,0.001 380,0.001 "
86
+ fill="none"
87
+ stroke="black"
88
+ stroke-width="2"
89
+ />
90
+ <path
91
+ d="M 253.33433333333332 95 C253.33433333333332,95 253.33333333333331,190 253.33333333333331,190 C253.33333333333331,190 316.66666666666663,190.0005 348.3333333333333,190.00074999999998 C348.3333333333333,190.00074999999998 364.16666666666663,190.000875 372.0833333333333,190.00093750000002 C372.0833333333333,190.00093750000002 376.04166666666663,190.00096875000003 378.0208333333333,190.00098437500003 C378.0208333333333,190.00098437500003 379.01041666666663,190.0009921875 379.5052083333333,190.00099609375002 C379.5052083333333,190.00099609375002 380,190.001 380,190.001 "
92
+ fill="none"
93
+ stroke="black"
94
+ stroke-width="2"
95
+ />
96
+ <path
97
+ d="M 0.001 237.5 C0.001,237.5 0,380 0,380 C0,380 63.33333333333333,380.0005 95,380.00075 C95,380.00075 110.83333333333333,380.00087499999995 118.75,380.00093749999996 C118.75,380.00093749999996 122.70833333333333,380.00096874999997 124.6875,380.000984375 C124.6875,380.000984375 125.67708333333333,380.00099218749995 126.171875,380.00099609374996 C126.171875,380.00099609374996 126.66666666666666,380.001 126.66666666666666,380.001 "
98
+ fill="none"
99
+ stroke="black"
100
+ stroke-width="2"
101
+ />
102
+ </g>
103
+ <g
104
+ class="node-layer"
105
+ >
106
+ <rect
107
+ class="node-shape"
108
+ fill="red"
109
+ height="190"
110
+ opacity="0.5"
111
+ width="126.66666666666669"
112
+ x="253.33333333333331"
113
+ y="0"
114
+ />
115
+ </g>
116
+ </g>
117
+ </g>
118
+ </svg>
119
+ </div>,
120
+ "debug": [Function],
121
+ "findAllByAltText": [Function],
122
+ "findAllByDisplayValue": [Function],
123
+ "findAllByLabelText": [Function],
124
+ "findAllByPlaceholderText": [Function],
125
+ "findAllByRole": [Function],
126
+ "findAllByTestId": [Function],
127
+ "findAllByText": [Function],
128
+ "findAllByTitle": [Function],
129
+ "findByAltText": [Function],
130
+ "findByDisplayValue": [Function],
131
+ "findByLabelText": [Function],
132
+ "findByPlaceholderText": [Function],
133
+ "findByRole": [Function],
134
+ "findByTestId": [Function],
135
+ "findByText": [Function],
136
+ "findByTitle": [Function],
137
+ "getAllByAltText": [Function],
138
+ "getAllByDisplayValue": [Function],
139
+ "getAllByLabelText": [Function],
140
+ "getAllByPlaceholderText": [Function],
141
+ "getAllByRole": [Function],
142
+ "getAllByTestId": [Function],
143
+ "getAllByText": [Function],
144
+ "getAllByTitle": [Function],
145
+ "getByAltText": [Function],
146
+ "getByDisplayValue": [Function],
147
+ "getByLabelText": [Function],
148
+ "getByPlaceholderText": [Function],
149
+ "getByRole": [Function],
150
+ "getByTestId": [Function],
151
+ "getByText": [Function],
152
+ "getByTitle": [Function],
153
+ "queryAllByAltText": [Function],
154
+ "queryAllByDisplayValue": [Function],
155
+ "queryAllByLabelText": [Function],
156
+ "queryAllByPlaceholderText": [Function],
157
+ "queryAllByRole": [Function],
158
+ "queryAllByTestId": [Function],
159
+ "queryAllByText": [Function],
160
+ "queryAllByTitle": [Function],
161
+ "queryByAltText": [Function],
162
+ "queryByDisplayValue": [Function],
163
+ "queryByLabelText": [Function],
164
+ "queryByPlaceholderText": [Function],
165
+ "queryByRole": [Function],
166
+ "queryByTestId": [Function],
167
+ "queryByText": [Function],
168
+ "queryByTitle": [Function],
169
+ "rerender": [Function],
170
+ "unmount": [Function],
171
+ }
172
+ `;
173
+
174
+ exports[`Figures > renders a single polar highlight 1`] = `
175
+ {
176
+ "asFragment": [Function],
177
+ "baseElement": <body>
178
+ <div>
179
+ <svg
180
+ data-testid="figure"
181
+ height="400px"
182
+ width="400px"
183
+ xmlns="http://www.w3.org/2000/svg"
184
+ >
185
+ <g>
186
+ <g
187
+ transform="translate(10,10)"
188
+ >
189
+ <g
190
+ class="branch-layer"
191
+ >
192
+ <path
193
+ d="M 191.0442564366689 190 C191.0442564366689,190 186.399298787742,253.16276972672102 184.07681996327852,284.7441545900815 C184.07681996327852,284.7441545900815 182.9155805510468,300.5348470217618 182.33496084493095,308.4301932376019 C182.33496084493095,308.4301932376019 182.04465099187303,312.37786634552197 181.89949606534407,314.351702899482 C181.89949606534407,314.351702899482 181.82691860207956,315.338621176462 181.79062987044733,315.832080314952 C181.79062987044733,315.832080314952 181.77248550463122,316.078809884197 181.76341332172314,316.20217466881957 C181.76341332172314,316.20217466881957 181.75434113881508,316.32553945344205 181.75434113881508,316.32553945344205 "
194
+ fill="none"
195
+ stroke="black"
196
+ stroke-width="2"
197
+ />
198
+ <path
199
+ d="M 181.75434113881508 316.32553945344205 C247.8501082366655,321.1861882228226 306.51906010557065,274.27508823362695 316.31858118777706,208.729335348547 C316.31858118777706,208.729335348547 347.6371623755541,213.41166918568376 363.2964529694426,215.75283610425214 C363.2964529694426,215.75283610425214 371.12609826638686,216.92341956353633 375.040920914859,217.5087112931784 C375.040920914859,217.5087112931784 376.998332239095,217.80135715799946 377.97703790121307,217.94768009041 C377.97703790121307,217.94768009041 378.4663907322721,218.02084155661527 378.7110671478016,218.0574222897179 C378.7110671478016,218.0574222897179 378.9557435633311,218.09400302282052 378.9557435633311,218.09400302282052 "
200
+ fill="none"
201
+ stroke="black"
202
+ stroke-width="2"
203
+ />
204
+ <path
205
+ d="M 181.75434113881508 316.32553945344205 C115.65857404096461,311.4648906840615 64.4833022968594,256.4759029000588 64.37775041784722,190.20173603608833 C64.37775041784722,190.20173603608833 32.7111239131418,190.2521700451104 16.877810660789084,190.27738704962144 C16.877810660789084,190.27738704962144 8.961154034612727,190.28999555187698 5.002825721524549,190.29629980300473 C5.002825721524549,190.29629980300473 3.02366156498046,190.2994519285686 2.034079486708415,190.30102799135057 C2.034079486708415,190.30102799135057 1.539288447572393,190.30181602274155 1.2918929280043818,190.302210038437 C1.2918929280043818,190.302210038437 1.0444974084363707,190.3026040541325 1.0444974084363707,190.3026040541325 "
206
+ fill="none"
207
+ stroke="black"
208
+ stroke-width="2"
209
+ />
210
+ <path
211
+ d="M 191.0442564366689 190 C191.0442564366689,190 222.3477640962031,185.21793078393245 237.9995179259702,182.82689617589867 C237.9995179259702,182.82689617589867 245.82539484085373,181.6313788718818 249.73833329829552,181.03362021987334 C249.73833329829552,181.03362021987334 251.6948025270164,180.73474089386912 252.67303714137685,180.585301230867 C252.67303714137685,180.585301230867 253.1621544485571,180.51058139936595 253.4067131021472,180.47322148361542 C253.4067131021472,180.47322148361542 253.52899242894225,180.45454152574015 253.5901320923398,180.44520154680254 C253.5901320923398,180.44520154680254 253.6512717557373,180.4358615678649 253.6512717557373,180.4358615678649 "
212
+ fill="none"
213
+ stroke="black"
214
+ stroke-width="2"
215
+ />
216
+ </g>
217
+ <g
218
+ class="node-layer"
219
+ >
220
+ <path
221
+ d="M-195,0.311A195,195,0,0,0,192.857,28.833L125.274,18.729A126.667,126.667,0,0,1,-126.667,0.202Z"
222
+ fill="red"
223
+ opacity="0.5"
224
+ transform="translate(191.0442564366689,190)"
225
+ />
226
+ </g>
227
+ </g>
228
+ </g>
229
+ </svg>
230
+ </div>
231
+ </body>,
232
+ "container": <div>
233
+ <svg
234
+ data-testid="figure"
235
+ height="400px"
236
+ width="400px"
237
+ xmlns="http://www.w3.org/2000/svg"
238
+ >
239
+ <g>
240
+ <g
241
+ transform="translate(10,10)"
242
+ >
243
+ <g
244
+ class="branch-layer"
245
+ >
246
+ <path
247
+ d="M 191.0442564366689 190 C191.0442564366689,190 186.399298787742,253.16276972672102 184.07681996327852,284.7441545900815 C184.07681996327852,284.7441545900815 182.9155805510468,300.5348470217618 182.33496084493095,308.4301932376019 C182.33496084493095,308.4301932376019 182.04465099187303,312.37786634552197 181.89949606534407,314.351702899482 C181.89949606534407,314.351702899482 181.82691860207956,315.338621176462 181.79062987044733,315.832080314952 C181.79062987044733,315.832080314952 181.77248550463122,316.078809884197 181.76341332172314,316.20217466881957 C181.76341332172314,316.20217466881957 181.75434113881508,316.32553945344205 181.75434113881508,316.32553945344205 "
248
+ fill="none"
249
+ stroke="black"
250
+ stroke-width="2"
251
+ />
252
+ <path
253
+ d="M 181.75434113881508 316.32553945344205 C247.8501082366655,321.1861882228226 306.51906010557065,274.27508823362695 316.31858118777706,208.729335348547 C316.31858118777706,208.729335348547 347.6371623755541,213.41166918568376 363.2964529694426,215.75283610425214 C363.2964529694426,215.75283610425214 371.12609826638686,216.92341956353633 375.040920914859,217.5087112931784 C375.040920914859,217.5087112931784 376.998332239095,217.80135715799946 377.97703790121307,217.94768009041 C377.97703790121307,217.94768009041 378.4663907322721,218.02084155661527 378.7110671478016,218.0574222897179 C378.7110671478016,218.0574222897179 378.9557435633311,218.09400302282052 378.9557435633311,218.09400302282052 "
254
+ fill="none"
255
+ stroke="black"
256
+ stroke-width="2"
257
+ />
258
+ <path
259
+ d="M 181.75434113881508 316.32553945344205 C115.65857404096461,311.4648906840615 64.4833022968594,256.4759029000588 64.37775041784722,190.20173603608833 C64.37775041784722,190.20173603608833 32.7111239131418,190.2521700451104 16.877810660789084,190.27738704962144 C16.877810660789084,190.27738704962144 8.961154034612727,190.28999555187698 5.002825721524549,190.29629980300473 C5.002825721524549,190.29629980300473 3.02366156498046,190.2994519285686 2.034079486708415,190.30102799135057 C2.034079486708415,190.30102799135057 1.539288447572393,190.30181602274155 1.2918929280043818,190.302210038437 C1.2918929280043818,190.302210038437 1.0444974084363707,190.3026040541325 1.0444974084363707,190.3026040541325 "
260
+ fill="none"
261
+ stroke="black"
262
+ stroke-width="2"
263
+ />
264
+ <path
265
+ d="M 191.0442564366689 190 C191.0442564366689,190 222.3477640962031,185.21793078393245 237.9995179259702,182.82689617589867 C237.9995179259702,182.82689617589867 245.82539484085373,181.6313788718818 249.73833329829552,181.03362021987334 C249.73833329829552,181.03362021987334 251.6948025270164,180.73474089386912 252.67303714137685,180.585301230867 C252.67303714137685,180.585301230867 253.1621544485571,180.51058139936595 253.4067131021472,180.47322148361542 C253.4067131021472,180.47322148361542 253.52899242894225,180.45454152574015 253.5901320923398,180.44520154680254 C253.5901320923398,180.44520154680254 253.6512717557373,180.4358615678649 253.6512717557373,180.4358615678649 "
266
+ fill="none"
267
+ stroke="black"
268
+ stroke-width="2"
269
+ />
270
+ </g>
271
+ <g
272
+ class="node-layer"
273
+ >
274
+ <path
275
+ d="M-195,0.311A195,195,0,0,0,192.857,28.833L125.274,18.729A126.667,126.667,0,0,1,-126.667,0.202Z"
276
+ fill="red"
277
+ opacity="0.5"
278
+ transform="translate(191.0442564366689,190)"
279
+ />
280
+ </g>
281
+ </g>
282
+ </g>
283
+ </svg>
284
+ </div>,
285
+ "debug": [Function],
286
+ "findAllByAltText": [Function],
287
+ "findAllByDisplayValue": [Function],
288
+ "findAllByLabelText": [Function],
289
+ "findAllByPlaceholderText": [Function],
290
+ "findAllByRole": [Function],
291
+ "findAllByTestId": [Function],
292
+ "findAllByText": [Function],
293
+ "findAllByTitle": [Function],
294
+ "findByAltText": [Function],
295
+ "findByDisplayValue": [Function],
296
+ "findByLabelText": [Function],
297
+ "findByPlaceholderText": [Function],
298
+ "findByRole": [Function],
299
+ "findByTestId": [Function],
300
+ "findByText": [Function],
301
+ "findByTitle": [Function],
302
+ "getAllByAltText": [Function],
303
+ "getAllByDisplayValue": [Function],
304
+ "getAllByLabelText": [Function],
305
+ "getAllByPlaceholderText": [Function],
306
+ "getAllByRole": [Function],
307
+ "getAllByTestId": [Function],
308
+ "getAllByText": [Function],
309
+ "getAllByTitle": [Function],
310
+ "getByAltText": [Function],
311
+ "getByDisplayValue": [Function],
312
+ "getByLabelText": [Function],
313
+ "getByPlaceholderText": [Function],
314
+ "getByRole": [Function],
315
+ "getByTestId": [Function],
316
+ "getByText": [Function],
317
+ "getByTitle": [Function],
318
+ "queryAllByAltText": [Function],
319
+ "queryAllByDisplayValue": [Function],
320
+ "queryAllByLabelText": [Function],
321
+ "queryAllByPlaceholderText": [Function],
322
+ "queryAllByRole": [Function],
323
+ "queryAllByTestId": [Function],
324
+ "queryAllByText": [Function],
325
+ "queryAllByTitle": [Function],
326
+ "queryByAltText": [Function],
327
+ "queryByDisplayValue": [Function],
328
+ "queryByLabelText": [Function],
329
+ "queryByPlaceholderText": [Function],
330
+ "queryByRole": [Function],
331
+ "queryByTestId": [Function],
332
+ "queryByText": [Function],
333
+ "queryByTitle": [Function],
334
+ "rerender": [Function],
335
+ "unmount": [Function],
336
+ }
337
+ `;
@@ -0,0 +1,65 @@
1
+ import { render } from "@testing-library/react";
2
+ import { ImmutableTree } from "../../evo";
3
+ import { FigTree } from "../../components";
4
+ import { polarLayout, rectangularLayout } from "../../layouts";
5
+ import { u } from "../../utils";
6
+ import { Branches, CartoonClades } from "../../bauble-makers/makers";
7
+
8
+ const tree = ImmutableTree.fromNewick("((A:1,B:1):2,C:1);");
9
+
10
+ describe("Figures", () => {
11
+ test("renders a single highlight", () => {
12
+ const fig = render(
13
+ <svg
14
+ width="400px"
15
+ height="400px"
16
+ data-testid="figure"
17
+ xmlns="http://www.w3.org/2000/svg"
18
+ >
19
+ <FigTree
20
+ width={400}
21
+ height={400}
22
+ tree={tree}
23
+ layout={rectangularLayout}
24
+ baubles={[
25
+ Branches({ attrs: { strokeWidth: 2, stroke: "black" } }),
26
+ CartoonClades({
27
+ attrs: { fill: "red", opacity: 0.5 },
28
+ nodes: [u(tree.getParent(u(tree.getNode("A"))))],
29
+ }),
30
+ ]}
31
+ />
32
+ </svg>,
33
+ );
34
+
35
+ //fig.debug();
36
+ expect(fig).toMatchSnapshot();
37
+ });
38
+ test("renders a single polar highlight", () => {
39
+ const fig = render(
40
+ <svg
41
+ width="400px"
42
+ height="400px"
43
+ data-testid="figure"
44
+ xmlns="http://www.w3.org/2000/svg"
45
+ >
46
+ <FigTree
47
+ width={400}
48
+ height={400}
49
+ tree={tree}
50
+ layout={polarLayout}
51
+ baubles={[
52
+ Branches({ attrs: { strokeWidth: 2, stroke: "black" } }),
53
+ CartoonClades({
54
+ attrs: { fill: "red", opacity: 0.5 },
55
+ nodes: [u(tree.getParent(u(tree.getNode("A"))))],
56
+ }),
57
+ ]}
58
+ />
59
+ </svg>,
60
+ );
61
+ //fig.debug();
62
+ expect(fig).toMatchSnapshot();
63
+ // expect(fig).toBeInTheDocument();
64
+ });
65
+ });
@@ -0,0 +1,66 @@
1
+ import { render } from "@testing-library/react";
2
+ import { ImmutableTree } from "../../evo";
3
+ import { FigTree } from "../../components";
4
+ import { polarLayout, rectangularLayout } from "../../layouts";
5
+
6
+ import { u } from "../../utils";
7
+ import { Branches, HighlightClades } from "../../bauble-makers/makers";
8
+
9
+ const tree = ImmutableTree.fromNewick("((A:1,B:1):2,C:1);");
10
+
11
+ describe("Figures", () => {
12
+ test("renders a single highlight", () => {
13
+ const fig = render(
14
+ <svg
15
+ width="400px"
16
+ height="400px"
17
+ data-testid="figure"
18
+ xmlns="http://www.w3.org/2000/svg"
19
+ >
20
+ <FigTree
21
+ width={400}
22
+ height={400}
23
+ tree={tree}
24
+ layout={rectangularLayout}
25
+ baubles={[
26
+ Branches({ attrs: { strokeWidth: 2, stroke: "black" } }),
27
+ HighlightClades({
28
+ attrs: { fill: "red", opacity: 0.5 },
29
+ nodes: [u(tree.getParent(u(tree.getNode("A"))))],
30
+ }),
31
+ ]}
32
+ />
33
+ </svg>,
34
+ );
35
+ //fig.debug();
36
+ expect(fig).toMatchSnapshot();
37
+ // expect(fig).toBeInTheDocument();
38
+ });
39
+ test("renders a single polar highlight", () => {
40
+ const fig = render(
41
+ <svg
42
+ width="400px"
43
+ height="400px"
44
+ data-testid="figure"
45
+ xmlns="http://www.w3.org/2000/svg"
46
+ >
47
+ <FigTree
48
+ width={400}
49
+ height={400}
50
+ tree={tree}
51
+ layout={polarLayout}
52
+ baubles={[
53
+ Branches({ attrs: { strokeWidth: 2, stroke: "black" } }),
54
+ HighlightClades({
55
+ attrs: { fill: "red", opacity: 0.5 },
56
+ nodes: [u(tree.getParent(u(tree.getNode("A"))))],
57
+ }),
58
+ ]}
59
+ />
60
+ </svg>,
61
+ );
62
+ //fig.debug();
63
+ expect(fig).toMatchSnapshot();
64
+ // expect(fig).toBeInTheDocument();
65
+ });
66
+ });