CX · Reference guideux
PlaygroundDownloadsAboutv0.17.0

ux

The SEMANTIC CORE of the UX projection (EXPERIMENTAL x/ tier; #787): the vocabulary, the fragment addressing, the validation, the three projections (command→form, query→table, feature-grammar→form/columns), the hint claims, the patch algebra a live feed lowers onto, and the surface document's routing correspondence. It contains NO RENDERER and imports no markup library: cx-x/ux-web lowers a semantic tree to HTML/htmx and cx-x/ux-tui lowers the same tree to a terminal, and neither is privileged. Renderer-private intent — swap modes, out-of-band targets, SSE endpoints — is refused on semantic elements and lives instead in the render context document a renderer reads for itself; a region declares a LOGICAL feed name and an action declares the element path it AFFECTS. Fragment identity is exactly (route, feature instance, element path) — theme, locale, actor and data are content, never identity — and content-of is the normal form on which two renderings are asserted to agree.

Experimental x/ tier — imported as cx-x/ux. Bundled and gated in-tree like any other module, but EXEMPT from the frozen-surface stability promise (std-lib README, decision D3): a semver-breaking change is allowed here while the surface settles, and the frozen-surface canary never counts it. Pin behaviour you depend on with your own fixtures.

ux:frag

[$ux:frag] ($route::string $feature::string $path::string) -> element — Build a fragment address from its three identity inputs; its strict canonical bytes are the identity.

ux:frag-address

[$ux:frag-address] ($f::element) -> string — The Tier-1 content address of a fragment address, tagged sha2-256: like every other address in the suite.

ux:frag-id

[$ux:frag-id] ($f::element) -> string — The short selector-safe spelling of an address: cx- plus the first 16 hex chars of its sha2-256 — a derived rendering, never a second identity.

ux:frag-id-of

[$ux:frag-id-of] ($repr::string) -> string — The DOM id derived from an already-computed canonical form — byte-identical to frag-id, and half the canonicalization, which measurement showed dominates rendering.

ux:frag-repr

[$ux:frag-repr] ($f::element) -> string — The full readable canonical form, so goldens stay diffable and clients can recover the address.

ux:path-step

[$ux:path-step] ($base::string $step::string) -> string — Append one step to an element path.

ux:row-step

[$ux:row-step] ($base::string $key::any) -> string | () — A collection row's path step, keyed by the declared row key; absence in yields absence out, because positional row identity is never minted.

ux:vocabulary

[$ux:vocabulary] () -> [sequence string] — The semantic element set the projection emits — surface-neutral, assuming no hover, pointer, CSS-shaped layout, or renderer transport.

ux:in-vocabulary

[$ux:in-vocabulary] ($n::string) -> bool — Is an element name a member of the semantic vocabulary?

ux:tones

[$ux:tones] () -> [sequence string] — The closed tone set for a badge — semantic meanings, never colors; each renderer decides what a tone looks like.

ux:valid-tone

[$ux:valid-tone] ($t::string) -> bool — Is a tone name a member of the closed tone set?

ux:renderer-private-attrs

[$ux:renderer-private-attrs] () -> [sequence string] — The attribute names a semantic element may NOT carry — each one a renderer's private concept; a tree carrying one is a tree only that renderer can honor.

ux:feed-binding

[$ux:feed-binding] ($rctx::any $name::string) -> element | () — The render context's binding for one logical feed name: its endpoint and event. Shared by every renderer, because both are clients of the same surface.

ux:swap-mode

[$ux:swap-mode] ($rctx::any $affects::string) -> string — The swap mode declared for one affects= path, else the context default, else outerHTML. A renderer with no notion of swap modes never calls it.

ux:binding-refusals

[$ux:binding-refusals] ($el::any $rctx::any) -> [sequence element] — Refuse a live= naming a feed the render context does not bind — a region that silently is not live passes every server-side gate and then never updates.

ux:refusals-of

[$ux:refusals-of] ($el::any) -> [sequence element] — Every refusal in one semantic subtree, collected before any lowering — the SHARED gate, so a tree one renderer accepts and another rejects cannot exist.

ux:joined

[$ux:joined] ($a::any $b::any) -> [sequence element] — Read two refusal sequences back as one flat node-set.

ux:seq-child

[$ux:seq-child] ($el::any) -> bool — Is this child a SEQUENCE rather than an element? A [?for] in an element body yields one sequence-valued child, and every tree walk must see through it.

ux:descend

[$ux:descend] ($el::any $ctx::map) -> map — The fragment context an element's children see: a placed element contributes its author-assigned id as the element-path step, and the render context rides along untouched.

ux:ctx-at

[$ux:ctx-at] ($ctx::map $path::string) -> map — The same fragment context at a different element path.

ux:ctx-frag

[$ux:ctx-frag] ($ctx::map) -> element — The fragment address a context currently denotes.

ux:affects-frag

[$ux:affects-frag] ($el::any $ctx::map) -> element | () — The fragment an action or form declares that it updates — DERIVED, so a renderer's target cannot drift from the identity it minted for the target.

ux:str-or

[$ux:str-or] ($v::any $dflt::string) -> string — An absent attribute's default — NOT ?else over [$string], which never fires because the empty string exists.

ux:label-of

[$ux:label-of] ($el::any) -> string — An element's display label: its label= attribute when present, else its text.

ux:label-of-name

[$ux:label-of-name] ($n::string) -> string — Derive a human label from a param or verb name — the ruled degradation when no documentation supplies one.

ux:level-of

[$ux:level-of] ($el::any) -> string — A heading's level as a literal name, defaulting to 2 — read as a string because a cast would RAISE on level=abc and escape the refusal contract.

ux:child-elements

[$ux:child-elements] ($el::any $n::string) -> [sequence element] — The child ELEMENTS named n. NOT $el/n: a named child step is a field read and ATOMIZES to the child's value on a single match, so [$first $el/n] returns a string for a one-member collection and an element for a two-member one — a difference every two-row fixture hides.

ux:absent

[$ux:absent] ($x::any) -> bool — Is this absence rather than an element? NOT [not [$exists x]]: $exists is false for a single element taken with [$first]/[$nth] as well as for absence, so it cannot tell found-one from found-none — the most load-bearing distinction a tree walk makes. [$count] can.

ux:first-child

[$ux:first-child] ($el::any $n::string) -> element | () — The first child element named n, or absence. NOT for a PARSED DOCUMENT: [$cx:parse] returns a document node the child axis does not traverse, even though [$count] reports 1 — read those with the descendant axis.

ux:has-str

[$ux:has-str] ($seq::any $s::string) -> bool — Membership of a string in a sequence of stringables.

ux:has-address

[$ux:has-address] ($el::any) -> bool — Does this element own a distinct fragment address? A property of the semantic tree, not of a renderer, so both renderers mint from one answer.

ux:child-ctx

[$ux:child-ctx] ($el::any $ctx::map) -> map — THE one definition of how an element path grows: a region re-roots feature and path, a form steps by its verb, a keyed row by its key, a placed element by its author-assigned id, and structure leaves the path alone.

ux:address-pairs

[$ux:address-pairs] ($el::any $ctx::map) -> [sequence element] — Every (DOM id, readable address) pair a semantic tree will mint — taken from the semantic tree, so the check runs once and is shared rather than re-walking each renderer's larger output.

ux:address-collisions

[$ux:address-collisions] ($el::any $ctx::map) -> [sequence element] — Refuse a duplicate DOM id — a hash-truncation collision or a reused address — never silently disambiguate. Detection is three counts and O(n log n); the pairwise scan that names the offenders runs only when a count disagrees, which is a path that refuses the render anyway.

ux:dangling-affects

[$ux:dangling-affects] ($el::any $ctx::map) -> [sequence element] — Refuse an affects= naming a path no element in the same tree mints. Without it a swap targets an id that does not exist and the page silently does not update — which looks like a caching problem and is the worst symptom an addressing mistake can have.

ux:content-of

[$ux:content-of] ($el::any) -> element — The COMMON CONTENT NORMAL FORM: content and structure with presentation stripped. Each renderer supplies a readback from its own output to this form, and the fixtures assert all three canonical-equal.

ux:content-repr

[$ux:content-repr] ($el::any) -> string — The canonical bytes of the content normal form — what two renderings must agree on.

ux:form

[$ux:form] ($source::string $verb::string $opts::map) -> element | [err …] — Project a command def onto a semantic form — fields from the param list, required from the non-defaulted positionals, labels degrading to name-derived; derived at render time, never from a materialized manifest.

ux:form-error

[$ux:form-error] ($message::string) -> element — Render a command refusal as a form error, carrying the refusal's own message verbatim — the UX layer never restates a rule.

ux:feature-form

[$ux:feature-form] ($feature::any $verb::string $opts::map) -> element | [err …] — Project an ACT verb of an XAP FEATURE DOCUMENT onto a semantic form — fields from the verb's own declared intent parameters when the grammar states them, falling back to the noun the verb writes when it does not. The reference estate defines commands as feature grammar, not as [?def]s, so this is the subject the third face must project there.

ux:feature-noun

[$ux:feature-noun] ($feature::any $noun::string) -> [sequence element] — The noun a feature declares under that name — public so a surface can project one more instance of a repeating group without re-deriving the grammar.

ux:feature-columns

[$ux:feature-columns] ($feature::any $noun::string) -> [sequence [sequence string]] — A noun's field names as column names, in the domain author's declaration order. Nests ONE level — a [?for] in an element body yields one sequence-valued child — so an absent noun reads as absence, not as an empty name.

ux:schema-address

[$ux:schema-address] ($schema::any) -> string — The E2 content address of a DECLARED schema — byte-identical to what register-schema binds. Takes a SCHEMA, never a value: an address inferred from one sample carries that sample's cardinality and cannot serve as a claim key.

ux:claim-key

[$ux:claim-key] ($addr::string $path::string) -> string — The composite claim-key spelling: the tagged schema address immediately followed by the CXPath — a derived spelling of the pair, never a third identity.

ux:hint-for

[$ux:hint-for] ($hints::any $addr::string $path::string $type::string) -> string | () — Resolve one hint type for a keyed node, longest matching path first; absence is a normal answer and the default projection applies.

ux:table

[$ux:table] ($rows::any $opts::map) -> element — Project a query result onto a semantic table — columns derived from the row schema, rows keyed only by a DECLARED key, nested collections rendered as nested tables, and the row container addressed so a live patch has somewhere to land.

ux:rows-container-step

[$ux:rows-container-step] () -> string — The element-path step a projected table's row container takes — the address a live patch appends into.

ux:rows-container-path

[$ux:rows-container-path] ($table-path::string) -> string — The row container's element path for a table placed at the given path.

ux:row-columns

[$ux:row-columns] ($schema::any $rowname::string) -> [sequence string] — A row type's scalar attribute names in schema order — a column exists because a value does.

ux:key-for

[$ux:key-for] ($opts::map $rowname::string) -> string | () — The DECLARED key attribute for one row type, or absence — never guessed from an attribute named id.

ux:cell-text

[$ux:cell-text] ($r::any $attr::string) -> string — One attribute's value as text through the canonical scalar printer, so a decimal renders at the precision it was stored at.

ux:feed-ops

[$ux:feed-ops] ($frames::any $rows::any $ctx::map $opts::map) -> [sequence element] — Lower a live-modes ∂ script onto the SEMANTIC PATCH ALGEBRA — insert / update / remove / repaint over a keyed collection addressed by element path, never by a renderer's swap syntax. retract carries only a position, so the current row list recovers its key, and an unkeyed collection collapses every frame to a repaint.

ux:feed

[$ux:feed] ($feature::string $path::string $name::string $body::any) -> element — The live region: it names a LOGICAL FEED, and the endpoint and event live in the render context — so one declaration reaches a browser and a terminal without either transport being spelled in the tree.

ux:routes-of

[$ux:routes-of] ($surface::element) -> [sequence element] — A surface document's route table as data: path, feature, instance name, and template per route.

ux:duplicate-instances

[$ux:duplicate-instances] ($surface::element) -> [sequence element] — Refuse composing the same feature instance twice on one route — no silent ordinals, because the instance name is a fragment-identity input.

ux:fragment-paths

[$ux:fragment-paths] ($surface::element) -> [sequence string] — The fragment endpoints a surface's routes declare — kept INSIDE the route/resource correspondence check rather than exempted from it, because an unrouted fragment endpoint is as much a page outside the composition as an unrouted page.

ux:service-refusals

[$ux:service-refusals] ($surface::element $served::any) -> [sequence element] — Refuse any drift between a surface document's routes and the resource paths its [?http-service] registers, in both directions.

ux:surface-verb-refusals

[$ux:surface-verb-refusals] ($surface::element $features::any) -> [sequence element] — The static half of verb coverage at compose time (W16-b): every act verb the composed features declare is offered by some route or declared not-offered with a why — a why-less declaration does not account for its verb.

ux:check-surface

[$ux:check-surface] ($surface::element $served::any $features::any) -> true | [err …] — The compose-time gate over a surface document, its service's resource table, and the feature documents it composes (verb accounting is part of composing at all — W16-b).

ux:currency-symbol

[$ux:currency-symbol] ($c::string) -> string — The display symbol for an ISO currency code (USD/EUR/GBP/JPY); an unknown code falls back to the code itself plus a space, never an error.

ux:group-digits

[$ux:group-digits] ($d::string) -> string — Insert thousands separators into a digit string, right to left ('1234567' -> '1,234,567').

ux:money-text

[$ux:money-text] ($v::string $cur::string) -> string — Render a decimal carrier and its currency as display text (sign, symbol, grouped integer part, two-place fraction) — never routed through a float.

ux:rating-fifths

[$ux:rating-fifths] ($v::string) -> int — A 0..5 rating carrier as a whole number of filled marks, rounding half-up and clamping to 5.

ux:rating-text

[$ux:rating-text] ($v::string) -> string — The marks AND the number, always together (P0-66): filled/empty stars followed by the numeric value, shared by every renderer.

ux:formatted

[$ux:formatted] ($el::any $raw::string) -> string — The ONE place a format= hint turns a carrier into display text — money and rating dispatch here; anything else passes through raw.

ux:allowed-attrs

[$ux:allowed-attrs] ($n::string) -> sequence — The closed attribute list for one vocabulary member — the authority the attribute-closure gate checks against; an unknown member yields the empty sequence.

ux:own-attr-names

[$ux:own-attr-names] ($el::any) -> sequence — The element's OWN attribute names, enumerated through a fixed-depth rooted carrier scan (the binding surface has no attribute wildcard).

ux:act-verbs

[$ux:act-verbs] ($feature::any) -> sequence — The feature's invokable verbs — every [verb] whose effect is 'act', by the P0-17 discriminator.

ux:control-verbs

[$ux:control-verbs] ($el::any) -> sequence — Every verb a semantic tree offers as a control (action, form, or verb-carrying quantity), distinct — twenty cards offering one verb are one affordance.

ux:verbs-uncovered

[$ux:verbs-uncovered] ($offers::any $el::any) -> sequence — The verbs a route declares it offers that its rendered tree does not offer as a control — each as a ux-verb-uncovered refusal.

ux:verbs-unaccounted

[$ux:verbs-unaccounted] ($feature::any $offered::any $not-offered::any) -> sequence — Surface-level completeness: every act verb the feature declares that no route offers and no [not-offered] accounts for — the missing-affordance class equivalence cannot see (L5).

ux:found

[$ux:found] ($x::any) -> bool — True iff the value is present — delegates to [$present] (#854); the retired exists-or-named workaround's public name, kept for its callers.

ux:collisions-with

[$ux:collisions-with] ($pairs::any) -> sequence — Address-collision refusals over a precomputed address-pair set — empty when every pair and every id is distinct.

ux:err-refusals

[$ux:err-refusals] ($el::any) -> sequence — Every [err …] spliced into a semantic tree, surfaced as a ux-err-in-tree refusal — an err embedded in a document has already lost the property that makes it a refusal.

ux:dangling-affects-with

[$ux:dangling-affects-with] ($el::any $ctx::map $pairs::any) -> sequence — Every affects= naming a path neither the tree mints nor (for a fragment) the render context declares — the silently-lands-nowhere class, refused.

ux:declared-containers

[$ux:declared-containers] ($rctx::any) -> sequence — The container paths a render context declares ([swap]/[fragment] entries) — what a fragment's affects= is allowed to aim at.

ux:committed

[$ux:committed] ($message::string) -> element — A success notice for a committed intent — the caller's message in a tone=ok notice; the other half of form-error, owed by the same reasoning.

ux:entered

[$ux:entered] ($opts::map $name::string $dflt::string) -> string — The value the operator already typed for one control (from opts.values), or the default — what keeps a refused form from losing its input.

ux:field-error

[$ux:field-error] ($opts::map $name::string) -> string — The refusal message that belongs to ONE control (from opts.errors), or the empty string — the message renders next to its field, not in a banner.

ux:reference-select

[$ux:reference-select] ($f::any $noun::string $opts::map) -> element — A reference field as a required ux:select over the referenced noun's rows; a missing option set yields an empty select (an empty catalogue is a legitimate state).

ux:options-for

[$ux:options-for] ($opts::map $noun::string) -> sequence — The caller's option set for one noun ([options for=… [option value=… label=…]…]) as ux:option elements; absent set yields the empty sequence.

ux:repeating-group

[$ux:repeating-group] ($f::any $ref::any $feature::any $opts::map) -> element — The nested WRITE case: a repeat=true ux:group over the referenced noun's fields, one rendered instance per surviving wire index.

ux:instance-indices

[$ux:instance-indices] ($opts::map $group::string) -> sequence — WHICH group instances to re-render, by their own wire index (gaps preserved — indices are identity, so removing lines.0 must not renumber lines.1); an unentered form mints index 0.

ux:index-part

[$ux:index-part] ($s::string $n::int) -> string — The index segment of a grouped wire name ('lines.2.sku' at the group prefix length -> '2'); too-short names yield '0'.

ux:group-instance

[$ux:group-instance] ($f::any $ref::any $feature::any $opts::map $i::int) -> element — One instance of a repeated noun as a ux:card of controls named .. — the index keeps two instances from collapsing on the flat form wire.

ux:intent-params

[$ux:intent-params] ($v::any) -> sequence — The parameter names a verb's [intent [do …]] grammar declares — the verb's real signature; empty when the verb has not declared one (the noun remains the fallback).

ux:feature-card

[$ux:feature-card] ($feature::any $spec::any $row::any $opts::map) -> element — One row as a ux:card, driven by a route-level [card …] spec: media, title, subtitle, the shows= fields that carry values (empty ones drop), and the buy action.

ux:row-attr

[$ux:row-attr] ($row::any $name::string) -> string — One attribute of a row as a string, or '' when absent or unnamed — the total accessor card projection is built on.

ux:noun-field-view

[$ux:noun-field-view] ($ns::any $fname::string $row::any $opts::map) -> element — ONE declared field as a labelled ux:field — label from the declaration (or derived from the name), format from the hint claim keyed by (noun address, path), which is why money is money everywhere.

ux:feature-fields

[$ux:feature-fields] ($feature::any $noun::string $row::any $skip::any $opts::map) -> sequence — Every declared field of a noun projected as labelled values, minus the skip list and the value-less — the detail page's specification block, driven by the noun so a new attribute gains a row here and nowhere else.

ux:format-for

[$ux:format-for] ($hints::any $addr::string $col::string) -> any — The format= hint claim for one column, keyed by (schema content-address, /column path) — absent when no claim speaks for it.

ux:layout-find

[$ux:layout-find] ($layout::any $id::string) -> element | () — The [placed …] element carrying this surface-doc id, anywhere in the layout document, or absence — ids are unique per document (P0-16).

ux:layout-ids

[$ux:layout-ids] ($layout::any) -> [sequence string] — Every placed id in the layout document, document order.

ux:layout-parent-id

[$ux:layout-parent-id] ($layout::any $id::string) -> string — The id of the placed element holding this one; '' means it sits at the layout root.

ux:layout-successor

[$ux:layout-successor] ($layout::any $id::string) -> string — The id of the placed sibling FOLLOWING this one, or '' when it is last — what makes the inverse-pair table (P0-108) computable: put-it-back is insert-before-what-followed.

ux:layout-hint

[$ux:layout-hint] ($layout::any $id::string $hint::string) -> string — The SURFACE-LEVEL value of one hint on one placed element, or '' when it carries none and the inherited resolution applies (P0-107) — also the prior value the set-hint inverse restores.

ux:component-known

[$ux:component-known] ($components::any $name::string) -> bool — Is a component name in the resolved registry? Placeable is a cascade-resolvable component name, never raw markup (P0-105).

ux:component-container

[$ux:component-container] ($components::any $name::string) -> bool — Is a component declared container=true — allowed to hold placed children (a wrap target, a place/move parent)?

ux:layout-refusals

[$ux:layout-refusals] ($layout::any $cmd::any $components::any) -> [sequence element] — Every refusal one layout command earns against the FULL document: address-miss (P0-28), id-collision (P0-16/P0-105), unknown or non-container component, cycle and incoherent position (P0-29), unknown command.

ux:layout-apply

[$ux:layout-apply] ($layout::any $cmd::any $components::any) -> element | [err …] — Apply ONE layout command against the full document (P0-29) — pure structural surgery touching only what the command addresses (P0-26); the amended document, or one [err] naming every refusal. The caller journals, stamps and publishes.

ux:layout-apply-batch

[$ux:layout-apply-batch] ($layout::any $cmds::any $components::any) -> element | [err …] — A P0-27 batch, atomic: all-or-nothing, one journal entry at the boundary; the first refusal refuses the batch whole.

ux:layout-param

[$ux:layout-param] ($layout::any $id::string $param::string) -> string — The value of one content param on one placed element, or '' when it carries none and the registry default applies (P0-111) — the prior the set-param inverse restores.

ux:component-params

[$ux:component-params] ($components::any $name::string) -> [sequence element] — One registry entry's [param name= default= carrier=] declarations — the component's editable content surface (P0-113).

ux:component-variants

[$ux:component-variants] ($components::any $name::string) -> [sequence element] — One registry entry's [variant name= options=] axes — closed option sets written as ordinary surface-level hints (P0-107/P0-113).

ux:component-accepts

[$ux:component-accepts] ($components::any $name::string) -> [sequence string] — The component names a container may hold (P0-113); absent accepts= means anything, and a place or move of an unaccepted child refuses with ux-layout-not-accepted — the rule that stops an editor's reasonable guess from producing an invalid tree.

ux:component-fixed

[$ux:component-fixed] ($components::any $name::string) -> bool — Is a component declared fixed — restylable but never moved, removed or wrapped (load-bearing chrome, e.g. an affects= target)?

ux:layout-inverse

[$ux:layout-inverse] ($layout::any $cmd::any) -> [sequence element] — The P0-108 inverse-pair table, computed against the PRE-state: move↔move-back, set-hint↔set-hint-prior, place↔remove, remove↔the reconstructing place batch, wrap↔(move the child back THEN remove the empty wrapper) as one P0-27 batch.

ux:op-replace

[$ux:op-replace] ($path::string $el::any) -> element — A replace operation over an addressed element path (the P0-44 algebra reaching non-row elements, P0-83) — each renderer lowers it for itself: the browser swaps out-of-band, a terminal re-reads.