yumemi/front/el

要素の木と SSR の文字列化(0.12、51 v6「要素の木」)。構成子は外から見えず、★ が作れるのは yumemi/front/html のタグ、yumemi/front/attr の属性と、ここの text / each / none ほか framework の語だけ。@internal の口は生成物と yumemi の html / attr が呼ぶ(★ が呼べば生成器が 止める、第 3 条)。

Types

pub opaque type Attribute
pub opaque type Element

el.static_sheet だけが作る、priv/static の .css の在り処。

pub opaque type Sheet

画像の在り処。gen/media.src と el.static_src だけが作る(51 v6「html と el」)。

pub opaque type Src

Values

pub fn badge(
  count: option.Option(Int),
  child: List(Element),
) -> Element

A badge marker whose optional count is always represented by one element.

pub fn closer(area: String, child: List(Element)) -> Element

A button that closes the overlay belonging to area.

pub fn dialog(
  key: String,
  class: css.Class,
  attributes: List(Attribute),
  children: List(Element),
) -> Element

確認の 1 段などに使う <dialog>(51 v6「invoker commands」)。key は literal。

pub fn dialog_closer(
  key: String,
  class: css.Class,
  children: List(Element),
) -> Element

dialog を閉じるボタン(command="close")。

pub fn dialog_opener(
  key: String,
  class: css.Class,
  children: List(Element),
) -> Element

dialog を開くボタン(command="show-modal")。invoker commands の無い browser は runtime が代わる。

pub fn each(items: List(a), view: fn(a) -> Element) -> Element
pub fn each_modal(
  scope: String,
  row_key: String,
  opener_child: List(Element),
  closer_child: List(Element),
  child: List(Element),
) -> Element

A popover and its controls for one row rendered inside each.

scope identifies the each call site and row_key identifies one row within that scope. A generator should provide stable, distinct tokens for both. The id format is yumemi-row-overlay-{scope length}-{scope}-{key length}-{key}. The length fields make the pair unambiguous. The id is constructed here, so callers provide neither an id nor an id attribute.

pub fn fragment(children: List(Element)) -> Element
pub fn img(
  class: css.Class,
  src: Src,
  alt: String,
  attributes: List(Attribute),
) -> Element

画像。src は gen/media.src(Blob の variant)か el.static_src(priv/static の file)だけが作る。

pub fn is_custom_element_name(tag: String) -> Bool
pub fn is_name(name: String) -> Bool

[a-z][a-z0-9-]*。attr.data / attr.aria の名はこれに縛り、外れた名の属性は出さない。

pub fn none() -> Element
pub fn notice(class: css.Class) -> Element

Layout の Block に置く、読み直した先・移った先の文言の置き場(51 v6「After」)。runtime が 1 回だけ textContent を入れる。

pub fn opener(area: String, child: List(Element)) -> Element

A button that opens the overlay belonging to area.

pub const overlay_id_prefix: String

Prefix for area overlay ids. Append the exact area name to form the id.

pub fn static_sheet(path: String) -> Sheet

priv/static の .css。path は文字列の literal で書く(第 31 条)。/ で始めても始めなくてもよい。

pub fn static_src(path: String) -> Src

priv/static の file。path は文字列の literal で書く(第 43 条)。static_sheet と同じ柵。

pub fn stylesheet(sheet: Sheet) -> Element

生の CSS の逃げ道(51 v6「生の CSS の逃げ道」)。priv/static の .css を <link> で読む。 生成器が file を検査し、置いた規則を数える(第 28〜31 条)。

pub fn text(content: String) -> Element
pub fn to_string(element: Element) -> String

要素を HTML の字にする(test と Block リストのため)。

✨ Search Document