Get started
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.
On this page
- Check your app
- Rename ProfileBase to PageBase
- Check commands that use one of Jali's ids
- Use Jali's own client-only wrapper
- Drop your own paused context
- What people will notice
- Layout
- Tabs and headers
- Keys
- Styles and storage
- What is new
- Adapters and hand-made stores
- The store takes two arguments
- Names
- Helpers React kept to itself
- Next
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.
npm install jali-layout@0.2.0pnpm add jali-layout@0.2.0yarn add jali-layout@0.2.0bun add jali-layout@0.2.0vp add jali-layout@0.2.0Check your app
Link to this section: Check your appFour things can need a change in an app's own code. Go through them in order; most apps need none.
Rename ProfileBase to PageBase
Link to this section: Rename ProfileBase to PageBaseA curated page's type is now
PageBase. It is the same type, andProfileBasestill works, marked deprecated, until a later release.// Beforeimport type { ProfileBase } from "jali-layout";// Afterimport type { PageBase } from "jali-layout";Check commands that use one of Jali's ids
Link to this section: Check commands that use one of Jali's idsIn 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.
// 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 }Use Jali's own client-only wrapper
Link to this section: Use Jali's own client-only wrapperIf a server renders your page and you wrote a component that mounts
<JaliRoot>in the browser only,<ClientOnly>anduseHydrated()fromjali-layout/reactnow do that. See Server rendering.Drop your own paused context
Link to this section: Drop your own paused contextIf you passed a pane's
pauseddown through a context of your own so that shared hooks could read it, callusePaused()instead. It returnsfalseoutside a pane, so it never throws. See Pause hidden panes.
What people will notice
Link to this section: What people will noticeThese 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.
| 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) |
| 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) |
| 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
Link to this section: 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) |
| 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) |
| 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 |
| 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
Link to this section: 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
Link to this section: What is new- Server rendering:
useHydrated()and<ClientOnly>, in Installation. - Pausing from any hook:
usePaused(), in Pause hidden panes. - Short titles:
useTitle(title, { short })and the--jali-tab-mintoken, in Tab widths and short titles. - Activity marks of your own:
<JaliRoot parts={{ activity }}>, with theJaliPartsandActivityMarkPropstypes, anddata-activityon every place a mark goes, in Activity marks. - Room for what was opened:
createJali({ noRoom })andopenBeside(…, { noRoom, focus }).focus: falseleaves focus where it is. - Reading what is on screen:
jali.model().isShown(id)anduseIsShown(id), anduseFollowers(id)for the panes following a list. - Menus of your own:
Menu, withMenuPropsandMenuAt, 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.plainNamenames 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).
Adapters and hand-made stores
Link to this section: Adapters and hand-made storesThis 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
Link to this section: The store takes two argumentscreateJaliStore takes what its env holds and what only the store reads as two objects. JaliConfig is gone.
// Beforeconst store = createJaliStore({ kinds, name: "Shop", features: [palette()], id: "shop", storage: memoryStorage(), initial: { layout, area: { width: 0, height: 0 } },});// Afterconst 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 |
| 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
Link to this section: Helpers React kept to itselfWhat 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.