@xmachines/json-render-core 0.21.0-xm.2 → 0.21.0-xm.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -358,6 +358,25 @@ const store = createStoreAdapter({
358
358
 
359
359
  The official adapter packages (`@xmachines/json-render-redux`, `@xmachines/json-render-zustand`, `@xmachines/json-render-jotai`) are all built on top of `createStoreAdapter`.
360
360
 
361
+ ### Renderer Utilities (for renderer authors)
362
+
363
+ | Export | Purpose |
364
+ |--------|---------|
365
+ | `withRenderErrorHandler(registry, handler)` | Copy a registry with an `onRenderError` handler on the copy, and keep its slot metadata |
366
+ | `setRenderErrorHandler(registry, handler)` | Put an `onRenderError` handler on a registry, in place, as a property that is not enumerable. `defineRegistry` of each renderer calls it. The handler takes the place of a component named `onRenderError`, and the function warns. A frozen registry keeps no handler, and the function warns |
367
+ | `getRenderErrorHandler(registry)` | The `onRenderError` handler that a registry holds, or `undefined`. A component of that name is no handler |
368
+ | `warnUnusedRenderErrorHandler(registry)` | Warn one time about an enumerable `onRenderError` of a registry, which is a component and no handler. A renderer calls it when a render error finds no handler |
369
+ | `getOwnEntry(map, key)` | The entry of a name in a registry or a map of action handlers. A name of `Object.prototype` is an entry only as an own property |
370
+ | `getRegistryComponent(registry, type)` | The component of a type. The error handler is no component, and a member of `Object.prototype` is one only as an own property of the registry. A string, such as an element type of React, is a component |
371
+ | `reportActionError(handler, error, action, source)` | Report an `on` event or a `watch` whose binding threw: to the handler, with the action name as its second argument, or to `console.error` |
372
+ | `elementSubtreeJson(spec, key, element)` | The JSON of an element and of the elements below it. A renderer resets a failed boundary when it changes |
373
+ | `readWatchedValues(watch, state, previous)` | The values that the `watch` of an element reads. Gives `previous` back while the paths stay the same, in the same order, and each value stays the same (`Object.is`) |
374
+ | `changedWatchPaths(current, previous)` | The watched paths whose value changed. A path that an element starts to watch is not a change |
375
+ | `runWatchBindings(watch, paths, run, isCancelled)` | Run the bindings of the changed paths one after another. Stops on a cancel, and at a binding that throws |
376
+ | `resolveBindingParams(binding, ctx)` | Resolve the params of an action binding against a context |
377
+ | `isBuiltInAction(name)` | True for an action that every renderer runs itself: `setState`, `pushState`, `removeState`, `push`, `pop` and `validateForm`. A renderer reads the `confirm` gate before it runs one |
378
+ | `mergeActionHandlers(prop, registered)` | The handlers of an action provider: the registered handlers on top of the prop. Reads the prop by name, so the `onAction` Proxy of `createRenderer` keeps each action |
379
+
361
380
  ### Types
362
381
 
363
382
  | Export | Purpose |
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as StateModel, V as VisibilityCondition, a as StateCondition, A as AndCondition, O as OrCondition, D as DynamicValue, b as Spec, J as JsonPatch, U as UIElement } from './store-utils-CGwRAVOR.mjs';
2
- export { $ as Action, _ as ActionBinding, a7 as ActionBindingSchema, a0 as ActionConfirm, a9 as ActionConfirmSchema, a4 as ActionDefinition, a6 as ActionExecutionContext, a3 as ActionHandler, a2 as ActionOnError, ab as ActionOnErrorSchema, a1 as ActionOnSuccess, aa as ActionOnSuccessSchema, a8 as ActionSchema, C as ComponentSchema, e as DynamicBoolean, r as DynamicBooleanSchema, d as DynamicNumber, q as DynamicNumberSchema, c as DynamicString, p as DynamicStringSchema, o as DynamicValueSchema, F as FlatElement, f as IndexCondition, I as ItemCondition, M as MixedStreamCallbacks, l as MixedStreamParser, P as PatchOp, R as RepeatStatePath, a5 as ResolvedAction, W as SPEC_DATA_PART, X as SPEC_DATA_PART_TYPE, g as SingleCondition, n as SpecDataPart, k as SpecStreamCompiler, j as SpecStreamLine, h as StateStore, Y as StoreAdapterConfig, m as StreamChunk, i as ValidationMode, ag as action, af as actionBinding, x as addByPath, G as applySpecPatch, E as applySpecStreamPatch, K as compileSpecStream, Q as createJsonRenderTransform, N as createMixedStreamParser, L as createSpecStreamCompiler, Z as createStateStore, ad as executeAction, z as findFormValue, t as getByPath, ae as interpolateString, H as nestedToFlat, B as parseSpecStreamLine, T as pipeJsonRender, y as removeByPath, ac as resolveAction, s as resolveDynamicValue, v as resolveRepeatItemStatePath, u as resolveRepeatStatePath, w as setByPath } from './store-utils-CGwRAVOR.mjs';
1
+ import { S as StateModel, V as VisibilityCondition, a as StateCondition, A as AndCondition, O as OrCondition, b as ActionBinding, D as DynamicValue, c as Spec, U as UIElement, J as JsonPatch } from './store-utils-3y6Mlk7s.mjs';
2
+ export { $ as Action, a7 as ActionBindingSchema, a0 as ActionConfirm, a9 as ActionConfirmSchema, a4 as ActionDefinition, a6 as ActionExecutionContext, a3 as ActionHandler, a2 as ActionOnError, ab as ActionOnErrorSchema, a1 as ActionOnSuccess, aa as ActionOnSuccessSchema, a8 as ActionSchema, C as ComponentSchema, f as DynamicBoolean, s as DynamicBooleanSchema, e as DynamicNumber, r as DynamicNumberSchema, d as DynamicString, q as DynamicStringSchema, p as DynamicValueSchema, F as FlatElement, g as IndexCondition, I as ItemCondition, M as MixedStreamCallbacks, m as MixedStreamParser, P as PatchOp, R as RepeatStatePath, a5 as ResolvedAction, X as SPEC_DATA_PART, Y as SPEC_DATA_PART_TYPE, h as SingleCondition, o as SpecDataPart, l as SpecStreamCompiler, k as SpecStreamLine, i as StateStore, Z as StoreAdapterConfig, n as StreamChunk, j as ValidationMode, ai as action, ah as actionBinding, y as addByPath, H as applySpecPatch, G as applySpecStreamPatch, L as compileSpecStream, T as createJsonRenderTransform, Q as createMixedStreamParser, N as createSpecStreamCompiler, _ as createStateStore, ad as executeAction, B as findFormValue, u as getByPath, af as interpolateString, ae as isBuiltInAction, ag as mergeActionHandlers, K as nestedToFlat, E as parseSpecStreamLine, W as pipeJsonRender, z as removeByPath, ac as resolveAction, t as resolveDynamicValue, w as resolveRepeatItemStatePath, v as resolveRepeatStatePath, x as setByPath } from './store-utils-3y6Mlk7s.mjs';
3
3
  import { z } from 'zod';
4
4
 
5
5
  /**
@@ -268,6 +268,14 @@ declare function resolveBindings(props: Record<string, unknown>, ctx: PropResolu
268
268
  * - Everything else delegates to `resolvePropValue` ($state, $cond, literals).
269
269
  */
270
270
  declare function resolveActionParam(value: unknown, ctx: PropResolutionContext): unknown;
271
+ /**
272
+ * Resolve the params of an action binding with {@link resolveActionParam}.
273
+ *
274
+ * A renderer calls it just before each binding of a chain runs, with the
275
+ * state of that moment in `ctx.stateModel`, so a later binding sees what an
276
+ * earlier one wrote. A binding without params comes back as it is.
277
+ */
278
+ declare function resolveBindingParams(binding: ActionBinding, ctx: PropResolutionContext): ActionBinding;
271
279
 
272
280
  /**
273
281
  * Emitted when an action begins executing. The same `id` appears on the
@@ -949,6 +957,7 @@ declare function buildUserPrompt(options: UserPromptOptions): string;
949
957
  *
950
958
  * @packageDocumentation
951
959
  */
960
+
952
961
  /** Slot names declared by one catalog component. */
953
962
  interface ComponentSlotMetadata {
954
963
  slots?: string[];
@@ -976,6 +985,118 @@ declare function getComponentSlotMetadata(registry: object, type: string): Compo
976
985
  * metadata, or for a component that declares no slots.
977
986
  */
978
987
  declare function warnElementSlots(registry: object, type: string, slots: Record<string, string[]> | undefined): void;
988
+ /**
989
+ * Copy a registry with an `onRenderError` handler on the copy.
990
+ *
991
+ * The copy holds the own components of the registry, so an enumeration of
992
+ * the copy lists them. It has the registry as its prototype, so it also
993
+ * finds a component that the registry has from its own prototype or from a
994
+ * Proxy. The handler is an own property of the copy
995
+ * that is not enumerable, and it replaces a handler that the registry
996
+ * holds. The copy carries the slot metadata of the registry over: the
997
+ * metadata is keyed on the registry object. The registry of the caller does
998
+ * not change.
999
+ */
1000
+ declare function withRenderErrorHandler<TRegistry extends object>(registry: TRegistry, onRenderError: RenderErrorHandler): TRegistry;
1001
+ /**
1002
+ * Put an `onRenderError` handler on a registry, in place. `defineRegistry`
1003
+ * of each renderer calls it. The property is not enumerable, so an
1004
+ * enumeration of the components does not list it. The handler takes the
1005
+ * place of a component of the same name, which a catalog can declare, and
1006
+ * the function warns: an element of that type then renders the fallback.
1007
+ */
1008
+ declare function setRenderErrorHandler(registry: object, onRenderError: RenderErrorHandler): void;
1009
+ /**
1010
+ * Warn one time for each registry that holds an enumerable `onRenderError`
1011
+ * function, when a render error finds no handler: the function counts as a
1012
+ * component of that name, and not as the handler. A renderer calls it
1013
+ * before it writes a render error to `console.error`.
1014
+ */
1015
+ declare function warnUnusedRenderErrorHandler(registry: object | undefined): void;
1016
+ /**
1017
+ * The `onRenderError` handler that a registry holds, or `undefined`. Only a
1018
+ * property that is not enumerable counts, as `setRenderErrorHandler` makes
1019
+ * it: a component named `onRenderError` is no handler.
1020
+ */
1021
+ declare function getRenderErrorHandler(registry: object | undefined): RenderErrorHandler | undefined;
1022
+ /**
1023
+ * The entry of `key` in a map of names, such as a registry or a map of action
1024
+ * handlers. A name of Object.prototype, such as `toString`, `constructor` or
1025
+ * `__proto__`, is an entry only as an own property of the map.
1026
+ */
1027
+ declare function getOwnEntry<TEntry>(map: Record<string, TEntry>, key: string): TEntry | undefined;
1028
+ /**
1029
+ * The own enumerable members of `source`, as descriptors for a copy that
1030
+ * takes no write through a setter of the source. A value is read through
1031
+ * the source, so a reactive source tracks it, and a getter reads the
1032
+ * source when it runs, with the source as `this`.
1033
+ */
1034
+ declare function ownMemberDescriptors(source: object): PropertyDescriptorMap;
1035
+ /**
1036
+ * An empty registry for `components`. A component named `__proto__` gets
1037
+ * an own property first, so that an assignment of it sets that property and
1038
+ * not the prototype of the registry. `defineRegistry` of each renderer
1039
+ * starts from it, and the dom renderer also starts its map of action
1040
+ * handlers from it.
1041
+ */
1042
+ declare function createComponentRegistry<TComponent>(components: object | undefined): Record<string, TComponent>;
1043
+ /**
1044
+ * The component of `type` in a registry, or `undefined`. The registry can be
1045
+ * a plain object, an object with a prototype, or a Proxy. The `onRenderError`
1046
+ * handler and the members of Object.prototype are no components.
1047
+ */
1048
+ declare function getRegistryComponent<TComponent>(registry: Record<string, TComponent>, type: string): TComponent | undefined;
1049
+ /**
1050
+ * Report an action chain that failed: an `on` event or a `watch` whose
1051
+ * binding threw. `onRenderError` gets the error with the action name as its
1052
+ * second argument. Without a handler, the error goes to `console.error`, and
1053
+ * not to an unhandled rejection, because a component discards the promise of
1054
+ * `emit`.
1055
+ */
1056
+ declare function reportActionError(onRenderError: RenderErrorHandler | undefined, error: unknown, action: string, source: "event" | "watch"): void;
1057
+
1058
+ /**
1059
+ * The JSON of an element and of every element below it: its children and the
1060
+ * elements of its named slots.
1061
+ *
1062
+ * A renderer records it when the boundary of an element catches a failure,
1063
+ * and it renders the element again when the JSON changes. A child resolves
1064
+ * its props outside its own boundary, so the boundary of its parent catches
1065
+ * that failure, and a new version of the child must reset it, as the
1066
+ * signatures of react do.
1067
+ */
1068
+ declare function elementSubtreeJson(spec: Spec | null | undefined, key: string | undefined, element: UIElement | null | undefined): string;
1069
+
1070
+ /**
1071
+ * The values that the `watch` map of an element reads from `state`, one for
1072
+ * each watched path.
1073
+ *
1074
+ * The function returns `previous` when `previous` holds the same paths in the
1075
+ * same order with the same values, by `Object.is`, so a watched `NaN` stays
1076
+ * the same too. A
1077
+ * renderer uses the reference as its change signal: a write
1078
+ * to any other path gives the same object back, so it neither runs the watch
1079
+ * nor cancels the bindings that still run.
1080
+ */
1081
+ declare function readWatchedValues(watch: Record<string, unknown> | undefined, state: StateModel, previous: Record<string, unknown> | undefined): Record<string, unknown> | undefined;
1082
+ /**
1083
+ * The watched paths whose value changes from `previous` to `current`, in the
1084
+ * order of `current`.
1085
+ *
1086
+ * A path that `previous` does not hold is new: the element starts to watch it,
1087
+ * and its first value fires nothing, as the first render fires nothing.
1088
+ */
1089
+ declare function changedWatchPaths(current: Record<string, unknown> | undefined, previous: Record<string, unknown> | undefined): string[];
1090
+ /**
1091
+ * Run the bindings of the changed `paths` of `watch` one after another.
1092
+ *
1093
+ * Each binding waits for the previous one, so a later binding sees what an
1094
+ * earlier one wrote. `isCancelled` is read before each binding: a new change
1095
+ * of a watched value, or the unmount of the element, stops the rest of the
1096
+ * chain. A binding that throws stops the chain too, and the promise rejects
1097
+ * with its error, as the chain of an `on` event does.
1098
+ */
1099
+ declare function runWatchBindings(watch: Record<string, ActionBinding | ActionBinding[]>, paths: string[], run: (binding: ActionBinding) => Promise<void>, isCancelled: () => boolean): Promise<void>;
979
1100
 
980
1101
  /**
981
1102
  * Deep-merge `patch` into `base`, returning a new object.
@@ -1130,4 +1251,4 @@ interface Experimental_EvaluatorOptions {
1130
1251
  */
1131
1252
  declare function experimental_createEvaluator(options: Experimental_EvaluatorOptions): Experimental_CompositionEvaluator;
1132
1253
 
1133
- export { type ActionDispatchInfo, type ActionObserver, type ActionSettleInfo, AndCondition, type BuildEditUserPromptOptions, type BuiltInAction, type Catalog, type ComponentSlotMetadata, type ComputedFunction, type DirectiveDefinition, type DirectiveRegistry, DynamicValue, type EditConfig, type EditMode, type Experimental_ChoiceQuestion, type Experimental_ComposeSpecOptions, type Experimental_CompositionCandidate, type Experimental_CompositionCatalog, type Experimental_CompositionEvaluation, type Experimental_CompositionEvaluator, type Experimental_CompositionEvent, type Experimental_CompositionStep, type Experimental_EvaluatorOptions, type InferActionParams, type InferCatalogActions, type InferCatalogComponents, type InferCatalogInput, type InferComponentProps, type InferSpec, JsonPatch, type JsonSchemaOptions, OrCondition, type PromptContext, type PromptOptions, type PromptTemplate, type PropExpression, type PropResolutionContext, type RenderErrorHandler, type Schema, type SchemaBuilder, type SchemaDefinition, type SchemaOptions, type SchemaType, Spec, type SpecIssue, type SpecIssueSeverity, type SpecValidationIssues, type SpecValidationResult, StateCondition, StateModel, UIElement, type UserPromptOptions, type ValidateSpecOptions, type ValidationCheck, type ValidationCheckResult, ValidationCheckSchema, type ValidationConfig, ValidationConfigSchema, type ValidationContext, type ValidationFunction, type ValidationFunctionDefinition, type ValidationResult, VisibilityCondition, VisibilityConditionSchema, VisibilityConditionStrictSchema, type VisibilityContext, autoFixSpec, buildEditInstructions, buildEditUserPrompt, buildUserPrompt, builtInValidationFunctions, check, conditionUsesItemScope, copySlotMetadata, createDirectiveRegistry, deepMergeSpec, defineCatalog, defineDirective, defineSchema, diffToPatches, evaluateVisibility, experimental_composeSpec, experimental_createEvaluator, findDirective, formatSpecIssues, getComponentSlotMetadata, isDevtoolsActive, isNonEmptySpec, markDevtoolsActive, nextActionDispatchId, notifyActionDispatch, notifyActionSettle, registerActionObserver, resolveActionParam, resolveBindings, resolveElementProps, resolvePropValue, runValidation, runValidationCheck, setCatalogSlotMetadata, splitRepeatVisibility, subscribeDevtoolsActive, validateSpec, visibility, warnElementSlots };
1254
+ export { ActionBinding, type ActionDispatchInfo, type ActionObserver, type ActionSettleInfo, AndCondition, type BuildEditUserPromptOptions, type BuiltInAction, type Catalog, type ComponentSlotMetadata, type ComputedFunction, type DirectiveDefinition, type DirectiveRegistry, DynamicValue, type EditConfig, type EditMode, type Experimental_ChoiceQuestion, type Experimental_ComposeSpecOptions, type Experimental_CompositionCandidate, type Experimental_CompositionCatalog, type Experimental_CompositionEvaluation, type Experimental_CompositionEvaluator, type Experimental_CompositionEvent, type Experimental_CompositionStep, type Experimental_EvaluatorOptions, type InferActionParams, type InferCatalogActions, type InferCatalogComponents, type InferCatalogInput, type InferComponentProps, type InferSpec, JsonPatch, type JsonSchemaOptions, OrCondition, type PromptContext, type PromptOptions, type PromptTemplate, type PropExpression, type PropResolutionContext, type RenderErrorHandler, type Schema, type SchemaBuilder, type SchemaDefinition, type SchemaOptions, type SchemaType, Spec, type SpecIssue, type SpecIssueSeverity, type SpecValidationIssues, type SpecValidationResult, StateCondition, StateModel, UIElement, type UserPromptOptions, type ValidateSpecOptions, type ValidationCheck, type ValidationCheckResult, ValidationCheckSchema, type ValidationConfig, ValidationConfigSchema, type ValidationContext, type ValidationFunction, type ValidationFunctionDefinition, type ValidationResult, VisibilityCondition, VisibilityConditionSchema, VisibilityConditionStrictSchema, type VisibilityContext, autoFixSpec, buildEditInstructions, buildEditUserPrompt, buildUserPrompt, builtInValidationFunctions, changedWatchPaths, check, conditionUsesItemScope, copySlotMetadata, createComponentRegistry, createDirectiveRegistry, deepMergeSpec, defineCatalog, defineDirective, defineSchema, diffToPatches, elementSubtreeJson, evaluateVisibility, experimental_composeSpec, experimental_createEvaluator, findDirective, formatSpecIssues, getComponentSlotMetadata, getOwnEntry, getRegistryComponent, getRenderErrorHandler, isDevtoolsActive, isNonEmptySpec, markDevtoolsActive, nextActionDispatchId, notifyActionDispatch, notifyActionSettle, ownMemberDescriptors, readWatchedValues, registerActionObserver, reportActionError, resolveActionParam, resolveBindingParams, resolveBindings, resolveElementProps, resolvePropValue, runValidation, runValidationCheck, runWatchBindings, setCatalogSlotMetadata, setRenderErrorHandler, splitRepeatVisibility, subscribeDevtoolsActive, validateSpec, visibility, warnElementSlots, warnUnusedRenderErrorHandler, withRenderErrorHandler };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { S as StateModel, V as VisibilityCondition, a as StateCondition, A as AndCondition, O as OrCondition, D as DynamicValue, b as Spec, J as JsonPatch, U as UIElement } from './store-utils-CGwRAVOR.js';
2
- export { $ as Action, _ as ActionBinding, a7 as ActionBindingSchema, a0 as ActionConfirm, a9 as ActionConfirmSchema, a4 as ActionDefinition, a6 as ActionExecutionContext, a3 as ActionHandler, a2 as ActionOnError, ab as ActionOnErrorSchema, a1 as ActionOnSuccess, aa as ActionOnSuccessSchema, a8 as ActionSchema, C as ComponentSchema, e as DynamicBoolean, r as DynamicBooleanSchema, d as DynamicNumber, q as DynamicNumberSchema, c as DynamicString, p as DynamicStringSchema, o as DynamicValueSchema, F as FlatElement, f as IndexCondition, I as ItemCondition, M as MixedStreamCallbacks, l as MixedStreamParser, P as PatchOp, R as RepeatStatePath, a5 as ResolvedAction, W as SPEC_DATA_PART, X as SPEC_DATA_PART_TYPE, g as SingleCondition, n as SpecDataPart, k as SpecStreamCompiler, j as SpecStreamLine, h as StateStore, Y as StoreAdapterConfig, m as StreamChunk, i as ValidationMode, ag as action, af as actionBinding, x as addByPath, G as applySpecPatch, E as applySpecStreamPatch, K as compileSpecStream, Q as createJsonRenderTransform, N as createMixedStreamParser, L as createSpecStreamCompiler, Z as createStateStore, ad as executeAction, z as findFormValue, t as getByPath, ae as interpolateString, H as nestedToFlat, B as parseSpecStreamLine, T as pipeJsonRender, y as removeByPath, ac as resolveAction, s as resolveDynamicValue, v as resolveRepeatItemStatePath, u as resolveRepeatStatePath, w as setByPath } from './store-utils-CGwRAVOR.js';
1
+ import { S as StateModel, V as VisibilityCondition, a as StateCondition, A as AndCondition, O as OrCondition, b as ActionBinding, D as DynamicValue, c as Spec, U as UIElement, J as JsonPatch } from './store-utils-3y6Mlk7s.js';
2
+ export { $ as Action, a7 as ActionBindingSchema, a0 as ActionConfirm, a9 as ActionConfirmSchema, a4 as ActionDefinition, a6 as ActionExecutionContext, a3 as ActionHandler, a2 as ActionOnError, ab as ActionOnErrorSchema, a1 as ActionOnSuccess, aa as ActionOnSuccessSchema, a8 as ActionSchema, C as ComponentSchema, f as DynamicBoolean, s as DynamicBooleanSchema, e as DynamicNumber, r as DynamicNumberSchema, d as DynamicString, q as DynamicStringSchema, p as DynamicValueSchema, F as FlatElement, g as IndexCondition, I as ItemCondition, M as MixedStreamCallbacks, m as MixedStreamParser, P as PatchOp, R as RepeatStatePath, a5 as ResolvedAction, X as SPEC_DATA_PART, Y as SPEC_DATA_PART_TYPE, h as SingleCondition, o as SpecDataPart, l as SpecStreamCompiler, k as SpecStreamLine, i as StateStore, Z as StoreAdapterConfig, n as StreamChunk, j as ValidationMode, ai as action, ah as actionBinding, y as addByPath, H as applySpecPatch, G as applySpecStreamPatch, L as compileSpecStream, T as createJsonRenderTransform, Q as createMixedStreamParser, N as createSpecStreamCompiler, _ as createStateStore, ad as executeAction, B as findFormValue, u as getByPath, af as interpolateString, ae as isBuiltInAction, ag as mergeActionHandlers, K as nestedToFlat, E as parseSpecStreamLine, W as pipeJsonRender, z as removeByPath, ac as resolveAction, t as resolveDynamicValue, w as resolveRepeatItemStatePath, v as resolveRepeatStatePath, x as setByPath } from './store-utils-3y6Mlk7s.js';
3
3
  import { z } from 'zod';
4
4
 
5
5
  /**
@@ -268,6 +268,14 @@ declare function resolveBindings(props: Record<string, unknown>, ctx: PropResolu
268
268
  * - Everything else delegates to `resolvePropValue` ($state, $cond, literals).
269
269
  */
270
270
  declare function resolveActionParam(value: unknown, ctx: PropResolutionContext): unknown;
271
+ /**
272
+ * Resolve the params of an action binding with {@link resolveActionParam}.
273
+ *
274
+ * A renderer calls it just before each binding of a chain runs, with the
275
+ * state of that moment in `ctx.stateModel`, so a later binding sees what an
276
+ * earlier one wrote. A binding without params comes back as it is.
277
+ */
278
+ declare function resolveBindingParams(binding: ActionBinding, ctx: PropResolutionContext): ActionBinding;
271
279
 
272
280
  /**
273
281
  * Emitted when an action begins executing. The same `id` appears on the
@@ -949,6 +957,7 @@ declare function buildUserPrompt(options: UserPromptOptions): string;
949
957
  *
950
958
  * @packageDocumentation
951
959
  */
960
+
952
961
  /** Slot names declared by one catalog component. */
953
962
  interface ComponentSlotMetadata {
954
963
  slots?: string[];
@@ -976,6 +985,118 @@ declare function getComponentSlotMetadata(registry: object, type: string): Compo
976
985
  * metadata, or for a component that declares no slots.
977
986
  */
978
987
  declare function warnElementSlots(registry: object, type: string, slots: Record<string, string[]> | undefined): void;
988
+ /**
989
+ * Copy a registry with an `onRenderError` handler on the copy.
990
+ *
991
+ * The copy holds the own components of the registry, so an enumeration of
992
+ * the copy lists them. It has the registry as its prototype, so it also
993
+ * finds a component that the registry has from its own prototype or from a
994
+ * Proxy. The handler is an own property of the copy
995
+ * that is not enumerable, and it replaces a handler that the registry
996
+ * holds. The copy carries the slot metadata of the registry over: the
997
+ * metadata is keyed on the registry object. The registry of the caller does
998
+ * not change.
999
+ */
1000
+ declare function withRenderErrorHandler<TRegistry extends object>(registry: TRegistry, onRenderError: RenderErrorHandler): TRegistry;
1001
+ /**
1002
+ * Put an `onRenderError` handler on a registry, in place. `defineRegistry`
1003
+ * of each renderer calls it. The property is not enumerable, so an
1004
+ * enumeration of the components does not list it. The handler takes the
1005
+ * place of a component of the same name, which a catalog can declare, and
1006
+ * the function warns: an element of that type then renders the fallback.
1007
+ */
1008
+ declare function setRenderErrorHandler(registry: object, onRenderError: RenderErrorHandler): void;
1009
+ /**
1010
+ * Warn one time for each registry that holds an enumerable `onRenderError`
1011
+ * function, when a render error finds no handler: the function counts as a
1012
+ * component of that name, and not as the handler. A renderer calls it
1013
+ * before it writes a render error to `console.error`.
1014
+ */
1015
+ declare function warnUnusedRenderErrorHandler(registry: object | undefined): void;
1016
+ /**
1017
+ * The `onRenderError` handler that a registry holds, or `undefined`. Only a
1018
+ * property that is not enumerable counts, as `setRenderErrorHandler` makes
1019
+ * it: a component named `onRenderError` is no handler.
1020
+ */
1021
+ declare function getRenderErrorHandler(registry: object | undefined): RenderErrorHandler | undefined;
1022
+ /**
1023
+ * The entry of `key` in a map of names, such as a registry or a map of action
1024
+ * handlers. A name of Object.prototype, such as `toString`, `constructor` or
1025
+ * `__proto__`, is an entry only as an own property of the map.
1026
+ */
1027
+ declare function getOwnEntry<TEntry>(map: Record<string, TEntry>, key: string): TEntry | undefined;
1028
+ /**
1029
+ * The own enumerable members of `source`, as descriptors for a copy that
1030
+ * takes no write through a setter of the source. A value is read through
1031
+ * the source, so a reactive source tracks it, and a getter reads the
1032
+ * source when it runs, with the source as `this`.
1033
+ */
1034
+ declare function ownMemberDescriptors(source: object): PropertyDescriptorMap;
1035
+ /**
1036
+ * An empty registry for `components`. A component named `__proto__` gets
1037
+ * an own property first, so that an assignment of it sets that property and
1038
+ * not the prototype of the registry. `defineRegistry` of each renderer
1039
+ * starts from it, and the dom renderer also starts its map of action
1040
+ * handlers from it.
1041
+ */
1042
+ declare function createComponentRegistry<TComponent>(components: object | undefined): Record<string, TComponent>;
1043
+ /**
1044
+ * The component of `type` in a registry, or `undefined`. The registry can be
1045
+ * a plain object, an object with a prototype, or a Proxy. The `onRenderError`
1046
+ * handler and the members of Object.prototype are no components.
1047
+ */
1048
+ declare function getRegistryComponent<TComponent>(registry: Record<string, TComponent>, type: string): TComponent | undefined;
1049
+ /**
1050
+ * Report an action chain that failed: an `on` event or a `watch` whose
1051
+ * binding threw. `onRenderError` gets the error with the action name as its
1052
+ * second argument. Without a handler, the error goes to `console.error`, and
1053
+ * not to an unhandled rejection, because a component discards the promise of
1054
+ * `emit`.
1055
+ */
1056
+ declare function reportActionError(onRenderError: RenderErrorHandler | undefined, error: unknown, action: string, source: "event" | "watch"): void;
1057
+
1058
+ /**
1059
+ * The JSON of an element and of every element below it: its children and the
1060
+ * elements of its named slots.
1061
+ *
1062
+ * A renderer records it when the boundary of an element catches a failure,
1063
+ * and it renders the element again when the JSON changes. A child resolves
1064
+ * its props outside its own boundary, so the boundary of its parent catches
1065
+ * that failure, and a new version of the child must reset it, as the
1066
+ * signatures of react do.
1067
+ */
1068
+ declare function elementSubtreeJson(spec: Spec | null | undefined, key: string | undefined, element: UIElement | null | undefined): string;
1069
+
1070
+ /**
1071
+ * The values that the `watch` map of an element reads from `state`, one for
1072
+ * each watched path.
1073
+ *
1074
+ * The function returns `previous` when `previous` holds the same paths in the
1075
+ * same order with the same values, by `Object.is`, so a watched `NaN` stays
1076
+ * the same too. A
1077
+ * renderer uses the reference as its change signal: a write
1078
+ * to any other path gives the same object back, so it neither runs the watch
1079
+ * nor cancels the bindings that still run.
1080
+ */
1081
+ declare function readWatchedValues(watch: Record<string, unknown> | undefined, state: StateModel, previous: Record<string, unknown> | undefined): Record<string, unknown> | undefined;
1082
+ /**
1083
+ * The watched paths whose value changes from `previous` to `current`, in the
1084
+ * order of `current`.
1085
+ *
1086
+ * A path that `previous` does not hold is new: the element starts to watch it,
1087
+ * and its first value fires nothing, as the first render fires nothing.
1088
+ */
1089
+ declare function changedWatchPaths(current: Record<string, unknown> | undefined, previous: Record<string, unknown> | undefined): string[];
1090
+ /**
1091
+ * Run the bindings of the changed `paths` of `watch` one after another.
1092
+ *
1093
+ * Each binding waits for the previous one, so a later binding sees what an
1094
+ * earlier one wrote. `isCancelled` is read before each binding: a new change
1095
+ * of a watched value, or the unmount of the element, stops the rest of the
1096
+ * chain. A binding that throws stops the chain too, and the promise rejects
1097
+ * with its error, as the chain of an `on` event does.
1098
+ */
1099
+ declare function runWatchBindings(watch: Record<string, ActionBinding | ActionBinding[]>, paths: string[], run: (binding: ActionBinding) => Promise<void>, isCancelled: () => boolean): Promise<void>;
979
1100
 
980
1101
  /**
981
1102
  * Deep-merge `patch` into `base`, returning a new object.
@@ -1130,4 +1251,4 @@ interface Experimental_EvaluatorOptions {
1130
1251
  */
1131
1252
  declare function experimental_createEvaluator(options: Experimental_EvaluatorOptions): Experimental_CompositionEvaluator;
1132
1253
 
1133
- export { type ActionDispatchInfo, type ActionObserver, type ActionSettleInfo, AndCondition, type BuildEditUserPromptOptions, type BuiltInAction, type Catalog, type ComponentSlotMetadata, type ComputedFunction, type DirectiveDefinition, type DirectiveRegistry, DynamicValue, type EditConfig, type EditMode, type Experimental_ChoiceQuestion, type Experimental_ComposeSpecOptions, type Experimental_CompositionCandidate, type Experimental_CompositionCatalog, type Experimental_CompositionEvaluation, type Experimental_CompositionEvaluator, type Experimental_CompositionEvent, type Experimental_CompositionStep, type Experimental_EvaluatorOptions, type InferActionParams, type InferCatalogActions, type InferCatalogComponents, type InferCatalogInput, type InferComponentProps, type InferSpec, JsonPatch, type JsonSchemaOptions, OrCondition, type PromptContext, type PromptOptions, type PromptTemplate, type PropExpression, type PropResolutionContext, type RenderErrorHandler, type Schema, type SchemaBuilder, type SchemaDefinition, type SchemaOptions, type SchemaType, Spec, type SpecIssue, type SpecIssueSeverity, type SpecValidationIssues, type SpecValidationResult, StateCondition, StateModel, UIElement, type UserPromptOptions, type ValidateSpecOptions, type ValidationCheck, type ValidationCheckResult, ValidationCheckSchema, type ValidationConfig, ValidationConfigSchema, type ValidationContext, type ValidationFunction, type ValidationFunctionDefinition, type ValidationResult, VisibilityCondition, VisibilityConditionSchema, VisibilityConditionStrictSchema, type VisibilityContext, autoFixSpec, buildEditInstructions, buildEditUserPrompt, buildUserPrompt, builtInValidationFunctions, check, conditionUsesItemScope, copySlotMetadata, createDirectiveRegistry, deepMergeSpec, defineCatalog, defineDirective, defineSchema, diffToPatches, evaluateVisibility, experimental_composeSpec, experimental_createEvaluator, findDirective, formatSpecIssues, getComponentSlotMetadata, isDevtoolsActive, isNonEmptySpec, markDevtoolsActive, nextActionDispatchId, notifyActionDispatch, notifyActionSettle, registerActionObserver, resolveActionParam, resolveBindings, resolveElementProps, resolvePropValue, runValidation, runValidationCheck, setCatalogSlotMetadata, splitRepeatVisibility, subscribeDevtoolsActive, validateSpec, visibility, warnElementSlots };
1254
+ export { ActionBinding, type ActionDispatchInfo, type ActionObserver, type ActionSettleInfo, AndCondition, type BuildEditUserPromptOptions, type BuiltInAction, type Catalog, type ComponentSlotMetadata, type ComputedFunction, type DirectiveDefinition, type DirectiveRegistry, DynamicValue, type EditConfig, type EditMode, type Experimental_ChoiceQuestion, type Experimental_ComposeSpecOptions, type Experimental_CompositionCandidate, type Experimental_CompositionCatalog, type Experimental_CompositionEvaluation, type Experimental_CompositionEvaluator, type Experimental_CompositionEvent, type Experimental_CompositionStep, type Experimental_EvaluatorOptions, type InferActionParams, type InferCatalogActions, type InferCatalogComponents, type InferCatalogInput, type InferComponentProps, type InferSpec, JsonPatch, type JsonSchemaOptions, OrCondition, type PromptContext, type PromptOptions, type PromptTemplate, type PropExpression, type PropResolutionContext, type RenderErrorHandler, type Schema, type SchemaBuilder, type SchemaDefinition, type SchemaOptions, type SchemaType, Spec, type SpecIssue, type SpecIssueSeverity, type SpecValidationIssues, type SpecValidationResult, StateCondition, StateModel, UIElement, type UserPromptOptions, type ValidateSpecOptions, type ValidationCheck, type ValidationCheckResult, ValidationCheckSchema, type ValidationConfig, ValidationConfigSchema, type ValidationContext, type ValidationFunction, type ValidationFunctionDefinition, type ValidationResult, VisibilityCondition, VisibilityConditionSchema, VisibilityConditionStrictSchema, type VisibilityContext, autoFixSpec, buildEditInstructions, buildEditUserPrompt, buildUserPrompt, builtInValidationFunctions, changedWatchPaths, check, conditionUsesItemScope, copySlotMetadata, createComponentRegistry, createDirectiveRegistry, deepMergeSpec, defineCatalog, defineDirective, defineSchema, diffToPatches, elementSubtreeJson, evaluateVisibility, experimental_composeSpec, experimental_createEvaluator, findDirective, formatSpecIssues, getComponentSlotMetadata, getOwnEntry, getRegistryComponent, getRenderErrorHandler, isDevtoolsActive, isNonEmptySpec, markDevtoolsActive, nextActionDispatchId, notifyActionDispatch, notifyActionSettle, ownMemberDescriptors, readWatchedValues, registerActionObserver, reportActionError, resolveActionParam, resolveBindingParams, resolveBindings, resolveElementProps, resolvePropValue, runValidation, runValidationCheck, runWatchBindings, setCatalogSlotMetadata, setRenderErrorHandler, splitRepeatVisibility, subscribeDevtoolsActive, validateSpec, visibility, warnElementSlots, warnUnusedRenderErrorHandler, withRenderErrorHandler };