How lightning-js/blits works
And isolate the core components
• Core Framework Library – The heart of Blits is located within the src directory. This includes:
– Application and Component lifecycles (src/application.js, src/component.js)
– The component base and setup modules (src/component/base and src/component/setup)
– Reactivity system (src/lib/reactivity, src/lib/reactivityguard)
– Template parsing (src/lib/templateparser) and precompilation (src/lib/precompiler)
– Event handling, logging, and utility functions (src/lib/eventListeners, src/lib/utils, src/lib/log)
• Rendering & Engine Integration – The src/engines folder (especially src/engines/L3) shows integration layers with the Lightning 3 Renderer, including shader and font loaders.
• Plugin System – The src/plugins directory holds plugins for app state, language, logging, and theming. This is an extensibility point for customization.
• CLI/Tooling & Application scaffolding – The bin/ folder and packages (packages/create-app and packages/create-blits) reinforce that Blits provides commands to generate new apps and boilerplate projects.
• Additional Utilities – Include public assets, helper modules, and integration with tooling like Vite in the vite directory.
Relationships and Interactions
• The Framework Core (application, component, reactivity, parser) drives user applications.
• Components interact with the Lightning 3 rendering engine (via the engines submodules) and communicate using event systems and the reactive data layer.
• The Router and Transition modules work together to manage navigation, animated scene changes, and state transitions.
• Plugins integrate into the core providing additional functionalities such as global app state, themes, and multilingual support.
• The CLI modules (in bin and packages) serve as entry points for project creation and scaffolding, interfacing with the core libraries to set up new projects.
• Vite integrations and build tooling (in the vite folder) handle bundling, preprocessing, and compiling the XML–style templates along with type-checking and other development concerns.
Architectural Patterns & Design Principles
• Modularity: The project is divided neatly among core functionalities, helper libraries, and extensibility points.
• Layered architecture: There is a clear separation between the UI (component/template), business logic (reactivity, state management), and communication with the rendering engine.
• Extensibility: The plugin system and CLI scaffolding packages highlight a design aimed at easy customization and extension.
• MVC/MVVM hints: While not a classic implementation, the separation of component logic, routing, and reactivity indicates patterns similar to modern front–end frameworks.
Final Steps
• Drill down into the core runtime:
– Left section: Core Libraries (application, components, reactivity, template parser).
– Center: Routing and transition management.
– Right section: Engine integration and plugin modules.
• Overlay the build and toolchain integrations (bin, vite, docs) as supporting services that interact with the core.