# sliemeobn/elementary-htmx architecture

> Architecture diagram of the GitHub repository sliemeobn/elementary-htmx, 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/sliemeobn/elementary-htmx
- Repository: https://github.com/sliemeobn/elementary-htmx

## Overview

##### Main Components Structure

a) Core Package Components:
- ElementaryHTMXSSE (Server-Sent Events)
- ElementaryHTMXWS (WebSockets)
- ElementaryHyperscript

b) Dependencies:
- Elementary framework as an external dependency
- HTMX library as a frontend dependency
- Connection to Hyperscript library

##### Integration Layer
- How the package extends HTML elements with:
- .hx attributes
- .sse attributes
- .ws attributes
- .hyperscript attributes

##### Implementation Details
- HTMX Attributes Handler
- SSE Extension Handler
- WebSocket Extension Handler
- Hyperscript Integration

**[External Dependencies Layer]**
- ↓
**[Core Package Layer]**
- ↓
**[Extensions Layer]**
- ↓
**[Integration Layer]**
- ↓
**[Example Applications]**

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph External
        Elementary[Elementary Framework]:::external
        HTMX[HTMX Library]:::external
        Hyperscript[Hyperscript Library]:::external
    end

    subgraph Core
        ElementaryHTMX[ElementaryHTMX Core]:::core
        HTMXAttr[HTMX Attributes Handler]:::core
        HTMXValues[HTMX Attribute Values]:::core
    end

    subgraph Extensions
        SSE[ElementaryHTMXSSE]:::extension
        WS[ElementaryHTMXWS]:::extension
        HS[ElementaryHyperscript]:::extension
        
        SSEAttr[SSE Attributes Handler]:::extension
        SSEValues[SSE Attribute Values]:::extension
        
        WSAttr[WebSocket Attributes Handler]:::extension
        WSValues[WebSocket Attribute Values]:::extension
        
        HSAttr[Hyperscript Attributes Handler]:::extension
    end

    subgraph Integration
        HTMLElements[HTML Elements]:::integration
        HXAttrs[".hx Attributes"]:::integration
        SSEAttrs[".sse Attributes"]:::integration
        WSAttrs[".ws Attributes"]:::integration
        HSAttrs[".hyperscript Attributes"]:::integration
    end

    subgraph Examples
        Hummingbird[Hummingbird Demo]:::example
        Vapor[Vapor Demo]:::example
    end

    %% Core Relationships
    Elementary --> ElementaryHTMX
    ElementaryHTMX --> HTMXAttr
    ElementaryHTMX --> HTMXValues
    HTMX --> HTMLElements

    %% Extension Relationships
    ElementaryHTMX --> SSE
    ElementaryHTMX --> WS
    ElementaryHTMX --> HS
    
    SSE --> SSEAttr
    SSE --> SSEValues
    WS --> WSAttr
    WS --> WSValues
    HS --> HSAttr
    Hyperscript --> HS

    %% Integration Relationships
    HTMXAttr --> HXAttrs
    SSEAttr --> SSEAttrs
    WSAttr --> WSAttrs
    HSAttr --> HSAttrs

    HXAttrs --> HTMLElements
    SSEAttrs --> HTMLElements
    WSAttrs --> HTMLElements
    HSAttrs --> HTMLElements

    %% Example Applications
    HTMLElements --> Hummingbird
    HTMLElements --> Vapor

    %% Click Events
    click ElementaryHTMX "https://github.com/sliemeobn/elementary-htmx/tree/main/Sources/ElementaryHTMX/"
    click HTMXAttr "https://github.com/sliemeobn/elementary-htmx/blob/main/Sources/ElementaryHTMX/HTMLAttribute+HTMX.swift"
    click HTMXValues "https://github.com/sliemeobn/elementary-htmx/blob/main/Sources/ElementaryHTMX/HTMLAttributeValue+HTMX.swift"
    
    click SSE "https://github.com/sliemeobn/elementary-htmx/tree/main/Sources/ElementaryHTMXSSE/"
    click SSEAttr "https://github.com/sliemeobn/elementary-htmx/blob/main/Sources/ElementaryHTMXSSE/HTMLAttribute+HTMXSSE.swift"
    click SSEValues "https://github.com/sliemeobn/elementary-htmx/blob/main/Sources/ElementaryHTMXSSE/HTMLAttributeValue+HTMXSSE.swift"
    
    click WS "https://github.com/sliemeobn/elementary-htmx/tree/main/Sources/ElementaryHTMXWS/"
    click WSAttr "https://github.com/sliemeobn/elementary-htmx/blob/main/Sources/ElementaryHTMXWS/HTMLAttribute+HTMX.swift"
    click WSValues "https://github.com/sliemeobn/elementary-htmx/blob/main/Sources/ElementaryHTMXWS/HTMLAttributeValue+HTMX.swift"
    
    click HS "https://github.com/sliemeobn/elementary-htmx/tree/main/Sources/ElementaryHyperscript/"
    click HSAttr "https://github.com/sliemeobn/elementary-htmx/blob/main/Sources/ElementaryHyperscript/HTMLAttribute+Hyperscript.swift"
    
    click Hummingbird "https://github.com/sliemeobn/elementary-htmx/tree/main/Examples/HummingbirdDemo/"
    click Vapor "https://github.com/sliemeobn/elementary-htmx/tree/main/Examples/VaporDemo/"

    %% Styling
    classDef external fill:#gray,stroke:#333,stroke-width:2px
    classDef core fill:#blue,stroke:#333,stroke-width:2px
    classDef extension fill:#green,stroke:#333,stroke-width:2px
    classDef integration fill:#purple,stroke:#333,stroke-width:2px
    classDef example fill:#orange,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1[External Dependencies]:::external
        L2[Core Components]:::core
        L3[Extensions]:::extension
        L4[Integration Layer]:::integration
        L5[Example Apps]:::example
    end
```
