55 lines
963 B
Go
55 lines
963 B
Go
package hx
|
|
|
|
import (
|
|
h "git.codemonkeysoftware.net/b/hatmill"
|
|
a "git.codemonkeysoftware.net/b/hatmill/attribute"
|
|
)
|
|
|
|
func Get(url string) h.Attrib {
|
|
return h.Attrib{
|
|
Key: "hx-get",
|
|
Value: a.String(url),
|
|
}
|
|
}
|
|
|
|
func Patch(url string) h.Attrib {
|
|
return h.Attrib{
|
|
Key: "hx-patch",
|
|
Value: a.String(url),
|
|
}
|
|
}
|
|
|
|
func Trigger(event string) h.Attrib {
|
|
return h.Attrib{
|
|
Key: "hx-trigger",
|
|
Value: a.String(event),
|
|
}
|
|
}
|
|
|
|
func Target(target string) h.Attrib {
|
|
return h.Attrib{
|
|
Key: "hx-target",
|
|
Value: a.String(target),
|
|
}
|
|
}
|
|
|
|
type SwapKind string
|
|
|
|
const (
|
|
InnerHTML SwapKind = "innerHTML"
|
|
OuterHTML SwapKind = "outerHTML"
|
|
AfterBegin SwapKind = "afterbegin"
|
|
BeforeBegin SwapKind = "beforebegin"
|
|
BeforeEnd SwapKind = "beforeend"
|
|
AfterEnd SwapKind = "afterend"
|
|
Delete SwapKind = "delete"
|
|
None SwapKind = "none"
|
|
)
|
|
|
|
func Swap(kind SwapKind) h.Attrib {
|
|
return h.Attrib{
|
|
Key: "hx-target",
|
|
Value: a.String(kind),
|
|
}
|
|
}
|