@protobase/cli 0.99.13 → 0.99.14

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.99.13";
2
+ var version = "0.99.14";
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.99.13",
3
+ "version": "0.99.14",
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.99.13",
47
- "@protobase/layout": "0.99.13",
48
- "@protobase/query": "0.99.13",
49
- "@protobase/schema": "0.99.13",
50
- "@protobase/server": "0.99.13",
51
- "@protobase/ui": "0.99.13",
52
- "@protobase/workflows": "0.99.13",
46
+ "@protobase/config": "0.99.14",
47
+ "@protobase/layout": "0.99.14",
48
+ "@protobase/query": "0.99.14",
49
+ "@protobase/schema": "0.99.14",
50
+ "@protobase/server": "0.99.14",
51
+ "@protobase/ui": "0.99.14",
52
+ "@protobase/workflows": "0.99.14",
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",
@@ -27,6 +27,7 @@ Pages of your own, built from blocks in a JSX layout.
27
27
  - [Diff block](../reference/blocks.md#diff) (beta): A `Diff` block shows a unified patch the record holds, side by side on wide screens and in one column on a phone; it shows stored patches and does not compute them.
28
28
  - [Image block](../reference/blocks.md#image): A picture one of the app's API functions draws for the reader, such as a system map, at the size and theme the client asks, refreshed on a timer; a client that draws no images shows its alt text, or nothing.
29
29
  - [Chart block](../reference/blocks.md#chart): Counts, sums or averages by value or by date, as bars, lines or a donut, and over time split by a second field.
30
+ - [Timeline block](../reference/blocks.md#timeline) (beta): A `Timeline` block draws records as bars in lanes over time, each bar's parts coloured by a status field and its waits striped, with the chosen bar's details under it.
30
31
  - [Conversations](../reference/blocks.md#conversation): A chat declared in the layout: a thread of a resource's messages under each sender's name and time, following new ones as they arrive, and a box that sends one as the signed-in user.
31
32
  - [Tool calls in threads](../reference/blocks.md#tool-calls): Conversation threads show tool calls in time order, with a status and an expandable input and result.
32
33
  - [Buttons and forms](../reference/blocks.md#behaviour): Buttons for named actions, and create or edit forms in a dialog.
@@ -536,6 +536,39 @@ Counts, sums or averages of the records that match `filter`, per value of a fiel
536
536
 
537
537
  Each value takes its colour from the view's `valueColors`, else an enum value's place among its values, from the [chart tokens](theme.md#tokens). A chart whose field the user cannot read is left out of their page, and a field it cannot group or add up stops the server at startup.
538
538
 
539
+ ### Timeline
540
+
541
+ :::caution[Beta]
542
+ A timeline is read-only: bars cannot be dragged or edited, and it has no zoom; it reads at most 500 records.
543
+ :::
544
+
545
+ Records of `resource` that match `filter` as a timeline, a Gantt chart for projects, orders or work: a lane per value of `lane`, a bar per value of `bar` in it, and each record a segment of its bar from `start` to `end`, coloured by its `color` value. A record without an end runs to now. The time axis runs from the earliest start to the latest end and always fits the page's width, so a phone shows the same time compressed, its lanes stacked under their names, and the page never scrolls sideways. Bars that overlap in time get rows of their own in their lane. Pointing at a bar, or moving focus to it, shows its times and each segment's under the lanes, which a screen reader reads from the bar too, a relation's bar by the name of the record it points at.
546
+
547
+ | Prop | |
548
+ | --- | --- |
549
+ | `resource`, `filter` | The records it draws, the earliest first. `resource` is required. |
550
+ | `lane` | The field whose values each get a lane, in the order they first start, such as a project. Required. |
551
+ | `bar` | The field whose values each get a bar in their lane, its records the bar's segments, such as a task; the record's own key gives a bar per record. Required. |
552
+ | `start`, `end` | Date or timestamp fields where a segment starts and ends. Required. |
553
+ | `color` | An enum field: a segment takes its value's tone or colour from the view's [`valueColors`](ui-config.md#value-tones-and-currencies), else the [chart token](theme.md#tokens) of its place among the enum's values, and is striped for a value the view marks with `.waitingValues(...)`. A legend names the values the bars hold. Required. |
554
+ | `select` | The [page parameter](layouts.md#page-parameters) a bar's choice sets, such as `task`: each bar links to the page with its `bar` value there (`?task=42`), the chosen bar is marked `aria-current`, and the timeline's children draw under it inside the chosen bar's first record, or nothing while none is chosen. |
555
+ | `limit` | How many records it reads at most; default and largest 500. |
556
+ | `title`, `description`, `actions`, `empty`, `span` | As on `Table`. |
557
+
558
+ ```tsx
559
+ <Timeline title="Where the time went" resource="phases" lane="project" bar="task_id" start="started_at" end="ended_at" color="phase" select="task">
560
+ <ReferenceField source="task_id" reference="tasks" />
561
+ </Timeline>
562
+ ```
563
+
564
+ ```ts
565
+ view<typeof phases>('phases').fields((r) => ({
566
+ phase: r.phase.valueLabels({ build: 'Building', ci: 'Waiting for CI' }).valueColors({ build: 'blue', ci: 'amber' }).waitingValues(['ci']),
567
+ }))
568
+ ```
569
+
570
+ Its [text form](layouts.md#text-form) is a Markdown table with a row per segment: its lane, bar, value, start and end under the fields' labels. A timeline whose fields the user cannot read is left out of their page, and a field it cannot draw, such as a `start` that is no date, stops the server at startup.
571
+
539
572
  ## Related records
540
573
 
541
574
  The blocks that repeat over a record's related records, as [related records](layouts.md#related-records) explains, with the names, props and defaults of react-admin's components. `ReferenceManyField`, `ReferenceArrayField` and `ArrayField` hold a list and draw nothing of their own; a `RecordsIterator` or a `Table` without `resource` inside one draws it. Each sits inside a record, whose field it reads.
@@ -73,9 +73,9 @@ renderText(<Page title="Order"><Field source="status" /></Page>, {
73
73
  | --- | --- |
74
74
  | `record` | The record around the tree. `Field`, the [field components](#field-values), `Diff`, `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. The `{{path}}`s of props read it too. Without it, a field reads as its label alone, a condition as holding (a `Show` reads as its children, a `Switch` as its first `Match`), a prop's `{{path}}`s as empty, 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
- | `records` | Per `ReferenceManyField`, `ReferenceArrayField` or `ReferenceField` element and the record around it, the records it holds, which you loaded; its `RecordsIterator` then reads as its children once per record, in that record, and an empty list as its `empty`. Without it, the block reads as a link to its records. An `ArrayField` reads its items from the record around it. For a `RecordCard`, its record, which its children read; for a `CardRow`, its records, its children once per record. For a `Table` with `select`, the row chosen, whose record its children read; without it they read as nothing. It gets the element, the record around it and the element's place in the tree, the pointer the [read plan](#how-a-page-reads-its-data) names its block by. |
76
+ | `records` | Per `ReferenceManyField`, `ReferenceArrayField` or `ReferenceField` element and the record around it, the records it holds, which you loaded; its `RecordsIterator` then reads as its children once per record, in that record, and an empty list as its `empty`. Without it, the block reads as a link to its records. An `ArrayField` reads its items from the record around it. For a `RecordCard`, its record, which its children read; for a `CardRow`, its records, its children once per record. For a `Table` with `select`, the row chosen, and for a `Timeline` with `select`, the chosen bar's first record, whose record its children read; without it they read as nothing. It gets the element, the record around it and the element's place in the tree, the pointer the [read plan](#how-a-page-reads-its-data) names its block by. |
77
77
  | `params` | The [page parameters](#page-parameters) the page's address holds, such as `{ window: '30d' }`, which `@params` and the `SelectInput`s read, each held to its choices. |
78
- | `tables` | Per `Table` element, its place in the tree, the record around it and the records of the list around it (which a table without `resource` shows), 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. |
78
+ | `tables` | Per `Table` or `Timeline` element, its place in the tree, the record around it and the records of the list around it (which a table without `resource` shows), 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. A `Timeline` reads the same way, a row per segment, its columns its `lane`, `bar`, `color`, `start` and `end` fields. |
79
79
  | `locale` | The reader's locale, such as `nl-NL`, in which [field components](#field-values) without `locales` format numbers and dates; the runtime's default when omitted. |
80
80
  | `basePath` | What links start with, such as `https://example.com/admin`. |
81
81
  | `forms` | Text forms by block type, over the built-in ones. |
@@ -164,7 +164,7 @@ On the web, a `Table`, `Thread`, `Chart`, `RecordCards` and `RecordRow` still re
164
164
 
165
165
  The build compiles each page into a read plan: one ordinary API read per data block, each known before any record is read, so all of them start together when the page opens and none waits for another's rows. There is no combined page query: each read is a request of its own. `/api/meta` sends each user the plan of the page as they see it, so it holds no read of a resource they cannot read and no field they cannot read.
166
166
 
167
- - **One read per block.** `Stat`, `RecordCard`, `Table`, `CardRow`, `RecordRow`, `RecordCards`, `Thread`, `Chart`, `ReferenceManyField`, `ReferenceArrayField` and `ReferenceField` each make one list, count or `:aggregate` read. A `Thread`'s tool calls, the row a `Table`'s `select` chose and each `<resource>.count` a condition names are reads of their own. A block under `Show` or `Match` is read anyway: the condition decides only what is drawn.
167
+ - **One read per block.** `Stat`, `RecordCard`, `Table`, `CardRow`, `RecordRow`, `RecordCards`, `Thread`, `Chart`, `Timeline`, `ReferenceManyField`, `ReferenceArrayField` and `ReferenceField` each make one list, count or `:aggregate` read. A `Thread`'s tool calls, the row a `Table`'s or the bar a `Timeline`'s `select` chose and each `<resource>.count` a condition names are reads of their own. A block under `Show` or `Match` is read anyway: the condition decides only what is drawn.
168
168
  - **Fields are derived.** You never write `fields`. Each read asks for its key and every field drawn in its scope: by `Field`s, [field components](#field-values), `{{path}}`s, conditions and table columns, and the fields a nested list ties itself by. A block whose view decides what it draws, such as a `Table` without `columns` or a `RecordRow`, reads every field. So does a read whose records an `Action` or an edit form changes, since it asks for each record's ETag and an ETag covers the whole record. The other reads ask for no ETag.
169
169
  - **A nested read carries the read around it.** A block inside the records of another ties itself to them by a field: a `ReferenceManyField`'s `target`, a `ReferenceField`'s or `ReferenceArrayField`'s `source`, or `task_id = {{id}}` as a top-level `AND` term of a filter. Its read takes that as a [`related()`](api.md#filtering-through-related-records) term holding the outer read's own filter, order and page size, such as `related(task_id, tasks.id, (status = "open"), "id desc", 10)`, never the values of records read first. A `ReferenceArrayField` ties itself by the JSON list of keys the same way, `related(id, tasks.waits, …)`. Terms nest for a list two levels deep.
170
170
  - **Per record, in one read.** Inside a repeated record, such as a `CardRow` or a `RecordsIterator`, a list reads its `perPage` (or `limit`) for each record with [`limit_per`](api.md#first-rows-per-value), and a `Stat` count is one `:aggregate` grouped by the field it ties itself by. Each nested read holds at most 500 records in all, the API's largest page, and the build warns when the records around it times its page are more, as some records would show fewer. A `ReferenceArrayField` there reads one page for all the records around it, of up to `perPage` records for each of them, since one record can sit in several lists. A `RecordRow` there needs a `limit`.
@@ -278,7 +278,9 @@ A `Table` with `select` chooses one of its rows: each row links to the page with
278
278
 
279
279
  In the [text form](#text-form), a `SelectInput` reads as its label and its choice's name, `**Window**: Last 30 days`, from the `params` you pass, and a `select` table's children as the row `records` gives for it.
280
280
 
281
- <gap>A data block other than a `Table`, or a list display such as a map, cannot take `select` because choosing a row there is not implemented.</gap>
281
+ A [`Timeline`](blocks.md#timeline) takes `select` too: a bar links to the page with its `bar` value in the parameter, and its children draw inside the chosen bar's first record.
282
+
283
+ <gap>A data block other than a `Table` or a `Timeline`, or a list display such as a map, cannot take `select` because choosing a row there is not implemented.</gap>
282
284
 
283
285
  ## Conditions
284
286
 
@@ -111,6 +111,7 @@ Field hints:
111
111
  | `.icon(name)` | An icon before the value on a card's meta row: one of the names [actions](layouts.md#named-actions) take, such as `bed`, `calendar` or `cpu`, and above the value in a section of [key facts](#key-facts). Nowhere else shows it. |
112
112
  | `.valueLabels({ value: text })` | How an enum's values read: `r.method.valueLabels({ ideal: 'iDEAL' })`. Only the enum's values are accepted. A value without a label shows as stored (`direct_debit`), so label every value that should read as words. |
113
113
  | `.valueColors({ value: tone or '#hex' })`, `.badgeShape('arrow')` | An enum's badges in a tone per value, or filled with a colour (the text turns white or black, whichever reads), and drawn as arrows pointing right, as on a rating scale. See [Value tones and currencies](#value-tones-and-currencies). The property portal's energy label: `r.energy_label.format('badge').valueColors({ a: '#00a651', g: '#ed1c24' }).badgeShape('arrow')`. Only the enum's values are accepted. |
114
+ | `.waitingValues([value])` | Enum values that mark a wait rather than work, such as `r.phase.waitingValues(['ci'])`: a [`Timeline`](blocks.md#timeline) draws their segments striped, so a wait never reads as work. Only the enum's values are accepted. |
114
115
  | `.widget(name, props?)` | Shows and edits the field with a [field type](plugins.md#field-types) of the project or a plugin, such as `r.status.widget('steps')` or `r.score.widget('rating', { max: 5 })`, or with the built-in [`members`](plugins.md#members), which picks an organization's members into a JSON array of user ids; `props` are plain data. Without it, or on a storage type it does not show, the field shows as it would without the hint. |
115
116
 
116
117
  An enum's value labels show everywhere the admin shows its values: badges, select options, list and related-table cells, filter options and chips, record titles, the sidebar and search results. They are part of the view in `/api/meta`, so an app with its own screens can show them too, and [`enumLabel(value, labels)`](https://docs.protobase.net/api/schema/functions/enumlabel/) from `@protobase/schema` reads a value the same way. A label for a value the enum does not have stops the server at startup, so renaming a value cannot leave a stale label behind.