@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
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { NamespaceURL } from './NamespaceURL.ts';
|
|
2
|
+
export type NamespaceURI = NamespaceURL | null;
|
|
3
|
+
export type QualifiedNamePrefix = string | null;
|
|
4
|
+
export interface NamespaceQualifiedNameSource {
|
|
5
|
+
readonly namespaceURI: NamespaceURI | string;
|
|
6
|
+
readonly localName: string;
|
|
7
|
+
/**
|
|
8
|
+
* Note that this property is intentionally optional as one of the
|
|
9
|
+
* {@link QualifiedNameSource | QualifiedName source input}, and its absence
|
|
10
|
+
* is treated differently from an explicitly assigned `null` value.
|
|
11
|
+
*
|
|
12
|
+
* @see {@link SourcePrefixUnspecified}, {@link DeferredPrefix}
|
|
13
|
+
*/
|
|
14
|
+
readonly prefix?: QualifiedNamePrefix;
|
|
15
|
+
}
|
|
16
|
+
declare const SOURCE_PREFIX_UNSPECIFIED: unique symbol;
|
|
17
|
+
/**
|
|
18
|
+
* May be used as a placeholder for a {@link QualifiedName.prefix}, where the
|
|
19
|
+
* actual prefix may not be known at definition time.
|
|
20
|
+
*
|
|
21
|
+
* Example: parsing non-XML sources into an XML-like tree, e.g. for XPath
|
|
22
|
+
* evaluation; in which case, we may not need to resolve a prefix for the name
|
|
23
|
+
* until such a node is serialized as XML, if it ever is.
|
|
24
|
+
*/
|
|
25
|
+
type SourcePrefixUnspecified = typeof SOURCE_PREFIX_UNSPECIFIED;
|
|
26
|
+
/**
|
|
27
|
+
* Represents a {@link QualifiedName.prefix} whose resolution may be deferred,
|
|
28
|
+
* e.g. until all requisite parsing is complete and/or until XML serialization
|
|
29
|
+
* requires use of a prefix to represent the corresponding
|
|
30
|
+
* {@link QualifiedName.namespaceURI}.
|
|
31
|
+
*/
|
|
32
|
+
type DeferredPrefix = string | null | SourcePrefixUnspecified;
|
|
33
|
+
interface DeferredPrefixedQualifiedNameSource {
|
|
34
|
+
readonly namespaceURI: NamespaceURI | string;
|
|
35
|
+
readonly prefix: DeferredPrefix;
|
|
36
|
+
readonly localName: string;
|
|
37
|
+
}
|
|
38
|
+
export type QualifiedNameSource = NamespaceQualifiedNameSource | DeferredPrefixedQualifiedNameSource;
|
|
39
|
+
interface PrefixResolutionOptions {
|
|
40
|
+
lookupPrefix(namespaceURI: NamespaceURI | string): string | null;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @todo This is in the `lib` directory because it's a cross-cutting concern,
|
|
44
|
+
* applicable to:
|
|
45
|
+
*
|
|
46
|
+
* - Parsing XML into a useful runtime data model (usage which motivated initial
|
|
47
|
+
* development of this class)
|
|
48
|
+
* - Serializing XML from a runtime data model (also motivated initial dev)
|
|
49
|
+
* - `@getodk/xpath` (internal) e.g. references to
|
|
50
|
+
* {@link https://www.w3.org/TR/REC-xml-names/#NT-QName | QName} in various
|
|
51
|
+
* parts of XPath expression _syntax_, as well as various parts of the package
|
|
52
|
+
* interpreting those parts of syntax
|
|
53
|
+
* - `@getodk/xpath` (cross-package), e.g. in aspects of the
|
|
54
|
+
* {@link XPathDOMAdapter} APIs, and implementations thereof
|
|
55
|
+
* - A zillion potential optimizations, e.g. where names are useful in a lookup
|
|
56
|
+
* table (or used in conjunction with other information to construct keys for
|
|
57
|
+
* same)
|
|
58
|
+
*
|
|
59
|
+
* @todo As a cross-cutting concern, there are subtle but important differences
|
|
60
|
+
* between certain XPath and XML semantics around expressions of a "null"
|
|
61
|
+
* {@link prefix}. E.g. in the expression `/foo`, **technically** the `foo` Step
|
|
62
|
+
* should select child elements _in the null namespace_, whereas in most other
|
|
63
|
+
* cases a null prefix (when explicitly assigned `null`, rather than
|
|
64
|
+
* {@link DeferredPrefix | deferred for later resolution}) is expected to
|
|
65
|
+
* correspond _to the default namespace_ (whatever that is in the context of the
|
|
66
|
+
* {@link QualifiedName | qualified-named thing}).
|
|
67
|
+
*
|
|
68
|
+
* @todo As a mechanism for many optimizations, an evolution of this class would
|
|
69
|
+
* be **BY FAR** most useful if it can be treated as a _value type_, despite
|
|
70
|
+
* challenges using non-primitives as such in a JS runtime. To be clear: it
|
|
71
|
+
* would be most useful if every instance of {@link QualifiedName} having the
|
|
72
|
+
* same property values (or in some cases, the same combined
|
|
73
|
+
* {@link namespaceURI}/{@link localName} or combined
|
|
74
|
+
* {@link prefix}/{@link localName}) would also have _reference equality_ with
|
|
75
|
+
* other instances having the same property values (or pertinent subset
|
|
76
|
+
* thereof). Making a somewhat obvious point explicit: this would be
|
|
77
|
+
* particularly useful in cases where a lookup table is implemented as a native
|
|
78
|
+
* {@link Map}, where using {@link QualifiedName} as a key would break
|
|
79
|
+
* expectations (and probably quite a lot of functionality!) if 2+ equivalent
|
|
80
|
+
* keys mapped to different values.
|
|
81
|
+
*
|
|
82
|
+
* @todo Where we would want to treat instances as a value type, it would be
|
|
83
|
+
* useful to look at prior art for representation of the same data as a string.
|
|
84
|
+
* One frame of reference worth looking at is
|
|
85
|
+
* {@link https://www.w3.org/TR/xpath-30/#prod-xpath30-URIQualifiedName | XPath 3.0's URIQualifiedName}
|
|
86
|
+
* (but note that this syntax is mutually exclusive with the prefixed `QName`).
|
|
87
|
+
*/
|
|
88
|
+
export declare class QualifiedName implements DeferredPrefixedQualifiedNameSource {
|
|
89
|
+
private readonly defaultPrefixResolutionOptions;
|
|
90
|
+
readonly namespaceURI: NamespaceURI;
|
|
91
|
+
/**
|
|
92
|
+
* @see {@link SourcePrefixUnspecified}, {@link DeferredPrefix}
|
|
93
|
+
*/
|
|
94
|
+
readonly prefix: DeferredPrefix;
|
|
95
|
+
readonly localName: string;
|
|
96
|
+
constructor(source: QualifiedNameSource);
|
|
97
|
+
/**
|
|
98
|
+
* @todo at time of writing, it's not expected we will actually supply
|
|
99
|
+
* {@link options} in calls to this method! Current calls are from definitions
|
|
100
|
+
* whose prefixes are known at parse time (i.e. they are prefixed in the
|
|
101
|
+
* source XML from which they're parsed).
|
|
102
|
+
*
|
|
103
|
+
* The intent of accepting the options here now is to leave a fairly large
|
|
104
|
+
* breadcrumb, for any use case where we might want to serialize XML from
|
|
105
|
+
* artificially constructed DOM-like trees (e.g. `StaticNode` implementations
|
|
106
|
+
* defined by parsing non-XML external secondary instances such as CSV and
|
|
107
|
+
* GeoJSON). AFAIK this doesn't correspond to any known feature in the "like
|
|
108
|
+
* Collect" scope, but it could have implications for inspecting form details
|
|
109
|
+
* in e.g. "debug/form design/dev mode" scenarios.
|
|
110
|
+
*/
|
|
111
|
+
getPrefixedName(options?: PrefixResolutionOptions): string;
|
|
112
|
+
}
|
|
113
|
+
export {};
|
|
@@ -1,40 +1,15 @@
|
|
|
1
1
|
import { InstanceValueContext } from '../../instance/internal-api/InstanceValueContext.ts';
|
|
2
2
|
import { SimpleAtomicState } from './types.ts';
|
|
3
|
-
type InitialValueSource = 'FORM_DEFAULT' | 'PRIMARY_INSTANCE';
|
|
4
|
-
export interface InstanceValueStateOptions {
|
|
5
|
-
/**
|
|
6
|
-
* Specifies the source of a {@link createInstanceValueState} signal's initial
|
|
7
|
-
* value state, where:
|
|
8
|
-
*
|
|
9
|
-
* - 'FORM_DEFAULT': Derives the initial state from the form's definition of
|
|
10
|
-
* the node itself. This is the default option, appropriate when
|
|
11
|
-
* initializing a form without additional primary instance data. In other
|
|
12
|
-
* words, this value should not be used for edits.
|
|
13
|
-
*
|
|
14
|
-
* - 'PRIMARY_INSTANCE': Derives the initial state from the current text
|
|
15
|
-
* content of the {@link ValueNode.contextNode}. This option should be
|
|
16
|
-
* specified when initializing a form with existing primary instance data,
|
|
17
|
-
* such as when editing a previous submission.
|
|
18
|
-
*
|
|
19
|
-
* @default 'FORM_DEFAULT'
|
|
20
|
-
*
|
|
21
|
-
* Specifies whether a {@link createInstanceValueState} signal's initial state
|
|
22
|
-
* should be derived from the current text content of the
|
|
23
|
-
* {@link ValueNode.contextNode | primary instance DOM state}.
|
|
24
|
-
*/
|
|
25
|
-
readonly initialValueSource?: InitialValueSource;
|
|
26
|
-
}
|
|
27
3
|
export type InstanceValueState = SimpleAtomicState<string>;
|
|
28
4
|
/**
|
|
29
5
|
* Provides a consistent interface for value nodes of any type which:
|
|
30
6
|
*
|
|
31
7
|
* - derives initial state from either an existing instance (e.g. for edits) or
|
|
32
|
-
* the node's definition (e.g. initializing a new
|
|
8
|
+
* the node's definition (e.g. initializing a new instance)
|
|
33
9
|
* - decodes current primary instance state into the value node's runtime type
|
|
34
10
|
* - encodes updated runtime values to store updated instance state
|
|
35
11
|
* - initializes reactive computation of `calculate` bind expressions for those
|
|
36
12
|
* nodes defined with one
|
|
37
13
|
* - prevents downstream writes to nodes in a readonly state
|
|
38
14
|
*/
|
|
39
|
-
export declare const createInstanceValueState: (context: InstanceValueContext
|
|
40
|
-
export {};
|
|
15
|
+
export declare const createInstanceValueState: (context: InstanceValueContext) => InstanceValueState;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Accessor } from 'solid-js';
|
|
2
|
+
import { SelectItem } from '../../client/SelectNode.ts';
|
|
3
|
+
import { RankItem } from '../../client/RankNode.ts';
|
|
4
|
+
import { SelectControl } from '../../instance/SelectControl.ts';
|
|
5
|
+
import { RankControl } from '../../instance/RankControl.ts';
|
|
6
|
+
export type ItemCollectionControl = RankControl | SelectControl;
|
|
7
|
+
type Item = RankItem | SelectItem;
|
|
8
|
+
/**
|
|
9
|
+
* Creates a reactive computation of a {@link ItemCollectionControl}'s
|
|
10
|
+
* {@link Item}s, in support of the field's `valueOptions`.
|
|
11
|
+
*
|
|
12
|
+
* - The control defined with static `<item>`s will compute to an corresponding
|
|
13
|
+
* static list of items.
|
|
14
|
+
* - The control defined with a computed `<itemset>` will compute to a reactive list
|
|
15
|
+
* of items.
|
|
16
|
+
* - Items of both will produce {@link ItemType.label | labels} reactive to
|
|
17
|
+
* their appropriate dependencies (whether relative to the itemset item node,
|
|
18
|
+
* referencing a form's `itext` translations, etc).
|
|
19
|
+
*/
|
|
20
|
+
export declare const createItemCollection: (control: ItemCollectionControl) => Accessor<readonly Item[]>;
|
|
21
|
+
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { NamespaceDeclarationMap } from './names/NamespaceDeclarationMap.ts';
|
|
2
|
+
import { QualifiedName } from './names/QualifiedName.ts';
|
|
1
3
|
declare const ESCAPED_XML_TEXT_BRAND: unique symbol;
|
|
2
4
|
export type EscapedXMLText = string & {
|
|
3
5
|
readonly [ESCAPED_XML_TEXT_BRAND]: true;
|
|
@@ -36,6 +38,13 @@ export type EscapedXMLText = string & {
|
|
|
36
38
|
* reconsider this assumption.
|
|
37
39
|
*/
|
|
38
40
|
export declare const escapeXMLText: <Text extends string>(text: Exclude<Text, EscapedXMLText>, attr?: boolean) => EscapedXMLText;
|
|
39
|
-
|
|
40
|
-
|
|
41
|
+
interface SerializableElementAttribute {
|
|
42
|
+
serializeAttributeXML(): string;
|
|
43
|
+
}
|
|
44
|
+
interface ElementXMLSerializationOptions {
|
|
45
|
+
readonly namespaceDeclarations?: NamespaceDeclarationMap;
|
|
46
|
+
readonly attributes?: readonly SerializableElementAttribute[];
|
|
47
|
+
}
|
|
48
|
+
export declare const serializeParentElementXML: (qualifiedName: QualifiedName, serializedChildren: readonly string[], options?: ElementXMLSerializationOptions) => string;
|
|
49
|
+
export declare const serializeLeafElementXML: (qualifiedName: QualifiedName, xmlValue: EscapedXMLText, options?: ElementXMLSerializationOptions) => string;
|
|
41
50
|
export {};
|
package/dist/parse/XFormDOM.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export declare class XFormDOM {
|
|
|
29
29
|
readonly secondaryInstanceElements: readonly DOMSecondaryInstanceElement[];
|
|
30
30
|
readonly body: Element;
|
|
31
31
|
protected constructor(sourceXML: string, options: XFormDOMOptions);
|
|
32
|
-
toJSON(): Omit<this, "head" | "html" | "title" | "toJSON" | "model" | "
|
|
32
|
+
toJSON(): Omit<this, "head" | "html" | "title" | "toJSON" | "model" | "primaryInstance" | "primaryInstanceRoot" | "xformDocument"> & {
|
|
33
33
|
xformDocument: string;
|
|
34
34
|
html: string;
|
|
35
35
|
head: string;
|
|
@@ -4,7 +4,7 @@ import { DependencyContext } from '../expression/abstract/DependencyContext.ts';
|
|
|
4
4
|
import { InputControlDefinition } from './control/InputControlDefinition.ts';
|
|
5
5
|
import { RangeControlDefinition } from './control/RangeControlDefinition.ts';
|
|
6
6
|
import { RankControlDefinition } from './control/RankControlDefinition.ts';
|
|
7
|
-
import {
|
|
7
|
+
import { AnySelectControlDefinition } from './control/SelectControlDefinition.ts';
|
|
8
8
|
import { TriggerControlDefinition } from './control/TriggerControlDefinition.ts';
|
|
9
9
|
import { UploadControlDefinition } from './control/UploadControlDefinition.ts';
|
|
10
10
|
import { LogicalGroupDefinition } from './group/LogicalGroupDefinition.ts';
|
|
@@ -17,7 +17,7 @@ export interface BodyElementParentContext {
|
|
|
17
17
|
readonly reference: string | null;
|
|
18
18
|
readonly element: Element;
|
|
19
19
|
}
|
|
20
|
-
export type ControlElementDefinition =
|
|
20
|
+
export type ControlElementDefinition = AnySelectControlDefinition | InputControlDefinition | RangeControlDefinition | RankControlDefinition | TriggerControlDefinition | UploadControlDefinition;
|
|
21
21
|
type SupportedBodyElementDefinition = RepeatElementDefinition | LogicalGroupDefinition | PresentationGroupDefinition | StructuralGroupDefinition | ControlElementDefinition;
|
|
22
22
|
export type AnyBodyElementDefinition = SupportedBodyElementDefinition | UnsupportedBodyElementDefinition;
|
|
23
23
|
export type BodyElementDefinitionArray = readonly AnyBodyElementDefinition[];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ParsedTokenList, TokenListParser } from '../../../lib/TokenListParser.ts';
|
|
2
|
+
export declare const rangeAppearanceParser: TokenListParser<"no-ticks" | "picker" | "rating" | "vertical", "no-ticks" | "picker" | "rating" | "vertical">;
|
|
3
|
+
export type RangeAppearanceDefinition = ParsedTokenList<typeof rangeAppearanceParser>;
|
|
@@ -6,5 +6,8 @@ export declare class InputControlDefinition extends ControlDefinition<'input'> {
|
|
|
6
6
|
static isCompatible(localName: string): boolean;
|
|
7
7
|
readonly type = "input";
|
|
8
8
|
readonly appearances: InputAppearanceDefinition;
|
|
9
|
+
readonly rows: number | null;
|
|
10
|
+
readonly accuracyThreshold: number | null;
|
|
11
|
+
readonly unacceptableAccuracyThreshold: number | null;
|
|
9
12
|
constructor(form: XFormDefinition, parent: BodyElementParentContext, element: Element);
|
|
10
13
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ItemElement } from '../../../lib/dom/query.ts';
|
|
2
|
+
import { ItemLabelDefinition } from '../../text/ItemLabelDefinition.ts';
|
|
3
|
+
import { XFormDefinition } from '../../XFormDefinition.ts';
|
|
4
|
+
import { BodyElementDefinition } from '../BodyElementDefinition.ts';
|
|
5
|
+
import { AnySelectControlDefinition } from './SelectControlDefinition.ts';
|
|
6
|
+
import { RankControlDefinition } from './RankControlDefinition.ts';
|
|
7
|
+
export declare class ItemDefinition extends BodyElementDefinition<'item'> {
|
|
8
|
+
readonly parent: AnySelectControlDefinition | RankControlDefinition;
|
|
9
|
+
readonly category = "support";
|
|
10
|
+
readonly type = "item";
|
|
11
|
+
readonly label: ItemLabelDefinition | null;
|
|
12
|
+
readonly value: string;
|
|
13
|
+
constructor(form: XFormDefinition, parent: AnySelectControlDefinition | RankControlDefinition, element: ItemElement);
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ItemsetElement } from '../../../lib/dom/query.ts';
|
|
2
|
+
import { ItemsetNodesetExpression } from '../../expression/ItemsetNodesetExpression.ts';
|
|
3
|
+
import { ItemsetValueExpression } from '../../expression/ItemsetValueExpression.ts';
|
|
4
|
+
import { ItemsetLabelDefinition } from '../../text/ItemsetLabelDefinition.ts';
|
|
5
|
+
import { XFormDefinition } from '../../XFormDefinition.ts';
|
|
6
|
+
import { BodyElementDefinition } from '../BodyElementDefinition.ts';
|
|
7
|
+
import { AnySelectControlDefinition } from './SelectControlDefinition.ts';
|
|
8
|
+
import { RankControlDefinition } from './RankControlDefinition.ts';
|
|
9
|
+
export declare class ItemsetDefinition extends BodyElementDefinition<'itemset'> {
|
|
10
|
+
readonly parent: AnySelectControlDefinition | RankControlDefinition;
|
|
11
|
+
readonly category = "support";
|
|
12
|
+
readonly type = "itemset";
|
|
13
|
+
readonly reference: string;
|
|
14
|
+
readonly label: ItemsetLabelDefinition | null;
|
|
15
|
+
readonly nodes: ItemsetNodesetExpression;
|
|
16
|
+
readonly value: ItemsetValueExpression;
|
|
17
|
+
constructor(form: XFormDefinition, parent: AnySelectControlDefinition | RankControlDefinition, element: ItemsetElement);
|
|
18
|
+
}
|
|
@@ -1,11 +1,40 @@
|
|
|
1
1
|
import { XFormDefinition } from '../../XFormDefinition.ts';
|
|
2
|
-
import {
|
|
2
|
+
import { RangeAppearanceDefinition } from '../appearance/rangeAppearanceParser.ts';
|
|
3
3
|
import { BodyElementParentContext } from '../BodyDefinition.ts';
|
|
4
4
|
import { ControlDefinition } from './ControlDefinition.ts';
|
|
5
|
+
type NumericString = `${number}`;
|
|
6
|
+
/**
|
|
7
|
+
* Per
|
|
8
|
+
* {@link https://getodk.github.io/xforms-spec/#body-elements | ODK XForms spec},
|
|
9
|
+
* the following attributes are required:
|
|
10
|
+
*
|
|
11
|
+
* - `start`
|
|
12
|
+
* - `end`
|
|
13
|
+
* - `step`
|
|
14
|
+
*
|
|
15
|
+
* While we also know that a `<range>` control is expected to have a bind type
|
|
16
|
+
* of either `decimal` or `int`, at this parsing stage we do not yet know which
|
|
17
|
+
* type is associated with the control. So we parse the attributes as strings,
|
|
18
|
+
* checking only that they appear to be numeric values. We also preserve the
|
|
19
|
+
* attributes' names here, for consistency with the spec.
|
|
20
|
+
*
|
|
21
|
+
* Downstream, we parse these to their appropriate numeric runtime types, and
|
|
22
|
+
* alias them to their more conventional names (i.e. "start" -> "min", "end" ->
|
|
23
|
+
* "max").
|
|
24
|
+
*/
|
|
25
|
+
export declare class RangeControlBoundsDefinition {
|
|
26
|
+
readonly start: NumericString;
|
|
27
|
+
readonly end: NumericString;
|
|
28
|
+
readonly step: NumericString;
|
|
29
|
+
static from(element: Element): RangeControlBoundsDefinition;
|
|
30
|
+
constructor(start: NumericString, end: NumericString, step: NumericString);
|
|
31
|
+
}
|
|
5
32
|
export declare class RangeControlDefinition extends ControlDefinition<'range'> {
|
|
6
33
|
static isCompatible(localName: string): boolean;
|
|
7
34
|
readonly type = "range";
|
|
8
|
-
readonly appearances:
|
|
35
|
+
readonly appearances: RangeAppearanceDefinition;
|
|
36
|
+
readonly bounds: RangeControlBoundsDefinition;
|
|
9
37
|
constructor(form: XFormDefinition, parent: BodyElementParentContext, element: Element);
|
|
10
38
|
toJSON(): object;
|
|
11
39
|
}
|
|
40
|
+
export {};
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { XFormDefinition } from '../../XFormDefinition.ts';
|
|
2
|
-
import { UnknownAppearanceDefinition } from '../appearance/unknownAppearanceParser.ts';
|
|
3
2
|
import { BodyElementParentContext } from '../BodyDefinition.ts';
|
|
4
3
|
import { ControlDefinition } from './ControlDefinition.ts';
|
|
4
|
+
import { ItemsetDefinition } from './ItemsetDefinition.ts';
|
|
5
|
+
import { ItemDefinition } from './ItemDefinition.ts';
|
|
6
|
+
import { UnknownAppearanceDefinition } from '../appearance/unknownAppearanceParser.ts';
|
|
5
7
|
export declare class RankControlDefinition extends ControlDefinition<'rank'> {
|
|
6
|
-
static isCompatible(localName: string
|
|
8
|
+
static isCompatible(localName: string): boolean;
|
|
7
9
|
readonly type = "rank";
|
|
8
10
|
readonly appearances: UnknownAppearanceDefinition;
|
|
11
|
+
readonly itemset: ItemsetDefinition | null;
|
|
12
|
+
readonly items: readonly ItemDefinition[];
|
|
9
13
|
constructor(form: XFormDefinition, parent: BodyElementParentContext, element: Element);
|
|
10
|
-
toJSON():
|
|
14
|
+
toJSON(): {};
|
|
11
15
|
}
|
package/dist/parse/body/control/{select/SelectDefinition.d.ts → SelectControlDefinition.d.ts}
RENAMED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { CollectionValues } from '
|
|
2
|
-
import { LocalNamedElement } from '
|
|
3
|
-
import { XFormDefinition } from '
|
|
4
|
-
import { SelectAppearanceDefinition } from '
|
|
5
|
-
import { AnyBodyElementDefinition, BodyElementParentContext } from '
|
|
6
|
-
import { ControlDefinition } from '
|
|
1
|
+
import { CollectionValues } from '../../../../../common/types/collections/CollectionValues.ts';
|
|
2
|
+
import { LocalNamedElement } from '../../../../../common/types/dom.ts';
|
|
3
|
+
import { XFormDefinition } from '../../XFormDefinition.ts';
|
|
4
|
+
import { SelectAppearanceDefinition } from '../appearance/selectAppearanceParser.ts';
|
|
5
|
+
import { AnyBodyElementDefinition, BodyElementParentContext } from '../BodyDefinition.ts';
|
|
6
|
+
import { ControlDefinition } from './ControlDefinition.ts';
|
|
7
7
|
import { ItemDefinition } from './ItemDefinition.ts';
|
|
8
8
|
import { ItemsetDefinition } from './ItemsetDefinition.ts';
|
|
9
9
|
declare const selectLocalNames: Set<"select" | "select1">;
|
|
10
10
|
export type SelectType = CollectionValues<typeof selectLocalNames>;
|
|
11
11
|
export interface SelectElement extends LocalNamedElement<SelectType> {
|
|
12
12
|
}
|
|
13
|
-
export declare class
|
|
13
|
+
export declare class SelectControlDefinition<Type extends SelectType> extends ControlDefinition<Type> {
|
|
14
14
|
static isCompatible(localName: string, element: Element): boolean;
|
|
15
|
-
static isSelect(element: AnyBodyElementDefinition): element is
|
|
15
|
+
static isSelect(element: AnyBodyElementDefinition): element is AnySelectControlDefinition;
|
|
16
16
|
readonly type: Type;
|
|
17
17
|
readonly element: SelectElement;
|
|
18
18
|
readonly appearances: SelectAppearanceDefinition;
|
|
@@ -21,5 +21,5 @@ export declare class SelectDefinition<Type extends SelectType> extends ControlDe
|
|
|
21
21
|
constructor(form: XFormDefinition, parent: BodyElementParentContext, element: Element);
|
|
22
22
|
toJSON(): {};
|
|
23
23
|
}
|
|
24
|
-
export type
|
|
24
|
+
export type AnySelectControlDefinition = SelectControlDefinition<SelectType>;
|
|
25
25
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ItemsetDefinition } from '../body/control/
|
|
1
|
+
import { ItemsetDefinition } from '../body/control/ItemsetDefinition.ts';
|
|
2
2
|
import { DependentExpression } from './abstract/DependentExpression.ts';
|
|
3
3
|
export declare class ItemsetNodesetExpression extends DependentExpression<'nodes'> {
|
|
4
4
|
constructor(itemset: ItemsetDefinition, nodesetExpression: string);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ItemsetDefinition } from '../body/control/
|
|
1
|
+
import { ItemsetDefinition } from '../body/control/ItemsetDefinition.ts';
|
|
2
2
|
import { DependentExpression } from './abstract/DependentExpression.ts';
|
|
3
3
|
export declare class ItemsetValueExpression extends DependentExpression<'string'> {
|
|
4
4
|
readonly itemset: ItemsetDefinition;
|
|
@@ -3,6 +3,7 @@ import { BindComputationExpression } from '../expression/BindComputationExpressi
|
|
|
3
3
|
import { MessageDefinition } from '../text/MessageDefinition.ts';
|
|
4
4
|
import { XFormDefinition } from '../XFormDefinition.ts';
|
|
5
5
|
import { BindElement } from './BindElement.ts';
|
|
6
|
+
import { AnyBindPreloadDefinition } from './BindPreloadDefinition.ts';
|
|
6
7
|
import { BindType, BindTypeDefinition } from './BindTypeDefinition.ts';
|
|
7
8
|
import { ModelDefinition } from './ModelDefinition.ts';
|
|
8
9
|
export declare class BindDefinition<T extends BindType = BindType> extends DependencyContext {
|
|
@@ -12,6 +13,7 @@ export declare class BindDefinition<T extends BindType = BindType> extends Depen
|
|
|
12
13
|
readonly bindElement: BindElement;
|
|
13
14
|
readonly type: BindTypeDefinition<T>;
|
|
14
15
|
readonly parentNodeset: string | null;
|
|
16
|
+
readonly preload: AnyBindPreloadDefinition | null;
|
|
15
17
|
readonly calculate: BindComputationExpression<'calculate'> | null;
|
|
16
18
|
readonly readonly: BindComputationExpression<'readonly'>;
|
|
17
19
|
readonly relevant: BindComputationExpression<'relevant'>;
|
|
@@ -34,5 +36,5 @@ export declare class BindDefinition<T extends BindType = BindType> extends Depen
|
|
|
34
36
|
get reference(): string;
|
|
35
37
|
get parentReference(): string | null;
|
|
36
38
|
constructor(form: XFormDefinition, model: ModelDefinition, nodeset: string, bindElement: BindElement);
|
|
37
|
-
toJSON(): Omit<this, "form" | "reference" | "
|
|
39
|
+
toJSON(): Omit<this, "form" | "reference" | "parentReference" | "toJSON" | "isTranslated" | "model" | "bindElement" | "parentBind">;
|
|
38
40
|
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { PartiallyKnownString } from '../../../../common/types/string/PartiallyKnownString.ts';
|
|
2
|
+
import { BindElement } from './BindElement.ts';
|
|
3
|
+
type PartiallyKnownPreloadParameter<Known extends string> = PartiallyKnownString<NonNullable<Known>> | Extract<Known, null>;
|
|
4
|
+
interface PreloadParametersByType {
|
|
5
|
+
readonly uid: string | null;
|
|
6
|
+
readonly date: PartiallyKnownPreloadParameter<'today'>;
|
|
7
|
+
readonly timestamp: PartiallyKnownPreloadParameter<'end' | 'start'>;
|
|
8
|
+
readonly property: PartiallyKnownPreloadParameter<'deviceid' | 'email' | 'phonenumber' | 'username'>;
|
|
9
|
+
}
|
|
10
|
+
type PreloadType = PartiallyKnownString<keyof PreloadParametersByType>;
|
|
11
|
+
type PreloadParameter<Type extends PreloadType> = Type extends keyof PreloadParametersByType ? PreloadParametersByType[Type] : string | null;
|
|
12
|
+
interface PreloadInput<Type extends PreloadType> {
|
|
13
|
+
readonly type: Type;
|
|
14
|
+
readonly parameter: PreloadParameter<Type>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Parsed representation of
|
|
18
|
+
* {@link https://getodk.github.io/xforms-spec/#preload-attributes | Preload Attributes}.
|
|
19
|
+
* If specified on a
|
|
20
|
+
* {@link https://getodk.github.io/xforms-spec/#bindings | binding}, this will
|
|
21
|
+
* be parsed to define:
|
|
22
|
+
*
|
|
23
|
+
* - {@link type}, a `jr:preload`
|
|
24
|
+
* - {@link parameter}, an associated `jr:preloadParams` value
|
|
25
|
+
*
|
|
26
|
+
* @todo It would probably make sense for the _definition_ to also convey:
|
|
27
|
+
*
|
|
28
|
+
* 1. Which {@link https://getodk.github.io/xforms-spec/#events | event} the
|
|
29
|
+
* preload is semantically associated with (noting that the spec may be a tad
|
|
30
|
+
* overzealous about this association).
|
|
31
|
+
*
|
|
32
|
+
* 2. The constant XPath expression (or other computation?) expressed by the
|
|
33
|
+
* combined {@link type} and {@link parameter}.
|
|
34
|
+
*/
|
|
35
|
+
export declare class BindPreloadDefinition<Type extends PreloadType> implements PreloadInput<Type> {
|
|
36
|
+
static from(bindElement: BindElement): AnyBindPreloadDefinition | null;
|
|
37
|
+
readonly type: Type;
|
|
38
|
+
readonly parameter: PreloadParameter<Type>;
|
|
39
|
+
private constructor();
|
|
40
|
+
}
|
|
41
|
+
export type AnyBindPreloadDefinition = BindPreloadDefinition<'uid'> | BindPreloadDefinition<'timestamp'> | BindPreloadDefinition<'property'> | BindPreloadDefinition<string>;
|
|
42
|
+
export {};
|