@getodk/xforms-engine 0.4.0 → 0.6.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 +18 -3
- package/dist/client/BaseValueNode.d.ts +32 -0
- package/dist/client/EngineConfig.d.ts +49 -48
- package/dist/client/GroupNode.d.ts +1 -0
- package/dist/client/InputNode.d.ts +82 -0
- package/dist/client/ModelValueNode.d.ts +13 -7
- package/dist/client/NoteNode.d.ts +26 -9
- package/dist/client/RangeNode.d.ts +36 -0
- package/dist/client/RankNode.d.ts +46 -0
- package/dist/client/RootNode.d.ts +37 -7
- 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/ValueType.d.ts +3 -0
- package/dist/client/constants.d.ts +50 -0
- package/dist/client/hierarchy.d.ts +8 -8
- package/dist/client/identity.d.ts +14 -0
- package/dist/client/node-types.d.ts +3 -2
- package/dist/client/resources.d.ts +93 -0
- package/dist/client/submission/SubmissionData.d.ts +7 -0
- package/dist/client/submission/SubmissionDefinition.d.ts +14 -0
- package/dist/client/submission/SubmissionInstanceFile.d.ts +6 -0
- package/dist/client/submission/SubmissionOptions.d.ts +23 -0
- package/dist/client/submission/SubmissionResult.d.ts +91 -0
- package/dist/client/submission/SubmissionState.d.ts +12 -0
- package/dist/client/unsupported/UnsupportedControlNode.d.ts +1 -3
- package/dist/client/validation.d.ts +2 -2
- package/dist/error/ErrorProductionDesignPendingError.d.ts +7 -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/ValueTypeInvariantError.d.ts +17 -0
- package/dist/error/XFormsSpecViolationError.d.ts +2 -0
- package/dist/error/XPathFunctionalityError.d.ts +14 -0
- package/dist/error/XPathFunctionalityNotSupportedError.d.ts +7 -0
- package/dist/error/XPathFunctionalityPendingError.d.ts +7 -0
- package/dist/index.d.ts +12 -4
- package/dist/index.js +17864 -14655
- package/dist/index.js.map +1 -1
- package/dist/instance/Group.d.ts +10 -4
- package/dist/instance/InputControl.d.ts +38 -0
- package/dist/instance/ModelValue.d.ts +17 -25
- package/dist/instance/Note.d.ts +16 -21
- package/dist/instance/PrimaryInstance.d.ts +85 -0
- package/dist/instance/RangeControl.d.ts +34 -0
- package/dist/instance/RankControl.d.ts +40 -0
- package/dist/instance/Root.d.ts +30 -25
- package/dist/instance/SelectControl.d.ts +66 -0
- package/dist/instance/Subtree.d.ts +11 -5
- package/dist/instance/TriggerControl.d.ts +13 -19
- package/dist/instance/abstract/DescendantNode.d.ts +32 -25
- package/dist/instance/abstract/InstanceNode.d.ts +52 -30
- package/dist/instance/abstract/UnsupportedControl.d.ts +11 -3
- package/dist/instance/abstract/ValueNode.d.ts +47 -0
- package/dist/instance/hierarchy.d.ts +13 -12
- package/dist/instance/identity.d.ts +2 -7
- package/dist/instance/internal-api/EvaluationContext.d.ts +53 -12
- package/dist/instance/internal-api/InstanceConfig.d.ts +8 -2
- package/dist/instance/internal-api/InstanceValueContext.d.ts +22 -0
- package/dist/instance/internal-api/PrimaryInstanceDocument.d.ts +36 -0
- package/dist/instance/internal-api/TranslationContext.d.ts +3 -2
- package/dist/instance/internal-api/ValidationContext.d.ts +3 -4
- package/dist/instance/internal-api/ValueContext.d.ts +2 -1
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableInstance.d.ts +14 -0
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableLeafNode.d.ts +32 -0
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableParentNode.d.ts +19 -0
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableValueNode.d.ts +18 -0
- package/dist/instance/repeat/BaseRepeatRange.d.ts +40 -83
- package/dist/instance/repeat/RepeatInstance.d.ts +12 -29
- package/dist/instance/repeat/RepeatRangeControlled.d.ts +2 -2
- package/dist/instance/repeat/RepeatRangeUncontrolled.d.ts +2 -2
- package/dist/instance/resource.d.ts +1 -1
- package/dist/instance/text/TextRange.d.ts +1 -1
- package/dist/instance/unsupported/UploadControl.d.ts +3 -1
- package/dist/integration/xpath/EngineXPathEvaluator.d.ts +14 -0
- package/dist/integration/xpath/adapter/XFormsXPathNode.d.ts +71 -0
- package/dist/integration/xpath/adapter/engineDOMAdapter.d.ts +5 -0
- package/dist/integration/xpath/adapter/kind.d.ts +32 -0
- package/dist/integration/xpath/adapter/names.d.ts +6 -0
- package/dist/integration/xpath/adapter/traversal.d.ts +26 -0
- package/dist/integration/xpath/adapter/values.d.ts +2 -0
- package/dist/integration/xpath/static-dom/StaticAttribute.d.ts +26 -0
- package/dist/integration/xpath/static-dom/StaticDocument.d.ts +15 -0
- package/dist/integration/xpath/static-dom/StaticElement.d.ts +48 -0
- package/dist/integration/xpath/static-dom/StaticNode.d.ts +33 -0
- package/dist/integration/xpath/static-dom/StaticText.d.ts +16 -0
- package/dist/lib/client-reactivity/submission/createInstanceSubmissionState.d.ts +3 -0
- package/dist/lib/client-reactivity/submission/createLeafNodeSubmissionState.d.ts +3 -0
- package/dist/lib/client-reactivity/submission/createNodeRangeSubmissionState.d.ts +4 -0
- package/dist/lib/client-reactivity/submission/createParentNodeSubmissionState.d.ts +4 -0
- package/dist/lib/client-reactivity/submission/createRootSubmissionState.d.ts +3 -0
- package/dist/lib/client-reactivity/submission/createValueNodeSubmissionState.d.ts +3 -0
- package/dist/lib/client-reactivity/submission/prepareSubmission.d.ts +8 -0
- package/dist/lib/codecs/DecimalValueCodec.d.ts +6 -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/IntValueCodec.d.ts +6 -0
- package/dist/lib/codecs/NoteCodec.d.ts +8 -0
- package/dist/lib/codecs/RangeCodec.d.ts +8 -0
- package/dist/lib/codecs/StringValueCodec.d.ts +4 -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 +30 -0
- package/dist/lib/codecs/ValueTypePlaceholderCodec.d.ts +12 -0
- 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 +48 -0
- 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 +4 -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/number-parsers.d.ts +2 -0
- package/dist/lib/reactivity/createChildrenState.d.ts +7 -5
- package/dist/lib/reactivity/createComputedExpression.d.ts +18 -5
- package/dist/lib/reactivity/createInstanceValueState.d.ts +40 -0
- package/dist/lib/reactivity/createItemCollection.d.ts +21 -0
- package/dist/lib/reactivity/createNoteReadonlyThunk.d.ts +2 -2
- package/dist/lib/reactivity/createTranslationState.d.ts +19 -0
- package/dist/lib/reactivity/createValueState.d.ts +6 -10
- package/dist/lib/reactivity/materializeCurrentStateChildren.d.ts +4 -4
- package/dist/lib/xml-serialization.d.ts +50 -0
- package/dist/parse/XFormDOM.d.ts +18 -7
- package/dist/parse/XFormDefinition.d.ts +1 -2
- package/dist/parse/attachments/FormAttachmentResource.d.ts +27 -0
- package/dist/parse/body/BodyDefinition.d.ts +4 -4
- package/dist/parse/body/RepeatElementDefinition.d.ts +1 -1
- package/dist/parse/body/appearance/inputAppearanceParser.d.ts +1 -1
- package/dist/parse/body/appearance/rangeAppearanceParser.d.ts +3 -0
- package/dist/parse/body/control/{InputDefinition.d.ts → InputControlDefinition.d.ts} +4 -1
- 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/expression/abstract/DependencyContext.d.ts +0 -5
- package/dist/parse/expression/abstract/DependentExpression.d.ts +2 -3
- package/dist/parse/model/BindDefinition.d.ts +6 -5
- package/dist/parse/model/BindPreloadDefinition.d.ts +42 -0
- package/dist/parse/model/BindTypeDefinition.d.ts +20 -0
- package/dist/parse/model/DescendentNodeDefinition.d.ts +4 -14
- package/dist/parse/model/FormSubmissionDefinition.d.ts +8 -0
- package/dist/parse/model/ItextTranslation/ItextTranslationDefinition.d.ts +4 -0
- package/dist/parse/model/ItextTranslation/ItextTranslationRootDefinition.d.ts +9 -0
- package/dist/parse/model/ItextTranslation/ItextTranslationsDefinition.d.ts +8 -0
- package/dist/parse/model/LeafNodeDefinition.d.ts +9 -4
- package/dist/parse/model/ModelBindMap.d.ts +1 -1
- package/dist/parse/model/ModelDefinition.d.ts +2 -0
- package/dist/parse/model/NodeDefinition.d.ts +16 -20
- package/dist/parse/model/NoteNodeDefinition.d.ts +9 -8
- package/dist/parse/model/RangeNodeDefinition.d.ts +41 -0
- package/dist/parse/model/RepeatInstanceDefinition.d.ts +7 -4
- package/dist/parse/model/RepeatRangeDefinition.d.ts +7 -4
- package/dist/parse/model/RepeatTemplateDefinition.d.ts +7 -4
- package/dist/parse/model/RootAttributeDefinition.d.ts +24 -0
- package/dist/parse/model/RootAttributeMap.d.ts +23 -0
- package/dist/parse/model/RootDefinition.d.ts +12 -9
- package/dist/parse/model/SecondaryInstance/SecondaryInstanceDefinition.d.ts +4 -0
- package/dist/parse/model/SecondaryInstance/SecondaryInstanceRootDefinition.d.ts +7 -0
- package/dist/parse/model/SecondaryInstance/SecondaryInstancesDefinition.d.ts +13 -0
- package/dist/parse/model/SecondaryInstance/sources/BlankSecondaryInstanceSource.d.ts +14 -0
- package/dist/parse/model/SecondaryInstance/sources/CSVExternalSecondaryInstance.d.ts +22 -0
- package/dist/parse/model/SecondaryInstance/sources/ExternalSecondaryInstanceResource.d.ts +23 -0
- package/dist/parse/model/SecondaryInstance/sources/ExternalSecondaryInstanceSource.d.ts +9 -0
- package/dist/parse/model/SecondaryInstance/sources/GeoJSONExternalSecondaryInstance.d.ts +5 -0
- package/dist/parse/model/SecondaryInstance/sources/InternalSecondaryInstanceSource.d.ts +7 -0
- package/dist/parse/model/SecondaryInstance/sources/SecondaryInstanceSource.d.ts +13 -0
- package/dist/parse/model/SecondaryInstance/sources/XMLExternalSecondaryInstanceSource.d.ts +12 -0
- package/dist/parse/model/SubtreeDefinition.d.ts +7 -4
- package/dist/parse/shared/parseStaticDocumentFromDOMSubtree.d.ts +23 -0
- 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/text/abstract/TextRangeDefinition.d.ts +0 -2
- package/dist/parse/xpath/semantic-analysis.d.ts +6 -3
- package/dist/solid.js +15437 -12246
- package/dist/solid.js.map +1 -1
- package/package.json +18 -13
- package/src/client/BaseNode.ts +21 -6
- package/src/client/BaseValueNode.ts +35 -0
- package/src/client/EngineConfig.ts +52 -51
- package/src/client/GroupNode.ts +1 -0
- package/src/client/InputNode.ts +113 -0
- package/src/client/ModelValueNode.ts +31 -7
- package/src/client/NoteNode.ts +45 -9
- package/src/client/RangeNode.ts +51 -0
- package/src/client/RankNode.ts +54 -0
- package/src/client/RootNode.ts +43 -7
- package/src/client/SelectNode.ts +53 -26
- package/src/client/SubtreeNode.ts +1 -0
- package/src/client/TriggerNode.ts +12 -6
- package/src/client/ValueType.ts +4 -0
- package/src/client/constants.ts +67 -0
- package/src/client/hierarchy.ts +12 -13
- package/src/client/identity.ts +16 -0
- package/src/client/node-types.ts +13 -7
- package/src/client/resources.ts +118 -0
- package/src/client/submission/SubmissionData.ts +12 -0
- package/src/client/submission/SubmissionDefinition.ts +16 -0
- package/src/client/submission/SubmissionInstanceFile.ts +9 -0
- package/src/client/submission/SubmissionOptions.ts +28 -0
- package/src/client/submission/SubmissionResult.ts +124 -0
- package/src/client/submission/SubmissionState.ts +14 -0
- package/src/client/unsupported/UnsupportedControlNode.ts +2 -6
- package/src/client/validation.ts +2 -2
- package/src/error/ErrorProductionDesignPendingError.ts +6 -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/ValueTypeInvariantError.ts +22 -0
- package/src/error/XFormsSpecViolationError.ts +1 -0
- package/src/error/XPathFunctionalityError.ts +26 -0
- package/src/error/XPathFunctionalityNotSupportedError.ts +18 -0
- package/src/error/XPathFunctionalityPendingError.ts +18 -0
- package/src/index.ts +12 -13
- package/src/instance/Group.ts +18 -5
- package/src/instance/InputControl.ts +159 -0
- package/src/instance/ModelValue.ts +48 -53
- package/src/instance/Note.ts +40 -49
- package/src/instance/PrimaryInstance.ts +245 -0
- package/src/instance/RangeControl.ts +113 -0
- package/src/instance/RankControl.ts +199 -0
- package/src/instance/Root.ts +63 -134
- package/src/instance/SelectControl.ts +219 -0
- package/src/instance/Subtree.ts +20 -7
- package/src/instance/TriggerControl.ts +44 -66
- package/src/instance/abstract/DescendantNode.ts +91 -51
- package/src/instance/abstract/InstanceNode.ts +113 -107
- package/src/instance/abstract/UnsupportedControl.ts +29 -5
- package/src/instance/abstract/ValueNode.ts +128 -0
- package/src/instance/children.ts +80 -40
- package/src/instance/hierarchy.ts +39 -30
- package/src/instance/identity.ts +3 -9
- package/src/instance/index.ts +25 -7
- package/src/instance/internal-api/EvaluationContext.ts +60 -13
- package/src/instance/internal-api/InstanceConfig.ts +9 -2
- package/src/instance/internal-api/InstanceValueContext.ts +26 -0
- package/src/instance/internal-api/PrimaryInstanceDocument.ts +53 -0
- package/src/instance/internal-api/TranslationContext.ts +3 -2
- package/src/instance/internal-api/ValidationContext.ts +3 -4
- package/src/instance/internal-api/ValueContext.ts +2 -1
- package/src/instance/internal-api/submission/ClientReactiveSubmittableInstance.ts +20 -0
- package/src/instance/internal-api/submission/ClientReactiveSubmittableLeafNode.ts +43 -0
- package/src/instance/internal-api/submission/ClientReactiveSubmittableParentNode.ts +26 -0
- package/src/instance/internal-api/submission/ClientReactiveSubmittableValueNode.ts +24 -0
- package/src/instance/repeat/BaseRepeatRange.ts +52 -131
- package/src/instance/repeat/RepeatInstance.ts +21 -46
- package/src/instance/repeat/RepeatRangeControlled.ts +5 -5
- package/src/instance/repeat/RepeatRangeUncontrolled.ts +2 -4
- package/src/instance/resource.ts +5 -2
- package/src/instance/text/TextChunk.ts +1 -1
- package/src/instance/unsupported/UploadControl.ts +5 -1
- package/src/integration/xpath/EngineXPathEvaluator.ts +22 -0
- package/src/integration/xpath/adapter/XFormsXPathNode.ts +126 -0
- package/src/integration/xpath/adapter/engineDOMAdapter.ts +57 -0
- package/src/integration/xpath/adapter/kind.ts +114 -0
- package/src/integration/xpath/adapter/names.ts +148 -0
- package/src/integration/xpath/adapter/traversal.ts +229 -0
- package/src/integration/xpath/adapter/values.ts +5 -0
- package/src/integration/xpath/static-dom/StaticAttribute.ts +41 -0
- package/src/integration/xpath/static-dom/StaticDocument.ts +36 -0
- package/src/integration/xpath/static-dom/StaticElement.ts +119 -0
- package/src/integration/xpath/static-dom/StaticNode.ts +68 -0
- package/src/integration/xpath/static-dom/StaticText.ts +28 -0
- package/src/lib/client-reactivity/README.md +0 -0
- package/src/lib/client-reactivity/submission/createInstanceSubmissionState.ts +12 -0
- package/src/lib/client-reactivity/submission/createLeafNodeSubmissionState.ts +20 -0
- package/src/lib/client-reactivity/submission/createNodeRangeSubmissionState.ts +17 -0
- package/src/lib/client-reactivity/submission/createParentNodeSubmissionState.ts +22 -0
- package/src/lib/client-reactivity/submission/createRootSubmissionState.ts +19 -0
- package/src/lib/client-reactivity/submission/createValueNodeSubmissionState.ts +21 -0
- package/src/lib/client-reactivity/submission/prepareSubmission.ts +172 -0
- package/src/lib/codecs/DecimalValueCodec.ts +46 -0
- package/src/lib/codecs/Geopoint/Geopoint.ts +150 -0
- package/src/lib/codecs/Geopoint/GeopointValueCodec.ts +20 -0
- package/src/lib/codecs/IntValueCodec.ts +100 -0
- package/src/lib/codecs/NoteCodec.ts +32 -0
- package/src/lib/codecs/RangeCodec.ts +65 -0
- package/src/lib/codecs/StringValueCodec.ts +11 -0
- package/src/lib/codecs/TriggerCodec.ts +64 -0
- package/src/lib/codecs/ValueArrayCodec.ts +42 -0
- package/src/lib/codecs/ValueCodec.ts +106 -0
- package/src/lib/codecs/ValueTypePlaceholderCodec.ts +19 -0
- package/src/lib/codecs/getNoteCodec.ts +27 -0
- package/src/lib/codecs/getSelectCodec.ts +27 -0
- package/src/lib/codecs/getSharedValueCodec.ts +79 -0
- 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 +8 -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/number-parsers.ts +25 -0
- package/src/lib/reactivity/createChildrenState.ts +8 -6
- package/src/lib/reactivity/createComputedExpression.ts +57 -34
- package/src/lib/reactivity/createInstanceValueState.ts +216 -0
- package/src/lib/reactivity/createItemCollection.ts +173 -0
- package/src/lib/reactivity/createNoteReadonlyThunk.ts +12 -7
- package/src/lib/reactivity/createTranslationState.ts +61 -0
- package/src/lib/reactivity/createValueState.ts +62 -120
- package/src/lib/reactivity/materializeCurrentStateChildren.ts +7 -7
- package/src/lib/reactivity/text/createTextRange.ts +4 -3
- package/src/lib/reactivity/validation/createAggregatedViolations.ts +1 -1
- package/src/lib/reactivity/validation/createValidation.ts +2 -3
- package/src/lib/xml-serialization.ts +163 -0
- package/src/parse/XFormDOM.ts +231 -76
- package/src/parse/XFormDefinition.ts +2 -10
- package/src/parse/attachments/FormAttachmentResource.ts +40 -0
- package/src/parse/body/BodyDefinition.ts +7 -7
- package/src/parse/body/appearance/inputAppearanceParser.ts +1 -1
- package/src/parse/body/appearance/rangeAppearanceParser.ts +11 -0
- package/src/parse/body/control/InputControlDefinition.ts +29 -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/expression/abstract/DependencyContext.ts +0 -26
- package/src/parse/expression/abstract/DependentExpression.ts +2 -13
- package/src/parse/model/BindDefinition.ts +9 -8
- package/src/parse/model/BindPreloadDefinition.ts +100 -0
- package/src/parse/model/BindTypeDefinition.ts +175 -0
- package/src/parse/model/DescendentNodeDefinition.ts +7 -31
- package/src/parse/model/FormSubmissionDefinition.ts +44 -0
- package/src/parse/model/ItextTranslation/ItextTranslationDefinition.ts +4 -0
- package/src/parse/model/ItextTranslation/ItextTranslationRootDefinition.ts +42 -0
- package/src/parse/model/ItextTranslation/ItextTranslationsDefinition.ts +31 -0
- package/src/parse/model/LeafNodeDefinition.ts +15 -5
- package/src/parse/model/ModelBindMap.ts +6 -8
- package/src/parse/model/ModelDefinition.ts +6 -1
- package/src/parse/model/NodeDefinition.ts +24 -48
- package/src/parse/model/NoteNodeDefinition.ts +11 -10
- package/src/parse/model/RangeNodeDefinition.ts +118 -0
- package/src/parse/model/RepeatInstanceDefinition.ts +11 -7
- package/src/parse/model/RepeatRangeDefinition.ts +11 -7
- package/src/parse/model/RepeatTemplateDefinition.ts +11 -7
- package/src/parse/model/RootAttributeDefinition.ts +45 -0
- package/src/parse/model/RootAttributeMap.ts +44 -0
- package/src/parse/model/RootDefinition.ts +31 -29
- package/src/parse/model/SecondaryInstance/SecondaryInstanceDefinition.ts +4 -0
- package/src/parse/model/SecondaryInstance/SecondaryInstanceRootDefinition.ts +12 -0
- package/src/parse/model/SecondaryInstance/SecondaryInstancesDefinition.ts +102 -0
- package/src/parse/model/SecondaryInstance/sources/BlankSecondaryInstanceSource.ts +40 -0
- package/src/parse/model/SecondaryInstance/sources/CSVExternalSecondaryInstance.ts +288 -0
- package/src/parse/model/SecondaryInstance/sources/ExternalSecondaryInstanceResource.ts +222 -0
- package/src/parse/model/SecondaryInstance/sources/ExternalSecondaryInstanceSource.ts +22 -0
- package/src/parse/model/SecondaryInstance/sources/GeoJSONExternalSecondaryInstance.ts +415 -0
- package/src/parse/model/SecondaryInstance/sources/InternalSecondaryInstanceSource.ts +19 -0
- package/src/parse/model/SecondaryInstance/sources/SecondaryInstanceSource.ts +29 -0
- package/src/parse/model/SecondaryInstance/sources/XMLExternalSecondaryInstanceSource.ts +32 -0
- package/src/parse/model/SubtreeDefinition.ts +12 -12
- package/src/parse/shared/parseStaticDocumentFromDOMSubtree.ts +149 -0
- 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/text/abstract/TextRangeDefinition.ts +0 -6
- package/src/parse/xpath/semantic-analysis.ts +33 -3
- package/dist/client/StringNode.d.ts +0 -46
- 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 -50
- package/dist/instance/StringField.d.ts +0 -44
- package/dist/instance/internal-api/SubscribableDependency.d.ts +0 -59
- package/dist/instance/unsupported/RangeControl.d.ts +0 -4
- package/dist/instance/unsupported/RankControl.d.ts +0 -4
- package/dist/lib/reactivity/createSelectItems.d.ts +0 -16
- package/dist/parse/XFormDataType.d.ts +0 -25
- 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 -11
- package/src/client/StringNode.ts +0 -52
- package/src/client/unsupported/RangeNode.ts +0 -14
- package/src/client/unsupported/RankNode.ts +0 -14
- package/src/instance/SelectField.ts +0 -226
- package/src/instance/StringField.ts +0 -120
- package/src/instance/internal-api/SubscribableDependency.ts +0 -61
- package/src/instance/unsupported/RangeControl.ts +0 -5
- package/src/instance/unsupported/RankControl.ts +0 -5
- package/src/lib/reactivity/createSelectItems.ts +0 -168
- package/src/parse/XFormDataType.ts +0 -62
- package/src/parse/body/control/InputDefinition.ts +0 -22
- package/src/parse/body/control/select/ItemsetNodesetContext.ts +0 -26
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { XPathNodeKindKey } from '@getodk/xpath';
|
|
2
|
+
import { XFormsXPathNode } from '../adapter/XFormsXPathNode.ts';
|
|
3
|
+
import { StaticAttribute } from './StaticAttribute.ts';
|
|
4
|
+
import { StaticDocument } from './StaticDocument.ts';
|
|
5
|
+
import { StaticElement } from './StaticElement.ts';
|
|
6
|
+
import { StaticText } from './StaticText.ts';
|
|
7
|
+
export type StaticNodeKind = 'document' | 'element' | 'attribute' | 'text';
|
|
8
|
+
export type StaticNodeType<Kind extends StaticNodeKind> = `static-${Kind}`;
|
|
9
|
+
export declare abstract class StaticNode<Kind extends StaticNodeKind> implements XFormsXPathNode {
|
|
10
|
+
abstract readonly [XPathNodeKindKey]: Kind;
|
|
11
|
+
abstract readonly nodeType: StaticNodeType<Kind>;
|
|
12
|
+
/**
|
|
13
|
+
* A concrete {@link StaticDocument} instance, representing the topmost node
|
|
14
|
+
* of a static document tree, containing all of:
|
|
15
|
+
*
|
|
16
|
+
* - {@link root}
|
|
17
|
+
* - {@link children}
|
|
18
|
+
* - any {@link StaticChildNode} descendants of either of the above
|
|
19
|
+
*/
|
|
20
|
+
abstract readonly rootDocument: StaticDocument;
|
|
21
|
+
/**
|
|
22
|
+
* A concrete {@link StaticElement} instance, representing the single,
|
|
23
|
+
* immediate child of {@link rootDocument}, containing all other descendants
|
|
24
|
+
* of its document tree.
|
|
25
|
+
*/
|
|
26
|
+
abstract readonly root: StaticElement;
|
|
27
|
+
abstract readonly children: readonly StaticChildNode[] | null;
|
|
28
|
+
getXPathChildNodes(): readonly StaticChildNode[];
|
|
29
|
+
abstract getXPathValue(): string;
|
|
30
|
+
}
|
|
31
|
+
export type AnyStaticNode = StaticDocument | StaticElement | StaticAttribute | StaticText;
|
|
32
|
+
export type StaticParentNode = StaticDocument | StaticElement;
|
|
33
|
+
export type StaticChildNode = StaticElement | StaticText;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { XPathNodeKindKey } from '@getodk/xpath';
|
|
2
|
+
import { XFormsXPathText } from '../adapter/XFormsXPathNode.ts';
|
|
3
|
+
import { StaticDocument } from './StaticDocument.ts';
|
|
4
|
+
import { StaticElement } from './StaticElement.ts';
|
|
5
|
+
import { StaticNode } from './StaticNode.ts';
|
|
6
|
+
export declare class StaticText extends StaticNode<'text'> implements XFormsXPathText {
|
|
7
|
+
readonly parent: StaticElement;
|
|
8
|
+
readonly value: string;
|
|
9
|
+
readonly [XPathNodeKindKey] = "text";
|
|
10
|
+
readonly nodeType = "static-text";
|
|
11
|
+
readonly rootDocument: StaticDocument;
|
|
12
|
+
readonly root: StaticElement;
|
|
13
|
+
readonly children: null;
|
|
14
|
+
constructor(parent: StaticElement, value: string);
|
|
15
|
+
getXPathValue(): string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { SubmissionState } from '../../../client/submission/SubmissionState.ts';
|
|
2
|
+
import { ClientReactiveSubmittableInstance } from '../../../instance/internal-api/submission/ClientReactiveSubmittableInstance.ts';
|
|
3
|
+
export declare const createInstanceSubmissionState: (node: ClientReactiveSubmittableInstance) => SubmissionState;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { SubmissionState } from '../../../client/submission/SubmissionState.ts';
|
|
2
|
+
import { ClientReactiveSubmittableLeafNode } from '../../../instance/internal-api/submission/ClientReactiveSubmittableLeafNode.ts';
|
|
3
|
+
export declare const createLeafNodeSubmissionState: <Value>(node: ClientReactiveSubmittableLeafNode<Value>) => SubmissionState;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SubmissionState } from '../../../client/submission/SubmissionState.ts';
|
|
2
|
+
import { ClientReactiveSubmittableParentNode } from '../../../instance/internal-api/submission/ClientReactiveSubmittableParentNode.ts';
|
|
3
|
+
import { RepeatInstance } from '../../../instance/repeat/RepeatInstance.ts';
|
|
4
|
+
export declare const createNodeRangeSubmissionState: (node: ClientReactiveSubmittableParentNode<RepeatInstance>) => SubmissionState;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SubmissionState } from '../../../client/submission/SubmissionState.ts';
|
|
2
|
+
import { GeneralChildNode } from '../../../instance/hierarchy.ts';
|
|
3
|
+
import { ClientReactiveSubmittableParentNode } from '../../../instance/internal-api/submission/ClientReactiveSubmittableParentNode.ts';
|
|
4
|
+
export declare const createParentNodeSubmissionState: (node: ClientReactiveSubmittableParentNode<GeneralChildNode>) => SubmissionState;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { SubmissionState } from '../../../client/submission/SubmissionState.ts';
|
|
2
|
+
import { ClientReactiveSubmittableValueNode } from '../../../instance/internal-api/submission/ClientReactiveSubmittableValueNode.ts';
|
|
3
|
+
export declare const createValueNodeSubmissionState: (node: ClientReactiveSubmittableValueNode) => SubmissionState;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SubmissionChunkedType } from '../../../client/submission/SubmissionOptions.ts';
|
|
2
|
+
import { SubmissionResult } from '../../../client/submission/SubmissionResult.ts';
|
|
3
|
+
import { ClientReactiveSubmittableInstance } from '../../../instance/internal-api/submission/ClientReactiveSubmittableInstance.ts';
|
|
4
|
+
export interface PrepeareSubmissionOptions<ChunkedType extends SubmissionChunkedType> {
|
|
5
|
+
readonly chunked: ChunkedType;
|
|
6
|
+
readonly maxSize: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const prepareSubmission: <ChunkedType extends SubmissionChunkedType>(instanceRoot: ClientReactiveSubmittableInstance, options: PrepeareSubmissionOptions<ChunkedType>) => SubmissionResult<ChunkedType>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ValueCodec } from './ValueCodec.ts';
|
|
2
|
+
export type DecimalInputValue = bigint | number | string | null;
|
|
3
|
+
export type DecimalRuntimeValue = number | null;
|
|
4
|
+
export declare class DecimalValueCodec extends ValueCodec<'decimal', DecimalRuntimeValue, DecimalInputValue> {
|
|
5
|
+
constructor();
|
|
6
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This abstract class defines the minimal behavior for a default geopoint.
|
|
3
|
+
* It can be expanded later to support units (e.g., degrees or meters),
|
|
4
|
+
* which would also serve as documentation to clarify what each value represents.
|
|
5
|
+
*/
|
|
6
|
+
declare abstract class SemanticValue<Semantic extends string, Value extends number | null> {
|
|
7
|
+
readonly value: Value;
|
|
8
|
+
abstract readonly semantic: Semantic;
|
|
9
|
+
constructor(value: Value);
|
|
10
|
+
}
|
|
11
|
+
declare class Latitude extends SemanticValue<'latitude', number> {
|
|
12
|
+
readonly semantic = "latitude";
|
|
13
|
+
}
|
|
14
|
+
declare class Longitude extends SemanticValue<'longitude', number> {
|
|
15
|
+
readonly semantic = "longitude";
|
|
16
|
+
}
|
|
17
|
+
declare class Altitude<Value extends number | null = number> extends SemanticValue<'altitude', Value> {
|
|
18
|
+
readonly semantic = "altitude";
|
|
19
|
+
}
|
|
20
|
+
declare class Accuracy<Value extends number | null = number> extends SemanticValue<'accuracy', Value> {
|
|
21
|
+
readonly semantic = "accuracy";
|
|
22
|
+
}
|
|
23
|
+
export interface GeopointValue {
|
|
24
|
+
readonly latitude: number;
|
|
25
|
+
readonly longitude: number;
|
|
26
|
+
readonly altitude: number | null;
|
|
27
|
+
readonly accuracy: number | null;
|
|
28
|
+
}
|
|
29
|
+
export type GeopointRuntimeValue = GeopointValue | null;
|
|
30
|
+
export type GeopointInputValue = GeopointRuntimeValue | string;
|
|
31
|
+
type GeopointTuple = readonly [
|
|
32
|
+
latitude: Latitude,
|
|
33
|
+
longitude: Longitude,
|
|
34
|
+
altitude: Altitude<null> | Altitude<number>,
|
|
35
|
+
accuracy: Accuracy
|
|
36
|
+
] | readonly [latitude: Latitude, longitude: Longitude, altitude: Altitude] | readonly [latitude: Latitude, longitude: Longitude];
|
|
37
|
+
export declare class Geopoint {
|
|
38
|
+
private readonly internalValue;
|
|
39
|
+
constructor(coordinates: GeopointValue);
|
|
40
|
+
getTuple(): GeopointTuple;
|
|
41
|
+
getRuntimeValue(): GeopointRuntimeValue;
|
|
42
|
+
private isValidDegrees;
|
|
43
|
+
private isValidNumber;
|
|
44
|
+
private static isNullLocation;
|
|
45
|
+
static parseString(value: string): GeopointRuntimeValue;
|
|
46
|
+
static toCoordinatesString(value: GeopointInputValue): string;
|
|
47
|
+
}
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ValueCodec } from './ValueCodec.ts';
|
|
2
|
+
export type IntInputValue = bigint | number | string | null;
|
|
3
|
+
export type IntRuntimeValue = bigint | null;
|
|
4
|
+
export declare class IntValueCodec extends ValueCodec<'int', IntRuntimeValue, IntInputValue> {
|
|
5
|
+
constructor();
|
|
6
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ValueType } from '../../client/ValueType.ts';
|
|
2
|
+
import { RuntimeInputValue, RuntimeValue, SharedValueCodec } from './getSharedValueCodec.ts';
|
|
3
|
+
import { ValueCodec } from './ValueCodec.ts';
|
|
4
|
+
export type NoteRuntimeValue<V extends ValueType> = RuntimeValue<V> | null;
|
|
5
|
+
export type NoteInputValue<V extends ValueType> = RuntimeInputValue<V> | RuntimeValue<V> | null;
|
|
6
|
+
export declare class NoteCodec<V extends ValueType> extends ValueCodec<V, NoteRuntimeValue<V>, NoteInputValue<V>> {
|
|
7
|
+
constructor(baseCodec: SharedValueCodec<V>);
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RangeNodeDefinition, RangeValueType } from '../../parse/model/RangeNodeDefinition.ts';
|
|
2
|
+
import { RuntimeInputValue, RuntimeValue, SharedValueCodec } from './getSharedValueCodec.ts';
|
|
3
|
+
import { ValueCodec } from './ValueCodec.ts';
|
|
4
|
+
export type RangeRuntimeValue<V extends RangeValueType> = RuntimeValue<V>;
|
|
5
|
+
export type RangeInputValue<V extends RangeValueType> = RuntimeInputValue<V>;
|
|
6
|
+
export declare class RangeCodec<V extends RangeValueType> extends ValueCodec<V, RangeRuntimeValue<V>, RangeInputValue<V>> {
|
|
7
|
+
constructor(baseCodec: SharedValueCodec<V>, definition: RangeNodeDefinition<V>);
|
|
8
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ValueCodec } from './ValueCodec.ts';
|
|
2
|
+
export type TriggerValueType = 'string';
|
|
3
|
+
export type TriggerRuntimeValue = boolean;
|
|
4
|
+
export type TriggerInputValue = boolean | '' | null;
|
|
5
|
+
export declare class TriggerCodec extends ValueCodec<TriggerValueType, TriggerRuntimeValue, TriggerInputValue> {
|
|
6
|
+
constructor();
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ValueType } from '../../client/ValueType.ts';
|
|
2
|
+
import { RuntimeValue, SharedValueCodec } from './getSharedValueCodec.ts';
|
|
3
|
+
import { CodecDecoder, CodecEncoder, ValueCodec } from './ValueCodec.ts';
|
|
4
|
+
export type SplitInstanceValues = (value: string) => readonly string[];
|
|
5
|
+
export type JoinInstnaceValues = (values: readonly string[]) => string;
|
|
6
|
+
export type RuntimeItemValue<V extends ValueType> = NonNullable<RuntimeValue<V>>;
|
|
7
|
+
export type RuntimeValues<V extends ValueType> = ReadonlyArray<RuntimeItemValue<V>>;
|
|
8
|
+
export declare abstract class ValueArrayCodec<V extends ValueType, Values extends RuntimeValues<V> = RuntimeValues<V>> extends ValueCodec<V, Values, Values> {
|
|
9
|
+
readonly decodeItemValue: CodecDecoder<RuntimeItemValue<V>>;
|
|
10
|
+
constructor(baseCodec: SharedValueCodec<V>, encodeValue: CodecEncoder<Values>, decodeValue: CodecDecoder<Values>);
|
|
11
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Accessor } from 'solid-js';
|
|
2
|
+
import { ValueType } from '../../client/ValueType.ts';
|
|
3
|
+
import { DecodeInstanceValue } from '../../instance/internal-api/InstanceValueContext.ts';
|
|
4
|
+
import { SimpleAtomicState } from '../reactivity/types.ts';
|
|
5
|
+
export type CodecEncoder<RuntimeInputValue> = (input: RuntimeInputValue) => string;
|
|
6
|
+
export type CodecDecoder<RuntimeValue> = (value: string) => RuntimeValue;
|
|
7
|
+
type RuntimeValueAccessor<RuntimeValue> = Accessor<RuntimeValue>;
|
|
8
|
+
export type RuntimeValueSetter<RuntimeValue extends RuntimeInputValue, RuntimeInputValue = RuntimeValue> = (input: RuntimeInputValue) => RuntimeValue;
|
|
9
|
+
export type RuntimeValueState<RuntimeValue extends RuntimeInputValue, RuntimeInputValue = RuntimeValue> = readonly [
|
|
10
|
+
get: RuntimeValueAccessor<RuntimeValue>,
|
|
11
|
+
set: RuntimeValueSetter<RuntimeValue, RuntimeInputValue>
|
|
12
|
+
];
|
|
13
|
+
export type CreateRuntimeValueState<RuntimeValue extends RuntimeInputValue, RuntimeInputValue = RuntimeValue> = (instanceState: SimpleAtomicState<string>) => RuntimeValueState<RuntimeValue, RuntimeInputValue>;
|
|
14
|
+
type RuntimeValueStateFactory<RuntimeValue extends RuntimeInputValue, RuntimeInputValue = RuntimeValue> = (encodeValue: CodecEncoder<RuntimeInputValue>, decodeValue: CodecDecoder<RuntimeValue>) => CreateRuntimeValueState<RuntimeValue, RuntimeInputValue>;
|
|
15
|
+
type DecodeInstanceValueFactory<RuntimeValue extends RuntimeInputValue, RuntimeInputValue = RuntimeValue> = (encodeValue: CodecEncoder<RuntimeInputValue>, decodeValue: CodecDecoder<RuntimeValue>) => DecodeInstanceValue;
|
|
16
|
+
interface ValueCodecOptions<RuntimeValue extends RuntimeInputValue, RuntimeInputValue> {
|
|
17
|
+
readonly decodeInstanceValueFactory?: DecodeInstanceValueFactory<RuntimeValue, RuntimeInputValue>;
|
|
18
|
+
readonly runtimeValueStateFactory?: RuntimeValueStateFactory<RuntimeValue, RuntimeInputValue>;
|
|
19
|
+
}
|
|
20
|
+
export declare abstract class ValueCodec<V extends ValueType, RuntimeValue extends RuntimeInputValue, RuntimeInputValue = RuntimeValue> {
|
|
21
|
+
readonly valueType: V;
|
|
22
|
+
readonly encodeValue: CodecEncoder<RuntimeInputValue>;
|
|
23
|
+
readonly decodeValue: CodecDecoder<RuntimeValue>;
|
|
24
|
+
protected readonly defaultRuntimeValueStateFactory: RuntimeValueStateFactory<RuntimeValue, RuntimeInputValue>;
|
|
25
|
+
protected readonly defaultDecodeInstanceValueFactory: DecodeInstanceValueFactory<RuntimeValue, RuntimeInputValue>;
|
|
26
|
+
readonly decodeInstanceValue: DecodeInstanceValue;
|
|
27
|
+
readonly createRuntimeValueState: CreateRuntimeValueState<RuntimeValue, RuntimeInputValue>;
|
|
28
|
+
constructor(valueType: V, encodeValue: CodecEncoder<RuntimeInputValue>, decodeValue: CodecDecoder<RuntimeValue>, options?: ValueCodecOptions<RuntimeValue, RuntimeInputValue>);
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ValueType } from '../../client/ValueType.ts';
|
|
2
|
+
import { ValueCodec } from './ValueCodec.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Provides fallback functionality where a {@link ValueCodec} is expected, for
|
|
5
|
+
* those {@link ValueType | value types} which are still pending implementation.
|
|
6
|
+
* This allows consistent use of the {@link ValueCodec} interface while
|
|
7
|
+
* maintaining the current behavior of treating those unimplemented value types
|
|
8
|
+
* as string values.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ValueTypePlaceholderCodec<V extends ValueType> extends ValueCodec<V, string, string> {
|
|
11
|
+
constructor(valueType: V);
|
|
12
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SelectDefinition } from '../../client/SelectNode.ts';
|
|
2
|
+
import { MultipleValueItemCodec } from './items/MultipleValueItemCodec.ts';
|
|
3
|
+
import { SingleValueItemCodec } from './items/SingleValueItemCodec.ts';
|
|
4
|
+
export type SelectCodec = MultipleValueItemCodec | SingleValueItemCodec;
|
|
5
|
+
export declare const getSelectCodec: (definition: SelectDefinition<"string">) => SelectCodec;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { ValueType } from '../../client/ValueType.ts';
|
|
2
|
+
import { DecimalInputValue, DecimalRuntimeValue } from './DecimalValueCodec.ts';
|
|
3
|
+
import { GeopointInputValue, GeopointRuntimeValue } from './Geopoint/Geopoint.ts';
|
|
4
|
+
import { IntInputValue, IntRuntimeValue } from './IntValueCodec.ts';
|
|
5
|
+
import { ValueCodec } from './ValueCodec.ts';
|
|
6
|
+
interface RuntimeValuesByType {
|
|
7
|
+
readonly string: string;
|
|
8
|
+
readonly int: IntRuntimeValue;
|
|
9
|
+
readonly decimal: DecimalRuntimeValue;
|
|
10
|
+
readonly boolean: string;
|
|
11
|
+
readonly date: string;
|
|
12
|
+
readonly time: string;
|
|
13
|
+
readonly dateTime: string;
|
|
14
|
+
readonly geopoint: GeopointRuntimeValue;
|
|
15
|
+
readonly geotrace: string;
|
|
16
|
+
readonly geoshape: string;
|
|
17
|
+
readonly binary: string;
|
|
18
|
+
readonly barcode: string;
|
|
19
|
+
readonly intent: string;
|
|
20
|
+
}
|
|
21
|
+
export type RuntimeValue<V extends ValueType> = RuntimeValuesByType[V];
|
|
22
|
+
interface RuntimeInputValuesByType {
|
|
23
|
+
readonly string: string;
|
|
24
|
+
readonly int: IntInputValue;
|
|
25
|
+
readonly decimal: DecimalInputValue;
|
|
26
|
+
readonly boolean: string;
|
|
27
|
+
readonly date: string;
|
|
28
|
+
readonly time: string;
|
|
29
|
+
readonly dateTime: string;
|
|
30
|
+
readonly geopoint: GeopointInputValue;
|
|
31
|
+
readonly geotrace: string;
|
|
32
|
+
readonly geoshape: string;
|
|
33
|
+
readonly binary: string;
|
|
34
|
+
readonly barcode: string;
|
|
35
|
+
readonly intent: string;
|
|
36
|
+
}
|
|
37
|
+
export type RuntimeInputValue<V extends ValueType> = RuntimeInputValuesByType[V];
|
|
38
|
+
type SharedValueCodecs = {
|
|
39
|
+
readonly [V in ValueType]: ValueCodec<V, RuntimeValue<V>, RuntimeInputValue<V>>;
|
|
40
|
+
};
|
|
41
|
+
export type SharedValueCodec<V extends ValueType> = SharedValueCodecs[V];
|
|
42
|
+
/**
|
|
43
|
+
* Provides codecs for each {@link ValueType | value type}, for nodes with a
|
|
44
|
+
* common representation of those value types.
|
|
45
|
+
*/
|
|
46
|
+
export declare const sharedValueCodecs: SharedValueCodecs;
|
|
47
|
+
export declare const getSharedValueCodec: <V extends ValueType>(valueType: V) => SharedValueCodec<V>;
|
|
48
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ValueType } from '../../../client/ValueType.ts';
|
|
2
|
+
import { SharedValueCodec } from '../getSharedValueCodec.ts';
|
|
3
|
+
import { ValueArrayCodec } from '../ValueArrayCodec.ts';
|
|
4
|
+
import { CodecDecoder, CodecEncoder } from '../ValueCodec.ts';
|
|
5
|
+
export type BaseItemValueType = 'string';
|
|
6
|
+
export type UnsupportedBaseItemValueType = Exclude<ValueType, BaseItemValueType>;
|
|
7
|
+
export declare abstract class BaseItemCodec<Values extends readonly string[] = readonly string[]> extends ValueArrayCodec<BaseItemValueType, Values> {
|
|
8
|
+
constructor(baseCodec: SharedValueCodec<'string'>, encodeValue: CodecEncoder<Values>, decodeValue: CodecDecoder<Values>);
|
|
9
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SharedValueCodec } from '../getSharedValueCodec.ts';
|
|
2
|
+
import { BaseItemCodec } from './BaseItemCodec.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Value codec implementation for `<select>` and `<odk:rank>` controls.
|
|
5
|
+
*
|
|
6
|
+
* This generalizes the application of a {@link SharedValueCodec} implementation
|
|
7
|
+
* over individual select and rank values, where those values are serialized as a
|
|
8
|
+
* whitespace-separated list. All other encoding and decoding logic is deferred
|
|
9
|
+
* to the provided {@link baseCodec}, ensuring that select and rank value types are
|
|
10
|
+
* treated consistently with the same underlying data types for other controls.
|
|
11
|
+
*/
|
|
12
|
+
export declare class MultipleValueItemCodec extends BaseItemCodec<readonly string[]> {
|
|
13
|
+
constructor(baseCodec: SharedValueCodec<'string'>);
|
|
14
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { SharedValueCodec } from '../getSharedValueCodec.ts';
|
|
2
|
+
import { BaseItemCodec } from './BaseItemCodec.ts';
|
|
3
|
+
export type SingleValueSelectRuntimeValues = readonly [] | readonly [string];
|
|
4
|
+
/**
|
|
5
|
+
* @see {@link encodeValueFactory}
|
|
6
|
+
*/
|
|
7
|
+
type SingleValueSelectCodecValues = SingleValueSelectRuntimeValues | readonly string[];
|
|
8
|
+
/**
|
|
9
|
+
* Value codec implementation for `<select1>` controls.
|
|
10
|
+
*
|
|
11
|
+
* Note: this implementation is a specialization of the same principles
|
|
12
|
+
* underlying {@link MultipleValueItemCodec}. It is implemented separately:
|
|
13
|
+
*
|
|
14
|
+
* 1. to address a semantic difference between `<select>` and `<select1>`
|
|
15
|
+
* values: the former are serialized as a space-separated list, but that does
|
|
16
|
+
* not apply to the latter;
|
|
17
|
+
*
|
|
18
|
+
* 2. as an optimization, as the more general implementation performs poorly on
|
|
19
|
+
* forms which we monitor for performance.
|
|
20
|
+
*/
|
|
21
|
+
export declare class SingleValueItemCodec extends BaseItemCodec<SingleValueSelectCodecValues> {
|
|
22
|
+
constructor(baseCodec: SharedValueCodec<'string'>);
|
|
23
|
+
}
|
|
24
|
+
export {};
|
package/dist/lib/dom/query.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { KnownAttributeLocalNamedElement, LocalNamedElement } from '../../../../common/types/dom.ts';
|
|
2
|
-
import { SelectElement } from '../../parse/body/control/select/SelectDefinition';
|
|
3
2
|
export interface HintElement extends LocalNamedElement<'hint'> {
|
|
4
3
|
}
|
|
5
4
|
export interface ItemElement extends LocalNamedElement<'item'> {
|
|
@@ -17,9 +16,12 @@ export interface RepeatElement extends KnownAttributeLocalNamedElement<'repeat',
|
|
|
17
16
|
export interface ValueElement extends LocalNamedElement<'value'> {
|
|
18
17
|
}
|
|
19
18
|
export declare const getHintElement: (parent: Element) => HintElement | null;
|
|
20
|
-
export declare const getItemElements: (parent:
|
|
19
|
+
export declare const getItemElements: (parent: Element) => readonly ItemElement[];
|
|
21
20
|
export declare const getItemsetElement: (parent: Element) => ItemsetElement | null;
|
|
22
21
|
export declare const getLabelElement: (parent: Element) => LabelElement | null;
|
|
23
22
|
export declare const getRepeatGroupLabelElement: (parent: Element) => RepeatGroupLabelElement | null;
|
|
24
23
|
export declare const getRepeatElement: (parent: Element) => RepeatElement | null;
|
|
25
24
|
export declare const getValueElement: (parent: ItemElement | ItemsetElement) => ValueElement | null;
|
|
25
|
+
export interface SubmissionElement extends LocalNamedElement<'submission'> {
|
|
26
|
+
}
|
|
27
|
+
export declare const getSubmissionElement: (parent: Element) => SubmissionElement | null;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { NamespaceURI } from './QualifiedName.ts';
|
|
2
|
+
interface NamespaceDeclarationXMLSerializationOptions {
|
|
3
|
+
readonly omitDefaultNamespace?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export interface NamespaceDeclarationOptions {
|
|
6
|
+
readonly declaredPrefix: string | null;
|
|
7
|
+
readonly declaredURI: NamespaceURI;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Provides a generalized representation of an XML namespace declaration, which
|
|
11
|
+
* can be used for:
|
|
12
|
+
*
|
|
13
|
+
* - Resolution of a declared namespace URI, by its declared prefix
|
|
14
|
+
* - Resolution of a declared namespace prefix associated with its namespace URI
|
|
15
|
+
* - Scoped resolution of same in an arbitrary DOM-like tree of nodes (or
|
|
16
|
+
* representations thereof)
|
|
17
|
+
* - Serialization of the namespace declaration as an XML representation, as
|
|
18
|
+
* part of broader XML serialization logic from an arbitrary DOM-like tree of
|
|
19
|
+
* nodes (or representations thereof)
|
|
20
|
+
*
|
|
21
|
+
* @see {@link NamespaceDeclarationMap} for details on scoped usage
|
|
22
|
+
*/
|
|
23
|
+
export declare class NamespaceDeclaration {
|
|
24
|
+
private readonly serializedXML;
|
|
25
|
+
/**
|
|
26
|
+
* A namespace is declared as either:
|
|
27
|
+
*
|
|
28
|
+
* - a "default" namespace (for which no prefix is declared, in which case
|
|
29
|
+
* this value will be `null`)
|
|
30
|
+
*
|
|
31
|
+
* - a namespace prefix (for which the prefix can be used to reference the
|
|
32
|
+
* declared namespace, in which case this value will be a `string`)
|
|
33
|
+
*/
|
|
34
|
+
readonly declaredPrefix: string | null;
|
|
35
|
+
/**
|
|
36
|
+
* A namespace is declared for a {@link NamespaceURI}, i.e. either a
|
|
37
|
+
* {@link URL} or `null`, where `null` corresponds to the "null namespace"
|
|
38
|
+
* (i.e. `xmlns=""` or `xmlns:prefix=""`, in serialized XML).
|
|
39
|
+
*/
|
|
40
|
+
readonly declaredURI: NamespaceURI;
|
|
41
|
+
constructor(options: NamespaceDeclarationOptions);
|
|
42
|
+
declaresNamespaceURI(namespaceURI: NamespaceURI): boolean;
|
|
43
|
+
serializeNamespaceDeclarationXML(options?: NamespaceDeclarationXMLSerializationOptions): string;
|
|
44
|
+
}
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { NamespaceDeclaration } from './NamespaceDeclaration.ts';
|
|
2
|
+
import { NamespaceURI, QualifiedName } from './QualifiedName.ts';
|
|
3
|
+
export interface NamedNodeDefinition {
|
|
4
|
+
readonly qualifiedName: QualifiedName;
|
|
5
|
+
}
|
|
6
|
+
type NamedNodeDefinitionMap = ReadonlyMap<QualifiedName, NamedNodeDefinition>;
|
|
7
|
+
export interface NamedSubtreeDefinition extends NamedNodeDefinition {
|
|
8
|
+
readonly namespaceDeclarations: NamespaceDeclarationMap;
|
|
9
|
+
readonly parent: NamedSubtreeDefinition | null;
|
|
10
|
+
readonly attributes?: NamedNodeDefinitionMap;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @todo This is a bit of a code style experiment! Responsive to
|
|
14
|
+
* {@link https://github.com/getodk/web-forms/issues/296 | How should we represent enumerated types?}.
|
|
15
|
+
* Observations to be considered for that issue...
|
|
16
|
+
*
|
|
17
|
+
* This more or less works as one would expect, with one really irritating
|
|
18
|
+
* downside: unlike a **TypeScript `enum`**, code completions (in VSCode, but
|
|
19
|
+
* I'd expect the same for any TypeScript language server/LSP implementation)
|
|
20
|
+
* automatically suggest the bare string values rather than the equivalent
|
|
21
|
+
* syntax referencing the enumerations as defined here. Without care, it would
|
|
22
|
+
* be fairly trivial to lose consistency between the source "enum" and consuming
|
|
23
|
+
* code which we presume to be an exhaustive check (such as the `switch`
|
|
24
|
+
* statement operating on it below). This is somewhat mitigated for now by
|
|
25
|
+
* habitual use of {@link UnreachableError} (and would be better mitigated by a
|
|
26
|
+
* lint rule to enforce exhaustiveness checks over similar enumerations). But
|
|
27
|
+
* there is an obvious _stylistic mismatch_ between how an editor treats "thing
|
|
28
|
+
* shaped like `enum` but not semantically an `enum`", whereas there's no such
|
|
29
|
+
* mismatch in how it treats a plain "union of strings". If nothing else, that
|
|
30
|
+
* mismatch would tend to exacerbate exhaustiveness drift as an enumeration
|
|
31
|
+
* evolves.
|
|
32
|
+
*/
|
|
33
|
+
declare const DECLARE_NAMESPACE_RESULTS: {
|
|
34
|
+
readonly SUCCESS: "SUCCESS";
|
|
35
|
+
readonly HOISTED: "HOISTED";
|
|
36
|
+
readonly DEFERRED: "DEFERRED";
|
|
37
|
+
readonly REDUNDANT: "REDUNDANT";
|
|
38
|
+
readonly CONFLICT: "CONFLICT";
|
|
39
|
+
};
|
|
40
|
+
type DeclareNamespaceResultEnum = typeof DECLARE_NAMESPACE_RESULTS;
|
|
41
|
+
type DeclareNamespaceResult = DeclareNamespaceResultEnum[keyof DeclareNamespaceResultEnum];
|
|
42
|
+
export declare class NamespaceDeclarationMap extends Map<string | null, NamespaceDeclaration> {
|
|
43
|
+
readonly subtree: NamedSubtreeDefinition;
|
|
44
|
+
constructor(subtree: NamedSubtreeDefinition);
|
|
45
|
+
/**
|
|
46
|
+
* For any {@link definition | named node definition}, we can _infer_ a
|
|
47
|
+
* namespace declaration (rather than parsing it directly, which is error
|
|
48
|
+
* prone depending on parsing context) from that definition's
|
|
49
|
+
* {@link QualifiedName.namespaceURI} and {@link QualifiedName.prefix} (if the
|
|
50
|
+
* latter is defined).
|
|
51
|
+
*
|
|
52
|
+
* If a namespace declaration can be inferred, we "declare" (set, in
|
|
53
|
+
* {@link Map} semantics) it in **EITHER**:
|
|
54
|
+
*
|
|
55
|
+
* - An ancestor {@link NamedSubtreeDefinition | named subtree definition}'s
|
|
56
|
+
* {@link NamespaceDeclarationMap}: if such an ancestor exists and has no
|
|
57
|
+
* conflicting declaration for the same prefix; **OR**
|
|
58
|
+
* - This {@link NamespaceDeclarationMap}, if no suitable ancestor exists
|
|
59
|
+
*
|
|
60
|
+
* This can be described as "hoisting" the declaration to the uppermost node
|
|
61
|
+
* (or definitional representation of same) where it would be valid to declare
|
|
62
|
+
* the namespace for its prefix.
|
|
63
|
+
*
|
|
64
|
+
* In the following example, note that this logic applies for arbitrary tree
|
|
65
|
+
* structures satisfying the {@link NamedNodeDefinition} and
|
|
66
|
+
* {@link NamedSubtreeDefinition} interfaces. XML syntax is used to provide a
|
|
67
|
+
* concise explanation, but it should not be inferred that this is operating
|
|
68
|
+
* directly on an XML value (or any platform-native DOM structure of the
|
|
69
|
+
* same).
|
|
70
|
+
*
|
|
71
|
+
* @example Given an input tree like:
|
|
72
|
+
*
|
|
73
|
+
* ```xml
|
|
74
|
+
* <foo xmlns="https://example.com/DEFAULT_ONE">
|
|
75
|
+
* <bar:bat xmlns:bar="https://example.com/bar"/>
|
|
76
|
+
* <baz xmlns="https://example.com/DEFAULT_TWO"/>
|
|
77
|
+
* </foo>
|
|
78
|
+
* ```
|
|
79
|
+
*
|
|
80
|
+
* The namespace declarations will be assigned as if they'd been declared
|
|
81
|
+
* like:
|
|
82
|
+
*
|
|
83
|
+
* ```xml
|
|
84
|
+
* <foo
|
|
85
|
+
* xmlns="https://example.com/DEFAULT_ONE"
|
|
86
|
+
* xmlns:bar="https://example.com/bar"
|
|
87
|
+
* >
|
|
88
|
+
* <!-- bar declaration has no conflict in foo, hoisted to parent -->
|
|
89
|
+
* <bar:bat/>
|
|
90
|
+
* <!-- default declaration conflicts with foo's default, not hoisted -->
|
|
91
|
+
* <baz xmlns="https://example.com/DEFAULT_TWO"/>
|
|
92
|
+
* </foo>
|
|
93
|
+
* ```
|
|
94
|
+
*
|
|
95
|
+
* **IMPORTANT:** this behavior may seem overly complicated! It should be
|
|
96
|
+
* noted that the behavior:
|
|
97
|
+
*
|
|
98
|
+
* 1. ... is conceptually similar to behavior observable in a web standard
|
|
99
|
+
* WHAT Working Group DOM (as in browser DOM, XML DOM) implementation.
|
|
100
|
+
* There, serializing any subtree element will produce namespace
|
|
101
|
+
* declarations on the root element for any namespaces _referenced within
|
|
102
|
+
* its subtree but declared on an ancestor_. Note that in this case, the
|
|
103
|
+
* hierarchical behavior is inverted, but it demonstrates the same
|
|
104
|
+
* effective namespace scoping semantics.
|
|
105
|
+
*
|
|
106
|
+
* 2. ... vastly simplifies our ability to produce a compact XML
|
|
107
|
+
* representation from any arbitrary tree representation of its nodes.
|
|
108
|
+
* Hoisting namespace declarations to their uppermost scope, and
|
|
109
|
+
* deduplicating recursively up the ancestor tree, ensures that we only
|
|
110
|
+
* declare a given namespace once as it is referenced.
|
|
111
|
+
*
|
|
112
|
+
* @todo While this design is intended to help with producing compact
|
|
113
|
+
* serialized XML, at time of writing there is still an aspect which is
|
|
114
|
+
* unaddressed in the serialization logic: we assume namespace declarations
|
|
115
|
+
* are referenced if they've been parsed. This logic doesn't hold for nodes
|
|
116
|
+
* which are ultimately omitted from serialization, which would occur for
|
|
117
|
+
* non-relevant nodes, and repeat ranges with zero repeat instances (or any of
|
|
118
|
+
* their descendants). A future iteration of this same behavior could produce
|
|
119
|
+
* XML which is theoretically more compact, by performing the same declaration
|
|
120
|
+
* hoisting logic _dynamically at call time_ rather than at parse time.
|
|
121
|
+
*/
|
|
122
|
+
declareNamespace(definition: NamedNodeDefinition): DeclareNamespaceResult;
|
|
123
|
+
/**
|
|
124
|
+
* Given a {@link namespaceURI}, resolves a declared prefix (which may be
|
|
125
|
+
* `null`) for the {@link subtree} context **or any of its ancestors**. This
|
|
126
|
+
* is an important semantic detail:
|
|
127
|
+
*
|
|
128
|
+
* - Namespace declarations on a given subtree are effective for all of its
|
|
129
|
+
* descendants _until another declaration for the same prefix or namespace
|
|
130
|
+
* URI is encountered_
|
|
131
|
+
* - We "hoist" namespace declarations up to the uppermost {@link subtree}'s
|
|
132
|
+
* {@link NamespaceDeclarationMap} during parsing (as described in more
|
|
133
|
+
* detail on {@link declareNamespace}).
|
|
134
|
+
*/
|
|
135
|
+
lookupPrefix(namespaceURI: NamespaceURI): string | null;
|
|
136
|
+
}
|
|
137
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convenience wrapper to represent an XML namespace URI as a {@link URL}. This
|
|
3
|
+
* representation is used/responsible for:
|
|
4
|
+
*
|
|
5
|
+
* - normalized logic for XML semantics around special namespace URI values, in
|
|
6
|
+
* particular for consistent handling of the "null namespace" (input for such
|
|
7
|
+
* is accepted as either an empty string or `null`)
|
|
8
|
+
* - validation of input: a non-"null namespace" value will be rejected if it is
|
|
9
|
+
* not a valid URI string
|
|
10
|
+
* - type-level distinction between a namespace URI and a
|
|
11
|
+
* {@link NamespaceDeclaration.declaredPrefix | namespace declaration's prefix},
|
|
12
|
+
* as an aide to avoid using one in place of the other as e.g. a positional
|
|
13
|
+
* argument
|
|
14
|
+
*
|
|
15
|
+
* @todo Test the finer distinctions between "URL" and "URI"!
|
|
16
|
+
*
|
|
17
|
+
* @todo Probably not a huge deal in the scheme of things, but this is almost
|
|
18
|
+
* entirely pure overhead at runtime! The "validation" use case is kind of a
|
|
19
|
+
* stretch, and may well be wrong. The type-level distinction from a namespace
|
|
20
|
+
* prefix, however, has proved useful **quite a few times** during iteration of
|
|
21
|
+
* this change. If we can actually measure an impact, it might be worth instead
|
|
22
|
+
* considering "branded types" for the type-level distinct (in which case we
|
|
23
|
+
* could use a factory function to handle both the branding and special XML
|
|
24
|
+
* semantics).
|
|
25
|
+
*/
|
|
26
|
+
export declare class NamespaceURL extends URL {
|
|
27
|
+
static from(namespaceURI: NamespaceURL | string | null): NamespaceURL | null;
|
|
28
|
+
readonly href: string;
|
|
29
|
+
private constructor();
|
|
30
|
+
}
|