frontbacked-ql
v4.0.0
Published
Frontbacked Query Language (FQL) engine
Readme
Frontbacked frontbacked-ql Library
The frontbacked-ql library is the client-side engine responsible for bringing Frontbacked themes to life.
Role in the Platform
Its primary role is to parse the Frontbacked Query Language (FQL) embedded in a theme's HTML and orchestrate the data flow.
- FQL Parsing: Scans the HTML for
{STATE}declarations in comments andf-*attributes on tags. - Request Orchestration: Organizes and plans the necessary network requests to the server. It intelligently handles dependent requests (e.g., fetching data
Bonly after dataAis available). - State Management: Injects fetched data into the web app's state as declared in the FQL.
- DOM Injection: Automatically updates HTML tag attributes and inner text with the fetched data, ensuring the UI stays in sync with the state.
- Error Handling: Manages fetch errors and provides mechanisms for developers to handle them gracefully.
How it Works
By using the frontbacked-ql library, theme developers can write less code. Instead of manual fetch calls and DOM manipulation, they simply declare the data sources in the HTML, and the frontbacked-ql library handles the "how" and "when" of fetching and displaying that data efficiently.
Technical Details
- Core: AST (Abstract Syntax Tree) generator and resolver for FQL expressions.
- Injection: Direct DOM manipulation based on parsed FQL instructions.
