xui 0.1.0

Declarative UI toolkit for Rust — an ergonomic layer over GPUI
Documentation
// SPDX-License-Identifier: MIT OR Apache-2.0

//! # XUI
//!
//! `xui` is an ergonomic wrapper around the `gpui` framework, designed to simplify
//! UI development in Rust by providing declarative macros and convenient utilities.

// We lock the GPUI version for this crate, so we need to make it possible for the user
// to use our version of GPUI instead of their own direct dependency.
// This is a standard practice to avoid version inconsistencies between the same crate
// acting as both a direct and a transitive dependency.
pub use gpui;

#[macro_use]
pub mod macros;

/// Predefined color constants mapped to `gpui::Hsla` values.
pub mod colors {
    use gpui::{black, white, red, green, blue, yellow, Hsla};
    pub use gpui::{hsla, rgba};

    /// Solid black color.
    pub const BLACK: Hsla = black();
    /// Solid white color.
    pub const WHITE: Hsla = white();
    /// Solid red color.
    pub const RED: Hsla = red();
    /// Solid green color.
    pub const GREEN: Hsla = green();
    /// Solid blue color.
    pub const BLUE: Hsla = blue();
    /// Solid yellow color.
    pub const YELLOW: Hsla = yellow();
}

/// Re-exports of common sizing utilities from `gpui`.
pub mod sizes {
    pub use gpui::{rems, px};
}

/// The `prelude` module re-exports the most commonly used items, traits, and macros.
/// Importing this module via `use xui::prelude::*;` brings all essential XUI and GPUI
/// components into scope.
pub mod prelude {
    pub use crate::{macros::*, colors::*, sizes::*};
    pub use gpui::{FontWeight, Stateful};
    pub use gpui::prelude::*;
    pub use gpui;
}