79 lines
1.4 KiB
Go
79 lines
1.4 KiB
Go
package nebula
|
|
|
|
type Option func(*Config)
|
|
|
|
func WithBasePath(path string) Option {
|
|
return func(c *Config) {
|
|
c.BasePath = path
|
|
}
|
|
}
|
|
|
|
func WithAppTitle(title string) Option {
|
|
return func(c *Config) {
|
|
c.AppTitle = title
|
|
}
|
|
}
|
|
|
|
func WithTheme(theme string) Option {
|
|
return func(c *Config) {
|
|
c.Theme = theme
|
|
}
|
|
}
|
|
|
|
func WithTransitions(enabled bool) Option {
|
|
return func(c *Config) {
|
|
c.HTMX.Transitions = enabled
|
|
}
|
|
}
|
|
|
|
func WithImplicitInheritance(enabled bool) Option {
|
|
return func(c *Config) {
|
|
c.HTMX.ImplicitInheritance = enabled
|
|
}
|
|
}
|
|
|
|
func WithSelfRequestsOnly(enabled bool) Option {
|
|
return func(c *Config) {
|
|
c.HTMX.SelfRequestsOnly = enabled
|
|
}
|
|
}
|
|
|
|
func WithTimeout(ms int) Option {
|
|
return func(c *Config) {
|
|
c.HTMX.Timeout = ms
|
|
}
|
|
}
|
|
|
|
func WithNoSwap(codes ...string) Option {
|
|
return func(c *Config) {
|
|
c.HTMX.NoSwap = codes
|
|
}
|
|
}
|
|
|
|
func WithSSE(enabled bool) Option {
|
|
return func(c *Config) {
|
|
c.SSE.Enabled = enabled
|
|
}
|
|
}
|
|
|
|
func WithSSEReconnect(enabled bool, delay, maxDelay, maxAttempts int) Option {
|
|
return func(c *Config) {
|
|
c.SSE.Reconnect = enabled
|
|
c.SSE.ReconnectDelay = delay
|
|
c.SSE.ReconnectMaxDelay = maxDelay
|
|
c.SSE.ReconnectMaxAttempts = maxAttempts
|
|
}
|
|
}
|
|
|
|
func WithPreload(enabled bool) Option {
|
|
return func(c *Config) {
|
|
c.Preload = enabled
|
|
}
|
|
}
|
|
|
|
func WithMorphing(enabled bool) Option {
|
|
return func(c *Config) {
|
|
c.Morphing = enabled
|
|
}
|
|
}
|