How xiaopujun/light-chaser works
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.