1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//! JavaScript scripting layer over the Boa engine.
//!
//! # Architecture
//!
//! A [`ScriptEngine`] owns a Boa [`Context`](crate::boa_engine::Context) plus a mutable DOM
//! ([`NodeArena`](crate::tdom::node::NodeArena)) that scripts manipulate
//! through browser-aligned bindings
//! (`document.getElementById`, `el.textContent`, `el.addEventListener`, …).
//!
//! The engine is a *side channel* like the rest of the event system: the
//! render thread still owns layout/paint, but when JS mutates the DOM the
//! engine reports a dirty flag and the input loop forwards the live arena to
//! the render thread via [`RenderCmd::RenderArena`](crate::tui::graph_api::RenderCmd::RenderArena)
//! — no HTML re-parse needed.
//!
//! # Event model
//!
//! `on*` attribute bodies are compiled to `function (event) { body }` (browser
//! semantics: a bare identifier only evaluates, it never calls). Each handler
//! lives in a single slot per (element, event type) — installing overwrites,
//! `removeAttribute` clears — and is (re)wired whenever its attribute appears:
//! at engine startup, after `innerHTML` writes, and after mutations
//! (`appendChild` / `insertBefore` / `replaceChild` / `cloneNode`) and
//! `setAttribute`. `addEventListener(type, fn)` registers JS functions on a
//! separate multicast list (GC-safe); at dispatch the attribute handler runs
//! after that element's list listeners. Dispatch walks the hit region's
//! ancestor path target-first, firing each element's handlers with a
//! DOM-style `Event` object (`target`, `currentTarget`, `x`, `y`,
//! `stopPropagation()`).
//!
//! # Host functions
//!
//! Entries of [`EventBindings::host`](crate::events::EventBindings::host)
//! become JS globals callable from scripts;
//! they can push [`RenderCmd`](crate::tui::graph_api::RenderCmd)s and return
//! values. See `host`.
pub use ;
pub use ScriptEngine;
pub use ;
pub use ;
pub use SharedUiState;
pub use ;
use ;