Documentation
¶
Index ¶
- Constants
- func ApplyHeaders(headers http.Header, values map[string]string)
- type Config
- type Connector
- type HTMX
- func (x *HTMX) GetActionHeader() string
- func (x *HTMX) GetActionValue(r *http.Request) string
- func (x *HTMX) GetSelectHeader() string
- func (x *HTMX) GetSelectValue(r *http.Request) string
- func (x *HTMX) GetTargetHeader() string
- func (x *HTMX) GetTargetValue(r *http.Request) string
- func (h *HTMX) InteractionAttrs(interaction Interaction) map[string]string
- func (h *HTMX) RenderPartial(r *http.Request) bool
- func (h *HTMX) ResponseHeaders(response Response) map[string]string
- type HTMX4
- func (x HTMX4) GetActionHeader() string
- func (x HTMX4) GetActionValue(r *http.Request) string
- func (x HTMX4) GetSelectHeader() string
- func (x HTMX4) GetSelectValue(r *http.Request) string
- func (x HTMX4) GetTargetHeader() string
- func (h *HTMX4) GetTargetValue(r *http.Request) string
- func (h *HTMX4) InteractionAttrs(interaction Interaction) map[string]string
- func (h *HTMX4) RenderPartial(r *http.Request) bool
- func (h *HTMX4) ResponseHeaders(response Response) map[string]string
- type HeaderKey
- type Interaction
- type InteractionKind
- type Partial
- func (x *Partial) GetActionHeader() string
- func (x *Partial) GetActionValue(r *http.Request) string
- func (x *Partial) GetSelectHeader() string
- func (x *Partial) GetSelectValue(r *http.Request) string
- func (x *Partial) GetTargetHeader() string
- func (x *Partial) GetTargetValue(r *http.Request) string
- func (x *Partial) InteractionAttrs(interaction Interaction) map[string]string
- func (x *Partial) RenderPartial(r *http.Request) bool
- func (x *Partial) ResponseHeaders(response Response) map[string]string
- type Response
- type ResponseBuilder
- func (b *ResponseBuilder) Location(value string) *ResponseBuilder
- func (b *ResponseBuilder) PushURL(value string) *ResponseBuilder
- func (b *ResponseBuilder) Redirect(value string) *ResponseBuilder
- func (b *ResponseBuilder) Refresh(value bool) *ResponseBuilder
- func (b *ResponseBuilder) ReplaceURL(value string) *ResponseBuilder
- func (b *ResponseBuilder) Reselect(value string) *ResponseBuilder
- func (b *ResponseBuilder) Reswap(value string) *ResponseBuilder
- func (b *ResponseBuilder) ReswapWith(swap *Swap) *ResponseBuilder
- func (b *ResponseBuilder) Retarget(value string) *ResponseBuilder
- func (b *ResponseBuilder) Trigger(value string) *ResponseBuilder
- func (b *ResponseBuilder) TriggerAfterSettle(value string) *ResponseBuilder
- func (b *ResponseBuilder) TriggerAfterSettleWith(trigger *Trigger) *ResponseBuilder
- func (b *ResponseBuilder) TriggerAfterSwap(value string) *ResponseBuilder
- func (b *ResponseBuilder) TriggerAfterSwapWith(trigger *Trigger) *ResponseBuilder
- func (b *ResponseBuilder) TriggerWith(trigger *Trigger) *ResponseBuilder
- func (b *ResponseBuilder) Value() Response
- type Swap
- func (s *Swap) FocusScroll(enabled bool) *Swap
- func (s *Swap) IgnoreTitle(enabled bool) *Swap
- func (s *Swap) Scroll(target, direction string) *Swap
- func (s *Swap) Settle(duration time.Duration) *Swap
- func (s *Swap) Show(target, direction string) *Swap
- func (s *Swap) String() string
- func (s *Swap) Style(style SwapStyle) *Swap
- func (s *Swap) Swap(duration time.Duration) *Swap
- func (s *Swap) Transition(enabled bool) *Swap
- type SwapStyle
- type Trigger
- type Turbo
- func (x *Turbo) GetActionHeader() string
- func (x *Turbo) GetActionValue(r *http.Request) string
- func (x *Turbo) GetSelectHeader() string
- func (x *Turbo) GetSelectValue(r *http.Request) string
- func (x *Turbo) GetTargetHeader() string
- func (x *Turbo) GetTargetValue(r *http.Request) string
- func (t *Turbo) InteractionAttrs(interaction Interaction) map[string]string
- func (x *Turbo) RenderPartial(r *http.Request) bool
- func (x *Turbo) ResponseHeaders(response Response) map[string]string
- type Unpoly
- func (x *Unpoly) GetActionHeader() string
- func (x *Unpoly) GetActionValue(r *http.Request) string
- func (x *Unpoly) GetSelectHeader() string
- func (x *Unpoly) GetSelectValue(r *http.Request) string
- func (x *Unpoly) GetTargetHeader() string
- func (x *Unpoly) GetTargetValue(r *http.Request) string
- func (u *Unpoly) InteractionAttrs(interaction Interaction) map[string]string
- func (u *Unpoly) RenderPartial(r *http.Request) bool
- func (x *Unpoly) ResponseHeaders(response Response) map[string]string
Constants ¶
View Source
const ( InteractionAsync InteractionKind = "async" InteractionReveal InteractionKind = "reveal" InteractionPoll InteractionKind = "poll" InteractionStream InteractionKind = "stream" InteractionPrefetch InteractionKind = "prefetch" InteractionRefresh InteractionKind = "refresh" InteractionOn InteractionKind = "on" HeaderTarget HeaderKey = "X-Target" HeaderSelect HeaderKey = "X-Select" HeaderAction HeaderKey = "X-Action" HeaderLocation HeaderKey = "X-Location" HeaderPushURL HeaderKey = "X-Push-Url" HeaderRedirect HeaderKey = "X-Redirect" HeaderRefresh HeaderKey = "X-Refresh" HeaderReplaceURL HeaderKey = "X-Replace-Url" HeaderReswap HeaderKey = "X-Reswap" HeaderRetarget HeaderKey = "X-Retarget" HeaderReselect HeaderKey = "X-Reselect" HeaderTrigger HeaderKey = "X-Trigger" HeaderTriggerAfterSettle HeaderKey = "X-Trigger-After-Settle" HeaderTriggerAfterSwap HeaderKey = "X-Trigger-After-Swap" )
View Source
const ( SwapModifierSwap = "swap" SwapModifierSettle = "settle" SwapModifierTransition = "transition" SwapModifierIgnoreTitle = "ignoreTitle" SwapModifierFocusScroll = "focus-scroll" SwapModifierScroll = "scroll" SwapModifierShow = "show" )
View Source
const ( TurboHeaderTarget HeaderKey = "Turbo-Frame" TurboHeaderSelect HeaderKey = "Turbo-Select" TurboHeaderAction HeaderKey = "Turbo-Action" TurboAttrFrameID = "id" TurboAttrSource = "src" TurboAttrLoading = "loading" )
View Source
const ( UnpolyHeaderTarget HeaderKey = "X-Up-Target" UnpolyHeaderSelect HeaderKey = "X-Up-Select" UnpolyHeaderAction HeaderKey = "X-Up-Action" UnpolyAttrGet = "up-get" UnpolyAttrTrigger = "up-trigger" UnpolyAttrTarget = "up-target" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Connector ¶
type Connector interface {
RenderPartial(r *http.Request) bool
GetTargetValue(r *http.Request) string
GetSelectValue(r *http.Request) string
GetActionValue(r *http.Request) string
GetTargetHeader() string
GetSelectHeader() string
GetActionHeader() string
InteractionAttrs(interaction Interaction) map[string]string
ResponseHeaders(response Response) map[string]string
}
func NewPartial ¶
type HTMX ¶
type HTMX struct {
// contains filtered or unexported fields
}
func (*HTMX) GetActionHeader ¶
func (x *HTMX) GetActionHeader() string
func (*HTMX) GetActionValue ¶
func (*HTMX) GetSelectHeader ¶
func (x *HTMX) GetSelectHeader() string
func (*HTMX) GetSelectValue ¶
func (*HTMX) GetTargetHeader ¶
func (x *HTMX) GetTargetHeader() string
func (*HTMX) GetTargetValue ¶
func (*HTMX) InteractionAttrs ¶ added in v0.9.0
func (h *HTMX) InteractionAttrs(interaction Interaction) map[string]string
type HTMX4 ¶ added in v0.12.0
type HTMX4 struct{ *HTMX }
HTMX4 implements the htmx 4 protocol. NewHTMX remains the htmx 2 connector.
func (HTMX4) GetActionHeader ¶ added in v0.12.0
func (x HTMX4) GetActionHeader() string
func (HTMX4) GetActionValue ¶ added in v0.12.0
func (HTMX4) GetSelectHeader ¶ added in v0.12.0
func (x HTMX4) GetSelectHeader() string
func (HTMX4) GetSelectValue ¶ added in v0.12.0
func (HTMX4) GetTargetHeader ¶ added in v0.12.0
func (x HTMX4) GetTargetHeader() string
func (*HTMX4) GetTargetValue ¶ added in v0.12.0
func (*HTMX4) InteractionAttrs ¶ added in v0.12.0
func (h *HTMX4) InteractionAttrs(interaction Interaction) map[string]string
type HeaderKey ¶ added in v0.9.0
type HeaderKey string
const ( HTMXHeaderBoosted HeaderKey = "HX-Boosted" HTMXHeaderCurrentURL HeaderKey = "HX-Current-URL" HTMXHeaderHistoryRestoreRequest HeaderKey = "HX-History-Restore-Request" // HTMXHeaderPrompt is sent by HTMX 2 core; HTMX 4 requires hx-prompt. HTMXHeaderPrompt HeaderKey = "HX-Prompt" HTMXHeaderRequest HeaderKey = "HX-Request" HTMXHeaderTarget HeaderKey = "HX-Target" // HTMX 2 request keys. HTMX 4 replaces both with HTMXHeaderSource. HTMXHeaderTriggerName HeaderKey = "HX-Trigger-Name" HTMXHeaderTriggerRequest HeaderKey = "HX-Trigger" HTMXHeaderLocation HeaderKey = "HX-Location" HTMXHeaderPushURL HeaderKey = "HX-Push-Url" HTMXHeaderRedirect HeaderKey = "HX-Redirect" HTMXHeaderRefresh HeaderKey = "HX-Refresh" HTMXHeaderReplaceURL HeaderKey = "HX-Replace-Url" HTMXHeaderReswap HeaderKey = "HX-Reswap" HTMXHeaderRetarget HeaderKey = "HX-Retarget" HTMXHeaderReselect HeaderKey = "HX-Reselect" HTMXHeaderTrigger HeaderKey = "HX-Trigger" // Timing response headers are HTMX 2-only; NewHTMX4 omits them. HTMXHeaderTriggerAfterSettle HeaderKey = "HX-Trigger-After-Settle" HTMXHeaderTriggerAfterSwap HeaderKey = "HX-Trigger-After-Swap" HTMXAttrGet = "hx-get" // HTMXAttrExt is HTMX 2-only. HTMX 4 loads extension scripts directly. HTMXAttrExt = "hx-ext" HTMXAttrTrigger = "hx-trigger" HTMXAttrTarget = "hx-target" HTMXAttrSwap = "hx-swap" // HTMX 2 SSE extension attributes. HTMX 4 uses HTMX4AttrSSEConnect. HTMXAttrSSEConnect = "sse-connect" HTMXAttrSSESwap = "sse-swap" )
type Interaction ¶ added in v0.9.0
type InteractionKind ¶ added in v0.9.0
type InteractionKind string
type Partial ¶
type Partial struct {
// contains filtered or unexported fields
}
func (*Partial) GetActionHeader ¶
func (x *Partial) GetActionHeader() string
func (*Partial) GetActionValue ¶
func (*Partial) GetSelectHeader ¶
func (x *Partial) GetSelectHeader() string
func (*Partial) GetSelectValue ¶
func (*Partial) GetTargetHeader ¶
func (x *Partial) GetTargetHeader() string
func (*Partial) GetTargetValue ¶
func (*Partial) InteractionAttrs ¶ added in v0.9.0
func (x *Partial) InteractionAttrs(interaction Interaction) map[string]string
func (*Partial) RenderPartial ¶
func (*Partial) ResponseHeaders ¶ added in v0.9.0
type ResponseBuilder ¶ added in v0.9.0
type ResponseBuilder struct {
// contains filtered or unexported fields
}
ResponseBuilder mutates a Response through fluent methods.
It is intended for single-goroutine request/configuration use. Do not share a builder across goroutines without external synchronization.
func NewResponseBuilder ¶ added in v0.9.0
func NewResponseBuilder(response *Response) *ResponseBuilder
func (*ResponseBuilder) Location ¶ added in v0.9.0
func (b *ResponseBuilder) Location(value string) *ResponseBuilder
func (*ResponseBuilder) PushURL ¶ added in v0.9.0
func (b *ResponseBuilder) PushURL(value string) *ResponseBuilder
func (*ResponseBuilder) Redirect ¶ added in v0.9.0
func (b *ResponseBuilder) Redirect(value string) *ResponseBuilder
func (*ResponseBuilder) Refresh ¶ added in v0.9.0
func (b *ResponseBuilder) Refresh(value bool) *ResponseBuilder
func (*ResponseBuilder) ReplaceURL ¶ added in v0.9.0
func (b *ResponseBuilder) ReplaceURL(value string) *ResponseBuilder
func (*ResponseBuilder) Reselect ¶ added in v0.9.0
func (b *ResponseBuilder) Reselect(value string) *ResponseBuilder
func (*ResponseBuilder) Reswap ¶ added in v0.9.0
func (b *ResponseBuilder) Reswap(value string) *ResponseBuilder
func (*ResponseBuilder) ReswapWith ¶ added in v0.9.0
func (b *ResponseBuilder) ReswapWith(swap *Swap) *ResponseBuilder
func (*ResponseBuilder) Retarget ¶ added in v0.9.0
func (b *ResponseBuilder) Retarget(value string) *ResponseBuilder
func (*ResponseBuilder) Trigger ¶ added in v0.9.0
func (b *ResponseBuilder) Trigger(value string) *ResponseBuilder
func (*ResponseBuilder) TriggerAfterSettle ¶ added in v0.9.0
func (b *ResponseBuilder) TriggerAfterSettle(value string) *ResponseBuilder
func (*ResponseBuilder) TriggerAfterSettleWith ¶ added in v0.9.0
func (b *ResponseBuilder) TriggerAfterSettleWith(trigger *Trigger) *ResponseBuilder
func (*ResponseBuilder) TriggerAfterSwap ¶ added in v0.9.0
func (b *ResponseBuilder) TriggerAfterSwap(value string) *ResponseBuilder
func (*ResponseBuilder) TriggerAfterSwapWith ¶ added in v0.9.0
func (b *ResponseBuilder) TriggerAfterSwapWith(trigger *Trigger) *ResponseBuilder
func (*ResponseBuilder) TriggerWith ¶ added in v0.9.0
func (b *ResponseBuilder) TriggerWith(trigger *Trigger) *ResponseBuilder
func (*ResponseBuilder) Value ¶ added in v0.9.0
func (b *ResponseBuilder) Value() Response
type Swap ¶ added in v0.9.0
type Swap struct {
// contains filtered or unexported fields
}
Swap builds an HTMX-compatible swap header value.
Swap is mutable and is not safe for concurrent mutation.
func (*Swap) FocusScroll ¶ added in v0.9.0
func (*Swap) IgnoreTitle ¶ added in v0.9.0
func (*Swap) Transition ¶ added in v0.9.0
type SwapStyle ¶ added in v0.9.0
type SwapStyle string
const ( SwapInnerHTML SwapStyle = "innerHTML" SwapOuterHTML SwapStyle = "outerHTML" SwapBeforeBegin SwapStyle = "beforebegin" SwapAfterBegin SwapStyle = "afterbegin" SwapBeforeEnd SwapStyle = "beforeend" SwapAfterEnd SwapStyle = "afterend" SwapDelete SwapStyle = "delete" SwapNone SwapStyle = "none" // Additional built-in HTMX 4 styles. Morph/sync require an extension in HTMX 2. SwapInnerMorph SwapStyle = "innerMorph" SwapOuterMorph SwapStyle = "outerMorph" SwapOuterSync SwapStyle = "outerSync" SwapTextContent SwapStyle = "textContent" )
type Trigger ¶ added in v0.9.0
type Trigger struct {
// contains filtered or unexported fields
}
Trigger builds an HTMX-compatible trigger header value.
Trigger is mutable and is not safe for concurrent mutation.
func NewTrigger ¶ added in v0.9.0
func NewTrigger() *Trigger
func (*Trigger) AddEventDetailed ¶ added in v0.9.0
func (*Trigger) AddEventObject ¶ added in v0.9.0
type Turbo ¶
type Turbo struct {
// contains filtered or unexported fields
}
func (*Turbo) GetActionHeader ¶
func (x *Turbo) GetActionHeader() string
func (*Turbo) GetActionValue ¶
func (*Turbo) GetSelectHeader ¶
func (x *Turbo) GetSelectHeader() string
func (*Turbo) GetSelectValue ¶
func (*Turbo) GetTargetHeader ¶
func (x *Turbo) GetTargetHeader() string
func (*Turbo) GetTargetValue ¶
func (*Turbo) InteractionAttrs ¶ added in v0.9.0
func (t *Turbo) InteractionAttrs(interaction Interaction) map[string]string
func (*Turbo) RenderPartial ¶
func (*Turbo) ResponseHeaders ¶ added in v0.9.0
type Unpoly ¶
type Unpoly struct {
// contains filtered or unexported fields
}
func (*Unpoly) GetActionHeader ¶
func (x *Unpoly) GetActionHeader() string
func (*Unpoly) GetActionValue ¶
func (*Unpoly) GetSelectHeader ¶
func (x *Unpoly) GetSelectHeader() string
func (*Unpoly) GetSelectValue ¶
func (*Unpoly) GetTargetHeader ¶
func (x *Unpoly) GetTargetHeader() string
func (*Unpoly) GetTargetValue ¶
func (*Unpoly) InteractionAttrs ¶ added in v0.9.0
func (u *Unpoly) InteractionAttrs(interaction Interaction) map[string]string
func (*Unpoly) ResponseHeaders ¶ added in v0.9.0
Click to show internal directories.
Click to hide internal directories.