# rxi/lite architecture

> Architecture diagram of the GitHub repository rxi/lite, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rxi/lite
- Repository: https://github.com/rxi/lite

## Overview

##### Main Components (Top Level)

a) Core Engine Layer
- Contains: Lua runtime environment and core functionality
- Components: Object system, Config system, Command system

b) UI Layer
- Contains: View system and rendering components
- Key components: RootView, DocView, CommandView, StatusView

c) Plugin System
- Shows plugin architecture and extension points

##### Detailed Component Breakdown

- Core API    |

- Command      |
- Config       |
- Keymap       |
- Object       |

- Doc Manager |---->| Highlighter  |

- v                    v

- Doc View    |     | Tokenizer    |

- SDL2    |--->| RenCache |--->| Display |

##### Integration Points

Connections between:
- Core API and Plugin System
- Document System and Renderer
- User Configuration and Core System

##### Key Technical Elements to Highlight

- SDL2 Integration (show as external dependency)
- Lua Runtime Environment (show as foundation layer)
- Plugin Loading System (show as modular components)
- File System Interface (show as I/O layer)

##### Data Flow Indicators

- Command flow from user input to execution
- Document data flow through the system
- Plugin interaction with core systems
- Rendering pipeline flow

## Diagram (Mermaid)

```mermaid
graph TB
    %% Style Definitions
    classDef core fill:#dae8fc,stroke:#6c8ebf
    classDef ui fill:#d5e8d4,stroke:#82b366
    classDef plugin fill:#e1d5e7,stroke:#9673a6
    classDef system fill:#f5f5f5,stroke:#666666
    classDef config fill:#fff2cc,stroke:#d6b656
    classDef renderer fill:#ffe6cc,stroke:#d79b00

    %% System Level
    subgraph SystemLevel
        SDL["SDL2 Integration"]
        FSInterface["File System Interface"]
    end

    %% Core Runtime
    subgraph CoreRuntime
        LuaRuntime["Lua Runtime Environment"]
    end

    %% Core Systems
    subgraph CoreSystems
        ObjectSys["Object System"]:::core
        ConfigSys["Config System"]:::core
        CommandSys["Command System"]:::core
        KeymapSys["Keymap System"]:::core
    end

    %% Document System
    subgraph DocumentSystem
        DocManager["Doc Manager"]:::core
        Highlighter["Highlighter"]:::core
        Tokenizer["Tokenizer"]:::core
    end

    %% UI Layer
    subgraph UILayer
        RootView["Root View"]:::ui
        DocView["Doc View"]:::ui
        CommandView["Command View"]:::ui
        StatusView["Status View"]:::ui
    end

    %% Renderer System
    subgraph RendererSystem
        RenCache["Renderer Cache"]:::renderer
        DisplayRenderer["Display Renderer"]:::renderer
    end

    %% Plugin System
    subgraph PluginSystem
        PluginLoader["Plugin Loader"]:::plugin
        LangPlugins["Language Plugins"]:::plugin
        ThemePlugins["Theme Plugins"]:::plugin
    end

    %% User Configuration
    UserConfig["User Configuration"]:::config

    %% Relationships
    LuaRuntime --> CoreSystems
    CoreSystems --> DocumentSystem
    DocumentSystem --> UILayer
    UILayer --> RendererSystem
    SDL --> RenCache
    RenCache --> DisplayRenderer
    PluginSystem --> CoreSystems
    UserConfig --> ConfigSys
    DocManager --> Highlighter
    Highlighter --> Tokenizer
    FSInterface --> DocManager

    %% Click Events
    click ObjectSys "https://github.com/rxi/lite/blob/master/data/core/object.lua"
    click ConfigSys "https://github.com/rxi/lite/blob/master/data/core/config.lua"
    click CommandSys "https://github.com/rxi/lite/blob/master/data/core/command.lua"
    click KeymapSys "https://github.com/rxi/lite/blob/master/data/core/keymap.lua"
    click RootView "https://github.com/rxi/lite/blob/master/data/core/rootview.lua"
    click DocView "https://github.com/rxi/lite/blob/master/data/core/docview.lua"
    click CommandView "https://github.com/rxi/lite/blob/master/data/core/commandview.lua"
    click StatusView "https://github.com/rxi/lite/blob/master/data/core/statusview.lua"
    click DocManager "https://github.com/rxi/lite/blob/master/data/core/doc/init.lua"
    click Highlighter "https://github.com/rxi/lite/blob/master/data/core/doc/highlighter.lua"
    click Tokenizer "https://github.com/rxi/lite/blob/master/data/core/tokenizer.lua"
    click SDL "https://github.com/rxi/lite/blob/master/winlib/SDL2-2.0.10"
    click RenCache "https://github.com/rxi/lite/blob/master/src/rencache.c"
    click DisplayRenderer "https://github.com/rxi/lite/blob/master/src/renderer.c"
    click PluginLoader "https://github.com/rxi/lite/tree/master/data/plugins"
    click UserConfig "https://github.com/rxi/lite/blob/master/data/user/init.lua"
```
