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.

Re-exports

  • pub use sauron_core::jss as jss_crate;

Modules

  • This module provides functionalities for manipulating the actual Document Object Model in the browser
  • Provides functions and macros to build html elements
  • Bindings to JavaScript’s standard, built-in objects, including their methods and properties.
  • Provides convenient functions and macro to build dynamic css
  • mt-dom is a generic virtual dom implementation which doesn’t specify the types of the data that is being processed. It’s up to the library user to specify those types
  • 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.
  • Runtime support for the wasm-bindgen tool
  • 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:
  • Creates css using json notation
  • Create a css string using json notation and use namespace on the class selectors
  • create css using jss with namespace macro with correct indentions
  • Create css using jss macro with nice indentions
  • creates a key attribute using a formatter
  • Quasi-quoting macro for building sauron Nodes.
  • Creat a style attribute
  • creates a text node using a formatter

Structs

  • A handle to both a closure in Rust as well as JS closure which will invoke the Rust closure.
  • Cmd 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. Cmd 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.
  • 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.
  • 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.
  • Program handle the lifecycle of the APP

Traits

  • An Application is the root component of your program. Everything that happens in your application is done here.
  • Add mapping function for Attribute
  • A component has a view and can update itself.
  • A Container have children that is set from the parent component
  • a trait for implementing CustomElement in the DOM with custom tag
  • Add mapping function for Element
  • A trait for checked and unchecked casting between JS types.
  • Add mapping function for Node, Element, Attribute,
  • render node, elements to a writable buffer
  • 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.

Functions

Type Definitions

  • Attribute type used in sauron where the type of the Attribute name is &’static str
  • Element type with tag and attribute name type set to &’static str
  • Callback where Event type is supplied for Components
  • A simplified version of saurdon_vdom node, where we supplied the type for the tag which is a &’static str. The missing type is now only MSG which will be supplied by the users App code.
  • Patch as result of diffing the current_vdom and the new vdom. The tag and attribute name types is set to &’static str

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