Add icons
crate (#27447)
This PR adds a new `icons` crate and moves the `IconName` into it. We have a number of crates that are taking a dependency on `ui` just so they can talk about icons, which is not ideal. Release Notes: - N/A
This commit is contained in:
parent
46e86f003f
commit
503bf607c5
7 changed files with 279 additions and 251 deletions
16
crates/icons/Cargo.toml
Normal file
16
crates/icons/Cargo.toml
Normal file
|
@ -0,0 +1,16 @@
|
|||
[package]
|
||||
name = "icons"
|
||||
version = "0.1.0"
|
||||
edition.workspace = true
|
||||
publish.workspace = true
|
||||
license = "GPL-3.0-or-later"
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
||||
[lib]
|
||||
path = "src/icons.rs"
|
||||
|
||||
[dependencies]
|
||||
serde.workspace = true
|
||||
strum.workspace = true
|
1
crates/icons/LICENSE-GPL
Symbolic link
1
crates/icons/LICENSE-GPL
Symbolic link
|
@ -0,0 +1 @@
|
|||
../../LICENSE-GPL
|
248
crates/icons/src/icons.rs
Normal file
248
crates/icons/src/icons.rs
Normal file
|
@ -0,0 +1,248 @@
|
|||
use std::sync::Arc;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use strum::{EnumIter, EnumString, IntoStaticStr};
|
||||
|
||||
#[derive(
|
||||
Debug, PartialEq, Eq, Copy, Clone, EnumIter, EnumString, IntoStaticStr, Serialize, Deserialize,
|
||||
)]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
pub enum IconName {
|
||||
Ai,
|
||||
AiAnthropic,
|
||||
AiBedrock,
|
||||
AiAnthropicHosted,
|
||||
AiDeepSeek,
|
||||
AiEdit,
|
||||
AiGoogle,
|
||||
AiLmStudio,
|
||||
AiMistral,
|
||||
AiOllama,
|
||||
AiOpenAi,
|
||||
AiZed,
|
||||
ArrowCircle,
|
||||
ArrowDown,
|
||||
ArrowDownFromLine,
|
||||
ArrowLeft,
|
||||
ArrowRight,
|
||||
ArrowRightLeft,
|
||||
ArrowUp,
|
||||
ArrowUpFromLine,
|
||||
ArrowUpRight,
|
||||
ArrowUpRightAlt,
|
||||
AtSign,
|
||||
AudioOff,
|
||||
AudioOn,
|
||||
Backspace,
|
||||
Bell,
|
||||
BellDot,
|
||||
BellOff,
|
||||
BellRing,
|
||||
Blocks,
|
||||
Bolt,
|
||||
Book,
|
||||
BookCopy,
|
||||
BookPlus,
|
||||
Brain,
|
||||
CaseSensitive,
|
||||
Check,
|
||||
ChevronDown,
|
||||
/// This chevron indicates a popover menu.
|
||||
ChevronDownSmall,
|
||||
ChevronLeft,
|
||||
ChevronRight,
|
||||
ChevronUp,
|
||||
ChevronUpDown,
|
||||
Circle,
|
||||
Clipboard,
|
||||
Close,
|
||||
Code,
|
||||
Cog,
|
||||
Command,
|
||||
Context,
|
||||
Control,
|
||||
Copilot,
|
||||
CopilotDisabled,
|
||||
CopilotError,
|
||||
CopilotInit,
|
||||
Copy,
|
||||
CountdownTimer,
|
||||
CursorIBeam,
|
||||
Dash,
|
||||
DebugBreakpoint,
|
||||
DebugIgnoreBreakpoints,
|
||||
DebugPause,
|
||||
DebugContinue,
|
||||
DebugStepOver,
|
||||
DebugStepInto,
|
||||
DebugStepOut,
|
||||
DebugStepBack,
|
||||
DebugRestart,
|
||||
Debug,
|
||||
DebugStop,
|
||||
DebugDisconnect,
|
||||
DebugLogBreakpoint,
|
||||
DatabaseZap,
|
||||
Delete,
|
||||
Diff,
|
||||
Disconnected,
|
||||
Download,
|
||||
Ellipsis,
|
||||
EllipsisVertical,
|
||||
Envelope,
|
||||
Eraser,
|
||||
Escape,
|
||||
ExpandVertical,
|
||||
Exit,
|
||||
ExternalLink,
|
||||
ExpandUp,
|
||||
ExpandDown,
|
||||
Eye,
|
||||
File,
|
||||
FileCode,
|
||||
FileDoc,
|
||||
FileDiff,
|
||||
FileGeneric,
|
||||
FileGit,
|
||||
FileLock,
|
||||
FileRust,
|
||||
FileSearch,
|
||||
FileText,
|
||||
FileToml,
|
||||
FileTree,
|
||||
Filter,
|
||||
Folder,
|
||||
FolderOpen,
|
||||
FolderX,
|
||||
Font,
|
||||
FontSize,
|
||||
FontWeight,
|
||||
GenericClose,
|
||||
GenericMaximize,
|
||||
GenericMinimize,
|
||||
GenericRestore,
|
||||
Github,
|
||||
Globe,
|
||||
GitBranch,
|
||||
GitBranchSmall,
|
||||
Hash,
|
||||
HistoryRerun,
|
||||
Indicator,
|
||||
Info,
|
||||
InlayHint,
|
||||
Keyboard,
|
||||
Library,
|
||||
LineHeight,
|
||||
Link,
|
||||
ListTree,
|
||||
ListX,
|
||||
LockOutlined,
|
||||
MagnifyingGlass,
|
||||
MailOpen,
|
||||
Maximize,
|
||||
Menu,
|
||||
MessageBubbles,
|
||||
MessageCircle,
|
||||
Cloud,
|
||||
Mic,
|
||||
MicMute,
|
||||
Microscope,
|
||||
Minimize,
|
||||
Option,
|
||||
PageDown,
|
||||
PageUp,
|
||||
PanelLeft,
|
||||
PanelRight,
|
||||
Pencil,
|
||||
Person,
|
||||
PersonCircle,
|
||||
PhoneIncoming,
|
||||
Pin,
|
||||
Play,
|
||||
Plus,
|
||||
PocketKnife,
|
||||
Public,
|
||||
PullRequest,
|
||||
Quote,
|
||||
RefreshTitle,
|
||||
Regex,
|
||||
ReplNeutral,
|
||||
Replace,
|
||||
ReplaceAll,
|
||||
ReplaceNext,
|
||||
ReplyArrowRight,
|
||||
Rerun,
|
||||
Return,
|
||||
Reveal,
|
||||
RotateCcw,
|
||||
RotateCw,
|
||||
Route,
|
||||
Save,
|
||||
Screen,
|
||||
SearchCode,
|
||||
SearchSelection,
|
||||
SelectAll,
|
||||
Server,
|
||||
Settings,
|
||||
SettingsAlt,
|
||||
Shift,
|
||||
Slash,
|
||||
SlashSquare,
|
||||
Sliders,
|
||||
SlidersVertical,
|
||||
Snip,
|
||||
Space,
|
||||
Sparkle,
|
||||
SparkleAlt,
|
||||
SparkleFilled,
|
||||
Spinner,
|
||||
Split,
|
||||
SquareDot,
|
||||
SquareMinus,
|
||||
SquarePlus,
|
||||
Star,
|
||||
StarFilled,
|
||||
Stop,
|
||||
Strikethrough,
|
||||
Supermaven,
|
||||
SupermavenDisabled,
|
||||
SupermavenError,
|
||||
SupermavenInit,
|
||||
SwatchBook,
|
||||
Tab,
|
||||
Terminal,
|
||||
TextSnippet,
|
||||
ThumbsUp,
|
||||
ThumbsDown,
|
||||
Trash,
|
||||
TrashAlt,
|
||||
Triangle,
|
||||
TriangleRight,
|
||||
Undo,
|
||||
Unpin,
|
||||
Update,
|
||||
UserGroup,
|
||||
Visible,
|
||||
Wand,
|
||||
Warning,
|
||||
WholeWord,
|
||||
X,
|
||||
XCircle,
|
||||
ZedAssistant,
|
||||
ZedAssistant2,
|
||||
ZedAssistantFilled,
|
||||
ZedPredict,
|
||||
ZedPredictUp,
|
||||
ZedPredictDown,
|
||||
ZedPredictDisabled,
|
||||
ZedPredictError,
|
||||
ZedXCopilot,
|
||||
}
|
||||
|
||||
impl IconName {
|
||||
/// Returns the path to this icon.
|
||||
pub fn path(&self) -> Arc<str> {
|
||||
let file_stem: &'static str = self.into();
|
||||
format!("icons/{file_stem}.svg").into()
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue