Skip to content

Commit 2950272

Browse files
committed
Document Tao dialog + CompositionLocal migration notes
Add Step 4 sub-sections covering: - JewelDecoratedDialog now ships an extension on NucleusApplicationScope that's required for the Tao backend. - Parent CompositionLocals propagate across the Tao ComposeScene boundary, so the double IntUiTheme wrap workaround is no longer needed. Also add matching Troubleshooting entries for the two errors users were hitting (NoClassDefFoundError on DecoratedDialogKt, No TextStyle provided on Tao).
1 parent 12e1fdf commit 2950272

1 file changed

Lines changed: 49 additions & 0 deletions

File tree

docs/migration-2.0.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,49 @@ The call site (inside `nucleusApplication { … }`) doesn't change — the recei
272272

273273
The plain Compose Desktop `Window` still works inside `nucleusApplication`, but you lose the unified `nucleusWindow` handle and the automatic restore-on-second-instance behavior described below.
274274

275+
### Dialogs follow the same rule
276+
277+
`JewelDecoratedDialog` ships in two flavours, mirroring `JewelDecoratedWindow`:
278+
279+
| Receiver | Backend support |
280+
|---|---|
281+
| `JewelDecoratedDialog(…)` (no receiver) | AWT only (JBR / JNI). Crashes on Tao with `NoClassDefFoundError: dev/nucleusframework/window/DecoratedDialogKt`. |
282+
| `NucleusApplicationScope.JewelDecoratedDialog(…)` | Backend-agnostic. Dispatches to AWT or Tao under the hood. |
283+
284+
Use the scoped variant for anything composed inside `nucleusApplication { … }` — your "About", "Settings", and confirmation dialogs all need it:
285+
286+
```diff
287+
@Composable
288+
-fun MyAboutDialog(onClose: () -> Unit) {
289+
+fun NucleusApplicationScope.MyAboutDialog(onClose: () -> Unit) {
290+
JewelDecoratedDialog(onCloseRequest = onClose, title = "About") { … }
291+
}
292+
```
293+
294+
The same applies to `MaterialDecoratedDialog` / the generic `DecoratedDialog` extension on `NucleusApplicationScope`.
295+
296+
### CompositionLocals propagate across the Tao scene boundary
297+
298+
The Tao backend opens a fresh `ComposeScene` per window/dialog. As of 2.0.0-alpha-202605131305 the full parent `CompositionLocalContext` (theme, `LocalDensity`, `LocalLayoutDirection`, user locals, …) is bridged into the new scene automatically — same behavior as Compose's own `Dialog`/`Popup`.
299+
300+
This means you do **not** need to wrap content twice anymore:
301+
302+
```kotlin
303+
// Before — needed on Tao to avoid "No TextStyle provided" / "No IsDarkTheme provided"
304+
IntUiTheme(theme, styling) {
305+
JewelDecoratedWindow(…) {
306+
IntUiTheme(theme, styling) { …content… } // duplicate
307+
}
308+
}
309+
310+
// After — a single wrap in the parent scope is enough on every backend
311+
IntUiTheme(theme, styling) {
312+
JewelDecoratedWindow(…) { …content… }
313+
}
314+
```
315+
316+
If you previously threaded `theme` / `styling` parameters through every custom window or dialog (`JewelOnboardingWindow`, `JewelAboutWindow`, …) to re-apply `IntUiTheme` inside the scene, you can drop the threading: read the theme from the outer scope once.
317+
275318
---
276319

277320
## Step 5 — Single Instance Is Automatic
@@ -420,6 +463,12 @@ Pass `enableSingleInstance = false` to `nucleusApplication`. The lock is skipped
420463
**`Unresolved reference 'JewelDecoratedWindow'` even though the import is correct.**
421464
The composable became an extension on `NucleusApplicationScope` in 2.0. Wrap-style helper composables must propagate the receiver — see [Step 4](#step-4--replace-window---with-decoratedwindow--).
422465

466+
**`NoClassDefFoundError: dev/nucleusframework/window/DecoratedDialogKt` on the Tao backend.**
467+
You're calling the AWT-only `JewelDecoratedDialog` (no receiver) under `NucleusBackend.Tao`. Switch the host composable to an extension on `NucleusApplicationScope` so the call resolves to `NucleusApplicationScope.JewelDecoratedDialog`, which dispatches to the right backend — see [Step 4 → Dialogs](#dialogs-follow-the-same-rule).
468+
469+
**`IllegalStateException: No TextStyle provided` / `No IsDarkTheme provided` on Tao but not on AWT.**
470+
Older Tao builds (pre-`v2.0.0-alpha-202605131225`) did not bridge `CompositionLocals` across the per-window `ComposeScene`. Bump to `2.0.0-alpha-202605131305` or newer and remove any duplicate `IntUiTheme { … }` you added inside the window/dialog content lambda — a single wrap in the outer scope is enough.
471+
423472
**`Could not find org.jetbrains.jewel:jewel-foundation:0.37.…`**
424473
The IntelliJ snapshots repo is missing. Add `maven("https://www.jetbrains.com/intellij-repository/snapshots")` to `dependencyResolutionManagement.repositories` — see [Prerequisites](#prerequisites).
425474

0 commit comments

Comments
 (0)