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