@protobase/cli 0.97.1 → 0.98.0

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.97.1";
2
+ var version = "0.98.0";
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.97.1",
3
+ "version": "0.98.0",
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.97.1",
47
- "@protobase/layout": "0.97.1",
48
- "@protobase/query": "0.97.1",
49
- "@protobase/schema": "0.97.1",
50
- "@protobase/server": "0.97.1",
51
- "@protobase/ui": "0.97.1",
52
- "@protobase/workflows": "0.97.1",
46
+ "@protobase/config": "0.98.0",
47
+ "@protobase/layout": "0.98.0",
48
+ "@protobase/query": "0.98.0",
49
+ "@protobase/schema": "0.98.0",
50
+ "@protobase/server": "0.98.0",
51
+ "@protobase/ui": "0.98.0",
52
+ "@protobase/workflows": "0.98.0",
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",
@@ -13,3 +13,7 @@ Apps written for other systems that keep working on Protobase, and moving their
13
13
  - [Supabase Storage](../reference/supabase-storage.md) (beta): supabase-js storage calls keep working, over the app's file storage.
14
14
  - [Supabase Realtime](../reference/supabase-realtime.md) (beta): Database changes, broadcast and presence through supabase-js channels, private ones authorized by the policies on `realtime.messages`, broadcasts sent from a server without joining a channel, and broadcasts from the database with `realtime.send()` and `realtime.broadcast_changes()`, across [several processes](../reference/supabase-realtime.md#several-processes) serving one app.
15
15
  - [Edge Functions](../guides/api-functions.md#functions-moved-from-supabase): Functions moved from Supabase answer at their old addresses.
16
+
17
+ ## Template paths
18
+
19
+ - [Paths and scopes](../reference/layouts.md#paths-and-scopes) (beta): Layout paths follow Mustache's context-stack lookup and Handlebars' path grammar: `../`, `this`, `./`, `@root`, `@index`, `@first` and `@last`, though `@root` cannot be read yet. Protobase differs in three ways: a placeholder is escaped for the string it lands in, such as a filter's quoted value, rather than for HTML; `@params` names a page parameter, which the build accepts but a path cannot read yet; and a name no record around it has fails the build instead of drawing empty.
@@ -7,7 +7,8 @@ Pages of your own, built from blocks in a JSX layout.
7
7
  - [Composed pages](../reference/layouts.md#setup): Pages built from a JSX layout, with their own address, sidebar entry and role limits, reading the API under the same access rules as the lists.
8
8
  - [Layout checks](../reference/layouts.md#what-a-layout-may-hold): The build refuses a layout with code, unknown props or unknown fields, and names the file and place.
9
9
  - [Conditions](../reference/layouts.md#conditions): Part of a page shows only while a condition on a record or a count holds.
10
- - [Paths and scopes](../reference/layouts.md#paths-and-scopes) (beta): Layout values resolve through the records around them with Handlebars paths, such as `../name`, `@root` and `@index`; typos and reads that would wait on other reads fail the build, and `Show`, `Switch` and `Match` choose what is drawn.
10
+ - [Paths and scopes](../reference/layouts.md#paths-and-scopes) (beta): Layout values resolve through the records around them with paths relative to those records, such as `../name`, `this.name` and `@index`; typos and reads that would wait on other reads fail the build, and `Show`, `Switch` and `Match` choose what is drawn.
11
+ - [Field values and expanding lines](../reference/layouts.md#field-values) (beta): Layouts show a record's values inline in text and links with react-admin's field components, such as `DateField` and `NumberField`, and a line that opens to show more with `Details` and `Summary`.
11
12
  - [App addresses](../reference/layouts.md#addresses): Links to lists, records, create forms and pages are typed addresses that can carry filters and prefilled values.
12
13
  - [Component fallbacks](../reference/custom-components.md#fallbacks): A custom component declares what a client that cannot draw it shows instead, or nothing, and the web shows it too when the component is missing or throws.
13
14
  - [Text form](../reference/layouts.md#text-form): Every layout block renders to Markdown text through one shared function, built up from its children, as the last-resort fallback and for MCP clients and LLMs.
@@ -25,9 +25,9 @@ export const billing = page(
25
25
  actions={[<Action name="cancel" variant="danger" />, <Action name="upgrade" variant="primary" />]}
26
26
  >
27
27
  <Grid columns={3}>
28
- <Field name="plan.name" label="Plan" />
29
- <Field name="plan.price" label="Per month" />
30
- <Field name="renews_at" />
28
+ <Field source="plan.name" label="Plan" />
29
+ <Field source="plan.price" label="Per month" />
30
+ <Field source="renews_at" />
31
31
  </Grid>
32
32
  <Progress label="Seats" value="seats_used" max="plan.seats" />
33
33
  </RecordCard>
@@ -95,9 +95,9 @@ export const billing = page(
95
95
  actions={[<Action name="cancel" variant="danger" />, <Action name="upgrade" variant="primary" />]}
96
96
  >
97
97
  <Grid columns={3}>
98
- <Field name="plan.name" label="Plan" />
99
- <Field name="plan.price" label="Per month" />
100
- <Field name="renews_at" />
98
+ <Field source="plan.name" label="Plan" />
99
+ <Field source="plan.price" label="Per month" />
100
+ <Field source="renews_at" />
101
101
  </Grid>
102
102
  <Progress label="Seats" value="seats_used" max="plan.seats" />
103
103
  </RecordCard>
@@ -107,10 +107,10 @@ export const billing = page(
107
107
  actions={<ModalForm mode="edit" label="Edit" title="Edit billing details" fields={['company', 'vat_number', 'address', 'email']} />}
108
108
  >
109
109
  <Grid columns={2}>
110
- <Field name="company" />
111
- <Field name="vat_number" />
112
- <Field name="address" />
113
- <Field name="email" />
110
+ <Field source="company" />
111
+ <Field source="vat_number" />
112
+ <Field source="address" />
113
+ <Field source="email" />
114
114
  </Grid>
115
115
  </RecordCard>
116
116
  </Grid>
@@ -139,9 +139,9 @@ export const billing = page(
139
139
  actions={[<Action name="cancel" variant="danger" />, <Action name="upgrade" variant="primary" />]}
140
140
  >
141
141
  <Grid columns={3}>
142
- <Field name="plan.name" label="Plan" />
143
- <Field name="plan.price" label="Per month" />
144
- <Field name="renews_at" />
142
+ <Field source="plan.name" label="Plan" />
143
+ <Field source="plan.price" label="Per month" />
144
+ <Field source="renews_at" />
145
145
  </Grid>
146
146
  <Progress label="Seats" value="seats_used" max="plan.seats" />
147
147
  </RecordCard>
@@ -151,10 +151,10 @@ export const billing = page(
151
151
  actions={<ModalForm mode="edit" label="Edit" title="Edit billing details" fields={['company', 'vat_number', 'address', 'email']} />}
152
152
  >
153
153
  <Grid columns={2}>
154
- <Field name="company" />
155
- <Field name="vat_number" />
156
- <Field name="address" />
157
- <Field name="email" />
154
+ <Field source="company" />
155
+ <Field source="vat_number" />
156
+ <Field source="address" />
157
+ <Field source="email" />
158
158
  </Grid>
159
159
  </RecordCard>
160
160
  </Grid>
@@ -164,9 +164,9 @@ export const billing = page(
164
164
  sort="is_default desc, id"
165
165
  actions={<ModalForm mode="create" label="Add card" resource="payment_methods" fields={['brand', 'last4', 'expires']} />}
166
166
  >
167
- <Field name="brand" label={false} />
168
- <Field name="last4" label="Number" />
169
- <Field name="expires" />
167
+ <Field source="brand" label={false} />
168
+ <Field source="last4" label="Number" />
169
+ <Field source="expires" />
170
170
  <Show when="is_default = true">Default card</Show>
171
171
  <Show when="is_default = false">
172
172
  <Action name="makeDefault" />
@@ -203,9 +203,9 @@ export const billing = page(
203
203
  actions={[<Action name="cancel" variant="danger" />, <Action name="upgrade" variant="primary" />]}
204
204
  >
205
205
  <Grid columns={3}>
206
- <Field name="plan.name" label="Plan" />
207
- <Field name="plan.price" label="Per month" />
208
- <Field name="renews_at" />
206
+ <Field source="plan.name" label="Plan" />
207
+ <Field source="plan.price" label="Per month" />
208
+ <Field source="renews_at" />
209
209
  </Grid>
210
210
  <Progress label="Seats" value="seats_used" max="plan.seats" />
211
211
  <SeatHistory months={6} />
@@ -216,10 +216,10 @@ export const billing = page(
216
216
  actions={<ModalForm mode="edit" label="Edit" title="Edit billing details" fields={['company', 'vat_number', 'address', 'email']} />}
217
217
  >
218
218
  <Grid columns={2}>
219
- <Field name="company" />
220
- <Field name="vat_number" />
221
- <Field name="address" />
222
- <Field name="email" />
219
+ <Field source="company" />
220
+ <Field source="vat_number" />
221
+ <Field source="address" />
222
+ <Field source="email" />
223
223
  </Grid>
224
224
  </RecordCard>
225
225
  </Grid>
@@ -229,9 +229,9 @@ export const billing = page(
229
229
  sort="is_default desc, id"
230
230
  actions={<ModalForm mode="create" label="Add card" resource="payment_methods" fields={['brand', 'last4', 'expires']} />}
231
231
  >
232
- <Field name="brand" label={false} />
233
- <Field name="last4" label="Number" />
234
- <Field name="expires" />
232
+ <Field source="brand" label={false} />
233
+ <Field source="last4" label="Number" />
234
+ <Field source="expires" />
235
235
  <Show when="is_default = true">Default card</Show>
236
236
  <Show when="is_default = false">
237
237
  <Action name="makeDefault" />
@@ -244,8 +244,8 @@ export const billing = page(
244
244
  <Stat label="Open invoices" resource="invoices" filter="status = 'open'" />
245
245
  <RecordCard title="Latest invoice" resource="invoices" sort="issued_at desc" actions={<Action name="download" />}>
246
246
  <Grid columns={2}>
247
- <Field name="number" />
248
- <Field name="total" />
247
+ <Field source="number" />
248
+ <Field source="total" />
249
249
  </Grid>
250
250
  </RecordCard>
251
251
  <Card title="Questions about a bill?">
@@ -95,10 +95,10 @@ export const overview = page(
95
95
  actions={<Action name="markPaid" variant="primary" />}
96
96
  >
97
97
  <Grid columns={4}>
98
- <Field name="number" />
99
- <Field name="total" />
100
- <Field name="company_id" label="Customer" />
101
- <Field name="company_id.city" label="City" />
98
+ <Field source="number" />
99
+ <Field source="total" />
100
+ <Field source="company_id" label="Customer" />
101
+ <Field source="company_id.city" label="City" />
102
102
  </Grid>
103
103
  <Show when="company_id.status = 'dormant'">The customer has gone quiet: call before sending a reminder.</Show>
104
104
  </RecordCard>
@@ -192,10 +192,10 @@ export const overview = page(
192
192
  actions={<Action name="markPaid" variant="primary" />}
193
193
  >
194
194
  <Grid columns={4}>
195
- <Field name="number" />
196
- <Field name="total" />
197
- <Field name="company_id" label="Customer" />
198
- <Field name="company_id.city" label="City" />
195
+ <Field source="number" />
196
+ <Field source="total" />
197
+ <Field source="company_id" label="Customer" />
198
+ <Field source="company_id.city" label="City" />
199
199
  </Grid>
200
200
  <Show when="company_id.status = 'dormant'">The customer has gone quiet: call before sending a reminder.</Show>
201
201
  </RecordCard>
@@ -211,9 +211,9 @@ export const overview = page(
211
211
  sort="created_at desc"
212
212
  actions={<ModalForm mode="create" label="Add lead" resource="companies" fields={['name', 'city', 'email']} values={{ status: 'lead' }} />}
213
213
  >
214
- <Field name="name" label={false} />
215
- <Field name="city" />
216
- <Field name="email" />
214
+ <Field source="name" label={false} />
215
+ <Field source="city" />
216
+ <Field source="email" />
217
217
  <ModalForm mode="edit" label="Edit" fields={['name', 'city', 'email', 'status']} />
218
218
  </CardRow>
219
219
  </Page>,
@@ -36,10 +36,10 @@ export const salesOverview = page(
36
36
  actions={<Action name="markPaid" variant="primary" />}
37
37
  >
38
38
  <Grid columns={2}>
39
- <Field name="number" />
40
- <Field name="total" />
41
- <Field name="company_id" label="Customer" />
42
- <Field name="company_id.city" label="City" />
39
+ <Field source="number" />
40
+ <Field source="total" />
41
+ <Field source="company_id" label="Customer" />
42
+ <Field source="company_id.city" label="City" />
43
43
  </Grid>
44
44
  <Show when="company_id.status = 'dormant'">The customer has gone quiet: call before sending a reminder.</Show>
45
45
  </RecordCard>
@@ -52,10 +52,10 @@ export const salesOverview = page(
52
52
  actions={[<Action name="send" label="Send reminder" />, <Action name="recordPayment" variant="primary" />]}
53
53
  >
54
54
  <Grid columns={2}>
55
- <Field name="number" />
56
- <Field name="total" />
57
- <Field name="company_id" label="Customer" />
58
- <Field name="due_at" label="Due" />
55
+ <Field source="number" />
56
+ <Field source="total" />
57
+ <Field source="company_id" label="Customer" />
58
+ <Field source="due_at" label="Due" />
59
59
  </Grid>
60
60
  </RecordCard>
61
61
  <Card title="Orders per day" description="The last 30 days.">
@@ -79,9 +79,9 @@ export const salesOverview = page(
79
79
  limit={8}
80
80
  actions={<ModalForm mode="create" label="Add lead" resource="companies" fields={['name', 'city', 'country_code', 'email']} values={{ status: 'lead' }} />}
81
81
  >
82
- <Field name="name" label={false} />
83
- <Field name="city" />
84
- <Field name="email" />
82
+ <Field source="name" label={false} />
83
+ <Field source="city" />
84
+ <Field source="email" />
85
85
  <ModalForm mode="edit" label="Edit" fields={['name', 'city', 'email', 'phone', 'status']} />
86
86
  </CardRow>
87
87
  </Page>,
@@ -142,7 +142,7 @@ A box with a heading. Text and `Link`s inside it run together as paragraphs.
142
142
 
143
143
  ### Link
144
144
 
145
- A link in text: `to` an address in the app, or an `href` that leaves it (`https:` opens in a new tab, `mailto:` in the mail app). It shows its children inline, text and `Text as="span"`s, or without them where it leads. It cannot hold another `Link`. With [`className`](layouts.md#tailwind-classes) it drops its own look for those classes.
145
+ A link in text: `to` an address in the app, or an `href` that leaves it (`https:` opens in a new tab, `mailto:` in the mail app). It shows its children inline, text, `Text as="span"`s and [field components](#field-components), or without them where it leads. It cannot hold another `Link` or a `UrlField`. With [`className`](layouts.md#tailwind-classes) it drops its own look for those classes.
146
146
 
147
147
  ```tsx
148
148
  <Link to={{ kind: 'list', resource: 'invoices', filter: "status = 'overdue'" }}>Overdue invoices</Link>
@@ -165,7 +165,7 @@ Plain elements for a page too custom for the blocks, drawn by their [Tailwind cl
165
165
  | `Box` | An element of its own, such as a panel or a banner. No look of its own. |
166
166
  | `Row` | Its children side by side: `flex`. |
167
167
  | `Column` | Its children one under another: `flex flex-col`. |
168
- | `Text` | Text, `Link`s and `Text as="span"`s in it, nothing else, run as one line. `as` makes it `p` (the default), `span`, or a heading `h1` to `h4`. |
168
+ | `Text` | Text, `Link`s, `Text as="span"`s and [field components](#field-components) in it, nothing else, run as one line. `as` makes it `p` (the default), `span`, or a heading `h1` to `h4`. |
169
169
 
170
170
  ```tsx
171
171
  <Row className="items-center gap-3">
@@ -174,6 +174,21 @@ Plain elements for a page too custom for the blocks, drawn by their [Tailwind cl
174
174
  </Row>
175
175
  ```
176
176
 
177
+ ### Details and Summary
178
+
179
+ A line that opens to show the rest and closes again, drawn as HTML's [`<details>` and `<summary>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details), so the browser opens and closes it with no script. A `Details` takes one `Summary`, as its first child; the `Summary` is one line, holding what a `Text` holds. See [Field values](layouts.md#field-values).
180
+
181
+ ```tsx
182
+ <Details>
183
+ <Summary>Brakes, <ChipField source="state" /></Summary>
184
+ <Text>Pads and cables replaced.</Text>
185
+ </Details>
186
+ ```
187
+
188
+ | Prop | |
189
+ | --- | --- |
190
+ | `open` | `Details` only: starts open. |
191
+
177
192
  ### Tabs and Tab
178
193
 
179
194
  `Tabs` splits a page into tabs, each at its own address: the first at the page's (`/<page>`), each other at its name below it (`/<page>/<name>`). Only the shown tab's elements are drawn, so the others load nothing. On a phone the tabs are a select. `Tabs` takes no props and holds only `Tab`s; it sits directly in the `Page`, once per page, with other elements before or after it if you like.
@@ -333,8 +348,8 @@ One record and what is inside it: the one `recordKey` names (the key as the reco
333
348
 
334
349
  ```tsx
335
350
  <RecordCard title="Biggest unpaid delivery" resource="orders" filter="status = 'delivered' AND paid = false" sort="total desc" actions={<Action name="markPaid" variant="primary" />}>
336
- <Field name="number" />
337
- <Field name="company_id.city" label="City" />
351
+ <Field source="number" />
352
+ <Field source="company_id.city" label="City" />
338
353
  </RecordCard>
339
354
  ```
340
355
 
@@ -399,10 +414,18 @@ A label over a value of the record, formatted as on the record page: statuses as
399
414
 
400
415
  | Prop | |
401
416
  | --- | --- |
402
- | `name` | A field, through relations (`company_id.city`). Required. |
403
- | `label` | Default: the view's label, else the name in words. `false` shows the value alone. |
417
+ | `source` | A field, through relations (`company_id.city`), named as react-admin's fields name it. Required. |
418
+ | `label` | Default: the view's label, else the path in words. `false` shows the value alone. |
404
419
  | `format` | Instead of the view's [format](ui-config.md#names-and-columns). |
405
420
 
421
+ ### Field components
422
+
423
+ `TextField`, `NumberField`, `DateField`, `BooleanField`, `UrlField` and `ChipField` show one value of the record inline, in a `Text`, a `Link` or a `Summary`, as [react-admin's field components](https://marmelab.com/react-admin/Fields.html) do. Each takes `source` and `emptyText`; see [Field values](layouts.md#field-values) for their props and where they differ from react-admin's.
424
+
425
+ ```tsx
426
+ <Text>Due <DateField source="due_at" format="relative" />, quoted at <NumberField source="quote" options={{ style: 'currency', currency: 'EUR' }} /></Text>
427
+ ```
428
+
406
429
  ### Progress
407
430
 
408
431
  A bar for `value` out of `max`, with both numbers. It turns amber from 90%.
@@ -60,7 +60,7 @@ Every layout block renders to Markdown text through one shared function, `render
60
60
  ```tsx
61
61
  import { Field, Page, renderText } from '@protobase/layout'
62
62
 
63
- renderText(<Page title="Order"><Field name="status" /></Page>, {
63
+ renderText(<Page title="Order"><Field source="status" /></Page>, {
64
64
  record: { status: 'in_progress' },
65
65
  fields: { status: { label: 'Status', valueLabels: { in_progress: 'In progress' } } },
66
66
  })
@@ -71,9 +71,10 @@ renderText(<Page title="Order"><Field name="status" /></Page>, {
71
71
 
72
72
  | Option | |
73
73
  | --- | --- |
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. 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. |
74
+ | `record` | The record around the tree. `Field`, the [field components](#field-values), `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
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. |
77
+ | `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. |
77
78
  | `basePath` | What links start with, such as `https://example.com/admin`. |
78
79
  | `forms` | Text forms by block type, over the built-in ones. |
79
80
 
@@ -109,32 +110,77 @@ Behaviour comes from [named actions](#named-actions); React code from [custom co
109
110
 
110
111
  A `RecordCard` (its first match) and each card of a `CardRow` hold a **record**. Inside one, `Field`, `Progress`, `Stat field`, `Show`, `Action` and `ModalForm mode="edit"` work on that record, and a `RecordCard`'s header `actions` do too. A field name may follow relations: `company_id.city` is the city of the record's company, fetched like the record page fetches it and cached.
111
112
 
113
+ ## Field values
114
+
115
+ :::caution[Beta]
116
+ React-admin's `ReferenceField`, a related record's value, is not built yet, and these components may still change.
117
+ :::
118
+
119
+ The field components show one value of the record around them inside a line of text: in a `Text`, a `Link` or a `Summary`, beside words and links. They are [react-admin's field components](https://marmelab.com/react-admin/Fields.html), with the same names, props and defaults, so a layout reads as a react-admin page does. `source` is a [path](#paths-and-scopes), and a `source` no record around it has fails the build with the closest field, as any path does.
120
+
121
+ ```tsx
122
+ <RecordCard resource="repairs" recordKey="42">
123
+ <Details>
124
+ <Summary><TextField source="bike" /> <ChipField source="state" /></Summary>
125
+ <Text>Due <DateField source="due_at" format="relative" />, quoted at <NumberField source="quote" options={{ style: 'currency', currency: 'EUR' }} />.</Text>
126
+ <Text>Paid: <BooleanField source="paid" />. Manual: <UrlField source="manual_url" content="Workshop manual" /></Text>
127
+ </Details>
128
+ </RecordCard>
129
+ ```
130
+
131
+ | Component | Shows | Props besides `source` and `emptyText` |
132
+ | --- | --- | --- |
133
+ | [`TextField`](https://marmelab.com/react-admin/TextField.html) | The value as text; an enum value as its label. | |
134
+ | [`NumberField`](https://marmelab.com/react-admin/NumberField.html) | A number, a numeric string read as one, formatted by `Intl.NumberFormat`. | `locales`, `options` |
135
+ | [`DateField`](https://marmelab.com/react-admin/DateField.html) | A date, by default without its time; a date-only value such as `2026-02-15` on its own day in every time zone. | `showDate` (default `true`), `showTime` (default `false`), `locales`, `options`, `format` |
136
+ | [`BooleanField`](https://marmelab.com/react-admin/BooleanField.html) | A check mark for true and the word for false. | `valueLabelTrue`, `valueLabelFalse` |
137
+ | [`UrlField`](https://marmelab.com/react-admin/UrlField.html) | A link to the address the value holds. | `content`, the link's text instead of the address |
138
+ | [`ChipField`](https://marmelab.com/react-admin/ChipField.html) | The value as a badge, in the view's value colours. | |
139
+
140
+ `emptyText` is shown when the value is empty, and nothing is shown without it. `locales` is a locale or a list of them, such as `nl-NL`, and is the reader's language when omitted; `options` are the `Intl` options, such as `{ style: 'currency', currency: 'EUR' }` or `{ dateStyle: 'long' }`, and locales or options `Intl` does not take fail the build. Where Protobase differs from react-admin:
141
+
142
+ - `DateField format="relative"`, which react-admin does not have, shows how long ago or ahead the moment is, such as "3 hours ago", as the lists show relative times. It takes no `showDate`, `showTime`, `locales` or `options`.
143
+ - A `DateField` with `showDate` and `showTime` both false, which react-admin refuses as it draws, fails the build.
144
+ - `UrlField` links only to an `http:`, `https:`, `mailto:` or `tel:` address or a path on the app's own origin; any other address, such as a `javascript:` one, shows as text. It cannot sit in a `Link`, as a link cannot hold a link.
145
+ - `TextField` and `ChipField` show an enum value by its label from the view, where react-admin shows the stored value.
146
+ - Props that take code in react-admin, such as `transform`, `render` or icons, are not taken: a layout holds data only.
147
+
148
+ <gap>A layout cannot show a related record's value inline with react-admin's `ReferenceField` because `ReferenceField` is not implemented.</gap>
149
+
150
+ In the [text form](#text-form) each one reads as its formatted value, a `UrlField` as a Markdown link, and a `BooleanField` as Yes or No.
151
+
152
+ `Details` and `Summary` are HTML's [`<details>` and `<summary>`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details): a line that opens to show the rest and closes again, by the browser alone, with no script. A `Details` takes one `Summary`, as its first child, and `open` to start open; a `Summary` holds one line, as a `Text` does, and sits in a `Details` only. In the text form a `Details` reads as its summary, then the rest.
153
+
112
154
  ## Paths and scopes
113
155
 
114
- A `RecordCard` and each card of a `CardRow` put their record on a stack of records, as each section does in [Mustache](https://mustache.github.io/mustache.5.html): an element inside both a task's `RecordCard` and a `CardRow` of its claims sits in a claim, inside the task. A name in a layout is looked up through that stack, by the rules of the [Mustache spec](https://github.com/mustache/spec) and [Handlebars path expressions](https://handlebarsjs.com/guide/expressions.html#path-expressions):
156
+ :::caution[Beta]
157
+ A path cannot read `@root` or `@params` yet, and a block inside a card or under a condition reads its records only once it draws, as the marked limits below say.
158
+ :::
159
+
160
+ A `RecordCard` and each card of a `CardRow` put their record on a stack of records: an element inside both a task's `RecordCard` and a `CardRow` of its claims sits in a claim, inside the task. A bare name is looked up in the innermost record, then in each record further out, then in the page's own record; the [compatibility page](../features/compatibility.md#template-paths) says which template syntax this follows:
115
161
 
116
162
  | Path | Reads |
117
163
  | --- | --- |
118
164
  | `status` | The nearest record that has a field `status`, then each record around it in turn. |
119
- | `meta.size` | `meta` as above, then `size` from that value only: when it has none, the path is empty, and no record further out is tried (Mustache's "Dotted Names - Context Precedence"). |
165
+ | `meta.size` | `meta` as above, then `size` from that value only: when it has none, the path is empty, and no record further out is tried. |
120
166
  | `../id`, `../../id` | The record one, or two, out from the nearest. |
121
167
  | `this.id`, `./id` | The nearest record only. |
122
168
  | `@index`, `@first`, `@last` | The card's place among a `CardRow`'s cards, from 0, and whether it is the first or the last. |
123
169
  | `@root.id` | The page's own record. <gap>A path cannot read `@root` because pages with a record of their own are not implemented.</gap> |
124
170
  | `@params.window` | The page parameter `window`. <gap>A path cannot read `@params` because the input that sets a page parameter is not implemented.</gap> |
125
171
 
126
- `Field name`, `Stat field`, `Progress`, and the names in a [condition](#conditions) take a path. A string prop takes `{{path}}` placeholders, double braces as in Handlebars, filled with the path's value where the element draws, and empty when it has none:
172
+ `Field source`, a field component's `source`, `Stat field`, `Progress`, and the names in a [condition](#conditions) take a path. A string prop takes `{{path}}` placeholders in double braces, filled with the path's value where the element draws, and empty when it has none:
127
173
 
128
- - `title`, `description`, `empty` and `label` read any path: `<Table resource="claim_steps" title="Steps of {{title}}" />`.
174
+ - `title`, `description`, `empty`, `label`, and a field component's `emptyText`, `content`, `valueLabelTrue` and `valueLabelFalse` read any path: `<Table resource="claim_steps" title="Steps of {{title}}" />`.
129
175
  - `filter`, `recordKey` and `values` read a field of a record around them. A filter takes one only as a top-level `AND` equality, `claim_id = {{id}} AND done = false`, the shape a read can take for every row at once with a [`related()`](api.md#filtering-through-related-records) filter. A filter takes a page parameter anywhere.
130
176
  - `when` takes them where a name cannot go, such as `this.status = '{{../status}}'`, since a name in AIP-160 cannot start with `../` or `@`.
131
177
  - A [link's address](#addresses) takes them in its resource, key, tab, filter, order and values.
132
178
 
133
- A placeholder quoted on its own in a filter or condition, `title = '{{title}}'`, is filled with its quotes and backslashes escaped, so any text stays one value; Handlebars escapes for HTML instead. One inside a longer quoted value, `title = 'about {{title}}'`, fails the build, as it would be filled unescaped. Paths are all a placeholder holds: no helpers, subexpressions, literals, `@key` or `{{{triple braces}}}`. A `{{…}}` that holds anything else fails as soon as the layout loads, before its names are checked.
179
+ A placeholder quoted on its own in a filter or condition, `title = '{{title}}'`, is filled with its quotes and backslashes escaped, so any text stays one value: a placeholder is escaped for the string it lands in, not for HTML. One inside a longer quoted value, `title = 'about {{title}}'`, fails the build, as it would be filled unescaped. Paths are all a placeholder holds: no helpers, subexpressions, literals, `@key` or `{{{triple braces}}}`. A `{{…}}` that holds anything else fails as soon as the layout loads, before its names are checked.
134
180
 
135
181
  The build checks every path where it sits:
136
182
 
137
- - **Typos.** A name no record around it has fails, naming every record searched and the closest field: `"claimd_at" is no field of task_claims, tasks; did you mean claimed_at?`. Mustache would draw it empty, so a layout the build accepts draws the same under Mustache's rules.
183
+ - **Typos.** A name no record around it has fails, naming every record searched and the closest field: `"claimd_at" is no field of task_claims, tasks; did you mean claimed_at?`. A name the build accepts that has no value in a record draws empty.
138
184
  - **Bad roots.** `../` past the outermost record, `@root` on a page without a record, `@index` outside a `CardRow`, and `@params.x` without an input setting `x` fail.
139
185
  - **Reads that would wait.** A per-row value in a filter in any other place than a top-level `AND` equality (with `>=`, inside `OR` or `NOT`, a second one), `@index`, `@first`, `@last` or `this` in a filter, key or values, and any placeholder in `resource`, `sort`, `columns` or `limit` fail with "this would wait for the parent's rows": each block's records are one read of their own, and none may wait for another's rows.
140
186
  - **Shadowing.** A bare name that more than one record around it has reads the nearest, and the build warns which it read and how to write the others: `"id" resolves to task_claims; write ../id for the one of tasks`. `protobase build --strict` fails on it instead. `this.`, `./`, `../` and `@` paths never warn.