# reutenkoivan/react-control-flow architecture

> Architecture diagram of the GitHub repository reutenkoivan/react-control-flow, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/reutenkoivan/react-control-flow
- Repository: https://github.com/reutenkoivan/react-control-flow

## Overview

##### Main Components Overview
- Component
- For Component
- SwitchMap Component

##### Component Architecture

**┌─ React Control Flow Library ─────────────────────┐**

- ┌─ Public API ──────────────────────────────┐  │
- Show                                    │  │
- For                                     │  │
- SwitchMap                              │  │

- ┌─ Core Components ───────────────────────┐ │  │

- ┌─ Show ─────┐  ┌─ For ──────┐        │ │  │
- Props:     │  │ Props:     │        │ │  │
- when     │  │ - of       │        │ │  │
- fallback │  │ - children │        │ │  │
- children │  │ - keyMapper│        │ │  │
- ┘  │ - loading   │        │ │  │
- slots     │        │ │  │
- ┘         │ │  │

- ┌─ SwitchMap ─────┐                  │ │  │
- Props:          │                  │ │  │
- case          │                  │ │  │
- default       │                  │ │  │
- children      │                  │ │  │
- ┘                   │ │  │

- ┌─ Utils ────────────────────────────┐   │  │
- genericMemo                      │   │  │

- ┘

##### Development Infrastructure
A separate section showing:
- Build System (Vite)
- Testing Framework (Storybook)
- CI/CD Pipeline (.github/workflows)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Library["React Control Flow Library"]
        subgraph API["Public API Layer"]
            Show_API["Show Component"]
            For_API["For Component"]
            SwitchMap_API["SwitchMap Component"]
        end

        subgraph Core["Core Components Layer"]
            subgraph ShowComp["Show Component"]
                Show_Props["Props:
                - when
                - fallback
                - children"]
            end

            subgraph ForComp["For Component"]
                For_Props["Props:
                - of
                - children
                - keyMapper
                - loading
                - slots"]
            end

            subgraph SwitchMapComp["SwitchMap Component"]
                SwitchMap_Props["Props:
                - case
                - default
                - children"]
            end
        end

        subgraph Utils["Utilities Layer"]
            GenericMemo["genericMemo"]
        end

        subgraph Infrastructure["Development Infrastructure"]
            Build["Build System
            (Vite)"]
            Testing["Testing Framework
            (Storybook)"]
            CICD["CI/CD Pipeline"]
            Types["TypeScript
            Definitions"]
        end
    end

    %% Component Relationships
    Show_API --> ShowComp
    For_API --> ForComp
    SwitchMap_API --> SwitchMapComp
    
    ShowComp --> GenericMemo
    ForComp --> GenericMemo
    SwitchMapComp --> GenericMemo

    %% Infrastructure Connections
    ShowComp --> Testing
    ForComp --> Testing
    SwitchMapComp --> Testing
    
    Core --> Build
    Core --> Types
    Build --> CICD

    %% Click Events
    click Show_API "https://github.com/reutenkoivan/react-control-flow/blob/main/src/Show/Show.tsx"
    click For_API "https://github.com/reutenkoivan/react-control-flow/blob/main/src/For/For.tsx"
    click SwitchMap_API "https://github.com/reutenkoivan/react-control-flow/blob/main/src/SwitchMap/SwitchMap.tsx"
    click GenericMemo "https://github.com/reutenkoivan/react-control-flow/blob/main/src/utils/genericMemo.ts"
    click Types "https://github.com/reutenkoivan/react-control-flow/blob/main/src/types.ts"
    click Testing "https://github.com/reutenkoivan/react-control-flow/blob/main/.storybook/main.ts"
    click Build "https://github.com/reutenkoivan/react-control-flow/blob/main/vite.config.ts"
    click CICD "https://github.com/reutenkoivan/react-control-flow/tree/main/.github/workflows/"

    %% Styling
    classDef api fill:#95B8D1,stroke:#333,stroke-width:2px
    classDef component fill:#B8E0D2,stroke:#333,stroke-width:2px
    classDef util fill:#D7BDE2,stroke:#333,stroke-width:2px
    classDef infra fill:#FAD7A0,stroke:#333,stroke-width:2px

    class Show_API,For_API,SwitchMap_API api
    class ShowComp,ForComp,SwitchMapComp,Show_Props,For_Props,SwitchMap_Props component
    class GenericMemo util
    class Build,Testing,CICD,Types infra
```
