Expand description
Core UI transformation system with container models, layout calculations, and HTML generation.
This crate provides a comprehensive UI transformation system for building modern user interfaces. It includes a flexible container model, layout calculation engine, HTML generation, and tree traversal utilities.
§Features
- Container System - Comprehensive UI container model with styling and layout properties
- Layout Engine - Advanced layout calculation with flexbox and grid support (via
layoutfeature) - HTML Generation - Complete HTML rendering with CSS generation (via
htmlfeature) - Calculation System - CSS
calc()expressions with viewport units (vw, vh, dvw, dvh) - Element Types - Full HTML element support including semantic elements, forms, and media
- Responsive Design - Conditional styling and responsive breakpoints via override system
- Tree Traversal - Efficient container tree navigation and manipulation
§Example
use hyperchad_transformer::{Container, Element, Number};
use hyperchad_transformer::models::LayoutDirection;
use hyperchad_color::Color;
// Create a basic container with styling
let container = Container {
element: Element::Div,
width: Some(Number::from(300)),
height: Some(Number::from(200)),
background: Some(Color::from_hex("#f0f0f0")),
direction: LayoutDirection::Column,
padding_left: Some(Number::from(20)),
padding_right: Some(Number::from(20)),
..Default::default()
};
// Generate HTML representation
let html = container.to_string();§Main Entry Points
Container- The core UI container struct with styling and layout propertiesElement- Enum representing different HTML element typesNumber- Numeric values with unit support (px, %, vw, vh, calc expressions)Calculation- Arithmetic expressions for CSScalc()support
§Re-exports
Re-exports§
pub use hyperchad_actions as actions;pub use hyperchad_transformer_models as models;
Modules§
- html
- HTML parsing and generation utilities (requires
htmlfeature). HTML parsing and generation utilities. - layout
- Layout calculation engine for UI containers (requires
layoutfeature). Layout calculation engine for UI containers. - parse
- Parsing utilities for numeric values and CSS calculation expressions. Parsing utilities for numeric values and CSS calculation expressions.
Macros§
- float_
eq - Compares two floats for approximate equality within epsilon tolerance.
- float_
gt - Compares if float
$ais greater than$bwith epsilon tolerance. - float_
gte - Compares if float
$ais greater than or approximately equal to$bwith epsilon tolerance. - float_
lt - Compares if float
$ais less than$bwith epsilon tolerance. - float_
lte - Compares if float
$ais less than or approximately equal to$bwith epsilon tolerance. - max_
float - Returns the maximum of two float values.
- min_
float - Returns the minimum of two float values.
- override_
item - Pattern matches on
OverrideItemvariants and executes an action with the inner value.
Structs§
- BfsPaths
- Breadth-first search traversal paths for container trees.
- Bool
Wrapper - Wrapper for boolean values with conditional logic support.
- Config
Override - Configuration override applied when a condition is met.
- Container
- Represents a layout container with style properties and child elements.
- Flex
- Flexbox sizing configuration with grow, shrink, and basis values.
- Table
Iter - Iterator over table rows and headings with immutable references.
- Table
Iter Mut - Iterator over table rows and headings with mutable references.
- Text
Decoration - Text decoration configuration including underline, overline, and strikethrough.
Enums§
- Calculation
- Represents a calculation expression that can be evaluated with context.
- Element
- HTML element type with associated properties.
- Header
Size - HTML heading level sizes.
- Input
- HTML input element types with associated properties.
- Maybe
Replaced - Represents a value that may have been replaced with a string.
- Number
- Represents a numeric value with optional unit or calculation.
- Override
Condition - Condition type for configuration overrides.
- Override
Item - Style property that can be overridden based on conditions.
- Responsive
Trigger - Conditions that trigger responsive layout changes.