Skip to main content

aetna_core/tree/
icon_name.rs

1//! Built-in icon-name vocabulary.
2
3/// Built-in icon names. The string forms intentionally mirror common
4/// lucide/shadcn names so agents can reach for familiar labels.
5#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
6#[non_exhaustive]
7pub enum IconName {
8    Activity,
9    AlertCircle,
10    BarChart,
11    Bell,
12    Check,
13    ChevronDown,
14    ChevronLeft,
15    ChevronRight,
16    Command,
17    Download,
18    FileText,
19    Folder,
20    GitBranch,
21    GitCommit,
22    Info,
23    LayoutDashboard,
24    Menu,
25    MoreHorizontal,
26    Plus,
27    RefreshCw,
28    Search,
29    Settings,
30    Upload,
31    Users,
32    X,
33}
34
35impl IconName {
36    pub fn parse(name: &str) -> Option<Self> {
37        match name {
38            "activity" => Some(Self::Activity),
39            "alert-circle" | "alert" => Some(Self::AlertCircle),
40            "bar-chart" | "chart-bar" => Some(Self::BarChart),
41            "bell" => Some(Self::Bell),
42            "check" => Some(Self::Check),
43            "chevron-down" => Some(Self::ChevronDown),
44            "chevron-left" => Some(Self::ChevronLeft),
45            "chevron-right" => Some(Self::ChevronRight),
46            "command" => Some(Self::Command),
47            "download" => Some(Self::Download),
48            "file-text" | "file" => Some(Self::FileText),
49            "folder" => Some(Self::Folder),
50            "git-branch" => Some(Self::GitBranch),
51            "git-commit" => Some(Self::GitCommit),
52            "info" => Some(Self::Info),
53            "layout-dashboard" | "dashboard" => Some(Self::LayoutDashboard),
54            "menu" => Some(Self::Menu),
55            "more-horizontal" | "more" => Some(Self::MoreHorizontal),
56            "plus" => Some(Self::Plus),
57            "refresh-cw" | "refresh" => Some(Self::RefreshCw),
58            "search" => Some(Self::Search),
59            "settings" => Some(Self::Settings),
60            "upload" => Some(Self::Upload),
61            "users" => Some(Self::Users),
62            "x" | "close" => Some(Self::X),
63            _ => None,
64        }
65    }
66
67    pub fn name(self) -> &'static str {
68        match self {
69            Self::Activity => "activity",
70            Self::AlertCircle => "alert-circle",
71            Self::BarChart => "bar-chart",
72            Self::Bell => "bell",
73            Self::Check => "check",
74            Self::ChevronDown => "chevron-down",
75            Self::ChevronLeft => "chevron-left",
76            Self::ChevronRight => "chevron-right",
77            Self::Command => "command",
78            Self::Download => "download",
79            Self::FileText => "file-text",
80            Self::Folder => "folder",
81            Self::GitBranch => "git-branch",
82            Self::GitCommit => "git-commit",
83            Self::Info => "info",
84            Self::LayoutDashboard => "layout-dashboard",
85            Self::Menu => "menu",
86            Self::MoreHorizontal => "more-horizontal",
87            Self::Plus => "plus",
88            Self::RefreshCw => "refresh-cw",
89            Self::Search => "search",
90            Self::Settings => "settings",
91            Self::Upload => "upload",
92            Self::Users => "users",
93            Self::X => "x",
94        }
95    }
96
97    pub fn fallback_glyph(self) -> &'static str {
98        match self {
99            Self::Activity => "~",
100            Self::AlertCircle => "!",
101            Self::BarChart => "▮",
102            Self::Bell => "•",
103            Self::Check => "✓",
104            Self::ChevronDown => "⌄",
105            Self::ChevronLeft => "‹",
106            Self::ChevronRight => "›",
107            Self::Command => "⌘",
108            Self::Download => "↓",
109            Self::FileText => "□",
110            Self::Folder => "▱",
111            Self::GitBranch => "⑂",
112            Self::GitCommit => "⊙",
113            Self::Info => "i",
114            Self::LayoutDashboard => "▦",
115            Self::Menu => "☰",
116            Self::MoreHorizontal => "…",
117            Self::Plus => "+",
118            Self::RefreshCw => "↻",
119            Self::Search => "⌕",
120            Self::Settings => "⚙",
121            Self::Upload => "↑",
122            Self::Users => "●",
123            Self::X => "×",
124        }
125    }
126}