chrono-phylo-tree 1.0.6 → 1.0.8

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 (2) hide show
  1. package/README.md +62 -3
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -12,6 +12,15 @@ You can test and explore the functionality of the chrono-phylo-tree library by v
12
12
 
13
13
  ### Updates
14
14
 
15
+ **1.0.8**
16
+
17
+ - Species class' step functions can include or not species whose `display` is `false`.
18
+
19
+ **1.0.7**
20
+
21
+ - The default duration of the ancestors and descendants are the duration of the species
22
+ - MultiplePhTrees component allows to show the phylogenetic tree from multiple common ancestors
23
+
15
24
  **1.0.5**
16
25
 
17
26
  - PhTree's lines' width can depend or not on the species' duration
@@ -267,31 +276,37 @@ Returns an array of all descendants of the species, sorted by appearance time.
267
276
  #### stepsChain
268
277
 
269
278
  ```typescript
270
- stepsChain(desc: Species): Species[]
279
+ stepsChain(desc: Species, includeNotDisplay = false): Species[]
271
280
  ```
272
281
 
273
282
  Returns an array of `Species` objects representing the chain of species from the current species (`this`) to the specified descendant (`desc`). The chain includes all intermediate species in the lineage. If the specified descendant is not a descendant of the current species, the method returns an empty array.
274
283
 
275
284
  - **desc**: The descendant species to which the chain is traced.
276
285
 
286
+ - **includeNotDisplay**: If `true`, include the species whose `display` is `false`.
287
+
277
288
  #### stepsUntil
278
289
 
279
290
  ```typescript
280
- stepsUntil(desc: Species): number
291
+ stepsUntil(desc: Species, includeNotDisplay = false): number
281
292
  ```
282
293
 
283
294
  Returns the number of steps (generations) from the current species (`this`) to the specified descendant (`desc`). If the specified descendant is not a descendant of the current species, the method returns `undefined`.
284
295
 
285
296
  - **desc**: The descendant species to which the number of steps is calculated.
286
297
 
298
+ - **includeNotDisplay**: If `true`, include the species whose `display` is `false`.
299
+
287
300
  #### stepsUntilLastDescendant
288
301
 
289
302
  ```typescript
290
- stepsUntilLastDescendant(): number
303
+ stepsUntilLastDescendant(includeNotDisplay = false): number
291
304
  ```
292
305
 
293
306
  Returns the maximum number of steps (generations) from the current species (`this`) to its most distant descendant. If the current species has no descendants, the method returns `0`.
294
307
 
308
+ - **includeNotDisplay**: If `true`, include the species whose `display` is `false`.
309
+
295
310
  #### toJSON
296
311
 
297
312
  ```typescript
@@ -455,6 +470,50 @@ The component renders an SVG element that contains the phylogenetic tree. It use
455
470
 
456
471
  The `PhTree` component can be customized using the various props it accepts. Additionally, the `children` render prop allows for further customization of the menu content displayed when a species node is clicked.
457
472
 
473
+ ## MultiplePhTrees Component
474
+
475
+ The `MultiplePhTrees` component is a React-based visualization tool designed to display multiple phylogenetic trees from a list of species. It allows users to visualize and interact with multiple trees simultaneously, providing a comprehensive view of evolutionary relationships among different species.
476
+
477
+ ### Features
478
+
479
+ - **Multiple Tree Visualization**: Displays multiple phylogenetic trees based on a list of species, each with its own evolutionary lineage.
480
+
481
+ - **Common Ancestor Management**: Automatically creates a common ancestor for the provided species list, ensuring a unified visualization.
482
+
483
+ - **Customizable Appearance**: Supports customization of tree dimensions, padding, stroke color, and number formatting.
484
+
485
+ - **Interactive Tree Visualization**: Users can interact with the trees by toggling the visibility of species and accessing detailed information through a menu.
486
+
487
+ ### Properties
488
+
489
+ The `MultiplePhTrees` component accepts the following props:
490
+
491
+ - **speciesList**: `Species[]` - An array of species that will be used to generate the phylogenetic trees.
492
+
493
+ - **width**: `number` (optional, default: `1000`) - The width of the SVG canvas.
494
+
495
+ - **height**: `number` (optional, default: `50`) - The height per descendant of the SVG canvas.
496
+
497
+ - **padding**: `number` (optional, default: `0`) - The padding around the tree.
498
+
499
+ - **stroke**: `string` (optional, default: `"grey"`) - The stroke color for the tree lines.
500
+
501
+ - **format**: `(n: number) => string` (optional, default: `(n) => n.toString()`) - A function to format the display of time values.
502
+
503
+ - **chronoScale**: `boolean` (optional, default: `true`) - If `true`, the width of the lines depends on the duration of the species.
504
+
505
+ - **presentTime**: `number` (optional) - The current time to highlight in the tree.
506
+
507
+ - **children**: `(species: Species, showMenu: boolean, toggleShowMenu: (species: Species) => void) => React.ReactNode` (optional) - Render prop to customize the menu content.
508
+
509
+ ### Rendering
510
+
511
+ The component renders an SVG element that contains the phylogenetic trees. It uses the `PhTree` component to recursively draw the tree structure for each species in the list. The `children` render prop is conditionally rendered based on the `showMenu` state, allowing for further customization of the menu content displayed when a species node is clicked.
512
+
513
+ ### Customization
514
+
515
+ The `MultiplePhTrees` component can be customized using the various props it accepts. Additionally, the `children` render prop allows for further customization of the menu content displayed when a species node is clicked.
516
+
458
517
  ## Menu Component
459
518
 
460
519
  The `Menu` component provides a user interface to edit and manage species data. It allows users to modify species attributes, add descendants or ancestors, and delete species.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chrono-phylo-tree",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "A React-based phylogenetic tree visualization library",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",