Documentation
¶
Overview ¶
Package interaction implements a declarative event→condition→action engine for UISpec interactions. It dispatches events through matching interaction rules, evaluates conditions via the expression evaluator, and executes registered action handlers.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionHandler ¶
type ActionHandler func(ctx context.Context, action uispec.InteractionAction, eventData map[string]any) error
ActionHandler executes a single interaction action.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine routes events through interaction rules and executes actions.
func New ¶
New creates an Engine with built-in handlers (state.set, state.toggle, component.refresh, navigate) wired to the provided state store.
func (*Engine) Dispatch ¶
func (e *Engine) Dispatch(ctx context.Context, interactions []uispec.Interaction, event Event) error
Dispatch finds all interactions matching the event and executes their actions. Actions within a single interaction run sequentially; all matching interactions are evaluated.
func (*Engine) RegisterHandler ¶
func (e *Engine) RegisterHandler(action string, handler ActionHandler)
RegisterHandler adds or replaces a named action handler.