Crate percy_dom

Source
Expand description

percy-dom provides a virtual dom implementation as well as an html! macro that you can use to generate a virtual dom.

The virtual dom works on both the client and server. On the client we’ll render to an HtmlElement, and on the server we render to a String.

Modules§

event
prelude
Exports structs and macros that you’ll almost always want access to in a virtual-dom powered application
render
Utilities to help with rendering.
single_page_app
Utilities for single page applications.
test_utils
A collection of functions that are useful for unit testing your html! views.

Macros§

html
Used to generate VirtualNode’s from a TokenStream.

Structs§

Closure
A handle to both a closure in Rust as well as JS closure which will invoke the Rust closure.
EventAttribFn
Box<dyn AsRef>> is our js_sys::Closure. Stored this way to allow us to store any Closure regardless of the types of its arguments.
IterableNodes
Used by the html! macro for all braced child nodes so that we can use any type that implements Into
PercyDom
Used for keeping a real DOM node up to date based on the current VirtualNode and a new incoming VirtualNode that represents our latest DOM state.
SpecialAttributes
A specially supported attributes.
VElement
VText
Represents a text node

Enums§

AttributeValue
The value associated with an element’s attribute.
Patch
A Patch encodes an operation that modifies a real DOM element.
PatchSpecialAttribute
Patches that apply to [SpecialAttributes].
VirtualNode
When building your views you’ll typically use the html! macro to generate VirtualNode’s.

Traits§

JsCast
A trait for checked and unchecked casting between JS types.
View
A trait with common functionality for rendering front-end views.

Functions§

diff
Given two VirtualNode’s generate Patch’s that would turn the old virtual node’s real DOM node equivalent into the new VirtualNode’s real DOM node equivalent.
patch
Apply all of the patches to our old root node in order to create the new root node that we desire. Also, update the VirtualEvents with the new virtual node’s event callbacks.