Skip to main content

reinhardt_admin/
lib.rs

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