chrono-phylo-tree 1.0.9 → 1.0.11
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.
- package/README.md +93 -29
- package/package.json +12 -4
package/README.md
CHANGED
@@ -12,31 +12,35 @@ You can test and explore the functionality of the chrono-phylo-tree library by v
|
|
12
12
|
|
13
13
|
### Updates
|
14
14
|
|
15
|
-
|
15
|
+
**1.0.11**
|
16
16
|
|
17
|
-
-
|
17
|
+
- Species class has a new property (`image?: string`).
|
18
|
+
- Interface SpeciesJSON gives a restriction to the JSON importing.
|
18
19
|
|
19
|
-
|
20
|
+
**1.0.9**
|
20
21
|
|
21
|
-
|
22
|
+
- Translation to German thanks to [u/Kneeerg](https://www.reddit.com/user/Kneeerg/).
|
23
|
+
- PhTree allows to execute functions when the mouse is over the buttons.
|
24
|
+
|
25
|
+
**1.0.8**
|
22
26
|
|
23
27
|
- Species class' step functions can include or not species whose `display` is `false`.
|
24
28
|
|
25
|
-
|
29
|
+
**1.0.7**
|
26
30
|
|
27
|
-
- The default duration of the ancestors and descendants are the duration of the species
|
28
|
-
- MultiplePhTrees component allows to show the phylogenetic tree from multiple common ancestors
|
31
|
+
- The default duration of the ancestors and descendants are the duration of the species.
|
32
|
+
- MultiplePhTrees component allows to show the phylogenetic tree from multiple common ancestors.
|
29
33
|
|
30
|
-
|
34
|
+
**1.0.5**
|
31
35
|
|
32
|
-
- PhTree's lines' width can depend or not on the species' duration
|
33
|
-
- It's possible to know the steps until a species
|
34
|
-
- It's possible to count the maximum steps until the last descendant of a species
|
36
|
+
- PhTree's lines' width can depend or not on the species' duration.
|
37
|
+
- It's possible to know the steps until a species.
|
38
|
+
- It's possible to count the maximum steps until the last descendant of a species.
|
35
39
|
|
36
|
-
|
40
|
+
**1.0.2**
|
37
41
|
|
38
|
-
- The duration of the species must be greater than 0
|
39
|
-
- Menu doesn't close when a function throws error
|
42
|
+
- The duration of the species must be greater than 0.
|
43
|
+
- Menu doesn't close when a function throws error.
|
40
44
|
|
41
45
|
### Key Features
|
42
46
|
|
@@ -105,16 +109,52 @@ import React from "react";
|
|
105
109
|
import { Species, PhTree } from "chrono-phylo-tree";
|
106
110
|
|
107
111
|
const root = new Species("Hominoidea", -25e6, 6e6);
|
108
|
-
root.addDescendant(
|
112
|
+
root.addDescendant(
|
113
|
+
"Hilobates",
|
114
|
+
6e6,
|
115
|
+
19e6,
|
116
|
+
undefined,
|
117
|
+
"https://upload.wikimedia.org/wikipedia/commons/4/40/Hylobaes_lar_Canarias.jpg"
|
118
|
+
);
|
109
119
|
const child0 = root.addDescendant("Hominidae", 6e6, 6e6);
|
110
|
-
child0.addDescendant(
|
120
|
+
child0.addDescendant(
|
121
|
+
"Pongo",
|
122
|
+
6e6,
|
123
|
+
13e6,
|
124
|
+
undefined,
|
125
|
+
"https://upload.wikimedia.org/wikipedia/commons/6/65/Pongo_tapanuliensis.jpg"
|
126
|
+
);
|
111
127
|
const child1 = child0.addDescendant("Homininae", 6e6, 5e6);
|
112
|
-
child1.addDescendant(
|
128
|
+
child1.addDescendant(
|
129
|
+
"Gorilla",
|
130
|
+
5e6,
|
131
|
+
8e6,
|
132
|
+
undefined,
|
133
|
+
"https://gorillas-world.com/wp-content/uploads/anatomia.jpg"
|
134
|
+
);
|
113
135
|
const child2 = child1.addDescendant("Hominini", 5e6, 2e6);
|
114
136
|
const child3 = child2.addDescendant("Pan", 2e6, 3e6);
|
115
|
-
child3.addDescendant(
|
116
|
-
|
117
|
-
|
137
|
+
child3.addDescendant(
|
138
|
+
"Pan Troglodytes",
|
139
|
+
3e6,
|
140
|
+
3e6,
|
141
|
+
undefined,
|
142
|
+
"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR-v4-d4R9AUgsHdG42VPYuYj_d4OMRHKasUQ&s"
|
143
|
+
);
|
144
|
+
child3.addDescendant(
|
145
|
+
"Pan Paniscus",
|
146
|
+
3e6,
|
147
|
+
3e6,
|
148
|
+
undefined,
|
149
|
+
"https://upload.wikimedia.org/wikipedia/commons/e/e2/Apeldoorn_Apenheul_zoo_Bonobo.jpg"
|
150
|
+
);
|
151
|
+
child2.addDescendant(
|
152
|
+
"Homo",
|
153
|
+
2e6,
|
154
|
+
6e6,
|
155
|
+
undefined,
|
156
|
+
"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR7XK_e3HG0jhOticytH1Dn3tzBEZyRyWc5Mg&s"
|
157
|
+
);
|
118
158
|
|
119
159
|
const App = () => {
|
120
160
|
return (
|
@@ -130,6 +170,20 @@ const App = () => {
|
|
130
170
|
export default App;
|
131
171
|
```
|
132
172
|
|
173
|
+
## SpeciesJSON Interface
|
174
|
+
|
175
|
+
```typescript
|
176
|
+
interface SpeciesJSON {
|
177
|
+
name: string;
|
178
|
+
apparition?: number;
|
179
|
+
duration?: number;
|
180
|
+
description?: string;
|
181
|
+
descendants?: SpeciesJSON[];
|
182
|
+
afterApparition?: number;
|
183
|
+
image?: string;
|
184
|
+
}
|
185
|
+
```
|
186
|
+
|
133
187
|
## Species Class
|
134
188
|
|
135
189
|
The `Species` class represents a species in a phylogenetic tree, with properties and methods to manage its ancestors, descendants, and other attributes.
|
@@ -156,7 +210,8 @@ constructor(
|
|
156
210
|
duration = 0,
|
157
211
|
ancestor?: Species,
|
158
212
|
descendants: Species[] = [],
|
159
|
-
description: string | undefined = undefined
|
213
|
+
description: string | undefined = undefined,
|
214
|
+
image: string | undefined = undefined
|
160
215
|
)
|
161
216
|
```
|
162
217
|
|
@@ -168,6 +223,7 @@ Initializes a new instance of the `Species` class.
|
|
168
223
|
- **ancestor**: The ancestor of the species.
|
169
224
|
- **descendants**: An array of descendant species.
|
170
225
|
- **description**: An optional description of the species.
|
226
|
+
- **image**: An optional url of the species' image.
|
171
227
|
|
172
228
|
#### copy
|
173
229
|
|
@@ -185,6 +241,7 @@ addDescendant(
|
|
185
241
|
afterApparition = 0,
|
186
242
|
duration = 0,
|
187
243
|
description: string | undefined = undefined,
|
244
|
+
image: string | undefined = undefined,
|
188
245
|
copy = false
|
189
246
|
): Species
|
190
247
|
```
|
@@ -215,6 +272,7 @@ addAncestor(
|
|
215
272
|
previousApparition = 0,
|
216
273
|
duration = 0,
|
217
274
|
description: string | undefined = undefined,
|
275
|
+
image: string | undefined = undefined,
|
218
276
|
display = true,
|
219
277
|
copy = false
|
220
278
|
): Species
|
@@ -316,7 +374,7 @@ Returns the maximum number of steps (generations) from the current species (`thi
|
|
316
374
|
#### toJSON
|
317
375
|
|
318
376
|
```typescript
|
319
|
-
toJSON():
|
377
|
+
toJSON(): SpeciesJSON
|
320
378
|
```
|
321
379
|
|
322
380
|
Converts the species and its descendants to a JSON object.
|
@@ -334,7 +392,7 @@ Saves the species and its descendants as a JSON file.
|
|
334
392
|
#### fromJSON
|
335
393
|
|
336
394
|
```typescript
|
337
|
-
static fromJSON(json:
|
395
|
+
static fromJSON(json: SpeciesJSON, ancestor?: Species): Species
|
338
396
|
```
|
339
397
|
|
340
398
|
Creates a species instance from a JSON object.
|
@@ -361,7 +419,8 @@ Here is an example of a JSON object representing a species and its descendants:
|
|
361
419
|
{
|
362
420
|
"name": "Hilobates",
|
363
421
|
"afterApparition": 6000000,
|
364
|
-
"duration": 19000000
|
422
|
+
"duration": 19000000,
|
423
|
+
"image": "https://upload.wikimedia.org/wikipedia/commons/4/40/Hylobaes_lar_Canarias.jpg"
|
365
424
|
},
|
366
425
|
{
|
367
426
|
"name": "Hominidae",
|
@@ -371,7 +430,8 @@ Here is an example of a JSON object representing a species and its descendants:
|
|
371
430
|
{
|
372
431
|
"name": "Pongo",
|
373
432
|
"afterApparition": 6000000,
|
374
|
-
"duration": 13000000
|
433
|
+
"duration": 13000000,
|
434
|
+
"image": "https://upload.wikimedia.org/wikipedia/commons/6/65/Pongo_tapanuliensis.jpg"
|
375
435
|
},
|
376
436
|
{
|
377
437
|
"name": "Homininae",
|
@@ -381,7 +441,8 @@ Here is an example of a JSON object representing a species and its descendants:
|
|
381
441
|
{
|
382
442
|
"name": "Gorilla",
|
383
443
|
"afterApparition": 5000000,
|
384
|
-
"duration": 8000000
|
444
|
+
"duration": 8000000,
|
445
|
+
"image": "https://gorillas-world.com/wp-content/uploads/anatomia.jpg"
|
385
446
|
},
|
386
447
|
{
|
387
448
|
"name": "Hominini",
|
@@ -396,19 +457,22 @@ Here is an example of a JSON object representing a species and its descendants:
|
|
396
457
|
{
|
397
458
|
"name": "Pan Troglodytes",
|
398
459
|
"afterApparition": 3000000,
|
399
|
-
"duration": 3000000
|
460
|
+
"duration": 3000000,
|
461
|
+
"image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR-v4-d4R9AUgsHdG42VPYuYj_d4OMRHKasUQ&s"
|
400
462
|
},
|
401
463
|
{
|
402
464
|
"name": "Pan Paniscus",
|
403
465
|
"afterApparition": 3000000,
|
404
|
-
"duration": 3000000
|
466
|
+
"duration": 3000000,
|
467
|
+
"image": "https://upload.wikimedia.org/wikipedia/commons/e/e2/Apeldoorn_Apenheul_zoo_Bonobo.jpg"
|
405
468
|
}
|
406
469
|
]
|
407
470
|
},
|
408
471
|
{
|
409
472
|
"name": "Homo",
|
410
473
|
"afterApparition": 2000000,
|
411
|
-
"duration": 6000000
|
474
|
+
"duration": 6000000,
|
475
|
+
"image": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR7XK_e3HG0jhOticytH1Dn3tzBEZyRyWc5Mg&s"
|
412
476
|
}
|
413
477
|
]
|
414
478
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "chrono-phylo-tree",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.11",
|
4
4
|
"description": "A React-based phylogenetic tree visualization library",
|
5
5
|
"type": "module",
|
6
6
|
"main": "dist/index.js",
|
@@ -16,9 +16,12 @@
|
|
16
16
|
"preview": "vite preview"
|
17
17
|
},
|
18
18
|
"dependencies": {
|
19
|
+
"@tailwindcss/vite": "^4.0.12",
|
20
|
+
"multiple-sorting-array": "^1.0.0",
|
19
21
|
"papaparse": "^5.5.2",
|
20
22
|
"react": "^19.0.0",
|
21
|
-
"react-dom": "^19.0.0"
|
23
|
+
"react-dom": "^19.0.0",
|
24
|
+
"tailwindcss": "^4.0.12"
|
22
25
|
},
|
23
26
|
"devDependencies": {
|
24
27
|
"@eslint/js": "^9.19.0",
|
@@ -36,8 +39,13 @@
|
|
36
39
|
},
|
37
40
|
"repository": {
|
38
41
|
"type": "git",
|
39
|
-
"url": "https://github.com/LUCHER4321/
|
42
|
+
"url": "https://github.com/LUCHER4321/chrono-phylo-tree"
|
40
43
|
},
|
41
|
-
"keywords": [
|
44
|
+
"keywords": [
|
45
|
+
"phylogenetic",
|
46
|
+
"tree",
|
47
|
+
"visualization",
|
48
|
+
"react"
|
49
|
+
],
|
42
50
|
"author": "LUCHER4321"
|
43
51
|
}
|