Skip to content

Interface: DomRenderContext

API / @xmachines/play-dom / DomRenderContext

Defined in: @xmachines/json-render-dom

Low-level render context passed to each DomComponentRenderer.

Properties

PropertyTypeDescriptionDefined in
directives?DirectiveRegistryCustom directive registry, converted from UIProviderOptions.directives (a DirectiveDefinition[]) once per render pass and forwarded to PropResolutionContext.directives. Components that resolve prop sub-values themselves (via resolvePropValue from @xmachines/json-render-core) should include this in their resolution context so custom $-prefixed dynamic values keep working inside those values. Mirrors the directives context from the framework renderers (useDirectives / DirectivesContextProvider / DIRECTIVES_KEY).-
elementBindings?Record<string, string>Pre-computed two-way binding paths for this element’s props.-
functions?Record<string, ComputedFunction>Optional map of named compute functions, forwarded to PropResolutionContext. Enables { $computed: “funcName”, args: {…} } prop expressions to resolve. Mirrors the functions prop from framework renderer providers.-
handlersRecord<string, ActionHandler>Map of json-render catalog action names → async ActionHandler functions.-
loading?booleanWhen true, indicates the spec is still streaming (e.g. from an AI provider). Component implementations can use this to show skeleton/loading states. When loading=true, missing-child warnings are suppressed. Mirrors the loading prop from framework renderer providers.-
navigate?(path) => voidNavigation function forwarded from UIProviderOptions. Called when an action binding has onSuccess: { navigate: "/path" }. Mirrors the navigate prop in ActionProvider from framework renderers.-
onConfirm?ConfirmHandlerConfirmation hook forwarded from UIProviderOptions.onConfirm. Consulted by emit() before executing an action binding that declares confirm. When absent, confirm-gated actions are skipped with a console.warn instead of executing unconfirmed.-
onRenderError?RenderErrorHandlerError handler forwarded from UIProviderOptions.onRenderError. Matches RenderErrorHandler = (error: unknown, name: string) => void. Called by emit() when an action handler rejects, with (error, actionName). Also called by renderSpec when a component renderer throws, with (error, elementType). When absent, both fall back to console.error. Component implementations may call this directly via ctx.ctx.onRenderError to surface errors through the application’s central error channel.-
renderChildren(keys) => Node[]Render a list of child element keys into DOM nodes.-
repeatBasePath?stringAbsolute JSON Pointer path to the current repeat item (e.g. “/todos/0”). Mirrors repeatBasePath in PropResolutionContext.-
repeatIndex?numberCurrent repeat array index when inside a repeat scope. Mirrors repeatIndex in PropResolutionContext.-
repeatItem?unknownCurrent repeat item when inside a repeat scope. Mirrors repeatItem in @xmachines/json-render-core’s PropResolutionContext.-
send(event) => voidDispatch an event (e.g. to an XState actor).-
specSpecFull spec tree for this render pass.-
storeStateStoreLive state store bound to spec.state.-
validationFunctions?Record<string, (value, args?) => boolean>Custom validation functions available to runValidation / runValidationCheck. Each function receives (value, args?) and returns a boolean. Mirrors customFunctions in ValidationProvider from framework renderers. Components that perform inline validation (e.g. form fields) should read this from ctx.ctx.validationFunctions and pass it as customFunctions to runValidationCheck / runValidation from @xmachines/json-render-core.-