# donatso/family-chart architecture

> Architecture diagram of the GitHub repository donatso/family-chart, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/donatso/family-chart
- Repository: https://github.com/donatso/family-chart

## Overview

##### Main Components

a. Core Library Components:
- Visualization Engine (D3.js Integration)
- Tree Calculator Module
- Card Rendering System
- Event Handling System
- Data Store
- View Management

b. External Interfaces:
- WikiData Integration
- Framework Integrations (React, Vue, Vanilla JS)

##### Component Relationships

- Data flow from WikiData API to the store
- Tree calculation flow from raw data to rendered visualization
- Event handling paths from user interactions to tree updates
- Component communication between modules

##### Detailed Component Breakdown

CalculateTree Module:
- Tree calculation handlers
- Link creation system
- Layout algorithms

Cards Module:
- SVG and HTML rendering options
- Card templates and utilities

CreateTree Module:
- Form handling
- History management
- Relative management

View Module:
- Card rendering
- Link rendering
- Event handling
- HTML components

##### Implementation Notes

Annotations for:
- Customization points
- Framework integration methods
- Event flow patterns
- Data structure requirements

- The modular nature of the system
- Clear separation of concerns
- Extensibility points
- Integration capabilities

Remember to:
- Keep the main flow clear and visible
- Version information
- Document key interaction patterns

This visualization library requires a balance between showing the technical complexity of the D3.js integration while maintaining clarity about how different components work together to create interactive family trees.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Client
        React["React Integration"]
        Vue["Vue Integration"]
        VanillaJS["Vanilla JS Integration"]
        WikiData["WikiData Integration"]
    end

    subgraph Core["Core Components"]
        TreeModule["Tree Module"]
        CalcModule["Calculate Tree Module"]:::calc
        ViewSystem["View Management System"]:::view
        Store["Store Management"]:::store
    end

    subgraph Rendering["Rendering & Data Layer"]
        D3Integration["D3.js Integration"]:::d3
        CardSystem["Card Rendering System"]:::card
        DataStore["Data Storage"]:::store
        EventHandlers["Event Handlers"]:::event
    end

    subgraph TreeCalculation["Tree Calculation Components"]
        CalcHandlers["Calculation Handlers"]:::calc
        LinkCreation["Link Creation System"]:::calc
        LayoutAlgo["Layout Algorithms"]:::calc
    end

    subgraph CardComponents["Card Components"]
        SVGCards["SVG Cards"]:::card
        HTMLCards["HTML Cards"]:::card
        Templates["Card Templates"]:::card
    end

    subgraph ViewComponents["View Components"]
        CardRender["Card Rendering"]:::view
        LinkRender["Link Rendering"]:::view
        ViewEvents["View Events"]:::view
        HTMLComp["HTML Components"]:::view
    end

    subgraph TreeManagement["Tree Management"]
        FormHandling["Form Handling"]:::tree
        HistoryMgmt["History Management"]:::tree
        RelativeMgmt["Relative Management"]:::tree
    end

    %% Relationships
    Client --> Core
    Core --> Rendering
    TreeCalculation --> Rendering
    CardComponents --> Rendering
    ViewComponents --> Rendering
    TreeManagement --> Core

    %% Click events
    click D3Integration "https://github.com/donatso/family-chart/blob/master/src/d3.js"
    click CalcHandlers "https://github.com/donatso/family-chart/blob/master/src/CalculateTree/CalculateTree.handlers.js"
    click LinkCreation "https://github.com/donatso/family-chart/blob/master/src/CalculateTree/createLinks.js"
    click SVGCards "https://github.com/donatso/family-chart/blob/master/src/Cards/CardSvg.js"
    click HTMLCards "https://github.com/donatso/family-chart/blob/master/src/Cards/CardHtml.js"
    click Templates "https://github.com/donatso/family-chart/blob/master/src/view/elements/Card.templates.js"
    click EventHandlers "https://github.com/donatso/family-chart/blob/master/src/handlers/general.js"
    click Store "https://github.com/donatso/family-chart/blob/master/src/createStore.js"
    click ViewSystem "https://github.com/donatso/family-chart/blob/master/src/view/view.js"
    click CardRender "https://github.com/donatso/family-chart/blob/master/src/view/view.cards.js"
    click LinkRender "https://github.com/donatso/family-chart/blob/master/src/view/view.links.js"
    click HTMLComp "https://github.com/donatso/family-chart/blob/master/src/view/view.html.component.js"
    click FormHandling "https://github.com/donatso/family-chart/blob/master/src/CreateTree/form.js"
    click HistoryMgmt "https://github.com/donatso/family-chart/blob/master/src/CreateTree/history.js"
    click RelativeMgmt "https://github.com/donatso/family-chart/blob/master/src/CreateTree/addRelative.js"

    %% Styling
    classDef d3 fill:#1E88E5,color:white
    classDef calc fill:#43A047,color:white
    classDef card fill:#FB8C00,color:white
    classDef view fill:#8E24AA,color:white
    classDef store fill:#757575,color:white
    classDef event fill:#D81B60,color:white
    classDef tree fill:#00ACC1,color:white

    %% Legend
    subgraph Legend
        L1["D3.js Components"]:::d3
        L2["Calculation Components"]:::calc
        L3["Card Components"]:::card
        L4["View Components"]:::view
        L5["Store Components"]:::store
        L6["Event Components"]:::event
        L7["Tree Management"]:::tree
    end
```
