Skip to main content

strata/
lib.rs

1//! Strata: Universal High-Performance Frontend Engine & Framework in Pure Rust.
2//!
3//! # Examples
4//!
5//! ```rust
6//! use strata::prelude::*;
7//!
8//! let counter = Signal::new(10);
9//! counter.set(25);
10//! assert_eq!(counter.get(), 25);
11//! ```
12
13#![allow(
14    clippy::too_many_arguments,
15    clippy::type_complexity,
16    clippy::field_reassign_with_default,
17    clippy::collapsible_match
18)]
19
20pub use strata_a11y;
21pub use strata_a11y as a11y;
22pub use strata_dom;
23pub use strata_dom as dom;
24pub use strata_gpu_path as gpu_path;
25pub use strata_js;
26pub use strata_js as js;
27pub use strata_layout as layout;
28pub use strata_macro::*;
29pub use strata_platform as platform;
30pub use strata_platform::dialog;
31pub use strata_platform::vibrancy;
32pub use strata_platform::{HoverTooltipStyle, WindowConfig};
33pub use strata_primitives as primitives;
34pub use strata_render as render;
35pub use strata_storage as storage;
36pub use strata_style as style;
37pub use strata_vfs as fs;
38pub use strata_web_api as web_api;
39
40#[cfg(feature = "device")]
41pub use strata_device as device;
42#[cfg(feature = "devtools")]
43pub use strata_devtools as devtools;
44#[cfg(feature = "hot-reload")]
45pub use strata_hot_reload as hot_reload;
46#[cfg(feature = "parallel")]
47pub use strata_parallel as parallel;
48
49pub mod low_level;
50pub mod mcp_bridge;
51pub mod runtime;
52pub mod view_transition;
53pub use low_level::{LowLevelRenderer, OffscreenBuffer, RawSurfaceHandle};
54pub use mcp_bridge::{default_dev_socket_path, start_mcp_dev_listener};
55#[cfg(feature = "hot-reload")]
56pub use runtime::{HmrPatchOutcome, HmrRuntimeController};
57pub use runtime::{
58    app, launch, launch_auto, launch_headless, launch_headless_pump, launch_window,
59    launch_with_config, launch_with_events, launch_with_frame, queue_edit_command, AppFrameInfo,
60    AppLifecycleHooks, AppRuntime, DynamicTextBinding, EditCommand, FrameOutcome, FrameProfile,
61    FrameProfileRecord, KeyDispatchResult, MatchMode, NodeQuery, PerfPercentileStats,
62    PerfProfileSummary, PointerDownAction, PointerMoveAction, PointerUpAction, ProfilingAllocator,
63    RebuildReason, ReconcileStats, StrataApp, StrataAppBuilder,
64};
65#[cfg(target_os = "linux")]
66pub use runtime::{
67    launch_gtk, launch_gtk_with_events, launch_gtk_with_frame, launch_wayland,
68    launch_wayland_with_events, launch_x11, launch_x11_with_events,
69};
70#[cfg(target_os = "macos")]
71pub use runtime::{launch_macos, launch_macos_with_events};
72#[cfg(windows)]
73pub use runtime::{launch_win32, launch_win32_with_events};
74#[cfg(target_os = "linux")]
75pub use strata_platform::{
76    gtk_begin_window_drag, gtk_close, gtk_current_modifiers, gtk_get_clipboard_text,
77    gtk_is_closing, gtk_is_maximized, gtk_minimize, gtk_set_clipboard_text, gtk_toggle_maximize,
78};
79pub use strata_dom::{
80    get_scroll_offset, scroll_into_view, scroll_to, scroll_to_bottom, scroll_to_top,
81    ProgrammaticScrollCommand,
82};
83pub use view_transition::{ViewTransitionManager, ViewTransitionSnapshot};
84
85pub mod prelude {
86    pub use strata_dom;
87    pub use strata_dom::{
88        clear_cursor_override, clear_hmr_signals, clear_persistent_signals, create_anchored_portal,
89        create_context, create_dropdown_portal, create_portal, current_cursor,
90        dispatch_click_outside, dispatch_global_keydown, export_hmr_signals, get_scroll_offset,
91        import_hmr_signals, provide_context, reset_component_hooks, scroll_into_view, scroll_to,
92        scroll_to_bottom, scroll_to_top, set_current_cursor, set_system_color_scheme,
93        set_system_contrast, set_system_reduced_motion, set_viewport_dimensions, use_active,
94        use_callback, use_click_outside, use_clipboard, use_color_scheme, use_context,
95        use_contrast, use_cursor, use_effect, use_effect_with_deps, use_focus, use_focus_within,
96        use_hmr_signal, use_hover, use_id, use_keyboard_shortcut, use_media_query, use_memo,
97        use_memo_with_deps, use_persistent_signal, use_press, use_reduced_motion, use_reducer,
98        use_reducer_init, use_ref, use_shortcut, use_signal, use_state, with_component_key,
99        with_root_component_scope, AnchorPlacement, Attribute, ClickOutsideHandle, ClipboardHandle,
100        ColorScheme, Context, ContrastPreference, CursorIcon, Effect, EffectGuard, ErrorBoundary,
101        ErrorBoundaryBuilder, ErrorBoundaryInfo, Event, EventType, FocusHandlers, HmrCodec,
102        HoverHandlers, IntoChildren, IntoEffectCleanup, IntoNodeBlueprint, KeyChord, Memo,
103        NodeBlueprint, Portal, PortalBuilder, PressHandlers, ProgrammaticScrollCommand, ReadSignal,
104        Ref, SetSignal, ShortcutHandle, Signal, Tag, View, WriteSignal,
105    };
106    pub use strata_js;
107    pub use strata_js::{
108        json::{parse_json, stringify_json},
109        promise::{
110            drain_microtasks, pending_microtasks_count, queue_microtask, JsPromise, PromiseState,
111        },
112        web::{
113            advance_timers_by, clear_interval, clear_timeout, local_storage, session_storage,
114            set_interval, set_timeout, tick_timers, Storage, TimerId, URLSearchParams,
115        },
116        JsObject, JsValue,
117    };
118    pub use strata_macro::{component, dynamic, rsx};
119    pub use strata_platform::prelude::*;
120    pub use strata_primitives::prelude::*;
121    pub use strata_render::scene3d::{
122        AmbientLight, BoxGeometry, Camera3D, Canvas3D, DirectionalLight, Geometry3D, Light3D,
123        Material3D, Mesh, Mesh3D, PerspectiveCamera, Scene3D, ShaderMaterial, ShaderSource,
124        SphereGeometry, StandardMaterial, Transform3D,
125    };
126    pub use strata_storage::prelude::*;
127    pub use strata_style::ComputedStyle;
128    pub use strata_vfs::prelude::*;
129    pub use strata_web_api::prelude::*;
130
131    #[cfg(feature = "device")]
132    pub use strata_device::prelude::*;
133    #[cfg(feature = "devtools")]
134    pub use strata_devtools::*;
135    #[cfg(feature = "hot-reload")]
136    pub use strata_hot_reload::prelude::*;
137    #[cfg(feature = "parallel")]
138    pub use strata_parallel::{
139        reset_thread_local_arena, translate_draw_command, with_thread_local_arena,
140        AdaptivePartitioner, ContainmentClassifier, DirtySignalQueue, DisplayListChunk,
141        LayoutConstraints, LayoutPartition, ParallelEngine, PartitionBoundary, PartitionId,
142    };
143
144    pub use crate::runtime::{
145        app, launch, launch_auto, launch_headless, launch_headless_pump, launch_window,
146        launch_with_config, launch_with_events, launch_with_frame, queue_edit_command,
147        AppFrameInfo, AppLifecycleHooks, AppRuntime, DynamicTextBinding, EditCommand, FrameOutcome,
148        KeyDispatchResult, PointerDownAction, PointerMoveAction, PointerUpAction, StrataApp,
149        StrataAppBuilder,
150    };
151    #[cfg(target_os = "linux")]
152    pub use crate::runtime::{
153        launch_gtk, launch_gtk_with_events, launch_gtk_with_frame, launch_wayland,
154        launch_wayland_with_events, launch_x11, launch_x11_with_events,
155    };
156    #[cfg(target_os = "macos")]
157    pub use crate::runtime::{launch_macos, launch_macos_with_events};
158    #[cfg(windows)]
159    pub use crate::runtime::{launch_win32, launch_win32_with_events};
160    #[cfg(target_os = "linux")]
161    pub use strata_platform::{
162        gtk_begin_window_drag, gtk_close, gtk_get_clipboard_text, gtk_is_maximized, gtk_minimize,
163        gtk_set_clipboard_text, gtk_toggle_maximize,
164    };
165    pub use strata_platform::{HoverTooltipStyle, WindowAnchor, WindowConfig};
166}