💄 Prepare themes and set default for Drust

This commit is contained in:
Manuel Cillero 2024-11-16 19:50:17 +01:00
parent cafa1d53a2
commit 046d5605e9
132 changed files with 16514 additions and 170 deletions

View file

@ -3,46 +3,44 @@ name = "pagetop"
version = "0.0.56"
edition = "2021"
description = "An opinionated web framework to build modular Server-Side Rendering web solutions."
description = """\
An opinionated web framework to build modular Server-Side Rendering web solutions.\
"""
categories = ["web-programming", "gui", "development-tools", "asynchronous"]
keywords = ["pagetop", "web", "framework", "frontend", "ssr"]
readme = "../../README.md"
homepage = { workspace = true }
repository = { workspace = true }
license = { workspace = true }
authors = { workspace = true }
license = { workspace = true }
[lib]
name = "pagetop"
[dependencies]
colored = "2.1.0"
concat-string = "1.0.1"
figlet-rs = "0.1.5"
paste = "1.0.15"
terminal_size = "0.4.0"
toml = "0.8.19"
colored = "2.1.0"
concat-string = "1.0.1"
figlet-rs = "0.1.5"
fluent-bundle = "0.15"
fluent-templates = "0.11"
nom = "7.1"
paste = "1.0.15"
substring = "1.4"
terminal_size = "0.4.0"
toml = "0.8.19"
tracing = "0.1"
tracing-appender = "0.2"
tracing-subscriber = { version = "0.3", features = ["json", "env-filter"] }
tracing-actix-web = "0.7"
unic-langid = { version = "0.9", features = ["macros"] }
serde.workspace = true
static-files.workspace = true
actix-web = "4"
actix-web-files = { package = "actix-files", version = "0.6" }
actix-web-static-files = "4.0"
actix-session = { version = "0.10", features = ["cookie-session"] }
pagetop-macros.workspace = true
serde = { workspace = true }
static-files = { workspace = true }
actix-web.workspace = true
actix-web-files.workspace = true
actix-web-static-files.workspace = true
actix-session.workspace = true
fluent-templates.workspace = true
nom.workspace = true
tracing.workspace = true
tracing-appender.workspace = true
tracing-subscriber.workspace = true
tracing-actix-web.workspace = true
substring.workspace = true
unic-langid.workspace = true
pagetop-macros = { workspace = true }

View file

@ -5,8 +5,6 @@ use crate::{service, trace};
use std::sync::{LazyLock, RwLock};
//static_files!(base);
// PACKAGES ****************************************************************************************
static ENABLED_PACKAGES: LazyLock<RwLock<Vec<PackageRef>>> =
@ -21,14 +19,6 @@ pub fn register_packages(root_package: Option<PackageRef>) {
// Initialize a list for packages to be enabled.
let mut enabled_list: Vec<PackageRef> = Vec::new();
// Add default welcome page package to the enabled list.
// add_to_enabled(&mut enabled_list, &crate::base::package::Welcome);
// Add default theme packages to the enabled list.
// add_to_enabled(&mut enabled_list, &crate::base::theme::Basic);
// add_to_enabled(&mut enabled_list, &crate::base::theme::Chassis);
// add_to_enabled(&mut enabled_list, &crate::base::theme::Inception);
// If a root package is provided, add it to the enabled list.
if let Some(package) = root_package {
add_to_enabled(&mut enabled_list, package);
@ -130,13 +120,6 @@ pub fn init_packages() {
// CONFIGURE SERVICES ******************************************************************************
pub fn configure_services(scfg: &mut service::web::ServiceConfig) {
/*
static_files_service!(
scfg,
base => "/base",
[&global::SETTINGS.dev.pagetop_project_dir, "static/base"]
);
*/
for m in ENABLED_PACKAGES.read().unwrap().iter() {
m.configure_service(scfg);
}

View file

@ -1,5 +1,4 @@
use crate::core::theme::ThemeRef;
//use crate::global;
use std::sync::{LazyLock, RwLock};
@ -7,16 +6,27 @@ use std::sync::{LazyLock, RwLock};
pub static THEMES: LazyLock<RwLock<Vec<ThemeRef>>> = LazyLock::new(|| RwLock::new(Vec::new()));
// DEFAULT THEME ***********************************************************************************
/*
/* DEFAULT THEME ***********************************************************************************
pub struct NoTheme;
impl PackageTrait for NoTheme {
fn theme(&self) -> Option<ThemeRef> {
Some(&NoTheme)
}
}
impl ThemeTrait for NoTheme {
}
pub static THEME_DEFAULT: LazyLock<ThemeRef> =
LazyLock::new(|| match theme_by_short_name(&global::SETTINGS.app.theme) {
Some(theme) => theme,
None => &crate::base::theme::Inception,
None => &NoTheme,
});
*/
// THEME BY NAME ***********************************************************************************
/*
pub fn theme_by_short_name(short_name: &str) -> Option<ThemeRef> {
let short_name = short_name.to_lowercase();
match THEMES

View file

@ -32,6 +32,7 @@ pub use crate::core::{AnyBase, AnyTo};
pub use crate::core::action::*;
pub use crate::core::package::*;
pub use crate::core::theme::*;
pub use crate::response::{json::*, redirect::*, ResponseError};