@protobase/cli 0.54.5 → 0.54.6

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.
@@ -1,4 +1,4 @@
1
1
  //#region package.json
2
- var version = "0.54.5";
2
+ var version = "0.54.6";
3
3
  //#endregion
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/cli",
3
- "version": "0.54.5",
3
+ "version": "0.54.6",
4
4
  "description": "The protobase command: scaffold, doctor, dev, build and serve a Protobase project.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -42,12 +42,12 @@
42
42
  "dependencies": {
43
43
  "@better-auth/core": "^1.7.12",
44
44
  "@hono/node-server": "^2.1.3",
45
- "@protobase/config": "0.54.5",
46
- "@protobase/layout": "0.54.5",
47
- "@protobase/query": "0.54.5",
48
- "@protobase/schema": "0.54.5",
49
- "@protobase/server": "0.54.5",
50
- "@protobase/ui": "0.54.5",
45
+ "@protobase/config": "0.54.6",
46
+ "@protobase/layout": "0.54.6",
47
+ "@protobase/query": "0.54.6",
48
+ "@protobase/schema": "0.54.6",
49
+ "@protobase/server": "0.54.6",
50
+ "@protobase/ui": "0.54.6",
51
51
  "@react-email/render": "^2.1.0",
52
52
  "@scalar/hono-api-reference": "^0.12.10",
53
53
  "@tailwindcss/vite": "^4.3.3",
@@ -8,6 +8,7 @@ The page of one record, with its sections, related records, galleries, charts an
8
8
  - [Read view and edit](../reference/ui-config.md#read-view-and-edit): A record opens as a read-only fact sheet or a form, and Edit opens the form at its own address.
9
9
  - [Unsaved edits](../reference/ui-config.md#editing-a-record): Unsaved changes to a record stay in the browser and can be resumed, and leaving a form, a dialog or a comment with changes asks first.
10
10
  - [Record forms](../reference/ui-config.md#editing-a-record): Relations are picked from a list that narrows as you type, numbers are read as the browser's language writes them, and a refused save says under each field what is wrong.
11
+ - [Titles per reader](../reference/ui-config.md#titles-per-reader): A record without a name of its own, such as a direct message, is titled for each reader from its fields, such as after the other members, in the sidebar, breadcrumbs, heading, browser tab, relation links and search.
11
12
  - [Save feedback](../reference/ui-config.md#the-record-page): A view shows saving on the Save button instead of in a toast.
12
13
  - [Save conflicts](../reference/ui-config.md#editing-a-record): When someone else changed a record while you edited it, Save shows their value beside yours for each field you both changed, and you keep yours or take theirs.
13
14
  - [Groups and tabs](../reference/ui-config.md#groups): Parts of a record page sit under headings that open on click, or in tabs, and the open ones are kept in the address.
@@ -49,6 +49,7 @@ export const repairsView = view<typeof repairs>('repairs')
49
49
  | --- | --- |
50
50
  | `.names({ singular, plural })` | "New repair", "Repairs" in the sidebar, breadcrumbs and browser tabs. Default: the resource name in words. |
51
51
  | `.title((r) => r.number)` | The field that names a record: in breadcrumbs, browser tabs, the record page's heading, relation links and search results. |
52
+ | `.titleFrom(rule, (r) => [r.member_ids])` | A title derived in the browser for the person reading it, in place of `.title`, by the function `rule` names in the UI config's `titles`, from the fields picked. See [Titles per reader](#titles-per-reader). |
52
53
  | `.searchResult((r) => ({ title?, subtitle? }))` | A record in the [global search](client.md#global-search): `title` is one field or several joined by spaces (`[r.first_name, r.last_name]`, default: `.title`), `subtitle` the line under it (default: the first search field not in the title), replaced by the search field the text matched when neither line shows it. |
53
54
  | `.list((r, d, c) => ({ columns, sort?, search?, filter?, editable?, displays?, default? }))` | The list's columns in order, fields or [related records](#related-records-in-a-list) (`c.related`); the `filter` it [opens with](#a-filter-the-list-opens-with); its starting `sort` as `[[field, 'asc' \| 'desc'], ...]`, on `.sortable()` fields; the fields the search box suggests, among the resource's `.search` fields, which decide what search matches on the server; the columns [edited in their cell](#editing-in-the-list); other ways to show it, see [List displays](#list-displays). `protobase build` fails on a sort or search field outside those. |
54
55
  | `.fields((r) => ({ name: r.name.label(...) }))` | Hints per field, below. Calls add up. |
@@ -61,6 +62,29 @@ export const repairsView = view<typeof repairs>('repairs')
61
62
 
62
63
  A browser tab names what it shows, then the app's name ([`name`](config/app.md#name)): `Nordlicht GmbH · Companies · Protobase` on a record page, the plural on a list, `New company · Companies · Protobase` on the create form, and a composed page's title on that page.
63
64
 
65
+ ### Titles per reader
66
+
67
+ Some records hold no name of their own, such as a direct message, which holds its members' user ids. With `.titleFrom`, each reader sees such a record named for them: Maya sees the conversation as "Sam Okafor", Sam the same record as "Maya Jansen". The view names a function under `titles` in `protobase.ui.tsx` and the fields it reads; the function gets the record and the reader, the signed-in `user` and `member(id)`, the organization's members by user id as [`useMembers()`](custom-components.md#members-names) gives them, and returns the title:
68
+
69
+ ```tsx
70
+ // protobase.views.ts
71
+ view<typeof directMessages>('direct_messages').titleFrom('memberNames', (r) => [r.member_ids])
72
+
73
+ // protobase.ui.tsx
74
+ export default defineUi({
75
+ titles: {
76
+ memberNames: (record, { user, member }) => {
77
+ const others = (record.member_ids as string[]).filter((id) => id !== user?.id).map((id) => member(id)?.name)
78
+ return others.every(Boolean) ? others.join(', ') : undefined
79
+ },
80
+ },
81
+ })
82
+ ```
83
+
84
+ The derived title names the record wherever `.title` would: the sidebar's [recent records](sidebar.md#recent-records), whose list request reads the picked fields too, the breadcrumb, the record page's heading, the browser tab, the links of a record page's relation fields, related cards and the global search, unless the view's `.searchResult` gives a title. The record's key shows while the function returns nothing, such as while the members' names load, and when the reader cannot read a field it picks, or the UI config registers no function of that name. It is presentation only: no field, filter or sort reads it, and the search does not match it. Other members' names come only with organizations; without them, `member` finds no one.
85
+
86
+ <gap>A relation column in a list, a relation picker and a relation filter cannot show a derived title because derived titles for the labels a list reads with its rows are not implemented.</gap>
87
+
64
88
  A click on a row of a list's table opens its record. Its title cell, the `.title` column or else the first, is a link to the record, so Cmd- or Ctrl-click, a middle click and the browser's link menu open it in a new tab or copy its address; embedded lists and the table of a list sorted by hand do the same.
65
89
 
66
90
  Field hints: