Skip to main content

fig_schema/
present.rs

1//! Renderer-neutral presentation hints. A frontend maps these to its own
2//! symbols and colours (SwiftUI → SF Symbols + adaptive `Color`; ratatui →
3//! unicode + ANSI). Carried on [`crate::FieldRule`] but never interpreted by
4//! this crate — purely a payload for the embedder's renderer.
5
6/// Presentation hints for one field rule.
7#[derive(Debug, Clone, Default, PartialEq, Eq)]
8pub struct Presentation {
9    /// A human field label.
10    pub title: Option<String>,
11    /// Help text / section subtitle.
12    pub description: Option<String>,
13    /// A semantic icon.
14    pub icon: Option<Icon>,
15    /// A semantic tint.
16    pub tint: Option<Tint>,
17}
18
19/// A semantic icon hint. Frontends map to their own symbol set.
20#[derive(Debug, Clone, PartialEq, Eq)]
21pub enum Icon {
22    Link,
23    Enum,
24    Toggle,
25    Lock,
26    Globe,
27    Clock,
28    Tag,
29    Text,
30    /// An escape hatch naming a frontend-specific symbol.
31    Other(String),
32}
33
34/// A semantic tint hint. Frontends map to theme-adaptive colours.
35#[derive(Debug, Clone, Copy, PartialEq, Eq)]
36pub enum Tint {
37    Accent,
38    Neutral,
39    Positive,
40    Warning,
41    Danger,
42}