npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

js-family-tree

v1.1.1

Published

A JavaScript library for visualizing and managing family trees using modern web technologies.

Downloads

30

Readme

JS Family Tree

Javascript library to create family hierarchy (compactable with all framework & libary).

Overview

The Family Tree is a versatile JavaScript library for creating interactive family tree structures in a hierarchical format. It is designed to be lightweight, easy to use, and compatible with any JavaScript framework. With this library, you can visualize family relationships and genealogical data in an intuitive and visually appealing way.

Features

  • Flexible Data Input: Accepts data in object format, allowing you to define family relationships and hierarchy easily.
  • Framework Agnostic: Works seamlessly with any JavaScript framework, including React, Angular, Vue.js, and more.
  • Customizable Styling: Provides CSS classes for styling, allowing you to customize the appearance of the family tree to suit your needs.
  • Interactive Interface: Supports interactive features such as collapsible nodes and tooltips for enhanced user experience.
  • Dynamic Rendering: Dynamically renders the family tree structure based on the provided data, enabling real-time updates and modifications.

Installation

You can install the Family Tree via npm:

npm install js-family-tree

Data Passing Format

To use the js-family-tree library, you need to pass the family tree data in JSON format. Below is the structure of the JSON data and an example of how to integrate it with your library.

JSON Data Structure

The JSON data should represent the family tree with nodes and relationships. Each person in the family tree is a node with specific attributes. Here's a sample structure:

{ person: { name: "Father", gender: "Male", dob: "09/10/1998", dod: "till", img:
"https://yoururlofimage" }, spouse: { name: "Mother", gender: "Female", dob:
"09/10/1999", dod: "till", img: "https://yoururlofimage" }, children: [ {
person: { name: "Son", gender: "Male", dob: "", dod: "till", img:
"https://yoururlofimage" }, children: [ { person: { name: "Daughter", gender:
"Female", dob: "", dod: "till", img: "https://yoururlofimage" }, spouse: { name:
"Son-in-Law", gender: "Male", dob: "", dod: "till", img:
"https://yoururlofimage" }, children: [ { person: { name: "Him", gender: "Male",
dob: "", dod: "till", img: "https://yoururlofimage" }, spouse: { name: "Her",
gender: "female", dob: "", dod: "till", img: "https://yoururlofimage" },
children: [], }, { person: { name: "Him", gender: "Male", dob: "", dod: "till",
img: "path" }, spouse: { name: "Her", gender: "Female", dob: "", dod: "till",
img: "path" }, children: [], }, ], }, ], };

Description of JSON Fields

  • id: A unique identifier for each person in the family tree.
  • name: The name of the person.
  • gender: The gender of the person. It can be "male" or "female".
  • spouse: An object representing the person's spouse (if any), with similar attributes (id, name, gender).
  • children: An array of objects representing the person's children, each with similar attributes (id, name, gender).

Usage

  • Import and use in a React/Next component: example

import { FamilyTree } from "js-family-tree"; const sampleData = {}; function
Dummy() { useEffect(() => { const familyTreeHtml = new FamilyTree(sampleData);
const familyTreeElement = document.getElementById("familyTree"); if
(familyTreeElement) familyTreeElement.innerHTML = familyTreeHtml.render(); },
[]); return (
<div>
  <div id="familyTree"></div>
</div>
); }
  • Import and use in a Vanilla Javascript/Typescript component: example

html file

<div id="familyTreeContainer"></div>

js file

document.addEventListener('DOMContentLoaded', () => { const familyTree = new
FamilyTree({your data as object});
familyTree.render(document.getElementById('familyTreeContainer') ); });

Documentation

Documentation is currently in progress. Please check back later for updates.

Contributing

Contributions are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue or submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.