On this page

The framework-free part of Jali: the instance, the layouts it shows, the address and storage ports, commands and keys. Render it with jali-layout/react. Types have their own page, jali-layout types.

npm install jali-layout

Framework adapters import jali-layout/adapter: everything on this page, and, by name, what an adapter needs from inside the package, such as the DomPort through which the core finds the adapter's elements, the instance's store (storeOf), and the pure layout operations (layout). Apps need only what is on this page.

createJali

Makes one instance, ready to render: its state, the model derived from it, its actions and its keymap. Each instance has its own; nothing is shared between two on one page.

createJali(options: JaliOptions): Jali<RefOf<kinds>, PageOf<page>>
jali.ts
import { createJali, memoryLocation, memoryStorage } from "jali-layout";import { launcherKind, orderKind, ordersKind } from "./kinds";import { palette } from "jali-layout/palette";import { urlSync } from "jali-layout/url";​export const jali = createJali({  panes: [ordersKind, orderKind], // the kinds of pane it can show  layout: ordersKind(), // the layout it opens on (or `presets`)  launcher: launcherKind, // what Split opens: without one there is no Split  name: "Sales desk", // in commands such as "Open Sales desk"  features: [urlSync({ prefix: "a.", sizes: "link" }), palette()], // each a value from its own module  storage: "sales", // localStorage keys "sales:…", or a StoragePort  id: "sales", // DOM ids "sales-pane-…"  keyboard: { scope: "local", keymap: { "pane.close": "Mod+K Mod+X" } }, // only keys pressed inside it  pageTheme: false, // leave data-theme on <html> to the page});​// With no browser (a test, the server): the address and storage in memory, a fixed size, DOM focus left alone.const location = memoryLocation();export const inMemory = createJali({  panes: [orderKind],  layout: orderKind({ id: 1041 }),  features: [urlSync({ location })],  storage: memoryStorage(),  size: { width: 1440, height: 900 },  moveFocus: false,});​location.entries; // every address Jali pushed or replacedlocation.visit("?tab=2"); // navigation from outside: Jali hears it, as it hears Back and Forward

Before it returns, it reads the address (a layout link opens as it is, a curated page link opens the page, a link that can't be read opens the starting layout with an error toast), adds what is on screen to Recent, fits the layout to the room and focuses the first pane. A page-only app (a page with no layout and no presets) starts with its page open on firstItem, and leaving it is refused. It throws Jali: no layout to start from can be shown when it has none of them, or when none of them can be shown (a kind it doesn't have, a param it can't read), with the first reason after a colon.

Its type comes from what it is given: jali.actions takes refs of these kinds only, events and the model say which kind (ref.kind narrows ref.params), and jali.page is there only with a page. Declare it once as Register and the React hooks are typed by it too.

Its listeners (keys, Back and Forward, theme and saving) start with jali.start(), which returns their stop and can start again; <JaliRoot> starts it while mounted and stops it on unmount. jali.destroy() is the end.

Parameters

optionsJaliOptionsRequired
Show child parameters
panesreadonly PaneKindBase[]Required
The kinds of pane it can show, from definePane. A layout can only show refs of these kinds.
layoutLayoutInputOptional
The layout it opens on: a builder's result (row(...)), a single ref, or a whole Layout. Give this or presets.
presetsreadonly PresetOptions[]Optional

Default []

Layouts to start from, in menu order, each { id, label, layout }. Each gets a layout.preset.<id> command, titled "Layout: label", and "Reset layout" rebuilds the one in use. layout may be a function, to build a fresh one each time. saved gives back the layout the person left a preset in.
presetstringOptional

Default the first preset

The preset it opens on when no link says otherwise. An id that is not in presets also gives the first.
launcherPaneKindBaseOptional
What Split and "New tab here" open until the person chooses what to show. It closes quietly and its component reads useLauncher(). Without one, those commands and the tab strip's "+" are not offered.
pagePage | nullOptional

Default null

A curated page this instance can show, from definePage (jali-layout/page). A page made any other way is refused: definePage gives it the code that runs it, which an app without a page never ships. With one, jali.page has its actions.
namestringOptional
Your app's name for the free layout, in command titles such as "Open Data Studio" on a curated page. Without one, the command reads "Leave" and the page's name.
featuresreadonly Feature[]Optional

Default none

What the instance does beyond laying out panes, each a value from its own entry, so an app ships only what it uses: [urlSync(), palette(), rename({ run })], or defaultFeatures() for the address, ⌘K, Settings, the chooser and data-pressed at once. A feature given again takes the earlier one's place. See Features.
urlUrlWriterOptional
A writer of your own for the address (a router's), in place of urlSync(): Jali writes through it and reads nothing back. Most apps give urlSync({ location }) instead. See UrlWriter.
storagestring | StoragePortOptional

Default its id in a browser, memory elsewhere

What this person keeps on this device: settings, pane state, a curated page's mode and layout, dragged sizes. A string is a localStorage prefix; or pass a port, such as memoryStorage(). The default prefix is the instance's id ("jali"), so two instances with their own ids keep their own.
idstringOptional

Default "jali"

Prefix for DOM ids (jali-pane-orders). Give each instance on one page its own.
pageThemebooleanOptional

Default true

Set data-theme on <html> from the person's theme setting, and on the instance's root and dialog layer too, for rules scoped to the instance. false when the instance sits in a page that has its own theme: then it writes none of them.
settingsPartial<Settings>Optional

Default Jali's (theme system, pane cap 8)

Settings for a person who has none saved on this device yet: { theme: "dark" } for a dark-first app. They are not saved; what the person changes is, and wins from then on, setting by setting. See Settings.
commandsreadonly Command[]Optional
Your own commands. They are listed in ⌘K after Jali's, each with its own keys and a disabled check if it needs one (Command). keyboard.keymap can rebind or unbind their keys like any other ({ "orders.refresh": "Mod+K Mod+U" }). If an id repeats one of Jali's, Jali's wins.
keyboardKeyboardOptionsOptional

Jali's keys, in one place. See KeyboardOptions.

Show child parameters
keyboard.scope"page" | "local"Optional

Default "page"

"page": every key on the page. "local": only keys pressed inside it or in its dialogs (the palette, settings and the chooser render outside its root, so a ⌘K chord finishes there), and keys with nothing focused while it was the last one used. Use "local" for two on one page.
keyboard.keymapKeymapOverridesOptional
Rebind or unbind commands: { "pane.zoom": "Mod+K Mod+Enter", "pane.close": null }. A binding is refused (and reported) when it can't be parsed, is a single character key with no Mod, Ctrl or Alt (those belong to the content), or has more than two steps.
keyboard.prefixKeyStringOptional

Default "Mod+K"

The first step of every default two-step binding, and the palette's key. Move it when your app owns ⌘K: "Mod+J" makes "Restore last closed pane" ⌘J ⌘Z. Bindings in keymap are used as written.
keyboard.reservedreadonly KeyString[]Optional
Keys your app uses for itself. Any of Jali's bindings that is one of them, or starts with one, is dropped and reported to onInvalid when the instance is made.
keyboard.platform"mac" | "other"Optional
The keymap's platform, for tests and the server. Default: the running one.
keyboard.onInvalid(id, binding, reason) => voidOptional

Default console.warn

Hears each binding refused.
keyboard.wordsKeyWordsOptional

Default messages.keys

The words printed keys use ("Ctrl", "Esc"). Default: the instance's messages.keys, English unless you translate them.
landmark"region" | "main"Optional

Default "region"

What the panes are to screen readers. "region": a <section> labelled "Panes", which sits inside your page's own <main> and adds no second one. "main": the panes render as the page's <main>. Use it when Jali is the whole app and the page has no <main> of its own.
labelstringOptional
The instance's name for assistive technology, for a page with more than one instance. Its landmark is named this instead of "Panes", and each of Jali's landmarks inside it adds it (a pane "Order 7, Orders", the shelf "Shelf, Orders", the switcher, the peek, a page's views), so no two instances repeat a landmark. Without it, the names are Jali's own. See Two instances on one page.
dirDirectionOptional

Default the page's

The reading direction. By default the instance reads its page's: the computed direction where it renders, so <html dir="rtl"> is enough, and it follows a later change of dir. Give one to fix it; <JaliRoot> then sets dir on its elements, so the styles agree. Right to left, a row starts at the right, and every left and right a key, command, drop zone or message names is still the screen's. The layout and its links are the same in both. See Direction.
gapnumberOptional

Default 6

The space between panes, in CSS pixels. The layout measures with it (splits, rows that scroll, the stacked view), and <JaliRoot> writes it on its root and its layer as --jali-gap, so a style that reads the variable agrees with where the panes are.
size{ width: number; height: number }Optional
A fixed size instead of the window's, for tests and server rendering. <JaliRoot> measures the real one once it renders.
moveFocusbooleanOptional

Default true

false leaves DOM focus alone: for tests and an instance that is never shown.
beforeCloseBeforeCloseOptional
Asked before a change removes panes or makes a pane show another object: a close, close others, a preset, setLayout, Back and Forward, openHere. Return true to let it happen or false to keep the panes, or a promise of either for a check that takes time. Jali's own "Discard unsaved changes?" follows a yes when a pane still reports unsaved work, including work reported while the guard decided. Nothing of the change is written while the guard decides: an action your guard runs meanwhile happens at once, with its real result, and the change is then worked out again against the state it leaves. See BeforeClose.
confirmDiscardbooleanOptional

Default true

false: your app asks about unsaved work itself, from beforeClose. Panes still report it with useUnsaved and show the unsaved mark, but Jali never asks "Discard unsaved changes?" and doesn't hold the page's unload. A following detail with unsaved work still keeps its object.
tabMenuTabMenuOptional
Your items for a tab's menu (right-click, Shift+F10 or the menu key on a tab), after Jali's: Close, Close other tabs, Close tabs to the right, Move tab left and right, Move out of tabs, Split right and down, Maximise. Called as the menu opens, with the tab's pane; undefined or [] for none. See TabMenuItem.
allowAllowOptional
What may happen to panes: turn controls off for the whole instance ({ fullScreen: false }), turn Pop out off ({ popOut: false }, with the popOut() feature), and when({ action, pane, presetId, page }) to decide by context; false refuses. Each kind's own allow is asked first, and only takes away. See Choose what people can do with panes and Allow.
buttonsPaneButtonsOptional
The buttons in a pane's header, as shortcuts: everything allowed is in the pane's menu (right-click, ⋯ or Shift+F10) and ⌘K either way. Leave it out for Jali's: Tuck, Maximise, Pop out (where allow.popOut turns it on) and Close, with Full screen in Maximise's place on a lone pane. A list replaces them; a function adjusts them ((defaults) => defaults.filter((b) => b !== "tuck")). A kind's own buttons win. See PaneButtons.
phonePhoneOptionsOptional
Phones: below phone.below pixels of width (default 600) Jali shows one pane at a time, with a switcher, whatever the panes' minimums. { below: 0 } switches only when even one pane can't fit. See PhoneOptions.
onPaneError(error: unknown, info: PaneErrorInfo) => voidOptional

Default console.error in development

Called when a pane's component throws. That pane shows a failed state with Retry and Close, and the other panes carry on. info says which pane (PaneErrorInfo). Send it to your error reporting.
messagesMessageOverridesOptional

Default English (en)

Words to use instead of Jali's English ones, by area: { commands: { close: "Fermer le volet" } }. Keys you leave out stay English. See en and Translate Jali.

Returns

Jali

The instance. Its members are listed under Jali: actions, page (with a page), dialogs, get(), subscribe(), on(), model(), getLayout(), setLayout(), keymap, env, messages, href(), start() and destroy().

actions

What an app asks the instance to do with panes and layouts; a curated page's actions are jali.page (JaliPage) and the dialogs' jali.dialogs (JaliDialogs). Each action reads the current state, makes its change once (layout, focus, address, announcement, toast) and returns what happened: { ok: true, pane }, or { ok: false, reason } with the reason it did not.

jali.actions.openBeside(pane: PaneTarget, ref: ObjectRef, options?: OpenBesideOptions): ActionResult
actions.ts
import { orderKind } from "./kinds";import { store } from "./store";​// Read, subscribe, act. An action says what it did: the pane it opened, or why it did not.const off = store.subscribe(() => console.log(store.get().view.focused));const opened = store.actions.openBeside("orders", orderKind({ id: 1042 }));if (!opened.ok) console.log(opened.reason); // "not-found", "unsaved", …store.actions.select("orders", orderKind({ id: 1043 }));store.actions.close(orderKind({ id: 1042 })); // a pane by what it showsstore.on("open", ({ pane, ref }) => console.log("opened", pane, ref.params));store.model().panes.filter((p) => p.where === "shown"); // panes on screen, in tree orderstore.on("toast", (t) => console.log(t.title, t.undo ? "(Undo)" : ""));off();

The pane comes first, by its id or by the object it shows: close("order") and close(orderKind({ id: 7 })) both work. An action that would remove or replace a pane with unsaved work is held instead (reason: "unsaved"), and "Discard unsaved changes?" opens. A following detail with unsaved work keeps its object and says so, while the list's other followers move on. Every action is listed under JaliActions.

What a kind's refs hold, in its params: Number, String, Boolean, oneOf(...) or your own function, each required unless wrapped in optional or appOnly. The Pane kinds guide explains what happens to a ref that is missing a required param.

optional

A param a ref may leave out. The kind's code sees it as optional (tab?: string), and its ref maker takes it or not. An optional param given as undefined is left out of the ref, as a link would leave it.

optional<T extends ParamType>(type: T, options?: ParamOptions): OptionalParam<T>
ticket.tsx
import { definePane, type PaneProps } from "jali-layout/react";import { oneOf, optional } from "jali-layout";​// Declared first, so a component written apart from the kind is typed from it.const ticketParams = {  id: Number,  status: optional(oneOf("open", "pending", "closed")),  internal: optional(Boolean),};​// params is { id: number; status?: "open" | "pending" | "closed"; internal?: boolean }function TicketView({ params }: PaneProps<typeof ticketParams>) {  return (    <h3>      Ticket {params.id} · {params.status ?? "any status"}      {params.internal ? " · internal notes" : ""}    </h3>  );}​export const ticket = definePane("ticket", {  params: ticketParams,  title: ({ id }) => `Ticket ${id}`,  Component: TicketView,});​ticket({ id: 7 }); // { kind: "ticket", params: { id: 7 } }ticket({ id: 7, status: "open", internal: true });

Parameters

typeParamTypeRequired
How to read it when it is there: Number, String, Boolean, oneOf(...) or a function.
options.linkfalseOptional
The param is the pane's own state for this page load, and stays out of the address: runId: optional(String, { link: false }). Jali leaves it out of every link it writes (the address bar, Copy link, Back and Forward). Unlike appOnly, it is part of what the pane shows (chart({ runId: "a" }) and chart({ runId: "b" }) are two objects), and a link that does carry it still sets it. Back and Forward keep it on a pane that is still open; after a reload the pane has none, unless the preset the address names gave it one. Use it for a value that means nothing in another tab: a run id, a key into memory.

Returns

OptionalParam<T>

appOnly

A param only your app sets, never a link: params: { sql: String, autorun: appOnly(Boolean) }. Use it for anything a link must not be able to turn on, such as a query that runs as it opens. Jali leaves it out of every address it writes (the address bar, Copy link, Back and Forward) and drops it from every link it reads, even when the link holds a value it can't read. What the app gave stays where the app gave it: Back and Forward keep it on a pane that is still open, and a reload keeps what the preset the address names gave a pane, when the pane is exactly the preset's (the same id, showing the same object). A link that changes the pane gets none. It is optional, since a pane opened from a link has none, and it is not part of what the pane shows: query({ sql, autorun: true }) and query({ sql }) are the same object.

appOnly<T extends ParamType>(type: T): AppOnlyParam<T>

Parameters

typeParamTypeRequired
How to read it when your app gives it: Number, String, Boolean, oneOf(...) or a function.

Returns

AppOnlyParam<T>

oneOf

A param that is one of a few values: oneOf("open", "closed") gives "open" | "closed". Values are compared as text, so oneOf(10, 25) reads "25" from a link as 25. Any other value can't be read, and the ref doesn't open.

oneOf<const V extends readonly (string | number)[]>(...values: V): OneOf<V[number]>

Parameters

...values(string | number)[]Required
The values it can be.

Returns

OneOf<V[number]>

A reader, with the values as values.

row

Children side by side. A child is a ref (a pane showing it), a pane(ref, options), or another row, column or tabs. Options come first when there are any: row({ weight: 2 }, a, b).

row(...children: LayoutInput[]): SplitDraft
row(options: RowOptions, ...children: LayoutInput[]): SplitDraft
layouts.ts
import { column, pane, row, tabs } from "jali-layout";import { orderKind, ordersKind } from "./kinds";​// A child is a ref, a pane(ref, options), or another row, column or tabs. Options come first when there are any.export const desk = row(  pane(ordersKind(), { id: "orders", px: 320 }), // a fixed 320px  column(    { weight: 2 }, // twice the share of its siblings    pane(orderKind({ id: 1041 }), { id: "order", linkedTo: "orders", follows: true }),    tabs(orderKind({ id: 1042 }), orderKind({ id: 1043 })), // two tabs, the first shown  ),);

Nodes without an id are named after what they hold: "row", "column", "tabs", or the pane's kind, then "order-2" and so on. Give an id to a pane another one links to, or that your code names.

Parameters

optionsRowOptionsOptional
id; weight (its share of the parent, default 1) or px (a fixed length); scroll: "x" for a row that scrolls sideways, its children at their own widths, instead of sharing its width and folding what doesn't fit.
children(Draft | ObjectRef)[]Required

Returns

SplitDraft

For createJali({ layout }) or a preset's layout.

column

Children one above the other. Otherwise the same as row.

column(...children: LayoutInput[]): SplitDraft
column(options: SizeOptions, ...children: LayoutInput[]): SplitDraft

tabs

Panes as tabs in one place: a stack the person made. options.active names the tab shown (default: the first); id, weight and px as for row.

tabs(...panes: (ObjectRef | PaneDraft)[]): TabsDraft
tabs(options: TabsOptions, ...panes: (ObjectRef | PaneDraft)[]): TabsDraft

pane

A pane showing ref, with options. A bare ref in a row is the same as pane(ref).

pane(ref: ObjectRef, options?: PaneNodeOptions): PaneDraft

Parameters

refObjectRefRequired
What it shows: orderKind({ id: 1 }).
optionsPaneNodeOptionsOptional
Show options
idstringOptional
Its node id. Default: its kind's name, then name-2, ….
weightnumberOptional

Default 1

Its share of the parent.
pxnumberOptional
A fixed length along the parent's axis instead.
linkedTostringOptional
The pane it was opened from. Closing that pane drops the link.
followsbooleanOptional
With linkedTo: it shows whatever is selected in that pane, and moves with the selection.
keptbooleanOptional
Kept by the person: never reused for another object, never following, the last to fold.
pinnedbooleanOptional
A pinned tab: first in its tab group, left open by Close other tabs and Close tabs to the right, and still pinned if it leaves the group and joins another.
rolestringOptional
The place it fills in a curated page's designed layout (the view's id).
priority"primary" | "supporting"Optional
Supporting panes give way first when room runs out.
hiddenbooleanOptional
Off screen at the start, with no slot or tab; showing it brings it back.

Returns

PaneDraft

sameRef

Whether two refs are exactly the same: the same kind and the same params, compared with ===, in any key order (a layout read back from Postgres jsonb shows the same objects). Jali compares refs with this everywhere. 1 and "1" differ here; to ask whether two refs show the same object, use kinds.sameObject.

sameRef(a: ObjectRef | undefined, b: ObjectRef | undefined): boolean
same-ref.ts
import { sameRef } from "jali-layout";​sameRef({ kind: "order", params: { id: 1041 } }, { kind: "order", params: { id: 1041 } }); // truesameRef({ kind: "order", params: { id: 1041 } }, { kind: "order", params: { id: "1041" } }); // false: 1041 !== "1041"sameRef(undefined, { kind: "order", params: {} }); // false

Parameters

aObjectRef | undefinedRequired
bObjectRef | undefinedRequired

Returns

boolean

false when either is undefined.

createJali makes these for you from its url and storage options. Pass one yourself for a router, a test or an instance that must not touch the page.

memoryLocation

An address that lives in memory: for tests, server rendering, and an instance in a dialog that must not touch the page's address.

memoryLocation(initial?: string): LocationPort & { entries: string[]; visit(search: string): void }
jali.ts
import { createJali, memoryLocation, memoryStorage } from "jali-layout";import { launcherKind, orderKind, ordersKind } from "./kinds";import { palette } from "jali-layout/palette";import { urlSync } from "jali-layout/url";​export const jali = createJali({  panes: [ordersKind, orderKind], // the kinds of pane it can show  layout: ordersKind(), // the layout it opens on (or `presets`)  launcher: launcherKind, // what Split opens: without one there is no Split  name: "Sales desk", // in commands such as "Open Sales desk"  features: [urlSync({ prefix: "a.", sizes: "link" }), palette()], // each a value from its own module  storage: "sales", // localStorage keys "sales:…", or a StoragePort  id: "sales", // DOM ids "sales-pane-…"  keyboard: { scope: "local", keymap: { "pane.close": "Mod+K Mod+X" } }, // only keys pressed inside it  pageTheme: false, // leave data-theme on <html> to the page});​// With no browser (a test, the server): the address and storage in memory, a fixed size, DOM focus left alone.const location = memoryLocation();export const inMemory = createJali({  panes: [orderKind],  layout: orderKind({ id: 1041 }),  features: [urlSync({ location })],  storage: memoryStorage(),  size: { width: 1440, height: 900 },  moveFocus: false,});​location.entries; // every address Jali pushed or replacedlocation.visit("?tab=2"); // navigation from outside: Jali hears it, as it hears Back and Forward

Parameters

initialstringOptional

Default ""

The first search string.

Returns

LocationPort & { entries: string[]; visit(search: string): void }

entries is the history, newest last; href() is memory: plus the search. visit(search) is navigation the instance did not make (Back, a router link): it adds an entry and calls every subscriber. navigate does not call subscribers.

memoryStorage

Storage in a Map, for tests, server rendering and embedded instances.

memoryStorage(initial?: Record<string, string>): StoragePort

Parameters

initialRecord<string, string>Optional

Default {}

Keys to start with (settings, pane-state, …).

Returns

StoragePort

listCommands

Every command a person can run from a menu now, in the palette's order: the focused pane's own commands first (keys pane:<id>), then the instance's and your own commands. Each has its title, group, keys label for this platform, disabled and the reason, and run. For an app with its own command menu (no palette() feature).

listCommands(jali: Jali): readonly ListedCommand[]
toolbar.ts
import { copyLink, listCommands, runCommand } from "jali-layout";import { store } from "./store";​// A toolbar button that runs one of Jali's commands and shows its keys.const zoom = listCommands(store).find((c) => c.id === "pane.zoom")!;const disabled = zoom.disabled;const tooltip = `${zoom.title} · ${zoom.keys}`; // "Maximise or restore pane · ⇧⌘↵"​function onClick() {  if (!runCommand(store, "pane.zoom")) console.info("refused");}​copyLink(store); // the address on the clipboard, and "Link copied" read outexport { disabled, tooltip, onClick };

It is worked out on every call, and returns the same array (and the same entries, each with the same run) until something it lists changes. So in React it is a store snapshot as it is: useSyncExternalStore(jali.subscribe, read, read) with read = () => listCommands(jali) (the same read is the server's snapshot) re-renders only when the list changes. What it lists can change without a change of state, when an allow rule reads your own data: call it again then.

Returns

readonly ListedCommand[]

runCommand

Runs a command by id if its check passes. A refusal is not announced here (the keyboard and the palette do that).

runCommand(jali: Jali, id: string): boolean

Parameters

jaliJaliRequired
idstringRequired
A command id, such as "pane.zoom".

Returns

boolean

Whether it ran: false for an unknown id, a refused check, an action that refused, or an instance after destroy(). A change held for an answer (the host's beforeClose, or "Discard unsaved changes?") ran.

edgeScroll

Scrolls a row that scrolls sideways while a drag is held within 56px of its left or right edge, faster the closer it is, so a drag can reach a pane out of view. For an app's own drag; Jali's pane drag (by a header) already does this. Call move on every pointer move and stop when the drag ends. onScroll runs after each step, so the drag can find what is under the pointer again as the panes slide past.

edgeScroll(jali: Jali, onScroll?: () => void): EdgeScroll

Parameters

jaliJaliRequired
onScroll() => voidOptional
After each step of scrolling.

Returns

EdgeScroll

EdgeScroll

What edgeScroll returns: tell it where the pointer is, and when the drag ends.

interface EdgeScroll { move(clientX: number, clientY: number): void; stop(): void }

copyLink

Writes jali.href() to the clipboard and announces "Link copied", or "Couldn't copy the link" when the browser refuses. Where navigator.clipboard is missing it does nothing. The layout.copy_link command runs it.

copyLink(jali: Jali): void

Parameters

jaliJaliRequired

Returns

void

keyBelongsToContent

Whether a key event belongs to the focused content: its target is a text field, a contenteditable region, a combobox or search box, inside a dialog, or a control that Space presses (a button, link, tab, checkbox, switch, radio or menu item). Use it in a window-level keydown handler that wants a single key such as Space. See Space in lists.

keyBelongsToContent(event: KeyboardEvent): boolean

altClick

The words for Jali's modifier-click, for hints in your own text: "⌥-click" on a Mac and "Alt-click" elsewhere, as in `${altClick()} a tab to open it beside`.

altClick(platform?: Platform): string

Parameters

platformPlatformOptional

Default this platform

keyHint

A binding string printed for the platform: keyHint("Alt+Enter") is "⌥↵" on a Mac and "Alt+Enter" elsewhere. For keys a pane handles itself, which are not in the keymap. Throws on a key or modifier it doesn't know.

keyHint(text: string, platform?: Platform, words?: KeyWords): string
hints.ts
import { keyHint } from "jali-layout";import { store } from "./store";​keyHint("Alt+Enter", "mac"); // "⌥↵"keyHint("Alt+Enter", "other"); // "Alt+Enter"keyHint("Mod+Enter"); // for this platform: "⌘↵" on a Mac, "Ctrl+Enter" elsewherestore.keymap.sequences("pane.zoom").map((s) => store.keymap.format(s));

Parameters

textstringRequired
A binding such as "Mod+K Mod+M".
platformPlatformOptional

Default this platform

wordsKeyWordsOptional

Default English

The words for the keys (en.keys, or your translation of them).

Returns

string

en

Jali's English messages: every word it shows or says, by area (announcements, toasts, commands, commandGroups, keys, palette, chooser, confirmDiscard, settings, tabs, shelf, pane, peek, panes, page, drop). An instance made without messages says these words. A curated page's own words (the page area, and the announcements, commands and toast only a page uses) come with the page from definePage, so an instance without a page has none of them in jali.messages, and an app that doesn't import en doesn't ship them. Spread it to start a translation. A message that needs values is a function, such as en.announcements.closed(pane); a message with a bold part takes bold and returns its parts in order.

const en: Messages
messages.ts
import { createJali, en, type MessageOverrides } from "jali-layout";import { orderKind } from "./kinds";​const words: MessageOverrides = {  commands: { close: "Close tab" },  tabs: { close: (pane) => `Close ${pane} tab` },};const jali = createJali({ panes: [orderKind], layout: orderKind({ id: 1 }), messages: words });​jali.messages.commands.close; // "Close tab"jali.messages.commands.zoom; // "Maximise or restore pane", from `en`en.announcements.closed("Order 1041"); // "Order 1041 closed · Undo available"