@getodk/xforms-engine 0.6.0 → 0.8.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 +4 -4
- package/dist/client/BaseValueNode.d.ts +7 -3
- package/dist/client/RootNode.d.ts +20 -16
- package/dist/client/UploadNode.d.ts +53 -0
- package/dist/client/attachments/InstanceAttachmentMeta.d.ts +8 -0
- package/dist/client/attachments/InstanceAttachmentsConfig.d.ts +8 -0
- package/dist/client/constants.d.ts +11 -12
- package/dist/client/form/CreateFormInstance.d.ts +14 -0
- package/dist/client/form/EditFormInstance.d.ts +62 -0
- package/dist/client/form/FormInstance.d.ts +104 -0
- package/dist/client/form/FormInstanceConfig.d.ts +19 -0
- package/dist/client/form/FormResource.d.ts +1 -0
- package/dist/client/form/LoadForm.d.ts +79 -0
- package/dist/client/form/LoadFormResult.d.ts +67 -0
- package/dist/client/form/RestoreFormInstance.d.ts +8 -0
- package/dist/client/hierarchy.d.ts +4 -5
- package/dist/client/index.d.ts +40 -11
- package/dist/client/node-types.d.ts +2 -3
- package/dist/client/repeat/BaseRepeatRangeNode.d.ts +3 -4
- package/dist/client/repeat/RepeatInstanceNode.d.ts +4 -5
- package/dist/client/repeat/RepeatRangeControlledNode.d.ts +2 -2
- package/dist/client/repeat/RepeatRangeUncontrolledNode.d.ts +2 -2
- package/dist/client/resources.d.ts +1 -1
- package/dist/client/serialization/InstanceData.d.ts +14 -0
- package/dist/client/serialization/InstanceFile.d.ts +6 -0
- package/dist/client/serialization/InstancePayload.d.ts +93 -0
- package/dist/client/serialization/InstancePayloadOptions.d.ts +24 -0
- package/dist/client/serialization/InstanceState.d.ts +12 -0
- package/dist/client/submission/{SubmissionDefinition.d.ts → SubmissionMeta.d.ts} +1 -1
- package/dist/entrypoints/FormInstance.d.ts +20 -0
- package/dist/entrypoints/FormResult/BaseFormResult.d.ts +22 -0
- package/dist/entrypoints/FormResult/BaseInstantiableFormResult.d.ts +25 -0
- package/dist/entrypoints/FormResult/FormFailureResult.d.ts +17 -0
- package/dist/entrypoints/FormResult/FormSuccessResult.d.ts +15 -0
- package/dist/entrypoints/FormResult/FormWarningResult.d.ts +15 -0
- package/dist/entrypoints/createInstance.d.ts +9 -0
- package/dist/entrypoints/editInstance.d.ts +9 -0
- package/dist/entrypoints/index.d.ts +4 -0
- package/dist/entrypoints/loadForm.d.ts +4 -0
- package/dist/entrypoints/restoreInstance.d.ts +9 -0
- package/dist/error/LoadFormFailureError.d.ts +9 -0
- package/dist/error/MalformedInstanceDataError.d.ts +3 -0
- package/dist/error/TemplatedNodeAttributeSerializationError.d.ts +22 -0
- package/dist/error/UploadValueTypeError.d.ts +8 -0
- package/dist/index.d.ts +2 -33
- package/dist/index.js +8280 -6779
- package/dist/index.js.map +1 -1
- package/dist/instance/Group.d.ts +6 -5
- package/dist/instance/InputControl.d.ts +5 -4
- package/dist/instance/ModelValue.d.ts +5 -4
- package/dist/instance/Note.d.ts +4 -3
- package/dist/instance/PrimaryInstance.d.ts +34 -8
- package/dist/instance/RangeControl.d.ts +5 -4
- package/dist/instance/RankControl.d.ts +6 -5
- package/dist/instance/Root.d.ts +7 -9
- package/dist/instance/SelectControl.d.ts +4 -3
- package/dist/instance/Subtree.d.ts +6 -5
- package/dist/instance/TriggerControl.d.ts +4 -3
- package/dist/instance/UploadControl.d.ts +58 -0
- package/dist/instance/abstract/DescendantNode.d.ts +10 -1
- package/dist/instance/abstract/InstanceNode.d.ts +7 -4
- package/dist/instance/abstract/ValueNode.d.ts +7 -5
- package/dist/instance/attachments/InstanceAttachment.d.ts +42 -0
- package/dist/instance/attachments/InstanceAttachmentsState.d.ts +9 -0
- package/dist/instance/children/DescendantNodeInitOptions.d.ts +32 -0
- package/dist/instance/{children.d.ts → children/buildChildren.d.ts} +1 -1
- package/dist/instance/children/childrenInitOptions.d.ts +9 -0
- package/dist/instance/children/normalizeChildInitOptions.d.ts +2 -0
- package/dist/instance/hierarchy.d.ts +6 -7
- package/dist/instance/input/InitialInstanceState.d.ts +13 -0
- package/dist/instance/input/InstanceAttachmentMap.d.ts +19 -0
- package/dist/instance/internal-api/InstanceAttachmentContext.d.ts +19 -0
- package/dist/instance/internal-api/InstanceConfig.d.ts +4 -9
- package/dist/instance/internal-api/InstanceValueContext.d.ts +8 -1
- package/dist/instance/internal-api/serialization/ClientReactiveSerializableInstance.d.ts +16 -0
- package/dist/instance/internal-api/serialization/ClientReactiveSerializableLeafNode.d.ts +32 -0
- package/dist/instance/internal-api/serialization/ClientReactiveSerializableParentNode.d.ts +18 -0
- package/dist/instance/internal-api/serialization/ClientReactiveSerializableTemplatedNode.d.ts +13 -0
- package/dist/instance/internal-api/serialization/ClientReactiveSerializableValueNode.d.ts +21 -0
- package/dist/instance/repeat/BaseRepeatRange.d.ts +10 -8
- package/dist/instance/repeat/RepeatInstance.d.ts +10 -7
- package/dist/instance/repeat/RepeatRangeControlled.d.ts +27 -3
- package/dist/instance/repeat/RepeatRangeUncontrolled.d.ts +4 -3
- package/dist/instance/resource.d.ts +5 -1
- package/dist/integration/xpath/EngineXPathEvaluator.d.ts +2 -2
- package/dist/integration/xpath/adapter/kind.d.ts +4 -10
- package/dist/integration/xpath/static-dom/StaticAttribute.d.ts +4 -5
- package/dist/integration/xpath/static-dom/StaticDocument.d.ts +13 -10
- package/dist/integration/xpath/static-dom/StaticElement.d.ts +21 -22
- package/dist/integration/xpath/static-dom/StaticNode.d.ts +1 -1
- package/dist/integration/xpath/static-dom/StaticParentNode.d.ts +13 -0
- package/dist/integration/xpath/static-dom/staticNodeName.d.ts +3 -0
- package/dist/lib/client-reactivity/instance-state/createNodeRangeInstanceState.d.ts +4 -0
- package/dist/lib/client-reactivity/instance-state/createParentNodeInstanceState.d.ts +4 -0
- package/dist/lib/client-reactivity/instance-state/createPrimaryInstanceState.d.ts +3 -0
- package/dist/lib/client-reactivity/instance-state/createRootInstanceState.d.ts +3 -0
- package/dist/lib/client-reactivity/instance-state/createTemplatedNodeInstanceState.d.ts +6 -0
- package/dist/lib/client-reactivity/instance-state/createValueNodeInstanceState.d.ts +3 -0
- package/dist/lib/client-reactivity/instance-state/prepareInstancePayload.d.ts +8 -0
- package/dist/lib/names/UnprefixedXFormsName.d.ts +4 -0
- package/dist/lib/reactivity/createInstanceAttachment.d.ts +8 -0
- package/dist/lib/reactivity/createInstanceValueState.d.ts +2 -27
- package/dist/lib/resource-helpers.d.ts +2 -0
- package/dist/parse/XFormDOM.d.ts +1 -1
- package/dist/parse/body/BodyDefinition.d.ts +2 -1
- package/dist/parse/body/control/UploadControlDefinition.d.ts +2 -0
- package/dist/parse/model/BindDefinition.d.ts +1 -1
- package/dist/parse/model/BindTypeDefinition.d.ts +2 -7
- package/dist/parse/model/ItextTranslationsDefinition.d.ts +18 -0
- package/dist/parse/model/LeafNodeDefinition.d.ts +4 -5
- package/dist/parse/model/ModelBindMap.d.ts +1 -1
- package/dist/parse/model/ModelDefinition.d.ts +9 -2
- package/dist/parse/model/NodeDefinition.d.ts +18 -30
- package/dist/parse/model/NoteNodeDefinition.d.ts +3 -2
- package/dist/parse/model/RangeNodeDefinition.d.ts +2 -1
- package/dist/parse/model/RepeatDefinition.d.ts +62 -0
- package/dist/parse/model/RootAttributeDefinition.d.ts +1 -4
- package/dist/parse/model/RootAttributeMap.d.ts +2 -1
- package/dist/parse/model/RootDefinition.d.ts +7 -8
- package/dist/parse/model/SecondaryInstance/SecondaryInstancesDefinition.d.ts +15 -2
- package/dist/parse/model/SecondaryInstance/assertSecondaryInstanceDefinition.d.ts +5 -0
- package/dist/parse/model/SecondaryInstance/defineSecondaryInstance.d.ts +5 -0
- package/dist/parse/model/SecondaryInstance/sources/BlankSecondaryInstanceSource.d.ts +1 -7
- package/dist/parse/model/SecondaryInstance/sources/CSVExternalSecondaryInstance.d.ts +1 -1
- package/dist/parse/model/SecondaryInstance/sources/GeoJSONExternalSecondaryInstance.d.ts +1 -1
- package/dist/parse/model/SecondaryInstance/sources/InternalSecondaryInstanceSource.d.ts +1 -1
- package/dist/parse/model/SecondaryInstance/sources/SecondaryInstanceSource.d.ts +1 -1
- package/dist/parse/model/SecondaryInstance/sources/XMLExternalSecondaryInstanceSource.d.ts +1 -1
- package/dist/parse/model/{FormSubmissionDefinition.d.ts → SubmissionDefinition.d.ts} +2 -2
- package/dist/parse/model/SubtreeDefinition.d.ts +4 -5
- package/dist/parse/model/nodeDefinitionMap.d.ts +5 -0
- package/dist/parse/shared/parseInstanceXML.d.ts +21 -0
- package/dist/parse/shared/parseStaticDocumentFromDOMSubtree.d.ts +4 -21
- package/dist/solid.js +8251 -6751
- package/dist/solid.js.map +1 -1
- package/package.json +15 -14
- package/src/client/BaseNode.ts +4 -4
- package/src/client/BaseValueNode.ts +7 -3
- package/src/client/RootNode.ts +32 -19
- package/src/client/UploadNode.ts +78 -0
- package/src/client/attachments/InstanceAttachmentMeta.ts +10 -0
- package/src/client/attachments/InstanceAttachmentsConfig.ts +13 -0
- package/src/client/constants.ts +12 -14
- package/src/client/form/CreateFormInstance.ts +19 -0
- package/src/client/form/EditFormInstance.ts +93 -0
- package/src/client/form/FormInstance.ts +114 -0
- package/src/client/form/FormInstanceConfig.ts +21 -0
- package/src/client/form/FormResource.ts +1 -0
- package/src/client/form/LoadForm.ts +92 -0
- package/src/client/form/LoadFormResult.ts +103 -0
- package/src/client/form/RestoreFormInstance.ts +14 -0
- package/src/client/hierarchy.ts +5 -8
- package/src/client/index.ts +49 -29
- package/src/client/node-types.ts +3 -8
- package/src/client/repeat/BaseRepeatRangeNode.ts +3 -4
- package/src/client/repeat/RepeatInstanceNode.ts +4 -8
- package/src/client/repeat/RepeatRangeControlledNode.ts +2 -2
- package/src/client/repeat/RepeatRangeUncontrolledNode.ts +2 -2
- package/src/client/resources.ts +2 -2
- package/src/client/serialization/InstanceData.ts +24 -0
- package/src/client/serialization/InstanceFile.ts +9 -0
- package/src/client/serialization/InstancePayload.ts +126 -0
- package/src/client/serialization/InstancePayloadOptions.ts +29 -0
- package/src/client/serialization/InstanceState.ts +14 -0
- package/src/client/submission/{SubmissionDefinition.ts → SubmissionMeta.ts} +1 -1
- package/src/entrypoints/FormInstance.ts +56 -0
- package/src/entrypoints/FormResult/BaseFormResult.ts +40 -0
- package/src/entrypoints/FormResult/BaseInstantiableFormResult.ts +109 -0
- package/src/entrypoints/FormResult/FormFailureResult.ts +44 -0
- package/src/entrypoints/FormResult/FormSuccessResult.ts +25 -0
- package/src/entrypoints/FormResult/FormWarningResult.ts +25 -0
- package/src/entrypoints/createInstance.ts +23 -0
- package/src/entrypoints/editInstance.ts +24 -0
- package/src/entrypoints/index.ts +4 -0
- package/src/entrypoints/loadForm.ts +154 -0
- package/src/entrypoints/restoreInstance.ts +27 -0
- package/src/error/LoadFormFailureError.ts +114 -0
- package/src/error/MalformedInstanceDataError.ts +3 -0
- package/src/error/TemplatedNodeAttributeSerializationError.ts +24 -0
- package/src/error/UploadValueTypeError.ts +13 -0
- package/src/index.ts +2 -46
- package/src/instance/Group.ts +16 -15
- package/src/instance/InputControl.ts +17 -11
- package/src/instance/ModelValue.ts +17 -11
- package/src/instance/Note.ts +10 -9
- package/src/instance/PrimaryInstance.ts +68 -31
- package/src/instance/RangeControl.ts +17 -11
- package/src/instance/RankControl.ts +28 -19
- package/src/instance/Root.ts +20 -31
- package/src/instance/SelectControl.ts +21 -12
- package/src/instance/Subtree.ts +16 -15
- package/src/instance/TriggerControl.ts +21 -12
- package/src/instance/UploadControl.ts +184 -0
- package/src/instance/abstract/DescendantNode.ts +12 -2
- package/src/instance/abstract/InstanceNode.ts +9 -5
- package/src/instance/abstract/ValueNode.ts +11 -13
- package/src/instance/attachments/InstanceAttachment.ts +69 -0
- package/src/instance/attachments/InstanceAttachmentsState.ts +18 -0
- package/src/instance/children/DescendantNodeInitOptions.ts +35 -0
- package/src/instance/{children.ts → children/buildChildren.ts} +57 -53
- package/src/instance/children/childrenInitOptions.ts +117 -0
- package/src/instance/children/normalizeChildInitOptions.ts +332 -0
- package/src/instance/hierarchy.ts +6 -9
- package/src/instance/input/InitialInstanceState.ts +108 -0
- package/src/instance/input/InstanceAttachmentMap.ts +154 -0
- package/src/instance/internal-api/InstanceAttachmentContext.ts +20 -0
- package/src/instance/internal-api/InstanceConfig.ts +6 -10
- package/src/instance/internal-api/InstanceValueContext.ts +9 -1
- package/src/instance/internal-api/serialization/ClientReactiveSerializableInstance.ts +22 -0
- package/src/instance/internal-api/serialization/ClientReactiveSerializableLeafNode.ts +43 -0
- package/src/instance/internal-api/serialization/ClientReactiveSerializableParentNode.ts +26 -0
- package/src/instance/internal-api/serialization/ClientReactiveSerializableTemplatedNode.ts +24 -0
- package/src/instance/internal-api/serialization/ClientReactiveSerializableValueNode.ts +28 -0
- package/src/instance/repeat/BaseRepeatRange.ts +19 -24
- package/src/instance/repeat/RepeatInstance.ts +26 -19
- package/src/instance/repeat/RepeatRangeControlled.ts +90 -17
- package/src/instance/repeat/RepeatRangeUncontrolled.ts +10 -9
- package/src/instance/resource.ts +14 -1
- package/src/integration/xpath/EngineXPathEvaluator.ts +2 -2
- package/src/integration/xpath/adapter/kind.ts +1 -28
- package/src/integration/xpath/adapter/traversal.ts +2 -2
- package/src/integration/xpath/static-dom/StaticAttribute.ts +6 -5
- package/src/integration/xpath/static-dom/StaticDocument.ts +17 -16
- package/src/integration/xpath/static-dom/StaticElement.ts +196 -50
- package/src/integration/xpath/static-dom/StaticNode.ts +1 -1
- package/src/integration/xpath/static-dom/StaticParentNode.ts +22 -0
- package/src/integration/xpath/static-dom/staticNodeName.ts +20 -0
- package/src/lib/client-reactivity/instance-state/createNodeRangeInstanceState.ts +17 -0
- package/src/lib/client-reactivity/instance-state/createParentNodeInstanceState.ts +22 -0
- package/src/lib/client-reactivity/instance-state/createPrimaryInstanceState.ts +12 -0
- package/src/lib/client-reactivity/{submission/createRootSubmissionState.ts → instance-state/createRootInstanceState.ts} +4 -4
- package/src/lib/client-reactivity/instance-state/createTemplatedNodeInstanceState.ts +31 -0
- package/src/lib/client-reactivity/instance-state/createValueNodeInstanceState.ts +21 -0
- package/src/lib/client-reactivity/instance-state/prepareInstancePayload.ts +237 -0
- package/src/lib/names/UnprefixedXFormsName.ts +12 -0
- package/src/lib/reactivity/createInstanceAttachment.ts +212 -0
- package/src/lib/reactivity/createInstanceValueState.ts +27 -51
- package/src/lib/resource-helpers.ts +33 -0
- package/src/parse/XFormDOM.ts +1 -3
- package/src/parse/body/BodyDefinition.ts +4 -0
- package/src/parse/body/control/UploadControlDefinition.ts +42 -0
- package/src/parse/model/BindDefinition.ts +1 -1
- package/src/parse/model/BindTypeDefinition.ts +68 -26
- package/src/parse/model/ItextTranslationsDefinition.ts +79 -0
- package/src/parse/model/LeafNodeDefinition.ts +3 -5
- package/src/parse/model/ModelBindMap.ts +0 -5
- package/src/parse/model/ModelDefinition.ts +36 -3
- package/src/parse/model/NodeDefinition.ts +19 -45
- package/src/parse/model/NoteNodeDefinition.ts +4 -3
- package/src/parse/model/RangeNodeDefinition.ts +3 -2
- package/src/parse/model/RepeatDefinition.ts +382 -0
- package/src/parse/model/RootAttributeDefinition.ts +6 -7
- package/src/parse/model/RootAttributeMap.ts +15 -10
- package/src/parse/model/RootDefinition.ts +17 -19
- package/src/parse/model/SecondaryInstance/SecondaryInstancesDefinition.ts +23 -2
- package/src/parse/model/SecondaryInstance/assertSecondaryInstanceDefinition.ts +14 -0
- package/src/parse/model/SecondaryInstance/defineSecondaryInstance.ts +32 -0
- package/src/parse/model/SecondaryInstance/sources/BlankSecondaryInstanceSource.ts +3 -24
- package/src/parse/model/SecondaryInstance/sources/CSVExternalSecondaryInstance.ts +33 -86
- package/src/parse/model/SecondaryInstance/sources/ExternalSecondaryInstanceResource.ts +1 -30
- package/src/parse/model/SecondaryInstance/sources/GeoJSONExternalSecondaryInstance.ts +64 -137
- package/src/parse/model/SecondaryInstance/sources/InternalSecondaryInstanceSource.ts +9 -7
- package/src/parse/model/SecondaryInstance/sources/SecondaryInstanceSource.ts +1 -1
- package/src/parse/model/SecondaryInstance/sources/XMLExternalSecondaryInstanceSource.ts +7 -7
- package/src/parse/model/{FormSubmissionDefinition.ts → SubmissionDefinition.ts} +2 -2
- package/src/parse/model/SubtreeDefinition.ts +4 -5
- package/src/parse/model/nodeDefinitionMap.ts +34 -0
- package/src/parse/shared/parseInstanceXML.ts +79 -0
- package/src/parse/shared/parseStaticDocumentFromDOMSubtree.ts +45 -130
- package/dist/client/EngineConfig.d.ts +0 -79
- package/dist/client/submission/SubmissionData.d.ts +0 -7
- package/dist/client/submission/SubmissionInstanceFile.d.ts +0 -6
- package/dist/client/submission/SubmissionOptions.d.ts +0 -23
- package/dist/client/submission/SubmissionResult.d.ts +0 -91
- package/dist/client/submission/SubmissionState.d.ts +0 -12
- package/dist/client/unsupported/UnsupportedControlNode.d.ts +0 -30
- package/dist/client/unsupported/UploadNode.d.ts +0 -9
- package/dist/instance/abstract/UnsupportedControl.d.ts +0 -54
- package/dist/instance/index.d.ts +0 -8
- package/dist/instance/internal-api/ValueContext.d.ts +0 -23
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableInstance.d.ts +0 -14
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableLeafNode.d.ts +0 -32
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableParentNode.d.ts +0 -19
- package/dist/instance/internal-api/submission/ClientReactiveSubmittableValueNode.d.ts +0 -18
- package/dist/instance/unsupported/UploadControl.d.ts +0 -6
- package/dist/lib/client-reactivity/submission/createInstanceSubmissionState.d.ts +0 -3
- package/dist/lib/client-reactivity/submission/createLeafNodeSubmissionState.d.ts +0 -3
- package/dist/lib/client-reactivity/submission/createNodeRangeSubmissionState.d.ts +0 -4
- package/dist/lib/client-reactivity/submission/createParentNodeSubmissionState.d.ts +0 -4
- package/dist/lib/client-reactivity/submission/createRootSubmissionState.d.ts +0 -3
- package/dist/lib/client-reactivity/submission/createValueNodeSubmissionState.d.ts +0 -3
- package/dist/lib/client-reactivity/submission/prepareSubmission.d.ts +0 -8
- package/dist/lib/reactivity/createValueState.d.ts +0 -40
- package/dist/parse/model/ItextTranslation/ItextTranslationDefinition.d.ts +0 -4
- package/dist/parse/model/ItextTranslation/ItextTranslationRootDefinition.d.ts +0 -9
- package/dist/parse/model/ItextTranslation/ItextTranslationsDefinition.d.ts +0 -8
- package/dist/parse/model/RepeatInstanceDefinition.d.ts +0 -17
- package/dist/parse/model/RepeatRangeDefinition.d.ts +0 -32
- package/dist/parse/model/RepeatTemplateDefinition.d.ts +0 -31
- package/dist/parse/model/SecondaryInstance/SecondaryInstanceDefinition.d.ts +0 -4
- package/dist/parse/model/SecondaryInstance/SecondaryInstanceRootDefinition.d.ts +0 -7
- package/src/client/EngineConfig.ts +0 -84
- package/src/client/submission/SubmissionData.ts +0 -12
- package/src/client/submission/SubmissionInstanceFile.ts +0 -9
- package/src/client/submission/SubmissionOptions.ts +0 -28
- package/src/client/submission/SubmissionResult.ts +0 -124
- package/src/client/submission/SubmissionState.ts +0 -14
- package/src/client/unsupported/UnsupportedControlNode.ts +0 -36
- package/src/client/unsupported/UploadNode.ts +0 -14
- package/src/instance/abstract/UnsupportedControl.ts +0 -175
- package/src/instance/index.ts +0 -55
- package/src/instance/internal-api/ValueContext.ts +0 -28
- package/src/instance/internal-api/submission/ClientReactiveSubmittableInstance.ts +0 -20
- package/src/instance/internal-api/submission/ClientReactiveSubmittableLeafNode.ts +0 -43
- package/src/instance/internal-api/submission/ClientReactiveSubmittableParentNode.ts +0 -26
- package/src/instance/internal-api/submission/ClientReactiveSubmittableValueNode.ts +0 -24
- package/src/instance/unsupported/UploadControl.ts +0 -9
- package/src/lib/client-reactivity/submission/createInstanceSubmissionState.ts +0 -12
- package/src/lib/client-reactivity/submission/createLeafNodeSubmissionState.ts +0 -20
- package/src/lib/client-reactivity/submission/createNodeRangeSubmissionState.ts +0 -17
- package/src/lib/client-reactivity/submission/createParentNodeSubmissionState.ts +0 -22
- package/src/lib/client-reactivity/submission/createValueNodeSubmissionState.ts +0 -21
- package/src/lib/client-reactivity/submission/prepareSubmission.ts +0 -172
- package/src/lib/reactivity/createValueState.ts +0 -200
- package/src/parse/model/ItextTranslation/ItextTranslationDefinition.ts +0 -4
- package/src/parse/model/ItextTranslation/ItextTranslationRootDefinition.ts +0 -42
- package/src/parse/model/ItextTranslation/ItextTranslationsDefinition.ts +0 -31
- package/src/parse/model/RepeatInstanceDefinition.ts +0 -38
- package/src/parse/model/RepeatRangeDefinition.ts +0 -98
- package/src/parse/model/RepeatTemplateDefinition.ts +0 -149
- package/src/parse/model/SecondaryInstance/SecondaryInstanceDefinition.ts +0 -4
- package/src/parse/model/SecondaryInstance/SecondaryInstanceRootDefinition.ts +0 -12
|
@@ -3,7 +3,14 @@ import type { Accessor } from 'solid-js';
|
|
|
3
3
|
import { createMemo } from 'solid-js';
|
|
4
4
|
import type { RankDefinition, RankItem, RankNode, RankValueOptions } from '../client/RankNode.ts';
|
|
5
5
|
import type { TextRange } from '../client/TextRange.ts';
|
|
6
|
+
import type { ValueType } from '../client/ValueType.ts';
|
|
7
|
+
import { RankMissingValueError } from '../error/RankMissingValueError.ts';
|
|
8
|
+
import { RankValueTypeError } from '../error/RankValueTypeError.ts';
|
|
6
9
|
import type { XFormsXPathElement } from '../integration/xpath/adapter/XFormsXPathNode.ts';
|
|
10
|
+
import type { StaticLeafElement } from '../integration/xpath/static-dom/StaticElement.ts';
|
|
11
|
+
import { sharedValueCodecs } from '../lib/codecs/getSharedValueCodec.ts';
|
|
12
|
+
import { MultipleValueItemCodec } from '../lib/codecs/items/MultipleValueItemCodec.ts';
|
|
13
|
+
import { createItemCollection } from '../lib/reactivity/createItemCollection.ts';
|
|
7
14
|
import type { CurrentState } from '../lib/reactivity/node-state/createCurrentState.ts';
|
|
8
15
|
import type { EngineState } from '../lib/reactivity/node-state/createEngineState.ts';
|
|
9
16
|
import type { SharedNodeState } from '../lib/reactivity/node-state/createSharedNodeState.ts';
|
|
@@ -11,20 +18,14 @@ import { createSharedNodeState } from '../lib/reactivity/node-state/createShared
|
|
|
11
18
|
import { createFieldHint } from '../lib/reactivity/text/createFieldHint.ts';
|
|
12
19
|
import { createNodeLabel } from '../lib/reactivity/text/createNodeLabel.ts';
|
|
13
20
|
import type { SimpleAtomicState } from '../lib/reactivity/types.ts';
|
|
21
|
+
import type { UnknownAppearanceDefinition } from '../parse/body/appearance/unknownAppearanceParser.ts';
|
|
14
22
|
import type { Root } from './Root.ts';
|
|
15
23
|
import type { ValueNodeStateSpec } from './abstract/ValueNode.ts';
|
|
16
24
|
import { ValueNode } from './abstract/ValueNode.ts';
|
|
17
25
|
import type { GeneralParentNode } from './hierarchy.ts';
|
|
18
26
|
import type { EvaluationContext } from './internal-api/EvaluationContext.ts';
|
|
19
27
|
import type { ValidationContext } from './internal-api/ValidationContext.ts';
|
|
20
|
-
import type {
|
|
21
|
-
import { MultipleValueItemCodec } from '../lib/codecs/items/MultipleValueItemCodec.ts';
|
|
22
|
-
import { sharedValueCodecs } from '../lib/codecs/getSharedValueCodec.ts';
|
|
23
|
-
import { createItemCollection } from '../lib/reactivity/createItemCollection.ts';
|
|
24
|
-
import type { UnknownAppearanceDefinition } from '../parse/body/appearance/unknownAppearanceParser.ts';
|
|
25
|
-
import type { ValueType } from '../client/ValueType.ts';
|
|
26
|
-
import { RankMissingValueError } from '../error/RankMissingValueError.ts';
|
|
27
|
-
import { RankValueTypeError } from '../error/RankValueTypeError.ts';
|
|
28
|
+
import type { ClientReactiveSerializableValueNode } from './internal-api/serialization/ClientReactiveSerializableValueNode.ts';
|
|
28
29
|
|
|
29
30
|
export type AnyRankDefinition = {
|
|
30
31
|
[V in ValueType]: RankDefinition<V>;
|
|
@@ -66,12 +67,20 @@ export class RankControl
|
|
|
66
67
|
XFormsXPathElement,
|
|
67
68
|
EvaluationContext,
|
|
68
69
|
ValidationContext,
|
|
69
|
-
|
|
70
|
+
ClientReactiveSerializableValueNode
|
|
70
71
|
{
|
|
71
|
-
static from(
|
|
72
|
-
|
|
72
|
+
static from(
|
|
73
|
+
parent: GeneralParentNode,
|
|
74
|
+
instanceNode: StaticLeafElement | null,
|
|
75
|
+
definition: RankDefinition
|
|
76
|
+
): RankControl;
|
|
77
|
+
static from(
|
|
78
|
+
parent: GeneralParentNode,
|
|
79
|
+
instanceNode: StaticLeafElement | null,
|
|
80
|
+
definition: AnyRankDefinition
|
|
81
|
+
): RankControl {
|
|
73
82
|
assertRankNodeDefinition(definition);
|
|
74
|
-
return new this(parent, definition);
|
|
83
|
+
return new this(parent, instanceNode, definition);
|
|
75
84
|
}
|
|
76
85
|
|
|
77
86
|
private readonly mapOptionsByValue: Accessor<RankItemMap>;
|
|
@@ -91,9 +100,13 @@ export class RankControl
|
|
|
91
100
|
readonly nodeOptions = null;
|
|
92
101
|
readonly currentState: CurrentState<RankControlStateSpec>;
|
|
93
102
|
|
|
94
|
-
private constructor(
|
|
103
|
+
private constructor(
|
|
104
|
+
parent: GeneralParentNode,
|
|
105
|
+
instanceNode: StaticLeafElement | null,
|
|
106
|
+
definition: RankDefinition<'string'>
|
|
107
|
+
) {
|
|
95
108
|
const codec = new MultipleValueItemCodec(sharedValueCodecs.string);
|
|
96
|
-
super(parent, definition, codec);
|
|
109
|
+
super(parent, instanceNode, definition, codec);
|
|
97
110
|
|
|
98
111
|
this.appearances = definition.bodyElement.appearances;
|
|
99
112
|
|
|
@@ -150,10 +163,6 @@ export class RankControl
|
|
|
150
163
|
return createMemo(() => codec.encodeValue(getValue()));
|
|
151
164
|
});
|
|
152
165
|
|
|
153
|
-
const sharedStateOptions = {
|
|
154
|
-
clientStateFactory: this.engineConfig.stateFactory,
|
|
155
|
-
};
|
|
156
|
-
|
|
157
166
|
const state = createSharedNodeState(
|
|
158
167
|
this.scope,
|
|
159
168
|
{
|
|
@@ -168,7 +177,7 @@ export class RankControl
|
|
|
168
177
|
value: valueState,
|
|
169
178
|
instanceValue: this.getInstanceValue,
|
|
170
179
|
},
|
|
171
|
-
|
|
180
|
+
this.instanceConfig
|
|
172
181
|
);
|
|
173
182
|
|
|
174
183
|
this.state = state;
|
package/src/instance/Root.ts
CHANGED
|
@@ -3,16 +3,15 @@ import type { Accessor } from 'solid-js';
|
|
|
3
3
|
import type { ActiveLanguage, FormLanguage, FormLanguages } from '../client/FormLanguage.ts';
|
|
4
4
|
import type { FormNodeID } from '../client/identity.ts';
|
|
5
5
|
import type { RootNode } from '../client/RootNode.ts';
|
|
6
|
-
import type {
|
|
6
|
+
import type { InstancePayload } from '../client/serialization/InstancePayload.ts';
|
|
7
7
|
import type {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} from '../client/
|
|
11
|
-
import type {
|
|
12
|
-
import type { SubmissionState } from '../client/submission/SubmissionState.ts';
|
|
8
|
+
InstancePayloadOptions,
|
|
9
|
+
InstancePayloadType,
|
|
10
|
+
} from '../client/serialization/InstancePayloadOptions.ts';
|
|
11
|
+
import type { InstanceState } from '../client/serialization/InstanceState.ts';
|
|
13
12
|
import type { AncestorNodeValidationState } from '../client/validation.ts';
|
|
14
13
|
import type { XFormsXPathElement } from '../integration/xpath/adapter/XFormsXPathNode.ts';
|
|
15
|
-
import {
|
|
14
|
+
import { createRootInstanceState } from '../lib/client-reactivity/instance-state/createRootInstanceState.ts';
|
|
16
15
|
import type { ChildrenState } from '../lib/reactivity/createChildrenState.ts';
|
|
17
16
|
import { createChildrenState } from '../lib/reactivity/createChildrenState.ts';
|
|
18
17
|
import type { MaterializedChildren } from '../lib/reactivity/materializeCurrentStateChildren.ts';
|
|
@@ -25,10 +24,10 @@ import { createAggregatedViolations } from '../lib/reactivity/validation/createA
|
|
|
25
24
|
import type { BodyClassList } from '../parse/body/BodyDefinition.ts';
|
|
26
25
|
import type { RootDefinition } from '../parse/model/RootDefinition.ts';
|
|
27
26
|
import { DescendantNode } from './abstract/DescendantNode.ts';
|
|
28
|
-
import { buildChildren } from './children.ts';
|
|
27
|
+
import { buildChildren } from './children/buildChildren.ts';
|
|
29
28
|
import type { GeneralChildNode } from './hierarchy.ts';
|
|
30
29
|
import type { EvaluationContext } from './internal-api/EvaluationContext.ts';
|
|
31
|
-
import type {
|
|
30
|
+
import type { ClientReactiveSerializableParentNode } from './internal-api/serialization/ClientReactiveSerializableParentNode.ts';
|
|
32
31
|
import type { TranslationContext } from './internal-api/TranslationContext.ts';
|
|
33
32
|
import type { PrimaryInstance } from './PrimaryInstance.ts';
|
|
34
33
|
|
|
@@ -54,7 +53,7 @@ export class Root
|
|
|
54
53
|
XFormsXPathElement,
|
|
55
54
|
EvaluationContext,
|
|
56
55
|
TranslationContext,
|
|
57
|
-
|
|
56
|
+
ClientReactiveSerializableParentNode<GeneralChildNode>
|
|
58
57
|
{
|
|
59
58
|
private readonly childrenState: ChildrenState<GeneralChildNode>;
|
|
60
59
|
|
|
@@ -80,22 +79,16 @@ export class Root
|
|
|
80
79
|
readonly classes: BodyClassList;
|
|
81
80
|
readonly currentState: MaterializedChildren<CurrentState<RootStateSpec>, GeneralChildNode>;
|
|
82
81
|
readonly validationState: AncestorNodeValidationState;
|
|
83
|
-
readonly
|
|
84
|
-
|
|
85
|
-
// ClientReactiveSubmittableInstance
|
|
86
|
-
get submissionDefinition(): SubmissionDefinition {
|
|
87
|
-
return this.definition.submission;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
// RootNode
|
|
82
|
+
readonly instanceState: InstanceState;
|
|
91
83
|
readonly languages: FormLanguages;
|
|
92
84
|
|
|
93
85
|
constructor(parent: PrimaryInstance) {
|
|
94
|
-
const { definition } = parent;
|
|
86
|
+
const { definition, instanceNode: instance } = parent;
|
|
87
|
+
const instanceNode = instance.root;
|
|
95
88
|
const { nodeset: reference } = definition;
|
|
96
89
|
const computeReference: Accessor<string> = () => reference;
|
|
97
90
|
|
|
98
|
-
super(parent, definition, {
|
|
91
|
+
super(parent, instanceNode, definition, {
|
|
99
92
|
computeReference,
|
|
100
93
|
});
|
|
101
94
|
|
|
@@ -106,10 +99,6 @@ export class Root
|
|
|
106
99
|
this.childrenState = childrenState;
|
|
107
100
|
this.languages = parent.languages;
|
|
108
101
|
|
|
109
|
-
const sharedStateOptions = {
|
|
110
|
-
clientStateFactory: this.engineConfig.stateFactory,
|
|
111
|
-
};
|
|
112
|
-
|
|
113
102
|
const state = createSharedNodeState(
|
|
114
103
|
this.scope,
|
|
115
104
|
{
|
|
@@ -124,7 +113,7 @@ export class Root
|
|
|
124
113
|
value: null,
|
|
125
114
|
children: childrenState.childIds,
|
|
126
115
|
},
|
|
127
|
-
|
|
116
|
+
this.instanceConfig
|
|
128
117
|
);
|
|
129
118
|
|
|
130
119
|
this.state = state;
|
|
@@ -136,8 +125,8 @@ export class Root
|
|
|
136
125
|
);
|
|
137
126
|
|
|
138
127
|
childrenState.setChildren(buildChildren(this));
|
|
139
|
-
this.validationState = createAggregatedViolations(this,
|
|
140
|
-
this.
|
|
128
|
+
this.validationState = createAggregatedViolations(this, this.instanceConfig);
|
|
129
|
+
this.instanceState = createRootInstanceState(this);
|
|
141
130
|
}
|
|
142
131
|
|
|
143
132
|
getChildren(): readonly GeneralChildNode[] {
|
|
@@ -151,9 +140,9 @@ export class Root
|
|
|
151
140
|
return this;
|
|
152
141
|
}
|
|
153
142
|
|
|
154
|
-
|
|
155
|
-
options?:
|
|
156
|
-
): Promise<
|
|
157
|
-
return this.rootDocument.
|
|
143
|
+
prepareInstancePayload<PayloadType extends InstancePayloadType = 'monolithic'>(
|
|
144
|
+
options?: InstancePayloadOptions<PayloadType>
|
|
145
|
+
): Promise<InstancePayload<PayloadType>> {
|
|
146
|
+
return this.rootDocument.prepareInstancePayload(options);
|
|
158
147
|
}
|
|
159
148
|
}
|
|
@@ -12,6 +12,7 @@ import type { TextRange } from '../client/TextRange.ts';
|
|
|
12
12
|
import type { ValueType } from '../client/ValueType.ts';
|
|
13
13
|
import { SelectValueTypeError } from '../error/SelectValueTypeError.ts';
|
|
14
14
|
import type { XFormsXPathElement } from '../integration/xpath/adapter/XFormsXPathNode.ts';
|
|
15
|
+
import type { StaticLeafElement } from '../integration/xpath/static-dom/StaticElement.ts';
|
|
15
16
|
import { getSelectCodec } from '../lib/codecs/getSelectCodec.ts';
|
|
16
17
|
import { createItemCollection } from '../lib/reactivity/createItemCollection.ts';
|
|
17
18
|
import type { CurrentState } from '../lib/reactivity/node-state/createCurrentState.ts';
|
|
@@ -28,7 +29,7 @@ import { ValueNode } from './abstract/ValueNode.ts';
|
|
|
28
29
|
import type { GeneralParentNode } from './hierarchy.ts';
|
|
29
30
|
import type { EvaluationContext } from './internal-api/EvaluationContext.ts';
|
|
30
31
|
import type { ValidationContext } from './internal-api/ValidationContext.ts';
|
|
31
|
-
import type {
|
|
32
|
+
import type { ClientReactiveSerializableValueNode } from './internal-api/serialization/ClientReactiveSerializableValueNode.ts';
|
|
32
33
|
|
|
33
34
|
export type AnySelectDefinition = {
|
|
34
35
|
[V in ValueType]: SelectDefinition<V>;
|
|
@@ -59,13 +60,21 @@ export class SelectControl
|
|
|
59
60
|
XFormsXPathElement,
|
|
60
61
|
EvaluationContext,
|
|
61
62
|
ValidationContext,
|
|
62
|
-
|
|
63
|
+
ClientReactiveSerializableValueNode
|
|
63
64
|
{
|
|
64
|
-
static from(
|
|
65
|
-
|
|
65
|
+
static from(
|
|
66
|
+
parent: GeneralParentNode,
|
|
67
|
+
instanceNode: StaticLeafElement | null,
|
|
68
|
+
definition: SelectDefinition
|
|
69
|
+
): SelectControl;
|
|
70
|
+
static from(
|
|
71
|
+
parent: GeneralParentNode,
|
|
72
|
+
instanceNode: StaticLeafElement | null,
|
|
73
|
+
definition: AnySelectDefinition
|
|
74
|
+
): SelectControl {
|
|
66
75
|
assertSupportedSelectValueType(definition);
|
|
67
76
|
|
|
68
|
-
return new this(parent, definition);
|
|
77
|
+
return new this(parent, instanceNode, definition);
|
|
69
78
|
}
|
|
70
79
|
|
|
71
80
|
private readonly mapOptionsByValue: Accessor<SelectItemMap>;
|
|
@@ -86,10 +95,14 @@ export class SelectControl
|
|
|
86
95
|
readonly nodeOptions = null;
|
|
87
96
|
readonly currentState: CurrentState<SelectControlStateSpec>;
|
|
88
97
|
|
|
89
|
-
private constructor(
|
|
98
|
+
private constructor(
|
|
99
|
+
parent: GeneralParentNode,
|
|
100
|
+
instanceNode: StaticLeafElement | null,
|
|
101
|
+
definition: SelectDefinition<'string'>
|
|
102
|
+
) {
|
|
90
103
|
const codec = getSelectCodec(definition);
|
|
91
104
|
|
|
92
|
-
super(parent, definition, codec);
|
|
105
|
+
super(parent, instanceNode, definition, codec);
|
|
93
106
|
|
|
94
107
|
this.appearances = definition.bodyElement.appearances;
|
|
95
108
|
this.selectType = definition.bodyElement.type;
|
|
@@ -123,10 +136,6 @@ export class SelectControl
|
|
|
123
136
|
});
|
|
124
137
|
});
|
|
125
138
|
|
|
126
|
-
const sharedStateOptions = {
|
|
127
|
-
clientStateFactory: this.engineConfig.stateFactory,
|
|
128
|
-
};
|
|
129
|
-
|
|
130
139
|
const state = createSharedNodeState(
|
|
131
140
|
this.scope,
|
|
132
141
|
{
|
|
@@ -142,7 +151,7 @@ export class SelectControl
|
|
|
142
151
|
value: valueState,
|
|
143
152
|
instanceValue: this.getInstanceValue,
|
|
144
153
|
},
|
|
145
|
-
|
|
154
|
+
this.instanceConfig
|
|
146
155
|
);
|
|
147
156
|
|
|
148
157
|
this.state = state;
|
package/src/instance/Subtree.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { XPathNodeKindKey } from '@getodk/xpath';
|
|
2
2
|
import type { Accessor } from 'solid-js';
|
|
3
3
|
import type { FormNodeID } from '../client/identity.ts';
|
|
4
|
-
import type {
|
|
4
|
+
import type { InstanceState } from '../client/serialization/InstanceState.ts';
|
|
5
5
|
import type { SubtreeDefinition, SubtreeNode } from '../client/SubtreeNode.ts';
|
|
6
6
|
import type { AncestorNodeValidationState } from '../client/validation.ts';
|
|
7
7
|
import type { XFormsXPathElement } from '../integration/xpath/adapter/XFormsXPathNode.ts';
|
|
8
|
-
import {
|
|
8
|
+
import type { StaticElement } from '../integration/xpath/static-dom/StaticElement.ts';
|
|
9
|
+
import { createParentNodeInstanceState } from '../lib/client-reactivity/instance-state/createParentNodeInstanceState.ts';
|
|
9
10
|
import type { ChildrenState } from '../lib/reactivity/createChildrenState.ts';
|
|
10
11
|
import { createChildrenState } from '../lib/reactivity/createChildrenState.ts';
|
|
11
12
|
import type { MaterializedChildren } from '../lib/reactivity/materializeCurrentStateChildren.ts';
|
|
@@ -17,10 +18,10 @@ import { createSharedNodeState } from '../lib/reactivity/node-state/createShared
|
|
|
17
18
|
import { createAggregatedViolations } from '../lib/reactivity/validation/createAggregatedViolations.ts';
|
|
18
19
|
import type { DescendantNodeSharedStateSpec } from './abstract/DescendantNode.ts';
|
|
19
20
|
import { DescendantNode } from './abstract/DescendantNode.ts';
|
|
20
|
-
import { buildChildren } from './children.ts';
|
|
21
|
+
import { buildChildren } from './children/buildChildren.ts';
|
|
21
22
|
import type { GeneralChildNode, GeneralParentNode } from './hierarchy.ts';
|
|
22
23
|
import type { EvaluationContext } from './internal-api/EvaluationContext.ts';
|
|
23
|
-
import type {
|
|
24
|
+
import type { ClientReactiveSerializableParentNode } from './internal-api/serialization/ClientReactiveSerializableParentNode.ts';
|
|
24
25
|
|
|
25
26
|
interface SubtreeStateSpec extends DescendantNodeSharedStateSpec {
|
|
26
27
|
readonly label: null;
|
|
@@ -36,7 +37,7 @@ export class Subtree
|
|
|
36
37
|
SubtreeNode,
|
|
37
38
|
XFormsXPathElement,
|
|
38
39
|
EvaluationContext,
|
|
39
|
-
|
|
40
|
+
ClientReactiveSerializableParentNode<GeneralChildNode>
|
|
40
41
|
{
|
|
41
42
|
private readonly childrenState: ChildrenState<GeneralChildNode>;
|
|
42
43
|
|
|
@@ -52,19 +53,19 @@ export class Subtree
|
|
|
52
53
|
readonly nodeOptions = null;
|
|
53
54
|
readonly currentState: MaterializedChildren<CurrentState<SubtreeStateSpec>, GeneralChildNode>;
|
|
54
55
|
readonly validationState: AncestorNodeValidationState;
|
|
55
|
-
readonly
|
|
56
|
+
readonly instanceState: InstanceState;
|
|
56
57
|
|
|
57
|
-
constructor(
|
|
58
|
-
|
|
58
|
+
constructor(
|
|
59
|
+
parent: GeneralParentNode,
|
|
60
|
+
instanceNode: StaticElement | null,
|
|
61
|
+
definition: SubtreeDefinition
|
|
62
|
+
) {
|
|
63
|
+
super(parent, instanceNode, definition);
|
|
59
64
|
|
|
60
65
|
const childrenState = createChildrenState<Subtree, GeneralChildNode>(this);
|
|
61
66
|
|
|
62
67
|
this.childrenState = childrenState;
|
|
63
68
|
|
|
64
|
-
const sharedStateOptions = {
|
|
65
|
-
clientStateFactory: this.engineConfig.stateFactory,
|
|
66
|
-
};
|
|
67
|
-
|
|
68
69
|
const state = createSharedNodeState(
|
|
69
70
|
this.scope,
|
|
70
71
|
{
|
|
@@ -79,7 +80,7 @@ export class Subtree
|
|
|
79
80
|
valueOptions: null,
|
|
80
81
|
value: null,
|
|
81
82
|
},
|
|
82
|
-
|
|
83
|
+
this.instanceConfig
|
|
83
84
|
);
|
|
84
85
|
|
|
85
86
|
this.state = state;
|
|
@@ -91,8 +92,8 @@ export class Subtree
|
|
|
91
92
|
);
|
|
92
93
|
|
|
93
94
|
childrenState.setChildren(buildChildren(this));
|
|
94
|
-
this.validationState = createAggregatedViolations(this,
|
|
95
|
-
this.
|
|
95
|
+
this.validationState = createAggregatedViolations(this, this.instanceConfig);
|
|
96
|
+
this.instanceState = createParentNodeInstanceState(this);
|
|
96
97
|
}
|
|
97
98
|
|
|
98
99
|
getChildren(): readonly GeneralChildNode[] {
|
|
@@ -5,6 +5,7 @@ import type { TriggerNode, TriggerNodeDefinition } from '../client/TriggerNode.t
|
|
|
5
5
|
import type { ValueType } from '../client/ValueType.ts';
|
|
6
6
|
import { ErrorProductionDesignPendingError } from '../error/ErrorProductionDesignPendingError.ts';
|
|
7
7
|
import type { XFormsXPathElement } from '../integration/xpath/adapter/XFormsXPathNode.ts';
|
|
8
|
+
import type { StaticLeafElement } from '../integration/xpath/static-dom/StaticElement.ts';
|
|
8
9
|
import type { TriggerInputValue, TriggerRuntimeValue } from '../lib/codecs/TriggerCodec.ts';
|
|
9
10
|
import { TriggerCodec } from '../lib/codecs/TriggerCodec.ts';
|
|
10
11
|
import type { CurrentState } from '../lib/reactivity/node-state/createCurrentState.ts';
|
|
@@ -19,7 +20,7 @@ import { ValueNode, type ValueNodeStateSpec } from './abstract/ValueNode.ts';
|
|
|
19
20
|
import type { GeneralParentNode } from './hierarchy.ts';
|
|
20
21
|
import type { EvaluationContext } from './internal-api/EvaluationContext.ts';
|
|
21
22
|
import type { ValidationContext } from './internal-api/ValidationContext.ts';
|
|
22
|
-
import type {
|
|
23
|
+
import type { ClientReactiveSerializableValueNode } from './internal-api/serialization/ClientReactiveSerializableValueNode.ts';
|
|
23
24
|
|
|
24
25
|
interface TriggerControlStateSpec extends ValueNodeStateSpec<TriggerRuntimeValue> {
|
|
25
26
|
readonly label: Accessor<TextRange<'label'> | null>;
|
|
@@ -45,17 +46,25 @@ export class TriggerControl
|
|
|
45
46
|
XFormsXPathElement,
|
|
46
47
|
EvaluationContext,
|
|
47
48
|
ValidationContext,
|
|
48
|
-
|
|
49
|
+
ClientReactiveSerializableValueNode
|
|
49
50
|
{
|
|
50
|
-
static from(
|
|
51
|
-
|
|
51
|
+
static from(
|
|
52
|
+
parent: GeneralParentNode,
|
|
53
|
+
instanceNode: StaticLeafElement | null,
|
|
54
|
+
definition: TriggerNodeDefinition
|
|
55
|
+
): TriggerControl;
|
|
56
|
+
static from(
|
|
57
|
+
parent: GeneralParentNode,
|
|
58
|
+
instanceNode: StaticLeafElement | null,
|
|
59
|
+
definition: AnyTriggerNodeDefinition
|
|
60
|
+
): TriggerControl {
|
|
52
61
|
if (definition.valueType !== 'string') {
|
|
53
62
|
throw new ErrorProductionDesignPendingError(
|
|
54
63
|
`Unsupported trigger value type: ${definition.valueType}`
|
|
55
64
|
);
|
|
56
65
|
}
|
|
57
66
|
|
|
58
|
-
return new this(parent, definition);
|
|
67
|
+
return new this(parent, instanceNode, definition);
|
|
59
68
|
}
|
|
60
69
|
|
|
61
70
|
// XFormsXPathElement
|
|
@@ -71,15 +80,15 @@ export class TriggerControl
|
|
|
71
80
|
readonly nodeOptions = null;
|
|
72
81
|
readonly currentState: CurrentState<TriggerControlStateSpec>;
|
|
73
82
|
|
|
74
|
-
private constructor(
|
|
75
|
-
|
|
83
|
+
private constructor(
|
|
84
|
+
parent: GeneralParentNode,
|
|
85
|
+
instanceNode: StaticLeafElement | null,
|
|
86
|
+
definition: TriggerNodeDefinition<'string'>
|
|
87
|
+
) {
|
|
88
|
+
super(parent, instanceNode, definition, codec);
|
|
76
89
|
|
|
77
90
|
this.appearances = definition.bodyElement.appearances;
|
|
78
91
|
|
|
79
|
-
const sharedStateOptions = {
|
|
80
|
-
clientStateFactory: this.engineConfig.stateFactory,
|
|
81
|
-
};
|
|
82
|
-
|
|
83
92
|
const state = createSharedNodeState(
|
|
84
93
|
this.scope,
|
|
85
94
|
{
|
|
@@ -95,7 +104,7 @@ export class TriggerControl
|
|
|
95
104
|
value: this.valueState,
|
|
96
105
|
instanceValue: this.getInstanceValue,
|
|
97
106
|
},
|
|
98
|
-
|
|
107
|
+
this.instanceConfig
|
|
99
108
|
);
|
|
100
109
|
|
|
101
110
|
this.state = state;
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { XPathNodeKindKey } from '@getodk/xpath';
|
|
2
|
+
import type { Accessor } from 'solid-js';
|
|
3
|
+
import type { TextRange } from '../client/TextRange.ts';
|
|
4
|
+
import type { UploadDefinition, UploadNode, UploadNodeOptions } from '../client/UploadNode.ts';
|
|
5
|
+
import type { ValueType } from '../client/ValueType.ts';
|
|
6
|
+
import type { InstanceAttachmentFileName, InstanceState } from '../client/index.ts';
|
|
7
|
+
import type { AnyViolation, LeafNodeValidationState } from '../client/validation.ts';
|
|
8
|
+
import { UploadValueTypeError } from '../error/UploadValueTypeError.ts';
|
|
9
|
+
import type { XFormsXPathElement } from '../integration/xpath/adapter/XFormsXPathNode.ts';
|
|
10
|
+
import type { StaticLeafElement } from '../integration/xpath/static-dom/StaticElement.ts';
|
|
11
|
+
import { createValueNodeInstanceState } from '../lib/client-reactivity/instance-state/createValueNodeInstanceState.ts';
|
|
12
|
+
import { createInstanceAttachment } from '../lib/reactivity/createInstanceAttachment.ts';
|
|
13
|
+
import type { CurrentState } from '../lib/reactivity/node-state/createCurrentState.ts';
|
|
14
|
+
import type { EngineState } from '../lib/reactivity/node-state/createEngineState.ts';
|
|
15
|
+
import type { SharedNodeState } from '../lib/reactivity/node-state/createSharedNodeState.ts';
|
|
16
|
+
import { createSharedNodeState } from '../lib/reactivity/node-state/createSharedNodeState.ts';
|
|
17
|
+
import { createFieldHint } from '../lib/reactivity/text/createFieldHint.ts';
|
|
18
|
+
import { createNodeLabel } from '../lib/reactivity/text/createNodeLabel.ts';
|
|
19
|
+
import type { SimpleAtomicState } from '../lib/reactivity/types.ts';
|
|
20
|
+
import type { SharedValidationState } from '../lib/reactivity/validation/createValidation.ts';
|
|
21
|
+
import { createValidationState } from '../lib/reactivity/validation/createValidation.ts';
|
|
22
|
+
import type { UnknownAppearanceDefinition } from '../parse/body/appearance/unknownAppearanceParser.ts';
|
|
23
|
+
import type { Root } from './Root.ts';
|
|
24
|
+
import type { DescendantNodeStateSpec } from './abstract/DescendantNode.ts';
|
|
25
|
+
import { DescendantNode } from './abstract/DescendantNode.ts';
|
|
26
|
+
import type {
|
|
27
|
+
InstanceAttachment,
|
|
28
|
+
InstanceAttachmentRuntimeValue,
|
|
29
|
+
} from './attachments/InstanceAttachment.ts';
|
|
30
|
+
import type { GeneralParentNode } from './hierarchy.ts';
|
|
31
|
+
import type { EvaluationContext } from './internal-api/EvaluationContext.ts';
|
|
32
|
+
import type { InstanceAttachmentContext } from './internal-api/InstanceAttachmentContext.ts';
|
|
33
|
+
import type {
|
|
34
|
+
DecodeInstanceValue,
|
|
35
|
+
InstanceValueContext,
|
|
36
|
+
} from './internal-api/InstanceValueContext.ts';
|
|
37
|
+
import type { ValidationContext } from './internal-api/ValidationContext.ts';
|
|
38
|
+
import type { ClientReactiveSerializableValueNode } from './internal-api/serialization/ClientReactiveSerializableValueNode.ts';
|
|
39
|
+
|
|
40
|
+
export type AnyUploadDefinition = {
|
|
41
|
+
[V in ValueType]: UploadDefinition<V>;
|
|
42
|
+
}[ValueType];
|
|
43
|
+
|
|
44
|
+
type AssertUploadDefinition = (
|
|
45
|
+
definition: AnyUploadDefinition
|
|
46
|
+
) => asserts definition is UploadDefinition<'binary'>;
|
|
47
|
+
|
|
48
|
+
const assertUploadDefinition: AssertUploadDefinition = (definition) => {
|
|
49
|
+
const { valueType } = definition;
|
|
50
|
+
|
|
51
|
+
if (valueType !== 'binary') {
|
|
52
|
+
throw new UploadValueTypeError(definition);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
interface UploadControlStateSpec extends DescendantNodeStateSpec<InstanceAttachmentRuntimeValue> {
|
|
57
|
+
readonly label: Accessor<TextRange<'label'> | null>;
|
|
58
|
+
readonly hint: Accessor<TextRange<'hint'> | null>;
|
|
59
|
+
readonly children: null;
|
|
60
|
+
readonly valueOptions: null;
|
|
61
|
+
readonly value: SimpleAtomicState<InstanceAttachmentRuntimeValue>;
|
|
62
|
+
readonly instanceValue: Accessor<InstanceAttachmentFileName>;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export class UploadControl
|
|
66
|
+
extends DescendantNode<
|
|
67
|
+
UploadDefinition<'binary'>,
|
|
68
|
+
UploadControlStateSpec,
|
|
69
|
+
GeneralParentNode,
|
|
70
|
+
null
|
|
71
|
+
>
|
|
72
|
+
implements
|
|
73
|
+
UploadNode,
|
|
74
|
+
XFormsXPathElement,
|
|
75
|
+
EvaluationContext,
|
|
76
|
+
InstanceAttachmentContext,
|
|
77
|
+
InstanceValueContext,
|
|
78
|
+
ValidationContext,
|
|
79
|
+
ClientReactiveSerializableValueNode
|
|
80
|
+
{
|
|
81
|
+
static from(
|
|
82
|
+
parent: GeneralParentNode,
|
|
83
|
+
instanceNode: StaticLeafElement | null,
|
|
84
|
+
definition: UploadDefinition
|
|
85
|
+
): UploadControl;
|
|
86
|
+
static from(
|
|
87
|
+
parent: GeneralParentNode,
|
|
88
|
+
instanceNode: StaticLeafElement | null,
|
|
89
|
+
definition: AnyUploadDefinition
|
|
90
|
+
): UploadControl {
|
|
91
|
+
assertUploadDefinition(definition);
|
|
92
|
+
|
|
93
|
+
return new this(parent, instanceNode, definition);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
private readonly validation: SharedValidationState;
|
|
97
|
+
private readonly instanceAttachment: InstanceAttachment;
|
|
98
|
+
|
|
99
|
+
// XFormsXPathElement
|
|
100
|
+
override readonly [XPathNodeKindKey] = 'element';
|
|
101
|
+
override readonly getXPathValue: () => InstanceAttachmentFileName;
|
|
102
|
+
|
|
103
|
+
// InstanceNode
|
|
104
|
+
protected readonly state: SharedNodeState<UploadControlStateSpec>;
|
|
105
|
+
protected readonly engineState: EngineState<UploadControlStateSpec>;
|
|
106
|
+
|
|
107
|
+
// InstanceValueContext
|
|
108
|
+
readonly decodeInstanceValue: DecodeInstanceValue;
|
|
109
|
+
|
|
110
|
+
// UploadNode
|
|
111
|
+
readonly nodeType = 'upload';
|
|
112
|
+
readonly valueType = 'binary';
|
|
113
|
+
readonly appearances: UnknownAppearanceDefinition;
|
|
114
|
+
readonly nodeOptions: UploadNodeOptions;
|
|
115
|
+
readonly currentState: CurrentState<UploadControlStateSpec>;
|
|
116
|
+
|
|
117
|
+
get validationState(): LeafNodeValidationState {
|
|
118
|
+
return this.validation.currentState;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
readonly instanceState: InstanceState;
|
|
122
|
+
|
|
123
|
+
private constructor(
|
|
124
|
+
parent: GeneralParentNode,
|
|
125
|
+
override readonly instanceNode: StaticLeafElement | null,
|
|
126
|
+
definition: UploadDefinition<'binary'>
|
|
127
|
+
) {
|
|
128
|
+
super(parent, instanceNode, definition);
|
|
129
|
+
|
|
130
|
+
this.appearances = definition.bodyElement.appearances;
|
|
131
|
+
this.nodeOptions = definition.bodyElement.options;
|
|
132
|
+
|
|
133
|
+
const instanceAttachment = createInstanceAttachment(this);
|
|
134
|
+
|
|
135
|
+
this.instanceAttachment = instanceAttachment;
|
|
136
|
+
this.decodeInstanceValue = instanceAttachment.decodeInstanceValue;
|
|
137
|
+
this.getXPathValue = instanceAttachment.getInstanceValue;
|
|
138
|
+
|
|
139
|
+
const state = createSharedNodeState(
|
|
140
|
+
this.scope,
|
|
141
|
+
{
|
|
142
|
+
reference: this.contextReference,
|
|
143
|
+
readonly: this.isReadonly,
|
|
144
|
+
relevant: this.isRelevant,
|
|
145
|
+
required: this.isRequired,
|
|
146
|
+
|
|
147
|
+
label: createNodeLabel(this, definition),
|
|
148
|
+
hint: createFieldHint(this, definition),
|
|
149
|
+
children: null,
|
|
150
|
+
valueOptions: null,
|
|
151
|
+
value: instanceAttachment.valueState,
|
|
152
|
+
instanceValue: instanceAttachment.getInstanceValue,
|
|
153
|
+
},
|
|
154
|
+
this.instanceConfig
|
|
155
|
+
);
|
|
156
|
+
|
|
157
|
+
this.state = state;
|
|
158
|
+
this.engineState = state.engineState;
|
|
159
|
+
this.currentState = state.currentState;
|
|
160
|
+
this.validation = createValidationState(this, this.instanceConfig);
|
|
161
|
+
this.instanceState = createValueNodeInstanceState(this);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// ValidationContext
|
|
165
|
+
getViolation(): AnyViolation | null {
|
|
166
|
+
return this.validation.engineState.violation;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
isBlank(): boolean {
|
|
170
|
+
return this.getXPathValue() === '';
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// InstanceNode
|
|
174
|
+
getChildren(): readonly [] {
|
|
175
|
+
return [];
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// UploadNode
|
|
179
|
+
setValue(value: InstanceAttachmentRuntimeValue): Root {
|
|
180
|
+
this.instanceAttachment.setValue(value);
|
|
181
|
+
|
|
182
|
+
return this.root;
|
|
183
|
+
}
|
|
184
|
+
}
|