pub struct WebUIParserPlugin { /* private fields */ }Expand description
WebUI Framework parser plugin.
Intercepts @event attributes and component registrations during parsing,
then compiles each component’s HTML template into a metadata JS IIFE string.
§Event tracking
Event indices are assigned globally across all elements in a component.
element_events counts events on the current element (reset per element),
while next_event_idx is a monotonically increasing global counter.
This preserves event order in the emitted metadata while letting SSR HTML
mark one element with a single data-ev="COUNT" attribute.
Implementations§
Source§impl WebUIParserPlugin
impl WebUIParserPlugin
pub fn new() -> Self
Sourcepub fn take_component_templates(&self) -> Vec<(String, String)>
pub fn take_component_templates(&self) -> Vec<(String, String)>
Compile all tracked components and return (tag_name, script_block) pairs.
Each script block is a self-executing IIFE that registers a metadata
object into window.__webui.templates[tagName]. Call this after all
HTML parsing is complete.
Trait Implementations§
Source§impl Default for WebUIParserPlugin
impl Default for WebUIParserPlugin
Source§impl ParserPlugin for WebUIParserPlugin
impl ParserPlugin for WebUIParserPlugin
Source§fn start_fragment(&mut self, _fragment_id: &str)
fn start_fragment(&mut self, _fragment_id: &str)
Source§fn configure(&mut self, options: &ParserOptions)
fn configure(&mut self, options: &ParserOptions)
Source§fn classify_attribute(&mut self, attr_name: &str) -> AttributeAction
fn classify_attribute(&mut self, attr_name: &str) -> AttributeAction
Source§fn register_component_template(
&mut self,
tag_name: &str,
component: &Component,
processed_template: &str,
) -> Result<()>
fn register_component_template( &mut self, tag_name: &str, component: &Component, processed_template: &str, ) -> Result<()>
Source§fn finish_element(&mut self, binding_attribute_count: u32) -> Option<Vec<u8>>
fn finish_element(&mut self, binding_attribute_count: u32) -> Option<Vec<u8>>
binding_attribute_count is the number of dynamic attribute bindings found.
Returns optional opaque bytes to emit as a Plugin protocol fragment.