Skip to content

Interface: PlaySpec

API / @xmachines/play-view / index / PlaySpec

Defined in: packages/play-view/src/view-types.ts:58

The view that an actor publishes, and that every renderer receives: the XMachines extension of the Spec type of @xmachines/json-render-core.

Each derived view receives the machine context in its state store, under the read-only /context subtree. A spec therefore reads the context through the ordinary { $state: "/context/…" } grammar: in a prop, in a visible condition, and in repeat.statePath. The store always holds the complete context, and a spec reads only the paths that it needs.

An author writes a ViewMeta, and not this type.

Extends

  • Spec

Properties

PropertyModifierTypeDescriptionInherited fromDefined in
elementspublicRecord<string, UIElement>Flat map of elements by keySpec.elements-
rootpublicstringRoot element keySpec.root-
state?publicRecord<string, unknown>Optional initial state to seed the state model. Components using statePath will read from / write to this state.Spec.state-
viewKey?readonlystringThe identity of the view of this derived spec. deriveCurrentView sets it from the meta entry that the derivation selected. A provider uses it as the key of its store lifecycle: a new viewKey seeds the store again, and the same viewKey refreshes /context in place, which keeps the ephemeral view state. Never write this field in meta.view.-packages/play-view/src/view-types.ts:66
viewParts?readonlyreadonly string[]The ids of the state nodes whose views a composed spec holds, in the order of the composition. deriveCurrentView sets it only when a state declares outlets. The viewKey stays the id of the outermost view, so a change of a substate keeps the store; a new viewParts value then seeds the authored state of the new views. Never write this field in meta.view.-packages/play-view/src/view-types.ts:74