@antelopejs/agent-skills 0.8.2 → 0.9.7
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/package.json +2 -2
- package/skills/dms-best-practices/REFERENCE.md +7 -46
- package/skills/dms-best-practices/SKILL.md +29 -17
- package/skills/dms-builder-mcp/SKILL.md +3 -1
- package/skills/dms-mockup/SKILL.md +1 -0
- package/skills/dms-mockup/SPEC.md +59 -13
- package/skills/dms-mockup-build/SKILL.md +11 -5
- package/skills/dms-page-design/SKILL.md +40 -16
- package/skills/dms-pages/REFERENCE.md +13 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@antelopejs/agent-skills",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.7",
|
|
4
4
|
"description": "Finds the agent skills that AntelopeJS packages ship, so every tool that loads them sees the same ones.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent-skills",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"engines": {
|
|
50
50
|
"node": ">=20.19"
|
|
51
51
|
},
|
|
52
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "b5065368040fddd3c07ede30dc3edcfc33bfe6b3",
|
|
53
53
|
"scripts": {
|
|
54
54
|
"typecheck": "tsc -p .",
|
|
55
55
|
"release": "release-it"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# dms-best-practices reference
|
|
2
2
|
|
|
3
|
-
Material for [SKILL.md](SKILL.md): mapping design elements to DMS blocks, the
|
|
3
|
+
Material for [SKILL.md](SKILL.md): mapping design elements to DMS blocks, the mockup comparison, the Safe mode question, and the text fallback. The block catalog is the source of truth: `builder_catalog` with the builder MCP, `ListBlockTypes()` from `@antelopejs/interface-dms/base/block-types`, or https://dms.antelopejs.com/docs/components (one page per block).
|
|
4
4
|
|
|
5
5
|
## Design element → DMS block
|
|
6
6
|
|
|
@@ -31,50 +31,11 @@ Material for [SKILL.md](SKILL.md): mapping design elements to DMS blocks, the `p
|
|
|
31
31
|
|
|
32
32
|
Nothing matches — a canvas, a map, a bespoke visualization — → a custom block, under the rules of SKILL.md.
|
|
33
33
|
|
|
34
|
-
##
|
|
34
|
+
## Mockup comparison
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
A variant holds a `tree` (the DMS block with other options), a `sketch` (`{ html, css?, caption?, height? }`: static HTML and CSS standing for the custom block you would build, `height` in px from 80 to 1200, default 320), or both, so the user compares it with the DMS option before any Vue exists. Keep a sketch to the element alone: static markup with no script, event handler, `@import` or external URL (the tool refuses them with `invalid_sketch`), images as `data:` URLs, and the `--sketch-*` theme variables the tool describes for colors, so it follows light and dark mode.
|
|
36
|
+
Build or update a mockup through **dms-mockup**, with the user's design as the mockup's reference: the closest DMS block as the page's tree and, for the custom block, a sketch in the spec. The user annotates the mockup, then **dms-mockup** applies the annotations. Then ask with the asking tool (`ask_user` in the dms-assistant chat):
|
|
39
37
|
|
|
40
38
|
```ts
|
|
41
|
-
preview_blocks({
|
|
42
|
-
title: "Revenue tile",
|
|
43
|
-
description: "Your tile as a DMS KPI card, adjusted, and as a custom block",
|
|
44
|
-
label: "DMS KpiCard",
|
|
45
|
-
tree: {
|
|
46
|
-
type: "KpiCard",
|
|
47
|
-
options: {
|
|
48
|
-
title: "Revenue",
|
|
49
|
-
valueFormat: "currency",
|
|
50
|
-
currencyCode: "EUR",
|
|
51
|
-
staticValue: 48200,
|
|
52
|
-
staticDelta: 12.4,
|
|
53
|
-
showDelta: true,
|
|
54
|
-
showSparkline: true,
|
|
55
|
-
staticSparkline: [31, 34, 33, 38, 41, 39, 44, 48],
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
reference: { attachmentId: "latest", caption: "Your design" },
|
|
59
|
-
variants: [
|
|
60
|
-
{
|
|
61
|
-
label: "DMS, compact",
|
|
62
|
-
tree: {
|
|
63
|
-
type: "KpiCard",
|
|
64
|
-
options: { title: "Revenue", variant: "stat", staticValue: 48200 },
|
|
65
|
-
},
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
label: "Custom sketch",
|
|
69
|
-
sketch: {
|
|
70
|
-
html: "<div class='tile'><span>Revenue</span><strong>€48,200</strong><div class='bars'><i style='height:40%'></i><i style='height:70%'></i><i style='height:100%'></i></div></div>",
|
|
71
|
-
css: ".tile{padding:16px;border:1px solid;border-radius:8px}.bars{display:flex;gap:4px;height:32px;align-items:end}.bars i{width:8px;background:currentColor}",
|
|
72
|
-
caption: "Bars under the figure, as in your design",
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
});
|
|
77
|
-
// then, with the asking tool (ask_user in the dms-assistant chat)
|
|
78
39
|
ask_user({
|
|
79
40
|
questions: [
|
|
80
41
|
{
|
|
@@ -84,7 +45,7 @@ ask_user({
|
|
|
84
45
|
{
|
|
85
46
|
label: "Keep the DMS block",
|
|
86
47
|
description:
|
|
87
|
-
"KpiCard as
|
|
48
|
+
"KpiCard as mocked up; themed, permissioned, editable in the builder",
|
|
88
49
|
},
|
|
89
50
|
{
|
|
90
51
|
label: "Adjust it through its options",
|
|
@@ -104,7 +65,7 @@ ask_user({
|
|
|
104
65
|
|
|
105
66
|
## Safe mode: a custom block is out of reach
|
|
106
67
|
|
|
107
|
-
The builder tools cannot write Vue. Show the closest composition
|
|
68
|
+
The builder tools cannot write Vue. Show the closest composition in a mockup through **dms-mockup** (the text table when there is no mockup tooling), then:
|
|
108
69
|
|
|
109
70
|
```ts
|
|
110
71
|
ask_user({
|
|
@@ -116,7 +77,7 @@ ask_user({
|
|
|
116
77
|
options: [
|
|
117
78
|
{
|
|
118
79
|
label: "Use the DMS composition",
|
|
119
|
-
description: "A Grid of KpiCard per zone, as
|
|
80
|
+
description: "A Grid of KpiCard per zone, as mocked up",
|
|
120
81
|
},
|
|
121
82
|
{
|
|
122
83
|
label: "Turn Safe mode off for this block",
|
|
@@ -129,7 +90,7 @@ ask_user({
|
|
|
129
90
|
});
|
|
130
91
|
```
|
|
131
92
|
|
|
132
|
-
## Text fallback (no
|
|
93
|
+
## Text fallback (no mockup tooling)
|
|
133
94
|
|
|
134
95
|
One table per batch of components, then one closed question per row:
|
|
135
96
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: dms-best-practices
|
|
3
|
-
description: Enforces the rules for building AntelopeJS DMS pages (every page a tree of DMS blocks, custom code only for the missing block, `.meta()` on every custom block), finds the DMS module or block feature a need already has before anything is built (mails, tenants and SaaS, translated fields, archiving) and proposes installing a missing module, decides when to leave DMS blocks and proposes that deviation to the user, and runs the design-fidelity protocol. Use when creating or changing any DMS page, dashboard or screen, before building a feature or business logic in a DMS project (sending an email, tenants or subscriptions, translatable fields, archiving rows), before writing a CustomComponent or Vue for one, or when the user provides a design, mockup, Figma frame or screenshot to reproduce. Not for a question about one block option or DataType (dms-pages).
|
|
3
|
+
description: Enforces the rules for building AntelopeJS DMS pages (every page a tree of DMS blocks, custom code only for the missing block, `.meta()` on every custom block), finds the DMS module or block feature a need already has before anything is built (mails, notifications, tenants and SaaS, permissions and roles, stored secrets, translated fields, archiving) and proposes installing a missing module, decides when to leave DMS blocks and proposes that deviation to the user, and runs the design-fidelity protocol. Use when creating or changing any DMS page, dashboard or screen, before building a feature or business logic in a DMS project (sending an email or a notification, tenants or subscriptions, a permission or a role, a stored secret, translatable fields, archiving rows), before writing a CustomComponent or Vue for one, or when the user provides a design, mockup, Figma frame or screenshot to reproduce. Not for a question about one block option or DataType (dms-pages).
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# DMS best practices
|
|
@@ -9,7 +9,7 @@ Three rules hold for every page, a path runs before any custom block, and a prot
|
|
|
9
9
|
|
|
10
10
|
Three facts about the project change the steps below. **dms-builder-mcp** _Detect what the project has_ tells how to settle them:
|
|
11
11
|
|
|
12
|
-
- **The builder MCP** answers (`builder_catalog` is among your tools), or not. **
|
|
12
|
+
- **The builder MCP** answers (`builder_catalog` is among your tools), or not. **Mockup tooling**: **dms-mockup** is available (its `mockup_*` tools answer), or not.
|
|
13
13
|
- **Safe mode** is on (the builder tools are the only way to write), or not.
|
|
14
14
|
- **The asking tool**: `ask_user` in the dms-assistant chat, your harness's question tool elsewhere, else one closed question in chat.
|
|
15
15
|
|
|
@@ -17,23 +17,36 @@ Three facts about the project change the steps below. **dms-builder-mcp** _Detec
|
|
|
17
17
|
|
|
18
18
|
Run this before any feature, a page or business logic alike. Most needs already have a DMS module or a block feature, and a home-made copy loses its admin pages, permissions and upgrades.
|
|
19
19
|
|
|
20
|
-
1. **List what the project has**: the `@antelopejs/*` dependencies of `package.json`, the modules of `antelope.config.*`, and the synced skills (**skills**). A table is `@RegisterTable("<table>", "<schema>") class X extends Table` with `@Field("<type>") declare <name>: <T>` fields and an inherited `_id` (no primary-key decorator), read and written through `GetModel(BasicDataModel(X))
|
|
20
|
+
1. **List what the project has**: the `@antelopejs/*` dependencies of `package.json`, the modules of `antelope.config.*`, and the synced skills (**skills**). A table is `@RegisterTable("<table>", "<schema>") class X extends Table` with `@Field("<type>") declare <name>: <T>` fields and an inherited `_id` (no primary-key decorator), read and written through `GetModel(BasicDataModel(X))` (a tenant table through its tenant, as _Rights, tenants and messages_ says). From `@antelopejs/interface-database-decorators`: `Table` and `Field` from `/table`, `RegisterTable` from `/schema`, `GetModel` and `BasicDataModel` from `/model`. **database-decorators-interface** has the rest.
|
|
21
21
|
2. **Match the need.** The table holds the needs most often rebuilt. For any other, the module catalog is the resolver's `list` (**interface**): each `dms-*` interface there is a module's contract.
|
|
22
22
|
|
|
23
|
-
| Need
|
|
24
|
-
|
|
|
25
|
-
| An email, its template, its sends
|
|
26
|
-
|
|
|
27
|
-
|
|
|
28
|
-
|
|
|
29
|
-
|
|
|
30
|
-
| A
|
|
31
|
-
|
|
|
32
|
-
|
|
|
23
|
+
| Need | Use |
|
|
24
|
+
| ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
25
|
+
| An email, its template, its sends | `@antelopejs/dms-mailing`: a mail is a template, sent with `SendTemplate` and shipped with `DeclareTemplate` (`@antelopejs/interface-dms-mailing`); the mail provider is its transport only, and holds no template |
|
|
26
|
+
| A notification to a user about an event | `Notification()` from `@antelopejs/interface-dms/notifications`, under a `NotificationSubject` declared per event, so each member turns it on or off in Settings › Notifications |
|
|
27
|
+
| A secret the business stores (an API key, bank credentials) | `@Encrypted({ secretKey })` on a field of a `Table.with(EncryptionModifier)` (`@antelopejs/interface-database-decorators/modifiers/encryption`), the key read from the environment; the form edits it with `SecretType({ revealable: false, copyable: false })` behind a permissioned route, and logs name the field only |
|
|
28
|
+
| Tenants, workspaces, SaaS, plans, subscriptions, billing | `@antelopejs/dms-saas` |
|
|
29
|
+
| An image or file on a record | `@antelopejs/dms-media` (`AssetType`) |
|
|
30
|
+
| A procedure run on a schedule, a webhook or a data event | `@antelopejs/dms-automation` |
|
|
31
|
+
| Translated interface texts, translations for another app | `@antelopejs/dms-lang` |
|
|
32
|
+
| A field in several languages | `@Localized()` on a field of a `Table.with(LocalizationModifier)` (`@antelopejs/interface-database-decorators/modifiers/localization`); the DMS form edits each locale |
|
|
33
|
+
| Archive and restore rows instead of deleting them | `@ArchiveField()` on a `@Field("boolean")` of the `Table`, and `TableViewRoutes.Archive` / `Restore`: both from `@antelopejs/interface-dms/base`, not the decorators |
|
|
34
|
+
| Status tabs, saved views, kanban, footer totals | `TableView` options (**dms-page-design**) |
|
|
33
35
|
|
|
34
36
|
3. **Installed**: load that module's skill, or its contract through **interface**, and build on it. **Absent**: never build a copy. Open with one question, asked with the asking tool, whether you may install it, and show no code or command before it. On yes, run `ajs project modules add @antelopejs/<module>` and build on it.
|
|
35
37
|
4. **Before adding a field, column, route or custom code to a block**, read what the block already offers: `builder_catalog` with the builder MCP, else the block's TSDoc through **interface**: `contract dms base/<block>` (`base/table-view`) lists what it re-exports from each file, and `contract dms base/<block>/<file>` (`base/table-view/meta`, `base/table-view/routes`) prints that file.
|
|
36
38
|
|
|
39
|
+
## Rights, tenants and messages
|
|
40
|
+
|
|
41
|
+
The DMS already decides who may do what, whose data a request reads and who hears about an event. Build on its model as it is:
|
|
42
|
+
|
|
43
|
+
- **Every right is a DMS permission**, granted per role in the Roles editor. A page's or a block's own permission and a permissioned `.action()` are checked with `@AuthUserWithPermission(<page, block or action>)` on the route. A right no block carries is a `RegisterPermission` id (`@antelopejs/interface-dms/permissions`), checked with `HasPermission` over `GetEffectiveUserPermissions`. Code names permission ids only, and the role holding them is the administrator's choice. A permission grants what the DMS says it grants; `RegisterPermissionsResolver` is for a module gating by plan or quota (the dms-saas plan gate).
|
|
44
|
+
- **A role you propose for non-administrators** holds none of the grants the Roles editor flags as "Owner-level access" (adding and editing members, editing invitations, adding, editing and deleting roles).
|
|
45
|
+
- **Business data lives in tenant tables**, registered in the tenant schema (`TENANT_SCHEMA_NAME`, from `@antelopejs/interface-dms/constants`). A request reads them through `@TenantScopedModel(Model)` (`@antelopejs/interface-dms/tenant-scoped-model`), on the route handler or the `DataController`'s model field; a job or a hook with no request through `GetModel(Model, tenantId)`. A model with no tenant reads the default instance, not the request's workspace. A test reads as two tenants, finds only each one's rows, and is refused another tenant's.
|
|
46
|
+
- **One company's data is tenant data**: its clients, numbering, legal notices, bank details and settings live in tenant tables, edited from the app, and the code holds none of them as a constant. With dms-saas, the workspace name and logo are its General settings.
|
|
47
|
+
- **Publish tenant data with the tenant id**: a `PublishMessage` about one workspace's data passes `{ tenantId }`, or it wakes the page of every workspace.
|
|
48
|
+
- **A notification or a mail about an action goes to the people the record names** (the assignee, the owner), the actor left out, through `toUser` / `toUsers`.
|
|
49
|
+
|
|
37
50
|
## The rules
|
|
38
51
|
|
|
39
52
|
1. **A page is always blocks.** Describe every page on the backend as a tree of DMS blocks: `PeriodSelector`, `Grid` / `GridRow`, `KpiCard`, `TableView`, `Form`, … Each static field and each `.child()` is a line in the roles editor, a `.watch()` target, a `periodScope` subscriber and a node the builder can move. One block that draws the whole screen loses all of that.
|
|
@@ -77,9 +90,9 @@ An order details page, say, becomes a header with a status badge, a `TableView`
|
|
|
77
90
|
Run this path before writing a `CustomComponent` or its Vue, one element at a time:
|
|
78
91
|
|
|
79
92
|
1. **Search the catalog.** With the builder MCP, `builder_catalog`; otherwise the block catalog of the running DMS (`GET /api/block-preview/types`), else `ListBlockTypes()` from `@antelopejs/interface-dms/base/block-types` or the exports of `@antelopejs/interface-dms/base`. Try the block's options first, then a composition of blocks (`Card` + `KeyValueList`, `ChartCard` + a chart, `Grid` of `KpiCard`).
|
|
80
|
-
2. **Show the comparison.**
|
|
93
|
+
2. **Show the comparison.** With mockup tooling, build or update a mockup through **dms-mockup**: the closest DMS option as the page's tree, the user's design as reference, a sketch of the custom block in the spec; have the user annotate it, and apply the annotations. Without it, write the text table of [REFERENCE.md](REFERENCE.md).
|
|
81
94
|
3. **Ask.** One closed question with the asking tool, three options: _Keep the DMS block_ / _Adjust it through its options_ / _Build a custom block_.
|
|
82
|
-
4. **Build.** On _Adjust_, change the block's options and
|
|
95
|
+
4. **Build.** On _Adjust_, change the block's options and update the mockup. Only on _Build a custom block_, build that block alone, under the rules above, with `.meta()`; the rest of the page stays blocks.
|
|
83
96
|
|
|
84
97
|
In **Safe mode** step 4 is out of reach, since the builder tools cannot write Vue: say so, offer the closest DMS composition, and ask whether to turn Safe mode off for that one block.
|
|
85
98
|
|
|
@@ -94,7 +107,7 @@ Run it whenever the user hands you a design, mockup or screenshot. When the user
|
|
|
94
107
|
- _DMS equivalents_: map every component to its closest DMS block silently; an element no block or composition covers still goes through the path;
|
|
95
108
|
- _Component by component_ (**recommended**): decide each visible difference together.
|
|
96
109
|
2. **Map** every component of the design to its closest DMS block ([REFERENCE.md](REFERENCE.md) has the mapping table). Differences the right-hand column of the table above lists never trigger a question.
|
|
97
|
-
3. **Decide.** _Component by component_: run [the path](#before-any-custom-block) for each visible difference (layout, a missing element, another chart kind), batching several components in one
|
|
110
|
+
3. **Decide.** _Component by component_: run [the path](#before-any-custom-block) for each visible difference (layout, a missing element, another chart kind), batching several components in one mockup and one question. _Pixel perfect_ answers step 3 of the path for every element, so skip that question but still run step 1: only the parts no block or composition matches become custom.
|
|
98
111
|
4. **Build** under the rules above.
|
|
99
112
|
|
|
100
113
|
The protocol is done when every visibly different component has an answer and every custom block in the page carries `.meta()`.
|
|
@@ -109,5 +122,4 @@ A `docs/<path>` link is `https://dms.antelopejs.com/docs/<path>`.
|
|
|
109
122
|
- An automation action with side effects (email, notification, write) declares `dryRun(input, ctx)`: it checks the input as `execute` would and acts on nothing, so a builder Test run sends nothing (`docs/building/backend-services`, Test runs).
|
|
110
123
|
- Locale values escape vue-i18n's special characters as literals (`{'@'}`, `{'{'}`, `{'}'}`, `{'|'}`): a raw `@` or brace breaks the message's compilation (`docs/building/localization`, Special characters).
|
|
111
124
|
- Data comes from routes (`fetchUrl`) rather than options computed at registration; a custom block reads its route with `useApiData` (server-rendered, refreshed with the page) and writes with `$authFetch`.
|
|
112
|
-
- Publish tenant data with the tenant id: a `PublishMessage` about one workspace's data passes `{ tenantId }`, or it wakes the page of every workspace.
|
|
113
125
|
- Verified live, as **dms-builder-mcp** _Verify_ says, or in the browser without the MCP (**dms-project**). The build typechecks `src/` only.
|
|
@@ -42,7 +42,7 @@ Settle these three before the first edit. They decide every later branch.
|
|
|
42
42
|
4. **Build the blocks.** A whole page, or a set of blocks, goes in one `builder_compose_page` call: the blocks as an ordered tree, each data block with its `query` inline. Preview it first (`"preview": true`), as **dms-page-design** _Build a page in one call_ says. For one block, `builder_add_block`: omit `parent` for a top-level block or pass a container's BlockPath; `name` unique among siblings. A controller-leading block (catalog `controllerArg: true`, e.g. `TableView`) takes `controller` = the resource `ref`; other types refuse it.
|
|
43
43
|
5. **Configure or rearrange.** `builder_configure_block` merges options (`replace: true` overwrites); `builder_configure_table_view` sets a table's displays, views and footer. Children change only through `builder_add_block`, `builder_move_block` and `builder_remove_block` (which removes the subtree).
|
|
44
44
|
6. **Pages and categories.** `builder_configure_page` edits displayName, icon, order, description, `hidden` and `category` (a move changes the page's ref and route); `builder_delete_page` removes a page and its barrel import; `builder_create_category`, `builder_configure_category` and `builder_delete_category` manage categories; `builder_create_category` with `section: true` writes a sidebar section (a `RootCategory`, `type: "label"`), as a mockup's `categories` need, where a plain call writes a collapsible category. A category delete is refused with `referential_integrity` while a page references it.
|
|
45
|
-
7. **Verify.** A typecheck-clean edit can still fail at runtime (a `fetchUrl` that 404s). Before the write, the `builder_compose_page` preview answers each block's data status. After it, `query_logs` shows the host's reload and runtime output, and `navigate_to_page` answers the page's dashboard URL (`unknown_route` until the reload registers the page); it drives no browser. Open that URL with your browser tool when you have one and look at every block; without one, give the URL to the user and ask them to check it. The step is done when every block the change touched shows data and the logs show no error from it.
|
|
45
|
+
7. **Verify.** A typecheck-clean edit can still fail at runtime (a `fetchUrl` that 404s). Before the write, the `builder_compose_page` preview answers each block's data status. After it, `query_logs` shows the host's reload and runtime output, and `navigate_to_page` answers the page's dashboard URL (`unknown_route` until the reload registers the page); it drives no browser. Open that URL with your browser tool when you have one and look at every block; without one, give the URL to the user and ask them to check it. Reload the page once: it shows the same blocks and data. With `page_verify` among your tools, call it on the page with `viewports` `desktop`, `mobile` and `{ "name": "phone-360", "width": 360, "height": 780 }`: it checks for every role of the workspace whether the page opens as its grants say, and a role no member holds alone stays unchecked, which your report names. The step is done when every block the change touched shows data and the logs show no error from it.
|
|
46
46
|
|
|
47
47
|
On the code path, verify with the project's typecheck (the `typecheck` MCP tool, or the project's own script), then open the page in the browser as **dms-pages** _Verify in the browser_ says.
|
|
48
48
|
|
|
@@ -52,6 +52,8 @@ A **resource** is the data a table or form shows: a `Table` + `Model` and a `Dat
|
|
|
52
52
|
|
|
53
53
|
A **query** is a derived-data endpoint on a page: an aggregate or one point per group, backed by a generated model method. Its `response` matches the block: `value` for a `KpiCard`, `card` for a `ChartCard`, `items` for a `TopListCard`, `series` for a bare chart. Run `builder_query_templates` and `builder_preview_query` first, add it with `builder_add_query` on the page that shows it, and wire the returned `route` as the block's `fetchUrl`.
|
|
54
54
|
|
|
55
|
+
A KPI that is a share or a rate (a ratio of two counts or two sums: utilisation rate, conversion rate) uses the `ratio` template, never one of its two sides: `params: { numerator: { op: "count", where: [...] }, denominator: { op: "count" } }`, `response: "value"`, and `valueFormat: "percent"` on the `KpiCard`. It answers in percent (25 for a quarter), which that format divides by 100; a zero denominator leaves the value out and the card shows its empty state. `compare: true` works with it. Utilisation rate = bikes rented / bikes: `{ "page": "/dashboard", "name": "utilisationRate", "resource": "bike", "template": "ratio", "params": { "numerator": { "op": "count", "where": [{ "field": "status", "op": "eq", "value": "rented" }] }, "denominator": { "op": "count" } }, "response": "value" }`. In code the model method returns `percentOf(numeratorQuery, denominatorQuery)` from `@antelopejs/interface-dms/base/query-response`.
|
|
56
|
+
|
|
55
57
|
Fields take per-column presentation (`display`, `group`, `isVisible`, `size`, `cellWrap`, `description`) and `builder_configure_column_groups` writes form groups, in Safe mode too: see REFERENCE.md _Column presentation_. [REFERENCE.md](REFERENCE.md) has the resource and query workflows, field rules, `$param` binding and opaque queries.
|
|
56
58
|
|
|
57
59
|
## Theme and branding
|
|
@@ -38,6 +38,7 @@ For each wish, find the closest DMS block or composition in the catalog, with th
|
|
|
38
38
|
- **A block covers it** (through its options or a composition): use it. A difference the theme or the options handle is no question.
|
|
39
39
|
- **Nothing covers it, or the user asked for exactly this look**: propose the choice as **dms-best-practices** _Before any custom block_ says, with the closest DMS option beside a **sketch** of the custom part, one closed question per element or batch: _Keep the DMS block_ / _Adjust it through its options_ / _Build a custom block_. Only _Build a custom block_ puts a sketch in the spec.
|
|
40
40
|
- **A whole page no arrangement of blocks draws** goes through the same choice, offering a **custom page** ([SPEC.md](SPEC.md) _Custom pages_) in place of a custom block. The mockup draws it as one sketch; the build splits it into blocks.
|
|
41
|
+
- **A DMS module covers it** (the table of **dms-best-practices** _Match the need_: mails, tenants and SaaS, media, automation, translations): write its catalog id in the spec's top-level `modules` ([SPEC.md](SPEC.md) _Modules_), such as `"mailing"`, and sketch no copy of what the module provides. Its admin pages come with the module; sketch only the pages of the app that read its data.
|
|
41
42
|
- **A sidebar part no module provides** (a plan card, a help box) is a **sidebar widget** ([SPEC.md](SPEC.md) _Sidebar widgets_).
|
|
42
43
|
|
|
43
44
|
This step is done when every wish maps to a block, a composition, or a sketch the user chose.
|
|
@@ -15,6 +15,7 @@ Fallback with no running DMS: `@antelopejs/dms` ships the same files at `node_mo
|
|
|
15
15
|
"$schema": "../../node_modules/@antelopejs/dms/data/mockup-spec.schema.json",
|
|
16
16
|
"version": 1,
|
|
17
17
|
"title": "Order desk",
|
|
18
|
+
"modules": ["mailing", "media"],
|
|
18
19
|
"categories": [
|
|
19
20
|
{ "id": "sales", "title": "Sales", "icon": "i-ph-storefront" }
|
|
20
21
|
],
|
|
@@ -46,6 +47,17 @@ Fallback with no running DMS: `@antelopejs/dms` ships the same files at `node_mo
|
|
|
46
47
|
]
|
|
47
48
|
}
|
|
48
49
|
]
|
|
50
|
+
},
|
|
51
|
+
"weekly": {
|
|
52
|
+
"series": [
|
|
53
|
+
{
|
|
54
|
+
"name": "Revenue",
|
|
55
|
+
"data": [
|
|
56
|
+
{ "x": "2026-01-05T00:00:00.000Z", "y": 31200 },
|
|
57
|
+
{ "x": "2026-01-12T00:00:00.000Z", "y": 28900 }
|
|
58
|
+
]
|
|
59
|
+
}
|
|
60
|
+
]
|
|
49
61
|
}
|
|
50
62
|
},
|
|
51
63
|
"tree": [
|
|
@@ -65,6 +77,26 @@ Fallback with no running DMS: `@antelopejs/dms` ships the same files at `node_mo
|
|
|
65
77
|
}
|
|
66
78
|
]
|
|
67
79
|
},
|
|
80
|
+
{
|
|
81
|
+
"type": "ChartCard",
|
|
82
|
+
"options": {
|
|
83
|
+
"title": "Revenue per week",
|
|
84
|
+
"fetchUrl": "fixture:weekly",
|
|
85
|
+
"valueFormat": "currency",
|
|
86
|
+
"currencyCode": "EUR"
|
|
87
|
+
},
|
|
88
|
+
"children": [
|
|
89
|
+
{
|
|
90
|
+
"id": "chart",
|
|
91
|
+
"type": "ChartBar",
|
|
92
|
+
"options": {
|
|
93
|
+
"orientation": "vertical",
|
|
94
|
+
"xaxisType": "datetime",
|
|
95
|
+
"xAxis": { "datetimeFormat": "dd MMM" }
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
]
|
|
99
|
+
},
|
|
68
100
|
{
|
|
69
101
|
"type": "TableView",
|
|
70
102
|
"options": {
|
|
@@ -111,6 +143,19 @@ Fallback with no running DMS: `@antelopejs/dms` ships the same files at `node_mo
|
|
|
111
143
|
|
|
112
144
|
The envelope is strict: a key this page does not list is an issue.
|
|
113
145
|
|
|
146
|
+
## Modules
|
|
147
|
+
|
|
148
|
+
`modules` lists the DMS modules the app needs by their id in the module store catalog: `ai`, `api`, `automation`, `database`, `lang`, `mailing`, `marketing`, `media` and `saas`.
|
|
149
|
+
|
|
150
|
+
```json
|
|
151
|
+
{ "version": 1, "modules": ["mailing", "media"], "pages": [] }
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
- A module id listed twice is an issue (the `modules` array requires unique items).
|
|
155
|
+
- An id the catalog does not list is an issue at `/modules/<index>`, which names the id and lists the known ones.
|
|
156
|
+
- The viewer shows the modules in a strip under its top bar, each with its icon and name.
|
|
157
|
+
- `mockup_read_spec` and `GET /api/mockup/<name>` give each as `{ id, package, icon }`; **dms-mockup-build** installs each `package`.
|
|
158
|
+
|
|
114
159
|
## Nodes
|
|
115
160
|
|
|
116
161
|
A node is `{ type, options?, children? }`; a child also takes `id`, `slot` (a `Tab` or `Card` slot) and `colSpan` (inside a `GridRow`). `type` is a block type of the catalog (it wins over a `componentName`) and `options` its factory options, with two exceptions:
|
|
@@ -118,7 +163,7 @@ A node is `{ type, options?, children? }`; a child also takes `id`, `slot` (a `T
|
|
|
118
163
|
- An option that holds a block, such as a `ChartCard`'s `chart`, is a child whose `id` is the option's name.
|
|
119
164
|
- A `Form` with `sections` keeps every field in `fields`, and each section lists its fields by id in `fieldIds`.
|
|
120
165
|
|
|
121
|
-
Name every child with an `id`: the builder and the roles editor key blocks by name. A block that only shows a figure can take its `static*` options (`staticValue`, `staticDelta`) in place of a fixture.
|
|
166
|
+
Name every child with an `id`: the builder and the roles editor key blocks by name. A vertical bar chart whose categories are dates or weeks (a `ChartBar` of revenue per week) takes `orientation: "vertical"` (an unset orientation is horizontal), `xaxisType: "datetime"` with `xAxis.datetimeFormat` (`dd MMM`) and its `x` values ISO timestamps: without both, the week labels read as amounts. `valueFormat` and `currencyCode` go on the wrapping `ChartCard`, never on the chart, which ignores them. A horizontal `ChartBar` forces a category axis and stays bare: no datetime option, and inside a card its labels read `NaN`. A block that only shows a figure can take its `static*` options (`staticValue`, `staticDelta`) in place of a fixture.
|
|
122
167
|
|
|
123
168
|
- **Fixture reference.** Any string option of the form `fixture:<key>`, at any depth, reads that key of the page's `fixtures`. Use it for every `fetchUrl`, so the block draws data with no route.
|
|
124
169
|
- **Page link.** Any string option of the form `page:<id>`, at any depth, links to that spec page, as _Links and sub-pages_ says.
|
|
@@ -418,7 +463,7 @@ A column's `group` and the table's `columnGroups` group the generated forms' fie
|
|
|
418
463
|
}
|
|
419
464
|
```
|
|
420
465
|
|
|
421
|
-
A `ResourceForm` or a `Form`
|
|
466
|
+
A `ResourceForm` or a `Form` lists its `fields` once, with field groups `{ id, label?, fields }` among them, and splits them into `sections`, each `{ id, label, description?, icon?, fieldIds }` naming the ids of the fields it holds, with `sectionNav` `side`, `jump` or `none`:
|
|
422
467
|
|
|
423
468
|
```json
|
|
424
469
|
{
|
|
@@ -428,22 +473,23 @@ A `ResourceForm` or a `Form` takes `sections`, each `{ id, label, description?,
|
|
|
428
473
|
"mode": "view",
|
|
429
474
|
"fetchUrl": "fixture:customers",
|
|
430
475
|
"sectionNav": "jump",
|
|
476
|
+
"fields": [
|
|
477
|
+
{ "id": "name", "label": "Name", "type": "string" },
|
|
478
|
+
{
|
|
479
|
+
"id": "contact",
|
|
480
|
+
"label": "Contact",
|
|
481
|
+
"fields": [
|
|
482
|
+
{ "id": "email", "label": "Email", "type": "string" },
|
|
483
|
+
{ "id": "phone", "label": "Phone", "type": "string" }
|
|
484
|
+
]
|
|
485
|
+
}
|
|
486
|
+
],
|
|
431
487
|
"sections": [
|
|
432
488
|
{
|
|
433
489
|
"id": "general",
|
|
434
490
|
"label": "General",
|
|
435
491
|
"icon": "i-ph-identification-card",
|
|
436
|
-
"
|
|
437
|
-
{ "id": "name", "label": "Name", "type": "string" },
|
|
438
|
-
{
|
|
439
|
-
"id": "contact",
|
|
440
|
-
"label": "Contact",
|
|
441
|
-
"fields": [
|
|
442
|
-
{ "id": "email", "label": "Email", "type": "string" },
|
|
443
|
-
{ "id": "phone", "label": "Phone", "type": "string" }
|
|
444
|
-
]
|
|
445
|
-
}
|
|
446
|
-
]
|
|
492
|
+
"fieldIds": ["name", "contact"]
|
|
447
493
|
}
|
|
448
494
|
]
|
|
449
495
|
}
|
|
@@ -12,7 +12,6 @@ The spec is the contract: the pages it lists, their blocks in its order, their o
|
|
|
12
12
|
- **The builder MCP and Safe mode**, as **dms-builder-mcp** _Detect what the project has_ says. With the builder MCP, build each new page through it with one `builder_compose_page` call; without it, write the TypeScript with **dms-pages**.
|
|
13
13
|
- **`page_verify`** among your tools (the DMS development MCP): it opens each page in a headless browser and reports its render against the mockup, its data, errors, interactions and permissions. It drives step 4. Without it, step 4 falls back to the visual comparison, with **a browser tool** that opens a URL and takes a screenshot (a browser MCP, agent-browser, Playwright) when you have one.
|
|
14
14
|
- **`mockup_apply_to_page`** among your tools: it writes a converted mockup page back to its live page and lists what it left to wire, as _Pages converted from a live page_ says.
|
|
15
|
-
- **`preview_blocks`** among your tools: step 4 shows each comparison through it.
|
|
16
15
|
- **The asking tool**: `ask_user` in the dms-assistant chat, your harness's question tool elsewhere, else one closed question in chat.
|
|
17
16
|
|
|
18
17
|
## 1. Read the mockup
|
|
@@ -21,6 +20,8 @@ Read the spec with `mockup_read_spec` (`{ mockup, path? }`, read-only, allowed i
|
|
|
21
20
|
|
|
22
21
|
## 2. Plan
|
|
23
22
|
|
|
23
|
+
Read the spec's top-level `modules` first ([SPEC.md](../dms-mockup/SPEC.md) _Modules_; the state of `mockup_read_spec` or `GET /api/mockup/<name>` gives each as `{ id, package, icon }`). List in the plan each `package` that is neither a dependency of `package.json` nor a module of `antelope.config.*`: step 3 installs it before any page.
|
|
24
|
+
|
|
24
25
|
Map every spec page and node, and present the plan before you write:
|
|
25
26
|
|
|
26
27
|
- **Converted page:** a spec page with `livePage: { ref, version }` was converted from the live page at `livePage.ref` (a route). Read that page with `builder_page_structure` (without the builder MCP, its page class) and plan the changes that turn it into the spec page (blocks to configure, move, remove or add), not a new `PageController`; its fixtures whose key is in the spec page's `liveRoutes` keep reading those live routes (_Live route_ below). A **live sketch**, a Custom sketch whose `id` names a block of the live page, stands for code the conversion could not express: keep that block as it is, with no component to write and no Safe mode question. Check its version first, as _Pages converted from a live page_ says: a stale page goes in the plan as stopped, with no changes. With `mockup_apply_to_page` among your tools, the plan still lists every change and says that the tool writes the page first, and that you build only the changes its `wiring` answer lists.
|
|
@@ -38,6 +39,7 @@ Map every spec page and node, and present the plan before you write:
|
|
|
38
39
|
2. rows of one entity (a `$generate` fixture is one: its `fields` are the entity's fields): a new resource (`builder_create_resource`), its fields and types read from the fixture's rows or its `fields`, seeded with those rows only when the user wants sample data;
|
|
39
40
|
3. a figure, a series or a ranking: a query on that resource (`builder_add_query`) whose `response` matches the block, as **dms-builder-mcp** _Data resources and queries_ says.
|
|
40
41
|
A fixture none of these can serve goes in the plan as a question.
|
|
42
|
+
- **A block no builder tool can build:** never replace it with another figure or block (a share or rate is built with the `ratio` query template as **dms-builder-mcp** says, never as one of its two counts). Leave it unbuilt, and offer Code mode for it.
|
|
41
43
|
- **`TableView` over a fixture** → a `TableView` bound to the resource (`controller` = its ref), its columns from the spec's `columns`, with every badge, price, tab, board, card and view the mockup shows. A table over a relation of a connected database is mapped with `builder_map_resources`, as **dms-external-database** _Apply_ says: leave out each badge the Builder proposes (it writes the real values and tones, where the spec's items are fixture values), send a price with its `currency`, and turn `tabsFrom` into the resource's `tabs` and the board, groups, cards, `defaultDisplay` and `views` into `tableOptions`, renamed as [SPEC.md](../dms-mockup/SPEC.md) _Tables_ says, with its section's ref as `category` and the spec page's `title`. Another table takes the spec's displays as they are, its board and views through `builder_configure_table_view`. A colour or display the builder cannot write (a badge the Builder does not propose over a column with no native enum, a `mobileDisplay`) is a question in the plan, never dropped. Build a column's cell display (`display: { type, options }` such as `mono`, `two_line`, `identity`), `group`, `isVisible`, `size` and `cellWrap` through the builder in Safe mode too: in `builder_map_resources` `fields` at mapping time, else `builder_configure_field` (or `builder_add_field`, `builder_create_resource` `fields`), as **dms-builder-mcp** _Column presentation_ says. Build the spec's `columnGroups` with `builder_configure_column_groups`. A rating stays a badge, never a cell display. An `invalid_config` or `relation_skipped` on a display is a question in the plan, never dropped.
|
|
42
44
|
- **Table forms** (`rowActions`, `formContainer`) → the same actions on the real table, and `false` for each of `add`, `edit` and `details` the spec leaves out: the real `TableView` turns an absent one on. A table with no `formContainer` showed a modal: write `{ "type": "modal" }`, as **dms-page-design** _Records, forms and links_ says. `modal` and `drawer` stay as written, `size` and `direction` included, `details: true` in them being the table's own read-only details view, with no page to build. With `page`, each `urlSlug: "page:<id>"` becomes that page's slug relative to the table's page (`new`, `:id/edit`, `:id`), `customPage: true` kept, and the form page is a _Sub-page_ registered at that slug (`orders/new`). The add and edit forms save through the table's data controller. Write them with `builder_configure_block` on the table, or in the page class.
|
|
43
45
|
- **Archive mode** (`archiveMode`, `archivedCountLabel`) → the same options on the real table, its resource's archive field `isArchived` (`@ArchiveField`).
|
|
@@ -60,7 +62,9 @@ Write nothing before the user approves it.
|
|
|
60
62
|
|
|
61
63
|
## 3. Build
|
|
62
64
|
|
|
63
|
-
|
|
65
|
+
Install the modules first: for each package of the plan's module list, run `ajs project modules add <package>`, then load that module's skill (**skills**, else its contract through **interface**) and build the pages that use it on it, never a copy. A package already a dependency or a module of `antelope.config.*` is skipped.
|
|
66
|
+
|
|
67
|
+
Create the sections next, then each page, in the spec's order:
|
|
64
68
|
|
|
65
69
|
- **Builder MCP:** for a new page, `builder_create_page`, then one `builder_compose_page` call with the page's whole tree, previewed first (`"preview": true`) as **dms-page-design** _Build a page in one call_ says. Create the resources and queries the page reads before the page. A page whose table maps a database relation is written by `builder_map_resources` instead: add its other blocks with `builder_compose_page` on that page's `pageRef` and a `placement`.
|
|
66
70
|
- **Code:** write the page class, its routes and DataControllers with **dms-pages**, then run the typecheck. Page code imports from `@antelopejs/interface-dms` and the other interface packages **dms-pages** names, never from `@antelopejs/dms`, which exports no page API.
|
|
@@ -104,7 +108,7 @@ A **round** verifies pages, then fixes what failed. Keep going while a page fail
|
|
|
104
108
|
|
|
105
109
|
**With `page_verify`**, per page:
|
|
106
110
|
|
|
107
|
-
1. Call `page_verify({ page: "<route>", mockup: "<name>", mockupPage: "<spec page id>" })`, with the route as `list_pages` answers it, or `livePage.ref` for a converted page, a concrete one for `:params` (such as `/orders/42`). Keep the
|
|
111
|
+
1. Call `page_verify({ page: "<route>", mockup: "<name>", mockupPage: "<spec page id>" })`, with the route as `list_pages` answers it, or `livePage.ref` for a converted page, a concrete one for `:params` (such as `/orders/42`). Keep the owner and writes held back, and pass the viewports **dms-builder-mcp** _Verify_ names. The first call can take minutes while it installs its browser. An answer without `pages`: check the route with `list_pages` and call once more; if it still has none, verify that page without `page_verify`.
|
|
108
112
|
2. Read `pages[].failures` first: one line per failed check (a block in error or empty, a console error, a failed request, an interaction, a permission, a mockup block with no counterpart), and `notes`. Then read `pages[].render.mockup`: absent, or `unavailable` set, means the page was not compared, so compare it as without `page_verify` (by its tree when the dashboard has no `/mockup` viewer); otherwise each `extraPageBlocks` entry other than a live sketch's block is a difference, so is a relative order of the matched blocks that differs from their order in the desktop viewport's `render.viewports[].blocks`, and the `mockupScreenshot` and `pageScreenshot` of each matched block show the option differences the tool does not check.
|
|
109
113
|
3. Fix each failure where it starts: the route, resource or query a block in error reads (its `data[].source`), the block tree with the builder tools, or the code.
|
|
110
114
|
|
|
@@ -116,14 +120,16 @@ A **round** verifies pages, then fixes what failed. Keep going while a page fail
|
|
|
116
120
|
|
|
117
121
|
A page compared by its tree fails until the user confirms it.
|
|
118
122
|
|
|
119
|
-
When `preview_blocks` is among your tools, call it each time you compare a page with the mockup, with the page's tree as built (`static*` options in place of its data) and the mockup as `reference`: `{ url: "/mockup?name=<name>&page=<id>", caption: "Mockup <name>, page <id>" }`. Every `preview_blocks` call of the build carries that reference: the dms-assistant build dialog draws the latest preview beside it. Elsewhere, show the user what the tool answers.
|
|
120
|
-
|
|
121
123
|
## 5. Report
|
|
122
124
|
|
|
123
125
|
Open with one summary line, the same in the dms-assistant chat and in any harness: `<passing>/<planned> pages pass, <n> errors`, such as `3/3 pages pass, 0 errors`, even when nothing was built (`0/3 pages pass, 3 errors`). `<planned>` counts the pages of the approved plan, built or not; `<n>` counts the failure lines and differences of the last verify, one per distinct block or check, accepted differences and live sketches' lines excluded, plus one for each failing page that has none (a typecheck error, a page the user has not confirmed, a stale page left unbuilt). When `page_verify` did not compare some pages with the mockup, end the line with how they were compared: without `page_verify`, `(compared visually, page_verify is not available)`, or `(compared by tree, page_verify is not available)` without a browser tool; otherwise `(<k> of <planned> compared visually: <why>)` or `(<k> of <planned> compared by tree: <why>)`, where `<why>` is the `unavailable` text or the answer without `pages`.
|
|
124
126
|
|
|
125
127
|
Then list every page still failing after the last round, never fewer: its route, each failure line or difference, the error behind it (the console text, the failed request with its status, the typecheck error, a stale page with both versions), and its screenshots: the page's `render.viewports[].screenshot`, the block's `render.viewports[].blocks[].screenshot`, `pageScreenshot` and `mockupScreenshot`, all project-relative, or your own screenshots in the visual comparison. Then the `notes` that qualify a pass (a role checked as the owner, writes held back), and the differences the user accepted, each with its reason.
|
|
126
128
|
|
|
129
|
+
Then what remains: each block of the spec left unbuilt because no builder tool can build it, by page and block, with why, and the offer to build it in Code mode.
|
|
130
|
+
|
|
131
|
+
Then the modules installed, by package, and those already there.
|
|
132
|
+
|
|
127
133
|
Then, per page: the blocks built (for a converted page, the blocks configured, moved, removed and added, and the live sketches kept; when `mockup_apply_to_page` wrote the page, read them from its `written`, `added` and `removed`, and the live sketches among its `preserved`), the resources and queries created, and the custom components.
|
|
128
134
|
|
|
129
135
|
Record the build on the spec: `mockup_patch_spec` with `{ "mockup": "<name>", "patch": [{ "op": "add", "path": "/built", "value": { "at": "<ISO date>", "pages": [{ "path": "<dashboard path>", "title": "<title>" }] } }] }`, one entry per page the build wrote, or set `built` in `spec.json` without that tool. In the same patch, link each new page to the page it was built into, so the Mockups page marks the mockup Out of sync once that page changes: `{ "op": "add", "path": "/pages/<i>/livePage", "value": { "ref": "<pageRef>", "version": "<version>" } }`, `<i>` the spec page's index, `ref` and `version` as a fresh `builder_page_structure` on the built page answers them. A converted page keeps its stamp of step 3. Without the builder MCP, link nothing. Leave `mockups/<name>/` in place: it is the record of what the user approved.
|
|
@@ -26,21 +26,23 @@ arguments are in `dms-builder-mcp`, the code in `dms-pages`.
|
|
|
26
26
|
|
|
27
27
|
## Pick the block from the data's shape
|
|
28
28
|
|
|
29
|
-
| The data
|
|
30
|
-
|
|
|
31
|
-
| A measure or a row count over time
|
|
32
|
-
| A second series over time (orders beside revenue)
|
|
33
|
-
| A column with 2 to 6 values (status, segment, media type)
|
|
34
|
-
| A column with 7 or more values, a top N
|
|
35
|
-
| One figure with its trend (revenue, orders, customers)
|
|
36
|
-
|
|
|
37
|
-
|
|
|
29
|
+
| The data | Block | Query |
|
|
30
|
+
| ------------------------------------------------------------------------------------ | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
31
|
+
| A measure or a row count over time | `ChartCard` around `ChartArea`, full width | `series`, `groupBy` the time axis, `bucket`, `response: "card"` |
|
|
32
|
+
| A second series over time (orders beside revenue) | `ChartCard` around `ChartColumn` or `ChartLine` | as above |
|
|
33
|
+
| A column with 2 to 6 values (status, segment, media type) | `ChartCard` around `ChartDonut`, with `showSeriesLegend: true` | `series`, `groupBy` the column, `response: "card"` |
|
|
34
|
+
| A column with 7 or more values, a top N | A bare `ChartBar`, or a `TopListCard` with `showBar` | `series`, `orderBy: "measure"`, `direction: "desc"`, `limit: 10`; `response: "card"` for the chart, `"items"` for the list |
|
|
35
|
+
| One figure with its trend (revenue, orders, customers) | `KpiCard` with `showDelta`, `showSparkline` | `series` by the time axis (never `count` or `aggregate`, which answer no previous period and no sparkline), `response: "value"`, `compare: true` |
|
|
36
|
+
| A share or a rate (utilisation rate, conversion rate: one count or sum over another) | `KpiCard` with `valueFormat: "percent"` | `ratio` with `numerator` and `denominator` (each `{ op: "count" \| "sum", field?, where? }`), `response: "value"`, `compare: true` for a delta |
|
|
37
|
+
| Numbers used as categories (a rating 1 to 5, a year) | `ChartCard` around `ChartColumn` with `xaxisType: "category"` | `series`, `groupBy` the column |
|
|
38
|
+
| A status column on a table | Tabs on the `TableView`, plus a donut on the analytics page | see _Tables_ |
|
|
38
39
|
|
|
39
40
|
- Put a chart in a `ChartCard`: it adds the headline figure. Through the builder its `chart` is a
|
|
40
41
|
nested block value, `{ "$block": { "type": "ChartArea", "config": {} } }`. A horizontal
|
|
41
42
|
`ChartBar` stays bare: inside a card its category labels read `NaN`.
|
|
42
43
|
- The `response` must match the block: `card` for a `ChartCard` or a bare chart, `value` for a
|
|
43
44
|
`KpiCard`, `items` for a `TopListCard`. Any other pairing draws nothing.
|
|
45
|
+
- A share or a rate is never one of its two counts ("Utilisation rate" is not "Bikes rented"): build it on the `ratio` template, for example `numerator: { op: "count", where: [{ field: "status", op: "eq", value: "rented" }] }`, `denominator: { op: "count" }`, with `valueFormat: "percent"` on the card. `ratio` answers in percent (25 for a quarter), and a zero denominator shows the card's empty state.
|
|
44
46
|
- Compare periods on KPI cards and top lists (`compare: true`), never on a chart over time:
|
|
45
47
|
the previous period's buckets are other categories, so they draw beside the period instead
|
|
46
48
|
of under it.
|
|
@@ -89,7 +91,9 @@ alone is never done.
|
|
|
89
91
|
Every card binds the page's period: `periodScope: "page"` on the block, and on its query
|
|
90
92
|
`where` filters on the time axis bound to the request,
|
|
91
93
|
`{ "field": "<time axis>", "op": "ge", "value": { "$param": { "name": "from" } } }` and
|
|
92
|
-
`"le"` with `"to"`. A
|
|
94
|
+
`"le"` with `"to"`. A block that ignores the period (a relation with no time axis, open tasks,
|
|
95
|
+
the stock today) leaves a page with a `PeriodSelector` and goes to the top of its list page: a
|
|
96
|
+
figure as _KPI cards above the table_ says, a chart with the same `placement: { "before": "table" }`.
|
|
93
97
|
|
|
94
98
|
## Period
|
|
95
99
|
|
|
@@ -109,7 +113,7 @@ Pick the bucket so the default window holds 8 to 31 points: `day` up to 31 days,
|
|
|
109
113
|
about 7 months (a 90-day window is 13 weeks), `month` beyond. A time chart with fewer than 8 points reads as a curve with no story. An axis
|
|
110
114
|
chart (area, line, column, bar) over time takes `xaxisType: "category"`: a bucketed series
|
|
111
115
|
answers its periods as labels. Use `"datetime"` only for a route you wrote yourself that
|
|
112
|
-
answers timestamps. A donut or pie takes no axis option.
|
|
116
|
+
answers timestamps, and in a mockup, where a vertical `ChartBar` grouped by week or date (revenue per week) takes `orientation: "vertical"` (an unset orientation is horizontal) with `xaxisType: "datetime"` and `xAxis.datetimeFormat` (`dd MMM`). Put `valueFormat: "currency"` and `currencyCode: "EUR"` on the wrapping `ChartCard`, never on the chart, which ignores them. A horizontal `ChartBar` forces a category axis and stays bare, so none of this applies to it. A donut or pie takes no axis option.
|
|
113
117
|
|
|
114
118
|
## Name every page
|
|
115
119
|
|
|
@@ -127,7 +131,10 @@ never a title.
|
|
|
127
131
|
- **Description**: one sentence on what the page holds or answers, from the data
|
|
128
132
|
("Every order with its payment and shipping status").
|
|
129
133
|
- **Order**: the main analytics page first (`order: 0`), then the most used lists. Keep a
|
|
130
|
-
table page's order at 100 or more unless it must sit among the dashboards.
|
|
134
|
+
table page's order at 100 or more unless it must sit among the dashboards. The main
|
|
135
|
+
analytics page is also the dashboard's home: the `homepage` config key of `@antelopejs/dms`
|
|
136
|
+
holds its path, written with `builder_configure_project` (`ConfigureModule`), or in
|
|
137
|
+
`antelope.config.ts` without the builder MCP.
|
|
131
138
|
|
|
132
139
|
Set them with `builder_create_page` on new pages, per resource in `builder_map_resources`
|
|
133
140
|
(`title`, `icon`, `description`, `order`), or with `builder_configure_page` afterwards.
|
|
@@ -142,6 +149,9 @@ section: it stays in the category it is created in. A section's own dashboard (_
|
|
|
142
149
|
dashboard_) sits first in its section. An app of fewer pages has no sections. You decide the sections; the user edits them.
|
|
143
150
|
A page that belongs in a section the project has already goes there: in a mockup, a section of
|
|
144
151
|
that exact title, which the viewer draws as the app's own.
|
|
152
|
+
A step handled from a record (sending a quote, approving an expense) gets no section and no
|
|
153
|
+
page in the menu: its actions sit on the record. A table of records in its own right stays a
|
|
154
|
+
page.
|
|
145
155
|
|
|
146
156
|
A section is a menu category: `builder_create_category` (`name`, `displayName`, `icon`,
|
|
147
157
|
`order`, `module`, and `section: true` for a sidebar section, a `RootCategory`) answers its `ref`, which `builder_create_page` takes as `category`,
|
|
@@ -180,6 +190,15 @@ target's label, never the raw number: map the target relation with a label first
|
|
|
180
190
|
the relation column as a relation. Raw id columns stay off the list. A `display` you do send, and the relation's `tabs`, go in `builder_map_resources`.
|
|
181
191
|
A cell display (`mono`, `two_line`, `identity`, `progress`...), `group`, `isVisible`, `size` and `cellWrap` go in the same `fields`, else `builder_configure_field`: no code needed, Safe mode included.
|
|
182
192
|
|
|
193
|
+
**Rows at a glance.** The list keeps the columns a reader scans to pick a row; a field read only
|
|
194
|
+
once the row is open (a note, a secondary contact) stays in the record.
|
|
195
|
+
|
|
196
|
+
- A list of people or companies whose relation has a photo or logo column leads with an
|
|
197
|
+
`identity` cell: the photo or logo (`avatarField`) beside the name.
|
|
198
|
+
- A due date shows in its own column as a `relative_date` display with `style: "day"`,
|
|
199
|
+
`pastTone: "error"` (red once it has passed) and `soonTone: "warning"` with `soonWithinMs` for a
|
|
200
|
+
date coming due.
|
|
201
|
+
|
|
183
202
|
**Tabs.** A single-choice column with 2 to 6 values that splits the rows into states people
|
|
184
203
|
work through (a status, a stage) gives tabs when the column is drawn as a badge, by the
|
|
185
204
|
Builder or over a native enum: send `tabs: { "column": "<column>" }`, and the table draws
|
|
@@ -266,7 +285,11 @@ An app clicks through: from a figure to its rows, from a row to its record, and
|
|
|
266
285
|
never chosen unasked. When it would clearly help, suggest it in one sentence ("a details page
|
|
267
286
|
could show the order's KPIs above the record, want it?") and build it only on a yes: a
|
|
268
287
|
sub-page of the list, left out of the menu, that opens on a click on its row, built as
|
|
269
|
-
**dms-best-practices** _Custom pages are blocks_ says.
|
|
288
|
+
**dms-best-practices** _Custom pages are blocks_ says. Its head shows what the blocks below do
|
|
289
|
+
not: no banner repeats the record's fields.
|
|
290
|
+
- **A many-to-many is a `multiple` relation** (`RelationType({ multiple: true, dataApiController: <Controller> })`) on the side
|
|
291
|
+
people edit it from. Showing it from the other side is a related list on a details page,
|
|
292
|
+
proposed as _A custom details page is the user's call_ says.
|
|
270
293
|
- **Turn on only the actions the reader takes.** A connected database's table writes only on a
|
|
271
294
|
`read-write` connection, as **dms-external-database** _Connection access_ says. On one,
|
|
272
295
|
propose each table's write actions from its `writes` and its shape, and the integrator
|
|
@@ -295,7 +318,8 @@ An app clicks through: from a figure to its rows, from a row to its record, and
|
|
|
295
318
|
table it counts, a dashboard tile to its page, a detail page back to its list, a toolbar
|
|
296
319
|
button to the page it opens. `KpiCard` takes no link: a figure that links is a `StatGroup`
|
|
297
320
|
cell (`to`), or sits in a `Card` whose head action (`actions: [{ label, to }]`) opens the
|
|
298
|
-
table.
|
|
321
|
+
table. A figure with no period links to the view or tab it counts (`?<tableId>.view=<id>`,
|
|
322
|
+
`?<tableId>.tab=<id>`) and counts with that filter, so it equals the list's row count.
|
|
299
323
|
|
|
300
324
|
A mockup writes these as [SPEC.md](../dms-mockup/SPEC.md) _Links and sub-pages_, _Table
|
|
301
325
|
forms_ and _Archive mode_ say.
|
|
@@ -310,8 +334,8 @@ Use the single-block tools only for a small fix afterwards.
|
|
|
310
334
|
1. Call it first with `"preview": true` and the default period's `from` and `to` as `args`.
|
|
311
335
|
It writes nothing and answers each block's status: decide from that status, never from the
|
|
312
336
|
figures a preview holds. Change or drop every block marked
|
|
313
|
-
`empty`, `zero` or `error` (another measure
|
|
314
|
-
follow the period), then preview again. Never write a block over an empty answer.
|
|
337
|
+
`empty`, `zero` or `error` (another measure; a block that should not
|
|
338
|
+
follow the period moves to its list page, as _Lay out an analytics page_ says), then preview again. Never write a block over an empty answer.
|
|
315
339
|
2. Call it again without `preview` to write. A refusal lists every refused block by pointer:
|
|
316
340
|
fix those and call again; nothing was written.
|
|
317
341
|
3. KPI cards above a table: `pageRef` of the table page, `placement: { "before": "table" }`,
|
|
@@ -117,6 +117,16 @@ row's ⋯ button — `docs/components/tables/columns-and-displays#pinned-rows`.
|
|
|
117
117
|
publishes to every tenant for a table of the shared schema, and a platform (module) page receives
|
|
118
118
|
every tenant's changes.
|
|
119
119
|
|
|
120
|
+
### Confirmations
|
|
121
|
+
|
|
122
|
+
- Every action that sends something, removes data or changes a role or a right takes a
|
|
123
|
+
`confirm` dialog. Its texts name the row with `{field}` ("Remove {name}?").
|
|
124
|
+
- A dialog whose content is not on the row (the recipients and CC a send resolves, what a delete
|
|
125
|
+
takes with it) is worded by a route: `confirm: { from: "<url>" }`, answering
|
|
126
|
+
`serializeConfirmDialog({ title, description, params, impact, fields })`
|
|
127
|
+
(`@antelopejs/interface-dms/base/table-view`). A send's dialog names the recipients, the CC and
|
|
128
|
+
the channel.
|
|
129
|
+
|
|
120
130
|
### Live pages
|
|
121
131
|
|
|
122
132
|
A monitoring page, `pageToolbar()`, `LiveToggle`, `liveHold` and pause: see [LIVE.md](LIVE.md).
|
|
@@ -207,6 +217,9 @@ LayoutBannerScope.EVERYWHERE` to a workspace-wide state (billing past due, suspe
|
|
|
207
217
|
`NumberType` / `StringType` rather than filling the row; one bounded to 6 digits or a
|
|
208
218
|
`maxLength` of 16 or less is compact already, and `width: "full"` opts out. Phones keep the
|
|
209
219
|
full row.
|
|
220
|
+
- A new record's constant first choice (a default status, a usual quantity) starts filled through
|
|
221
|
+
the field's `defaultValue`, rather than hinted in a `placeholder`.
|
|
222
|
+
- Every typed phone number is a `PhoneType` field, in every form that asks for one.
|
|
210
223
|
- A long sectioned `Form` groups its navigation with `FormSection.navGroup`, in the side list and
|
|
211
224
|
the `sectionNav: "jump"` chips alike.
|
|
212
225
|
- A module's own `inputComponent` submits its form, adds a validator and focuses a field with
|