@antelopejs/agent-skills 0.1.0 → 0.3.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.
@@ -0,0 +1,65 @@
1
+ ---
2
+ name: dms-mockup
3
+ description: Mocks up AntelopeJS DMS apps in mockups/<name>/spec.json before any page is built: interviews the user, matches every wish to a DMS block or a custom sketch, and applies the user's annotations on the mockup. Use when the user wants to mock up, sketch or prototype a DMS app or page, start an app from scratch, or has commented on a mockup.
4
+ ---
5
+
6
+ # DMS mockups
7
+
8
+ A mockup is `mockups/<name>/spec.json` in the project: the pages of an app as trees of real DMS blocks, with **fixtures** standing in for their data and **sketch** nodes standing in for the custom parts. The dev-only `/mockup` page of the running DMS draws the spec with the real renderer and redraws it on every save, with no typecheck and no reload. The user comments on any element there; the comments land in `mockups/<name>/annotations.json`. [SPEC.md](SPEC.md) holds the file formats.
9
+
10
+ The mockup is done when the user approves it. Building the real pages from it is **dms-mockup-build**.
11
+
12
+ ## Detect what the project has
13
+
14
+ - **The block catalog.** With the builder MCP (`builder_catalog` among your tools, see **dms-builder-mcp**), `builder_catalog`. Without it, the catalog of the running DMS (`GET /api/block-preview/types`, or the spec schema at `GET /api/mockup/schema`), else the schema file `@antelopejs/dms` ships ([SPEC.md](SPEC.md) _Schema_). The running DMS lists the blocks of the installed modules too; the file lists the core blocks only.
15
+ - **The preview.** `/mockup?name=<name>` answers while `ajs project dev` runs. When it does not, write and validate the spec all the same, show the user each page as a text outline (one line per block, sketches marked _Custom_), and tell them `ajs project dev` turns it into a live preview.
16
+ - **Annotations.** When `mockup_annotations` is among your tools, it lists them and `mockup_resolve_annotation` resolves one. Without them, use the HTTP API of the running DMS, else edit `mockups/<name>/annotations.json` directly ([SPEC.md](SPEC.md) _annotations.json_).
17
+ - **Writing the spec.** When `mockup_write_spec` and `mockup_patch_spec` are among your tools, every write of the spec goes through them: `mockup_write_spec` for a first draft or a rewrite, `mockup_patch_spec` (RFC 6902 operations) for a targeted change. Both validate and write `spec.json` only, and Safe mode allows them, as it allows `mockup_resolve_annotation`. Without them, write the file directly.
18
+ - **The asking tool**: `ask_user` in the dms-assistant chat, your harness's question tool elsewhere (`AskUserQuestion` in Claude Code), else one closed question in chat. Batch questions: up to 4 per call.
19
+
20
+ ## 1. Interview
21
+
22
+ Collect the user's **wishes**: each thing a screen must show or let someone do. Ask, in as few rounds as the answers allow:
23
+
24
+ - what the app is for, and who opens it (roles);
25
+ - the pages, and for each the question it answers or the job it does;
26
+ - the data each page shows: entities, their main fields, the figures that matter;
27
+ - the actions: create, edit, approve, export, …;
28
+ - a reference: a screenshot, a Figma frame, another product. When there is one, frame it once as **dms-best-practices** _Design-fidelity protocol_ step 1 says.
29
+
30
+ When the project already has a database or resources (`builder_list_resources`, `database_connections`), read their names and fields first and ask only what they do not answer. Data pages follow **dms-page-design**: its shapes, layout and naming rules decide the blocks of an analytics or table page.
31
+
32
+ The interview is done when every page has a purpose, its data and its actions, and every wish names the page it lives on.
33
+
34
+ ## 2. Check every wish against the catalog
35
+
36
+ For each wish, find the closest DMS block or composition in the catalog, with the mapping table of **dms-best-practices** [REFERENCE.md](../dms-best-practices/REFERENCE.md). Then:
37
+
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
+ - **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
+
41
+ This step is done when every wish maps to a block, a composition, or a sketch the user chose.
42
+
43
+ ## 3. Write the spec
44
+
45
+ Write `mockups/<name>/spec.json` with `mockup_write_spec` or as a file (`<name>` in kebab case, from the app or the area: `crm`, `stock-dashboard`), following [SPEC.md](SPEC.md):
46
+
47
+ - one entry per page, its tree in the order the page reads, every block with a name;
48
+ - **fixtures** for every block that reads data, realistic and coherent across pages (the order total on the list matches the KPI), sized like the real data (a dozen rows, not two);
49
+ - a **sketch** for each custom part the user chose, kept to that element;
50
+ - `source`, on a new spec only: `claude-code` in Claude Code, `codex` in Codex, left out when you cannot tell which harness runs you;
51
+ - texts in the user's language.
52
+
53
+ Validate it: `mockup_write_spec` answers its `errors`; otherwise `GET /api/mockup/<name>` answers every issue with the JSON pointer of its node ([SPEC.md](SPEC.md) _Validation_); without a running DMS, check the file against the schema. The step is done when the spec has no issue. Then give the user the link: `/mockup?name=<name>` on the running DMS.
54
+
55
+ ## 4. Iterate on annotations
56
+
57
+ When the user says they commented, or asks what is left, list the open annotations. For each one:
58
+
59
+ 1. Find the node its path names, and the wish behind it.
60
+ 2. Change the spec. A request the DMS blocks cannot meet goes through step 2 again, never straight to a sketch.
61
+ 3. Resolve the annotation, and note what changed for the report.
62
+
63
+ Save after each batch, as one `mockup_patch_spec` call when it is among your tools: the preview redraws on its own. A patch that fails, or a spec it leaves invalid, is not written: fix it and send it again. Report the annotations you resolved and those you left open, with the question each one raises.
64
+
65
+ The mockup is done when no annotation is open and the user approves it. Then offer **dms-mockup-build**.
@@ -0,0 +1,147 @@
1
+ # Mockup file formats
2
+
3
+ The formats of `mockups/<name>/spec.json` and `mockups/<name>/annotations.json`, for **dms-mockup** and **dms-mockup-build**. `<name>` matches `^[a-z0-9][a-z0-9-]{0,63}$`, and so does every page `id`. Never name a mockup `schema`: `/api/mockup/schema` answers the schema, so that mockup's routes never answer.
4
+
5
+ ## Schema
6
+
7
+ `@antelopejs/dms` ships the JSON Schema of the spec at `node_modules/@antelopejs/dms/data/mockup-spec.schema.json`, and a running DMS serves the same schema, built from the blocks of the installed modules, at `GET /api/mockup/schema`. Point the spec's `$schema` at the file, so an editor checks it as the user types. When the schema and this page disagree, the schema wins. `node_modules/@antelopejs/dms/data/mockup-example/spec.json` is a two-page spec that compiles with no issue: model a new spec on it.
8
+
9
+ ## spec.json
10
+
11
+ ```json
12
+ {
13
+ "$schema": "../../node_modules/@antelopejs/dms/data/mockup-spec.schema.json",
14
+ "version": 1,
15
+ "title": "Order desk",
16
+ "pages": [
17
+ {
18
+ "id": "orders",
19
+ "title": "Orders",
20
+ "options": { "theme": "light", "locale": "en", "padding": true },
21
+ "fixtures": {
22
+ "orders": [
23
+ { "_id": "o1", "customer": "Acme", "total": 120, "status": "paid" },
24
+ {
25
+ "_id": "o2",
26
+ "customer": "Globex",
27
+ "total": 87.5,
28
+ "status": "pending"
29
+ }
30
+ ],
31
+ "revenue": {
32
+ "value": 48210,
33
+ "delta": 12.4,
34
+ "series": [
35
+ {
36
+ "name": "Revenue",
37
+ "data": [
38
+ { "x": "2026-01-05T00:00:00.000Z", "y": 5800 },
39
+ { "x": "2026-01-06T00:00:00.000Z", "y": 6400 }
40
+ ]
41
+ }
42
+ ]
43
+ }
44
+ },
45
+ "tree": [
46
+ {
47
+ "type": "ChartCard",
48
+ "options": {
49
+ "title": "Revenue",
50
+ "fetchUrl": "fixture:revenue",
51
+ "valueFormat": "currency",
52
+ "currencyCode": "EUR"
53
+ },
54
+ "children": [
55
+ {
56
+ "id": "chart",
57
+ "type": "ChartArea",
58
+ "options": { "xaxisType": "datetime" }
59
+ }
60
+ ]
61
+ },
62
+ {
63
+ "type": "TableView",
64
+ "options": {
65
+ "fetchUrl": "fixture:orders",
66
+ "columns": {
67
+ "customer": {
68
+ "name": "Customer",
69
+ "type": "string",
70
+ "sortable": true
71
+ },
72
+ "total": { "name": "Total", "type": "number", "sortable": true },
73
+ "status": { "name": "Status", "type": "select" }
74
+ }
75
+ }
76
+ },
77
+ {
78
+ "type": "sketch",
79
+ "options": {
80
+ "html": "<div class='map'>Delivery map</div>",
81
+ "css": ".map{height:100%;display:grid;place-items:center}",
82
+ "height": 240,
83
+ "caption": "Live map of the drivers"
84
+ }
85
+ }
86
+ ]
87
+ }
88
+ ]
89
+ }
90
+ ```
91
+
92
+ - `pages`: 1 to 50 pages. `options` is optional: `theme` (`light` or `dark`), `locale`, `padding` (default `true`).
93
+ - `fixtures`: a key (`^[A-Za-z0-9_-]{1,64}$`) to any JSON value, the data the page's blocks read.
94
+ - `tree`: the page's blocks, top to bottom, in the `DmsBlockPreview` tree format below.
95
+ - `livePage` and `liveRoutes` (optional, per page): set by "Edit as mockup" on a page converted from a live page, `livePage: { ref, version }` and `liveRoutes` a fixture key to the live route it stands for. **dms-mockup-build** reads them.
96
+ - `source` (optional): the harness that created the spec, `claude-code` or `codex`.
97
+ - `built` (optional): written by **dms-mockup-build** after a build, `{ at, pages }`: `at` an ISO date, `pages` one `{ path, title? }` per page built, `path` its dashboard path.
98
+
99
+ The envelope is strict: a key this page does not list is an issue.
100
+
101
+ ## Nodes
102
+
103
+ 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:
104
+
105
+ - An option that holds a block, such as a `ChartCard`'s `chart`, is a child whose `id` is the option's name.
106
+ - A `Form` with `sections` keeps every field in `fields`, and each section lists its fields by id in `fieldIds`.
107
+
108
+ 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.
109
+
110
+ - **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.
111
+ - **`TableView`** takes the options of `TableView.fromSource`: `fetchUrl: "fixture:<key>"` naming an array of rows, and `columns` keyed by row field, each with its `name` and its `type`, a data type id (`string`, `number`, `date`, `boolean`, `select`, …). Paging, search and sort work over the fixture; filters (tabs, quick filters, `queryParamFilters`) draw but do not narrow the rows, and a column takes no `display`.
112
+ - **`ResourceForm`** takes its `fields` and `fetchUrl: "fixture:<key>"` naming the record object, with no `submitUrl`.
113
+ - **Sketch.** `{ "type": "sketch", "options": { "html", "css"?, "height"?, "caption"? } }`, with no children: the static HTML and CSS of one custom part, drawn hatched, outlined and labelled _Custom_. `height` is 80 to 1200 px (default 320); `caption` (up to 200 characters) says what the part does. It runs in a sandbox with no script: the spec refuses `<script>`, embedding elements, `on*` handlers, `<meta http-equiv>`, `@import`, `javascript:` and `vbscript:` URLs, and any `url()`, `src` or `href` that is not a `data:` URL or an `#anchor`. Keep it to the element alone; the blocks around it stay blocks.
114
+
115
+ ## Validation
116
+
117
+ `mockup_write_spec` with `{ "mockup": "<name>", "spec": { … } }`, or `mockup_patch_spec` with `{ "mockup": "<name>", "patch": [ RFC 6902 operations ] }`, validates the resulting spec, writes `spec.json` when it holds, and answers `{ ok, errors }`, each error `{ path, message }`. A refused spec answers `ok: false`; a bad name, a failed patch operation or a missing target answers a tool error. Nothing is written in either case. Without that tool, `GET /api/mockup/<name>` answers the compiled state: `pages`, a `revision` that grows on each good read, and `issues`, each `{ path, message }` with `path` a JSON pointer into `spec.json` (`/pages/0/tree/1/children/0/options/title`). The spec validates when `issues` is empty. A node with bad options still draws what it can, so a page that looks right can still hold issues: read them.
118
+
119
+ ## The preview
120
+
121
+ `/mockup?name=<name>` on the running DMS (`ajs project dev`, dev only) draws the spec and redraws it on every save; `&page=<id>` opens one page and `&width=mobile` the phone width (`desktop` by default). The user clicks an element there to comment on it.
122
+
123
+ ## annotations.json
124
+
125
+ ```json
126
+ {
127
+ "version": 1,
128
+ "annotations": [
129
+ {
130
+ "id": "k3f9",
131
+ "page": "orders",
132
+ "path": "/pages/0/tree/1",
133
+ "text": "Add the order date",
134
+ "status": "open",
135
+ "createdAt": "2026-11-11T10:00:00.000Z"
136
+ }
137
+ ]
138
+ }
139
+ ```
140
+
141
+ `path` is the JSON pointer of the node in `spec.json`. A resolved annotation has `status: "resolved"` and a `resolvedAt` date. After a spec edit that adds or removes a node before it, an open annotation's pointer can name a neighbour: match it by its text and page too.
142
+
143
+ Read and resolve them, by the first way available:
144
+
145
+ 1. The DMS MCP: `mockup_annotations` with `{ "mockup": "<name>", "status": "open" }` (and `page` to narrow) lists them; `mockup_resolve_annotation` with `{ "mockup": "<name>", "id": "<id>" }` resolves one. Both work in Safe mode.
146
+ 2. The HTTP API of the running DMS: `GET /api/mockup/<name>/annotations`, and `PATCH /api/mockup/<name>/annotations/<id>` with `{ "status": "resolved" }`.
147
+ 3. The file itself, when no server runs: set `status` and `resolvedAt`, keep the rest as it is.
@@ -0,0 +1,116 @@
1
+ ---
2
+ name: dms-mockup-build
3
+ description: Builds the real AntelopeJS DMS pages from an approved mockup (mockups/<name>/spec.json): PageControllers through the builder MCP or TypeScript, real data in place of the fixtures, custom components for the sketches (or updates the live page a converted mockup page names), then a verify and fix loop against the mockup (page_verify, at most three rounds) that reports every page left failing. Use when the user wants to build or implement a mockup, or turn its spec into pages.
4
+ ---
5
+
6
+ # Building pages from a mockup
7
+
8
+ The spec is the contract: the pages it lists, their blocks in its order, their options, and a custom component for each sketch. [SPEC.md](../dms-mockup/SPEC.md) holds its format. Every page you write follows **dms-best-practices**; data pages also follow **dms-page-design**.
9
+
10
+ ## Detect what the project has
11
+
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
+ - **`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
+ - **`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
+ - **The asking tool**: `ask_user` in the dms-assistant chat, your harness's question tool elsewhere, else one closed question in chat.
17
+
18
+ ## 1. Read the mockup
19
+
20
+ Read `mockups/<name>/spec.json` and its open annotations ([SPEC.md](../dms-mockup/SPEC.md) _annotations.json_). An open annotation is a change the user still wants: ask whether to apply it first with **dms-mockup**, or to build the spec as it stands.
21
+
22
+ ## 2. Plan
23
+
24
+ Map every spec page and node, and present the plan before you write:
25
+
26
+ - **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.
27
+ - **Page** → a `PageController` (with `RegisterPage`, from `@antelopejs/interface-dms/page`): `id` and title from the spec page, an icon and a description as **dms-page-design** _Name every page_ says, a category the user confirms.
28
+ - **Block** → the same `type` and options. Keep each child's `id` as the block's name; a child whose `id` names a block option (a `ChartCard`'s `chart`) becomes that option.
29
+ - **Live route:** on a converted page, a `fixture:<key>` whose key is in the page's `liveRoutes` reads that route: the block's fetch option (such as `fetchUrl`) takes it in place of the fixture's `static*` option, and a live `TableView` or `ResourceForm` keeps its `controller`; a block the spec adds follows the _Fixture_ rules. This comes before the _Fixture_, `TableView` and `ResourceForm` rules.
30
+ - **Fixture**, or a `static*` option → the real data it stands for, by the first that holds:
31
+ 1. an existing resource or route serves it (`builder_list_resources`, the project's controllers): bind to it;
32
+ 2. rows of one entity: a new resource (`builder_create_resource`), its fields and types read from the fixture's rows, seeded with those rows only when the user wants sample data;
33
+ 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.
34
+ A fixture none of these can serve goes in the plan as a question.
35
+ - **`TableView` over a fixture** → a `TableView` bound to the resource (`controller` = its ref), its columns from the spec's `columns`.
36
+ - **`ResourceForm` over a fixture** → a `ResourceForm` on the resource, with the spec's fields.
37
+ - **Sketch** → a `CustomComponent` (from `@antelopejs/interface-dms/base/custom`) with `.meta({ name, description, icon })`, its Vue drawn from the sketch's HTML and CSS with the DMS UI components and theme variables, its data from a route. In Safe mode this is out of reach: ask whether to turn Safe mode off for these components, or to leave each one as a `Placeholder` named after its caption.
38
+
39
+ The plan lists per page:
40
+
41
+ - **Build (`builder_compose_page`):** for a new page, `builder_create_page`, then one `builder_compose_page` call with the whole tree; for a converted page, the block changes on `livePage.ref`, through `mockup_apply_to_page` first when you have it; without the builder MCP, the page class.
42
+ - **Blocks:** in the spec's order, with their options.
43
+ - **Data (`liveRoutes`):** per fixture, its route from `liveRoutes` on a converted page, else the resource or query it binds to; the resources and queries to create.
44
+ - **Components (`CustomComponent`):** a `CustomComponent` for each sketch other than a live sketch, or its `Placeholder` in Safe mode.
45
+
46
+ Write nothing before the user approves it.
47
+
48
+ ## 3. Build
49
+
50
+ Per page, in the spec's order:
51
+
52
+ - **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.
53
+ - **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.
54
+ - **Custom components:** with **dms-pages**, after the builder's write; then `builder_refresh` on the page when the builder MCP answers.
55
+
56
+ A page is built when it typechecks and, checked as **dms-builder-mcp** _Verify_ says, shows every block with data.
57
+
58
+ ### Pages converted from a live page
59
+
60
+ `livePage.version` is the `version` (a hash of the page's source file) that `builder_page_structure` answered at conversion. Compare it with the `version` of `builder_page_structure` on `livePage.ref` for every converted page, when you plan and again before the first write of the build, resources and queries included. A different `version` means the page changed in code since "Edit as mockup": the page is **stale**. Write nothing to it, and ask the user one question that says so and offers to convert it again (`mockup_from_page` with `{ pageRef: livePage.ref, replace: true }`, which discards the mockup's edits) or to build anyway. After a new conversion, start again at step 1. Build anyway only on the user's explicit go: read the structure again and apply the mockup's edits by block name only. The spec's other pages build as planned. Without the builder MCP there is no `version` to compare: build through the code and tell the user the page could not be checked.
61
+
62
+ **With `mockup_apply_to_page`** among your tools, call it for each converted page before any other write for that page, its resources and queries included: `mockup_apply_to_page({ mockup: "<name>", page: "<spec page id>" })`. It checks the version again itself; your compare before the first write of the build stays.
63
+
64
+ - `{ ok: true, outcome: "applied", livePage: { ref, version }, stamped, preserved, written, added, removed, wiring }`: the tool wrote the page in one write. It kept the unchanged blocks and the live sketches byte for byte, wrote the option, order, slot and span edits, added and removed blocks, named each new block after its node's `id` (`revenue-2` becomes `revenue_2`), and, with `stamped: true`, recorded `livePage.version` in the spec and gave each new node that had no `id` the name it was written under. `stamped: false` comes with a `message`: the spec changed during the write and its version was left as it was; tell the user that `message`. `preserved`, `written`, `added` and `removed` hold builder paths. Read the page again with `builder_page_structure`, then build only the `wiring` entries with the builder tools and the rules of step 2, and do not redo what the tool wrote. Each entry, `{ pointer, id?, type?, reason, kept? }`, is a spec node the tool did not write, with everything under it (a `parent` entry is about its `kept` block, and a `placement` entry's node was written): `pointer` is its place in `spec.json`, `id` and `type` the node's, and `kept`, when set, the builder path of the live block left as it was there. Edit the `kept` block when there is one, else add the node. By `reason`:
65
+ - `data`: the node reads data the live page does not serve. Wire it to a route or a query, as _Fixture_ says.
66
+ - `custom-component`: a new or edited sketch, or one put in place of a block. Build it as a custom component, as _Sketch_ says.
67
+ - `table`: a table added, retyped, or whose columns, rows or source changed. Bind it to its resource with `builder_configure_table_view`.
68
+ - `held-block`: a block held in an option of its parent (a `ChartCard`'s `chart`) changed or was removed. Configure that option on the parent.
69
+ - `move`: a live block moved to another parent. Move it from `kept` with `builder_move_block`.
70
+ - `parent`: `kept` is a block the mockup removed, left in place because a block inside it could not move out (that block's `move` entry). Remove `kept` once that block is moved.
71
+ - `locked`: a change the page's source locks (an option set in code, the type of such a block, the order, slot or span of its children). Make it in the page class.
72
+ - `type`: a type the builder cannot write there. Build it as a custom component or in the page class.
73
+ - `name`: a new block's `id` gives it the name of another block at its place. Give the node an `id` of its own with `mockup_patch_spec`, then add the block.
74
+ - `placement`: a `slot` or `colSpan` on a top-level block, which the builder lays out in order only. The block was written without it: tell the user, or set it in the page class.
75
+
76
+ With an empty `wiring`, nothing is left to write on that page; the built check above and step 4 still apply.
77
+
78
+ - `{ ok: false, error: "stale", livePage, currentVersion }`: the page is stale, as above, and nothing was written. Building anyway writes the whole page yourself, without the tool.
79
+ - `{ ok: false, error: "not_linked" }`: the spec page records no `livePage`, so it is no converted page. Build it with the builder tools as a _Page_ of step 2.
80
+ - `{ ok: false, error, message, errors }` with `not_found` (the mockup, the spec page or the live page does not exist), `invalid` (`errors` holds the spec's schema issues or the builder's refusal of the draft, each with its `path`) or `unreadable` (the builder cannot read the page): write nothing to that page, tell the user the `message` and each of the `errors`, and ask. For `invalid` on the spec's schema, offer to fix the spec with **dms-mockup**, then call the tool again. Never create the live page.
81
+
82
+ Without the tool, write the page yourself. An existing block whose fixture key is in `liveRoutes` reads its live route (_Live route_). Change its existing blocks with `builder_configure_block`, `builder_move_block` and `builder_remove_block`; add the spec's new blocks with `builder_add_block`, or with `builder_compose_page` on that `pageRef` and a `placement`, previewed first (`"preview": true`). Without the builder MCP, edit the existing page class.
83
+
84
+ Every write of yours to a converted page, a `wiring` entry included, updates the page at `livePage.ref`, never another: no `builder_create_page`. Move a live sketch's neighbours around it, never the block itself. A builder tool's `stale` answer (your read of the structure is outdated): read the page again with `builder_page_structure` and retry. A builder tool's `not_found` answer for the page: ask the user; never create it.
85
+
86
+ After the last round of step 4, stamp each converted page you wrote yourself (a `wiring` entry, a fix, or the whole page without the tool) with its new version; a page only `mockup_apply_to_page` wrote, answering `stamped: true`, keeps the tool's stamp. Read the version with a fresh `builder_page_structure` and write it with `mockup_patch_spec`: `{ "mockup": "<name>", "patch": [{ "op": "replace", "path": "/pages/<i>/livePage/version", "value": "<version>" }] }`, `<i>` the page's index in the spec. Without `mockup_patch_spec`, set that field in `spec.json`. Without the builder MCP, stamp nothing.
87
+
88
+ ## 4. Verify and fix
89
+
90
+ A **round** verifies pages, then fixes what failed. Keep going while a page fails, up to **three rounds**: round 1 verifies every page of the plan, each later round the pages that failed before and every page a fix changed, and after the third verify you fix nothing more. A page passes when its last verify, leaving out the lines of its live sketches, finds no failure (with `page_verify`, `ok` or failing only on those lines) and no difference from the mockup, or only differences the user accepted. A page of the plan that was never built, or does not typecheck, fails with that error. A **difference** is a block missing, extra or out of order, another type, another option (title, format, variant, span, columns), a sketch whose component looks otherwise, or a block empty on the real page. Values that differ because real data replaced a fixture are no difference; a block empty where its fixture had data is one. A live sketch's lines are never differences nor fix targets: its sketch with no counterpart, its live block in `extraPageBlocks` or in a failure line. Report them under the live sketches kept, outside `<n>`.
91
+
92
+ **With `page_verify`**, per page:
93
+
94
+ 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 defaults: the owner, desktop and mobile, writes held back. 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`.
95
+ 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.
96
+ 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.
97
+
98
+ **Without `page_verify`**, compare visually. The pages are compared with the mockup but not tested, and the summary line of step 5 says so with its suffix: `(compared visually, page_verify is not available)`, or `(compared by tree, page_verify is not available)` without a browser tool:
99
+
100
+ 1. **With a browser tool:** screenshot `/mockup?name=<name>&page=<id>` and the real page, at the desktop width, then at the mobile width (`&width=mobile`, and the same viewport for the real page).
101
+ 2. **Without one:** compare the spec's tree with `builder_page_structure` (or the page class), node by node, and ask the user with the asking tool to look at the page.
102
+ 3. Fix each difference with the builder tools or a code edit.
103
+
104
+ A page compared by its tree fails until the user confirms it.
105
+
106
+ 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.
107
+
108
+ ## 5. Report
109
+
110
+ 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`.
111
+
112
+ 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.
113
+
114
+ 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.
115
+
116
+ 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. Leave `mockups/<name>/` in place: it is the record of what the user approved.
@@ -0,0 +1,201 @@
1
+ ---
2
+ name: dms-page-design
3
+ description: Designs AntelopeJS DMS pages that show data. Use when building or changing an analytics, stats or dashboard page or a table page, choosing a chart or a KPI for some data, picking a page's period, naming a page and its icon, or deciding how a table displays (badges, prices, relation labels, status tabs, saved views, kanban, cards, footer totals, KPI cards above the table).
4
+ ---
5
+
6
+ # Designing data pages
7
+
8
+ A data page answers the questions its owner asks about the data. Each block answers one
9
+ question, and its title says which ("Revenue per month", "Top 10 countries by revenue").
10
+ Build every page from the questions, the shapes below and the checks at the end, in that
11
+ order, so that two runs over the same data produce the same page.
12
+
13
+ This skill decides **what** to build; `dms-best-practices` still holds. The tools and their
14
+ arguments are in `dms-builder-mcp`, the code in `dms-pages`.
15
+
16
+ ## Pick the path
17
+
18
+ - **The builder MCP answers** (`builder_catalog` is among your tools, see `dms-builder-mcp`
19
+ _Detect what the project has_): every step below applies as written.
20
+ - **No builder MCP**: the shapes, layout, period, names and table features below still decide
21
+ the page. Write it with `dms-pages`: a query becomes a route on the page
22
+ (`pageRoutePath`), the period arrives as the request's `from` and `to`, and the table
23
+ features are `TableView` options. There is no preview call: before you write a block, read
24
+ its answer from the route (or the data it aggregates) for the default period, and apply the
25
+ checks of _Build a page in one call_ to that answer. Open each page in the browser at the end.
26
+
27
+ ## Pick the block from the data's shape
28
+
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
+ | Numbers used as categories (a rating 1 to 5, a year) | `ChartCard` around `ChartColumn` with `xaxisType: "category"` | `series`, `groupBy` the column |
37
+ | A status column on a table | Tabs on the `TableView`, plus a donut on the analytics page | see _Tables_ |
38
+
39
+ - Put a chart in a `ChartCard`: it adds the headline figure. Through the builder its `chart` is a
40
+ nested block value, `{ "$block": { "type": "ChartArea", "config": {} } }`. A horizontal
41
+ `ChartBar` stays bare: inside a card its category labels read `NaN`.
42
+ - The `response` must match the block: `card` for a `ChartCard` or a bare chart, `value` for a
43
+ `KpiCard`, `items` for a `TopListCard`. Any other pairing draws nothing.
44
+ - Compare periods on KPI cards and top lists (`compare: true`), never on a chart over time:
45
+ the previous period's buckets are other categories, so they draw beside the period instead
46
+ of under it.
47
+ - Sum a measure that adds up (a total, a quantity). Count rows for everything else. Never sum
48
+ a unit price or a rate.
49
+ - Format money with `valueFormat: "currency"` and a `currencyCode` only when the data names its
50
+ currency (a currency column, a comment). Otherwise use `valueFormat: "number"`: the default
51
+ currency is the euro, and a wrong symbol is worse than none.
52
+ - Grouping by a foreign key shows ids. Group by the relation's own columns only; a breakdown by
53
+ a related entity's name goes under _Not possible yet_ in your report.
54
+
55
+ ## Lay out an analytics page
56
+
57
+ Add the blocks in this order. Every analytics page has items 1 to 4.
58
+
59
+ 1. A `PageToolbar` holding a `PeriodSelector`, first on the page (see _Period_).
60
+ 2. One `GridRow` of 3 or 4 `KpiCard`s, each bound to the period.
61
+ 3. The main series over time, a full-width `ChartCard`.
62
+ 4. A `GridRow` of two breakdowns: a bare `ChartBar` for the largest category column, and a
63
+ `ChartDonut` or a `ChartColumn` for another column or a second measure over time.
64
+ 5. A `TopListCard` for a second category column, when one exists.
65
+
66
+ Use at least 3 different chart kinds on the page when the data has the shapes for them. The
67
+ chart kinds are `ChartArea`, `ChartLine`, `ChartColumn`, `ChartBar` and `ChartDonut`; KPI cards
68
+ and top lists are not chart kinds. Use a second kind before you repeat one. A page of KPI cards
69
+ alone is never done.
70
+
71
+ Every card binds the page's period: `periodScope: "page"` on the block, and on its query
72
+ `where` filters on the time axis bound to the request,
73
+ `{ "field": "<time axis>", "op": "ge", "value": { "$param": { "name": "from" } } }` and
74
+ `"le"` with `"to"`. A card over a relation with no time axis stays unbound.
75
+
76
+ ## Period
77
+
78
+ The default period is computed from the data's real dates, never assumed. Read the time
79
+ axis's `range` from the analysis, or profile that column. Then take the first rule that holds,
80
+ counting from today:
81
+
82
+ 1. The data reaches into the last 30 days and spans at least 90 days: `last-90-days`,
83
+ compared with `previous-period`.
84
+ 2. The current year holds at least 3 months of data: `ytd`, compared with `previous-year`.
85
+ 3. Last calendar year holds data: `last-year`, compared with `previous-year` when the year
86
+ before it holds data too, else `none`.
87
+ 4. Otherwise bind nothing to a period, leave the selector out, and say so in your report.
88
+
89
+ Set it on the selector: `defaultPreset`, `defaultComparison`, `presets` (the default, any
90
+ other preset whose window holds data, and `custom`) and `comparisons`. Leave `all` out of
91
+ `presets`: it sends no `from` or `to`, and every bound query fails without them.
92
+
93
+ Pick the bucket so the default window holds 8 to 31 points: `day` up to 31 days, `week` up to
94
+ 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
95
+ chart (area, line, column, bar) over time takes `xaxisType: "category"`, unless a preview's
96
+ `x` values are epoch milliseconds, which take `xaxisType: "datetime"`. A donut or pie takes
97
+ no axis option.
98
+
99
+ ## Name every page
100
+
101
+ Every page you create or map gets a title, an icon and a description; a raw relation name is
102
+ never a title.
103
+
104
+ - **Title**: what the owner calls the content, in their words and plural for lists ("Support
105
+ tickets", not "support_ticket"; "Sales", not "orders stats"). Drop technical prefixes and
106
+ suffixes (`tbl_`, `_v2`). An analytics page is named for the area it covers ("Sales",
107
+ "Customers", "Overview"). Two pages never share a title: when a table page is already
108
+ "Customers", its analytics page is "Customer insights".
109
+ - **Icon**: a Phosphor icon, `i-ph-<name>`, that a reader links to the content at a glance
110
+ (`i-ph-users` for people, `i-ph-package` for goods, `i-ph-receipt` for invoices,
111
+ `i-ph-chart-line-up` for an analytics page). Two pages in one menu never share an icon.
112
+ - **Description**: one sentence on what the page holds or answers, from the data
113
+ ("Every order with its payment and shipping status").
114
+ - **Order**: the main analytics page first (`order: 0`), then the most used lists. Keep a
115
+ table page's order at 100 or more unless it must sit among the dashboards.
116
+
117
+ Set them with `builder_create_page` on new pages, per resource in `builder_map_resources`
118
+ (`title`, `icon`, `description`, `order`), or with `builder_configure_page` afterwards.
119
+
120
+ ## Tables
121
+
122
+ A table page is a working tool: the reader finds a row, sees its state, and acts. Read the
123
+ relation's columns with `builder_resource_structure` (and the proposal's profiles when there
124
+ is one), then give the table every feature its data supports, and none it does not. Each
125
+ rule below names the shape that earns the feature; decide from the columns and their values,
126
+ never from the relation's name.
127
+
128
+ **Columns.** A primary key gets no display and is never a row's label. A boolean keeps its
129
+ default display (no badge). A column that a view filters on, a tab splits on, or a footer
130
+ `where` reads must be `filterable` in the mapping; one that a view sorts on, `sortable`.
131
+ Keep the Builder's proposed displays unless the column's meaning says otherwise:
132
+ a column with few distinct values (a status, a type, a channel, a priority, under about 12
133
+ values) shows coloured badges, one tone per value (green for done or good, amber for waiting,
134
+ red for failed or lost, grey for closed or neutral); free text (a subject, a note, a name)
135
+ never shows badges, even when the sample repeats. A money column shows a price. A relation
136
+ column (a `customer_id`, an `order_id`) is titled by its target ("Customer") and shows the
137
+ target's label, never the raw number: map the target relation with a label first, then send
138
+ the relation column as a relation. Raw id columns stay off the list. Send each field's `display` and the relation's `tabs` in `builder_map_resources`.
139
+
140
+ **Tabs.** A single-choice column with 2 to 6 values that splits the rows into states people
141
+ work through (a status, a stage) gives one tab per value after "All". One tab column per table.
142
+
143
+ **Saved views** (`views`). Add 2 to 4 views when a recurring question is a fixed filter on the
144
+ table: rows waiting for action (a status that means "to do"), recent rows (a date
145
+ `greater_than` `{{now-7d}}` or `{{now-30d}}`), rows assigned to the reader (an owner column
146
+ equal to `{{user.id}}`), outliers worth a look (a stock or a score under a threshold read from
147
+ the profile, a high amount). Each view has a short label that states the question
148
+ ("Awaiting shipment", "This week", "Low stock"), a sort that puts the first row to handle on
149
+ top, and `count: true` when the number itself matters. Keep views and tabs from repeating each
150
+ other: views for questions that cross columns or dates, tabs for the plain split by state.
151
+
152
+ **Display modes.** Offer another display when the data reads better that way, and make it the
153
+ default only when it is the main way to work the table:
154
+
155
+ - **Kanban** (`kanban.groupBy`) when a single-choice status or stage column describes a flow
156
+ rows move through, with 3 to 7 values and rows that are handled one by one (tickets, tasks,
157
+ deliveries, applications). Not for a column that only classifies (a country, a category).
158
+ Kanban works on a read-only table: it shows the flow without moving cards. Leave `draggable`
159
+ off unless the table is editable.
160
+ - **Cards** (`cards.fields`) when each row is an entity people recognise by a few fields
161
+ rather than compare across many columns (a product, a person, a place): 3 to 5 fields, the
162
+ label first, then the badge and the key figure.
163
+ - **Grouped** (`grouped`) when rows are read by day or week (a log, bookings, events): group by
164
+ the main date column with `by: "day"` or `"week"`.
165
+
166
+ **Footer totals** (`footer.summary`). When the table has an additive money or quantity column,
167
+ show its `sum`, and a `count` of rows; add a `count` with a `where` on a status value when that
168
+ number is what the reader checks ("Refunded"). Never sum a unit price, a rate or a score.
169
+
170
+ **KPI cards above the table.** When the relation has a measure or a state worth tracking (an
171
+ amount, rows waiting, a share of a status), put a `GridRow` of 3 or 4 `KpiCard`s above the
172
+ `TableView`, each answering one question the table's reader asks ("Revenue this month",
173
+ "Awaiting shipment", "Refund rate"), with the series and `compare` rules above. A lookup list
174
+ (a reference table, tags, settings) gets none.
175
+
176
+ Set displays, views and footer per resource as `tableOptions` in `builder_map_resources`, or on
177
+ an existing page with `builder_configure_table_view`. A refused choice comes back as
178
+ `invalid_config` with the setting it names: fix that one and send again.
179
+
180
+ ## Build a page in one call, and check it first
181
+
182
+ Build every page, or every set of blocks added to a page, with one `builder_compose_page` call:
183
+ the blocks as an ordered tree (containers carry `children`), each data block with its `query`
184
+ inline (same fields as `builder_add_query`). It writes everything at once and typechecks once.
185
+ Use the single-block tools only for a small fix afterwards.
186
+
187
+ 1. Call it first with `"preview": true` and the default period's `from` and `to` as `args`.
188
+ It writes nothing and answers each block's status. Change or drop every block marked
189
+ `empty`, `zero` or `error` (another measure, the whole history for a card that should not
190
+ follow the period), then preview again. Never write a block over an empty answer.
191
+ 2. Call it again without `preview` to write. A refusal lists every refused block by pointer:
192
+ fix those and call again; nothing was written.
193
+ 3. KPI cards above a table: `pageRef` of the table page, `placement: { "before": "table" }`,
194
+ and the `GridRow` of `KpiCard`s as `blocks`. A later remap keeps them.
195
+ 4. After the last page, check each page as `dms-builder-mcp` _Verify_ says, and fix any block
196
+ that shows no data or an error.
197
+ 5. Your report names every block that still shows no data, and why.
198
+
199
+ The page is done when every block has data in the default period, the page meets the
200
+ layout above, it has a title, an icon and a description, and each table uses every feature
201
+ its data supports.
@@ -0,0 +1,45 @@
1
+ # dms-pages: live pages
2
+
3
+ Part of [REFERENCE.md](REFERENCE.md). A `docs/<path>` link is `https://dms.antelopejs.com/docs/<path>`.
4
+
5
+ - A monitoring page that must not refetch on every event declares `live: { maxRate }` in its page
6
+ options (`slowRateAfter: { period: "7d", maxRate: 60 }` for long periods, `rememberKey: "<module>"`
7
+ to share the choice; `maxRate` is also the polling interval while the stream is down) and places a
8
+ `LiveToggle()` (Live / Pause, L key; `variant: "pill"`, `missedLabel` for "N new requests").
9
+ - A page with a period or live data starts with `pageToolbar({ leading, live, period })`
10
+ (`base/page-toolbar`): the same bar on every page — leading blocks, then "Updated N s ago",
11
+ Live / Pause, the window and the 1H / 24H / 7D / 30D presets, at one `size` and one height
12
+ (24 / 28 / 32 px, with live or not). `live: false` or `period: false` drops a control; without
13
+ `live` it shows the last read and a refresh button. A module's leading chip takes the toolbar's
14
+ height from `usePageToolbarSize().heightClass`. More than one comparison offered
15
+ (`comparisons: ["previous-period", "previous-year", "none"]`) draws a menu naming the compared window ("vs 16 – 17 Oct ▾", the range label then
16
+ without its "vs …"); a single one
17
+ stays on without a control. A `custom` preset shows as a calendar icon, named in full.
18
+ `live` / `period` also take `childId` (keep an id roles already grant, `live` / `period` by
19
+ default) and `meta` (roles-editor name), so a page never builds the toolbar by hand for that;
20
+ `transformOptions` changes a child's options at each registration (a setting read in
21
+ `construct()`) — never patch the toolbar's children afterwards;
22
+ an editor reads the default children from the block type's `initialChildren`.
23
+ A component may draw `<DmsPageToolbarBlock>` and `<DmsLiveToggleBlock>` itself, around controls
24
+ of its own: neither needs a `componentId` or `pageId` there.
25
+ - `liveHold: true` keeps a table's rows while paused, and in Direct while they are on screen unless `whileOnScreen: false` (new
26
+ rows wait behind a "N new · Show" pill over the rows, counting the rows the table's query matches now beyond those held, through its count route); `liveHold: { whileRowOpen, whileScrolled,
27
+ whileSearching, whileSorted }` also holds the table alone; `liveHold.missedLabel` words its "N new".
28
+ Paused, an event counts as its `payload.ids` rows or its `payload.count`, so a module may batch
29
+ publishes with `{ count }`. A hidden tab and `?live=0` pause the page too.
30
+ - A custom component follows that state with `usePageLive()` (`hold(reason)` / `release()`,
31
+ `setMissedDetail()`); one that reads its own data on a topic calls
32
+ `usePageLiveRefresh(refresh, { realtimeTopic, idleRefresh })` — never a throttle of its own.
33
+ `refreshPageBlocks()` (user actions) always reads; `refreshLivePageBlocks()` (timers, feeds) is
34
+ held while paused. A table view's write (row/bulk action, its form saved) already
35
+ calls `refreshPageBlocks()`: KPIs and badges of the page need no wiring of their own.
36
+ - Making a block live: a built-in data block names a `realtimeTopic` (its builder registers the
37
+ topic on the page) and the backend calls `PublishMessage`; a table view follows its controller's
38
+ row events by itself. A block without a topic reads only on `refreshLivePageBlocks()`, the
39
+ polling while the stream is down and `refreshPageBlocks()` — no timer while the stream is up. A
40
+ custom component's own topic needs `RegisterPageTopic(pageId, topic)` in the backend.
41
+ - Pause (user, hold, hidden tab) freezes every block of the page at once: realtime events, row
42
+ events, page-topic events behind `useApiData`, `refreshLivePageBlocks()`, `idleRefresh`, the
43
+ stream-down polling and a component's `useApiData` `refreshInterval`. Each block that missed
44
+ something reads once on resume. User actions and inputs (period, filter, search, sort, page)
45
+ still read; notifications, presence and the menu are not the page and keep updating.