# dmitrybaranovskiy/raphael architecture

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

- Interactive diagram: https://gitdiagram.com/dmitrybaranovskiy/raphael
- Repository: https://github.com/dmitrybaranovskiy/raphael

## Overview

##### Project type and purpose
- This is an open-source, front-end JavaScript library for cross-browser vector graphics (Raphaël). It provides a unified API that wraps SVG and VML implementations under the hood and is distributed as UMD modules via npm/Bower.

##### File structure
- Top-level files
- raphael.js / raphael.no-deps.js: main UMD entry points
- Gruntfile.js / webpack.config.js: build definitions
- package.json / bower.json: package metadata and dependencies (eve)
- “dev/” directory
- raphael*.amd/core/.vml.js: source splits for AMD, core logic, VML fallback
- raphaelTest.html + dev/test/: manual browser test harness
- Distribution artifacts
- raphael.min.js, raphael.no-deps.min.js (built via Yarn scripts)

##### README for insights
- Describes build steps (`yarn build-all`), test procedure (static server + dev/test), dependency on `eve`.
- Notes UMD compliance and consumption modes (script tag, AMD define).

##### Elements
- Labels for each module/component (Source, Build Tools, Test Harness, Distributables, Consumers)
- Source → Build Tools → Distributables → Consumers
- Distributables ↔ Test Harness
- API calls → Rendering Engines → DOM/SVG/VML
- API calls → Eve event engine
- Source code modules (e.g., blue rectangles)
- Outputs (e.g., yellow)
- External dependency (eve.js, orange)
- Consumer/test harness (purple)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Source Modules
    subgraph "Source Modules"
        Core["Core Rendering API"]:::source
        SVG["SVG Implementation"]:::source
        VML["VML Implementation"]:::source
        AMD["AMD Adapter"]:::source
    end

    %% Build Tools
    subgraph "Build Tools"
        Yarn["Yarn Scripts"]:::build
        Grunt["Gruntfile.js"]:::build
        Webpack["webpack.config.js"]:::build
    end

    %% Distribution Artifacts
    subgraph "Distribution Artifacts"
        UMD["raphael.js (UMD)"]:::dist
        NoDeps["raphael.no-deps.js"]:::dist
        Min["Minified Bundles"]:::dist
    end

    %% Test Harness
    subgraph "Test Harness"
        HTML["raphaelTest.html"]:::test
        Index["dev/test/index.html"]:::test
        SVGTest["SVG Tests (dev/test/svg/dom.js)"]:::test
        VMLTest["VML Tests (dev/test/vml/dom.js)"]:::test
    end

    %% Consumers
    subgraph "Consumers"
        Browser["Browser (<script> tag)"]:::consumer
        AMDLoader["AMD Loader"]:::consumer
    end

    %% External Dependency
    Eve["Eve Event Engine"]:::external

    %% Data Flows
    Core -->|provides modules| Yarn
    SVG -->|provides modules| Yarn
    VML -->|provides modules| Yarn
    AMD -->|provides modules| Yarn

    Yarn -->|invokes| Grunt
    Yarn -->|invokes| Webpack

    Grunt -->|builds| UMD
    Grunt -->|builds| NoDeps
    Webpack -->|bundles| Min

    UMD -->|loaded by| Browser
    NoDeps -->|loaded by| Browser
    UMD -->|loaded by| AMDLoader
    NoDeps -->|loaded by| AMDLoader

    UMD -->|served to| HTML
    NoDeps -->|served to| HTML

    HTML -->|bootstrap tests| Index
    Index -->|runs| SVGTest
    Index -->|runs| VMLTest

    Browser -->|"calls API"| Core
    AMDLoader -->|"calls API"| Core

    Core -->|"renders"| SVG
    Core -->|"renders"| VML
    Core -->|"emits events"| Eve

    %% Click Events
    click Core "https://github.com/dmitrybaranovskiy/raphael/blob/master/dev/raphael.core.js"
    click SVG "https://github.com/dmitrybaranovskiy/raphael/blob/master/dev/raphael.core.js"
    click VML "https://github.com/dmitrybaranovskiy/raphael/blob/master/dev/raphael.vml.js"
    click AMD "https://github.com/dmitrybaranovskiy/raphael/blob/master/dev/raphael.amd.js"
    click UMD "https://github.com/dmitrybaranovskiy/raphael/blob/master/raphael.js"
    click NoDeps "https://github.com/dmitrybaranovskiy/raphael/blob/master/raphael.no-deps.js"
    click Grunt "https://github.com/dmitrybaranovskiy/raphael/blob/master/Gruntfile.js"
    click Webpack "https://github.com/dmitrybaranovskiy/raphael/blob/master/webpack.config.js"
    click Yarn "https://github.com/dmitrybaranovskiy/raphael/blob/master/package.json"
    click Yarn "https://github.com/dmitrybaranovskiy/raphael/blob/master/bower.json"
    click HTML "https://github.com/dmitrybaranovskiy/raphael/blob/master/dev/raphaelTest.html"
    click SVGTest "https://github.com/dmitrybaranovskiy/raphael/blob/master/dev/test/svg/dom.js"
    click VMLTest "https://github.com/dmitrybaranovskiy/raphael/blob/master/dev/test/vml/dom.js"
    click Index "https://github.com/dmitrybaranovskiy/raphael/blob/master/dev/test/index.html"

    %% Styles
    classDef source fill:#cef,stroke:#339,stroke-width:1px
    classDef build fill:#cfc,stroke:#393,stroke-width:1px
    classDef dist fill:#ffc,stroke:#993,stroke-width:1px
    classDef test fill:#ccf,stroke:#339,stroke-width:1px
    classDef consumer fill:#fcf,stroke:#939,stroke-width:1px
    classDef external fill:#f96,stroke:#f60,stroke-width:1px
```
