How kusti8/proton-native works
Main Components
• User Application Layer: At the top, show that consumers write desktop apps with standard React syntax. This is represented in the examples (like Calculator, CatApi, Notepad) and the API built with React components.
• Proton Native Framework Core:
• React Components: These are found in both the src/components and src/react-components directories. They define the visual elements (e.g., Button, Window, TextInput).
• Reconciler: Located in src/reconciler, this module integrates with the React rendering process, performing the diffing and managing the conversion from virtual components to native widgets.
• Render Layer: In src/render, responsible for mapping reconciled components into actual instructions that the respective native backend understands.
• Utilities & Helpers: Files in src/utils and src/misc provide auxiliary functions (like style conversion, prop checking, and hot reloading support).
• Native Backends:
• Backend Abstraction: In src/backends, with separate modules for qt.ts and wx.ts, which abstract the details of the native toolkits.
• Development & Tooling:
• Hot Reloading and Debugging: Documented both in the docs and implemented in modules like src/misc/hot.ts.
• Tests: The test folder contains tests that capture interactions with components and the rendering behavior.
• Build/Configuration: Files such as package.json, tsconfig.json, and build scripts indicate how the project is configured.
Out the Relationships and Data Flow
• The user’s React components are processed by Proton Native’s custom Reconciler (src/reconciler) and Render (src/render) modules.
• The React components (src/react-components and src/components) serve as the high-level abstraction of UI elements.
• Additionally, include side components for Utilities and Hot Reloading which support the main rendering flow, enabling live updates and debugging.
Architectural Patterns and Design Principles
• Component Abstraction: The separation between UI components (both base and React-specific components) and the rendering logic illustrates a clear separation of concerns.
• Platform Abstraction: The backends (QT and wx) are isolated in their own modules, showing the use of abstraction to support cross-platform compatibility.
• Modular Design: The division into several directories (components, reconciler, render, utils) shows a modular approach where each part handles a distinct role.
• Integration with React: Emphasize that the Proton Native reconciler is built to work with the standard React lifecycle, making it easily integrable with React-centric libraries like Redux.
Technologies and Frameworks
• React: The project leverages the familiar React model, now targeting desktop.
• Native Toolkits (QT and wxWidgets): Abstracted in the backends.
• TypeScript: Many source files (with .ts and .tsx extensions) indicate use of TypeScript for static type checking.
• Hot Reloading: Supported by modules and documented in the docs for a better developer experience.