sketch/lustre/element

This module is a drop-in replacement for lustre/element. Just use the new functions, and everything will automagically be styled.

Types

1:1 representation of a lustre/element.Element.

Lustre Documentation

pub opaque type Element(msg)

Functions

pub fn element(
  tag tag: String,
  class class: Class,
  attributes attributes: List(Attribute(a)),
  children children: List(Element(a)),
) -> Element(a)
pub fn element_(
  tag tag: String,
  attributes attributes: List(Attribute(a)),
  children children: List(Element(a)),
) -> Element(a)
pub fn fragment(children: List(Element(a))) -> Element(a)
pub fn keyed(
  element: fn(List(Element(a))) -> Element(a),
  children: List(#(String, Element(a))),
) -> Element(a)
pub fn map(element: Element(a), mapper: fn(a) -> b) -> Element(b)
pub fn namespaced(
  namespace namespace: String,
  tag tag: String,
  class class: Class,
  attributes attributes: List(Attribute(a)),
  children children: List(Element(a)),
) -> Element(a)
pub fn namespaced_(
  namespace namespace: String,
  tag tag: String,
  attributes attributes: List(Attribute(a)),
  children children: List(Element(a)),
) -> Element(a)
pub fn none() -> Element(a)
pub fn styled(
  element: Element(a),
) -> sketch/lustre/element.Element(a)

Style a node from plain Lustre to Sketch. Use it when you need to convert a foreign element in a sketch_lustre element.

pub fn text(content: String) -> Element(a)
pub fn unstyled(
  stylesheet: StyleSheet,
  element: Element(a),
) -> #(StyleSheet, lustre/internals/vdom.Element(a))

Unstyle a node from Sketch to plain Lustre. Use it when you need to convert a Sketch element in Lustre. You’ll have to maintain the StyleSheet on your own, though.
Because of the nature of unstyled, that function returns a tuple, with the updated stylesheet, and the Lustre element.

Search Document