# casparwylie/cascii-core architecture

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

- Interactive diagram: https://gitdiagram.com/casparwylie/cascii-core
- Repository: https://github.com/casparwylie/cascii-core

## Overview

##### File structure
- Top-level files:
- cascii.html – the entire application (HTML, CSS, and JS)
- README.md – description, feature list, usage
- .prettierrc, .gitattributes – formatting/git config
- TODO – rough notes
- No separate frontend/backend folders: everything runs in the browser.
- No build or deployment scripts: open cascii.html directly.

##### README for additional insights
- Managers: EventManager, LayerManager, CharManager, GroupManager, ModeMaster
- CanvasCom: the rendering engine (“Pixels!”)
- Layer classes: SquareLayer, CircleLayer, DiamondLayer, BaseLineLayer, SwitchLineLayer, StepLineLayer, FreeLineLayer, FreeLayer, TableLayer
- Features: selection, grouping, history, import/export, themes, auto-save localStorage
- External integration: optional server for short links and user accounts.

##### Essential details
- Make each manager and layer type explicit—this illustrates the core extensibility of the tool.
- Data flow from user input through rendering and persistence.
- Clean separation: no build tools, all logic embedded in cascii.html.
- A note on optional server integration, even though it’s not in this repo.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Top-level environment
    Browser["Browser Host (HTML5)"]:::env

    %% Application Bundle
    subgraph "cascii.html Application"
        direction TB
        EM["EventManager"]:::controller
        MM["ModeMaster"]:::controller
        LM["LayerManager"]:::controller
        CM["CharManager"]:::controller
        GM["GroupManager"]:::controller
        CC["CanvasCom (Rendering Engine)"]:::engine

        subgraph "Layer Types"
            direction TB
            SL["SquareLayer"]:::layer
            CL["CircleLayer"]:::layer
            DL["DiamondLayer"]:::layer
            BL["BaseLineLayer"]:::layer
            SWL["SwitchLineLayer"]:::layer
            STL["StepLineLayer"]:::layer
            FLL["FreeLineLayer"]:::layer
            FL["FreeLayer"]:::layer
            TL["TableLayer"]:::layer
        end
    end

    %% Persistence and External
    LS[("localStorage")]:::storage
    CS(("Cascii Server")):::external

    %% Data Flow
    Browser -->|"loads cascii.html"| EM
    EM -->|"dispatches events"| MM
    EM -->|"dispatches events"| LM
    EM -->|"dispatches events"| CM
    EM -->|"dispatches events"| GM

    MM -->|"coordinates"| CM
    MM -->|"coordinates"| GM
    MM -->|"coordinates"| LM

    LM -->|"manages layers"| SL
    LM -->|"manages layers"| CL
    LM -->|"manages layers"| DL
    LM -->|"manages layers"| BL
    LM -->|"manages layers"| SWL
    LM -->|"manages layers"| STL
    LM -->|"manages layers"| FLL
    LM -->|"manages layers"| FL
    LM -->|"manages layers"| TL

    LM -->|"provides data"| CC
    CC -->|"renders to viewport"| Browser

    %% Persistence
    CC -->|"auto-save"| LS
    EM -->|"import/export"| LS
    EM -->|"import/export (Base64)"| EM

    %% Optional external
    EM -->|"share/export"| CS
    CS -->|"short-link/account service"| Browser

    %% Click Events
    click EM "https://github.com/casparwylie/cascii-core/blob/main/cascii.html"
    click MM "https://github.com/casparwylie/cascii-core/blob/main/cascii.html"
    click LM "https://github.com/casparwylie/cascii-core/blob/main/cascii.html"
    click CM "https://github.com/casparwylie/cascii-core/blob/main/cascii.html"
    click GM "https://github.com/casparwylie/cascii-core/blob/main/cascii.html"
    click CC "https://github.com/casparwylie/cascii-core/blob/main/cascii.html"
    click SL "https://github.com/casparwylie/cascii-core/blob/main/cascii.html"
    click CL "https://github.com/casparwylie/cascii-core/blob/main/cascii.html"
    click DL "https://github.com/casparwylie/cascii-core/blob/main/cascii.html"
    click BL "https://github.com/casparwylie/cascii-core/blob/main/cascii.html"
    click SWL "https://github.com/casparwylie/cascii-core/blob/main/cascii.html"
    click STL "https://github.com/casparwylie/cascii-core/blob/main/cascii.html"
    click FLL "https://github.com/casparwylie/cascii-core/blob/main/cascii.html"
    click FL "https://github.com/casparwylie/cascii-core/blob/main/cascii.html"
    click TL "https://github.com/casparwylie/cascii-core/blob/main/cascii.html"
    click LS "https://github.com/casparwylie/cascii-core/blob/main/cascii.html"

    %% Styles
    classDef env fill:#f9f,stroke:#333,stroke-width:1px
    classDef controller fill:#bbf,stroke:#333,stroke-width:1px
    classDef engine fill:#bfb,stroke:#333,stroke-width:1px
    classDef layer fill:#dfd,stroke:#333,stroke-width:1px
    classDef storage fill:#ffd,stroke:#333,stroke-width:1px
    classDef external fill:#eee,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
```
