README

f4ah6o/moonchat/html does not have a README file

#
AttrValue

pub enum AttrValue {
Str(String)
Bool(Bool)
Int(Int)
None
}

属性値
impl Eq for AttrValue
impl Show for AttrValue

#
AttrValue::to_string

fn AttrValue::to_string(self : AttrValue) -> String

#
Attrs

pub struct Attrs {
attrs : Array[(String, AttrValue)]
}

属性セット
impl Show for Attrs

#
Attrs::add

fn Attrs::add(self : Attrs, key : String, value : AttrValue) -> Attrs

#
Attrs::attr_type

fn Attrs::attr_type(self : Attrs, t : String) -> Attrs

#
Attrs::class

fn Attrs::class(self : Attrs, name : String) -> Attrs

#
Attrs::data

fn Attrs::data(self : Attrs, key : String, value : String) -> Attrs

#
Attrs::href

fn Attrs::href(self : Attrs, url : String) -> Attrs

#
Attrs::hx_delete

fn Attrs::hx_delete(self : Attrs, url : String) -> Attrs

Htmx属性: hx-delete

#
Attrs::hx_get

fn Attrs::hx_get(self : Attrs, url : String) -> Attrs

Htmx属性: hx-get

#
Attrs::hx_patch

fn Attrs::hx_patch(self : Attrs, url : String) -> Attrs

Htmx属性: hx-patch

#
Attrs::hx_post

fn Attrs::hx_post(self : Attrs, url : String) -> Attrs

Htmx属性: hx-post

#
Attrs::hx_put

fn Attrs::hx_put(self : Attrs, url : String) -> Attrs

Htmx属性: hx-put

#
Attrs::hx_swap

fn Attrs::hx_swap(self : Attrs, swap : String) -> Attrs

Htmx属性: hx-swap

#
Attrs::hx_swap_safe

fn Attrs::hx_swap_safe(self : Attrs, swap : Swap) -> Attrs

Htmx属性: hx-swap (型安全版 - Swap enumを受け取る)

#
Attrs::hx_target

fn Attrs::hx_target(self : Attrs, selector : String) -> Attrs

Htmx属性: hx-target

#
Attrs::hx_trigger

fn Attrs::hx_trigger(self : Attrs, event : String) -> Attrs

Htmx属性: hx-trigger

#
Attrs::hx_trigger_safe

fn Attrs::hx_trigger_safe(self : Attrs, trigger : Trigger) -> Attrs

Htmx属性: hx-trigger (型安全版 - Trigger enumを受け取る)

#
Attrs::id

fn Attrs::id(self : Attrs, id : String) -> Attrs

#
Attrs::merge

fn Attrs::merge(prefer : Attrs, fallback : Attrs) -> Attrs

2つの Attrs をマージする(prefer の属性が優先)

#
Attrs::name

fn Attrs::name(self : Attrs, n : String) -> Attrs

#
Attrs::new

fn Attrs::new() -> Attrs

#
Attrs::placeholder

fn Attrs::placeholder(self : Attrs, p : String) -> Attrs

#
Attrs::value

fn Attrs::value(self : Attrs, v : String) -> Attrs

#
ElementBuilder

pub struct ElementBuilder {
tag : String
attrs : Attrs
is_void : Bool
}

要素ビルダー

#
ElementBuilder::attr

fn ElementBuilder::attr(self : ElementBuilder, key : String, value : AttrValue) -> ElementBuilder

#
ElementBuilder::attr_str

fn ElementBuilder::attr_str(self : ElementBuilder, key : String, value : String) -> ElementBuilder

文字列属性を追加(簡易版)

#
ElementBuilder::attr_type

fn ElementBuilder::attr_type(self : ElementBuilder, t : String) -> ElementBuilder

#
ElementBuilder::attrs

fn ElementBuilder::attrs(self : ElementBuilder, attrs : Attrs) -> ElementBuilder

#
ElementBuilder::child

fn ElementBuilder::child(self : ElementBuilder, child : Html) -> Html

#
ElementBuilder::children

fn ElementBuilder::children(self : ElementBuilder, children : Array[Html]) -> Html

#
ElementBuilder::class

fn ElementBuilder::class(self : ElementBuilder, name : String) -> ElementBuilder

#
ElementBuilder::data

fn ElementBuilder::data(self : ElementBuilder, key : String, value : String) -> ElementBuilder

#
ElementBuilder::empty

fn ElementBuilder::empty(self : ElementBuilder) -> Html

#
ElementBuilder::href

fn ElementBuilder::href(self : ElementBuilder, url : String) -> ElementBuilder

#
ElementBuilder::hx_delete

fn ElementBuilder::hx_delete(self : ElementBuilder, url : String) -> ElementBuilder

Htmx属性: hx-delete

#
ElementBuilder::hx_get

fn ElementBuilder::hx_get(self : ElementBuilder, url : String) -> ElementBuilder

Htmx属性: hx-get

#
ElementBuilder::hx_patch

fn ElementBuilder::hx_patch(self : ElementBuilder, url : String) -> ElementBuilder

Htmx属性: hx-patch

#
ElementBuilder::hx_post

fn ElementBuilder::hx_post(self : ElementBuilder, url : String) -> ElementBuilder

Htmx属性: hx-post

#
ElementBuilder::hx_put

fn ElementBuilder::hx_put(self : ElementBuilder, url : String) -> ElementBuilder

Htmx属性: hx-put

#
ElementBuilder::hx_swap

fn ElementBuilder::hx_swap(self : ElementBuilder, swap : String) -> ElementBuilder

Htmx属性: hx-swap

#
ElementBuilder::hx_swap_safe

fn ElementBuilder::hx_swap_safe(self : ElementBuilder, swap : Swap) -> ElementBuilder

Htmx属性: hx-swap (型安全版 - Swap enumを受け取る)

#
ElementBuilder::hx_target

fn ElementBuilder::hx_target(self : ElementBuilder, selector : String) -> ElementBuilder

Htmx属性: hx-target

#
ElementBuilder::hx_trigger

fn ElementBuilder::hx_trigger(self : ElementBuilder, event : String) -> ElementBuilder

Htmx属性: hx-trigger

#
ElementBuilder::hx_trigger_safe

fn ElementBuilder::hx_trigger_safe(self : ElementBuilder, trigger : Trigger) -> ElementBuilder

Htmx属性: hx-trigger (型安全版 - Trigger enumを受け取る)

#
ElementBuilder::id

fn ElementBuilder::id(self : ElementBuilder, id : String) -> ElementBuilder

#
ElementBuilder::name

fn ElementBuilder::name(self : ElementBuilder, n : String) -> ElementBuilder

#
ElementBuilder::placeholder

fn ElementBuilder::placeholder(self : ElementBuilder, p : String) -> ElementBuilder

#
ElementBuilder::text

fn ElementBuilder::text(self : ElementBuilder, t : String) -> Html

#
ElementBuilder::value

fn ElementBuilder::value(self : ElementBuilder, v : String) -> ElementBuilder

#
Html

pub enum Html {
Element(String, Attrs, Array[Html], Bool)
Text(String)
Fragment(Array[Html])
Raw(String)
When(Bool, Html, Html?)
}

HTML要素
impl Show for Html

#
Html::render

fn Html::render(self : Html) -> String

HTMLを文字列にレンダリング

#
Swap

pub enum Swap {
InnerHTML
OuterHTML
BeforeBegin
AfterBegin
BeforeEnd
AfterEnd
Delete
None
}

HDA Swap戦略
impl Eq for Swap
impl Show for Swap

#
Swap::from_string

fn Swap::from_string(s : String) -> Swap

#
Swap::to_string

fn Swap::to_string(self : Swap) -> String

#
Trigger

pub enum Trigger {
Event(String)
EventWithMods(String, Array[TriggerMod])
Multiple(Array[Trigger])
}

トリガー
impl Show for Trigger

#
Trigger::to_string

fn Trigger::to_string(self : Trigger) -> String

#
TriggerMod

pub enum TriggerMod {
Once
Changed
Delay(Int)
Throttle(Int)
From(String)
Target(String)
Filter(String)
Consumed
Queue(String)
}

トリガー修飾子
impl Eq for TriggerMod
impl Show for TriggerMod

#
TriggerMod::to_string

fn TriggerMod::to_string(self : TriggerMod) -> String

#
article

fn article() -> ElementBuilder

#
aside

fn aside() -> ElementBuilder

#
attr_str

fn attr_str(key : String, value : String) -> Attrs

文字列からAttrsを作成

#
attr_value_str

fn attr_value_str(s : String) -> AttrValue

文字列からAttrValueを作成

#
blockquote

fn blockquote() -> ElementBuilder

#
body

fn body() -> ElementBuilder

fn br() -> ElementBuilder

#
button

fn button() -> ElementBuilder

#
charset

fn charset(charset : String) -> Html

#
code

fn code() -> ElementBuilder

#
del

fn del() -> ElementBuilder

#
div

fn div() -> ElementBuilder

#
doctype

fn doctype() -> Html

ヘルパー関数
fn em() -> ElementBuilder

fn footer() -> ElementBuilder

#
form

fn form() -> ElementBuilder

#
fragment

fn fragment(children : Array[Html]) -> Html

フラグメント
fn h1() -> ElementBuilder

fn h2() -> ElementBuilder

fn h3() -> ElementBuilder

fn h4() -> ElementBuilder

fn h5() -> ElementBuilder

fn h6() -> ElementBuilder

fn head() -> ElementBuilder

fn header() -> ElementBuilder

fn hr() -> ElementBuilder

#
html

fn html() -> ElementBuilder

HTML要素生成関数

#
img

fn img() -> ElementBuilder

#
input

fn input() -> ElementBuilder

#
label

fn label() -> ElementBuilder

fn li() -> ElementBuilder

fn link_tag() -> ElementBuilder

#
main_el

fn main_el() -> ElementBuilder

#
meta

fn meta() -> ElementBuilder

fn nav() -> ElementBuilder

fn ol() -> ElementBuilder

#
pre

fn pre() -> ElementBuilder

#
raw

fn raw(content : String) -> Html

Raw HTML(エスケープなし)

#
script

fn script() -> ElementBuilder

#
section

fn section() -> ElementBuilder

#
small

fn small() -> ElementBuilder

#
span

fn span() -> ElementBuilder

#
strong

fn strong() -> ElementBuilder

#
style

fn style() -> ElementBuilder

#
stylesheet

fn stylesheet(href : String) -> Html

#
table

fn table() -> ElementBuilder

#
tbody

fn tbody() -> ElementBuilder

fn td() -> ElementBuilder

#
text

fn text(content : String) -> Html

テキストノード

#
textarea

fn textarea() -> ElementBuilder

fn th() -> ElementBuilder

#
thead

fn thead() -> ElementBuilder

#
title

fn title() -> ElementBuilder

fn tr() -> ElementBuilder

fn ul() -> ElementBuilder

#
viewport

fn viewport(content : String) -> Html

#
when

fn when(condition : Bool, then : Html) -> Html

条件付きレンダリング(elseなし)

#
when_else

fn when_else(condition : Bool, then : Html, otherwise : Html) -> Html

条件付きレンダリング(elseあり)

Source Files