mizchi/luna/core does not have a README file
pub enum Attr[E] {
VStatic(String)
VDynamic(() -> String)
VHandler(EventHandler[E])
VAction(String)
}pub struct EventHandler[E] {
callback : (E) -> Unit
}pub enum Node[E] {
Element(VElement[E])
Text(String)
DynamicText(() -> String)
Fragment(Array[Node[E]])
Show(() -> Bool, () -> Node[E])
For(() -> Array[Node[E]])
Component(() -> Node[E])
Island(VIsland[E])
WcIsland(VWcIsland[E])
Async(VAsync[E])
ErrorBoundary(VErrorBoundary[E])
Switch(VSwitch[E])
InternalRef(VInternalRef[E])
}#alias(Trigger)
pub(all) enum TriggerType {
Load
Idle
Visible
Media(String)
None
}pub struct VInternalRef[E] {
url : String
state : String
trigger : TriggerType
wc : Bool
styles : String
children : Array[Node[E]]
}pub struct VIsland[E] {
id : String
url : String
state : String
trigger : TriggerType
children : Array[Node[E]]
}pub struct VWcIsland[E] {
name : String
url : String
styles : String
state : String
trigger : TriggerType
children : Array[Node[E]]
}pub enum MyAction { Increment; Decrement } derive(Show)
@luna.h("button", [("onclick", action(Increment))], [...])error_boundary(
children=fn() { risky_component() },
fallback=fn(err, reset) {
h("div", [], [
text("Error: " + err.to_string()),
h("button", [("onclick", handler(fn(_) { reset() }))], [text("Retry")])
])
}
)fn[E] internal_ref(url : String, state : String, trigger? : TriggerType, wc? : Bool, styles? : String, children? : Array[Node[E]]) -> Node[E]fn[E] island(id : String, url : String, state : String, children : Array[Node[E]], trigger? : TriggerType) -> Node[E]switch_(
cases=[
match_case(when=fn() { state.get() == 1 }, render=fn() { text("One") }),
match_case(when=fn() { state.get() == 2 }, render=fn() { text("Two") }),
],
fallback=Some(fn() { text("Other") })
)fn[E] wc_island(name : String, url : String, styles : String, state : String, children : Array[Node[E]], trigger? : TriggerType) -> Node[E]