Views in Goat
Portable-ui declarations, routes, state, resources, actions and view verification.
A portable view in portable-ui/1.0 describes a screen’s layout, typed data, interactions and text. GoatCMS runs these views in the Angular panel through the Web renderer. The format allows other renderers. Android and iOS are outside the current implementation. Legacy version=1 mockups use a separate grammar. Public server-rendered pages such as the homepage can have their own templates and handlers in child/app/.
From declaration to route
| Source | Purpose |
|---|---|
herd/views/<id>.view.goat | Declares a view with view:add, a stable ID and a format. |
herd/views/portable.catalog.goat | Connects catalogues for types, components, transports and methods. It defines navigation destinations or imports them from domain catalogues. |
herd/views/<name>.translations.goat | Stores message keys, text and parameter types. |
herd/views/<id>.requirements.md | Lists short, verifiable requirements for the view. |
herd/views/foundation.goat | Selects managers for existing models for the foundation to generate. |
herd/gen.goat and herd/gen/angular.goat | Select routes to compile into Angular and generate method clients and component registries. |
catalog:use --id=... makes a catalogue available to a view. destination:define describes a named destination, its parameters and its path. context:use selects the screen’s context. destination:alias can point an additional path at the same destination. Declaration paths such as /search are relative to the panel shell at /app/.
gen:views:load reads one project snapshot and generates Go publications, Web and MCP method validators, and Angular components. Published templates fix screen structure and the choice of controls at build time. Generated TypeScript binds conditions, expressions and actions to shared panel functions. The panel loads view code from the release, and the editor previews definitions from the selected revision.
/app/view-definitions exposes the release metadata and documents. The panel uses /app/view-contracts to check the artifact and contract set. Check existing publications before adding a path. Send typed arguments to a named destination via navigate --destination=....
Data and lifecycle
context.*contains typed inputs such as a project ID or filter. A parameter affecting screen identity can require remounting the view.state:adddeclares local state such as a draft. Supply an explicit type or infer it from a named model value via--initial-from. Form fields can bind to state in both directions.resource:addbinds a read to a method and typed arguments.on-enterloads on entry,on-argumentsreacts to argument changes, andmanualrequires an explicitresource:load.latestlets the runtime discard a late response from a previous read.resource.<name>.dataholds accepted data. Useavailableandpendingto distinguish loading, refresh and empty results.item.*is scoped to a collection item.- A write has its own request state, such as
request.mark.pending. Confirmed success can accept a form, refresh a resource, close a dialog or navigate. Check an unresolved durable write through the method’s receipt.
Layout, fields and actions
screen:add contains layout and content. component:add selects a component by type ID, prop:set sets a property, and bind:add binds a typed value. slot:set fills a named slot such as a collection row. field:add --mode=edit|display picks a presentation using the field type. Labels, empty states and accessibility text use text:set keys. visible:when and enabled:when control the interface. The backend checks authorization for data and operations.
These excerpts from pilot-notifications.view.goat show a read and an action within a row.
resource:add --name=inbox --from=notifications.list --load=on-enter --concurrency=latest --cache=noneon:activate --call=notifications.markRead --request=mark --refresh=inbox --arguments=<<ARGS
bind --name=id --from=item.id
ARGSOn entry, the runtime reads the current account’s inbox. Within the row, it passes the notification ID, tracks the request as mark and refreshes inbox after confirmed success. pilot-search.view.goat shows debounced search, history updates after a successful read, distinct resource states and a parameterized summary.
Adding and verifying a view
- Define the user flow, role, empty, error and loading states, and what follows a save. Read the requirements file before changing the view. Present proposed changes and get approval before implementing dependent behavior.
- Select the model and method contracts. Add a destination, screen declaration and text keys in all four languages. Use Goat subterminals in heredocs for nested declarations.
- For an existing model manager, select
manager:use --entity=... --module=crudinfoundation.goat. For a custom view, start with a comparable screen inherd/views/. Regenerate after changing the source. - Check the definitions, Web behavior and isolated examples. Test keyboard and focus behavior, draft preservation, route and history behavior, and denied access. If the screen publishes new MCP actions, verify them through the full catalogue or document the coverage gap.
goat view:validate
goat run:script --path=child/ci/panel.goat -- --suite=viewsThe first command validates the sources and their references. The recipe runs Web scenarios, including the reference package with an isolated backend and PostgreSQL. Find the examples in child/e2e/fixtures/portable/ and the specification in herd/specifications/views-v1/. For a routing error, start with the destination and publication registry. For a method error, check binding types, implementation registration and contractSetId compatibility.