@protobase/schema 0.58.8 → 0.59.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.
- package/dist/access/roles.d.ts +1 -1
- package/dist/access/roles.js +1 -1
- package/dist/assistant/protocol.d.ts +1 -1
- package/dist/bottom-bar.d.ts +1 -1
- package/dist/bottom-bar.js +1 -1
- package/dist/encrypted-value.d.ts +1 -1
- package/dist/encrypted-value.js +1 -1
- package/dist/field.d.ts +6 -6
- package/dist/field.js +6 -6
- package/dist/fields.d.ts +1 -1
- package/dist/fields.js +1 -1
- package/dist/file-field.d.ts +2 -2
- package/dist/file-field.js +2 -2
- package/dist/filter/where.d.ts +1 -1
- package/dist/filter/where.js +1 -1
- package/dist/layout.d.ts +9 -9
- package/dist/layout.js +9 -9
- package/dist/model.d.ts +38 -38
- package/dist/relation-field.d.ts +1 -1
- package/dist/relation-field.js +1 -1
- package/dist/resource.d.ts +12 -12
- package/dist/resource.js +12 -12
- package/dist/user-menu.d.ts +1 -1
- package/dist/user-menu.js +1 -1
- package/dist/view-actions.d.ts +1 -1
- package/dist/view-actions.js +1 -1
- package/dist/view-columns.d.ts +1 -1
- package/dist/view-columns.js +1 -1
- package/dist/view-displays.d.ts +4 -4
- package/dist/view-displays.js +4 -4
- package/dist/view-field.d.ts +2 -2
- package/dist/view-field.js +2 -2
- package/dist/view.d.ts +17 -17
- package/dist/view.js +17 -17
- package/package.json +1 -1
package/dist/access/roles.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export type RoleLimit = HeldCapability & {
|
|
|
24
24
|
* `{ 'products.read': ['sku', 'price'] }`, `{ 'products.read': { fields: ['name'], filter: 'published = true' } }`.
|
|
25
25
|
* The role `anonymous`, when defined, is what requests without a token act as; it may only read listed fields, and
|
|
26
26
|
* create listed fields through a public form.
|
|
27
|
-
* See [Access](website/src/content/docs/reference/access.mdx#capabilities).
|
|
27
|
+
* See [Access](docs/website/src/content/docs/reference/access.mdx#capabilities).
|
|
28
28
|
*
|
|
29
29
|
* @example
|
|
30
30
|
* ```ts
|
package/dist/access/roles.js
CHANGED
|
@@ -13,7 +13,7 @@ const rolesOf = (user) => user.roles ?? [];
|
|
|
13
13
|
* `{ 'products.read': ['sku', 'price'] }`, `{ 'products.read': { fields: ['name'], filter: 'published = true' } }`.
|
|
14
14
|
* The role `anonymous`, when defined, is what requests without a token act as; it may only read listed fields, and
|
|
15
15
|
* create listed fields through a public form.
|
|
16
|
-
* See [Access](website/src/content/docs/reference/access.mdx#capabilities).
|
|
16
|
+
* See [Access](docs/website/src/content/docs/reference/access.mdx#capabilities).
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
19
|
* ```ts
|
|
@@ -140,7 +140,7 @@ export type AssistantState = {
|
|
|
140
140
|
* What the event stream sends. `state` replaces everything and always comes first on a connection; `message` adds a
|
|
141
141
|
* message or replaces the one with its id; `part` adds a part to a message or replaces the one with its id; `patch`
|
|
142
142
|
* changes the top-level fields, `null` clearing one. A backend in place of the built-in one sends these; see
|
|
143
|
-
* [Another backend](website/src/content/docs/reference/assistant.md#another-backend).
|
|
143
|
+
* [Another backend](docs/website/src/content/docs/reference/assistant.md#another-backend).
|
|
144
144
|
*/
|
|
145
145
|
export type AssistantEvent = {
|
|
146
146
|
/** Replaces the whole state. */
|
package/dist/bottom-bar.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export type BottomBarSource = {
|
|
|
26
26
|
/**
|
|
27
27
|
* Tabs at the bottom of the screen on phones, for the users holding one of `roles`. Export one per group of roles; a
|
|
28
28
|
* role belongs to one bottom bar. `label` names the bar where someone with several switches between them. Its tabs
|
|
29
|
-
* are `m.resource`, `m.page` and `m.link`, at most four. See [Bottom bar](website/src/content/docs/reference/bottom-bar.md).
|
|
29
|
+
* are `m.resource`, `m.page` and `m.link`, at most four. See [Bottom bar](docs/website/src/content/docs/reference/bottom-bar.md).
|
|
30
30
|
*/
|
|
31
31
|
export declare const bottomBar: (options: {
|
|
32
32
|
label: string;
|
package/dist/bottom-bar.js
CHANGED
|
@@ -29,7 +29,7 @@ const items = {
|
|
|
29
29
|
/**
|
|
30
30
|
* Tabs at the bottom of the screen on phones, for the users holding one of `roles`. Export one per group of roles; a
|
|
31
31
|
* role belongs to one bottom bar. `label` names the bar where someone with several switches between them. Its tabs
|
|
32
|
-
* are `m.resource`, `m.page` and `m.link`, at most four. See [Bottom bar](website/src/content/docs/reference/bottom-bar.md).
|
|
32
|
+
* are `m.resource`, `m.page` and `m.link`, at most four. See [Bottom bar](docs/website/src/content/docs/reference/bottom-bar.md).
|
|
33
33
|
*/
|
|
34
34
|
const bottomBar = (options, build) => {
|
|
35
35
|
const model = {
|
|
@@ -8,7 +8,7 @@ export type Encrypted = {
|
|
|
8
8
|
* What record rules, validators and write hooks get in place of an `.encrypted()` field's stored value when it is set;
|
|
9
9
|
* an empty one is `null`. It is the same for every value and carries nothing of it: test it with `== null` or
|
|
10
10
|
* `=== encrypted`, while comparing it loosely or reading it as text throws. See
|
|
11
|
-
* [Encrypted fields](website/src/content/docs/reference/data-config.mdx#encrypted-fields).
|
|
11
|
+
* [Encrypted fields](docs/website/src/content/docs/reference/data-config.mdx#encrypted-fields).
|
|
12
12
|
*/
|
|
13
13
|
export declare const encrypted: Encrypted;
|
|
14
14
|
//#endregion
|
package/dist/encrypted-value.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* What record rules, validators and write hooks get in place of an `.encrypted()` field's stored value when it is set;
|
|
4
4
|
* an empty one is `null`. It is the same for every value and carries nothing of it: test it with `== null` or
|
|
5
5
|
* `=== encrypted`, while comparing it loosely or reading it as text throws. See
|
|
6
|
-
* [Encrypted fields](website/src/content/docs/reference/data-config.mdx#encrypted-fields).
|
|
6
|
+
* [Encrypted fields](docs/website/src/content/docs/reference/data-config.mdx#encrypted-fields).
|
|
7
7
|
*/
|
|
8
8
|
const encrypted = Object.freeze(Object.create(null, { [Symbol.toPrimitive]: { value: () => {
|
|
9
9
|
throw new TypeError("An encrypted field's stored value cannot be read, only whether it is set");
|
package/dist/field.d.ts
CHANGED
|
@@ -87,7 +87,7 @@ export type FieldTypeDef = {
|
|
|
87
87
|
};
|
|
88
88
|
/**
|
|
89
89
|
* A field of a resource, holding values of type `V`, as `f` builds it. Every option returns a new field, so they chain
|
|
90
|
-
* in any order. See [Field options](website/src/content/docs/reference/data-config.mdx#field-options).
|
|
90
|
+
* in any order. See [Field options](docs/website/src/content/docs/reference/data-config.mdx#field-options).
|
|
91
91
|
*/
|
|
92
92
|
export declare class Field<V> {
|
|
93
93
|
/** Its field type. */
|
|
@@ -123,14 +123,14 @@ export declare class Field<V> {
|
|
|
123
123
|
* Stored encrypted with the app's own key (`PROTOBASE_ENCRYPTION_KEY`): the database only ever holds ciphertext. It is
|
|
124
124
|
* sensitive too, so only its reveal decrypts it, and record rules, validators and hooks get a set stored value as
|
|
125
125
|
* {@link encrypted}, never the value. Only `f.text()` takes it. See
|
|
126
|
-
* [Encrypted fields](website/src/content/docs/reference/data-config.mdx#encrypted-fields).
|
|
126
|
+
* [Encrypted fields](docs/website/src/content/docs/reference/data-config.mdx#encrypted-fields).
|
|
127
127
|
*/
|
|
128
128
|
encrypted(): Field<V | Encrypted>;
|
|
129
129
|
/**
|
|
130
130
|
* Revealing it needs a strong sign-in: one that proved a passkey or a second step, made or confirmed in the last
|
|
131
131
|
* `minutes` (15 by default). Otherwise the reveal is refused with `403 strong-sign-in-required`, and the record page
|
|
132
132
|
* asks the person to confirm it's them first. It is sensitive too. See
|
|
133
|
-
* [Recent strong sign-in](website/src/content/docs/reference/data-config.mdx#recent-strong-sign-in).
|
|
133
|
+
* [Recent strong sign-in](docs/website/src/content/docs/reference/data-config.mdx#recent-strong-sign-in).
|
|
134
134
|
*/
|
|
135
135
|
strongSignIn(o?: {
|
|
136
136
|
minutes?: number;
|
|
@@ -151,7 +151,7 @@ export declare class Field<V> {
|
|
|
151
151
|
max(value: number): Field<V>;
|
|
152
152
|
/**
|
|
153
153
|
* A job fills the field from `prompt`, `{field}` replaced by the record's values, after a create, and after an update
|
|
154
|
-
* that changes a field the prompt names, as the user who wrote; see [AI fields and actions](website/src/content/docs/reference/ai.mdx).
|
|
154
|
+
* that changes a field the prompt names, as the user who wrote; see [AI fields and actions](docs/website/src/content/docs/reference/ai.mdx).
|
|
155
155
|
*/
|
|
156
156
|
ai(o: {
|
|
157
157
|
prompt: string;
|
|
@@ -160,7 +160,7 @@ export declare class Field<V> {
|
|
|
160
160
|
* The database keeps the field: a column a trigger on `from`'s table sets to `fn` of the records whose `via` points at
|
|
161
161
|
* this record, in the transaction that writes them. `count` and `sum` are 0 without records; `avg`, `min` and `max`
|
|
162
162
|
* are empty, so their fields are `.optional()`. Empty values are left out, as in SQL. Read-only; `protobase migration`
|
|
163
|
-
* writes the column and its trigger. See [Rollups and formulas](website/src/content/docs/reference/data-config.mdx#rollups-and-formulas).
|
|
163
|
+
* writes the column and its trigger. See [Rollups and formulas](docs/website/src/content/docs/reference/data-config.mdx#rollups-and-formulas).
|
|
164
164
|
*
|
|
165
165
|
* @example
|
|
166
166
|
* ```ts
|
|
@@ -172,7 +172,7 @@ export declare class Field<V> {
|
|
|
172
172
|
* The database computes the field from the record's other number fields: a generated column. `expression` takes
|
|
173
173
|
* numbers, fields, `+ - * /`, parentheses, `coalesce(a, b, ...)` and `round(x, digits)`, computed exactly as decimals and
|
|
174
174
|
* stored as the field's type. Read-only; `protobase migration` writes the column. See
|
|
175
|
-
* [Rollups and formulas](website/src/content/docs/reference/data-config.mdx#rollups-and-formulas).
|
|
175
|
+
* [Rollups and formulas](docs/website/src/content/docs/reference/data-config.mdx#rollups-and-formulas).
|
|
176
176
|
*
|
|
177
177
|
* @example
|
|
178
178
|
* ```ts
|
package/dist/field.js
CHANGED
|
@@ -5,7 +5,7 @@ import { z } from "zod";
|
|
|
5
5
|
const fieldRegistry = z.registry();
|
|
6
6
|
/**
|
|
7
7
|
* A field of a resource, holding values of type `V`, as `f` builds it. Every option returns a new field, so they chain
|
|
8
|
-
* in any order. See [Field options](website/src/content/docs/reference/data-config.mdx#field-options).
|
|
8
|
+
* in any order. See [Field options](docs/website/src/content/docs/reference/data-config.mdx#field-options).
|
|
9
9
|
*/
|
|
10
10
|
var Field = class Field {
|
|
11
11
|
def;
|
|
@@ -60,7 +60,7 @@ var Field = class Field {
|
|
|
60
60
|
* Stored encrypted with the app's own key (`PROTOBASE_ENCRYPTION_KEY`): the database only ever holds ciphertext. It is
|
|
61
61
|
* sensitive too, so only its reveal decrypts it, and record rules, validators and hooks get a set stored value as
|
|
62
62
|
* {@link encrypted}, never the value. Only `f.text()` takes it. See
|
|
63
|
-
* [Encrypted fields](website/src/content/docs/reference/data-config.mdx#encrypted-fields).
|
|
63
|
+
* [Encrypted fields](docs/website/src/content/docs/reference/data-config.mdx#encrypted-fields).
|
|
64
64
|
*/
|
|
65
65
|
encrypted() {
|
|
66
66
|
if (this.meta.type !== "text") throw new Error(".encrypted() takes only f.text() fields");
|
|
@@ -73,7 +73,7 @@ var Field = class Field {
|
|
|
73
73
|
* Revealing it needs a strong sign-in: one that proved a passkey or a second step, made or confirmed in the last
|
|
74
74
|
* `minutes` (15 by default). Otherwise the reveal is refused with `403 strong-sign-in-required`, and the record page
|
|
75
75
|
* asks the person to confirm it's them first. It is sensitive too. See
|
|
76
|
-
* [Recent strong sign-in](website/src/content/docs/reference/data-config.mdx#recent-strong-sign-in).
|
|
76
|
+
* [Recent strong sign-in](docs/website/src/content/docs/reference/data-config.mdx#recent-strong-sign-in).
|
|
77
77
|
*/
|
|
78
78
|
strongSignIn(o = {}) {
|
|
79
79
|
const minutes = o.minutes ?? 15;
|
|
@@ -116,7 +116,7 @@ var Field = class Field {
|
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
118
118
|
* A job fills the field from `prompt`, `{field}` replaced by the record's values, after a create, and after an update
|
|
119
|
-
* that changes a field the prompt names, as the user who wrote; see [AI fields and actions](website/src/content/docs/reference/ai.mdx).
|
|
119
|
+
* that changes a field the prompt names, as the user who wrote; see [AI fields and actions](docs/website/src/content/docs/reference/ai.mdx).
|
|
120
120
|
*/
|
|
121
121
|
ai(o) {
|
|
122
122
|
const error = promptError(o.prompt);
|
|
@@ -127,7 +127,7 @@ var Field = class Field {
|
|
|
127
127
|
* The database keeps the field: a column a trigger on `from`'s table sets to `fn` of the records whose `via` points at
|
|
128
128
|
* this record, in the transaction that writes them. `count` and `sum` are 0 without records; `avg`, `min` and `max`
|
|
129
129
|
* are empty, so their fields are `.optional()`. Empty values are left out, as in SQL. Read-only; `protobase migration`
|
|
130
|
-
* writes the column and its trigger. See [Rollups and formulas](website/src/content/docs/reference/data-config.mdx#rollups-and-formulas).
|
|
130
|
+
* writes the column and its trigger. See [Rollups and formulas](docs/website/src/content/docs/reference/data-config.mdx#rollups-and-formulas).
|
|
131
131
|
*
|
|
132
132
|
* @example
|
|
133
133
|
* ```ts
|
|
@@ -144,7 +144,7 @@ var Field = class Field {
|
|
|
144
144
|
* The database computes the field from the record's other number fields: a generated column. `expression` takes
|
|
145
145
|
* numbers, fields, `+ - * /`, parentheses, `coalesce(a, b, ...)` and `round(x, digits)`, computed exactly as decimals and
|
|
146
146
|
* stored as the field's type. Read-only; `protobase migration` writes the column. See
|
|
147
|
-
* [Rollups and formulas](website/src/content/docs/reference/data-config.mdx#rollups-and-formulas).
|
|
147
|
+
* [Rollups and formulas](docs/website/src/content/docs/reference/data-config.mdx#rollups-and-formulas).
|
|
148
148
|
*
|
|
149
149
|
* @example
|
|
150
150
|
* ```ts
|
package/dist/fields.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { z } from "zod";
|
|
|
5
5
|
//#region src/fields.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* The field builders of a resource's `.fields({ ... })`, one per field type. Each returns a {@link Field} whose options
|
|
8
|
-
* chain in any order. See [Field types](website/src/content/docs/reference/data-config.mdx#field-types).
|
|
8
|
+
* chain in any order. See [Field types](docs/website/src/content/docs/reference/data-config.mdx#field-types).
|
|
9
9
|
*
|
|
10
10
|
* @example
|
|
11
11
|
* ```ts
|
package/dist/fields.js
CHANGED
|
@@ -32,7 +32,7 @@ const make = (def, extra = {}) => new Field(def, {
|
|
|
32
32
|
});
|
|
33
33
|
/**
|
|
34
34
|
* The field builders of a resource's `.fields({ ... })`, one per field type. Each returns a {@link Field} whose options
|
|
35
|
-
* chain in any order. See [Field types](website/src/content/docs/reference/data-config.mdx#field-types).
|
|
35
|
+
* chain in any order. See [Field types](docs/website/src/content/docs/reference/data-config.mdx#field-types).
|
|
36
36
|
*
|
|
37
37
|
* @example
|
|
38
38
|
* ```ts
|
package/dist/file-field.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { FileProcessor, ImageVariant, ImageVariantOptions } from "./files/file-o
|
|
|
2
2
|
import { FieldAccess } from "./access/types.js";
|
|
3
3
|
import { Field, FieldMeta } from "./field.js";
|
|
4
4
|
//#region src/file-field.d.ts
|
|
5
|
-
/** `f.file()`: a text column holding a file's URI, uploaded through `:upload`. See [Files](website/src/content/docs/reference/files.mdx). */
|
|
5
|
+
/** `f.file()`: a text column holding a file's URI, uploaded through `:upload`. See [Files](docs/website/src/content/docs/reference/files.mdx). */
|
|
6
6
|
export declare class FileField<V> extends Field<V> {
|
|
7
7
|
/** Allowed types, checked against the type detected from the content: `['image/*', 'application/pdf']`. */
|
|
8
8
|
accept(types: readonly string[]): FileField<V>;
|
|
@@ -30,7 +30,7 @@ export declare class FileField<V> extends Field<V> {
|
|
|
30
30
|
/**
|
|
31
31
|
* Also takes an https URL of a file elsewhere, such as `https://images.example.com/photos/42.jpg`, stored as it is:
|
|
32
32
|
* never uploaded, without variants, and drawn from that address. See
|
|
33
|
-
* [External URLs](website/src/content/docs/reference/files.mdx#external-urls).
|
|
33
|
+
* [External URLs](docs/website/src/content/docs/reference/files.mdx#external-urls).
|
|
34
34
|
*/
|
|
35
35
|
externalUrls(): FileField<V>;
|
|
36
36
|
/** The column is nullable: the field may hold no file. */
|
package/dist/file-field.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Field } from "./field.js";
|
|
2
2
|
import { checkedAccept, checkedProvider, checkedVariant, checkedVariants, parseSize } from "./files/file-options.js";
|
|
3
3
|
//#region src/file-field.ts
|
|
4
|
-
/** `f.file()`: a text column holding a file's URI, uploaded through `:upload`. See [Files](website/src/content/docs/reference/files.mdx). */
|
|
4
|
+
/** `f.file()`: a text column holding a file's URI, uploaded through `:upload`. See [Files](docs/website/src/content/docs/reference/files.mdx). */
|
|
5
5
|
var FileField = class FileField extends Field {
|
|
6
6
|
/** Allowed types, checked against the type detected from the content: `['image/*', 'application/pdf']`. */
|
|
7
7
|
accept(types) {
|
|
@@ -52,7 +52,7 @@ var FileField = class FileField extends Field {
|
|
|
52
52
|
/**
|
|
53
53
|
* Also takes an https URL of a file elsewhere, such as `https://images.example.com/photos/42.jpg`, stored as it is:
|
|
54
54
|
* never uploaded, without variants, and drawn from that address. See
|
|
55
|
-
* [External URLs](website/src/content/docs/reference/files.mdx#external-urls).
|
|
55
|
+
* [External URLs](docs/website/src/content/docs/reference/files.mdx#external-urls).
|
|
56
56
|
*/
|
|
57
57
|
externalUrls() {
|
|
58
58
|
return this.withFile({ external: true });
|
package/dist/filter/where.d.ts
CHANGED
|
@@ -67,7 +67,7 @@ export declare const createWhere: <R extends Source = Anything>() => {
|
|
|
67
67
|
};
|
|
68
68
|
/**
|
|
69
69
|
* Builds a filter in code instead of writing filter text, for any resource; `createWhere` checks names and values
|
|
70
|
-
* against one. The [Filters](website/src/content/docs/reference/api.md#filters) of the API take what it builds.
|
|
70
|
+
* against one. The [Filters](docs/website/src/content/docs/reference/api.md#filters) of the API take what it builds.
|
|
71
71
|
*
|
|
72
72
|
* @example
|
|
73
73
|
* ```ts
|
package/dist/filter/where.js
CHANGED
|
@@ -143,7 +143,7 @@ const createWhere = () => {
|
|
|
143
143
|
};
|
|
144
144
|
/**
|
|
145
145
|
* Builds a filter in code instead of writing filter text, for any resource; `createWhere` checks names and values
|
|
146
|
-
* against one. The [Filters](website/src/content/docs/reference/api.md#filters) of the API take what it builds.
|
|
146
|
+
* against one. The [Filters](docs/website/src/content/docs/reference/api.md#filters) of the API take what it builds.
|
|
147
147
|
*
|
|
148
148
|
* @example
|
|
149
149
|
* ```ts
|
package/dist/layout.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { ComponentRef, ViewProps } from "./view-displays.js";
|
|
|
4
4
|
//#region src/layout.d.ts
|
|
5
5
|
/**
|
|
6
6
|
* The items of a record page, for a view's `.layout((r) => [...])`, exported as `l`. See
|
|
7
|
-
* [The record page](website/src/content/docs/reference/ui-config.mdx#the-record-page).
|
|
7
|
+
* [The record page](docs/website/src/content/docs/reference/ui-config.mdx#the-record-page).
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
10
|
* ```ts
|
|
@@ -17,7 +17,7 @@ import { ComponentRef, ViewProps } from "./view-displays.js";
|
|
|
17
17
|
*
|
|
18
18
|
* Every item shows on both the form and the read view unless its `when` says `editing` (the form and the create form)
|
|
19
19
|
* or `reading` (the read view and the locked form). See
|
|
20
|
-
* [Form and read view](website/src/content/docs/reference/ui-config.mdx#form-and-read-view).
|
|
20
|
+
* [Form and read view](docs/website/src/content/docs/reference/ui-config.mdx#form-and-read-view).
|
|
21
21
|
*/
|
|
22
22
|
export declare const layout: {
|
|
23
23
|
/**
|
|
@@ -25,7 +25,7 @@ export declare const layout: {
|
|
|
25
25
|
* shown only while the record is edited with `helpWhen: 'editing'` (the view's `.helpWhen(...)` when omitted).
|
|
26
26
|
* `presentation: 'facts'` shows the read view's fields as a row of key facts, as a listing on a real estate site does:
|
|
27
27
|
* each value under its field's `.icon(...)`, or under its label without one, leaving out the empty ones. See
|
|
28
|
-
* [Key facts](website/src/content/docs/reference/ui-config.mdx#key-facts).
|
|
28
|
+
* [Key facts](docs/website/src/content/docs/reference/ui-config.mdx#key-facts).
|
|
29
29
|
*/
|
|
30
30
|
section: (title: string, fields: Ref[], o?: {
|
|
31
31
|
help?: string;
|
|
@@ -39,7 +39,7 @@ export declare const layout: {
|
|
|
39
39
|
* `image` of the records of `photos.resource` whose relation `photos.field` points at the record, in `photos.sort`
|
|
40
40
|
* order, as a cards display's `photos` names them. In the lightbox, a user who may read a photo's record opens its
|
|
41
41
|
* details. Throws without `image` or `photos`. See
|
|
42
|
-
* [Galleries](website/src/content/docs/reference/ui-config.mdx#galleries).
|
|
42
|
+
* [Galleries](docs/website/src/content/docs/reference/ui-config.mdx#galleries).
|
|
43
43
|
*/
|
|
44
44
|
gallery: (title: string, o: {
|
|
45
45
|
image?: Ref;
|
|
@@ -53,7 +53,7 @@ export declare const layout: {
|
|
|
53
53
|
/**
|
|
54
54
|
* A heading over sections and related tables in the main column; `collapsed: true` keeps it closed until the person
|
|
55
55
|
* opens it, or a link to the record does (the address names the open groups by title). Throws on any other item. See
|
|
56
|
-
* [Groups](website/src/content/docs/reference/ui-config.mdx#groups).
|
|
56
|
+
* [Groups](docs/website/src/content/docs/reference/ui-config.mdx#groups).
|
|
57
57
|
*/
|
|
58
58
|
group: (title: string, items: LayoutItemModel[], o?: {
|
|
59
59
|
collapsed?: boolean;
|
|
@@ -63,7 +63,7 @@ export declare const layout: {
|
|
|
63
63
|
* A tab of the record page holding main-column items: sections, groups, related tables, custom components, maps,
|
|
64
64
|
* charts, galleries, history and comments. A view's tabs stand together and show as one strip, the first tab open unless the
|
|
65
65
|
* address names another; items before and after them show on every tab. Throws on a sidebar item or another tab. See
|
|
66
|
-
* [Tabs](website/src/content/docs/reference/ui-config.mdx#tabs).
|
|
66
|
+
* [Tabs](docs/website/src/content/docs/reference/ui-config.mdx#tabs).
|
|
67
67
|
*/
|
|
68
68
|
tab: (title: string, items: LayoutItemModel[]) => LayoutItemModel;
|
|
69
69
|
/** A table of the records of another resource that point at this one, directly or through a join table. */
|
|
@@ -85,7 +85,7 @@ export declare const layout: {
|
|
|
85
85
|
* machine's metric samples, over their timestamp `at`: per minute over the last hour, per 5 minutes over the last day
|
|
86
86
|
* and per hour over the last week, the average or the maximum of each bucket, opening on `range` (default `1h`). A
|
|
87
87
|
* bucket without a sample is a gap. Throws without a series. See
|
|
88
|
-
* [Charts of related records](website/src/content/docs/reference/ui-config.mdx#charts-of-related-records).
|
|
88
|
+
* [Charts of related records](docs/website/src/content/docs/reference/ui-config.mdx#charts-of-related-records).
|
|
89
89
|
*/
|
|
90
90
|
chart: (title: string, o: {
|
|
91
91
|
resource: string;
|
|
@@ -99,7 +99,7 @@ export declare const layout: {
|
|
|
99
99
|
/**
|
|
100
100
|
* The record's changes, newest first: who made each, when, and the fields before and after, only those the user may
|
|
101
101
|
* read. `limit` changes show before Show more (default 10). Needs `.history()` on the resource; a view without a
|
|
102
|
-
* layout shows it last by itself. See [Record history](website/src/content/docs/reference/history.mdx).
|
|
102
|
+
* layout shows it last by itself. See [Record history](docs/website/src/content/docs/reference/history.mdx).
|
|
103
103
|
*/
|
|
104
104
|
history: (title?: string, o?: {
|
|
105
105
|
limit?: number;
|
|
@@ -108,7 +108,7 @@ export declare const layout: {
|
|
|
108
108
|
/**
|
|
109
109
|
* The record's comments, oldest first, with who wrote each and when, and a box to write one; `@` mentions someone who
|
|
110
110
|
* may read the record. Needs `.comments()` on the resource; a view without a layout shows it last by itself. See
|
|
111
|
-
* [Record comments](website/src/content/docs/reference/comments.mdx).
|
|
111
|
+
* [Record comments](docs/website/src/content/docs/reference/comments.mdx).
|
|
112
112
|
*/
|
|
113
113
|
comments: (title?: string, o?: {
|
|
114
114
|
when?: ShowWhen;
|
package/dist/layout.js
CHANGED
|
@@ -3,7 +3,7 @@ import { customComponent } from "./view-displays.js";
|
|
|
3
3
|
//#region src/layout.ts
|
|
4
4
|
/**
|
|
5
5
|
* The items of a record page, for a view's `.layout((r) => [...])`, exported as `l`. See
|
|
6
|
-
* [The record page](website/src/content/docs/reference/ui-config.mdx#the-record-page).
|
|
6
|
+
* [The record page](docs/website/src/content/docs/reference/ui-config.mdx#the-record-page).
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
9
|
* ```ts
|
|
@@ -16,7 +16,7 @@ import { customComponent } from "./view-displays.js";
|
|
|
16
16
|
*
|
|
17
17
|
* Every item shows on both the form and the read view unless its `when` says `editing` (the form and the create form)
|
|
18
18
|
* or `reading` (the read view and the locked form). See
|
|
19
|
-
* [Form and read view](website/src/content/docs/reference/ui-config.mdx#form-and-read-view).
|
|
19
|
+
* [Form and read view](docs/website/src/content/docs/reference/ui-config.mdx#form-and-read-view).
|
|
20
20
|
*/
|
|
21
21
|
const layout = {
|
|
22
22
|
/**
|
|
@@ -24,7 +24,7 @@ const layout = {
|
|
|
24
24
|
* shown only while the record is edited with `helpWhen: 'editing'` (the view's `.helpWhen(...)` when omitted).
|
|
25
25
|
* `presentation: 'facts'` shows the read view's fields as a row of key facts, as a listing on a real estate site does:
|
|
26
26
|
* each value under its field's `.icon(...)`, or under its label without one, leaving out the empty ones. See
|
|
27
|
-
* [Key facts](website/src/content/docs/reference/ui-config.mdx#key-facts).
|
|
27
|
+
* [Key facts](docs/website/src/content/docs/reference/ui-config.mdx#key-facts).
|
|
28
28
|
*/
|
|
29
29
|
section: (title, fields, o = {}) => ({
|
|
30
30
|
kind: "section",
|
|
@@ -41,7 +41,7 @@ const layout = {
|
|
|
41
41
|
* `image` of the records of `photos.resource` whose relation `photos.field` points at the record, in `photos.sort`
|
|
42
42
|
* order, as a cards display's `photos` names them. In the lightbox, a user who may read a photo's record opens its
|
|
43
43
|
* details. Throws without `image` or `photos`. See
|
|
44
|
-
* [Galleries](website/src/content/docs/reference/ui-config.mdx#galleries).
|
|
44
|
+
* [Galleries](docs/website/src/content/docs/reference/ui-config.mdx#galleries).
|
|
45
45
|
*/
|
|
46
46
|
gallery: (title, o) => {
|
|
47
47
|
if (!o.image && !o.photos) throw new Error(`l.gallery "${title}" needs an image field, photos or both`);
|
|
@@ -62,7 +62,7 @@ const layout = {
|
|
|
62
62
|
/**
|
|
63
63
|
* A heading over sections and related tables in the main column; `collapsed: true` keeps it closed until the person
|
|
64
64
|
* opens it, or a link to the record does (the address names the open groups by title). Throws on any other item. See
|
|
65
|
-
* [Groups](website/src/content/docs/reference/ui-config.mdx#groups).
|
|
65
|
+
* [Groups](docs/website/src/content/docs/reference/ui-config.mdx#groups).
|
|
66
66
|
*/
|
|
67
67
|
group: (title, items, o = {}) => {
|
|
68
68
|
const wrong = items.find((item) => item.kind !== "section" && item.kind !== "related");
|
|
@@ -79,7 +79,7 @@ const layout = {
|
|
|
79
79
|
* A tab of the record page holding main-column items: sections, groups, related tables, custom components, maps,
|
|
80
80
|
* charts, galleries, history and comments. A view's tabs stand together and show as one strip, the first tab open unless the
|
|
81
81
|
* address names another; items before and after them show on every tab. Throws on a sidebar item or another tab. See
|
|
82
|
-
* [Tabs](website/src/content/docs/reference/ui-config.mdx#tabs).
|
|
82
|
+
* [Tabs](docs/website/src/content/docs/reference/ui-config.mdx#tabs).
|
|
83
83
|
*/
|
|
84
84
|
tab: (title, items) => {
|
|
85
85
|
const wrong = items.find((item) => item.kind === "sidebar" || item.kind === "tab" || (item.kind === "custom" || item.kind === "map") && item.sidebar);
|
|
@@ -115,7 +115,7 @@ const layout = {
|
|
|
115
115
|
* machine's metric samples, over their timestamp `at`: per minute over the last hour, per 5 minutes over the last day
|
|
116
116
|
* and per hour over the last week, the average or the maximum of each bucket, opening on `range` (default `1h`). A
|
|
117
117
|
* bucket without a sample is a gap. Throws without a series. See
|
|
118
|
-
* [Charts of related records](website/src/content/docs/reference/ui-config.mdx#charts-of-related-records).
|
|
118
|
+
* [Charts of related records](docs/website/src/content/docs/reference/ui-config.mdx#charts-of-related-records).
|
|
119
119
|
*/
|
|
120
120
|
chart: (title, o) => {
|
|
121
121
|
if (o.series.length === 0) throw new Error(`l.chart "${title}" needs at least one series`);
|
|
@@ -134,7 +134,7 @@ const layout = {
|
|
|
134
134
|
/**
|
|
135
135
|
* The record's changes, newest first: who made each, when, and the fields before and after, only those the user may
|
|
136
136
|
* read. `limit` changes show before Show more (default 10). Needs `.history()` on the resource; a view without a
|
|
137
|
-
* layout shows it last by itself. See [Record history](website/src/content/docs/reference/history.mdx).
|
|
137
|
+
* layout shows it last by itself. See [Record history](docs/website/src/content/docs/reference/history.mdx).
|
|
138
138
|
*/
|
|
139
139
|
history: (title = "History", o = {}) => {
|
|
140
140
|
if (o.limit !== void 0 && (!Number.isInteger(o.limit) || o.limit < 1)) throw new Error(`l.history "${title}": limit must be a positive whole number`);
|
|
@@ -148,7 +148,7 @@ const layout = {
|
|
|
148
148
|
/**
|
|
149
149
|
* The record's comments, oldest first, with who wrote each and when, and a box to write one; `@` mentions someone who
|
|
150
150
|
* may read the record. Needs `.comments()` on the resource; a view without a layout shows it last by itself. See
|
|
151
|
-
* [Record comments](website/src/content/docs/reference/comments.mdx).
|
|
151
|
+
* [Record comments](docs/website/src/content/docs/reference/comments.mdx).
|
|
152
152
|
*/
|
|
153
153
|
comments: (title = "Comments", o = {}) => ({
|
|
154
154
|
kind: "comments",
|