Skip to main content

Crate hyperchad_actions

Crate hyperchad_actions 

Source
Expand description

Action system for HyperChad UI framework

This crate provides a comprehensive action system for building interactive UI behaviors in the HyperChad framework. It enables declarative definition of UI actions triggered by events such as clicks, hovers, and HTTP requests.

§Main Components

  • Action - Combines a trigger event with an effect to execute
  • ActionTrigger - Event types that can trigger actions (click, hover, HTTP events, etc.)
  • ActionEffect - Wrapper for actions with timing modifiers (throttle, delay)
  • ActionType - Concrete action types (style changes, navigation, logging, custom actions)
  • Key - Keyboard key representations for key events

§Feature Flags

  • logic - Enables conditional logic and dynamic value evaluation in actions
  • handler - Provides action handler implementation for processing actions
  • arb - Adds property-based testing support via proptest
  • serde - Enables serialization/deserialization support

§Example

use hyperchad_actions::{Action, ActionTrigger, ActionType};
use hyperchad_transformer_models::Visibility;

// Create an action that hides an element when clicked
let action = Action {
    trigger: ActionTrigger::Click,
    effect: ActionType::hide_by_id("my-element").into(),
};

Modules§

arb
Arbitrary value generation for property-based testing Arbitrary value generation for property-based testing
dsl
Domain-specific language (DSL) for defining actions in templates DSL AST for HyperChad Actions
handler
Action handler implementation for processing and executing actions Action handler implementation for processing and executing actions
logic
Logic and conditional evaluation for actions Conditional logic and dynamic value evaluation for actions
prelude
Convenience re-exports for common action APIs.

Structs§

Action
Action that combines a trigger event with an effect
ActionEffect
Effect that wraps an action with timing and execution modifiers
HttpEventContext
Context information for HTTP-related action events

Enums§

ActionTrigger
Event trigger that determines when an action should execute
ActionType
Types of actions that can be performed on UI elements
ElementTarget
Target specification for DOM element selection.
InputActionType
Input-related action types
Key
Keyboard key representation for key events
LogLevel
Log severity level for logging actions
StyleAction
Style modification actions for UI elements
Target
A target reference that can be either a literal string or a reference to a value.