# apvarun/toastify-js architecture

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

- Interactive diagram: https://gitdiagram.com/apvarun/toastify-js
- Repository: https://github.com/apvarun/toastify-js

## Overview

##### Main Components Identification
The system is a frontend library with these key components:

- Core Toast Module
- Styling System
- DOM Integration Layer
- Configuration Handler
- Event Management System

- Toast Controller    |

- Message Queue        |
- Position Manager     |
- Lifecycle Handler    |

- DOM Integration     |

- Element Creation     |
- Shadow DOM Support   |
- Event Binding        |

- Style Manager       |

- CSS Customization    |
- Theme Management     |
- Position Styling     |

##### Flow and Interaction Representation

- Configuration flow (input) → Toast Controller
- Toast Controller → DOM Integration (creation)
- Style Manager → DOM Integration (styling)
- Event triggers → Toast Controller (lifecycle)

##### Important Elements

a) Input Interface:

- Public API          |

- showToast()          |
- Configuration Object |

b) Browser Integration:

- Browser Runtime     |

- DOM                  |
- Event System        |

##### Implementation Details to Note

- The library is modular (show clear boundaries)
- Supports both NPM and traditional script inclusion
- Has browser compatibility requirements
- Includes accessibility features (ARIA)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Legend
        L1[Component]
        L2([External Interface])
        L3[(Browser Runtime)]
        L4>Event Flow]
        style L1 fill:#a8d1f0
        style L2 fill:#f0a8a8
        style L3 fill:#d1f0a8
        style L4 fill:#f0d1a8
    end

    subgraph "Core System"
        TC[Toast Controller]:::core
        MQ[Message Queue]:::core
        PM[Position Manager]:::core
        LH[Lifecycle Handler]:::core

        TC --> MQ
        TC --> PM
        TC --> LH
    end

    subgraph "Integration Layer"
        DI[DOM Integration]:::integration
        EC[Element Creation]:::integration
        SD[Shadow DOM Support]:::integration
        EB[Event Binding]:::integration

        DI --> EC
        DI --> SD
        DI --> EB
    end

    subgraph "Style System"
        SM[Style Manager]:::styling
        CC[CSS Customization]:::styling
        TM[Theme Management]:::styling
        PS[Position Styling]:::styling

        SM --> CC
        SM --> TM
        SM --> PS
    end

    subgraph "External Interfaces"
        API([Public API]):::external
        CFG([Configuration Object]):::external
        BR[(Browser Runtime)]:::browser
    end

    API --> TC
    CFG --> TC
    TC --> DI
    SM --> DI
    DI --> BR
    EB --> TC

    classDef core fill:#a8d1f0
    classDef integration fill:#a8f0c8
    classDef styling fill:#d1a8f0
    classDef external fill:#f0a8a8
    classDef browser fill:#d1f0a8

    click TC "https://github.com/apvarun/toastify-js/blob/master/src/toastify.js"
    click SM "https://github.com/apvarun/toastify-js/blob/master/src/toastify.css"
    click API "https://github.com/apvarun/toastify-js/blob/master/src/toastify-es.js"
    click CFG "https://github.com/apvarun/toastify-js/blob/master/example/script.js"
    click CC "https://github.com/apvarun/toastify-js/blob/master/example/script.css"
```
