htmx

package module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2024 License: MIT Imports: 9 Imported by: 0

README

👮‍♀️ Htmx

Go Reference Go Report Card Taylor Swift

Installation

$ go get github.com/zeiss/fiber-htmx

Examples

See examples to understand the provided interfaces.

License

MIT

Documentation

Index

Constants

View Source
const (
	ElementType = NodeType(iota)
	AttributeType
)
View Source
const (
	// StatusStopPolling ...
	StatusStopPolling = 286
)

Variables

View Source
var ConfigDefault = Config{
	ErrorHandler: defaultErrorHandler,
}

ConfigDefault is the default config.

Functions

func AsBool

func AsBool(str string) bool

AsBool ...

func AsStr added in v1.0.1

func AsStr(v bool) string

AsStr ...

func ContextWithHx

func ContextWithHx(c *fiber.Ctx) *fiber.Ctx

ContextWithHx ...

func New

func New(config ...Config) fiber.Handler

New ...

func NewCompHandler added in v1.0.1

func NewCompHandler(n Node, config ...Config) fiber.Handler

NewCompHandler ...

func NewHtmxHandler

func NewHtmxHandler(handler HtmxHandlerFunc, config ...Config) fiber.Handler

NewHtmxHandler ...

Types

type ClassNames added in v1.0.1

type ClassNames map[string]bool

ClassNames ...

func (ClassNames) Render added in v1.0.1

func (c ClassNames) Render(w io.Writer) error

Render ...

func (ClassNames) String added in v1.0.1

func (c ClassNames) String() string

String ...

func (ClassNames) Type added in v1.0.1

func (c ClassNames) Type() NodeType

Type ...

type Config

type Config struct {
	// Next defines a function to skip this middleware when returned true.
	Next func(c *fiber.Ctx) bool

	// ErrorHandler is executed when an error is returned from fiber.Handler.
	//
	// Optional. Default: DefaultErrorHandler
	ErrorHandler fiber.ErrorHandler
}

Config ...

type HTML5Props added in v1.0.1

type HTML5Props struct {
	Title       string
	Description string
	Language    string
	Head        []Node
	Body        []Node
}

HTML5Props ...

type Htmx

type Htmx struct {
	// contains filtered or unexported fields
}

Htmx ...

func (*Htmx) Ctx

func (h *Htmx) Ctx() *fiber.Ctx

Ctx ...

func (*Htmx) IsHxBoosted

func (h *Htmx) IsHxBoosted() bool

IsHxBoosted ...

func (*Htmx) IsHxHistoryRestoreRequest

func (h *Htmx) IsHxHistoryRestoreRequest() bool

IsHxHistoryRestoreRequest ...

func (*Htmx) IsHxRequest

func (h *Htmx) IsHxRequest() bool

IsHxRequest ...

func (*Htmx) ReSelect

func (h *Htmx) ReSelect(target string)

ReSelect ...

func (*Htmx) ReSwap

func (h *Htmx) ReSwap(target string)

ReSwap ...

func (*Htmx) ReTarget

func (h *Htmx) ReTarget(target string)

ReTarget ...

func (*Htmx) Redirect

func (h *Htmx) Redirect(url string)

Redirect ..

func (*Htmx) RenderComp added in v1.0.1

func (h *Htmx) RenderComp(n Node) error

RenderComp ...

func (*Htmx) RenderPartial

func (h *Htmx) RenderPartial() bool

RenderPartial ...

func (*Htmx) ReplaceURL

func (h *Htmx) ReplaceURL(url string)

ReplaceURL ...

func (*Htmx) StopPolling

func (h *Htmx) StopPolling() error

StopPolling ...

func (*Htmx) Trigger

func (h *Htmx) Trigger(target string)

Trigger ...

func (*Htmx) Write

func (h *Htmx) Write(data []byte) (n int, err error)

Write ...

func (*Htmx) WriteHTML

func (h *Htmx) WriteHTML(html template.HTML) (n int, err error)

WriteHTML ...

func (*Htmx) WriteJSON

func (h *Htmx) WriteJSON(data any) (n int, err error)

WriteJSON ...

func (*Htmx) WriteString

func (h *Htmx) WriteString(s string) (n int, err error)

WriteString ...

type HtmxHandlerFunc

type HtmxHandlerFunc = func(hx *Htmx) error

HtmxHandler ...

type Hx

type Hx struct {
	HxBoosted               bool
	HxCurrentURL            string
	HxHistoryRestoreRequest bool
	HxPrompt                string
	HxRequest               bool
	HxTarget                string
	HxTriggerName           string
	HxTrigger               string
}

Hx ...

func HxFromContext

func HxFromContext(c *fiber.Ctx) *Hx

HxFromContext ...

type HxClassName added in v1.0.1

type HxClassName string

HxClassName ...

const (
	HxClassNameAdded     HxClassName = "htmx-added"
	HxClassNameIndicator HxClassName = "htmx-indicator"
	HxClassNameRequest   HxClassName = "htmx-request"
	HxClassNameSettling  HxClassName = "htmx-settling"
	HxClassNameSwapping  HxClassName = "htmx-swapping"
)

func (HxClassName) String added in v1.0.1

func (c HxClassName) String() string

String ...

type HxEventType added in v1.0.1

type HxEventType string

HxEventType ...

const (
	HxEventTypeAbort            HxEventType = "htmx:abort"
	HxEventTypeAfterLoad        HxEventType = "htmx:afterLoad"
	HxEventTypeAfterProcessNode HxEventType = "htmx:afterProcessNode"
	HxEventTypeAfterRequest     HxEventType = "htmx:afterRequest"
)

func (HxEventType) String added in v1.0.1

func (e HxEventType) String() string

String ...

type HxRequestHeader

type HxRequestHeader string

HxRequestHeader ...

const (
	HxRequestHeaderBoosted               HxRequestHeader = "HX-Boosted"
	HxRequestHeaderCurrentURL            HxRequestHeader = "HX-Current-URL"
	HxRequestHeaderHistoryRestoreRequest HxRequestHeader = "HX-History-Restore-Request"
	HxRequestHeaderPrompt                HxRequestHeader = "HX-Prompt"
	HxRequestHeaderRequest               HxRequestHeader = "HX-Request"
	HxRequestHeaderTarget                HxRequestHeader = "HX-Target"
	HxRequestHeaderTrigger               HxRequestHeader = "HX-Trigger"
	HxRequestHeaderTriggerName           HxRequestHeader = "HX-Trigger-Name"
)

func (HxRequestHeader) String

func (h HxRequestHeader) String() string

String ...

type HxResponseHeader

type HxResponseHeader string

HxResponseHeader ...

const (
	HXLocation           HxResponseHeader = "HX-Location"             // Allows you to do a client-side redirect that does not do a full page reload
	HXPushUrl            HxResponseHeader = "HX-Push-Url"             // pushes a new url into the history stack
	HXRedirect           HxResponseHeader = "HX-Redirect"             // can be used to do a client-side redirect to a new location
	HXRefresh            HxResponseHeader = "HX-Refresh"              // if set to "true" the client side will do a full refresh of the page
	HXReplaceUrl         HxResponseHeader = "HX-Replace-Url"          // replaces the current URL in the location bar
	HXReswap             HxResponseHeader = "HX-Reswap"               // Allows you to specify how the response will be swapped. See hx-swap for possible values
	HXRetarget           HxResponseHeader = "HX-Retarget"             // A CSS selector that updates the target of the content update to a different element on the page
	HXReselect           HxResponseHeader = "HX-Reselect"             // A CSS selector that allows you to choose which part of the response is used to be swapped in. Overrides an existing hx-select on the triggering element
	HXTrigger            HxResponseHeader = "HX-Trigger"              // allows you to trigger client side events, see the documentation for more info
	HXTriggerAfterSettle HxResponseHeader = "HX-Trigger-After-Settle" // allows you to trigger client side events, see the documentation for more info
	HXTriggerAfterSwap   HxResponseHeader = "HX-Trigger-After-Swap"   // allows you to trigger client side events, see the documentation for more info
)

func (HxResponseHeader) String

func (h HxResponseHeader) String() string

String ...

type HxResponseHeaders

type HxResponseHeaders struct {
	// contains filtered or unexported fields
}

HxResponseHeaders ...

func (*HxResponseHeaders) Get

Get ...

func (*HxResponseHeaders) Set

func (h *HxResponseHeaders) Set(k HxResponseHeader, val string)

Set ...

type Node added in v1.0.1

type Node interface {
	Render(w io.Writer) error
}

Node ...

func A added in v1.0.1

func A(children ...Node) Node

A ...

func Abbr added in v1.0.1

func Abbr(children ...Node) Node

func Accept added in v1.0.1

func Accept(v string) Node

func Action added in v1.0.1

func Action(v string) Node

func Address added in v1.0.1

func Address(children ...Node) Node

Address ...

func Alt added in v1.0.1

func Alt(v string) Node

func Area added in v1.0.1

func Area(children ...Node) Node

Area ...

func Aria added in v1.0.1

func Aria(name, v string) Node

func Article added in v1.0.1

func Article(children ...Node) Node

Article ...

func As added in v1.0.1

func As(v string) Node

func Aside added in v1.0.1

func Aside(children ...Node) Node

Aside

func Async added in v1.0.1

func Async() Node

func Attribute added in v1.0.1

func Attribute(name string, value ...string) Node

Attribute ...

func Audio added in v1.0.1

func Audio(children ...Node) Node

Audio ...

func AutoComplete added in v1.0.1

func AutoComplete(v string) Node

func AutoFocus added in v1.0.1

func AutoFocus() Node

func AutoPlay added in v1.0.1

func AutoPlay() Node

func B added in v1.0.1

func B(children ...Node) Node

func Base added in v1.0.1

func Base(children ...Node) Node

Base ...

func BlockQuote added in v1.0.1

func BlockQuote(children ...Node) Node

BlockQuote ...

func Body added in v1.0.1

func Body(children ...Node) Node

Body ...

func Br added in v1.0.1

func Br(children ...Node) Node

Br ...

func Button added in v1.0.1

func Button(children ...Node) Node

Button ...

func Canvas added in v1.0.1

func Canvas(children ...Node) Node

Canvas ...

func Caption added in v1.0.1

func Caption(children ...Node) Node

func Charset added in v1.0.1

func Charset(v string) Node

func Checked added in v1.0.1

func Checked() Node

func Cite added in v1.0.1

func Cite(children ...Node) Node

Cite ...

func Class added in v1.0.1

func Class(v string) Node

func Code added in v1.0.1

func Code(children ...Node) Node

Code ...

func Col added in v1.0.1

func Col(children ...Node) Node

Col ...

func ColGroup added in v1.0.1

func ColGroup(children ...Node) Node

ColGroup ...

func ColSpan added in v1.0.1

func ColSpan(v string) Node

func Cols added in v1.0.1

func Cols(v string) Node

func Content added in v1.0.1

func Content(v string) Node

func Controls added in v1.0.1

func Controls() Node

func DElement added in v1.0.1

func DElement(children ...Node) Node

func DataAttribute added in v1.0.1

func DataAttribute(name, v string) Node

func DataElement added in v1.0.1

func DataElement(children ...Node) Node

Data ...

func DataList added in v1.0.1

func DataList(children ...Node) Node

DataList ...

func Dd added in v1.0.1

func Dd(children ...Node) Node

func Defer added in v1.0.1

func Defer() Node

func Details added in v1.0.1

func Details(children ...Node) Node

Details ...

func Dfn added in v1.0.1

func Dfn(children ...Node) Node

func Dialog added in v1.0.1

func Dialog(children ...Node) Node

Dialog ...

func Disabled added in v1.0.1

func Disabled() Node

func Div added in v1.0.1

func Div(children ...Node) Node

Div ...

func Dl added in v1.0.1

func Dl(children ...Node) Node

Dl ...

func Doctype added in v1.0.1

func Doctype(sibling Node) Node

Doctype ...

func Dt added in v1.0.1

func Dt(children ...Node) Node

func Element added in v1.0.1

func Element(name string, children ...Node) Node

Element ...

func Em added in v1.0.1

func Em(children ...Node) Node

func Embed added in v1.0.1

func Embed(children ...Node) Node

Embed ...

func EncType added in v1.0.1

func EncType(v string) Node

func FieldSet added in v1.0.1

func FieldSet(children ...Node) Node

func FigCaption added in v1.0.1

func FigCaption(children ...Node) Node

func Figure added in v1.0.1

func Figure(children ...Node) Node
func Footer(children ...Node) Node

func For added in v1.0.1

func For(v string) Node

func FormAttribute added in v1.0.1

func FormAttribute(v string) Node

func FormElement added in v1.0.1

func FormElement(children ...Node) Node

func Group added in v1.0.1

func Group(children ...Node) Node

Group ...

func H1 added in v1.0.1

func H1(children ...Node) Node

func H2 added in v1.0.1

func H2(children ...Node) Node

func H3 added in v1.0.1

func H3(children ...Node) Node

func H4 added in v1.0.1

func H4(children ...Node) Node

func H5 added in v1.0.1

func H5(children ...Node) Node

func H6 added in v1.0.1

func H6(children ...Node) Node

func HGroup added in v1.0.1

func HGroup(children ...Node) Node

func HTML added in v1.0.1

func HTML(children ...Node) Node

func HTML5 added in v1.0.1

func HTML5(p HTML5Props) Node

HTML5 ...

func Head(children ...Node) Node
func Header(children ...Node) Node

func Height added in v1.0.1

func Height(v string) Node

func Hr added in v1.0.1

func Hr(children ...Node) Node

func Href added in v1.0.1

func Href(v string) Node

func HxBoost added in v1.0.1

func HxBoost(v bool) Node

func HxConfirm added in v1.0.1

func HxConfirm(msg string) Node

func HxDelete added in v1.0.1

func HxDelete(url string) Node

func HxDisable added in v1.0.1

func HxDisable() Node

func HxEncoding added in v1.0.1

func HxEncoding(enc string) Node

func HxExt added in v1.0.1

func HxExt(ext string) Node

func HxGet added in v1.0.1

func HxGet(url string) Node

func HxIndicator added in v1.0.1

func HxIndicator(target string) Node

func HxOn added in v1.0.1

func HxOn(target string, js string) Node

func HxPath added in v1.0.1

func HxPath(url string) Node

func HxPost added in v1.0.1

func HxPost(url string) Node

func HxPrompt added in v1.0.1

func HxPrompt(msg string) Node

func HxPushUrl added in v1.0.1

func HxPushUrl(v bool) Node

func HxPut added in v1.0.1

func HxPut(url string) Node

func HxSelect added in v1.0.1

func HxSelect(target string) Node

func HxSelectOob added in v1.0.1

func HxSelectOob(target string) Node

func HxSwap added in v1.0.1

func HxSwap(target string) Node

func HxSwapOob added in v1.0.1

func HxSwapOob(target string) Node

func HxTarget added in v1.0.1

func HxTarget(target string) Node

func HxTrigger added in v1.0.1

func HxTrigger(target string) Node

func HxValidate added in v1.0.1

func HxValidate(v bool) Node

func I added in v1.0.1

func I(children ...Node) Node

func ID added in v1.0.1

func ID(v string) Node

func IFrame added in v1.0.1

func IFrame(children ...Node) Node

func If added in v1.0.1

func If(condition bool, n Node) Node

If ...

func Img added in v1.0.1

func Img(children ...Node) Node

func Input added in v1.0.1

func Input(children ...Node) Node

func Ins added in v1.0.1

func Ins(children ...Node) Node

func Kbd added in v1.0.1

func Kbd(children ...Node) Node

func LabElement added in v1.0.1

func LabElement(children ...Node) Node

func Lang added in v1.0.1

func Lang(v string) Node

func Legend added in v1.0.1

func Legend(children ...Node) Node

func Li added in v1.0.1

func Li(children ...Node) Node
func Link(children ...Node) Node

func Loading added in v1.0.1

func Loading(v string) Node

func Loop added in v1.0.1

func Loop() Node

func Main added in v1.0.1

func Main(children ...Node) Node

func Mark added in v1.0.1

func Mark(children ...Node) Node

func Max added in v1.0.1

func Max(v string) Node

func MaxLength added in v1.0.1

func MaxLength(v string) Node
func Menu(children ...Node) Node

func Meta added in v1.0.1

func Meta(children ...Node) Node

func Meter added in v1.0.1

func Meter(children ...Node) Node

func Method added in v1.0.1

func Method(v string) Node

func Min added in v1.0.1

func Min(v string) Node

func MinLength added in v1.0.1

func MinLength(v string) Node

func Multiple added in v1.0.1

func Multiple() Node

func Muted added in v1.0.1

func Muted() Node

func Name added in v1.0.1

func Name(v string) Node
func Nav(children ...Node) Node

func NoScript added in v1.0.1

func NoScript(children ...Node) Node

func Object added in v1.0.1

func Object(children ...Node) Node

func Ol added in v1.0.1

func Ol(children ...Node) Node

func OptGroup added in v1.0.1

func OptGroup(children ...Node) Node

func Option added in v1.0.1

func Option(children ...Node) Node

func P added in v1.0.1

func P(children ...Node) Node

func Param added in v1.0.1

func Param(children ...Node) Node

func Pattern added in v1.0.1

func Pattern(v string) Node

func Picture added in v1.0.1

func Picture(children ...Node) Node

func Placeholder added in v1.0.1

func Placeholder(v string) Node

func PlaysInline added in v1.0.1

func PlaysInline() Node

func Poster added in v1.0.1

func Poster(v string) Node

func Pre added in v1.0.1

func Pre(children ...Node) Node

func Preload added in v1.0.1

func Preload(v string) Node

func Progress added in v1.0.1

func Progress(children ...Node) Node

func Q added in v1.0.1

func Q(children ...Node) Node

func Raw added in v1.0.1

func Raw(t string) Node

Raw ...

func Rawf added in v1.0.1

func Rawf(format string, a ...interface{}) Node

Rawf ...

func ReadOnly added in v1.0.1

func ReadOnly() Node

func Rel added in v1.0.1

func Rel(v string) Node

func Required added in v1.0.1

func Required() Node

func Role added in v1.0.1

func Role(v string) Node

func RowSpan added in v1.0.1

func RowSpan(v string) Node

func Rows added in v1.0.1

func Rows(v string) Node

func S added in v1.0.1

func S(children ...Node) Node

func SVG added in v1.0.1

func SVG(children ...Node) Node

func Samp added in v1.0.1

func Samp(children ...Node) Node

func Script added in v1.0.1

func Script(children ...Node) Node

func Section added in v1.0.1

func Section(children ...Node) Node

func Select added in v1.0.1

func Select(children ...Node) Node

func Selected added in v1.0.1

func Selected() Node

func Small added in v1.0.1

func Small(children ...Node) Node

func Source added in v1.0.1

func Source(children ...Node) Node

func Span added in v1.0.1

func Span(children ...Node) Node

func Src added in v1.0.1

func Src(v string) Node

func SrcSet added in v1.0.1

func SrcSet(v string) Node

func Step added in v1.0.1

func Step(v string) Node

func Strong added in v1.0.1

func Strong(children ...Node) Node

func StyleAttribute added in v1.0.1

func StyleAttribute(v string) Node

func StyleElement added in v1.0.1

func StyleElement(children ...Node) Node

func Sub added in v1.0.1

func Sub(children ...Node) Node

func Summary added in v1.0.1

func Summary(children ...Node) Node

func Sup added in v1.0.1

func Sup(children ...Node) Node

func TBody added in v1.0.1

func TBody(children ...Node) Node

func TFoot added in v1.0.1

func TFoot(children ...Node) Node

func THead added in v1.0.1

func THead(children ...Node) Node

func TabIndex added in v1.0.1

func TabIndex(v string) Node

func Table added in v1.0.1

func Table(children ...Node) Node

func Target added in v1.0.1

func Target(v string) Node

func Td added in v1.0.1

func Td(children ...Node) Node

func Text added in v1.0.1

func Text(t string) Node

Text ...

func Textarea added in v1.0.1

func Textarea(children ...Node) Node

func Textf added in v1.0.1

func Textf(format string, a ...interface{}) Node

Textf ...

func Th added in v1.0.1

func Th(children ...Node) Node

func Time added in v1.0.1

func Time(children ...Node) Node

func TitleAttribute added in v1.0.1

func TitleAttribute(v string) Node

func TitleElement added in v1.0.1

func TitleElement(children ...Node) Node

func Tr added in v1.0.1

func Tr(children ...Node) Node

func Type added in v1.0.1

func Type(v string) Node

func U added in v1.0.1

func U(children ...Node) Node

func Ul added in v1.0.1

func Ul(children ...Node) Node

func Value added in v1.0.1

func Value(v string) Node

func Var added in v1.0.1

func Var(children ...Node) Node

func Video added in v1.0.1

func Video(children ...Node) Node

func Wbr added in v1.0.1

func Wbr(children ...Node) Node

func Width added in v1.0.1

func Width(v string) Node

type NodeFunc added in v1.0.1

type NodeFunc func(io.Writer) error

NodeFunc ...

func (NodeFunc) Render added in v1.0.1

func (n NodeFunc) Render(w io.Writer) error

Render ...

func (NodeFunc) String added in v1.0.1

func (n NodeFunc) String() string

String ...

func (NodeFunc) Type added in v1.0.1

func (n NodeFunc) Type() NodeType

Type ...

type NodeType added in v1.0.1

type NodeType int

NodeType ...

type NodeTypeDescriptor added in v1.0.1

type NodeTypeDescriptor interface {
	Type() NodeType
}

NodeTypeDescriptor ...

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL