# jonesyenmin/modal-popup architecture

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

- Interactive diagram: https://gitdiagram.com/jonesyenmin/modal-popup
- Repository: https://github.com/jonesyenmin/modal-popup

## Overview

##### Main Components

A. Core Library Components:
- Modal Video Core (lib/core/index.js)
- DOM Parser (lib/lib/dom-parser.js)
- Utility Functions (lib/lib/util.js)
- jQuery Adapter (lib/adaptor/jquery.js)

B. External Integration Points:
- YouTube Player API
- Vimeo Player API
- jQuery Integration Layer

**┌─ Application Layer (Consumer Code) ─────────────────┐**

- [HTML Button Trigger] → [Modal Video Instance]   │

- Core Layer ────────────────────┐ │

- ┌─────────────┐    ┌──────────────┐             │ │
- Modal Manager│ ←→ │DOM Controller│             │ │
- ┘    └──────────────┘             │ │
- ↓                  ↓                     │ │
- ┌─────────────┐    ┌──────────────┐             │ │
- Event Handler│ ←→ │Utility Helper│             │ │
- ┘    └──────────────┘             │ │

- Integration Layer ─────────────────┐│ │

- ┌─────────────┐    ┌──────────────┐           ││ │
- YouTube API  │    │  Vimeo API   │           ││ │
- Integration  │    │ Integration  │           ││ │
- ┘    └──────────────┘           ││ │
- ↓                  ↓                   ││ │
- ┌────────────────────────────────────┐        ││ │
- jQuery Adapter Layer        │        ││ │
- ┘        ││ │
- ┘│ │
- ┘

##### Component Relationships to Highlight

a. Modal Initialization Flow:
- HTML Trigger → Modal Video Instance
- Modal Manager → DOM Controller
- Event Handler → Video API Integration

b. Video Player Integration:
- Core → YouTube/Vimeo API
- jQuery Adapter → Core Components

##### Important Details

- Configuration options flow
- Event handling system
- DOM manipulation paths
- API integration points
- Accessibility features

##### Technical Specifications to Note

- Support for both YouTube and Vimeo
- jQuery compatibility
- CSS transition handling
- Accessibility support
- Configuration options

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef core fill:#b3d1ff,stroke:#4d88ff
    classDef external fill:#90EE90,stroke:#32CD32
    classDef adapter fill:#FFB366,stroke:#FF8000
    classDef app fill:#E6E6E6,stroke:#808080

    %% Application Layer
    subgraph AppLayer["Application Layer"]
        Button["HTML Button Trigger"]:::app
        ModalInstance["Modal Video Instance"]:::app
        Button --> ModalInstance
    end

    %% Core Layer
    subgraph CoreLayer["Core Layer"]
        ModalCore["Modal Video Core"]:::core
        DOMParser["DOM Parser"]:::core
        Utils["Utility Functions"]:::core
        EventHandler["Event Handler"]:::core
        
        ModalCore <--> DOMParser
        ModalCore <--> Utils
        ModalCore <--> EventHandler
    end

    %% Integration Layer
    subgraph IntegrationLayer["Integration Layer"]
        YouTube["YouTube API Integration"]:::external
        Vimeo["Vimeo API Integration"]:::external
        jQuery["jQuery Adapter"]:::adapter
        
        YouTube <--> ModalCore
        Vimeo <--> ModalCore
        jQuery <--> ModalCore
    end

    %% Main Flow
    AppLayer --> CoreLayer
    CoreLayer --> IntegrationLayer

    %% Click Events
    click ModalCore "https://github.com/jonesyenmin/modal-popup/blob/master/lib/core/index.js"
    click DOMParser "https://github.com/jonesyenmin/modal-popup/blob/master/lib/lib/dom-parser.js"
    click Utils "https://github.com/jonesyenmin/modal-popup/blob/master/lib/lib/util.js"
    click jQuery "https://github.com/jonesyenmin/modal-popup/blob/master/lib/adaptor/jquery.js"

    %% Legend
    subgraph Legend["Legend"]
        CoreComp["Core Component"]:::core
        ExtComp["External Integration"]:::external
        AdaptComp["Adapter Component"]:::adapter
        AppComp["Application Component"]:::app
    end
```
