hxconfig

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: 0BSD Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

func New

func New() *Builder

func (*Builder) AddedClass

func (b *Builder) AddedClass(value string) *Builder

defaults to htmx-added

func (*Builder) AllowEval

func (b *Builder) AllowEval(value bool) *Builder

defaults to true, can be used to disable htmx’s use of eval for certain features (e.g. trigger filters)

func (*Builder) AllowScriptTags

func (b *Builder) AllowScriptTags(value bool) *Builder

defaults to true, determines if htmx will process script tags found in new content

func (*Builder) AttributesToSettle

func (b *Builder) AttributesToSettle(value []string) *Builder

defaults to ["class", "style", "width", "height"], the attributes to settle during the settling phase

func (*Builder) Build

func (b *Builder) Build() map[string]any

func (*Builder) DefaultFocusScroll

func (b *Builder) DefaultFocusScroll(value bool) *Builder

if the focused element should be scrolled into view, defaults to false and can be overridden using the focus-scroll swap modifier.

func (*Builder) DefaultSettleDelay

func (b *Builder) DefaultSettleDelay(value time.Duration) *Builder

defaults to 20

func (*Builder) DefaultSwapDelay

func (b *Builder) DefaultSwapDelay(value time.Duration) *Builder

defaults to 0

func (*Builder) DefaultSwapStyle

func (b *Builder) DefaultSwapStyle(value swap.Strategy) *Builder

defaults to innerHTML

func (*Builder) DisableSelector

func (b *Builder) DisableSelector(value string) *Builder

defaults to [hx-disable], [data-hx-disable], htmx will not process elements with this attribute on it or a parent

func (*Builder) GetCacheBusterParam

func (b *Builder) GetCacheBusterParam(value bool) *Builder

defaults to false, if set to true htmx will include a cache-busting parameter in GET requests to avoid caching partial responses by the browser

func (*Builder) GlobalViewTransitions

func (b *Builder) GlobalViewTransitions(value bool) *Builder

if set to true, htmx will use the View Transition API when swapping in new content.

func (*Builder) HistoryCacheSize

func (b *Builder) HistoryCacheSize(value int) *Builder

defaults to 10

func (*Builder) HistoryEnabled

func (b *Builder) HistoryEnabled(value bool) *Builder

HistoryEnabled defaults to true, really only useful for testing

func (*Builder) IgnoreTitle

func (b *Builder) IgnoreTitle(value bool) *Builder

defaults to false, if set to true htmx will not update the title of the document when a title tag is found in new content

func (*Builder) IncludeIndicatorStyles

func (b *Builder) IncludeIndicatorStyles(value bool) *Builder

defaults to true (determines if the indicator styles are loaded) )

func (*Builder) IndicatorClass

func (b *Builder) IndicatorClass(value string) *Builder

defaults to htmx-indicator

func (*Builder) InlineScriptNonce

func (b *Builder) InlineScriptNonce(value string) *Builder

defaults to ”, meaning that no nonce will be added to inline scripts

func (*Builder) MethodsThatUseUrlParams

func (b *Builder) MethodsThatUseUrlParams(value []HTTPMethod) *Builder

defaults to ["get"], htmx will format requests with these methods by encoding their parameters in the URL, not the request body

func (*Builder) RefreshOnHistoryMiss

func (b *Builder) RefreshOnHistoryMiss(value bool) *Builder

defaults to false, if set to true htmx will issue a full page refresh on history misses rather than use an AJAX request

func (*Builder) RequestClass

func (b *Builder) RequestClass(value string) *Builder

defaults to htmx-request

func (*Builder) ScrollBehavior

func (b *Builder) ScrollBehavior(value ScrollBehavior) *Builder

defaults to ‘smooth’, the behavior for a boosted link on page transitions. The allowed values are auto and smooth. Smooth will smoothscroll to the top of the page while auto will behave like a vanilla link.

func (*Builder) ScrollIntoViewOnBoost

func (b *Builder) ScrollIntoViewOnBoost(value bool) *Builder

defaults to true, whether or not the target of a boosted element is scrolled into the viewport. If hx-target is omitted on a boosted element, the target defaults to body, causing the page to scroll to the top.

func (*Builder) SelfRequestsOnly

func (b *Builder) SelfRequestsOnly(value bool) *Builder

defaults to false, if set to true will only allow AJAX requests to the same domain as the current document

func (*Builder) SettlingClass

func (b *Builder) SettlingClass(value string) *Builder

defaults to htmx-settling

func (*Builder) SwappingClass

func (b *Builder) SwappingClass(value string) *Builder

defaults to htmx-swapping

func (*Builder) Timeout

func (b *Builder) Timeout(value time.Duration) *Builder

defaults to 0, the number of milliseconds a request can take before automatically being terminated

func (*Builder) TriggerSpecsCache

func (b *Builder) TriggerSpecsCache(value string) *Builder

defaults to null, the cache to store evaluated trigger specifications into, improving parsing performance at the cost of more memory usage. You may define a simple object to use a never-clearing cache, or implement your own system using a proxy object

func (*Builder) UseTemplateFragments

func (b *Builder) UseTemplateFragments(value bool) *Builder

defaults to false, HTML template tags for parsing content from the server (not IE11 compatible!)

func (*Builder) WSBinaryType

func (b *Builder) WSBinaryType(value string) *Builder

defaults to blob, the the type of binary data being received over the WebSocket connection

func (*Builder) WSReconnectDelay

func (b *Builder) WSReconnectDelay(value string) *Builder

defaults to ["get"], htmx will format requests with these methods by encoding their parameters in the URL, not the request body

func (*Builder) WithCredentials

func (b *Builder) WithCredentials(value bool) *Builder

defaults to false, allow cross-site Access-Control requests using credentials such as cookies, authorization headers or TLS client certificates

type HTTPMethod

type HTTPMethod string

An HTTPMethod is a named HTTP Method used for [Config.MethodsThatUseUrlParams]

const (
	MethodGet     HTTPMethod = "get"
	MethodPost    HTTPMethod = "post"
	MethodPut     HTTPMethod = "put"
	MethodDelete  HTTPMethod = "delete"
	MethodPatch   HTTPMethod = "patch"
	MethodHead    HTTPMethod = "head"
	MethodOptions HTTPMethod = "options"
)

type ScrollBehavior

type ScrollBehavior string
const (
	ScrollBehaviorAuto   ScrollBehavior = "auto"   // auto will behave like a vanilla link.
	ScrollBehaviorSmooth ScrollBehavior = "smooth" // smooth (default) will smoothscroll to the top of the page
)

Jump to

Keyboard shortcuts

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