fix(view-windows): réconcilier l'état des fenêtres détachées au boot (#50)

Branche le consommateur frontend sur la commande backend
`list_open_view_windows` : le port window expose la liste des fenêtres
de panneaux détachées réellement ouvertes côté OS, l'adaptateur Tauri
(et son double mock) l'implémente, et `ProjectsView` réconcilie le
placement des vues au démarrage à partir de ce snapshot au lieu de
supposer un état. Couvre `viewPlacement` et la réconciliation par des
tests dédiés.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-13 18:14:45 +02:00
parent afbf315e97
commit b4a01e0ae9
7 changed files with 300 additions and 1 deletions

View File

@ -947,6 +947,21 @@ export interface ViewWindowClosed {
panel: string;
}
/**
* A snapshot of one detached view window currently open at the OS level
* (ticket #50). Enumerated at startup so the main window can reconcile its
* `placements` state with windows that were already open before it mounted (a
* panel-only window restored by the OS shows as "detached", not "closed").
*
* `panel` is a `PanelId`-shaped string (kept as `string` at the port seam);
* `visible` distinguishes a truly-open window from a tracked-but-hidden one.
*/
export interface ViewWindowSnapshot {
panel: string;
label: string;
visible: boolean;
}
/**
* Detaching a View into its own OS window (ticket #23, reworked in #47).
*
@ -968,6 +983,14 @@ export interface WindowGateway {
openViewWindow(panel: string): Promise<void>;
/** Closes the detached window for `panel` if one is open. */
closeViewWindow(panel: string): Promise<void>;
/**
* Lists the detached view windows currently open at the OS level (ticket #50).
* Called once at main-window mount to reconcile `placements` with windows that
* survived a restart / were opened before mount, so a panel-only window shows
* as "detached" rather than "closed" in the Panneaux menu. Best-effort: callers
* treat a rejection as "no reconciliation".
*/
listOpenViewWindows(): Promise<ViewWindowSnapshot[]>;
/**
* Subscribes to detached-window close events (OS close or programmatic). The
* handler receives the `{ panel }` that closed. Returns an unsubscribe.