1// TODO:
2// Document these:
3// - [ ] - label
4// - [ ] - button
5// - [ ] - icon_button
6// - [ ] - icon
7// - [ ] - list
8// - [ ] - avatar
9// - [ ] - panel
10// - [ ] - modal
11// - [ ] - palette
12// - [ ] - input
13// - [ ] - facepile
14// - [ ] - player
15// - [ ] - stacks
16// - [ ] - context menu
17// - [ ] - input
18// - [ ] - textarea (not built)
19// - [ ] - indicator
20// - [ ] - public actor
21// - [ ] - keybinding
22// - [ ] - tab
23// - [ ] - toast
24// - [ ] - status_toast (maybe not built?)
25// - [ ] - notification_toast
26
27//! # UI – Zed UI Primitives & Components
28//!
29//! This crate provides a set of UI primitives and components that are used to build all of the elements in Zed's UI.
30//!
31//! ## Work in Progress
32//!
33//! This crate is still a work in progress. The initial primitives and components are built for getting all the UI on the screen,
34//! much of the state and functionality is mocked or hard codeded, and performance has not been a focus.
35//!
36//! Expect some inconsistencies from component to component as we work out the best way to build these components.
37//!
38//! ## Getting Started
39//!
40//! This is a quick primer to get you started using the UI components.
41//!
42//! You shouldn't need to construct an element from scratch very often. If you find
43//! yourself manually styling things like hover, text colors, etc, you should
44//! probably check that there isn't already a base component for whatever you are building.
45//!
46//! Here is an into to some of the most common elements:
47//!
48//! ### Text
49//!
50//! For generic UI text most frequently you will use a [`Label`] component.
51//!
52//! ```rust
53//! use ui2::prelude::*;
54//! use ui2::{Label, LabelColor};
55//!
56//! pub fn render_some_ui_text<V: 'static>() -> impl Component<V> {
57//! div().p_2().child(
58//! Label::new("Hello World")
59//! .color(LabelColor::Muted)
60//! )
61//! }
62//! ```
63//!
64//! ### Interactive Elements
65//!
66//! - Icon: To make an icon interactive, use [`IconButton`].
67//! - Button: To make a button interactive, use [`Button`].
68//!
69//! ## Design Philosophy
70//!
71//! Work in Progress!
72//!
73
74// TODO: Fix warnings instead of supressing.
75#![allow(dead_code, unused_variables)]
76
77mod components;
78mod elements;
79mod elevation;
80pub mod prelude;
81pub mod settings;
82mod static_data;
83pub mod utils;
84
85pub use components::*;
86pub use elements::*;
87pub use prelude::*;
88pub use static_data::*;
89
90// This needs to be fully qualified with `crate::` otherwise we get a panic
91// at:
92// thread '<unnamed>' panicked at crates/gpui2/src/platform/mac/platform.rs:66:81:
93// called `Option::unwrap()` on a `None` value
94//
95// AFAICT this is something to do with conflicting names between crates and modules that
96// interfaces with declaring the `ClassDecl`.
97pub use crate::settings::*;
98
99#[cfg(feature = "stories")]
100mod story;
101#[cfg(feature = "stories")]
102pub use story::*;