Crate sauron

source ·
Expand description

Sauron is an web framework for creating fast and interactive client side web application, as well as server-side rendering for back-end web applications.

Modules§

  • provides diffing algorithm which returns patches
  • This module provides functionalities for manipulating the actual Document Object Model in the browser
  • Provides functions and macros to build html elements
  • prelude
  • This is a native integration of Serde with wasm-bindgen. It allows to convert Rust data types into native JavaScript types and vice versa.
  • Provides functions and macros to build svg elements
  • vdom stands for virtual-dom. This module contains types that are derived from mt-dom where we assign concrete types into the generics.
  • Converting between JavaScript Promises to Rust Futures.
  • Raw API bindings for Web APIs

Macros§

  • declare a function with the name corresponds to attribute name for easy usage in html elements Example:
  • Generate a skip diff list based on the node used in the view
  • extract template by including only attributes and elements that is static str
  • build a css string
  • build css string that has media selector or any other conditional group
  • creates a key attribute using a formatter
  • Quasi-quoting macro for building sauron Nodes.
  • build a style attribute
  • creates a text node using a formatter

Structs§

  • The AnimationEvent class.
  • request animation frame handle
  • These are the plain attributes of an element
  • A handle to both a closure in Rust as well as JS closure which will invoke the Rust closure.
  • Cmd is a way to tell the Runtime that something needs to be executed
  • Dispatch is a command to be executed by the system. This is returned at the init function of a component and is executed right after instantiation of that component. Dispatch required a DSP object which is the Program as an argument The emit function is called with the program argument. The callback is supplied with the program an is then executed/emitted.
  • Provides function for document related functions
  • Effects is a convenient way to group Msg for component to execute subsequent updates based on certain conditions. This can be used for doing animation and incremental changes to the view to provide an effect of transition or animation.
  • Represents an element of the virtual node An element has a generic tag, this tag could be a static str tag, such as usage in html dom. Example of which are div, a, input, img, etc.
  • The FocusEvent class.
  • The HashChangeEvent class.
  • TODO: expand this much farther by getting the InputEvent data, data_transfer, event_type, is_composing events. a custom InputEvent to contain the input string value
  • Convenience type for use on exported fn() -> Result<T, JsError> functions, where you wish to throw a JavaScript Error object.
  • Representation of an object owned by JS.
  • The KeyboardEvent class.
  • Contains the time it took for the last app update call for the component TODO: Maybe rename to Diagnostics
  • an event when a virtual Node is mounted the field node is the actual dom node where the virtual Node is created in the actual dom
  • The MouseEvent class.
  • A Patch encodes an operation that modifies a real DOM element or native UI element
  • Program handle the lifecycle of the APP
  • The Selection class.
  • if the expression evaluates to true, diffing at this node will be skipped entirely
  • Provides function related to Time
  • handle for request_idle_callback calls
  • The TouchEvent class.
  • The TransitionEvent class.
  • Describe the path traversal of a Node starting from the root node
  • A self contain web component This is needed to move some of the code from the #custom_element macro This is also necessary, since #[wasm_bindgen] macro can not process impl types which uses generics, we use generics here to simplify the code and do the type checks for us, rather than in the code derived from the #[web_component] macro
  • Provides function for window related functions

Enums§

  • Values of an attribute can be in these variants
  • a dom version of the Attribute value, thereby removing the MSG generic
  • specify how the App is mounted to the DOM
  • specify whether to attach the Node in shadow_root
  • Mouse button used in the MouseEvent
  • represents a node in a virtual dom A node could be an element which can contain one or more children of nodes. A node could also be just a text node which contains a string
  • Wraps different primitive variants used as values in html This is needed since html attributes can have different value types such as checked(bool), name(String), tab_index(i32) Note: memory size of Value is 32 bytes, in comparison String is 24 bytes

Constants§

  • These are most commonly used html attributes such as class, id, etc
  • html events
  • These are the comonly used html tags such as div, input, buttons,.. etc
  • These are most commonly used svg attributes
  • These are svg attributes with names that are non proper rust identifier therefore they are handled differently. ie: (color-profile, accent-height, etc)
  • Svg attributes with xlink namespace
  • These are the commonly used svg tags such as rect, circle, path, arc, ..etc.
  • These are svg tags which the tags are non proper rust identifier, so they are handled differently

Traits§

  • An Application is the root component of your program. Everything that happens in your application is done here.
  • A component has a view and can update itself.
  • A trait for checked and unchecked casting between JS types.
  • A component that can be used directly in the view without mapping
  • An extension trait for Option<T> and Result<T, E> for unwrapping the T value, or throwing a JS error if it is not available.
  • a trait for implementing WebComponent in the DOM with custom tag

Functions§

Type Aliases§

  • Callback where Event type is supplied for Components

Attribute Macros§

  • derive code for a certain CustomElement implementation to have the necessary types and glue code which register itself into the the DOM customElementRegistry. This also adds the register function into the module it is called in, so make sure you only use this in each module, multiple web_components should be in different modules