# Upgrading to 0.2.0

What changes for an app moving from Jali 0.1.0 to 0.2.0, what is new, and the few calls an adapter or a hand-made store must change.

0.2.0 is the first release after 0.1.0. For most apps, upgrading is changing the version: nothing an app writes with `createJali`, `definePane` and `<JaliRoot>` was removed, and the one public name that changed keeps its old name for now.

```sh
npm install jali-layout@0.2.0
```

## Check your app

Four things can need a change in an app's own code. Go through them in order; most apps need none.

### Rename ProfileBase to PageBase

A curated page's type is now `PageBase`. It is the same type, and `ProfileBase` still works, marked deprecated, until a later release.

```ts nocheck
// Before
import type { ProfileBase } from "jali-layout";
// After
import type { PageBase } from "jali-layout";
```

### Check commands that use one of Jali's ids

In 0.1.0, a command of your app's with one of Jali's ids was dropped, keys and all. Now it replaces Jali's: ⌘K lists yours instead, and the keys bound to that id run it. If you gave a command a Jali id by accident and relied on Jali's still showing, give yours an id of its own.

```ts nocheck
// Now the one "Reset layout" in ⌘K: Jali's is no longer listed.
{ id: "layout.reset", title: "Reset layout", run: forgetAndReset }
// To keep Jali's beside it, give yours an id of your own.
{ id: "orders.reset-layout", title: "Reset layout", run: forgetAndReset }
```

See [Replace one of Jali's commands](/guides/commands-and-keys#replace-one-of-jalis-commands).

### Use Jali's own client-only wrapper

If a server renders your page and you wrote a component that mounts `<JaliRoot>` in the browser only, `<ClientOnly>` and `useHydrated()` from `jali-layout/react` now do that. See [Server rendering](/get-started/installation#server-rendering-next-astro-remix).

### Drop your own paused context

If you passed a pane's `paused` down through a context of your own so that shared hooks could read it, call `usePaused()` instead. It returns `false` outside a pane, so it never throws. See [Pause hidden panes](/guides/pane-kinds#pause-hidden-panes).

## What people will notice

These changes need no code. Each makes Jali do what a person expects, so check only that your tests don't rely on the old behaviour.

### Layout

| In 0.1.0 | In 0.2.0 |
|---|---|
| A preset with more panes than the pane cap folded the extra ones into tabs | It shows all its panes. What the person adds meets the cap again ([The pane cap](/learn/fitting#the-pane-cap)) |
| A link opened with no room folded straight into a tab, so the person saw only "1 folded" | The panes in least use fold to make room, and the new pane shows. `createJali({ noRoom: "fold" })` keeps the old way ([Opening when there is no room](/learn/fitting#opening-when-there-is-no-room)) |
| A preset always started with focus in its first pane | A preset can name the pane people start in, `focus`; without it, the first pane, as before |
| `tuck(id)` on a pane in a row that scrolls returned `{ ok: true }` and left the pane where it was | It is refused as `"blocked"`: a row that scrolls is no tuck's home |

### Tabs and headers

| In 0.1.0 | In 0.2.0 |
|---|---|
| A tab kept its whole title, and a short strip scrolled the other tabs away behind "+N" | The tabs share the strip, the longest titles shortened first, down to 6rem each. Only then does it scroll. A pane can give a short title for a squeezed tab ([Tab widths and short titles](/guides/layouts#tab-widths-and-short-titles)) |
| On a touch screen, every pane showed its header buttons | Only the focused pane shows them. A tap on another pane focuses it, and its buttons come |
| A pane in error showed a red dot | Its title and icon take the error colour, `--jali-failed`, with no dot ([Activity marks](/guides/theming#activity-marks)) |
| A plain link's follow toggle said **Following** | It is its icon alone, named "Opened from …" |
| A follower that couldn't show its list's selection still said **Following** | It says **Holding**, with a dashed outline, until the list selects something it can show |

### Keys

| In 0.1.0 | In 0.2.0 |
|---|---|
| ⌘K listed what matched in its own order | It ranks matches: titles that start with the text, then a word in the title that does, then the title containing it, then the id or group |
| After the ⌘K prefix, Jali waited for the second key however long it took | The wait ends when the palette closes, on a click, when the window loses focus, or after 2 seconds for a prefix that opened no palette |
| Keys typed while an input method composed text could run pane commands | They are the input method's |
| Resize mode stayed on after its pane closed or was tucked, taking the arrows page-wide | It ends once focus leaves its pane, or the maximised pane changes |
| Esc with one pane on the full screen did nothing | It leaves full screen. Full screen also ends with its pane |
| ⌘K opened the palette behind "Discard unsaved changes?" | It does nothing while that question is open |

### Styles and storage

| In 0.1.0 | In 0.2.0 |
|---|---|
| Jali set `color-scheme: dark` on the page's root when the system was dark | Only on Jali's own elements, so a light-only page keeps its own controls light |
| Stacking was fixed: dialogs 100, menus 60, full screen 50 | `--jali-z-dialog`, `--jali-z-menu` and `--jali-z-fullscreen` set it, for an app whose own bars sit higher |
| The shelf's "+N" list opened inside the shelf, where a status bar that clips could hide it | It opens in the instance's layer. `.jali-shelf-menu` still selects it |
| A toast shown while a pane was on the full screen sat behind it | Your `overlays` go into the full-screen pane, with the root's theme and tokens |
| Discarding a draft left one saved by an earlier page load in storage, so a reload brought it back | Discarding removes it |

## What is new

- **Server rendering:** `useHydrated()` and `<ClientOnly>`, in [Installation](/get-started/installation#server-rendering-next-astro-remix).
- **Pausing from any hook:** `usePaused()`, in [Pause hidden panes](/guides/pane-kinds#pause-hidden-panes).
- **Short titles:** `useTitle(title, { short })` and the `--jali-tab-min` token, in [Tab widths and short titles](/guides/layouts#tab-widths-and-short-titles).
- **Activity marks of your own:** `<JaliRoot parts={{ activity }}>`, with the `JaliParts` and `ActivityMarkProps` types, and `data-activity` on every place a mark goes, in [Activity marks](/guides/theming#activity-marks).
- **Room for what was opened:** `createJali({ noRoom })` and `openBeside(…, { noRoom, focus })`. `focus: false` leaves focus where it is.
- **Reading what is on screen:** `jali.model().isShown(id)` and `useIsShown(id)`, and `useFollowers(id)` for the panes following a list.
- **Menus of your own:** `Menu`, with `MenuProps` and `MenuAt`, which works as Jali's menus do and opens in the instance's layer.
- **Smaller things:** `copyLink(jali)` resolves to whether the link reached the clipboard; `messages.pane.plainName` names a plain link's toggle; and the parts `.jali-pane[data-framed]`, `[data-jali][data-dragging]` and the menu item's name, keys, check and separator ([Parts](/reference/parts)).

## Adapters and hand-made stores

This part is for code that imports `jali-layout/adapter`: an adapter for another framework, or a test that makes a store by hand. That entry may change in any minor version. An app that calls `createJali` changes nothing here.

### The store takes two arguments

`createJaliStore` takes what its env holds and what only the store reads as two objects. `JaliConfig` is gone.

```ts nocheck
// Before
const store = createJaliStore({
  kinds,
  name: "Shop",
  features: [palette()],
  id: "shop",
  storage: memoryStorage(),
  initial: { layout, area: { width: 0, height: 0 } },
});

// After
const store = createJaliStore(
  { kinds, name: "Shop", features: [palette()] },
  {
    id: "shop",
    storage: memoryStorage(),
    initial: { layout, area: { width: 0, height: 0 } },
  },
);
```

| In 0.1.0 | In 0.2.0 |
|---|---|
| `JaliConfig` | `EnvOptions` (kinds, page, presets, the chrome's options, `messages`, `gap`) and `StoreOptions` (`preset`, `url`, `sync`, `storage`, `id`, `initial`, `settings`, `keyboard`, `focusPane`, `unstable`, `beforeClose`) |
| `initial: Partial<UiState>` | `initial: { layout?, area? }`. A reading direction is `EnvOptions.dir` |
| `url`: the app's writer or the `urlSync()` feature's, told apart by its methods | `url`, a writer of the app's own, or `sync`, the feature's `UrlSync` |
| `Feature.address` gave a `UrlWriter` | A `UrlSync` |
| `Env.messages` was optional | Always there: the store resolves the words |

### Names

| In 0.1.0 | In 0.2.0 |
|---|---|
| `Presentation`: `"tiled" \| "single"`, and `CHROME.single` | `"tiled" \| "onePane"`, and `CHROME.onePane`, so one pane at a time on a phone is no longer named like a curated page's Single view |
| `ALONE_CHROME`, told apart by `chrome === ALONE_CHROME` | `CHROME.alone`, and `chrome.alone` |
| A curated page's Single view was the adapter's own flag | `chromeOf(placement, pageSingle)` gives the frames' chrome: `CHROME.tiled`, `onePane` or `alone`, or `pageTiled` and `pageOnePane` in Single view. `Chrome` says `alone`, `header` (`"shown"` or `"hidden"`), `menu`, `follow` and `rename` |
| A hand-made `Frame` left pausing to the adapter | `Frame.paused`: hidden, covered by a maximised pane, or scrolled out of view |
| `Env.profile`, the page, and `Env.page`, its engine | `Env.page`, the page, and `Env.pageEngine`, its engine. `EnvOptions.profile` is `EnvOptions.page` |
| `roleOf(profile, id)` and `investigation(panes)` | `viewOf(page, id)` and `openedPanes(panes)` |
| `OpenPage.investigation`, and `readSearch(...).page.investigation` | `OpenPage.opened`, and `readSearch(...).page.opened` |
| `TuckRefusal`: `"missing"`, `"tab"`, `"hidden"` or `"last"` | Also `"strip"`: the pane is in a row that scrolls |
| `DomPort.dragging(what, divider)` | A third argument, the instance's root, which a port may ignore |

Links, stored layouts and the state's own fields (`page.profile`, `page.tab`, a pane's `role`, `?open=`) are as they were, so a saved layout or a shared link from 0.1.0 opens the same.

### Helpers React kept to itself

What React's adapter worked out without React is now in `jali-layout/adapter`, so another framework's adapter needn't write it again: `tabGroups`, `hostFor` and `peekHostFor` (with `PaneHost`), `watchMeasure` and `watchKeyboard`, `followStatus`, `pageTabState`, `pressedFeature`, `createPopOutWindow`, and the fold and stack announcements' words, `foldWords` and `stackWords`.

## Next

- [Installation](/get-started/installation): The package, the styles and server rendering.

- [Troubleshooting](/guides/troubleshooting): Fixes for the problems people meet first.
