@getodk/xforms-engine 0.15.0 → 0.16.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 (94) hide show
  1. package/dist/client/AttributeNode.d.ts +2 -5
  2. package/dist/client/BaseNode.d.ts +5 -0
  3. package/dist/client/form/FormInstanceConfig.d.ts +15 -0
  4. package/dist/index.js +395 -231
  5. package/dist/index.js.map +1 -1
  6. package/dist/instance/Attribute.d.ts +17 -11
  7. package/dist/instance/Group.d.ts +0 -2
  8. package/dist/instance/InputControl.d.ts +2 -0
  9. package/dist/instance/PrimaryInstance.d.ts +0 -2
  10. package/dist/instance/Root.d.ts +0 -2
  11. package/dist/instance/UploadControl.d.ts +0 -2
  12. package/dist/instance/abstract/InstanceNode.d.ts +2 -2
  13. package/dist/instance/abstract/ValueNode.d.ts +2 -1
  14. package/dist/instance/attachments/buildAttributes.d.ts +6 -2
  15. package/dist/instance/hierarchy.d.ts +1 -2
  16. package/dist/instance/internal-api/AttributeContext.d.ts +6 -0
  17. package/dist/instance/internal-api/InstanceConfig.d.ts +2 -0
  18. package/dist/instance/internal-api/InstanceValueContext.d.ts +6 -0
  19. package/dist/instance/internal-api/serialization/ClientReactiveSerializableAttributeNode.d.ts +0 -1
  20. package/dist/instance/internal-api/serialization/ClientReactiveSerializableValueNode.d.ts +4 -0
  21. package/dist/instance/repeat/RepeatInstance.d.ts +0 -2
  22. package/dist/lib/codecs/items/SingleValueItemCodec.d.ts +1 -1
  23. package/dist/lib/reactivity/createInstanceValueState.d.ts +4 -1
  24. package/dist/lib/reactivity/node-state/createSharedNodeState.d.ts +2 -2
  25. package/dist/lib/xml-serialization.d.ts +1 -1
  26. package/dist/parse/XFormDOM.d.ts +3 -0
  27. package/dist/parse/expression/ActionComputationExpression.d.ts +4 -0
  28. package/dist/parse/model/ActionDefinition.d.ts +15 -0
  29. package/dist/parse/model/AttributeDefinition.d.ts +3 -1
  30. package/dist/parse/model/BindPreloadDefinition.d.ts +6 -10
  31. package/dist/parse/model/Event.d.ts +8 -0
  32. package/dist/parse/model/LeafNodeDefinition.d.ts +5 -2
  33. package/dist/parse/model/ModelActionMap.d.ts +9 -0
  34. package/dist/parse/model/ModelDefinition.d.ts +8 -1
  35. package/dist/parse/model/NoteNodeDefinition.d.ts +3 -2
  36. package/dist/parse/model/RangeNodeDefinition.d.ts +2 -1
  37. package/dist/parse/model/RootDefinition.d.ts +1 -0
  38. package/dist/solid.js +395 -231
  39. package/dist/solid.js.map +1 -1
  40. package/package.json +21 -17
  41. package/src/client/AttributeNode.ts +2 -5
  42. package/src/client/BaseNode.ts +6 -0
  43. package/src/client/form/FormInstanceConfig.ts +17 -0
  44. package/src/client/validation.ts +1 -1
  45. package/src/entrypoints/FormInstance.ts +1 -0
  46. package/src/instance/Attribute.ts +45 -45
  47. package/src/instance/Group.ts +1 -10
  48. package/src/instance/InputControl.ts +8 -1
  49. package/src/instance/ModelValue.ts +7 -1
  50. package/src/instance/Note.ts +6 -1
  51. package/src/instance/PrimaryInstance.ts +1 -11
  52. package/src/instance/RangeControl.ts +6 -1
  53. package/src/instance/RankControl.ts +7 -1
  54. package/src/instance/Root.ts +1 -10
  55. package/src/instance/SelectControl.ts +6 -1
  56. package/src/instance/TriggerControl.ts +6 -1
  57. package/src/instance/UploadControl.ts +1 -10
  58. package/src/instance/abstract/DescendantNode.ts +0 -5
  59. package/src/instance/abstract/InstanceNode.ts +2 -2
  60. package/src/instance/abstract/ValueNode.ts +2 -1
  61. package/src/instance/attachments/buildAttributes.ts +11 -4
  62. package/src/instance/children/normalizeChildInitOptions.ts +1 -1
  63. package/src/instance/hierarchy.ts +1 -3
  64. package/src/instance/internal-api/AttributeContext.ts +6 -0
  65. package/src/instance/internal-api/InstanceConfig.ts +6 -1
  66. package/src/instance/internal-api/InstanceValueContext.ts +6 -0
  67. package/src/instance/internal-api/serialization/ClientReactiveSerializableAttributeNode.ts +0 -1
  68. package/src/instance/internal-api/serialization/ClientReactiveSerializableValueNode.ts +4 -0
  69. package/src/instance/repeat/RepeatInstance.ts +1 -10
  70. package/src/lib/client-reactivity/instance-state/createValueNodeInstanceState.ts +2 -1
  71. package/src/lib/client-reactivity/instance-state/prepareInstancePayload.ts +1 -0
  72. package/src/lib/codecs/NoteCodec.ts +1 -1
  73. package/src/lib/codecs/items/SingleValueItemCodec.ts +1 -3
  74. package/src/lib/reactivity/createInstanceValueState.ts +152 -53
  75. package/src/lib/reactivity/node-state/createSharedNodeState.ts +2 -2
  76. package/src/lib/xml-serialization.ts +9 -1
  77. package/src/parse/XFormDOM.ts +9 -0
  78. package/src/parse/body/GroupElementDefinition.ts +1 -1
  79. package/src/parse/body/control/InputControlDefinition.ts +1 -1
  80. package/src/parse/expression/ActionComputationExpression.ts +12 -0
  81. package/src/parse/model/ActionDefinition.ts +70 -0
  82. package/src/parse/model/AttributeDefinition.ts +3 -2
  83. package/src/parse/model/AttributeDefinitionMap.ts +1 -1
  84. package/src/parse/model/BindDefinition.ts +1 -6
  85. package/src/parse/model/BindPreloadDefinition.ts +44 -12
  86. package/src/parse/model/Event.ts +9 -0
  87. package/src/parse/model/LeafNodeDefinition.ts +5 -1
  88. package/src/parse/model/ModelActionMap.ts +37 -0
  89. package/src/parse/model/ModelDefinition.ts +18 -3
  90. package/src/parse/model/NoteNodeDefinition.ts +5 -2
  91. package/src/parse/model/RangeNodeDefinition.ts +5 -2
  92. package/src/parse/model/RootDefinition.ts +22 -4
  93. package/dist/lib/reactivity/createAttributeValueState.d.ts +0 -15
  94. package/src/lib/reactivity/createAttributeValueState.ts +0 -189
@@ -12,10 +12,7 @@ import type { InstanceState } from '../client/serialization/InstanceState.ts';
12
12
  import type { AncestorNodeValidationState } from '../client/validation.ts';
13
13
  import type { XFormsXPathElement } from '../integration/xpath/adapter/XFormsXPathNode.ts';
14
14
  import { createRootInstanceState } from '../lib/client-reactivity/instance-state/createRootInstanceState.ts';
15
- import {
16
- createAttributeState,
17
- type AttributeState,
18
- } from '../lib/reactivity/createAttributeState.ts';
15
+ import { createAttributeState } from '../lib/reactivity/createAttributeState.ts';
19
16
  import type { ChildrenState } from '../lib/reactivity/createChildrenState.ts';
20
17
  import { createChildrenState } from '../lib/reactivity/createChildrenState.ts';
21
18
  import type { MaterializedChildren } from '../lib/reactivity/materializeCurrentStateChildren.ts';
@@ -63,7 +60,6 @@ export class Root
63
60
  ClientReactiveSerializableParentNode<GeneralChildNode>
64
61
  {
65
62
  private readonly childrenState: ChildrenState<GeneralChildNode>;
66
- private readonly attributeState: AttributeState;
67
63
 
68
64
  // XFormsXPathElement
69
65
  override readonly [XPathNodeKindKey] = 'element';
@@ -106,7 +102,6 @@ export class Root
106
102
  const attributeState = createAttributeState(this.scope);
107
103
 
108
104
  this.childrenState = childrenState;
109
- this.attributeState = attributeState;
110
105
  this.languages = parent.languages;
111
106
 
112
107
  const state = createSharedNodeState(
@@ -145,10 +140,6 @@ export class Root
145
140
  return this.childrenState.getChildren();
146
141
  }
147
142
 
148
- getAttributes(): readonly Attribute[] {
149
- return this.attributeState.getAttributes();
150
- }
151
-
152
143
  // RootNode
153
144
  setLanguage(language: FormLanguage): Root {
154
145
  this.rootDocument.setLanguage(language);
@@ -14,6 +14,7 @@ import { SelectValueTypeError } from '../error/SelectValueTypeError.ts';
14
14
  import type { XFormsXPathElement } from '../integration/xpath/adapter/XFormsXPathNode.ts';
15
15
  import type { StaticLeafElement } from '../integration/xpath/static-dom/StaticElement.ts';
16
16
  import { getSelectCodec } from '../lib/codecs/getSelectCodec.ts';
17
+ import { createAttributeState } from '../lib/reactivity/createAttributeState.ts';
17
18
  import { createItemCollection } from '../lib/reactivity/createItemCollection.ts';
18
19
  import type { CurrentState } from '../lib/reactivity/node-state/createCurrentState.ts';
19
20
  import type { EngineState } from '../lib/reactivity/node-state/createEngineState.ts';
@@ -26,6 +27,7 @@ import type { SelectType } from '../parse/body/control/SelectControlDefinition.t
26
27
  import type { Root } from './Root.ts';
27
28
  import type { ValueNodeStateSpec } from './abstract/ValueNode.ts';
28
29
  import { ValueNode } from './abstract/ValueNode.ts';
30
+ import { buildAttributes } from './attachments/buildAttributes.ts';
29
31
  import type { GeneralParentNode } from './hierarchy.ts';
30
32
  import type { EvaluationContext } from './internal-api/EvaluationContext.ts';
31
33
  import type { ValidationContext } from './internal-api/ValidationContext.ts';
@@ -108,6 +110,7 @@ export class SelectControl
108
110
 
109
111
  this.appearances = definition.bodyElement.appearances;
110
112
  this.selectType = definition.bodyElement.type;
113
+ const attributeState = createAttributeState(this.scope);
111
114
 
112
115
  const valueOptions = createItemCollection(this);
113
116
 
@@ -153,7 +156,7 @@ export class SelectControl
153
156
  label: createNodeLabel(this, definition),
154
157
  hint: createFieldHint(this, definition),
155
158
  children: null,
156
- attributes: null,
159
+ attributes: attributeState.getAttributes,
157
160
  valueOptions,
158
161
  value: valueState,
159
162
  instanceValue: this.getInstanceValue,
@@ -162,6 +165,8 @@ export class SelectControl
162
165
  this.instanceConfig
163
166
  );
164
167
 
168
+ attributeState.setAttributes(buildAttributes(this));
169
+
165
170
  this.state = state;
166
171
  this.engineState = state.engineState;
167
172
  this.currentState = state.currentState;
@@ -8,6 +8,7 @@ import type { XFormsXPathElement } from '../integration/xpath/adapter/XFormsXPat
8
8
  import type { StaticLeafElement } from '../integration/xpath/static-dom/StaticElement.ts';
9
9
  import type { TriggerInputValue, TriggerRuntimeValue } from '../lib/codecs/TriggerCodec.ts';
10
10
  import { TriggerCodec } from '../lib/codecs/TriggerCodec.ts';
11
+ import { createAttributeState } from '../lib/reactivity/createAttributeState.ts';
11
12
  import type { CurrentState } from '../lib/reactivity/node-state/createCurrentState.ts';
12
13
  import type { EngineState } from '../lib/reactivity/node-state/createEngineState.ts';
13
14
  import type { SharedNodeState } from '../lib/reactivity/node-state/createSharedNodeState.ts';
@@ -17,6 +18,7 @@ import { createNodeLabel } from '../lib/reactivity/text/createNodeLabel.ts';
17
18
  import type { UnknownAppearanceDefinition } from '../parse/body/appearance/unknownAppearanceParser.ts';
18
19
  import type { Root } from './Root.ts';
19
20
  import { ValueNode, type ValueNodeStateSpec } from './abstract/ValueNode.ts';
21
+ import { buildAttributes } from './attachments/buildAttributes.ts';
20
22
  import type { GeneralParentNode } from './hierarchy.ts';
21
23
  import type { EvaluationContext } from './internal-api/EvaluationContext.ts';
22
24
  import type { ValidationContext } from './internal-api/ValidationContext.ts';
@@ -88,6 +90,7 @@ export class TriggerControl
88
90
  super(parent, instanceNode, definition, codec);
89
91
 
90
92
  this.appearances = definition.bodyElement.appearances;
93
+ const attributeState = createAttributeState(this.scope);
91
94
 
92
95
  const state = createSharedNodeState(
93
96
  this.scope,
@@ -100,7 +103,7 @@ export class TriggerControl
100
103
  label: createNodeLabel(this, definition),
101
104
  hint: createFieldHint(this, definition),
102
105
  children: null,
103
- attributes: null,
106
+ attributes: attributeState.getAttributes,
104
107
  valueOptions: null,
105
108
  value: this.valueState,
106
109
  instanceValue: this.getInstanceValue,
@@ -108,6 +111,8 @@ export class TriggerControl
108
111
  this.instanceConfig
109
112
  );
110
113
 
114
+ attributeState.setAttributes(buildAttributes(this));
115
+
111
116
  this.state = state;
112
117
  this.engineState = state.engineState;
113
118
  this.currentState = state.currentState;
@@ -9,10 +9,7 @@ import { UploadValueTypeError } from '../error/UploadValueTypeError.ts';
9
9
  import type { XFormsXPathElement } from '../integration/xpath/adapter/XFormsXPathNode.ts';
10
10
  import type { StaticLeafElement } from '../integration/xpath/static-dom/StaticElement.ts';
11
11
  import { createValueNodeInstanceState } from '../lib/client-reactivity/instance-state/createValueNodeInstanceState.ts';
12
- import {
13
- createAttributeState,
14
- type AttributeState,
15
- } from '../lib/reactivity/createAttributeState.ts';
12
+ import { createAttributeState } from '../lib/reactivity/createAttributeState.ts';
16
13
  import { createInstanceAttachment } from '../lib/reactivity/createInstanceAttachment.ts';
17
14
  import type { CurrentState } from '../lib/reactivity/node-state/createCurrentState.ts';
18
15
  import type { EngineState } from '../lib/reactivity/node-state/createEngineState.ts';
@@ -101,7 +98,6 @@ export class UploadControl
101
98
 
102
99
  private readonly validation: SharedValidationState;
103
100
  private readonly instanceAttachment: InstanceAttachment;
104
- private readonly attributeState: AttributeState;
105
101
 
106
102
  // XFormsXPathElement
107
103
  override readonly [XPathNodeKindKey] = 'element';
@@ -141,7 +137,6 @@ export class UploadControl
141
137
 
142
138
  this.instanceAttachment = instanceAttachment;
143
139
  const attributeState = createAttributeState(this.scope);
144
- this.attributeState = attributeState;
145
140
  this.decodeInstanceValue = instanceAttachment.decodeInstanceValue;
146
141
  this.getXPathValue = instanceAttachment.getInstanceValue;
147
142
 
@@ -191,8 +186,4 @@ export class UploadControl
191
186
 
192
187
  return this.root;
193
188
  }
194
-
195
- getAttributes(): readonly Attribute[] {
196
- return this.attributeState.getAttributes();
197
- }
198
189
  }
@@ -167,11 +167,6 @@ export abstract class DescendantNode<
167
167
  return true;
168
168
  }
169
169
  }
170
- for (const attr of parent.getAttributes()) {
171
- if (attr === self) {
172
- return true;
173
- }
174
- }
175
170
  return false;
176
171
  });
177
172
  });
@@ -240,13 +240,13 @@ export abstract class InstanceNode<
240
240
  * (though for those nodes it will always be empty). This affords consistency
241
241
  * and efficiency of interface for those internal uses.
242
242
  */
243
- abstract getChildren(this: AnyInstanceNode): ReadonlyArray<Exclude<AnyChildNode, Attribute>>;
243
+ abstract getChildren(this: AnyInstanceNode): readonly AnyChildNode[];
244
244
 
245
245
  // XFormsXPathNode
246
246
  /**
247
247
  * @todo Values as text nodes(?)
248
248
  */
249
- getXPathChildNodes(): ReadonlyArray<Exclude<AnyChildNode, Attribute>> {
249
+ getXPathChildNodes(): readonly AnyChildNode[] {
250
250
  return (this as AnyInstanceNode).getChildren().flatMap((child) => {
251
251
  switch (child.nodeType) {
252
252
  case 'repeat-range:controlled':
@@ -21,6 +21,7 @@ import type { SimpleAtomicState } from '../../lib/reactivity/types.ts';
21
21
  import type { SharedValidationState } from '../../lib/reactivity/validation/createValidation.ts';
22
22
  import { createValidationState } from '../../lib/reactivity/validation/createValidation.ts';
23
23
  import { LeafNodeDefinition } from '../../parse/model/LeafNodeDefinition.ts';
24
+ import type { Attribute } from '../Attribute.ts';
24
25
  import type { GeneralParentNode } from '../hierarchy.ts';
25
26
  import type { EvaluationContext } from '../internal-api/EvaluationContext.ts';
26
27
  import type {
@@ -36,7 +37,7 @@ export type ValueNodeDefinition<V extends ValueType> = LeafNodeDefinition<V>;
36
37
 
37
38
  export interface ValueNodeStateSpec<RuntimeValue> extends DescendantNodeStateSpec<RuntimeValue> {
38
39
  readonly children: null;
39
- readonly attributes: null;
40
+ readonly attributes: Accessor<readonly Attribute[]>;
40
41
  readonly value: SimpleAtomicState<RuntimeValue>;
41
42
  readonly instanceValue: Accessor<string>;
42
43
  }
@@ -1,8 +1,15 @@
1
1
  import { Attribute } from '../Attribute';
2
- import type { AnyParentNode } from '../hierarchy';
2
+ import type { AnyNode } from '../hierarchy.ts';
3
+ import type { InputControl } from '../InputControl.ts';
4
+ import type { ModelValue } from '../ModelValue.ts';
5
+ import type { Note } from '../Note.ts';
6
+ import type { RangeControl } from '../RangeControl.ts';
3
7
 
4
- export function buildAttributes(parent: AnyParentNode): Attribute[] {
5
- return Array.from(parent.definition.attributes.values()).map((attributeDefinition) => {
6
- return new Attribute(parent, attributeDefinition, attributeDefinition.template);
8
+ export function buildAttributes(
9
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
+ owner: AnyNode | InputControl<any> | ModelValue<any> | Note<any> | RangeControl<any>
11
+ ): Attribute[] {
12
+ return Array.from(owner.definition.attributes.values()).map((attributeDefinition) => {
13
+ return new Attribute(owner, attributeDefinition, attributeDefinition.template);
7
14
  });
8
15
  }
@@ -217,7 +217,7 @@ const buildDeprecatedIDDefinition = (
217
217
  const nodeset = instanceNode.nodeset;
218
218
  const bind = group.model.binds.getOrCreateBindDefinition(nodeset);
219
219
 
220
- return new LeafNodeDefinition(group.parent.definition, bind, null, instanceNode);
220
+ return new LeafNodeDefinition(group.model, group.parent.definition, bind, null, instanceNode);
221
221
  };
222
222
 
223
223
  const buildDeprecatedID = (
@@ -1,4 +1,3 @@
1
- import type { Attribute } from './Attribute.ts';
2
1
  import type { Group } from './Group.ts';
3
2
  import type { AnyInputControl } from './InputControl.ts';
4
3
  import type { AnyModelValue } from './ModelValue.ts';
@@ -63,8 +62,7 @@ export type AnyChildNode =
63
62
  | RankControl
64
63
  | SelectControl
65
64
  | TriggerControl
66
- | UploadControl
67
- | Attribute;
65
+ | UploadControl;
68
66
 
69
67
  // prettier-ignore
70
68
  export type GeneralChildNode =
@@ -1,12 +1,16 @@
1
+ import type { Accessor } from 'solid-js';
1
2
  import type { FormInstanceInitializationMode } from '../../client/index.ts';
2
3
  import type { StaticAttribute } from '../../integration/xpath/static-dom/StaticAttribute.ts';
3
4
  import type { ReactiveScope } from '../../lib/reactivity/scope.ts';
4
5
  import type { BindComputationExpression } from '../../parse/expression/BindComputationExpression.ts';
5
6
  import type { AnyBindPreloadDefinition } from '../../parse/model/BindPreloadDefinition.ts';
7
+ import type { ModelDefinition } from '../../parse/model/ModelDefinition.ts';
6
8
  import type { EvaluationContext } from './EvaluationContext.ts';
9
+ import type { InstanceConfig } from './InstanceConfig.ts';
7
10
 
8
11
  export interface InstanceAttributeContextDocument {
9
12
  readonly initializationMode: FormInstanceInitializationMode;
13
+ readonly isAttached: Accessor<boolean>;
10
14
  }
11
15
 
12
16
  export type DecodeInstanceValue = (value: string) => string;
@@ -20,6 +24,7 @@ interface InstanceAttributeContextDefinitionBind {
20
24
  export interface InstanceAttributeContextDefinition {
21
25
  readonly bind: InstanceAttributeContextDefinitionBind;
22
26
  readonly template: StaticAttribute;
27
+ readonly model: ModelDefinition;
23
28
  }
24
29
 
25
30
  export interface AttributeContext extends EvaluationContext {
@@ -27,6 +32,7 @@ export interface AttributeContext extends EvaluationContext {
27
32
  readonly rootDocument: InstanceAttributeContextDocument;
28
33
  readonly definition: InstanceAttributeContextDefinition;
29
34
  readonly instanceNode: StaticAttribute;
35
+ readonly instanceConfig: InstanceConfig;
30
36
  readonly decodeInstanceValue: DecodeInstanceValue;
31
37
 
32
38
  isReadonly(): boolean;
@@ -1,5 +1,8 @@
1
1
  import type { InstanceAttachmentFileNameFactory } from '../../client/attachments/InstanceAttachmentsConfig.ts';
2
- import type { FormInstanceConfig } from '../../client/form/FormInstanceConfig.ts';
2
+ import type {
3
+ FormInstanceConfig,
4
+ PreloadProperties,
5
+ } from '../../client/form/FormInstanceConfig.ts';
3
6
  import type { OpaqueReactiveObjectFactory } from '../../client/OpaqueReactiveObjectFactory.ts';
4
7
 
5
8
  export interface InstanceConfig {
@@ -9,4 +12,6 @@ export interface InstanceConfig {
9
12
  readonly clientStateFactory: OpaqueReactiveObjectFactory;
10
13
 
11
14
  readonly computeAttachmentName: InstanceAttachmentFileNameFactory;
15
+
16
+ readonly preloadProperties: PreloadProperties;
12
17
  }
@@ -1,12 +1,16 @@
1
+ import type { Accessor } from 'solid-js';
1
2
  import type { FormInstanceInitializationMode } from '../../client/index.ts';
2
3
  import type { StaticLeafElement } from '../../integration/xpath/static-dom/StaticElement.ts';
3
4
  import type { ReactiveScope } from '../../lib/reactivity/scope.ts';
4
5
  import type { BindComputationExpression } from '../../parse/expression/BindComputationExpression.ts';
5
6
  import type { AnyBindPreloadDefinition } from '../../parse/model/BindPreloadDefinition.ts';
7
+ import type { ModelDefinition } from '../../parse/model/ModelDefinition.ts';
6
8
  import type { EvaluationContext } from './EvaluationContext.ts';
9
+ import type { InstanceConfig } from './InstanceConfig.ts';
7
10
 
8
11
  export interface InstanceValueContextDocument {
9
12
  readonly initializationMode: FormInstanceInitializationMode;
13
+ readonly isAttached: Accessor<boolean>;
10
14
  }
11
15
 
12
16
  export type DecodeInstanceValue = (value: string) => string;
@@ -20,6 +24,7 @@ interface InstanceValueContextDefinitionBind {
20
24
  export interface InstanceValueContextDefinition {
21
25
  readonly bind: InstanceValueContextDefinitionBind;
22
26
  readonly template: StaticLeafElement;
27
+ readonly model: ModelDefinition;
23
28
  }
24
29
 
25
30
  export interface InstanceValueContext extends EvaluationContext {
@@ -27,6 +32,7 @@ export interface InstanceValueContext extends EvaluationContext {
27
32
  readonly rootDocument: InstanceValueContextDocument;
28
33
  readonly definition: InstanceValueContextDefinition;
29
34
  readonly instanceNode: StaticLeafElement | null;
35
+ readonly instanceConfig: InstanceConfig;
30
36
  readonly decodeInstanceValue: DecodeInstanceValue;
31
37
 
32
38
  isReadonly(): boolean;
@@ -4,7 +4,6 @@ import type { QualifiedName } from '../../../lib/names/QualifiedName.ts';
4
4
  export type SerializedInstanceValue = string;
5
5
 
6
6
  interface ClientReactiveSerializableAttributeNodeCurrentState {
7
- get relevant(): boolean;
8
7
  get instanceValue(): SerializedInstanceValue;
9
8
  }
10
9
 
@@ -1,5 +1,7 @@
1
1
  import type { InstanceState } from '../../../client/serialization/InstanceState.ts';
2
2
  import type { QualifiedName } from '../../../lib/names/QualifiedName.ts';
3
+ import type { BindDefinition } from '../../../parse/model/BindDefinition.ts';
4
+ import type { Attribute } from '../../Attribute.ts';
3
5
  import type {
4
6
  ClientReactiveSerializableChildNode,
5
7
  ClientReactiveSerializableParentNode,
@@ -14,10 +16,12 @@ interface ClientReactiveSerializableValueNodeCurrentState {
14
16
  * @todo Consider moving into {@link InstanceState}
15
17
  */
16
18
  get instanceValue(): SerializedInstanceValue;
19
+ get attributes(): readonly Attribute[];
17
20
  }
18
21
 
19
22
  interface ClientReactiveSerializableValueNodeDefinition {
20
23
  readonly qualifiedName: QualifiedName;
24
+ readonly bind: BindDefinition;
21
25
  }
22
26
 
23
27
  export interface ClientReactiveSerializableValueNode {
@@ -13,10 +13,7 @@ import type { AncestorNodeValidationState } from '../../client/validation.ts';
13
13
  import type { XFormsXPathElement } from '../../integration/xpath/adapter/XFormsXPathNode.ts';
14
14
  import type { StaticElement } from '../../integration/xpath/static-dom/StaticElement.ts';
15
15
  import { createTemplatedNodeInstanceState } from '../../lib/client-reactivity/instance-state/createTemplatedNodeInstanceState.ts';
16
- import {
17
- createAttributeState,
18
- type AttributeState,
19
- } from '../../lib/reactivity/createAttributeState.ts';
16
+ import { createAttributeState } from '../../lib/reactivity/createAttributeState.ts';
20
17
  import type { ChildrenState } from '../../lib/reactivity/createChildrenState.ts';
21
18
  import { createChildrenState } from '../../lib/reactivity/createChildrenState.ts';
22
19
  import type { MaterializedChildren } from '../../lib/reactivity/materializeCurrentStateChildren.ts';
@@ -63,7 +60,6 @@ export class RepeatInstance
63
60
  ClientReactiveSerializableTemplatedNode
64
61
  {
65
62
  private readonly childrenState: ChildrenState<GeneralChildNode>;
66
- private readonly attributeState: AttributeState;
67
63
  private readonly currentIndex: Accessor<number>;
68
64
 
69
65
  override readonly [XPathNodeKindKey] = 'element';
@@ -138,7 +134,6 @@ export class RepeatInstance
138
134
  const attributeState = createAttributeState(this.scope);
139
135
 
140
136
  this.childrenState = childrenState;
141
- this.attributeState = attributeState;
142
137
  this.currentIndex = currentIndex;
143
138
 
144
139
  const state = createSharedNodeState(
@@ -197,8 +192,4 @@ export class RepeatInstance
197
192
  getChildren(): readonly GeneralChildNode[] {
198
193
  return this.childrenState.getChildren();
199
194
  }
200
-
201
- getAttributes(): readonly Attribute[] {
202
- return this.attributeState.getAttributes();
203
- }
204
195
  }
@@ -14,8 +14,9 @@ export const createValueNodeInstanceState = (
14
14
  }
15
15
 
16
16
  const xmlValue = escapeXMLText(node.currentState.instanceValue);
17
+ const attributes = node.currentState.attributes;
17
18
 
18
- return serializeLeafElementXML(qualifiedName, xmlValue);
19
+ return serializeLeafElementXML(qualifiedName, xmlValue, attributes);
19
20
  },
20
21
  };
21
22
  };
@@ -208,6 +208,7 @@ export const prepareInstancePayload = <PayloadType extends InstancePayloadType>(
208
208
  instanceRoot: ClientReactiveSerializableInstance,
209
209
  options: PrepareInstancePayloadOptions<PayloadType>
210
210
  ): InstancePayload<PayloadType> => {
211
+ instanceRoot.root.parent.model.triggerXformsRevalidateListeners();
211
212
  const validation = validateInstance(instanceRoot);
212
213
  const submissionMeta = instanceRoot.definition.submission;
213
214
  const instanceFile = new InstanceFile(instanceRoot);
@@ -10,7 +10,7 @@ export type NoteRuntimeValue<V extends ValueType> =
10
10
  // prettier-ignore
11
11
  export type NoteInputValue<V extends ValueType> =
12
12
  | RuntimeInputValue<V>
13
- | RuntimeValue<V>
13
+ | RuntimeValue<V> // eslint-disable-line @typescript-eslint/no-redundant-type-constituents
14
14
  | null;
15
15
 
16
16
  export class NoteCodec<V extends ValueType> extends ValueCodec<
@@ -12,9 +12,7 @@ export type SingleValueSelectRuntimeValues =
12
12
  * @see {@link encodeValueFactory}
13
13
  */
14
14
  // prettier-ignore
15
- type SingleValueSelectCodecValues =
16
- | SingleValueSelectRuntimeValues
17
- | readonly string[];
15
+ type SingleValueSelectCodecValues = readonly string[];
18
16
 
19
17
  /**
20
18
  * @todo This is more permissive than it should be, allowing an array of any