Documentation
¶
Index ¶
- Variables
- func ClampFloat64(value, min, max float64) float64
- func ClampInt(value, min, max int) int
- func GenerateCSRFToken() string
- func GetEnvPort() string
- func GetState(key string) interface{}
- func GetStateBool(key string) bool
- func GetStateInt(key string) int
- func GetStateString(key string) string
- func InitGlobalState()
- func InitializeStateUpdater(ctx *Context)
- func MergeHTMXAttributes(attrMaps ...map[string]string) map[string]string
- func SafeExecuteCallback(callbackID, widgetType, widgetID, eventType string, callback func(), ...)
- func SafeExecuteStateOperation(operation, key string, value interface{}, operation_func func() error, ...) error
- func ServeFile(w http.ResponseWriter, r *http.Request, filename string) error
- func SetGlobalContext(ctx *Context)
- func SetGlobalStateUpdater(updater *StateUpdater)
- func SetState(key string, value interface{})
- func SetStateCallback(ctx *Context, callback func()) error
- func SetStateFunc(ctx *Context, updateFunc func()) error
- func SetStateValue(ctx *Context, key string, value interface{}) error
- func SetStateValues(ctx *Context, values map[string]interface{}) error
- func SetStateWithCallback(ctx *Context, updateFunc func(), callback func()) error
- func SetStateWithRebuild(ctx *Context, updateFunc func(), widgetIDs ...string) error
- func SetStateWithWidgets(ctx *Context, updateFunc func(), widgetIDs []string) error
- func SetupStateAPI(app *App, stateManager *state.StateManager)
- func StateMiddleware(stateManager *state.StateManager) func(http.Handler) http.Handler
- func ValidateCSRFToken(provided, expected string) bool
- func WithStateContext(ctx context.Context, stateCtx *Context) context.Context
- type AccessibilityFeatures
- type App
- func (app *App) CallbackRegistry() *CallbackRegistry
- func (app *App) DELETE(path string, handler Handler)
- func (app *App) DialogManager() interface{}
- func (app *App) ExecuteButtonCallback(buttonID string) bool
- func (app *App) ExecuteCallback(callbackID string, params map[string]interface{}) error
- func (app *App) GET(path string, handler Handler)
- func (app *App) GenerateCSRFTokenForApp() string
- func (app *App) GenerateThemeCSS() string
- func (app *App) GetHandlerCount() int
- func (app *App) GetTheme() *ThemeData
- func (app *App) HTMXIntegrator() *HTMXIntegrator
- func (app *App) MediaQueryProvider() *MediaQueryProvider
- func (app *App) Navigator() interface{}
- func (app *App) POST(path string, handler Handler)
- func (app *App) PUT(path string, handler Handler)
- func (app *App) Packages() *packages.PackageManager
- func (app *App) RegisterButtonCallback(buttonID string, callback func())
- func (app *App) RegisterCallback(widgetID, widgetType, callbackType string, fn interface{}, ctx *Context) string
- func (app *App) RegisterHandler(handler Handler) string
- func (app *App) Router() *mux.Router
- func (app *App) Serve(addr string) error
- func (app *App) SetDarkTheme(theme *ThemeData)
- func (app *App) SetDialogManager(manager interface{})
- func (app *App) SetHTMXConfig(config *HTMXConfig)
- func (app *App) SetLightTheme(theme *ThemeData)
- func (app *App) SetMediaQueryProvider(provider *MediaQueryProvider)
- func (app *App) SetNavigator(nav interface{})
- func (app *App) SetTheme(theme *ThemeData)
- func (app *App) SetThemeMode(mode ThemeMode)
- func (app *App) State() *state.StateManager
- func (app *App) ThemeProvider() *ThemeProvider
- func (app *App) WebSocket() *WebSocketManager
- func (app *App) WithDarkTheme(theme *ThemeData) *App
- func (app *App) WithLightTheme(theme *ThemeData) *App
- func (app *App) WithTheme(theme *ThemeData) *App
- func (app *App) WithThemeMode(mode ThemeMode) *App
- type BoxConstraints
- type Breakpoint
- type Brightness
- type CSSGenerator
- type CallbackError
- type CallbackInfo
- type CallbackParameter
- type CallbackRecoveryStrategy
- type CallbackRegistry
- func (cr *CallbackRegistry) CleanupCallback(callbackID string)
- func (cr *CallbackRegistry) ExecuteCallback(callbackID string, params map[string]interface{}) error
- func (cr *CallbackRegistry) GetCallbackInfo(callbackID string) (*CallbackInfo, bool)
- func (cr *CallbackRegistry) GetCallbacksByType(callbackType string) []*CallbackInfo
- func (cr *CallbackRegistry) GetCallbacksByWidget(widgetID string) []*CallbackInfo
- func (cr *CallbackRegistry) GetStats() map[string]interface{}
- func (cr *CallbackRegistry) ListCallbacks() map[string]*CallbackInfo
- func (cr *CallbackRegistry) RegisterCallback(widgetID, widgetType, callbackType string, fn interface{}, ctx *Context) string
- func (cr *CallbackRegistry) Stop()
- type Color
- type ColorScheme
- type Config
- type ConsoleErrorLogger
- type Context
- func (c *Context) Error(message string, code int)
- func (c *Context) FormValue(name string) string
- func (c *Context) Get(key string) interface{}
- func (c *Context) GetBool(key string) bool
- func (c *Context) GetInt(key string) int
- func (c *Context) GetState(key string) interface{}
- func (c *Context) GetStateBool(key string) bool
- func (c *Context) GetStateInt(key string) int
- func (c *Context) GetStateString(key string) string
- func (c *Context) GetString(key string) string
- func (c *Context) HTMXCurrentURL() string
- func (c *Context) HTMXTarget() string
- func (c *Context) HTMXTrigger() string
- func (c *Context) Header(name string) string
- func (c *Context) IsHTMX() bool
- func (c *Context) IsSecure() bool
- func (c *Context) JSON(v interface{}) error
- func (c *Context) MediaQuery() *MediaQueryData
- func (c *Context) Method() string
- func (c *Context) Param(name string) string
- func (c *Context) ParamInt(name string) (int, error)
- func (c *Context) Query(name string) string
- func (c *Context) QueryInt(name string) (int, error)
- func (c *Context) Redirect(url string, code int)
- func (c *Context) RegisterHandler(handler Handler) string
- func (c *Context) RemoteAddr() string
- func (c *Context) RenderTemplate(widget Widget, title string)
- func (c *Context) Set(key string, value interface{})
- func (c *Context) SetHeader(name, value string)
- func (c *Context) SetState(key string, value interface{})
- func (c *Context) Theme() *ThemeData
- func (c *Context) URL() string
- func (c *Context) UserAgent() string
- func (c *Context) WriteHTML(html string)
- func (c *Context) WriteJSON(data interface{}) error
- func (c *Context) WriteText(text string)
- type ContextKey
- type DefaultErrorHandler
- type DevServer
- type DisplayFeature
- type DisplayFeatureState
- type DisplayFeatureType
- type EdgeInsets
- type ErrorHandler
- type ErrorLogger
- type ErrorRecoveryManager
- type FileWatcher
- type FontWeight
- type GlobalStateManager
- type HTMXConfig
- type HTMXErrorHandler
- type HTMXIntegrator
- func (hi *HTMXIntegrator) AddHeader(key, value string)
- func (hi *HTMXIntegrator) GenerateBlurHandler(callbackID string) map[string]string
- func (hi *HTMXIntegrator) GenerateChangeHandler(callbackID string) map[string]string
- func (hi *HTMXIntegrator) GenerateClickHandler(callbackID string) map[string]string
- func (hi *HTMXIntegrator) GenerateContextMenuHandler(callbackID string) map[string]string
- func (hi *HTMXIntegrator) GenerateCustomHandler(event, callbackID string) map[string]string
- func (hi *HTMXIntegrator) GenerateDoubleClickHandler(callbackID string) map[string]string
- func (hi *HTMXIntegrator) GenerateEnterKeyHandler(callbackID string) map[string]string
- func (hi *HTMXIntegrator) GenerateErrorHandlingAttributes(errorHandler *HTMXErrorHandler) map[string]string
- func (hi *HTMXIntegrator) GenerateFocusHandler(callbackID string) map[string]string
- func (hi *HTMXIntegrator) GenerateHoverHandler(callbackID string) map[string]string
- func (hi *HTMXIntegrator) GenerateInputHandler(callbackID string) map[string]string
- func (hi *HTMXIntegrator) GenerateKeyHandler(callbackID string, keyCode int) map[string]string
- func (hi *HTMXIntegrator) GenerateLoadingIndicatorAttributes(indicatorSelector string) map[string]string
- func (hi *HTMXIntegrator) GeneratePollingHandler(callbackID string, intervalMs int) map[string]string
- func (hi *HTMXIntegrator) GenerateProgressAttributes() map[string]string
- func (hi *HTMXIntegrator) GenerateSubmitHandler(callbackID string) map[string]string
- func (hi *HTMXIntegrator) GenerateWebSocketHandler(wsEndpoint string) map[string]string
- func (hi *HTMXIntegrator) GetConfig() HTMXConfig
- func (hi *HTMXIntegrator) RemoveHeader(key string)
- func (hi *HTMXIntegrator) SetCSRFToken(token string)
- func (hi *HTMXIntegrator) SetSwapStrategy(strategy string)
- func (hi *HTMXIntegrator) SetTargetStrategy(target string)
- type Handler
- type LayoutBuilder
- type MediaQueryData
- func (mqd *MediaQueryData) GetBreakpointName() string
- func (mqd *MediaQueryData) GetDisplayFeaturesByType(featureType DisplayFeatureType) []DisplayFeature
- func (mqd *MediaQueryData) GetSafeAreaInsets() EdgeInsets
- func (mqd *MediaQueryData) GetViewportSize() Size
- func (mqd *MediaQueryData) HasDisplayFeatures() bool
- func (mqd *MediaQueryData) IsLandscape() bool
- func (mqd *MediaQueryData) IsLargeScreen() bool
- func (mqd *MediaQueryData) IsMediumScreen() bool
- func (mqd *MediaQueryData) IsPortrait() bool
- func (mqd *MediaQueryData) IsSmallScreen() bool
- type MediaQueryInheritedWidget
- type MediaQueryProvider
- func (mqp *MediaQueryProvider) AddListener(listener func(*MediaQueryData))
- func (mqp *MediaQueryProvider) GetData() *MediaQueryData
- func (mqp *MediaQueryProvider) QueueUpdate(data *MediaQueryData)
- func (mqp *MediaQueryProvider) RemoveListener(listener func(*MediaQueryData))
- func (mqp *MediaQueryProvider) StartListening()
- func (mqp *MediaQueryProvider) StopListening()
- func (mqp *MediaQueryProvider) UpdateAccessibilityFeatures(features AccessibilityFeatures)
- func (mqp *MediaQueryProvider) UpdateData(data *MediaQueryData)
- func (mqp *MediaQueryProvider) UpdateDevicePixelRatio(ratio float64)
- func (mqp *MediaQueryProvider) UpdatePlatformBrightness(brightness Brightness)
- func (mqp *MediaQueryProvider) UpdateSize(width, height float64)
- func (mqp *MediaQueryProvider) UpdateTextScaleFactor(factor float64)
- type Orientation
- type OrientationBuilder
- type RecoveryStrategy
- type Rect
- type ResponsiveBuilder
- type Server
- type SimpleErrorLogger
- type Size
- type StateAPIHandler
- type StateConsumer
- type StateError
- type StateRecoveryStrategy
- type StateUpdate
- type StateUpdater
- func (su *StateUpdater) GetStats() map[string]interface{}
- func (su *StateUpdater) IsProcessing() bool
- func (su *StateUpdater) QueueUpdate(update StateUpdate) error
- func (su *StateUpdater) SetBatchDelay(delay time.Duration)
- func (su *StateUpdater) Stop()
- func (su *StateUpdater) TriggerRebuild(widgetIDs []string)
- type StateWebSocketHandler
- type TemplateData
- type TextAlign
- type TextStyle
- type ThemeData
- type ThemeMode
- type ThemeProvider
- func (tp *ThemeProvider) AddListener(listener func(*ThemeData))
- func (tp *ThemeProvider) GenerateCSS() string
- func (tp *ThemeProvider) GetDarkTheme() *ThemeData
- func (tp *ThemeProvider) GetLightTheme() *ThemeData
- func (tp *ThemeProvider) GetTheme() *ThemeData
- func (tp *ThemeProvider) RemoveListener(listener func(*ThemeData))
- func (tp *ThemeProvider) SetDarkTheme(theme *ThemeData)
- func (tp *ThemeProvider) SetLightTheme(theme *ThemeData)
- func (tp *ThemeProvider) SetTheme(theme *ThemeData)
- func (tp *ThemeProvider) SetThemeMode(mode ThemeMode)
- type Typography
- type VisualDensity
- type WebSocketManager
- func (wsm *WebSocketManager) Broadcast(channel string, data interface{})
- func (wsm *WebSocketManager) Enable(path string)
- func (wsm *WebSocketManager) GetConnectionCount() int
- func (wsm *WebSocketManager) GetPath() string
- func (wsm *WebSocketManager) HandleConnection(w http.ResponseWriter, r *http.Request)
- func (wsm *WebSocketManager) IsEnabled() bool
- func (wsm *WebSocketManager) Publish(channel string, data interface{})
- func (wsm *WebSocketManager) Subscribe(channel string) chan interface{}
- type WebSocketMessage
- type Widget
Constants ¶
This section is empty.
Variables ¶
var ( VisualDensityStandard = VisualDensity{Horizontal: 0, Vertical: 0} VisualDensityComfortable = VisualDensity{Horizontal: -1, Vertical: -1} VisualDensityCompact = VisualDensity{Horizontal: -2, Vertical: -2} VisualDensityAdaptive = VisualDensity{Horizontal: 0, Vertical: 0} )
Standard visual densities
var ( DefaultLightTheme = NewThemeData() DefaultDarkTheme = func() *ThemeData { theme := NewThemeData() theme.ColorScheme = NewDarkColorScheme() theme.Brightness = BrightnessDark return theme }() )
Predefined themes
var ( // Primary colors ColorPrimary = NewColor(103, 80, 164, 255) // Material Purple ColorPrimaryLight = NewColor(187, 134, 252, 255) ColorPrimaryDark = NewColor(77, 56, 138, 255) // Secondary colors ColorSecondary = NewColor(3, 218, 198, 255) // Material Teal ColorSecondaryLight = NewColor(129, 199, 132, 255) ColorSecondaryDark = NewColor(0, 150, 136, 255) // Surface colors ColorSurface = NewColor(255, 255, 255, 255) ColorSurfaceDark = NewColor(18, 18, 18, 255) ColorBackground = NewColor(255, 255, 255, 255) ColorBackgroundDark = NewColor(0, 0, 0, 255) // Text colors ColorOnSurface = NewColor(0, 0, 0, 255) ColorOnSurfaceDark = NewColor(255, 255, 255, 255) ColorOnBackground = NewColor(0, 0, 0, 255) ColorOnBackgroundDark = NewColor(255, 255, 255, 255) ColorOnPrimary = NewColor(255, 255, 255, 255) ColorOnPrimaryDark = NewColor(0, 0, 0, 255) ColorOnSecondary = NewColor(0, 0, 0, 255) ColorOnSecondaryDark = NewColor(0, 0, 0, 255) // Status colors ColorError = NewColor(211, 47, 47, 255) ColorWarning = NewColor(255, 152, 0, 255) ColorSuccess = NewColor(76, 175, 80, 255) ColorInfo = NewColor(33, 150, 243, 255) // Neutral colors ColorTransparent = NewColor(0, 0, 0, 0) ColorWhite = NewColor(255, 255, 255, 255) ColorBlack = NewColor(0, 0, 0, 255) ColorGrey = NewColor(158, 158, 158, 255) ColorGreyLight = NewColor(245, 245, 245, 255) ColorGreyDark = NewColor(66, 66, 66, 255) )
Predefined colors following Material Design
var BreakpointValues = map[Breakpoint]float64{ BreakpointXS: 0, BreakpointSM: 576, BreakpointMD: 768, BreakpointLG: 992, BreakpointXL: 1200, }
BreakpointValues maps breakpoints to their pixel values
Functions ¶
func ClampFloat64 ¶ added in v1.2.0
ClampFloat64 clamps a float64 value between min and max
func GenerateCSRFToken ¶ added in v1.2.0
func GenerateCSRFToken() string
GenerateCSRFToken generates a new CSRF token
func GetEnvPort ¶ added in v1.2.0
func GetEnvPort() string
GetEnvPort gets the port from environment variables
func GetState ¶ added in v1.2.0
func GetState(key string) interface{}
GetState is the global function to get state values
func GetStateBool ¶ added in v1.2.0
GetStateBool retrieves a boolean value from global state
func GetStateInt ¶ added in v1.2.0
GetStateInt retrieves an integer value from global state
func GetStateString ¶ added in v1.2.0
GetStateString retrieves a string value from global state
func InitGlobalState ¶ added in v1.2.0
func InitGlobalState()
InitGlobalState initializes the global state manager
func InitializeStateUpdater ¶ added in v1.2.0
func InitializeStateUpdater(ctx *Context)
InitializeStateUpdater initializes the global state updater
func MergeHTMXAttributes ¶ added in v1.2.0
MergeAttributes merges multiple attribute maps
func SafeExecuteCallback ¶ added in v1.2.0
func SafeExecuteCallback(callbackID, widgetType, widgetID, eventType string, callback func(), errorHandler ErrorHandler)
SafeExecuteCallback executes a callback with error handling and recovery
func SafeExecuteStateOperation ¶ added in v1.2.0
func SafeExecuteStateOperation(operation, key string, value interface{}, operation_func func() error, errorHandler ErrorHandler) error
SafeExecuteStateOperation executes a state operation with error handling
func SetGlobalContext ¶ added in v1.2.0
func SetGlobalContext(ctx *Context)
SetGlobalContext sets the current context for global state operations
func SetGlobalStateUpdater ¶ added in v1.2.0
func SetGlobalStateUpdater(updater *StateUpdater)
SetGlobalStateUpdater sets the global state updater instance
func SetState ¶ added in v1.2.0
func SetState(key string, value interface{})
setState is the global function that can be called from button callbacks
func SetStateCallback ¶ added in v1.2.0
Flutter-style setState function that can be called from widget callbacks This provides the familiar setState(() => { ... }) pattern
func SetStateFunc ¶ added in v1.2.0
SetStateFunc executes a state update function and triggers UI rebuilds This is the main setState function similar to Flutter
func SetStateValue ¶ added in v1.2.0
SetStateValue is a convenience function for setting a single state value
func SetStateValues ¶ added in v1.2.0
SetStateValues is a convenience function for setting multiple state values
func SetStateWithCallback ¶ added in v1.2.0
SetStateWithCallback executes a setState with a completion callback
func SetStateWithRebuild ¶ added in v1.2.0
SetStateWithRebuild executes a state update and rebuilds specific widgets
func SetStateWithWidgets ¶ added in v1.2.0
SetStateWithWidgets executes a state update and rebuilds specific widgets
func SetupStateAPI ¶ added in v1.2.0
func SetupStateAPI(app *App, stateManager *state.StateManager)
Helper function to create a complete state API setup
func StateMiddleware ¶ added in v1.2.0
StateMiddleware provides state management middleware
func ValidateCSRFToken ¶ added in v1.2.0
ValidateCSRFToken validates a CSRF token (simplified implementation)
Types ¶
type AccessibilityFeatures ¶ added in v1.2.0
type AccessibilityFeatures struct {
InvertColors bool
HighContrast bool
DisableAnimations bool
BoldText bool
}
AccessibilityFeatures represents accessibility settings
type App ¶
type App struct {
// contains filtered or unexported fields
}
App represents the main Godin application
func (*App) CallbackRegistry ¶ added in v1.2.0
func (app *App) CallbackRegistry() *CallbackRegistry
CallbackRegistry returns the callback registry
func (*App) DialogManager ¶ added in v1.2.0
func (app *App) DialogManager() interface{}
DialogManager returns the dialog manager
func (*App) ExecuteButtonCallback ¶ added in v1.2.0
ExecuteButtonCallback executes a button callback by ID
func (*App) ExecuteCallback ¶ added in v1.2.0
ExecuteCallback executes a callback by ID with optional parameters
func (*App) GenerateCSRFTokenForApp ¶ added in v1.2.0
GenerateCSRFTokenForApp generates and sets a CSRF token for the app
func (*App) GenerateThemeCSS ¶ added in v1.2.0
GenerateThemeCSS generates CSS from the current theme
func (*App) GetHandlerCount ¶ added in v1.2.0
GetHandlerCount returns the number of registered handlers (for generating unique IDs)
func (*App) HTMXIntegrator ¶ added in v1.2.0
func (app *App) HTMXIntegrator() *HTMXIntegrator
HTMXIntegrator returns the HTMX integrator
func (*App) MediaQueryProvider ¶ added in v1.2.0
func (app *App) MediaQueryProvider() *MediaQueryProvider
MediaQueryProvider returns the media query provider
func (*App) Navigator ¶ added in v1.2.0
func (app *App) Navigator() interface{}
Navigator returns the navigator
func (*App) Packages ¶
func (app *App) Packages() *packages.PackageManager
Packages returns the package manager
func (*App) RegisterButtonCallback ¶ added in v1.2.0
RegisterButtonCallback registers a button callback for WebSocket communication
func (*App) RegisterCallback ¶ added in v1.2.0
func (app *App) RegisterCallback(widgetID, widgetType, callbackType string, fn interface{}, ctx *Context) string
RegisterCallback registers a callback function and returns a unique callback ID
func (*App) RegisterHandler ¶ added in v1.2.0
RegisterHandler registers a handler globally and returns a unique ID
func (*App) SetDarkTheme ¶ added in v1.2.0
SetDarkTheme sets the dark theme
func (*App) SetDialogManager ¶ added in v1.2.0
func (app *App) SetDialogManager(manager interface{})
SetDialogManager sets the dialog manager
func (*App) SetHTMXConfig ¶ added in v1.2.0
func (app *App) SetHTMXConfig(config *HTMXConfig)
SetHTMXConfig updates the HTMX integrator configuration
func (*App) SetLightTheme ¶ added in v1.2.0
SetLightTheme sets the light theme
func (*App) SetMediaQueryProvider ¶ added in v1.2.0
func (app *App) SetMediaQueryProvider(provider *MediaQueryProvider)
SetMediaQueryProvider sets the media query provider
func (*App) SetNavigator ¶ added in v1.2.0
func (app *App) SetNavigator(nav interface{})
SetNavigator sets the navigator
func (*App) SetThemeMode ¶ added in v1.2.0
SetThemeMode sets the theme mode (light, dark, or system)
func (*App) ThemeProvider ¶ added in v1.2.0
func (app *App) ThemeProvider() *ThemeProvider
ThemeProvider returns the theme provider
func (*App) WebSocket ¶
func (app *App) WebSocket() *WebSocketManager
WebSocket returns the WebSocket manager
func (*App) WithDarkTheme ¶ added in v1.2.0
WithDarkTheme creates a new app instance with a custom dark theme (builder pattern)
func (*App) WithLightTheme ¶ added in v1.2.0
WithLightTheme creates a new app instance with a custom light theme (builder pattern)
func (*App) WithTheme ¶ added in v1.2.0
WithTheme creates a new app instance with a custom theme (builder pattern)
func (*App) WithThemeMode ¶ added in v1.2.0
WithThemeMode creates a new app instance with a specific theme mode (builder pattern)
type BoxConstraints ¶ added in v1.2.0
type BoxConstraints struct {
MinWidth float64
MaxWidth float64
MinHeight float64
MaxHeight float64
}
BoxConstraints represents layout constraints
type Breakpoint ¶ added in v1.2.0
type Breakpoint string
Breakpoint represents responsive design breakpoints
const ( BreakpointXS Breakpoint = "xs" // < 576px BreakpointSM Breakpoint = "sm" // >= 576px BreakpointMD Breakpoint = "md" // >= 768px BreakpointLG Breakpoint = "lg" // >= 992px BreakpointXL Breakpoint = "xl" // >= 1200px )
func GetBreakpoint ¶ added in v1.2.0
func GetBreakpoint(width float64) Breakpoint
GetBreakpoint returns the appropriate breakpoint for a given width
type Brightness ¶ added in v1.2.0
type Brightness string
Brightness represents light or dark theme mode
const ( BrightnessLight Brightness = "light" BrightnessDark Brightness = "dark" )
type CSSGenerator ¶ added in v1.2.0
type CSSGenerator struct {
// contains filtered or unexported fields
}
CSSGenerator generates CSS from theme data
func NewCSSGenerator ¶ added in v1.2.0
func NewCSSGenerator(prefix string) *CSSGenerator
NewCSSGenerator creates a new CSS generator
func (*CSSGenerator) GenerateCSS ¶ added in v1.2.0
func (cg *CSSGenerator) GenerateCSS(theme *ThemeData) string
GenerateCSS generates CSS custom properties from theme data
type CallbackError ¶ added in v1.2.0
type CallbackError struct {
CallbackID string // ID of the callback that failed
WidgetType string // Type of widget that triggered the callback
WidgetID string // ID of the widget that triggered the callback
EventType string // Type of event (OnPressed, OnChanged, etc.)
OriginalErr error // The original error that occurred
Timestamp time.Time // When the error occurred
StackTrace string // Stack trace at the time of error
Context interface{} // Additional context information
Recoverable bool // Whether the error is recoverable
}
CallbackError represents an error that occurred during callback execution
func CreateCallbackError ¶ added in v1.2.0
func CreateCallbackError(callbackID, widgetType, widgetID, eventType string, originalErr error, recoverable bool) *CallbackError
CreateCallbackError creates a new callback error with stack trace
func (*CallbackError) Error ¶ added in v1.2.0
func (ce *CallbackError) Error() string
Error implements the error interface
func (*CallbackError) String ¶ added in v1.2.0
func (ce *CallbackError) String() string
String returns a detailed string representation of the error
type CallbackInfo ¶ added in v1.2.0
type CallbackInfo struct {
ID string // Unique callback identifier
WidgetID string // Widget instance identifier
WidgetType string // Type of widget (Button, TextField, etc.)
CallbackType string // Type of callback (OnPressed, OnChanged, etc.)
Function interface{} // The actual Go function to execute
Context *Context // Context when callback was registered
Parameters map[string]interface{} // Additional parameters for the callback
CreatedAt time.Time // When the callback was registered
LastUsed time.Time // When the callback was last executed
}
CallbackInfo stores information about a registered callback
type CallbackParameter ¶ added in v1.2.0
CallbackParameter represents a parameter passed to a callback
type CallbackRecoveryStrategy ¶ added in v1.2.0
type CallbackRecoveryStrategy struct{}
CallbackRecoveryStrategy implements recovery for callback errors
func (*CallbackRecoveryStrategy) CanRecover ¶ added in v1.2.0
func (crs *CallbackRecoveryStrategy) CanRecover(err error) bool
CanRecover checks if this strategy can recover from the error
func (*CallbackRecoveryStrategy) Recover ¶ added in v1.2.0
func (crs *CallbackRecoveryStrategy) Recover(err error, context interface{}) error
Recover attempts to recover from a callback error
type CallbackRegistry ¶ added in v1.2.0
type CallbackRegistry struct {
// contains filtered or unexported fields
}
CallbackRegistry manages widget callback registration and execution
func NewCallbackRegistry ¶ added in v1.2.0
func NewCallbackRegistry(app *App) *CallbackRegistry
NewCallbackRegistry creates a new callback registry
func (*CallbackRegistry) CleanupCallback ¶ added in v1.2.0
func (cr *CallbackRegistry) CleanupCallback(callbackID string)
CleanupCallback removes a callback from the registry
func (*CallbackRegistry) ExecuteCallback ¶ added in v1.2.0
func (cr *CallbackRegistry) ExecuteCallback(callbackID string, params map[string]interface{}) error
ExecuteCallback executes a callback by ID with optional parameters
func (*CallbackRegistry) GetCallbackInfo ¶ added in v1.2.0
func (cr *CallbackRegistry) GetCallbackInfo(callbackID string) (*CallbackInfo, bool)
GetCallbackInfo returns information about a callback
func (*CallbackRegistry) GetCallbacksByType ¶ added in v1.2.0
func (cr *CallbackRegistry) GetCallbacksByType(callbackType string) []*CallbackInfo
GetCallbacksByType returns all callbacks of a specific type
func (*CallbackRegistry) GetCallbacksByWidget ¶ added in v1.2.0
func (cr *CallbackRegistry) GetCallbacksByWidget(widgetID string) []*CallbackInfo
GetCallbacksByWidget returns all callbacks for a specific widget
func (*CallbackRegistry) GetStats ¶ added in v1.2.0
func (cr *CallbackRegistry) GetStats() map[string]interface{}
GetStats returns statistics about the callback registry
func (*CallbackRegistry) ListCallbacks ¶ added in v1.2.0
func (cr *CallbackRegistry) ListCallbacks() map[string]*CallbackInfo
ListCallbacks returns all registered callbacks
func (*CallbackRegistry) RegisterCallback ¶ added in v1.2.0
func (cr *CallbackRegistry) RegisterCallback(widgetID, widgetType, callbackType string, fn interface{}, ctx *Context) string
RegisterCallback registers a callback function and returns a unique callback ID
func (*CallbackRegistry) Stop ¶ added in v1.2.0
func (cr *CallbackRegistry) Stop()
Stop stops the cleanup timer
type Color ¶ added in v1.2.0
type Color struct {
R, G, B, A uint8
}
Color represents an RGBA color
func NewColorFromHex ¶ added in v1.2.0
NewColorFromHex creates a Color from a hex string (e.g., "#FF0000" or "FF0000")
func (Color) WithOpacity ¶ added in v1.2.0
WithOpacity returns a new color with the specified opacity (0.0 to 1.0)
type ColorScheme ¶ added in v1.2.0
type ColorScheme struct {
// Primary colors
Primary Color
OnPrimary Color
PrimaryContainer Color
OnPrimaryContainer Color
// Secondary colors
Secondary Color
OnSecondary Color
SecondaryContainer Color
OnSecondaryContainer Color
// Tertiary colors
Tertiary Color
OnTertiary Color
TertiaryContainer Color
OnTertiaryContainer Color
// Error colors
Error Color
OnError Color
ErrorContainer Color
OnErrorContainer Color
// Surface colors
Surface Color
OnSurface Color
SurfaceVariant Color
OnSurfaceVariant Color
SurfaceTint Color
// Background colors
Background Color
OnBackground Color
// Outline colors
Outline Color
OutlineVariant Color
// Other colors
Shadow Color
Scrim Color
InverseSurface Color
InverseOnSurface Color
InversePrimary Color
// Brightness
Brightness Brightness
}
ColorScheme defines the color palette for the theme
func NewDarkColorScheme ¶ added in v1.2.0
func NewDarkColorScheme() *ColorScheme
NewDarkColorScheme creates a dark color scheme
func NewLightColorScheme ¶ added in v1.2.0
func NewLightColorScheme() *ColorScheme
NewLightColorScheme creates a light color scheme
type Config ¶
type Config struct {
Server struct {
Port string `yaml:"port"`
Host string `yaml:"host"`
} `yaml:"server"`
WebSocket struct {
Enabled bool `yaml:"enabled"`
Path string `yaml:"path"`
} `yaml:"websocket"`
Static struct {
Dir string `yaml:"dir"`
Cache bool `yaml:"cache"`
} `yaml:"static"`
}
Config holds application configuration
type ConsoleErrorLogger ¶ added in v1.2.0
type ConsoleErrorLogger struct{}
ConsoleErrorLogger logs errors to the console only
func NewConsoleErrorLogger ¶ added in v1.2.0
func NewConsoleErrorLogger() *ConsoleErrorLogger
NewConsoleErrorLogger creates a new console error logger
type Context ¶
type Context struct {
Request *http.Request
Response http.ResponseWriter
App *App
// contains filtered or unexported fields
}
Context provides request context and utilities for handlers
func NewContext ¶
NewContext creates a new request context
func StateContextFromContext ¶ added in v1.2.0
StateContextFromContext retrieves the state context from a context
func (*Context) GetStateBool ¶ added in v1.2.0
GetStateBool retrieves a boolean value from the state
func (*Context) GetStateInt ¶ added in v1.2.0
GetStateInt retrieves an integer value from the state
func (*Context) GetStateString ¶ added in v1.2.0
GetStateString retrieves a string value from the state
func (*Context) HTMXCurrentURL ¶
HTMXCurrentURL returns the current URL from HTMX
func (*Context) HTMXTarget ¶
HTMXTarget returns the HTMX target element ID
func (*Context) HTMXTrigger ¶
HTMXTrigger returns the HTMX trigger element ID
func (*Context) MediaQuery ¶ added in v1.2.0
func (c *Context) MediaQuery() *MediaQueryData
MediaQuery returns the current MediaQuery data
func (*Context) RegisterHandler ¶
RegisterHandler registers a handler function and returns a unique ID
func (*Context) RemoteAddr ¶
RemoteAddr returns the client's remote address
func (*Context) RenderTemplate ¶
RenderTemplate renders a widget using the base HTML template
func (*Context) SetState ¶ added in v1.2.0
SetState sets a value in the local state and triggers UI updates
type ContextKey ¶ added in v1.2.0
type ContextKey string
ContextKey is used for context values
const ( // StateContextKey is the key for storing state context StateContextKey ContextKey = "godin_state_context" )
type DefaultErrorHandler ¶ added in v1.2.0
type DefaultErrorHandler struct {
Logger ErrorLogger
}
DefaultErrorHandler provides default error handling behavior
func NewDefaultErrorHandler ¶ added in v1.2.0
func NewDefaultErrorHandler(logger ErrorLogger) *DefaultErrorHandler
NewDefaultErrorHandler creates a new default error handler
func (*DefaultErrorHandler) HandleCallbackError ¶ added in v1.2.0
func (deh *DefaultErrorHandler) HandleCallbackError(err *CallbackError)
HandleCallbackError handles callback errors
func (*DefaultErrorHandler) HandleGenericError ¶ added in v1.2.0
func (deh *DefaultErrorHandler) HandleGenericError(err error, context interface{})
HandleGenericError handles generic errors
func (*DefaultErrorHandler) HandleStateError ¶ added in v1.2.0
func (deh *DefaultErrorHandler) HandleStateError(err *StateError)
HandleStateError handles state management errors
type DevServer ¶
type DevServer struct {
*Server
// contains filtered or unexported fields
}
DevServer extends Server with development features
func NewDevServer ¶
NewDevServer creates a development server with hot reload
type DisplayFeature ¶ added in v1.2.0
type DisplayFeature struct {
Bounds Rect
Type DisplayFeatureType
State DisplayFeatureState
}
DisplayFeature represents a display feature like notches or folds
type DisplayFeatureState ¶ added in v1.2.0
type DisplayFeatureState string
DisplayFeatureState represents the state of a display feature
const ( DisplayFeatureStateUnknown DisplayFeatureState = "unknown" DisplayFeatureStatePostureFlat DisplayFeatureState = "flat" DisplayFeatureStatePostureHalfOpened DisplayFeatureState = "halfOpened" )
type DisplayFeatureType ¶ added in v1.2.0
type DisplayFeatureType string
DisplayFeatureType represents the type of display feature
const ( DisplayFeatureTypeFold DisplayFeatureType = "fold" DisplayFeatureTypeHinge DisplayFeatureType = "hinge" DisplayFeatureTypeCutout DisplayFeatureType = "cutout" )
type EdgeInsets ¶ added in v1.2.0
EdgeInsets represents padding or margin values
func NewEdgeInsets ¶ added in v1.2.0
func NewEdgeInsets(top, right, bottom, left float64) EdgeInsets
NewEdgeInsets creates EdgeInsets with individual values
func NewEdgeInsetsAll ¶ added in v1.2.0
func NewEdgeInsetsAll(value float64) EdgeInsets
NewEdgeInsetsAll creates EdgeInsets with the same value for all sides
func NewEdgeInsetsOnly ¶ added in v1.2.0
func NewEdgeInsetsOnly(top, right, bottom, left *float64) EdgeInsets
NewEdgeInsetsOnly creates EdgeInsets with only specified sides
func NewEdgeInsetsSymmetric ¶ added in v1.2.0
func NewEdgeInsetsSymmetric(vertical, horizontal float64) EdgeInsets
NewEdgeInsetsSymmetric creates EdgeInsets with vertical and horizontal values
func (EdgeInsets) Horizontal ¶ added in v1.2.0
func (e EdgeInsets) Horizontal() float64
Horizontal returns the total horizontal insets (left + right)
func (EdgeInsets) ToCSS ¶ added in v1.2.0
func (e EdgeInsets) ToCSS() string
ToCSS converts EdgeInsets to CSS padding/margin format
func (EdgeInsets) Vertical ¶ added in v1.2.0
func (e EdgeInsets) Vertical() float64
Vertical returns the total vertical insets (top + bottom)
type ErrorHandler ¶ added in v1.2.0
type ErrorHandler interface {
HandleCallbackError(error *CallbackError)
HandleStateError(error *StateError)
HandleGenericError(error error, context interface{})
}
ErrorHandler defines the interface for handling errors
type ErrorLogger ¶ added in v1.2.0
type ErrorLogger interface {
LogError(level string, message string, error error, context interface{})
}
ErrorLogger defines the interface for logging errors
type ErrorRecoveryManager ¶ added in v1.2.0
type ErrorRecoveryManager struct {
// contains filtered or unexported fields
}
ErrorRecoveryManager manages error recovery strategies
func NewErrorRecoveryManager ¶ added in v1.2.0
func NewErrorRecoveryManager() *ErrorRecoveryManager
NewErrorRecoveryManager creates a new error recovery manager
func (*ErrorRecoveryManager) Recover ¶ added in v1.2.0
func (erm *ErrorRecoveryManager) Recover(err error, context interface{}) error
Recover attempts to recover from an error using registered strategies
func (*ErrorRecoveryManager) RegisterStrategy ¶ added in v1.2.0
func (erm *ErrorRecoveryManager) RegisterStrategy(name string, strategy RecoveryStrategy)
RegisterStrategy registers a recovery strategy
type FileWatcher ¶
type FileWatcher struct {
// contains filtered or unexported fields
}
FileWatcher watches for file changes and triggers reloads
func NewFileWatcher ¶
func NewFileWatcher(app *App) *FileWatcher
NewFileWatcher creates a new file watcher
func (*FileWatcher) Stop ¶ added in v1.2.0
func (fw *FileWatcher) Stop()
Stop stops the file watcher
func (*FileWatcher) Watch ¶
func (fw *FileWatcher) Watch(paths []string)
Watch starts watching the specified directories for changes
type FontWeight ¶ added in v1.2.0
type FontWeight int
FontWeight represents font weight values
const ( FontWeightThin FontWeight = 100 FontWeightExtraLight FontWeight = 200 FontWeightLight FontWeight = 300 FontWeightNormal FontWeight = 400 FontWeightMedium FontWeight = 500 FontWeightSemiBold FontWeight = 600 FontWeightBold FontWeight = 700 FontWeightExtraBold FontWeight = 800 FontWeightBlack FontWeight = 900 )
type GlobalStateManager ¶ added in v1.2.0
type GlobalStateManager struct {
// contains filtered or unexported fields
}
GlobalStateManager manages global state for native Go code execution
func (*GlobalStateManager) GetCurrentContext ¶ added in v1.2.0
func (gsm *GlobalStateManager) GetCurrentContext() *Context
GetCurrentContext gets the current context
func (*GlobalStateManager) SetCurrentContext ¶ added in v1.2.0
func (gsm *GlobalStateManager) SetCurrentContext(ctx *Context)
SetCurrentContext sets the current context for state operations
type HTMXConfig ¶ added in v1.2.0
type HTMXConfig struct {
EndpointPrefix string // Prefix for generated endpoints (default: "/api/callbacks")
CSRFToken string // CSRF token for security
BaseURL string // Base URL for endpoints
Headers map[string]string // Additional headers to include
SwapStrategy string // Default swap strategy (none, innerHTML, outerHTML, etc.)
TargetStrategy string // Default target strategy
}
HTMXConfig represents configuration for HTMX integration
type HTMXErrorHandler ¶ added in v1.2.0
type HTMXErrorHandler struct {
OnClientError func(statusCode int, message string) string // 4xx errors
OnServerError func(statusCode int, message string) string // 5xx errors
OnNetworkError func(message string) string // Network errors
}
HTMXErrorHandler represents an error handler for HTMX requests
type HTMXIntegrator ¶ added in v1.2.0
type HTMXIntegrator struct {
// contains filtered or unexported fields
}
HTMXIntegrator handles automatic HTMX attribute generation
func NewHTMXIntegrator ¶ added in v1.2.0
func NewHTMXIntegrator(config *HTMXConfig) *HTMXIntegrator
NewHTMXIntegrator creates a new HTMX integrator with configuration
func (*HTMXIntegrator) AddHeader ¶ added in v1.2.0
func (hi *HTMXIntegrator) AddHeader(key, value string)
AddHeader adds a custom header
func (*HTMXIntegrator) GenerateBlurHandler ¶ added in v1.2.0
func (hi *HTMXIntegrator) GenerateBlurHandler(callbackID string) map[string]string
GenerateBlurHandler generates HTMX attributes for blur events
func (*HTMXIntegrator) GenerateChangeHandler ¶ added in v1.2.0
func (hi *HTMXIntegrator) GenerateChangeHandler(callbackID string) map[string]string
GenerateChangeHandler generates HTMX attributes for change events
func (*HTMXIntegrator) GenerateClickHandler ¶ added in v1.2.0
func (hi *HTMXIntegrator) GenerateClickHandler(callbackID string) map[string]string
GenerateClickHandler generates HTMX attributes for click events
func (*HTMXIntegrator) GenerateContextMenuHandler ¶ added in v1.2.0
func (hi *HTMXIntegrator) GenerateContextMenuHandler(callbackID string) map[string]string
GenerateContextMenuHandler generates HTMX attributes for context menu (right-click) events
func (*HTMXIntegrator) GenerateCustomHandler ¶ added in v1.2.0
func (hi *HTMXIntegrator) GenerateCustomHandler(event, callbackID string) map[string]string
GenerateCustomHandler generates HTMX attributes for custom events
func (*HTMXIntegrator) GenerateDoubleClickHandler ¶ added in v1.2.0
func (hi *HTMXIntegrator) GenerateDoubleClickHandler(callbackID string) map[string]string
GenerateDoubleClickHandler generates HTMX attributes for double-click events
func (*HTMXIntegrator) GenerateEnterKeyHandler ¶ added in v1.2.0
func (hi *HTMXIntegrator) GenerateEnterKeyHandler(callbackID string) map[string]string
GenerateEnterKeyHandler generates HTMX attributes for Enter key events
func (*HTMXIntegrator) GenerateErrorHandlingAttributes ¶ added in v1.2.0
func (hi *HTMXIntegrator) GenerateErrorHandlingAttributes(errorHandler *HTMXErrorHandler) map[string]string
GenerateErrorHandlingAttributes generates HTMX attributes for error handling
func (*HTMXIntegrator) GenerateFocusHandler ¶ added in v1.2.0
func (hi *HTMXIntegrator) GenerateFocusHandler(callbackID string) map[string]string
GenerateFocusHandler generates HTMX attributes for focus events
func (*HTMXIntegrator) GenerateHoverHandler ¶ added in v1.2.0
func (hi *HTMXIntegrator) GenerateHoverHandler(callbackID string) map[string]string
GenerateHoverHandler generates HTMX attributes for hover events
func (*HTMXIntegrator) GenerateInputHandler ¶ added in v1.2.0
func (hi *HTMXIntegrator) GenerateInputHandler(callbackID string) map[string]string
GenerateInputHandler generates HTMX attributes for input events (real-time text changes)
func (*HTMXIntegrator) GenerateKeyHandler ¶ added in v1.2.0
func (hi *HTMXIntegrator) GenerateKeyHandler(callbackID string, keyCode int) map[string]string
GenerateKeyHandler generates HTMX attributes for keyboard events
func (*HTMXIntegrator) GenerateLoadingIndicatorAttributes ¶ added in v1.2.0
func (hi *HTMXIntegrator) GenerateLoadingIndicatorAttributes(indicatorSelector string) map[string]string
GenerateLoadingIndicatorAttributes generates HTMX attributes for loading indicators
func (*HTMXIntegrator) GeneratePollingHandler ¶ added in v1.2.0
func (hi *HTMXIntegrator) GeneratePollingHandler(callbackID string, intervalMs int) map[string]string
GeneratePollingHandler generates HTMX attributes for polling/periodic updates
func (*HTMXIntegrator) GenerateProgressAttributes ¶ added in v1.2.0
func (hi *HTMXIntegrator) GenerateProgressAttributes() map[string]string
GenerateProgressAttributes generates HTMX attributes for progress tracking
func (*HTMXIntegrator) GenerateSubmitHandler ¶ added in v1.2.0
func (hi *HTMXIntegrator) GenerateSubmitHandler(callbackID string) map[string]string
GenerateSubmitHandler generates HTMX attributes for submit events
func (*HTMXIntegrator) GenerateWebSocketHandler ¶ added in v1.2.0
func (hi *HTMXIntegrator) GenerateWebSocketHandler(wsEndpoint string) map[string]string
GenerateWebSocketHandler generates HTMX attributes for WebSocket integration
func (*HTMXIntegrator) GetConfig ¶ added in v1.2.0
func (hi *HTMXIntegrator) GetConfig() HTMXConfig
GetConfig returns the current configuration
func (*HTMXIntegrator) RemoveHeader ¶ added in v1.2.0
func (hi *HTMXIntegrator) RemoveHeader(key string)
RemoveHeader removes a custom header
func (*HTMXIntegrator) SetCSRFToken ¶ added in v1.2.0
func (hi *HTMXIntegrator) SetCSRFToken(token string)
SetCSRFToken sets the CSRF token for security
func (*HTMXIntegrator) SetSwapStrategy ¶ added in v1.2.0
func (hi *HTMXIntegrator) SetSwapStrategy(strategy string)
SetSwapStrategy sets the default swap strategy
func (*HTMXIntegrator) SetTargetStrategy ¶ added in v1.2.0
func (hi *HTMXIntegrator) SetTargetStrategy(target string)
SetTargetStrategy sets the default target strategy
type LayoutBuilder ¶ added in v1.2.0
type LayoutBuilder struct {
Builder func(ctx *Context, constraints BoxConstraints) Widget
}
LayoutBuilder provides constraints-based layout building
func (LayoutBuilder) Render ¶ added in v1.2.0
func (lb LayoutBuilder) Render(ctx *Context) string
Render renders the LayoutBuilder
type MediaQueryData ¶ added in v1.2.0
type MediaQueryData struct {
Size Size
DevicePixelRatio float64
TextScaleFactor float64
Padding EdgeInsets
ViewInsets EdgeInsets
ViewPadding EdgeInsets
AlwaysUse24HourFormat bool
InvertColors bool
HighContrast bool
DisableAnimations bool
BoldText bool
Orientation Orientation
PlatformBrightness Brightness
Breakpoint Breakpoint
SystemGestureInsets EdgeInsets
DisplayFeatures []DisplayFeature
}
MediaQueryData contains screen and device information
func MediaQueryOf ¶ added in v1.2.0
func MediaQueryOf(ctx *Context) *MediaQueryData
MediaQueryOf returns the MediaQueryData from the context
func NewDefaultMediaQueryData ¶ added in v1.2.0
func NewDefaultMediaQueryData() *MediaQueryData
NewDefaultMediaQueryData creates default MediaQueryData
func (*MediaQueryData) GetBreakpointName ¶ added in v1.2.0
func (mqd *MediaQueryData) GetBreakpointName() string
GetBreakpointName returns the name of the current breakpoint
func (*MediaQueryData) GetDisplayFeaturesByType ¶ added in v1.2.0
func (mqd *MediaQueryData) GetDisplayFeaturesByType(featureType DisplayFeatureType) []DisplayFeature
GetDisplayFeaturesByType returns display features of a specific type
func (*MediaQueryData) GetSafeAreaInsets ¶ added in v1.2.0
func (mqd *MediaQueryData) GetSafeAreaInsets() EdgeInsets
GetSafeAreaInsets returns the safe area insets
func (*MediaQueryData) GetViewportSize ¶ added in v1.2.0
func (mqd *MediaQueryData) GetViewportSize() Size
GetViewportSize returns the viewport size minus insets
func (*MediaQueryData) HasDisplayFeatures ¶ added in v1.2.0
func (mqd *MediaQueryData) HasDisplayFeatures() bool
HasDisplayFeatures returns true if there are display features
func (*MediaQueryData) IsLandscape ¶ added in v1.2.0
func (mqd *MediaQueryData) IsLandscape() bool
IsLandscape returns true if the orientation is landscape
func (*MediaQueryData) IsLargeScreen ¶ added in v1.2.0
func (mqd *MediaQueryData) IsLargeScreen() bool
IsLargeScreen returns true if the screen is considered large
func (*MediaQueryData) IsMediumScreen ¶ added in v1.2.0
func (mqd *MediaQueryData) IsMediumScreen() bool
IsMediumScreen returns true if the screen is considered medium
func (*MediaQueryData) IsPortrait ¶ added in v1.2.0
func (mqd *MediaQueryData) IsPortrait() bool
IsPortrait returns true if the orientation is portrait
func (*MediaQueryData) IsSmallScreen ¶ added in v1.2.0
func (mqd *MediaQueryData) IsSmallScreen() bool
IsSmallScreen returns true if the screen is considered small
type MediaQueryInheritedWidget ¶ added in v1.2.0
type MediaQueryInheritedWidget struct {
Data *MediaQueryData
Child Widget
}
MediaQueryInheritedWidget provides MediaQuery data to child widgets
func (MediaQueryInheritedWidget) Render ¶ added in v1.2.0
func (mq MediaQueryInheritedWidget) Render(ctx *Context) string
Render renders the MediaQueryInheritedWidget
type MediaQueryProvider ¶ added in v1.2.0
type MediaQueryProvider struct {
// contains filtered or unexported fields
}
MediaQueryProvider manages screen information and updates
func NewMediaQueryProvider ¶ added in v1.2.0
func NewMediaQueryProvider() *MediaQueryProvider
NewMediaQueryProvider creates a new MediaQueryProvider
func (*MediaQueryProvider) AddListener ¶ added in v1.2.0
func (mqp *MediaQueryProvider) AddListener(listener func(*MediaQueryData))
AddListener adds a MediaQuery change listener
func (*MediaQueryProvider) GetData ¶ added in v1.2.0
func (mqp *MediaQueryProvider) GetData() *MediaQueryData
GetData returns the current MediaQueryData
func (*MediaQueryProvider) QueueUpdate ¶ added in v1.2.0
func (mqp *MediaQueryProvider) QueueUpdate(data *MediaQueryData)
QueueUpdate queues a MediaQuery update
func (*MediaQueryProvider) RemoveListener ¶ added in v1.2.0
func (mqp *MediaQueryProvider) RemoveListener(listener func(*MediaQueryData))
RemoveListener removes a MediaQuery change listener
func (*MediaQueryProvider) StartListening ¶ added in v1.2.0
func (mqp *MediaQueryProvider) StartListening()
StartListening starts listening for MediaQuery updates
func (*MediaQueryProvider) StopListening ¶ added in v1.2.0
func (mqp *MediaQueryProvider) StopListening()
StopListening stops listening for MediaQuery updates
func (*MediaQueryProvider) UpdateAccessibilityFeatures ¶ added in v1.2.0
func (mqp *MediaQueryProvider) UpdateAccessibilityFeatures(features AccessibilityFeatures)
UpdateAccessibilityFeatures updates accessibility features
func (*MediaQueryProvider) UpdateData ¶ added in v1.2.0
func (mqp *MediaQueryProvider) UpdateData(data *MediaQueryData)
UpdateData updates the MediaQueryData and notifies listeners
func (*MediaQueryProvider) UpdateDevicePixelRatio ¶ added in v1.2.0
func (mqp *MediaQueryProvider) UpdateDevicePixelRatio(ratio float64)
UpdateDevicePixelRatio updates the device pixel ratio
func (*MediaQueryProvider) UpdatePlatformBrightness ¶ added in v1.2.0
func (mqp *MediaQueryProvider) UpdatePlatformBrightness(brightness Brightness)
UpdatePlatformBrightness updates the platform brightness
func (*MediaQueryProvider) UpdateSize ¶ added in v1.2.0
func (mqp *MediaQueryProvider) UpdateSize(width, height float64)
UpdateSize updates just the screen size
func (*MediaQueryProvider) UpdateTextScaleFactor ¶ added in v1.2.0
func (mqp *MediaQueryProvider) UpdateTextScaleFactor(factor float64)
UpdateTextScaleFactor updates the text scale factor
type Orientation ¶ added in v1.2.0
type Orientation string
Orientation represents screen orientation
const ( OrientationPortrait Orientation = "portrait" OrientationLandscape Orientation = "landscape" )
type OrientationBuilder ¶ added in v1.2.0
OrientationBuilder builds different widgets based on orientation
func (OrientationBuilder) Render ¶ added in v1.2.0
func (ob OrientationBuilder) Render(ctx *Context) string
Render renders the appropriate widget based on orientation
type RecoveryStrategy ¶ added in v1.2.0
type RecoveryStrategy interface {
CanRecover(err error) bool
Recover(err error, context interface{}) error
}
RecoveryStrategy defines a strategy for recovering from errors
type ResponsiveBuilder ¶ added in v1.2.0
type ResponsiveBuilder struct {
XS Widget // Extra small screens
SM Widget // Small screens
MD Widget // Medium screens
LG Widget // Large screens
XL Widget // Extra large screens
Child Widget // Fallback widget
}
ResponsiveBuilder builds different widgets based on screen size
func (ResponsiveBuilder) Render ¶ added in v1.2.0
func (rb ResponsiveBuilder) Render(ctx *Context) string
Render renders the appropriate widget based on screen size
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server handles HTTP requests and WebSocket connections
type SimpleErrorLogger ¶ added in v1.2.0
type SimpleErrorLogger struct {
// contains filtered or unexported fields
}
SimpleErrorLogger provides a simple implementation of ErrorLogger
func NewSimpleErrorLogger ¶ added in v1.2.0
func NewSimpleErrorLogger(logFile string) (*SimpleErrorLogger, error)
NewSimpleErrorLogger creates a new simple error logger
func (*SimpleErrorLogger) Close ¶ added in v1.2.0
func (sel *SimpleErrorLogger) Close() error
Close closes the log file if it was opened
type Size ¶ added in v1.2.0
Size represents width and height dimensions
func (Size) AspectRatio ¶ added in v1.2.0
AspectRatio returns the width/height ratio
type StateAPIHandler ¶ added in v1.2.0
type StateAPIHandler struct {
// contains filtered or unexported fields
}
StateAPIHandler handles state-related API endpoints
func NewStateAPIHandler ¶ added in v1.2.0
func NewStateAPIHandler(stateManager *state.StateManager) *StateAPIHandler
NewStateAPIHandler creates a new state API handler
func (*StateAPIHandler) RegisterRoutes ¶ added in v1.2.0
func (h *StateAPIHandler) RegisterRoutes(app *App)
RegisterRoutes registers state API routes with the app
type StateConsumer ¶ added in v1.2.0
type StateConsumer struct {
StateKey string
Value interface{}
}
StateConsumer is a simple widget for rendering state values in API responses
func (*StateConsumer) Render ¶ added in v1.2.0
func (sc *StateConsumer) Render(ctx *Context) string
Render renders the state consumer as HTML
type StateError ¶ added in v1.2.0
type StateError struct {
Operation string // The operation that failed (Set, Get, Watch, etc.)
Key string // The state key involved
Value interface{} // The value involved (if applicable)
OriginalErr error // The original error that occurred
Timestamp time.Time // When the error occurred
StackTrace string // Stack trace at the time of error
Context interface{} // Additional context information
Recoverable bool // Whether the error is recoverable
}
StateError represents an error that occurred during state management
func CreateStateError ¶ added in v1.2.0
func CreateStateError(operation, key string, value interface{}, originalErr error, recoverable bool) *StateError
CreateStateError creates a new state error with stack trace
func (*StateError) Error ¶ added in v1.2.0
func (se *StateError) Error() string
Error implements the error interface
func (*StateError) String ¶ added in v1.2.0
func (se *StateError) String() string
String returns a detailed string representation of the error
type StateRecoveryStrategy ¶ added in v1.2.0
type StateRecoveryStrategy struct{}
StateRecoveryStrategy implements recovery for state errors
func (*StateRecoveryStrategy) CanRecover ¶ added in v1.2.0
func (srs *StateRecoveryStrategy) CanRecover(err error) bool
CanRecover checks if this strategy can recover from the error
func (*StateRecoveryStrategy) Recover ¶ added in v1.2.0
func (srs *StateRecoveryStrategy) Recover(err error, context interface{}) error
Recover attempts to recover from a state error
type StateUpdate ¶ added in v1.2.0
type StateUpdate struct {
UpdateFunc func() // Function to execute for the state update
WidgetIDs []string // Widget IDs that should be rebuilt
Timestamp time.Time // When the update was queued
Context *Context // Context for the update
Metadata map[string]interface{} // Additional metadata
}
StateUpdate represents a state update operation
type StateUpdater ¶ added in v1.2.0
type StateUpdater struct {
// contains filtered or unexported fields
}
StateUpdater provides Flutter-like setState functionality
func GetGlobalStateUpdater ¶ added in v1.2.0
func GetGlobalStateUpdater() *StateUpdater
GetGlobalStateUpdater returns the global state updater instance
func NewStateUpdater ¶ added in v1.2.0
func NewStateUpdater(ctx *Context) *StateUpdater
NewStateUpdater creates a new StateUpdater instance
func (*StateUpdater) GetStats ¶ added in v1.2.0
func (su *StateUpdater) GetStats() map[string]interface{}
GetStats returns statistics about the state updater
func (*StateUpdater) IsProcessing ¶ added in v1.2.0
func (su *StateUpdater) IsProcessing() bool
IsProcessing returns true if the state updater is currently processing updates
func (*StateUpdater) QueueUpdate ¶ added in v1.2.0
func (su *StateUpdater) QueueUpdate(update StateUpdate) error
QueueUpdate queues a state update for batch processing
func (*StateUpdater) SetBatchDelay ¶ added in v1.2.0
func (su *StateUpdater) SetBatchDelay(delay time.Duration)
SetBatchDelay sets the delay for batching state updates
func (*StateUpdater) Stop ¶ added in v1.2.0
func (su *StateUpdater) Stop()
Stop stops the state updater (for cleanup)
func (*StateUpdater) TriggerRebuild ¶ added in v1.2.0
func (su *StateUpdater) TriggerRebuild(widgetIDs []string)
TriggerRebuild triggers rebuilds for specific widget IDs
type StateWebSocketHandler ¶ added in v1.2.0
type StateWebSocketHandler struct {
// contains filtered or unexported fields
}
StateWebSocketHandler handles WebSocket connections for real-time state updates
func NewStateWebSocketHandler ¶ added in v1.2.0
func NewStateWebSocketHandler(stateManager *state.StateManager) *StateWebSocketHandler
NewStateWebSocketHandler creates a new state WebSocket handler
func (*StateWebSocketHandler) HandleWebSocket ¶ added in v1.2.0
func (h *StateWebSocketHandler) HandleWebSocket(w http.ResponseWriter, r *http.Request)
HandleWebSocket handles WebSocket connections for state updates
type TemplateData ¶
type TemplateData struct {
Title string
Content template.HTML // Use template.HTML to prevent escaping
CSS template.CSS // Use template.CSS for CSS content
JS template.JS // Use template.JS for JavaScript content
}
TemplateData represents data for template rendering
type TextStyle ¶ added in v1.2.0
type TextStyle struct {
Color *Color
FontSize *float64
FontWeight *FontWeight
FontFamily *string
LetterSpacing *float64
LineHeight *float64
TextAlign *TextAlign
TextDecoration *string
}
TextStyle represents text styling options
func NewTextStyle ¶ added in v1.2.0
func NewTextStyle() *TextStyle
NewTextStyle creates a new TextStyle
func (*TextStyle) WithFontFamily ¶ added in v1.2.0
WithFontFamily sets the font family
func (*TextStyle) WithFontSize ¶ added in v1.2.0
WithFontSize sets the font size
func (*TextStyle) WithFontWeight ¶ added in v1.2.0
func (ts *TextStyle) WithFontWeight(weight FontWeight) *TextStyle
WithFontWeight sets the font weight
type ThemeData ¶ added in v1.2.0
type ThemeData struct {
ColorScheme *ColorScheme
Typography *Typography
ComponentThemes map[string]interface{}
Extensions map[string]interface{}
Brightness Brightness
CSS map[string]string // CSS custom properties
UseMaterial3 bool
VisualDensity VisualDensity
}
ThemeData contains all theme configuration
func NewThemeData ¶ added in v1.2.0
func NewThemeData() *ThemeData
NewThemeData creates a new ThemeData with default values
type ThemeMode ¶ added in v1.2.0
type ThemeMode string
ThemeMode represents how theme should be determined
type ThemeProvider ¶ added in v1.2.0
type ThemeProvider struct {
// contains filtered or unexported fields
}
ThemeProvider manages theme state and updates
func NewThemeProvider ¶ added in v1.2.0
func NewThemeProvider() *ThemeProvider
NewThemeProvider creates a new ThemeProvider
func (*ThemeProvider) AddListener ¶ added in v1.2.0
func (tp *ThemeProvider) AddListener(listener func(*ThemeData))
AddListener adds a theme change listener
func (*ThemeProvider) GenerateCSS ¶ added in v1.2.0
func (tp *ThemeProvider) GenerateCSS() string
GenerateCSS generates CSS custom properties from the current theme
func (*ThemeProvider) GetDarkTheme ¶ added in v1.2.0
func (tp *ThemeProvider) GetDarkTheme() *ThemeData
GetDarkTheme returns the dark theme
func (*ThemeProvider) GetLightTheme ¶ added in v1.2.0
func (tp *ThemeProvider) GetLightTheme() *ThemeData
GetLightTheme returns the light theme
func (*ThemeProvider) GetTheme ¶ added in v1.2.0
func (tp *ThemeProvider) GetTheme() *ThemeData
GetTheme returns the current theme
func (*ThemeProvider) RemoveListener ¶ added in v1.2.0
func (tp *ThemeProvider) RemoveListener(listener func(*ThemeData))
RemoveListener removes a theme change listener
func (*ThemeProvider) SetDarkTheme ¶ added in v1.2.0
func (tp *ThemeProvider) SetDarkTheme(theme *ThemeData)
SetDarkTheme sets the dark theme
func (*ThemeProvider) SetLightTheme ¶ added in v1.2.0
func (tp *ThemeProvider) SetLightTheme(theme *ThemeData)
SetLightTheme sets the light theme
func (*ThemeProvider) SetTheme ¶ added in v1.2.0
func (tp *ThemeProvider) SetTheme(theme *ThemeData)
SetTheme sets the current theme
func (*ThemeProvider) SetThemeMode ¶ added in v1.2.0
func (tp *ThemeProvider) SetThemeMode(mode ThemeMode)
SetThemeMode sets the theme mode
type Typography ¶ added in v1.2.0
type Typography struct {
// Display styles
DisplayLarge *TextStyle
DisplayMedium *TextStyle
DisplaySmall *TextStyle
// Headline styles
HeadlineLarge *TextStyle
HeadlineMedium *TextStyle
HeadlineSmall *TextStyle
// Title styles
TitleLarge *TextStyle
TitleMedium *TextStyle
TitleSmall *TextStyle
// Body styles
BodyLarge *TextStyle
BodyMedium *TextStyle
BodySmall *TextStyle
// Label styles
LabelLarge *TextStyle
LabelMedium *TextStyle
LabelSmall *TextStyle
}
Typography defines text styles for the theme
func NewDefaultTypography ¶ added in v1.2.0
func NewDefaultTypography() *Typography
NewDefaultTypography creates default typography
type VisualDensity ¶ added in v1.2.0
VisualDensity represents the visual density of UI elements
type WebSocketManager ¶
type WebSocketManager struct {
// contains filtered or unexported fields
}
WebSocketManager manages WebSocket connections and channels
func NewWebSocketManager ¶
func NewWebSocketManager() *WebSocketManager
NewWebSocketManager creates a new WebSocket manager
func (*WebSocketManager) Broadcast ¶
func (wsm *WebSocketManager) Broadcast(channel string, data interface{})
Broadcast sends data to all connections on a channel
func (*WebSocketManager) Enable ¶
func (wsm *WebSocketManager) Enable(path string)
Enable enables WebSocket support with the specified path
func (*WebSocketManager) GetConnectionCount ¶
func (wsm *WebSocketManager) GetConnectionCount() int
GetConnectionCount returns the number of active connections
func (*WebSocketManager) GetPath ¶
func (wsm *WebSocketManager) GetPath() string
GetPath returns the WebSocket path
func (*WebSocketManager) HandleConnection ¶
func (wsm *WebSocketManager) HandleConnection(w http.ResponseWriter, r *http.Request)
HandleConnection handles new WebSocket connections
func (*WebSocketManager) IsEnabled ¶
func (wsm *WebSocketManager) IsEnabled() bool
IsEnabled returns whether WebSocket is enabled
func (*WebSocketManager) Publish ¶
func (wsm *WebSocketManager) Publish(channel string, data interface{})
Publish sends data to all subscribers of a channel
func (*WebSocketManager) Subscribe ¶
func (wsm *WebSocketManager) Subscribe(channel string) chan interface{}
Subscribe creates a channel for receiving data
type WebSocketMessage ¶
type WebSocketMessage struct {
Type string `json:"type"`
Channel string `json:"channel"`
Data interface{} `json:"data"`
}
WebSocketMessage represents a WebSocket message