Skip to main content

WebUIParserPlugin

Struct WebUIParserPlugin 

Source
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

Source

pub fn new() -> Self

Source

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

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl ParserPlugin for WebUIParserPlugin

Source§

fn start_fragment(&mut self, _fragment_id: &str)

Called before parsing begins for a fragment. Read more
Source§

fn configure(&mut self, options: &ParserOptions)

Called when parser output options change.
Source§

fn classify_attribute(&mut self, attr_name: &str) -> AttributeAction

Decide how a framework-owned attribute should be handled.
Source§

fn register_component_template( &mut self, tag_name: &str, component: &Component, processed_template: &str, ) -> Result<()>

Called when a component template has been fully processed for the active CSS strategy and wrapped for shadow DOM rendering.
Source§

fn finish_element(&mut self, binding_attribute_count: u32) -> Option<Vec<u8>>

Called after all attributes on an element have been processed. binding_attribute_count is the number of dynamic attribute bindings found. Returns optional opaque bytes to emit as a Plugin protocol fragment.
Source§

fn into_artifacts(self: Box<Self>) -> ParserPluginArtifacts

Consume the plugin and return any build artifacts it captured.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.