Skip to main content

reinhardt_admin/
lib.rs

1//! # reinhardt-admin
2//!
3//! Admin functionality for Reinhardt framework.
4//!
5//! This crate serves as a workspace for admin-related functionality:
6//! - **types**: Shared type definitions for admin API
7//! - **api**: Backend JSON API for admin panel
8//! - **ui**: WASM-based admin panel UI (Dominator + futures-signals)
9//!
10//! ## Features
11//!
12//! - `default`: No features enabled by default
13//! - `all`: All admin functionality
14//!
15//! ## Examples
16//!
17//! ## Available Modules
18//!
19//! - [`adapters`] - Admin adapter implementations
20//! - [`core`] - Admin core functionality
21//! - [`pages`] - Admin page rendering
22//! - [`server`] - Admin HTTP server
23//! - [`types`] - Shared type definitions
24
25#![warn(missing_docs)]
26#![cfg_attr(docsrs, feature(doc_cfg))]
27
28pub mod adapters;
29#[cfg(server)]
30pub mod core;
31pub mod pages;
32pub mod server;
33#[cfg(server)]
34pub mod settings;
35pub mod types;
36
37// Register admin static files for auto-discovery by collectstatic
38#[cfg(server)]
39const _: () = {
40	/// Path to admin static assets directory (embedded CSS/JS placeholder)
41	const ADMIN_STATIC_DIR: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/assets");
42
43	// Register at compile time using inventory
44	reinhardt_apps::register_app_static_files!("admin", ADMIN_STATIC_DIR, "/static/admin/");
45};
46
47// Register WASM build output for auto-discovery by collectstatic.
48// The dist-admin/ directory may not exist if the WASM SPA has not been built;
49// collectstatic gracefully skips non-existent directories.
50#[cfg(server)]
51const _: () = {
52	/// Path to admin WASM build output directory
53	const ADMIN_WASM_DIR: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/dist-admin");
54
55	reinhardt_apps::register_app_static_files!("admin-wasm", ADMIN_WASM_DIR, "/static/admin/");
56};
57
58// Register vendor assets (CSS, JS, fonts) for download via the generic
59// `reinhardt-utils::staticfiles::vendor` subsystem. Each entry is collected via
60// the `inventory` crate and downloaded lazily on first admin request.
61#[cfg(server)]
62const _: () = {
63	use reinhardt_apps::AppVendorAsset;
64
65	// Open Props v1.7.23 — CSS custom property design tokens
66	reinhardt_apps::inventory::submit! {
67		AppVendorAsset {
68			app_label: "admin",
69			url: "https://cdn.jsdelivr.net/npm/open-props@1.7.23/open-props.min.css",
70			target: "vendor/open-props.min.css",
71			sha256: "",
72		}
73	}
74
75	// Animate.css v4.1.1 — CSS animation library
76	reinhardt_apps::inventory::submit! {
77		AppVendorAsset {
78			app_label: "admin",
79			url: "https://cdn.jsdelivr.net/npm/animate.css@4.1.1/animate.min.css",
80			target: "vendor/animate.min.css",
81			sha256: "",
82		}
83	}
84
85	// DM Sans — Latin subset, weight 400 (regular)
86	reinhardt_apps::inventory::submit! {
87		AppVendorAsset {
88			app_label: "admin",
89			url: "https://cdn.jsdelivr.net/npm/@fontsource/dm-sans@5.1.1/files/dm-sans-latin-400-normal.woff2",
90			target: "vendor/fonts/dm-sans-latin-400-normal.woff2",
91			sha256: "",
92		}
93	}
94
95	// DM Sans — Latin subset, weight 400 italic
96	reinhardt_apps::inventory::submit! {
97		AppVendorAsset {
98			app_label: "admin",
99			url: "https://cdn.jsdelivr.net/npm/@fontsource/dm-sans@5.1.1/files/dm-sans-latin-400-italic.woff2",
100			target: "vendor/fonts/dm-sans-latin-400-italic.woff2",
101			sha256: "",
102		}
103	}
104
105	// DM Sans — Latin subset, weight 500 (medium)
106	reinhardt_apps::inventory::submit! {
107		AppVendorAsset {
108			app_label: "admin",
109			url: "https://cdn.jsdelivr.net/npm/@fontsource/dm-sans@5.1.1/files/dm-sans-latin-500-normal.woff2",
110			target: "vendor/fonts/dm-sans-latin-500-normal.woff2",
111			sha256: "",
112		}
113	}
114
115	// DM Sans — Latin subset, weight 600 (semi-bold)
116	reinhardt_apps::inventory::submit! {
117		AppVendorAsset {
118			app_label: "admin",
119			url: "https://cdn.jsdelivr.net/npm/@fontsource/dm-sans@5.1.1/files/dm-sans-latin-600-normal.woff2",
120			target: "vendor/fonts/dm-sans-latin-600-normal.woff2",
121			sha256: "",
122		}
123	}
124
125	// DM Sans — Latin subset, weight 700 (bold)
126	reinhardt_apps::inventory::submit! {
127		AppVendorAsset {
128			app_label: "admin",
129			url: "https://cdn.jsdelivr.net/npm/@fontsource/dm-sans@5.1.1/files/dm-sans-latin-700-normal.woff2",
130			target: "vendor/fonts/dm-sans-latin-700-normal.woff2",
131			sha256: "",
132		}
133	}
134
135	// Inter — Latin subset, weight 600 (semi-bold)
136	reinhardt_apps::inventory::submit! {
137		AppVendorAsset {
138			app_label: "admin",
139			url: "https://cdn.jsdelivr.net/fontsource/fonts/inter@latest/latin-600-normal.woff2",
140			target: "vendor/fonts/inter-latin-600-normal.woff2",
141			sha256: "",
142		}
143	}
144
145	// Inter — Latin subset, weight 700 (bold)
146	reinhardt_apps::inventory::submit! {
147		AppVendorAsset {
148			app_label: "admin",
149			url: "https://cdn.jsdelivr.net/fontsource/fonts/inter@latest/latin-700-normal.woff2",
150			target: "vendor/fonts/inter-latin-700-normal.woff2",
151			sha256: "",
152		}
153	}
154
155	// Inter — Latin subset, weight 800 (extra-bold)
156	reinhardt_apps::inventory::submit! {
157		AppVendorAsset {
158			app_label: "admin",
159			url: "https://cdn.jsdelivr.net/fontsource/fonts/inter@latest/latin-800-normal.woff2",
160			target: "vendor/fonts/inter-latin-800-normal.woff2",
161			sha256: "",
162		}
163	}
164
165	// UnoCSS Runtime v66.6.7 — browser-based utility CSS generation engine.
166	// Generates Tailwind-compatible utility CSS by observing DOM class names
167	// at runtime, eliminating the need for a build-time CLI step.
168	reinhardt_apps::inventory::submit! {
169		AppVendorAsset {
170			app_label: "admin",
171			url: "https://cdn.jsdelivr.net/npm/@unocss/runtime@66.6.7/uno.global.js",
172			target: "vendor/unocss-runtime.js",
173			sha256: "",
174		}
175	}
176};