# miyanokomiya/no-mans-folly architecture

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

- Interactive diagram: https://gitdiagram.com/miyanokomiya/no-mans-folly
- Repository: https://github.com/miyanokomiya/no-mans-folly

## Overview

##### UI Components
- React component tree originating from “src/App.tsx” as the application’s root.
- Layout components such as AppHeader, AppFootbar, AppToolbar, ShapeLibraryPanel, and ShapeTemplatePanel.
- Specialized dialogs and panels like ContextMenu, PreviewDialog, FramePanel, LinkMenu, TextEditor etc.
- That React Contexts, hooks, and atoms (simple UI pieces) consolidate shared state. Group “src/contexts” and “src/hooks” together to indicate how they contribute to UI behavior and state propagation.

##### State Management & Composables
- Within this module, show that there are multiple composables that implement discrete responsibilities (e.g., alignHandler, boardHandler, shapeHandlers, etc.)
- Pointers to “defineAsyncState” and the synchronous state transition logic.

##### Data Persistence & External Integration
- A block representing data storage and integration.
- A “Google Integration” module since the file tree includes “src/google” (e.g., driveAccess, drivePicker, auth utilities) to support additional file handling.
- Modules back to the UI (if applicable) and to the underlying store modules (like “src/stores”) where the application state is maintained.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interface (UI) Components
    subgraph "User Interface (UI) Components"
        UI_Root["src/App.tsx"]:::ui
        UI_Components["Components (src/components)"]:::ui
        Contexts["Contexts (src/contexts)"]:::ui
        Hooks["Hooks (src/hooks)"]:::ui
    end

    %% Canvas and Diagram Engine
    subgraph "Canvas and Diagram Engine"
        Canvas["Canvas Module (src/components/appCanvas)"]:::canvas
    end

    %% State Management & Composables
    subgraph "State Management & Composables"
        StateMgmt["Business Logic & State (src/composables)"]:::state
        CanvasStates["Canvas States (src/composables/states)"]:::state
    end

    %% Shape and Rendering Modules
    subgraph "Shape and Rendering Modules"
        Shapes["Shapes (src/shapes)"]:::shape
        ShapeHandlers["Shape Handlers (src/composables/shapeHandlers)"]:::shape
    end

    %% Data Persistence & External Integrations
    subgraph "Data Persistence & External Integrations"
        IndexedDB["IndexedDB Persistence"]:::data
        Google["Google Integration (src/google)"]:::data
    end

    %% Additional Utility Modules
    subgraph "Additional Utility Modules"
        Utils["Utilities (src/utils)"]:::utils
        GlobalStore["Global Store (src/stores)"]:::utils
    end

    %% Connections
    UI_Root -->|"initializes"| UI_Components
    UI_Components -->|"uses"| Contexts
    UI_Components -->|"uses"| Hooks
    UI_Root -->|"renders on"| Canvas
    UI_Components -->|"triggers events"| Canvas

    Canvas -->|"initiates state change"| StateMgmt
    StateMgmt -->|"updates canvas"| Canvas
    StateMgmt -->|"manages"| CanvasStates

    StateMgmt -->|"drives rendering"| Shapes
    StateMgmt -->|"invokes"| ShapeHandlers
    Shapes -->|"drawn on"| Canvas

    UI_Components -->|"calls"| Utils
    StateMgmt -->|"reads/writes"| GlobalStore
    Utils -->|"supports"| GlobalStore

    Google -->|"integrates with"| GlobalStore
    IndexedDB -->|"persists data to"| GlobalStore

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef canvas fill:#FFDAB9,stroke:#000,stroke-width:2px;
    classDef state fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef shape fill:#F0E68C,stroke:#000,stroke-width:2px;
    classDef data fill:#D3D3D3,stroke:#000,stroke-width:2px;
    classDef utils fill:#EE82EE,stroke:#000,stroke-width:2px;

    %% Click Events
    click UI_Root "https://github.com/miyanokomiya/no-mans-folly/blob/main/src/App.tsx"
    click UI_Components "https://github.com/miyanokomiya/no-mans-folly/tree/main/src/components"
    click Contexts "https://github.com/miyanokomiya/no-mans-folly/tree/main/src/contexts"
    click Hooks "https://github.com/miyanokomiya/no-mans-folly/tree/main/src/hooks"
    click Canvas "https://github.com/miyanokomiya/no-mans-folly/tree/main/src/components/appCanvas"
    click StateMgmt "https://github.com/miyanokomiya/no-mans-folly/tree/main/src/composables"
    click CanvasStates "https://github.com/miyanokomiya/no-mans-folly/tree/main/src/composables/states"
    click Shapes "https://github.com/miyanokomiya/no-mans-folly/tree/main/src/shapes"
    click ShapeHandlers "https://github.com/miyanokomiya/no-mans-folly/tree/main/src/composables/shapeHandlers"
    click Google "https://github.com/miyanokomiya/no-mans-folly/tree/main/src/google"
    click Utils "https://github.com/miyanokomiya/no-mans-folly/tree/main/src/utils"
    click GlobalStore "https://github.com/miyanokomiya/no-mans-folly/tree/main/src/stores"
```
