fernctl/domain/tokens/
mod.rs

1//! # Design Tokens
2//!
3//! Design tokens are the atomic building blocks of the Fern design system.
4//! They encode visual design decisions (colors, spacing, radii) as type-safe
5//! Rust values.
6//!
7//! ## What Are Design Tokens?
8//!
9//! Design tokens are named values that store visual design attributes. Instead
10//! of scattering magic values throughout code:
11//!
12//! ```rust,ignore
13//! // ❌ Bad: Magic values everywhere
14//! button.background = "#313244";
15//! button.padding = 8;
16//! button.radius = 4;
17//! ```
18//!
19//! We use semantic tokens:
20//!
21//! ```rust,ignore
22//! // ✅ Good: Semantic tokens
23//! button.background = theme.surface;      // ColorToken<Surface>
24//! button.padding = SpacingSm::pixels();   // 8px from scale
25//! button.radius = theme.radius.button();  // Semantic radius
26//! ```
27//!
28//! ## Token Categories
29//!
30//! | Category | Module | Description |
31//! |----------|--------|-------------|
32//! | Color | [`color`] | RGBA colors with semantic roles |
33//! | Spacing | [`spacing`] | Scale-based spacing values |
34//! | Radius | [`radius`] | Border radius with semantic names |
35//! | Typography | [`typography`] | Font families and size scales |
36//!
37//! ## Type Safety
38//!
39//! Tokens use Rust's type system to prevent misuse:
40//!
41//! - **Color roles**: Can't use a foreground color as a background
42//! - **Spacing scale**: Can't use arbitrary pixel values
43//! - **Radius semantics**: Components can only use valid radii
44//!
45//! See each submodule for detailed examples.
46
47pub mod color;
48pub mod radius;
49pub mod spacing;
50pub mod typography;
51
52// Re-export all token types
53pub use color::*;
54pub use radius::*;
55pub use spacing::*;
56pub use typography::*;