Module sauron::prelude

source ·
Expand description

prelude

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.
  • 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
  • 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.
  • 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:
  • build a css string
  • build css string that has media selector or any other conditional group
  • creates a key attribute using a formatter
  • build a style attribute
  • creates a text node using a formatter

Structs

  • The AnimationEvent class.
  • request animation frame handle
  • A generic wrapper for a closure in rust where we can transform and pass around.
  • 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.
  • 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.
  • Program handle the lifecycle of the APP
  • The Selection class.
  • Task is used to do asynchronous operations
  • 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

Enums

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.
  • 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
  • Add mapping function for Element
  • A trait for checked and unchecked casting between JS types.
  • Add mapping function for Node, Element, Attribute,
  • additional traits for mt_dom::Node
  • 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.
  • a trait for implementing WebComponent in the DOM with custom tag

Functions

Type Aliases

  • 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