How didi/logicflow works
Main Components
• Execution Engine: Found in the packages/engine directory, this component deals with the self-executing workflow / flow model, scheduling, event propagation, and processing logic.
• Extensions: In packages/extension (and related directories for BPMN, dynamic group, node resizing and labeling), these are the plug-in components that enrich the base functionality with custom elements, adapters, and integration with BPMN or other external data structures.
• Framework Integrations: The react-node-registry and vue-node-registry packages show built-in support for integration with React and Vue frameworks, respectively, to allow custom node renderings and portal integration.
• Examples & Documentation: The examples and sites/docs folders serve as practical usage demos (including demos for browser, Node usage, React/Vue and Next.js apps) and also host comprehensive documentation and tutorials on how the library should be used and extended.
Relationships and Interactions
• The Core component is the starting point – it provides the API (including event handling, rendering, and data management) that other components build upon.
• Extensions plug into the Core and Engine layers to provide additional node types, behaviors, and adapters (for example, to convert LogicFlow data into BPMN structures).
• The framework-specific registries (React/Vue) wrap or extend the Core’s capabilities for UI rendering in their respective ecosystems.
• The documentation and examples components are used to guide developers and also serve as integration tests for the overall system.
Architectural Patterns and Design Principles
• Component-based design: Core drawing and rendering are broken down into modular node, edge, and overlay view components.
• Event-driven architecture: There is an event emitter system that listens to and dictates user interactions, state changes, and propagation across modules.
• Plugin/Extension mechanism: The framework supports extensibility by allowing custom nodes and behaviors, which is emphasized in the extension directories.
• Separation of concerns: The project clearly divides responsibilities among packages (core logic, engine, UI views, tooling, adapter conversion).
Relevant Technologies and Frameworks
• TypeScript is used throughout, ensuring type safety across modules.
• Popular tools like ESLint, Prettier, and husky suggest a strong emphasis on code quality.
• The use of Rollup for bundling, and multiple configurations (babel, tsconfig, etc.), indicates a robust build and packaging system.
• Integration support for various front-end frameworks (React, Vue, Next.js) is evident from the examples and registry packages.
• Testing is rigorously set up with Jest and other testing configurations.
• Use clear, distinct labels for each major component. For example, label “Core Engine”, “Execution Engine”, “Extensions”, “React/Vue Integration”, and “Documentation/Examples”.
– From user interaction (in the browser container) to Core for input handling.
– Between Core and Engine for event and state updates.
– Between Core/Engine and Extensions for plug-in interactions.
– From Integration modules back into Core for rendering custom nodes.
Summary
• Internal architecture – Core modules handling visual model management, the Engine that drives execution, and the Extensions that allow for custom behaviors and adapter functionalities.
• Ecosystem integrations (React, Vue) and support for various documentation and examples.
The goal is to communicate both the high-level interactions and the detailed roles of each package.