StratoSDK is a framework with a declarative approach similar to Flutter/React, written and designed entirely for Rust.
| 1 | //! Core functionality for StratoUI framework |
| 2 | //! |
| 3 | //! This crate provides the fundamental building blocks for the StratoUI framework, |
| 4 | //! including state management, event handling, and layout calculations. |
| 5 | |
| 6 | pub mod config; |
| 7 | pub mod error; |
| 8 | pub mod event; |
| 9 | pub mod hot_reload; |
| 10 | pub mod inspector; |
| 11 | pub mod layout; |
| 12 | pub mod logging; |
| 13 | pub mod plugin; |
| 14 | pub mod reactive; |
| 15 | pub mod state; |
| 16 | pub mod taffy_layout; |
| 17 | pub mod text; |
| 18 | pub mod theme; |
| 19 | pub mod types; |
| 20 | pub mod ui_node; |
| 21 | pub mod validated_rect; |
| 22 | pub mod vdom; |
| 23 | pub mod widget; |
| 24 | pub mod window; |
| 25 | |
| 26 | pub use error::{ |
| 27 | Result, StratoError, StratoResult, TaffyLayoutError, TaffyLayoutResult, TaffyRenderError, |
| 28 | TaffyRenderResult, TaffyValidationError, TaffyValidationResult, |
| 29 | }; |
| 30 | pub use event::{Event, EventHandler, EventResult}; |
| 31 | pub use layout::{Constraints, Layout, LayoutConstraints, LayoutEngine, Size}; |
| 32 | pub use logging::{LogCategory, LogLevel}; |
| 33 | pub use reactive::{Computed, Effect, Reactive}; |
| 34 | pub use state::{Signal, State}; |
| 35 | pub use taffy; |
| 36 | pub use taffy_layout::{ComputedLayout, DrawCommand, TaffyLayoutManager, TaffyWidget}; |
| 37 | pub use types::{Color, Point, Rect, Transform}; |
| 38 | pub use validated_rect::ValidatedRect; |
| 39 | |
| 40 | /// Re-export commonly used types |
| 41 | pub mod prelude { |
| 42 | pub use crate::{ |
| 43 | error::{Result, StratoError}, |
| 44 | event::{Event, EventHandler, EventResult}, |
| 45 | inspector::{inspector, InspectorConfig, InspectorSnapshot}, |
| 46 | layout::{Constraints, Layout, Size}, |
| 47 | logging::LogLevel, |
| 48 | reactive::{Computed, Effect}, |
| 49 | state::{Signal, State}, |
| 50 | types::{Color, Point, Rect}, |
| 51 | }; |
| 52 | } |
| 53 | |
| 54 | /// Framework version information |
| 55 | pub const VERSION: &str = env!("CARGO_PKG_VERSION"); |
| 56 | |
| 57 | /// Initialize the core framework |
| 58 | pub fn init() -> Result<()> { |
| 59 | // Initialize logging system with default config |
| 60 | let config = config::LoggingConfig::default(); |
| 61 | if let Err(e) = logging::init(&config) { |
| 62 | return Err(StratoError::Initialization { |
| 63 | message: format!("Failed to initialize logging: {}", e), |
| 64 | context: None, |
| 65 | }); |
| 66 | } |
| 67 | |
| 68 | // Initialize tracing |
| 69 | tracing::info!("StratoUI Core v{} initialized", VERSION); |
| 70 | Ok(()) |
| 71 | } |
| 72 | |
| 73 | #[cfg(test)] |
| 74 | mod tests { |
| 75 | use super::*; |
| 76 | |
| 77 | #[test] |
| 78 | fn test_version() { |
| 79 | assert!(!VERSION.is_empty()); |
| 80 | } |
| 81 | } |
| 82 |