windjammer-ui 0.3.6

Cross-platform UI framework for Windjammer (Web, Desktop, Mobile)
Documentation
//! Windjammer UI Framework
//!
//! A cross-platform UI framework for building web, desktop, and mobile applications.
//!
//! # Features
//!
//! - **Reactive State Management** - Signal, Computed, Effect
//! - **Virtual DOM** - Efficient diffing and patching
//! - **Component Model** - Clean, composable components
//! - **Cross-Platform** - Web (WASM), Desktop (Tauri), Mobile
//! - **Server-Side Rendering** - SSR with hydration
//! - **Routing** - Client-side navigation
//!
//! # Example
//!
//! ```rust,no_run
//! use windjammer_ui::prelude::*;
//! use windjammer_ui::vdom::{VElement, VNode, VText};
//! use windjammer_ui::reactivity::Signal;
//!

// Allow clippy warnings for generated code
#![allow(clippy::new_without_default)]
#![allow(clippy::len_zero)]
#![allow(clippy::useless_conversion)]
#![allow(clippy::comparison_to_empty)]
#![allow(clippy::write_with_newline)]
#![allow(clippy::to_string_in_format_args)]
#![allow(clippy::collapsible_else_if)]
#![allow(clippy::useless_format)]
//! struct Counter {
//!     count: Signal<i32>,
//! }
//!
//! impl Counter {
//!     fn new() -> Self {
//!         Self { count: Signal::new(0) }
//!     }
//!     
//!     fn increment(&self) {
//!         self.count.update(|c| *c += 1);
//!     }
//! }
//! ```

#![allow(clippy::module_inception)]

// Re-export the proc macro
pub use windjammer_ui_macro::component;
pub use windjammer_ui_macro::Props;

pub mod app;
#[cfg(all(not(target_arch = "wasm32"), feature = "desktop"))]
pub mod app_docking;
#[cfg(target_arch = "wasm32")]
pub mod app_reactive;
#[cfg(all(not(target_arch = "wasm32"), feature = "desktop"))]
pub mod app_reactive_eframe;
pub mod event_handler;
#[cfg(all(not(target_arch = "wasm32"), feature = "desktop"))]
// pub mod scene_gizmos; // TODO: Implement scene gizmos module
pub mod undo_redo; // Available on all platforms

// Component trait (used by renderer, runtime, ssr)
pub mod component;
pub mod component_runtime;
pub mod components; // Component library
pub mod events;
pub mod platform;
pub mod reactivity;

#[cfg(all(not(target_arch = "wasm32"), feature = "desktop"))]
pub mod desktop_app_context;
#[cfg(all(not(target_arch = "wasm32"), feature = "desktop"))]
pub mod desktop_renderer;
pub mod reactivity_optimized;
pub mod renderer;
pub mod routing;
pub mod runtime;
pub mod simple_renderer;
pub mod simple_vnode;
pub mod ssr;
pub mod to_vnode;
pub mod vdom;
pub mod vnode_ffi; // FFI for Windjammer components to construct VNodes
#[cfg(target_arch = "wasm32")]
pub mod wasm_events;

#[cfg(target_arch = "wasm32")]
pub mod examples_wasm;

#[cfg(test)]
mod reactivity_tests;

/// Prelude module with commonly used types and traits
pub mod prelude {
    pub use crate::app::App;
    pub use crate::component::{Component, ComponentProps};
    pub use crate::component_runtime;
    pub use crate::events::{Event, EventHandler};
    pub use crate::platform::{Event as PlatformEvent, GestureEvent, SwipeDirection, Target};
    pub use crate::reactivity::{Computed, Effect, Signal};
    pub use crate::renderer::WebRenderer;
    pub use crate::routing::{Route, Router};
    pub use crate::simple_vnode::{VAttr, VNode};
    pub use crate::to_vnode::ToVNode;
    pub use crate::vnode_ffi; // VNode FFI for cross-platform components

    pub use crate::vdom::{VElement, VText};

    // Reactive app (all platforms)
    #[cfg(all(not(target_arch = "wasm32"), feature = "desktop"))]
    pub use crate::app_docking::DockingApp;
    #[cfg(target_arch = "wasm32")]
    pub use crate::app_reactive::{trigger_rerender, ReactiveApp};
    #[cfg(all(not(target_arch = "wasm32"), feature = "desktop"))]
    pub use crate::app_reactive_eframe::{trigger_rerender, ReactiveApp};

    // Re-export the component macro
    pub use crate::component;

    // Re-export common components (explicit imports due to symbol conflicts)
    pub use crate::components::alert::{Alert, AlertVariant};
    pub use crate::components::button::{Button, ButtonSize, ButtonVariant};
    pub use crate::components::container::Container;
    pub use crate::components::flex::{Flex, FlexDirection};
    pub use crate::components::input::Input;
    pub use crate::components::text::{Text, TextSize, TextWeight};
}

/// Mount a component to the DOM (WASM only)
#[cfg(target_arch = "wasm32")]
pub use renderer::mount;

#[cfg(test)]
mod tests {
    #[test]
    fn test_prelude_imports() {
        // Just verify prelude compiles
        use crate::prelude::*;
        let _ = Signal::new(42);
    }
}