@getodk/xforms-engine 0.14.0 → 0.15.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 (87) hide show
  1. package/dist/client/AttributeNode.d.ts +53 -0
  2. package/dist/client/index.d.ts +1 -0
  3. package/dist/client/node-types.d.ts +1 -1
  4. package/dist/client/validation.d.ts +7 -1
  5. package/dist/index.js +436 -164
  6. package/dist/index.js.map +1 -1
  7. package/dist/instance/Attribute.d.ts +58 -0
  8. package/dist/instance/Group.d.ts +4 -0
  9. package/dist/instance/PrimaryInstance.d.ts +4 -0
  10. package/dist/instance/Root.d.ts +4 -0
  11. package/dist/instance/UploadControl.d.ts +4 -0
  12. package/dist/instance/abstract/InstanceNode.d.ts +7 -4
  13. package/dist/instance/abstract/ValueNode.d.ts +1 -0
  14. package/dist/instance/attachments/buildAttributes.d.ts +3 -0
  15. package/dist/instance/hierarchy.d.ts +2 -1
  16. package/dist/instance/internal-api/AttributeContext.d.ts +29 -0
  17. package/dist/instance/internal-api/serialization/ClientReactiveSerializableAttributeNode.d.ts +16 -0
  18. package/dist/instance/internal-api/serialization/ClientReactiveSerializableParentNode.d.ts +2 -0
  19. package/dist/instance/internal-api/serialization/ClientReactiveSerializableTemplatedNode.d.ts +2 -2
  20. package/dist/instance/repeat/BaseRepeatRange.d.ts +5 -0
  21. package/dist/instance/repeat/RepeatInstance.d.ts +4 -2
  22. package/dist/integration/xpath/adapter/XFormsXPathNode.d.ts +2 -2
  23. package/dist/lib/client-reactivity/instance-state/createAttributeNodeInstanceState.d.ts +3 -0
  24. package/dist/lib/client-reactivity/instance-state/createTemplatedNodeInstanceState.d.ts +0 -3
  25. package/dist/lib/names/NamespaceDeclarationMap.d.ts +1 -1
  26. package/dist/lib/reactivity/createAttributeState.d.ts +16 -0
  27. package/dist/lib/reactivity/createAttributeValueState.d.ts +15 -0
  28. package/dist/lib/xml-serialization.d.ts +5 -9
  29. package/dist/parse/XFormDOM.d.ts +1 -1
  30. package/dist/parse/model/AttributeDefinition.d.ts +22 -0
  31. package/dist/parse/model/{RootAttributeMap.d.ts → AttributeDefinitionMap.d.ts} +4 -10
  32. package/dist/parse/model/GroupDefinition.d.ts +4 -1
  33. package/dist/parse/model/LeafNodeDefinition.d.ts +1 -0
  34. package/dist/parse/model/NodeDefinition.d.ts +8 -3
  35. package/dist/parse/model/RepeatDefinition.d.ts +4 -1
  36. package/dist/parse/model/RootDefinition.d.ts +2 -2
  37. package/dist/solid.js +436 -164
  38. package/dist/solid.js.map +1 -1
  39. package/package.json +5 -5
  40. package/src/client/AttributeNode.ts +62 -0
  41. package/src/client/index.ts +1 -0
  42. package/src/client/node-types.ts +1 -0
  43. package/src/client/validation.ts +9 -1
  44. package/src/instance/Attribute.ts +164 -0
  45. package/src/instance/Group.ts +16 -0
  46. package/src/instance/InputControl.ts +1 -0
  47. package/src/instance/ModelValue.ts +1 -0
  48. package/src/instance/Note.ts +1 -0
  49. package/src/instance/PrimaryInstance.ts +17 -0
  50. package/src/instance/RangeControl.ts +1 -0
  51. package/src/instance/RankControl.ts +1 -0
  52. package/src/instance/Root.ts +16 -0
  53. package/src/instance/SelectControl.ts +1 -0
  54. package/src/instance/TriggerControl.ts +1 -0
  55. package/src/instance/UploadControl.ts +14 -0
  56. package/src/instance/abstract/DescendantNode.ts +5 -1
  57. package/src/instance/abstract/InstanceNode.ts +6 -3
  58. package/src/instance/abstract/ValueNode.ts +1 -0
  59. package/src/instance/attachments/buildAttributes.ts +8 -0
  60. package/src/instance/hierarchy.ts +3 -1
  61. package/src/instance/internal-api/AttributeContext.ts +34 -0
  62. package/src/instance/internal-api/serialization/ClientReactiveSerializableAttributeNode.ts +19 -0
  63. package/src/instance/internal-api/serialization/ClientReactiveSerializableParentNode.ts +2 -0
  64. package/src/instance/internal-api/serialization/ClientReactiveSerializableTemplatedNode.ts +2 -3
  65. package/src/instance/repeat/BaseRepeatRange.ts +14 -0
  66. package/src/instance/repeat/RepeatInstance.ts +14 -5
  67. package/src/integration/xpath/adapter/XFormsXPathNode.ts +3 -1
  68. package/src/lib/client-reactivity/instance-state/createAttributeNodeInstanceState.ts +16 -0
  69. package/src/lib/client-reactivity/instance-state/createParentNodeInstanceState.ts +5 -5
  70. package/src/lib/client-reactivity/instance-state/createRootInstanceState.ts +6 -9
  71. package/src/lib/client-reactivity/instance-state/createTemplatedNodeInstanceState.ts +5 -15
  72. package/src/lib/names/NamespaceDeclarationMap.ts +1 -1
  73. package/src/lib/reactivity/createAttributeState.ts +51 -0
  74. package/src/lib/reactivity/createAttributeValueState.ts +189 -0
  75. package/src/lib/xml-serialization.ts +30 -34
  76. package/src/parse/model/AttributeDefinition.ts +58 -0
  77. package/src/parse/model/{RootAttributeMap.ts → AttributeDefinitionMap.ts} +7 -13
  78. package/src/parse/model/GroupDefinition.ts +6 -0
  79. package/src/parse/model/LeafNodeDefinition.ts +1 -0
  80. package/src/parse/model/NodeDefinition.ts +11 -3
  81. package/src/parse/model/RepeatDefinition.ts +8 -1
  82. package/src/parse/model/RootDefinition.ts +5 -5
  83. package/src/parse/model/nodeDefinitionMap.ts +1 -1
  84. package/dist/error/TemplatedNodeAttributeSerializationError.d.ts +0 -22
  85. package/dist/parse/model/RootAttributeDefinition.d.ts +0 -21
  86. package/src/error/TemplatedNodeAttributeSerializationError.ts +0 -24
  87. package/src/parse/model/RootAttributeDefinition.ts +0 -44
package/dist/index.js CHANGED
@@ -7899,7 +7899,7 @@ const sn$1 = /*@__PURE__*/new WeakMap(),
7899
7899
  epochMilliseconds: I$1,
7900
7900
  epochNanoseconds: v$1
7901
7901
  },
7902
- [wn$1, In$1, vn$1] = createSlotClass$1(N$1, j$1, {
7902
+ [wn$1, In$1] = createSlotClass$1(N$1, j$1, {
7903
7903
  ...gn$1,
7904
7904
  blank: y$1
7905
7905
  }, {
@@ -7984,7 +7984,7 @@ const sn$1 = /*@__PURE__*/new WeakMap(),
7984
7984
  from: (t, e) => En$1(toPlainDateTimeSlots$1(t, e)),
7985
7985
  compare: (t, e) => Yt$1(toPlainDateTimeSlots$1(t), toPlainDateTimeSlots$1(e))
7986
7986
  }),
7987
- [Ln$1, Vn$1, Jn$1] = createSlotClass$1(qt$1, Pt$1(kt$1, Mt$1), {
7987
+ [Ln$1, Vn$1] = createSlotClass$1(qt$1, Pt$1(kt$1, Mt$1), {
7988
7988
  ...Pn$1,
7989
7989
  ...Dn$1
7990
7990
  }, {
@@ -8003,7 +8003,7 @@ const sn$1 = /*@__PURE__*/new WeakMap(),
8003
8003
  }, {
8004
8004
  from: (t, e) => Vn$1(toPlainMonthDaySlots$1(t, e))
8005
8005
  }),
8006
- [kn$1, qn$1, Rn$1] = createSlotClass$1(Ut$1, Pt$1(Qt$1, Mt$1), {
8006
+ [kn$1, qn$1] = createSlotClass$1(Ut$1, Pt$1(Qt$1, Mt$1), {
8007
8007
  ...Pn$1,
8008
8008
  ...hn$1
8009
8009
  }, {
@@ -8027,7 +8027,7 @@ const sn$1 = /*@__PURE__*/new WeakMap(),
8027
8027
  from: (t, e) => qn$1(toPlainYearMonthSlots$1(t, e)),
8028
8028
  compare: (t, e) => te$1(toPlainYearMonthSlots$1(t), toPlainYearMonthSlots$1(e))
8029
8029
  }),
8030
- [xn$1, Wn$1, Gn$1] = createSlotClass$1(G$1, Pt$1(ue$1, Mt$1), {
8030
+ [xn$1, Wn$1] = createSlotClass$1(G$1, Pt$1(ue$1, Mt$1), {
8031
8031
  ...Pn$1,
8032
8032
  ...Tn$1
8033
8033
  }, {
@@ -8110,7 +8110,7 @@ const sn$1 = /*@__PURE__*/new WeakMap(),
8110
8110
  from: (t, e) => $n$1(toZonedDateTimeSlots$1(t, e)),
8111
8111
  compare: (t, e) => Be$1(toZonedDateTimeSlots$1(t), toZonedDateTimeSlots$1(e))
8112
8112
  }),
8113
- [Hn$1, Kn$1, Qn$1] = createSlotClass$1(Re$1, qe$1, On$1, {
8113
+ [Hn$1, Kn$1] = createSlotClass$1(Re$1, qe$1, On$1, {
8114
8114
  add: (t, e) => Kn$1(Ye$1(0, t, toDurationSlots$1(e))),
8115
8115
  subtract: (t, e) => Kn$1(Ye$1(1, t, toDurationSlots$1(e))),
8116
8116
  until: (t, e, n) => In$1(Ee$1(0, t, toInstantSlots$1(e), n)),
@@ -21900,7 +21900,7 @@ const collectDefinitions = (result, definition) => {
21900
21900
  throw new ErrorProductionDesignPendingError();
21901
21901
  }
21902
21902
  result.set(nodeset, definition);
21903
- if (definition.type === "leaf-node") {
21903
+ if (definition.type === "leaf-node" || definition.type === "attribute") {
21904
21904
  return result;
21905
21905
  }
21906
21906
  for (const child of definition.children) {
@@ -21955,33 +21955,33 @@ const serializeElementNamespaceDeclarationXML = (namespaceDeclarations) => {
21955
21955
  });
21956
21956
  }).join("");
21957
21957
  };
21958
- const serializeElementAttributeXML = (attributes) => {
21959
- if (attributes == null) {
21960
- return "";
21961
- }
21962
- return attributes.map((attribute) => {
21963
- return attribute.serializeAttributeXML();
21964
- }).join("");
21965
- };
21966
- const serializeElementXML = (qualifiedName, children, options = {}) => {
21958
+ const serializeElementXML = (qualifiedName, children, attributes, namespaceDeclarations) => {
21967
21959
  const nodeName = qualifiedName.getPrefixedName(
21968
21960
  // options.namespaceDeclarations
21969
21961
  );
21970
- const namespaceDeclarations = serializeElementNamespaceDeclarationXML(
21971
- options.namespaceDeclarations
21972
- );
21973
- const attributes = serializeElementAttributeXML(options.attributes);
21974
- const prefix = `<${nodeName}${namespaceDeclarations}${attributes}`;
21962
+ const serializedNamespaceDeclarations = serializeElementNamespaceDeclarationXML(namespaceDeclarations);
21963
+ const prefix = `<${nodeName}${serializedNamespaceDeclarations}${attributes}`;
21975
21964
  if (children === "") {
21976
21965
  return `${prefix}/>`;
21977
21966
  }
21978
21967
  return `${prefix}>${children}</${nodeName}>`;
21979
21968
  };
21980
- const serializeParentElementXML = (qualifiedName, serializedChildren, options) => {
21981
- return serializeElementXML(qualifiedName, serializedChildren.join(""), options);
21969
+ const serializeAttributeXML = (qualifiedName, xmlValue) => {
21970
+ const nodeName = qualifiedName.getPrefixedName();
21971
+ return ` ${nodeName}="${xmlValue.normalize()}"`;
21972
+ };
21973
+ const serializeParentElementXML = (qualifiedName, children, attributes, namespaceDeclarations) => {
21974
+ const serializedChildren = children.map((child) => child.instanceState.instanceXML).join("");
21975
+ const serializedAttributes = attributes.map((attribute) => attribute.instanceState.instanceXML).join("");
21976
+ return serializeElementXML(
21977
+ qualifiedName,
21978
+ serializedChildren,
21979
+ serializedAttributes,
21980
+ namespaceDeclarations
21981
+ );
21982
21982
  };
21983
- const serializeLeafElementXML = (qualifiedName, xmlValue, options) => {
21984
- return serializeElementXML(qualifiedName, xmlValue.normalize(), options);
21983
+ const serializeLeafElementXML = (qualifiedName, xmlValue, namespaceDeclarations) => {
21984
+ return serializeElementXML(qualifiedName, xmlValue.normalize(), "", namespaceDeclarations);
21985
21985
  };
21986
21986
 
21987
21987
  class NamespaceDeclaration {
@@ -22210,6 +22210,59 @@ class NodeDefinition {
22210
22210
  nodeset;
22211
22211
  }
22212
22212
 
22213
+ class AttributeDefinition extends NodeDefinition {
22214
+ constructor(root, bind, template) {
22215
+ super(bind);
22216
+ this.template = template;
22217
+ const { value } = template;
22218
+ this.root = root;
22219
+ this.value = value;
22220
+ this.qualifiedName = template.qualifiedName;
22221
+ this.namespaceDeclarations = new NamespaceDeclarationMap(this);
22222
+ if (this.qualifiedName.namespaceURI?.href === XMLNS_NAMESPACE_URI$1) {
22223
+ this.serializedXML = "";
22224
+ } else {
22225
+ const xmlValue = escapeXMLText(this.value, true);
22226
+ this.serializedXML = serializeAttributeXML(this.qualifiedName, xmlValue);
22227
+ }
22228
+ }
22229
+ serializedXML;
22230
+ value;
22231
+ type = "attribute";
22232
+ namespaceDeclarations;
22233
+ bodyElement = null;
22234
+ root;
22235
+ isTranslated = false;
22236
+ parent = null;
22237
+ children = null;
22238
+ attributes = null;
22239
+ qualifiedName;
22240
+ serializeAttributeXML() {
22241
+ return this.serializedXML;
22242
+ }
22243
+ }
22244
+
22245
+ const isNonNamespaceAttribute = (attribute) => {
22246
+ return attribute.qualifiedName.namespaceURI?.href !== XMLNS_NAMESPACE_URI$1;
22247
+ };
22248
+ class AttributeDefinitionMap extends Map {
22249
+ static from(model, instanceNode) {
22250
+ const nonNamespaceAttributes = instanceNode.attributes.filter(isNonNamespaceAttribute);
22251
+ const definitions = nonNamespaceAttributes.map((attribute) => {
22252
+ const bind = model.binds.getOrCreateBindDefinition(attribute.nodeset);
22253
+ return new AttributeDefinition(model.root, bind, attribute);
22254
+ });
22255
+ return new this(definitions);
22256
+ }
22257
+ constructor(definitions) {
22258
+ super(
22259
+ definitions.map((attribute) => {
22260
+ return [attribute.qualifiedName, attribute];
22261
+ })
22262
+ );
22263
+ }
22264
+ }
22265
+
22213
22266
  class DescendentNodeDefinition extends NodeDefinition {
22214
22267
  constructor(parent, bind, bodyElement) {
22215
22268
  super(bind);
@@ -22225,7 +22278,7 @@ class DescendentNodeDefinition extends NodeDefinition {
22225
22278
  }
22226
22279
 
22227
22280
  class GroupDefinition extends DescendentNodeDefinition {
22228
- constructor(parent, bind, bodyElement, template) {
22281
+ constructor(model, parent, bind, bodyElement, template) {
22229
22282
  if (bodyElement != null && (bodyElement.category !== "structure" || bodyElement.type === "repeat")) {
22230
22283
  throw new Error(`Unexpected body element for nodeset ${bind.nodeset}`);
22231
22284
  }
@@ -22235,11 +22288,13 @@ class GroupDefinition extends DescendentNodeDefinition {
22235
22288
  this.qualifiedName = template.qualifiedName;
22236
22289
  this.namespaceDeclarations = new NamespaceDeclarationMap(this);
22237
22290
  this.children = root.buildSubtree(this, template);
22291
+ this.attributes = AttributeDefinitionMap.from(model, template);
22238
22292
  }
22239
22293
  type = "group";
22240
22294
  namespaceDeclarations;
22241
22295
  qualifiedName;
22242
22296
  children;
22297
+ attributes;
22243
22298
  toJSON() {
22244
22299
  const { parent, bodyElement, bind, root, ...rest } = this;
22245
22300
  return rest;
@@ -22262,6 +22317,7 @@ class LeafNodeDefinition extends DescendentNodeDefinition {
22262
22317
  namespaceDeclarations;
22263
22318
  qualifiedName;
22264
22319
  children = null;
22320
+ attributes = null;
22265
22321
  toJSON() {
22266
22322
  const { bind, bodyElement, parent, root, ...rest } = this;
22267
22323
  return rest;
@@ -25918,7 +25974,7 @@ const sn = /*@__PURE__*/ new WeakMap, cn = /*@__PURE__*/ sn.get.bind(sn), un = /
25918
25974
  }, gn = /*@__PURE__*/ g((t => e => e[t]), p.concat("sign")), pn = /*@__PURE__*/ g(((t, e) => t => t[w[e]]), O), On = {
25919
25975
  epochMilliseconds: I,
25920
25976
  epochNanoseconds: v
25921
- }, [wn, In, vn] = createSlotClass(N, j, {
25977
+ }, [wn, In] = createSlotClass(N, j, {
25922
25978
  ...gn,
25923
25979
  blank: y
25924
25980
  }, {
@@ -25992,7 +26048,7 @@ const sn = /*@__PURE__*/ new WeakMap, cn = /*@__PURE__*/ sn.get.bind(sn), un = /
25992
26048
  }, {
25993
26049
  from: (t, e) => En(toPlainDateTimeSlots(t, e)),
25994
26050
  compare: (t, e) => Yt(toPlainDateTimeSlots(t), toPlainDateTimeSlots(e))
25995
- }), [Ln, Vn, Jn] = createSlotClass(qt, Pt(kt, Mt), {
26051
+ }), [Ln, Vn] = createSlotClass(qt, Pt(kt, Mt), {
25996
26052
  ...Pn,
25997
26053
  ...Dn
25998
26054
  }, {
@@ -26010,7 +26066,7 @@ const sn = /*@__PURE__*/ new WeakMap, cn = /*@__PURE__*/ sn.get.bind(sn), un = /
26010
26066
  valueOf: neverValueOf
26011
26067
  }, {
26012
26068
  from: (t, e) => Vn(toPlainMonthDaySlots(t, e))
26013
- }), [kn, qn, Rn] = createSlotClass(Ut, Pt(Qt, Mt), {
26069
+ }), [kn, qn] = createSlotClass(Ut, Pt(Qt, Mt), {
26014
26070
  ...Pn,
26015
26071
  ...hn
26016
26072
  }, {
@@ -26033,7 +26089,7 @@ const sn = /*@__PURE__*/ new WeakMap, cn = /*@__PURE__*/ sn.get.bind(sn), un = /
26033
26089
  }, {
26034
26090
  from: (t, e) => qn(toPlainYearMonthSlots(t, e)),
26035
26091
  compare: (t, e) => te(toPlainYearMonthSlots(t), toPlainYearMonthSlots(e))
26036
- }), [xn, Wn, Gn] = createSlotClass(G, Pt(ue, Mt), {
26092
+ }), [xn, Wn] = createSlotClass(G, Pt(ue, Mt), {
26037
26093
  ...Pn,
26038
26094
  ...Tn
26039
26095
  }, {
@@ -26109,7 +26165,7 @@ const sn = /*@__PURE__*/ new WeakMap, cn = /*@__PURE__*/ sn.get.bind(sn), un = /
26109
26165
  }, {
26110
26166
  from: (t, e) => $n(toZonedDateTimeSlots(t, e)),
26111
26167
  compare: (t, e) => Be(toZonedDateTimeSlots(t), toZonedDateTimeSlots(e))
26112
- }), [Hn, Kn, Qn] = createSlotClass(Re, qe, On, {
26168
+ }), [Hn, Kn] = createSlotClass(Re, qe, On, {
26113
26169
  add: (t, e) => Kn(Ye(0, t, toDurationSlots(e))),
26114
26170
  subtract: (t, e) => Kn(Ye(1, t, toDurationSlots(e))),
26115
26171
  until: (t, e, n) => In(Ee(0, t, toInstantSlots(e), n)),
@@ -26571,8 +26627,8 @@ const parseRepeatTemplateElement = (firstRepeatInstanceNode) => {
26571
26627
  return cloneStaticElementStructure(firstRepeatInstanceNode);
26572
26628
  };
26573
26629
  class RepeatDefinition extends DescendentNodeDefinition {
26574
- static from(parent, bind, bodyElement, instanceNodes) {
26575
- return new this(parent, bind, bodyElement, instanceNodes);
26630
+ static from(model, parent, bind, bodyElement, instanceNodes) {
26631
+ return new this(model, parent, bind, bodyElement, instanceNodes);
26576
26632
  }
26577
26633
  type = "repeat";
26578
26634
  children;
@@ -26580,7 +26636,8 @@ class RepeatDefinition extends DescendentNodeDefinition {
26580
26636
  template;
26581
26637
  namespaceDeclarations;
26582
26638
  qualifiedName;
26583
- constructor(parent, bind, bodyElement, instanceNodes) {
26639
+ attributes;
26640
+ constructor(model, parent, bind, bodyElement, instanceNodes) {
26584
26641
  super(parent, bind, bodyElement);
26585
26642
  const { root } = parent;
26586
26643
  const [instanceNode] = instanceNodes;
@@ -26591,6 +26648,7 @@ class RepeatDefinition extends DescendentNodeDefinition {
26591
26648
  this.namespaceDeclarations = new NamespaceDeclarationMap(this);
26592
26649
  this.children = root.buildSubtree(self, template);
26593
26650
  const initialCount = this.omitTemplate(instanceNodes).length;
26651
+ this.attributes = AttributeDefinitionMap.from(model, template);
26594
26652
  this.count = RepeatCountControlExpression.from(bodyElement, initialCount);
26595
26653
  }
26596
26654
  isControlled() {
@@ -26609,48 +26667,6 @@ class RepeatDefinition extends DescendentNodeDefinition {
26609
26667
  }
26610
26668
  }
26611
26669
 
26612
- class RootAttributeDefinition {
26613
- serializedXML;
26614
- parent;
26615
- qualifiedName;
26616
- value;
26617
- constructor(root, source) {
26618
- const { qualifiedName, value } = source;
26619
- this.parent = root;
26620
- this.qualifiedName = qualifiedName;
26621
- this.value = value;
26622
- if (qualifiedName.namespaceURI?.href === XMLNS_NAMESPACE_URI$1) {
26623
- this.serializedXML = "";
26624
- } else {
26625
- const nodeName = qualifiedName.getPrefixedName();
26626
- this.serializedXML = ` ${nodeName}="${escapeXMLText(value, true)}"`;
26627
- }
26628
- }
26629
- serializeAttributeXML() {
26630
- return this.serializedXML;
26631
- }
26632
- }
26633
-
26634
- const isNonNamespaceAttribute = (attribute) => {
26635
- return attribute.qualifiedName.namespaceURI?.href !== XMLNS_NAMESPACE_URI$1;
26636
- };
26637
- class RootAttributeMap extends Map {
26638
- static from(root, instanceNode) {
26639
- const nonNamespaceAttributes = instanceNode.attributes.filter(isNonNamespaceAttribute);
26640
- const definitions = nonNamespaceAttributes.map((attribute) => {
26641
- return new RootAttributeDefinition(root, attribute);
26642
- });
26643
- return new this(definitions);
26644
- }
26645
- constructor(definitions) {
26646
- super(
26647
- definitions.map((attribute) => {
26648
- return [attribute.qualifiedName, attribute];
26649
- })
26650
- );
26651
- }
26652
- }
26653
-
26654
26670
  class RootDefinition extends NodeDefinition {
26655
26671
  constructor(form, model, submission, classes) {
26656
26672
  const template = model.instance.root;
@@ -26668,7 +26684,7 @@ class RootDefinition extends NodeDefinition {
26668
26684
  this.classes = classes;
26669
26685
  this.qualifiedName = qualifiedName;
26670
26686
  this.template = template;
26671
- this.attributes = RootAttributeMap.from(this, template);
26687
+ this.attributes = AttributeDefinitionMap.from(model, template);
26672
26688
  this.namespaceDeclarations = new NamespaceDeclarationMap(this);
26673
26689
  this.children = this.buildSubtree(this, template);
26674
26690
  }
@@ -26705,7 +26721,7 @@ class RootDefinition extends NodeDefinition {
26705
26721
  const bodyElement = body.getBodyElement(nodeset);
26706
26722
  const [firstChild, ...restChildren] = children;
26707
26723
  if (bodyElement?.type === "repeat") {
26708
- return RepeatDefinition.from(parent, bind, bodyElement, children);
26724
+ return RepeatDefinition.from(model, parent, bind, bodyElement, children);
26709
26725
  }
26710
26726
  if (restChildren.length) {
26711
26727
  throw new Error(`Unexpected: multiple elements for non-repeat nodeset: ${nodeset}`);
@@ -26717,7 +26733,7 @@ class RootDefinition extends NodeDefinition {
26717
26733
  }
26718
26734
  return NoteNodeDefinition.from(parent, bind, bodyElement, element) ?? new LeafNodeDefinition(parent, bind, bodyElement, element);
26719
26735
  }
26720
- return new GroupDefinition(parent, bind, bodyElement, element);
26736
+ return new GroupDefinition(model, parent, bind, bodyElement, element);
26721
26737
  });
26722
26738
  }
26723
26739
  toJSON() {
@@ -28887,6 +28903,30 @@ const prepareInstancePayload = (instanceRoot, options) => {
28887
28903
  }
28888
28904
  };
28889
28905
 
28906
+ const createAttributeState = (scope) => {
28907
+ return scope.runTask(() => {
28908
+ const baseState = createSignal([]);
28909
+ const [getAttributes, baseSetAttributes] = baseState;
28910
+ const setAttributes = (valueOrSetterCallback) => {
28911
+ let setterCallback;
28912
+ if (typeof valueOrSetterCallback === "function") {
28913
+ setterCallback = valueOrSetterCallback;
28914
+ } else {
28915
+ setterCallback = (_) => valueOrSetterCallback;
28916
+ }
28917
+ return baseSetAttributes((prev) => {
28918
+ return setterCallback(prev);
28919
+ });
28920
+ };
28921
+ const attributes = [getAttributes, setAttributes];
28922
+ return {
28923
+ attributes,
28924
+ getAttributes,
28925
+ setAttributes
28926
+ };
28927
+ });
28928
+ };
28929
+
28890
28930
  const createChildrenState = (parent) => {
28891
28931
  return parent.scope.runTask(() => {
28892
28932
  const baseState = createSignal([]);
@@ -29199,6 +29239,249 @@ class InstanceNode {
29199
29239
  }
29200
29240
  }
29201
29241
 
29242
+ const createAttributeNodeInstanceState = (node) => {
29243
+ const { qualifiedName } = node.definition;
29244
+ return {
29245
+ get instanceXML() {
29246
+ const xmlValue = escapeXMLText(node.currentState.instanceValue, true);
29247
+ return serializeAttributeXML(qualifiedName, xmlValue);
29248
+ }
29249
+ };
29250
+ };
29251
+
29252
+ const expressionEvaluator = (evaluator, type, expression, options) => {
29253
+ switch (type) {
29254
+ case "boolean":
29255
+ return () => {
29256
+ return evaluator.evaluateBoolean(expression, options);
29257
+ };
29258
+ case "nodes":
29259
+ return () => {
29260
+ return evaluator.evaluateNodes(expression, options);
29261
+ };
29262
+ case "number":
29263
+ return () => {
29264
+ return evaluator.evaluateNumber(expression, options);
29265
+ };
29266
+ case "string":
29267
+ return () => {
29268
+ return evaluator.evaluateString(expression, options);
29269
+ };
29270
+ default:
29271
+ throw new UnreachableError$1(type);
29272
+ }
29273
+ };
29274
+ const DEFAULT_BOOLEAN_EVALUATION = false;
29275
+ const DEFAULT_NODES_EVALUATION = [];
29276
+ const DEFAULT_NUMBER_EVALUATION = NaN;
29277
+ const DEFAULT_STRING_EVALUATION = "";
29278
+ const defaultEvaluationsByType = {
29279
+ boolean: DEFAULT_BOOLEAN_EVALUATION,
29280
+ nodes: DEFAULT_NODES_EVALUATION,
29281
+ number: DEFAULT_NUMBER_EVALUATION,
29282
+ string: DEFAULT_STRING_EVALUATION
29283
+ };
29284
+ const createComputedExpression = (context, dependentExpression, options = {}) => {
29285
+ return context.scope.runTask(() => {
29286
+ const { contextNode, evaluator } = context;
29287
+ const { expression, isTranslated, resultType } = dependentExpression;
29288
+ const evaluatePreInitializationDefaultValue = () => {
29289
+ return options?.defaultValue ?? defaultEvaluationsByType[resultType];
29290
+ };
29291
+ const evaluateExpression = expressionEvaluator(evaluator, resultType, expression, {
29292
+ contextNode
29293
+ });
29294
+ if (isConstantExpression(expression)) {
29295
+ return createMemo(evaluateExpression);
29296
+ }
29297
+ return createMemo(() => {
29298
+ if (!context.isAttached()) {
29299
+ return evaluatePreInitializationDefaultValue();
29300
+ }
29301
+ if (isTranslated) {
29302
+ context.getActiveLanguage();
29303
+ }
29304
+ return evaluateExpression();
29305
+ });
29306
+ });
29307
+ };
29308
+
29309
+ const isInstanceFirstLoad$1 = (context) => {
29310
+ return context.rootDocument.initializationMode === "create";
29311
+ };
29312
+ const isEditInitialLoad$1 = (context) => {
29313
+ return context.rootDocument.initializationMode === "edit";
29314
+ };
29315
+ const getInitialValue$1 = (context) => {
29316
+ const sourceNode = context.instanceNode ?? context.definition.template;
29317
+ return context.decodeInstanceValue(sourceNode.value);
29318
+ };
29319
+ const createRelevantValueState$1 = (context, baseValueState) => {
29320
+ return context.scope.runTask(() => {
29321
+ const [getRelevantValue, setValue] = baseValueState;
29322
+ const getValue = createMemo(() => {
29323
+ if (context.isRelevant()) {
29324
+ return getRelevantValue();
29325
+ }
29326
+ return "";
29327
+ });
29328
+ return [getValue, setValue];
29329
+ });
29330
+ };
29331
+ const guardDownstreamReadonlyWrites$1 = (context, baseState) => {
29332
+ const { readonly } = context.definition.bind;
29333
+ if (readonly.isDefaultExpression) {
29334
+ return baseState;
29335
+ }
29336
+ const [getValue, baseSetValue] = baseState;
29337
+ const setValue = (value) => {
29338
+ if (context.isReadonly()) {
29339
+ const reference = untrack(() => context.contextReference());
29340
+ throw new Error(`Cannot write to readonly field: ${reference}`);
29341
+ }
29342
+ return baseSetValue(value);
29343
+ };
29344
+ return [getValue, setValue];
29345
+ };
29346
+ const PRELOAD_UID_EXPRESSION$1 = 'concat("uuid:", uuid())';
29347
+ const shouldPreloadUID$1 = (context) => {
29348
+ return isInstanceFirstLoad$1(context) || isEditInitialLoad$1(context);
29349
+ };
29350
+ const setPreloadUIDValue$1 = (context, valueState) => {
29351
+ const { preload } = context.definition.bind;
29352
+ if (preload?.type !== "uid" || !shouldPreloadUID$1(context)) {
29353
+ return;
29354
+ }
29355
+ const preloadUIDValue = context.evaluator.evaluateString(PRELOAD_UID_EXPRESSION$1, {
29356
+ contextNode: context.contextNode
29357
+ });
29358
+ const [, setValue] = valueState;
29359
+ setValue(preloadUIDValue);
29360
+ };
29361
+ const createCalculation$1 = (context, setRelevantValue, calculateDefinition) => {
29362
+ context.scope.runTask(() => {
29363
+ const calculate = createComputedExpression(context, calculateDefinition, {
29364
+ defaultValue: ""
29365
+ });
29366
+ createComputed(() => {
29367
+ if (context.isAttached() && context.isRelevant()) {
29368
+ const calculated = calculate();
29369
+ const value = context.decodeInstanceValue(calculated);
29370
+ setRelevantValue(value);
29371
+ }
29372
+ });
29373
+ });
29374
+ };
29375
+ const createAttributeValueState = (context) => {
29376
+ return context.scope.runTask(() => {
29377
+ const initialValue = getInitialValue$1(context);
29378
+ const baseValueState = createSignal(initialValue);
29379
+ const relevantValueState = createRelevantValueState$1(context, baseValueState);
29380
+ setPreloadUIDValue$1(context, relevantValueState);
29381
+ const { calculate } = context.definition.bind;
29382
+ if (calculate != null) {
29383
+ const [, setValue] = relevantValueState;
29384
+ createCalculation$1(context, setValue, calculate);
29385
+ }
29386
+ return guardDownstreamReadonlyWrites$1(context, relevantValueState);
29387
+ });
29388
+ };
29389
+
29390
+ class Attribute extends InstanceNode {
29391
+ constructor(parent, definition, instanceNode) {
29392
+ const codec = getSharedValueCodec("string");
29393
+ super(parent.instanceConfig, parent, instanceNode, definition, {
29394
+ scope: parent.scope,
29395
+ computeReference: () => "@" + this.definition.qualifiedName.getPrefixedName()
29396
+ });
29397
+ this.instanceNode = instanceNode;
29398
+ this.root = parent.root;
29399
+ this.getActiveLanguage = parent.getActiveLanguage;
29400
+ this.validationState = { violations: [] };
29401
+ this.valueType = "string";
29402
+ this.evaluator = parent.evaluator;
29403
+ this.decodeInstanceValue = codec.decodeInstanceValue;
29404
+ const instanceValueState = createAttributeValueState(this);
29405
+ const valueState = codec.createRuntimeValueState(instanceValueState);
29406
+ const [getInstanceValue] = instanceValueState;
29407
+ const [, setValueState] = valueState;
29408
+ this.getInstanceValue = getInstanceValue;
29409
+ this.setValueState = setValueState;
29410
+ this.getXPathValue = () => {
29411
+ return this.getInstanceValue();
29412
+ };
29413
+ this.valueState = valueState;
29414
+ const state = createSharedNodeState(
29415
+ this.scope,
29416
+ {
29417
+ reference: this.contextReference,
29418
+ readonly: this.isReadonly,
29419
+ relevant: this.isRelevant,
29420
+ required: () => false,
29421
+ label: null,
29422
+ hint: null,
29423
+ children: null,
29424
+ valueOptions: null,
29425
+ value: this.valueState,
29426
+ instanceValue: this.getInstanceValue,
29427
+ attributes: null
29428
+ },
29429
+ this.instanceConfig
29430
+ );
29431
+ this.state = state;
29432
+ this.engineState = state.engineState;
29433
+ this.currentState = state.currentState;
29434
+ this.instanceState = createAttributeNodeInstanceState(this);
29435
+ }
29436
+ [XPathNodeKindKey] = "attribute";
29437
+ state;
29438
+ engineState;
29439
+ validationState;
29440
+ nodeType = "attribute";
29441
+ currentState;
29442
+ instanceState;
29443
+ appearances = null;
29444
+ nodeOptions = null;
29445
+ valueType;
29446
+ decodeInstanceValue;
29447
+ getInstanceValue;
29448
+ valueState;
29449
+ setValueState;
29450
+ evaluator;
29451
+ getActiveLanguage;
29452
+ root;
29453
+ isRelevant = () => {
29454
+ return this.parent.isRelevant();
29455
+ };
29456
+ isAttached = () => {
29457
+ return this.parent.isAttached();
29458
+ };
29459
+ isReadonly = () => {
29460
+ return true;
29461
+ };
29462
+ hasReadonlyAncestor = () => {
29463
+ const { parent } = this;
29464
+ return parent.hasReadonlyAncestor() || parent.isReadonly();
29465
+ };
29466
+ hasNonRelevantAncestor = () => {
29467
+ const { parent } = this;
29468
+ return parent.hasNonRelevantAncestor() || !parent.isRelevant();
29469
+ };
29470
+ setValue(value) {
29471
+ this.setValueState(value);
29472
+ return this.root;
29473
+ }
29474
+ getChildren() {
29475
+ return [];
29476
+ }
29477
+ }
29478
+
29479
+ function buildAttributes(parent) {
29480
+ return Array.from(parent.definition.attributes.values()).map((attributeDefinition) => {
29481
+ return new Attribute(parent, attributeDefinition, attributeDefinition.template);
29482
+ });
29483
+ }
29484
+
29202
29485
  class InstanceAttachmentsState extends Map {
29203
29486
  constructor(sourceAttachments = null) {
29204
29487
  super();
@@ -29215,14 +29498,12 @@ class InstanceAttachmentsState extends Map {
29215
29498
  const createRootInstanceState = (node) => {
29216
29499
  return {
29217
29500
  get instanceXML() {
29218
- const { namespaceDeclarations, attributes } = node.definition;
29219
- const serializedChildren = node.currentState.children.map((child) => {
29220
- return child.instanceState.instanceXML;
29221
- });
29222
- return serializeParentElementXML(node.definition.qualifiedName, serializedChildren, {
29223
- namespaceDeclarations,
29224
- attributes: Array.from(attributes.values())
29225
- });
29501
+ return serializeParentElementXML(
29502
+ node.definition.qualifiedName,
29503
+ node.currentState.children,
29504
+ node.currentState.attributes,
29505
+ node.definition.namespaceDeclarations
29506
+ );
29226
29507
  }
29227
29508
  };
29228
29509
  };
@@ -29276,63 +29557,6 @@ const createAggregatedViolations = (context, options) => {
29276
29557
 
29277
29558
  const XFORMS_XPATH_NODE_RANGE_KIND = "comment";
29278
29559
 
29279
- const expressionEvaluator = (evaluator, type, expression, options) => {
29280
- switch (type) {
29281
- case "boolean":
29282
- return () => {
29283
- return evaluator.evaluateBoolean(expression, options);
29284
- };
29285
- case "nodes":
29286
- return () => {
29287
- return evaluator.evaluateNodes(expression, options);
29288
- };
29289
- case "number":
29290
- return () => {
29291
- return evaluator.evaluateNumber(expression, options);
29292
- };
29293
- case "string":
29294
- return () => {
29295
- return evaluator.evaluateString(expression, options);
29296
- };
29297
- default:
29298
- throw new UnreachableError$1(type);
29299
- }
29300
- };
29301
- const DEFAULT_BOOLEAN_EVALUATION = false;
29302
- const DEFAULT_NODES_EVALUATION = [];
29303
- const DEFAULT_NUMBER_EVALUATION = NaN;
29304
- const DEFAULT_STRING_EVALUATION = "";
29305
- const defaultEvaluationsByType = {
29306
- boolean: DEFAULT_BOOLEAN_EVALUATION,
29307
- nodes: DEFAULT_NODES_EVALUATION,
29308
- number: DEFAULT_NUMBER_EVALUATION,
29309
- string: DEFAULT_STRING_EVALUATION
29310
- };
29311
- const createComputedExpression = (context, dependentExpression, options = {}) => {
29312
- return context.scope.runTask(() => {
29313
- const { contextNode, evaluator } = context;
29314
- const { expression, isTranslated, resultType } = dependentExpression;
29315
- const evaluatePreInitializationDefaultValue = () => {
29316
- return options?.defaultValue ?? defaultEvaluationsByType[resultType];
29317
- };
29318
- const evaluateExpression = expressionEvaluator(evaluator, resultType, expression, {
29319
- contextNode
29320
- });
29321
- if (isConstantExpression(expression)) {
29322
- return createMemo(evaluateExpression);
29323
- }
29324
- return createMemo(() => {
29325
- if (!context.isAttached()) {
29326
- return evaluatePreInitializationDefaultValue();
29327
- }
29328
- if (isTranslated) {
29329
- context.getActiveLanguage();
29330
- }
29331
- return evaluateExpression();
29332
- });
29333
- });
29334
- };
29335
-
29336
29560
  class DescendantNode extends InstanceNode {
29337
29561
  constructor(parent, instanceNode, definition, options) {
29338
29562
  super(parent.instanceConfig, parent, instanceNode, definition, options);
@@ -29358,6 +29582,11 @@ class DescendantNode extends InstanceNode {
29358
29582
  return true;
29359
29583
  }
29360
29584
  }
29585
+ for (const attr of parent.getAttributes()) {
29586
+ if (attr === self) {
29587
+ return true;
29588
+ }
29589
+ }
29361
29590
  return false;
29362
29591
  });
29363
29592
  });
@@ -29469,10 +29698,11 @@ const createParentNodeInstanceState = (node) => {
29469
29698
  if (!node.currentState.relevant) {
29470
29699
  return "";
29471
29700
  }
29472
- const serializedChildren = node.currentState.children.map((child) => {
29473
- return child.instanceState.instanceXML;
29474
- });
29475
- return serializeParentElementXML(node.definition.qualifiedName, serializedChildren);
29701
+ return serializeParentElementXML(
29702
+ node.definition.qualifiedName,
29703
+ node.currentState.children,
29704
+ node.currentState.attributes
29705
+ );
29476
29706
  }
29477
29707
  };
29478
29708
  };
@@ -39746,6 +39976,7 @@ const createNodeLabel = (context, definition) => {
39746
39976
 
39747
39977
  class Group extends DescendantNode {
39748
39978
  childrenState;
39979
+ attributeState;
39749
39980
  [XPathNodeKindKey] = "element";
39750
39981
  // InstanceNode
39751
39982
  state;
@@ -39761,7 +39992,9 @@ class Group extends DescendantNode {
39761
39992
  super(parent, instanceNode, definition);
39762
39993
  this.appearances = definition.bodyElement?.appearances ?? null;
39763
39994
  const childrenState = createChildrenState(this);
39995
+ const attributeState = createAttributeState(this.scope);
39764
39996
  this.childrenState = childrenState;
39997
+ this.attributeState = attributeState;
39765
39998
  const state = createSharedNodeState(
39766
39999
  this.scope,
39767
40000
  {
@@ -39772,6 +40005,7 @@ class Group extends DescendantNode {
39772
40005
  label: createNodeLabel(this, definition),
39773
40006
  hint: null,
39774
40007
  children: childrenState.childIds,
40008
+ attributes: attributeState.getAttributes,
39775
40009
  valueOptions: null,
39776
40010
  value: null
39777
40011
  },
@@ -39785,12 +40019,16 @@ class Group extends DescendantNode {
39785
40019
  childrenState
39786
40020
  );
39787
40021
  childrenState.setChildren(buildChildren(this));
40022
+ attributeState.setAttributes(buildAttributes(this));
39788
40023
  this.validationState = createAggregatedViolations(this, this.instanceConfig);
39789
40024
  this.instanceState = createParentNodeInstanceState(this);
39790
40025
  }
39791
40026
  getChildren() {
39792
40027
  return this.childrenState.getChildren();
39793
40028
  }
40029
+ getAttributes() {
40030
+ return this.attributeState.getAttributes();
40031
+ }
39794
40032
  }
39795
40033
 
39796
40034
  const createFieldHint = (context, definition) => {
@@ -40094,6 +40332,7 @@ class InputControl extends ValueNode {
40094
40332
  label: createNodeLabel(this, definition),
40095
40333
  hint: createFieldHint(this, definition),
40096
40334
  children: null,
40335
+ attributes: null,
40097
40336
  valueOptions: null,
40098
40337
  value: this.valueState,
40099
40338
  instanceValue: this.getInstanceValue
@@ -40137,6 +40376,7 @@ class ModelValue extends ValueNode {
40137
40376
  label: null,
40138
40377
  hint: null,
40139
40378
  children: null,
40379
+ attributes: null,
40140
40380
  valueOptions: null,
40141
40381
  value: this.valueState,
40142
40382
  instanceValue: this.getInstanceValue
@@ -40264,6 +40504,7 @@ class Note extends ValueNode {
40264
40504
  hint,
40265
40505
  noteText,
40266
40506
  children: null,
40507
+ attributes: null,
40267
40508
  valueOptions: null,
40268
40509
  value: this.valueState,
40269
40510
  instanceValue: this.getInstanceValue
@@ -40343,6 +40584,7 @@ class RangeControl extends ValueNode {
40343
40584
  label: createNodeLabel(this, definition),
40344
40585
  hint: createFieldHint(this, definition),
40345
40586
  children: null,
40587
+ attributes: null,
40346
40588
  valueOptions: null,
40347
40589
  value: this.valueState,
40348
40590
  instanceValue: this.getInstanceValue
@@ -40600,6 +40842,7 @@ class RankControl extends ValueNode {
40600
40842
  label: createNodeLabel(this, definition),
40601
40843
  hint: createFieldHint(this, definition),
40602
40844
  children: null,
40845
+ attributes: null,
40603
40846
  valueOptions,
40604
40847
  value: valueState,
40605
40848
  instanceValue: this.getInstanceValue
@@ -40661,26 +40904,17 @@ const createNodeRangeInstanceState = (node) => {
40661
40904
  };
40662
40905
  };
40663
40906
 
40664
- class TemplatedNodeAttributeSerializationError extends Error {
40665
- constructor() {
40666
- super("Template attribute omission not implemented");
40667
- }
40668
- }
40669
-
40670
40907
  const createTemplatedNodeInstanceState = (node) => {
40671
40908
  return {
40672
40909
  get instanceXML() {
40673
40910
  if (!node.currentState.relevant) {
40674
40911
  return "";
40675
40912
  }
40676
- const serializedChildren = node.currentState.children.map((child) => {
40677
- return child.instanceState.instanceXML;
40678
- });
40679
- const { attributes } = node.currentState;
40680
- if (attributes != null) {
40681
- throw new TemplatedNodeAttributeSerializationError();
40682
- }
40683
- return serializeParentElementXML(node.definition.qualifiedName, serializedChildren);
40913
+ return serializeParentElementXML(
40914
+ node.definition.qualifiedName,
40915
+ node.currentState.children,
40916
+ node.currentState.attributes
40917
+ );
40684
40918
  }
40685
40919
  };
40686
40920
  };
@@ -40701,7 +40935,9 @@ class RepeatInstance extends DescendantNode {
40701
40935
  this.parent = parent;
40702
40936
  this.appearances = definition.bodyElement.appearances;
40703
40937
  const childrenState = createChildrenState(this);
40938
+ const attributeState = createAttributeState(this.scope);
40704
40939
  this.childrenState = childrenState;
40940
+ this.attributeState = attributeState;
40705
40941
  this.currentIndex = currentIndex;
40706
40942
  const state = createSharedNodeState(
40707
40943
  this.scope,
@@ -40713,7 +40949,7 @@ class RepeatInstance extends DescendantNode {
40713
40949
  // TODO: only-child <group><label>
40714
40950
  label: createNodeLabel(this, definition),
40715
40951
  hint: null,
40716
- attributes: null,
40952
+ attributes: attributeState.getAttributes,
40717
40953
  children: childrenState.childIds,
40718
40954
  valueOptions: null,
40719
40955
  value: null
@@ -40736,6 +40972,7 @@ class RepeatInstance extends DescendantNode {
40736
40972
  this.instanceState = createTemplatedNodeInstanceState(this);
40737
40973
  }
40738
40974
  childrenState;
40975
+ attributeState;
40739
40976
  currentIndex;
40740
40977
  [XPathNodeKindKey] = "element";
40741
40978
  // InstanceNode
@@ -40770,10 +41007,14 @@ class RepeatInstance extends DescendantNode {
40770
41007
  getChildren() {
40771
41008
  return this.childrenState.getChildren();
40772
41009
  }
41010
+ getAttributes() {
41011
+ return this.attributeState.getAttributes();
41012
+ }
40773
41013
  }
40774
41014
 
40775
41015
  class BaseRepeatRange extends DescendantNode {
40776
41016
  childrenState;
41017
+ attributeState;
40777
41018
  /**
40778
41019
  * A repeat range doesn't have a corresponding primary instance element of its
40779
41020
  * own. It is represented in the following ways:
@@ -40813,7 +41054,9 @@ class BaseRepeatRange extends DescendantNode {
40813
41054
  super(parent, definition.template, definition);
40814
41055
  const repeatRange = this;
40815
41056
  const childrenState = createChildrenState(repeatRange);
41057
+ const attributeState = createAttributeState(this.scope);
40816
41058
  this.childrenState = childrenState;
41059
+ this.attributeState = attributeState;
40817
41060
  const state = createSharedNodeState(
40818
41061
  this.scope,
40819
41062
  {
@@ -40824,6 +41067,7 @@ class BaseRepeatRange extends DescendantNode {
40824
41067
  label: createNodeLabel(this, definition),
40825
41068
  hint: null,
40826
41069
  children: childrenState.childIds,
41070
+ attributes: attributeState.getAttributes,
40827
41071
  valueOptions: null,
40828
41072
  value: null
40829
41073
  },
@@ -40891,6 +41135,9 @@ class BaseRepeatRange extends DescendantNode {
40891
41135
  getChildren() {
40892
41136
  return this.childrenState.getChildren();
40893
41137
  }
41138
+ getAttributes() {
41139
+ return this.attributeState.getAttributes();
41140
+ }
40894
41141
  }
40895
41142
 
40896
41143
  class RepeatRangeControlled extends BaseRepeatRange {
@@ -41134,6 +41381,7 @@ class SelectControl extends ValueNode {
41134
41381
  label: createNodeLabel(this, definition),
41135
41382
  hint: createFieldHint(this, definition),
41136
41383
  children: null,
41384
+ attributes: null,
41137
41385
  valueOptions,
41138
41386
  value: valueState,
41139
41387
  instanceValue: this.getInstanceValue,
@@ -41269,6 +41517,7 @@ class TriggerControl extends ValueNode {
41269
41517
  label: createNodeLabel(this, definition),
41270
41518
  hint: createFieldHint(this, definition),
41271
41519
  children: null,
41520
+ attributes: null,
41272
41521
  valueOptions: null,
41273
41522
  value: this.valueState,
41274
41523
  instanceValue: this.getInstanceValue
@@ -41467,6 +41716,8 @@ class UploadControl extends DescendantNode {
41467
41716
  this.nodeOptions = definition.bodyElement.options;
41468
41717
  const instanceAttachment = createInstanceAttachment(this);
41469
41718
  this.instanceAttachment = instanceAttachment;
41719
+ const attributeState = createAttributeState(this.scope);
41720
+ this.attributeState = attributeState;
41470
41721
  this.decodeInstanceValue = instanceAttachment.decodeInstanceValue;
41471
41722
  this.getXPathValue = instanceAttachment.getInstanceValue;
41472
41723
  const state = createSharedNodeState(
@@ -41481,6 +41732,7 @@ class UploadControl extends DescendantNode {
41481
41732
  children: null,
41482
41733
  valueOptions: null,
41483
41734
  value: instanceAttachment.valueState,
41735
+ attributes: attributeState.getAttributes,
41484
41736
  instanceValue: instanceAttachment.getInstanceValue
41485
41737
  },
41486
41738
  this.instanceConfig
@@ -41497,6 +41749,7 @@ class UploadControl extends DescendantNode {
41497
41749
  }
41498
41750
  validation;
41499
41751
  instanceAttachment;
41752
+ attributeState;
41500
41753
  // XFormsXPathElement
41501
41754
  [XPathNodeKindKey] = "element";
41502
41755
  getXPathValue;
@@ -41531,6 +41784,9 @@ class UploadControl extends DescendantNode {
41531
41784
  this.instanceAttachment.setValue(value);
41532
41785
  return this.root;
41533
41786
  }
41787
+ getAttributes() {
41788
+ return this.attributeState.getAttributes();
41789
+ }
41534
41790
  }
41535
41791
 
41536
41792
  const META_LOCAL_NAME = "meta";
@@ -41812,6 +42068,7 @@ const buildChildren = (parent) => {
41812
42068
 
41813
42069
  class Root extends DescendantNode {
41814
42070
  childrenState;
42071
+ attributeState;
41815
42072
  // XFormsXPathElement
41816
42073
  [XPathNodeKindKey] = "element";
41817
42074
  // DescendantNode
@@ -41843,7 +42100,9 @@ class Root extends DescendantNode {
41843
42100
  });
41844
42101
  this.classes = parent.classes;
41845
42102
  const childrenState = createChildrenState(this);
42103
+ const attributeState = createAttributeState(this.scope);
41846
42104
  this.childrenState = childrenState;
42105
+ this.attributeState = attributeState;
41847
42106
  this.languages = parent.languages;
41848
42107
  const state = createSharedNodeState(
41849
42108
  this.scope,
@@ -41857,7 +42116,8 @@ class Root extends DescendantNode {
41857
42116
  required: () => false,
41858
42117
  valueOptions: null,
41859
42118
  value: null,
41860
- children: childrenState.childIds
42119
+ children: childrenState.childIds,
42120
+ attributes: attributeState.getAttributes
41861
42121
  },
41862
42122
  this.instanceConfig
41863
42123
  );
@@ -41869,12 +42129,16 @@ class Root extends DescendantNode {
41869
42129
  childrenState
41870
42130
  );
41871
42131
  childrenState.setChildren(buildChildren(this));
42132
+ attributeState.setAttributes(buildAttributes(this));
41872
42133
  this.validationState = createAggregatedViolations(this, this.instanceConfig);
41873
42134
  this.instanceState = createRootInstanceState(this);
41874
42135
  }
41875
42136
  getChildren() {
41876
42137
  return this.childrenState.getChildren();
41877
42138
  }
42139
+ getAttributes() {
42140
+ return this.attributeState.getAttributes();
42141
+ }
41878
42142
  // RootNode
41879
42143
  setLanguage(language) {
41880
42144
  this.rootDocument.setLanguage(language);
@@ -41919,6 +42183,7 @@ class PrimaryInstance extends InstanceNode {
41919
42183
  isAttached;
41920
42184
  evaluator;
41921
42185
  contextNode = this;
42186
+ attributeState;
41922
42187
  constructor(options) {
41923
42188
  const { mode, initialState, scope, model, secondaryInstances, config } = options;
41924
42189
  const { instance: modelInstance } = model;
@@ -41949,7 +42214,9 @@ class PrimaryInstance extends InstanceNode {
41949
42214
  this.evaluator = evaluator;
41950
42215
  this.classes = definition.classes;
41951
42216
  const childrenState = createChildrenState(this);
42217
+ const attributeState = createAttributeState(this.scope);
41952
42218
  this.getChildren = childrenState.getChildren;
42219
+ this.attributeState = attributeState;
41953
42220
  const stateSpec = {
41954
42221
  activeLanguage: getActiveLanguage,
41955
42222
  reference: PRIMARY_INSTANCE_REFERENCE,
@@ -41960,7 +42227,8 @@ class PrimaryInstance extends InstanceNode {
41960
42227
  required: false,
41961
42228
  valueOptions: null,
41962
42229
  value: null,
41963
- children: childrenState.childIds
42230
+ children: childrenState.childIds,
42231
+ attributes: attributeState.getAttributes
41964
42232
  };
41965
42233
  const state = createSharedNodeState(scope, stateSpec, config);
41966
42234
  this.state = state;
@@ -41975,6 +42243,7 @@ class PrimaryInstance extends InstanceNode {
41975
42243
  };
41976
42244
  this.instanceState = createPrimaryInstanceState(this);
41977
42245
  childrenState.setChildren([root]);
42246
+ attributeState.setAttributes(buildAttributes(this));
41978
42247
  setIsAttached(true);
41979
42248
  }
41980
42249
  // PrimaryInstanceDocument
@@ -42017,6 +42286,9 @@ class PrimaryInstance extends InstanceNode {
42017
42286
  });
42018
42287
  return Promise.resolve(result);
42019
42288
  }
42289
+ getAttributes() {
42290
+ return this.attributeState.getAttributes();
42291
+ }
42020
42292
  }
42021
42293
 
42022
42294
  class FormInstance {