Get and set site name

This commit is contained in:
2024-11-16 18:21:51 -07:00
parent beef4523c2
commit 7aa3c4fb3f
10 changed files with 235 additions and 100 deletions

54
hx/hx.go Normal file
View File

@ -0,0 +1,54 @@
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),
}
}