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