ReviewOS

also looking at this

craft-native/craft

feat: add Linux and Windows named-window routing

#325
Merged glennmichael123 wants to merge codex/multi-window-linux-windows into main
29 files +2250 -200
docs/features/window-management.mdmodified+14-8
Changes to docs/features/window-management.md
@@ -29,8 +29,11 @@ await show(html, {
2929### Runtime Window Creation
3030
3131The `craft-native` SDK returns a typed `Window` handle. Runtime-created
32windows are currently implemented by the macOS host and must provide either
33`html` or `url` content.
32windows are available on macOS, Linux, and Windows and must provide either
33`html` or `url` content. The common create, close, title, geometry, and event
34routes are cross-platform; some advanced window controls remain macOS-only.
35On Linux, the window manager may ignore position requests, especially before
36the window is shown.
3437
3538```typescript
3639import { createWindow } from 'craft-native'
@@ -477,12 +480,15 @@ that created it sees the same transitions through the `inspector` handle.
477480Other open windows do not receive them. Call the unsubscribe function returned
478481by `on`, such as `stopWatching()` above, when the listener is no longer needed.
479482
480Closing a window keeps its native page alive so the macOS reopen lifecycle can
481restore its DOM and JavaScript state. Call `destroy()` on a runtime-created
482handle to permanently release its native window, webview, recovery state and
483event subscriptions; opening the same ID afterwards creates a fresh native
484page behind the same stable SDK handle. The unnamed primary window cannot be
485force-destroyed through this API.
483On macOS, closing a window keeps its native page alive so reopening can
484restore its DOM and JavaScript state. On Linux and Windows, closing releases
485the native window and webview; reopening the same ID creates a fresh page
486behind the same stable SDK handle. `destroy()` releases a named window's native
487resources and detaches its SDK DOM listeners. A later `createWindow()` with the
488same ID reuses the typed handle and reattaches those listeners. The unnamed
489primary window cannot be force-destroyed through this API. CI exercises Linux
490create/close/reopen under Xvfb and the equivalent Windows WebView2 path,
491including concurrent child creation and stale-handle cleanup.
486492Modal/parent semantics are not part of the runtime-created-window contract yet.
487493See [Multi-window ownership](../architecture/multi-window-ownership.md) for the
488494implemented routing guarantees, application-level event sinks and remaining