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 JSON metadata and JS closures.
§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) -> Result<Vec<ComponentTemplateArtifact>>
pub fn take_component_templates(&self) -> Result<Vec<ComponentTemplateArtifact>>
Compile all tracked components and return split template payloads.
Each payload contains JSON-safe metadata plus a component-local closure array for condition evaluation. Call this after all HTML parsing is complete.
§Errors
Returns crate::ParserError::Template if any tracked component
contains an invalid @event handler or a non-braced w-ref binding.
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<()>
<template> attributes are preserved here;
the SSR/internal parse view may strip runtime-only attributes.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.