host: site themes are the host's (AppConfig::with_themes, commands::THEME)

theme_commands serves theme_get / theme_set / theme_preview / theme_scopes_get / theme_scopes_set
(shell-only, each checks its caller first; testkit::assert_theme_guards) over the theme state the
host now keeps: the owner's theme, account and pane themes, the Theme Builder preview. The app
only names its built-in themes and the two files (ThemeConfig). apply() themes every site tab
(script, cached Google font bytes, native background); page_scripts()/tab_background() serve a new
document; set_theme/set_scopes/set_preview are the app's own writers (backup import, dev mode).
A font install or removal re-themes the tabs in the host itself.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
CRTkafa 2026-10-01 14:10:43 +07:00
parent 260646bbc0
commit 82382293a2
6 changed files with 276 additions and 7 deletions

View file

@ -259,6 +259,14 @@ pub fn assert_dev_guards() {
}
}
/// The theme commands' wrappers check their caller first. Runs against the host's source.
pub fn assert_theme_guards() {
let source = include_str!("theme_commands.rs");
for command in commands::THEME {
assert_guarded(source, command, "shell_only(&webview)?");
}
}
/// The backup commands' wrappers check their caller first. Runs against the host's source.
pub fn assert_backup_guards() {
let source = include_str!("backup_commands.rs");
@ -280,6 +288,7 @@ mod tests {
assert_sync_guards();
assert_dev_guards();
assert_backup_guards();
assert_theme_guards();
}
fn caps_with(shell_extra: &str, tab_extra: &str, site_extra: &str) -> Capabilities {