logicaffeine_language/parser/lgx_lower/mod.rs
1//! Lowering a component's `View:` into the DOM calls every tier already runs.
2//!
3//! The tree-walker renders an LGX component from its first-class AST, with the whole runtime
4//! behind it: instances, transactional turns, the journal. That is the REFERENCE semantics, and
5//! it stays.
6//!
7//! The bytecode VM — and therefore WebAssembly, and therefore a browser — reaches the same page
8//! by a different road. A component's view is compiled ONCE, here, into ordinary LOGOS: a
9//! `## To __render_<Name> (parent):` function whose body is the `createElement` /
10//! `setAttribute` / `appendChild` calls the retiring dialect has always lowered to. Those
11//! builtins are already compiled by the VM and already lowered to wasm, so the frontend reaches
12//! the browser with NO new ISA surface — no opcode to classify in six device catalogs, no
13//! `wasm_aot_lock` bucket that would have to lie about a lowering that does not exist.
14//!
15//! Both forms are emitted. The interpreter reads the `ComponentDef` and ignores the function;
16//! the VM compiles the function and treats the definition as a declaration. `Mount App.` means
17//! "render the instance" on one tier and "call `__render_App`" on the other, and
18//! `lgx_vm_parity_lock` holds the two to the same bytes.
19//!
20//! What is NOT here is everything that needs the runtime rather than the DOM: actions, turns,
21//! rollback, the journal, stores, directives. Those need a host that can catch a trap, which the
22//! VM has no way to express — so a component using them has no render function, and the VM
23//! refuses it LOUDLY rather than rendering half a page.
24//!
25//! Split by concern across this directory's modules: naming/binding conventions (`naming`), the
26//! lowerability/refusal gate every construct passes through before compiling (`gate`), the
27//! derived JSON codec (`json`), sessions, `## Route`s and server rendering (`server`), the per-component driver (`components`), DOM events and dispatch (`events`),
28//! patchable sites and per-instance state (`sites`), the page clock and the unmount sweep
29//! (`sweep`), typed `fetch` (`fetch`), `## Store` lowering (`stores`), element/localStorage
30//! commands (`elements`), `Mount` (`mount`), turn wrapping and its epilogue (`turns`), and the
31//! view-tree walk that builds a render function (`render`). Every item this module used to export
32//! at the flat `lgx_lower::` path still does, through the `pub use` lines below — this split is a
33//! pure reorganization, not a change to what any other file may call.
34
35mod components;
36mod elements;
37mod events;
38mod fetch;
39mod gate;
40mod json;
41mod mount;
42mod naming;
43mod render;
44mod server;
45mod shared;
46mod sites;
47mod stores;
48mod sweep;
49mod turns;
50mod views;
51
52pub use events::*;
53pub use gate::*;
54pub use naming::*;
55pub use server::*;
56pub(crate) use views::ViewLowering;
57
58pub(crate) use shared::{shared_field_kind, SharedFieldKind};