收口原生外观查询边界

将 Expo 系统配色读取收口到 appearance 模块

将 Tauri 窗口主题读取收口到 appearance 模块

同步原生壳结构门禁和架构文档清单
This commit is contained in:
2026-06-19 21:51:28 +08:00
parent b92b9bbc29
commit f04daee4a4
11 changed files with 118 additions and 31 deletions
@@ -46,6 +46,14 @@ const app = fs.readFileSync(appPath, 'utf8');
const mainPath = new URL('../src-tauri/src/main.rs', import.meta.url);
const main = fs.readFileSync(mainPath, 'utf8');
const rustSourceDir = new URL('../src-tauri/src/', import.meta.url);
const desktopHostBridgeAppearancePath = new URL(
'../src-tauri/src/host_bridge/appearance.rs',
import.meta.url,
);
const desktopHostBridgeAppearanceSource = fs.readFileSync(
desktopHostBridgeAppearancePath,
'utf8',
);
const desktopHostBridgeBadgePath = new URL(
'../src-tauri/src/host_bridge/badge.rs',
import.meta.url,
@@ -201,6 +209,7 @@ const expectedDesktopRustRootEntries = [
'file:main.rs',
];
const expectedDesktopHostBridgeRustFiles = [
'appearance.rs',
'badge.rs',
'capabilities.rs',
'clipboard.rs',
@@ -1812,6 +1821,7 @@ const expectedRustRootEntries = [
'file:main.rs',
];
const expectedRustHostBridgeFiles = [
'appearance.rs',
'badge.rs',
'capabilities.rs',
'clipboard.rs',
@@ -2058,6 +2068,25 @@ assertSameList(
if (nativeAppHostBridgeSource.includes("'host_bridge_request'")) {
throw new Error('H5 native app HostBridge must use HOST_BRIDGE_TAURI_COMMAND');
}
if (
!desktopHostBridgeDispatchSource.includes(
'desktop_appearance_color_scheme(&app, &request)',
) ||
desktopHostBridgeDispatchSource.includes('window.theme()') ||
desktopHostBridgeDispatchSource.includes('color_scheme_from_theme')
) {
throw new Error('desktop shell appearance HostBridge method must delegate to appearance module');
}
for (const snippet of [
'desktop_appearance_color_scheme',
'color_scheme_from_theme(theme)',
'window.theme()',
'"colorScheme"',
]) {
if (!desktopHostBridgeAppearanceSource.includes(snippet)) {
throw new Error(`desktop shell appearance module is missing ${snippet}`);
}
}
if (
!desktopHostBridgeDispatchSource.includes(
'set_desktop_app_badge_count(&app, &request)',