plushie 0.7.0

Desktop GUI framework for Rust
//! Shared property types for building views.
//!
//! Most types are re-exported from [`plushie_core::types`] which owns the
//! canonical definitions and wire encode/decode logic. This module adds
//! SDK-specific ergonomic types (`Align`, `KeyModifiers`) that only make
//! sense in the builder/event context.

// -------------------------------------------------------------------------
// Re-exports from plushie-core
// -------------------------------------------------------------------------

pub use plushie_core::types::{
    // A11y
    A11y,
    Anchor,
    // Angle
    Angle,
    // Animation
    Animatable,
    ArrowMode,
    Background,
    Border,
    // Visual
    Color,
    ContentFit,
    CursorStyle,
    // Theme
    CustomTheme,
    // Layout
    Direction,
    Ellipsis,
    ErrorCorrection,
    FilterMethod,
    // Typography
    Font,
    FontStretch,
    FontStyle,
    FontWeight,
    Gradient,
    GradientStop,
    HasPopup,
    // Alignment
    HorizontalAlignment,
    // Input
    InputPurpose,
    // Geometry
    Length,
    LineHeight,
    Live,
    Orientation,
    Padding,
    Position,
    Radius,
    Role,
    Shadow,
    Shaping,
    SortOrder,
    // Style
    Style,
    StyleMap,
    TextAlignment,
    TextDirection,
    TextMotion,
    Theme,
    // Untyped props escape hatch
    UntypedProps,
    // Value
    Validation,
    ValueRange,
    VerticalAlignment,
    // Text layout
    Wrapping,
};

// Note: the derive-macro helper traits (`FromNode`, `PlushieType`,
// `WidgetEventEncode`, `WidgetCommandEncode`) are reached via
// [`crate::derive_support`] rather than `plushie::types`, keeping the
// app-developer namespace focused on palette, layout, geometry, and
// typography types.

// -------------------------------------------------------------------------
// Re-exports from plushie-core (canvas)
// -------------------------------------------------------------------------

pub use plushie_core::types::{DragAxis, FillRule, LineCap, LineJoin};

// -------------------------------------------------------------------------
// SDK-specific: Alignment
// -------------------------------------------------------------------------

/// Horizontal or vertical alignment.
///
/// Maps to different wire strings depending on context:
/// horizontal uses "left"/"center"/"right", vertical uses
/// "top"/"center"/"bottom", and cross-axis uses
/// "start"/"center"/"end".
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum Align {
    /// Align to the start (left or top).
    Start,
    /// Align to the center.
    Center,
    /// Align to the end (right or bottom).
    End,
}

impl From<Align> for TextAlignment {
    fn from(value: Align) -> Self {
        match value {
            Align::Start => Self::Left,
            Align::Center => Self::Center,
            Align::End => Self::Right,
        }
    }
}

// -------------------------------------------------------------------------
// Re-export: KeyModifiers
// -------------------------------------------------------------------------

/// Keyboard modifier state exposed to app `update/2`.
///
/// Re-exported from `plushie_core::protocol::KeyModifiers`. The canonical
/// definition lives in plushie-core with all necessary derives (Copy, Eq,
/// Serialize, Deserialize).
pub use plushie_core::protocol::KeyModifiers;

// -------------------------------------------------------------------------
// Re-export: WindowLevel
// -------------------------------------------------------------------------

/// Window stacking level.
///
/// Re-exported from `plushie_core::ops::WindowLevel`.
pub use plushie_core::ops::WindowLevel;