Crate sycamore_web

Source
Expand description

§sycamore-web

Web rendering backend for sycamore. This is already re-exported in the main sycamore crate, so you should rarely need to use this crate directly.

§Feature flags

  • hydrate - Enables hydration support in DOM node. By default, hydration is disabled to reduce binary size.

  • suspense - Enables suspense and resources support.

  • wasm-bindgen-interning (default) - Enables interning for wasm-bindgen strings. This improves performance at a slight cost in binary size. If you want to minimize the size of the resulting .wasm binary, you might want to disable this.

§Server Side Rendering

This crate uses target detection to determine whether to use DOM or SSR as the rendering backend. If the target arch is wasm32, DOM rendering will be used. Otherwise, SSR will be used. Sometimes, this isn’t desirable (e.g., if using server side wasm). To override this behavior, you can set --cfg sycamore_force_ssr in your RUSTFLAGS environment variable when compiling to force SSR mode even on wasm32.

Re-exports§

Modules§

  • Definition for bind-able attributes/properties.
  • Definition for all the events that can be listened to.
  • Definition of all the HTML and SVG elements.

Macros§

  • macro_rules! equivalent of cfg_not_ssr. This is to get around the limitation of not being able to put proc-macros on mod items.
  • macro_rules! equivalent of cfg_ssr. This is to get around the limitation of not being able to put proc-macros on mod items.
  • Debug the value of a variable to the JavaScript console if on wasm32. Otherwise logs it to stdout.
  • Prints an error message to the JavaScript console if on wasm32. Otherwise logs it to stderr.
  • Log a message to the JavaScript console if on wasm32. Otherwise logs it to stdout.
  • Log a warning to the JavaScript console if on wasm32. Otherwise logs it to stderr.
  • A macro that expands to whether we are in DOM mode or not.
  • A macro that expands to whether we are in SSR mode or not.

Structs§

Enums§

Traits§

  • A trait for unwrapping a type into an HtmlNode.
  • A trait that represents an attribute that can be set. This is not “attribute” in the HTML spec sense. It can also represent JS properties (and possibly more …) that can be set on an HTML element.
  • Attributes that are available on all elements.
  • Props that are available on all elements.
  • A trait that is implemented for all elements and which provides all the global HTML attributes.
  • Implemented for all types that can accept attributes (AttributeValue).
  • A trait that is implemented for all SVG elements and which provides all the global SVG attributes.
  • A trait that should be implemented for anything that represents an HTML node.
  • A trait that should be implemented for anything that represents a node in the view tree (UI tree).

Functions§

Type Aliases§

  • Type alias respresenting a possibly dynamic boolean value.
  • A type alias for Children automatically selecting the correct node type.
  • A type alias for the rendering backend.
  • Type alias representing a possibly dynamic string value.

Attribute Macros§

  • Re-export of js-sys and wasm-bindgen for convenience.