@azx-pbc/axiom-react 0.0.0-stage → 0.0.1

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.
Files changed (191) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +604 -2
  3. package/dist/FormErrorBoundary.d.ts +37 -0
  4. package/dist/FormErrorBoundary.d.ts.map +1 -0
  5. package/dist/FormErrorBoundary.js +54 -0
  6. package/dist/FormErrorBoundary.js.map +1 -0
  7. package/dist/FormProvider.d.ts +197 -0
  8. package/dist/FormProvider.d.ts.map +1 -0
  9. package/dist/FormProvider.js +149 -0
  10. package/dist/FormProvider.js.map +1 -0
  11. package/dist/field-error.d.ts +154 -0
  12. package/dist/field-error.d.ts.map +1 -0
  13. package/dist/field-error.js +2 -0
  14. package/dist/field-error.js.map +1 -0
  15. package/dist/field-props.d.ts +362 -0
  16. package/dist/field-props.d.ts.map +1 -0
  17. package/dist/field-props.js +64 -0
  18. package/dist/field-props.js.map +1 -0
  19. package/dist/form-context.d.ts +31 -0
  20. package/dist/form-context.d.ts.map +1 -0
  21. package/dist/form-context.js +13 -0
  22. package/dist/form-context.js.map +1 -0
  23. package/dist/form-store.d.ts +784 -0
  24. package/dist/form-store.d.ts.map +1 -0
  25. package/dist/form-store.js +2179 -0
  26. package/dist/form-store.js.map +1 -0
  27. package/dist/hints.d.ts +60 -0
  28. package/dist/hints.d.ts.map +1 -0
  29. package/dist/hints.js +158 -0
  30. package/dist/hints.js.map +1 -0
  31. package/dist/index.d.ts +57 -0
  32. package/dist/index.d.ts.map +1 -0
  33. package/dist/index.js +36 -0
  34. package/dist/index.js.map +1 -0
  35. package/dist/render/field-value.d.ts +92 -0
  36. package/dist/render/field-value.d.ts.map +1 -0
  37. package/dist/render/field-value.js +124 -0
  38. package/dist/render/field-value.js.map +1 -0
  39. package/dist/render/nodes.d.ts +303 -0
  40. package/dist/render/nodes.d.ts.map +1 -0
  41. package/dist/render/nodes.js +325 -0
  42. package/dist/render/nodes.js.map +1 -0
  43. package/dist/render/schema.d.ts +30 -0
  44. package/dist/render/schema.d.ts.map +1 -0
  45. package/dist/render/schema.js +40 -0
  46. package/dist/render/schema.js.map +1 -0
  47. package/dist/render/value-text.d.ts +59 -0
  48. package/dist/render/value-text.d.ts.map +1 -0
  49. package/dist/render/value-text.js +104 -0
  50. package/dist/render/value-text.js.map +1 -0
  51. package/dist/store/array-bindings.d.ts +110 -0
  52. package/dist/store/array-bindings.d.ts.map +1 -0
  53. package/dist/store/array-bindings.js +181 -0
  54. package/dist/store/array-bindings.js.map +1 -0
  55. package/dist/store/bindings.d.ts +12 -0
  56. package/dist/store/bindings.d.ts.map +1 -0
  57. package/dist/store/bindings.js +16 -0
  58. package/dist/store/bindings.js.map +1 -0
  59. package/dist/store/buffer-state.d.ts +42 -0
  60. package/dist/store/buffer-state.d.ts.map +1 -0
  61. package/dist/store/buffer-state.js +51 -0
  62. package/dist/store/buffer-state.js.map +1 -0
  63. package/dist/store/configure.d.ts +19 -0
  64. package/dist/store/configure.d.ts.map +1 -0
  65. package/dist/store/configure.js +28 -0
  66. package/dist/store/configure.js.map +1 -0
  67. package/dist/store/derive.d.ts +106 -0
  68. package/dist/store/derive.d.ts.map +1 -0
  69. package/dist/store/derive.js +417 -0
  70. package/dist/store/derive.js.map +1 -0
  71. package/dist/store/errors.d.ts +20 -0
  72. package/dist/store/errors.d.ts.map +1 -0
  73. package/dist/store/errors.js +101 -0
  74. package/dist/store/errors.js.map +1 -0
  75. package/dist/store/fields.d.ts +35 -0
  76. package/dist/store/fields.d.ts.map +1 -0
  77. package/dist/store/fields.js +81 -0
  78. package/dist/store/fields.js.map +1 -0
  79. package/dist/store/form-channel.d.ts +174 -0
  80. package/dist/store/form-channel.d.ts.map +1 -0
  81. package/dist/store/form-channel.js +411 -0
  82. package/dist/store/form-channel.js.map +1 -0
  83. package/dist/store/gates.d.ts +22 -0
  84. package/dist/store/gates.d.ts.map +1 -0
  85. package/dist/store/gates.js +44 -0
  86. package/dist/store/gates.js.map +1 -0
  87. package/dist/store/ids.d.ts +20 -0
  88. package/dist/store/ids.d.ts.map +1 -0
  89. package/dist/store/ids.js +28 -0
  90. package/dist/store/ids.js.map +1 -0
  91. package/dist/store/inputs.d.ts +114 -0
  92. package/dist/store/inputs.d.ts.map +1 -0
  93. package/dist/store/inputs.js +202 -0
  94. package/dist/store/inputs.js.map +1 -0
  95. package/dist/store/layout.d.ts +81 -0
  96. package/dist/store/layout.d.ts.map +1 -0
  97. package/dist/store/layout.js +285 -0
  98. package/dist/store/layout.js.map +1 -0
  99. package/dist/store/messages.d.ts +56 -0
  100. package/dist/store/messages.d.ts.map +1 -0
  101. package/dist/store/messages.js +157 -0
  102. package/dist/store/messages.js.map +1 -0
  103. package/dist/store/option-pages.d.ts +193 -0
  104. package/dist/store/option-pages.d.ts.map +1 -0
  105. package/dist/store/option-pages.js +598 -0
  106. package/dist/store/option-pages.js.map +1 -0
  107. package/dist/store/parse-print.d.ts +105 -0
  108. package/dist/store/parse-print.d.ts.map +1 -0
  109. package/dist/store/parse-print.js +415 -0
  110. package/dist/store/parse-print.js.map +1 -0
  111. package/dist/store/proposals.d.ts +114 -0
  112. package/dist/store/proposals.d.ts.map +1 -0
  113. package/dist/store/proposals.js +90 -0
  114. package/dist/store/proposals.js.map +1 -0
  115. package/dist/store/publish.d.ts +48 -0
  116. package/dist/store/publish.d.ts.map +1 -0
  117. package/dist/store/publish.js +96 -0
  118. package/dist/store/publish.js.map +1 -0
  119. package/dist/store/snapshots.d.ts +63 -0
  120. package/dist/store/snapshots.d.ts.map +1 -0
  121. package/dist/store/snapshots.js +154 -0
  122. package/dist/store/snapshots.js.map +1 -0
  123. package/dist/store/steps.d.ts +13 -0
  124. package/dist/store/steps.d.ts.map +1 -0
  125. package/dist/store/steps.js +31 -0
  126. package/dist/store/steps.js.map +1 -0
  127. package/dist/store/view.d.ts +124 -0
  128. package/dist/store/view.d.ts.map +1 -0
  129. package/dist/store/view.js +301 -0
  130. package/dist/store/view.js.map +1 -0
  131. package/dist/store/visibility.d.ts +68 -0
  132. package/dist/store/visibility.d.ts.map +1 -0
  133. package/dist/store/visibility.js +231 -0
  134. package/dist/store/visibility.js.map +1 -0
  135. package/dist/store/wizard-cursor.d.ts +43 -0
  136. package/dist/store/wizard-cursor.d.ts.map +1 -0
  137. package/dist/store/wizard-cursor.js +67 -0
  138. package/dist/store/wizard-cursor.js.map +1 -0
  139. package/dist/store/writes.d.ts +50 -0
  140. package/dist/store/writes.d.ts.map +1 -0
  141. package/dist/store/writes.js +91 -0
  142. package/dist/store/writes.js.map +1 -0
  143. package/dist/typed.d.ts +134 -0
  144. package/dist/typed.d.ts.map +1 -0
  145. package/dist/typed.js +74 -0
  146. package/dist/typed.js.map +1 -0
  147. package/dist/useAsyncOptions.d.ts +20 -0
  148. package/dist/useAsyncOptions.d.ts.map +1 -0
  149. package/dist/useAsyncOptions.js +70 -0
  150. package/dist/useAsyncOptions.js.map +1 -0
  151. package/dist/useBufferedInput.d.ts +69 -0
  152. package/dist/useBufferedInput.d.ts.map +1 -0
  153. package/dist/useBufferedInput.js +132 -0
  154. package/dist/useBufferedInput.js.map +1 -0
  155. package/dist/useField.d.ts +42 -0
  156. package/dist/useField.d.ts.map +1 -0
  157. package/dist/useField.js +63 -0
  158. package/dist/useField.js.map +1 -0
  159. package/dist/useFieldArray.d.ts +25 -0
  160. package/dist/useFieldArray.d.ts.map +1 -0
  161. package/dist/useFieldArray.js +18 -0
  162. package/dist/useFieldArray.js.map +1 -0
  163. package/dist/useForm.d.ts +20 -0
  164. package/dist/useForm.d.ts.map +1 -0
  165. package/dist/useForm.js +9 -0
  166. package/dist/useForm.js.map +1 -0
  167. package/dist/useFormState.d.ts +23 -0
  168. package/dist/useFormState.d.ts.map +1 -0
  169. package/dist/useFormState.js +11 -0
  170. package/dist/useFormState.js.map +1 -0
  171. package/dist/useGate.d.ts +15 -0
  172. package/dist/useGate.d.ts.map +1 -0
  173. package/dist/useGate.js +21 -0
  174. package/dist/useGate.js.map +1 -0
  175. package/dist/useLayout.d.ts +29 -0
  176. package/dist/useLayout.d.ts.map +1 -0
  177. package/dist/useLayout.js +59 -0
  178. package/dist/useLayout.js.map +1 -0
  179. package/dist/useMessage.d.ts +58 -0
  180. package/dist/useMessage.d.ts.map +1 -0
  181. package/dist/useMessage.js +62 -0
  182. package/dist/useMessage.js.map +1 -0
  183. package/dist/useWatch.d.ts +19 -0
  184. package/dist/useWatch.d.ts.map +1 -0
  185. package/dist/useWatch.js +17 -0
  186. package/dist/useWatch.js.map +1 -0
  187. package/dist/useWizard.d.ts +166 -0
  188. package/dist/useWizard.d.ts.map +1 -0
  189. package/dist/useWizard.js +554 -0
  190. package/dist/useWizard.js.map +1 -0
  191. package/package.json +62 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/store/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAkBnE,MAAM,KAAK,GAAG,IAAI,OAAO,EAAmC,CAAC;AAE7D;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,KAAuB;IACnD,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAChC,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IACxC,MAAM,MAAM,GAAiB,EAAE,CAAC;IAChC,KAAK,MAAM,OAAO,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QACrC,MAAM,CAAC,IAAI,CACT,MAAM,CAAC,MAAM,CAAC;YACZ,IAAI,EAAE,OAAO,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU;YAC7D,uFAAuF;YACvF,uFAAuF;YACvF,yFAAyF;YACzF,qEAAqE;YACrE,QAAQ,EAAE,OAAO,CAAC,QAAQ,KAAK,OAAO,IAAI,OAAO,CAAC,MAAM,KAAK,MAAM;YACnE,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,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,UAAU,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;QACzE,MAAM,QAAQ,GAAqB,MAAM,CAAC,MAAM,CAAC;YAC/C,IAAI,EAAE,QAAQ;YACd,QAAQ,EAAE,KAAK;YACf,MAAM,EAAE,KAAK,CAAC,MAAM;SACrB,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxB,CAAC;IACD,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,KAAK,WAAW,IAAI,KAAK,CAAC,MAAM,KAAK,QAAQ,CAAC;IAC3E,MAAM,OAAO,GAAkB,MAAM,CAAC,MAAM,CAAC;QAC3C,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;QAC7B,mBAAmB,EAAE,QAAQ;YAC3B,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;YAC3C,CAAC,CAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAA+B;QACpD,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC;KAChD,CAAC,CAAC;IACH,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC1B,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,WAAW,CAAC,KAAiB;IACpC,OAAO,KAAK,CAAC,IAAI,KAAK,UAAU,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,CAAC;AAChE,CAAC","sourcesContent":["import { OPTION_NO_LONGER_ELIGIBLE } from '@azx-pbc/axiom-runtime';\nimport type { EngineFieldState } from '@azx-pbc/axiom-runtime';\nimport type {\n AccessFieldError,\n FieldError,\n InvalidValueFieldError,\n RuleFieldError,\n} from '../field-error.js';\n\n/** What one binding's errors say, with the read-only subset a display groups out. */\ninterface BindingErrors {\n readonly errors: readonly FieldError[];\n /** The errors of a `read_only` or `masked` binding, which a control shows beside itself. */\n readonly readOnlyDiagnostics: readonly FieldError[];\n /** Whether any error stops a submission on this device. */\n readonly invalid: boolean;\n}\n\nconst CACHE = new WeakMap<EngineFieldState, BindingErrors>();\n\n/**\n * Derives one binding's errors from the engine's frozen state.\n *\n * Memoised by the state object, which the engine hands back unchanged while a binding's facts\n * hold, so a control that reads its errors twice reads the same arrays and its published props\n * keep their identity across an unrelated write.\n */\nexport function bindingErrors(state: EngineFieldState): BindingErrors {\n const cached = CACHE.get(state);\n if (cached !== undefined) return cached;\n const errors: FieldError[] = [];\n for (const message of state.messages) {\n errors.push(\n Object.freeze({\n kind: message.status === 'DEFERRED' ? 'deferred' : 'validate',\n // Only a decided `FAIL` is a failure a control announces. A server-tier check that has\n // not run is a handoff, and an `UNKNOWN` result is a check the device could not decide\n // (`RULES-2.1.1`): both leave `invalid` false, so `showError` stays false and the form's\n // undetermined state is reported once, by the summary and `verdict`.\n blocking: message.severity === 'block' && message.status === 'FAIL',\n severity: message.severity,\n status: message.status,\n messageKey: message.messageKey,\n ruleId: message.ruleId,\n ...(message.params === undefined ? {} : { params: message.params }),\n }),\n );\n }\n // Only the decided `missing` is the user's failure. `undetermined` covers a server-tier\n // answer this device cannot settle and a value the server withheld on purpose (`redacted`):\n // it leaves the form unready, but it is not a blocking reason the user can act on, and\n // announcing it as `required` accused the user of a value the server chose not to send.\n if (state.visible && state.required && state.missingRequired === 'missing') {\n const rowName =\n state.rowKey !== undefined &&\n (state.rowAddressing === 'natural' || state.rowAddressing === 'value')\n ? String(state.rowKey)\n : undefined;\n errors.push(\n Object.freeze({\n kind: 'required',\n blocking: true,\n status: 'FAIL',\n missing: 'missing',\n fieldId: state.fieldId,\n ...(state.rowKey === undefined ? {} : { rowKey: state.rowKey }),\n ...(rowName === undefined ? {} : { rowName }),\n ...(state.requiredMessageKey === undefined ? {} : { messageKey: state.requiredMessageKey }),\n ...(state.requiredParams === undefined ? {} : { params: state.requiredParams }),\n }),\n );\n }\n // A count outside the declared range is a decided refusal with no artifact sentence: like a\n // missing required value, the host writes the text, and the error carries both numbers.\n if (\n state.visible &&\n state.cardinality !== undefined &&\n (state.cardinality.kind === 'belowMin' || state.cardinality.kind === 'aboveMax')\n ) {\n errors.push(\n Object.freeze({\n kind: 'cardinality',\n blocking: true,\n status: 'FAIL',\n bound: state.cardinality.kind === 'belowMin' ? 'minItems' : 'maxItems',\n count: state.cardinality.count,\n limit:\n state.cardinality.kind === 'belowMin'\n ? state.cardinality.minItems\n : state.cardinality.maxItems,\n }),\n );\n }\n if (state.invalidValue !== undefined) {\n const invalid: InvalidValueFieldError = Object.freeze({\n kind: 'invalid-value',\n code: OPTION_NO_LONGER_ELIGIBLE,\n blocking: true,\n status: 'FAIL',\n });\n errors.push(invalid);\n }\n // The access error states that access withholds the value — `masked`, `hidden` or\n // `write_only`. A `redacted` value is withheld by the *server*, not by the resolved access,\n // and on a writable binding the user can still act; saying \"not editable\" there was false.\n if (state.value.kind === 'withheld' && state.value.reason !== 'redacted') {\n const withheld: AccessFieldError = Object.freeze({\n kind: 'access',\n blocking: false,\n access: state.access,\n });\n errors.push(withheld);\n }\n const readOnly = state.access === 'read_only' || state.access === 'masked';\n const derived: BindingErrors = Object.freeze({\n errors: Object.freeze(errors),\n readOnlyDiagnostics: readOnly\n ? Object.freeze(errors.filter(isRuleError))\n : (Object.freeze([]) as readonly RuleFieldError[]),\n invalid: errors.some((error) => error.blocking),\n });\n CACHE.set(state, derived);\n return derived;\n}\n\nfunction isRuleError(error: FieldError): boolean {\n return error.kind === 'validate' || error.kind === 'deferred';\n}\n"]}
@@ -0,0 +1,35 @@
1
+ import type { CompiledField, CompiledSchema, WireValue } from '@azx-pbc/axiom-runtime';
2
+ /**
3
+ * Where one declared field's value lives, and whether it is one value per row.
4
+ *
5
+ * This is the React binding's own map of the artifact, not a second derivation: `path` and
6
+ * `arrayContainerId` are declaration facts the artifact states, and everything a control
7
+ * renders comes from the engine's derived state.
8
+ */
9
+ export interface FieldFacts {
10
+ readonly field: CompiledField;
11
+ /** Where the value lives in `values`: through every record container, ending at this id. */
12
+ readonly path: readonly string[];
13
+ /** The array container this field is an item field of, when it is one. */
14
+ readonly arrayContainerId: string | undefined;
15
+ }
16
+ /** Indexes every declared field and its members once per artifact. */
17
+ export declare function fieldFacts(compiled: CompiledSchema): ReadonlyMap<string, FieldFacts>;
18
+ /**
19
+ * The facts of one binding, refusing a reference the artifact cannot bind.
20
+ *
21
+ * An item field declares one value per row, so a binding to it without a row key would report
22
+ * the field's own absent value forever; a field that holds no rows cannot be given one. Both
23
+ * are refused by name rather than answered with a plausible default.
24
+ */
25
+ export declare function fieldFactsOf(facts: ReadonlyMap<string, FieldFacts>, fieldId: string, rowKey: string | number | undefined, schemaId: string): FieldFacts;
26
+ /**
27
+ * Validates every initial value against its declaration.
28
+ *
29
+ * Only a top-level field has its own key in `values`. An undeclared key, an explicit `undefined`,
30
+ * or a declared field in the wrong place is refused rather than silently dropped and later exported
31
+ * as if it had been entered. Every value entering the store is read through the wire contract once,
32
+ * so a host supplying a draft cannot seed a session the boundary would have refused.
33
+ */
34
+ export declare function validateInitialValues(facts: ReadonlyMap<string, FieldFacts>, values: Readonly<Record<string, WireValue>>): Readonly<Record<string, WireValue>>;
35
+ //# sourceMappingURL=fields.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fields.d.ts","sourceRoot":"","sources":["../../src/store/fields.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEvF;;;;;;GAMG;AACH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,4FAA4F;IAC5F,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,0EAA0E;IAC1E,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/C;AAID,sEAAsE;AACtE,wBAAgB,UAAU,CAAC,QAAQ,EAAE,cAAc,GAAG,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,CAOpF;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,EACtC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,EACnC,QAAQ,EAAE,MAAM,GACf,UAAU,CA4BZ;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,UAAU,CAAC,EACtC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,GAC1C,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAgCrC"}
@@ -0,0 +1,81 @@
1
+ import { AxiomError, toHostWireValue, wireDeclarationOf } from '@azx-pbc/axiom-runtime';
2
+ const FACTS = new WeakMap();
3
+ /** Indexes every declared field and its members once per artifact. */
4
+ export function fieldFacts(compiled) {
5
+ const cached = FACTS.get(compiled.fields);
6
+ if (cached !== undefined)
7
+ return cached;
8
+ const facts = new Map();
9
+ indexFields(compiled.fields, [], undefined, facts);
10
+ FACTS.set(compiled.fields, facts);
11
+ return facts;
12
+ }
13
+ /**
14
+ * The facts of one binding, refusing a reference the artifact cannot bind.
15
+ *
16
+ * An item field declares one value per row, so a binding to it without a row key would report
17
+ * the field's own absent value forever; a field that holds no rows cannot be given one. Both
18
+ * are refused by name rather than answered with a plausible default.
19
+ */
20
+ export function fieldFactsOf(facts, fieldId, rowKey, schemaId) {
21
+ const found = facts.get(fieldId);
22
+ if (found === undefined) {
23
+ throw new AxiomError('ENGINE_ERROR', `${JSON.stringify(fieldId)} is not a field of schema ${schemaId}`, fieldId);
24
+ }
25
+ if (found.arrayContainerId !== undefined && rowKey === undefined) {
26
+ throw new AxiomError('ENGINE_ERROR', `${JSON.stringify(fieldId)} is declared inside array ${JSON.stringify(found.arrayContainerId)}; a row value needs a row binding (a row key)`, fieldId);
27
+ }
28
+ if (rowKey !== undefined &&
29
+ found.arrayContainerId === undefined &&
30
+ found.field.primitive !== 'array') {
31
+ throw new AxiomError('ENGINE_ERROR', `${JSON.stringify(fieldId)} holds no rows, so a row key cannot name one`, fieldId);
32
+ }
33
+ return found;
34
+ }
35
+ /**
36
+ * Validates every initial value against its declaration.
37
+ *
38
+ * Only a top-level field has its own key in `values`. An undeclared key, an explicit `undefined`,
39
+ * or a declared field in the wrong place is refused rather than silently dropped and later exported
40
+ * as if it had been entered. Every value entering the store is read through the wire contract once,
41
+ * so a host supplying a draft cannot seed a session the boundary would have refused.
42
+ */
43
+ export function validateInitialValues(facts, values) {
44
+ const checked = {};
45
+ for (const fieldId of Object.keys(values)) {
46
+ const found = facts.get(fieldId);
47
+ if (found === undefined) {
48
+ throw new AxiomError('ENGINE_ERROR', `the record holds undeclared field ${fieldId}`, `$.values.${fieldId}`);
49
+ }
50
+ if (found.arrayContainerId !== undefined) {
51
+ throw new AxiomError('ENGINE_ERROR', `this field is declared inside array ${JSON.stringify(found.arrayContainerId)} and has no field-level value`, fieldId);
52
+ }
53
+ if (found.path.length !== 1) {
54
+ throw new AxiomError('ENGINE_ERROR', 'this field is a record member and is supplied inside its container', fieldId);
55
+ }
56
+ const raw = values[fieldId];
57
+ // An opening record is the host's, not a respondent's: a value of the wrong domain is the
58
+ // host's bug, so it answers `LATE_BOUND_TYPE_MISMATCH` with both domains rather than the
59
+ // blanket engine error, and the application can log it as its own defect.
60
+ checked[fieldId] = toHostWireValue(raw, `$.values.${fieldId}`, wireDeclarationOf(found.field));
61
+ }
62
+ return checked;
63
+ }
64
+ /** Indexes one field and every member it holds. */
65
+ function indexFields(fields, path, arrayContainerId, facts) {
66
+ for (const field of fields) {
67
+ const fieldPath = [...path, field.fieldId];
68
+ const itemField = field.primitive === 'array';
69
+ facts.set(field.fieldId, {
70
+ field,
71
+ // An item member of an array has one value per row, so its field-level path is the
72
+ // array that holds it rather than a home of its own.
73
+ path: arrayContainerId === undefined ? fieldPath : path,
74
+ arrayContainerId,
75
+ });
76
+ if (field.fields !== undefined) {
77
+ indexFields(field.fields, itemField ? path : fieldPath, itemField ? field.fieldId : arrayContainerId, facts);
78
+ }
79
+ }
80
+ }
81
+ //# sourceMappingURL=fields.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fields.js","sourceRoot":"","sources":["../../src/store/fields.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAkBxF,MAAM,KAAK,GAAG,IAAI,OAAO,EAA6D,CAAC;AAEvF,sEAAsE;AACtE,MAAM,UAAU,UAAU,CAAC,QAAwB;IACjD,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC1C,IAAI,MAAM,KAAK,SAAS;QAAE,OAAO,MAAM,CAAC;IACxC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAsB,CAAC;IAC5C,WAAW,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IACnD,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAClC,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAC1B,KAAsC,EACtC,OAAe,EACf,MAAmC,EACnC,QAAgB;IAEhB,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACjC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,UAAU,CAClB,cAAc,EACd,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,6BAA6B,QA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om-runtime';\nimport type { CompiledField, CompiledSchema, WireValue } from '@azx-pbc/axiom-runtime';\n\n/**\n * Where one declared field's value lives, and whether it is one value per row.\n *\n * This is the React binding's own map of the artifact, not a second derivation: `path` and\n * `arrayContainerId` are declaration facts the artifact states, and everything a control\n * renders comes from the engine's derived state.\n */\nexport interface FieldFacts {\n readonly field: CompiledField;\n /** Where the value lives in `values`: through every record container, ending at this id. */\n readonly path: readonly string[];\n /** The array container this field is an item field of, when it is one. */\n readonly arrayContainerId: string | undefined;\n}\n\nconst FACTS = new WeakMap<readonly CompiledField[], ReadonlyMap<string, FieldFacts>>();\n\n/** Indexes every declared field and its members once per artifact. */\nexport function fieldFacts(compiled: CompiledSchema): ReadonlyMap<string, FieldFacts> {\n const cached = FACTS.get(compiled.fields);\n if (cached !== undefined) return cached;\n const facts = new Map<string, FieldFacts>();\n indexFields(compiled.fields, [], undefined, facts);\n FACTS.set(compiled.fields, facts);\n return facts;\n}\n\n/**\n * The facts of one binding, refusing a reference the artifact cannot bind.\n *\n * An item field declares one value per row, so a binding to it without a row key would report\n * the field's own absent value forever; a field that holds no rows cannot be given one. Both\n * are refused by name rather than answered with a plausible default.\n */\nexport function fieldFactsOf(\n facts: ReadonlyMap<string, FieldFacts>,\n fieldId: string,\n rowKey: string | number | undefined,\n schemaId: string,\n): FieldFacts {\n const found = facts.get(fieldId);\n if (found === undefined) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n `${JSON.stringify(fieldId)} is not a field of schema ${schemaId}`,\n fieldId,\n );\n }\n if (found.arrayContainerId !== undefined && rowKey === undefined) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n `${JSON.stringify(fieldId)} is declared inside array ${JSON.stringify(found.arrayContainerId)}; a row value needs a row binding (a row key)`,\n fieldId,\n );\n }\n if (\n rowKey !== undefined &&\n found.arrayContainerId === undefined &&\n found.field.primitive !== 'array'\n ) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n `${JSON.stringify(fieldId)} holds no rows, so a row key cannot name one`,\n fieldId,\n );\n }\n return found;\n}\n\n/**\n * Validates every initial value against its declaration.\n *\n * Only a top-level field has its own key in `values`. An undeclared key, an explicit `undefined`,\n * or a declared field in the wrong place is refused rather than silently dropped and later exported\n * as if it had been entered. Every value entering the store is read through the wire contract once,\n * so a host supplying a draft cannot seed a session the boundary would have refused.\n */\nexport function validateInitialValues(\n facts: ReadonlyMap<string, FieldFacts>,\n values: Readonly<Record<string, WireValue>>,\n): Readonly<Record<string, WireValue>> {\n const checked: Record<string, WireValue> = {};\n for (const fieldId of Object.keys(values)) {\n const found = facts.get(fieldId);\n if (found === undefined) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n `the record holds undeclared field ${fieldId}`,\n `$.values.${fieldId}`,\n );\n }\n if (found.arrayContainerId !== undefined) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n `this field is declared inside array ${JSON.stringify(found.arrayContainerId)} and has no field-level value`,\n fieldId,\n );\n }\n if (found.path.length !== 1) {\n throw new AxiomError(\n 'ENGINE_ERROR',\n 'this field is a record member and is supplied inside its container',\n fieldId,\n );\n }\n const raw = values[fieldId];\n // An opening record is the host's, not a respondent's: a value of the wrong domain is the\n // host's bug, so it answers `LATE_BOUND_TYPE_MISMATCH` with both domains rather than the\n // blanket engine error, and the application can log it as its own defect.\n checked[fieldId] = toHostWireValue(raw, `$.values.${fieldId}`, wireDeclarationOf(found.field));\n }\n return checked;\n}\n\n/** Indexes one field and every member it holds. */\nfunction indexFields(\n fields: readonly CompiledField[],\n path: readonly string[],\n arrayContainerId: string | undefined,\n facts: Map<string, FieldFacts>,\n): void {\n for (const field of fields) {\n const fieldPath = [...path, field.fieldId];\n const itemField = field.primitive === 'array';\n facts.set(field.fieldId, {\n field,\n // An item member of an array has one value per row, so its field-level path is the\n // array that holds it rather than a home of its own.\n path: arrayContainerId === undefined ? fieldPath : path,\n arrayContainerId,\n });\n if (field.fields !== undefined) {\n indexFields(\n field.fields,\n itemField ? path : fieldPath,\n itemField ? field.fieldId : arrayContainerId,\n facts,\n );\n }\n }\n}\n"]}
@@ -0,0 +1,174 @@
1
+ import type { Engine, FieldRef, FormBlocker, FormState, FormUndeterminedCheck, FormUndeterminedComputation, SubmissionVerdict } from '@azx-pbc/axiom-runtime';
2
+ import type { FieldError } from '../field-error.js';
3
+ import type { ShowErrorsPolicy } from './visibility.js';
4
+ import type { BindingVisibility } from './visibility.js';
5
+ import type { FieldFacts } from './fields.js';
6
+ import type { WriteProposal, PendingProposalSummary } from './proposals.js';
7
+ import type { SessionView } from './view.js';
8
+ /**
9
+ * The form-level summary a `useFormState` consumer renders.
10
+ *
11
+ * It is derived from the engine's committed state once per changed snapshot and structurally
12
+ * memoised, so a second keystroke that changes no summary fact returns the same object and the
13
+ * consumer does not render again. `isValid` and `verdict` are deliberately different answers:
14
+ * `isValid` states whether any decided field failure or gate item blocks, while `verdict` is the
15
+ * engine's readiness — gates, screens, required values and open checks folded — and neither
16
+ * authorises a submission, which the server decides again (`[ACCESS-7.1.1]`).
17
+ *
18
+ * Every failure list here is a view of one walk (`BindingWalk`) and one partition of
19
+ * `blockers`; `hasUnansweredBlockers`, `isDirty`, `isSubmitted` and `visibleErrorCount` are
20
+ * computed from the lists beside them rather than stored separately.
21
+ */
22
+ export interface FormSummary {
23
+ readonly isDirty: boolean;
24
+ /**
25
+ * The binding keys whose value moved from its baseline, in artifact declaration order — a
26
+ * container before the rows it holds, and a field before its own rows.
27
+ */
28
+ readonly dirtyFields: readonly string[];
29
+ readonly touchedFields: readonly string[];
30
+ /**
31
+ * Whether any field-level check is decided against the record: no blocking field error and no
32
+ * blocking gate item. It is deliberately not the submission gate: an undecided check is no
33
+ * failure, so a form can be `isValid: true` while `verdict` is `UNDETERMINED`
34
+ * (`undeterminedChecks` names the open question). Read `verdict` to decide whether to submit.
35
+ */
36
+ readonly isValid: boolean;
37
+ readonly isSubmitted: boolean;
38
+ readonly isSubmitting: boolean;
39
+ /**
40
+ * Whether the last settled submission reached `onValid` and it returned without throwing.
41
+ *
42
+ * React Hook Form's `isSubmitSuccessful`: a new attempt clears it before it decides, a blocked
43
+ * or refused attempt leaves it false, and `reset()` clears it. It says nothing about the
44
+ * server's answer — a local `SUBMIT` is only a proposal (`[ACCESS-7.1.1]`).
45
+ */
46
+ readonly isSubmitSuccessful: boolean;
47
+ readonly submitCount: number;
48
+ /**
49
+ * The binding a host focuses first when a submit fails, as `bindingKey`.
50
+ *
51
+ * It is the first visible binding in artifact declaration order with a blocking error — the
52
+ * same order `errors` states — so a keyboard user lands on the control that needs them rather
53
+ * than at the top of the page. `fieldDomId(useIdPrefix(), firstErrorBindingKey)` is that
54
+ * control's `a11y.controlId`. Absent when nothing blocks: a gate item, a screen or a
55
+ * record-scope rule names no binding, and a form with only those has no control to focus.
56
+ *
57
+ * A blocking binding is always visible; it is not necessarily enabled. A missing required
58
+ * value behind a failed `enabled` rule is still a blocker, and Axiom reports it rather than
59
+ * silently dropping it — the artifact has asked for something the user cannot supply.
60
+ */
61
+ readonly firstErrorBindingKey?: string;
62
+ /**
63
+ * Every blocking reason a control shows: the field-level failures (a missing required value
64
+ * among them, with the binding it names), each blocking screen, and nothing that `blockers`
65
+ * states at the form level alone. A gate item is never re-projected here.
66
+ *
67
+ * This is the engine's fact list, not the painted list: a failure the reveal policy is still
68
+ * holding back is stated here and in `blockers`, and appears in `visibleBlockingErrors` only
69
+ * when a control is announcing it.
70
+ */
71
+ readonly errors: readonly FieldError[];
72
+ /** The subset of `errors` a control is painting now. `visibleErrorCount` is its length plus the form-level reasons below. */
73
+ readonly visibleBlockingErrors: readonly FieldError[];
74
+ /**
75
+ * The readiness blockers the session is painting now.
76
+ *
77
+ * It is `blockers` filtered by the reveal policy and by whether the binding a reason names is
78
+ * itself showing that reason. A required value the user has not reached is not a painted
79
+ * failure; it is `unansweredBlockers`.
80
+ */
81
+ readonly visibleBlockers: readonly FormBlocker[];
82
+ /**
83
+ * A blocking fact the session is not painting yet, because the user has not supplied what
84
+ * would make it answerable — an untouched required field, a comparison missing an operand, or
85
+ * any blocker before the first submit under `showErrors: "submit"`.
86
+ *
87
+ * A host states these as "not yet answered", never as failures: the verdict already counts
88
+ * them, so a submission is refused either way, but the user has not been accused of anything
89
+ * they cannot yet act on.
90
+ */
91
+ readonly unansweredBlockers: readonly FormBlocker[];
92
+ /** The binding keys of `visibleBlockers`' required reasons: the painted required failures. */
93
+ readonly visibleMissingRequiredFields: readonly string[];
94
+ /** How many painted failure lines the summary states: visible binding errors plus form-level reasons. */
95
+ readonly visibleErrorCount: number;
96
+ /** Whether any blocking fact is still waiting to be answerable. */
97
+ readonly hasUnansweredBlockers: boolean;
98
+ /**
99
+ * The readiness blockers as the runtime states them — a blocking validation, a missing
100
+ * required binding, and each blocking gate item. This is the one place a gate blocker
101
+ * appears; `errors` never re-projects it.
102
+ */
103
+ readonly blockers: readonly FormBlocker[];
104
+ /**
105
+ * The binding keys of the decided missing required values, derived from `blockers`: the link
106
+ * from a summary line to the control it names.
107
+ */
108
+ readonly missingRequiredFields: readonly string[];
109
+ readonly hasDeferredChecks: boolean;
110
+ /**
111
+ * Every block-severity check the device could not decide, in declaration order.
112
+ *
113
+ * The list is the fact and its emptiness is the predicate: read `length` rather than a boolean
114
+ * beside it. A form can be `BLOCKED` and undecided at once, so the verdict alone cannot state
115
+ * the second fact. An undecided check is not in `errors`: it is no failure, and the binding
116
+ * never announces it.
117
+ */
118
+ readonly undeterminedChecks: readonly FormUndeterminedCheck[];
119
+ /** Every computed value the engine could not decide. Informational, never a refusal. */
120
+ readonly undeterminedComputations: readonly FormUndeterminedComputation[];
121
+ /**
122
+ * The one verdict a host gates a submission on. `SUBMIT` means nothing this device can see
123
+ * blocks or leaves undecided; the server still re-derives every decision (`[ACCESS-7.1.1]`).
124
+ * `BLOCKED` names its causes in `blockers` and `errors`. `UNDETERMINED` means nothing decided
125
+ * is wrong, but a block check could not be decided: `undeterminedChecks` names every open
126
+ * question, and `isValid` may still be true because no decided field failure exists. This
127
+ * folds every gate's verdict and local readiness; it is not `report.status` (a rule that fails
128
+ * on a hidden field folds there while nothing on screen needs repair).
129
+ */
130
+ readonly verdict: SubmissionVerdict;
131
+ /**
132
+ * The staged write the host is confirming, or `undefined` when none is pending.
133
+ *
134
+ * One proposal is pending at a time: a newer qualifying write replaces it, and applying,
135
+ * declining, resetting or unmounting clears it. This member is a value-free projection: it
136
+ * states the sequence and the binding the write edits, never its operations or candidate, so
137
+ * the summary is plain data that can be cloned and serialised and holds no typed value. The
138
+ * proposal to commit through `applyProposal` or drop through `discardProposal` is the one
139
+ * `onWriteProposed` delivered (or `form.propose` returned).
140
+ */
141
+ readonly pendingProposal: PendingProposalSummary | undefined;
142
+ }
143
+ /** Everything one summary build reads. */
144
+ export interface FormChannelInput {
145
+ readonly engine: Engine;
146
+ readonly form: FormState;
147
+ readonly facts: ReadonlyMap<string, FieldFacts>;
148
+ readonly view: SessionView;
149
+ readonly submitCount: number;
150
+ readonly isSubmitting: boolean;
151
+ readonly submitSucceeded: boolean;
152
+ /** The host's reveal policy: which decided failures are painted now. */
153
+ readonly reveal: ShowErrorsPolicy;
154
+ /** Every rule's declared reads, for the incomplete-operand question. */
155
+ readonly ruleReads: ReadonlyMap<string, readonly FieldRef[]>;
156
+ /** One binding's precomputed visibility, shared with its own props derivation. */
157
+ readonly visibilityOf: (fieldId: string, rowKey: string | number | undefined) => BindingVisibility;
158
+ /** The staged write the session holds, when one is pending. */
159
+ readonly pendingProposal?: WriteProposal | undefined;
160
+ }
161
+ /**
162
+ * Builds one summary from committed state.
163
+ *
164
+ * Only visible bindings are summarised: a binding the host may not show has no value a summary
165
+ * may name, and its access answer is a display fact rather than a form-level error. A field of
166
+ * an array has no bindable value of its own, so its rows answer instead.
167
+ */
168
+ export declare function buildFormSummary(input: FormChannelInput): FormSummary;
169
+ /**
170
+ * Whether two summaries state the same facts, so a second keystroke that changes none of them
171
+ * returns the object the consumer already rendered.
172
+ */
173
+ export declare function sameFormSummary(left: FormSummary, right: FormSummary): boolean;
174
+ //# sourceMappingURL=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