# xiaopujun/light-chaser architecture

> Architecture diagram of the GitHub repository xiaopujun/light-chaser, 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/xiaopujun/light-chaser
- Repository: https://github.com/xiaopujun/light-chaser

## Overview

##### Main Components
- User Interface & Pages: Represent the entry point (index.html, src/index.tsx) along with the different views in src/pages. This includes Home, Designer (designer page), Login, and the result/error pages.
- Designer Module: A major module found in src/designer. Break it down into its sub-components such as the blueprint editor, node management, header, left-side menus, right configuration panels, footer, loader, and canvas support. These together form the “blueprint” experience that lets users design data visualization projects.
- Component Library: The project contains a rich collection of components organized into directories like src/comps. These include variations under “antd” (Antd-tabbed components), “antd-common”, “lc” (likely “light chaser” custom components), “common-component” (shared base components), and map components. Each folder represents a family of components that are used to build dashboards and visualizations.
- Framework and Core Utilities: The src/framework folder shows abstractions for caching, message management (GlobalMessage/Modal), drag-scale behavior, operate (undo-redo, event handling), screen fitting, and conversion. These cross-cutting aspects support the UI and design interactions.
- JSON Schema UI Components: The src/json-schema folder holds components to render UI elements from schemas. This area supports dynamic form layouts, accordions, dialogs, button groups, etc. and is likely used to configure or edit component properties.
- Utilities & Configuration: The src/utils directory (with various helper utilities) and configuration files (e.g., Dockerfile, nginx.conf, Vite configurations) help in deployment, building, and runtime support.

##### Relationships and Interactions
- The main entry (index.html and src/index.tsx) initializes the React application and routing (using the src/router/MainRouter.tsx) to direct users to pages such as the Home screen and the Designer.
- The JSON schema UI components are used to render configurable settings for the components, so there should be a link between the designer/configuration panels and the JSON schema layer.
- The utilities provide support functions for component lifecycle, resource loading (such as images and fonts in designer/resource), and file operations.
- The application’s state management and interactivity are likely supported by MobX (as per the badges in the README), so a note on state management flow should be added.

##### Architectural Patterns and Technologies
- Modular design: Separation of concerns is clear – UI (pages and designer), component library, and framework utilities are separated into dedicated folders.
- Component-based architecture: With a heavy emphasis on React components, each UI element is built as an isolated component (e.g., under src/comps, src/designer, src/json-schema/ui).
- Blueprint/Graphical Editor: The “designer/blueprint” structure depicts a robust system for node-based design, supporting drag, drop, selection, scaling, and undo-redo operations.
- Use of TypeScript: The project is built with TypeScript, ensuring type safety in modules and components.
- State management: MobX is employed to handle complex state interactions, especially in the dynamic design canvas and configuration panels.
- Vite as the build tool, supporting fast development and deployment.

##### Putting It All Together
- Branch out to the Router, then split into Pages (Home, Designer, Login, etc.).
- Designer page as the central hub – further branch it into its child areas (blueprint left, right, header, canvas, and footer).
- Parallel to the Designer, display the component library modules that feed into it.

## Diagram (Mermaid)

```mermaid
graph TD
    %% App Bootstrap & Pages
    subgraph "App Bootstrap & Pages"
        index_html["index.html"]:::pages
        src_index["src/index.tsx"]:::pages
        pages["src/pages (Home, Login, Designer, Error)"]:::pages
    end
    index_html --> src_index
    src_index --> pages

    %% Designer Page Route
    designer_page["Designer Page (via Router)"]:::pages
    pages --> designer_page

    %% Designer Module and its components
    subgraph "Designer Module [src/designer]"
        designer_module["Designer Module"]:::designer
        header["Header"]:::designer
        left["Left Menu"]:::designer
        blueprint["Blueprint Editor"]:::designer
        right["Right Panel"]:::designer
        canvas["Canvas"]:::designer
        loader["Loader"]:::designer
        footer["Footer"]:::designer
    end
    designer_page --> designer_module
    designer_module --> header
    designer_module --> left
    designer_module --> blueprint
    designer_module --> right
    designer_module --> canvas
    designer_module --> loader
    designer_module --> footer

    %% Component Library and divisions
    subgraph "Component Library [src/comps]"
        comp_antd["Antd Components"]:::components
        comp_antd_common["Antd Common"]:::components
        comp_lc["LC Components"]:::components
        comp_common["Common Components"]:::components
        comp_map["Map Components"]:::components
    end
    designer_module -->|"uses"| comp_antd
    designer_module -->|"uses"| comp_antd_common
    designer_module -->|"uses"| comp_lc
    designer_module -->|"uses"| comp_common
    designer_module -->|"uses"| comp_map

    %% Framework and Core Utilities
    subgraph "Framework & Core Utilities"
        framework["Framework (src/framework)"]:::framework
        utils["Utils (src/utils)"]:::framework
    end
    designer_module -->|"interacts with"| framework
    designer_module -->|"interacts with"| utils

    %% JSON Schema UI Components
    subgraph "JSON Schema UI Components"
        json_schema["JSON Schema"]:::jsonschema
        json_schema_ui["JSON Schema UI"]:::jsonschema
    end
    designer_module -->|"configures via"| json_schema
    designer_module -->|"configures via"| json_schema_ui

    %% Utilities & Configuration
    subgraph "Utilities & Configuration"
        dockerfile["Dockerfile"]:::config
        nginx["nginx.conf"]:::config
        vite["Vite Config"]:::config
    end
    utils -->|"supports"| dockerfile
    utils -->|"supports"| nginx
    utils -->|"supports"| vite

    %% External State Management Annotation
    mobx["MobX State Management"]:::external
    pages -->|"state_management"| mobx

    %% Click Events
    click index_html "https://github.com/xiaopujun/light-chaser/blob/master/index.html"
    click src_index "https://github.com/xiaopujun/light-chaser/blob/master/src/index.tsx"
    click pages "https://github.com/xiaopujun/light-chaser/tree/master/src/pages"
    click designer_module "https://github.com/xiaopujun/light-chaser/tree/master/src/designer"
    click blueprint "https://github.com/xiaopujun/light-chaser/tree/master/src/designer/blueprint"
    click header "https://github.com/xiaopujun/light-chaser/tree/master/src/designer/header"
    click left "https://github.com/xiaopujun/light-chaser/tree/master/src/designer/left"
    click right "https://github.com/xiaopujun/light-chaser/tree/master/src/designer/right"
    click comp_antd "https://github.com/xiaopujun/light-chaser/tree/master/src/comps/antd"
    click comp_antd_common "https://github.com/xiaopujun/light-chaser/tree/master/src/comps/antd-common"
    click comp_lc "https://github.com/xiaopujun/light-chaser/tree/master/src/comps/lc"
    click comp_common "https://github.com/xiaopujun/light-chaser/tree/master/src/comps/common-component"
    click comp_map "https://github.com/xiaopujun/light-chaser/tree/master/src/comps/map"
    click framework "https://github.com/xiaopujun/light-chaser/tree/master/src/framework"
    click utils "https://github.com/xiaopujun/light-chaser/tree/master/src/utils"
    click json_schema "https://github.com/xiaopujun/light-chaser/tree/master/src/json-schema"
    click json_schema_ui "https://github.com/xiaopujun/light-chaser/tree/master/src/json-schema/ui"
    click dockerfile "https://github.com/xiaopujun/light-chaser/tree/master/Dockerfile"
    click nginx "https://github.com/xiaopujun/light-chaser/blob/master/nginx.conf"
    click vite "https://github.com/xiaopujun/light-chaser/blob/master/vite.config.ts"

    %% Styles
    classDef pages fill:#FFD700,stroke:#DAA520,stroke-width:2px;
    classDef designer fill:#FFCCCB,stroke:#FF0000,stroke-width:2px;
    classDef components fill:#90EE90,stroke:#006400,stroke-width:2px;
    classDef framework fill:#ADD8E6,stroke:#00008B,stroke-width:2px;
    classDef jsonschema fill:#FFB6C1,stroke:#FF69B4,stroke-width:2px;
    classDef config fill:#D3D3D3,stroke:#696969,stroke-width:2px;
    classDef external fill:#E6E6FA,stroke:#800080,stroke-width:2px;
```
