Skip to content

Interface: RenderSpecOptions

API / @xmachines/play-dom / RenderSpecOptions

Defined in: @xmachines/json-render-dom

Named options for renderSpec.

All fields are optional — send defaults to a no-op and handlers to an empty map, so renderSpec(spec, store, registry) renders a static tree.

Properties

PropertyTypeDescriptionDefined in
directives?DirectiveDefinition<ZodType<unknown, unknown, $ZodTypeInternals<unknown, unknown>>>[]Custom directives — user-defined $-prefixed dynamic values that extend the spec expression language. Converted to a DirectiveRegistry once per renderSpec call and forwarded to PropResolutionContext.directives, matching the framework renderers’ directives prop (@json-render 0.19). Built-in expressions always take precedence over custom directives.-
fallback?DomComponentRendererRenderer called when registry has no entry for an element’s type (GAP-04). If absent, unknown types render as null.-
functions?Record<string, ComputedFunction>Map of named compute functions forwarded to PropResolutionContext (GAP-03). Enables { $computed: "fn", args } prop expressions to resolve. When absent, $computed expressions return undefined (no throw).-
handlers?Record<string, ActionHandler>Map of catalog action names → async ActionHandler functions, consumed by defineRegistry’s emit()/watch dispatch. Defaults to {}.-
loading?booleanFlag indicating the spec is still streaming (GAP-06). When true, components can read ctx.loading to render skeleton states, and missing-child warnings (GAP-07) are suppressed since referenced elements may not yet have arrived in the incremental spec.-
navigate?(path) => voidNavigation callback forwarded to DomRenderContext.navigate. Invoked automatically by defineRegistry’s emit() when an action binding resolves with onSuccess: { navigate: "/path" }. Also readable by component implementations via ctx.navigate.-
onConfirm?ConfirmHandlerConfirmation hook forwarded to DomRenderContext.onConfirm. Consulted by defineRegistry’s emit() before executing an action binding that declares confirm. Without it, confirm-gated actions are skipped with a console.warn (never executed unconfirmed).-
onRenderError?RenderErrorHandlerCallback matching RenderErrorHandler = (error, name). Invoked for three distinct error classes: - (error, elementType) when a component renderer throws (GAP-08) - (error, actionName) when an action handler rejects during emit() - (error, actionName) when an action handler rejects in a watch binding If absent, all three fall back to console.error. Forwarded into DomRenderContext.onRenderError so emit() and watch handlers route errors through the same channel as component render errors.-
onWatchSetup?(cleanup) => void | (() => void)Callback invoked with each watch subscription cleanup function (GAP-02). When an element declares watch, the renderer sets up a store subscription and passes its unsubscribe function to this callback. Host renderers collect these to call on teardown. When absent, watch bindings are not wired. May return a replacement cleanup: when the caller wraps the supplied cleanup (e.g. to drop it from its own collection when invoked), the incremental renderer registers the returned wrapper so an unmount-driven release also runs the caller’s bookkeeping. Returning nothing keeps the supplied cleanup.-
send?(event) => voidDispatcher for interaction events (e.g. actor.send), exposed to component implementations via ctx.send. Defaults to a no-op.-
validationFunctions?Record<string, (value, args?) => boolean>Custom validation functions forwarded to DomRenderContext.validationFunctions. Components pass these as customFunctions to runValidationCheck / runValidation from @xmachines/json-render-core. Has no effect on prop resolution.-