doors

package module
v0.8.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: AGPL-3.0 Imports: 33 Imported by: 0

README

doors

Back-end UI Framework for feature-rich, secure, and fast web apps in Go.

⚠️ Beta - Not Ready for Production

Getting Started

  • See the Tutorial for building your first doors application.
  • Read the Docs to dive into details.
  • Check out the API Reference.

Philosophy

Explicid

Build direct connections between events, state, and HTML in a completely type-safe environment. It hits different.

Lightweight

Fast loading, non-blocking execution environment, minimal memory footprint

Server Centric

Business logic runs on the server, and the browser acts like a human I/O.

Straight

Native experience of classic MPA with natural reactive UI capabilities.

JS friendly

If you need - integration, bundling, and serving tools included.

How It Works

Stateful Server + Ultra-Thin Client

API-free architecture

  1. User loads page → Server creates instance and sets session cookie
  2. Server maintains state → Live representation of each user's page
  3. Persistent connection → Lightweight client syncs with server
  4. Events flow up → User interactions sent to Go handlers
  5. Updates flow down → Server sends specific DOM changes
Core Components

Door - Dynamic container in HTML where content can change:

  • Update, Replace, Remove, Clear, Reload operations
  • Form a tree structure, where each branch has its own lifecycle
  • Provides local context that can be used as an unmount hook.

Beam - Reactive state primitive on the server:

  • SourceBeam for mutable state
  • Derived beams for computed values
  • Respects the dynamic container tree, guaranteeing render consistency

Path Models - Type-safe routing through Go structs:

  • Declare multiple path variants (the matched field becomes true)
  • Use type-safe parameter capturing
  • Use splat parameter to capture the remaining path tail
  • Use almost any types for query parameters (go-playground/form under the hood)
Instance and Session Model
  • Each browser tab creates an instance (live server connection)
  • Multiple instances share a session (common state)
  • Navigation within same Path Model: reactive updates
  • Navigation to different Path Model: new instance created
Real-Time Sync Protocol
  • Client maintains a connection for synchronization via short-lived, handover HTTP requests
  • Works through proxies and firewalls
  • Takes advantage of QUIC
Event Handling
  • Secure session-scoped DOM event handeling in Go
  • Events as separate HTTP requests
  • Advanced concurrency control (blocking, debounce, and more)

When to use doors

Excellent for:

  • SaaS products
  • Business process automation (ERP, CRM, etc)
  • Administrative interfaces
  • Customer portals
  • Internal tools
  • Other form-heavy applications

Not ideal for:

  • Public marketing websites with minimal interactivity
  • Offline-first applications
  • Static content sites

Comparison

Unlike React/Vue: No business logic on the client side, no hydration, NPM-free.

Unlike htmx: Full type safety, reactive state, and programmatic control from Go.

Unlike Phoenix LiveView: Explicit update model, parallel rendering & non-blocking event handling and QUIC friendly

License

doors is dual-licensed by doors dev LLC:

  • Open Source: GNU Affero General Public License v3.0 only (AGPL-3.0-only)
  • Commercial: a paid commercial license for proprietary / closed-source use or other non-AGPL-compliant use

If you cannot (or do not want to) comply with the AGPL requirements (including providing Corresponding Source to users who interact with the software over a network), you must obtain a commercial license.

Commercial inquiries: sales@doors.dev

Full License Texts

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DocsFS embed.FS

DocsFS is the embedded documentation tree for internal purposes.

Functions

func AllowBlocking

func AllowBlocking(ctx context.Context) context.Context

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

func EndInstance(ctx context.Context)

EndInstance ends the current instance (tab/window) but keeps the session and other instances active.

func EndSession

func EndSession(ctx context.Context)

EndSession immediately ends the current session and all instances. Use during logout to close authorized pages and free server resources.

func ExpireSession

func ExpireSession(ctx context.Context, d time.Duration)

ExpireSession sets the maximum lifetime of the current session.

func Go

func Go(f func(context.Context)) gox.Editor

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

func HashId(string string) string

HashId creates ID using provided string, hashbased. For the same string outputs the same result. Suitable for HTML attributes.

func Inject

func Inject[T any](key any, beam Beam[T]) gox.Proxy

func InstanceId

func InstanceId(ctx context.Context) string

InstanceId returns the unique ID of the current instance. Useful for logging, debugging, and tracking connections.

func InstanceInit

func InstanceInit(ctx context.Context, key any, new func() any) any

InstanceInit returns the value stored under key in instance-scoped storage, initializing it with new() if the key is not already present.

func InstanceLoad

func InstanceLoad(ctx context.Context, key any) any

InstanceLoad gets a value from instance-scoped storage by key. Returns nil if absent. Callers must type-assert the result.

func InstanceRemove

func InstanceRemove(ctx context.Context, key any) any

InstanceRemove deletes a key/value from instance-scoped storage. Returns the removed value or nil if absent.

func InstanceSave

func InstanceSave(ctx context.Context, key any, value any) any

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

func SessionId(ctx context.Context) string

SessionId returns the unique ID of the current session. All instances in the same browser share this ID via a session cookie.

func SessionInit

func SessionInit(ctx context.Context, key any, new func() any) any

SessionInit returns the value stored under key in session-scoped storage, initializing it with new() if the key is not already present.

func SessionLoad

func SessionLoad(ctx context.Context, key any) any

SessionLoad gets a value from session-scoped storage by key. Returns nil if absent. Callers must type-assert the result.

func SessionRemove

func SessionRemove(ctx context.Context, key any) any

SessionRemove deletes a key/value from session-scoped storage. Returns the removed value or nil if absent.

func SessionSave

func SessionSave(ctx context.Context, key any, value any) any

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

func Status(statusCode int) gox.Editor

Status sets the HTTP status code when rendered in a template. Makes effect only at initial page render. Example: ~(doors.Status(404))

func Sub

func Sub[T any](beam Beam[T], el func(T) gox.Elem) gox.Editor

func TitleMeta

func TitleMeta[M any](b Beam[M], el func(M) gox.Elem) gox.Editor

func UseCSP

func UseCSP(r Router, csp CSP)

UseCSP configures Content Security Policy headers for enhanced security. This helps prevent XSS attacks and other security vulnerabilities.

func UseESConf

func UseESConf(r Router, conf ESConf)

UseESConf configures esbuild profiles for JavaScript/TypeScript processing. Different profiles can be used for development vs production builds.

func UseErrorPage

func UseErrorPage(r Router, page func(message string) gox.Elem)

UseErrorPage sets a custom error page component for handling internal errors. The component receives the error message as a parameter.

func UseFallback

func UseFallback(r Router, handler http.Handler)

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

func UseLicense(r Router, cert string)

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

func UseRoute(r Router, rt Route)

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.

func (ABlur) Modify

func (b ABlur) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (ABlur) Proxy

func (b ABlur) Proxy(cur gox.Cursor, elem gox.Elem) error

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.

func (AChange) Modify

func (p AChange) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (AChange) Proxy

func (p AChange) Proxy(cur gox.Cursor, elem gox.Elem) error

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.

func (AClick) Modify

func (p AClick) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (AClick) Proxy

func (p AClick) Proxy(cur gox.Cursor, elem gox.Elem) error

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.

func (AData) Modify

func (a AData) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (AData) Proxy

func (a AData) Proxy(cur gox.Cursor, elem gox.Elem) error

type ADataMap

type ADataMap map[string]any

func (ADataMap) Modify

func (dm ADataMap) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (ADataMap) Proxy

func (dm ADataMap) Proxy(cur gox.Cursor, elem gox.Elem) error

type ADyn

type ADyn = *aDyn

ADyn is a dynamic attribute that can be updated at runtime.

func NewADyn

func NewADyn(name string, value string, enable bool) ADyn

NewADyn returns a new dynamic attribute with the given name, value, and state.

func (ADyn) Enable

func (a ADyn) Enable(ctx context.Context, enable bool)

Enable adds or removes the attribute.

func (ADyn) Modify

func (a ADyn) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (ADyn) Proxy

func (a ADyn) Proxy(cur gox.Cursor, elem gox.Elem) error

func (ADyn) Value

func (a ADyn) Value(ctx context.Context, value string)

Value sets the attribute's value.

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.

func (AFileHref) Modify

func (s AFileHref) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (AFileHref) Proxy

func (s AFileHref) Proxy(cur gox.Cursor, elem gox.Elem) error

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.

func (AFocus) Modify

func (f AFocus) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (AFocus) Proxy

func (f AFocus) Proxy(cur gox.Cursor, elem gox.Elem) error

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.

func (AFocusIn) Modify

func (f AFocusIn) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (AFocusIn) Proxy

func (f AFocusIn) Proxy(cur gox.Cursor, elem gox.Elem) error

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.

func (AFocusOut) Modify

func (f AFocusOut) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (AFocusOut) Proxy

func (f AFocusOut) Proxy(cur gox.Cursor, elem gox.Elem) error

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.

func (AGotPointerCapture) Modify

func (p AGotPointerCapture) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (AGotPointerCapture) Proxy

func (p AGotPointerCapture) Proxy(cur gox.Cursor, elem gox.Elem) error

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

func (AHook[T]) Modify

func (h AHook[T]) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (AHook[T]) Proxy

func (h AHook[T]) Proxy(cur gox.Cursor, elem gox.Elem) error

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.

func (AHref) Modify

func (h AHref) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (AHref) Proxy

func (h AHref) Proxy(cur gox.Cursor, elem gox.Elem) error

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
}

func (AInput) Modify

func (p AInput) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (AInput) Proxy

func (p AInput) Proxy(cur gox.Cursor, elem gox.Elem) error

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.

func (AKeyDown) Modify

func (k AKeyDown) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (AKeyDown) Proxy

func (k AKeyDown) Proxy(cur gox.Cursor, elem gox.Elem) error

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.

func (AKeyUp) Modify

func (k AKeyUp) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (AKeyUp) Proxy

func (k AKeyUp) Proxy(cur gox.Cursor, elem gox.Elem) error

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.

func (ALostPointerCapture) Modify

func (p ALostPointerCapture) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (ALostPointerCapture) Proxy

func (p ALostPointerCapture) Proxy(cur gox.Cursor, elem gox.Elem) error

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.

func (APointerCancel) Modify

func (p APointerCancel) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (APointerCancel) Proxy

func (p APointerCancel) Proxy(cur gox.Cursor, elem gox.Elem) error

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.

func (APointerDown) Modify

func (p APointerDown) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (APointerDown) Proxy

func (p APointerDown) Proxy(cur gox.Cursor, elem gox.Elem) error

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.

func (APointerEnter) Modify

func (p APointerEnter) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (APointerEnter) Proxy

func (p APointerEnter) Proxy(cur gox.Cursor, elem gox.Elem) error

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.

func (APointerLeave) Modify

func (p APointerLeave) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (APointerLeave) Proxy

func (p APointerLeave) Proxy(cur gox.Cursor, elem gox.Elem) error

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.

func (APointerMove) Modify

func (p APointerMove) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (APointerMove) Proxy

func (p APointerMove) Proxy(cur gox.Cursor, elem gox.Elem) error

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.

func (APointerOut) Modify

func (p APointerOut) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (APointerOut) Proxy

func (p APointerOut) Proxy(cur gox.Cursor, elem gox.Elem) error

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.

func (APointerOver) Modify

func (p APointerOver) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (APointerOver) Proxy

func (p APointerOver) Proxy(cur gox.Cursor, elem gox.Elem) error

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.

func (APointerUp) Modify

func (p APointerUp) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (APointerUp) Proxy

func (p APointerUp) Proxy(cur gox.Cursor, elem gox.Elem) error

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.

func (ARawFileHref) Modify

func (s ARawFileHref) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (ARawFileHref) Proxy

func (s ARawFileHref) Proxy(cur gox.Cursor, elem gox.Elem) error

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.

func (ARawHook) Modify

func (h ARawHook) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (ARawHook) Proxy

func (h ARawHook) Proxy(cur gox.Cursor, elem gox.Elem) error

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.

func (ARawSrc) Modify

func (s ARawSrc) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (ARawSrc) Proxy

func (s ARawSrc) Proxy(cur gox.Cursor, elem gox.Elem) error

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.

func (ARawSubmit) Modify

func (s ARawSubmit) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (ARawSubmit) Proxy

func (s ARawSubmit) Proxy(cur gox.Cursor, elem gox.Elem) error

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.

func (ASrc) Modify

func (s ASrc) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (ASrc) Proxy

func (s ASrc) Proxy(cur gox.Cursor, elem gox.Elem) error

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.

func (ASubmit[V]) Modify

func (s ASubmit[V]) Modify(ctx context.Context, _ string, attrs gox.Attrs) error

func (ASubmit[V]) Proxy

func (s ASubmit[V]) Proxy(cur gox.Cursor, elem gox.Elem) error

type Action

type Action interface {
	// contains filtered or unexported methods
}

Action performs a client-side operation

func ActionOnlyEmit

func ActionOnlyEmit(name string, arg any) []Action

ActionOnlyEmit returns a single ActionEmit.

func ActionOnlyIndicate

func ActionOnlyIndicate(indicator []Indicator, duration time.Duration) []Action

ActionOnlyIndicate returns a single ActionIndicate.

func ActionOnlyLocationAssign

func ActionOnlyLocationAssign(model any) []Action

ActionOnlyLocationAssign returns a single ActionLocationAssign.

func ActionOnlyLocationReload

func ActionOnlyLocationReload() []Action

ActionOnlyLocationReload returns a single ActionLocationReload.

func ActionOnlyLocationReplace

func ActionOnlyLocationReplace(model any) []Action

ActionOnlyLocationReplace returns a single ActionLocationReplace.

func ActionOnlyRawLocationAssign

func ActionOnlyRawLocationAssign(url string) []Action

ActionOnlyRawLocationAssign returns a single ActionLocationAssign.

func ActionOnlyScroll

func ActionOnlyScroll(selector string, smooth bool) []Action

ActionOnlyScroll returns a single ActionScroll.

type ActionEmit

type ActionEmit struct {
	Name string
	Arg  any
}

ActionEmit invokes a client-side handler registered with $on(name: string, func: (arg: any, err?: Error) => any).

type ActionIndicate

type ActionIndicate struct {
	Indicator []Indicator
	Duration  time.Duration
}

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

type ActionScroll struct {
	Selector string
	Smooth   bool
}

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

type App[M any] interface {
	Main(Source[M]) gox.Elem
}

App defines a renderable app component, where Main() must output page HTML M - the path model type.

type Attr

type Attr interface {
	gox.Modify
	gox.Proxy
}

Attr is a doors attribute modifier.

func A

func A(ctx context.Context, a ...Attr) Attr

type Beam

type Beam[T any] = beam.Beam[T]

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 CSP

type CSP = common.CSP

CSP represents Content Security Policy configuration.

type CallResult

type CallResult[T any] struct {
	Ok  T     // Result value
	Err error // Error if the call failed
}

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

type Door = door.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 ESOptions

type ESOptions struct {
	External []string
	Minify   bool
	JSX      JSX
}

func (ESOptions) Options

func (opt ESOptions) Options(_profile string) api.BuildOptions

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
}

func (ImportCommonJS) Edit

func (m ImportCommonJS) Edit(cur gox.Cursor) error

func (ImportCommonJS) Modify

func (m ImportCommonJS) Modify(ctx context.Context, tag string, attrs gox.Attrs) error

type ImportModule

type ImportModule struct {
	Provider  ScriptProvider
	Format    ScriptFormat
	Specifier string
	Profile   string
}

func (ImportModule) Edit

func (m ImportModule) Edit(cur gox.Cursor) error

func (ImportModule) Modify

func (m ImportModule) Modify(ctx context.Context, tag string, attrs gox.Attrs) error

type ImportStyle

type ImportStyle struct {
	Provider StyleProvider
	Minify   bool
}

func (ImportStyle) Edit

func (m ImportStyle) Edit(cur gox.Cursor) error

func (ImportStyle) Modify

func (m ImportStyle) Modify(ctx context.Context, tag string, attrs gox.Attrs) error

type Indicator

type Indicator = front.Indicator

Indicator is a temporary DOM modification. It can change content, attributes, or classes, and is cleaned up automatically.

func IndicatorOnlyAttr

func IndicatorOnlyAttr(attr string, value string) []Indicator

IndicatorOnlyAttr sets an attribute on the event target element.

func IndicatorOnlyAttrQuery

func IndicatorOnlyAttrQuery(query string, attr string, value string) []Indicator

IndicatorOnlyAttrQuery sets an attribute on the first element matching a CSS query.

func IndicatorOnlyAttrQueryAll

func IndicatorOnlyAttrQueryAll(query string, attr string, value string) []Indicator

IndicatorOnlyAttrQueryAll sets an attribute on all elements matching a CSS query.

func IndicatorOnlyAttrQueryParent

func IndicatorOnlyAttrQueryParent(query string, attr string, value string) []Indicator

IndicatorOnlyAttrQueryParent sets an attribute on the closest ancestor matching a CSS query.

func IndicatorOnlyClass

func IndicatorOnlyClass(class string) []Indicator

IndicatorOnlyClass adds classes to the event target element.

func IndicatorOnlyClassQuery

func IndicatorOnlyClassQuery(query string, class string) []Indicator

IndicatorOnlyClassQuery adds classes to the first element matching a CSS query.

func IndicatorOnlyClassQueryAll

func IndicatorOnlyClassQueryAll(query string, class string) []Indicator

IndicatorOnlyClassQueryAll adds classes to all elements matching a CSS query.

func IndicatorOnlyClassQueryParent

func IndicatorOnlyClassQueryParent(query string, class string) []Indicator

IndicatorOnlyClassQueryParent adds classes to the closest ancestor matching a CSS query.

func IndicatorOnlyClassRemove

func IndicatorOnlyClassRemove(class string) []Indicator

IndicatorOnlyClassRemove removes classes from the event target element.

func IndicatorOnlyClassRemoveQuery

func IndicatorOnlyClassRemoveQuery(query string, class string) []Indicator

IndicatorOnlyClassRemoveQuery removes classes from the first element matching a CSS query.

func IndicatorOnlyClassRemoveQueryAll

func IndicatorOnlyClassRemoveQueryAll(query string, class string) []Indicator

IndicatorOnlyClassRemoveQueryAll removes classes from all elements matching a CSS query.

func IndicatorOnlyClassRemoveQueryParent

func IndicatorOnlyClassRemoveQueryParent(query string, class string) []Indicator

IndicatorOnlyClassRemoveQueryParent removes classes from the closest ancestor matching a CSS query.

func IndicatorOnlyContent

func IndicatorOnlyContent(content string) []Indicator

IndicatorOnlyContent sets content on the event target element.

func IndicatorOnlyContentQuery

func IndicatorOnlyContentQuery(query string, content string) []Indicator

IndicatorOnlyContentQuery sets content on the first element matching a CSS query.

func IndicatorOnlyContentQueryAll

func IndicatorOnlyContentQueryAll(query string, content string) []Indicator

IndicatorOnlyContentQueryAll sets content on all elements matching a CSS query.

func IndicatorOnlyContentQueryParent

func IndicatorOnlyContentQueryParent(query string, content string) []Indicator

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 JSX struct {
	JSX          api.JSX
	Factory      string
	ImportSource string
	Fragment     string
	SideEffects  bool
	Dev          bool
}

func JSXPreact

func JSXPreact() JSX

func JSXReact

func JSXReact() JSX

type KeyboardEvent

type KeyboardEvent = front.KeyboardEvent

type Location

type Location = path.Location

Location represents a URL built from a path model: path plus query. Use with navigation functions or href attributes.

func NewLocation

func NewLocation(ctx context.Context, model any) (Location, error)

NewLocation encodes model into a Location using the registered adapter for the model's type. Returns an error if no adapter is registered or encoding fails.

type ModelRoute

type ModelRoute = router.Response

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 ProviderFS

type ProviderFS struct {
	FS   fs.FS
	Path string
	Name 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 REvent

type REvent[E any] interface {
	R
	RAfter
	// Event returns the event payload.
	Event() E
}

REvent provides request handling for event hooks with typed event data.

type RForm

type RForm[D any] interface {
	R
	RAfter
	// Data returns the parsed form payload.
	Data() D
}

RForm provides request handling for form submissions with typed form data.

type RHook

type RHook[D any] interface {
	R
	RAfter
	// Data returns the parsed hook payload.
	Data() D
}

RHook provides request handling for hook handlers with typed data.

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 Route

type Route = router.Route

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 ("/").

func (RouteDir) Match

func (rt RouteDir) Match(r *http.Request) bool

func (RouteDir) Serve

func (rt RouteDir) Serve(w http.ResponseWriter, r *http.Request)

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 ("/").

func (RouteFS) Match

func (rt RouteFS) Match(r *http.Request) bool

func (RouteFS) Serve

func (rt RouteFS) Serve(w http.ResponseWriter, r *http.Request)

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 ("/").

func (RouteFile) Match

func (rt RouteFile) Match(r *http.Request) bool

func (RouteFile) Serve

func (rt RouteFile) Serve(w http.ResponseWriter, r *http.Request)

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) Match

func (rt RouteResource) Match(r *http.Request) 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) Match

func (rt RouteResourceFS) Match(r *http.Request) bool

func (RouteResourceFS) Serve

type Router

type Router interface {
	http.Handler
	Use(r Use)
}

Router represents the main HTTP router that handles all requests. It implements http.Handler and provides configuration through Use().

func NewRouter

func NewRouter() Router

NewRouter creates a new router instance with default configuration. The router handles app routing, static files, hooks, and framework resources.

type Scope

type Scope = front.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

func ScopeOnlyDebounce(duration, limit time.Duration) []Scope

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.

func (*ScopeBlocking) Scope

func (b *ScopeBlocking) Scope(core core.Core) ScopeSet

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.

func (*ScopeDebounce) Scope

func (d *ScopeDebounce) Scope(duration, limit time.Duration) Scope

Scope creates a debounced scope.

  • duration: debounce delay, reset by new events
  • limit: maximum wait before execution regardless of new events

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.

func (*ScopeSerial) Scope

func (b *ScopeSerial) Scope(core core.Core) ScopeSet

type ScopeSet

type ScopeSet = front.ScopeSet

ScopeSet holds the configuration of a scope instance.

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

func SelectorParentQuery(query string) Selector

SelectorParentQuery selects the closest ancestor matching a CSS query.

func SelectorQuery

func SelectorQuery(query string) Selector

SelectorQuery selects the first element matching a CSS query (e.g. "#id", ".class").

func SelectorQueryAll

func SelectorQueryAll(query string) Selector

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

type Source[T any] = beam.Source[T]

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

func NewSourceEqual[T any](init T, equal func(new T, old T) bool) Source[T]

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.

type Use

type Use = router.Use

Use represents a router modification that can be used to configure routing behavior.

Jump to

Keyboard shortcuts

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