@protobase/cli 0.55.4 → 0.55.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.
- package/dist/cli/package.js +1 -1
- package/package.json +7 -7
- package/skills/protobase/references/features/record-pages.md +1 -0
- package/skills/protobase/references/features/your-own-code.md +1 -1
- package/skills/protobase/references/reference/custom-components.md +24 -1
- package/skills/protobase/references/reference/layouts.md +1 -1
- package/skills/protobase/references/reference/ui-config.md +12 -0
package/dist/cli/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.55.
|
|
3
|
+
"version": "0.55.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.55.
|
|
46
|
-
"@protobase/layout": "0.55.
|
|
47
|
-
"@protobase/query": "0.55.
|
|
48
|
-
"@protobase/schema": "0.55.
|
|
49
|
-
"@protobase/server": "0.55.
|
|
50
|
-
"@protobase/ui": "0.55.
|
|
45
|
+
"@protobase/config": "0.55.6",
|
|
46
|
+
"@protobase/layout": "0.55.6",
|
|
47
|
+
"@protobase/query": "0.55.6",
|
|
48
|
+
"@protobase/schema": "0.55.6",
|
|
49
|
+
"@protobase/server": "0.55.6",
|
|
50
|
+
"@protobase/ui": "0.55.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",
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
The page of one record, with its sections, related records, galleries, charts and editing.
|
|
6
6
|
|
|
7
7
|
- [Record page layout](../reference/ui-config.md#the-record-page): Sections, a summary sidebar, related tables, maps, charts, galleries, history, comments and your own components.
|
|
8
|
+
- [Full-area record pages](../reference/ui-config.md#full-area-record-pages) (beta): A view draws its record pages with a component of its own that fills the area beside the sidebar and under the top bar, such as a chat channel, and links to the standard page.
|
|
8
9
|
- [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
10
|
- [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
11
|
- [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.
|
|
@@ -13,7 +13,7 @@ React components, field types, pages and handlers of your own, loaded as plugins
|
|
|
13
13
|
- [Form parts](../reference/custom-components.md#form-parts): Build your own forms from the app's fields, pickers, switches, buttons and dialogs.
|
|
14
14
|
- [Image carousel](../reference/custom-components.md#image-carousel): Step through screenshots or a record's files in your own components by swiping or with arrows, as cards step through photos.
|
|
15
15
|
- [Assistant parts](../reference/assistant.md#in-the-ui): The assistant's panel, chat messages, composer and action cards for your own components, with a frameless action card for a page that is already framed.
|
|
16
|
-
- [Chat parts](../reference/custom-components.md#chat-parts): A chat between people from the app's parts: messages with their author, avatar, time and a status line, day and new-message lines, a thread that loads earlier messages, keeps the reader's place, opens on the new-message line, says when the reader has read to the end and jumps to the end when they send, and a composer of several lines with @mentions.
|
|
16
|
+
- [Chat parts](../reference/custom-components.md#chat-parts): A chat between people from the app's parts: messages with their author, avatar, time and a status line, day and new-message lines, a thread that loads earlier messages, keeps the reader's place, opens on the new-message line, says when the reader has read to the end and jumps to the end when they send, and a composer of several lines with @mentions and slots for an attach button and a tray of picked files, which sends files without text and takes pasted and dropped files.
|
|
17
17
|
- [Members' names](../reference/custom-components.md#members-names): The names and photos of the organization's members by user id, for message authors and @mentions in your own components; every member reads them, without email addresses.
|
|
18
18
|
- [Signed-in user](../reference/custom-components.md#members-names): The signed-in person's user id and name in your own components, such as for a filter on their own messages.
|
|
19
19
|
- [Action handlers](../reference/custom-components.md#action-handlers): Your own code for a named action, with the record, the API client and the action's inputs.
|
|
@@ -140,6 +140,29 @@ export const CustomerRepairs = ({ limit }: { limit: number }) => {
|
|
|
140
140
|
|
|
141
141
|
A list that should stay live polls: `useList('repairs', { refetchInterval: 5000 })` refetches every 5 seconds. It is TanStack Query's `refetchInterval`, so it also takes `false` to stop, or a function of the query, and pauses while the tab is in the background.
|
|
142
142
|
|
|
143
|
+
## Full-area record pages
|
|
144
|
+
|
|
145
|
+
A view can make a component the whole record page with [`.record({ component })`](ui-config.md#full-area-record-pages). It gets the record from `useLayoutRecord()`, as a record section does, and fills the area beside the sidebar and under the top bar, where the page does not scroll: a list in it scrolls in a box of its own with `min-h-0 flex-1 overflow-y-auto`, and what follows the list stays at the bottom. It links to the record's standard page, which keeps the form, the related records, Edit and Delete:
|
|
146
|
+
|
|
147
|
+
```tsx
|
|
148
|
+
// components/channel-chat.tsx, exported from protobase.ui.tsx: export { ChannelChat } from './components/channel-chat'
|
|
149
|
+
import { AppLink, useLayoutRecord } from '@protobase/ui'
|
|
150
|
+
|
|
151
|
+
export const ChannelChat = () => {
|
|
152
|
+
const { model, key, record } = useLayoutRecord()!
|
|
153
|
+
return (
|
|
154
|
+
<section className="flex min-h-0 flex-col">
|
|
155
|
+
<header className="flex justify-between border-b px-4 py-2">
|
|
156
|
+
{String(record.name)}
|
|
157
|
+
<AppLink to={{ kind: 'record', resource: model.name, key, standard: true }}>Details</AppLink>
|
|
158
|
+
</header>
|
|
159
|
+
<ol className="min-h-0 flex-1 overflow-y-auto">{/* the messages */}</ol>
|
|
160
|
+
{/* the composer */}
|
|
161
|
+
</section>
|
|
162
|
+
)
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
143
166
|
## Record cards
|
|
144
167
|
|
|
145
168
|
A cards display can draw each card's content with a component, declared in the view with `d.cards(fields, { card })`. The card stays a link to the record, with the display's frame; the component draws what is inside it from `row`, the record with the fields the display names, so name every field the card shows:
|
|
@@ -278,7 +301,7 @@ A chat between people, such as a team's channels, is built from the parts the [a
|
|
|
278
301
|
| `ChatThread` | The scrolling list of messages: `length`, the number of messages, and `empty`, shown while there are none. A reader at the end follows new messages; one who scrolled back stays where they are, until `followKey` changes: change it when the reader sends, such as to a count of their sends, and the thread goes to the end and follows their message in. `onLoadEarlier` adds **Load earlier messages** at the top, with `loadingEarlier` while they come; the earlier messages keep the reader on the message they were reading, never on a `ChatDivider`, which moves when earlier messages of its day load above it. It opens on its `ChatDivider tone="new"` line, near the top, when the messages it first gets hold one, and at the end otherwise. `onReadToEnd` is called while the page shows and the reader is at the end: when it opens there, when a message arrives as they follow, when they scroll to the end and when the page shows again with them there, such as to move their read position. It scrolls inside itself, so the composer under it stays in view. |
|
|
279
302
|
| `ChatMessage` | One message. `author` (`{ id, name }`) draws it on the left beside the author's avatar, under their name and `time`, an ISO timestamp shown on the viewer's clock; `avatar` replaces the initials, such as with a photo, and `continued` leaves out avatar, name and time for a message that follows the same author's. `from: 'user' \| 'assistant'` draws an assistant chat's sides instead. `footer` adds a small line under either, such as whether it was read. |
|
|
280
303
|
| `ChatDivider` | A line across the chat with a label: `label` for a day, such as `chatDayLabel(time)` ("Today", "Yesterday" or the date, on the viewer's calendar) between two messages for which `sameChatDay(a, b)` is false; `tone="new"` for the red **New messages** line. |
|
|
281
|
-
| `Composer` | The box under the chat, which grows with its text: Enter or the button sends, Shift+Enter starts a new line. `onSend` gets the trimmed text and the ids of the people it mentions. With `searchPeople`, a function that returns the `{ id, name }` people whose name matches the text typed after `@`, such as a channel's members, typing `@` lists them above the box: the arrows move, Enter or Tab picks, Escape closes. `busy` keeps the text from being sent. |
|
|
304
|
+
| `Composer` | The box under the chat, which grows with its text: Enter or the button sends, Shift+Enter starts a new line. `onSend` gets the trimmed text and the ids of the people it mentions. With `searchPeople`, a function that returns the `{ id, name }` people whose name matches the text typed after `@`, such as a channel's members, typing `@` lists them above the box: the arrows move, Enter or Tab picks, Escape closes. `busy` keeps the text from being sent. For a message that carries files, `actions` draws an attach button left of the box and `attachments` a tray of the picked files above it, `canSendEmpty` lets Enter and the button send with no text, `onSend('', [])`, and `onFiles` gets the files pasted into the box or dropped on the composer, which uploads nothing itself; a paste that holds text stays text. |
|
|
282
305
|
| `MentionBox`, `MentionedText` | The text box with `@` mentions that the composer and [comments](comments.md) are built from, for a box of your own: `value` and `onChange` hold the text and the people picked (`emptyDraft` to start), and `mentionedIds(text, picked)` the ids still mentioned. `MentionedText` shows a message's `text` with each `@name` of its `mentions` picked out. |
|
|
283
306
|
|
|
284
307
|
The messages' author comes from the server: give the resource [`.author()`](data-config.md#resource), and each create stores the signed-in user's id, never a value the client sends.
|
|
@@ -105,7 +105,7 @@ Every place in the app has an address, and the app writes and reads them in one
|
|
|
105
105
|
| Address | Is |
|
|
106
106
|
| --- | --- |
|
|
107
107
|
| `{ kind: 'list', resource, filter?, orderBy?, display? }` | A resource's list, with the filter, order and [display](ui-config.md#list-displays) the list page would show. |
|
|
108
|
-
| `{ kind: 'record', resource, key, edit?, open?, tab? }` | One record; `key` is its value, or its parts for a composite key. `edit: true` is its form (`?edit=true`), on a view whose record page opens as a [read view or locked](ui-config.md#read-view-and-edit). `open` lists the titles of the record page's collapsed [groups](ui-config.md#groups) that are open (`?open=<title>`, once per group), and `tab` the title of the [tab](ui-config.md#tabs) it shows (`?tab=<title>`). |
|
|
108
|
+
| `{ kind: 'record', resource, key, edit?, open?, tab?, standard? }` | One record; `key` is its value, or its parts for a composite key. `edit: true` is its form (`?edit=true`), on a view whose record page opens as a [read view or locked](ui-config.md#read-view-and-edit). `open` lists the titles of the record page's collapsed [groups](ui-config.md#groups) that are open (`?open=<title>`, once per group), and `tab` the title of the [tab](ui-config.md#tabs) it shows (`?tab=<title>`). `standard: true` is its standard page (`?standard=true`), on a view whose record page is a [component of the app's own](ui-config.md#full-area-record-pages). |
|
|
109
109
|
| `{ kind: 'create', resource, values? }` | The form for a new record, with `values` filled in by field name, as text: `{ kind: 'create', resource: 'notes', values: { listing_id: '{id}' } }` on a listing's page starts a note about that listing. A relation shows the name of the record it points at. The values are a start the person can change, not a rule: what they may write is still up to the access rules. A view with a [create page](ui-config.md#create-pages) shows that page here instead, with the values in the address. |
|
|
110
110
|
| `{ kind: 'page', page, tab? }` | A composed page; `tab` the name of one of its [tabs](blocks.md#tabs-and-tab) (`/<page>/<tab>`), the first when omitted. |
|
|
111
111
|
|
|
@@ -647,6 +647,18 @@ Without a layout the record page shows one section with every field the user may
|
|
|
647
647
|
|
|
648
648
|
A record opened from a list, by its row or its card, shows the fields the list loaded at once, with placeholders for the others, and takes input once the whole record has loaded; actions, custom components, maps and galleries wait for it. What the page shows is read again whenever the browser tab or window regains focus, as are the lists, unless the record has unsaved changes, which keep the version they were made to.
|
|
649
649
|
|
|
650
|
+
### Full-area record pages
|
|
651
|
+
|
|
652
|
+
`.record({ component })` makes the record page at `/<resource>/<key>` a [custom component](custom-components.md#full-area-record-pages) of the app's own, for a record that is used rather than filled in, such as a chat channel. The component fills the content area, at full width beside the sidebar and down to the bottom bar on a phone, and the page does not scroll, so the component scrolls its own parts, such as messages above a box that stays at the bottom. The sidebar, the top bar with its breadcrumb naming the record, the bottom bar and a right panel stay; the heading, Save, the action rail, the sections, the related records and the Details card are not drawn. A record that does not exist, or that the user may not read, shows the record page's usual notice, and the component is never drawn.
|
|
653
|
+
|
|
654
|
+
```ts
|
|
655
|
+
export const ChannelChat = component('ChannelChat')
|
|
656
|
+
|
|
657
|
+
view<typeof channels>('channels').record({ component: ChannelChat })
|
|
658
|
+
```
|
|
659
|
+
|
|
660
|
+
The standard record page, with the layout's sections, the related records, Edit and Delete, stays at the record's address with `?standard=true` (`{ kind: 'record', resource, key, standard: true }`), which the component links to. Links to the record, from relations, search and notifications, open the component's page. Without the component, from a plugin that is off for instance, and when it throws, the standard page shows instead. <gap>A full-area record component cannot take props from the view because props for `.record` are not implemented.</gap>
|
|
661
|
+
|
|
650
662
|
### Read view and edit
|
|
651
663
|
|
|
652
664
|
`.recordMode(mode)` says how the record page opens to a user who may change the record:
|