CX · Reference guidecx-platform-ux
PlaygroundDownloadsAboutv0.18.0-pre.1

cx-platform-ux

the web and terminal surfaces

Why reach for it

One semantic tree, two renderers, neither privileged. cx-platform-ux is the projected surface: a closed vocabulary of headings, tables, forms, inputs and notices that a command, a query or a feature grammar projects onto, a web renderer that lowers it to HTML and a pinned subset of htmx attributes, and a terminal renderer that paints the same tree to a cell grid — so anything the vocabulary silently assumed about a browser fails in the terminal instead of passing unnoticed.

A fragment's identity is exactly a triple — route, feature instance, path — hashed to a content address and a DOM id derived from it; the same triple is the same fragment, and composing one feature twice on a route without distinct instance names is a refusal. Renderer-private intent — a swap mode, an out-of-band target, an event-stream endpoint — is refused on a semantic element and lives in the render context a renderer reads for itself; a region names a logical feed, an action names the path it affects.

The projections are the point: a table's columns derive from the row schema, and a row earns an address by declaring its key rather than by spelling an attribute id; a form derives from a [?def] and its documentation, with a required input for every parameter that has no default; a feature grammar projects to its form and columns, and an unknown verb refuses. A live feed's changes lower onto a small patch algebra, an unkeyed feed collapses to a repaint, and the surface document's routes and the resources behind them are checked against each other in both directions. The ux-capability page walks the whole capability.

What it gives you

Three modules of the platform group: the semantic core, which contains no renderer and imports no markup library, and its two peer renderers. Each links to the reference page projected from its own documentation.

module import it as where it lives reference
ux [?lib 'cx-platform/ux'] Ring 1 · the platform group ux reference
ux-tui [?lib 'cx-platform/ux-tui'] Ring 1 · the platform group ux-tui reference
ux-web [?lib 'cx-platform/ux-web'] Ring 1 · the platform group ux-web reference

Try it

A command definition with an [effects] clause and its documentation, projected onto a form: the heading is the summary, each parameter is an input with its kind and its help text, the one with a default is optional, and the submit label is derived from the verb.

prog.cx

        [?lib 'cx-platform/ux' as=ux]
[?let
  [= $src """
[?def place-order scope=public impure [effects [write]] [returns element]
  ($customer::string $qty::int $note::string="")
  [ordered customer=$customer]]
[fn-doc name=place-order scope=public purity=impure
  [summary '''Place a customer order.''']
  [param-doc name=customer '''Who the order is for.''']]
"""]
  [$ux:form $src "place-order" {affects: "/live/new"}]]
      
        $ cx prog.cx
[ux:form verb=place-order affects='/live/new' [ux:heading level=2 Place a customer order.] [ux:input name=customer kind=string required='true' help='Who the order is for.'] [ux:input name=qty kind=int required='true'] [ux:input name=note kind=string required='false'] [ux:submit label='Place order']]
      

Fixture ux-060-form-projection-from-a-command-def in deps/cx-platform-ux/conformance/xap/ux.cxd — replayed against this cx when the page was built.

Status

The surfaces ship as a package: the three modules are bundled into the build from the pin, where they keep the x/ source path they graduated from, and the application host serves the composed grammar through them to a terminal and a browser.

fact as the registry records it
ships as package
status extracted
pinned at 2950dbd34
builds on cx-core-code, cx-platform-flow
built on by nothing pins it yet
bundled modules 3
BUILDS ON THIS REPOSITORY · SHIPS BUILT ON BY cx-core-code cx-platform-flow cx-platform-ux ux ux-tui ux-web nothing pins it yet DRAWN FROM registry/repos.cxd's pins= COLUMN AND registry/modules.cxd WHEN THIS PAGE WAS BUILT
Fig. — what cx-platform-ux plugs into: the repositories it builds on (left), the modules it ships (centre), the repositories that build on it (right) · drawn from registry/repos.cxd, deps.cxd and registry/modules.cxd when this page was built