# 18alantom/strawberry architecture

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

- Interactive diagram: https://gitdiagram.com/18alantom/strawberry
- Repository: https://github.com/18alantom/strawberry

## Overview

##### Main Components

a. Core Framework Layer
- Reactivity Engine
- Template System
- DOM Manipulation Module
- Custom Directives Handler

b. Public API Layer
- Initialization Module (sb.init)
- Template Registration (sb.register)
- External Template Loader (sb.load)

##### Key Architectural Elements

a. Data Flow Components:
- Reactive Data Store
- Computed Values Handler
- DOM Update Manager
- Template Compiler

b. Feature Modules:
- Conditional Rendering System (sb-if, sb-ifnot)
- Marking System (sb-mark)
- Component Composition System
- Slot Management

**┌─────────────────────────────────────────┐**
- Client HTML                │
- ┤
- Public API Layer              │
- ┤
- Core Framework Layer          │
- ┤
- DOM APIs                  │
- ┘

##### Specific Implementation Details

- Direct DOM manipulation (no Virtual DOM)
- Template-based component system
- Reactive data flow system
- Build-free architecture

##### Key Relationships to Highlight

- Data flow between reactive store and DOM updates
- Template compilation and registration process
- Component composition and slot management
- Directive processing pipeline

##### Important Notes

Specific characteristics:
- Zero-dependency nature (show direct WebAPI usage)
- Build-free operation (show runtime processing)
- Small footprint (emphasize minimal layers)
- Direct DOM updates (show immediate data flow)

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        HTML[Client HTML]
    end

    subgraph API
        Init[Initialization Module]
        Register[Template Registration]
        Load[External Template Loader]
        API_DOC[API Documentation]:::doc
    end

    subgraph Core
        ReactivityEngine[Reactivity Engine]:::core
        TemplateSystem[Template System]:::core
        DOMManipulation[DOM Manipulation Module]
        DirectivesHandler[Custom Directives Handler]:::core
    end

    subgraph DataFlow
        ReactiveStore[Reactive Data Store]
        ComputedHandler[Computed Values Handler]:::core
        DOMUpdater[DOM Update Manager]
        TemplateCompiler[Template Compiler]
    end

    subgraph Features
        ConditionalSystem[Conditional Rendering]:::core
        MarkSystem[Marking System]:::core
        ComponentComposition[Component Composition]
        SlotManagement[Slot Management]
    end

    subgraph Testing
        TemplateTest[Template Testing]:::test
        DirectiveTest[Directive Testing]:::test
        ConditionalTest[Conditional Testing]:::test
        ComputedTest[Computed Testing]:::test
        LoopTest[Loop Testing]:::test
    end

    %% Relationships
    HTML --> Init
    Init --> Register
    Register --> TemplateSystem
    Load --> TemplateSystem

    ReactivityEngine --> ReactiveStore
    ReactiveStore --> DOMUpdater
    TemplateSystem --> TemplateCompiler
    TemplateCompiler --> DOMManipulation
    DirectivesHandler --> DOMManipulation

    ReactiveStore --> ComputedHandler
    ComputedHandler --> DOMUpdater
    
    DirectivesHandler --> ConditionalSystem
    DirectivesHandler --> MarkSystem
    DirectivesHandler --> ComponentComposition
    ComponentComposition --> SlotManagement

    %% Testing Relationships
    TemplateSystem --> TemplateTest
    DirectivesHandler --> DirectiveTest
    ConditionalSystem --> ConditionalTest
    ComputedHandler --> ComputedTest
    DirectivesHandler --> LoopTest

    %% Styling
    classDef core fill:#a8d5ff
    classDef test fill:#ffe0b2
    classDef doc fill:#e1bee7

    %% Click Events
    click ReactivityEngine "https://github.com/18alantom/strawberry/blob/main/docs/reactivity/reactive_values.md"
    click TemplateSystem "https://github.com/18alantom/strawberry/blob/main/tests/test.templates.html"
    click DirectivesHandler "https://github.com/18alantom/strawberry/blob/main/docs/reactivity/directives.md"
    click ConditionalSystem "https://github.com/18alantom/strawberry/blob/main/docs/reactivity/conditionals.md"
    click ComputedHandler "https://github.com/18alantom/strawberry/blob/main/docs/reactivity/computed.md"
    click MarkSystem "https://github.com/18alantom/strawberry/blob/main/docs/reactivity/mark.md"
    click API_DOC "https://github.com/18alantom/strawberry/blob/main/docs/api.md"
    click TemplateTest "https://github.com/18alantom/strawberry/blob/main/tests/templates.html"
    click DirectiveTest "https://github.com/18alantom/strawberry/blob/main/tests/test.directives.html"
    click ConditionalTest "https://github.com/18alantom/strawberry/blob/main/tests/test.conditionals.html"
    click ComputedTest "https://github.com/18alantom/strawberry/blob/main/tests/test.computed.html"
    click LoopTest "https://github.com/18alantom/strawberry/blob/main/tests/test.loops.html"
```
