Documentation
¶
Index ¶
- Variables
- func AllowBlocking(ctx context.Context) context.Context
- func Call(ctx context.Context, action Action) context.CancelFunc
- func EndInstance(ctx context.Context)
- func EndSession(ctx context.Context)
- func ExpireSession(ctx context.Context, d time.Duration)
- func Go(f func(context.Context)) gox.Editor
- func HashId(string string) string
- func Inject[T any](key any, beam Beam[T]) gox.Proxy
- func InstanceId(ctx context.Context) string
- func InstanceInit(ctx context.Context, key any, new func() any) any
- func InstanceLoad(ctx context.Context, key any) any
- func InstanceRemove(ctx context.Context, key any) any
- func InstanceSave(ctx context.Context, key any, value any) any
- func RandId() string
- func SessionId(ctx context.Context) string
- func SessionInit(ctx context.Context, key any, new func() any) any
- func SessionLoad(ctx context.Context, key any) any
- func SessionRemove(ctx context.Context, key any) any
- func SessionSave(ctx context.Context, key any, value any) any
- func Status(statusCode int) gox.Editor
- func Sub[T any](beam Beam[T], el func(T) gox.Elem) gox.Editor
- func TitleMeta[M any](b Beam[M], el func(M) gox.Elem) gox.Editor
- func UseCSP(r Router, csp CSP)
- func UseESConf(r Router, conf ESConf)
- func UseErrorPage(r Router, page func(message string) gox.Elem)
- func UseFallback(r Router, handler http.Handler)
- func UseLicense(r Router, cert string)
- func UseModel[M any](r Router, handler func(m ModelRouter[M], r RModel[M]) ModelRoute)
- func UseRoute(r Router, rt Route)
- func UseSessionCallback(r Router, callback SessionCallback)
- func UseSystemConf(r Router, conf SystemConf)
- func XCall[T any](ctx context.Context, action Action) (<-chan CallResult[T], context.CancelFunc)
- type ABlur
- type AChange
- type AClick
- type AData
- type ADataMap
- type ADyn
- type AFileHref
- type AFocus
- type AFocusIn
- type AFocusOut
- type AGotPointerCapture
- type AHook
- type AHref
- type AInput
- type AKeyDown
- type AKeyUp
- type ALostPointerCapture
- type APointerCancel
- type APointerDown
- type APointerEnter
- type APointerLeave
- type APointerMove
- type APointerOut
- type APointerOver
- type APointerUp
- type ARawFileHref
- type ARawHook
- type ARawSrc
- type ARawSubmit
- type ASrc
- type ASubmit
- type Action
- func ActionOnlyEmit(name string, arg any) []Action
- func ActionOnlyIndicate(indicator []Indicator, duration time.Duration) []Action
- func ActionOnlyLocationAssign(model any) []Action
- func ActionOnlyLocationReload() []Action
- func ActionOnlyLocationReplace(model any) []Action
- func ActionOnlyRawLocationAssign(url string) []Action
- func ActionOnlyScroll(selector string, smooth bool) []Action
- type ActionEmit
- type ActionIndicate
- type ActionLocationAssign
- type ActionLocationReload
- type ActionLocationReplace
- type ActionRawLocationAssign
- type ActionScroll
- type Active
- type App
- type Attr
- type Beam
- type CSP
- type CallResult
- type ChangeEvent
- type Door
- type ESConf
- type ESOptions
- type FocusEvent
- type HrefActiveMatch
- type ImportCommonJS
- type ImportModule
- type ImportStyle
- type Indicator
- func IndicatorOnlyAttr(attr string, value string) []Indicator
- func IndicatorOnlyAttrQuery(query string, attr string, value string) []Indicator
- func IndicatorOnlyAttrQueryAll(query string, attr string, value string) []Indicator
- func IndicatorOnlyAttrQueryParent(query string, attr string, value string) []Indicator
- func IndicatorOnlyClass(class string) []Indicator
- func IndicatorOnlyClassQuery(query string, class string) []Indicator
- func IndicatorOnlyClassQueryAll(query string, class string) []Indicator
- func IndicatorOnlyClassQueryParent(query string, class string) []Indicator
- func IndicatorOnlyClassRemove(class string) []Indicator
- func IndicatorOnlyClassRemoveQuery(query string, class string) []Indicator
- func IndicatorOnlyClassRemoveQueryAll(query string, class string) []Indicator
- func IndicatorOnlyClassRemoveQueryParent(query string, class string) []Indicator
- func IndicatorOnlyContent(content string) []Indicator
- func IndicatorOnlyContentQuery(query string, content string) []Indicator
- func IndicatorOnlyContentQueryAll(query string, content string) []Indicator
- func IndicatorOnlyContentQueryParent(query string, content string) []Indicator
- type IndicatorAttr
- type IndicatorClass
- type IndicatorClassRemove
- type IndicatorContent
- type InputEvent
- type JSX
- type KeyboardEvent
- type Location
- type ModelRoute
- type ModelRouter
- type ParsedForm
- type PathMatcher
- type PointerEvent
- type ProviderExternal
- type ProviderFS
- type ProviderJsBytes
- type ProviderJsString
- type ProviderLocal
- type ProviderPath
- type ProviderStyleBytes
- type ProviderStyleString
- type ProviderTsBytes
- type ProviderTsString
- type QueryMatcher
- func QueryMatcherIfPresent(params ...string) QueryMatcher
- func QueryMatcherIgnoreAll() QueryMatcher
- func QueryMatcherIgnoreSome(params ...string) QueryMatcher
- func QueryMatcherOnlyIfPresent(params ...string) []QueryMatcher
- func QueryMatcherOnlyIgnoreAll() []QueryMatcher
- func QueryMatcherOnlyIgnoreSome(params ...string) []QueryMatcher
- func QueryMatcherOnlySome(params ...string) []QueryMatcher
- func QueryMatcherSome(params ...string) QueryMatcher
- type R
- type RAfter
- type REvent
- type RForm
- type RHook
- type RModel
- type RRawForm
- type RRawHook
- type Route
- type RouteDir
- type RouteFS
- type RouteFile
- type RouteResource
- type RouteResourceFS
- type Router
- type Scope
- type ScopeBlocking
- type ScopeConcurrent
- type ScopeDebounce
- type ScopeFrame
- type ScopeSerial
- type ScopeSet
- type ScriptFormat
- type ScriptProvider
- type Selector
- type SessionCallback
- type Source
- type StyleProvider
- type SystemConf
- type Use
Constants ¶
This section is empty.
Variables ¶
var DocsFS embed.FS
DocsFS is the embedded documentation tree for internal purposes.
Functions ¶
func AllowBlocking ¶
AllowBlocking returns a context that suppresses warnings when used with blocking X* operations. Use with caution.
func Call ¶
func Call(ctx context.Context, action Action) context.CancelFunc
Call dispatches an action to the client side. Returns a cancel function to abort the call (best-effort).
func EndInstance ¶
EndInstance ends the current instance (tab/window) but keeps the session and other instances active.
func EndSession ¶
EndSession immediately ends the current session and all instances. Use during logout to close authorized pages and free server resources.
func ExpireSession ¶
ExpireSession sets the maximum lifetime of the current session.
func Go ¶
Go starts a goroutine at render time using a blocking-safe context tied to the component's lifecycle.
The goroutine runs only if the component is rendered. The context is canceled when the component is unmounted, allowing for proper cleanup. You must explicitly listen to ctx.Done() to stop work.
The context allows safe blocking operations, making it safe to use with X* operations (e.g., XUpdate, XRemove).
Example:
@doors.Go(func(ctx context.Context) {
for {
select {
case <-time.After(time.Second):
door.Update(ctx, currentTime())
case <-ctx.Done():
return
}
}
})
Parameters:
- f: a function to run in a goroutine, scoped to the component's render lifecycle
Returns:
- A non-visual templ.Component that starts the goroutine when rendered
func HashId ¶
HashId creates ID using provided string, hashbased. For the same string outputs the same result. Suitable for HTML attributes.
func InstanceId ¶
InstanceId returns the unique ID of the current instance. Useful for logging, debugging, and tracking connections.
func InstanceInit ¶
InstanceInit returns the value stored under key in instance-scoped storage, initializing it with new() if the key is not already present.
func InstanceLoad ¶
InstanceLoad gets a value from instance-scoped storage by key. Returns nil if absent. Callers must type-assert the result.
func InstanceRemove ¶
InstanceRemove deletes a key/value from instance-scoped storage. Returns the removed value or nil if absent.
func InstanceSave ¶
InstanceSave stores a key/value in instance-scoped storage. Returns the previous value.
func RandId ¶
func RandId() string
RandId returns a cryptographically secure, URL-safe random ID. Suitable for sessions, instances, tokens, attributes. Case-sensitive.
func SessionId ¶
SessionId returns the unique ID of the current session. All instances in the same browser share this ID via a session cookie.
func SessionInit ¶
SessionInit returns the value stored under key in session-scoped storage, initializing it with new() if the key is not already present.
func SessionLoad ¶
SessionLoad gets a value from session-scoped storage by key. Returns nil if absent. Callers must type-assert the result.
func SessionRemove ¶
SessionRemove deletes a key/value from session-scoped storage. Returns the removed value or nil if absent.
func SessionSave ¶
SessionSave stores a key/value in session-scoped storage shared by all instances in the session. Returns the previous value under the key.
func Status ¶
Status sets the HTTP status code when rendered in a template. Makes effect only at initial page render. Example: ~(doors.Status(404))
func UseCSP ¶
UseCSP configures Content Security Policy headers for enhanced security. This helps prevent XSS attacks and other security vulnerabilities.
func UseESConf ¶
UseESConf configures esbuild profiles for JavaScript/TypeScript processing. Different profiles can be used for development vs production builds.
func UseErrorPage ¶
UseErrorPage sets a custom error page component for handling internal errors. The component receives the error message as a parameter.
func UseFallback ¶
UseFallback sets a fallback handler for requests that don't match any routes. This is useful for integrating with other HTTP handlers or serving custom 404 pages.
func UseLicense ¶
UseLicense verifies and adds license certificate. License is required for non AGPL3 complient use. You can purchase suitable license at https://doors.dev or via email sales@doors.dev
func UseModel ¶
func UseModel[M any](r Router, handler func(m ModelRouter[M], r RModel[M]) ModelRoute)
UseModel registers a model handler for a path model type M. The model defines path/query patterns via struct tags.
Example:
type BlogPath struct {
Home bool `path:"/"` // Match root path
Post bool `path:"/post/:ID"` // Match /post/123, capture ID
List bool `path:"/posts"` // Match /posts
ID int // Captured from :ID parameter
Tag *string `query:"tag"` // Query parameter ?tag=golang
}
func UseRoute ¶
UseRoute adds a custom Route to the router. A Route must implement:
- Match(*http.Request) bool: whether the route handles the request
- Serve(http.ResponseWriter, *http.Request): serve the matched request
func UseSessionCallback ¶
func UseSessionCallback(r Router, callback SessionCallback)
UseSessionCallback registers callbacks for session lifecycle events. The Create callback is called when a new session is created. The Delete callback is called when a session is removed.
func UseSystemConf ¶
func UseSystemConf(r Router, conf SystemConf)
UseSystemConf applies system-wide configuration including timeouts, limits, and other framework behavior settings.
func XCall ¶
func XCall[T any](ctx context.Context, action Action) (<-chan CallResult[T], context.CancelFunc)
XCall dispatches an action to the client side and returns a result channel. The channel is closed without a value if the call is canceled. Cancellation is best-effort. Wait on the channel only in contexts where blocking is allowed (hooks, goroutines). The output value is unmarshaled into type T. For all actions, except ActionEmit, use json.RawMessage as T.
Types ¶
type ABlur ¶
type ABlur struct {
// Defines how the hook is scheduled (e.g. blocking, debounce).
// Optional.
Scope []Scope
// Visual indicators while the hook is running.
// Optional.
Indicator []Indicator
// Actions to run before the hook request.
// Optional.
Before []Action
// Backend event handler.
// Receives a typed REvent[FocusEvent].
// Should return true when the hook is complete and can be removed.
// Required.
On func(context.Context, REvent[FocusEvent]) bool
// Actions to run on error.
// Optional.
OnError []Action
}
ABlur prepares a blur event hook for DOM elements, with configurable propagation, scheduling, indicators, and handlers.
type AChange ¶
type AChange struct {
// Defines how the hook is scheduled (e.g. blocking, debounce).
// Optional.
Scope []Scope
// Visual indicators while the hook is running.
// Optional.
Indicator []Indicator
// Actions to run before the hook request.
// Optional.
Before []Action
// Backend event handler.
// Receives a typed REvent[ChangeEvent].
// Should return true when the hook is complete and can be removed.
// Required.
On func(context.Context, REvent[ChangeEvent]) bool
// Actions to run on error.
// Optional.
OnError []Action
}
AChange prepares a change event hook for DOM elements, with configurable propagation, scheduling, indicators, and handlers.
type AClick ¶
type AClick struct {
// If true, stops the event from bubbling up the DOM.
// Optional.
StopPropagation bool
// If true, prevents the browser's default action for the event.
// Optional.
PreventDefault bool
// If true, only fires when the event occurs on this element itself.
// Optional.
ExactTarget bool
// Defines how the hook is scheduled (e.g. blocking, debounce).
// Optional.
Scope []Scope
// Visual indicators while the hook is running.
// Optional.
Indicator []Indicator
// Actions to run before the hook request.
// Optional.
Before []Action
// Backend event handler.
// Receives a typed REvent[PointerEvent].
// Should return true when the hook is complete and can be removed.
// Required.
On func(context.Context, REvent[PointerEvent]) bool
// Actions to run on error.
// Optional.
OnError []Action
}
AClick prepares a click event hook for DOM elements, configuring propagation, scheduling, indicators, and handlers.
type AData ¶
type AData struct {
// Name of the data entry to read via JavaScript with $data(name).
// Required.
Name string
// Value to expose to the client. Marshaled to JSON.
// Required.
Value any
}
AData exposes server-provided data to JavaScript via $data(name).
The Value is marshaled to JSON and made available for client-side access. This is useful for passing initial state, configuration, or constants directly into the client runtime.
type ADyn ¶
type ADyn = *aDyn
ADyn is a dynamic attribute that can be updated at runtime.
type AFileHref ¶
type AFileHref struct {
// If true, resource is available for download only once.
Once bool
// File name. Optional.
Name string
// File system path to serve.
Path string
}
AFileHref prepares the href attribute for a downloadable resource served privately from a file system path.
type AFocus ¶
type AFocus struct {
// Defines how the hook is scheduled (e.g. blocking, debounce).
// Optional.
Scope []Scope
// Visual indicators while the hook is running.
// Optional.
Indicator []Indicator
// Actions to run before the hook request.
// Optional.
Before []Action
// Backend event handler.
// Receives a typed REvent[FocusEvent].
// Should return true when the hook is complete and can be removed.
// Required.
On func(context.Context, REvent[FocusEvent]) bool
// Actions to run on error.
// Optional.
OnError []Action
}
AFocus prepares a focus event hook for DOM elements, with configurable propagation, scheduling, indicators, and handlers.
type AFocusIn ¶
type AFocusIn struct {
// If true, stops the event from bubbling up the DOM.
// Optional.
StopPropagation bool
// If true, only fires when the event occurs on this element itself.
// Optional.
ExactTarget bool
// Defines how the hook is scheduled (e.g. blocking, debounce).
// Optional.
Scope []Scope
// Visual indicators while the hook is running.
// Optional.
Indicator []Indicator
// Actions to run before the hook request.
// Optional.
Before []Action
// Backend event handler.
// Receives a typed REvent[FocusEvent].
// Should return true when the hook is complete and can be removed.
// Required.
On func(context.Context, REvent[FocusEvent]) bool
// Actions to run on error.
// Optional.
OnError []Action
}
AFocusIn prepares a focusin event hook for DOM elements, with configurable propagation, scheduling, indicators, and handlers.
type AFocusOut ¶
type AFocusOut struct {
// If true, stops the event from bubbling up the DOM.
// Optional.
StopPropagation bool
// If true, only fires when the event occurs on this element itself.
// Optional.
ExactTarget bool
// Defines how the hook is scheduled (e.g. blocking, debounce).
// Optional.
Scope []Scope
// Visual indicators while the hook is running.
// Optional.
Indicator []Indicator
// Actions to run before the hook request.
// Optional.
Before []Action
// Backend event handler.
// Receives a typed REvent[FocusEvent].
// Should return true when the hook is complete and can be removed.
// Required.
On func(context.Context, REvent[FocusEvent]) bool
// Actions to run on error.
// Optional.
OnError []Action
}
AFocusOut prepares a focusout event hook for DOM elements, with configurable propagation, scheduling, indicators, and handlers.
type AGotPointerCapture ¶
type AGotPointerCapture struct {
// If true, stops the event from bubbling up the DOM.
// Optional.
StopPropagation bool
// If true, prevents the browser's default action for the event.
// Optional.
PreventDefault bool
// If true, only fires when the event occurs on this element itself.
// Optional.
ExactTarget bool
// Defines how the hook is scheduled (e.g. blocking, debounce).
// Optional.
Scope []Scope
// Visual indicators while the hook is running.
// Optional.
Indicator []Indicator
// Actions to run before the hook request.
// Optional.
Before []Action
// Backend event handler.
// Receives a typed REvent[PointerEvent].
// Should return true when the hook is complete and can be removed.
// Required.
On func(context.Context, REvent[PointerEvent]) bool
// Actions to run on error.
// Optional.
OnError []Action
}
AGotPointerCapture prepares a gotpointercapture event hook for DOM elements, with configurable propagation, scheduling, indicators, and handlers.
type AHook ¶
type AHook[T any] struct { // Name of the hook to call from JavaScript via $hook(name, ...). // Required. Name string // Defines how the hook is scheduled (e.g. blocking, debounce). // Optional. Scope []Scope // Visual indicators while the hook is running. // Optional. Indicator []Indicator // Backend handler for the hook. // Receives typed input (T, unmarshaled from JSON) through RHook, // and returns any output which will be marshaled to JSON. // Should return true when the hook is complete and can be removed. // Required. On func(ctx context.Context, r RHook[T]) (any, bool) }
AHook binds a backend handler to a named client-side hook, allowing JavaScript code to call Go functions via $hook(name, ...).
Input data is unmarshaled from JSON into type T. Output data is marshaled to JSON from any.
Generic parameters:
- T: input data type, sent from the client
type AHref ¶
type AHref struct {
// Target path model value. Required.
Model any
// Active link indicator configuration. Optional.
Active Active
// Stop event propagation (for dynamic links). Optional.
StopPropagation bool
// Defines how the hook is scheduled (e.g. blocking, debounce).
// Optional.
Scope []Scope
// Visual indicators while the hook is running
// (for dynamic links). Optional.
Indicator []Indicator
// Actions to run before the hook request (for dynamic links). Optional.
Before []Action
// Actions to run after the hook request (for dynamic links). Optional.
After []Action
// Actions to run on error (for dynamic links).
// Default (nil) triggers a location reload.
OnError []Action
}
AHref prepares the href attribute for internal navigation and configures dynamic link behavior.
type AInput ¶
type AInput struct {
// Defines how the hook is scheduled (e.g. blocking, debounce).
// Optional.
Scope []Scope
// Visual indicators while the hook is running.
// Optional.
Indicator []Indicator
// Actions to run before the hook request.
// Optional.
Before []Action
// Backend event handler.
// Receives a typed REvent[InputEvent].
// Should return true when the hook is complete and can be removed.
// Required.
On func(context.Context, REvent[InputEvent]) bool
// If true, does not include value in event
// Optional.
ExcludeValue bool
// Actions to run on error.
// Optional.
OnError []Action
}
type AKeyDown ¶
type AKeyDown struct {
// If true, stops the event from bubbling up the DOM.
// Optional.
StopPropagation bool
// If true, prevents the browser's default action for the event.
// Optional.
PreventDefault bool
// If true, only fires when the event occurs on this element itself.
// Optional.
ExactTarget bool
// Filters by event.key if provided.
// Optional.
Filter []string
// Defines how the hook is scheduled (e.g. blocking, debounce).
// Optional.
Scope []Scope
// Visual indicators while the hook is running.
// Optional.
Indicator []Indicator
// Backend event handler.
// Receives a typed REvent[KeyboardEvent].
// Should return true when the hook is complete and can be removed.
// Required.
On func(context.Context, REvent[KeyboardEvent]) bool
// Actions to run on error.
// Optional.
OnError []Action
// Actions to run before the hook request.
// Optional.
Before []Action
}
AKeyDown prepares a key down event hook for DOM elements, with configurable propagation, scheduling, indicators, and handlers.
type AKeyUp ¶
type AKeyUp struct {
// If true, stops the event from bubbling up the DOM.
// Optional.
StopPropagation bool
// If true, prevents the browser's default action for the event.
// Optional.
PreventDefault bool
// If true, only fires when the event occurs on this element itself.
// Optional.
ExactTarget bool
// Filters by event.key if provided.
// Optional.
Filter []string
// Defines how the hook is scheduled (e.g. blocking, debounce).
// Optional.
Scope []Scope
// Visual indicators while the hook is running.
// Optional.
Indicator []Indicator
// Backend event handler.
// Receives a typed REvent[KeyboardEvent].
// Should return true when the hook is complete and can be removed.
// Required.
On func(context.Context, REvent[KeyboardEvent]) bool
// Actions to run on error.
// Optional.
OnError []Action
// Actions to run before the hook request.
// Optional.
Before []Action
}
AKeyUp prepares a key up event hook for DOM elements, with configurable propagation, scheduling, indicators, and handlers.
type ALostPointerCapture ¶
type ALostPointerCapture struct {
// If true, stops the event from bubbling up the DOM.
// Optional.
StopPropagation bool
// If true, prevents the browser's default action for the event.
// Optional.
PreventDefault bool
// If true, only fires when the event occurs on this element itself.
// Optional.
ExactTarget bool
// Defines how the hook is scheduled (e.g. blocking, debounce).
// Optional.
Scope []Scope
// Visual indicators while the hook is running.
// Optional.
Indicator []Indicator
// Actions to run before the hook request.
// Optional.
Before []Action
// Backend event handler.
// Receives a typed REvent[PointerEvent].
// Should return true when the hook is complete and can be removed.
// Required.
On func(context.Context, REvent[PointerEvent]) bool
// Actions to run on error.
// Optional.
OnError []Action
}
ALostPointerCapture prepares a lostpointercapture event hook for DOM elements, with configurable propagation, scheduling, indicators, and handlers.
type APointerCancel ¶
type APointerCancel struct {
// If true, stops the event from bubbling up the DOM.
// Optional.
StopPropagation bool
// If true, prevents the browser's default action for the event.
// Optional.
PreventDefault bool
// If true, only fires when the event occurs on this element itself.
// Optional.
ExactTarget bool
// Defines how the hook is scheduled (e.g. blocking, debounce).
// Optional.
Scope []Scope
// Visual indicators while the hook is running.
// Optional.
Indicator []Indicator
// Actions to run before the hook request.
// Optional.
Before []Action
// Backend event handler.
// Receives a typed REvent[PointerEvent].
// Should return true when the hook is complete and can be removed.
// Required.
On func(context.Context, REvent[PointerEvent]) bool
// Actions to run on error.
// Optional.
OnError []Action
}
APointerCancel prepares a pointer cancel event hook for DOM elements, with configurable propagation, scheduling, indicators, and handlers.
type APointerDown ¶
type APointerDown struct {
// If true, stops the event from bubbling up the DOM.
// Optional.
StopPropagation bool
// If true, prevents the browser's default action for the event.
// Optional.
PreventDefault bool
// If true, only fires when the event occurs on this element itself.
// Optional.
ExactTarget bool
// Defines how the hook is scheduled (e.g. blocking, debounce).
// Optional.
Scope []Scope
// Visual indicators while the hook is running.
// Optional.
Indicator []Indicator
// Actions to run before the hook request.
// Optional.
Before []Action
// Backend event handler.
// Receives a typed REvent[PointerEvent].
// Should return true when the hook is complete and can be removed.
// Required.
On func(context.Context, REvent[PointerEvent]) bool
// Actions to run on error.
// Optional.
OnError []Action
}
APointerDown prepares a pointer down event hook for DOM elements, configuring propagation, scheduling, indicators, and handlers.
type APointerEnter ¶
type APointerEnter struct {
// If true, stops the event from bubbling up the DOM.
// Optional.
StopPropagation bool
// If true, prevents the browser's default action for the event.
// Optional.
PreventDefault bool
// If true, only fires when the event occurs on this element itself.
// Optional.
ExactTarget bool
// Defines how the hook is scheduled (e.g. blocking, debounce).
// Optional.
Scope []Scope
// Visual indicators while the hook is running.
// Optional.
Indicator []Indicator
// Actions to run before the hook request.
// Optional.
Before []Action
// Backend event handler.
// Receives a typed REvent[PointerEvent].
// Should return true when the hook is complete and can be removed.
// Required.
On func(context.Context, REvent[PointerEvent]) bool
// Actions to run on error.
// Optional.
OnError []Action
}
APointerEnter prepares a pointer enter event hook for DOM elements, with configurable propagation, scheduling, indicators, and handlers.
type APointerLeave ¶
type APointerLeave struct {
// If true, stops the event from bubbling up the DOM.
// Optional.
StopPropagation bool
// If true, prevents the browser's default action for the event.
// Optional.
PreventDefault bool
// If true, only fires when the event occurs on this element itself.
// Optional.
ExactTarget bool
// Defines how the hook is scheduled (e.g. blocking, debounce).
// Optional.
Scope []Scope
// Visual indicators while the hook is running.
// Optional.
Indicator []Indicator
// Actions to run before the hook request.
// Optional.
Before []Action
// Backend event handler.
// Receives a typed REvent[PointerEvent].
// Should return true when the hook is complete and can be removed.
// Required.
On func(context.Context, REvent[PointerEvent]) bool
// Actions to run on error.
// Optional.
OnError []Action
}
APointerLeave prepares a pointer leave event hook for DOM elements, with configurable propagation, scheduling, indicators, and handlers.
type APointerMove ¶
type APointerMove struct {
// If true, stops the event from bubbling up the DOM.
// Optional.
StopPropagation bool
// If true, prevents the browser's default action for the event.
// Optional.
PreventDefault bool
// If true, only fires when the event occurs on this element itself.
// Optional.
ExactTarget bool
// Defines how the hook is scheduled (e.g. blocking, debounce).
// Optional.
Scope []Scope
// Visual indicators while the hook is running.
// Optional.
Indicator []Indicator
// Actions to run before the hook request.
// Optional.
Before []Action
// Backend event handler.
// Receives a typed REvent[PointerEvent].
// Should return true when the hook is complete and can be removed.
// Required.
On func(context.Context, REvent[PointerEvent]) bool
// Actions to run on error.
// Optional.
OnError []Action
}
APointerMove prepares a pointer move event hook for DOM elements, configuring propagation, scheduling, indicators, and handlers.
type APointerOut ¶
type APointerOut struct {
// If true, stops the event from bubbling up the DOM.
// Optional.
StopPropagation bool
// If true, prevents the browser's default action for the event.
// Optional.
PreventDefault bool
// If true, only fires when the event occurs on this element itself.
// Optional.
ExactTarget bool
// Defines how the hook is scheduled (e.g. blocking, debounce).
// Optional.
Scope []Scope
// Visual indicators while the hook is running.
// Optional.
Indicator []Indicator
// Actions to run before the hook request.
// Optional.
Before []Action
// Backend event handler.
// Receives a typed REvent[PointerEvent].
// Should return true when the hook is complete and can be removed.
// Required.
On func(context.Context, REvent[PointerEvent]) bool
// Actions to run on error.
// Optional.
OnError []Action
}
APointerOut prepares a pointer out event hook for DOM elements, with configurable propagation, scheduling, indicators, and handlers.
type APointerOver ¶
type APointerOver struct {
// If true, stops the event from bubbling up the DOM.
// Optional.
StopPropagation bool
// If true, prevents the browser's default action for the event.
// Optional.
PreventDefault bool
// If true, only fires when the event occurs on this element itself.
// Optional.
ExactTarget bool
// Defines how the hook is scheduled (e.g. blocking, debounce).
// Optional.
Scope []Scope
// Visual indicators while the hook is running.
// Optional.
Indicator []Indicator
// Actions to run before the hook request.
// Optional.
Before []Action
// Backend event handler.
// Receives a typed REvent[PointerEvent].
// Should return true when the hook is complete and can be removed.
// Required.
On func(context.Context, REvent[PointerEvent]) bool
// Actions to run on error.
// Optional.
OnError []Action
}
APointerOver prepares a pointer over event hook for DOM elements, configuring propagation, scheduling, indicators, and handlers.
type APointerUp ¶
type APointerUp struct {
// If true, stops the event from bubbling up the DOM.
// Optional.
StopPropagation bool
// If true, prevents the browser's default action for the event.
// Optional.
PreventDefault bool
// If true, only fires when the event occurs on this element itself.
// Optional.
ExactTarget bool
// Defines how the hook is scheduled (e.g. blocking, debounce).
// Optional.
Scope []Scope
// Visual indicators while the hook is running.
// Optional.
Indicator []Indicator
// Actions to run before the hook request.
// Optional.
Before []Action
// Backend event handler.
// Receives a typed REvent[PointerEvent].
// Should return true when the hook is complete and can be removed.
// Required.
On func(context.Context, REvent[PointerEvent]) bool
// Actions to run on error.
// Optional.
OnError []Action
}
APointerUp prepares a pointer up event hook for DOM elements, configuring propagation, scheduling, indicators, and handlers.
type ARawFileHref ¶
type ARawFileHref struct {
// If true, resource is available for download only once.
Once bool
// File name. Optional.
Name string
// Handler for serving the resource request.
Handler func(w http.ResponseWriter, r *http.Request)
}
ARawFileHref prepares the href attribute for a downloadable resource served privately and directly through a custom handler.
type ARawHook ¶
type ARawHook struct {
// Name of the hook to call from JavaScript via $hook(name, ...).
// Required.
Name string
// Defines how the hook is scheduled (e.g. blocking, debounce).
// Optional.
Scope []Scope
// Visual indicators while the hook is running.
// Optional.
Indicator []Indicator
// Backend handler for the hook.
// Provides raw access via RRawHook (body reader, multipart parser).
// Should return true when the hook is complete and can be removed.
// Required.
On func(ctx context.Context, r RRawHook) bool
}
ARawHook binds a backend handler to a named client-side hook, allowing JavaScript code to call Go functions via $hook(name, ...).
Unlike AHook, ARawHook does not perform JSON unmarshaling or marshaling. Instead, it gives full access to the raw request body and multipart form data, useful for streaming, custom parsing, or file uploads.
type ARawSrc ¶
type ARawSrc struct {
// If true, resource is available for download only once.
Once bool
// File name. Optional.
Name string
// Handler for serving the resource request.
Handler func(w http.ResponseWriter, r *http.Request)
}
ARawSrc prepares the src attribute for a downloadable resource served directly and privately through a custom handler.
type ARawSubmit ¶
type ARawSubmit struct {
// Defines how the hook is scheduled (e.g. blocking, debounce).
// Optional.
Scope []Scope
// Visual indicators while the hook is running.
// Optional.
Indicator []Indicator
// Actions to run before the hook request.
// Optional.
Before []Action
// Backend form handler.
// Should return true when the hook is complete and can be removed.
// Required.
On func(context.Context, RRawForm) bool
// Actions to run on error.
// Optional.
OnError []Action
}
ARawSubmit handles form submissions with raw multipart data, giving full control over uploads, streaming, and parsing.
type ASrc ¶
type ASrc struct {
// If true, resource is available for download only once.
Once bool
// File name. Optional.
Name string
// File system path to serve.
Path string
}
ASrc prepares the src attribute for a downloadable resource served privately from a file system path.
type ASubmit ¶
type ASubmit[T any] struct { // MaxMemory sets the maximum number of bytes to parse into memory. // It is passed to ParseMultipartForm. // Defaults to 8 MB if zero. MaxMemory int // Defines how the hook is scheduled (e.g. blocking, debounce). // Optional. Scope []Scope // Visual indicators while the hook is running. // Optional. Indicator []Indicator // Actions to run before the hook request. // Optional. Before []Action // Backend form handler. // Should return true when the hook is complete and can be removed. // Required. On func(context.Context, RForm[T]) bool // Actions to run on error. // Optional. OnError []Action }
ASubmit handles form submissions with decoded data of type T, which must be a struct annotated for go-playground/form.
type Action ¶
type Action interface {
// contains filtered or unexported methods
}
Action performs a client-side operation
func ActionOnlyEmit ¶
ActionOnlyEmit returns a single ActionEmit.
func ActionOnlyIndicate ¶
ActionOnlyIndicate returns a single ActionIndicate.
func ActionOnlyLocationAssign ¶
ActionOnlyLocationAssign returns a single ActionLocationAssign.
func ActionOnlyLocationReload ¶
func ActionOnlyLocationReload() []Action
ActionOnlyLocationReload returns a single ActionLocationReload.
func ActionOnlyLocationReplace ¶
ActionOnlyLocationReplace returns a single ActionLocationReplace.
func ActionOnlyRawLocationAssign ¶
ActionOnlyRawLocationAssign returns a single ActionLocationAssign.
func ActionOnlyScroll ¶
ActionOnlyScroll returns a single ActionScroll.
type ActionEmit ¶
ActionEmit invokes a client-side handler registered with $on(name: string, func: (arg: any, err?: Error) => any).
type ActionIndicate ¶
ActionIndicate applies indicators for a fixed duration.
type ActionLocationAssign ¶
type ActionLocationAssign struct {
Model any
}
ActionLocationAssign navigates to a model-derived URL.
type ActionLocationReload ¶
type ActionLocationReload struct{}
ActionLocationReload reloads the current page.
type ActionLocationReplace ¶
type ActionLocationReplace struct {
Model any
}
ActionLocationReplace replaces the current location with a model-derived URL.
type ActionRawLocationAssign ¶
type ActionRawLocationAssign struct {
URL string
}
ActionRawLocationAssign navigates to a specified URL
type ActionScroll ¶
ActionScroll scrolls to the first element matching Selector.
type Active ¶
type Active struct {
// Path match strategy
PathMatcher PathMatcher
// Query param match strategy, applied sequientially
QueryMatcher []QueryMatcher
// Indicators to apply when active
Indicator []Indicator
}
Active configures active link indication
type App ¶
App defines a renderable app component, where Main() must output page HTML M - the path model type.
type Beam ¶
Beam represents a reactive value stream that can be read, subscribed to, or watched.
When used in a render cycle, it is guaranteed that a Door and all of its children will observe the exact same value for a given Beam. This ensures stable and predictable rendering behavior, even when multiple components depend on the same reactive source.
func NewBeam ¶
func NewBeam[T any, T2 comparable](source Beam[T], cast func(T) T2) Beam[T2]
NewBeam derives a new Beam[T2] from an existing Beam[T] by applying a transformation function.
The cast function maps values from the source beam2.to the derived beam. Updates are only propagated when the new value passes the default equality function with != comparison to the old value
Parameters:
- source: the source Beam[T] to derive from
- cast: a function that transforms values from type T to type T2
Returns:
- A new Beam[T2] that emits transformed values when they differ from the previous value
func NewBeamEqual ¶
func NewBeamEqual[T any, T2 any](source Beam[T], cast func(T) T2, equal func(new T2, old T2) bool) Beam[T2]
NewBeamEqual derives a new Beam[T2] from an existing Beam[T] using custom transformation and filtering.
The cast function transforms source values from type T to type T2. The equality function determines whether updated values should be propagated by comparing new and old values. If equality function is nil, every transformation will be propagated regardless of value equality.
Parameters:
- source: the source Beam[T] to derive from
- cast: a function to transform T → T2
- equality: a function to determine if transformed values should propagate (equal values ignored) or nil to always propagate
Returns:
- A new Beam[T2] that emits transformed values filtered by the equality function
type CallResult ¶
CallResult holds the outcome of an XCall. Either Ok is set with the result, or Err is non-nil.
type ChangeEvent ¶
type ChangeEvent = front.ChangeEvent
type Door ¶
Door represents a dynamic placeholder in the DOM tree that can be updated, replaced, or removed at runtime.
It is a fundamental building block of the framework, used to manage dynamic HTML content. All changes made to a Door are automatically synchronized with the frontend DOM.
A Door is itself a templ.Component and can be used directly in templates:
~(door)
// or
~>(door)
<div>
Initial Content
</div>
Doors start inactive and become active when rendered. Operations on inactive doors are stored virtually and applied when the door becomes active. If a door is removed or replaced, it becomes inactive again, but operations continue to update its virtual state for potential future rendering.
The context used when rendering a Door's content follows the Door's lifecycle. This allows you to safely use `ctx.Done()` inside background goroutines that depend on the Door's presence in the DOM.
Extended methods (prefixed with X) return a channel that can be used to track when operations complete. The channel receives nil on success or an error on failure, then closes. For inactive doors, the channel closes immediately without sending a value.
During a single render cycle, Doors and their children are guaranteed to observe consistent state (Beam), ensuring stable and predictable rendering.
type ESConf ¶
type ESConf = resources.BuildProfiles
type FocusEvent ¶
type FocusEvent = front.FocusEvent
type HrefActiveMatch ¶
type HrefActiveMatch int
const ( MatchFull HrefActiveMatch = iota MatchPath MatchStarts )
type ImportCommonJS ¶
type ImportCommonJS struct {
Provider ScriptProvider
Format ScriptFormat
Profile string
}
type ImportModule ¶
type ImportModule struct {
Provider ScriptProvider
Format ScriptFormat
Specifier string
Profile string
}
type ImportStyle ¶
type ImportStyle struct {
Provider StyleProvider
Minify bool
}
type Indicator ¶
Indicator is a temporary DOM modification. It can change content, attributes, or classes, and is cleaned up automatically.
func IndicatorOnlyAttr ¶
IndicatorOnlyAttr sets an attribute on the event target element.
func IndicatorOnlyAttrQuery ¶
IndicatorOnlyAttrQuery sets an attribute on the first element matching a CSS query.
func IndicatorOnlyAttrQueryAll ¶
IndicatorOnlyAttrQueryAll sets an attribute on all elements matching a CSS query.
func IndicatorOnlyAttrQueryParent ¶
IndicatorOnlyAttrQueryParent sets an attribute on the closest ancestor matching a CSS query.
func IndicatorOnlyClass ¶
IndicatorOnlyClass adds classes to the event target element.
func IndicatorOnlyClassQuery ¶
IndicatorOnlyClassQuery adds classes to the first element matching a CSS query.
func IndicatorOnlyClassQueryAll ¶
IndicatorOnlyClassQueryAll adds classes to all elements matching a CSS query.
func IndicatorOnlyClassQueryParent ¶
IndicatorOnlyClassQueryParent adds classes to the closest ancestor matching a CSS query.
func IndicatorOnlyClassRemove ¶
IndicatorOnlyClassRemove removes classes from the event target element.
func IndicatorOnlyClassRemoveQuery ¶
IndicatorOnlyClassRemoveQuery removes classes from the first element matching a CSS query.
func IndicatorOnlyClassRemoveQueryAll ¶
IndicatorOnlyClassRemoveQueryAll removes classes from all elements matching a CSS query.
func IndicatorOnlyClassRemoveQueryParent ¶
IndicatorOnlyClassRemoveQueryParent removes classes from the closest ancestor matching a CSS query.
func IndicatorOnlyContent ¶
IndicatorOnlyContent sets content on the event target element.
func IndicatorOnlyContentQuery ¶
IndicatorOnlyContentQuery sets content on the first element matching a CSS query.
func IndicatorOnlyContentQueryAll ¶
IndicatorOnlyContentQueryAll sets content on all elements matching a CSS query.
func IndicatorOnlyContentQueryParent ¶
IndicatorOnlyContentQueryParent sets content on the closest ancestor matching a CSS query.
type IndicatorAttr ¶
type IndicatorAttr struct {
Selector Selector // Target element
Name string // Attribute name
Value string // Attribute value
}
IndicatorAttr temporarily sets an attribute on the selected element.
func (IndicatorAttr) Indicate ¶
func (c IndicatorAttr) Indicate() indicate
type IndicatorClass ¶
type IndicatorClass struct {
Selector Selector // Target element
Class string // Space-separated classes
}
IndicatorClass temporarily adds CSS classes to the selected element.
func (IndicatorClass) Indicate ¶
func (c IndicatorClass) Indicate() indicate
type IndicatorClassRemove ¶
type IndicatorClassRemove struct {
Selector Selector // Target element
Class string // Space-separated classes
}
IndicatorClassRemove temporarily removes CSS classes from the selected element.
func (IndicatorClassRemove) Indicate ¶
func (c IndicatorClassRemove) Indicate() indicate
type IndicatorContent ¶
type IndicatorContent struct {
Selector Selector // Target element
Content string // Replacement content
}
IndicatorContent temporarily replaces innerHTML on the selected element.
func (IndicatorContent) Indicate ¶
func (c IndicatorContent) Indicate() indicate
type InputEvent ¶
type InputEvent = front.InputEvent
type JSX ¶
type KeyboardEvent ¶
type KeyboardEvent = front.KeyboardEvent
type Location ¶
Location represents a URL built from a path model: path plus query. Use with navigation functions or href attributes.
type ModelRoute ¶
ModelRoute provides the response type for page handlers (page, redirect, reroute, or static content).
type ModelRouter ¶
type ModelRouter[M any] interface { // Page renders a Page. App(app App[M]) ModelRoute // PageFunc renders a Page from a function. AppFunc(AppFunc func(Source[M]) gox.Elem) ModelRoute // StaticPage returns a static page with status. StaticPage(content gox.Comp, status int) ModelRoute // Reroute performs an internal reroute to model (detached=true disables path sync). Reroute(model any, detached bool) ModelRoute // Redirect issues an HTTP redirect to model with status. Redirect(model any, status int) ModelRoute // Redirect issues an HTTP redirect to URL with status. RawRedirect(url string, status int) ModelRoute }
ModelRouter provides helpers to produce page responses.
type ParsedForm ¶
type ParsedForm interface {
// FormValues returns all parsed form values.
FormValues() url.Values
// FormValue returns the first value for the given key.
FormValue(key string) string
// FormFile returns the uploaded file for the given key.
FormFile(key string) (multipart.File, *multipart.FileHeader, error)
// Form returns the underlying multipart.Form.
Form() *multipart.Form
}
ParsedForm exposes parsed form values and uploaded files.
type PathMatcher ¶
type PathMatcher interface {
// contains filtered or unexported methods
}
func PathMatcherFull ¶
func PathMatcherFull() PathMatcher
func PathMatcherParts ¶
func PathMatcherParts(i ...int) PathMatcher
PathMatcherParts checks if path parts by specified indexes matche
func PathMatcherStarts ¶
func PathMatcherStarts() PathMatcher
type PointerEvent ¶
type PointerEvent = front.PointerEvent
type ProviderExternal ¶
type ProviderExternal string
type ProviderJsBytes ¶
type ProviderJsBytes []byte
type ProviderJsString ¶
type ProviderJsString string
type ProviderLocal ¶
type ProviderLocal string
type ProviderPath ¶
type ProviderPath string
type ProviderStyleBytes ¶
type ProviderStyleBytes []byte
type ProviderStyleString ¶
type ProviderStyleString string
type ProviderTsBytes ¶
type ProviderTsBytes []byte
type ProviderTsString ¶
type ProviderTsString string
type QueryMatcher ¶
type QueryMatcher interface {
// contains filtered or unexported methods
}
func QueryMatcherIfPresent ¶
func QueryMatcherIfPresent(params ...string) QueryMatcher
QueryMatcherIfPresent matches the given parameters only if they are present.
func QueryMatcherIgnoreAll ¶
func QueryMatcherIgnoreAll() QueryMatcher
QueryMatcherIgnoreAll excludes all remaining query parameters from comparison.
func QueryMatcherIgnoreSome ¶
func QueryMatcherIgnoreSome(params ...string) QueryMatcher
QueryMatcherIgnoreSome excludes the given query parameters from comparison.
func QueryMatcherOnlyIfPresent ¶
func QueryMatcherOnlyIfPresent(params ...string) []QueryMatcher
QueryMatcherOnlyIfPresent matches the given parameters if present and ignores all others.
func QueryMatcherOnlyIgnoreAll ¶
func QueryMatcherOnlyIgnoreAll() []QueryMatcher
QueryMatcherOnlyIgnoreAll ignores all query parameters.
func QueryMatcherOnlyIgnoreSome ¶
func QueryMatcherOnlyIgnoreSome(params ...string) []QueryMatcher
QueryMatcherOnlyIgnoreSome ignores the given parameters and matches all remaining.
func QueryMatcherOnlySome ¶
func QueryMatcherOnlySome(params ...string) []QueryMatcher
QueryMatcherOnlySome matches the provided query parameters and ignores all others.
func QueryMatcherSome ¶
func QueryMatcherSome(params ...string) QueryMatcher
QueryMatcherSome matches only the provided query parameters.
type R ¶
type R interface {
// SetCookie adds a cookie to the response.
SetCookie(cookie *http.Cookie)
// GetCookie retrieves a cookie by name.
GetCookie(name string) (*http.Cookie, error)
// Done signals when the request context is canceled or completed.
Done() <-chan struct{}
}
R provides basic request operations including cookie management.
type RAfter ¶
type RAfter interface {
// After sets client-side actions to run once the request finishes.
After([]Action) error
}
RAfter allows setting client-side actions to run after a request completes.
type RModel ¶
type RModel[M any] interface { R // Model returns the decoded path model. Model() M // RequestHeader returns the incoming request headers. RequestHeader() http.Header // ResponseHeader returns the outgoing response headers. ResponseHeader() http.Header }
RModel provides request data and response control for model handlers.
type RRawForm ¶
type RRawForm interface {
R
RAfter
// W returns the HTTP response writer.
W() http.ResponseWriter
// Reader returns a multipart reader for streaming form parts.
Reader() (*multipart.Reader, error)
// ParseForm parses the form data with a memory limit.
ParseForm(maxMemory int) (ParsedForm, error)
}
RRawForm provides access to raw multipart form data for streaming or custom parsing.
type RRawHook ¶
type RRawHook interface {
RRawForm
// Body returns the raw request body reader.
Body() io.ReadCloser
}
RRawHook provides access to raw request data for hook handlers without parsing.
type RouteDir ¶
type RouteDir struct {
// URL prefix under which files are served.
// Required.
Prefix string
// Filesystem directory path to serve.
// Required.
DirPath string
// Cache-Control header applied to responses.
// Optional.
CacheControl string
}
RouteDir serves files from a local directory under a URL prefix. The prefix must not be root ("/").
type RouteFS ¶
type RouteFS struct {
// URL prefix under which files are served.
// Required.
Prefix string
// Filesystem to serve files from.
// Required.
FS fs.FS
// Optional Cache-Control header applied to responses.
// Optional.
CacheControl string
}
RouteFS serves files from an fs.FS under a URL prefix. The prefix must not be root ("/").
type RouteFile ¶
type RouteFile struct {
// URL path at which the file is served.
// Required.
Path string
// Filesystem path to the file to serve.
// Reuired.
FilePath string
// Cache-Control header applied to the response.
// Optional.
CacheControl string
}
RouteFile serves a single file at a fixed URL path. The path must not be root ("/").
type RouteResource ¶
type RouteResource struct {
// URL path at which the file is served.
// Required.
Path string
// Filesystem path to the file to serve.
// Reuired.
FilePath string
// ContentType header
ContentType string
// Disable resource cache-control headers
NoCache bool
}
func (RouteResource) Serve ¶
func (rt RouteResource) Serve(w http.ResponseWriter, r *http.Request)
type RouteResourceFS ¶
type RouteResourceFS struct {
// Filesystem to serve files from.
// Required.
FS fs.FS
// URL path at which the file is served.
// Required.
Path string
// Filesystem path to the file to serve.
// Reuired.
FilePath string
// ContentType header
ContentType string
// Disable resource cache-control headers
NoCache bool
}
func (RouteResourceFS) Serve ¶
func (rt RouteResourceFS) Serve(w http.ResponseWriter, r *http.Request)
type Router ¶
Router represents the main HTTP router that handles all requests. It implements http.Handler and provides configuration through Use().
type Scope ¶
Scope controls concurrency for event processing. It defines how events are queued, blocked, debounced, or serialized.
func ScopeOnlyBlocking ¶
func ScopeOnlyBlocking() []Scope
ScopeOnlyBlocking creates a blocking scope that cancels concurrent events.
func ScopeOnlyDebounce ¶
ScopeOnlyDebounce creates a debounced scope with duration and limit.
func ScopeOnlySerial ¶
func ScopeOnlySerial() []Scope
ScopeOnlySerial creates a serial scope that executes events sequentially.
type ScopeBlocking ¶
type ScopeBlocking struct {
// contains filtered or unexported fields
}
ScopeBlocking cancels new events while one is processing. Useful for preventing double-clicks or duplicate submissions.
type ScopeConcurrent ¶
type ScopeConcurrent struct {
// contains filtered or unexported fields
}
ScopeConcurrent can be occupied by events with the same groupId, other - blocked
func (*ScopeConcurrent) Scope ¶
func (d *ScopeConcurrent) Scope(groupId int) Scope
type ScopeDebounce ¶
type ScopeDebounce struct {
// contains filtered or unexported fields
}
ScopeDebounce delays events by duration but guarantees execution within the specified limit. New events reset the delay.
type ScopeFrame ¶
type ScopeFrame struct {
// contains filtered or unexported fields
}
ScopeFrame distinguishes immediate and frame events. Immediate events run normally. Frame events wait for all prior events to finish, block new ones, then run exclusively.
func (*ScopeFrame) Scope ¶
func (d *ScopeFrame) Scope(frame bool) Scope
Scope creates a frame-based scope.
- frame=false: execute immediately
- frame=true: wait for completion of all events, then execute exclusively
type ScopeSerial ¶
type ScopeSerial struct {
// contains filtered or unexported fields
}
ScopeSerial queues events and processes them in order.
type ScriptFormat ¶
type ScriptFormat int
const ( FormatDefault ScriptFormat = iota FormatBundle FormatRaw )
type ScriptProvider ¶
type ScriptProvider interface {
// contains filtered or unexported methods
}
type Selector ¶
type Selector interface {
// contains filtered or unexported methods
}
Selector targets DOM elements for indicators. Select by event source, CSS query, or closest matching parent.
func SelectorParentQuery ¶
SelectorParentQuery selects the closest ancestor matching a CSS query.
func SelectorQuery ¶
SelectorQuery selects the first element matching a CSS query (e.g. "#id", ".class").
func SelectorQueryAll ¶
SelectorQuery selects all elements matching a CSS query (e.g. "#id", ".class").
func SelectorTarget ¶
func SelectorTarget() Selector
SelectorTarget selects the element that triggered the event.
type SessionCallback ¶
type SessionCallback = router.SessionCallback
type Source ¶
Source is the initial Beam (others are derived from it), which, in addition to its core functionality, includes the ability to update values and propagate changes to all subscribers and derived beams. It serves as the root of a reactive value chain. Updates and mutations are synchronized across all subscribers, ensuring consistent state during rendering cycles. During a render cycle, all consumers will see a consistent view of the latest value. The source maintains a sequence of values for synchronization purposes.
IMPORTANT: For reference types (slices, maps, pointers, structs), do not modify the data directly. Instead, create or provide a different instance. Direct modification can break the consistency guarantees since subscribers may observe partial changes or inconsistent state.
func NewSource ¶
func NewSource[T comparable](init T) Source[T]
NewSource creates a new SourceBeam with the given initial value. Updates are only propagated when the new value passes the default distinct function with != comparison to the old value
Parameters:
- init: the initial value for the SourceBeam
Returns:
- A new Source[T] instance
func NewSourceEqual ¶
NewSourceEqual creates a new SourceBeam with a custom equality function.
The equality function receives new and old values and should return true if the new value is considered different and should be propagated to subscribers. If equality is nil, every update will be propagated regardless of value equality.
Parameters:
- init: the initial value for the SourceBeam
- equality: a function to determine if transformed values should propagate (equal values ignored) or nil to always propagate
Returns:
- A new Source[T] instance that uses the equality function for update filtering
type StyleProvider ¶
type StyleProvider interface {
// contains filtered or unexported methods
}
type SystemConf ¶
type SystemConf = common.SystemConf
SystemConf contains system-wide configuration options for the framework.