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        }
42    }
43    cfg_if::cfg_if! {
44        if #[cfg(feature = "plot")] {
45            pub use freya_components::plot::*;
46        }
47    }
48    pub use freya_core::prelude::*;
49    pub use freya_winit::{
50        WinitPlatformExt,
51        config::{
52            LaunchConfig,
53            WindowConfig,
54        },
55    };
56
57    pub use crate::components::*;
58    pub fn launch(launch_config: LaunchConfig) {
59        #[cfg(feature = "devtools")]
60        let launch_config = launch_config.with_plugin(freya_devtools::DevtoolsPlugin::default());
61        #[cfg(feature = "performance")]
62        let launch_config = launch_config
63            .with_plugin(freya_performance_plugin::PerformanceOverlayPlugin::default());
64        freya_winit::launch(launch_config)
65    }
66    pub use torin::{
67        alignment::Alignment,
68        content::Content,
69        direction::Direction,
70        gaps::Gaps,
71        geometry::{
72            Area,
73            CursorPoint,
74            Size2D,
75        },
76        position::Position,
77        size::Size,
78    };
79}
80pub mod elements {
81    pub use freya_core::elements::*;
82}
83
84pub mod components {
85    #[cfg(feature = "gif")]
86    pub use freya_components::gif_viewer::*;
87    pub use freya_components::{
88        accordion::*,
89        activable_route_context::*,
90        button::*,
91        checkbox::*,
92        chip::*,
93        context_menu::*,
94        drag_drop::*,
95        draggable_canvas::*,
96        dropdown::*,
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        popup::*,
110        portal::*,
111        progressbar::*,
112        radio_item::*,
113        resizable_container::*,
114        scrollviews::*,
115        selectable_text::*,
116        sidebar::*,
117        slider::*,
118        switch::*,
119        table::*,
120        theming::{
121            component_themes::*,
122            extensions::*,
123            hooks::*,
124            themes::*,
125        },
126        tile::*,
127        tooltip::*,
128    };
129}
130
131pub mod text_edit {
132    pub use freya_edit::*;
133}
134pub mod animation {
135    pub use freya_animation::prelude::*;
136}
137#[cfg(feature = "router")]
138pub mod router {
139    pub use freya_router::*;
140}
141#[cfg(feature = "i18n")]
142pub mod i18n {
143    pub use freya_i18n::*;
144}
145#[cfg(feature = "engine")]
146pub mod engine {
147    pub use freya_engine::*;
148}
149
150pub mod winit {
151    pub use freya_winit::winit::*;
152}
153
154pub mod helpers {
155    pub use freya_core::helpers::*;
156}
157
158#[cfg(feature = "tray")]
159pub mod tray {
160    pub use freya_winit::tray::*;
161}
162
163#[cfg(feature = "sdk")]
164pub mod sdk {
165    pub use freya_sdk::*;
166}
167
168#[cfg(doc)]
169pub mod _docs;