@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.
- package/README.md +12 -2
- package/index.d.ts +17 -3
- package/index.mjs +29 -8
- package/package.json +6 -3
- package/skills/dms-best-practices/REFERENCE.md +143 -0
- package/skills/dms-best-practices/SKILL.md +86 -0
- package/skills/dms-builder-mcp/REFERENCE.md +116 -0
- package/skills/dms-builder-mcp/SKILL.md +75 -0
- package/skills/dms-external-database/REFERENCE.md +351 -0
- package/skills/dms-external-database/SKILL.md +222 -0
- package/skills/dms-mockup/SKILL.md +65 -0
- package/skills/dms-mockup/SPEC.md +147 -0
- package/skills/dms-mockup-build/SKILL.md +116 -0
- package/skills/dms-page-design/SKILL.md +201 -0
- package/skills/dms-pages/LIVE.md +45 -0
- package/skills/dms-pages/REFERENCE.md +238 -0
- package/skills/dms-pages/SKILL.md +84 -0
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
# dms-pages reference
|
|
2
|
+
|
|
3
|
+
Deep material for [SKILL.md](SKILL.md): the block catalog, patterns by topic, and the DataTypes
|
|
4
|
+
catalog. Live pages are in [LIVE.md](LIVE.md). A `docs/<path>` link is
|
|
5
|
+
`https://dms.antelopejs.com/docs/<path>`.
|
|
6
|
+
|
|
7
|
+
## Block catalog
|
|
8
|
+
|
|
9
|
+
Every block is a registered type (`ListBlockTypes()` from `@antelopejs/interface-dms/base/block-types`
|
|
10
|
+
lists them with their option schemas); `docs/components` has one page per block.
|
|
11
|
+
|
|
12
|
+
| Group | Blocks |
|
|
13
|
+
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
14
|
+
| Layout | `Grid` + `GridRow` (children must be rows; `{ colSpan }` child metadata; a `GridRow` inside a cell, e.g. in a `Section`, spreads its own children rather than the grid's columns), `HStack` / `VStack` / `Spacer`, `PageToolbar` (`pageToolbar()`), `Card` (slots `actions`, `footer`), `Tab` (`{ slot }` per child), `Guard`, `Placeholder` |
|
|
15
|
+
| Charts & widgets | `KpiCard`, `ChartCard` (wraps one chart), `TopListCard`, `PeriodSelector`, `LiveToggle`; charts `ChartLine`, `ChartArea`, `ChartRangeArea`, `ChartBar`, `ChartColumn`, `ChartScatter`, `ChartMixed`, `ChartRadar`, `ChartCandlestick`, `ChartDonut`, `ChartPie`, `ChartRadialBar`, `ChartHeatmap` |
|
|
16
|
+
| Display | `StatGroup`, `KeyValueList`, `NavCardGrid`, `EmptyState` (its `code` shows a snippet), `Banner`, `CodeBlock` (`code` + `language`, or `fetchUrl` answering `{ code, language? }`) |
|
|
17
|
+
| Lists & settings | `ActivityFeed`, `Meter`, `Section` + `FieldRow` |
|
|
18
|
+
| Data | `Form`, `ResourceForm(controller, { mode: "new" \| "edit" \| "view" })` (from `/base/table-view`), `TableView(controller, options)` |
|
|
19
|
+
| Escape hatch | `CustomComponent(name)` (deep import from `@antelopejs/interface-dms/base/custom` — not in the barrel), always with `.meta()` — see **dms-best-practices** |
|
|
20
|
+
|
|
21
|
+
Nest with `.child("key", builder)`. Builders also carry a behavioral DSL — permissioned
|
|
22
|
+
`.action()`s and `.watch()` reactivity — see `docs/building/actions-and-reactivity`.
|
|
23
|
+
|
|
24
|
+
`Guard({ fetchUrl, field?, when?, fallback? })` wraps any blocks and shows one `EmptyState`
|
|
25
|
+
(`fallback`) in their place when the route says there is nothing: `when: "empty"` (default)
|
|
26
|
+
checks the value at `field` (absent / `null` / `false` / `0` / `""` / `[]`), `when: "notFound"`
|
|
27
|
+
a 404. The children show while loading and on any other failure; an `emptyState` in the
|
|
28
|
+
answer is laid over `fallback` — `docs/components/layout-and-containers/guard`.
|
|
29
|
+
A block whose `fetchUrl` answers 404 shows its own "Not found" (no retry), the 404 body's
|
|
30
|
+
`message` / `emptyState` over it — `docs/components/block-fundamentals#not-found`.
|
|
31
|
+
|
|
32
|
+
A `TableView` scoped by the page URL takes `queryParamFilters: { status: { field: "status" } }`
|
|
33
|
+
(hidden filters read from `?status=`; `routeParamFilters` for slug params like `:id`). No
|
|
34
|
+
glue is needed around it: an active query filter shows the `filtered` empty state, and a
|
|
35
|
+
link changing its value sends the table back to page 1. A drawer or modal row action already
|
|
36
|
+
gets `navigation` (J / K, `index` / `total` in the order shown) —
|
|
37
|
+
`docs/components/tables/row-drawers`.
|
|
38
|
+
|
|
39
|
+
A page's `headerActions` follow its URL: a target URL takes `{{params.X}}` / `{{query.X}}`
|
|
40
|
+
(`?workspace={{query.workspace}}`, a pair the page has no value for is dropped), a label's
|
|
41
|
+
translation takes the page's route and query parameters (`"Download {locale}.json"`), and an
|
|
42
|
+
`availability` reads `context.query` and the route parameters in `context.params` (`:id`),
|
|
43
|
+
asked again when either changes (a detail page hides "Edit" for a missing record) — no need to build
|
|
44
|
+
the header in Vue with `usePageHeaderActions` to carry the scope —
|
|
45
|
+
`node_modules/@antelopejs/interface-dms/docs/3.base/11.page-layouts.md#buttons-that-follow-the-page-url`. An `availability`
|
|
46
|
+
answering `{ hidden: true }` leaves the button out for that query (`{ reason }` only
|
|
47
|
+
disables it): no Vue header to hide "Add key" on a read-only workspace. `order` on a
|
|
48
|
+
header button and `usePageHeaderActions(render, { order })` interleave served buttons with a
|
|
49
|
+
component's client-side ones (default `0`, served first on a tie: `order: -1` puts a Vue
|
|
50
|
+
"Export" before a served "Add key") — `node_modules/@antelopejs/interface-dms/docs/3.base/11.page-layouts.md#ordering-the-header`.
|
|
51
|
+
|
|
52
|
+
A button or row action (`customButtons`, `rowActions.custom`, a page's `headerActions`)
|
|
53
|
+
points at an `ActionTarget`. A detail or record panel (an inspector, a request, a run) is a
|
|
54
|
+
`drawer` target — never a `sidePanel`, and never your own drawer hosted in a
|
|
55
|
+
`CustomComponent`. It opens from the bottom; `direction: "right"` makes it a side sheet,
|
|
56
|
+
600px wide from `lg` (`size: "3xl"` opens it at a modal's width instead), which the user
|
|
57
|
+
resizes by its inner edge and which opens again at that size. On a row it takes the side
|
|
58
|
+
panel's row options: the DMS draws the row header once `rowTitle` (naming the row from its
|
|
59
|
+
fields) or `positionLabel` ("Request 4 of 50") is set (`rowHeader: true` with the defaults),
|
|
60
|
+
with previous / next next to close; J / K step in place, through every row the table lists
|
|
61
|
+
(the position counts them all, a step past the page loaded turns the page, a step goes to
|
|
62
|
+
the open row's neighbour by id so live rows never make it skip or revisit one, and a
|
|
63
|
+
deep-linked row past the page loaded is located in the table's result, in the order
|
|
64
|
+
the table shows, pinned rows leading their own page); `deepLink:
|
|
65
|
+
true` on the target keeps
|
|
66
|
+
`?record=`; `notFound: { title, description }` draws the 404 state — with the table's
|
|
67
|
+
`rowClick: "single"` (a `TableView.fromSource` table reads a deep-linked row beyond its first
|
|
68
|
+
page through `fetchRowUrl: "/api/x/{{row.id}}"`) — never bridge the table's DOM to build one —
|
|
69
|
+
`docs/components/tables/row-drawers#detail-drawers`.
|
|
70
|
+
A drawer a module opens itself through `useDrawer()` keeps the size the user gives it under
|
|
71
|
+
its `sizeKey`, by default its `containerId`, else its component's name — pass `sizeKey` only
|
|
72
|
+
when one component opens drawers that must not share a size, or when the component is
|
|
73
|
+
anonymous — `docs/frontend-composables/ui-toolkit`. On a row of a list the module draws
|
|
74
|
+
itself, `rowHeader: { title, positionLabel, navigation }` draws the DMS's row header (position,
|
|
75
|
+
previous / next, J and K; `titleClass`, `titleBreakAfter`, `subtitle`, `subtitleClass` and
|
|
76
|
+
`component` / `componentOptions` under the position line shape it — never a header component of
|
|
77
|
+
the module's own); `patch({ componentOptions, componentKey, rowHeader })` steps it — never
|
|
78
|
+
import the layer's `RowHeader` component —
|
|
79
|
+
`docs/frontend-composables/ui-toolkit#a-drawer-on-a-row-of-your-own`.
|
|
80
|
+
A drawer's body is a flex column: a body component with a growing root (`flex flex-1 flex-col`)
|
|
81
|
+
fills it and ends with `<DmsContainerFooter>` for its buttons — never measure the drawer nor use
|
|
82
|
+
`--dms-form-foot-*`; a code editor taking the height left (`DmsInputCode fill`, in a stacked
|
|
83
|
+
`DmsFieldRow fill`) — never count its lines from the drawer's size —
|
|
84
|
+
`docs/frontend-composables/ui-toolkit#a-body-that-fills-the-drawer-and-its-footer`.
|
|
85
|
+
A `useDrawer()` body injects what the component calling `useDrawer()` (in its setup) provides —
|
|
86
|
+
never pass a context as a prop to provide it again in the body.
|
|
87
|
+
A `sidePanel` target (non-modal, docked on the right) still works, but is meant for global,
|
|
88
|
+
page-independent panels such as an assistant dock —
|
|
89
|
+
`docs/components/tables/row-drawers#side-panel`.
|
|
90
|
+
A button downloading a file the user's session may read (`/api/...`) takes a `download`
|
|
91
|
+
target, `{ url, filename? }`, with the same `{{row.field}}` / `{{query.X}}` tokens — never a Vue
|
|
92
|
+
header button or an `api` target for it — `node_modules/@antelopejs/interface-dms/docs/3.base/2.types.md`.
|
|
93
|
+
|
|
94
|
+
A row that must stay on top of a table under any sort (a base language, a default
|
|
95
|
+
workspace) takes `pinnedRows: { field: "isBase", equals: true }` — never sort on the
|
|
96
|
+
server for it. A row action names its row with `{field}` braces in its `label`
|
|
97
|
+
(`"Translate {name}"`), and `rowActions.menuLabel` (`"Actions for {name}"`) names the
|
|
98
|
+
row's ⋯ button — `docs/components/tables/columns-and-displays#pinned-rows`.
|
|
99
|
+
|
|
100
|
+
## Patterns by topic
|
|
101
|
+
|
|
102
|
+
### Data, URLs and refresh
|
|
103
|
+
|
|
104
|
+
- Every URL token is `{{<scope>.<key>}}`: `params` and `query` (the page URL, percent-encoded;
|
|
105
|
+
nothing is fetched while one is unresolved), `row` (an action's row), `response` (a form's
|
|
106
|
+
redirect). The same page tokens work in every URL and link option.
|
|
107
|
+
- `.watch(FormEvents.SUBMIT_SUCCESS, BlockFunctions.REFRESH_PAGE)` makes the page's data blocks
|
|
108
|
+
(table views included) re-fetch after a form saves.
|
|
109
|
+
- `periodScope` binds a card, chart, list block, `Meter` or `TableView.fromSource` to a
|
|
110
|
+
`PeriodSelector`, which keeps its period in the page URL (`?<id>.period=`). Its selected
|
|
111
|
+
comparison drives the cards: `KpiCard` names it ("vs previous year", leave `compareLabel`
|
|
112
|
+
unset) and prints the route's `previousValue`; "No comparison" hides the change, the value
|
|
113
|
+
compared against and the label on `KpiCard`, `ChartCard` and `TopListCard`.
|
|
114
|
+
- `realtimeTopic` re-fetches a chart, a `KpiCard`, list block, `Meter`, `Tab` badges or `TableView` on each
|
|
115
|
+
`PublishMessage`. Publish tenant data with the tenant id (`{ tenantId }`): without it the message
|
|
116
|
+
is global and refetches the page in every workspace. A `TableView` needs no option: the DMS
|
|
117
|
+
publishes to every tenant for a table of the shared schema, and a platform (module) page receives
|
|
118
|
+
every tenant's changes.
|
|
119
|
+
|
|
120
|
+
### Live pages
|
|
121
|
+
|
|
122
|
+
A monitoring page, `pageToolbar()`, `LiveToggle`, `liveHold` and pause: see [LIVE.md](LIVE.md).
|
|
123
|
+
|
|
124
|
+
### Texts
|
|
125
|
+
|
|
126
|
+
- A text naming values is a `ComposedText` — `{ key, params: { amount: { type: "money", value: 92200,
|
|
127
|
+
currency: "EUR" } } }` — written by the browser in the reader's language. StatGroup /
|
|
128
|
+
KeyValueList / Banner / NavCardGrid / ActivityFeed / Meter / TopListCard item texts, ActivityFeed
|
|
129
|
+
`params` (typed `count` for plurals), tab badges and layout banners (`RegisterLayoutBanner({ resolve })`
|
|
130
|
+
→ `{ text, actions }`) take it. Never format text server-side.
|
|
131
|
+
- A layout banner (`RegisterLayoutBanner`) shows on the application's pages only by default, never
|
|
132
|
+
inside `/modules` (modules page, module store, module pages). Give `scope:
|
|
133
|
+
LayoutBannerScope.EVERYWHERE` to a workspace-wide state (billing past due, suspended workspace,
|
|
134
|
+
maintenance) that must follow the user into modules; leave the default for anything about the
|
|
135
|
+
application's own data.
|
|
136
|
+
- A route that must word a text reads the request's `x-content-language` header (the language on
|
|
137
|
+
screen), never `users.language` (the profile's, for mails).
|
|
138
|
+
- A status the backend computes (health, outage) is a `Banner({ fetchUrl })`: the route answers a
|
|
139
|
+
`BannerContent` (its buttons may run `api` / modal / quick-action targets with `confirm`) or
|
|
140
|
+
`null` for no banner.
|
|
141
|
+
|
|
142
|
+
### Blocks
|
|
143
|
+
|
|
144
|
+
- `StatGroup` details and `NavCardGrid` card titles take up to two lines before their ellipsis.
|
|
145
|
+
- `StatGroup({ columnsFrom: "md" })` (`DmsStatGroup columns-from`) sets all `columns` side by side from
|
|
146
|
+
that group width — never a class forcing the group's grid (`[&>div]:grid-cols-*`).
|
|
147
|
+
- `ActivityFeed`: `wrap: true` for entries read whole (leave `fillHeight` off), `visibleItems: N`
|
|
148
|
+
for a "Show N more" fold.
|
|
149
|
+
- `KeyValueList` rows take `copy: true` or `copyValue` (the text to copy instead).
|
|
150
|
+
- A fetched list block draws `skeletonCount` placeholders until its first answer in a client
|
|
151
|
+
navigation (a server render waits for the data): set it to the usual number of items so the page
|
|
152
|
+
does not move when they land. A refresh keeps the items on screen until the new ones land.
|
|
153
|
+
- `TopListCard({ actions })` puts link buttons in its head; `Tab({ fit: true })` keeps pill tabs to
|
|
154
|
+
their labels' width; with `persistState` the URL names the open tab by its slot (`?tab=tester`).
|
|
155
|
+
- A `ChartCard` plotting several series names them with `showSeriesLegend: true` (placed by the
|
|
156
|
+
chart's `legendPosition`) — never a raw Apex `legend` in `rawOptions`.
|
|
157
|
+
- A chart route sends series names, categories (`x`) and point labels as `$` keys, bare chart or
|
|
158
|
+
`ChartCard` alike: the browser translates them, so donut slices are `{ x: "$app.plan.pro", y }`.
|
|
159
|
+
|
|
160
|
+
### Tables
|
|
161
|
+
|
|
162
|
+
- A cell's secondary line is a row field holding text or a composed text (or `{ text, tone }`),
|
|
163
|
+
named by `StatusPillDisplay({ subField })`, `IdentityDisplay({ subtitleField })` or
|
|
164
|
+
`TwoLineDisplay({ subField })`; `IdentityDisplay({ emptyLabel, emptyIcon, iconField })`.
|
|
165
|
+
- `StatusPillDisplay({ toneField })`, `DurationDisplay({ toneField, format: "ms" })` and
|
|
166
|
+
`TextDisplay({ toneField })` read a tone from a row field; a `PillsDisplay` item may be
|
|
167
|
+
`{ label, tone?, variant: "soft" | "outline" }`.
|
|
168
|
+
- A `TableView` over a shared controller hides a column on one page with
|
|
169
|
+
`columns: { hidden: ["workspace"] }` — no view just to hide it.
|
|
170
|
+
- A field shown, required or locked by another column's value goes on its `@Column`:
|
|
171
|
+
`visibleWhen: { field: "stage", in: ["lost"] }`, `disabledWhen: { field: "stage", in: ["won"] }`.
|
|
172
|
+
The generated forms and the data routes both apply them (hidden: not mandatory, value ignored,
|
|
173
|
+
stored value cleared on edit; disabled: sent value ignored, stored one kept) — no watch, no custom page.
|
|
174
|
+
- `forms: { new?, edit?, view? }` hands each generated form's builder to a callback
|
|
175
|
+
(`new: (form) => form.watch(FormEvents.FIELD_CHANGE, …)`) for input comfort only — a value filled
|
|
176
|
+
in from another, a field one table's forms leave out. No data rule there: the routes never see it.
|
|
177
|
+
- A table of more than a few columns that phones will read offers the cards and opens them there:
|
|
178
|
+
`displays: [{ id: "table" }, { id: "cards" }], mobileDisplay: "cards"`. Only a display the user
|
|
179
|
+
saved or the open view's own `display` overrides it: a `views.defaultView` that sets no display
|
|
180
|
+
still opens phones on the cards.
|
|
181
|
+
- A table ordered by hand (`reorder: { field }`) moves rows on the grid and cards on the `cards`
|
|
182
|
+
display alike; a `card.component` receives a `reorder` prop and `v-bind`s `reorder.handle`.
|
|
183
|
+
- A `cards` display whose cards need more room sets `card.minWidth` (a CSS length, `230px` by
|
|
184
|
+
default, the skeleton follows): cards stretch to fill the row, a short list's up to twice that.
|
|
185
|
+
- A `cards` display whose `card.component` is taller than the built-in card sets
|
|
186
|
+
`card.skeletonHeight` to its height (a CSS length): the loading placeholder takes it, so the
|
|
187
|
+
pagination footer does not drop when the cards land.
|
|
188
|
+
- A built-in card carries its row's actions top right (the grid row's buttons and … menu, same
|
|
189
|
+
rules and confirmations); a `card.component` opts in with `<component :is="rowActions" />`.
|
|
190
|
+
|
|
191
|
+
### Forms
|
|
192
|
+
|
|
193
|
+
- A unit after a number field is `NumberType({ suffix: "$…days" })` (written in its table cells,
|
|
194
|
+
cards and read-only fields too); a character counter is
|
|
195
|
+
`StringType({ maxLength, showCount: true })` — no custom `inputComponent` for either.
|
|
196
|
+
- A relation picker depending on another field of the form takes `filterBy: { field, from }`:
|
|
197
|
+
`RelationType({ dataApiController: SiteController, filterBy: { field: "customer", from: "customer" } })`
|
|
198
|
+
lists only the picked customer's sites, searches again when it changes and clears a pick made for
|
|
199
|
+
the previous one — no custom picker. `field` must be filterable on the related controller (it
|
|
200
|
+
throws at registration otherwise) — `docs/components/data-types`.
|
|
201
|
+
- A field whose value follows another one (stage → probability) takes a watch running
|
|
202
|
+
`FormFunctions.SET_FIELD_VALUE` with `{ targetField, valueMap: { won: 100, lost: 0 } }` (or a fixed
|
|
203
|
+
`value`) on `FIELD_CHANGE` keyed on the source `fieldId` — never a custom component. It writes on a
|
|
204
|
+
change only, never over the values a record opens with; a rule that must hold stays in the write
|
|
205
|
+
route — `docs/components/forms/validation-and-watches#setting-a-value-from-another-field`.
|
|
206
|
+
- A short number or text field (an estimate, a count, a code) takes `width: "compact"` on its
|
|
207
|
+
`NumberType` / `StringType` rather than filling the row; one bounded to 6 digits or a
|
|
208
|
+
`maxLength` of 16 or less is compact already, and `width: "full"` opts out. Phones keep the
|
|
209
|
+
full row.
|
|
210
|
+
- A long sectioned `Form` groups its navigation with `FormSection.navGroup`, in the side list and
|
|
211
|
+
the `sectionNav: "jump"` chips alike.
|
|
212
|
+
- A module's own `inputComponent` submits its form, adds a validator and focuses a field with
|
|
213
|
+
`useEnclosingForm()` (never `closest("form")` / `requestSubmit()`); a link ending in `#<fieldId>`
|
|
214
|
+
opens the form on that field. `DmsInputNumber` emits `adjust` when it keeps another value than the
|
|
215
|
+
one typed — listen to it rather than forcing a remount.
|
|
216
|
+
|
|
217
|
+
### Custom components
|
|
218
|
+
|
|
219
|
+
- Name the record at the end of the breadcrumb with
|
|
220
|
+
`usePageRecordLabel().setLabel(useDmsRoute().path, label)`. A hidden detail page next to its
|
|
221
|
+
list (`project/:id` beside `projects`) declares `parent: ProjectsPage` in its menu options so
|
|
222
|
+
the breadcrumb shows the list before the record — `docs/building/navigation`.
|
|
223
|
+
- Format through `useRegionalFormat()`; `useRegionalFormat({ locale: "format" })` writes in the
|
|
224
|
+
locale of the DMS's texts (`en` → `en-GB`).
|
|
225
|
+
- Bring a block into view with `scrollToBlock("tabs.statistics")` — never a DOM query.
|
|
226
|
+
- Show code with `DmsCodeSnippet` (`language`, `title`, `maxLines` or `maxHeight`, `wrap`) — never a
|
|
227
|
+
`<pre>` and a copy button of your own.
|
|
228
|
+
|
|
229
|
+
## DataTypes
|
|
230
|
+
|
|
231
|
+
A field's `type` is a **DataType instance**: `new DefaultDataTypes.StringType({ … })`. The
|
|
232
|
+
catalog (19 built in, `@antelopejs/interface-dms/base/data-types`): `String`, `Number`, `Date`,
|
|
233
|
+
`Boolean`, `Select`, `Price`, `Percentage`, `Email`, `Color`, `Password`, `Url`, `Phone`,
|
|
234
|
+
`Relation`, `CascaderRelation`, `Address`, `RichText`, `StringTime`,
|
|
235
|
+
`File`, `Image` (each as `<Name>Type`), plus `StatusType` via the `data-types` barrel. The
|
|
236
|
+
same types drive TableView columns and filters — options per type are in
|
|
237
|
+
`docs/components/data-types`. Custom types: subclass `DataType`, decorate with
|
|
238
|
+
`@RegisterDataType("id")` (frontend side: `docs/extending-the-dashboard/custom-data-types`).
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dms-pages
|
|
3
|
+
description: Declares AntelopeJS DMS admin pages in code and composes their blocks. Use when writing a @RegisterPage / PageController class, composing Form, TableView, Chart, Grid or KpiCard blocks from @antelopejs/interface-dms/base, choosing DataTypes, wiring the routes and DataControllers that feed a page, or editing page TypeScript when the builder MCP is unavailable or cannot make a change.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Pages and components in code
|
|
7
|
+
|
|
8
|
+
The DMS is backend-driven: you declare a **page** and attach **blocks** to it as static fields. The builders produce a serializable description that the shared Vue frontend renders, so a standard screen needs no Vue. **Before composing a page, apply dms-best-practices** (blocks only, custom for the missing block, `.meta()`, design fidelity). A `docs/<path>` link is `https://dms.antelopejs.com/docs/<path>`: pages in `docs/building/pages-and-components`, the navigation tree in `docs/building/navigation`, one page per block under `docs/components`.
|
|
9
|
+
|
|
10
|
+
## Pick the path
|
|
11
|
+
|
|
12
|
+
- **The builder MCP answers** (`builder_catalog` is among your tools): build through **dms-builder-mcp**. It writes this same code, typechecked, and keeps the builder's index in step. Use this skill for what the builder reports `opaque_target` or `unsupported`, for routes and DataControllers, and for custom blocks; then call `builder_refresh`.
|
|
13
|
+
- **Safe mode is on**: the builder tools are the only way to write. Follow **dms-builder-mcp**.
|
|
14
|
+
- **No builder MCP**: write the TypeScript below yourself.
|
|
15
|
+
|
|
16
|
+
This skill ships with the `antelopejs` plugin, not with the project's DMS. The project's installed `@antelopejs/interface-dms` is the source of truth: when a name below is missing from its types (`node_modules/@antelopejs/interface-dms`, TSDoc and `docs/`), follow the installed version.
|
|
17
|
+
|
|
18
|
+
## Declaring a page
|
|
19
|
+
|
|
20
|
+
A page is a class extending `PageController(id, options)` decorated with `@RegisterPage()`. Registration happens at import time: `src/index.ts` must import the pages module.
|
|
21
|
+
|
|
22
|
+
```ts
|
|
23
|
+
import { PageController, RegisterPage } from "@antelopejs/interface-dms/page";
|
|
24
|
+
|
|
25
|
+
@RegisterPage()
|
|
26
|
+
export class RecipesPage extends PageController("recipes", {
|
|
27
|
+
displayName: "Recipes", // sidebar label (a "$dms_x.y" i18n key in real modules)
|
|
28
|
+
icon: "i-ph-cooking-pot", // any iconify name
|
|
29
|
+
module: "cookbook", // a RegisterModule'd module id; can be combined with a category inside the module
|
|
30
|
+
order: 0,
|
|
31
|
+
}) {}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
`options` is the `MenuOptions` shape: `displayName`, `icon`, `module` and/or `category` (at least one; a module page's explicit category descends from the module's root), `urlSlug` (defaults to the id), `order`, `description`, `hidden`, `type`, plus auth options (`publicAccess`, `authOnly`, `memberAccess`, `permission`, `noComponentPermissions`, `ownerOnly`; see **dms-auth**). `ownerOnly: true` opens the page to the platform owner only, as on a module page: no role can be granted it, and the Roles editor does not list it. `Category(id, options)` returns a `CategoryInfo` for a page's `category`; `RegisterModule({ id, … })` creates a module root that pages join with `module: "<id>"`. Module pages live under `/modules/<moduleId>/<urlSlug>` and are **owner-only by design**: a screen for regular users goes under `pagesCategory` or a normal `Category`.
|
|
35
|
+
|
|
36
|
+
## Composing blocks
|
|
37
|
+
|
|
38
|
+
Each **static field on the page class whose value is a block builder** becomes a named block. Builders are fluent; import them from `@antelopejs/interface-dms/base` (barrel or subpaths):
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { PageController, RegisterPage } from "@antelopejs/interface-dms/page";
|
|
42
|
+
import { Form } from "@antelopejs/interface-dms/base/form";
|
|
43
|
+
import { DefaultDataTypes } from "@antelopejs/interface-dms/base/data-types/default-types";
|
|
44
|
+
import { HttpMethod } from "@antelopejs/interface-dms/base/types";
|
|
45
|
+
|
|
46
|
+
@RegisterPage()
|
|
47
|
+
export class SubmitRecipePage extends PageController("submit-recipe", {
|
|
48
|
+
displayName: "Submit Recipe",
|
|
49
|
+
module: "cookbook",
|
|
50
|
+
}) {
|
|
51
|
+
static form = Form({
|
|
52
|
+
title: "Submit a Recipe",
|
|
53
|
+
fields: [
|
|
54
|
+
{
|
|
55
|
+
id: "chef",
|
|
56
|
+
label: "Chef Name",
|
|
57
|
+
type: new DefaultDataTypes.StringType({ maxLength: 100 }),
|
|
58
|
+
},
|
|
59
|
+
{ id: "email", label: "Email", type: new DefaultDataTypes.EmailType() },
|
|
60
|
+
],
|
|
61
|
+
submitUrl: "/api/recipes",
|
|
62
|
+
submitUrlMethod: HttpMethod.post,
|
|
63
|
+
kind: "action", // "create" for a form making a row; omit for a record form (save bar)
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
[REFERENCE.md](REFERENCE.md) has the block catalog (`Form`, `TableView`, the charts, layout containers, dashboard widgets, `CustomComponent`), nesting rules, the behavioral DSL (permissioned `.action()`s, `.watch()` reactivity) and patterns by topic.
|
|
69
|
+
|
|
70
|
+
**Custom UI is only the missing block.** A part with no DMS equivalent becomes one `CustomComponent` (from `@antelopejs/interface-dms/base/custom`) carrying `.meta({ name, description, icon })` with `$` keys, as **dms-best-practices** says (`docs/components/custom-component`).
|
|
71
|
+
|
|
72
|
+
## Feeding blocks with data
|
|
73
|
+
|
|
74
|
+
Blocks pull data from URLs. Declare routes with the `@antelopejs/interface-api` decorators (`Controller`, `Get`, `Post`, `@Parameter`, `@JSONBody`); return a plain object for 200 or throw `new HTTPResult(status, body)`. `GetModel(Model)` (from `@antelopejs/interface-database-decorators`) gives `get`, `getAll`, `insert`, `update` and `delete`. Routes under a controller that a page or DataController wraps **inherit** its auth (see **dms-auth**). A route declared on a page class is served under `/dms/pages`, not at the page's own path: name it with `pageRoutePath(slug, "/route")` from `@antelopejs/interface-dms/page` in a `fetchUrl` or `submitUrl`. A plain `Controller` the frontend calls sits under `/api/<module>/`.
|
|
75
|
+
|
|
76
|
+
A **`TableView` is normally backed by a `DataController`**: a class `extends DataController(TableClass, TableViewRoutes.All, Controller("/path"))` registered with `@RegisterDataController()` (both from `@antelopejs/interface-data-api`). `TableClass` is a `Table` declared with `@RegisterTable(name, schema)` from `@antelopejs/interface-database-decorators`. `TableViewRoutes` (from `@antelopejs/interface-dms/base/table-view`) has the presets `Get`, `List`, `Select`, `Count`, `New`, `Edit`, `Delete`, `Archive`, `Restore` and `All`. Field decorators: `@Column`, `@Select`, `@Exported`, `@ArchiveField`, `@Searchable` from `@antelopejs/interface-dms/base` (plus class-level `@ColumnGroup(id, config)`), `@Listable` and `@Sortable` from `@antelopejs/interface-data-api/metadata`. Read a real one first: `@antelopejs/interface-dms/data-controllers` (`members`); guide in `docs/components/data-controller`. Database rows carry **`_id`** as the primary key: return and type it as `_id`.
|
|
77
|
+
|
|
78
|
+
## DataTypes
|
|
79
|
+
|
|
80
|
+
A field's `type` is a **DataType instance**, `new DefaultDataTypes.StringType({ … })`; the same types drive TableView columns and filters. [REFERENCE.md](REFERENCE.md) lists the built-in types and how to register custom ones.
|
|
81
|
+
|
|
82
|
+
## Verify in the browser
|
|
83
|
+
|
|
84
|
+
The build typechecks `src/` only: it misses a Vue error in a custom component and a wrong URL. After editing pages, restart the project and open each page as **dms-builder-mcp** _Verify_ says, or in the browser without the MCP (see **dms-project**). A hand-written link to a module page includes the `/modules/<moduleId>` prefix (or reads `fullSlug` from the layout): a missing prefix 404s through the frontend catch-all even though the build is clean. The page is done when every block it shows has data and the browser console and server logs hold no error from it.
|