@getodk/xforms-engine 0.1.1 → 0.3.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 (228) hide show
  1. package/dist/body/BodyDefinition.d.ts +24 -7
  2. package/dist/body/BodyElementDefinition.d.ts +4 -3
  3. package/dist/body/RepeatElementDefinition.d.ts +19 -0
  4. package/dist/body/appearance/inputAppearanceParser.d.ts +4 -0
  5. package/dist/body/appearance/selectAppearanceParser.d.ts +4 -0
  6. package/dist/body/appearance/structureElementAppearanceParser.d.ts +4 -0
  7. package/dist/body/control/ControlDefinition.d.ts +4 -2
  8. package/dist/body/control/InputDefinition.d.ts +5 -0
  9. package/dist/body/control/select/ItemDefinition.d.ts +2 -2
  10. package/dist/body/control/select/ItemsetDefinition.d.ts +5 -4
  11. package/dist/body/control/select/SelectDefinition.d.ts +11 -1
  12. package/dist/body/group/BaseGroupDefinition.d.ts +4 -9
  13. package/dist/body/group/PresentationGroupDefinition.d.ts +1 -1
  14. package/dist/client/BaseNode.d.ts +74 -3
  15. package/dist/client/GroupNode.d.ts +7 -2
  16. package/dist/client/ModelValueNode.d.ts +37 -0
  17. package/dist/client/NodeAppearances.d.ts +15 -0
  18. package/dist/client/NoteNode.d.ts +53 -0
  19. package/dist/client/RootNode.d.ts +21 -0
  20. package/dist/client/SelectNode.d.ts +8 -3
  21. package/dist/client/StringNode.d.ts +8 -3
  22. package/dist/client/SubtreeNode.d.ts +3 -0
  23. package/dist/client/TextRange.d.ts +85 -2
  24. package/dist/client/constants.d.ts +9 -0
  25. package/dist/client/hierarchy.d.ts +14 -9
  26. package/dist/client/node-types.d.ts +2 -1
  27. package/dist/client/{RepeatRangeNode.d.ts → repeat/BaseRepeatRangeNode.d.ts} +19 -15
  28. package/dist/client/{RepeatInstanceNode.d.ts → repeat/RepeatInstanceNode.d.ts} +11 -7
  29. package/dist/client/repeat/RepeatRangeControlledNode.d.ts +19 -0
  30. package/dist/client/repeat/RepeatRangeUncontrolledNode.d.ts +20 -0
  31. package/dist/client/validation.d.ts +163 -0
  32. package/dist/expression/DependentExpression.d.ts +12 -8
  33. package/dist/index.d.ts +9 -4
  34. package/dist/index.js +3173 -960
  35. package/dist/index.js.map +1 -1
  36. package/dist/instance/Group.d.ts +6 -4
  37. package/dist/instance/ModelValue.d.ts +40 -0
  38. package/dist/instance/Note.d.ts +42 -0
  39. package/dist/instance/Root.d.ts +10 -23
  40. package/dist/instance/SelectField.d.ts +12 -6
  41. package/dist/instance/StringField.d.ts +13 -7
  42. package/dist/instance/Subtree.d.ts +3 -1
  43. package/dist/instance/abstract/DescendantNode.d.ts +16 -9
  44. package/dist/instance/abstract/InstanceNode.d.ts +28 -29
  45. package/dist/instance/hierarchy.d.ts +10 -5
  46. package/dist/instance/internal-api/EvaluationContext.d.ts +5 -4
  47. package/dist/instance/internal-api/ValidationContext.d.ts +21 -0
  48. package/dist/instance/internal-api/ValueContext.d.ts +2 -2
  49. package/dist/instance/repeat/BaseRepeatRange.d.ts +160 -0
  50. package/dist/instance/{RepeatInstance.d.ts → repeat/RepeatInstance.d.ts} +38 -13
  51. package/dist/instance/repeat/RepeatRangeControlled.d.ts +16 -0
  52. package/dist/instance/repeat/RepeatRangeUncontrolled.d.ts +35 -0
  53. package/dist/instance/text/TextRange.d.ts +4 -4
  54. package/dist/lib/TokenListParser.d.ts +84 -0
  55. package/dist/lib/dom/query.d.ts +5 -0
  56. package/dist/lib/reactivity/createComputedExpression.d.ts +6 -1
  57. package/dist/lib/reactivity/createNoteReadonlyThunk.d.ts +5 -0
  58. package/dist/lib/reactivity/materializeCurrentStateChildren.d.ts +2 -1
  59. package/dist/lib/reactivity/node-state/createSharedNodeState.d.ts +1 -1
  60. package/dist/lib/reactivity/node-state/createSpecifiedState.d.ts +1 -1
  61. package/dist/lib/reactivity/text/createFieldHint.d.ts +3 -3
  62. package/dist/lib/reactivity/text/createNodeLabel.d.ts +2 -2
  63. package/dist/lib/reactivity/text/createNoteText.d.ts +25 -0
  64. package/dist/lib/reactivity/text/createTextRange.d.ts +5 -7
  65. package/dist/lib/reactivity/validation/createAggregatedViolations.d.ts +9 -0
  66. package/dist/lib/reactivity/validation/createValidation.d.ts +18 -0
  67. package/dist/model/BindDefinition.d.ts +4 -2
  68. package/dist/model/BindElement.d.ts +1 -0
  69. package/dist/model/DescendentNodeDefinition.d.ts +1 -2
  70. package/dist/model/{ValueNodeDefinition.d.ts → LeafNodeDefinition.d.ts} +3 -4
  71. package/dist/model/NodeDefinition.d.ts +16 -16
  72. package/dist/model/RepeatInstanceDefinition.d.ts +5 -6
  73. package/dist/model/RepeatRangeDefinition.d.ts +30 -0
  74. package/dist/model/RepeatTemplateDefinition.d.ts +6 -7
  75. package/dist/model/RootDefinition.d.ts +3 -1
  76. package/dist/model/SubtreeDefinition.d.ts +2 -2
  77. package/dist/parse/NoteNodeDefinition.d.ts +31 -0
  78. package/dist/parse/expression/RepeatCountControlExpression.d.ts +19 -0
  79. package/dist/parse/text/HintDefinition.d.ts +9 -0
  80. package/dist/parse/text/ItemLabelDefinition.d.ts +9 -0
  81. package/dist/parse/text/ItemsetLabelDefinition.d.ts +13 -0
  82. package/dist/parse/text/LabelDefinition.d.ts +15 -0
  83. package/dist/parse/text/MessageDefinition.d.ts +15 -0
  84. package/dist/parse/text/OutputChunkDefinition.d.ts +8 -0
  85. package/dist/parse/text/ReferenceChunkDefinition.d.ts +8 -0
  86. package/dist/parse/text/StaticTextChunkDefinition.d.ts +10 -0
  87. package/dist/parse/text/TranslationChunkDefinition.d.ts +9 -0
  88. package/dist/parse/text/abstract/TextChunkDefinition.d.ts +18 -0
  89. package/dist/parse/text/abstract/TextElementDefinition.d.ts +23 -0
  90. package/dist/parse/text/abstract/TextRangeDefinition.d.ts +35 -0
  91. package/dist/parse/xpath/dependency-analysis.d.ts +40 -0
  92. package/dist/parse/xpath/path-resolution.d.ts +70 -0
  93. package/dist/parse/xpath/predicate-analysis.d.ts +30 -0
  94. package/dist/parse/xpath/reference-parsing.d.ts +18 -0
  95. package/dist/parse/xpath/semantic-analysis.d.ts +98 -0
  96. package/dist/parse/xpath/syntax-traversal.d.ts +69 -0
  97. package/dist/solid.js +3174 -961
  98. package/dist/solid.js.map +1 -1
  99. package/package.json +14 -15
  100. package/src/XFormDOM.ts +81 -8
  101. package/src/body/BodyDefinition.ts +38 -23
  102. package/src/body/BodyElementDefinition.ts +4 -3
  103. package/src/body/RepeatElementDefinition.ts +58 -0
  104. package/src/body/appearance/inputAppearanceParser.ts +39 -0
  105. package/src/body/appearance/selectAppearanceParser.ts +38 -0
  106. package/src/body/appearance/structureElementAppearanceParser.ts +7 -0
  107. package/src/body/control/ControlDefinition.ts +8 -3
  108. package/src/body/control/InputDefinition.ts +13 -0
  109. package/src/body/control/select/ItemDefinition.ts +3 -3
  110. package/src/body/control/select/ItemsetDefinition.ts +29 -12
  111. package/src/body/control/select/ItemsetNodesetExpression.ts +1 -1
  112. package/src/body/control/select/SelectDefinition.ts +14 -5
  113. package/src/body/group/BaseGroupDefinition.ts +14 -51
  114. package/src/body/group/PresentationGroupDefinition.ts +1 -1
  115. package/src/client/BaseNode.ts +82 -8
  116. package/src/client/GroupNode.ts +8 -2
  117. package/src/client/ModelValueNode.ts +40 -0
  118. package/src/client/NodeAppearances.ts +22 -0
  119. package/src/client/NoteNode.ts +74 -0
  120. package/src/client/README.md +1 -0
  121. package/src/client/RootNode.ts +24 -0
  122. package/src/client/SelectNode.ts +9 -3
  123. package/src/client/StringNode.ts +9 -3
  124. package/src/client/SubtreeNode.ts +3 -0
  125. package/src/client/TextRange.ts +99 -2
  126. package/src/client/constants.ts +10 -0
  127. package/src/client/hierarchy.ts +30 -14
  128. package/src/client/node-types.ts +8 -1
  129. package/src/client/{RepeatRangeNode.ts → repeat/BaseRepeatRangeNode.ts} +20 -17
  130. package/src/client/{RepeatInstanceNode.ts → repeat/RepeatInstanceNode.ts} +13 -7
  131. package/src/client/repeat/RepeatRangeControlledNode.ts +20 -0
  132. package/src/client/repeat/RepeatRangeUncontrolledNode.ts +21 -0
  133. package/src/client/validation.ts +199 -0
  134. package/src/expression/DependentExpression.ts +45 -27
  135. package/src/index.ts +15 -8
  136. package/src/instance/Group.ts +24 -13
  137. package/src/instance/ModelValue.ts +104 -0
  138. package/src/instance/Note.ts +142 -0
  139. package/src/instance/Root.ts +29 -67
  140. package/src/instance/SelectField.ts +35 -13
  141. package/src/instance/StringField.ts +40 -13
  142. package/src/instance/Subtree.ts +19 -10
  143. package/src/instance/abstract/DescendantNode.ts +50 -49
  144. package/src/instance/abstract/InstanceNode.ts +89 -92
  145. package/src/instance/children.ts +47 -10
  146. package/src/instance/hierarchy.ts +21 -2
  147. package/src/instance/index.ts +1 -1
  148. package/src/instance/internal-api/EvaluationContext.ts +5 -6
  149. package/src/instance/internal-api/ValidationContext.ts +23 -0
  150. package/src/instance/internal-api/ValueContext.ts +2 -2
  151. package/src/instance/repeat/BaseRepeatRange.ts +347 -0
  152. package/src/instance/{RepeatInstance.ts → repeat/RepeatInstance.ts} +85 -36
  153. package/src/instance/repeat/RepeatRangeControlled.ts +82 -0
  154. package/src/instance/repeat/RepeatRangeUncontrolled.ts +67 -0
  155. package/src/instance/text/TextRange.ts +10 -4
  156. package/src/lib/TokenListParser.ts +156 -0
  157. package/src/lib/dom/query.ts +13 -0
  158. package/src/lib/reactivity/createChildrenState.ts +51 -6
  159. package/src/lib/reactivity/createComputedExpression.ts +23 -25
  160. package/src/lib/reactivity/createNoteReadonlyThunk.ts +33 -0
  161. package/src/lib/reactivity/createSelectItems.ts +25 -20
  162. package/src/lib/reactivity/createValueState.ts +6 -6
  163. package/src/lib/reactivity/materializeCurrentStateChildren.ts +3 -1
  164. package/src/lib/reactivity/node-state/createSharedNodeState.ts +1 -1
  165. package/src/lib/reactivity/text/createFieldHint.ts +9 -7
  166. package/src/lib/reactivity/text/createNodeLabel.ts +7 -5
  167. package/src/lib/reactivity/text/createNoteText.ts +72 -0
  168. package/src/lib/reactivity/text/createTextRange.ts +17 -90
  169. package/src/lib/reactivity/validation/createAggregatedViolations.ts +70 -0
  170. package/src/lib/reactivity/validation/createValidation.ts +196 -0
  171. package/src/model/BindComputation.ts +0 -4
  172. package/src/model/BindDefinition.ts +8 -6
  173. package/src/model/BindElement.ts +1 -0
  174. package/src/model/DescendentNodeDefinition.ts +1 -2
  175. package/src/model/{ValueNodeDefinition.ts → LeafNodeDefinition.ts} +5 -6
  176. package/src/model/ModelBindMap.ts +4 -0
  177. package/src/model/ModelDefinition.ts +1 -1
  178. package/src/model/NodeDefinition.ts +21 -21
  179. package/src/model/RepeatInstanceDefinition.ts +8 -13
  180. package/src/model/RepeatRangeDefinition.ts +94 -0
  181. package/src/model/RepeatTemplateDefinition.ts +10 -15
  182. package/src/model/RootDefinition.ts +12 -14
  183. package/src/model/SubtreeDefinition.ts +3 -3
  184. package/src/parse/NoteNodeDefinition.ts +70 -0
  185. package/src/parse/TODO.md +3 -0
  186. package/src/parse/expression/RepeatCountControlExpression.ts +44 -0
  187. package/src/parse/text/HintDefinition.ts +25 -0
  188. package/src/parse/text/ItemLabelDefinition.ts +25 -0
  189. package/src/parse/text/ItemsetLabelDefinition.ts +44 -0
  190. package/src/parse/text/LabelDefinition.ts +61 -0
  191. package/src/parse/text/MessageDefinition.ts +49 -0
  192. package/src/parse/text/OutputChunkDefinition.ts +25 -0
  193. package/src/parse/text/ReferenceChunkDefinition.ts +14 -0
  194. package/src/parse/text/StaticTextChunkDefinition.ts +19 -0
  195. package/src/parse/text/TranslationChunkDefinition.ts +38 -0
  196. package/src/parse/text/abstract/TextChunkDefinition.ts +38 -0
  197. package/src/parse/text/abstract/TextElementDefinition.ts +71 -0
  198. package/src/parse/text/abstract/TextRangeDefinition.ts +70 -0
  199. package/src/parse/xpath/dependency-analysis.ts +105 -0
  200. package/src/parse/xpath/path-resolution.ts +475 -0
  201. package/src/parse/xpath/predicate-analysis.ts +61 -0
  202. package/src/parse/xpath/reference-parsing.ts +90 -0
  203. package/src/parse/xpath/semantic-analysis.ts +466 -0
  204. package/src/parse/xpath/syntax-traversal.ts +129 -0
  205. package/dist/body/RepeatDefinition.d.ts +0 -16
  206. package/dist/body/group/RepeatGroupDefinition.d.ts +0 -13
  207. package/dist/body/text/HintDefinition.d.ts +0 -11
  208. package/dist/body/text/LabelDefinition.d.ts +0 -20
  209. package/dist/body/text/TextElementDefinition.d.ts +0 -33
  210. package/dist/body/text/TextElementOutputPart.d.ts +0 -13
  211. package/dist/body/text/TextElementPart.d.ts +0 -13
  212. package/dist/body/text/TextElementReferencePart.d.ts +0 -7
  213. package/dist/body/text/TextElementStaticPart.d.ts +0 -7
  214. package/dist/instance/RepeatRange.d.ts +0 -80
  215. package/dist/lib/xpath/analysis.d.ts +0 -23
  216. package/dist/model/RepeatSequenceDefinition.d.ts +0 -20
  217. package/src/body/RepeatDefinition.ts +0 -54
  218. package/src/body/group/RepeatGroupDefinition.ts +0 -91
  219. package/src/body/text/HintDefinition.ts +0 -26
  220. package/src/body/text/LabelDefinition.ts +0 -54
  221. package/src/body/text/TextElementDefinition.ts +0 -97
  222. package/src/body/text/TextElementOutputPart.ts +0 -27
  223. package/src/body/text/TextElementPart.ts +0 -31
  224. package/src/body/text/TextElementReferencePart.ts +0 -21
  225. package/src/body/text/TextElementStaticPart.ts +0 -26
  226. package/src/instance/RepeatRange.ts +0 -214
  227. package/src/lib/xpath/analysis.ts +0 -241
  228. package/src/model/RepeatSequenceDefinition.ts +0 -53
@@ -1,6 +1,7 @@
1
1
  import { Accessor } from 'solid-js';
2
- import { GroupDefinition, GroupNode } from '../client/GroupNode.ts';
3
- import { TextRange } from '../index.ts';
2
+ import { GroupDefinition, GroupNode, GroupNodeAppearances } from '../client/GroupNode.ts';
3
+ import { TextRange } from '../client/TextRange.ts';
4
+ import { AncestorNodeValidationState } from '../client/validation.ts';
4
5
  import { MaterializedChildren } from '../lib/reactivity/materializeCurrentStateChildren.ts';
5
6
  import { CurrentState } from '../lib/reactivity/node-state/createCurrentState.ts';
6
7
  import { EngineState } from '../lib/reactivity/node-state/createEngineState.ts';
@@ -22,10 +23,11 @@ export declare class Group extends DescendantNode<GroupDefinition, GroupStateSpe
22
23
  private readonly childrenState;
23
24
  protected readonly state: SharedNodeState<GroupStateSpec>;
24
25
  protected engineState: EngineState<GroupStateSpec>;
25
- readonly currentState: MaterializedChildren<CurrentState<GroupStateSpec>, GeneralChildNode>;
26
26
  readonly nodeType = "group";
27
+ readonly appearances: GroupNodeAppearances;
28
+ readonly currentState: MaterializedChildren<CurrentState<GroupStateSpec>, GeneralChildNode>;
29
+ readonly validationState: AncestorNodeValidationState;
27
30
  constructor(parent: GeneralParentNode, definition: GroupDefinition);
28
- protected computeReference(parent: GeneralParentNode): string;
29
31
  getChildren(): readonly GeneralChildNode[];
30
32
  }
31
33
  export {};
@@ -0,0 +1,40 @@
1
+ import { ModelValueNode } from '../client/ModelValueNode.ts';
2
+ import { AnyViolation, LeafNodeValidationState } from '../client/validation.ts';
3
+ import { CurrentState } from '../lib/reactivity/node-state/createCurrentState.ts';
4
+ import { EngineState } from '../lib/reactivity/node-state/createEngineState.ts';
5
+ import { SharedNodeState } from '../lib/reactivity/node-state/createSharedNodeState.ts';
6
+ import { SimpleAtomicState } from '../lib/reactivity/types.ts';
7
+ import { LeafNodeDefinition } from '../model/LeafNodeDefinition.ts';
8
+ import { DescendantNodeStateSpec, DescendantNode } from './abstract/DescendantNode.ts';
9
+ import { GeneralParentNode } from './hierarchy.ts';
10
+ import { EvaluationContext } from './internal-api/EvaluationContext.ts';
11
+ import { SubscribableDependency } from './internal-api/SubscribableDependency.ts';
12
+ import { ValidationContext } from './internal-api/ValidationContext.ts';
13
+ import { ValueContext } from './internal-api/ValueContext.ts';
14
+
15
+ export interface ModelValueDefinition extends LeafNodeDefinition {
16
+ readonly bodyElement: null;
17
+ }
18
+ interface ModelValueStateSpec extends DescendantNodeStateSpec<string> {
19
+ readonly label: null;
20
+ readonly hint: null;
21
+ readonly children: null;
22
+ readonly value: SimpleAtomicState<string>;
23
+ readonly valueOptions: null;
24
+ }
25
+ export declare class ModelValue extends DescendantNode<ModelValueDefinition, ModelValueStateSpec, null> implements ModelValueNode, EvaluationContext, SubscribableDependency, ValidationContext, ValueContext<string> {
26
+ private readonly validation;
27
+ protected readonly state: SharedNodeState<ModelValueStateSpec>;
28
+ protected engineState: EngineState<ModelValueStateSpec>;
29
+ readonly nodeType = "model-value";
30
+ readonly appearances: null;
31
+ readonly currentState: CurrentState<ModelValueStateSpec>;
32
+ get validationState(): LeafNodeValidationState;
33
+ readonly encodeValue: (value: string) => string;
34
+ readonly decodeValue: (value: string) => string;
35
+ constructor(parent: GeneralParentNode, definition: ModelValueDefinition);
36
+ getViolation(): AnyViolation | null;
37
+ isBlank(): boolean;
38
+ getChildren(): readonly [];
39
+ }
40
+ export {};
@@ -0,0 +1,42 @@
1
+ import { Accessor } from 'solid-js';
2
+ import { NoteNode, NoteNodeAppearances } from '../client/NoteNode.ts';
3
+ import { TextRange } from '../client/TextRange.ts';
4
+ import { AnyViolation, LeafNodeValidationState } from '../client/validation.ts';
5
+ import { CurrentState } from '../lib/reactivity/node-state/createCurrentState.ts';
6
+ import { EngineState } from '../lib/reactivity/node-state/createEngineState.ts';
7
+ import { SharedNodeState } from '../lib/reactivity/node-state/createSharedNodeState.ts';
8
+ import { ComputedNoteText } from '../lib/reactivity/text/createNoteText.ts';
9
+ import { SimpleAtomicState } from '../lib/reactivity/types.ts';
10
+ import { NoteNodeDefinition } from '../parse/NoteNodeDefinition.ts';
11
+ import { DescendantNodeStateSpec, DescendantNode } from './abstract/DescendantNode.ts';
12
+ import { GeneralParentNode } from './hierarchy.ts';
13
+ import { EvaluationContext } from './internal-api/EvaluationContext.ts';
14
+ import { SubscribableDependency } from './internal-api/SubscribableDependency.ts';
15
+ import { ValidationContext } from './internal-api/ValidationContext.ts';
16
+ import { ValueContext } from './internal-api/ValueContext.ts';
17
+
18
+ interface NoteStateSpec extends DescendantNodeStateSpec<string> {
19
+ readonly readonly: Accessor<true>;
20
+ readonly noteText: ComputedNoteText;
21
+ readonly label: Accessor<TextRange<'label', 'form'> | null>;
22
+ readonly hint: Accessor<TextRange<'hint', 'form'> | null>;
23
+ readonly children: null;
24
+ readonly value: SimpleAtomicState<string>;
25
+ readonly valueOptions: null;
26
+ }
27
+ export declare class Note extends DescendantNode<NoteNodeDefinition, NoteStateSpec, null> implements NoteNode, EvaluationContext, SubscribableDependency, ValidationContext, ValueContext<string> {
28
+ private readonly validation;
29
+ protected readonly state: SharedNodeState<NoteStateSpec>;
30
+ protected engineState: EngineState<NoteStateSpec>;
31
+ readonly nodeType = "note";
32
+ readonly appearances: NoteNodeAppearances;
33
+ readonly currentState: CurrentState<NoteStateSpec>;
34
+ get validationState(): LeafNodeValidationState;
35
+ readonly encodeValue: (value: string) => string;
36
+ readonly decodeValue: (value: string) => string;
37
+ constructor(parent: GeneralParentNode, definition: NoteNodeDefinition);
38
+ getViolation(): AnyViolation | null;
39
+ isBlank(): boolean;
40
+ getChildren(): readonly [];
41
+ }
42
+ export {};
@@ -1,8 +1,10 @@
1
1
  import { XFormsXPathEvaluator } from '@getodk/xpath';
2
2
  import { Accessor, Signal } from 'solid-js';
3
3
  import { XFormDOM } from '../XFormDOM.ts';
4
+ import { BodyClassList } from '../body/BodyDefinition.ts';
4
5
  import { ActiveLanguage, FormLanguage, FormLanguages } from '../client/FormLanguage.ts';
5
6
  import { RootNode } from '../client/RootNode.ts';
7
+ import { AncestorNodeValidationState } from '../client/validation.ts';
6
8
  import { MaterializedChildren } from '../lib/reactivity/materializeCurrentStateChildren.ts';
7
9
  import { CurrentState } from '../lib/reactivity/node-state/createCurrentState.ts';
8
10
  import { EngineState } from '../lib/reactivity/node-state/createEngineState.ts';
@@ -29,41 +31,26 @@ interface RootStateSpec {
29
31
  readonly activeLanguage: Signal<ActiveLanguage>;
30
32
  }
31
33
  export declare class Root extends InstanceNode<RootDefinition, RootStateSpec, GeneralChildNode> implements RootNode, EvaluationContext, EvaluationContextRoot, SubscribableDependency, TranslationContext {
32
- static initialize(xformDOM: XFormDOM, definition: RootDefinition, engineConfig: InstanceConfig): Promise<Root>;
33
34
  private readonly childrenState;
35
+ readonly hasReadonlyAncestor: () => boolean;
36
+ readonly isReadonly: () => boolean;
37
+ readonly hasNonRelevantAncestor: () => boolean;
38
+ readonly isRelevant: () => boolean;
34
39
  protected readonly state: SharedNodeState<RootStateSpec>;
35
40
  protected readonly engineState: EngineState<RootStateSpec>;
36
41
  readonly nodeType = "root";
42
+ readonly appearances: null;
43
+ readonly classes: BodyClassList;
37
44
  readonly currentState: MaterializedChildren<CurrentState<RootStateSpec>, GeneralChildNode>;
45
+ readonly validationState: AncestorNodeValidationState;
38
46
  protected readonly instanceDOM: XFormDOM;
39
47
  readonly root: this;
40
48
  readonly evaluator: XFormsXPathEvaluator;
41
- private readonly rootReference;
42
- get contextReference(): string;
43
49
  readonly contextNode: Element;
44
50
  readonly parent: null;
45
51
  readonly languages: FormLanguages;
46
52
  get activeLanguage(): ActiveLanguage;
47
- protected constructor(xformDOM: XFormDOM, definition: RootDefinition, engineConfig: InstanceConfig);
48
- /**
49
- * Waits until form state is fully initialized.
50
- *
51
- * As much as possible, all instance state computations are implemented so
52
- * that they complete synchronously.
53
- *
54
- * There is currently one exception: because instance nodes may form
55
- * computation dependencies into their descendants as well as their ancestors,
56
- * there is an allowance **during form initialization only** to account for
57
- * this chicken/egg scenario. Note that this allowance is intentionally,
58
- * strictly limited: if form state initialization is not resolved within a
59
- * single microtask tick we throw/reject.
60
- *
61
- * All subsequent computations are always performed synchronously (and we will
62
- * use tests to validate this, by utilizing the synchronously returned `Root`
63
- * state from client-facing write interfaces).
64
- */
65
- formStateInitialized(): Promise<void>;
66
- protected computeReference(_parent: null, definition: RootDefinition): string;
53
+ constructor(xformDOM: XFormDOM, definition: RootDefinition, engineConfig: InstanceConfig);
67
54
  getChildren(): readonly GeneralChildNode[];
68
55
  setLanguage(language: FormLanguage): Root;
69
56
  subscribe(): void;
@@ -1,20 +1,22 @@
1
1
  import { Accessor } from 'solid-js';
2
2
  import { AnySelectDefinition } from '../body/control/select/SelectDefinition.ts';
3
- import { SelectItem, SelectNode } from '../client/SelectNode.ts';
4
- import { TextRange } from '../index.ts';
3
+ import { SelectItem, SelectNode, SelectNodeAppearances } from '../client/SelectNode.ts';
4
+ import { TextRange } from '../client/TextRange.ts';
5
+ import { AnyViolation, LeafNodeValidationState } from '../client/validation.ts';
5
6
  import { CurrentState } from '../lib/reactivity/node-state/createCurrentState.ts';
6
7
  import { EngineState } from '../lib/reactivity/node-state/createEngineState.ts';
7
8
  import { SharedNodeState } from '../lib/reactivity/node-state/createSharedNodeState.ts';
8
9
  import { SimpleAtomicState } from '../lib/reactivity/types.ts';
9
- import { ValueNodeDefinition } from '../model/ValueNodeDefinition.ts';
10
+ import { LeafNodeDefinition } from '../model/LeafNodeDefinition.ts';
10
11
  import { Root } from './Root.ts';
11
12
  import { DescendantNodeStateSpec, DescendantNode } from './abstract/DescendantNode.ts';
12
13
  import { GeneralParentNode } from './hierarchy.ts';
13
14
  import { EvaluationContext } from './internal-api/EvaluationContext.ts';
14
15
  import { SubscribableDependency } from './internal-api/SubscribableDependency.ts';
16
+ import { ValidationContext } from './internal-api/ValidationContext.ts';
15
17
  import { ValueContext } from './internal-api/ValueContext.ts';
16
18
 
17
- export interface SelectFieldDefinition extends ValueNodeDefinition {
19
+ export interface SelectFieldDefinition extends LeafNodeDefinition {
18
20
  readonly bodyElement: AnySelectDefinition;
19
21
  }
20
22
  interface SelectFieldStateSpec extends DescendantNodeStateSpec<readonly SelectItem[]> {
@@ -24,22 +26,26 @@ interface SelectFieldStateSpec extends DescendantNodeStateSpec<readonly SelectIt
24
26
  readonly value: SimpleAtomicState<readonly SelectItem[]>;
25
27
  readonly valueOptions: Accessor<readonly SelectItem[]>;
26
28
  }
27
- export declare class SelectField extends DescendantNode<SelectFieldDefinition, SelectFieldStateSpec, null> implements SelectNode, EvaluationContext, SubscribableDependency, ValueContext<readonly SelectItem[]> {
29
+ export declare class SelectField extends DescendantNode<SelectFieldDefinition, SelectFieldStateSpec, null> implements SelectNode, EvaluationContext, SubscribableDependency, ValidationContext, ValueContext<readonly SelectItem[]> {
28
30
  private readonly selectExclusive;
31
+ private readonly validation;
29
32
  protected readonly state: SharedNodeState<SelectFieldStateSpec>;
30
33
  protected engineState: EngineState<SelectFieldStateSpec>;
31
34
  readonly nodeType = "select";
35
+ readonly appearances: SelectNodeAppearances;
32
36
  readonly currentState: CurrentState<SelectFieldStateSpec>;
37
+ get validationState(): LeafNodeValidationState;
33
38
  readonly encodeValue: (runtimeValue: readonly SelectItem[]) => string;
34
39
  readonly decodeValue: (instanceValue: string) => readonly SelectItem[];
35
40
  protected readonly getValueOptions: Accessor<readonly SelectItem[]>;
36
41
  constructor(parent: GeneralParentNode, definition: SelectFieldDefinition);
42
+ getViolation(): AnyViolation | null;
37
43
  protected getSelectItemsByValue(valueOptions?: readonly SelectItem[]): ReadonlyMap<string, SelectItem>;
38
- protected computeReference(parent: GeneralParentNode): string;
39
44
  protected updateSelectedItemValues(values: readonly string[]): void;
40
45
  protected setSelectedItemValue(value: string | null): void;
41
46
  select(selectedItem: SelectItem): Root;
42
47
  deselect(deselectedItem: SelectItem): Root;
43
48
  getChildren(): readonly [];
49
+ isBlank(): boolean;
44
50
  }
45
51
  export {};
@@ -1,21 +1,23 @@
1
1
  import { Accessor } from 'solid-js';
2
2
  import { InputDefinition } from '../body/control/InputDefinition.ts';
3
- import { StringNode } from '../client/StringNode.ts';
4
- import { TextRange } from '../index.ts';
3
+ import { StringNode, StringNodeAppearances } from '../client/StringNode.ts';
4
+ import { TextRange } from '../client/TextRange.ts';
5
+ import { AnyViolation, LeafNodeValidationState } from '../client/validation.ts';
5
6
  import { CurrentState } from '../lib/reactivity/node-state/createCurrentState.ts';
6
7
  import { EngineState } from '../lib/reactivity/node-state/createEngineState.ts';
7
8
  import { SharedNodeState } from '../lib/reactivity/node-state/createSharedNodeState.ts';
8
9
  import { SimpleAtomicState } from '../lib/reactivity/types.ts';
9
- import { ValueNodeDefinition } from '../model/ValueNodeDefinition.ts';
10
+ import { LeafNodeDefinition } from '../model/LeafNodeDefinition.ts';
10
11
  import { Root } from './Root.ts';
11
12
  import { DescendantNodeStateSpec, DescendantNode } from './abstract/DescendantNode.ts';
12
13
  import { GeneralParentNode } from './hierarchy.ts';
13
14
  import { EvaluationContext } from './internal-api/EvaluationContext.ts';
14
15
  import { SubscribableDependency } from './internal-api/SubscribableDependency.ts';
16
+ import { ValidationContext } from './internal-api/ValidationContext.ts';
15
17
  import { ValueContext } from './internal-api/ValueContext.ts';
16
18
 
17
- export interface StringFieldDefinition extends ValueNodeDefinition {
18
- readonly bodyElement: InputDefinition | null;
19
+ export interface StringFieldDefinition extends LeafNodeDefinition {
20
+ readonly bodyElement: InputDefinition;
19
21
  }
20
22
  interface StringFieldStateSpec extends DescendantNodeStateSpec<string> {
21
23
  readonly label: Accessor<TextRange<'label'> | null>;
@@ -24,15 +26,19 @@ interface StringFieldStateSpec extends DescendantNodeStateSpec<string> {
24
26
  readonly value: SimpleAtomicState<string>;
25
27
  readonly valueOptions: null;
26
28
  }
27
- export declare class StringField extends DescendantNode<StringFieldDefinition, StringFieldStateSpec, null> implements StringNode, EvaluationContext, SubscribableDependency, ValueContext<string> {
29
+ export declare class StringField extends DescendantNode<StringFieldDefinition, StringFieldStateSpec, null> implements StringNode, EvaluationContext, SubscribableDependency, ValidationContext, ValueContext<string> {
30
+ private readonly validation;
28
31
  protected readonly state: SharedNodeState<StringFieldStateSpec>;
29
32
  protected engineState: EngineState<StringFieldStateSpec>;
30
33
  readonly nodeType = "string";
34
+ readonly appearances: StringNodeAppearances;
31
35
  readonly currentState: CurrentState<StringFieldStateSpec>;
36
+ get validationState(): LeafNodeValidationState;
32
37
  readonly encodeValue: (value: string) => string;
33
38
  readonly decodeValue: (value: string) => string;
34
39
  constructor(parent: GeneralParentNode, definition: StringFieldDefinition);
35
- protected computeReference(parent: GeneralParentNode): string;
40
+ getViolation(): AnyViolation | null;
41
+ isBlank(): boolean;
36
42
  getChildren(): readonly [];
37
43
  setValue(value: string): Root;
38
44
  }
@@ -1,5 +1,6 @@
1
1
  import { Accessor } from 'solid-js';
2
2
  import { SubtreeDefinition, SubtreeNode } from '../client/SubtreeNode.ts';
3
+ import { AncestorNodeValidationState } from '../client/validation.ts';
3
4
  import { MaterializedChildren } from '../lib/reactivity/materializeCurrentStateChildren.ts';
4
5
  import { CurrentState } from '../lib/reactivity/node-state/createCurrentState.ts';
5
6
  import { EngineState } from '../lib/reactivity/node-state/createEngineState.ts';
@@ -22,9 +23,10 @@ export declare class Subtree extends DescendantNode<SubtreeDefinition, SubtreeSt
22
23
  protected readonly state: SharedNodeState<SubtreeStateSpec>;
23
24
  protected engineState: EngineState<SubtreeStateSpec>;
24
25
  readonly nodeType = "subtree";
26
+ readonly appearances: null;
25
27
  readonly currentState: MaterializedChildren<CurrentState<SubtreeStateSpec>, GeneralChildNode>;
28
+ readonly validationState: AncestorNodeValidationState;
26
29
  constructor(parent: GeneralParentNode, definition: SubtreeDefinition);
27
- protected computeReference(parent: GeneralParentNode): string;
28
30
  getChildren(): readonly GeneralChildNode[];
29
31
  }
30
32
  export {};
@@ -2,14 +2,13 @@ import { XFormsXPathEvaluator } from '@getodk/xpath';
2
2
  import { Accessor } from 'solid-js';
3
3
  import { BaseNode } from '../../client/BaseNode.ts';
4
4
  import { AnyDescendantNodeDefinition } from '../../model/DescendentNodeDefinition.ts';
5
+ import { LeafNodeDefinition } from '../../model/LeafNodeDefinition.ts';
5
6
  import { AnyNodeDefinition } from '../../model/NodeDefinition.ts';
6
7
  import { RepeatInstanceDefinition } from '../../model/RepeatInstanceDefinition.ts';
7
- import { ValueNodeDefinition } from '../../model/ValueNodeDefinition.ts';
8
- import { RepeatRange } from '../RepeatRange.ts';
9
- import { Root } from '../Root.ts';
10
- import { AnyChildNode, GeneralParentNode } from '../hierarchy.ts';
8
+ import { AnyChildNode, GeneralParentNode, RepeatRange } from '../hierarchy.ts';
11
9
  import { EvaluationContext } from '../internal-api/EvaluationContext.ts';
12
10
  import { SubscribableDependency } from '../internal-api/SubscribableDependency.ts';
11
+ import { Root } from '../Root.ts';
13
12
  import { InstanceNodeStateSpec, InstanceNode } from './InstanceNode.ts';
14
13
 
15
14
  export interface DescendantNodeSharedStateSpec {
@@ -20,18 +19,25 @@ export interface DescendantNodeSharedStateSpec {
20
19
  }
21
20
  export type DescendantNodeStateSpec<Value = never> = InstanceNodeStateSpec<Value> & DescendantNodeSharedStateSpec;
22
21
  export type DescendantNodeDefinition = Extract<AnyNodeDefinition, AnyDescendantNodeDefinition>;
23
- export type DescendantNodeParent<Definition extends DescendantNodeDefinition> = Definition extends ValueNodeDefinition ? GeneralParentNode : Definition extends RepeatInstanceDefinition ? RepeatRange : GeneralParentNode;
22
+ export type DescendantNodeParent<Definition extends DescendantNodeDefinition> = Definition extends LeafNodeDefinition ? GeneralParentNode : Definition extends RepeatInstanceDefinition ? RepeatRange : GeneralParentNode;
24
23
  export type AnyDescendantNode = DescendantNode<DescendantNodeDefinition, DescendantNodeStateSpec<any>, any>;
24
+ interface DescendantNodeOptions {
25
+ readonly computeReference?: Accessor<string>;
26
+ }
25
27
  export declare abstract class DescendantNode<Definition extends DescendantNodeDefinition, Spec extends DescendantNodeStateSpec<any>, Child extends AnyChildNode | null = null> extends InstanceNode<Definition, Spec, Child> implements BaseNode, EvaluationContext, SubscribableDependency {
26
28
  readonly parent: DescendantNodeParent<Definition>;
27
29
  readonly definition: Definition;
30
+ readonly hasReadonlyAncestor: Accessor<boolean>;
31
+ readonly isSelfReadonly: Accessor<boolean>;
32
+ readonly isReadonly: Accessor<boolean>;
33
+ readonly hasNonRelevantAncestor: Accessor<boolean>;
34
+ readonly isSelfRelevant: Accessor<boolean>;
35
+ readonly isRelevant: Accessor<boolean>;
36
+ readonly isRequired: Accessor<boolean>;
28
37
  readonly root: Root;
29
38
  readonly evaluator: XFormsXPathEvaluator;
30
39
  readonly contextNode: Element;
31
- constructor(parent: DescendantNodeParent<Definition>, definition: Definition);
32
- protected computeChildStepReference(parent: DescendantNodeParent<Definition>): string;
33
- protected abstract computeReference(parent: DescendantNodeParent<Definition>, definition: Definition): string;
34
- protected buildSharedStateSpec(parent: DescendantNodeParent<Definition>, definition: Definition): DescendantNodeSharedStateSpec;
40
+ constructor(parent: DescendantNodeParent<Definition>, definition: Definition, options?: DescendantNodeOptions);
35
41
  protected createContextNode(parentContextNode: Element, nodeName: string): Element;
36
42
  /**
37
43
  * Currently expected to be overridden by...
@@ -74,3 +80,4 @@ export declare abstract class DescendantNode<Definition extends DescendantNodeDe
74
80
  */
75
81
  remove(this: AnyChildNode): void;
76
82
  }
83
+ export {};
@@ -1,7 +1,9 @@
1
1
  import { XFormsXPathEvaluator } from '@getodk/xpath';
2
2
  import { Accessor, Signal } from 'solid-js';
3
3
  import { BaseNode } from '../../client/BaseNode.ts';
4
+ import { NodeAppearances } from '../../client/NodeAppearances.ts';
4
5
  import { InstanceNodeType } from '../../client/node-types.ts';
6
+ import { NodeValidationState } from '../../client/validation.ts';
5
7
  import { TextRange } from '../../index.ts';
6
8
  import { CurrentState } from '../../lib/reactivity/node-state/createCurrentState.ts';
7
9
  import { EngineState } from '../../lib/reactivity/node-state/createEngineState.ts';
@@ -28,9 +30,6 @@ export interface InstanceNodeStateSpec<Value = never> {
28
30
  readonly value: Signal<Value> | SimpleAtomicState<Value> | null;
29
31
  }
30
32
  type AnyInstanceNode = InstanceNode<AnyNodeDefinition, InstanceNodeStateSpec<any>, any>;
31
- interface InitializedStateOptions<T, K extends keyof T> {
32
- readonly uninitializedFallback: T[K];
33
- }
34
33
  /**
35
34
  * This type has the same effect as {@link MaterializedChildren}, but abstractly
36
35
  * handles leaf node types as well.
@@ -38,52 +37,53 @@ interface InitializedStateOptions<T, K extends keyof T> {
38
37
  export type InstanceNodeCurrentState<Spec extends InstanceNodeStateSpec<any>, Child> = CurrentState<Omit<Spec, 'children'>> & {
39
38
  readonly children: [Child] extends [AnyChildNode] ? readonly Child[] : null;
40
39
  };
40
+ interface ComputableReferenceNode {
41
+ readonly parent: AnyParentNode | null;
42
+ readonly definition: AnyNodeDefinition;
43
+ }
44
+ type ComputeInstanceNodeReference = <This extends ComputableReferenceNode>(this: This, parent: This['parent'], definition: This['definition']) => string;
45
+ export interface InstanceNodeOptions {
46
+ readonly computeReference?: () => string;
47
+ }
41
48
  export declare abstract class InstanceNode<Definition extends AnyNodeDefinition, Spec extends InstanceNodeStateSpec<any>, Child extends AnyChildNode | null = null> implements BaseNode, EvaluationContext, SubscribableDependency {
42
49
  readonly engineConfig: InstanceConfig;
43
50
  readonly parent: AnyParentNode | null;
44
51
  readonly definition: Definition;
45
- protected readonly isStateInitialized: Accessor<boolean>;
46
52
  protected abstract readonly state: SharedNodeState<Spec>;
47
53
  protected abstract readonly engineState: EngineState<Spec>;
48
54
  /**
49
- * Provides a generalized mechanism for accessing a reactive state value
50
- * during a node's construction, while {@link engineState} is still being
51
- * defined and thus isn't assigned.
52
- *
53
- * The fallback value specified in {@link options} will be returned on access
54
- * until {@link isStateInitialized} returns true. This ensures:
55
- *
56
- * - a value of the expected type will be available
57
- * - any read access will become reactive to the actual state, once it has
58
- * been initialized and {@link engineState} is assigned
59
- *
60
- * @todo This is one among several chicken/egg problems encountered trying to
61
- * support state initialization in which some aspects of the state derive from
62
- * other aspects of it. It would be nice to dispense with this entirely. But
63
- * if it must persist, we should also consider replacing the method with a
64
- * direct accessor once state initialization completes, so the initialized
65
- * check is only called until it becomes impertinent.
55
+ * @package Exposed on every node type to facilitate inheritance, as well as
56
+ * conditional behavior for value nodes.
57
+ */
58
+ abstract readonly hasReadonlyAncestor: Accessor<boolean>;
59
+ /**
60
+ * @package Exposed on every node type to facilitate inheritance, as well as
61
+ * conditional behavior for value nodes.
66
62
  */
67
- protected getInitializedState<K extends keyof EngineState<Spec>>(key: K, options: InitializedStateOptions<EngineState<Spec>, K>): EngineState<Spec>[K];
63
+ abstract readonly isReadonly: Accessor<boolean>;
68
64
  /**
69
65
  * @package Exposed on every node type to facilitate inheritance, as well as
70
66
  * conditional behavior for value nodes.
71
67
  */
72
- get isReadonly(): boolean;
68
+ abstract readonly hasNonRelevantAncestor: Accessor<boolean>;
73
69
  /**
74
70
  * @package Exposed on every node type to facilitate inheritance, as well as
75
71
  * conditional behavior for value nodes.
76
72
  */
77
- get isRelevant(): boolean;
73
+ abstract readonly isRelevant: Accessor<boolean>;
78
74
  readonly nodeId: NodeID;
79
75
  abstract readonly nodeType: InstanceNodeType;
76
+ abstract readonly appearances: NodeAppearances<Definition>;
80
77
  abstract readonly currentState: InstanceNodeCurrentState<Spec, Child>;
78
+ abstract readonly validationState: NodeValidationState;
81
79
  abstract readonly root: Root;
82
80
  abstract readonly evaluator: XFormsXPathEvaluator;
83
81
  readonly scope: ReactiveScope;
84
- get contextReference(): string;
82
+ readonly computeReference: ComputeInstanceNodeReference;
83
+ protected readonly computeChildStepReference: ComputeInstanceNodeReference;
84
+ readonly contextReference: () => string;
85
85
  abstract readonly contextNode: Element;
86
- constructor(engineConfig: InstanceConfig, parent: AnyParentNode | null, definition: Definition);
86
+ constructor(engineConfig: InstanceConfig, parent: AnyParentNode | null, definition: Definition, options?: InstanceNodeOptions);
87
87
  /**
88
88
  * @package This presently serves a few internal use cases, where certain
89
89
  * behaviors depend on arbitrary traversal from any point in the instance
@@ -95,9 +95,8 @@ export declare abstract class InstanceNode<Definition extends AnyNodeDefinition,
95
95
  * interface for those internal uses.
96
96
  */
97
97
  abstract getChildren(this: AnyInstanceNode): readonly AnyChildNode[];
98
- protected abstract computeReference(parent: AnyInstanceNode | null, definition: Definition): string;
99
- getNodeByReference(this: AnyNode, visited: WeakSet<AnyNode>, dependencyReference: string): SubscribableDependency | null;
100
- getSubscribableDependencyByReference(this: AnyNode, reference: string): SubscribableDependency | null;
98
+ getNodesByReference(this: AnyNode, visited: WeakSet<AnyNode>, dependencyReference: string): readonly SubscribableDependency[];
99
+ getSubscribableDependenciesByReference(this: AnyNode, reference: string): readonly SubscribableDependency[];
101
100
  /**
102
101
  * This is a default implementation suitable for most node types. The rest
103
102
  * (currently: `Root`, `RepeatRange`, `RepeatInstance`) should likely extend
@@ -1,13 +1,18 @@
1
1
  import { Group } from './Group.ts';
2
- import { RepeatInstance } from './RepeatInstance.ts';
3
- import { RepeatRange } from './RepeatRange.ts';
2
+ import { ModelValue } from './ModelValue.ts';
3
+ import { Note } from './Note.ts';
4
+ import { RepeatInstance } from './repeat/RepeatInstance.ts';
5
+ import { RepeatRangeControlled } from './repeat/RepeatRangeControlled.ts';
6
+ import { RepeatRangeUncontrolled } from './repeat/RepeatRangeUncontrolled.ts';
4
7
  import { Root } from './Root.ts';
5
8
  import { SelectField } from './SelectField.ts';
6
9
  import { StringField } from './StringField.ts';
7
10
  import { Subtree } from './Subtree.ts';
8
11
 
9
- export type AnyNode = Root | Group | Subtree | RepeatRange | RepeatInstance | StringField | SelectField;
12
+ export type RepeatRange = RepeatRangeControlled | RepeatRangeUncontrolled;
13
+ export type AnyNode = Root | Group | Subtree | RepeatRange | RepeatInstance | Note | ModelValue | StringField | SelectField;
10
14
  export type AnyParentNode = Root | Group | Subtree | RepeatRange | RepeatInstance;
11
15
  export type GeneralParentNode = Root | Group | Subtree | RepeatInstance;
12
- export type AnyChildNode = Group | Subtree | RepeatRange | RepeatInstance | StringField | SelectField;
13
- export type GeneralChildNode = Group | Subtree | RepeatRange | StringField | SelectField;
16
+ export type AnyChildNode = Group | Subtree | RepeatRange | RepeatInstance | ModelValue | Note | StringField | SelectField;
17
+ export type GeneralChildNode = Group | Subtree | RepeatRange | ModelValue | Note | StringField | SelectField;
18
+ export type AnyValueNode = ModelValue | Note | StringField | SelectField;
@@ -1,4 +1,5 @@
1
1
  import { XFormsXPathEvaluator } from '@getodk/xpath';
2
+ import { Accessor } from 'solid-js';
2
3
  import { ReactiveScope } from '../../lib/reactivity/scope.ts';
3
4
  import { SubscribableDependency } from './SubscribableDependency.ts';
4
5
  import { TranslationContext } from './TranslationContext.ts';
@@ -25,11 +26,11 @@ export interface EvaluationContext {
25
26
  * Produces the current absolute reference to the {@link contextNode}, where
26
27
  * the absolute `/` resolves to the active form state's primary instance root.
27
28
  */
28
- get contextReference(): string;
29
+ readonly contextReference: Accessor<string>;
29
30
  readonly contextNode: Node;
30
31
  /**
31
- * Resolves a nodeset reference, possibly relative to the
32
- * {@link EvaluationContext.contextNode}.
32
+ * Resolves nodes corresponding to the provided node-set reference, possibly
33
+ * relative to the {@link EvaluationContext.contextNode}.
33
34
  */
34
- readonly getSubscribableDependencyByReference: (reference: string) => SubscribableDependency | null;
35
+ getSubscribableDependenciesByReference(reference: string): readonly SubscribableDependency[];
35
36
  }
@@ -0,0 +1,21 @@
1
+ import { BindComputation } from '../../model/BindComputation.ts';
2
+ import { MessageDefinition } from '../../parse/text/MessageDefinition.ts';
3
+ import { EvaluationContext } from './EvaluationContext.ts';
4
+ import { SubscribableDependency } from './SubscribableDependency.ts';
5
+
6
+ interface ValidationContextDefinitionBind {
7
+ readonly constraint: BindComputation<'constraint'>;
8
+ readonly constraintMsg: MessageDefinition<'constraintMsg'> | null;
9
+ readonly required: BindComputation<'required'>;
10
+ readonly requiredMsg: MessageDefinition<'requiredMsg'> | null;
11
+ }
12
+ interface ValidationContextDefinition {
13
+ readonly bind: ValidationContextDefinitionBind;
14
+ }
15
+ export interface ValidationContext extends EvaluationContext, SubscribableDependency {
16
+ readonly definition: ValidationContextDefinition;
17
+ isRelevant(): boolean;
18
+ isRequired(): boolean;
19
+ isBlank(): boolean;
20
+ }
21
+ export {};
@@ -15,8 +15,8 @@ export interface ValueContext<RuntimeValue> extends EvaluationContext {
15
15
  readonly scope: ReactiveScope;
16
16
  readonly definition: ValueContextDefinition;
17
17
  readonly contextNode: Element;
18
- get isReadonly(): boolean;
19
- get isRelevant(): boolean;
18
+ isReadonly(): boolean;
19
+ isRelevant(): boolean;
20
20
  readonly encodeValue: (this: unknown, runtimeValue: RuntimeValue) => InstanceValue;
21
21
  readonly decodeValue: (this: unknown, instanceValue: InstanceValue) => RuntimeValue;
22
22
  }