//! Example Analytics Theme Plugin //! //! This plugin demonstrates a complete, minimal plugin implementation for //! Rustelo. It provides a custom theme optimized for displaying analytics //! dashboards. //! //! # Features //! //! - Custom color scheme with analytics-friendly palette //! - Responsive typography for data visualization //! - Support for multiple languages (English, Spanish) //! - Complete documentation and tests //! //! # Usage //! //! To use this plugin in your Rustelo project: //! //! 1. Add to your `Cargo.toml`: ```toml [dependencies] plugin-example-theme = { //! path = "./crates/plugin-example-theme" } ``` //! //! 2. Register in your resources initialization: ```rust,no_run use //! plugin_example_theme::ExampleThemeContributor; //! //! rustelo_core_lib::register_contributor(&ExampleThemeContributor)?; //! ``` //! //! # Architecture //! //! The plugin follows the Rustelo Level 5 (Compile-Time) plugin architecture: //! - Implements `ResourceContributor` trait //! - Embeds configuration via `include_str!()` //! - Registers at application startup //! - No conditional compilation or framework coupling mod resources; pub use resources::ExampleThemeContributor; /// Initialize the example theme plugin /// /// This function registers the plugin's resource contributor with the /// framework. Called automatically if the plugin is included in the /// application. /// /// # Returns /// /// Returns `Ok(())` on successful registration, or an error if registration /// fails. /// /// # Example /// /// ```no_run /// use plugin_example_theme::initialize; /// /// let result = initialize()?; /// println!("Plugin initialized!"); /// # Ok::<(), Box>(()) /// ``` pub fn initialize() -> Result<(), Box> { rustelo_core_lib::register_contributor(&ExampleThemeContributor)?; #[cfg(not(target_arch = "wasm32"))] { eprintln!("✅ Example Theme Plugin initialized successfully"); eprintln!(" Theme: analytics-dashboard"); eprintln!(" Languages: en, es"); } Ok(()) } #[cfg(test)] mod tests { use super::*; #[test] fn test_plugin_can_be_initialized() { let _contributor = ExampleThemeContributor; // If we got here, the contributor exists and can be instantiated } #[test] fn test_plugin_exports_public_api() { // Verify the public API is accessible let _path_to_initialize = initialize; } }