UNPKG

chrono-phylo-tree

Version:

A React-based phylogenetic tree visualization library

55 lines (54 loc) 2.17 kB
import { SpeciesJSON } from '../types'; interface ConstructorProps { id?: string | number; name?: string; apparition?: number; duration?: number; ancestor?: Species; descendants?: Species[]; description?: string; image?: string; } interface DescendantProps extends Omit<Omit<Omit<ConstructorProps, "apparition">, "ancestor">, "descendants"> { afterApparition?: number; copy?: boolean; } interface AncestorProps extends Omit<DescendantProps, "afterApparition"> { previousApparition?: number; display?: boolean; } export declare class Species { id?: string | number; name: string; apparition: number; duration: number; ancestor?: Species; descendants: Species[]; description?: string; display: boolean; image?: string; private onPosition; constructor({ id, name, apparition, duration, ancestor, descendants, description, image }: ConstructorProps); copy(): Species; unlinkAncestor(): [Species, Species] | undefined; unlinkDescendant(descendant: Species): [Species, Species] | undefined; linkAncestor(ancestor: Species): void; linkDescendant(descendant: Species): void; linkDescendants(descendants: Species[]): void; addDescendant({ id, name, afterApparition, duration, description, image, copy }: DescendantProps): Species; removeDescendant(desc: Species): void; addAncestor({ id, name, previousApparition, duration, description, image, display, copy }: AncestorProps): Species; extinction(): number; absoluteExtinction(): number; absoluteDuration(): number; firstAncestor(includeNotDisplay?: boolean): Species; cousinsExtinction(): number; allDescendants(sort?: boolean): Species[]; stepsChain(desc: Species, includeNotDisplay?: boolean): Species[]; stepsUntil(desc: Species, includeNotDisplay?: boolean): number | undefined; stepsUntilLastDescendant(icludeNotDisplay?: boolean): number; toJSON(): SpeciesJSON; saveJSON(filename?: string): Promise<void>; static fromJSON({ id, name, duration, description, image, descendants, ...json }: SpeciesJSON, ancestor?: Species): Species; } export {};