@getodk/xforms-engine 0.5.0 → 0.7.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.
- package/README.md +1 -1
- package/dist/client/BaseNode.d.ts +8 -4
- package/dist/client/BaseValueNode.d.ts +8 -4
- package/dist/client/GroupNode.d.ts +1 -0
- package/dist/client/InputNode.d.ts +32 -3
- package/dist/client/ModelValueNode.d.ts +1 -0
- package/dist/client/NoteNode.d.ts +24 -7
- package/dist/client/RangeNode.d.ts +36 -0
- package/dist/client/RankNode.d.ts +46 -0
- package/dist/client/RootNode.d.ts +21 -14
- package/dist/client/SelectNode.d.ts +47 -25
- package/dist/client/SubtreeNode.d.ts +1 -0
- package/dist/client/TriggerNode.d.ts +10 -6
- package/dist/client/constants.d.ts +11 -12
- package/dist/client/form/CreateFormInstance.d.ts +14 -0
- package/dist/client/form/EditFormInstance.d.ts +62 -0
- package/dist/client/form/FormInstance.d.ts +104 -0
- package/dist/client/form/FormInstanceConfig.d.ts +17 -0
- package/dist/client/form/FormResource.d.ts +1 -0
- package/dist/client/form/LoadForm.d.ts +79 -0
- package/dist/client/form/LoadFormResult.d.ts +67 -0
- package/dist/client/form/RestoreFormInstance.d.ts +8 -0
- package/dist/client/hierarchy.d.ts +5 -5
- package/dist/client/index.d.ts +37 -11
- package/dist/client/node-types.d.ts +2 -2
- package/dist/client/repeat/BaseRepeatRangeNode.d.ts +3 -4
- package/dist/client/repeat/RepeatInstanceNode.d.ts +4 -5
- package/dist/client/repeat/RepeatRangeControlledNode.d.ts +2 -2
- package/dist/client/repeat/RepeatRangeUncontrolledNode.d.ts +2 -2
- package/dist/client/resources.d.ts +1 -1
- package/dist/client/serialization/InstanceData.d.ts +12 -0
- package/dist/client/serialization/InstanceFile.d.ts +6 -0
- package/dist/client/serialization/InstancePayload.d.ts +93 -0
- package/dist/client/serialization/InstancePayloadOptions.d.ts +23 -0
- package/dist/client/serialization/InstanceState.d.ts +12 -0
- package/dist/client/submission/{SubmissionDefinition.d.ts → SubmissionMeta.d.ts} +1 -1
- package/dist/client/unsupported/UnsupportedControlNode.d.ts +1 -3
- package/dist/entrypoints/FormInstance.d.ts +20 -0
- package/dist/entrypoints/FormResult/BaseFormResult.d.ts +22 -0
- package/dist/entrypoints/FormResult/BaseInstantiableFormResult.d.ts +25 -0
- package/dist/entrypoints/FormResult/FormFailureResult.d.ts +17 -0
- package/dist/entrypoints/FormResult/FormSuccessResult.d.ts +15 -0
- package/dist/entrypoints/FormResult/FormWarningResult.d.ts +15 -0
- package/dist/entrypoints/createInstance.d.ts +9 -0
- package/dist/entrypoints/editInstance.d.ts +9 -0
- package/dist/entrypoints/index.d.ts +4 -0
- package/dist/entrypoints/loadForm.d.ts +4 -0
- package/dist/entrypoints/restoreInstance.d.ts +9 -0
- package/dist/error/LoadFormFailureError.d.ts +9 -0
- package/dist/error/MalformedInstanceDataError.d.ts +3 -0
- package/dist/error/RankMissingValueError.d.ts +3 -0
- package/dist/error/RankValueTypeError.d.ts +6 -0
- package/dist/error/SelectValueTypeError.d.ts +15 -0
- package/dist/error/TemplatedNodeAttributeSerializationError.d.ts +22 -0
- package/dist/error/XFormsSpecViolationError.d.ts +2 -0
- package/dist/index.d.ts +2 -34
- package/dist/index.js +7274 -5840
- package/dist/index.js.map +1 -1
- package/dist/instance/Group.d.ts +7 -5
- package/dist/instance/InputControl.d.ts +9 -6
- package/dist/instance/ModelValue.d.ts +7 -4
- package/dist/instance/Note.d.ts +14 -25
- package/dist/instance/PrimaryInstance.d.ts +36 -8
- package/dist/instance/RangeControl.d.ts +35 -0
- package/dist/instance/RankControl.d.ts +41 -0
- package/dist/instance/Root.d.ts +8 -9
- package/dist/instance/SelectControl.d.ts +67 -0
- package/dist/instance/Subtree.d.ts +7 -5
- package/dist/instance/TriggerControl.d.ts +10 -22
- package/dist/instance/abstract/DescendantNode.d.ts +11 -3
- package/dist/instance/abstract/InstanceNode.d.ts +10 -5
- package/dist/instance/abstract/ValueNode.d.ts +7 -6
- package/dist/instance/children/DescendantNodeInitOptions.d.ts +32 -0
- package/dist/instance/{children.d.ts → children/buildChildren.d.ts} +1 -1
- package/dist/instance/children/childrenInitOptions.d.ts +9 -0
- package/dist/instance/children/normalizeChildInitOptions.d.ts +2 -0
- package/dist/instance/hierarchy.d.ts +9 -9
- package/dist/instance/input/InitialInstanceState.d.ts +13 -0
- package/dist/instance/input/InstanceAttachmentMap.d.ts +19 -0
- package/dist/instance/internal-api/InstanceConfig.d.ts +2 -9
- package/dist/instance/internal-api/InstanceValueContext.d.ts +10 -1
- package/dist/instance/internal-api/serialization/ClientReactiveSerializableInstance.d.ts +14 -0
- package/dist/instance/internal-api/serialization/ClientReactiveSerializableLeafNode.d.ts +32 -0
- package/dist/instance/internal-api/serialization/ClientReactiveSerializableParentNode.d.ts +18 -0
- package/dist/instance/internal-api/serialization/ClientReactiveSerializableTemplatedNode.d.ts +13 -0
- package/dist/instance/internal-api/serialization/ClientReactiveSerializableValueNode.d.ts +21 -0
- package/dist/instance/repeat/BaseRepeatRange.d.ts +11 -8
- package/dist/instance/repeat/RepeatInstance.d.ts +11 -7
- package/dist/instance/repeat/RepeatRangeControlled.d.ts +27 -3
- package/dist/instance/repeat/RepeatRangeUncontrolled.d.ts +4 -3
- package/dist/instance/resource.d.ts +5 -1
- package/dist/instance/unsupported/UploadControl.d.ts +32 -4
- package/dist/integration/xpath/EngineXPathEvaluator.d.ts +2 -2
- package/dist/integration/xpath/adapter/kind.d.ts +4 -10
- package/dist/integration/xpath/adapter/names.d.ts +1 -11
- package/dist/integration/xpath/adapter/traversal.d.ts +10 -9
- package/dist/integration/xpath/static-dom/StaticAttribute.d.ts +10 -4
- package/dist/integration/xpath/static-dom/StaticDocument.d.ts +13 -11
- package/dist/integration/xpath/static-dom/StaticElement.d.ts +25 -18
- package/dist/integration/xpath/static-dom/StaticNode.d.ts +1 -1
- package/dist/integration/xpath/static-dom/StaticParentNode.d.ts +13 -0
- package/dist/integration/xpath/static-dom/staticNodeName.d.ts +3 -0
- package/dist/lib/client-reactivity/instance-state/createNodeRangeInstanceState.d.ts +4 -0
- package/dist/lib/client-reactivity/instance-state/createParentNodeInstanceState.d.ts +4 -0
- package/dist/lib/client-reactivity/instance-state/createPrimaryInstanceState.d.ts +3 -0
- package/dist/lib/client-reactivity/instance-state/createRootInstanceState.d.ts +3 -0
- package/dist/lib/client-reactivity/instance-state/createTemplatedNodeInstanceState.d.ts +6 -0
- package/dist/lib/client-reactivity/instance-state/createValueNodeInstanceState.d.ts +3 -0
- package/dist/lib/client-reactivity/instance-state/prepareInstancePayload.d.ts +8 -0
- package/dist/lib/codecs/Geopoint/Geopoint.d.ts +48 -0
- package/dist/lib/codecs/Geopoint/GeopointValueCodec.d.ts +5 -0
- package/dist/lib/codecs/NoteCodec.d.ts +8 -0
- package/dist/lib/codecs/RangeCodec.d.ts +8 -0
- package/dist/lib/codecs/TempUnsupportedControlCodec.d.ts +7 -0
- package/dist/lib/codecs/TriggerCodec.d.ts +7 -0
- package/dist/lib/codecs/ValueArrayCodec.d.ts +11 -0
- package/dist/lib/codecs/ValueCodec.d.ts +2 -2
- package/dist/lib/codecs/getNoteCodec.d.ts +3 -0
- package/dist/lib/codecs/getSelectCodec.d.ts +5 -0
- package/dist/lib/codecs/getSharedValueCodec.d.ts +3 -2
- package/dist/lib/codecs/items/BaseItemCodec.d.ts +9 -0
- package/dist/lib/codecs/items/MultipleValueItemCodec.d.ts +14 -0
- package/dist/lib/codecs/items/SingleValueItemCodec.d.ts +24 -0
- package/dist/lib/dom/query.d.ts +1 -2
- package/dist/lib/names/NamespaceDeclaration.d.ts +45 -0
- package/dist/lib/names/NamespaceDeclarationMap.d.ts +137 -0
- package/dist/lib/names/NamespaceURL.d.ts +30 -0
- package/dist/lib/names/QualifiedName.d.ts +113 -0
- package/dist/lib/names/UnprefixedXFormsName.d.ts +4 -0
- package/dist/lib/number-parsers.d.ts +2 -0
- package/dist/lib/reactivity/createInstanceValueState.d.ts +2 -27
- package/dist/lib/reactivity/createItemCollection.d.ts +21 -0
- package/dist/lib/xml-serialization.d.ts +11 -2
- package/dist/parse/XFormDOM.d.ts +1 -1
- package/dist/parse/body/BodyDefinition.d.ts +2 -2
- package/dist/parse/body/appearance/rangeAppearanceParser.d.ts +3 -0
- package/dist/parse/body/control/InputControlDefinition.d.ts +3 -0
- package/dist/parse/body/control/ItemDefinition.d.ts +14 -0
- package/dist/parse/body/control/ItemsetDefinition.d.ts +18 -0
- package/dist/parse/body/control/RangeControlDefinition.d.ts +31 -2
- package/dist/parse/body/control/RankControlDefinition.d.ts +7 -3
- package/dist/parse/body/control/{select/SelectDefinition.d.ts → SelectControlDefinition.d.ts} +9 -9
- package/dist/parse/expression/ItemsetNodesetExpression.d.ts +1 -1
- package/dist/parse/expression/ItemsetValueExpression.d.ts +1 -1
- package/dist/parse/model/BindDefinition.d.ts +3 -1
- package/dist/parse/model/BindPreloadDefinition.d.ts +42 -0
- package/dist/parse/model/DescendentNodeDefinition.d.ts +4 -13
- package/dist/parse/model/ItextTranslationsDefinition.d.ts +18 -0
- package/dist/parse/model/LeafNodeDefinition.d.ts +9 -7
- package/dist/parse/model/ModelDefinition.d.ts +9 -2
- package/dist/parse/model/NodeDefinition.d.ts +30 -45
- package/dist/parse/model/NoteNodeDefinition.d.ts +7 -5
- package/dist/parse/model/RangeNodeDefinition.d.ts +42 -0
- package/dist/parse/model/RepeatDefinition.d.ts +62 -0
- package/dist/parse/model/RootAttributeDefinition.d.ts +21 -0
- package/dist/parse/model/RootAttributeMap.d.ts +24 -0
- package/dist/parse/model/RootDefinition.d.ts +15 -14
- package/dist/parse/model/SecondaryInstance/SecondaryInstancesDefinition.d.ts +15 -2
- package/dist/parse/model/SecondaryInstance/assertSecondaryInstanceDefinition.d.ts +5 -0
- package/dist/parse/model/SecondaryInstance/defineSecondaryInstance.d.ts +5 -0
- package/dist/parse/model/SecondaryInstance/sources/BlankSecondaryInstanceSource.d.ts +1 -7
- package/dist/parse/model/SecondaryInstance/sources/CSVExternalSecondaryInstance.d.ts +1 -1
- package/dist/parse/model/SecondaryInstance/sources/GeoJSONExternalSecondaryInstance.d.ts +1 -1
- package/dist/parse/model/SecondaryInstance/sources/InternalSecondaryInstanceSource.d.ts +1 -1
- package/dist/parse/model/SecondaryInstance/sources/SecondaryInstanceSource.d.ts +1 -1
- package/dist/parse/model/SecondaryInstance/sources/XMLExternalSecondaryInstanceSource.d.ts +1 -1
- package/dist/parse/model/{FormSubmissionDefinition.d.ts → SubmissionDefinition.d.ts} +2 -2
- package/dist/parse/model/SubtreeDefinition.d.ts +9 -7
- package/dist/parse/model/nodeDefinitionMap.d.ts +5 -0
- package/dist/parse/shared/parseInstanceXML.d.ts +21 -0
- package/dist/parse/shared/parseStaticDocumentFromDOMSubtree.d.ts +4 -22
- package/dist/parse/text/ItemLabelDefinition.d.ts +1 -1
- package/dist/parse/text/ItemsetLabelDefinition.d.ts +2 -2
- package/dist/parse/text/abstract/TextElementDefinition.d.ts +1 -1
- package/dist/parse/xpath/semantic-analysis.d.ts +1 -3
- package/dist/solid.js +7247 -5813
- package/dist/solid.js.map +1 -1
- package/package.json +15 -12
- package/src/client/BaseNode.ts +9 -4
- package/src/client/BaseValueNode.ts +8 -4
- package/src/client/GroupNode.ts +1 -0
- package/src/client/InputNode.ts +38 -2
- package/src/client/ModelValueNode.ts +1 -0
- package/src/client/NoteNode.ts +43 -7
- package/src/client/RangeNode.ts +51 -0
- package/src/client/RankNode.ts +54 -0
- package/src/client/RootNode.ts +30 -16
- package/src/client/SelectNode.ts +53 -26
- package/src/client/SubtreeNode.ts +1 -0
- package/src/client/TriggerNode.ts +12 -6
- package/src/client/constants.ts +12 -14
- package/src/client/form/CreateFormInstance.ts +19 -0
- package/src/client/form/EditFormInstance.ts +93 -0
- package/src/client/form/FormInstance.ts +114 -0
- package/src/client/form/FormInstanceConfig.ts +18 -0
- package/src/client/form/FormResource.ts +1 -0
- package/src/client/form/LoadForm.ts +92 -0
- package/src/client/form/LoadFormResult.ts +103 -0
- package/src/client/form/RestoreFormInstance.ts +14 -0
- package/src/client/hierarchy.ts +7 -8
- package/src/client/index.ts +47 -29
- package/src/client/node-types.ts +3 -5
- package/src/client/repeat/BaseRepeatRangeNode.ts +3 -4
- package/src/client/repeat/RepeatInstanceNode.ts +4 -8
- package/src/client/repeat/RepeatRangeControlledNode.ts +2 -2
- package/src/client/repeat/RepeatRangeUncontrolledNode.ts +2 -2
- package/src/client/resources.ts +2 -2
- package/src/client/serialization/InstanceData.ts +16 -0
- package/src/client/serialization/InstanceFile.ts +9 -0
- package/src/client/serialization/InstancePayload.ts +126 -0
- package/src/client/serialization/InstancePayloadOptions.ts +28 -0
- package/src/client/serialization/InstanceState.ts +14 -0
- package/src/client/submission/{SubmissionDefinition.ts → SubmissionMeta.ts} +1 -1
- package/src/client/unsupported/UnsupportedControlNode.ts +2 -6
- package/src/entrypoints/FormInstance.ts +55 -0
- package/src/entrypoints/FormResult/BaseFormResult.ts +40 -0
- package/src/entrypoints/FormResult/BaseInstantiableFormResult.ts +109 -0
- package/src/entrypoints/FormResult/FormFailureResult.ts +44 -0
- package/src/entrypoints/FormResult/FormSuccessResult.ts +25 -0
- package/src/entrypoints/FormResult/FormWarningResult.ts +25 -0
- package/src/entrypoints/createInstance.ts +23 -0
- package/src/entrypoints/editInstance.ts +24 -0
- package/src/entrypoints/index.ts +4 -0
- package/src/entrypoints/loadForm.ts +154 -0
- package/src/entrypoints/restoreInstance.ts +27 -0
- package/src/error/LoadFormFailureError.ts +114 -0
- package/src/error/MalformedInstanceDataError.ts +3 -0
- package/src/error/RankMissingValueError.ts +5 -0
- package/src/error/RankValueTypeError.ts +13 -0
- package/src/error/SelectValueTypeError.ts +22 -0
- package/src/error/TemplatedNodeAttributeSerializationError.ts +24 -0
- package/src/error/XFormsSpecViolationError.ts +1 -0
- package/src/index.ts +2 -56
- package/src/instance/Group.ts +17 -15
- package/src/instance/InputControl.ts +58 -12
- package/src/instance/ModelValue.ts +19 -11
- package/src/instance/Note.ts +40 -64
- package/src/instance/PrimaryInstance.ts +70 -31
- package/src/instance/RangeControl.ts +119 -0
- package/src/instance/RankControl.ts +208 -0
- package/src/instance/Root.ts +21 -31
- package/src/instance/SelectControl.ts +228 -0
- package/src/instance/Subtree.ts +17 -15
- package/src/instance/TriggerControl.ts +50 -80
- package/src/instance/abstract/DescendantNode.ts +13 -8
- package/src/instance/abstract/InstanceNode.ts +19 -7
- package/src/instance/abstract/ValueNode.ts +14 -15
- package/src/instance/children/DescendantNodeInitOptions.ts +35 -0
- package/src/instance/children/buildChildren.ts +206 -0
- package/src/instance/children/childrenInitOptions.ts +117 -0
- package/src/instance/children/normalizeChildInitOptions.ts +332 -0
- package/src/instance/hierarchy.ts +21 -16
- package/src/instance/input/InitialInstanceState.ts +108 -0
- package/src/instance/input/InstanceAttachmentMap.ts +142 -0
- package/src/instance/internal-api/InstanceConfig.ts +3 -10
- package/src/instance/internal-api/InstanceValueContext.ts +11 -1
- package/src/instance/internal-api/serialization/ClientReactiveSerializableInstance.ts +20 -0
- package/src/instance/internal-api/serialization/ClientReactiveSerializableLeafNode.ts +43 -0
- package/src/instance/internal-api/serialization/ClientReactiveSerializableParentNode.ts +26 -0
- package/src/instance/internal-api/serialization/ClientReactiveSerializableTemplatedNode.ts +24 -0
- package/src/instance/internal-api/serialization/ClientReactiveSerializableValueNode.ts +28 -0
- package/src/instance/repeat/BaseRepeatRange.ts +21 -24
- package/src/instance/repeat/RepeatInstance.ts +27 -19
- package/src/instance/repeat/RepeatRangeControlled.ts +90 -17
- package/src/instance/repeat/RepeatRangeUncontrolled.ts +10 -9
- package/src/instance/resource.ts +18 -2
- package/src/instance/unsupported/UploadControl.ts +116 -5
- package/src/integration/xpath/EngineXPathEvaluator.ts +2 -2
- package/src/integration/xpath/adapter/kind.ts +1 -28
- package/src/integration/xpath/adapter/names.ts +66 -17
- package/src/integration/xpath/adapter/traversal.ts +12 -11
- package/src/integration/xpath/static-dom/StaticAttribute.ts +16 -7
- package/src/integration/xpath/static-dom/StaticDocument.ts +17 -18
- package/src/integration/xpath/static-dom/StaticElement.ts +211 -52
- package/src/integration/xpath/static-dom/StaticNode.ts +1 -1
- package/src/integration/xpath/static-dom/StaticParentNode.ts +22 -0
- package/src/integration/xpath/static-dom/staticNodeName.ts +20 -0
- package/src/lib/client-reactivity/instance-state/createNodeRangeInstanceState.ts +17 -0
- package/src/lib/client-reactivity/instance-state/createParentNodeInstanceState.ts +22 -0
- package/src/lib/client-reactivity/instance-state/createPrimaryInstanceState.ts +12 -0
- package/src/lib/client-reactivity/instance-state/createRootInstanceState.ts +19 -0
- package/src/lib/client-reactivity/instance-state/createTemplatedNodeInstanceState.ts +31 -0
- package/src/lib/client-reactivity/instance-state/createValueNodeInstanceState.ts +21 -0
- package/src/lib/client-reactivity/instance-state/prepareInstancePayload.ts +173 -0
- package/src/lib/codecs/Geopoint/Geopoint.ts +150 -0
- package/src/lib/codecs/Geopoint/GeopointValueCodec.ts +20 -0
- package/src/lib/codecs/NoteCodec.ts +32 -0
- package/src/lib/codecs/RangeCodec.ts +65 -0
- package/src/lib/codecs/TempUnsupportedControlCodec.ts +32 -0
- package/src/lib/codecs/TriggerCodec.ts +64 -0
- package/src/lib/codecs/ValueArrayCodec.ts +42 -0
- package/src/lib/codecs/ValueCodec.ts +2 -2
- package/src/lib/codecs/getNoteCodec.ts +27 -0
- package/src/lib/codecs/getSelectCodec.ts +27 -0
- package/src/lib/codecs/getSharedValueCodec.ts +5 -3
- package/src/lib/codecs/items/BaseItemCodec.ts +20 -0
- package/src/lib/codecs/items/MultipleValueItemCodec.ts +28 -0
- package/src/lib/codecs/items/SingleValueItemCodec.ts +67 -0
- package/src/lib/dom/query.ts +1 -2
- package/src/lib/names/NamespaceDeclaration.ts +106 -0
- package/src/lib/names/NamespaceDeclarationMap.ts +228 -0
- package/src/lib/names/NamespaceURL.ts +44 -0
- package/src/lib/names/QualifiedName.ts +170 -0
- package/src/lib/names/UnprefixedXFormsName.ts +12 -0
- package/src/lib/number-parsers.ts +25 -0
- package/src/lib/reactivity/createInstanceValueState.ts +69 -43
- package/src/lib/reactivity/{createSelectItems.ts → createItemCollection.ts} +41 -36
- package/src/lib/xml-serialization.ts +76 -9
- package/src/parse/XFormDOM.ts +141 -21
- package/src/parse/XFormDefinition.ts +1 -4
- package/src/parse/body/BodyDefinition.ts +4 -4
- package/src/parse/body/appearance/rangeAppearanceParser.ts +11 -0
- package/src/parse/body/control/InputControlDefinition.ts +9 -0
- package/src/parse/body/control/{select/ItemDefinition.ts → ItemDefinition.ts} +8 -6
- package/src/parse/body/control/{select/ItemsetDefinition.ts → ItemsetDefinition.ts} +11 -9
- package/src/parse/body/control/RangeControlDefinition.ts +91 -6
- package/src/parse/body/control/RankControlDefinition.ts +25 -7
- package/src/parse/body/control/{select/SelectDefinition.ts → SelectControlDefinition.ts} +9 -9
- package/src/parse/expression/ItemsetNodesetExpression.ts +1 -1
- package/src/parse/expression/ItemsetValueExpression.ts +1 -1
- package/src/parse/model/BindDefinition.ts +4 -0
- package/src/parse/model/BindPreloadDefinition.ts +100 -0
- package/src/parse/model/DescendentNodeDefinition.ts +7 -25
- package/src/parse/model/ItextTranslationsDefinition.ts +79 -0
- package/src/parse/model/LeafNodeDefinition.ts +13 -8
- package/src/parse/model/ModelDefinition.ts +36 -3
- package/src/parse/model/NodeDefinition.ts +38 -85
- package/src/parse/model/NoteNodeDefinition.ts +12 -10
- package/src/parse/model/RangeNodeDefinition.ts +119 -0
- package/src/parse/model/RepeatDefinition.ts +382 -0
- package/src/parse/model/RootAttributeDefinition.ts +44 -0
- package/src/parse/model/RootAttributeMap.ts +49 -0
- package/src/parse/model/RootDefinition.ts +42 -43
- package/src/parse/model/SecondaryInstance/SecondaryInstancesDefinition.ts +23 -2
- package/src/parse/model/SecondaryInstance/assertSecondaryInstanceDefinition.ts +14 -0
- package/src/parse/model/SecondaryInstance/defineSecondaryInstance.ts +32 -0
- package/src/parse/model/SecondaryInstance/sources/BlankSecondaryInstanceSource.ts +3 -24
- package/src/parse/model/SecondaryInstance/sources/CSVExternalSecondaryInstance.ts +33 -86
- package/src/parse/model/SecondaryInstance/sources/GeoJSONExternalSecondaryInstance.ts +64 -136
- package/src/parse/model/SecondaryInstance/sources/InternalSecondaryInstanceSource.ts +9 -7
- package/src/parse/model/SecondaryInstance/sources/SecondaryInstanceSource.ts +1 -1
- package/src/parse/model/SecondaryInstance/sources/XMLExternalSecondaryInstanceSource.ts +7 -7
- package/src/parse/model/{FormSubmissionDefinition.ts → SubmissionDefinition.ts} +2 -2
- package/src/parse/model/SubtreeDefinition.ts +15 -16
- package/src/parse/model/nodeDefinitionMap.ts +34 -0
- package/src/parse/shared/parseInstanceXML.ts +79 -0
- package/src/parse/shared/parseStaticDocumentFromDOMSubtree.ts +46 -131
- package/src/parse/text/ItemLabelDefinition.ts +1 -1
- package/src/parse/text/ItemsetLabelDefinition.ts +2 -2
- package/src/parse/text/abstract/TextElementDefinition.ts +1 -1
- package/src/parse/xpath/semantic-analysis.ts +4 -3
- package/dist/client/EngineConfig.d.ts +0 -79
- package/dist/client/submission/SubmissionData.d.ts +0 -7
- package/dist/client/submission/SubmissionInstanceFile.d.ts +0 -6
- package/dist/client/submission/SubmissionOptions.d.ts +0 -23
- package/dist/client/submission/SubmissionResult.d.ts +0 -91
- package/dist/client/submission/SubmissionState.d.ts +0 -12
- package/dist/client/unsupported/RangeNode.d.ts +0 -9
- package/dist/client/unsupported/RankNode.d.ts +0 -9
- package/dist/instance/SelectField.d.ts +0 -58
- package/dist/instance/abstract/UnsupportedControl.d.ts +0 -53
- package/dist/instance/index.d.ts +0 -8
- package/dist/instance/internal-api/ValueContext.d.ts +0 -23
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableInstance.d.ts +0 -14
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableLeafNode.d.ts +0 -31
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableParentNode.d.ts +0 -18
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableValueNode.d.ts +0 -17
- package/dist/instance/unsupported/RangeControl.d.ts +0 -6
- package/dist/instance/unsupported/RankControl.d.ts +0 -6
- package/dist/integration/xpath/static-dom/StaticNamedNode.d.ts +0 -17
- package/dist/lib/client-reactivity/submission/createInstanceSubmissionState.d.ts +0 -3
- package/dist/lib/client-reactivity/submission/createLeafNodeSubmissionState.d.ts +0 -3
- package/dist/lib/client-reactivity/submission/createNodeRangeSubmissionState.d.ts +0 -4
- package/dist/lib/client-reactivity/submission/createParentNodeSubmissionState.d.ts +0 -4
- package/dist/lib/client-reactivity/submission/createValueNodeSubmissionState.d.ts +0 -3
- package/dist/lib/client-reactivity/submission/prepareSubmission.d.ts +0 -8
- package/dist/lib/reactivity/createSelectItems.d.ts +0 -16
- package/dist/lib/reactivity/createValueState.d.ts +0 -40
- package/dist/parse/body/control/select/ItemDefinition.d.ts +0 -13
- package/dist/parse/body/control/select/ItemsetDefinition.d.ts +0 -17
- package/dist/parse/body/control/select/ItemsetNodesetContext.d.ts +0 -9
- package/dist/parse/model/ItextTranslation/ItextTranslationDefinition.d.ts +0 -4
- package/dist/parse/model/ItextTranslation/ItextTranslationRootDefinition.d.ts +0 -8
- package/dist/parse/model/ItextTranslation/ItextTranslationsDefinition.d.ts +0 -8
- package/dist/parse/model/RepeatInstanceDefinition.d.ts +0 -14
- package/dist/parse/model/RepeatRangeDefinition.d.ts +0 -29
- package/dist/parse/model/RepeatTemplateDefinition.d.ts +0 -28
- package/dist/parse/model/SecondaryInstance/SecondaryInstanceDefinition.d.ts +0 -4
- package/dist/parse/model/SecondaryInstance/SecondaryInstanceRootDefinition.d.ts +0 -7
- package/src/client/EngineConfig.ts +0 -84
- package/src/client/submission/SubmissionData.ts +0 -12
- package/src/client/submission/SubmissionInstanceFile.ts +0 -9
- package/src/client/submission/SubmissionOptions.ts +0 -28
- package/src/client/submission/SubmissionResult.ts +0 -124
- package/src/client/submission/SubmissionState.ts +0 -14
- package/src/client/unsupported/RangeNode.ts +0 -14
- package/src/client/unsupported/RankNode.ts +0 -14
- package/src/instance/SelectField.ts +0 -263
- package/src/instance/abstract/UnsupportedControl.ts +0 -174
- package/src/instance/children.ts +0 -158
- package/src/instance/index.ts +0 -55
- package/src/instance/internal-api/ValueContext.ts +0 -28
- package/src/instance/internal-api/submission/ClientReactiveSubmittableInstance.ts +0 -20
- package/src/instance/internal-api/submission/ClientReactiveSubmittableLeafNode.ts +0 -42
- package/src/instance/internal-api/submission/ClientReactiveSubmittableParentNode.ts +0 -25
- package/src/instance/internal-api/submission/ClientReactiveSubmittableValueNode.ts +0 -23
- package/src/instance/unsupported/RangeControl.ts +0 -9
- package/src/instance/unsupported/RankControl.ts +0 -9
- package/src/integration/xpath/static-dom/StaticNamedNode.ts +0 -45
- package/src/lib/client-reactivity/submission/createInstanceSubmissionState.ts +0 -12
- package/src/lib/client-reactivity/submission/createLeafNodeSubmissionState.ts +0 -20
- package/src/lib/client-reactivity/submission/createNodeRangeSubmissionState.ts +0 -17
- package/src/lib/client-reactivity/submission/createParentNodeSubmissionState.ts +0 -22
- package/src/lib/client-reactivity/submission/createValueNodeSubmissionState.ts +0 -21
- package/src/lib/client-reactivity/submission/prepareSubmission.ts +0 -172
- package/src/lib/reactivity/createValueState.ts +0 -200
- package/src/parse/body/control/select/ItemsetNodesetContext.ts +0 -21
- package/src/parse/model/ItextTranslation/ItextTranslationDefinition.ts +0 -4
- package/src/parse/model/ItextTranslation/ItextTranslationRootDefinition.ts +0 -41
- package/src/parse/model/ItextTranslation/ItextTranslationsDefinition.ts +0 -31
- package/src/parse/model/RepeatInstanceDefinition.ts +0 -34
- package/src/parse/model/RepeatRangeDefinition.ts +0 -94
- package/src/parse/model/RepeatTemplateDefinition.ts +0 -145
- package/src/parse/model/SecondaryInstance/SecondaryInstanceDefinition.ts +0 -4
- package/src/parse/model/SecondaryInstance/SecondaryInstanceRootDefinition.ts +0 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getodk/xforms-engine",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "XForms engine for ODK Web Forms",
|
|
6
6
|
"type": "module",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"README.md"
|
|
30
30
|
],
|
|
31
31
|
"engines": {
|
|
32
|
-
"node": "^18.20.
|
|
32
|
+
"node": "^18.20.5 || ^20.18.1 || ^22.12.0",
|
|
33
33
|
"yarn": "1.22.22"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
@@ -55,30 +55,33 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"papaparse": "^5.4.1",
|
|
58
|
-
"solid-js": "^1.9.
|
|
58
|
+
"solid-js": "^1.9.3"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@babel/core": "^7.
|
|
61
|
+
"@babel/core": "^7.26.0",
|
|
62
62
|
"@getodk/tree-sitter-xpath": "0.1.2",
|
|
63
|
-
"@getodk/xpath": "0.
|
|
64
|
-
"@playwright/test": "^1.
|
|
63
|
+
"@getodk/xpath": "0.4.0",
|
|
64
|
+
"@playwright/test": "^1.49.1",
|
|
65
65
|
"@types/papaparse": "^5.3.15",
|
|
66
|
-
"@vitest/browser": "^2.1.
|
|
66
|
+
"@vitest/browser": "^2.1.8",
|
|
67
67
|
"babel-plugin-transform-jsbi-to-bigint": "^1.4.0",
|
|
68
68
|
"http-server": "^14.1.1",
|
|
69
69
|
"jsdom": "^25.0.1",
|
|
70
|
-
"typedoc": "^0.
|
|
71
|
-
"vite": "^5.4.
|
|
72
|
-
"vite-plugin-dts": "^4.
|
|
70
|
+
"typedoc": "^0.27.5",
|
|
71
|
+
"vite": "^5.4.11",
|
|
72
|
+
"vite-plugin-dts": "^4.3.0",
|
|
73
73
|
"vite-plugin-no-bundle": "^4.0.0",
|
|
74
|
-
"vitest": "^2.1.
|
|
74
|
+
"vitest": "^2.1.8"
|
|
75
75
|
},
|
|
76
76
|
"peerDependencies": {
|
|
77
|
-
"solid-js": "^1.
|
|
77
|
+
"solid-js": "^1.9.3"
|
|
78
78
|
},
|
|
79
79
|
"peerDependenciesMeta": {
|
|
80
80
|
"solid-js": {
|
|
81
81
|
"optional": true
|
|
82
82
|
}
|
|
83
|
+
},
|
|
84
|
+
"publishConfig": {
|
|
85
|
+
"access": "public"
|
|
83
86
|
}
|
|
84
87
|
}
|
package/src/client/BaseNode.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { OpaqueReactiveObjectFactory } from './OpaqueReactiveObjectFactory.
|
|
|
5
5
|
import type { TextRange } from './TextRange.ts';
|
|
6
6
|
import type { FormNodeID } from './identity.ts';
|
|
7
7
|
import type { InstanceNodeType } from './node-types.ts';
|
|
8
|
-
import type {
|
|
8
|
+
import type { InstanceState } from './serialization/InstanceState.ts';
|
|
9
9
|
import type {
|
|
10
10
|
AncestorNodeValidationState,
|
|
11
11
|
LeafNodeValidationState,
|
|
@@ -153,6 +153,11 @@ export interface BaseNode {
|
|
|
153
153
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
154
154
|
readonly appearances: NodeAppearances<any> | null;
|
|
155
155
|
|
|
156
|
+
/**
|
|
157
|
+
* A node can have options that determine its behavior.
|
|
158
|
+
*/
|
|
159
|
+
readonly nodeOptions: object | null;
|
|
160
|
+
|
|
156
161
|
/**
|
|
157
162
|
* Each node has a definition which specifies aspects of the node defined in
|
|
158
163
|
* the form. These aspects include (but are not limited to) the node's data
|
|
@@ -251,14 +256,14 @@ export interface BaseNode {
|
|
|
251
256
|
readonly validationState: NodeValidationState;
|
|
252
257
|
|
|
253
258
|
/**
|
|
254
|
-
* Represents the current
|
|
259
|
+
* Represents the current instance state of the node.
|
|
255
260
|
*
|
|
256
|
-
* @see {@link
|
|
261
|
+
* @see {@link InstanceState.instanceXML} for additional detail.
|
|
257
262
|
*
|
|
258
263
|
* @todo Consider whether this can (should) be merged with
|
|
259
264
|
* {@link currentState}, while providing the same client-reactivity
|
|
260
265
|
* guarantees. (The challenge there is in defining client-reactive state which
|
|
261
266
|
* self-referentially derives state from its own definition.)
|
|
262
267
|
*/
|
|
263
|
-
readonly
|
|
268
|
+
readonly instanceState: InstanceState;
|
|
264
269
|
}
|
|
@@ -2,12 +2,13 @@ import type { LeafNodeDefinition } from '../parse/model/LeafNodeDefinition.ts';
|
|
|
2
2
|
import type { BaseNode, BaseNodeState } from './BaseNode.ts';
|
|
3
3
|
import type { GeneralParentNode } from './hierarchy.ts';
|
|
4
4
|
import type { LeafNodeType } from './node-types.ts';
|
|
5
|
+
import type { InstanceState } from './serialization/InstanceState.ts';
|
|
5
6
|
import type { LeafNodeValidationState } from './validation.ts';
|
|
6
7
|
import type { ValueType } from './ValueType.ts';
|
|
7
8
|
|
|
8
9
|
export interface BaseValueNodeState<Value> extends BaseNodeState {
|
|
9
10
|
get children(): null;
|
|
10
|
-
get valueOptions():
|
|
11
|
+
get valueOptions(): unknown;
|
|
11
12
|
get value(): Value;
|
|
12
13
|
|
|
13
14
|
/**
|
|
@@ -15,12 +16,14 @@ export interface BaseValueNodeState<Value> extends BaseNodeState {
|
|
|
15
16
|
* {@link value} state. This representation allows access to the node's value
|
|
16
17
|
* _as primary instance state_. In other words, this is the value which:
|
|
17
18
|
*
|
|
18
|
-
* - would be serialized as a text node in
|
|
19
|
-
*
|
|
20
|
-
*
|
|
19
|
+
* - would be serialized as a text node in {@link InstanceState.instanceXML}
|
|
20
|
+
* (note: this value is **NOT** escaped for XML serialization, as it is
|
|
21
|
+
* there)
|
|
21
22
|
*
|
|
22
23
|
* - is used when the node's value is referenced in any of a form's XPath
|
|
23
24
|
* expressions
|
|
25
|
+
*
|
|
26
|
+
* @todo Consider moving into {@link InstanceState}
|
|
24
27
|
*/
|
|
25
28
|
get instanceValue(): string;
|
|
26
29
|
}
|
|
@@ -32,4 +35,5 @@ export interface BaseValueNode<V extends ValueType = ValueType, Value = string>
|
|
|
32
35
|
readonly parent: GeneralParentNode;
|
|
33
36
|
readonly currentState: BaseValueNodeState<Value>;
|
|
34
37
|
readonly validationState: LeafNodeValidationState;
|
|
38
|
+
readonly instanceState: InstanceState;
|
|
35
39
|
}
|
package/src/client/GroupNode.ts
CHANGED
|
@@ -31,6 +31,7 @@ export type GroupNodeAppearances = NodeAppearances<GroupDefinition>;
|
|
|
31
31
|
export interface GroupNode extends BaseNode {
|
|
32
32
|
readonly nodeType: 'group';
|
|
33
33
|
readonly appearances: GroupNodeAppearances;
|
|
34
|
+
readonly nodeOptions: null;
|
|
34
35
|
readonly definition: GroupDefinition;
|
|
35
36
|
readonly root: RootNode;
|
|
36
37
|
readonly parent: GeneralParentNode;
|
package/src/client/InputNode.ts
CHANGED
|
@@ -31,16 +31,44 @@ export interface InputDefinition<V extends ValueType = ValueType> extends LeafNo
|
|
|
31
31
|
|
|
32
32
|
export type InputNodeAppearances = NodeAppearances<InputDefinition>;
|
|
33
33
|
|
|
34
|
+
interface StringInputNodeOptions {
|
|
35
|
+
readonly rows: number | null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
interface GeoInputNodeOptions {
|
|
39
|
+
readonly accuracyThreshold: number | null;
|
|
40
|
+
readonly unacceptableAccuracyThreshold: number | null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface InputNodeOptionsByValueType {
|
|
44
|
+
readonly string: StringInputNodeOptions;
|
|
45
|
+
readonly int: null;
|
|
46
|
+
readonly boolean: null;
|
|
47
|
+
readonly decimal: null;
|
|
48
|
+
readonly date: null;
|
|
49
|
+
readonly time: null;
|
|
50
|
+
readonly dateTime: null;
|
|
51
|
+
readonly geopoint: GeoInputNodeOptions;
|
|
52
|
+
readonly geotrace: GeoInputNodeOptions;
|
|
53
|
+
readonly geoshape: GeoInputNodeOptions;
|
|
54
|
+
readonly binary: null;
|
|
55
|
+
readonly barcode: null;
|
|
56
|
+
readonly intent: null;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export type InputNodeOptions<V extends ValueType> = InputNodeOptionsByValueType[V];
|
|
60
|
+
|
|
34
61
|
/**
|
|
35
62
|
* A node corresponding to form field defined as an
|
|
36
63
|
* {@link https://getodk.github.io/xforms-spec/#body-elements | XForms `<input>`},
|
|
37
|
-
* which a user-facing client would likely present for a user to fill
|
|
64
|
+
* which a user-facing client would likely present for a user to fill.
|
|
38
65
|
*/
|
|
39
66
|
export interface InputNode<V extends ValueType = ValueType>
|
|
40
67
|
extends BaseValueNode<V, InputValue<V>> {
|
|
41
68
|
readonly nodeType: 'input';
|
|
42
69
|
readonly valueType: V;
|
|
43
70
|
readonly appearances: InputNodeAppearances;
|
|
71
|
+
readonly nodeOptions: InputNodeOptions<V>;
|
|
44
72
|
readonly definition: InputDefinition<V>;
|
|
45
73
|
readonly root: RootNode;
|
|
46
74
|
readonly parent: GeneralParentNode;
|
|
@@ -53,16 +81,23 @@ export interface InputNode<V extends ValueType = ValueType>
|
|
|
53
81
|
setValue(value: InputNodeInputValue<V>): RootNode;
|
|
54
82
|
}
|
|
55
83
|
|
|
84
|
+
export type StringInputValue = InputValue<'string'>;
|
|
85
|
+
export type IntInputValue = InputValue<'int'>;
|
|
86
|
+
export type DecimalInputValue = InputValue<'decimal'>;
|
|
87
|
+
export type GeopointInputValue = InputValue<'geopoint'>;
|
|
88
|
+
|
|
56
89
|
export type StringInputNode = InputNode<'string'>;
|
|
57
90
|
export type IntInputNode = InputNode<'int'>;
|
|
58
91
|
export type DecimalInputNode = InputNode<'decimal'>;
|
|
92
|
+
export type GeopointInputNode = InputNode<'geopoint'>;
|
|
59
93
|
|
|
60
94
|
// prettier-ignore
|
|
61
95
|
type SupportedInputValueType =
|
|
62
96
|
// eslint-disable-next-line @typescript-eslint/sort-type-constituents
|
|
63
97
|
| 'string'
|
|
64
98
|
| 'int'
|
|
65
|
-
| 'decimal'
|
|
99
|
+
| 'decimal'
|
|
100
|
+
| 'geopoint';
|
|
66
101
|
|
|
67
102
|
type TemporaryStringValueType = Exclude<ValueType, SupportedInputValueType>;
|
|
68
103
|
|
|
@@ -74,4 +109,5 @@ export type AnyInputNode =
|
|
|
74
109
|
| StringInputNode
|
|
75
110
|
| IntInputNode
|
|
76
111
|
| DecimalInputNode
|
|
112
|
+
| GeopointInputNode
|
|
77
113
|
| TemporaryStringValueInputNode;
|
|
@@ -40,6 +40,7 @@ export interface ModelValueNode<V extends ValueType = ValueType>
|
|
|
40
40
|
readonly nodeType: 'model-value';
|
|
41
41
|
readonly valueType: V;
|
|
42
42
|
readonly appearances: null;
|
|
43
|
+
readonly nodeOptions: null;
|
|
43
44
|
readonly definition: ModelValueDefinition<V>;
|
|
44
45
|
readonly root: RootNode;
|
|
45
46
|
readonly parent: GeneralParentNode;
|
package/src/client/NoteNode.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
+
import type { NoteRuntimeValue } from '../lib/codecs/NoteCodec.ts';
|
|
1
2
|
import type { InputControlDefinition } from '../parse/body/control/InputControlDefinition.ts';
|
|
2
3
|
import type { LeafNodeDefinition } from '../parse/model/LeafNodeDefinition.ts';
|
|
3
|
-
import type {
|
|
4
|
+
import type { BaseValueNode, BaseValueNodeState } from './BaseValueNode.ts';
|
|
4
5
|
import type { GeneralParentNode } from './hierarchy.ts';
|
|
5
6
|
import type { NodeAppearances } from './NodeAppearances.ts';
|
|
6
7
|
import type { RootNode } from './RootNode.ts';
|
|
7
8
|
import type { TextRange } from './TextRange.ts';
|
|
8
9
|
import type { LeafNodeValidationState } from './validation.ts';
|
|
10
|
+
import type { ValueType } from './ValueType.ts';
|
|
9
11
|
|
|
10
|
-
export
|
|
12
|
+
export type NoteValue<V extends ValueType> = NoteRuntimeValue<V>;
|
|
13
|
+
|
|
14
|
+
export interface NoteNodeState<V extends ValueType> extends BaseValueNodeState<NoteValue<V>> {
|
|
11
15
|
/**
|
|
12
16
|
* Note-specific specialization: a note will always have a non-null value in
|
|
13
17
|
* at least one of:
|
|
@@ -48,10 +52,10 @@ export interface NoteNodeState extends BaseNodeState {
|
|
|
48
52
|
// node types, specifically to make a clear distinction between blank and
|
|
49
53
|
// non-blank values (as that has been a primary driver for prioritizing note
|
|
50
54
|
// functionality).
|
|
51
|
-
get value():
|
|
55
|
+
get value(): NoteValue<V>;
|
|
52
56
|
}
|
|
53
57
|
|
|
54
|
-
export interface NoteDefinition extends LeafNodeDefinition {
|
|
58
|
+
export interface NoteDefinition<V extends ValueType = ValueType> extends LeafNodeDefinition<V> {
|
|
55
59
|
readonly bodyElement: InputControlDefinition;
|
|
56
60
|
}
|
|
57
61
|
|
|
@@ -63,12 +67,44 @@ export type NoteNodeAppearances = NodeAppearances<NoteDefinition>;
|
|
|
63
67
|
* - associated with an input, with at least one text element (label or hint)
|
|
64
68
|
* - guaranteed to be {@link NoteNodeState.readonly | readonly}
|
|
65
69
|
*/
|
|
66
|
-
export interface NoteNode extends
|
|
70
|
+
export interface NoteNode<V extends ValueType = ValueType> extends BaseValueNode<V, NoteValue<V>> {
|
|
67
71
|
readonly nodeType: 'note';
|
|
68
72
|
readonly appearances: NoteNodeAppearances;
|
|
69
|
-
readonly
|
|
73
|
+
readonly nodeOptions: null;
|
|
74
|
+
readonly definition: NoteDefinition<V>;
|
|
70
75
|
readonly root: RootNode;
|
|
71
76
|
readonly parent: GeneralParentNode;
|
|
72
|
-
readonly currentState: NoteNodeState
|
|
77
|
+
readonly currentState: NoteNodeState<V>;
|
|
73
78
|
readonly validationState: LeafNodeValidationState;
|
|
74
79
|
}
|
|
80
|
+
|
|
81
|
+
export type StringNoteValue = NoteValue<'string'>;
|
|
82
|
+
export type IntNoteValue = NoteValue<'int'>;
|
|
83
|
+
export type DecimalNoteValue = NoteValue<'decimal'>;
|
|
84
|
+
export type GeopointNoteValue = NoteValue<'geopoint'>;
|
|
85
|
+
|
|
86
|
+
export type StringNoteNode = NoteNode<'string'>;
|
|
87
|
+
export type IntNoteNode = NoteNode<'int'>;
|
|
88
|
+
export type DecimalNoteNode = NoteNode<'decimal'>;
|
|
89
|
+
export type GeopointNoteNode = NoteNode<'geopoint'>;
|
|
90
|
+
|
|
91
|
+
// prettier-ignore
|
|
92
|
+
type SupportedNoteValueType =
|
|
93
|
+
// eslint-disable-next-line @typescript-eslint/sort-type-constituents
|
|
94
|
+
| 'string'
|
|
95
|
+
| 'int'
|
|
96
|
+
| 'decimal'
|
|
97
|
+
| 'geopoint';
|
|
98
|
+
|
|
99
|
+
type TemporaryStringValueType = Exclude<ValueType, SupportedNoteValueType>;
|
|
100
|
+
|
|
101
|
+
export type TemporaryStringValueNoteNode = NoteNode<TemporaryStringValueType>;
|
|
102
|
+
|
|
103
|
+
// prettier-ignore
|
|
104
|
+
export type AnyNoteNode =
|
|
105
|
+
// eslint-disable-next-line @typescript-eslint/sort-type-constituents
|
|
106
|
+
| StringNoteNode
|
|
107
|
+
| IntNoteNode
|
|
108
|
+
| DecimalNoteNode
|
|
109
|
+
| GeopointNoteNode
|
|
110
|
+
| TemporaryStringValueNoteNode;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { RuntimeInputValue, RuntimeValue } from '../lib/codecs/getSharedValueCodec.ts';
|
|
2
|
+
import type { RangeNodeDefinition, RangeValueType } from '../parse/model/RangeNodeDefinition.ts';
|
|
3
|
+
import type { BaseValueNode, BaseValueNodeState } from './BaseValueNode.ts';
|
|
4
|
+
import type { NodeAppearances } from './NodeAppearances.ts';
|
|
5
|
+
import type { RootNode } from './RootNode.ts';
|
|
6
|
+
import type { GeneralParentNode } from './hierarchy.ts';
|
|
7
|
+
import type { LeafNodeValidationState } from './validation.ts';
|
|
8
|
+
|
|
9
|
+
export type { RangeValueType };
|
|
10
|
+
|
|
11
|
+
export type RangeValue<V extends RangeValueType> = RuntimeValue<V>;
|
|
12
|
+
|
|
13
|
+
export type RangeInputValue<V extends RangeValueType> = RuntimeInputValue<V>;
|
|
14
|
+
|
|
15
|
+
export interface RangeNodeState<V extends RangeValueType>
|
|
16
|
+
extends BaseValueNodeState<RangeValue<V>> {
|
|
17
|
+
get valueOptions(): null;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type RangeNodeAppearances = NodeAppearances<RangeNodeDefinition>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* A node corresponding to form field defined as an
|
|
24
|
+
* {@link https://getodk.github.io/xforms-spec/#body-elements | XForms `<range>`}.
|
|
25
|
+
*/
|
|
26
|
+
export interface RangeNode<V extends RangeValueType = RangeValueType>
|
|
27
|
+
extends BaseValueNode<V, RangeValue<V>> {
|
|
28
|
+
readonly nodeType: 'range';
|
|
29
|
+
readonly valueType: V;
|
|
30
|
+
readonly appearances: RangeNodeAppearances;
|
|
31
|
+
readonly nodeOptions: null;
|
|
32
|
+
readonly definition: RangeNodeDefinition<V>;
|
|
33
|
+
readonly root: RootNode;
|
|
34
|
+
readonly parent: GeneralParentNode;
|
|
35
|
+
readonly currentState: RangeNodeState<V>;
|
|
36
|
+
readonly validationState: LeafNodeValidationState;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* For use by a client to update the value of an {@link RangeNode}.
|
|
40
|
+
*/
|
|
41
|
+
setValue(value: RangeInputValue<V>): RootNode;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type IntRangeNode = RangeNode<'int'>;
|
|
45
|
+
export type DecimalRangeNode = RangeNode<'decimal'>;
|
|
46
|
+
|
|
47
|
+
// prettier-ignore
|
|
48
|
+
export type AnyRangeNode =
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/sort-type-constituents
|
|
50
|
+
| IntRangeNode
|
|
51
|
+
| DecimalRangeNode;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { RankControlDefinition } from '../parse/body/control/RankControlDefinition.ts';
|
|
2
|
+
import type { LeafNodeDefinition } from '../parse/model/LeafNodeDefinition.ts';
|
|
3
|
+
import type { BaseValueNode, BaseValueNodeState } from './BaseValueNode.ts';
|
|
4
|
+
import type { RootNode } from './RootNode.ts';
|
|
5
|
+
import type { TextRange } from './TextRange.ts';
|
|
6
|
+
import type { GeneralParentNode } from './hierarchy.ts';
|
|
7
|
+
import type { LeafNodeValidationState } from './validation.ts';
|
|
8
|
+
import type { UnknownAppearanceDefinition } from '../parse/body/appearance/unknownAppearanceParser.ts';
|
|
9
|
+
import type { ValueType } from './ValueType.ts';
|
|
10
|
+
|
|
11
|
+
export interface RankItem {
|
|
12
|
+
get label(): TextRange<'item-label'>;
|
|
13
|
+
get value(): string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type RankValueOptions = readonly RankItem[];
|
|
17
|
+
|
|
18
|
+
export interface RankNodeState extends BaseValueNodeState<readonly string[]> {
|
|
19
|
+
get valueOptions(): RankValueOptions;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* An ordered collection of values from {@link RankItem}.
|
|
23
|
+
* The order of the items is important and must be preserved during processing.
|
|
24
|
+
*/
|
|
25
|
+
get value(): readonly string[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface RankDefinition<V extends ValueType = ValueType> extends LeafNodeDefinition<V> {
|
|
29
|
+
readonly bodyElement: RankControlDefinition;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface RankNode extends BaseValueNode<'string', readonly string[]> {
|
|
33
|
+
readonly nodeType: 'rank';
|
|
34
|
+
readonly appearances: UnknownAppearanceDefinition;
|
|
35
|
+
readonly nodeOptions: null;
|
|
36
|
+
readonly valueType: 'string';
|
|
37
|
+
readonly definition: RankDefinition<'string'>;
|
|
38
|
+
readonly root: RootNode;
|
|
39
|
+
readonly parent: GeneralParentNode;
|
|
40
|
+
readonly currentState: RankNodeState;
|
|
41
|
+
readonly validationState: LeafNodeValidationState;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Convenience API to get the {@link RankItem}'s label.
|
|
45
|
+
*/
|
|
46
|
+
getValueLabel(value: string): TextRange<'item-label'> | null;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Set the value which is an ordered collection of values from {@link RankItem}.
|
|
50
|
+
* Calling this setter replaces the currently value.
|
|
51
|
+
* If called with an empty array, the current is cleared.
|
|
52
|
+
*/
|
|
53
|
+
setValues(values: readonly string[]): RootNode;
|
|
54
|
+
}
|
package/src/client/RootNode.ts
CHANGED
|
@@ -3,8 +3,12 @@ import type { RootDefinition } from '../parse/model/RootDefinition.ts';
|
|
|
3
3
|
import type { BaseNode, BaseNodeState } from './BaseNode.ts';
|
|
4
4
|
import type { ActiveLanguage, FormLanguage, FormLanguages } from './FormLanguage.ts';
|
|
5
5
|
import type { GeneralChildNode } from './hierarchy.ts';
|
|
6
|
-
import type {
|
|
7
|
-
|
|
6
|
+
import type {
|
|
7
|
+
ChunkedInstancePayload,
|
|
8
|
+
InstancePayload,
|
|
9
|
+
MonolithicInstancePayload,
|
|
10
|
+
} from './serialization/InstancePayload.ts';
|
|
11
|
+
import type { InstancePayloadOptions } from './serialization/InstancePayloadOptions.ts';
|
|
8
12
|
import type { AncestorNodeValidationState } from './validation.ts';
|
|
9
13
|
|
|
10
14
|
export interface RootNodeState extends BaseNodeState {
|
|
@@ -29,6 +33,8 @@ export interface RootNode extends BaseNode {
|
|
|
29
33
|
*/
|
|
30
34
|
readonly appearances: null;
|
|
31
35
|
|
|
36
|
+
readonly nodeOptions: null;
|
|
37
|
+
|
|
32
38
|
/**
|
|
33
39
|
* @todo This is another odd deviation in {@link RootNode}. Unlike
|
|
34
40
|
* {@link languages}, it doesn't feel particularly **essential**. While it
|
|
@@ -58,33 +64,41 @@ export interface RootNode extends BaseNode {
|
|
|
58
64
|
setLanguage(language: FormLanguage): RootNode;
|
|
59
65
|
|
|
60
66
|
/**
|
|
61
|
-
* Prepares the current form instance state
|
|
67
|
+
* Prepares the current form instance state as an {@link InstancePayload}.
|
|
62
68
|
*
|
|
63
|
-
* A
|
|
64
|
-
*
|
|
65
|
-
* two purposes:
|
|
69
|
+
* A payload will be prepared even if the current form state includes
|
|
70
|
+
* `constraint` or `required` violations. This supports serveral purposes:
|
|
66
71
|
*
|
|
67
|
-
* - A client may effectively use this method as a part of its
|
|
68
|
-
*
|
|
72
|
+
* - A client may effectively use this method as a part of its "submit"
|
|
73
|
+
* workflow, and use any violations included in the {@link InstancePayload}
|
|
69
74
|
* to prompt users to address those violations.
|
|
70
75
|
*
|
|
71
|
-
* - A client may inspect the
|
|
76
|
+
* - A client may inspect the serialized instance state of a form at any time.
|
|
72
77
|
* Depending on the client and use case, this may be a convenience (e.g. for
|
|
73
78
|
* developers to inspect that form state at a current point in time); or it
|
|
74
79
|
* may provide necessary functionality (e.g. for test or tooling clients).
|
|
75
80
|
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
81
|
+
* - A client may capture _incomplete_ instance state (e.g. for storage in
|
|
82
|
+
* client-side storage or similar persistance layer), to resume filling the
|
|
83
|
+
* instance at a later time.
|
|
84
|
+
*
|
|
85
|
+
* Note on asynchrony: preparing a {@link InstancePayload} is expected to be a
|
|
86
|
+
* fast operation. It may even be nearly instantaneous, or roughly
|
|
78
87
|
* proportionate to the size of the form itself. However, this method is
|
|
79
88
|
* designed to be asynchronous out of an abundance of caution, anticipating
|
|
80
89
|
* that some as-yet undeveloped operations on binary data (e.g. form
|
|
81
90
|
* attachments) may themselves impose asynchrony (i.e. by interfaces provided
|
|
82
91
|
* by the platform and/or external dependencies).
|
|
83
92
|
*
|
|
84
|
-
* A client may specify {@link
|
|
85
|
-
* {@link
|
|
93
|
+
* A client may specify {@link InstancePayloadOptions<'chunked'>}, in which
|
|
94
|
+
* case a {@link ChunkedInstancePayload} will be produced, with form
|
|
95
|
+
* attachments
|
|
86
96
|
*/
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
97
|
+
prepareInstancePayload(): Promise<MonolithicInstancePayload>;
|
|
98
|
+
prepareInstancePayload(
|
|
99
|
+
options: InstancePayloadOptions<'monolithic'>
|
|
100
|
+
): Promise<MonolithicInstancePayload>;
|
|
101
|
+
prepareInstancePayload(
|
|
102
|
+
options: InstancePayloadOptions<'chunked'>
|
|
103
|
+
): Promise<ChunkedInstancePayload>;
|
|
90
104
|
}
|
package/src/client/SelectNode.ts
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type {
|
|
2
|
+
AnySelectControlDefinition,
|
|
3
|
+
SelectType,
|
|
4
|
+
} from '../parse/body/control/SelectControlDefinition.ts';
|
|
2
5
|
import type { LeafNodeDefinition } from '../parse/model/LeafNodeDefinition.ts';
|
|
3
|
-
import type {
|
|
4
|
-
import type { InputNode } from './InputNode.ts';
|
|
6
|
+
import type { BaseValueNode, BaseValueNodeState } from './BaseValueNode.ts';
|
|
5
7
|
import type { NodeAppearances } from './NodeAppearances.ts';
|
|
6
8
|
import type { RootNode } from './RootNode.ts';
|
|
7
9
|
import type { TextRange } from './TextRange.ts';
|
|
10
|
+
import type { ValueType } from './ValueType.ts';
|
|
8
11
|
import type { GeneralParentNode } from './hierarchy.ts';
|
|
9
12
|
import type { LeafNodeValidationState } from './validation.ts';
|
|
10
13
|
|
|
11
14
|
export interface SelectItem {
|
|
15
|
+
get label(): TextRange<'item-label'>;
|
|
12
16
|
get value(): string;
|
|
13
|
-
get label(): TextRange<'item-label'> | null;
|
|
14
17
|
}
|
|
15
18
|
|
|
16
|
-
export
|
|
19
|
+
export type SelectValueOptions = readonly SelectItem[];
|
|
20
|
+
|
|
21
|
+
export interface SelectNodeState extends BaseValueNodeState<readonly string[]> {
|
|
17
22
|
get children(): null;
|
|
18
23
|
|
|
19
|
-
/**
|
|
20
|
-
* @todo should {@link BaseNodeState} include this??
|
|
21
|
-
*/
|
|
22
24
|
get valueOptions(): readonly SelectItem[];
|
|
23
25
|
|
|
24
26
|
/**
|
|
@@ -33,43 +35,68 @@ export interface SelectNodeState extends BaseNodeState {
|
|
|
33
35
|
* Should a `SelectNodeState` have this `value` type, whereas a hypothetical
|
|
34
36
|
* `Select1NodeState` would have `get value(): SelectItem | null`?
|
|
35
37
|
*/
|
|
36
|
-
get value(): readonly
|
|
38
|
+
get value(): readonly string[];
|
|
37
39
|
}
|
|
38
40
|
|
|
39
|
-
export interface SelectDefinition extends LeafNodeDefinition {
|
|
40
|
-
readonly bodyElement:
|
|
41
|
+
export interface SelectDefinition<V extends ValueType = ValueType> extends LeafNodeDefinition<V> {
|
|
42
|
+
readonly bodyElement: AnySelectControlDefinition;
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
export type SelectNodeAppearances = NodeAppearances<SelectDefinition>;
|
|
44
46
|
|
|
45
|
-
export interface SelectNode extends
|
|
47
|
+
export interface SelectNode extends BaseValueNode<'string', readonly string[]> {
|
|
46
48
|
readonly nodeType: 'select';
|
|
49
|
+
readonly valueType: 'string';
|
|
50
|
+
readonly selectType: SelectType;
|
|
47
51
|
readonly appearances: SelectNodeAppearances;
|
|
48
|
-
readonly
|
|
52
|
+
readonly nodeOptions: null;
|
|
53
|
+
readonly definition: SelectDefinition<'string'>;
|
|
49
54
|
readonly root: RootNode;
|
|
50
55
|
readonly parent: GeneralParentNode;
|
|
51
56
|
readonly currentState: SelectNodeState;
|
|
52
57
|
readonly validationState: LeafNodeValidationState;
|
|
53
58
|
|
|
54
59
|
/**
|
|
55
|
-
*
|
|
60
|
+
* Convenience API to get the {@link SelectItem} which is associated with
|
|
61
|
+
* {@link value}, if one is currently available—i.e. if it is present in
|
|
62
|
+
* {@link SelectNodeState.valueOptions}.
|
|
63
|
+
*/
|
|
64
|
+
getValueOption(value: string): SelectItem | null;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Convenience API to determine if {@link value} is currently selected—i.e. if
|
|
68
|
+
* it is one of the selected values in {@link SelectNodeState.value}.
|
|
69
|
+
*/
|
|
70
|
+
isSelected(value: string): boolean;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Selects a single {@link value}, as provided by a {@link SelectItem.value}.
|
|
74
|
+
* Calling this setter replaces the currently selected value(s, if any),
|
|
75
|
+
* where:
|
|
56
76
|
*
|
|
57
|
-
* -
|
|
58
|
-
*
|
|
59
|
-
* {@link SelectNodeState.value}.
|
|
60
|
-
* - For fields defined with an XForms `<select1>`, calling this method will
|
|
61
|
-
* replace the selection (if any).
|
|
77
|
+
* - if the provided value is `null`, the current selection is cleared; ELSE
|
|
78
|
+
* - the provided value is selected in place of any currently selected values.
|
|
62
79
|
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
80
|
+
* This setter is most useful for {@link SelectNode}s associated with an
|
|
81
|
+
* XForms
|
|
82
|
+
* {@link https://getodk.github.io/xforms-spec/#body-elements | `<select1>`}
|
|
83
|
+
* control.
|
|
65
84
|
*/
|
|
66
|
-
|
|
85
|
+
selectValue(value: string | null): RootNode;
|
|
67
86
|
|
|
68
87
|
/**
|
|
69
|
-
*
|
|
70
|
-
* {@link
|
|
88
|
+
* Selects any number of {@link values}, as provided by any number of
|
|
89
|
+
* {@link SelectItem.value}s. Calling this setter replaces the currently
|
|
90
|
+
* selected value(s, if any). If called with an empty array, the current
|
|
91
|
+
* selection is cleared.
|
|
92
|
+
*
|
|
93
|
+
* This setter is most useful for {@link SelectNode}s associated with an
|
|
94
|
+
* XForms
|
|
95
|
+
* {@link https://getodk.github.io/xforms-spec/#body-elements | `<select>`}
|
|
96
|
+
* control.
|
|
71
97
|
*
|
|
72
|
-
*
|
|
98
|
+
* This setter _may_ be used with a `<select1>` control, in which case the
|
|
99
|
+
* provided {@link values} should produce at most one value.
|
|
73
100
|
*/
|
|
74
|
-
|
|
101
|
+
selectValues(values: readonly string[]): RootNode;
|
|
75
102
|
}
|
|
@@ -52,6 +52,7 @@ export interface SubtreeDefinition extends BaseSubtreeDefinition {
|
|
|
52
52
|
export interface SubtreeNode extends BaseNode {
|
|
53
53
|
readonly nodeType: 'subtree';
|
|
54
54
|
readonly appearances: null;
|
|
55
|
+
readonly nodeOptions: null;
|
|
55
56
|
readonly definition: SubtreeDefinition;
|
|
56
57
|
readonly root: RootNode;
|
|
57
58
|
readonly parent: GeneralParentNode;
|