@protobase/cli 0.23.7 → 0.23.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -139,7 +139,7 @@ const displayShapes = (model, view, models) => (view.list?.displays ?? []).flatM
139
139
  }
140
140
  }];
141
141
  }
142
- if (display.kind === "calendar") {
142
+ if (display.kind === "calendar" || display.kind === "timeline") {
143
143
  const start = model.fields[display.start];
144
144
  if (!start) return [];
145
145
  const end = display.end === void 0 ? void 0 : model.fields[display.end];
@@ -150,7 +150,7 @@ const displayShapes = (model, view, models) => (view.list?.displays ?? []).flatM
150
150
  return [{
151
151
  resource: model.name,
152
152
  request: request(model.name, text, sort),
153
- from: `the calendar display "${display.name}"`,
153
+ from: `the ${display.kind} display "${display.name}"`,
154
154
  query: {
155
155
  filter,
156
156
  sort
package/dist/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.23.7";
2
+ var version = "0.23.9";
3
3
  //#endregion
4
4
  export { version };
@@ -1,10 +1,12 @@
1
1
  //#region src/serve/host-module-ids.ts
2
+ const lazyHostModuleIds = ["@protobase/server/email"];
2
3
  const hostModuleIds = [
3
4
  "@protobase/schema",
4
5
  "@protobase/layout",
5
6
  "@protobase/layout/jsx-runtime",
6
7
  "@protobase/query",
7
8
  "@protobase/server",
9
+ ...lazyHostModuleIds,
8
10
  "kysely",
9
11
  "kysely/helpers/postgres",
10
12
  "pg",
@@ -24,4 +26,4 @@ const hostModuleIds = [
24
26
  "@react-email/render"
25
27
  ];
26
28
  //#endregion
27
- export { hostModuleIds };
29
+ export { hostModuleIds, lazyHostModuleIds };
@@ -44,6 +44,7 @@ const hostModules = {
44
44
  "react/jsx-runtime": reactJsxRuntime,
45
45
  "@react-email/render": reactEmailRender
46
46
  };
47
+ const lazyHostModules = { "@protobase/server/email": () => import("@protobase/server/email") };
47
48
  const provideHostModules = () => {
48
49
  const bun = globalThis.Bun;
49
50
  if (!bun) return;
@@ -54,6 +55,10 @@ const provideHostModules = () => {
54
55
  exports,
55
56
  loader: "object"
56
57
  }));
58
+ for (const [id, load] of Object.entries(lazyHostModules)) build.module(id, async () => ({
59
+ exports: await load(),
60
+ loader: "object"
61
+ }));
57
62
  }
58
63
  });
59
64
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/cli",
3
- "version": "0.23.7",
3
+ "version": "0.23.9",
4
4
  "description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -35,11 +35,11 @@
35
35
  "dependencies": {
36
36
  "@hono/node-server": "^2.1.3",
37
37
  "@hono/vite-dev-server": "^0.26.1",
38
- "@protobase/layout": "0.23.7",
39
- "@protobase/query": "0.23.7",
40
- "@protobase/schema": "0.23.7",
41
- "@protobase/server": "0.23.7",
42
- "@protobase/ui": "0.23.7",
38
+ "@protobase/layout": "0.23.9",
39
+ "@protobase/query": "0.23.9",
40
+ "@protobase/schema": "0.23.9",
41
+ "@protobase/server": "0.23.9",
42
+ "@protobase/ui": "0.23.9",
43
43
  "@react-email/render": "^2.1.0",
44
44
  "@scalar/hono-api-reference": "^0.12.10",
45
45
  "@tailwindcss/vite": "^4.3.3",
@@ -256,8 +256,9 @@ The modules the app shares with plugins, `react`, `react/jsx-runtime`, `react-do
256
256
  | `better-auth`, `hono`, `jose`, `zod`, `aip-parsers`, `@hono/node-server`, `@scalar/hono-api-reference` | the main entry of each other dependency the `@protobase` packages run on the server |
257
257
  | `hono/cors`, `hono/http-exception`, `hono/validator` | Hono middleware for [API functions](../guides/api-functions.md)) |
258
258
  | `react`, `react/jsx-runtime`, `@react-email/render` | what [email templates](email.md#in-a-bundle)) render with, so a template's component and the renderer share one React |
259
+ | `@protobase/server/email` | the [look of Protobase's own mail](email.md#the-look-of-protobases-own-mail)), loaded when the bundle first imports it rather than when the runtime starts |
259
260
 
260
- `react-email` is a dependency of `@protobase/server` that the runtime does not supply: the server loads it only to send an auth email, so a config that imports it inlines its own copy, like any other package.
261
+ `react-email` is a dependency of `@protobase/server` that the runtime does not supply: the server loads it only to send its own mail, or for `@protobase/server/email`, so a config that imports it inlines its own copy, like any other package.
261
262
 
262
263
  Importing any other `@protobase` package or dependency of one (`@protobase/ui`, `react-dom`, `better-auth/plugins`, `zod/v4`, ...) fails the build with this list, also from inside an inlined package, when the finished bundle still imports it: an inlined package may re-export a module that imports one, as `react-email` does with `tailwindcss`, as long as the project leaves that export unused. So does a copy the project installs in another version than the `@protobase` packages use (another major, or another minor below 1.0), which the runtime's would replace. The list is `packages/cli/src/serve/host-module-ids.ts`; the set of packages comes from the `package.json` of `@protobase/cli` and of every `@protobase` package it depends on.
263
264
  - Packages with a native add-on stay imports too, and the bundle carries them in `node_modules/` (see [Native packages](#native-packages)). Node's built-in modules stay imports.
@@ -23,7 +23,7 @@ With an absolute `baseUrl`, such as another app's `https://desk.example.com/api/
23
23
 
24
24
  ## The admin app
25
25
 
26
- `<App baseUrl="/api/v1" />` renders the shell from `/api/meta` (beside the API, so `createClient` derives it from `baseUrl`) and routes `/:page` ([composed pages](layouts.md))), `/:resource` (list) and `/:resource/:key` (record); it opens on the first page, or the first resource. Its own pages sit under `/-/`, which no page or resource name takes: `/-/account` (the user's passkeys and two-factor authentication) and `/-/sign-in-policy` (admins: the policy, and the log of staff sign-ins). Before the shell, it signs in on its sign-in route, `/-/sign-in`, with the methods the server offers and asks for what the [sign-in policy](auth.md#sign-in-policy)) requires. Someone signed out goes there from any page, with that page in `?next=`, and signing in comes back to it; each step (a forgotten password, an emailed code, making an account) adds `?step=`, so the browser's Back returns to the step before; `?staff-sign-in` opens the [staff sign-in](auth.md#staff-sign-in)) page instead, and a staff session gets a banner above the shell. `createAuthSession` from `@protobase/client` is that session (`signIn`, `signInWithCode`, `signInWithPasskey`, `verifyTwoFactor`, `account`, `signInPolicy`, `staff`). `ui` takes the project's [custom components and action handlers](custom-components.md)). The list state lives in the URL: `?filter=` (AIP-160), `?order_by=`, `?layout=panel`, `?calendar=month,2026-10-01`, the month or week a [calendar](ui-config.md#calendars)) shows, and `?saved_search=`, the [saved search](ui-config.md#saved-searches)) the list was opened from. Views come from `examples/*/config/*/ui.ts`. The sidebar's recent-record groups and the user menu are configured there too: see [Sidebar](sidebar.md)), [User menu](user-menu.md)) and [Bottom bar](bottom-bar.md)).
26
+ `<App baseUrl="/api/v1" />` renders the shell from `/api/meta` (beside the API, so `createClient` derives it from `baseUrl`) and routes `/:page` ([composed pages](layouts.md))), `/:resource` (list) and `/:resource/:key` (record); it opens on the first page, or the first resource. Its own pages sit under `/-/`, which no page or resource name takes: `/-/account` (the user's passkeys and two-factor authentication) and `/-/sign-in-policy` (admins: the policy, and the log of staff sign-ins). Before the shell, it signs in on its sign-in route, `/-/sign-in`, with the methods the server offers and asks for what the [sign-in policy](auth.md#sign-in-policy)) requires. Someone signed out goes there from any page, with that page in `?next=`, and signing in comes back to it; each step (a forgotten password, an emailed code, making an account) adds `?step=`, so the browser's Back returns to the step before; `?staff-sign-in` opens the [staff sign-in](auth.md#staff-sign-in)) page instead, and a staff session gets a banner above the shell. `createAuthSession` from `@protobase/client` is that session (`signIn`, `signInWithCode`, `signInWithPasskey`, `verifyTwoFactor`, `account`, `signInPolicy`, `staff`). `ui` takes the project's [custom components and action handlers](custom-components.md)). The list state lives in the URL: `?filter=` (AIP-160), `?order_by=`, `?layout=panel`, `?calendar=month,2026-10-01`, the month or week a [calendar](ui-config.md#calendars)) shows, `?timeline=quarter,2026-10-01`, the week, month or quarter a [timeline](ui-config.md#timelines)) shows, and `?saved_search=`, the [saved search](ui-config.md#saved-searches)) the list was opened from. Views come from `examples/*/config/*/ui.ts`. The sidebar's recent-record groups and the user menu are configured there too: see [Sidebar](sidebar.md)), [User menu](user-menu.md)) and [Bottom bar](bottom-bar.md)).
27
27
 
28
28
  ## Global search
29
29
 
@@ -87,7 +87,7 @@ A prop that names a field is a field reference, `fieldRef('plan.name')` from `@p
87
87
 
88
88
  ## List displays
89
89
 
90
- A list can show its rows with a component of the project's own, declared in the view with [`d.custom`](ui-config.md#list-displays)). The list page loads the rows, with the filter, search and order of the address, and the component draws them: `useListDisplay()` gives them, `RecordLink` opens one. A board in columns of an enum field, with cards dragged between them, is built in as [`d.board`](ui-config.md#boards)), and a month or week calendar of a date field as [`d.calendar`](ui-config.md#calendars)); the board below draws its own.
90
+ A list can show its rows with a component of the project's own, declared in the view with [`d.custom`](ui-config.md#list-displays)). The list page loads the rows, with the filter, search and order of the address, and the component draws them: `useListDisplay()` gives them, `RecordLink` opens one. A board in columns of an enum field, with cards dragged between them, is built in as [`d.board`](ui-config.md#boards)), a month or week calendar of a date field as [`d.calendar`](ui-config.md#calendars)), and a Gantt-style timeline of bars from a start to an end date as [`d.timeline`](ui-config.md#timelines)); the board below draws its own.
91
91
 
92
92
  ```tsx
93
93
  // components/repair-board.tsx, exported from protobase.ui.tsx: export { RepairBoard } from './components/repair-board'
@@ -26,7 +26,7 @@ PROTOBASE_SMTP_URL=smtp://localhost:1025
26
26
  PROTOBASE_MAIL_FROM=noreply@shop.example.com
27
27
  ```
28
28
 
29
- A project that delivers mail another way passes a `mailer`, `{ send({ to, subject, text, html }) }`, to [`createAuth`](auth.md#password-reset)) and `startJobs`, or `mailer: false` to turn mail off whatever the environment says. A template's `send` takes one too, see [Templates](#templates).
29
+ A project that delivers mail another way passes a `mailer`, `{ send({ to, subject, text, html, headers }) }`, to [`createAuth`](auth.md#password-reset)) and `startJobs`, or `mailer: false` to turn mail off whatever the environment says. A template's `send` takes one too, see [Templates](#templates).
30
30
 
31
31
  ## Protobase's own mail
32
32
 
@@ -80,14 +80,52 @@ export const repairReady = defineEmail({
80
80
  | `name` | Names the email in errors. |
81
81
  | `subject` | The subject line, or a function of the data that makes it. |
82
82
  | `component` | The body, a React component of the data. It is rendered with React Email's `render` to the HTML part; the plain-text part is made from that HTML, leaving out what React Email marks to skip, such as `<Preview>`. |
83
+ | `headers` | Optional: more header fields, or a function of the data that makes them. A value is one line. |
83
84
 
84
85
  The template that comes back has two methods, both typed by the component's props:
85
86
 
86
- - `render(data)` gives `{ subject, html, text }` without sending anything: for a test, or to look at the result.
87
+ - `render(data)` gives `{ subject, html, text, headers }` without sending anything: for a test, or to look at the result.
87
88
  - `send(to, data, mailer?)` renders and sends it, through `mailer` when given (a job's `mail`), otherwise through `PROTOBASE_SMTP_URL`. It rejects when mail is off or the server refuses the message.
88
89
 
89
90
  React and React Email's renderer are loaded on the first email rendered, not when the app starts.
90
91
 
92
+ Mail an app sends in bulk, such as alerts or newsletters, should carry a one-click unsubscribe link, which Gmail and Yahoo expect of bulk senders ([RFC 8058](https://www.rfc-editor.org/rfc/rfc8058)): a `List-Unsubscribe` header with the recipient's own link, and `List-Unsubscribe-Post`. The link must stop the mail on a `POST` without a sign-in, such as an [API function](../guides/api-functions.md)) that takes a token of the recipient's in its address:
93
+
94
+ ```ts
95
+ headers: ({ unsubscribeUrl }: Digest) => ({ 'List-Unsubscribe': `<${unsubscribeUrl}>`, 'List-Unsubscribe-Post': 'List-Unsubscribe=One-Click' }),
96
+ ```
97
+
98
+ ### The look of Protobase's own mail
99
+
100
+ `@protobase/server/email` exports the components Protobase's own mail is built from, so an app's emails can look the same: a white card on grey with a teal action.
101
+
102
+ | Component | |
103
+ | --- | --- |
104
+ | `EmailLayout` | The whole email: `preview`, the line inboxes show after the subject; `heading`; the message as its children; and a footer naming `app`, linked to its home page. `app` is `{ name, url }`. |
105
+ | `EmailButton` | The email's one action: a button to `href`, and the label with the link in the plain-text part. |
106
+ | `EmailCode` | A code to type in, on a line of its own. |
107
+ | `EmailNote` | A remark below the message, such as why the recipient gets the email. |
108
+
109
+ ```tsx
110
+ import { defineEmail } from '@protobase/server'
111
+ import { EmailButton, EmailLayout, EmailNote, type MailingApp } from '@protobase/server/email'
112
+ import { Text } from 'react-email'
113
+
114
+ type RepairReady = { app: MailingApp; customer: string; bike: string; url: string }
115
+
116
+ const RepairReadyEmail = ({ app, customer, bike, url }: RepairReady) => (
117
+ <EmailLayout app={app} preview={`Your ${bike} is ready for pickup`} heading="Ready for pickup">
118
+ <Text>Hi {customer}, your {bike} is ready.</Text>
119
+ <EmailButton href={url}>See the repair</EmailButton>
120
+ <EmailNote>You get this email because you brought your bike in for repair.</EmailNote>
121
+ </EmailLayout>
122
+ )
123
+
124
+ export const repairReady = defineEmail({ name: 'repair-ready', subject: 'Your bike is ready', component: RepairReadyEmail })
125
+ ```
126
+
127
+ They are apart from `@protobase/server` itself, so an app that imports none never loads React Email's components.
128
+
91
129
  ## Sending
92
130
 
93
131
  A **job** is the usual place: it runs after the write that asked for it has committed, and a message the server refuses fails the try, which is retried. Pass the job's `mail`, so a job runtime started with a mailer of its own sends through it:
@@ -163,4 +201,4 @@ A message is sent once per call, so a job try that sends and then fails sends ag
163
201
 
164
202
  ## In a bundle
165
203
 
166
- A [bundle](cli.md#the-config-module)) gets React and React Email's renderer from the serve runtime, as it gets `@protobase/server`, so an email's component and the renderer share one React and hooks such as `useContext` work. React Email's other components are inlined, though `@protobase/server` uses them too: it loads them only to send its own mail, so the runtime does not supply them. Its `<Tailwind>` component needs `tailwindcss`, which the runtime does not supply, so a served config cannot use it: style with `style` props instead.
204
+ A [bundle](cli.md#the-config-module)) gets React and React Email's renderer from the serve runtime, as it gets `@protobase/server` and `@protobase/server/email`, so an email's component and the renderer share one React and hooks such as `useContext` work. React Email's other components are inlined, though `@protobase/server` uses them too: it loads them only to send its own mail, so the runtime does not supply them. Its `<Tailwind>` component needs `tailwindcss`, which the runtime does not supply, so a served config cannot use it: style with `style` props instead.
@@ -95,6 +95,8 @@ await sendInvoice.enqueue(db, { invoiceId: 7 }, { delay: '5 minutes', key: 'invo
95
95
 
96
96
  A job enqueued outside a transaction starts at once when this process runs its jobs. One enqueued in a transaction, or by another process, is picked up within the poll interval, 2 seconds.
97
97
 
98
+ Each worker takes one job per poll, so a queue that fills faster drains one job per worker every 2 seconds at first. Once the queue maintenance, about every minute, counts more jobs ready than the job's `concurrency`, a worker that found a job fetches the next one at once, until a fetch finds none: a backlog then drains as fast as its jobs run.
99
+
98
100
  ### From SQL
99
101
 
100
102
  A trigger or a migration can enqueue in its own transaction:
@@ -267,7 +267,7 @@ It can show the list's records per value of a field instead, such as orders per
267
267
 
268
268
  ## List displays
269
269
 
270
- Besides its table, a list can show as cards, on a map, as a board in columns of its status, on a calendar of a date, or as a component of the project's own. The list stays at `/<resource>`, read through the list API, with its search, filters, chart, order and New button; only the way the rows are drawn changes.
270
+ Besides its table, a list can show as cards, on a map, as a board in columns of its status, on a calendar of a date, as a timeline of bars from a start to an end date, or as a component of the project's own. The list stays at `/<resource>`, read through the list API, with its search, filters, chart, order and New button; only the way the rows are drawn changes.
271
271
 
272
272
  ```ts title="docs-examples/reference/workshop.ts"
273
273
  import { component } from '@protobase/layout'
@@ -306,11 +306,12 @@ export const repairsView = daily
306
306
  | `d.map({ latitude, longitude, approximate?, exact?, radius?, area? }, { name?, label?, icon?, cards?, defaultRadius? })` | The matching records in the map's view, with how many there are below it; it asks again as it pans and zooms, through the list API's [`:map`](api.md#maps)). From far out it shows a count for each part of the map, which zooms in when chosen; close in, or with few records in view, the records themselves. Nearby records share a marker with their count; choosing one shows the record's card at the map's bottom, with arrows through the marker's records, and choosing the map elsewhere or closing the card clears it. The card is the one of the cards display `cards` names, else the list's first cards display, else the record's title. A record at an approximate position has a hollow marker and the area around it; see [Approximate positions](#approximate-positions). Named `map` unless `name` says otherwise. See [Maps](#maps). |
307
307
  | `d.board({ by, title?, subtitle?, badge?, meta? }, { name?, label?, icon? })` | A column per value of the enum field `by`, each with how many records have it, and a card per record that opens it: `title` (default: the view's `.title`) over `subtitle`, with `badge` and a few small `meta` fields, as the built-in card of `d.cards` draws them. Dragging a card to another column, or moving it with the keyboard, saves the record with that column's value. Within a column, cards are reordered when the resource has a `.position()`. Named `board` unless `name` says otherwise. See [Boards](#boards). |
308
308
  | `d.calendar({ start, end?, title? }, { name?, label?, icon? })` | The records on the days from their date or timestamp field `start` to `end`, or on their start day alone, in a month grid or a week grid, each event a link to its record showing `title` (default: the view's `.title`). Dragging an event to another day, or moving it with the keyboard, saves the record with `start` and `end` moved by the same days. Named `calendar` unless `name` says otherwise. See [Calendars](#calendars). |
309
+ | `d.timeline({ start, end?, group?, title? }, { name?, label?, icon? })` | A Gantt-style timeline: each record a row with a bar from its date or timestamp field `start` to `end`, or on its start day alone, over a week, a month or a quarter, in lanes by the values of `group`. Each bar is a link to its record showing `title` (default: the view's `.title`). Dragging a bar along its row, or moving it with the keyboard, saves the record with `start` and `end` moved by the same days. Named `timeline` unless `name` says otherwise. See [Timelines](#timelines). |
309
310
  | `d.custom(Component, { name, label, fields, props?, icon? })` | The rows drawn by a [custom component](custom-components.md#list-displays)). `fields` are the fields it shows, loaded with the names of the records relations point at; `props` are plain data, with `r.field` where it takes a field. |
310
311
 
311
- With displays, the list page has a switch at the right of its title: the table first, then each display by its `label`, with its `icon` (`table`, `cards`, `kanban`, `board`, `list` or `calendar`). Below the `md` breakpoint (768px) the switch is a menu of the same choices. The choice is in the address, `/repairs?display=cards`, so a reload, a bookmark or a shared link opens the same display; `default` names the display `/repairs` opens in, the table when it is left out. On a phone, below Tailwind's `sm` breakpoint (640px), a list with a cards display opens in it instead: the `default` when that is a cards display, else the first. A list without one opens in a built-in **List** there: a row per record with its `.title`, the first enum column as a badge on its right, and the next two columns but booleans on a muted line below, at `?display=rows`. The display menu offers the table beside it. A `?display=` in the address wins on any screen. A display without column headers has a sort menu over the sortable fields it shows, beside the filters, or below `md` in the filters sheet, whose button sits left of the search box. Selecting rows, deleting them in bulk and the row menu stay on the table, which every list keeps.
312
+ With displays, the list page has a switch at the right of its title: the table first, then each display by its `label`, with its `icon` (`table`, `cards`, `kanban`, `board`, `list`, `calendar` or `timeline`). Below the `md` breakpoint (768px) the switch is a menu of the same choices. The choice is in the address, `/repairs?display=cards`, so a reload, a bookmark or a shared link opens the same display; `default` names the display `/repairs` opens in, the table when it is left out. On a phone, below Tailwind's `sm` breakpoint (640px), a list with a cards display opens in it instead: the `default` when that is a cards display, else the first. A list without one opens in a built-in **List** there: a row per record with its `.title`, the first enum column as a badge on its right, and the next two columns but booleans on a muted line below, at `?display=rows`. The display menu offers the table beside it. A `?display=` in the address wins on any screen. A display without column headers has a sort menu over the sortable fields it shows, beside the filters, or below `md` in the filters sheet, whose button sits left of the search box. Selecting rows, deleting them in bulk and the row menu stay on the table, which every list keeps.
312
313
 
313
- The table, the cards, a board and a calendar scroll with the page, which is as tall as all their rows, with the browser's own scrolling: only the rows and cards in view are drawn and loaded, so a list of any length scrolls at once, and Back returns to the same ones. The table's header stays below the top bar while the page scrolls. Every card is as tall as the tallest one drawn at that width. A custom display scrolls with the page as well, as every other page of the app does; the map fills the screen between the top bar and a phone's bottom bar instead, and does not scroll. Where scrollbars take room, as on Windows, the page keeps room for one even while it fits, so the cards keep their width as the scrollbar comes and goes.
314
+ The table, the cards, a board, a calendar and a timeline scroll with the page, which is as tall as all their rows, with the browser's own scrolling: only the rows and cards in view are drawn and loaded, so a list of any length scrolls at once, and Back returns to the same ones. The table's header stays below the top bar while the page scrolls. Every card is as tall as the tallest one drawn at that width. A custom display scrolls with the page as well, as every other page of the app does; the map fills the screen between the top bar and a phone's bottom bar instead, and does not scroll. Where scrollbars take room, as on Windows, the page keeps room for one even while it fits, so the cards keep their width as the scrollbar comes and goes.
314
315
 
315
316
  Display names are checked when the config loads: unique, not `table`, and `default` names one. Their fields are checked when the server starts, and may not be [sensitive](data-config.md#sensitive-fields)). In `/api/meta`, a user's displays lose the fields they cannot read, and a custom display whose `props` name one is left out; the list then opens in the table when its default display went.
316
317
 
@@ -359,6 +360,16 @@ An event moves to another day by dragging it, by a long press and drag on a touc
359
360
 
360
361
  `start` must be a filterable date or timestamp field, and `end` a filterable field of the same type, checked when the config loads and when the server starts. [`protobase doctor`](cli.md#doctor)) checks that indexes serve the days' filter on `start`, and on `end` when it is set. In `/api/meta`, a user who cannot read `start` gets the list without the calendar, opening in the table when it was the default, and one who cannot read `end` or `title` gets the calendar without them.
361
362
 
363
+ ### Timelines
364
+
365
+ `d.timeline({ start: r.starts_on, end: r.ends_on, group: r.crew_id, title: r.number })` shows the list's records as a Gantt chart: a row per record, its title on the left (above its bar on a phone), and a bar over the days from its `start` through its `end`, or its start day alone without an `end`. Days, weeks and a timestamp `end` work as on a [calendar](#calendars). The timeline shows a week of seven days from Monday, a month, or a quarter from January, April, July or October, today's day shaded; a bar that starts before the days shown or ends after them is cut square at that edge. With `group`, the rows are in lanes, one for each value a record shown has, each headed by the value and its count: an enum's lanes in the order the field lists its values, headed by their value labels; a relation's by the names of the records it points at; others by value; and last the records without a value, under **No** and the field's label. Within a lane the rows are in start order.
366
+
367
+ The period is in the address, `/jobs?display=timeline&timeline=quarter,2026-10-01`, or `timeline=week,2026-10-12` or `month,2026-10-01`, and the previous, today's and next period, and Week, Month and Quarter, are links to it; without it the timeline shows this month. Switching the scale opens the period holding today when the one shown holds it, else the one holding its first day. An embedded list keeps its timeline's period to itself. It reads the days it shows as a calendar does, through the list API with the list's filter and search, the same 500 records at most and no sort menu.
368
+
369
+ A bar moves along its row by dragging it, by a long press and drag on a touch screen, or from the keyboard: Space on a bar picks it up, the left and right arrow keys move it a day, Space or Enter drops it and Escape puts it back; a screen reader is told the day it starts on. The move saves the record as a calendar's does, with `start` and `end` moved by the same days, so the resource's access rules and `validate` decide, and a refused move puts the bar back with the server's reason. A bar keeps its length; to change it, edit `end` on the record.
370
+
371
+ `start` and `end` are checked as a calendar's are, and `group` may be any field the view may show. `protobase doctor` checks the indexes of its filter as it does a calendar's. In `/api/meta`, a user who cannot read `start` gets the list without the timeline, and one who cannot read `end`, `group` or `title` gets the timeline without them, in one lane when it is `group`.
372
+
362
373
  ### Card photos
363
374
 
364
375
  `photos: { resource, field, image, sort? }` names where a card's further photos come from: the records of `resource` whose relation `field` points at the card's record, in `sort` order, each shown by its file field `image`. The card's picture snaps photo by photo as it is swiped on a touch screen, and shows a left and a right arrow while the pointer is over it. The photos come with the list's records, in the same request through the list API's [`photos`](api.md#card-photos)), so every card on the page has them from the start, and a map's card too. The card's own `image` comes first and is not shown twice when it is among the photos too, and a card steps through ten pictures at most, its own among them; the arrows wrap around at both ends, dots under the picture mark the photo shown, and a card with no further photos has no arrows. Swiping or pressing an arrow does not open the record; tapping the picture does. In a row that scrolls sideways, as an embedded list shows its cards on a phone, a swipe scrolls the row instead, and the arrows show at all times on a touch screen. A card drawn by a `card` component has no arrows.