@getodk/xforms-engine 0.3.0 → 0.5.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/dist/client/BaseNode.d.ts +15 -5
- package/dist/client/BaseValueNode.d.ts +32 -0
- package/dist/client/EngineConfig.d.ts +49 -49
- package/dist/client/GroupNode.d.ts +2 -3
- package/dist/client/InputNode.d.ts +53 -0
- package/dist/client/ModelValueNode.d.ts +13 -9
- package/dist/client/NodeAppearances.d.ts +1 -2
- package/dist/client/NoteNode.d.ts +3 -4
- package/dist/client/RootNode.d.ts +36 -10
- package/dist/client/SelectNode.d.ts +4 -5
- package/dist/client/SubtreeNode.d.ts +1 -2
- package/dist/client/TextRange.d.ts +3 -4
- package/dist/client/TriggerNode.d.ts +25 -0
- package/dist/client/ValueType.d.ts +3 -0
- package/dist/client/constants.d.ts +50 -1
- package/dist/client/hierarchy.d.ts +9 -5
- package/dist/client/identity.d.ts +14 -0
- package/dist/client/index.d.ts +0 -1
- package/dist/client/node-types.d.ts +3 -1
- package/dist/client/repeat/BaseRepeatRangeNode.d.ts +1 -2
- package/dist/client/repeat/RepeatInstanceNode.d.ts +2 -3
- package/dist/client/repeat/RepeatRangeControlledNode.d.ts +1 -2
- package/dist/client/repeat/RepeatRangeUncontrolledNode.d.ts +1 -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/RangeNode.d.ts +9 -0
- package/dist/client/unsupported/RankNode.d.ts +9 -0
- package/dist/client/unsupported/UnsupportedControlNode.d.ts +32 -0
- package/dist/client/unsupported/UploadNode.d.ts +9 -0
- package/dist/client/validation.d.ts +2 -3
- package/dist/error/ErrorProductionDesignPendingError.d.ts +7 -0
- package/dist/error/ValueTypeInvariantError.d.ts +17 -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 +16 -4
- package/dist/index.js +8559 -4700
- package/dist/index.js.map +1 -1
- package/dist/instance/Group.d.ts +9 -5
- package/dist/instance/InputControl.d.ts +36 -0
- package/dist/instance/ModelValue.d.ts +16 -27
- package/dist/instance/Note.d.ts +11 -5
- package/dist/instance/PrimaryInstance.d.ts +84 -0
- package/dist/instance/Root.d.ts +31 -28
- package/dist/instance/SelectField.d.ts +13 -6
- package/dist/instance/Subtree.d.ts +10 -6
- package/dist/instance/TriggerControl.d.ts +47 -0
- package/dist/instance/abstract/DescendantNode.d.ts +33 -26
- package/dist/instance/abstract/InstanceNode.d.ts +50 -31
- package/dist/instance/abstract/UnsupportedControl.d.ts +53 -0
- package/dist/instance/abstract/ValueNode.d.ts +48 -0
- package/dist/instance/children.d.ts +0 -1
- package/dist/instance/hierarchy.d.ts +13 -8
- package/dist/instance/identity.d.ts +2 -7
- package/dist/instance/index.d.ts +0 -1
- package/dist/instance/internal-api/EvaluationContext.d.ts +53 -13
- package/dist/instance/internal-api/InstanceConfig.d.ts +8 -3
- package/dist/instance/internal-api/InstanceValueContext.d.ts +20 -0
- package/dist/instance/internal-api/PrimaryInstanceDocument.d.ts +36 -0
- package/dist/instance/internal-api/TranslationContext.d.ts +3 -3
- package/dist/instance/internal-api/ValidationContext.d.ts +12 -6
- package/dist/instance/internal-api/ValueContext.d.ts +5 -5
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableInstance.d.ts +14 -0
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableLeafNode.d.ts +31 -0
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableParentNode.d.ts +18 -0
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableValueNode.d.ts +17 -0
- package/dist/instance/repeat/BaseRepeatRange.d.ts +40 -85
- package/dist/instance/repeat/RepeatInstance.d.ts +11 -30
- package/dist/instance/repeat/RepeatRangeControlled.d.ts +3 -4
- package/dist/instance/repeat/RepeatRangeUncontrolled.d.ts +3 -4
- package/dist/instance/resource.d.ts +1 -2
- package/dist/instance/text/TextChunk.d.ts +0 -1
- package/dist/instance/text/TextRange.d.ts +1 -2
- package/dist/instance/unsupported/RangeControl.d.ts +6 -0
- package/dist/instance/unsupported/RankControl.d.ts +6 -0
- package/dist/instance/unsupported/UploadControl.d.ts +6 -0
- 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 +16 -0
- package/dist/integration/xpath/adapter/traversal.d.ts +25 -0
- package/dist/integration/xpath/adapter/values.d.ts +2 -0
- package/dist/integration/xpath/static-dom/StaticAttribute.d.ts +19 -0
- package/dist/integration/xpath/static-dom/StaticDocument.d.ts +16 -0
- package/dist/integration/xpath/static-dom/StaticElement.d.ts +40 -0
- package/dist/integration/xpath/static-dom/StaticNamedNode.d.ts +17 -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/TokenListParser.d.ts +3 -3
- 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/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/IntValueCodec.d.ts +6 -0
- package/dist/lib/codecs/StringValueCodec.d.ts +4 -0
- package/dist/lib/codecs/ValueCodec.d.ts +30 -0
- package/dist/lib/codecs/ValueTypePlaceholderCodec.d.ts +12 -0
- package/dist/lib/codecs/getSharedValueCodec.d.ts +47 -0
- package/dist/lib/dom/query.d.ts +4 -2
- package/dist/lib/reactivity/createChildrenState.d.ts +7 -6
- package/dist/lib/reactivity/createComputedExpression.d.ts +19 -7
- package/dist/lib/reactivity/createInstanceValueState.d.ts +40 -0
- package/dist/lib/reactivity/createNoteReadonlyThunk.d.ts +2 -3
- package/dist/lib/reactivity/createSelectItems.d.ts +0 -1
- package/dist/lib/reactivity/createTranslationState.d.ts +19 -0
- package/dist/lib/reactivity/createValueState.d.ts +6 -11
- package/dist/lib/reactivity/materializeCurrentStateChildren.d.ts +4 -5
- package/dist/lib/reactivity/node-state/createClientState.d.ts +0 -1
- package/dist/lib/reactivity/node-state/createCurrentState.d.ts +0 -1
- package/dist/lib/reactivity/node-state/createEngineState.d.ts +0 -1
- package/dist/lib/reactivity/node-state/createSharedNodeState.d.ts +0 -1
- package/dist/lib/reactivity/node-state/createSpecifiedPropertyDescriptor.d.ts +0 -1
- package/dist/lib/reactivity/node-state/createSpecifiedState.d.ts +0 -1
- package/dist/lib/reactivity/node-state/representations.d.ts +0 -1
- package/dist/lib/reactivity/scope.d.ts +0 -1
- package/dist/lib/reactivity/text/createFieldHint.d.ts +1 -2
- package/dist/lib/reactivity/text/createNodeLabel.d.ts +1 -2
- package/dist/lib/reactivity/text/createNoteText.d.ts +1 -2
- package/dist/lib/reactivity/text/createTextRange.d.ts +0 -1
- package/dist/lib/reactivity/types.d.ts +0 -1
- package/dist/lib/reactivity/validation/createAggregatedViolations.d.ts +0 -1
- package/dist/lib/reactivity/validation/createValidation.d.ts +0 -1
- package/dist/lib/xml-serialization.d.ts +41 -0
- package/dist/parse/XFormDOM.d.ts +42 -0
- package/dist/{XFormDefinition.d.ts → parse/XFormDefinition.d.ts} +3 -5
- package/dist/parse/attachments/FormAttachmentResource.d.ts +27 -0
- package/dist/{body → parse/body}/BodyDefinition.d.ts +16 -11
- package/dist/{body → parse/body}/BodyElementDefinition.d.ts +7 -7
- package/dist/{body → parse/body}/RepeatElementDefinition.d.ts +3 -4
- package/dist/{body → parse/body}/UnsupportedBodyElementDefinition.d.ts +0 -1
- package/dist/parse/body/appearance/inputAppearanceParser.d.ts +3 -0
- package/dist/{body → parse/body}/appearance/selectAppearanceParser.d.ts +1 -2
- package/dist/{body → parse/body}/appearance/structureElementAppearanceParser.d.ts +1 -2
- package/dist/parse/body/appearance/unknownAppearanceParser.d.ts +3 -0
- package/dist/{body → parse/body}/control/ControlDefinition.d.ts +3 -4
- package/dist/{body/control/InputDefinition.d.ts → parse/body/control/InputControlDefinition.d.ts} +2 -3
- package/dist/parse/body/control/RangeControlDefinition.d.ts +11 -0
- package/dist/parse/body/control/RankControlDefinition.d.ts +11 -0
- package/dist/parse/body/control/TriggerControlDefinition.d.ts +11 -0
- package/dist/parse/body/control/UploadControlDefinition.d.ts +11 -0
- package/dist/{body → parse/body}/control/select/ItemDefinition.d.ts +2 -3
- package/dist/{body → parse/body}/control/select/ItemsetDefinition.d.ts +4 -5
- package/dist/{body → parse/body}/control/select/ItemsetNodesetContext.d.ts +1 -4
- package/dist/{body → parse/body}/control/select/SelectDefinition.d.ts +3 -12
- package/dist/{body → parse/body}/group/BaseGroupDefinition.d.ts +3 -5
- package/dist/{body → parse/body}/group/LogicalGroupDefinition.d.ts +0 -1
- package/dist/{body → parse/body}/group/PresentationGroupDefinition.d.ts +1 -2
- package/dist/{body → parse/body}/group/StructuralGroupDefinition.d.ts +0 -1
- package/dist/{model/BindComputation.d.ts → parse/expression/BindComputationExpression.d.ts} +5 -6
- package/dist/{body/control/select → parse/expression}/ItemsetNodesetExpression.d.ts +2 -3
- package/dist/{body/control/select → parse/expression}/ItemsetValueExpression.d.ts +2 -3
- package/dist/parse/expression/RepeatCountControlExpression.d.ts +2 -3
- package/dist/parse/expression/TextLiteralExpression.d.ts +9 -0
- package/dist/parse/expression/TextOutputExpression.d.ts +7 -0
- package/dist/parse/expression/TextReferenceExpression.d.ts +7 -0
- package/dist/parse/expression/TextTranslationExpression.d.ts +8 -0
- package/dist/parse/expression/abstract/DependencyContext.d.ts +7 -0
- package/dist/{expression → parse/expression/abstract}/DependentExpression.d.ts +4 -6
- package/dist/parse/expression/abstract/TextChunkExpression.d.ts +17 -0
- package/dist/parse/model/BindDefinition.d.ts +38 -0
- package/dist/parse/model/BindTypeDefinition.d.ts +20 -0
- package/dist/{model → parse/model}/DescendentNodeDefinition.d.ts +0 -2
- 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 +8 -0
- package/dist/parse/model/ItextTranslation/ItextTranslationsDefinition.d.ts +8 -0
- package/dist/{model → parse/model}/LeafNodeDefinition.d.ts +4 -3
- package/dist/{model → parse/model}/ModelBindMap.d.ts +1 -2
- package/dist/{model → parse/model}/ModelDefinition.d.ts +3 -2
- package/dist/{model → parse/model}/NodeDefinition.d.ts +0 -2
- package/dist/parse/{NoteNodeDefinition.d.ts → model/NoteNodeDefinition.d.ts} +12 -13
- package/dist/{model → parse/model}/RepeatInstanceDefinition.d.ts +1 -2
- package/dist/{model → parse/model}/RepeatRangeDefinition.d.ts +2 -3
- package/dist/{model → parse/model}/RepeatTemplateDefinition.d.ts +2 -3
- package/dist/{model → parse/model}/RootDefinition.d.ts +5 -5
- 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/{model → parse/model}/SubtreeDefinition.d.ts +1 -2
- package/dist/parse/shared/parseStaticDocumentFromDOMSubtree.d.ts +24 -0
- package/dist/parse/text/HintDefinition.d.ts +2 -3
- package/dist/parse/text/ItemLabelDefinition.d.ts +2 -3
- package/dist/parse/text/ItemsetLabelDefinition.d.ts +3 -4
- package/dist/parse/text/LabelDefinition.d.ts +5 -6
- package/dist/parse/text/MessageDefinition.d.ts +4 -5
- package/dist/parse/text/abstract/TextElementDefinition.d.ts +8 -9
- package/dist/parse/text/abstract/TextRangeDefinition.d.ts +4 -7
- package/dist/parse/xpath/path-resolution.d.ts +0 -1
- package/dist/parse/xpath/predicate-analysis.d.ts +0 -1
- package/dist/parse/xpath/reference-parsing.d.ts +0 -1
- package/dist/parse/xpath/semantic-analysis.d.ts +5 -1
- package/dist/parse/xpath/syntax-traversal.d.ts +0 -1
- package/dist/solid.js +8398 -4543
- package/dist/solid.js.map +1 -1
- package/package.json +14 -12
- package/src/client/BaseNode.ts +17 -7
- package/src/client/BaseValueNode.ts +35 -0
- package/src/client/EngineConfig.ts +52 -51
- package/src/client/GroupNode.ts +2 -2
- package/src/client/InputNode.ts +77 -0
- package/src/client/ModelValueNode.ts +31 -8
- package/src/client/NodeAppearances.ts +1 -1
- package/src/client/NoteNode.ts +3 -3
- package/src/client/RootNode.ts +39 -9
- package/src/client/SelectNode.ts +5 -5
- package/src/client/SubtreeNode.ts +1 -1
- package/src/client/TextRange.ts +4 -5
- package/src/client/TriggerNode.ts +29 -0
- package/src/client/ValueType.ts +4 -0
- package/src/client/constants.ts +67 -0
- package/src/client/hierarchy.ts +16 -4
- package/src/client/identity.ts +16 -0
- package/src/client/node-types.ts +19 -5
- package/src/client/repeat/BaseRepeatRangeNode.ts +1 -1
- package/src/client/repeat/RepeatInstanceNode.ts +2 -2
- package/src/client/repeat/RepeatRangeControlledNode.ts +1 -1
- package/src/client/repeat/RepeatRangeUncontrolledNode.ts +1 -1
- 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/RangeNode.ts +14 -0
- package/src/client/unsupported/RankNode.ts +14 -0
- package/src/client/unsupported/UnsupportedControlNode.ts +40 -0
- package/src/client/unsupported/UploadNode.ts +14 -0
- package/src/client/validation.ts +2 -2
- package/src/error/ErrorProductionDesignPendingError.ts +6 -0
- package/src/error/ValueTypeInvariantError.ts +22 -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 +16 -2
- package/src/instance/Group.ts +17 -5
- package/src/instance/InputControl.ts +119 -0
- package/src/instance/ModelValue.ts +47 -54
- package/src/instance/Note.ts +26 -10
- package/src/instance/PrimaryInstance.ts +244 -0
- package/src/instance/Root.ts +64 -132
- package/src/instance/SelectField.ts +62 -25
- package/src/instance/Subtree.ts +19 -7
- package/src/instance/{StringField.ts → TriggerControl.ts} +61 -30
- package/src/instance/abstract/DescendantNode.ts +92 -47
- package/src/instance/abstract/InstanceNode.ts +104 -98
- package/src/instance/abstract/UnsupportedControl.ts +174 -0
- package/src/instance/abstract/ValueNode.ts +127 -0
- package/src/instance/children.ts +83 -14
- package/src/instance/hierarchy.ts +36 -14
- package/src/instance/identity.ts +3 -9
- package/src/instance/index.ts +26 -8
- package/src/instance/internal-api/EvaluationContext.ts +61 -14
- package/src/instance/internal-api/InstanceConfig.ts +9 -2
- package/src/instance/internal-api/InstanceValueContext.ts +24 -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 +13 -5
- package/src/instance/internal-api/ValueContext.ts +5 -4
- package/src/instance/internal-api/submission/ClientReactiveSubmittableInstance.ts +20 -0
- package/src/instance/internal-api/submission/ClientReactiveSubmittableLeafNode.ts +42 -0
- package/src/instance/internal-api/submission/ClientReactiveSubmittableParentNode.ts +25 -0
- package/src/instance/internal-api/submission/ClientReactiveSubmittableValueNode.ts +23 -0
- package/src/instance/repeat/BaseRepeatRange.ts +51 -132
- package/src/instance/repeat/RepeatInstance.ts +20 -46
- package/src/instance/repeat/RepeatRangeControlled.ts +6 -6
- package/src/instance/repeat/RepeatRangeUncontrolled.ts +3 -5
- package/src/instance/resource.ts +1 -1
- package/src/instance/text/TextChunk.ts +1 -1
- package/src/instance/unsupported/RangeControl.ts +9 -0
- package/src/instance/unsupported/RankControl.ts +9 -0
- package/src/instance/unsupported/UploadControl.ts +9 -0
- 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 +99 -0
- package/src/integration/xpath/adapter/traversal.ts +228 -0
- package/src/integration/xpath/adapter/values.ts +5 -0
- package/src/integration/xpath/static-dom/StaticAttribute.ts +33 -0
- package/src/integration/xpath/static-dom/StaticDocument.ts +38 -0
- package/src/integration/xpath/static-dom/StaticElement.ts +106 -0
- package/src/integration/xpath/static-dom/StaticNamedNode.ts +45 -0
- package/src/integration/xpath/static-dom/StaticNode.ts +68 -0
- package/src/integration/xpath/static-dom/StaticText.ts +28 -0
- package/src/lib/TokenListParser.ts +11 -7
- 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/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/IntValueCodec.ts +100 -0
- package/src/lib/codecs/StringValueCodec.ts +11 -0
- package/src/lib/codecs/ValueCodec.ts +106 -0
- package/src/lib/codecs/ValueTypePlaceholderCodec.ts +19 -0
- package/src/lib/codecs/getSharedValueCodec.ts +77 -0
- package/src/lib/dom/query.ts +8 -1
- package/src/lib/reactivity/createChildrenState.ts +8 -6
- package/src/lib/reactivity/createComputedExpression.ts +59 -36
- package/src/lib/reactivity/createInstanceValueState.ts +166 -0
- package/src/lib/reactivity/createNoteReadonlyThunk.ts +12 -7
- package/src/lib/reactivity/createSelectItems.ts +23 -23
- package/src/lib/reactivity/createTranslationState.ts +61 -0
- package/src/lib/reactivity/createValueState.ts +64 -122
- package/src/lib/reactivity/materializeCurrentStateChildren.ts +7 -7
- package/src/lib/reactivity/node-state/createSpecifiedState.ts +1 -1
- package/src/lib/reactivity/text/createFieldHint.ts +1 -1
- package/src/lib/reactivity/text/createNodeLabel.ts +1 -1
- package/src/lib/reactivity/text/createNoteText.ts +1 -1
- package/src/lib/reactivity/text/createTextRange.ts +8 -7
- package/src/lib/reactivity/validation/createAggregatedViolations.ts +9 -4
- package/src/lib/reactivity/validation/createValidation.ts +2 -3
- package/src/lib/xml-serialization.ts +96 -0
- package/src/{XFormDOM.ts → parse/XFormDOM.ts} +110 -75
- package/src/{XFormDefinition.ts → parse/XFormDefinition.ts} +3 -8
- package/src/parse/attachments/FormAttachmentResource.ts +40 -0
- package/src/{body → parse/body}/BodyDefinition.ts +46 -29
- package/src/{body → parse/body}/BodyElementDefinition.ts +12 -6
- package/src/{body → parse/body}/RepeatElementDefinition.ts +7 -5
- package/src/{body → parse/body}/appearance/inputAppearanceParser.ts +2 -2
- package/src/{body → parse/body}/appearance/selectAppearanceParser.ts +1 -1
- package/src/{body → parse/body}/appearance/structureElementAppearanceParser.ts +1 -1
- package/src/parse/body/appearance/unknownAppearanceParser.ts +5 -0
- package/src/{body → parse/body}/control/ControlDefinition.ts +4 -4
- package/src/{body/control/InputDefinition.ts → parse/body/control/InputControlDefinition.ts} +3 -5
- package/src/parse/body/control/RangeControlDefinition.ts +26 -0
- package/src/parse/body/control/RankControlDefinition.ts +27 -0
- package/src/parse/body/control/TriggerControlDefinition.ts +26 -0
- package/src/parse/body/control/UploadControlDefinition.ts +26 -0
- package/src/{body → parse/body}/control/select/ItemDefinition.ts +2 -2
- package/src/{body → parse/body}/control/select/ItemsetDefinition.ts +5 -5
- package/src/{body → parse/body}/control/select/ItemsetNodesetContext.ts +1 -6
- package/src/{body → parse/body}/control/select/SelectDefinition.ts +3 -11
- package/src/{body → parse/body}/group/BaseGroupDefinition.ts +11 -22
- package/src/{body → parse/body}/group/PresentationGroupDefinition.ts +1 -1
- package/src/{model/BindComputation.ts → parse/expression/BindComputationExpression.ts} +8 -8
- package/src/{body/control/select → parse/expression}/ItemsetNodesetExpression.ts +2 -2
- package/src/{body/control/select → parse/expression}/ItemsetValueExpression.ts +2 -2
- package/src/parse/expression/RepeatCountControlExpression.ts +2 -2
- package/src/parse/expression/TextLiteralExpression.ts +19 -0
- package/src/parse/{text/OutputChunkDefinition.ts → expression/TextOutputExpression.ts} +4 -4
- package/src/parse/{text/ReferenceChunkDefinition.ts → expression/TextReferenceExpression.ts} +4 -4
- package/src/parse/{text/TranslationChunkDefinition.ts → expression/TextTranslationExpression.ts} +4 -4
- package/src/{expression → parse/expression/abstract}/DependencyContext.ts +0 -26
- package/src/{expression → parse/expression/abstract}/DependentExpression.ts +5 -16
- package/src/parse/expression/abstract/TextChunkExpression.ts +38 -0
- package/src/parse/model/BindDefinition.ts +104 -0
- package/src/parse/model/BindTypeDefinition.ts +175 -0
- package/src/{model → parse/model}/DescendentNodeDefinition.ts +0 -6
- package/src/parse/model/FormSubmissionDefinition.ts +44 -0
- package/src/parse/model/ItextTranslation/ItextTranslationDefinition.ts +4 -0
- package/src/parse/model/ItextTranslation/ItextTranslationRootDefinition.ts +41 -0
- package/src/parse/model/ItextTranslation/ItextTranslationsDefinition.ts +31 -0
- package/src/{model → parse/model}/LeafNodeDefinition.ts +4 -1
- package/src/{model → parse/model}/ModelBindMap.ts +6 -8
- package/src/parse/model/ModelDefinition.ts +24 -0
- package/src/{model → parse/model}/NodeDefinition.ts +0 -3
- package/src/parse/{NoteNodeDefinition.ts → model/NoteNodeDefinition.ts} +12 -12
- package/src/{model → parse/model}/RepeatRangeDefinition.ts +1 -1
- package/src/{model → parse/model}/RootDefinition.ts +4 -3
- 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 +414 -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/shared/parseStaticDocumentFromDOMSubtree.ts +149 -0
- package/src/parse/text/HintDefinition.ts +2 -2
- package/src/parse/text/ItemLabelDefinition.ts +2 -2
- package/src/parse/text/ItemsetLabelDefinition.ts +7 -7
- package/src/parse/text/LabelDefinition.ts +5 -5
- package/src/parse/text/MessageDefinition.ts +7 -7
- package/src/parse/text/abstract/TextElementDefinition.ts +14 -14
- package/src/parse/text/abstract/TextRangeDefinition.ts +4 -10
- package/src/parse/xpath/semantic-analysis.ts +29 -0
- package/dist/XFormDOM.d.ts +0 -32
- package/dist/XFormDataType.d.ts +0 -27
- package/dist/body/appearance/inputAppearanceParser.d.ts +0 -4
- package/dist/client/StringNode.d.ts +0 -47
- package/dist/expression/DependencyContext.d.ts +0 -13
- package/dist/instance/StringField.d.ts +0 -45
- package/dist/instance/internal-api/SubscribableDependency.d.ts +0 -60
- package/dist/model/BindDefinition.d.ts +0 -34
- package/dist/parse/text/OutputChunkDefinition.d.ts +0 -8
- package/dist/parse/text/ReferenceChunkDefinition.d.ts +0 -8
- package/dist/parse/text/StaticTextChunkDefinition.d.ts +0 -10
- package/dist/parse/text/TranslationChunkDefinition.d.ts +0 -9
- package/dist/parse/text/abstract/TextChunkDefinition.d.ts +0 -18
- package/src/XFormDataType.ts +0 -64
- package/src/client/StringNode.ts +0 -52
- package/src/instance/internal-api/SubscribableDependency.ts +0 -61
- package/src/model/BindDefinition.ts +0 -106
- package/src/model/ModelDefinition.ts +0 -19
- package/src/parse/TODO.md +0 -3
- package/src/parse/text/StaticTextChunkDefinition.ts +0 -19
- package/src/parse/text/abstract/TextChunkDefinition.ts +0 -38
- /package/dist/{model → parse/model}/BindElement.d.ts +0 -0
- /package/src/{body → parse/body}/UnsupportedBodyElementDefinition.ts +0 -0
- /package/src/{body → parse/body}/group/LogicalGroupDefinition.ts +0 -0
- /package/src/{body → parse/body}/group/StructuralGroupDefinition.ts +0 -0
- /package/src/{model → parse/model}/BindElement.ts +0 -0
- /package/src/{model → parse/model}/RepeatInstanceDefinition.ts +0 -0
- /package/src/{model → parse/model}/RepeatTemplateDefinition.ts +0 -0
- /package/src/{model → parse/model}/SubtreeDefinition.ts +0 -0
|
@@ -1,74 +1,64 @@
|
|
|
1
|
+
import { XPathNodeKindKey } from '@getodk/xpath';
|
|
1
2
|
import { Accessor } from 'solid-js';
|
|
3
|
+
import { FormNodeID } from '../../client/identity.ts';
|
|
2
4
|
import { NodeAppearances } from '../../client/NodeAppearances.ts';
|
|
3
5
|
import { BaseRepeatRangeNode } from '../../client/repeat/BaseRepeatRangeNode.ts';
|
|
6
|
+
import { SubmissionState } from '../../client/submission/SubmissionState.ts';
|
|
4
7
|
import { TextRange } from '../../client/TextRange.ts';
|
|
5
8
|
import { AncestorNodeValidationState } from '../../client/validation.ts';
|
|
9
|
+
import { XFormsXPathNodeRange, XFormsXPathNodeRangeKind } from '../../integration/xpath/adapter/XFormsXPathNode.ts';
|
|
6
10
|
import { ChildrenState } from '../../lib/reactivity/createChildrenState.ts';
|
|
7
11
|
import { MaterializedChildren } from '../../lib/reactivity/materializeCurrentStateChildren.ts';
|
|
8
12
|
import { CurrentState } from '../../lib/reactivity/node-state/createCurrentState.ts';
|
|
9
13
|
import { EngineState } from '../../lib/reactivity/node-state/createEngineState.ts';
|
|
10
14
|
import { SharedNodeState } from '../../lib/reactivity/node-state/createSharedNodeState.ts';
|
|
11
|
-
import { AnyRepeatRangeDefinition, ControlledRepeatRangeDefinition } from '../../model/RepeatRangeDefinition.ts';
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
15
|
+
import { AnyRepeatRangeDefinition, ControlledRepeatRangeDefinition } from '../../parse/model/RepeatRangeDefinition.ts';
|
|
16
|
+
import { DescendantNodeSharedStateSpec, DescendantNode } from '../abstract/DescendantNode.ts';
|
|
17
|
+
import { GeneralParentNode } from '../hierarchy.ts';
|
|
14
18
|
import { EvaluationContext } from '../internal-api/EvaluationContext.ts';
|
|
15
|
-
import {
|
|
19
|
+
import { ClientReactiveSubmittableParentNode } from '../internal-api/submission/ClientReactiveSubmittableParentNode.ts';
|
|
16
20
|
import { RepeatInstance, RepeatDefinition } from './RepeatInstance.ts';
|
|
17
|
-
|
|
18
21
|
interface RepeatRangeStateSpec extends DescendantNodeSharedStateSpec {
|
|
19
22
|
readonly hint: null;
|
|
20
23
|
readonly label: Accessor<TextRange<'label'> | null>;
|
|
21
|
-
readonly children: Accessor<readonly
|
|
24
|
+
readonly children: Accessor<readonly FormNodeID[]>;
|
|
22
25
|
readonly valueOptions: null;
|
|
23
26
|
readonly value: null;
|
|
24
27
|
}
|
|
25
28
|
type BaseRepeatRangeNodeType<Definition extends AnyRepeatRangeDefinition> = Definition extends ControlledRepeatRangeDefinition ? 'repeat-range:controlled' : 'repeat-range:uncontrolled';
|
|
26
|
-
export declare abstract class BaseRepeatRange<Definition extends AnyRepeatRangeDefinition> extends DescendantNode<Definition, RepeatRangeStateSpec, RepeatInstance> implements BaseRepeatRangeNode, EvaluationContext,
|
|
27
|
-
/**
|
|
28
|
-
* A repeat range doesn't have a corresponding primary instance element of its
|
|
29
|
-
* own, and its instances are appended to the range's parent element. During
|
|
30
|
-
* creation of the initial primary instance state and DOM trees, we _could_
|
|
31
|
-
* reliably append all of the range's instances in order as the definition
|
|
32
|
-
* tree is recursed. But that would fail to handle some instance addition
|
|
33
|
-
* cases afterwards.
|
|
34
|
-
*
|
|
35
|
-
* Most notably, we need to know where in the primary instance tree to append
|
|
36
|
-
* instances created for a range which is currently empty. As a lucky
|
|
37
|
-
* coincidence, this need coincides with the ability to add instances at any
|
|
38
|
-
* arbitrary index within the range. In each case, we can reference a primary
|
|
39
|
-
* instance DOM node which will become the new instance's preceding sibling.
|
|
40
|
-
* Where the range is empty, we use this {@link Comment} node (itself created
|
|
41
|
-
* and appended during range initialization) in lieu of a nonexistent
|
|
42
|
-
* preceding instance's {@link contextNode}.
|
|
43
|
-
*
|
|
44
|
-
* @todo We likely want to remove these during submission serialization.
|
|
45
|
-
* @todo Can we use a
|
|
46
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/API/Range | DOM Range}
|
|
47
|
-
* instead?
|
|
48
|
-
*/
|
|
49
|
-
protected readonly anchorNode: Comment;
|
|
29
|
+
export declare abstract class BaseRepeatRange<Definition extends AnyRepeatRangeDefinition> extends DescendantNode<Definition, RepeatRangeStateSpec, GeneralParentNode, RepeatInstance> implements BaseRepeatRangeNode, XFormsXPathNodeRange, EvaluationContext, ClientReactiveSubmittableParentNode<RepeatInstance> {
|
|
50
30
|
protected readonly childrenState: ChildrenState<RepeatInstance>;
|
|
51
31
|
/**
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
*
|
|
32
|
+
* A repeat range doesn't have a corresponding primary instance element of its
|
|
33
|
+
* own. It is represented in the following ways:
|
|
34
|
+
*
|
|
35
|
+
* - As a comment node (in terms of XPath semantics), immediately preceding
|
|
36
|
+
* the repeat range's {@link RepeatInstance | repeat instances} (if it
|
|
37
|
+
* presently has any; as a placeholder where they may be appended
|
|
38
|
+
* otherwise). This is necessary to support certain ODK XForms functionality
|
|
39
|
+
* where an expression is expected to be evaluated against "repeats" as a
|
|
40
|
+
* conceptual unit. Most typically, this includes:
|
|
41
|
+
*
|
|
42
|
+
* - `jr:count` expressions associated with the repeat's body element
|
|
43
|
+
* - `relevant` bind computations associated with the repeat's nodeset
|
|
44
|
+
*
|
|
45
|
+
* - As a subtree with {@link RepeatInstance | repeat instance} **children**,
|
|
46
|
+
* in service of the client-facing {@link RepeatRangeNode} API (and with the
|
|
47
|
+
* same structural semantics internally)
|
|
48
|
+
*
|
|
49
|
+
* Ultimately, this means there is a fundamental impedance mismatch between
|
|
50
|
+
* two representations which are either necessary (XPath) or high value
|
|
51
|
+
* (providing a coherent mental model for clients and the engine
|
|
52
|
+
* implementation servicing that client-facing model).
|
|
53
|
+
*
|
|
54
|
+
* In recognition that this is a truly odd mix of inherent and incidental
|
|
55
|
+
* complexity, here we use the special {@link XFormsXPathNodeRangeKind}
|
|
56
|
+
* branded type as a dedicated point of (internal) documentation where the two
|
|
57
|
+
* models diverge.
|
|
68
58
|
*/
|
|
69
|
-
|
|
59
|
+
readonly [XPathNodeKindKey]: XFormsXPathNodeRangeKind;
|
|
70
60
|
protected readonly state: SharedNodeState<RepeatRangeStateSpec>;
|
|
71
|
-
protected engineState: EngineState<RepeatRangeStateSpec>;
|
|
61
|
+
protected readonly engineState: EngineState<RepeatRangeStateSpec>;
|
|
72
62
|
/**
|
|
73
63
|
* @todo Should we special case repeat `readonly` state the same way
|
|
74
64
|
* we do for `relevant`?
|
|
@@ -76,40 +66,6 @@ export declare abstract class BaseRepeatRange<Definition extends AnyRepeatRangeD
|
|
|
76
66
|
* @see {@link isSelfRelevant}
|
|
77
67
|
*/
|
|
78
68
|
isSelfReadonly: Accessor<boolean>;
|
|
79
|
-
/**
|
|
80
|
-
* A repeat range does not exist in the primary instance tree. A `relevant`
|
|
81
|
-
* expression applies to each {@link RepeatInstance} child of the repeat
|
|
82
|
-
* range. Determining whether a repeat range itself "is relevant" isn't a
|
|
83
|
-
* concept the spec addresses, but it may be used by clients to determine
|
|
84
|
-
* whether to allow interaction with the range (e.g. by adding a repeat
|
|
85
|
-
* instance, or presenting the range's label when empty).
|
|
86
|
-
*
|
|
87
|
-
* As a naive first pass, it seems like the heuristic for this should be:
|
|
88
|
-
*
|
|
89
|
-
* 1. Does the repeat range have any repeat instance children?
|
|
90
|
-
*
|
|
91
|
-
* - If yes, go to 2.
|
|
92
|
-
* - If no, go to 3.
|
|
93
|
-
*
|
|
94
|
-
* 2. Does one or more of those children return `true` for the node's
|
|
95
|
-
* `relevant` expression (i.e. is the repeat instance "self relevant")?
|
|
96
|
-
*
|
|
97
|
-
* 3. Does the relevant expression return `true` for the repeat range itself
|
|
98
|
-
* (where, at least for now, the context of that evaluation would be the
|
|
99
|
-
* repeat range's {@link anchorNode} to ensure correct relative expressions
|
|
100
|
-
* resolve correctly)?
|
|
101
|
-
*
|
|
102
|
-
* @todo While (3) is proactively implemented, there isn't presently a test
|
|
103
|
-
* exercising it. It felt best for now to surface this for discussion in
|
|
104
|
-
* review to validate that it's going in the right direction.
|
|
105
|
-
*
|
|
106
|
-
* @todo While (2) **is actually tested**, the tests currently in place behave
|
|
107
|
-
* the same way with only the logic for (3), regardless of whether the repeat
|
|
108
|
-
* range actually has any repeat instance children. It's unclear (a) if that's
|
|
109
|
-
* a preferable simplification and (b) how that might affect performance (in
|
|
110
|
-
* theory it could vary depending on form structure and runtime state).
|
|
111
|
-
*/
|
|
112
|
-
readonly isSelfRelevant: Accessor<boolean>;
|
|
113
69
|
abstract readonly nodeType: BaseRepeatRangeNodeType<Definition>;
|
|
114
70
|
/**
|
|
115
71
|
* @todo RepeatRange*, RepeatInstance* (and RepeatTemplate*) all share the
|
|
@@ -147,14 +103,13 @@ export declare abstract class BaseRepeatRange<Definition extends AnyRepeatRangeD
|
|
|
147
103
|
abstract readonly appearances: NodeAppearances<Definition>;
|
|
148
104
|
readonly currentState: MaterializedChildren<CurrentState<RepeatRangeStateSpec>, RepeatInstance>;
|
|
149
105
|
abstract readonly validationState: AncestorNodeValidationState;
|
|
150
|
-
|
|
106
|
+
readonly submissionState: SubmissionState;
|
|
107
|
+
constructor(parent: GeneralParentNode, definition: Definition);
|
|
151
108
|
protected getLastIndex(): number;
|
|
152
|
-
protected initializeContextNode(parentContextNode: Element): Element;
|
|
153
109
|
getInstanceIndex(instance: RepeatInstance): number;
|
|
154
110
|
private createChildren;
|
|
155
111
|
protected addChildren(afterIndex: number, definitions: readonly RepeatDefinition[]): readonly RepeatInstance[];
|
|
156
112
|
protected removeChildren(startIndex: number, count: number): readonly RepeatInstance[];
|
|
157
|
-
subscribe(): void;
|
|
158
113
|
getChildren(): readonly RepeatInstance[];
|
|
159
114
|
}
|
|
160
115
|
export {};
|
|
@@ -1,35 +1,37 @@
|
|
|
1
|
+
import { XPathNodeKindKey } from '@getodk/xpath';
|
|
1
2
|
import { Accessor } from 'solid-js';
|
|
3
|
+
import { FormNodeID } from '../../client/identity.ts';
|
|
2
4
|
import { RepeatDefinition, RepeatInstanceNode, RepeatInstanceNodeAppearances } from '../../client/repeat/RepeatInstanceNode.ts';
|
|
5
|
+
import { SubmissionState } from '../../client/submission/SubmissionState.ts';
|
|
3
6
|
import { TextRange } from '../../client/TextRange.ts';
|
|
4
7
|
import { AncestorNodeValidationState } from '../../client/validation.ts';
|
|
8
|
+
import { XFormsXPathElement } from '../../integration/xpath/adapter/XFormsXPathNode.ts';
|
|
5
9
|
import { MaterializedChildren } from '../../lib/reactivity/materializeCurrentStateChildren.ts';
|
|
6
10
|
import { CurrentState } from '../../lib/reactivity/node-state/createCurrentState.ts';
|
|
7
11
|
import { EngineState } from '../../lib/reactivity/node-state/createEngineState.ts';
|
|
8
12
|
import { SharedNodeState } from '../../lib/reactivity/node-state/createSharedNodeState.ts';
|
|
9
13
|
import { DescendantNodeSharedStateSpec, DescendantNode } from '../abstract/DescendantNode.ts';
|
|
10
|
-
import {
|
|
11
|
-
import { NodeID } from '../identity.ts';
|
|
14
|
+
import { GeneralChildNode, RepeatRange } from '../hierarchy.ts';
|
|
12
15
|
import { EvaluationContext } from '../internal-api/EvaluationContext.ts';
|
|
13
|
-
import {
|
|
14
|
-
|
|
16
|
+
import { ClientReactiveSubmittableParentNode } from '../internal-api/submission/ClientReactiveSubmittableParentNode.ts';
|
|
15
17
|
export type { RepeatDefinition };
|
|
16
18
|
interface RepeatInstanceStateSpec extends DescendantNodeSharedStateSpec {
|
|
17
19
|
readonly label: Accessor<TextRange<'label'> | null>;
|
|
18
20
|
readonly hint: null;
|
|
19
|
-
readonly children: Accessor<readonly
|
|
21
|
+
readonly children: Accessor<readonly FormNodeID[]>;
|
|
20
22
|
readonly valueOptions: null;
|
|
21
23
|
readonly value: null;
|
|
22
24
|
}
|
|
23
25
|
interface RepeatInstanceOptions {
|
|
24
|
-
readonly precedingPrimaryInstanceNode: Comment | Element;
|
|
25
26
|
readonly precedingInstance: RepeatInstance | null;
|
|
26
27
|
}
|
|
27
|
-
export declare class RepeatInstance extends DescendantNode<RepeatDefinition, RepeatInstanceStateSpec, GeneralChildNode> implements RepeatInstanceNode, EvaluationContext,
|
|
28
|
+
export declare class RepeatInstance extends DescendantNode<RepeatDefinition, RepeatInstanceStateSpec, RepeatRange, GeneralChildNode> implements RepeatInstanceNode, XFormsXPathElement, EvaluationContext, ClientReactiveSubmittableParentNode<GeneralChildNode> {
|
|
28
29
|
readonly parent: RepeatRange;
|
|
29
30
|
private readonly childrenState;
|
|
30
31
|
private readonly currentIndex;
|
|
32
|
+
readonly [XPathNodeKindKey] = "element";
|
|
31
33
|
protected readonly state: SharedNodeState<RepeatInstanceStateSpec>;
|
|
32
|
-
protected engineState: EngineState<RepeatInstanceStateSpec>;
|
|
34
|
+
protected readonly engineState: EngineState<RepeatInstanceStateSpec>;
|
|
33
35
|
/**
|
|
34
36
|
* @todo Should we special case repeat `readonly` inheritance the same way
|
|
35
37
|
* we do for `relevant`?
|
|
@@ -58,28 +60,7 @@ export declare class RepeatInstance extends DescendantNode<RepeatDefinition, Rep
|
|
|
58
60
|
readonly appearances: RepeatInstanceNodeAppearances;
|
|
59
61
|
readonly currentState: MaterializedChildren<CurrentState<RepeatInstanceStateSpec>, GeneralChildNode>;
|
|
60
62
|
readonly validationState: AncestorNodeValidationState;
|
|
63
|
+
readonly submissionState: SubmissionState;
|
|
61
64
|
constructor(parent: RepeatRange, definition: RepeatDefinition, options: RepeatInstanceOptions);
|
|
62
|
-
protected initializeContextNode(parentContextNode: Element, nodeName: string): Element;
|
|
63
|
-
subscribe(): void;
|
|
64
65
|
getChildren(): readonly GeneralChildNode[];
|
|
65
|
-
/**
|
|
66
|
-
* Performs repeat instance node-specific removal logic, then general node
|
|
67
|
-
* removal logic, in that order:
|
|
68
|
-
*
|
|
69
|
-
* 1. At present, before any reactive state change is performed, the repeat
|
|
70
|
-
* instance's {@link contextNode} is removed from the primary instance's
|
|
71
|
-
* XML DOM backing store (which also removes any descendant nodes from that
|
|
72
|
-
* store, as a side effect). This behavior may become unnecessary if/when
|
|
73
|
-
* we phase out use of this XML DOM backing store. This should be peformed
|
|
74
|
-
* first, so that any following reactive logic which evaluates affected
|
|
75
|
-
* XPath expressions will be performed against a state consistent with the
|
|
76
|
-
* repeat instance's removal (and that of its XML DOM descendants).
|
|
77
|
-
*
|
|
78
|
-
* 2. Performs any remaining removal logic as defined in
|
|
79
|
-
* {@link DescendantNode.remove}.
|
|
80
|
-
*
|
|
81
|
-
* These removal steps **must also** occur before any update to the parent
|
|
82
|
-
* {@link RepeatRange}'s reactive children state.
|
|
83
|
-
*/
|
|
84
|
-
remove(this: AnyChildNode): void;
|
|
85
66
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { RepeatRangeNodeAppearances } from '../../client/repeat/BaseRepeatRangeNode.ts';
|
|
2
2
|
import { RepeatRangeControlledNode } from '../../client/repeat/RepeatRangeControlledNode.ts';
|
|
3
3
|
import { AncestorNodeValidationState } from '../../client/validation.ts';
|
|
4
|
-
import {
|
|
4
|
+
import { XFormsXPathNodeRange } from '../../integration/xpath/adapter/XFormsXPathNode.ts';
|
|
5
|
+
import { ControlledRepeatRangeDefinition } from '../../parse/model/RepeatRangeDefinition.ts';
|
|
5
6
|
import { GeneralParentNode } from '../hierarchy.ts';
|
|
6
7
|
import { EvaluationContext } from '../internal-api/EvaluationContext.ts';
|
|
7
|
-
import { SubscribableDependency } from '../internal-api/SubscribableDependency.ts';
|
|
8
8
|
import { BaseRepeatRange } from './BaseRepeatRange.ts';
|
|
9
|
-
|
|
10
|
-
export declare class RepeatRangeControlled extends BaseRepeatRange<ControlledRepeatRangeDefinition> implements RepeatRangeControlledNode, EvaluationContext, SubscribableDependency {
|
|
9
|
+
export declare class RepeatRangeControlled extends BaseRepeatRange<ControlledRepeatRangeDefinition> implements RepeatRangeControlledNode, XFormsXPathNodeRange, EvaluationContext {
|
|
11
10
|
readonly nodeType = "repeat-range:controlled";
|
|
12
11
|
readonly appearances: RepeatRangeNodeAppearances;
|
|
13
12
|
readonly validationState: AncestorNodeValidationState;
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { RepeatRangeNodeAppearances } from '../../client/repeat/BaseRepeatRangeNode.ts';
|
|
2
2
|
import { RepeatRangeUncontrolledNode } from '../../client/repeat/RepeatRangeUncontrolledNode.ts';
|
|
3
3
|
import { AncestorNodeValidationState } from '../../client/validation.ts';
|
|
4
|
-
import {
|
|
4
|
+
import { XFormsXPathNodeRange } from '../../integration/xpath/adapter/XFormsXPathNode.ts';
|
|
5
|
+
import { UncontrolledRepeatRangeDefinition } from '../../parse/model/RepeatRangeDefinition.ts';
|
|
5
6
|
import { GeneralParentNode } from '../hierarchy.ts';
|
|
6
7
|
import { EvaluationContext } from '../internal-api/EvaluationContext.ts';
|
|
7
|
-
import { SubscribableDependency } from '../internal-api/SubscribableDependency.ts';
|
|
8
8
|
import { Root } from '../Root.ts';
|
|
9
9
|
import { BaseRepeatRange } from './BaseRepeatRange.ts';
|
|
10
|
-
|
|
11
|
-
export declare class RepeatRangeUncontrolled extends BaseRepeatRange<UncontrolledRepeatRangeDefinition> implements RepeatRangeUncontrolledNode, EvaluationContext, SubscribableDependency {
|
|
10
|
+
export declare class RepeatRangeUncontrolled extends BaseRepeatRange<UncontrolledRepeatRangeDefinition> implements RepeatRangeUncontrolledNode, XFormsXPathNodeRange, EvaluationContext {
|
|
12
11
|
readonly nodeType = "repeat-range:uncontrolled";
|
|
13
12
|
readonly appearances: RepeatRangeNodeAppearances;
|
|
14
13
|
readonly validationState: AncestorNodeValidationState;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { FetchResource, FetchResourceResponse } from '../client/EngineConfig.ts';
|
|
2
1
|
import { FormResource } from '../client/index.ts';
|
|
3
|
-
|
|
2
|
+
import { FetchResource, FetchResourceResponse } from '../client/resources.ts';
|
|
4
3
|
export type { FetchResource, FetchResourceResponse, FormResource };
|
|
5
4
|
export interface ResourceOptions {
|
|
6
5
|
readonly fetchResource: FetchResource;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ActiveLanguage } from '../../client/FormLanguage.ts';
|
|
2
2
|
import { TextChunk as ClientTextChunk, TextChunkSource } from '../../client/TextRange.ts';
|
|
3
3
|
import { TranslationContext } from '../internal-api/TranslationContext.ts';
|
|
4
|
-
|
|
5
4
|
export declare class TextChunk implements ClientTextChunk {
|
|
6
5
|
readonly context: TranslationContext;
|
|
7
6
|
readonly source: TextChunkSource;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { TextRange as ClientTextRange, TextChunk, TextOrigin, TextRole } from '../../client/TextRange.ts';
|
|
2
|
-
|
|
3
2
|
export declare class TextRange<Role extends TextRole, Origin extends TextOrigin> implements ClientTextRange<Role, Origin> {
|
|
4
3
|
readonly origin: Origin;
|
|
5
4
|
readonly role: Role;
|
|
6
5
|
protected readonly chunks: readonly TextChunk[];
|
|
7
|
-
[Symbol.iterator](): Generator<TextChunk, void,
|
|
6
|
+
[Symbol.iterator](): Generator<TextChunk, void, unknown>;
|
|
8
7
|
get formatted(): Record<PropertyKey, unknown>;
|
|
9
8
|
get asString(): string;
|
|
10
9
|
constructor(origin: Origin, role: Role, chunks: readonly TextChunk[]);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UnsupportedControl } from '../abstract/UnsupportedControl.ts';
|
|
2
|
+
import { ValueContext } from '../internal-api/ValueContext.ts';
|
|
3
|
+
export declare class RangeControl extends UnsupportedControl<'range'> implements ValueContext<unknown> {
|
|
4
|
+
readonly nodeType = "range";
|
|
5
|
+
readonly contextNode: this;
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UnsupportedControl } from '../abstract/UnsupportedControl.ts';
|
|
2
|
+
import { ValueContext } from '../internal-api/ValueContext.ts';
|
|
3
|
+
export declare class RankControl extends UnsupportedControl<'rank'> implements ValueContext<unknown> {
|
|
4
|
+
readonly nodeType = "rank";
|
|
5
|
+
readonly contextNode: this;
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UnsupportedControl } from '../abstract/UnsupportedControl.ts';
|
|
2
|
+
import { ValueContext } from '../internal-api/ValueContext.ts';
|
|
3
|
+
export declare class UploadControl extends UnsupportedControl<'upload'> implements ValueContext<unknown> {
|
|
4
|
+
readonly nodeType = "upload";
|
|
5
|
+
readonly contextNode: this;
|
|
6
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { XFormsItextTranslationMap, XFormsSecondaryInstanceMap, XFormsXPathEvaluator } from '@getodk/xpath';
|
|
2
|
+
import { PrimaryInstance } from '../../instance/PrimaryInstance.ts';
|
|
3
|
+
import { ItextTranslationRootDefinition } from '../../parse/model/ItextTranslation/ItextTranslationRootDefinition.ts';
|
|
4
|
+
import { SecondaryInstanceRootDefinition } from '../../parse/model/SecondaryInstance/SecondaryInstanceRootDefinition.ts';
|
|
5
|
+
import { EngineXPathNode } from './adapter/kind.ts';
|
|
6
|
+
interface EngineXPathEvaluatorOptions {
|
|
7
|
+
readonly rootNode: PrimaryInstance;
|
|
8
|
+
readonly itextTranslationsByLanguage: XFormsItextTranslationMap<ItextTranslationRootDefinition>;
|
|
9
|
+
readonly secondaryInstancesById: XFormsSecondaryInstanceMap<SecondaryInstanceRootDefinition>;
|
|
10
|
+
}
|
|
11
|
+
export declare class EngineXPathEvaluator extends XFormsXPathEvaluator<EngineXPathNode> {
|
|
12
|
+
constructor(options: EngineXPathEvaluatorOptions);
|
|
13
|
+
}
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { XPathAttributeKind, XPathCommentKind, XPathDocumentKind, XPathElementKind, XPathTextKind, XPathNodeKindKey } from '@getodk/xpath';
|
|
2
|
+
declare const XFORMS_XPATH_NODE_RANGE_BRAND: unique symbol;
|
|
3
|
+
/**
|
|
4
|
+
* To be used with any engine representation of a "range" of contiguous child
|
|
5
|
+
* nodes (also somewhat analogous to a DOM "fragment"). This mapping is
|
|
6
|
+
* conceptually disjoint, but serves an important purpose:
|
|
7
|
+
*
|
|
8
|
+
* - While such a "range" may increase the hierarchical depth of an
|
|
9
|
+
* engine-internal representation, it **DOES NOT** contribute the same
|
|
10
|
+
* hierarchy in XPath evaluation semantics.
|
|
11
|
+
* - Such a "range" may be treated as a distinct context node for evaluating an
|
|
12
|
+
* expression. This most cleanly maps to XPath's comment semantics in that it
|
|
13
|
+
* allows the "range" to have a clear document position (hierarchically a
|
|
14
|
+
* child of its parent element; sequentially a sibling to that parent's other
|
|
15
|
+
* child nodes).
|
|
16
|
+
*
|
|
17
|
+
* (Note: while this is phrased as an abstract concept, it is intended to
|
|
18
|
+
* correspond directly to the engine's "repeat range" concept. The specific type
|
|
19
|
+
* is not referenced here because they have an inverse relationship in the
|
|
20
|
+
* module/type graph.)
|
|
21
|
+
*/
|
|
22
|
+
export type XFormsXPathNodeRangeKind = 'comment' & {
|
|
23
|
+
readonly [XFORMS_XPATH_NODE_RANGE_BRAND]: true;
|
|
24
|
+
};
|
|
25
|
+
export declare const XFORMS_XPATH_NODE_RANGE_KIND: XFormsXPathNodeRangeKind;
|
|
26
|
+
export type XFormsXPathNodeKind = XPathDocumentKind | XFormsXPathNodeRangeKind | XPathElementKind | XPathAttributeKind | XPathTextKind | XPathCommentKind;
|
|
27
|
+
export interface XFormsXPathNode {
|
|
28
|
+
readonly [XPathNodeKindKey]: XFormsXPathNodeKind;
|
|
29
|
+
readonly rootDocument: XFormsXPathDocument;
|
|
30
|
+
readonly root: XFormsXPathElement;
|
|
31
|
+
getXPathChildNodes(this: XFormsXPathNode): readonly XFormsXPathDescendantNode[];
|
|
32
|
+
getXPathValue(this: XFormsXPathNode): string;
|
|
33
|
+
}
|
|
34
|
+
export interface XFormsXPathDocument extends XFormsXPathNode {
|
|
35
|
+
readonly [XPathNodeKindKey]: XPathDocumentKind;
|
|
36
|
+
}
|
|
37
|
+
export interface XFormsXPathElement extends XFormsXPathNode {
|
|
38
|
+
readonly [XPathNodeKindKey]: XPathElementKind;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @see {@link XFormsXPathNodeRangeKind}
|
|
42
|
+
*/
|
|
43
|
+
export interface XFormsXPathNodeRange extends XFormsXPathNode {
|
|
44
|
+
readonly [XPathNodeKindKey]: XFormsXPathNodeRangeKind;
|
|
45
|
+
}
|
|
46
|
+
export interface XFormsXPathAttribute extends XFormsXPathNode {
|
|
47
|
+
readonly [XPathNodeKindKey]: XPathAttributeKind;
|
|
48
|
+
}
|
|
49
|
+
export interface XFormsXPathText extends XFormsXPathNode {
|
|
50
|
+
readonly [XPathNodeKindKey]: XPathTextKind;
|
|
51
|
+
}
|
|
52
|
+
export interface XFormsXPathComment extends XFormsXPathNode {
|
|
53
|
+
readonly [XPathNodeKindKey]: XPathCommentKind;
|
|
54
|
+
}
|
|
55
|
+
export type XPathNamedNodeKind = XPathElementKind | XPathAttributeKind;
|
|
56
|
+
export interface XFormsXPathNamedNode extends XFormsXPathNode {
|
|
57
|
+
readonly [XPathNodeKindKey]: XPathNamedNodeKind;
|
|
58
|
+
}
|
|
59
|
+
export type XFormsXPathDescendantNodeKind = XFormsXPathNodeRangeKind | XPathElementKind | XPathTextKind | XPathCommentKind;
|
|
60
|
+
export interface XFormsXPathDescendantNode extends XFormsXPathNode {
|
|
61
|
+
readonly [XPathNodeKindKey]: XFormsXPathDescendantNodeKind;
|
|
62
|
+
}
|
|
63
|
+
export type XFormsXPathPrimaryInstanceNodeKind = XPathDocumentKind | XFormsXPathNodeRangeKind | XPathElementKind | XPathTextKind;
|
|
64
|
+
export interface XFormsXPathPrimaryInstanceNode extends XFormsXPathNode {
|
|
65
|
+
readonly [XPathNodeKindKey]: XFormsXPathPrimaryInstanceNodeKind;
|
|
66
|
+
}
|
|
67
|
+
export type XFormsXPathPrimaryInstanceDescendantNodeKind = XFormsXPathNodeRangeKind | XPathElementKind | XPathTextKind;
|
|
68
|
+
export interface XFormsXPathPrimaryInstanceDescendantNode extends XFormsXPathNode {
|
|
69
|
+
readonly [XPathNodeKindKey]: XFormsXPathPrimaryInstanceDescendantNodeKind;
|
|
70
|
+
}
|
|
71
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { XPathNodeKind } from '@getodk/xpath';
|
|
2
|
+
import { AnyChildNode, AnyNode, AnyParentNode, AnyValueNode } from '../../../instance/hierarchy.ts';
|
|
3
|
+
import { ValueContext } from '../../../instance/internal-api/ValueContext.ts';
|
|
4
|
+
import { PrimaryInstance } from '../../../instance/PrimaryInstance.ts';
|
|
5
|
+
import { ItextTranslationDefinition } from '../../../parse/model/ItextTranslation/ItextTranslationDefinition.ts';
|
|
6
|
+
import { ItextTranslationRootDefinition } from '../../../parse/model/ItextTranslation/ItextTranslationRootDefinition.ts';
|
|
7
|
+
import { SecondaryInstanceDefinition } from '../../../parse/model/SecondaryInstance/SecondaryInstanceDefinition.ts';
|
|
8
|
+
import { SecondaryInstanceRootDefinition } from '../../../parse/model/SecondaryInstance/SecondaryInstanceRootDefinition.ts';
|
|
9
|
+
import { StaticAttribute } from '../static-dom/StaticAttribute.ts';
|
|
10
|
+
import { StaticDocument } from '../static-dom/StaticDocument.ts';
|
|
11
|
+
import { StaticElement } from '../static-dom/StaticElement.ts';
|
|
12
|
+
import { StaticText } from '../static-dom/StaticText.ts';
|
|
13
|
+
import { XFormsXPathComment, XFormsXPathDocument, XFormsXPathElement, XFormsXPathPrimaryInstanceNode } from './XFormsXPathNode.ts';
|
|
14
|
+
export type PrimaryInstanceXPathNode = Extract<AnyNode, XFormsXPathPrimaryInstanceNode>;
|
|
15
|
+
export type PrimaryInstanceXPathElement = Extract<AnyChildNode, XFormsXPathElement>;
|
|
16
|
+
export type PrimaryInstanceXPathComment = Extract<AnyChildNode, XFormsXPathComment>;
|
|
17
|
+
export type PrimaryInstanceXPathChildNode = PrimaryInstanceXPathElement | PrimaryInstanceXPathComment;
|
|
18
|
+
export type PrimaryInstanceXPathValueElement<Value> = AnyValueNode & ValueContext<Value> & XFormsXPathElement;
|
|
19
|
+
export type EngineXPathDocument = PrimaryInstance | ItextTranslationDefinition | SecondaryInstanceDefinition | StaticDocument;
|
|
20
|
+
export type EngineXPathElement = PrimaryInstanceXPathElement | ItextTranslationRootDefinition | SecondaryInstanceRootDefinition | StaticElement;
|
|
21
|
+
export type EngineXPathComment = PrimaryInstanceXPathComment;
|
|
22
|
+
export type EngineXPathAttribute = StaticAttribute;
|
|
23
|
+
export type EngineXPathText = StaticText;
|
|
24
|
+
export type XFormsXPathChildNode = EngineXPathElement | EngineXPathText | EngineXPathComment;
|
|
25
|
+
type XPathAdapterParentNode = XFormsXPathDocument | XFormsXPathElement;
|
|
26
|
+
type PrimaryInstanceXPathParentNode = Extract<AnyParentNode, XPathAdapterParentNode>;
|
|
27
|
+
export type EngineXPathParentNode = PrimaryInstanceXPathParentNode | ItextTranslationDefinition | SecondaryInstanceDefinition | ItextTranslationRootDefinition | SecondaryInstanceRootDefinition | StaticDocument | StaticElement;
|
|
28
|
+
export type EngineXPathNode = EngineXPathDocument | EngineXPathElement | EngineXPathAttribute | EngineXPathText | EngineXPathComment;
|
|
29
|
+
export declare const isEngineXPathNode: (value: unknown) => value is EngineXPathNode;
|
|
30
|
+
export declare const getEngineXPathNodeKind: (node: EngineXPathNode) => XPathNodeKind;
|
|
31
|
+
export declare const isEngineXPathElement: (node: EngineXPathNode) => node is EngineXPathElement;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EngineXPathNode } from './kind.ts';
|
|
2
|
+
export declare const getEngineXPathNodeNamespaceURI: (node: EngineXPathNode) => string | null;
|
|
3
|
+
/**
|
|
4
|
+
* @todo currently, neither {@link InstanceNode} nor {@link StaticNode} account
|
|
5
|
+
* for prefixes in qualified names. This was already a general enough gap that
|
|
6
|
+
* it makes sense to defer to a broader solution as it becomes a priority
|
|
7
|
+
* (likely prompted by a bug report about unexpected behavior of the XPath
|
|
8
|
+
* `name` function).
|
|
9
|
+
*/
|
|
10
|
+
export declare const getEngineXPathNodeQualifiedName: (node: EngineXPathNode) => string;
|
|
11
|
+
export declare const getEngineXPathNodeLocalName: (node: EngineXPathNode) => string;
|
|
12
|
+
export declare const getEngineProcessingInstructionName: () => never;
|
|
13
|
+
/**
|
|
14
|
+
* @todo @see {@link getNamespaceDeclarations}
|
|
15
|
+
*/
|
|
16
|
+
export declare const resolveEngineXPathNodeNamespaceURI: (_: EngineXPathNode, prefix: string | null) => "http://www.w3.org/1999/xhtml" | "http://www.w3.org/2005/xpath-functions" | "http://openrosa.org/javarosa" | "http://www.opendatakit.org/xforms" | "http://openrosa.org/xforms" | "http://www.w3.org/2002/xforms" | "http://enketo.org/xforms" | null;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { EngineXPathAttribute, EngineXPathDocument, EngineXPathElement, EngineXPathNode, EngineXPathParentNode, XFormsXPathChildNode } from './kind.ts';
|
|
2
|
+
export declare const getContainingEngineXPathDocument: (node: EngineXPathNode) => EngineXPathDocument;
|
|
3
|
+
export declare const getEngineXPathAttributes: (node: EngineXPathNode) => Iterable<EngineXPathAttribute>;
|
|
4
|
+
/**
|
|
5
|
+
* @todo XML XForms may actually define explicit namespace declarations on
|
|
6
|
+
* non-root elements (i.e. elements other than the form definition's `h:html`,
|
|
7
|
+
* itext `translation`, secondary `instance`). Expressions defined in such forms
|
|
8
|
+
* may also expect to use those namespace declarations. It would even seem
|
|
9
|
+
* likely! Why declare namespaces on a subtree if you don't intend to use them?
|
|
10
|
+
* We don't currently capture namespace declarations below `h:html` in the parse
|
|
11
|
+
* stage (which, if we intend to support the use case, is where we should
|
|
12
|
+
* start).
|
|
13
|
+
*
|
|
14
|
+
* @todo At the very least, we should probably produce a set of default namespace declarations. At least for `h:html`, maybe for other "root" nodes.
|
|
15
|
+
*/
|
|
16
|
+
export declare const getNamespaceDeclarations: () => Iterable<never>;
|
|
17
|
+
export declare const getParentNode: (node: EngineXPathNode) => EngineXPathParentNode | null;
|
|
18
|
+
export declare const getChildNodes: (node: EngineXPathNode) => readonly XFormsXPathChildNode[];
|
|
19
|
+
export declare const getChildElements: (node: EngineXPathNode) => readonly EngineXPathElement[];
|
|
20
|
+
export declare const getPreviousSiblingNode: (node: EngineXPathNode) => XFormsXPathChildNode | null;
|
|
21
|
+
export declare const getPreviousSiblingElement: (node: EngineXPathNode) => EngineXPathElement | null;
|
|
22
|
+
export declare const getNextSiblingNode: (node: EngineXPathNode) => XFormsXPathChildNode | null;
|
|
23
|
+
export declare const getNextSiblingElement: (node: EngineXPathNode) => EngineXPathElement | null;
|
|
24
|
+
export declare const isDescendantNode: (ancestor: EngineXPathNode, other: EngineXPathNode) => boolean;
|
|
25
|
+
export declare const compareDocumentOrder: () => never;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { XPathNodeKindKey } from '@getodk/xpath';
|
|
2
|
+
import { XFormsXPathAttribute } from '../adapter/XFormsXPathNode.ts';
|
|
3
|
+
import { StaticElement } from './StaticElement.ts';
|
|
4
|
+
import { StaticNamedNodeOptions, StaticNamedNode } from './StaticNamedNode.ts';
|
|
5
|
+
interface StaticAttributeOptions extends StaticNamedNodeOptions {
|
|
6
|
+
readonly value: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class StaticAttribute extends StaticNamedNode<'attribute'> implements XFormsXPathAttribute {
|
|
9
|
+
readonly parent: StaticElement;
|
|
10
|
+
readonly [XPathNodeKindKey] = "attribute";
|
|
11
|
+
readonly nodeType = "static-attribute";
|
|
12
|
+
readonly root: StaticElement;
|
|
13
|
+
readonly attributes: readonly [];
|
|
14
|
+
readonly children: null;
|
|
15
|
+
readonly value: string;
|
|
16
|
+
constructor(parent: StaticElement, options: StaticAttributeOptions);
|
|
17
|
+
getXPathValue(): string;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { XPathNodeKindKey } from '@getodk/xpath';
|
|
2
|
+
import { XFormsXPathDocument } from '../adapter/XFormsXPathNode.ts';
|
|
3
|
+
import { StaticElement } from './StaticElement.ts';
|
|
4
|
+
import { StaticNode } from './StaticNode.ts';
|
|
5
|
+
export type StaticDocumentRootFactory<T extends StaticDocument, Root extends StaticElement> = (staticDocument: T) => Root;
|
|
6
|
+
export declare abstract class StaticDocument<DocumentRoot extends StaticElement = StaticElement> extends StaticNode<'document'> implements XFormsXPathDocument {
|
|
7
|
+
readonly [XPathNodeKindKey] = "document";
|
|
8
|
+
readonly nodeType = "static-document";
|
|
9
|
+
readonly rootDocument: StaticDocument;
|
|
10
|
+
readonly root: DocumentRoot;
|
|
11
|
+
readonly isXFormsNamespace: boolean;
|
|
12
|
+
readonly parent: null;
|
|
13
|
+
readonly children: readonly [root: DocumentRoot];
|
|
14
|
+
constructor(rootFactory: StaticDocumentRootFactory<StaticDocument<DocumentRoot>, DocumentRoot>);
|
|
15
|
+
getXPathValue(): string;
|
|
16
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { XFORMS_KNOWN_ATTRIBUTE, XFORMS_LOCAL_NAME, XPathNodeKindKey } from '@getodk/xpath';
|
|
2
|
+
import { XFormsXPathElement } from '../adapter/XFormsXPathNode.ts';
|
|
3
|
+
import { StaticAttribute } from './StaticAttribute.ts';
|
|
4
|
+
import { StaticNamedNodeOptions, StaticNamedNode } from './StaticNamedNode.ts';
|
|
5
|
+
import { StaticChildNode, StaticParentNode } from './StaticNode.ts';
|
|
6
|
+
export type StaticElementAttributesFactory = (element: StaticElement) => readonly StaticAttribute[];
|
|
7
|
+
export type StaticElementChildNodesFactory = (element: StaticElement) => readonly StaticChildNode[];
|
|
8
|
+
export interface StaticElementOptions extends StaticNamedNodeOptions {
|
|
9
|
+
}
|
|
10
|
+
type StaticElementKnownAttributeValue<T extends StaticElement, LocalName extends string> = T extends {
|
|
11
|
+
readonly [XFORMS_KNOWN_ATTRIBUTE]: LocalName;
|
|
12
|
+
} ? string : string | null;
|
|
13
|
+
export declare class StaticElement<Parent extends StaticParentNode = StaticParentNode> extends StaticNamedNode<'element'> implements XFormsXPathElement {
|
|
14
|
+
readonly [XFORMS_LOCAL_NAME]?: string;
|
|
15
|
+
readonly [XFORMS_KNOWN_ATTRIBUTE]?: string;
|
|
16
|
+
readonly [XPathNodeKindKey] = "element";
|
|
17
|
+
readonly nodeType = "static-element";
|
|
18
|
+
readonly root: StaticElement;
|
|
19
|
+
readonly attributes: readonly StaticAttribute[];
|
|
20
|
+
readonly children: readonly StaticChildNode[];
|
|
21
|
+
constructor(parent: Parent, attributesFactory: StaticElementAttributesFactory, childNodesFactory: StaticElementChildNodesFactory, options: StaticElementOptions);
|
|
22
|
+
/**
|
|
23
|
+
* @todo Generalize this, incorporate into {@link EngineDOMAdapter}
|
|
24
|
+
* @todo Namespaced lookup
|
|
25
|
+
* @todo Optimize: lookup from map and/or caching
|
|
26
|
+
*/
|
|
27
|
+
protected getAttributeNode(localName: string): StaticAttribute | null;
|
|
28
|
+
/**
|
|
29
|
+
* @todo Generalize this, incorporate into {@link EngineDOMAdapter}
|
|
30
|
+
* @todo Namespaced lookup
|
|
31
|
+
* @todo Optimize: lookup from map and/or caching (especially asserting known
|
|
32
|
+
* attributes!)
|
|
33
|
+
* @todo As long as this depends on {@link getAttributeNode}, push assertion
|
|
34
|
+
* up. (This was put off because the types are already plenty complex as it
|
|
35
|
+
* is.)
|
|
36
|
+
*/
|
|
37
|
+
getAttributeValue<This extends StaticElement, LocalName extends string>(this: This, localName: LocalName): StaticElementKnownAttributeValue<This, LocalName>;
|
|
38
|
+
getXPathValue(): string;
|
|
39
|
+
}
|
|
40
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { XFormsXPathNamedNode, XPathNamedNodeKind } from '../adapter/XFormsXPathNode.ts';
|
|
2
|
+
import { StaticDocument } from './StaticDocument.ts';
|
|
3
|
+
import { StaticParentNode, StaticNode } from './StaticNode.ts';
|
|
4
|
+
export interface StaticNamedNodeOptions {
|
|
5
|
+
readonly namespaceURI: string | null;
|
|
6
|
+
readonly localName: string;
|
|
7
|
+
readonly value?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare abstract class StaticNamedNode<Kind extends XPathNamedNodeKind> extends StaticNode<Kind> implements XFormsXPathNamedNode {
|
|
10
|
+
readonly parent: StaticParentNode;
|
|
11
|
+
readonly rootDocument: StaticDocument;
|
|
12
|
+
readonly isXFormsNamespace: boolean;
|
|
13
|
+
readonly namespaceURI: string | null;
|
|
14
|
+
readonly localName: string;
|
|
15
|
+
readonly value: string | null;
|
|
16
|
+
protected constructor(parent: StaticParentNode, options: StaticNamedNodeOptions);
|
|
17
|
+
}
|