# atomiks/tippyjs architecture

> Architecture diagram of the GitHub repository atomiks/tippyjs, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/atomiks/tippyjs
- Repository: https://github.com/atomiks/tippyjs

## Overview

##### Main Components

a) Core Components:
- Tippy Core Engine
- Popper.js Integration (external dependency)
- Animation System
- Theme System
- Plugin System
- DOM Event Handlers

b) -ons and Extensions:
- Singleton Manager
- Delegate System
- Headless Mode

**┌─ Application Layer ─────────────────────┐**
- (Consumer Applications)                 │
- ┤
- Integration Layer                       │
- ┤
- Core Layer                             │
- ┘

##### Component Relationships

a) Core Layer:
- Center the Tippy Core Engine
- It to Popper.js for positioning
- Bidirectional connections to:
- DOM Utils
- Props Manager
- Template Engine
- CSS/Theme Manager

b) Integration Layer:
- Plugin System with connections to:
- AnimateFill
- FollowCursor
- InlinePositioning
- Sticky
- Add-ons with connections to:
- Singleton Manager
- Delegate System

##### Data Flow

- Event propagation from DOM to Tippy instance
- Positioning calculations through Popper.js
- Theme and animation application flow
- Plugin hook execution flow

##### Specific Implementation Notes

- The modular nature of the codebase (src/addons, src/plugins)
- The separation of concerns (core logic vs styling)
- The build output flexibility (different bundles)
- The test coverage architecture (unit, integration, visual)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Legend
        L1[Core Components]:::core
        L2[Plugins]:::plugin
        L3[Add-ons]:::addon
        L4[External Dependencies]:::external
        L5[DOM Interactions]:::dom
    end

    subgraph "Application Layer"
        Consumer[Consumer Applications]
    end

    subgraph "Integration Layer"
        PluginSystem["Plugin System"]:::core
        click PluginSystem "https://github.com/atomiks/tippyjs/tree/master/src/plugins/"
        
        AnimateFill["AnimateFill"]:::plugin
        click AnimateFill "https://github.com/atomiks/tippyjs/blob/master/src/plugins/animateFill.ts"
        
        FollowCursor["FollowCursor"]:::plugin
        click FollowCursor "https://github.com/atomiks/tippyjs/blob/master/src/plugins/followCursor.ts"
        
        InlinePos["Inline Positioning"]:::plugin
        click InlinePos "https://github.com/atomiks/tippyjs/blob/master/src/plugins/inlinePositioning.ts"
        
        Sticky["Sticky"]:::plugin
        click Sticky "https://github.com/atomiks/tippyjs/blob/master/src/plugins/sticky.ts"
        
        Singleton["Singleton Manager"]:::addon
        click Singleton "https://github.com/atomiks/tippyjs/blob/master/src/addons/createSingleton.ts"
        
        Delegate["Delegate System"]:::addon
        click Delegate "https://github.com/atomiks/tippyjs/blob/master/src/addons/delegate.ts"
    end

    subgraph "Core Layer"
        TippyCore["Tippy Core Engine"]:::core
        click TippyCore "https://github.com/atomiks/tippyjs/blob/master/src/createTippy.ts"
        
        PopperJS["Popper.js"]:::external
        
        DOMUtils["DOM Utils"]:::dom
        click DOMUtils "https://github.com/atomiks/tippyjs/blob/master/src/dom-utils.ts"
        
        PropsManager["Props Manager"]:::core
        click PropsManager "https://github.com/atomiks/tippyjs/blob/master/src/props.ts"
        
        TemplateEngine["Template Engine"]:::core
        click TemplateEngine "https://github.com/atomiks/tippyjs/blob/master/src/template.ts"
        
        CSSManager["CSS/Theme Manager"]:::core
        click CSSManager "https://github.com/atomiks/tippyjs/blob/master/src/css.ts"
        
        AnimationSystem["Animation System"]:::core
        click AnimationSystem "https://github.com/atomiks/tippyjs/tree/master/src/scss/animations/"
        
        ThemeSystem["Theme System"]:::core
        click ThemeSystem "https://github.com/atomiks/tippyjs/tree/master/src/scss/themes/"
        
        HeadlessMode["Headless Mode"]:::addon
        click HeadlessMode "https://github.com/atomiks/tippyjs/tree/master/headless/"
    end

    %% Connections
    Consumer --> TippyCore
    TippyCore <--> PopperJS
    TippyCore <--> DOMUtils
    TippyCore <--> PropsManager
    TippyCore <--> TemplateEngine
    TippyCore <--> CSSManager
    TippyCore <--> AnimationSystem
    TippyCore <--> ThemeSystem

    PluginSystem --> AnimateFill
    PluginSystem --> FollowCursor
    PluginSystem --> InlinePos
    PluginSystem --> Sticky
    
    TippyCore --> PluginSystem
    TippyCore --> Singleton
    TippyCore --> Delegate
    TippyCore --> HeadlessMode

    %% Styles
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef plugin fill:#2ecc71,stroke:#27ae60,color:white
    classDef addon fill:#e67e22,stroke:#d35400,color:white
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef dom fill:#9b59b6,stroke:#8e44ad,color:white
```
