freya/
lib.rs

1#![doc(
2    html_logo_url = "https://freyaui.dev/logo.svg",
3    html_favicon_url = "https://freyaui.dev/logo.svg"
4)]
5//! # Freya
6//!
7//! **Freya** is a declarative, cross-platform GUI Rust library, powered by 🎨 [Skia](https://skia.org/).
8//!
9//! ### Basics
10//! - [Introduction](self::_docs::introduction)
11//! - [UI](self::_docs::ui)
12//! - [Elements](self::elements)
13//! - [Components and Props](self::_docs::components_and_props)
14//! - [Hooks](self::_docs::hooks)
15//!
16//! ### Learn
17//! - [Development Setup](self::_docs::development_setup)
18//! - [i18n](self::_docs::i18n)
19//! - [Built-in Components Gallery](crate::components::gallery)
20//!
21//! ## Features flags
22//!
23//! - `all`: Enables all the features listed below
24//! - `router`: Reexport `freya-router` under `freya::router`
25//! - `i18n`: Reexport `freya-i18n` under `freya::router`
26//! - `remote-asset`: Enables support for **HTTP** asset sources for [ImageViewer](freya_components::image_viewer::ImageViewer) and [freya_components::gif_viewer::GifViewer] components.
27//! - `devtools`: Enables devtools support.
28//! - `performance`: Enables the performance overlay plugin.
29//! - `vulkan`: Enables Vulkan rendering support.
30//! - `tray`: Enables tray support using the `tray-icon` crate.
31//! - `sdk`: Reexport `freya-sdk` under `freya::sdk`
32//! - `gif`: Enables the `GifViewer` component.
33//! - `plot`: Enables the `plot` element.
34
35pub mod prelude {
36    cfg_if::cfg_if! {
37        if #[cfg(feature = "router")] {
38            pub use freya_components::activable_route::*;
39            pub use freya_components::link::*;
40            pub use freya_components::native_router::*;
41            pub use freya_components::animated_router::*;
42        }
43    }
44    cfg_if::cfg_if! {
45        if #[cfg(feature = "plot")] {
46            pub use freya_components::plot::*;
47        }
48    }
49    pub use freya_core::prelude::*;
50    pub use freya_winit::{
51        WinitPlatformExt,
52        config::{
53            LaunchConfig,
54            WindowConfig,
55        },
56    };
57
58    pub use crate::components::*;
59    pub fn launch(launch_config: LaunchConfig) {
60        #[cfg(feature = "devtools")]
61        let launch_config = launch_config.with_plugin(freya_devtools::DevtoolsPlugin::default());
62        #[cfg(feature = "performance")]
63        let launch_config = launch_config
64            .with_plugin(freya_performance_plugin::PerformanceOverlayPlugin::default());
65        freya_winit::launch(launch_config)
66    }
67    pub use torin::{
68        alignment::Alignment,
69        content::Content,
70        direction::Direction,
71        gaps::Gaps,
72        geometry::{
73            Area,
74            CursorPoint,
75            Size2D,
76        },
77        position::Position,
78        size::Size,
79    };
80}
81pub mod elements {
82    pub use freya_core::elements::*;
83}
84
85pub mod components {
86    #[cfg(feature = "gif")]
87    pub use freya_components::gif_viewer::*;
88    pub use freya_components::{
89        accordion::*,
90        activable_route_context::*,
91        button::*,
92        checkbox::*,
93        chip::*,
94        context_menu::*,
95        drag_drop::*,
96        draggable_canvas::*,
97        element_expansions::*,
98        floating_tab::*,
99        gallery,
100        get_theme,
101        icons::{
102            arrow::*,
103            tick::*,
104        },
105        image_viewer::*,
106        input::*,
107        loader::*,
108        menu::*,
109        overflowed_content::*,
110        popup::*,
111        portal::*,
112        progressbar::*,
113        radio_item::*,
114        resizable_container::*,
115        scrollviews::*,
116        select::*,
117        selectable_text::*,
118        sidebar::*,
119        slider::*,
120        switch::*,
121        table::*,
122        theming::{
123            component_themes::*,
124            extensions::*,
125            hooks::*,
126            themes::*,
127        },
128        tile::*,
129        tooltip::*,
130    };
131}
132
133pub mod text_edit {
134    pub use freya_edit::*;
135}
136pub mod animation {
137    pub use freya_animation::prelude::*;
138}
139#[cfg(feature = "router")]
140pub mod router {
141    pub use freya_router::*;
142}
143#[cfg(feature = "i18n")]
144pub mod i18n {
145    pub use freya_i18n::*;
146}
147#[cfg(feature = "engine")]
148pub mod engine {
149    pub use freya_engine::*;
150}
151
152pub mod winit {
153    pub use freya_winit::winit::*;
154}
155
156pub mod helpers {
157    pub use freya_core::helpers::*;
158}
159
160#[cfg(feature = "tray")]
161pub mod tray {
162    pub use freya_winit::tray::*;
163}
164
165#[cfg(feature = "sdk")]
166pub mod sdk {
167    pub use freya_sdk::*;
168}
169
170#[cfg(doc)]
171pub mod _docs;