feat(terminal): add Detach into a separate window like Desktop #89
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/VAPP-80-terminal-detach-popout"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add a Detach control to the Terminal toolbar that moves the live terminal into a separate window, mirroring the Desktop tab: Document Picture-in-Picture on Chromium and a same-origin window.open popout on browsers without it (Firefox), selected via the reused desktop::pip_supported(). The detached window shares this page's JS/wasm context, so moving the wasm-owned xterm host node carries its WebSocket and the PTY with it and the session keeps running with no reconnect or lost scrollback.
To make the move safe against Dioxus (VAPP-70), the xterm host is now wasm-owned: build() creates a host div via create_element and inserts it into the Dioxus mount div, then opens xterm into the host, so reparenting it out of the renderer's document is invisible to Dioxus. move_host_into_window() copies the opener's stylesheets (xterm.css) into the detached document, re-fits the terminal to the new window size (FitAddon), focuses it, and installs the pagehide re-dock listener; the window.open path also installs the install_closed_poll backup so a closed popout re-docks even without pagehide. Re-dock re-fits back and reverts the toolbar; teardown closes any open detached window so no window, interval, or listener leaks.
A terminal_detach_guard test module enforces the load-bearing invariants (wasm-owned host, reparent machinery, window.open popout, stylesheet copy, closed poll, Detach/Re-dock toggle) so they cannot silently regress.
#VAPP-80