host: AlertsConfig and ThemeConfig live in ungated modules, so the host compiles and tests without the tauri feature

This commit is contained in:
CRTkafa 2026-10-01 16:05:27 +07:00
parent 13ac2827fe
commit 75d507ba8c
4 changed files with 25 additions and 19 deletions

View file

@ -7,6 +7,16 @@ use serde::{Deserialize, Serialize};
use std::collections::{HashMap, HashSet, VecDeque};
use std::time::{Duration, Instant};
/// What an app declares about its alerts for the host's settings commands
/// ([`crate::alerts_commands`]): where they are saved and how the page runtime takes the keywords
/// (`window.<global>.<member>.set(keywords)`, else parked in `window.<queue>`).
#[derive(Clone, Copy, Debug)]
pub struct AlertsConfig {
pub file: &'static str,
pub member: &'static str,
pub queue: &'static str,
}
pub const MAX_KEYWORDS: usize = 32;
pub const MIN_KEYWORD_CHARS: usize = 2;
pub const MAX_KEYWORD_CHARS: usize = 64;

View file

@ -11,14 +11,7 @@ use crate::tabs::deliver_script;
use std::sync::{Mutex, MutexGuard};
use tauri::{AppHandle, Manager, Webview};
/// What an app declares about its alerts: where they are saved and how the page runtime takes the
/// keywords (`window.<global>.<member>.set(keywords)`, else parked in `window.<queue>`).
#[derive(Clone, Copy, Debug)]
pub struct AlertsConfig {
pub file: &'static str,
pub member: &'static str,
pub queue: &'static str,
}
pub use crate::alerts::AlertsConfig;
struct AlertState(Mutex<AlertSettings>);

View file

@ -16,6 +16,18 @@ use serde::{Deserialize, Serialize};
use serde_json::{Map, Value};
use std::collections::BTreeMap;
/// What an app declares about its themes for the host's theme commands
/// ([`crate::theme_commands`]): the built-in ones and where the owner's choice is saved (app data
/// file names).
#[derive(Clone, Copy, Debug)]
pub struct ThemeConfig {
pub site: &'static ThemeSite,
/// The owner's theme choice (absent = the site's own look).
pub file: &'static str,
/// Account and pane themes and the chrome setting (absent = defaults).
pub scopes_file: &'static str,
}
/// A site's built-in themes. The first preset is the site's own look (the default choice).
#[derive(Clone, Copy, Debug)]
pub struct ThemeSite {

View file

@ -10,20 +10,11 @@
use crate::app::{config, tab_profile};
use crate::host::{data_file, read_json, shell_only, write_json};
use crate::theme::{ThemeChoice, ThemeScopes, ThemeSite};
use crate::theme::{ThemeChoice, ThemeScopes};
use std::sync::{Mutex, MutexGuard};
use tauri::{AppHandle, Manager, Webview};
/// What an app declares about its themes: the built-in ones and where the owner's choice is saved
/// (app data file names).
#[derive(Clone, Copy, Debug)]
pub struct ThemeConfig {
pub site: &'static ThemeSite,
/// The owner's theme choice (absent = the site's own look).
pub file: &'static str,
/// Account and pane themes and the chrome setting (absent = defaults).
pub scopes_file: &'static str,
}
pub use crate::theme::ThemeConfig;
#[derive(Default)]
struct Themes {