@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
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { XPathNodeKindKey } from '@getodk/xpath';
|
|
2
|
+
import { XFormsXPathNode } from '../adapter/XFormsXPathNode.ts';
|
|
3
|
+
import { StaticAttribute } from './StaticAttribute.ts';
|
|
4
|
+
import { StaticDocument } from './StaticDocument.ts';
|
|
5
|
+
import { StaticElement } from './StaticElement.ts';
|
|
6
|
+
import { StaticText } from './StaticText.ts';
|
|
7
|
+
export type StaticNodeKind = 'document' | 'element' | 'attribute' | 'text';
|
|
8
|
+
export type StaticNodeType<Kind extends StaticNodeKind> = `static-${Kind}`;
|
|
9
|
+
export declare abstract class StaticNode<Kind extends StaticNodeKind> implements XFormsXPathNode {
|
|
10
|
+
abstract readonly [XPathNodeKindKey]: Kind;
|
|
11
|
+
abstract readonly nodeType: StaticNodeType<Kind>;
|
|
12
|
+
/**
|
|
13
|
+
* A concrete {@link StaticDocument} instance, representing the topmost node
|
|
14
|
+
* of a static document tree, containing all of:
|
|
15
|
+
*
|
|
16
|
+
* - {@link root}
|
|
17
|
+
* - {@link children}
|
|
18
|
+
* - any {@link StaticChildNode} descendants of either of the above
|
|
19
|
+
*/
|
|
20
|
+
abstract readonly rootDocument: StaticDocument;
|
|
21
|
+
/**
|
|
22
|
+
* A concrete {@link StaticElement} instance, representing the single,
|
|
23
|
+
* immediate child of {@link rootDocument}, containing all other descendants
|
|
24
|
+
* of its document tree.
|
|
25
|
+
*/
|
|
26
|
+
abstract readonly root: StaticElement;
|
|
27
|
+
abstract readonly children: readonly StaticChildNode[] | null;
|
|
28
|
+
getXPathChildNodes(): readonly StaticChildNode[];
|
|
29
|
+
abstract getXPathValue(): string;
|
|
30
|
+
}
|
|
31
|
+
export type AnyStaticNode = StaticDocument | StaticElement | StaticAttribute | StaticText;
|
|
32
|
+
export type StaticParentNode = StaticDocument | StaticElement;
|
|
33
|
+
export type StaticChildNode = StaticElement | StaticText;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { XPathNodeKindKey } from '@getodk/xpath';
|
|
2
|
+
import { XFormsXPathText } from '../adapter/XFormsXPathNode.ts';
|
|
3
|
+
import { StaticDocument } from './StaticDocument.ts';
|
|
4
|
+
import { StaticElement } from './StaticElement.ts';
|
|
5
|
+
import { StaticNode } from './StaticNode.ts';
|
|
6
|
+
export declare class StaticText extends StaticNode<'text'> implements XFormsXPathText {
|
|
7
|
+
readonly parent: StaticElement;
|
|
8
|
+
readonly value: string;
|
|
9
|
+
readonly [XPathNodeKindKey] = "text";
|
|
10
|
+
readonly nodeType = "static-text";
|
|
11
|
+
readonly rootDocument: StaticDocument;
|
|
12
|
+
readonly root: StaticElement;
|
|
13
|
+
readonly children: null;
|
|
14
|
+
constructor(parent: StaticElement, value: string);
|
|
15
|
+
getXPathValue(): string;
|
|
16
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { PartiallyKnownString } from '../../../common/types/string/PartiallyKnownString.ts';
|
|
2
|
-
|
|
3
2
|
type SymbolIterator = typeof Symbol.iterator;
|
|
4
3
|
type TokenListKey<CanonicalToken extends string> = PartiallyKnownString<CanonicalToken> | SymbolIterator;
|
|
5
4
|
type TokenListIterator<CanonicalToken extends string> = IterableIterator<PartiallyKnownString<CanonicalToken>>;
|
|
5
|
+
type PassthroughTokenList = Readonly<Record<string, boolean>>;
|
|
6
6
|
/**
|
|
7
7
|
* @see {@link TokenListParser}
|
|
8
8
|
*/
|
|
9
|
-
export type TokenList<CanonicalToken extends string = string> = {
|
|
9
|
+
export type TokenList<CanonicalToken extends string = string> = PassthroughTokenList & {
|
|
10
10
|
readonly [Key in TokenListKey<CanonicalToken>]: Key extends SymbolIterator ? () => TokenListIterator<CanonicalToken> : boolean;
|
|
11
11
|
};
|
|
12
12
|
interface TokenListAlias<CanonicalToken extends string> {
|
|
@@ -77,7 +77,7 @@ type TokenListAttributeName = PartiallyKnownString<'appearance' | 'class'>;
|
|
|
77
77
|
export declare class TokenListParser<CanonicalToken extends string, TokenAlias extends CanonicalToken = CanonicalToken> {
|
|
78
78
|
readonly canonicalTokens: readonly CanonicalToken[];
|
|
79
79
|
private readonly aliases;
|
|
80
|
-
constructor(canonicalTokens
|
|
80
|
+
constructor(canonicalTokens?: readonly CanonicalToken[], options?: TokenListParserOptions<TokenAlias>);
|
|
81
81
|
parseFrom(element: Element, attributeName: TokenListAttributeName): TokenList<CanonicalToken>;
|
|
82
82
|
}
|
|
83
83
|
export type ParsedTokenList<Parser extends TokenListParser<any>> = Parser extends TokenListParser<infer CanonicalToken> ? TokenList<CanonicalToken> : never;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { SubmissionState } from '../../../client/submission/SubmissionState.ts';
|
|
2
|
+
import { ClientReactiveSubmittableInstance } from '../../../instance/internal-api/submission/ClientReactiveSubmittableInstance.ts';
|
|
3
|
+
export declare const createInstanceSubmissionState: (node: ClientReactiveSubmittableInstance) => SubmissionState;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { SubmissionState } from '../../../client/submission/SubmissionState.ts';
|
|
2
|
+
import { ClientReactiveSubmittableLeafNode } from '../../../instance/internal-api/submission/ClientReactiveSubmittableLeafNode.ts';
|
|
3
|
+
export declare const createLeafNodeSubmissionState: <Value>(node: ClientReactiveSubmittableLeafNode<Value>) => SubmissionState;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SubmissionState } from '../../../client/submission/SubmissionState.ts';
|
|
2
|
+
import { ClientReactiveSubmittableParentNode } from '../../../instance/internal-api/submission/ClientReactiveSubmittableParentNode.ts';
|
|
3
|
+
import { RepeatInstance } from '../../../instance/repeat/RepeatInstance.ts';
|
|
4
|
+
export declare const createNodeRangeSubmissionState: (node: ClientReactiveSubmittableParentNode<RepeatInstance>) => SubmissionState;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SubmissionState } from '../../../client/submission/SubmissionState.ts';
|
|
2
|
+
import { GeneralChildNode } from '../../../instance/hierarchy.ts';
|
|
3
|
+
import { ClientReactiveSubmittableParentNode } from '../../../instance/internal-api/submission/ClientReactiveSubmittableParentNode.ts';
|
|
4
|
+
export declare const createParentNodeSubmissionState: (node: ClientReactiveSubmittableParentNode<GeneralChildNode>) => SubmissionState;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { SubmissionState } from '../../../client/submission/SubmissionState.ts';
|
|
2
|
+
import { ClientReactiveSubmittableValueNode } from '../../../instance/internal-api/submission/ClientReactiveSubmittableValueNode.ts';
|
|
3
|
+
export declare const createValueNodeSubmissionState: (node: ClientReactiveSubmittableValueNode) => SubmissionState;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SubmissionChunkedType } from '../../../client/submission/SubmissionOptions.ts';
|
|
2
|
+
import { SubmissionResult } from '../../../client/submission/SubmissionResult.ts';
|
|
3
|
+
import { ClientReactiveSubmittableInstance } from '../../../instance/internal-api/submission/ClientReactiveSubmittableInstance.ts';
|
|
4
|
+
export interface PrepeareSubmissionOptions<ChunkedType extends SubmissionChunkedType> {
|
|
5
|
+
readonly chunked: ChunkedType;
|
|
6
|
+
readonly maxSize: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const prepareSubmission: <ChunkedType extends SubmissionChunkedType>(instanceRoot: ClientReactiveSubmittableInstance, options: PrepeareSubmissionOptions<ChunkedType>) => SubmissionResult<ChunkedType>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ValueCodec } from './ValueCodec.ts';
|
|
2
|
+
export type DecimalInputValue = bigint | number | string | null;
|
|
3
|
+
export type DecimalRuntimeValue = number | null;
|
|
4
|
+
export declare class DecimalValueCodec extends ValueCodec<'decimal', DecimalRuntimeValue, DecimalInputValue> {
|
|
5
|
+
constructor();
|
|
6
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ValueCodec } from './ValueCodec.ts';
|
|
2
|
+
export type IntInputValue = bigint | number | string | null;
|
|
3
|
+
export type IntRuntimeValue = bigint | null;
|
|
4
|
+
export declare class IntValueCodec extends ValueCodec<'int', IntRuntimeValue, IntInputValue> {
|
|
5
|
+
constructor();
|
|
6
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Accessor } from 'solid-js';
|
|
2
|
+
import { ValueType } from '../../client/ValueType.ts';
|
|
3
|
+
import { DecodeInstanceValue } from '../../instance/internal-api/InstanceValueContext.ts';
|
|
4
|
+
import { SimpleAtomicState } from '../reactivity/types.ts';
|
|
5
|
+
type CodecEncoder<RuntimeInputValue> = (input: RuntimeInputValue) => string;
|
|
6
|
+
type CodecDecoder<RuntimeValue> = (value: string) => RuntimeValue;
|
|
7
|
+
type RuntimeValueAccessor<RuntimeValue> = Accessor<RuntimeValue>;
|
|
8
|
+
export type RuntimeValueSetter<RuntimeValue extends RuntimeInputValue, RuntimeInputValue = RuntimeValue> = (input: RuntimeInputValue) => RuntimeValue;
|
|
9
|
+
export type RuntimeValueState<RuntimeValue extends RuntimeInputValue, RuntimeInputValue = RuntimeValue> = readonly [
|
|
10
|
+
get: RuntimeValueAccessor<RuntimeValue>,
|
|
11
|
+
set: RuntimeValueSetter<RuntimeValue, RuntimeInputValue>
|
|
12
|
+
];
|
|
13
|
+
export type CreateRuntimeValueState<RuntimeValue extends RuntimeInputValue, RuntimeInputValue = RuntimeValue> = (instanceState: SimpleAtomicState<string>) => RuntimeValueState<RuntimeValue, RuntimeInputValue>;
|
|
14
|
+
type RuntimeValueStateFactory<RuntimeValue extends RuntimeInputValue, RuntimeInputValue = RuntimeValue> = (encodeValue: CodecEncoder<RuntimeInputValue>, decodeValue: CodecDecoder<RuntimeValue>) => CreateRuntimeValueState<RuntimeValue, RuntimeInputValue>;
|
|
15
|
+
type DecodeInstanceValueFactory<RuntimeValue extends RuntimeInputValue, RuntimeInputValue = RuntimeValue> = (encodeValue: CodecEncoder<RuntimeInputValue>, decodeValue: CodecDecoder<RuntimeValue>) => DecodeInstanceValue;
|
|
16
|
+
interface ValueCodecOptions<RuntimeValue extends RuntimeInputValue, RuntimeInputValue> {
|
|
17
|
+
readonly decodeInstanceValueFactory?: DecodeInstanceValueFactory<RuntimeValue, RuntimeInputValue>;
|
|
18
|
+
readonly runtimeValueStateFactory?: RuntimeValueStateFactory<RuntimeValue, RuntimeInputValue>;
|
|
19
|
+
}
|
|
20
|
+
export declare abstract class ValueCodec<V extends ValueType, RuntimeValue extends RuntimeInputValue, RuntimeInputValue = RuntimeValue> {
|
|
21
|
+
readonly valueType: V;
|
|
22
|
+
readonly encodeValue: CodecEncoder<RuntimeInputValue>;
|
|
23
|
+
readonly decodeValue: CodecDecoder<RuntimeValue>;
|
|
24
|
+
protected readonly defaultRuntimeValueStateFactory: RuntimeValueStateFactory<RuntimeValue, RuntimeInputValue>;
|
|
25
|
+
protected readonly defaultDecodeInstanceValueFactory: DecodeInstanceValueFactory<RuntimeValue, RuntimeInputValue>;
|
|
26
|
+
readonly decodeInstanceValue: DecodeInstanceValue;
|
|
27
|
+
readonly createRuntimeValueState: CreateRuntimeValueState<RuntimeValue, RuntimeInputValue>;
|
|
28
|
+
constructor(valueType: V, encodeValue: CodecEncoder<RuntimeInputValue>, decodeValue: CodecDecoder<RuntimeValue>, options?: ValueCodecOptions<RuntimeValue, RuntimeInputValue>);
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ValueType } from '../../client/ValueType.ts';
|
|
2
|
+
import { ValueCodec } from './ValueCodec.ts';
|
|
3
|
+
/**
|
|
4
|
+
* Provides fallback functionality where a {@link ValueCodec} is expected, for
|
|
5
|
+
* those {@link ValueType | value types} which are still pending implementation.
|
|
6
|
+
* This allows consistent use of the {@link ValueCodec} interface while
|
|
7
|
+
* maintaining the current behavior of treating those unimplemented value types
|
|
8
|
+
* as string values.
|
|
9
|
+
*/
|
|
10
|
+
export declare class ValueTypePlaceholderCodec<V extends ValueType> extends ValueCodec<V, string, string> {
|
|
11
|
+
constructor(valueType: V);
|
|
12
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ValueType } from '../../client/ValueType.ts';
|
|
2
|
+
import { DecimalInputValue, DecimalRuntimeValue } from './DecimalValueCodec.ts';
|
|
3
|
+
import { IntInputValue, IntRuntimeValue } from './IntValueCodec.ts';
|
|
4
|
+
import { ValueCodec } from './ValueCodec.ts';
|
|
5
|
+
interface RuntimeValuesByType {
|
|
6
|
+
readonly string: string;
|
|
7
|
+
readonly int: IntRuntimeValue;
|
|
8
|
+
readonly decimal: DecimalRuntimeValue;
|
|
9
|
+
readonly boolean: string;
|
|
10
|
+
readonly date: string;
|
|
11
|
+
readonly time: string;
|
|
12
|
+
readonly dateTime: string;
|
|
13
|
+
readonly geopoint: string;
|
|
14
|
+
readonly geotrace: string;
|
|
15
|
+
readonly geoshape: string;
|
|
16
|
+
readonly binary: string;
|
|
17
|
+
readonly barcode: string;
|
|
18
|
+
readonly intent: string;
|
|
19
|
+
}
|
|
20
|
+
export type RuntimeValue<V extends ValueType> = RuntimeValuesByType[V];
|
|
21
|
+
interface RuntimeInputValuesByType {
|
|
22
|
+
readonly string: string;
|
|
23
|
+
readonly int: IntInputValue;
|
|
24
|
+
readonly decimal: DecimalInputValue;
|
|
25
|
+
readonly boolean: string;
|
|
26
|
+
readonly date: string;
|
|
27
|
+
readonly time: string;
|
|
28
|
+
readonly dateTime: string;
|
|
29
|
+
readonly geopoint: string;
|
|
30
|
+
readonly geotrace: string;
|
|
31
|
+
readonly geoshape: string;
|
|
32
|
+
readonly binary: string;
|
|
33
|
+
readonly barcode: string;
|
|
34
|
+
readonly intent: string;
|
|
35
|
+
}
|
|
36
|
+
export type RuntimeInputValue<V extends ValueType> = RuntimeInputValuesByType[V];
|
|
37
|
+
type SharedValueCodecs = {
|
|
38
|
+
readonly [V in ValueType]: ValueCodec<V, RuntimeValue<V>, RuntimeInputValue<V>>;
|
|
39
|
+
};
|
|
40
|
+
export type SharedValueCodec<V extends ValueType> = SharedValueCodecs[V];
|
|
41
|
+
/**
|
|
42
|
+
* Provides codecs for each {@link ValueType | value type}, for nodes with a
|
|
43
|
+
* common representation of those value types.
|
|
44
|
+
*/
|
|
45
|
+
export declare const sharedValueCodecs: SharedValueCodecs;
|
|
46
|
+
export declare const getSharedValueCodec: <V extends ValueType>(valueType: V) => SharedValueCodec<V>;
|
|
47
|
+
export {};
|
package/dist/lib/dom/query.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { KnownAttributeLocalNamedElement, LocalNamedElement } from '../../../../common/types/dom.ts';
|
|
2
|
-
import { SelectElement } from '../../body/control/select/SelectDefinition';
|
|
3
|
-
|
|
2
|
+
import { SelectElement } from '../../parse/body/control/select/SelectDefinition';
|
|
4
3
|
export interface HintElement extends LocalNamedElement<'hint'> {
|
|
5
4
|
}
|
|
6
5
|
export interface ItemElement extends LocalNamedElement<'item'> {
|
|
@@ -24,3 +23,6 @@ export declare const getLabelElement: (parent: Element) => LabelElement | null;
|
|
|
24
23
|
export declare const getRepeatGroupLabelElement: (parent: Element) => RepeatGroupLabelElement | null;
|
|
25
24
|
export declare const getRepeatElement: (parent: Element) => RepeatElement | null;
|
|
26
25
|
export declare const getValueElement: (parent: ItemElement | ItemsetElement) => ValueElement | null;
|
|
26
|
+
export interface SubmissionElement extends LocalNamedElement<'submission'> {
|
|
27
|
+
}
|
|
28
|
+
export declare const getSubmissionElement: (parent: Element) => SubmissionElement | null;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { Accessor, Setter, Signal } from 'solid-js';
|
|
2
|
+
import { FormNodeID } from '../../client/identity.ts';
|
|
2
3
|
import { AnyChildNode, AnyParentNode } from '../../instance/hierarchy.ts';
|
|
3
|
-
import { NodeID } from '../../instance/identity.ts';
|
|
4
|
-
|
|
5
4
|
export interface ChildrenState<Child extends AnyChildNode> {
|
|
6
5
|
readonly children: Signal<readonly Child[]>;
|
|
7
6
|
readonly getChildren: Accessor<readonly Child[]>;
|
|
8
7
|
readonly setChildren: Setter<readonly Child[]>;
|
|
9
|
-
readonly childIds: Accessor<readonly
|
|
8
|
+
readonly childIds: Accessor<readonly FormNodeID[]>;
|
|
10
9
|
}
|
|
11
10
|
/**
|
|
12
11
|
* Creates a synchronized pair of:
|
|
13
12
|
*
|
|
14
13
|
* - Internal children state suitable for all parent node types
|
|
15
|
-
* - The same children state computed as an array of each child's
|
|
14
|
+
* - The same children state computed as an array of each child's
|
|
15
|
+
* {@link FormNodeID}
|
|
16
16
|
*
|
|
17
17
|
* This state is used, in tandem with {@link materializeCurrentStateChildren},
|
|
18
18
|
* to ensure children in **client-facing** state are not written into nested
|
|
@@ -27,11 +27,12 @@ export interface ChildrenState<Child extends AnyChildNode> {
|
|
|
27
27
|
* The produced {@link ChildrenState.childIds} memo is intended to be used to
|
|
28
28
|
* specify each parent node's `children` in an instance of {@link EngineState}.
|
|
29
29
|
* In so doing, the node's corresponding (internal, synchronized)
|
|
30
|
-
* {@link ClientState} will likewise store only the children's
|
|
30
|
+
* {@link ClientState} will likewise store only the children's
|
|
31
|
+
* {@link FormNodeID}s.
|
|
31
32
|
*
|
|
32
33
|
* As a client reacts to changes in a given parent node's `children` state, that
|
|
33
34
|
* node's {@link CurrentState} should produce the child nodes corresponding to
|
|
34
|
-
* those {@link
|
|
35
|
+
* those {@link FormNodeID}s with the aforementioned
|
|
35
36
|
* {@link materializeCurrentStateChildren}.
|
|
36
37
|
*/
|
|
37
38
|
export declare const createChildrenState: <Parent extends AnyParentNode, Child extends AnyChildNode>(parent: Parent) => ChildrenState<Child>;
|
|
@@ -1,18 +1,30 @@
|
|
|
1
1
|
import { Accessor } from 'solid-js';
|
|
2
|
-
import { DependentExpression, DependentExpressionResultType } from '../../expression/DependentExpression.ts';
|
|
3
2
|
import { EvaluationContext } from '../../instance/internal-api/EvaluationContext.ts';
|
|
4
|
-
import {
|
|
5
|
-
|
|
3
|
+
import { EngineXPathNode } from '../../integration/xpath/adapter/kind.ts';
|
|
4
|
+
import { DependentExpression, DependentExpressionResultType } from '../../parse/expression/abstract/DependentExpression.ts';
|
|
6
5
|
interface ComputedExpressionResults {
|
|
7
6
|
readonly boolean: boolean;
|
|
8
|
-
readonly nodes:
|
|
7
|
+
readonly nodes: EngineXPathNode[];
|
|
9
8
|
readonly number: number;
|
|
10
9
|
readonly string: string;
|
|
11
10
|
}
|
|
12
11
|
type EvaluatedExpression<Type extends DependentExpressionResultType> = ComputedExpressionResults[Type];
|
|
13
12
|
type ComputedExpression<Type extends DependentExpressionResultType> = Accessor<EvaluatedExpression<Type>>;
|
|
14
|
-
interface CreateComputedExpressionOptions {
|
|
15
|
-
|
|
13
|
+
interface CreateComputedExpressionOptions<Type extends DependentExpressionResultType> {
|
|
14
|
+
/**
|
|
15
|
+
* If a default value is provided, {@link createComputedExpression} will
|
|
16
|
+
* produce this value for computations in a non-attached evaluation context,
|
|
17
|
+
* i.e. when evaluating an expression against a node which has not yet been
|
|
18
|
+
* appended to its parents children state (or which has since been removed
|
|
19
|
+
* from that state). A non-attached state is detected when
|
|
20
|
+
* {@link EvaluationContext.isAttached} returns false.
|
|
21
|
+
*
|
|
22
|
+
* If no default value is provided, an implicit default value is produced as
|
|
23
|
+
* appropriate for the expression's intrinsic result type.
|
|
24
|
+
*
|
|
25
|
+
* @see {@link defaultEvaluationsByType} for these implicit defaults.
|
|
26
|
+
*/
|
|
27
|
+
readonly defaultValue?: EvaluatedExpression<Type>;
|
|
16
28
|
}
|
|
17
|
-
export declare const createComputedExpression: <Type extends DependentExpressionResultType>(context: EvaluationContext, dependentExpression: DependentExpression<Type>, options?: CreateComputedExpressionOptions) => ComputedExpression<Type>;
|
|
29
|
+
export declare const createComputedExpression: <Type extends DependentExpressionResultType>(context: EvaluationContext, dependentExpression: DependentExpression<Type>, options?: CreateComputedExpressionOptions<Type>) => ComputedExpression<Type>;
|
|
18
30
|
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { InstanceValueContext } from '../../instance/internal-api/InstanceValueContext.ts';
|
|
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
|
+
export type InstanceValueState = SimpleAtomicState<string>;
|
|
28
|
+
/**
|
|
29
|
+
* Provides a consistent interface for value nodes of any type which:
|
|
30
|
+
*
|
|
31
|
+
* - derives initial state from either an existing instance (e.g. for edits) or
|
|
32
|
+
* the node's definition (e.g. initializing a new submission)
|
|
33
|
+
* - decodes current primary instance state into the value node's runtime type
|
|
34
|
+
* - encodes updated runtime values to store updated instance state
|
|
35
|
+
* - initializes reactive computation of `calculate` bind expressions for those
|
|
36
|
+
* nodes defined with one
|
|
37
|
+
* - prevents downstream writes to nodes in a readonly state
|
|
38
|
+
*/
|
|
39
|
+
export declare const createInstanceValueState: (context: InstanceValueContext, options?: InstanceValueStateOptions) => InstanceValueState;
|
|
40
|
+
export {};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Accessor } from 'solid-js';
|
|
2
2
|
import { EvaluationContext } from '../../instance/internal-api/EvaluationContext.ts';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export declare const createNoteReadonlyThunk: (context: EvaluationContext, readonlyDefinition: BindComputation<"readonly">) => Accessor<true>;
|
|
3
|
+
import { NoteNodeDefinition } from '../../parse/model/NoteNodeDefinition.ts';
|
|
4
|
+
export declare const createNoteReadonlyThunk: (context: EvaluationContext, definition: NoteNodeDefinition) => Accessor<true>;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Accessor } from 'solid-js';
|
|
2
2
|
import { SelectItem } from '../../index.ts';
|
|
3
3
|
import { SelectField } from '../../instance/SelectField.ts';
|
|
4
|
-
|
|
5
4
|
/**
|
|
6
5
|
* Creates a reactive computation of a {@link SelectField}'s
|
|
7
6
|
* {@link SelectItem}s, in support of the field's `valueOptions`.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Accessor } from 'solid-js';
|
|
2
|
+
import { ActiveLanguage, FormLanguage, FormLanguages } from '../../client/FormLanguage.ts';
|
|
3
|
+
import { EngineXPathEvaluator } from '../../integration/xpath/EngineXPathEvaluator.ts';
|
|
4
|
+
import { ReactiveScope } from './scope.ts';
|
|
5
|
+
import { SimpleAtomicStateSetter } from './types.ts';
|
|
6
|
+
interface TranslationState {
|
|
7
|
+
readonly languages: FormLanguages;
|
|
8
|
+
readonly getActiveLanguage: Accessor<ActiveLanguage>;
|
|
9
|
+
readonly setActiveLanguage: SimpleAtomicStateSetter<FormLanguage>;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* @todo It's been very silly all along that {@link XFormsXPathEvaluator} is
|
|
13
|
+
* responsible for parsing translation languages, and maintaining the active
|
|
14
|
+
* language state. It is especially silly now that we've moved _part of the
|
|
15
|
+
* parsing_ up to the constructor call site. Let's finish off that awkwardness
|
|
16
|
+
* in a subsequent refactor.
|
|
17
|
+
*/
|
|
18
|
+
export declare const createTranslationState: (scope: ReactiveScope, evaluator: EngineXPathEvaluator) => TranslationState;
|
|
19
|
+
export {};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ValueContext } from '../../instance/internal-api/ValueContext.ts';
|
|
2
2
|
import { SimpleAtomicState } from './types.ts';
|
|
3
|
-
|
|
4
3
|
type InitialValueSource = 'FORM_DEFAULT' | 'PRIMARY_INSTANCE';
|
|
5
4
|
export interface ValueStateOptions {
|
|
6
5
|
/**
|
|
@@ -13,8 +12,7 @@ export interface ValueStateOptions {
|
|
|
13
12
|
* other words, this value should not be used for edits.
|
|
14
13
|
*
|
|
15
14
|
* - 'PRIMARY_INSTANCE': Derives the initial state from the current text
|
|
16
|
-
* content of the {@link ValueNode.contextNode}
|
|
17
|
-
* backing store/source of thruth for primary instance state). This option
|
|
15
|
+
* content of the {@link ValueNode.contextNode}. This option
|
|
18
16
|
* should be specified when initializing a form with existing primary
|
|
19
17
|
* instance data, such as when editing a previous submission.
|
|
20
18
|
*
|
|
@@ -30,16 +28,13 @@ type ValueState<RuntimeValue> = SimpleAtomicState<RuntimeValue>;
|
|
|
30
28
|
/**
|
|
31
29
|
* Provides a consistent interface for value nodes of any type which:
|
|
32
30
|
*
|
|
33
|
-
* - derives initial state from either
|
|
34
|
-
*
|
|
35
|
-
* - decodes primary instance state into the value node's runtime type
|
|
36
|
-
* - encodes
|
|
31
|
+
* - derives initial state from either an existing instance (e.g. for edits) or
|
|
32
|
+
* the node's definition (e.g. initializing a new submission)
|
|
33
|
+
* - decodes current primary instance state into the value node's runtime type
|
|
34
|
+
* - encodes updated runtime values to store updated instance state
|
|
37
35
|
* - initializes reactive computation of `calculate` bind expressions for those
|
|
38
36
|
* nodes defined with one
|
|
39
|
-
* -
|
|
40
|
-
* (whether performed by a client, or by a reactive `calculate` computation)
|
|
41
|
-
* are persisted, ensuring a consistent view of state when downstream
|
|
42
|
-
* computations perform XPath evaluations against that primary instance state
|
|
37
|
+
* - prevents downstream writes to nodes in a readonly state
|
|
43
38
|
*/
|
|
44
39
|
export declare const createValueState: <RuntimeValue>(context: ValueContext<RuntimeValue>, options?: ValueStateOptions) => ValueState<RuntimeValue>;
|
|
45
40
|
export {};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
import { FormNodeID } from '../../client/identity.ts';
|
|
1
2
|
import { AnyChildNode } from '../../instance/hierarchy.ts';
|
|
2
|
-
import { NodeID } from '../../instance/identity.ts';
|
|
3
3
|
import { ChildrenState } from './createChildrenState.ts';
|
|
4
4
|
import { ReactiveScope } from './scope.ts';
|
|
5
|
-
|
|
6
5
|
export interface EncodedParentState {
|
|
7
|
-
readonly children: readonly
|
|
6
|
+
readonly children: readonly FormNodeID[];
|
|
8
7
|
}
|
|
9
8
|
export type MaterializedChildren<BaseState extends EncodedParentState, Child extends AnyChildNode | null> = Omit<BaseState, 'children'> & {
|
|
10
9
|
readonly children: readonly Child[];
|
|
@@ -12,8 +11,8 @@ export type MaterializedChildren<BaseState extends EncodedParentState, Child ext
|
|
|
12
11
|
/**
|
|
13
12
|
* Creates a wrapper proxy around a parent node's {@link CurrentState} to map
|
|
14
13
|
* `children` state, which is written to the node's (internal, synchronized)
|
|
15
|
-
* {@link ClientState} as an array of {@link
|
|
16
|
-
* corresponding to those IDs.
|
|
14
|
+
* {@link ClientState} as an array of {@link FormNodeID}s, back to the node
|
|
15
|
+
* objects corresponding to those IDs.
|
|
17
16
|
*
|
|
18
17
|
* @see {@link createChildrenState} for further detail.
|
|
19
18
|
*/
|
|
@@ -4,7 +4,6 @@ import { ReactiveScope } from '../scope.ts';
|
|
|
4
4
|
import { EngineState } from './createEngineState.ts';
|
|
5
5
|
import { SpecifiedState, StateSpec } from './createSpecifiedState.ts';
|
|
6
6
|
import { InternalClientRepresentation } from './representations.ts';
|
|
7
|
-
|
|
8
7
|
export type SpecifiedClientStateFactory<Factory extends OpaqueReactiveObjectFactory, Spec extends StateSpec> = ShallowMutable<SpecifiedState<Spec>> extends Parameters<Factory>[0] ? Factory : never;
|
|
9
8
|
export type ClientState<Spec extends StateSpec> = InternalClientRepresentation<SpecifiedState<Spec>>;
|
|
10
9
|
export declare const createClientState: <Factory extends OpaqueReactiveObjectFactory, Spec extends StateSpec>(scope: ReactiveScope, engineState: EngineState<Spec>, clientStateFactory: SpecifiedClientStateFactory<Factory, Spec>) => ClientState<Spec>;
|
|
@@ -2,6 +2,5 @@ import { ReactiveScope } from '../scope.ts';
|
|
|
2
2
|
import { ClientState } from './createClientState.ts';
|
|
3
3
|
import { SpecifiedState, StateSpec } from './createSpecifiedState.ts';
|
|
4
4
|
import { ReadonlyClientRepresentation } from './representations.ts';
|
|
5
|
-
|
|
6
5
|
export type CurrentState<Spec extends StateSpec> = ReadonlyClientRepresentation<SpecifiedState<Spec>>;
|
|
7
6
|
export declare const createCurrentState: <Spec extends StateSpec>(scope: ReactiveScope, clientState: ClientState<Spec>) => CurrentState<Spec>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ReactiveScope } from '../scope.ts';
|
|
2
2
|
import { SpecifiedState, StateSpec } from './createSpecifiedState.ts';
|
|
3
3
|
import { EngineRepresentation } from './representations.ts';
|
|
4
|
-
|
|
5
4
|
export type EngineState<Spec extends StateSpec> = EngineRepresentation<SpecifiedState<Spec>>;
|
|
6
5
|
export declare const createEngineState: <Spec extends StateSpec>(scope: ReactiveScope, spec: Spec) => EngineState<Spec>;
|
|
@@ -4,7 +4,6 @@ import { ClientState, SpecifiedClientStateFactory } from './createClientState.ts
|
|
|
4
4
|
import { CurrentState } from './createCurrentState.ts';
|
|
5
5
|
import { EngineState } from './createEngineState.ts';
|
|
6
6
|
import { MutablePropertySpec, SpecifiedState, StateSpec } from './createSpecifiedState.ts';
|
|
7
|
-
|
|
8
7
|
type MutableKeyOf<Spec extends StateSpec> = {
|
|
9
8
|
[K in string & keyof Spec]: Spec[K] extends MutablePropertySpec<any> ? K : never;
|
|
10
9
|
}[string & keyof Spec];
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Accessor } from 'solid-js';
|
|
2
2
|
import { TextRange } from '../../../client/TextRange.ts';
|
|
3
3
|
import { EvaluationContext } from '../../../instance/internal-api/EvaluationContext.ts';
|
|
4
|
-
import { LeafNodeDefinition } from '../../../model/LeafNodeDefinition.ts';
|
|
5
|
-
|
|
4
|
+
import { LeafNodeDefinition } from '../../../parse/model/LeafNodeDefinition.ts';
|
|
6
5
|
export declare const createFieldHint: (context: EvaluationContext, definition: LeafNodeDefinition) => Accessor<TextRange<"hint", "form"> | null>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Accessor } from 'solid-js';
|
|
2
2
|
import { TextRange } from '../../../client/TextRange.ts';
|
|
3
3
|
import { EvaluationContext } from '../../../instance/internal-api/EvaluationContext.ts';
|
|
4
|
-
import { AnyNodeDefinition } from '../../../model/NodeDefinition.ts';
|
|
5
|
-
|
|
4
|
+
import { AnyNodeDefinition } from '../../../parse/model/NodeDefinition.ts';
|
|
6
5
|
export declare const createNodeLabel: (context: EvaluationContext, definition: AnyNodeDefinition) => Accessor<TextRange<"label", "form"> | null>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Accessor } from 'solid-js';
|
|
2
2
|
import { TextRange } from '../../../client/TextRange.ts';
|
|
3
3
|
import { EvaluationContext } from '../../../instance/internal-api/EvaluationContext.ts';
|
|
4
|
-
import { NoteTextDefinition } from '../../../parse/NoteNodeDefinition.ts';
|
|
5
|
-
|
|
4
|
+
import { NoteTextDefinition } from '../../../parse/model/NoteNodeDefinition.ts';
|
|
6
5
|
export type NoteTextRole = 'label' | 'hint';
|
|
7
6
|
export type ComputedNoteText<Role extends NoteTextRole = NoteTextRole> = Accessor<TextRange<Role, 'form'>>;
|
|
8
7
|
interface BaseNoteText {
|
|
@@ -3,7 +3,6 @@ import { TextRole } from '../../../client/TextRange.ts';
|
|
|
3
3
|
import { EvaluationContext } from '../../../instance/internal-api/EvaluationContext.ts';
|
|
4
4
|
import { TextRange } from '../../../instance/text/TextRange.ts';
|
|
5
5
|
import { TextRangeDefinition } from '../../../parse/text/abstract/TextRangeDefinition.ts';
|
|
6
|
-
|
|
7
6
|
type ComputedFormTextRange<Role extends TextRole> = Accessor<TextRange<Role, 'form'>>;
|
|
8
7
|
/**
|
|
9
8
|
* Creates a text range (e.g. label or hint) from the provided definition,
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { OpaqueReactiveObjectFactory } from '../../../client/OpaqueReactiveObjectFactory.ts';
|
|
2
2
|
import { AncestorNodeValidationState } from '../../../client/validation.ts';
|
|
3
3
|
import { AnyParentNode } from '../../../instance/hierarchy.ts';
|
|
4
|
-
|
|
5
4
|
interface AggregatedViolationsOptions {
|
|
6
5
|
readonly clientStateFactory: OpaqueReactiveObjectFactory<AncestorNodeValidationState>;
|
|
7
6
|
}
|
|
@@ -3,7 +3,6 @@ import { OpaqueReactiveObjectFactory } from '../../../client/OpaqueReactiveObjec
|
|
|
3
3
|
import { AnyViolation, ConditionValidation, ValidationCondition } from '../../../client/validation.ts';
|
|
4
4
|
import { ValidationContext } from '../../../instance/internal-api/ValidationContext.ts';
|
|
5
5
|
import { SharedNodeState, SharedNodeStateOptions } from '../node-state/createSharedNodeState.ts';
|
|
6
|
-
|
|
7
6
|
type ComputedConditionValidation<Condition extends ValidationCondition> = Accessor<ConditionValidation<Condition>>;
|
|
8
7
|
type ComputedViolation = Accessor<AnyViolation | null>;
|
|
9
8
|
interface ValidationStateSpec {
|