@protobase/cli 0.96.4 → 0.96.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 +8 -8
- package/skills/protobase/references/features/composed-pages.md +1 -0
- package/skills/protobase/references/guides/plugin-build.md +1 -1
- package/skills/protobase/references/reference/blocks.md +11 -1
- package/skills/protobase/references/reference/cli.md +1 -1
- package/skills/protobase/references/reference/installable-app.md +1 -1
- package/skills/protobase/references/reference/layouts.md +3 -2
- package/skills/protobase/references/reference/plugins.md +1 -1
package/dist/cli/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@protobase/cli",
|
|
3
|
-
"version": "0.96.
|
|
3
|
+
"version": "0.96.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": {
|
|
@@ -43,13 +43,13 @@
|
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@better-auth/core": "^1.7.12",
|
|
45
45
|
"@hono/node-server": "^2.1.3",
|
|
46
|
-
"@protobase/config": "0.96.
|
|
47
|
-
"@protobase/layout": "0.96.
|
|
48
|
-
"@protobase/query": "0.96.
|
|
49
|
-
"@protobase/schema": "0.96.
|
|
50
|
-
"@protobase/server": "0.96.
|
|
51
|
-
"@protobase/ui": "0.96.
|
|
52
|
-
"@protobase/workflows": "0.96.
|
|
46
|
+
"@protobase/config": "0.96.6",
|
|
47
|
+
"@protobase/layout": "0.96.6",
|
|
48
|
+
"@protobase/query": "0.96.6",
|
|
49
|
+
"@protobase/schema": "0.96.6",
|
|
50
|
+
"@protobase/server": "0.96.6",
|
|
51
|
+
"@protobase/ui": "0.96.6",
|
|
52
|
+
"@protobase/workflows": "0.96.6",
|
|
53
53
|
"@react-email/render": "^2.1.0",
|
|
54
54
|
"@scalar/hono-api-reference": "^0.12.10",
|
|
55
55
|
"@sentry/vite-plugin": "^11.10.0",
|
|
@@ -15,6 +15,7 @@ Pages of your own, built from blocks in a JSX layout.
|
|
|
15
15
|
- [Tailwind classes](../reference/layouts.md#tailwind-classes) (experimental): Layouts can carry Tailwind classes, on plain elements and on blocks, for pages too custom for blocks.
|
|
16
16
|
- [Full-width pages](../reference/blocks.md#page): A page fills the whole area beside the sidebar instead of a centred column, for a dashboard with many blocks.
|
|
17
17
|
- [Data blocks](../reference/blocks.md#data): Counts, tables, single records, rows of cards, field values and progress bars.
|
|
18
|
+
- [Table columns on a phone](../reference/blocks.md#columns-on-a-phone): Table blocks choose which columns show at mobile width by priority, with a sensible default, and fall back to a Markdown table.
|
|
18
19
|
- [Row buttons](../reference/blocks.md#row-buttons) (experimental): A table's rows carry a button labelled by a field of the row, such as its next step; the row decides where it goes: a record tab a field names, a list with a filter built from its fields, or an outside https link a field holds. On mobile width the button sits under the row's first cell.
|
|
19
20
|
- [Record rows](../reference/blocks.md#recordrow): A sideways row of cards for a filter, favorites or saved searches, with a count and new-record marks.
|
|
20
21
|
- [Record cards](../reference/blocks.md#recordcards): Full-width cards with fields and buttons, stacked or in a carousel.
|
|
@@ -39,7 +39,7 @@ Nothing in it has to change: its named component exports, `defineUi({ actions, s
|
|
|
39
39
|
|
|
40
40
|
- **Modules of the shared packages.** `react`, `react/jsx-runtime`, `react-dom` and `@protobase/ui` come from the app, by those names. An import of another module of theirs, such as `react-dom/client` or a file inside `@protobase/ui`, fails the build: import from the package's main entry instead.
|
|
41
41
|
- **Browser work at the top level.** The build loads `protobase.ui.tsx` once in Node to read its field types. Code that touches `window`, `document` or `localStorage` when a module loads fails the build; move it into a component, a hook or a handler.
|
|
42
|
-
- **A data library of its own.** A component that used `@tanstack/react-query` directly found the app's query client while it was built into the app; as a plugin it carries its own copy, which does not. Read through `@protobase/ui`'s hooks (`useList`, `useRecord`, `useClient`), which share the app's cache and session.
|
|
42
|
+
- **A data library of its own.** A component that used `@tanstack/react-query` directly found the app's query client while it was built into the app; as a plugin it carries its own copy, which does not. Read through `@protobase/ui`'s hooks (`useList`, `useRecord`, `useClient`), which share the app's cache and session, or import `useQuery` and `useQueryClient` from `@protobase/ui` instead of `@tanstack/react-query`: they run on the app's client.
|
|
43
43
|
|
|
44
44
|
## 3. Check its styles
|
|
45
45
|
|
|
@@ -225,7 +225,7 @@ The first records of a list, drawn the way the resource's list page draws them:
|
|
|
225
225
|
| Prop | |
|
|
226
226
|
| --- | --- |
|
|
227
227
|
| `resource`, `filter`, `sort` | Which records, in which order. `resource` is required; `sort` defaults to the list's. |
|
|
228
|
-
| `columns` | Field names for the table; default the view's list columns. |
|
|
228
|
+
| `columns` | Field names for the table, or `{ name, priority }` for a column that matters on a phone, 1 the most important; default the view's list columns. See [Columns on a phone](#columns-on-a-phone). |
|
|
229
229
|
| `button` | A [button on each row](#row-buttons) to an address the row's fields name, or to the outside page a field holds; a list of these gives each row the first whose fields it holds. |
|
|
230
230
|
| `bulk` | `true`: rows can be selected, and the view's `bulk` actions run on the selected rows, as on the list page; see [signing several records off](#signing-several-records-off). |
|
|
231
231
|
| `limit` | How many records it shows; default 10. It has no pages: the rest are in the list. Before 0.13 this was `pageSize`, rows per page; rename it. |
|
|
@@ -238,6 +238,16 @@ The first records of a list, drawn the way the resource's list page draws them:
|
|
|
238
238
|
<Table title="Overdue invoices" resource="invoices" filter="status = 'overdue'" sort="issued_at" columns={['number', 'company_id', 'due_at', 'total']} limit={5} empty="Nothing is overdue." />
|
|
239
239
|
```
|
|
240
240
|
|
|
241
|
+
#### Columns on a phone
|
|
242
|
+
|
|
243
|
+
At mobile width, below the `sm` breakpoint (640px), a table shows at most three of its columns, so the ones that matter fit on screen without scrolling sideways; at wider widths it shows them all. Give a column a `priority` to choose it: when any column has one, a phone shows only the columns with a priority, the three lowest numbers. Without priorities, the default comes from the columns themselves: the record's title first, then badge columns such as enums, then the others in the table's order. The columns keep their order in the table.
|
|
244
|
+
|
|
245
|
+
```tsx
|
|
246
|
+
<Table title="Objectives" resource="objectives" columns={['rank', { name: 'title', priority: 2 }, 'points', { name: 'verdict', priority: 1 }]} />
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
On a phone this table shows Title and Verdict; on a wider screen Rank, Title, Points and Verdict. Its [text form](layouts.md#text-form) is a Markdown table with its columns in the same order of importance.
|
|
250
|
+
|
|
241
251
|
#### Row buttons
|
|
242
252
|
|
|
243
253
|
:::caution[Experimental]
|
|
@@ -486,7 +486,7 @@ With a `mobile` section, the server serves the [mobile app](../guides/mobile-app
|
|
|
486
486
|
|
|
487
487
|
An Android or iOS app built with `mobile.publicKey` updates itself from the server it calls, and never shows that it does. Launch waits on nothing: the app starts on the release it set next earlier, or its own files. The shell asks `GET /api/mobile/release` in the background each time the app comes back to the foreground and, while someone is signed in, once the app has drawn, every 15 minutes while it is in view and when the server's Protobase version changes under an open page. It downloads a release it does not run, only the files that changed, and runs it at the next cold start. The session stays in the device's cookie store, so the user stays signed in across the switch.
|
|
488
488
|
|
|
489
|
-
- The splash screen stays up from launch until the
|
|
489
|
+
- The splash screen stays up from launch until the app draws past its loading screens, the sign-in check, `/meta` and the plugins, so someone signed in sees the page from the start cache as it goes. It covers each reload into a release the same way.
|
|
490
490
|
- Right after someone signs in on the app, before it opens, the app takes the server's release and reloads into it, on the same page. Past 20 seconds it opens on the files it runs, and the download goes on for a later start or return.
|
|
491
491
|
- Coming back to the foreground after 5 minutes or more away, the app reloads into a release it downloaded, then returns to the page and scroll position it showed. It does not while a guard holds unsaved changes on the page, or when it was away for less. The app shows no prompt that it was updated: a reload would only start the files it runs again, so it checks for the server's release instead. A push tapped while the app reloads opens its page once the release has drawn.
|
|
492
492
|
|
|
@@ -52,4 +52,4 @@ The app keeps what someone signed in last saw, from the moment they sign in, and
|
|
|
52
52
|
- When the fresh data lands it replaces the cached data in place, and nothing moves.
|
|
53
53
|
- When the refresh fails, such as without a network, the cached data stays muted and a warning replaces the spinner.
|
|
54
54
|
|
|
55
|
-
The start cache holds who is signed in, the app's `/meta` and the latest answer of each query the app read. It has no time limit, only a soft limit of 4 MB: once the answers pass it, those used least recently are dropped, oldest first, until they are back under it. Who is signed in
|
|
55
|
+
The start cache holds who is signed in, the app's `/meta` and the latest answer of each query the app read. It has no time limit, only a soft limit of 4 MB: once the answers pass it, those used least recently are dropped, oldest first, until they are back under it. Who is signed in, `/meta` and the answers of the page on screen when it saves are never dropped, so the next start draws that page whole: the cache can pass 4 MB by that one page. A table embedded in a page reads only the fields it shows, which keeps the page small, unless its actions run on selected rows: those get whole records. It lives in the browser's IndexedDB for the app's origin, or in the app's own storage on a phone. It is emptied when someone signs out, when the session ends and the API answers 401, and when a new Protobase version of the app opens. Visitors and staff signed in as someone keep nothing.
|
|
@@ -73,10 +73,11 @@ renderText(<Page title="Order"><Field name="status" /></Page>, {
|
|
|
73
73
|
| --- | --- |
|
|
74
74
|
| `record` | The record around the tree. `Field`, `Stat field`, `Progress`, `Show` conditions and the `{field}`s of addresses read it, through relations as nested objects (`plan.name`); a count a condition names, such as `billing_profiles.count`, is a key of its own. Without it, a field reads as its label alone, a `Show` reads as all it holds, and addresses keep their `{field}`s. |
|
|
75
75
|
| `fields` | Per field path, its `label` and the `valueLabels` its enum values read as; a field without a label reads under its path. |
|
|
76
|
+
| `tables` | Per `Table` element, the records it shows and its columns (`{ columns: [{ name, label, title?, badge?, valueLabels? }], rows }`), which you loaded; the table then reads as its heading and a Markdown table. Without it, a table reads as its heading. |
|
|
76
77
|
| `basePath` | What links start with, such as `https://example.com/admin`. |
|
|
77
78
|
| `forms` | Text forms by block type, over the built-in ones. |
|
|
78
79
|
|
|
79
|
-
A heading reads at its level: a `Page` title as `#`, a `Tab` label as `##`, and the title of a `Card` and of a data block as `###`, the data block's linked to its records' list as it filters them. A field's value reads as its enum label, a list as its items, and JSON as a code block.
|
|
80
|
+
A heading reads at its level: a `Page` title as `#`, a `Tab` label as `##`, and the title of a `Card` and of a data block as `###`, the data block's linked to its records' list as it filters them. A field's value reads as its enum label, a list as its items, and JSON as a code block. A table's records read as a Markdown table: a header row of labels, a separator row and a row per record, its columns most important first by the same rule a [phone](blocks.md#columns-on-a-phone) uses, each cell on one line with its pipes escaped. `tableMarkdown` gives the same table for records you hold yourself.
|
|
80
81
|
|
|
81
82
|
A text form of your own is a function from its element and its children's text to Markdown. It can use the default as it is (`childrenText`), wrap a built-in form from `textForms`, or rework the children's text, such as a horizontal line between them:
|
|
82
83
|
|
|
@@ -91,7 +92,7 @@ renderText(tree, { forms: { Grid: ruled, Card: noted, SeatChart: childrenText }
|
|
|
91
92
|
|
|
92
93
|
A custom component reads as its [fallback](custom-components.md#fallbacks) when it declares one, and otherwise as what it holds, unless `forms` names it.
|
|
93
94
|
|
|
94
|
-
<gap>A data block's text form cannot
|
|
95
|
+
<gap>A data block's text form cannot read its records itself, such as a table's rows, because reading records for the text form is not implemented.</gap> <gap>A data block other than a `Table` cannot list records you pass because its text form for records is not implemented.</gap> <gap>A field's text form cannot apply its `format`, such as a relative time, because formatting in the text form is not implemented.</gap> <gap>MCP clients cannot read a page's text form because a tool that serves it is not implemented.</gap>
|
|
95
96
|
|
|
96
97
|
## What a layout may hold
|
|
97
98
|
|
|
@@ -72,7 +72,7 @@ export default definePlugin({ name: 'sales-tools', actions: { remindCustomer } }
|
|
|
72
72
|
|
|
73
73
|
It is written as a project's `protobase.ui.tsx` is: each component exported under the PascalCase name the config declares, from a file of its own, and the rest in the default export, `definePlugin({ name, actions, fields, shell, beforeSignIn, extends, ... })` (`defineUi` is the same function), with the keys of [Extension points](#extension-points). Its components use the hooks and components of `@protobase/ui`, which read the API as the signed-in user, under the same access rules as everything else.
|
|
74
74
|
|
|
75
|
-
**Imports.** `react`, `react/jsx-runtime` (the JSX), `react-dom` and `@protobase/ui`, by those names, come from the app. Everything else a plugin imports, its own files, icons or a chart library, is built into it. Other modules of those packages, such as `react-dom/client` or a file inside `@protobase/ui`, fail the build: a copy of its own would not work with the app's. Read data with `@protobase/ui`'s hooks (`useList`, `useRecord`, `useClient`), which share the app's cache: a data library of the plugin's own keeps a cache of its own.
|
|
75
|
+
**Imports.** `react`, `react/jsx-runtime` (the JSX), `react-dom` and `@protobase/ui`, by those names, come from the app. Everything else a plugin imports, its own files, icons or a chart library, is built into it. Other modules of those packages, such as `react-dom/client` or a file inside `@protobase/ui`, fail the build: a copy of its own would not work with the app's. Read data with `@protobase/ui`'s hooks (`useList`, `useRecord`, `useClient`), which share the app's cache: a data library of the plugin's own keeps a cache of its own. For anything else, such as another API's answer, `useQuery` and `useQueryClient` from `@protobase/ui` are TanStack Query's, on the app's own client, so their answers are kept in the [start cache](installable-app.md#starting-from-the-last-pages-seen) and draw on the next start before the network answers.
|
|
76
76
|
|
|
77
77
|
**Styling.** Use Tailwind classes, as the app's own code does. The plugin's stylesheet holds the utilities its files use and nothing else, no reset and no global style, and each reads the app's [tokens](theme.md): `bg-primary` is the app's primary color and `rounded-md` its radius, whatever the app's version and whatever its theme, and a token the app does not set falls back to Tailwind's default.
|
|
78
78
|
|