@getodk/xforms-engine 0.4.0 → 0.5.0

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 (285) hide show
  1. package/dist/client/BaseNode.d.ts +14 -3
  2. package/dist/client/BaseValueNode.d.ts +32 -0
  3. package/dist/client/EngineConfig.d.ts +49 -48
  4. package/dist/client/InputNode.d.ts +53 -0
  5. package/dist/client/ModelValueNode.d.ts +12 -7
  6. package/dist/client/NoteNode.d.ts +2 -2
  7. package/dist/client/RootNode.d.ts +34 -7
  8. package/dist/client/SelectNode.d.ts +2 -2
  9. package/dist/client/ValueType.d.ts +3 -0
  10. package/dist/client/constants.d.ts +50 -0
  11. package/dist/client/hierarchy.d.ts +4 -4
  12. package/dist/client/identity.d.ts +14 -0
  13. package/dist/client/node-types.d.ts +2 -1
  14. package/dist/client/resources.d.ts +93 -0
  15. package/dist/client/submission/SubmissionData.d.ts +7 -0
  16. package/dist/client/submission/SubmissionDefinition.d.ts +14 -0
  17. package/dist/client/submission/SubmissionInstanceFile.d.ts +6 -0
  18. package/dist/client/submission/SubmissionOptions.d.ts +23 -0
  19. package/dist/client/submission/SubmissionResult.d.ts +91 -0
  20. package/dist/client/submission/SubmissionState.d.ts +12 -0
  21. package/dist/client/validation.d.ts +2 -2
  22. package/dist/error/ErrorProductionDesignPendingError.d.ts +7 -0
  23. package/dist/error/ValueTypeInvariantError.d.ts +17 -0
  24. package/dist/error/XPathFunctionalityError.d.ts +14 -0
  25. package/dist/error/XPathFunctionalityNotSupportedError.d.ts +7 -0
  26. package/dist/error/XPathFunctionalityPendingError.d.ts +7 -0
  27. package/dist/index.d.ts +10 -1
  28. package/dist/index.js +10856 -8585
  29. package/dist/index.js.map +1 -1
  30. package/dist/instance/Group.d.ts +9 -4
  31. package/dist/instance/InputControl.d.ts +36 -0
  32. package/dist/instance/ModelValue.d.ts +16 -26
  33. package/dist/instance/Note.d.ts +10 -3
  34. package/dist/instance/PrimaryInstance.d.ts +84 -0
  35. package/dist/instance/Root.d.ts +29 -25
  36. package/dist/instance/SelectField.d.ts +10 -2
  37. package/dist/instance/Subtree.d.ts +10 -5
  38. package/dist/instance/TriggerControl.d.ts +10 -3
  39. package/dist/instance/abstract/DescendantNode.d.ts +31 -23
  40. package/dist/instance/abstract/InstanceNode.d.ts +49 -29
  41. package/dist/instance/abstract/UnsupportedControl.d.ts +10 -3
  42. package/dist/instance/abstract/ValueNode.d.ts +48 -0
  43. package/dist/instance/hierarchy.d.ts +9 -8
  44. package/dist/instance/identity.d.ts +2 -7
  45. package/dist/instance/internal-api/EvaluationContext.d.ts +53 -12
  46. package/dist/instance/internal-api/InstanceConfig.d.ts +8 -2
  47. package/dist/instance/internal-api/InstanceValueContext.d.ts +20 -0
  48. package/dist/instance/internal-api/PrimaryInstanceDocument.d.ts +36 -0
  49. package/dist/instance/internal-api/TranslationContext.d.ts +3 -2
  50. package/dist/instance/internal-api/ValidationContext.d.ts +3 -4
  51. package/dist/instance/internal-api/ValueContext.d.ts +2 -1
  52. package/dist/instance/internal-api/submission/ClientReactiveSubmittableInstance.d.ts +14 -0
  53. package/dist/instance/internal-api/submission/ClientReactiveSubmittableLeafNode.d.ts +31 -0
  54. package/dist/instance/internal-api/submission/ClientReactiveSubmittableParentNode.d.ts +18 -0
  55. package/dist/instance/internal-api/submission/ClientReactiveSubmittableValueNode.d.ts +17 -0
  56. package/dist/instance/repeat/BaseRepeatRange.d.ts +39 -83
  57. package/dist/instance/repeat/RepeatInstance.d.ts +11 -29
  58. package/dist/instance/repeat/RepeatRangeControlled.d.ts +2 -2
  59. package/dist/instance/repeat/RepeatRangeUncontrolled.d.ts +2 -2
  60. package/dist/instance/resource.d.ts +1 -1
  61. package/dist/instance/text/TextRange.d.ts +1 -1
  62. package/dist/instance/unsupported/RangeControl.d.ts +3 -1
  63. package/dist/instance/unsupported/RankControl.d.ts +3 -1
  64. package/dist/instance/unsupported/UploadControl.d.ts +3 -1
  65. package/dist/integration/xpath/EngineXPathEvaluator.d.ts +14 -0
  66. package/dist/integration/xpath/adapter/XFormsXPathNode.d.ts +71 -0
  67. package/dist/integration/xpath/adapter/engineDOMAdapter.d.ts +5 -0
  68. package/dist/integration/xpath/adapter/kind.d.ts +32 -0
  69. package/dist/integration/xpath/adapter/names.d.ts +16 -0
  70. package/dist/integration/xpath/adapter/traversal.d.ts +25 -0
  71. package/dist/integration/xpath/adapter/values.d.ts +2 -0
  72. package/dist/integration/xpath/static-dom/StaticAttribute.d.ts +19 -0
  73. package/dist/integration/xpath/static-dom/StaticDocument.d.ts +16 -0
  74. package/dist/integration/xpath/static-dom/StaticElement.d.ts +40 -0
  75. package/dist/integration/xpath/static-dom/StaticNamedNode.d.ts +17 -0
  76. package/dist/integration/xpath/static-dom/StaticNode.d.ts +33 -0
  77. package/dist/integration/xpath/static-dom/StaticText.d.ts +16 -0
  78. package/dist/lib/client-reactivity/submission/createInstanceSubmissionState.d.ts +3 -0
  79. package/dist/lib/client-reactivity/submission/createLeafNodeSubmissionState.d.ts +3 -0
  80. package/dist/lib/client-reactivity/submission/createNodeRangeSubmissionState.d.ts +4 -0
  81. package/dist/lib/client-reactivity/submission/createParentNodeSubmissionState.d.ts +4 -0
  82. package/dist/lib/client-reactivity/submission/createValueNodeSubmissionState.d.ts +3 -0
  83. package/dist/lib/client-reactivity/submission/prepareSubmission.d.ts +8 -0
  84. package/dist/lib/codecs/DecimalValueCodec.d.ts +6 -0
  85. package/dist/lib/codecs/IntValueCodec.d.ts +6 -0
  86. package/dist/lib/codecs/StringValueCodec.d.ts +4 -0
  87. package/dist/lib/codecs/ValueCodec.d.ts +30 -0
  88. package/dist/lib/codecs/ValueTypePlaceholderCodec.d.ts +12 -0
  89. package/dist/lib/codecs/getSharedValueCodec.d.ts +47 -0
  90. package/dist/lib/dom/query.d.ts +3 -0
  91. package/dist/lib/reactivity/createChildrenState.d.ts +7 -5
  92. package/dist/lib/reactivity/createComputedExpression.d.ts +18 -5
  93. package/dist/lib/reactivity/createInstanceValueState.d.ts +40 -0
  94. package/dist/lib/reactivity/createNoteReadonlyThunk.d.ts +2 -2
  95. package/dist/lib/reactivity/createTranslationState.d.ts +19 -0
  96. package/dist/lib/reactivity/createValueState.d.ts +6 -10
  97. package/dist/lib/reactivity/materializeCurrentStateChildren.d.ts +4 -4
  98. package/dist/lib/xml-serialization.d.ts +41 -0
  99. package/dist/parse/XFormDOM.d.ts +18 -7
  100. package/dist/parse/XFormDefinition.d.ts +1 -2
  101. package/dist/parse/attachments/FormAttachmentResource.d.ts +27 -0
  102. package/dist/parse/body/BodyDefinition.d.ts +3 -3
  103. package/dist/parse/body/RepeatElementDefinition.d.ts +1 -1
  104. package/dist/parse/body/appearance/inputAppearanceParser.d.ts +1 -1
  105. package/dist/parse/body/control/{InputDefinition.d.ts → InputControlDefinition.d.ts} +1 -1
  106. package/dist/parse/body/control/select/ItemsetNodesetContext.d.ts +0 -2
  107. package/dist/parse/expression/abstract/DependencyContext.d.ts +0 -5
  108. package/dist/parse/expression/abstract/DependentExpression.d.ts +2 -3
  109. package/dist/parse/model/BindDefinition.d.ts +4 -5
  110. package/dist/parse/model/BindTypeDefinition.d.ts +20 -0
  111. package/dist/parse/model/DescendentNodeDefinition.d.ts +0 -1
  112. package/dist/parse/model/FormSubmissionDefinition.d.ts +8 -0
  113. package/dist/parse/model/ItextTranslation/ItextTranslationDefinition.d.ts +4 -0
  114. package/dist/parse/model/ItextTranslation/ItextTranslationRootDefinition.d.ts +8 -0
  115. package/dist/parse/model/ItextTranslation/ItextTranslationsDefinition.d.ts +8 -0
  116. package/dist/parse/model/LeafNodeDefinition.d.ts +3 -1
  117. package/dist/parse/model/ModelBindMap.d.ts +1 -1
  118. package/dist/parse/model/ModelDefinition.d.ts +2 -0
  119. package/dist/parse/model/NodeDefinition.d.ts +0 -1
  120. package/dist/parse/model/NoteNodeDefinition.d.ts +4 -4
  121. package/dist/parse/model/RootDefinition.d.ts +3 -2
  122. package/dist/parse/model/SecondaryInstance/SecondaryInstanceDefinition.d.ts +4 -0
  123. package/dist/parse/model/SecondaryInstance/SecondaryInstanceRootDefinition.d.ts +7 -0
  124. package/dist/parse/model/SecondaryInstance/SecondaryInstancesDefinition.d.ts +13 -0
  125. package/dist/parse/model/SecondaryInstance/sources/BlankSecondaryInstanceSource.d.ts +14 -0
  126. package/dist/parse/model/SecondaryInstance/sources/CSVExternalSecondaryInstance.d.ts +22 -0
  127. package/dist/parse/model/SecondaryInstance/sources/ExternalSecondaryInstanceResource.d.ts +23 -0
  128. package/dist/parse/model/SecondaryInstance/sources/ExternalSecondaryInstanceSource.d.ts +9 -0
  129. package/dist/parse/model/SecondaryInstance/sources/GeoJSONExternalSecondaryInstance.d.ts +5 -0
  130. package/dist/parse/model/SecondaryInstance/sources/InternalSecondaryInstanceSource.d.ts +7 -0
  131. package/dist/parse/model/SecondaryInstance/sources/SecondaryInstanceSource.d.ts +13 -0
  132. package/dist/parse/model/SecondaryInstance/sources/XMLExternalSecondaryInstanceSource.d.ts +12 -0
  133. package/dist/parse/shared/parseStaticDocumentFromDOMSubtree.d.ts +24 -0
  134. package/dist/parse/text/abstract/TextRangeDefinition.d.ts +0 -2
  135. package/dist/parse/xpath/semantic-analysis.d.ts +5 -0
  136. package/dist/solid.js +8174 -5921
  137. package/dist/solid.js.map +1 -1
  138. package/package.json +13 -11
  139. package/src/client/BaseNode.ts +16 -6
  140. package/src/client/BaseValueNode.ts +35 -0
  141. package/src/client/EngineConfig.ts +52 -51
  142. package/src/client/InputNode.ts +77 -0
  143. package/src/client/ModelValueNode.ts +30 -7
  144. package/src/client/NoteNode.ts +2 -2
  145. package/src/client/RootNode.ts +37 -7
  146. package/src/client/SelectNode.ts +3 -3
  147. package/src/client/ValueType.ts +4 -0
  148. package/src/client/constants.ts +67 -0
  149. package/src/client/hierarchy.ts +5 -5
  150. package/src/client/identity.ts +16 -0
  151. package/src/client/node-types.ts +12 -6
  152. package/src/client/resources.ts +118 -0
  153. package/src/client/submission/SubmissionData.ts +12 -0
  154. package/src/client/submission/SubmissionDefinition.ts +16 -0
  155. package/src/client/submission/SubmissionInstanceFile.ts +9 -0
  156. package/src/client/submission/SubmissionOptions.ts +28 -0
  157. package/src/client/submission/SubmissionResult.ts +124 -0
  158. package/src/client/submission/SubmissionState.ts +14 -0
  159. package/src/client/validation.ts +2 -2
  160. package/src/error/ErrorProductionDesignPendingError.ts +6 -0
  161. package/src/error/ValueTypeInvariantError.ts +22 -0
  162. package/src/error/XPathFunctionalityError.ts +26 -0
  163. package/src/error/XPathFunctionalityNotSupportedError.ts +18 -0
  164. package/src/error/XPathFunctionalityPendingError.ts +18 -0
  165. package/src/index.ts +10 -1
  166. package/src/instance/Group.ts +17 -5
  167. package/src/instance/InputControl.ts +119 -0
  168. package/src/instance/ModelValue.ts +47 -54
  169. package/src/instance/Note.ts +24 -8
  170. package/src/instance/PrimaryInstance.ts +244 -0
  171. package/src/instance/Root.ts +62 -134
  172. package/src/instance/SelectField.ts +56 -19
  173. package/src/instance/Subtree.ts +19 -7
  174. package/src/instance/TriggerControl.ts +23 -6
  175. package/src/instance/abstract/DescendantNode.ts +90 -45
  176. package/src/instance/abstract/InstanceNode.ts +103 -105
  177. package/src/instance/abstract/UnsupportedControl.ts +28 -5
  178. package/src/instance/abstract/ValueNode.ts +127 -0
  179. package/src/instance/children.ts +9 -10
  180. package/src/instance/hierarchy.ts +19 -15
  181. package/src/instance/identity.ts +3 -9
  182. package/src/instance/index.ts +25 -7
  183. package/src/instance/internal-api/EvaluationContext.ts +60 -13
  184. package/src/instance/internal-api/InstanceConfig.ts +9 -2
  185. package/src/instance/internal-api/InstanceValueContext.ts +24 -0
  186. package/src/instance/internal-api/PrimaryInstanceDocument.ts +53 -0
  187. package/src/instance/internal-api/TranslationContext.ts +3 -2
  188. package/src/instance/internal-api/ValidationContext.ts +3 -4
  189. package/src/instance/internal-api/ValueContext.ts +2 -1
  190. package/src/instance/internal-api/submission/ClientReactiveSubmittableInstance.ts +20 -0
  191. package/src/instance/internal-api/submission/ClientReactiveSubmittableLeafNode.ts +42 -0
  192. package/src/instance/internal-api/submission/ClientReactiveSubmittableParentNode.ts +25 -0
  193. package/src/instance/internal-api/submission/ClientReactiveSubmittableValueNode.ts +23 -0
  194. package/src/instance/repeat/BaseRepeatRange.ts +50 -131
  195. package/src/instance/repeat/RepeatInstance.ts +20 -46
  196. package/src/instance/repeat/RepeatRangeControlled.ts +5 -5
  197. package/src/instance/repeat/RepeatRangeUncontrolled.ts +2 -4
  198. package/src/instance/resource.ts +1 -1
  199. package/src/instance/text/TextChunk.ts +1 -1
  200. package/src/instance/unsupported/RangeControl.ts +5 -1
  201. package/src/instance/unsupported/RankControl.ts +5 -1
  202. package/src/instance/unsupported/UploadControl.ts +5 -1
  203. package/src/integration/xpath/EngineXPathEvaluator.ts +22 -0
  204. package/src/integration/xpath/adapter/XFormsXPathNode.ts +126 -0
  205. package/src/integration/xpath/adapter/engineDOMAdapter.ts +57 -0
  206. package/src/integration/xpath/adapter/kind.ts +114 -0
  207. package/src/integration/xpath/adapter/names.ts +99 -0
  208. package/src/integration/xpath/adapter/traversal.ts +228 -0
  209. package/src/integration/xpath/adapter/values.ts +5 -0
  210. package/src/integration/xpath/static-dom/StaticAttribute.ts +33 -0
  211. package/src/integration/xpath/static-dom/StaticDocument.ts +38 -0
  212. package/src/integration/xpath/static-dom/StaticElement.ts +106 -0
  213. package/src/integration/xpath/static-dom/StaticNamedNode.ts +45 -0
  214. package/src/integration/xpath/static-dom/StaticNode.ts +68 -0
  215. package/src/integration/xpath/static-dom/StaticText.ts +28 -0
  216. package/src/lib/client-reactivity/README.md +0 -0
  217. package/src/lib/client-reactivity/submission/createInstanceSubmissionState.ts +12 -0
  218. package/src/lib/client-reactivity/submission/createLeafNodeSubmissionState.ts +20 -0
  219. package/src/lib/client-reactivity/submission/createNodeRangeSubmissionState.ts +17 -0
  220. package/src/lib/client-reactivity/submission/createParentNodeSubmissionState.ts +22 -0
  221. package/src/lib/client-reactivity/submission/createValueNodeSubmissionState.ts +21 -0
  222. package/src/lib/client-reactivity/submission/prepareSubmission.ts +172 -0
  223. package/src/lib/codecs/DecimalValueCodec.ts +46 -0
  224. package/src/lib/codecs/IntValueCodec.ts +100 -0
  225. package/src/lib/codecs/StringValueCodec.ts +11 -0
  226. package/src/lib/codecs/ValueCodec.ts +106 -0
  227. package/src/lib/codecs/ValueTypePlaceholderCodec.ts +19 -0
  228. package/src/lib/codecs/getSharedValueCodec.ts +77 -0
  229. package/src/lib/dom/query.ts +7 -0
  230. package/src/lib/reactivity/createChildrenState.ts +8 -6
  231. package/src/lib/reactivity/createComputedExpression.ts +57 -34
  232. package/src/lib/reactivity/createInstanceValueState.ts +166 -0
  233. package/src/lib/reactivity/createNoteReadonlyThunk.ts +12 -7
  234. package/src/lib/reactivity/createSelectItems.ts +21 -21
  235. package/src/lib/reactivity/createTranslationState.ts +61 -0
  236. package/src/lib/reactivity/createValueState.ts +62 -120
  237. package/src/lib/reactivity/materializeCurrentStateChildren.ts +7 -7
  238. package/src/lib/reactivity/text/createTextRange.ts +4 -3
  239. package/src/lib/reactivity/validation/createAggregatedViolations.ts +1 -1
  240. package/src/lib/reactivity/validation/createValidation.ts +2 -3
  241. package/src/lib/xml-serialization.ts +96 -0
  242. package/src/parse/XFormDOM.ts +110 -75
  243. package/src/parse/XFormDefinition.ts +1 -6
  244. package/src/parse/attachments/FormAttachmentResource.ts +40 -0
  245. package/src/parse/body/BodyDefinition.ts +3 -3
  246. package/src/parse/body/appearance/inputAppearanceParser.ts +1 -1
  247. package/src/parse/body/control/{InputDefinition.ts → InputControlDefinition.ts} +3 -5
  248. package/src/parse/body/control/select/ItemsetNodesetContext.ts +0 -5
  249. package/src/parse/expression/abstract/DependencyContext.ts +0 -26
  250. package/src/parse/expression/abstract/DependentExpression.ts +2 -13
  251. package/src/parse/model/BindDefinition.ts +5 -8
  252. package/src/parse/model/BindTypeDefinition.ts +175 -0
  253. package/src/parse/model/DescendentNodeDefinition.ts +0 -6
  254. package/src/parse/model/FormSubmissionDefinition.ts +44 -0
  255. package/src/parse/model/ItextTranslation/ItextTranslationDefinition.ts +4 -0
  256. package/src/parse/model/ItextTranslation/ItextTranslationRootDefinition.ts +41 -0
  257. package/src/parse/model/ItextTranslation/ItextTranslationsDefinition.ts +31 -0
  258. package/src/parse/model/LeafNodeDefinition.ts +4 -1
  259. package/src/parse/model/ModelBindMap.ts +6 -8
  260. package/src/parse/model/ModelDefinition.ts +6 -1
  261. package/src/parse/model/NodeDefinition.ts +0 -3
  262. package/src/parse/model/NoteNodeDefinition.ts +3 -3
  263. package/src/parse/model/RootDefinition.ts +2 -1
  264. package/src/parse/model/SecondaryInstance/SecondaryInstanceDefinition.ts +4 -0
  265. package/src/parse/model/SecondaryInstance/SecondaryInstanceRootDefinition.ts +12 -0
  266. package/src/parse/model/SecondaryInstance/SecondaryInstancesDefinition.ts +102 -0
  267. package/src/parse/model/SecondaryInstance/sources/BlankSecondaryInstanceSource.ts +40 -0
  268. package/src/parse/model/SecondaryInstance/sources/CSVExternalSecondaryInstance.ts +288 -0
  269. package/src/parse/model/SecondaryInstance/sources/ExternalSecondaryInstanceResource.ts +222 -0
  270. package/src/parse/model/SecondaryInstance/sources/ExternalSecondaryInstanceSource.ts +22 -0
  271. package/src/parse/model/SecondaryInstance/sources/GeoJSONExternalSecondaryInstance.ts +414 -0
  272. package/src/parse/model/SecondaryInstance/sources/InternalSecondaryInstanceSource.ts +19 -0
  273. package/src/parse/model/SecondaryInstance/sources/SecondaryInstanceSource.ts +29 -0
  274. package/src/parse/model/SecondaryInstance/sources/XMLExternalSecondaryInstanceSource.ts +32 -0
  275. package/src/parse/shared/parseStaticDocumentFromDOMSubtree.ts +149 -0
  276. package/src/parse/text/abstract/TextRangeDefinition.ts +0 -6
  277. package/src/parse/xpath/semantic-analysis.ts +29 -0
  278. package/dist/client/StringNode.d.ts +0 -46
  279. package/dist/instance/StringField.d.ts +0 -44
  280. package/dist/instance/internal-api/SubscribableDependency.d.ts +0 -59
  281. package/dist/parse/XFormDataType.d.ts +0 -25
  282. package/src/client/StringNode.ts +0 -52
  283. package/src/instance/StringField.ts +0 -120
  284. package/src/instance/internal-api/SubscribableDependency.ts +0 -61
  285. package/src/parse/XFormDataType.ts +0 -62
@@ -0,0 +1,127 @@
1
+ import { XPathNodeKindKey } from '@getodk/xpath';
2
+ import type { Accessor } from 'solid-js';
3
+ import type { BaseValueNode } from '../../client/BaseValueNode.ts';
4
+ import type { LeafNodeType as ValueNodeType } from '../../client/node-types.ts';
5
+ import type { SubmissionState } from '../../client/submission/SubmissionState.ts';
6
+ import type { AnyViolation, LeafNodeValidationState } from '../../client/validation.ts';
7
+ import type { ValueType } from '../../client/ValueType.ts';
8
+ import type { XFormsXPathElement } from '../../integration/xpath/adapter/XFormsXPathNode.ts';
9
+ import { createValueNodeSubmissionState } from '../../lib/client-reactivity/submission/createValueNodeSubmissionState.ts';
10
+ import type {
11
+ RuntimeValueSetter,
12
+ RuntimeValueState,
13
+ ValueCodec,
14
+ } from '../../lib/codecs/ValueCodec.ts';
15
+ import { createInstanceValueState } from '../../lib/reactivity/createInstanceValueState.ts';
16
+ import type { CurrentState } from '../../lib/reactivity/node-state/createCurrentState.ts';
17
+ import type { EngineState } from '../../lib/reactivity/node-state/createEngineState.ts';
18
+ import type { SharedNodeState } from '../../lib/reactivity/node-state/createSharedNodeState.ts';
19
+ import type { SimpleAtomicState } from '../../lib/reactivity/types.ts';
20
+ import type { SharedValidationState } from '../../lib/reactivity/validation/createValidation.ts';
21
+ import { createValidationState } from '../../lib/reactivity/validation/createValidation.ts';
22
+ import { LeafNodeDefinition } from '../../parse/model/LeafNodeDefinition.ts';
23
+ import type { GeneralParentNode } from '../hierarchy.ts';
24
+ import type { EvaluationContext } from '../internal-api/EvaluationContext.ts';
25
+ import type {
26
+ DecodeInstanceValue,
27
+ InstanceValueContext,
28
+ } from '../internal-api/InstanceValueContext.ts';
29
+ import type { ClientReactiveSubmittableValueNode } from '../internal-api/submission/ClientReactiveSubmittableValueNode.ts';
30
+ import type { ValidationContext } from '../internal-api/ValidationContext.ts';
31
+ import type { DescendantNodeStateSpec } from './DescendantNode.ts';
32
+ import { DescendantNode } from './DescendantNode.ts';
33
+
34
+ export type ValueNodeDefinition<V extends ValueType> = LeafNodeDefinition<V>;
35
+
36
+ export interface ValueNodeStateSpec<RuntimeValue> extends DescendantNodeStateSpec<RuntimeValue> {
37
+ readonly children: null;
38
+ readonly valueOptions: null;
39
+ readonly value: SimpleAtomicState<RuntimeValue>;
40
+ readonly instanceValue: Accessor<string>;
41
+ }
42
+
43
+ export abstract class ValueNode<
44
+ V extends ValueType,
45
+ Definition extends ValueNodeDefinition<V>,
46
+ RuntimeValue extends RuntimeInputValue,
47
+ RuntimeInputValue = RuntimeValue,
48
+ >
49
+ extends DescendantNode<Definition, ValueNodeStateSpec<RuntimeValue>, GeneralParentNode, null>
50
+ implements
51
+ BaseValueNode<V, RuntimeValue>,
52
+ XFormsXPathElement,
53
+ EvaluationContext,
54
+ InstanceValueContext,
55
+ ValidationContext,
56
+ ClientReactiveSubmittableValueNode
57
+ {
58
+ protected readonly validation: SharedValidationState;
59
+ protected readonly getInstanceValue: Accessor<string>;
60
+ protected readonly valueState: RuntimeValueState<RuntimeValue>;
61
+ protected readonly setValueState: RuntimeValueSetter<RuntimeInputValue>;
62
+
63
+ // XFormsXPathElement
64
+ override readonly [XPathNodeKindKey] = 'element';
65
+ override readonly getXPathValue: () => string;
66
+
67
+ // InstanceNode
68
+ protected abstract override readonly state: SharedNodeState<ValueNodeStateSpec<RuntimeValue>>;
69
+ protected abstract override readonly engineState: EngineState<ValueNodeStateSpec<RuntimeValue>>;
70
+
71
+ // InstanceValueContext
72
+ readonly decodeInstanceValue: DecodeInstanceValue;
73
+
74
+ // BaseValueNode
75
+ abstract override readonly nodeType: ValueNodeType;
76
+ readonly valueType: V;
77
+
78
+ abstract override readonly currentState: CurrentState<ValueNodeStateSpec<RuntimeValue>>;
79
+
80
+ get validationState(): LeafNodeValidationState {
81
+ return this.validation.currentState;
82
+ }
83
+
84
+ readonly submissionState: SubmissionState;
85
+
86
+ constructor(
87
+ parent: GeneralParentNode,
88
+ definition: Definition,
89
+ codec: ValueCodec<V, RuntimeValue, RuntimeInputValue>
90
+ ) {
91
+ super(parent, definition);
92
+
93
+ this.valueType = definition.valueType;
94
+ this.decodeInstanceValue = codec.decodeInstanceValue;
95
+
96
+ const instanceValueState = createInstanceValueState(this, {
97
+ initialValueSource: 'FORM_DEFAULT',
98
+ });
99
+ const valueState = codec.createRuntimeValueState(instanceValueState);
100
+
101
+ const [getInstanceValue] = instanceValueState;
102
+ const [, setValueState] = valueState;
103
+
104
+ this.getInstanceValue = getInstanceValue;
105
+ this.setValueState = setValueState;
106
+ this.getXPathValue = getInstanceValue;
107
+ this.valueState = valueState;
108
+ this.validation = createValidationState(this, {
109
+ clientStateFactory: this.engineConfig.stateFactory,
110
+ });
111
+ this.submissionState = createValueNodeSubmissionState(this);
112
+ }
113
+
114
+ // ValidationContext
115
+ getViolation(): AnyViolation | null {
116
+ return this.validation.engineState.violation;
117
+ }
118
+
119
+ isBlank(): boolean {
120
+ return this.getInstanceValue() === '';
121
+ }
122
+
123
+ // InstanceNode
124
+ getChildren(): readonly [] {
125
+ return [];
126
+ }
127
+ }
@@ -1,5 +1,7 @@
1
1
  import { UnreachableError } from '@getodk/common/lib/error/UnreachableError.ts';
2
2
  import type { GroupDefinition } from '../client/GroupNode.ts';
3
+ import type { InputDefinition } from '../client/InputNode.ts';
4
+ import type { ModelValueDefinition } from '../client/ModelValueNode.ts';
3
5
  import type { SubtreeDefinition } from '../client/SubtreeNode.ts';
4
6
  import type { TriggerNodeDefinition } from '../client/TriggerNode.ts';
5
7
  import type { RangeNodeDefinition } from '../client/unsupported/RangeNode.ts';
@@ -11,14 +13,13 @@ import { NoteNodeDefinition } from '../parse/model/NoteNodeDefinition.ts';
11
13
  import type { SubtreeDefinition as ModelSubtreeDefinition } from '../parse/model/SubtreeDefinition.ts';
12
14
  import { Group } from './Group.ts';
13
15
  import type { GeneralChildNode, GeneralParentNode } from './hierarchy.ts';
14
- import { ModelValue, type ModelValueDefinition } from './ModelValue.ts';
16
+ import { InputControl } from './InputControl.ts';
17
+ import { ModelValue } from './ModelValue.ts';
15
18
  import { Note } from './Note.ts';
16
19
  import { RepeatRangeControlled } from './repeat/RepeatRangeControlled.ts';
17
20
  import { RepeatRangeUncontrolled } from './repeat/RepeatRangeUncontrolled.ts';
18
21
  import type { SelectFieldDefinition } from './SelectField.ts';
19
22
  import { SelectField } from './SelectField.ts';
20
- import type { StringFieldDefinition } from './StringField.ts';
21
- import { StringField } from './StringField.ts';
22
23
  import { Subtree } from './Subtree.ts';
23
24
  import { TriggerControl } from './TriggerControl.ts';
24
25
  import { RangeControl } from './unsupported/RangeControl.ts';
@@ -39,8 +40,8 @@ type AnyUnsupportedControlDefinition =
39
40
  // prettier-ignore
40
41
  type ControlNodeDefinition =
41
42
  // eslint-disable-next-line @typescript-eslint/sort-type-constituents
43
+ | InputDefinition
42
44
  | SelectFieldDefinition
43
- | StringFieldDefinition
44
45
  | TriggerNodeDefinition
45
46
  | AnyUnsupportedControlDefinition;
46
47
 
@@ -52,9 +53,7 @@ const isModelValueDefinition = (
52
53
  return definition.bodyElement == null;
53
54
  };
54
55
 
55
- const isStringFieldDefinition = (
56
- definition: ControlNodeDefinition
57
- ): definition is StringFieldDefinition => {
56
+ const isInputDefinition = (definition: ControlNodeDefinition): definition is InputDefinition => {
58
57
  return definition.bodyElement.type === 'input';
59
58
  };
60
59
 
@@ -121,11 +120,11 @@ export const buildChildren = (parent: GeneralParentNode): GeneralChildNode[] =>
121
120
  const leafChild: AnyLeafNodeDefinition = child;
122
121
 
123
122
  if (isModelValueDefinition(leafChild)) {
124
- return new ModelValue(parent, leafChild);
123
+ return ModelValue.from(parent, leafChild);
125
124
  }
126
125
 
127
- if (isStringFieldDefinition(leafChild)) {
128
- return new StringField(parent, leafChild);
126
+ if (isInputDefinition(leafChild)) {
127
+ return InputControl.from(parent, leafChild);
129
128
  }
130
129
 
131
130
  if (isSelectFieldDefinition(leafChild)) {
@@ -1,12 +1,13 @@
1
1
  import type { Group } from './Group.ts';
2
- import type { ModelValue } from './ModelValue.ts';
2
+ import type { AnyInputControl } from './InputControl.ts';
3
+ import type { AnyModelValue } from './ModelValue.ts';
3
4
  import type { Note } from './Note.ts';
5
+ import type { PrimaryInstance } from './PrimaryInstance.ts';
4
6
  import type { RepeatInstance } from './repeat/RepeatInstance.ts';
5
7
  import type { RepeatRangeControlled } from './repeat/RepeatRangeControlled.ts';
6
8
  import type { RepeatRangeUncontrolled } from './repeat/RepeatRangeUncontrolled.ts';
7
9
  import type { Root } from './Root.ts';
8
10
  import type { SelectField } from './SelectField.ts';
9
- import type { StringField } from './StringField.ts';
10
11
  import type { Subtree } from './Subtree.ts';
11
12
  import type { TriggerControl } from './TriggerControl.ts';
12
13
  import type { RangeControl } from './unsupported/RangeControl.ts';
@@ -16,7 +17,7 @@ import type { UploadControl } from './unsupported/UploadControl.ts';
16
17
  export type RepeatRange = RepeatRangeControlled | RepeatRangeUncontrolled;
17
18
 
18
19
  // prettier-ignore
19
- export type UnsupportedControl =
20
+ export type AnyUnsupportedControl =
20
21
  | RangeControl
21
22
  | RankControl
22
23
  | UploadControl;
@@ -24,21 +25,23 @@ export type UnsupportedControl =
24
25
  // prettier-ignore
25
26
  export type AnyNode =
26
27
  // eslint-disable-next-line @typescript-eslint/sort-type-constituents
28
+ | PrimaryInstance
27
29
  | Root
28
30
  | Group
29
31
  | Subtree
30
32
  | RepeatRange
31
33
  | RepeatInstance
32
34
  | Note
33
- | ModelValue
34
- | StringField
35
+ | AnyModelValue
36
+ | AnyInputControl
35
37
  | SelectField
36
38
  | TriggerControl
37
- | UnsupportedControl;
39
+ | AnyUnsupportedControl;
38
40
 
39
41
  // prettier-ignore
40
42
  export type AnyParentNode =
41
43
  // eslint-disable-next-line @typescript-eslint/sort-type-constituents
44
+ | PrimaryInstance
42
45
  | Root
43
46
  | Group
44
47
  | Subtree
@@ -56,16 +59,17 @@ export type GeneralParentNode =
56
59
  // prettier-ignore
57
60
  export type AnyChildNode =
58
61
  // eslint-disable-next-line @typescript-eslint/sort-type-constituents
62
+ | Root
59
63
  | Group
60
64
  | Subtree
61
65
  | RepeatRange
62
66
  | RepeatInstance
63
- | ModelValue
67
+ | AnyModelValue
64
68
  | Note
65
- | StringField
69
+ | AnyInputControl
66
70
  | SelectField
67
71
  | TriggerControl
68
- | UnsupportedControl;
72
+ | AnyUnsupportedControl;
69
73
 
70
74
  // prettier-ignore
71
75
  export type GeneralChildNode =
@@ -73,19 +77,19 @@ export type GeneralChildNode =
73
77
  | Group
74
78
  | Subtree
75
79
  | RepeatRange
76
- | ModelValue
80
+ | AnyModelValue
77
81
  | Note
78
- | StringField
82
+ | AnyInputControl
79
83
  | SelectField
80
84
  | TriggerControl
81
- | UnsupportedControl;
85
+ | AnyUnsupportedControl;
82
86
 
83
87
  // prettier-ignore
84
88
  export type AnyValueNode =
85
89
  // eslint-disable-next-line @typescript-eslint/sort-type-constituents
86
- | ModelValue
90
+ | AnyModelValue
87
91
  | Note
88
- | StringField
92
+ | AnyInputControl
89
93
  | SelectField
90
94
  | TriggerControl
91
- | UnsupportedControl;
95
+ | AnyUnsupportedControl;
@@ -1,11 +1,5 @@
1
- declare const NODE_ID_BRAND: unique symbol;
2
- type NODE_ID_BRAND = typeof NODE_ID_BRAND;
1
+ import type { FormNodeID } from '../client/identity.ts';
3
2
 
4
- export type NodeID = string & { readonly [NODE_ID_BRAND]: true };
5
-
6
- // Just another added safeguard to ensure we're not mistakenly handling
7
- // rando `NodeID` strings which aren't explicitly attached to the node
8
- // types we expect.
9
- export const declareNodeID = (id: string): NodeID => {
10
- return id as NodeID;
3
+ export const nodeID = (id: string): FormNodeID => {
4
+ return `node:${id}` satisfies FormNodeID;
11
5
  };
@@ -1,24 +1,32 @@
1
1
  import { identity } from '@getodk/common/lib/identity.ts';
2
+ import { getOwner } from 'solid-js';
3
+ import type { EngineConfig } from '../client/EngineConfig.ts';
2
4
  import type { RootNode } from '../client/RootNode.ts';
5
+ import { MISSING_RESOURCE_BEHAVIOR } from '../client/constants.ts';
3
6
  import type {
4
7
  InitializeFormOptions as BaseInitializeFormOptions,
5
8
  FormResource,
6
9
  InitializeForm,
7
10
  } from '../client/index.ts';
8
11
  import { retrieveSourceXMLResource } from '../instance/resource.ts';
12
+ import { createReactiveScope } from '../lib/reactivity/scope.ts';
9
13
  import { createUniqueId } from '../lib/unique-id.ts';
14
+ import { XFormDOM } from '../parse/XFormDOM.ts';
10
15
  import { XFormDefinition } from '../parse/XFormDefinition.ts';
11
- import { Root } from './Root.ts';
16
+ import { SecondaryInstancesDefinition } from '../parse/model/SecondaryInstance/SecondaryInstancesDefinition.ts';
17
+ import { PrimaryInstance } from './PrimaryInstance.ts';
12
18
  import type { InstanceConfig } from './internal-api/InstanceConfig.ts';
13
19
 
14
20
  interface InitializeFormOptions extends BaseInitializeFormOptions {
15
21
  readonly config: Partial<InstanceConfig>;
16
22
  }
17
23
 
18
- const buildInstanceConfig = (options: Partial<InstanceConfig> = {}): InstanceConfig => {
24
+ const buildInstanceConfig = (options: EngineConfig = {}): InstanceConfig => {
19
25
  return {
20
- createUniqueId: options.createUniqueId ?? createUniqueId,
21
- fetchResource: options.fetchResource ?? fetch,
26
+ createUniqueId,
27
+ fetchFormDefinition: options.fetchFormDefinition ?? fetch,
28
+ fetchFormAttachment: options.fetchFormAttachment ?? fetch,
29
+ missingResourceBehavior: options.missingResourceBehavior ?? MISSING_RESOURCE_BEHAVIOR.DEFAULT,
22
30
  stateFactory: options.stateFactory ?? identity,
23
31
  };
24
32
  };
@@ -27,11 +35,21 @@ export const initializeForm = async (
27
35
  input: FormResource,
28
36
  options: Partial<InitializeFormOptions> = {}
29
37
  ): Promise<RootNode> => {
38
+ const owner = getOwner();
39
+ const scope = createReactiveScope({ owner });
30
40
  const engineConfig = buildInstanceConfig(options.config);
31
- const sourceXML = await retrieveSourceXMLResource(input, engineConfig);
32
- const form = new XFormDefinition(sourceXML);
41
+ const sourceXML = await retrieveSourceXMLResource(input, {
42
+ fetchResource: engineConfig.fetchFormDefinition,
43
+ });
44
+ const xformDOM = XFormDOM.from(sourceXML);
45
+ const secondaryInstances = await SecondaryInstancesDefinition.load(xformDOM, {
46
+ fetchResource: engineConfig.fetchFormAttachment,
47
+ missingResourceBehavior: engineConfig.missingResourceBehavior,
48
+ });
49
+ const form = new XFormDefinition(xformDOM);
50
+ const primaryInstance = new PrimaryInstance(scope, form.model, secondaryInstances, engineConfig);
33
51
 
34
- return new Root(form.xformDOM, form.model.root, engineConfig);
52
+ return primaryInstance.root;
35
53
  };
36
54
 
37
55
  initializeForm satisfies InitializeForm;
@@ -1,12 +1,16 @@
1
- import type { XFormsXPathEvaluator } from '@getodk/xpath';
2
1
  import type { Accessor } from 'solid-js';
2
+ import type { engineDOMAdapter } from '../../integration/xpath/adapter/engineDOMAdapter.ts';
3
+ import type { EngineXPathNode } from '../../integration/xpath/adapter/kind.ts';
4
+ import type { EngineXPathEvaluator } from '../../integration/xpath/EngineXPathEvaluator.ts';
5
+ import type { StaticNode } from '../../integration/xpath/static-dom/StaticNode.ts';
6
+ import type { createComputedExpression } from '../../lib/reactivity/createComputedExpression.ts';
7
+ import type { createTranslationState } from '../../lib/reactivity/createTranslationState.ts';
3
8
  import type { ReactiveScope } from '../../lib/reactivity/scope.ts';
4
9
  import type { DependentExpression } from '../../parse/expression/abstract/DependentExpression.ts';
5
- import type { SubscribableDependency } from './SubscribableDependency.ts';
10
+ import type { InstanceNode } from '../abstract/InstanceNode.ts';
11
+ import type { PrimaryInstance } from '../PrimaryInstance.ts';
6
12
  import type { TranslationContext } from './TranslationContext.ts';
7
13
 
8
- export interface EvaluationContextRoot extends SubscribableDependency, TranslationContext {}
9
-
10
14
  /**
11
15
  * Provides a common interface to establish context for XPath-based
12
16
  * computations, i.e. to evaluate {@link DependentExpression}s where:
@@ -18,23 +22,66 @@ export interface EvaluationContextRoot extends SubscribableDependency, Translati
18
22
  * - the expression may be dependent on the form's currently active language
19
23
  * (e.g. `jr:itext`)
20
24
  * - any dynamic case is expected to be internally reactive
25
+ *
26
+ * Historical note: we previously utilized static analysis and a related
27
+ * abstraction to set up reactive subscriptions to node references, values, and
28
+ * other pertinent state changes warranting an expression's recomputation. Those
29
+ * are still described above because they provide useful insight for the
30
+ * **effect** of evaluating a given {@link DependentExpression}, with a given
31
+ * {@link EvaluationContext}.
32
+ *
33
+ * The reactive subscription mechanism has since been largely replaced, with the
34
+ * engine's implementation of {@link EngineXPathEvaluator} and its corresponding
35
+ * {@link engineDOMAdapter | XPath DOM adapter implementation}.
36
+ *
37
+ * @todo There is still one notable exception: translation expressions (i.e.
38
+ * expressions calling {@link https://getodk.github.io/xforms-spec/#fn:jr:itext}
39
+ * | `jr:itext`). We still perform analysis to identify such calls, and when
40
+ * evaluating those expressions we still explicitly subscribe to the form's
41
+ * active language state. A further refactor, moving more of the responsibility
42
+ * for translation state up out of `@getodk/xpath` into the engine, would likely
43
+ * allow us to further simplify the engine's reactive XPath recomputation
44
+ * approach.
45
+ *
46
+ * @see {@link createTranslationState} for additional context.
21
47
  */
22
- export interface EvaluationContext {
48
+ export interface EvaluationContext extends TranslationContext {
49
+ /**
50
+ * Used to determine whether {@link contextNode} is attached to its
51
+ * {@link EngineXPathNode} document hierarchy.
52
+ *
53
+ * - If this function returns `true`: expressions are evaluated as defined.
54
+ * - If this function returns `false`: expressions are evaluated to either an
55
+ * explicit default value (if provided) or an implicit default value
56
+ * appropriate for the requested result type.
57
+ *
58
+ * @see {@link createComputedExpression} for further detail on the latter.
59
+ */
60
+ readonly isAttached: Accessor<boolean>;
61
+
23
62
  readonly scope: ReactiveScope;
24
- readonly evaluator: XFormsXPathEvaluator;
25
- readonly root: EvaluationContextRoot;
63
+ readonly evaluator: EngineXPathEvaluator;
26
64
 
27
65
  /**
28
66
  * Produces the current absolute reference to the {@link contextNode}, where
29
- * the absolute `/` resolves to the active form state's primary instance root.
67
+ * the AbsoluteLocationPath expression `/` resolves to the active
68
+ * {@link PrimaryInstance}, and each Step and/or position Predicate from there
69
+ * corresponds to the node hierarchy descending from there.
30
70
  */
31
71
  readonly contextReference: Accessor<string>;
32
72
 
33
- readonly contextNode: Node;
34
-
35
73
  /**
36
- * Resolves nodes corresponding to the provided node-set reference, possibly
37
- * relative to the {@link EvaluationContext.contextNode}.
74
+ * Note: in most cases, implementations of {@link EvaluationContext} will
75
+ * **also** be an implementation of {@link EngineXPathNode} (as concrete
76
+ * implementations of {@link InstanceNode}). This property is an intentional
77
+ * indirection which:
78
+ *
79
+ * - Expresses only the much more limited set of properties which must be
80
+ * present to initialize computations during those nodes' construction.
81
+ *
82
+ * - Allows for a handful of cases where an {@link InstanceNode} provides the
83
+ * requisite facilities for evaluating expressions in a {@link StaticNode}'s
84
+ * context (itemsets being a prominent example).
38
85
  */
39
- getSubscribableDependenciesByReference(reference: string): readonly SubscribableDependency[];
86
+ readonly contextNode: EngineXPathNode;
40
87
  }
@@ -1,7 +1,14 @@
1
- import type { EngineConfig } from '../../client/EngineConfig.ts';
1
+ import type { MissingResourceBehavior } from '../../client/constants.ts';
2
+ import type { OpaqueReactiveObjectFactory } from '../../client/OpaqueReactiveObjectFactory.ts';
3
+ import type { FetchFormAttachment, FetchResource } from '../../client/resources.ts';
2
4
  import type { CreateUniqueId } from '../../lib/unique-id.ts';
3
5
 
4
- export interface InstanceConfig extends Required<EngineConfig> {
6
+ export interface InstanceConfig {
7
+ readonly stateFactory: OpaqueReactiveObjectFactory;
8
+ readonly fetchFormDefinition: FetchResource;
9
+ readonly fetchFormAttachment: FetchFormAttachment;
10
+ readonly missingResourceBehavior: MissingResourceBehavior;
11
+
5
12
  /**
6
13
  * Uniqueness per form instance session (so e.g. persistence isn't necessary).
7
14
  */
@@ -0,0 +1,24 @@
1
+ import type { ReactiveScope } from '../../lib/reactivity/scope.ts';
2
+ import type { BindComputationExpression } from '../../parse/expression/BindComputationExpression.ts';
3
+ import type { EvaluationContext } from './EvaluationContext.ts';
4
+
5
+ export type DecodeInstanceValue = (value: string) => string;
6
+
7
+ interface InstanceValueContextDefinitionBind {
8
+ readonly calculate: BindComputationExpression<'calculate'> | null;
9
+ readonly readonly: BindComputationExpression<'readonly'>;
10
+ }
11
+
12
+ export interface InstanceValueContextDefinition {
13
+ readonly bind: InstanceValueContextDefinitionBind;
14
+ readonly defaultValue: string;
15
+ }
16
+
17
+ export interface InstanceValueContext extends EvaluationContext {
18
+ readonly scope: ReactiveScope;
19
+ readonly definition: InstanceValueContextDefinition;
20
+ readonly decodeInstanceValue: DecodeInstanceValue;
21
+
22
+ isReadonly(): boolean;
23
+ isRelevant(): boolean;
24
+ }
@@ -0,0 +1,53 @@
1
+ import type { FormLanguage } from '../../client/FormLanguage.ts';
2
+ import type { RootNode, RootNodeState } from '../../client/RootNode.ts';
3
+
4
+ export interface PrimaryInstanceDocumentState
5
+ extends Omit<
6
+ RootNodeState,
7
+ // Allow for override with `RootNode`, which is not presently considered a
8
+ // child node in the client API
9
+ 'children'
10
+ > {
11
+ /**
12
+ * @todo while this is an internal interface, this feels like maybe an
13
+ * unnecessary indirection? It would probably be fine for it to reference
14
+ * `Root` directly? We do get some minor benefit from making sure the client
15
+ * and internal types are aligned, but we also already enforce that by
16
+ * ensuring `Root implements RootNode`...
17
+ */
18
+ get children(): readonly RootNode[];
19
+ }
20
+
21
+ /**
22
+ * Provides an interface most similar to what we would expose at the
23
+ * `@getodk/xforms-engine` package boundary, if we were to document the primary
24
+ * instance document's types for a client.
25
+ *
26
+ * Note: this interface (as well as {@link currentState}'s {@link PrimaryInstanceDocumentState}) is derived from {@link RootNode} to help avoid drift if that underlying interface (or its shared {@link BaseNode} interface) is updated.
27
+ *
28
+ */
29
+ export interface PrimaryInstanceDocument
30
+ extends Omit<
31
+ RootNode,
32
+ // prettier-ignore
33
+ // eslint-disable-next-line @typescript-eslint/sort-type-constituents
34
+ | 'nodeType' // Allow for override with 'primary-instance'
35
+ | 'currentState' // Allow for override of `children`
36
+ | 'setLanguage' // Allow for override of return type
37
+ > {
38
+ readonly nodeType: 'primary-instance';
39
+ readonly currentState: PrimaryInstanceDocumentState;
40
+
41
+ /**
42
+ * @todo This intentionally returns `unknown` as a hint that we will likely
43
+ * want to move away from returning {@link RootNode} (i.e. "all of the state",
44
+ * as it was conceived in that design effort) on every state change.
45
+ *
46
+ * In this case, it may be sensible to return any of:
47
+ *
48
+ * - Just the state set directly (i.e. the input {@link FormLanguage})
49
+ * - That effective state, and some representation of all affected nodes
50
+ * - Something less obvious, but potentially more useful to clients?
51
+ */
52
+ setLanguage(language: FormLanguage): unknown;
53
+ }
@@ -1,5 +1,6 @@
1
- import type { ActiveLanguage } from '../../index.ts';
1
+ import type { Accessor } from 'solid-js';
2
+ import type { ActiveLanguage } from '../../client/FormLanguage.ts';
2
3
 
3
4
  export interface TranslationContext {
4
- get activeLanguage(): ActiveLanguage;
5
+ readonly getActiveLanguage: Accessor<ActiveLanguage>;
5
6
  }
@@ -1,9 +1,8 @@
1
+ import type { FormNodeID } from '../../client/identity.ts';
1
2
  import type { AnyViolation } from '../../client/validation.ts';
2
3
  import type { BindComputationExpression } from '../../parse/expression/BindComputationExpression.ts';
3
4
  import type { MessageDefinition } from '../../parse/text/MessageDefinition.ts';
4
- import type { NodeID } from '../identity.ts';
5
5
  import type { EvaluationContext } from './EvaluationContext.ts';
6
- import type { SubscribableDependency } from './SubscribableDependency.ts';
7
6
 
8
7
  interface ValidationContextCurrentState {
9
8
  get reference(): string;
@@ -20,8 +19,8 @@ interface ValidationContextDefinition {
20
19
  readonly bind: ValidationContextDefinitionBind;
21
20
  }
22
21
 
23
- export interface ValidationContext extends EvaluationContext, SubscribableDependency {
24
- readonly nodeId: NodeID;
22
+ export interface ValidationContext extends EvaluationContext {
23
+ readonly nodeId: FormNodeID;
25
24
  readonly definition: ValidationContextDefinition;
26
25
  readonly currentState: ValidationContextCurrentState;
27
26
 
@@ -1,3 +1,4 @@
1
+ import type { EngineXPathNode } from '../../integration/xpath/adapter/kind.ts';
1
2
  import type { ReactiveScope } from '../../lib/reactivity/scope.ts';
2
3
  import type { BindComputationExpression } from '../../parse/expression/BindComputationExpression.ts';
3
4
  import type { EvaluationContext } from './EvaluationContext.ts';
@@ -17,7 +18,7 @@ export interface ValueContextDefinition {
17
18
  export interface ValueContext<RuntimeValue> extends EvaluationContext {
18
19
  readonly scope: ReactiveScope;
19
20
  readonly definition: ValueContextDefinition;
20
- readonly contextNode: Element;
21
+ readonly contextNode: EngineXPathNode & this;
21
22
 
22
23
  isReadonly(): boolean;
23
24
  isRelevant(): boolean;
@@ -0,0 +1,20 @@
1
+ import type { SubmissionDefinition } from '../../../client/submission/SubmissionDefinition.ts';
2
+ import type { AncestorNodeValidationState } from '../../../client/validation.ts';
3
+ import type { Root } from '../../Root.ts';
4
+ import type {
5
+ ClientReactiveSubmittableParentNode,
6
+ ClientReactiveSubmittableParentNodeDefinition,
7
+ } from './ClientReactiveSubmittableParentNode.ts';
8
+
9
+ interface ClientReactiveSubmittableInstanceDefinition
10
+ extends ClientReactiveSubmittableParentNodeDefinition {
11
+ readonly submission: SubmissionDefinition;
12
+ }
13
+
14
+ export interface ClientReactiveSubmittableInstance
15
+ extends ClientReactiveSubmittableParentNode<Root> {
16
+ readonly definition: ClientReactiveSubmittableInstanceDefinition;
17
+ readonly root: Root;
18
+ readonly parent: null;
19
+ readonly validationState: AncestorNodeValidationState;
20
+ }