2023-11-03 20:37:22 +00:00
|
|
|
|
// TODO:
|
|
|
|
|
// Document these:
|
|
|
|
|
// - [ ] - label
|
|
|
|
|
// - [ ] - button
|
|
|
|
|
// - [ ] - icon_button
|
|
|
|
|
// - [ ] - icon
|
|
|
|
|
// - [ ] - list
|
|
|
|
|
// - [ ] - avatar
|
|
|
|
|
// - [ ] - panel
|
|
|
|
|
// - [ ] - modal
|
|
|
|
|
// - [ ] - palette
|
|
|
|
|
// - [ ] - input
|
|
|
|
|
// - [ ] - facepile
|
|
|
|
|
// - [ ] - player
|
|
|
|
|
// - [ ] - stacks
|
|
|
|
|
// - [ ] - context menu
|
|
|
|
|
// - [ ] - input
|
|
|
|
|
// - [ ] - textarea (not built)
|
|
|
|
|
// - [ ] - indicator
|
|
|
|
|
// - [ ] - public actor
|
|
|
|
|
// - [ ] - keybinding
|
|
|
|
|
// - [ ] - tab
|
|
|
|
|
// - [ ] - toast
|
|
|
|
|
// - [ ] - status_toast (maybe not built?)
|
|
|
|
|
// - [ ] - notification_toast
|
|
|
|
|
|
2023-10-23 14:21:30 +00:00
|
|
|
|
//! # UI – Zed UI Primitives & Components
|
|
|
|
|
//!
|
|
|
|
|
//! This crate provides a set of UI primitives and components that are used to build all of the elements in Zed's UI.
|
|
|
|
|
//!
|
|
|
|
|
//! ## Work in Progress
|
|
|
|
|
//!
|
|
|
|
|
//! This crate is still a work in progress. The initial primitives and components are built for getting all the UI on the screen,
|
|
|
|
|
//! much of the state and functionality is mocked or hard codeded, and performance has not been a focus.
|
|
|
|
|
//!
|
|
|
|
|
//! Expect some inconsistencies from component to component as we work out the best way to build these components.
|
|
|
|
|
//!
|
2023-11-03 20:28:54 +00:00
|
|
|
|
//! ## Getting Started
|
|
|
|
|
//!
|
|
|
|
|
//! This is a quick primer to get you started using the UI components.
|
|
|
|
|
//!
|
|
|
|
|
//! You shouldn't need to construct an element from scratch very often. If you find
|
|
|
|
|
//! yourself manually styling things like hover, text colors, etc, you should
|
|
|
|
|
//! probably check that there isn't already a base component for whatever you are building.
|
|
|
|
|
//!
|
|
|
|
|
//! Here is an into to some of the most common elements:
|
|
|
|
|
//!
|
|
|
|
|
//! ### Text
|
|
|
|
|
//!
|
|
|
|
|
//! For generic UI text most frequently you will use a [`Label`] component.
|
|
|
|
|
//!
|
|
|
|
|
//! ```rust
|
|
|
|
|
//! use ui2::prelude::*;
|
|
|
|
|
//! use ui2::{Label, LabelColor};
|
|
|
|
|
//!
|
|
|
|
|
//! pub fn render_some_ui_text<V: 'static>() -> impl Component<V> {
|
|
|
|
|
//! div().p_2().child(
|
|
|
|
|
//! Label::new("Hello World")
|
|
|
|
|
//! .color(LabelColor::Muted)
|
|
|
|
|
//! )
|
|
|
|
|
//! }
|
|
|
|
|
//! ```
|
|
|
|
|
//!
|
|
|
|
|
//! ### Interactive Elements
|
|
|
|
|
//!
|
|
|
|
|
//! - Icon: To make an icon interactive, use [`IconButton`].
|
|
|
|
|
//! - Button: To make a button interactive, use [`Button`].
|
|
|
|
|
//!
|
2023-10-23 14:21:30 +00:00
|
|
|
|
//! ## Design Philosophy
|
|
|
|
|
//!
|
|
|
|
|
//! Work in Progress!
|
|
|
|
|
//!
|
|
|
|
|
|
2023-10-25 14:33:33 +00:00
|
|
|
|
// TODO: Fix warnings instead of supressing.
|
2023-10-06 21:07:59 +00:00
|
|
|
|
#![allow(dead_code, unused_variables)]
|
2023-10-06 20:52:05 +00:00
|
|
|
|
|
2023-10-06 21:07:59 +00:00
|
|
|
|
mod components;
|
|
|
|
|
mod elements;
|
2023-10-23 15:21:48 +00:00
|
|
|
|
mod elevation;
|
2023-10-06 21:07:59 +00:00
|
|
|
|
pub mod prelude;
|
2023-10-23 09:34:35 +00:00
|
|
|
|
pub mod settings;
|
2023-10-06 21:47:10 +00:00
|
|
|
|
mod static_data;
|
2023-11-02 14:11:25 +00:00
|
|
|
|
pub mod utils;
|
2023-10-06 20:52:05 +00:00
|
|
|
|
|
2023-10-06 21:07:59 +00:00
|
|
|
|
pub use components::*;
|
|
|
|
|
pub use elements::*;
|
|
|
|
|
pub use prelude::*;
|
2023-10-06 21:47:10 +00:00
|
|
|
|
pub use static_data::*;
|
2023-10-06 21:07:59 +00:00
|
|
|
|
|
2023-10-19 16:58:17 +00:00
|
|
|
|
// This needs to be fully qualified with `crate::` otherwise we get a panic
|
|
|
|
|
// at:
|
2023-10-21 14:01:47 +00:00
|
|
|
|
// thread '<unnamed>' panicked at crates/gpui2/src/platform/mac/platform.rs:66:81:
|
2023-10-19 16:58:17 +00:00
|
|
|
|
// called `Option::unwrap()` on a `None` value
|
|
|
|
|
//
|
|
|
|
|
// AFAICT this is something to do with conflicting names between crates and modules that
|
|
|
|
|
// interfaces with declaring the `ClassDecl`.
|
|
|
|
|
pub use crate::settings::*;
|
2023-10-10 19:30:16 +00:00
|
|
|
|
|
|
|
|
|
#[cfg(feature = "stories")]
|
|
|
|
|
mod story;
|
|
|
|
|
#[cfg(feature = "stories")]
|
|
|
|
|
pub use story::*;
|