Skip to content

Interface: DomRenderContext

API / @xmachines/play-dom / DomRenderContext

Defined in: packages/play-dom/src/json-render/types.ts:217

Low-level render context passed to each DomComponentRenderer.

Properties

PropertyTypeDescriptionDefined in
elementBindings?Record<string, string>Pre-computed two-way binding paths for this element’s props.packages/play-dom/src/json-render/types.ts:231
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.packages/play-dom/src/json-render/types.ts:238
handlersRecord<string, ActionHandler>Map of json-render catalog action names → async ActionHandler functions.packages/play-dom/src/json-render/types.ts:225
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.packages/play-dom/src/json-render/types.ts:278
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.packages/play-dom/src/json-render/types.ts:258
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.packages/play-dom/src/json-render/types.ts:270
renderChildren(keys) => Node[]Render a list of child element keys into DOM nodes.packages/play-dom/src/json-render/types.ts:227
repeatBasePath?stringAbsolute JSON Pointer path to the current repeat item (e.g. “/todos/0”). Mirrors repeatBasePath in PropResolutionContext.packages/play-dom/src/json-render/types.ts:293
repeatIndex?numberCurrent repeat array index when inside a repeat scope. Mirrors repeatIndex in PropResolutionContext.packages/play-dom/src/json-render/types.ts:288
repeatItem?unknownCurrent repeat item when inside a repeat scope. Mirrors repeatItem in @json-render/core’s PropResolutionContext.packages/play-dom/src/json-render/types.ts:283
send(event) => voidDispatch an event (e.g. to an XState actor).packages/play-dom/src/json-render/types.ts:223
specSpecFull spec tree for this render pass.packages/play-dom/src/json-render/types.ts:219
storeStateStoreLive state store bound to spec.state.packages/play-dom/src/json-render/types.ts:221
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 @json-render/core.packages/play-dom/src/json-render/types.ts:248