feat(window): support des fenêtres plugin-hébergées (backend)

Étend le port/usecases window et layout.customPluginLayout pour ouvrir et
piloter des fenêtres OS hébergeant un layout plugin, en réutilisant
contributes.layouts plutôt qu'un système de fenêtres parallèle. Câble la
commande Tauri et l'état app-tauri correspondants.

Cargo test -p domain --test window : 5/5
Cargo test -p application --test window_usecases : 7/7
Cargo test -p infrastructure --test window_state_store : 1/1
Cargo test -p app-tauri view_window_tests : 8/8

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-08-04 00:39:42 +02:00
parent 3ea1d58b38
commit 551eb09ad2
14 changed files with 884 additions and 95 deletions

View File

@ -5,11 +5,13 @@
//! OS-window focus state, then dereferences to the shared core so existing
//! commands keep their field/method access unchanged.
use std::collections::HashMap;
use std::ops::Deref;
use std::path::PathBuf;
use std::sync::{Arc, Mutex};
use backend::BackendCore;
use domain::PersistedPluginLayoutWindow;
use infrastructure::{TemplateToolProvider, TicketToolProvider};
use serde::{Deserialize, Serialize};
@ -44,6 +46,8 @@ pub struct AppState {
pub embedded_server: Arc<EmbeddedServerController>,
/// Project currently focused by the main window; panel-only windows follow it.
focused_project: Mutex<Option<FocusedProjectDto>>,
/// Detached plugin-layout surfaces keyed by Tauri window label.
plugin_window_surfaces: Mutex<HashMap<String, PersistedPluginLayoutWindow>>,
}
impl AppState {
@ -96,6 +100,7 @@ impl AppState {
resource_dir,
)),
focused_project: Mutex::new(None),
plugin_window_surfaces: Mutex::new(HashMap::new()),
}
}
@ -122,6 +127,32 @@ impl AppState {
.expect("focused project mutex poisoned")
.clone()
}
/// Records the plugin layout surface hosted by a detached window.
pub fn set_plugin_window_surface(&self, label: String, surface: PersistedPluginLayoutWindow) {
self.plugin_window_surfaces
.lock()
.expect("plugin window surface mutex poisoned")
.insert(label, surface);
}
/// Reads the plugin layout surface hosted by a detached window.
#[must_use]
pub fn get_plugin_window_surface(&self, label: &str) -> Option<PersistedPluginLayoutWindow> {
self.plugin_window_surfaces
.lock()
.expect("plugin window surface mutex poisoned")
.get(label)
.cloned()
}
/// Removes a detached plugin layout surface.
pub fn clear_plugin_window_surface(&self, label: &str) {
self.plugin_window_surfaces
.lock()
.expect("plugin window surface mutex poisoned")
.remove(label);
}
}
impl Deref for AppState {