@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
package/dist/hints.js ADDED
@@ -0,0 +1,158 @@
1
+ import { assertNever } from '@azx-pbc/axiom-runtime';
2
+ /**
3
+ * One entry per declared control, checked against the closed union.
4
+ *
5
+ * This is the only control-to-hint authority: a control the compiler adds without an entry
6
+ * fails typecheck here, so no input can fall back to a hint nobody decided.
7
+ */
8
+ const CONTROL_HINTS = {
9
+ text: hints('text', web({ type: 'text', inputMode: 'text', autoComplete: 'off' }), native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'sentences' })),
10
+ textarea: hints('textarea', web({ type: 'text', inputMode: 'text', autoComplete: 'off' }), native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'sentences' })),
11
+ email: hints('email', web({ type: 'email', inputMode: 'email', autoComplete: 'email' }), native({
12
+ keyboardType: 'email-address',
13
+ textContentType: 'emailAddress',
14
+ autoCapitalize: 'none',
15
+ })),
16
+ phone: hints('phone', web({ type: 'tel', inputMode: 'tel', autoComplete: 'tel' }), native({
17
+ keyboardType: 'phone-pad',
18
+ textContentType: 'telephoneNumber',
19
+ autoCapitalize: 'none',
20
+ })),
21
+ url: hints('url', web({ type: 'url', inputMode: 'url', autoComplete: 'url' }), native({ keyboardType: 'url', textContentType: 'URL', autoCapitalize: 'none' })),
22
+ select: hints('select', web({ type: 'text', inputMode: 'text', autoComplete: 'off' }), native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' })),
23
+ radio: hints('radio', web({ type: 'radio', inputMode: 'text', autoComplete: 'off' }), native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' })),
24
+ checkbox: hints('checkbox', web({ type: 'checkbox', inputMode: 'text', autoComplete: 'off' }), native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' })),
25
+ combobox: hints('combobox', web({ type: 'text', inputMode: 'text', autoComplete: 'off' }), native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' })),
26
+ switch: hints('switch', web({ type: 'checkbox', inputMode: 'text', autoComplete: 'off' }), native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' })),
27
+ integer: hints('integer',
28
+ // Text, not `number`: a `number` element sanitises the entry before React sees it, so a
29
+ // buffered control never receives `12.` or a rejected keystroke and writes `null` instead.
30
+ // `inputMode` keeps the numeric keypad; the value pipeline owns the parse.
31
+ web({ type: 'text', inputMode: 'numeric', autoComplete: 'off' }), native({ keyboardType: 'number-pad', textContentType: 'none', autoCapitalize: 'none' })),
32
+ decimal: hints('decimal',
33
+ // A canonical decimal is text, not a JSON float: `type="number"` would hand the control a
34
+ // binary approximation of the string the wire contract carries.
35
+ web({ type: 'text', inputMode: 'decimal', autoComplete: 'off' }), native({ keyboardType: 'decimal-pad', textContentType: 'none', autoCapitalize: 'none' })),
36
+ money: hints('money', web({ type: 'text', inputMode: 'decimal', autoComplete: 'off' }), native({ keyboardType: 'decimal-pad', textContentType: 'none', autoCapitalize: 'none' })),
37
+ percentage: hints('percentage', web({ type: 'text', inputMode: 'decimal', autoComplete: 'off' }), native({ keyboardType: 'decimal-pad', textContentType: 'none', autoCapitalize: 'none' })),
38
+ date: hints('date', web({ type: 'date', autoComplete: 'off' }), native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' })),
39
+ datetime: hints('datetime', web({ type: 'datetime-local', autoComplete: 'off' }), native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' })),
40
+ media_capture: hints('media_capture', web({ type: 'file', autoComplete: 'off' }), native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' })),
41
+ signature_capture: hints('signature_capture', web({ type: 'text', autoComplete: 'off' }),
42
+ // A signature is drawn, not autofilled: `name` would offer iOS contact-name suggestions
43
+ // for a value no keyboard can produce.
44
+ native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' })),
45
+ multiselect: hints('multiselect', web({ type: 'text', inputMode: 'text', autoComplete: 'off' }), native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' })),
46
+ rank: hints('rank', web({ type: 'text', inputMode: 'text', autoComplete: 'off' }), native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' })),
47
+ tags: hints('tags', web({ type: 'text', inputMode: 'text', autoComplete: 'off' }), native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'sentences' })),
48
+ rating: hints('rating', web({ type: 'range', inputMode: 'numeric', autoComplete: 'off' }), native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' })),
49
+ likert: hints('likert', web({ type: 'radio', inputMode: 'text', autoComplete: 'off' }), native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' })),
50
+ quantity: hints('quantity',
51
+ // A measured amount is canonical text with a unit, so the keyboard is decimal and the
52
+ // element stays text: a `number` element would sanitise the entry before React sees it.
53
+ web({ type: 'text', inputMode: 'decimal', autoComplete: 'off' }), native({ keyboardType: 'decimal-pad', textContentType: 'none', autoCapitalize: 'none' })),
54
+ slider: hints('slider',
55
+ // A range input carries a numeric value; `range` is the native affordance a slider names.
56
+ web({ type: 'range', inputMode: 'numeric', autoComplete: 'off' }), native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' })),
57
+ duration: hints('duration', web({ type: 'text', inputMode: 'numeric', autoComplete: 'off' }), native({ keyboardType: 'number-pad', textContentType: 'none', autoCapitalize: 'none' })),
58
+ time: hints('time', web({ type: 'text', inputMode: 'numeric', autoComplete: 'off' }), native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' })),
59
+ address: hints('address', web({ type: 'text', inputMode: 'text', autoComplete: 'street-address' }), native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'words' })),
60
+ map: hints('map', web({ type: 'text', inputMode: 'text', autoComplete: 'off' }), native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' })),
61
+ password: passwordHints('current-password'),
62
+ timeslot: hints('timeslot', web({ type: 'text', inputMode: 'text', autoComplete: 'off' }), native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' })),
63
+ };
64
+ /** The creating-a-credential spelling of the password hints, cached beside the default. */
65
+ const PASSWORD_NEW_HINTS = passwordHints('new-password');
66
+ /**
67
+ * The hints of a container binding, which holds rows or members and no input of its own.
68
+ *
69
+ * A host that binds a container still reads `hints` — `useField` returns the same shape for
70
+ * every binding — so the undefined control has a defined, neutral answer rather than throwing
71
+ * inside a render.
72
+ */
73
+ const CONTAINER_HINTS = hints(undefined, web({ type: 'text', autoComplete: 'off' }), native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' }));
74
+ /**
75
+ * The hints one control declares, or the neutral container answer for none.
76
+ *
77
+ * Pure and module-cached: the same control returns the same frozen object, so a control may
78
+ * use the result as a memo key without allocating one per render.
79
+ */
80
+ export function getInputHints(control, options) {
81
+ if (control === undefined)
82
+ return CONTAINER_HINTS;
83
+ if (control === 'password' && options?.passwordPurpose === 'new')
84
+ return PASSWORD_NEW_HINTS;
85
+ // Every declared control has an entry above. The switch is the total lookup: a control the
86
+ // union gains without a table entry is a typecheck failure in both places rather than a
87
+ // control that silently renders with no hints.
88
+ switch (control) {
89
+ case 'text':
90
+ case 'textarea':
91
+ case 'email':
92
+ case 'phone':
93
+ case 'url':
94
+ case 'select':
95
+ case 'radio':
96
+ case 'checkbox':
97
+ case 'combobox':
98
+ case 'switch':
99
+ case 'integer':
100
+ case 'decimal':
101
+ case 'money':
102
+ case 'percentage':
103
+ case 'date':
104
+ case 'datetime':
105
+ case 'media_capture':
106
+ case 'signature_capture':
107
+ case 'multiselect':
108
+ case 'rank':
109
+ case 'tags':
110
+ case 'rating':
111
+ case 'likert':
112
+ case 'timeslot':
113
+ case 'quantity':
114
+ case 'slider':
115
+ case 'duration':
116
+ case 'time':
117
+ case 'address':
118
+ case 'map':
119
+ case 'password':
120
+ return CONTROL_HINTS[control];
121
+ default:
122
+ return assertNever(control);
123
+ }
124
+ }
125
+ /**
126
+ * The password hints, differing only in the autofill purpose the host names.
127
+ *
128
+ * A secret is never autocorrected or autocapitalised by the platform, and React Native masks it
129
+ * through secure entry rather than a platform-specific component.
130
+ */
131
+ function passwordHints(autoComplete) {
132
+ return hints('password', web({
133
+ type: 'password',
134
+ inputMode: 'text',
135
+ autoComplete,
136
+ autoCorrect: 'off',
137
+ autoCapitalize: 'none',
138
+ }), native({
139
+ keyboardType: 'default',
140
+ textContentType: 'none',
141
+ autoCapitalize: 'none',
142
+ secureTextEntry: true,
143
+ }));
144
+ }
145
+ function web(hints) {
146
+ return Object.freeze(hints);
147
+ }
148
+ function native(hints) {
149
+ return Object.freeze(hints);
150
+ }
151
+ function hints(control, webHints, nativeHints) {
152
+ return Object.freeze({
153
+ control,
154
+ web: webHints,
155
+ native: nativeHints,
156
+ });
157
+ }
158
+ //# sourceMappingURL=hints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hints.js","sourceRoot":"","sources":["../src/hints.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AA2ErD;;;;;GAKG;AACH,MAAM,aAAa,GAAgC;IACjD,IAAI,EAAE,KAAK,CACT,MAAM,EACN,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,EAC7D,MAAM,CAAC,EAAE,YAAY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AC;QACX,KAAK,UAAU;YACb,OAAO,aAAa,CAAC,OAAO,CAAC,CAAC;QAChC;YACE,OAAO,WAAW,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;AACH,CAAC;AAED;;;;;GAKG;AACH,SAAS,aAAa,CAAC,YAAoB;IACzC,OAAO,KAAK,CACV,UAAU,EACV,GAAG,CAAC;QACF,IAAI,EAAE,UAAU;QAChB,SAAS,EAAE,MAAM;QACjB,YAAY;QACZ,WAAW,EAAE,KAAK;QAClB,cAAc,EAAE,MAAM;KACvB,CAAC,EACF,MAAM,CAAC;QACL,YAAY,EAAE,SAAS;QACvB,eAAe,EAAE,MAAM;QACvB,cAAc,EAAE,MAAM;QACtB,eAAe,EAAE,IAAI;KACtB,CAAC,CACH,CAAC;AACJ,CAAC;AAED,SAAS,GAAG,CAAC,KAAoB;IAC/B,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED,SAAS,MAAM,CAAC,KAAuB;IACrC,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED,SAAS,KAAK,CACZ,OAA4B,EAC5B,QAAuB,EACvB,WAA6B;IAE7B,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,OAAO;QACP,GAAG,EAAE,QAAQ;QACb,MAAM,EAAE,WAAW;KACpB,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { assertNever } from '@azx-pbc/axiom-runtime';\nimport type { Control } from '@azx-pbc/axiom-runtime';\n\n/**\n * The keyboard and autofill hints a control asks a host to apply.\n *\n * A binding is target-neutral: it cannot know whether it is rendering an `<input>` or a React\n * Native `TextInput`, and it must not import either platform's types to find out. So both\n * answers are returned together and the host applies the half its platform understands.\n */\nexport interface InputHints {\n /** The declared control these hints were resolved for; `undefined` for a container. */\n readonly control: Control | undefined;\n readonly web: WebInputHints;\n readonly native: NativeInputHints;\n}\n\n/** What a Web host puts on an `<input>`; the element itself stays the host's choice. */\nexport interface WebInputHints {\n readonly type: WebInputType;\n readonly inputMode?: WebInputMode;\n readonly autoComplete: string;\n /**\n * Whether the platform should offer spelling corrections. A password must not: a suggestion\n * bubble over a secret would expose the entry to the surrounding sentence.\n */\n readonly autoCorrect?: 'on' | 'off';\n /** Whether the platform should capitalise the first letter or each word. */\n readonly autoCapitalize?: 'none' | 'sentences' | 'words' | 'characters';\n}\n\nexport type WebInputType =\n | 'text'\n | 'email'\n | 'tel'\n | 'url'\n | 'number'\n | 'date'\n | 'datetime-local'\n | 'checkbox'\n | 'radio'\n | 'file'\n | 'range'\n | 'password';\n\nexport type WebInputMode = 'text' | 'decimal' | 'numeric' | 'tel' | 'email' | 'url';\n\n/** What a React Native host puts on a `TextInput`. */\nexport interface NativeInputHints {\n readonly keyboardType: NativeKeyboardType;\n readonly textContentType: NativeTextContentType;\n readonly autoCapitalize: NativeAutoCapitalize;\n /** Whether the platform masks the entry, as a React Native `TextInput`'s secure entry does. */\n readonly secureTextEntry?: boolean;\n}\n\nexport type NativeKeyboardType =\n | 'default'\n | 'numeric'\n | 'number-pad'\n | 'decimal-pad'\n | 'email-address'\n | 'phone-pad'\n | 'url';\n\nexport type NativeTextContentType =\n | 'none'\n | 'name'\n | 'emailAddress'\n | 'telephoneNumber'\n | 'URL'\n | 'oneTimeCode';\n\nexport type NativeAutoCapitalize = 'none' | 'sentences' | 'words' | 'characters';\n\n/**\n * One entry per declared control, checked against the closed union.\n *\n * This is the only control-to-hint authority: a control the compiler adds without an entry\n * fails typecheck here, so no input can fall back to a hint nobody decided.\n */\nconst CONTROL_HINTS: Record<Control, InputHints> = {\n text: hints(\n 'text',\n web({ type: 'text', inputMode: 'text', autoComplete: 'off' }),\n native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'sentences' }),\n ),\n textarea: hints(\n 'textarea',\n web({ type: 'text', inputMode: 'text', autoComplete: 'off' }),\n native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'sentences' }),\n ),\n email: hints(\n 'email',\n web({ type: 'email', inputMode: 'email', autoComplete: 'email' }),\n native({\n keyboardType: 'email-address',\n textContentType: 'emailAddress',\n autoCapitalize: 'none',\n }),\n ),\n phone: hints(\n 'phone',\n web({ type: 'tel', inputMode: 'tel', autoComplete: 'tel' }),\n native({\n keyboardType: 'phone-pad',\n textContentType: 'telephoneNumber',\n autoCapitalize: 'none',\n }),\n ),\n url: hints(\n 'url',\n web({ type: 'url', inputMode: 'url', autoComplete: 'url' }),\n native({ keyboardType: 'url', textContentType: 'URL', autoCapitalize: 'none' }),\n ),\n select: hints(\n 'select',\n web({ type: 'text', inputMode: 'text', autoComplete: 'off' }),\n native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' }),\n ),\n radio: hints(\n 'radio',\n web({ type: 'radio', inputMode: 'text', autoComplete: 'off' }),\n native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' }),\n ),\n checkbox: hints(\n 'checkbox',\n web({ type: 'checkbox', inputMode: 'text', autoComplete: 'off' }),\n native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' }),\n ),\n combobox: hints(\n 'combobox',\n web({ type: 'text', inputMode: 'text', autoComplete: 'off' }),\n native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' }),\n ),\n switch: hints(\n 'switch',\n web({ type: 'checkbox', inputMode: 'text', autoComplete: 'off' }),\n native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' }),\n ),\n integer: hints(\n 'integer',\n // Text, not `number`: a `number` element sanitises the entry before React sees it, so a\n // buffered control never receives `12.` or a rejected keystroke and writes `null` instead.\n // `inputMode` keeps the numeric keypad; the value pipeline owns the parse.\n web({ type: 'text', inputMode: 'numeric', autoComplete: 'off' }),\n native({ keyboardType: 'number-pad', textContentType: 'none', autoCapitalize: 'none' }),\n ),\n decimal: hints(\n 'decimal',\n // A canonical decimal is text, not a JSON float: `type=\"number\"` would hand the control a\n // binary approximation of the string the wire contract carries.\n web({ type: 'text', inputMode: 'decimal', autoComplete: 'off' }),\n native({ keyboardType: 'decimal-pad', textContentType: 'none', autoCapitalize: 'none' }),\n ),\n money: hints(\n 'money',\n web({ type: 'text', inputMode: 'decimal', autoComplete: 'off' }),\n native({ keyboardType: 'decimal-pad', textContentType: 'none', autoCapitalize: 'none' }),\n ),\n percentage: hints(\n 'percentage',\n web({ type: 'text', inputMode: 'decimal', autoComplete: 'off' }),\n native({ keyboardType: 'decimal-pad', textContentType: 'none', autoCapitalize: 'none' }),\n ),\n date: hints(\n 'date',\n web({ type: 'date', autoComplete: 'off' }),\n native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' }),\n ),\n datetime: hints(\n 'datetime',\n web({ type: 'datetime-local', autoComplete: 'off' }),\n native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' }),\n ),\n media_capture: hints(\n 'media_capture',\n web({ type: 'file', autoComplete: 'off' }),\n native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' }),\n ),\n signature_capture: hints(\n 'signature_capture',\n web({ type: 'text', autoComplete: 'off' }),\n // A signature is drawn, not autofilled: `name` would offer iOS contact-name suggestions\n // for a value no keyboard can produce.\n native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' }),\n ),\n multiselect: hints(\n 'multiselect',\n web({ type: 'text', inputMode: 'text', autoComplete: 'off' }),\n native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' }),\n ),\n rank: hints(\n 'rank',\n web({ type: 'text', inputMode: 'text', autoComplete: 'off' }),\n native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' }),\n ),\n tags: hints(\n 'tags',\n web({ type: 'text', inputMode: 'text', autoComplete: 'off' }),\n native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'sentences' }),\n ),\n rating: hints(\n 'rating',\n web({ type: 'range', inputMode: 'numeric', autoComplete: 'off' }),\n native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' }),\n ),\n likert: hints(\n 'likert',\n web({ type: 'radio', inputMode: 'text', autoComplete: 'off' }),\n native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' }),\n ),\n quantity: hints(\n 'quantity',\n // A measured amount is canonical text with a unit, so the keyboard is decimal and the\n // element stays text: a `number` element would sanitise the entry before React sees it.\n web({ type: 'text', inputMode: 'decimal', autoComplete: 'off' }),\n native({ keyboardType: 'decimal-pad', textContentType: 'none', autoCapitalize: 'none' }),\n ),\n slider: hints(\n 'slider',\n // A range input carries a numeric value; `range` is the native affordance a slider names.\n web({ type: 'range', inputMode: 'numeric', autoComplete: 'off' }),\n native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' }),\n ),\n duration: hints(\n 'duration',\n web({ type: 'text', inputMode: 'numeric', autoComplete: 'off' }),\n native({ keyboardType: 'number-pad', textContentType: 'none', autoCapitalize: 'none' }),\n ),\n time: hints(\n 'time',\n web({ type: 'text', inputMode: 'numeric', autoComplete: 'off' }),\n native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' }),\n ),\n address: hints(\n 'address',\n web({ type: 'text', inputMode: 'text', autoComplete: 'street-address' }),\n native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'words' }),\n ),\n map: hints(\n 'map',\n web({ type: 'text', inputMode: 'text', autoComplete: 'off' }),\n native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' }),\n ),\n password: passwordHints('current-password'),\n timeslot: hints(\n 'timeslot',\n web({ type: 'text', inputMode: 'text', autoComplete: 'off' }),\n native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' }),\n ),\n};\n\n/** The purpose a password entry serves: an existing credential, or one being created. */\nexport type PasswordPurpose = 'current' | 'new';\n\n/**\n * What the host knows about a control beyond the control hint itself.\n *\n * A hint is semantic and cannot state whether a password field signs in or creates an account;\n * only the page knows that. The default is `current-password`, the answer that never offers to\n * save a secret the user did not create here.\n */\nexport interface InputHintOptions {\n readonly passwordPurpose?: PasswordPurpose;\n}\n\n/** The creating-a-credential spelling of the password hints, cached beside the default. */\nconst PASSWORD_NEW_HINTS: InputHints = passwordHints('new-password');\n\n/**\n * The hints of a container binding, which holds rows or members and no input of its own.\n *\n * A host that binds a container still reads `hints` — `useField` returns the same shape for\n * every binding — so the undefined control has a defined, neutral answer rather than throwing\n * inside a render.\n */\nconst CONTAINER_HINTS: InputHints = hints(\n undefined,\n web({ type: 'text', autoComplete: 'off' }),\n native({ keyboardType: 'default', textContentType: 'none', autoCapitalize: 'none' }),\n);\n\n/**\n * The hints one control declares, or the neutral container answer for none.\n *\n * Pure and module-cached: the same control returns the same frozen object, so a control may\n * use the result as a memo key without allocating one per render.\n */\nexport function getInputHints(\n control: Control | undefined,\n options?: InputHintOptions,\n): InputHints {\n if (control === undefined) return CONTAINER_HINTS;\n if (control === 'password' && options?.passwordPurpose === 'new') return PASSWORD_NEW_HINTS;\n // Every declared control has an entry above. The switch is the total lookup: a control the\n // union gains without a table entry is a typecheck failure in both places rather than a\n // control that silently renders with no hints.\n switch (control) {\n case 'text':\n case 'textarea':\n case 'email':\n case 'phone':\n case 'url':\n case 'select':\n case 'radio':\n case 'checkbox':\n case 'combobox':\n case 'switch':\n case 'integer':\n case 'decimal':\n case 'money':\n case 'percentage':\n case 'date':\n case 'datetime':\n case 'media_capture':\n case 'signature_capture':\n case 'multiselect':\n case 'rank':\n case 'tags':\n case 'rating':\n case 'likert':\n case 'timeslot':\n case 'quantity':\n case 'slider':\n case 'duration':\n case 'time':\n case 'address':\n case 'map':\n case 'password':\n return CONTROL_HINTS[control];\n default:\n return assertNever(control);\n }\n}\n\n/**\n * The password hints, differing only in the autofill purpose the host names.\n *\n * A secret is never autocorrected or autocapitalised by the platform, and React Native masks it\n * through secure entry rather than a platform-specific component.\n */\nfunction passwordHints(autoComplete: string): InputHints {\n return hints(\n 'password',\n web({\n type: 'password',\n inputMode: 'text',\n autoComplete,\n autoCorrect: 'off',\n autoCapitalize: 'none',\n }),\n native({\n keyboardType: 'default',\n textContentType: 'none',\n autoCapitalize: 'none',\n secureTextEntry: true,\n }),\n );\n}\n\nfunction web(hints: WebInputHints): WebInputHints {\n return Object.freeze(hints);\n}\n\nfunction native(hints: NativeInputHints): NativeInputHints {\n return Object.freeze(hints);\n}\n\nfunction hints(\n control: Control | undefined,\n webHints: WebInputHints,\n nativeHints: NativeInputHints,\n): InputHints {\n return Object.freeze({\n control,\n web: webHints,\n native: nativeHints,\n });\n}\n"]}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * `@azx-pbc/axiom-react` — Axiom's headless React bindings.
3
+ *
4
+ * The package renders nothing itself: a host mounts one `FormProvider` for a compiled artifact
5
+ * and binds a control to each field or row with `useField`, so the same code runs on React 19
6
+ * Web and React Native 0.88. There is no DOM, CSS or UI dependency here — and no compiler
7
+ * either, because the dependency graph runs compiler -> runtime <- react.
8
+ *
9
+ * `useField`, `useFormState` and `useForm` each state two doors. The typed door takes the
10
+ * artifact `@azx-pbc/axiom-builder`'s `defineDocument` returns, so the field ids, the row-key
11
+ * requirement and the submit record type come from the document literal. The untyped door keeps
12
+ * its signature for a host holding a runtime artifact that names no types.
13
+ */
14
+ export { FormProvider } from './FormProvider.js';
15
+ export type { FormProviderProps } from './FormProvider.js';
16
+ export type { FormRenderError } from './FormErrorBoundary.js';
17
+ export { seededIdFactory } from './store/ids.js';
18
+ export { useField } from './useField.js';
19
+ export { useFieldValue } from './render/field-value.js';
20
+ export type { FieldValue } from './render/field-value.js';
21
+ export { useFieldArray } from './useFieldArray.js';
22
+ export { useBufferedInput } from './useBufferedInput.js';
23
+ export { useAsyncOptions, DEFAULT_OPTION_PAGE_SIZE } from './useAsyncOptions.js';
24
+ export { useGate } from './useGate.js';
25
+ export { useLayout, useLayoutNode, useSection } from './useLayout.js';
26
+ export { useFields, useIdPrefix, useSchema } from './render/schema.js';
27
+ export { freeNaturalKey, renderErrorSummary, renderLayout, renderRowName } from './render/nodes.js';
28
+ export { UNDECIDED_VALUE_TEXT, renderDisplayText, renderFieldText, renderValueText, } from './render/value-text.js';
29
+ export type { ValueDisplay } from './render/value-text.js';
30
+ export type { RenderCalloutNode, RenderControlNode, RenderDividerNode, RenderErrorInput, RenderErrorItem, RenderErrorSummaryInput, RenderErrorSummaryNode, RenderGroupNode, RenderHeadingLevel, RenderHeadingNode, RenderLayoutInput, RenderNode, RenderReadout, RenderRecordsNode, RenderRecordNode, RenderSectionNode, RenderSopBlockNode, RenderStepNode, RenderSummaryCardNode, RenderTranslate, RenderWizardNode, } from './render/nodes.js';
31
+ export { useWizard, useStep } from './useWizard.js';
32
+ export { useMessage, useFormatMessage, useDirection, useLocaleAttributes } from './useMessage.js';
33
+ export type { LocaleAttributes } from './useMessage.js';
34
+ export { useForm, useFormHandle } from './useForm.js';
35
+ export { useFormState } from './useFormState.js';
36
+ export { useWatch } from './useWatch.js';
37
+ export { getInputHints } from './hints.js';
38
+ export { fieldDescriptionId, fieldDomId, fieldErrorId } from './field-props.js';
39
+ export { errorKey } from './store/visibility.js';
40
+ export type { InputHintOptions, InputHints, NativeAutoCapitalize, NativeInputHints, NativeKeyboardType, NativeTextContentType, PasswordPurpose, WebInputHints, WebInputMode, WebInputType, } from './hints.js';
41
+ export { AccessSourceError } from './store/inputs.js';
42
+ export type { FieldArray, FieldArrayControls, FieldArrayMutations, FieldArrayView, RowRef, } from './store/array-bindings.js';
43
+ export type { BufferedInput } from './useBufferedInput.js';
44
+ export type { BufferedFormat, BufferRefusal, BufferRefusalReason, FormatContract, ParseOutcome, } from './store/parse-print.js';
45
+ export type { AsyncOptionList, OptionBasis, OptionControls, OptionLoader, OptionPageState, OptionRequest, QueryDefer, } from './store/option-pages.js';
46
+ export type { GateView } from './store/gates.js';
47
+ export type { LayoutSlice } from './store/layout.js';
48
+ export type { StepBlocker, StepState, StepStatus, Wizard, WizardProblem, WizardStep, } from './useWizard.js';
49
+ export type { DeclaredMessageValue, FormatValue, MessageArgument, MessageFormatter, MessageValueKind, } from './store/messages.js';
50
+ export type { FormHandle, FormSummary, Proposal, PublishTrace, WriteProposal, } from './form-store.js';
51
+ export type { PendingProposalSummary, ProposalRefusal, ProposalRefusalCode, } from './store/proposals.js';
52
+ export type { AccessFieldError, CardinalityFieldError, FieldError, GateFieldError, InvalidValueFieldError, RequiredFieldError, RowKeyFieldError, RuleFieldError, ScreenFieldError, } from './field-error.js';
53
+ export type { ArrayFieldIdsOf, BindingKeyOf, BindingRefOf, FieldBindingArgs, TypedFieldProps, TypedFormHandle, TypedFormSummary, TypedValueState, } from './typed.js';
54
+ export { parseBindingKey } from './typed.js';
55
+ export type { FieldA11y, FieldComputation, FieldMessage, FieldProps, } from './field-props.js';
56
+ export type { ShowErrorsPolicy } from './store/visibility.js';
57
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,YAAY,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EA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;AACpB,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,YAAY,EACV,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,UAAU,GACX,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,36 @@
1
+ /**
2
+ * `@azx-pbc/axiom-react` — Axiom's headless React bindings.
3
+ *
4
+ * The package renders nothing itself: a host mounts one `FormProvider` for a compiled artifact
5
+ * and binds a control to each field or row with `useField`, so the same code runs on React 19
6
+ * Web and React Native 0.88. There is no DOM, CSS or UI dependency here — and no compiler
7
+ * either, because the dependency graph runs compiler -> runtime <- react.
8
+ *
9
+ * `useField`, `useFormState` and `useForm` each state two doors. The typed door takes the
10
+ * artifact `@azx-pbc/axiom-builder`'s `defineDocument` returns, so the field ids, the row-key
11
+ * requirement and the submit record type come from the document literal. The untyped door keeps
12
+ * its signature for a host holding a runtime artifact that names no types.
13
+ */
14
+ export { FormProvider } from './FormProvider.js';
15
+ export { seededIdFactory } from './store/ids.js';
16
+ export { useField } from './useField.js';
17
+ export { useFieldValue } from './render/field-value.js';
18
+ export { useFieldArray } from './useFieldArray.js';
19
+ export { useBufferedInput } from './useBufferedInput.js';
20
+ export { useAsyncOptions, DEFAULT_OPTION_PAGE_SIZE } from './useAsyncOptions.js';
21
+ export { useGate } from './useGate.js';
22
+ export { useLayout, useLayoutNode, useSection } from './useLayout.js';
23
+ export { useFields, useIdPrefix, useSchema } from './render/schema.js';
24
+ export { freeNaturalKey, renderErrorSummary, renderLayout, renderRowName } from './render/nodes.js';
25
+ export { UNDECIDED_VALUE_TEXT, renderDisplayText, renderFieldText, renderValueText, } from './render/value-text.js';
26
+ export { useWizard, useStep } from './useWizard.js';
27
+ export { useMessage, useFormatMessage, useDirection, useLocaleAttributes } from './useMessage.js';
28
+ export { useForm, useFormHandle } from './useForm.js';
29
+ export { useFormState } from './useFormState.js';
30
+ export { useWatch } from './useWatch.js';
31
+ export { getInputHints } from './hints.js';
32
+ export { fieldDescriptionId, fieldDomId, fieldErrorId } from './field-props.js';
33
+ export { errorKey } from './store/visibility.js';
34
+ export { AccessSourceError } from './store/inputs.js';
35
+ export { parseBindingKey } from './typed.js';
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGjD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACvE,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACpG,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,eAAe,EACf,eAAe,GAChB,MAAM,wBAAwB,CAAC;AAyBhC,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAElG,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAajD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AA6EtD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC","sourcesContent":["/**\n * `@azx-pbc/axiom-react` — Axiom's headless React bindings.\n *\n * The package renders nothing itself: a host mounts one `FormProvider` for a compiled artifact\n * and binds a control to each field or row with `useField`, so the same code runs on React 19\n * Web and React Native 0.88. There is no DOM, CSS or UI dependency here — and no compiler\n * either, because the dependency graph runs compiler -> runtime <- react.\n *\n * `useField`, `useFormState` and `useForm` each state two doors. The typed door takes the\n * artifact `@azx-pbc/axiom-builder`'s `defineDocument` returns, so the field ids, the row-key\n * requirement and the submit record type come from the document literal. The untyped door keeps\n * its signature for a host holding a runtime artifact that names no types.\n */\nexport { FormProvider } from './FormProvider.js';\nexport type { FormProviderProps } from './FormProvider.js';\nexport type { FormRenderError } from './FormErrorBoundary.js';\nexport { seededIdFactory } from './store/ids.js';\nexport { useField } from './useField.js';\nexport { useFieldValue } from './render/field-value.js';\nexport type { FieldValue } from './render/field-value.js';\nexport { useFieldArray } from './useFieldArray.js';\nexport { useBufferedInput } from './useBufferedInput.js';\nexport { useAsyncOptions, DEFAULT_OPTION_PAGE_SIZE } from './useAsyncOptions.js';\nexport { useGate } from './useGate.js';\nexport { useLayout, useLayoutNode, useSection } from './useLayout.js';\nexport { useFields, useIdPrefix, useSchema } from './render/schema.js';\nexport { freeNaturalKey, renderErrorSummary, renderLayout, renderRowName } from './render/nodes.js';\nexport {\n UNDECIDED_VALUE_TEXT,\n renderDisplayText,\n renderFieldText,\n renderValueText,\n} from './render/value-text.js';\nexport type { ValueDisplay } from './render/value-text.js';\nexport type {\n RenderCalloutNode,\n RenderControlNode,\n RenderDividerNode,\n RenderErrorInput,\n RenderErrorItem,\n RenderErrorSummaryInput,\n RenderErrorSummaryNode,\n RenderGroupNode,\n RenderHeadingLevel,\n RenderHeadingNode,\n RenderLayoutInput,\n RenderNode,\n RenderReadout,\n RenderRecordsNode,\n RenderRecordNode,\n RenderSectionNode,\n RenderSopBlockNode,\n RenderStepNode,\n RenderSummaryCardNode,\n RenderTranslate,\n RenderWizardNode,\n} from './render/nodes.js';\nexport { useWizard, useStep } from './useWizard.js';\nexport { useMessage, useFormatMessage, useDirection, useLocaleAttributes } from './useMessage.js';\nexport type { LocaleAttributes } from './useMessage.js';\nexport { useForm, useFormHandle } from './useForm.js';\nexport { useFormState } from './useFormState.js';\nexport { useWatch } from './useWatch.js';\nexport { getInputHints } from './hints.js';\nexport { fieldDescriptionId, fieldDomId, fieldErrorId } from './field-props.js';\nexport { errorKey } from './store/visibility.js';\nexport type {\n InputHintOptions,\n InputHints,\n NativeAutoCapitalize,\n NativeInputHints,\n NativeKeyboardType,\n NativeTextContentType,\n PasswordPurpose,\n WebInputHints,\n WebInputMode,\n WebInputType,\n} from './hints.js';\nexport { AccessSourceError } from './store/inputs.js';\nexport type {\n FieldArray,\n FieldArrayControls,\n FieldArrayMutations,\n FieldArrayView,\n RowRef,\n} from './store/array-bindings.js';\nexport type { BufferedInput } from './useBufferedInput.js';\nexport type {\n BufferedFormat,\n BufferRefusal,\n BufferRefusalReason,\n FormatContract,\n ParseOutcome,\n} from './store/parse-print.js';\nexport type {\n AsyncOptionList,\n OptionBasis,\n OptionControls,\n OptionLoader,\n OptionPageState,\n OptionRequest,\n QueryDefer,\n} from './store/option-pages.js';\nexport type { GateView } from './store/gates.js';\nexport type { LayoutSlice } from './store/layout.js';\nexport type {\n StepBlocker,\n StepState,\n StepStatus,\n Wizard,\n WizardProblem,\n WizardStep,\n} from './useWizard.js';\nexport type {\n DeclaredMessageValue,\n FormatValue,\n MessageArgument,\n MessageFormatter,\n MessageValueKind,\n} from './store/messages.js';\nexport type {\n FormHandle,\n FormSummary,\n Proposal,\n PublishTrace,\n WriteProposal,\n} from './form-store.js';\n// A staged proposal the store refused is a host-visible outcome: a host branches on\n// `PROPOSAL_SUPERSEDED` to show the newer change set instead of retrying the older one.\nexport type {\n PendingProposalSummary,\n ProposalRefusal,\n ProposalRefusalCode,\n} from './store/proposals.js';\nexport type {\n AccessFieldError,\n CardinalityFieldError,\n FieldError,\n GateFieldError,\n InvalidValueFieldError,\n RequiredFieldError,\n RowKeyFieldError,\n RuleFieldError,\n ScreenFieldError,\n} from './field-error.js';\nexport type {\n ArrayFieldIdsOf,\n BindingKeyOf,\n BindingRefOf,\n FieldBindingArgs,\n TypedFieldProps,\n TypedFormHandle,\n TypedFormSummary,\n TypedValueState,\n} from './typed.js';\nexport { parseBindingKey } from './typed.js';\nexport type {\n FieldA11y,\n FieldComputation,\n FieldMessage,\n FieldProps,\n} from './field-props.js';\nexport type { ShowErrorsPolicy } from './store/visibility.js';\n"]}
@@ -0,0 +1,92 @@
1
+ import type { ArtifactShape, FieldIdsOf, TypedArtifact, WireValue } from '@azx-pbc/axiom-runtime';
2
+ import type { FieldBindingArgs } from '../typed.js';
3
+ /**
4
+ * One binding's value, tagged by the declaration that gives it its domain.
5
+ *
6
+ * `FieldProps.value` is the wire union — a money amount is `{ minor, currency, scale }`, a
7
+ * timeslot and an attachment are records, an authored empty value is `null` — so a control that
8
+ * wanted a string wrote a `typeof` chain, and the two most-copied snippets rendered `''` for a
9
+ * money amount and the word `null` for an authored empty. This is the narrowed answer: a control
10
+ * branches once on `kind`, and the domain's own members are in the arm that carries them.
11
+ *
12
+ * `text` is not a member here: `FieldProps.text` already states the display text for every
13
+ * domain, and a control that only shows a value reads that instead.
14
+ */
15
+ export type FieldValue =
16
+ /** No value this binding holds: absent, or the authored `null` that `empty()` calls empty. */
17
+ {
18
+ readonly kind: 'absent';
19
+ }
20
+ /** A value the resolved access withholds; only `maskedText` may be shown in its place. */
21
+ | {
22
+ readonly kind: 'unreadable';
23
+ }
24
+ /** `string`, `decimal`, `date`, `instant` and an enumerated code, in their canonical text. */
25
+ | {
26
+ readonly kind: 'text';
27
+ readonly text: string;
28
+ } | {
29
+ readonly kind: 'integer';
30
+ readonly value: number;
31
+ } | {
32
+ readonly kind: 'boolean';
33
+ readonly value: boolean;
34
+ }
35
+ /** An amount in minor units, with the domain its declaration states. */
36
+ | {
37
+ readonly kind: 'money';
38
+ readonly minor: string;
39
+ readonly currency: string;
40
+ readonly scale: number;
41
+ }
42
+ /** A measured amount and the unit its declaration binds it to. */
43
+ | {
44
+ readonly kind: 'quantity';
45
+ readonly value: string;
46
+ readonly unit: string;
47
+ }
48
+ /** A civil date and the window it names. */
49
+ | {
50
+ readonly kind: 'timeslot';
51
+ readonly localDate: string;
52
+ readonly start?: string;
53
+ readonly end?: string;
54
+ }
55
+ /** A `media_ref` or `signature_ref`, by the identity the wire holds. */
56
+ | {
57
+ readonly kind: 'reference';
58
+ readonly id: string;
59
+ }
60
+ /** A scalar or attachment array's items, in order. */
61
+ | {
62
+ readonly kind: 'list';
63
+ readonly items: readonly WireValue[];
64
+ }
65
+ /** One nested record. */
66
+ | {
67
+ readonly kind: 'record';
68
+ readonly record: Readonly<Record<string, WireValue>>;
69
+ }
70
+ /**
71
+ * A value the declaration's domain did not describe — never expected from a compiled artifact,
72
+ * and stated rather than dropped so a control can still render `FieldProps.text`.
73
+ */
74
+ | {
75
+ readonly kind: 'opaque';
76
+ readonly value: WireValue;
77
+ };
78
+ /**
79
+ * The value of one binding, tagged by its declaration, `useFieldValue()`.
80
+ *
81
+ * Reads the same binding `useField` does, so it re-renders with it and no second subscription
82
+ * exists. A control that edits a value uses it for the domain (`money`, `timeslot`, `record`) and
83
+ * `useBufferedInput` for the text a keystroke passes through.
84
+ *
85
+ * Two doors share this hook. The typed door takes the artifact `defineDocument` returns and
86
+ * accepts only a declared field id, with a row key exactly where the declaration holds rows.
87
+ * The untyped door — `useFieldValue(fieldId, rowKey)` — is unchanged, for a host that holds a
88
+ * runtime artifact and names no types. Both read the same binding, and the runtime judges both.
89
+ */
90
+ export declare function useFieldValue<Shape extends ArtifactShape, Id extends FieldIdsOf<Shape>>(definition: TypedArtifact<Shape>, fieldId: Id, ...rowKey: FieldBindingArgs<Shape, Id>): FieldValue;
91
+ export declare function useFieldValue(fieldId: string, rowKey?: string | number): FieldValue;
92
+ //# sourceMappingURL=field-value.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-value.d.ts","sourceRoot":"","sources":["../../src/render/field-value.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGlG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,UAAU;AACpB,8FAA8F;AAC5F;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAE;AAC7B,0FAA0F;GACxF;IAAE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAA;CAAE;AACjC,8FAA8F;GAC5F;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAChD;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACpD;IAAE,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAA;CAAE;AACvD,wEAAwE;GACtE;IACE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM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GACrC,UAAU,CAAC;AACd,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,CAAC"}
@@ -0,0 +1,124 @@
1
+ import { assertNever, isRecord } from '@azx-pbc/axiom-runtime';
2
+ import { useField, useFormSessionFor } from '../useField.js';
3
+ /** Whether the access answer withholds the value this device holds. */
4
+ function isWithheld(source) {
5
+ return (source.maskedText !== undefined ||
6
+ source.access === 'masked' ||
7
+ source.access === 'hidden' ||
8
+ source.access === 'write_only');
9
+ }
10
+ /** A money value's members, when the value carries all three. */
11
+ function moneyOf(value) {
12
+ const minor = value['minor'];
13
+ const currency = value['currency'];
14
+ const scale = value['scale'];
15
+ if (typeof minor !== 'string' || typeof currency !== 'string' || typeof scale !== 'number') {
16
+ return undefined;
17
+ }
18
+ return { kind: 'money', minor, currency, scale };
19
+ }
20
+ /** A quantity's amount and unit, when the value carries both. */
21
+ function quantityOf(value) {
22
+ const amount = value['value'];
23
+ const unit = value['unit'];
24
+ if (typeof amount !== 'string' || typeof unit !== 'string')
25
+ return undefined;
26
+ return { kind: 'quantity', value: amount, unit };
27
+ }
28
+ /** A timeslot's date and window, when the value carries a date. */
29
+ function timeslotOf(value) {
30
+ const localDate = value['localDate'];
31
+ if (typeof localDate !== 'string')
32
+ return undefined;
33
+ const start = value['start'];
34
+ const end = value['end'];
35
+ return {
36
+ kind: 'timeslot',
37
+ localDate,
38
+ ...(typeof start === 'string' ? { start } : {}),
39
+ ...(typeof end === 'string' ? { end } : {}),
40
+ };
41
+ }
42
+ /**
43
+ * Reads one binding's value as the declaration's domain.
44
+ *
45
+ * A writer's value wins over the record's, exactly as `renderFieldText` reads them: a computed
46
+ * total is the value the control must show, and the record holds whatever the user last typed.
47
+ * Not exported: the only caller is `useFieldValue`, and a host holding a `FieldProps` reads
48
+ * `field.text` or calls the hook again.
49
+ */
50
+ function fieldValueOf(source) {
51
+ const resolved = source.computation.kind === 'value' ? source.computation.value : source.value;
52
+ if (resolved === undefined)
53
+ return isWithheld(source) ? { kind: 'unreadable' } : { kind: 'absent' };
54
+ if (resolved === null)
55
+ return { kind: 'absent' };
56
+ switch (source.descriptor.primitive) {
57
+ case 'string':
58
+ case 'decimal':
59
+ case 'date':
60
+ case 'instant':
61
+ case 'time':
62
+ return typeof resolved === 'string'
63
+ ? { kind: 'text', text: resolved }
64
+ : { kind: 'opaque', value: resolved };
65
+ case 'integer':
66
+ return typeof resolved === 'number'
67
+ ? { kind: 'integer', value: resolved }
68
+ : { kind: 'opaque', value: resolved };
69
+ case 'boolean':
70
+ return typeof resolved === 'boolean'
71
+ ? { kind: 'boolean', value: resolved }
72
+ : { kind: 'opaque', value: resolved };
73
+ case 'quantity': {
74
+ if (!isRecord(resolved))
75
+ return { kind: 'opaque', value: resolved };
76
+ return quantityOf(resolved) ?? { kind: 'opaque', value: resolved };
77
+ }
78
+ case 'duration':
79
+ case 'address':
80
+ case 'coordinate':
81
+ return { kind: 'opaque', value: resolved };
82
+ case 'money': {
83
+ if (!isRecord(resolved))
84
+ return { kind: 'opaque', value: resolved };
85
+ return moneyOf(resolved) ?? { kind: 'opaque', value: resolved };
86
+ }
87
+ case 'timeslot': {
88
+ if (!isRecord(resolved))
89
+ return { kind: 'opaque', value: resolved };
90
+ return timeslotOf(resolved) ?? { kind: 'opaque', value: resolved };
91
+ }
92
+ case 'media_ref':
93
+ case 'signature_ref': {
94
+ if (!isRecord(resolved))
95
+ return { kind: 'opaque', value: resolved };
96
+ const id = resolved['id'];
97
+ return typeof id === 'string'
98
+ ? { kind: 'reference', id }
99
+ : { kind: 'opaque', value: resolved };
100
+ }
101
+ case 'array':
102
+ return Array.isArray(resolved)
103
+ ? { kind: 'list', items: resolved }
104
+ : { kind: 'opaque', value: resolved };
105
+ case 'record':
106
+ return isRecord(resolved)
107
+ ? { kind: 'record', record: resolved }
108
+ : { kind: 'opaque', value: resolved };
109
+ default:
110
+ // A primitive added to the model must be given an arm, not fall through to `undefined`.
111
+ return assertNever(source.descriptor.primitive);
112
+ }
113
+ }
114
+ export function useFieldValue(definitionOrFieldId, fieldIdOrRowKey, rowKey) {
115
+ const typed = typeof definitionOrFieldId !== 'string';
116
+ const fieldId = typed ? fieldIdOrRowKey : definitionOrFieldId;
117
+ const bindingRowKey = typed ? rowKey : fieldIdOrRowKey;
118
+ if (typeof fieldId !== 'string') {
119
+ throw new Error('@azx-pbc/axiom-react: useFieldValue must name a field id');
120
+ }
121
+ useFormSessionFor(typed ? definitionOrFieldId : undefined, 'useFieldValue');
122
+ return fieldValueOf(useField(fieldId, bindingRowKey));
123
+ }
124
+ //# sourceMappingURL=field-value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"field-value.js","sourceRoot":"","sources":["../../src/render/field-value.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAG/D,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AA0D7D,uEAAuE;AACvE,SAAS,UAAU,CAAC,MAAmB;IACrC,OAAO,CACL,MAAM,CAAC,UAAU,KAAK,SAAS;QAC/B,MAAM,CAAC,MAAM,KAAK,QAAQ;QAC1B,MAAM,CAAC,MAAM,KAAK,QAAQ;QAC1B,MAAM,CAAC,MAAM,KAAK,YAAY,CAC/B,CAAC;AACJ,CAAC;AAED,iEAAiE;AACjE,SAAS,OAAO,CACd,KAA0C;IAE1C,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7B,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;IACnC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC;IAC7B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC3F,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,O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AC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE;gBACnC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;QAC1C,KAAK,QAAQ;YACX,OAAO,QAAQ,CAAC,QAAQ,CAAC;gBACvB,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE;gBACtC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;QAC1C;YACE,wFAAwF;YACxF,OAAO,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACpD,CAAC;AACH,CAAC;AAoBD,MAAM,UAAU,aAAa,CAC3B,mBAA0D,EAC1D,eAAiC,EACjC,MAAwB;IAExB,MAAM,KAAK,GAAG,OAAO,mBAAmB,KAAK,QAAQ,CAAC;IACtD,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,mBAAmB,CAAC;IAC9D,MAAM,aAAa,GAAG,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC;IACvD,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAChC,MAAM,IAAI,KAAK,CAAC,0DAA0D,CAAC,CAAC;IAC9E,CAAC;IACD,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,SAAS,EAAE,eAAe,CAAC,CAAC;IAC5E,OAAO,YAAY,CAAC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC;AACxD,CAAC","sourcesContent":["import { assertNever, isRecord } from '@azx-pbc/axiom-runtime';\nimport type { ArtifactShape, FieldIdsOf, TypedArtifact, WireValue } from '@azx-pbc/axiom-runtime';\nimport type { FieldProps } from '../field-props.js';\nimport { useField, useFormSessionFor } from '../useField.js';\nimport type { FieldBindingArgs } from '../typed.js';\n\n/**\n * One binding's value, tagged by the declaration that gives it its domain.\n *\n * `FieldProps.value` is the wire union — a money amount is `{ minor, currency, scale }`, a\n * timeslot and an attachment are records, an authored empty value is `null` — so a control that\n * wanted a string wrote a `typeof` chain, and the two most-copied snippets rendered `''` for a\n * money amount and the word `null` for an authored empty. This is the narrowed answer: a control\n * branches once on `kind`, and the domain's own members are in the arm that carries them.\n *\n * `text` is not a member here: `FieldProps.text` already states the display text for every\n * domain, and a control that only shows a value reads that instead.\n */\nexport type FieldValue =\n /** No value this binding holds: absent, or the authored `null` that `empty()` calls empty. */\n | { readonly kind: 'absent' }\n /** A value the resolved access withholds; only `maskedText` may be shown in its place. */\n | { readonly kind: 'unreadable' }\n /** `string`, `decimal`, `date`, `instant` and an enumerated code, in their canonical text. */\n | { readonly kind: 'text'; readonly text: string }\n | { readonly kind: 'integer'; readonly value: number }\n | { readonly kind: 'boolean'; readonly value: boolean }\n /** An amount in minor units, with the domain its declaration states. */\n | {\n readonly kind: 'money';\n readonly minor: string;\n readonly currency: string;\n readonly scale: number;\n }\n /** A measured amount and the unit its declaration binds it to. */\n | { readonly kind: 'quantity'; readonly value: string; readonly unit: string }\n /** A civil date and the window it names. */\n | {\n readonly kind: 'timeslot';\n readonly localDate: string;\n readonly start?: string;\n readonly end?: string;\n }\n /** A `media_ref` or `signature_ref`, by the identity the wire holds. */\n | { readonly kind: 'reference'; readonly id: string }\n /** A scalar or attachment array's items, in order. */\n | { readonly kind: 'list'; readonly items: readonly WireValue[] }\n /** One nested record. */\n | { readonly kind: 'record'; readonly record: Readonly<Record<string, WireValue>> }\n /**\n * A value the declaration's domain did not describe — never expected from a compiled artifact,\n * and stated rather than dropped so a control can still render `FieldProps.text`.\n */\n | { readonly kind: 'opaque'; readonly value: WireValue };\n\n/** The four facts one binding's value is read from. */\ntype ValueSource = Pick<\n FieldProps,\n 'value' | 'descriptor' | 'computation' | 'access' | 'maskedText'\n>;\n\n/** Whether the access answer withholds the value this device holds. */\nfunction isWithheld(source: ValueSource): boolean {\n return (\n source.maskedText !== undefined ||\n source.access === 'masked' ||\n source.access === 'hidden' ||\n source.access === 'write_only'\n );\n}\n\n/** A money value's members, when the value carries all three. */\nfunction moneyOf(\n value: Readonly<Record<string, WireValue>>,\n): Extract<FieldValue, { readonly kind: 'money' }> | undefined {\n const minor = value['minor'];\n const currency = value['currency'];\n const scale = value['scale'];\n if (typeof minor !== 'string' || typeof currency !== 'string' || typeof scale !== 'number') {\n return undefined;\n }\n return { kind: 'money', minor, currency, scale };\n}\n\n/** A quantity's amount and unit, when the value carries both. */\nfunction quantityOf(\n value: Readonly<Record<string, WireValue>>,\n): Extract<FieldValue, { readonly kind: 'quantity' }> | undefined {\n const amount = value['value'];\n const unit = value['unit'];\n if (typeof amount !== 'string' || typeof unit !== 'string') return undefined;\n return { kind: 'quantity', value: amount, unit };\n}\n\n/** A timeslot's date and window, when the value carries a date. */\nfunction timeslotOf(\n value: Readonly<Record<string, WireValue>>,\n): Extract<FieldValue, { readonly kind: 'timeslot' }> | undefined {\n const localDate = value['localDate'];\n if (typeof localDate !== 'string') return undefined;\n const start = value['start'];\n const end = value['end'];\n return {\n kind: 'timeslot',\n localDate,\n ...(typeof start === 'string' ? { start } : {}),\n ...(typeof end === 'string' ? { end } : {}),\n };\n}\n\n/**\n * Reads one binding's value as the declaration's domain.\n *\n * A writer's value wins over the record's, exactly as `renderFieldText` reads them: a computed\n * total is the value the control must show, and the record holds whatever the user last typed.\n * Not exported: the only caller is `useFieldValue`, and a host holding a `FieldProps` reads\n * `field.text` or calls the hook again.\n */\nfunction fieldValueOf(source: ValueSource): FieldValue {\n const resolved = source.computation.kind === 'value' ? source.computation.value : source.value;\n if (resolved === undefined)\n return isWithheld(source) ? { kind: 'unreadable' } : { kind: 'absent' };\n if (resolved === null) return { kind: 'absent' };\n switch (source.descriptor.primitive) {\n case 'string':\n case 'decimal':\n case 'date':\n case 'instant':\n case 'time':\n return typeof resolved === 'string'\n ? { kind: 'text', text: resolved }\n : { kind: 'opaque', value: resolved };\n case 'integer':\n return typeof resolved === 'number'\n ? { kind: 'integer', value: resolved }\n : { kind: 'opaque', value: resolved };\n case 'boolean':\n return typeof resolved === 'boolean'\n ? { kind: 'boolean', value: resolved }\n : { kind: 'opaque', value: resolved };\n case 'quantity': {\n if (!isRecord(resolved)) return { kind: 'opaque', value: resolved };\n return quantityOf(resolved) ?? { kind: 'opaque', value: resolved };\n }\n case 'duration':\n case 'address':\n case 'coordinate':\n return { kind: 'opaque', value: resolved };\n case 'money': {\n if (!isRecord(resolved)) return { kind: 'opaque', value: resolved };\n return moneyOf(resolved) ?? { kind: 'opaque', value: resolved };\n }\n case 'timeslot': {\n if (!isRecord(resolved)) return { kind: 'opaque', value: resolved };\n return timeslotOf(resolved) ?? { kind: 'opaque', value: resolved };\n }\n case 'media_ref':\n case 'signature_ref': {\n if (!isRecord(resolved)) return { kind: 'opaque', value: resolved };\n const id = resolved['id'];\n return typeof id === 'string'\n ? { kind: 'reference', id }\n : { kind: 'opaque', value: resolved };\n }\n case 'array':\n return Array.isArray(resolved)\n ? { kind: 'list', items: resolved }\n : { kind: 'opaque', value: resolved };\n case 'record':\n return isRecord(resolved)\n ? { kind: 'record', record: resolved }\n : { kind: 'opaque', value: resolved };\n default:\n // A primitive added to the model must be given an arm, not fall through to `undefined`.\n return assertNever(source.descriptor.primitive);\n }\n}\n\n/**\n * The value of one binding, tagged by its declaration, `useFieldValue()`.\n *\n * Reads the same binding `useField` does, so it re-renders with it and no second subscription\n * exists. A control that edits a value uses it for the domain (`money`, `timeslot`, `record`) and\n * `useBufferedInput` for the text a keystroke passes through.\n *\n * Two doors share this hook. The typed door takes the artifact `defineDocument` returns and\n * accepts only a declared field id, with a row key exactly where the declaration holds rows.\n * The untyped door — `useFieldValue(fieldId, rowKey)` — is unchanged, for a host that holds a\n * runtime artifact and names no types. Both read the same binding, and the runtime judges both.\n */\nexport function useFieldValue<Shape extends ArtifactShape, Id extends FieldIdsOf<Shape>>(\n definition: TypedArtifact<Shape>,\n fieldId: Id,\n ...rowKey: FieldBindingArgs<Shape, Id>\n): FieldValue;\nexport function useFieldValue(fieldId: string, rowKey?: string | number): FieldValue;\nexport function useFieldValue(\n definitionOrFieldId: TypedArtifact<ArtifactShape> | string,\n fieldIdOrRowKey?: string | number,\n rowKey?: string | number,\n): FieldValue {\n const typed = typeof definitionOrFieldId !== 'string';\n const fieldId = typed ? fieldIdOrRowKey : definitionOrFieldId;\n const bindingRowKey = typed ? rowKey : fieldIdOrRowKey;\n if (typeof fieldId !== 'string') {\n throw new Error('@azx-pbc/axiom-react: useFieldValue must name a field id');\n }\n useFormSessionFor(typed ? definitionOrFieldId : undefined, 'useFieldValue');\n return fieldValueOf(useField(fieldId, bindingRowKey));\n}\n"]}