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        drag_drop::*,
94        draggable_canvas::*,
95        dropdown::*,
96        element_expansions::*,
97        floating_tab::*,
98        gallery,
99        get_theme,
100        icons::{
101            arrow::*,
102            tick::*,
103        },
104        image_viewer::*,
105        input::*,
106        loader::*,
107        menu::*,
108        popup::*,
109        portal::*,
110        progressbar::*,
111        radio_item::*,
112        resizable_container::*,
113        scrollviews::*,
114        selectable_text::*,
115        sidebar::*,
116        slider::*,
117        switch::*,
118        table::*,
119        theming::{
120            component_themes::*,
121            hooks::*,
122            themes::*,
123        },
124        tile::*,
125        tooltip::*,
126    };
127}
128
129pub mod text_edit {
130    pub use freya_edit::*;
131}
132pub mod animation {
133    pub use freya_animation::prelude::*;
134}
135#[cfg(feature = "router")]
136pub mod router {
137    pub use freya_router::*;
138}
139#[cfg(feature = "i18n")]
140pub mod i18n {
141    pub use freya_i18n::*;
142}
143#[cfg(feature = "engine")]
144pub mod engine {
145    pub use freya_engine::*;
146}
147
148pub mod winit {
149    pub use freya_winit::winit::*;
150}
151
152pub mod helpers {
153    pub use freya_core::helpers::*;
154}
155
156#[cfg(feature = "tray")]
157pub mod tray {
158    pub use freya_winit::tray::*;
159}
160
161#[cfg(feature = "sdk")]
162pub mod sdk {
163    pub use freya_sdk::*;
164}
165
166#[cfg(doc)]
167pub mod _docs;