@getodk/xforms-engine 0.2.0 → 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 (184) hide show
  1. package/dist/body/BodyElementDefinition.d.ts +4 -3
  2. package/dist/body/RepeatElementDefinition.d.ts +2 -2
  3. package/dist/body/control/ControlDefinition.d.ts +2 -2
  4. package/dist/body/control/select/ItemDefinition.d.ts +2 -2
  5. package/dist/body/control/select/ItemsetDefinition.d.ts +5 -4
  6. package/dist/body/group/BaseGroupDefinition.d.ts +1 -1
  7. package/dist/body/group/PresentationGroupDefinition.d.ts +1 -1
  8. package/dist/client/BaseNode.d.ts +68 -2
  9. package/dist/client/GroupNode.d.ts +2 -0
  10. package/dist/client/ModelValueNode.d.ts +37 -0
  11. package/dist/client/NoteNode.d.ts +53 -0
  12. package/dist/client/RootNode.d.ts +2 -0
  13. package/dist/client/SelectNode.d.ts +5 -3
  14. package/dist/client/StringNode.d.ts +5 -3
  15. package/dist/client/SubtreeNode.d.ts +2 -0
  16. package/dist/client/TextRange.d.ts +85 -2
  17. package/dist/client/constants.d.ts +9 -0
  18. package/dist/client/hierarchy.d.ts +14 -9
  19. package/dist/client/node-types.d.ts +2 -1
  20. package/dist/client/{RepeatRangeNode.d.ts → repeat/BaseRepeatRangeNode.d.ts} +18 -17
  21. package/dist/client/{RepeatInstanceNode.d.ts → repeat/RepeatInstanceNode.d.ts} +9 -8
  22. package/dist/client/repeat/RepeatRangeControlledNode.d.ts +19 -0
  23. package/dist/client/repeat/RepeatRangeUncontrolledNode.d.ts +20 -0
  24. package/dist/client/validation.d.ts +163 -0
  25. package/dist/expression/DependentExpression.d.ts +12 -8
  26. package/dist/index.d.ts +9 -4
  27. package/dist/index.js +2635 -678
  28. package/dist/index.js.map +1 -1
  29. package/dist/instance/Group.d.ts +3 -1
  30. package/dist/instance/ModelValue.d.ts +40 -0
  31. package/dist/instance/Note.d.ts +42 -0
  32. package/dist/instance/Root.d.ts +2 -0
  33. package/dist/instance/SelectField.d.ts +10 -4
  34. package/dist/instance/StringField.d.ts +11 -5
  35. package/dist/instance/Subtree.d.ts +2 -0
  36. package/dist/instance/abstract/DescendantNode.d.ts +5 -6
  37. package/dist/instance/abstract/InstanceNode.d.ts +2 -0
  38. package/dist/instance/hierarchy.d.ts +10 -5
  39. package/dist/instance/internal-api/ValidationContext.d.ts +21 -0
  40. package/dist/instance/{RepeatRange.d.ts → repeat/BaseRepeatRange.d.ts} +46 -45
  41. package/dist/instance/{RepeatInstance.d.ts → repeat/RepeatInstance.d.ts} +13 -12
  42. package/dist/instance/repeat/RepeatRangeControlled.d.ts +16 -0
  43. package/dist/instance/repeat/RepeatRangeUncontrolled.d.ts +35 -0
  44. package/dist/instance/text/TextRange.d.ts +4 -4
  45. package/dist/lib/reactivity/createComputedExpression.d.ts +6 -1
  46. package/dist/lib/reactivity/createNoteReadonlyThunk.d.ts +5 -0
  47. package/dist/lib/reactivity/node-state/createSharedNodeState.d.ts +1 -1
  48. package/dist/lib/reactivity/node-state/createSpecifiedState.d.ts +1 -1
  49. package/dist/lib/reactivity/text/createFieldHint.d.ts +3 -3
  50. package/dist/lib/reactivity/text/createNodeLabel.d.ts +2 -2
  51. package/dist/lib/reactivity/text/createNoteText.d.ts +25 -0
  52. package/dist/lib/reactivity/text/createTextRange.d.ts +5 -7
  53. package/dist/lib/reactivity/validation/createAggregatedViolations.d.ts +9 -0
  54. package/dist/lib/reactivity/validation/createValidation.d.ts +18 -0
  55. package/dist/model/BindDefinition.d.ts +4 -2
  56. package/dist/model/BindElement.d.ts +1 -0
  57. package/dist/model/{ValueNodeDefinition.d.ts → LeafNodeDefinition.d.ts} +2 -2
  58. package/dist/model/NodeDefinition.d.ts +8 -8
  59. package/dist/model/RepeatInstanceDefinition.d.ts +2 -2
  60. package/dist/model/RepeatRangeDefinition.d.ts +14 -4
  61. package/dist/parse/NoteNodeDefinition.d.ts +31 -0
  62. package/dist/parse/expression/RepeatCountControlExpression.d.ts +19 -0
  63. package/dist/parse/text/HintDefinition.d.ts +9 -0
  64. package/dist/parse/text/ItemLabelDefinition.d.ts +9 -0
  65. package/dist/parse/text/ItemsetLabelDefinition.d.ts +13 -0
  66. package/dist/parse/text/LabelDefinition.d.ts +15 -0
  67. package/dist/parse/text/MessageDefinition.d.ts +15 -0
  68. package/dist/parse/text/OutputChunkDefinition.d.ts +8 -0
  69. package/dist/parse/text/ReferenceChunkDefinition.d.ts +8 -0
  70. package/dist/parse/text/StaticTextChunkDefinition.d.ts +10 -0
  71. package/dist/parse/text/TranslationChunkDefinition.d.ts +9 -0
  72. package/dist/parse/text/abstract/TextChunkDefinition.d.ts +18 -0
  73. package/dist/parse/text/abstract/TextElementDefinition.d.ts +23 -0
  74. package/dist/parse/text/abstract/TextRangeDefinition.d.ts +35 -0
  75. package/dist/parse/xpath/dependency-analysis.d.ts +40 -0
  76. package/dist/parse/xpath/path-resolution.d.ts +70 -0
  77. package/dist/parse/xpath/predicate-analysis.d.ts +30 -0
  78. package/dist/parse/xpath/reference-parsing.d.ts +18 -0
  79. package/dist/parse/xpath/semantic-analysis.d.ts +98 -0
  80. package/dist/parse/xpath/syntax-traversal.d.ts +69 -0
  81. package/dist/solid.js +2636 -679
  82. package/dist/solid.js.map +1 -1
  83. package/package.json +14 -15
  84. package/src/body/BodyElementDefinition.ts +4 -3
  85. package/src/body/RepeatElementDefinition.ts +5 -17
  86. package/src/body/control/ControlDefinition.ts +4 -3
  87. package/src/body/control/select/ItemDefinition.ts +3 -3
  88. package/src/body/control/select/ItemsetDefinition.ts +29 -12
  89. package/src/body/control/select/ItemsetNodesetExpression.ts +1 -1
  90. package/src/body/group/BaseGroupDefinition.ts +3 -2
  91. package/src/body/group/PresentationGroupDefinition.ts +1 -1
  92. package/src/client/BaseNode.ts +73 -7
  93. package/src/client/GroupNode.ts +2 -0
  94. package/src/client/ModelValueNode.ts +40 -0
  95. package/src/client/NoteNode.ts +74 -0
  96. package/src/client/README.md +1 -0
  97. package/src/client/RootNode.ts +2 -0
  98. package/src/client/SelectNode.ts +5 -3
  99. package/src/client/StringNode.ts +5 -3
  100. package/src/client/SubtreeNode.ts +2 -0
  101. package/src/client/TextRange.ts +99 -2
  102. package/src/client/constants.ts +10 -0
  103. package/src/client/hierarchy.ts +30 -14
  104. package/src/client/node-types.ts +8 -1
  105. package/src/client/{RepeatRangeNode.ts → repeat/BaseRepeatRangeNode.ts} +18 -19
  106. package/src/client/{RepeatInstanceNode.ts → repeat/RepeatInstanceNode.ts} +10 -8
  107. package/src/client/repeat/RepeatRangeControlledNode.ts +20 -0
  108. package/src/client/repeat/RepeatRangeUncontrolledNode.ts +21 -0
  109. package/src/client/validation.ts +199 -0
  110. package/src/expression/DependentExpression.ts +45 -27
  111. package/src/index.ts +15 -8
  112. package/src/instance/Group.ts +10 -4
  113. package/src/instance/ModelValue.ts +104 -0
  114. package/src/instance/Note.ts +142 -0
  115. package/src/instance/Root.ts +9 -3
  116. package/src/instance/SelectField.ts +28 -6
  117. package/src/instance/StringField.ts +35 -9
  118. package/src/instance/Subtree.ts +9 -3
  119. package/src/instance/abstract/DescendantNode.ts +6 -7
  120. package/src/instance/abstract/InstanceNode.ts +20 -6
  121. package/src/instance/children.ts +42 -15
  122. package/src/instance/hierarchy.ts +21 -2
  123. package/src/instance/internal-api/ValidationContext.ts +23 -0
  124. package/src/instance/{RepeatRange.ts → repeat/BaseRepeatRange.ts} +114 -99
  125. package/src/instance/{RepeatInstance.ts → repeat/RepeatInstance.ts} +27 -22
  126. package/src/instance/repeat/RepeatRangeControlled.ts +82 -0
  127. package/src/instance/repeat/RepeatRangeUncontrolled.ts +67 -0
  128. package/src/instance/text/TextRange.ts +10 -4
  129. package/src/lib/reactivity/createComputedExpression.ts +22 -24
  130. package/src/lib/reactivity/createNoteReadonlyThunk.ts +33 -0
  131. package/src/lib/reactivity/createSelectItems.ts +21 -14
  132. package/src/lib/reactivity/node-state/createSharedNodeState.ts +1 -1
  133. package/src/lib/reactivity/text/createFieldHint.ts +9 -7
  134. package/src/lib/reactivity/text/createNodeLabel.ts +7 -5
  135. package/src/lib/reactivity/text/createNoteText.ts +72 -0
  136. package/src/lib/reactivity/text/createTextRange.ts +17 -90
  137. package/src/lib/reactivity/validation/createAggregatedViolations.ts +70 -0
  138. package/src/lib/reactivity/validation/createValidation.ts +196 -0
  139. package/src/model/BindComputation.ts +0 -4
  140. package/src/model/BindDefinition.ts +8 -6
  141. package/src/model/BindElement.ts +1 -0
  142. package/src/model/{ValueNodeDefinition.ts → LeafNodeDefinition.ts} +4 -4
  143. package/src/model/ModelBindMap.ts +4 -0
  144. package/src/model/NodeDefinition.ts +12 -12
  145. package/src/model/RepeatInstanceDefinition.ts +2 -2
  146. package/src/model/RepeatRangeDefinition.ts +49 -8
  147. package/src/model/RootDefinition.ts +7 -3
  148. package/src/parse/NoteNodeDefinition.ts +70 -0
  149. package/src/parse/TODO.md +3 -0
  150. package/src/parse/expression/RepeatCountControlExpression.ts +44 -0
  151. package/src/parse/text/HintDefinition.ts +25 -0
  152. package/src/parse/text/ItemLabelDefinition.ts +25 -0
  153. package/src/parse/text/ItemsetLabelDefinition.ts +44 -0
  154. package/src/parse/text/LabelDefinition.ts +61 -0
  155. package/src/parse/text/MessageDefinition.ts +49 -0
  156. package/src/parse/text/OutputChunkDefinition.ts +25 -0
  157. package/src/parse/text/ReferenceChunkDefinition.ts +14 -0
  158. package/src/parse/text/StaticTextChunkDefinition.ts +19 -0
  159. package/src/parse/text/TranslationChunkDefinition.ts +38 -0
  160. package/src/parse/text/abstract/TextChunkDefinition.ts +38 -0
  161. package/src/parse/text/abstract/TextElementDefinition.ts +71 -0
  162. package/src/parse/text/abstract/TextRangeDefinition.ts +70 -0
  163. package/src/parse/xpath/dependency-analysis.ts +105 -0
  164. package/src/parse/xpath/path-resolution.ts +475 -0
  165. package/src/parse/xpath/predicate-analysis.ts +61 -0
  166. package/src/parse/xpath/reference-parsing.ts +90 -0
  167. package/src/parse/xpath/semantic-analysis.ts +466 -0
  168. package/src/parse/xpath/syntax-traversal.ts +129 -0
  169. package/dist/body/text/HintDefinition.d.ts +0 -11
  170. package/dist/body/text/LabelDefinition.d.ts +0 -22
  171. package/dist/body/text/TextElementDefinition.d.ts +0 -33
  172. package/dist/body/text/TextElementOutputPart.d.ts +0 -13
  173. package/dist/body/text/TextElementPart.d.ts +0 -13
  174. package/dist/body/text/TextElementReferencePart.d.ts +0 -7
  175. package/dist/body/text/TextElementStaticPart.d.ts +0 -7
  176. package/dist/lib/xpath/analysis.d.ts +0 -23
  177. package/src/body/text/HintDefinition.ts +0 -26
  178. package/src/body/text/LabelDefinition.ts +0 -68
  179. package/src/body/text/TextElementDefinition.ts +0 -97
  180. package/src/body/text/TextElementOutputPart.ts +0 -27
  181. package/src/body/text/TextElementPart.ts +0 -31
  182. package/src/body/text/TextElementReferencePart.ts +0 -21
  183. package/src/body/text/TextElementStaticPart.ts +0 -26
  184. package/src/lib/xpath/analysis.ts +0 -241
@@ -1,6 +1,7 @@
1
1
  import { Accessor } from 'solid-js';
2
2
  import { GroupDefinition, GroupNode, GroupNodeAppearances } from '../client/GroupNode.ts';
3
- import { TextRange } from '../index.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';
@@ -25,6 +26,7 @@ export declare class Group extends DescendantNode<GroupDefinition, GroupStateSpe
25
26
  readonly nodeType = "group";
26
27
  readonly appearances: GroupNodeAppearances;
27
28
  readonly currentState: MaterializedChildren<CurrentState<GroupStateSpec>, GeneralChildNode>;
29
+ readonly validationState: AncestorNodeValidationState;
28
30
  constructor(parent: GeneralParentNode, definition: GroupDefinition);
29
31
  getChildren(): readonly GeneralChildNode[];
30
32
  }
@@ -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 {};
@@ -4,6 +4,7 @@ import { XFormDOM } from '../XFormDOM.ts';
4
4
  import { BodyClassList } from '../body/BodyDefinition.ts';
5
5
  import { ActiveLanguage, FormLanguage, FormLanguages } from '../client/FormLanguage.ts';
6
6
  import { RootNode } from '../client/RootNode.ts';
7
+ import { AncestorNodeValidationState } from '../client/validation.ts';
7
8
  import { MaterializedChildren } from '../lib/reactivity/materializeCurrentStateChildren.ts';
8
9
  import { CurrentState } from '../lib/reactivity/node-state/createCurrentState.ts';
9
10
  import { EngineState } from '../lib/reactivity/node-state/createEngineState.ts';
@@ -41,6 +42,7 @@ export declare class Root extends InstanceNode<RootDefinition, RootStateSpec, Ge
41
42
  readonly appearances: null;
42
43
  readonly classes: BodyClassList;
43
44
  readonly currentState: MaterializedChildren<CurrentState<RootStateSpec>, GeneralChildNode>;
45
+ readonly validationState: AncestorNodeValidationState;
44
46
  protected readonly instanceDOM: XFormDOM;
45
47
  readonly root: this;
46
48
  readonly evaluator: XFormsXPathEvaluator;
@@ -1,20 +1,22 @@
1
1
  import { Accessor } from 'solid-js';
2
2
  import { AnySelectDefinition } from '../body/control/select/SelectDefinition.ts';
3
3
  import { SelectItem, SelectNode, SelectNodeAppearances } from '../client/SelectNode.ts';
4
- import { TextRange } from '../index.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";
32
35
  readonly appearances: SelectNodeAppearances;
33
36
  readonly currentState: CurrentState<SelectFieldStateSpec>;
37
+ get validationState(): LeafNodeValidationState;
34
38
  readonly encodeValue: (runtimeValue: readonly SelectItem[]) => string;
35
39
  readonly decodeValue: (instanceValue: string) => readonly SelectItem[];
36
40
  protected readonly getValueOptions: Accessor<readonly SelectItem[]>;
37
41
  constructor(parent: GeneralParentNode, definition: SelectFieldDefinition);
42
+ getViolation(): AnyViolation | null;
38
43
  protected getSelectItemsByValue(valueOptions?: readonly SelectItem[]): ReadonlyMap<string, SelectItem>;
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
3
  import { StringNode, StringNodeAppearances } from '../client/StringNode.ts';
4
- import { TextRange } from '../index.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";
31
34
  readonly appearances: StringNodeAppearances;
32
35
  readonly currentState: CurrentState<StringFieldStateSpec>;
36
+ get validationState(): LeafNodeValidationState;
33
37
  readonly encodeValue: (value: string) => string;
34
38
  readonly decodeValue: (value: string) => string;
35
39
  constructor(parent: GeneralParentNode, definition: StringFieldDefinition);
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';
@@ -24,6 +25,7 @@ export declare class Subtree extends DescendantNode<SubtreeDefinition, SubtreeSt
24
25
  readonly nodeType = "subtree";
25
26
  readonly appearances: null;
26
27
  readonly currentState: MaterializedChildren<CurrentState<SubtreeStateSpec>, GeneralChildNode>;
28
+ readonly validationState: AncestorNodeValidationState;
27
29
  constructor(parent: GeneralParentNode, definition: SubtreeDefinition);
28
30
  getChildren(): readonly GeneralChildNode[];
29
31
  }
@@ -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,7 +19,7 @@ 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>;
25
24
  interface DescendantNodeOptions {
26
25
  readonly computeReference?: Accessor<string>;
@@ -34,7 +33,7 @@ export declare abstract class DescendantNode<Definition extends DescendantNodeDe
34
33
  readonly hasNonRelevantAncestor: Accessor<boolean>;
35
34
  readonly isSelfRelevant: Accessor<boolean>;
36
35
  readonly isRelevant: Accessor<boolean>;
37
- protected readonly isRequired: Accessor<boolean>;
36
+ readonly isRequired: Accessor<boolean>;
38
37
  readonly root: Root;
39
38
  readonly evaluator: XFormsXPathEvaluator;
40
39
  readonly contextNode: Element;
@@ -3,6 +3,7 @@ import { Accessor, Signal } from 'solid-js';
3
3
  import { BaseNode } from '../../client/BaseNode.ts';
4
4
  import { NodeAppearances } from '../../client/NodeAppearances.ts';
5
5
  import { InstanceNodeType } from '../../client/node-types.ts';
6
+ import { NodeValidationState } from '../../client/validation.ts';
6
7
  import { TextRange } from '../../index.ts';
7
8
  import { CurrentState } from '../../lib/reactivity/node-state/createCurrentState.ts';
8
9
  import { EngineState } from '../../lib/reactivity/node-state/createEngineState.ts';
@@ -74,6 +75,7 @@ export declare abstract class InstanceNode<Definition extends AnyNodeDefinition,
74
75
  abstract readonly nodeType: InstanceNodeType;
75
76
  abstract readonly appearances: NodeAppearances<Definition>;
76
77
  abstract readonly currentState: InstanceNodeCurrentState<Spec, Child>;
78
+ abstract readonly validationState: NodeValidationState;
77
79
  abstract readonly root: Root;
78
80
  abstract readonly evaluator: XFormsXPathEvaluator;
79
81
  readonly scope: ReactiveScope;
@@ -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;
@@ -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 {};
@@ -1,18 +1,19 @@
1
1
  import { Accessor } from 'solid-js';
2
- import { RepeatRangeNode, RepeatRangeNodeAppearances } from '../client/RepeatRangeNode.ts';
3
- import { MaterializedChildren } from '../lib/reactivity/materializeCurrentStateChildren.ts';
4
- import { CurrentState } from '../lib/reactivity/node-state/createCurrentState.ts';
5
- import { EngineState } from '../lib/reactivity/node-state/createEngineState.ts';
6
- import { SharedNodeState } from '../lib/reactivity/node-state/createSharedNodeState.ts';
7
- import { RepeatRangeDefinition } from '../model/RepeatRangeDefinition.ts';
8
- import { RepeatDefinition, RepeatInstance } from './RepeatInstance.ts';
9
- import { Root } from './Root.ts';
10
- import { DescendantNodeSharedStateSpec, DescendantNode } from './abstract/DescendantNode.ts';
11
- import { GeneralParentNode } from './hierarchy.ts';
12
- import { NodeID } from './identity.ts';
13
- import { EvaluationContext } from './internal-api/EvaluationContext.ts';
14
- import { SubscribableDependency } from './internal-api/SubscribableDependency.ts';
15
- import { TextRange } from './text/TextRange.ts';
2
+ import { NodeAppearances } from '../../client/NodeAppearances.ts';
3
+ import { BaseRepeatRangeNode } from '../../client/repeat/BaseRepeatRangeNode.ts';
4
+ import { TextRange } from '../../client/TextRange.ts';
5
+ import { AncestorNodeValidationState } from '../../client/validation.ts';
6
+ import { ChildrenState } from '../../lib/reactivity/createChildrenState.ts';
7
+ import { MaterializedChildren } from '../../lib/reactivity/materializeCurrentStateChildren.ts';
8
+ import { CurrentState } from '../../lib/reactivity/node-state/createCurrentState.ts';
9
+ import { EngineState } from '../../lib/reactivity/node-state/createEngineState.ts';
10
+ import { SharedNodeState } from '../../lib/reactivity/node-state/createSharedNodeState.ts';
11
+ import { AnyRepeatRangeDefinition, ControlledRepeatRangeDefinition } from '../../model/RepeatRangeDefinition.ts';
12
+ import { DescendantNodeParent, DescendantNodeSharedStateSpec, DescendantNode } from '../abstract/DescendantNode.ts';
13
+ import { NodeID } from '../identity.ts';
14
+ import { EvaluationContext } from '../internal-api/EvaluationContext.ts';
15
+ import { SubscribableDependency } from '../internal-api/SubscribableDependency.ts';
16
+ import { RepeatInstance, RepeatDefinition } from './RepeatInstance.ts';
16
17
 
17
18
  interface RepeatRangeStateSpec extends DescendantNodeSharedStateSpec {
18
19
  readonly hint: null;
@@ -21,7 +22,8 @@ interface RepeatRangeStateSpec extends DescendantNodeSharedStateSpec {
21
22
  readonly valueOptions: null;
22
23
  readonly value: null;
23
24
  }
24
- export declare class RepeatRange extends DescendantNode<RepeatRangeDefinition, RepeatRangeStateSpec, RepeatInstance> implements RepeatRangeNode, EvaluationContext, SubscribableDependency {
25
+ type BaseRepeatRangeNodeType<Definition extends AnyRepeatRangeDefinition> = Definition extends ControlledRepeatRangeDefinition ? 'repeat-range:controlled' : 'repeat-range:uncontrolled';
26
+ export declare abstract class BaseRepeatRange<Definition extends AnyRepeatRangeDefinition> extends DescendantNode<Definition, RepeatRangeStateSpec, RepeatInstance> implements BaseRepeatRangeNode, EvaluationContext, SubscribableDependency {
25
27
  /**
26
28
  * A repeat range doesn't have a corresponding primary instance element of its
27
29
  * own, and its instances are appended to the range's parent element. During
@@ -44,8 +46,27 @@ export declare class RepeatRange extends DescendantNode<RepeatRangeDefinition, R
44
46
  * {@link https://developer.mozilla.org/en-US/docs/Web/API/Range | DOM Range}
45
47
  * instead?
46
48
  */
47
- private readonly anchorNode;
48
- private readonly childrenState;
49
+ protected readonly anchorNode: Comment;
50
+ protected readonly childrenState: ChildrenState<RepeatInstance>;
51
+ /**
52
+ * Provides an {@link EvaluationContext} from which to evaluate expressions
53
+ * where some LocationPath sub-expressions may be **relative to the repeat
54
+ * range itself**. This is useful for evaluation of expressions where:
55
+ *
56
+ * - the expression is typically contextualized to any of its
57
+ * {@link RepeatInstance} children, but it presently has none (i.e.
58
+ * `relevant`)
59
+ *
60
+ * - the expression is conceptually intended to be evaluated in the context of
61
+ * the repeat range itself (i.e. `jr:count`)
62
+ */
63
+ protected readonly selfEvaluationContext: EvaluationContext & {
64
+ readonly contextNode: Comment;
65
+ };
66
+ /**
67
+ * @see {@link isSelfRelevant}
68
+ */
69
+ protected readonly isEmptyRangeSelfRelevant: Accessor<boolean>;
49
70
  protected readonly state: SharedNodeState<RepeatRangeStateSpec>;
50
71
  protected engineState: EngineState<RepeatRangeStateSpec>;
51
72
  /**
@@ -55,11 +76,6 @@ export declare class RepeatRange extends DescendantNode<RepeatRangeDefinition, R
55
76
  * @see {@link isSelfRelevant}
56
77
  */
57
78
  isSelfReadonly: Accessor<boolean>;
58
- private readonly emptyRangeEvaluationContext;
59
- /**
60
- * @see {@link isSelfRelevant}
61
- */
62
- private readonly isEmptyRangeSelfRelevant;
63
79
  /**
64
80
  * A repeat range does not exist in the primary instance tree. A `relevant`
65
81
  * expression applies to each {@link RepeatInstance} child of the repeat
@@ -94,7 +110,7 @@ export declare class RepeatRange extends DescendantNode<RepeatRangeDefinition, R
94
110
  * theory it could vary depending on form structure and runtime state).
95
111
  */
96
112
  readonly isSelfRelevant: Accessor<boolean>;
97
- readonly nodeType = "repeat-range";
113
+ abstract readonly nodeType: BaseRepeatRangeNodeType<Definition>;
98
114
  /**
99
115
  * @todo RepeatRange*, RepeatInstance* (and RepeatTemplate*) all share the
100
116
  * same body element, and thus all share the same definition `bodyElement`. As
@@ -128,31 +144,16 @@ export declare class RepeatRange extends DescendantNode<RepeatRangeDefinition, R
128
144
  * All of the above creates considerable ambiguity about where "repeat
129
145
  * appearances" should apply, under which circumstances.
130
146
  */
131
- readonly appearances: RepeatRangeNodeAppearances;
147
+ abstract readonly appearances: NodeAppearances<Definition>;
132
148
  readonly currentState: MaterializedChildren<CurrentState<RepeatRangeStateSpec>, RepeatInstance>;
133
- constructor(parent: GeneralParentNode, definition: RepeatRangeDefinition);
134
- private getLastIndex;
149
+ abstract readonly validationState: AncestorNodeValidationState;
150
+ constructor(parent: DescendantNodeParent<Definition>, definition: Definition);
151
+ protected getLastIndex(): number;
135
152
  protected initializeContextNode(parentContextNode: Element): Element;
136
153
  getInstanceIndex(instance: RepeatInstance): number;
137
- addInstances(afterIndex?: number, count?: number, definition?: RepeatDefinition): Root;
138
- /**
139
- * Removes the {@link RepeatInstance}s corresponding to the specified range of
140
- * indexes, and then removes those repeat instances from the repeat range's
141
- * own children state in that order:
142
- *
143
- * 1. Identify the set of {@link RepeatInstance}s to be removed.
144
- *
145
- * 2. For each {@link RepeatInstance} pending removal, perform that node's
146
- * removal logic. @see {@link RepeatInstance.remove} for more detail.
147
- *
148
- * 3. Finalize update to the repeat range's own {@link childrenState},
149
- * omitting those {@link RepeatInstance}s which were removed.
150
- *
151
- * This ordering ensures a consistent representation of state is established
152
- * prior to any downstream reactive updates, and ensures that removed nodes'
153
- * reactivity is cleaned up.
154
- */
155
- removeInstances(startIndex: number, count?: number): Root;
154
+ private createChildren;
155
+ protected addChildren(afterIndex: number, definitions: readonly RepeatDefinition[]): readonly RepeatInstance[];
156
+ protected removeChildren(startIndex: number, count: number): readonly RepeatInstance[];
156
157
  subscribe(): void;
157
158
  getChildren(): readonly RepeatInstance[];
158
159
  }
@@ -1,16 +1,16 @@
1
1
  import { Accessor } from 'solid-js';
2
- import { RepeatDefinition, RepeatInstanceNode, RepeatInstanceNodeAppearances } from '../client/RepeatInstanceNode.ts';
3
- import { TextRange } from '../index.ts';
4
- import { MaterializedChildren } from '../lib/reactivity/materializeCurrentStateChildren.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 { RepeatRange } from './RepeatRange.ts';
9
- import { DescendantNodeSharedStateSpec, DescendantNode } from './abstract/DescendantNode.ts';
10
- import { AnyChildNode, GeneralChildNode } from './hierarchy.ts';
11
- import { NodeID } from './identity.ts';
12
- import { EvaluationContext } from './internal-api/EvaluationContext.ts';
13
- import { SubscribableDependency } from './internal-api/SubscribableDependency.ts';
2
+ import { RepeatDefinition, RepeatInstanceNode, RepeatInstanceNodeAppearances } from '../../client/repeat/RepeatInstanceNode.ts';
3
+ import { TextRange } from '../../client/TextRange.ts';
4
+ import { AncestorNodeValidationState } from '../../client/validation.ts';
5
+ import { MaterializedChildren } from '../../lib/reactivity/materializeCurrentStateChildren.ts';
6
+ import { CurrentState } from '../../lib/reactivity/node-state/createCurrentState.ts';
7
+ import { EngineState } from '../../lib/reactivity/node-state/createEngineState.ts';
8
+ import { SharedNodeState } from '../../lib/reactivity/node-state/createSharedNodeState.ts';
9
+ import { DescendantNodeSharedStateSpec, DescendantNode } from '../abstract/DescendantNode.ts';
10
+ import { AnyChildNode, GeneralChildNode, RepeatRange } from '../hierarchy.ts';
11
+ import { NodeID } from '../identity.ts';
12
+ import { EvaluationContext } from '../internal-api/EvaluationContext.ts';
13
+ import { SubscribableDependency } from '../internal-api/SubscribableDependency.ts';
14
14
 
15
15
  export type { RepeatDefinition };
16
16
  interface RepeatInstanceStateSpec extends DescendantNodeSharedStateSpec {
@@ -57,6 +57,7 @@ export declare class RepeatInstance extends DescendantNode<RepeatDefinition, Rep
57
57
  */
58
58
  readonly appearances: RepeatInstanceNodeAppearances;
59
59
  readonly currentState: MaterializedChildren<CurrentState<RepeatInstanceStateSpec>, GeneralChildNode>;
60
+ readonly validationState: AncestorNodeValidationState;
60
61
  constructor(parent: RepeatRange, definition: RepeatDefinition, options: RepeatInstanceOptions);
61
62
  protected initializeContextNode(parentContextNode: Element, nodeName: string): Element;
62
63
  subscribe(): void;
@@ -0,0 +1,16 @@
1
+ import { RepeatRangeNodeAppearances } from '../../client/repeat/BaseRepeatRangeNode.ts';
2
+ import { RepeatRangeControlledNode } from '../../client/repeat/RepeatRangeControlledNode.ts';
3
+ import { AncestorNodeValidationState } from '../../client/validation.ts';
4
+ import { ControlledRepeatRangeDefinition } from '../../model/RepeatRangeDefinition.ts';
5
+ import { GeneralParentNode } from '../hierarchy.ts';
6
+ import { EvaluationContext } from '../internal-api/EvaluationContext.ts';
7
+ import { SubscribableDependency } from '../internal-api/SubscribableDependency.ts';
8
+ import { BaseRepeatRange } from './BaseRepeatRange.ts';
9
+
10
+ export declare class RepeatRangeControlled extends BaseRepeatRange<ControlledRepeatRangeDefinition> implements RepeatRangeControlledNode, EvaluationContext, SubscribableDependency {
11
+ readonly nodeType = "repeat-range:controlled";
12
+ readonly appearances: RepeatRangeNodeAppearances;
13
+ readonly validationState: AncestorNodeValidationState;
14
+ constructor(parent: GeneralParentNode, definition: ControlledRepeatRangeDefinition);
15
+ private initializeControlledChildrenState;
16
+ }
@@ -0,0 +1,35 @@
1
+ import { RepeatRangeNodeAppearances } from '../../client/repeat/BaseRepeatRangeNode.ts';
2
+ import { RepeatRangeUncontrolledNode } from '../../client/repeat/RepeatRangeUncontrolledNode.ts';
3
+ import { AncestorNodeValidationState } from '../../client/validation.ts';
4
+ import { UncontrolledRepeatRangeDefinition } from '../../model/RepeatRangeDefinition.ts';
5
+ import { GeneralParentNode } from '../hierarchy.ts';
6
+ import { EvaluationContext } from '../internal-api/EvaluationContext.ts';
7
+ import { SubscribableDependency } from '../internal-api/SubscribableDependency.ts';
8
+ import { Root } from '../Root.ts';
9
+ import { BaseRepeatRange } from './BaseRepeatRange.ts';
10
+
11
+ export declare class RepeatRangeUncontrolled extends BaseRepeatRange<UncontrolledRepeatRangeDefinition> implements RepeatRangeUncontrolledNode, EvaluationContext, SubscribableDependency {
12
+ readonly nodeType = "repeat-range:uncontrolled";
13
+ readonly appearances: RepeatRangeNodeAppearances;
14
+ readonly validationState: AncestorNodeValidationState;
15
+ constructor(parent: GeneralParentNode, definition: UncontrolledRepeatRangeDefinition);
16
+ addInstances(afterIndex?: number, count?: number): Root;
17
+ /**
18
+ * Removes the {@link RepeatInstance}s corresponding to the specified range of
19
+ * indexes, and then removes those repeat instances from the repeat range's
20
+ * own children state in that order:
21
+ *
22
+ * 1. Identify the set of {@link RepeatInstance}s to be removed.
23
+ *
24
+ * 2. For each {@link RepeatInstance} pending removal, perform that node's
25
+ * removal logic. @see {@link RepeatInstance.remove} for more detail.
26
+ *
27
+ * 3. Finalize update to the repeat range's own {@link childrenState},
28
+ * omitting those {@link RepeatInstance}s which were removed.
29
+ *
30
+ * This ordering ensures a consistent representation of state is established
31
+ * prior to any downstream reactive updates, and ensures that removed nodes'
32
+ * reactivity is cleaned up.
33
+ */
34
+ removeInstances(startIndex: number, count?: number): Root;
35
+ }
@@ -1,11 +1,11 @@
1
- import { TextRange as ClientTextRange, TextChunk } from '../../client/TextRange.ts';
1
+ import { TextRange as ClientTextRange, TextChunk, TextOrigin, TextRole } from '../../client/TextRange.ts';
2
2
 
3
- export type TextRole = 'hint' | 'label';
4
- export declare class TextRange<Role extends TextRole> implements ClientTextRange<Role> {
3
+ export declare class TextRange<Role extends TextRole, Origin extends TextOrigin> implements ClientTextRange<Role, Origin> {
4
+ readonly origin: Origin;
5
5
  readonly role: Role;
6
6
  protected readonly chunks: readonly TextChunk[];
7
7
  [Symbol.iterator](): Generator<TextChunk, void, undefined>;
8
8
  get formatted(): Record<PropertyKey, unknown>;
9
9
  get asString(): string;
10
- constructor(role: Role, chunks: readonly TextChunk[]);
10
+ constructor(origin: Origin, role: Role, chunks: readonly TextChunk[]);
11
11
  }
@@ -1,13 +1,18 @@
1
1
  import { Accessor } from 'solid-js';
2
2
  import { DependentExpression, DependentExpressionResultType } from '../../expression/DependentExpression.ts';
3
3
  import { EvaluationContext } from '../../instance/internal-api/EvaluationContext.ts';
4
+ import { SubscribableDependency } from '../../instance/internal-api/SubscribableDependency.ts';
4
5
 
5
6
  interface ComputedExpressionResults {
6
7
  readonly boolean: boolean;
7
8
  readonly nodes: Node[];
9
+ readonly number: number;
8
10
  readonly string: string;
9
11
  }
10
12
  type EvaluatedExpression<Type extends DependentExpressionResultType> = ComputedExpressionResults[Type];
11
13
  type ComputedExpression<Type extends DependentExpressionResultType> = Accessor<EvaluatedExpression<Type>>;
12
- export declare const createComputedExpression: <Type extends "string" | "boolean" | "nodes">(context: EvaluationContext, dependentExpression: DependentExpression<Type>) => ComputedExpression<Type>;
14
+ interface CreateComputedExpressionOptions {
15
+ readonly arbitraryDependencies?: readonly SubscribableDependency[];
16
+ }
17
+ export declare const createComputedExpression: <Type extends DependentExpressionResultType>(context: EvaluationContext, dependentExpression: DependentExpression<Type>, options?: CreateComputedExpressionOptions) => ComputedExpression<Type>;
13
18
  export {};
@@ -0,0 +1,5 @@
1
+ import { Accessor } from 'solid-js';
2
+ import { EvaluationContext } from '../../instance/internal-api/EvaluationContext.ts';
3
+ import { BindComputation } from '../../model/BindComputation.ts';
4
+
5
+ export declare const createNoteReadonlyThunk: (context: EvaluationContext, readonlyDefinition: BindComputation<"readonly">) => Accessor<true>;
@@ -16,7 +16,7 @@ export interface SharedNodeState<Spec extends StateSpec> {
16
16
  readonly currentState: CurrentState<Spec>;
17
17
  readonly setProperty: SetEnginePropertyState<Spec>;
18
18
  }
19
- interface SharedNodeStateOptions<Factory extends OpaqueReactiveObjectFactory, Spec extends StateSpec> {
19
+ export interface SharedNodeStateOptions<Factory extends OpaqueReactiveObjectFactory, Spec extends StateSpec> {
20
20
  readonly clientStateFactory: SpecifiedClientStateFactory<Factory, Spec>;
21
21
  }
22
22
  export declare const createSharedNodeState: <Factory extends OpaqueReactiveObjectFactory, Spec extends StateSpec>(scope: ReactiveScope, spec: Spec, options: SharedNodeStateOptions<Factory, Spec>) => SharedNodeState<Spec>;