#![recursion_limit = "256"]
use leptos::prelude::*;
use leptos_meta::*;
use orbital_style::StyleRegistry;
use orbital_theme::OrbitalThemeProvider;
pub mod auth;
pub mod components;
pub mod primitives {
pub use orbital_primitives::*;
}
pub mod context;
pub mod models;
pub mod nav;
pub use orbital_shell::paths;
#[cfg(any(feature = "hydrate", feature = "ssr", feature = "preview"))]
pub mod preview;
pub mod routes;
pub mod services;
pub mod shell;
pub use context::{
provide_auth_context, provide_auth_dialog_controller, use_auth_context,
use_auth_dialog_controller, use_auth_state, use_authenticated_user, AuthContext,
AuthDialogController, AuthDialogIntent,
};
pub use models::auth::{AnonymousUser, AuthSession, AuthenticatedUser};
pub use orbital_theme::ThemeMode;
#[cfg(any(feature = "hydrate", feature = "ssr", feature = "preview"))]
pub use preview::{collect_preview_registrations, PreviewRegistration};
pub use services::auth_service::init_auth_resource;
pub use shell::OrbitalFirstPaintHeadAssets;
pub use shell::{hide_boot_loader, OrbitalBootLoaderHeadAssets, OrbitalBootOverlay};
pub use orbital_shell::tokens;
pub fn orbital_shell<F, IV>(options: LeptosOptions, app_fn: F) -> impl IntoView
where
F: Fn() -> IV + Send + 'static,
IV: IntoView + 'static,
{
orbital_shell_with_meta(options, OrbitalDocumentMeta::default(), app_fn)
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct OrbitalDocumentMeta {
pub title: &'static str,
pub favicon_href: &'static str,
pub apple_touch_icon_href: Option<&'static str>,
}
impl Default for OrbitalDocumentMeta {
fn default() -> Self {
Self {
title: "Orbital",
favicon_href: "/favicon.ico",
apple_touch_icon_href: None,
}
}
}
pub fn orbital_shell_with_meta<F, IV>(
options: LeptosOptions,
meta: OrbitalDocumentMeta,
app_fn: F,
) -> impl IntoView
where
F: Fn() -> IV + Send + 'static,
IV: IntoView + 'static,
{
provide_meta_context();
let title = meta.title;
let favicon_href = meta.favicon_href;
let apple_touch = meta.apple_touch_icon_href;
view! {
<StyleRegistry>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<OrbitalFirstPaintHeadAssets />
<OrbitalBootLoaderHeadAssets />
<meta name="orbital-style"/>
<Title text=title />
<AutoReload options=options.clone() />
<HydrationScripts options/>
<link rel="shortcut icon" type="image/ico" href=favicon_href />
<link rel="icon" type="image/x-icon" href=favicon_href />
{apple_touch.map(|href| {
view! { <link rel="apple-touch-icon" href=href /> }.into_any()
})}
<link rel="stylesheet" href="/main.css" />
<MetaTags/>
</head>
<body style="margin: 0;">
{app_fn()}
<OrbitalBootOverlay />
</body>
</html>
</StyleRegistry>
}
}
#[component]
pub fn OrbitalTemplate(children: Children) -> impl IntoView {
view! {
<OrbitalThemeProvider>
{children()}
</OrbitalThemeProvider>
}
}