sketch/lustre

Types

Options to indicate where to output the StyleSheet. Can be a Node in DOM, a CSSStyleSheet in document or in a shadow root.

pub opaque type Options

Functions

pub fn compose(
  options: Options,
  view: fn(a) -> Element(b),
  cache: Cache,
) -> fn(a) -> lustre/internals/vdom.Element(b)

Wrap the view function in lustre. Be careful, on BEAM, sketch will add an additional div at the root of the HTML tree, to inject the styles in the app, currently due to a fragment bug. This should have no impact on your app.

pub fn document() -> Options

Output the StyleSheet in a CSSStyleSheet in document. document cannot be used on server.

pub fn node() -> Options

Output the StyleSheet in a style tag in DOM.

pub fn shadow(root: ShadowRoot) -> Options

Output the StyleSheet in a CSSStyleSheet in a shadow root. shadow cannot be used on server.

pub fn ssr(
  el: Element(a),
  cache: Cache,
) -> lustre/internals/vdom.Element(a)

Take an Element, and overloads the content with the correct styles from sketch. Can only be used on BEAM.

Search Document