Cranpose Foundation
Fundamental building blocks and system services for Cranpose UI.
When to Use
This crate provides the essential primitives that cranpose-ui is built upon. It contains:
- The Modifier System: The core logic for
Modifierchains and node delegation. - Basic Layouts:
Box,Row,Column(the layout algorithms themselves). - Input APIs:
PointerInput,FocusManager.
Library authors building their own widget sets or design systems might depend on cranpose-foundation to avoid pulling in the opinionated widgets of cranpose-ui.
Key Concepts
- Modifier Node: A stateful object attached to a layout node that can participate in layout, drawing, and input handling. This is more efficient than the stateless
Modifierchain object, which is just a factory configuration. - Semantics: Accessibility and testing information attached to the UI tree.
- Focus System: Manages keyboard navigation and focus request propagation.
Example: Custom Modifier
Creating a custom modifier involves defining a ModifierNode and a fluent builder method.
use *;
// 1. Define the Node
;
// 2. Define the Element (Factory)
;
// 3. Extension method for fluent API