# thilinahewagama/mermaid-live architecture

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

- Interactive diagram: https://gitdiagram.com/thilinahewagama/mermaid-live
- Repository: https://github.com/thilinahewagama/mermaid-live

## Overview

##### Main Components

A. Frontend Components (Browser Environment):
- User Interface Layer
- Text Editor Panel
- Preview Panel
- Theme Selector
- Download Button
- Core Processing Layer
- Rendering Engine
- State Management
- Theme Settings

##### Component Relationships

- Theme Selector → Rendering Engine
- Download Button → Export Module

**Rectangle: UI Components**
**Hexagon: Processing Units**
**Diamond: User Interactions**

**Blue: UI Elements**
**Green: Processing Components**
**Orange: User Input/Output**

##### Specific Implementation Details

**Layer 1: User Interface (HTML/CSS)**
**Layer 2: Application Logic (JavaScript)**

##### Key Elements to Emphasize

- Real-time processing flow from input to preview
- Theme switching mechanism
- Download functionality pipeline

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Browser
        subgraph "User Interface Layer"
            UI[User Interface]:::ui
            Editor[Text Editor Panel]:::ui
            Preview[Preview Panel]:::ui
            ThemeSelect[Theme Selector]:::ui
            Download[Download Button]:::ui
        end

        subgraph "Core Processing Layer"
            Parser[Mermaid Parser]:::processing
            RenderEngine[Rendering Engine]:::processing
            ExportModule[Export Module]:::processing
        end

        subgraph "State Management"
            DiagramState[Diagram Data]:::state
            ThemeState[Theme Settings]:::state
        end

        subgraph "External Libraries"
            Mermaid[Mermaid.js]:::external
        end

        %% Relationships
        UI --> Editor
        UI --> Preview
        Editor --> Parser
        Parser --> Mermaid
        Mermaid --> RenderEngine
        RenderEngine --> Preview
        ThemeSelect --> ThemeState
        ThemeState --> RenderEngine
        Download --> ExportModule
        ExportModule --> DiagramState
        Parser --> DiagramState
    end

    %% Click Events
    click UI "https://github.com/ThilinaHewagama/mermaid-live/blob/main/index.html"
    click Parser "https://github.com/ThilinaHewagama/mermaid-live/blob/main/script.js"
    click RenderEngine "https://github.com/ThilinaHewagama/mermaid-live/blob/main/script.js"
    click ExportModule "https://github.com/ThilinaHewagama/mermaid-live/blob/main/script.js"
    click DiagramState "https://github.com/ThilinaHewagama/mermaid-live/blob/main/script.js"
    click ThemeState "https://github.com/ThilinaHewagama/mermaid-live/blob/main/script.js"

    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef processing fill:#2ecc71,stroke:#27ae60,color:white
    classDef state fill:#e67e22,stroke:#d35400,color:white
    classDef external fill:#9b59b6,stroke:#8e44ad,color:white

    %% Legend
    subgraph Legend
        L1[UI Components]:::ui
        L2[Processing Units]:::processing
        L3[State Storage]:::state
        L4[External Libraries]:::external
    end
```
