@getodk/xforms-engine 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -0
- package/dist/.vite/manifest.json +7 -0
- package/dist/XFormDOM.d.ts +31 -0
- package/dist/XFormDataType.d.ts +26 -0
- package/dist/XFormDefinition.d.ts +14 -0
- package/dist/body/BodyDefinition.d.ts +52 -0
- package/dist/body/BodyElementDefinition.d.ts +32 -0
- package/dist/body/RepeatDefinition.d.ts +15 -0
- package/dist/body/UnsupportedBodyElementDefinition.d.ts +10 -0
- package/dist/body/control/ControlDefinition.d.ts +16 -0
- package/dist/body/control/InputDefinition.d.ts +5 -0
- package/dist/body/control/select/ItemDefinition.d.ts +13 -0
- package/dist/body/control/select/ItemsetDefinition.d.ts +16 -0
- package/dist/body/control/select/ItemsetNodesetContext.d.ts +11 -0
- package/dist/body/control/select/ItemsetNodesetExpression.d.ts +5 -0
- package/dist/body/control/select/ItemsetValueExpression.d.ts +6 -0
- package/dist/body/control/select/SelectDefinition.d.ts +23 -0
- package/dist/body/group/BaseGroupDefinition.d.ts +46 -0
- package/dist/body/group/LogicalGroupDefinition.d.ts +6 -0
- package/dist/body/group/PresentationGroupDefinition.d.ts +11 -0
- package/dist/body/group/RepeatGroupDefinition.d.ts +12 -0
- package/dist/body/group/StructuralGroupDefinition.d.ts +6 -0
- package/dist/body/text/HintDefinition.d.ts +11 -0
- package/dist/body/text/LabelDefinition.d.ts +20 -0
- package/dist/body/text/TextElementDefinition.d.ts +32 -0
- package/dist/body/text/TextElementOutputPart.d.ts +12 -0
- package/dist/body/text/TextElementPart.d.ts +12 -0
- package/dist/body/text/TextElementReferencePart.d.ts +6 -0
- package/dist/body/text/TextElementStaticPart.d.ts +6 -0
- package/dist/client/BaseNode.d.ts +138 -0
- package/dist/client/EngineConfig.d.ts +78 -0
- package/dist/client/FormLanguage.d.ts +63 -0
- package/dist/client/GroupNode.d.ts +24 -0
- package/dist/client/OpaqueReactiveObjectFactory.d.ts +70 -0
- package/dist/client/RepeatInstanceNode.d.ts +28 -0
- package/dist/client/RepeatRangeNode.d.ts +94 -0
- package/dist/client/RootNode.d.ts +31 -0
- package/dist/client/SelectNode.d.ts +60 -0
- package/dist/client/StringNode.d.ts +41 -0
- package/dist/client/SubtreeNode.d.ts +52 -0
- package/dist/client/TextRange.d.ts +55 -0
- package/dist/client/hierarchy.d.ts +48 -0
- package/dist/client/index.d.ts +11 -0
- package/dist/client/node-types.d.ts +1 -0
- package/dist/expression/DependencyContext.d.ts +12 -0
- package/dist/expression/DependentExpression.d.ts +43 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +37622 -0
- package/dist/index.js.map +1 -0
- package/dist/instance/Group.d.ts +31 -0
- package/dist/instance/RepeatInstance.d.ts +60 -0
- package/dist/instance/RepeatRange.d.ts +81 -0
- package/dist/instance/Root.d.ts +70 -0
- package/dist/instance/SelectField.d.ts +45 -0
- package/dist/instance/StringField.d.ts +39 -0
- package/dist/instance/Subtree.d.ts +30 -0
- package/dist/instance/abstract/DescendantNode.d.ts +76 -0
- package/dist/instance/abstract/InstanceNode.d.ts +107 -0
- package/dist/instance/children.d.ts +2 -0
- package/dist/instance/hierarchy.d.ts +12 -0
- package/dist/instance/identity.d.ts +7 -0
- package/dist/instance/index.d.ts +8 -0
- package/dist/instance/internal-api/EvaluationContext.d.ts +34 -0
- package/dist/instance/internal-api/InstanceConfig.d.ts +8 -0
- package/dist/instance/internal-api/SubscribableDependency.d.ts +59 -0
- package/dist/instance/internal-api/TranslationContext.d.ts +4 -0
- package/dist/instance/internal-api/ValueContext.d.ts +22 -0
- package/dist/instance/resource.d.ts +10 -0
- package/dist/instance/text/FormattedTextStub.d.ts +1 -0
- package/dist/instance/text/TextChunk.d.ts +11 -0
- package/dist/instance/text/TextRange.d.ts +10 -0
- package/dist/lib/dom/query.d.ts +20 -0
- package/dist/lib/reactivity/createChildrenState.d.ts +36 -0
- package/dist/lib/reactivity/createComputedExpression.d.ts +12 -0
- package/dist/lib/reactivity/createSelectItems.d.ts +16 -0
- package/dist/lib/reactivity/createValueState.d.ts +44 -0
- package/dist/lib/reactivity/materializeCurrentStateChildren.d.ts +18 -0
- package/dist/lib/reactivity/node-state/createClientState.d.ts +9 -0
- package/dist/lib/reactivity/node-state/createCurrentState.d.ts +6 -0
- package/dist/lib/reactivity/node-state/createEngineState.d.ts +5 -0
- package/dist/lib/reactivity/node-state/createSharedNodeState.d.ts +22 -0
- package/dist/lib/reactivity/node-state/createSpecifiedPropertyDescriptor.d.ts +6 -0
- package/dist/lib/reactivity/node-state/createSpecifiedState.d.ts +139 -0
- package/dist/lib/reactivity/node-state/representations.d.ts +25 -0
- package/dist/lib/reactivity/scope.d.ts +23 -0
- package/dist/lib/reactivity/text/createFieldHint.d.ts +5 -0
- package/dist/lib/reactivity/text/createNodeLabel.d.ts +5 -0
- package/dist/lib/reactivity/text/createTextRange.d.ts +19 -0
- package/dist/lib/reactivity/types.d.ts +21 -0
- package/dist/lib/unique-id.d.ts +27 -0
- package/dist/lib/xpath/analysis.d.ts +22 -0
- package/dist/model/BindComputation.d.ts +30 -0
- package/dist/model/BindDefinition.d.ts +31 -0
- package/dist/model/BindElement.d.ts +6 -0
- package/dist/model/DescendentNodeDefinition.d.ts +25 -0
- package/dist/model/ModelBindMap.d.ts +15 -0
- package/dist/model/ModelDefinition.d.ts +10 -0
- package/dist/model/NodeDefinition.d.ts +74 -0
- package/dist/model/RepeatInstanceDefinition.d.ts +15 -0
- package/dist/model/RepeatSequenceDefinition.d.ts +19 -0
- package/dist/model/RepeatTemplateDefinition.d.ts +29 -0
- package/dist/model/RootDefinition.d.ts +24 -0
- package/dist/model/SubtreeDefinition.d.ts +14 -0
- package/dist/model/ValueNodeDefinition.d.ts +15 -0
- package/dist/solid.js +37273 -0
- package/dist/solid.js.map +1 -0
- package/package.json +87 -0
- package/src/XFormDOM.ts +224 -0
- package/src/XFormDataType.ts +64 -0
- package/src/XFormDefinition.ts +40 -0
- package/src/body/BodyDefinition.ts +202 -0
- package/src/body/BodyElementDefinition.ts +62 -0
- package/src/body/RepeatDefinition.ts +54 -0
- package/src/body/UnsupportedBodyElementDefinition.ts +17 -0
- package/src/body/control/ControlDefinition.ts +42 -0
- package/src/body/control/InputDefinition.ts +9 -0
- package/src/body/control/select/ItemDefinition.ts +31 -0
- package/src/body/control/select/ItemsetDefinition.ts +36 -0
- package/src/body/control/select/ItemsetNodesetContext.ts +26 -0
- package/src/body/control/select/ItemsetNodesetExpression.ts +8 -0
- package/src/body/control/select/ItemsetValueExpression.ts +11 -0
- package/src/body/control/select/SelectDefinition.ts +74 -0
- package/src/body/group/BaseGroupDefinition.ts +137 -0
- package/src/body/group/LogicalGroupDefinition.ts +11 -0
- package/src/body/group/PresentationGroupDefinition.ts +28 -0
- package/src/body/group/RepeatGroupDefinition.ts +91 -0
- package/src/body/group/StructuralGroupDefinition.ts +11 -0
- package/src/body/text/HintDefinition.ts +26 -0
- package/src/body/text/LabelDefinition.ts +54 -0
- package/src/body/text/TextElementDefinition.ts +97 -0
- package/src/body/text/TextElementOutputPart.ts +27 -0
- package/src/body/text/TextElementPart.ts +31 -0
- package/src/body/text/TextElementReferencePart.ts +21 -0
- package/src/body/text/TextElementStaticPart.ts +26 -0
- package/src/client/BaseNode.ts +180 -0
- package/src/client/EngineConfig.ts +83 -0
- package/src/client/FormLanguage.ts +77 -0
- package/src/client/GroupNode.ts +33 -0
- package/src/client/OpaqueReactiveObjectFactory.ts +100 -0
- package/src/client/README.md +39 -0
- package/src/client/RepeatInstanceNode.ts +41 -0
- package/src/client/RepeatRangeNode.ts +100 -0
- package/src/client/RootNode.ts +36 -0
- package/src/client/SelectNode.ts +69 -0
- package/src/client/StringNode.ts +46 -0
- package/src/client/SubtreeNode.ts +57 -0
- package/src/client/TextRange.ts +63 -0
- package/src/client/hierarchy.ts +63 -0
- package/src/client/index.ts +29 -0
- package/src/client/node-types.ts +10 -0
- package/src/expression/DependencyContext.ts +53 -0
- package/src/expression/DependentExpression.ts +102 -0
- package/src/index.ts +35 -0
- package/src/instance/Group.ts +82 -0
- package/src/instance/RepeatInstance.ts +164 -0
- package/src/instance/RepeatRange.ts +214 -0
- package/src/instance/Root.ts +264 -0
- package/src/instance/SelectField.ts +204 -0
- package/src/instance/StringField.ts +93 -0
- package/src/instance/Subtree.ts +79 -0
- package/src/instance/abstract/DescendantNode.ts +182 -0
- package/src/instance/abstract/InstanceNode.ts +257 -0
- package/src/instance/children.ts +52 -0
- package/src/instance/hierarchy.ts +54 -0
- package/src/instance/identity.ts +11 -0
- package/src/instance/index.ts +37 -0
- package/src/instance/internal-api/EvaluationContext.ts +41 -0
- package/src/instance/internal-api/InstanceConfig.ts +9 -0
- package/src/instance/internal-api/SubscribableDependency.ts +61 -0
- package/src/instance/internal-api/TranslationContext.ts +5 -0
- package/src/instance/internal-api/ValueContext.ts +27 -0
- package/src/instance/resource.ts +75 -0
- package/src/instance/text/FormattedTextStub.ts +8 -0
- package/src/instance/text/TextChunk.ts +20 -0
- package/src/instance/text/TextRange.ts +23 -0
- package/src/lib/dom/query.ts +49 -0
- package/src/lib/reactivity/createChildrenState.ts +60 -0
- package/src/lib/reactivity/createComputedExpression.ts +114 -0
- package/src/lib/reactivity/createSelectItems.ts +163 -0
- package/src/lib/reactivity/createValueState.ts +258 -0
- package/src/lib/reactivity/materializeCurrentStateChildren.ts +121 -0
- package/src/lib/reactivity/node-state/createClientState.ts +51 -0
- package/src/lib/reactivity/node-state/createCurrentState.ts +27 -0
- package/src/lib/reactivity/node-state/createEngineState.ts +18 -0
- package/src/lib/reactivity/node-state/createSharedNodeState.ts +79 -0
- package/src/lib/reactivity/node-state/createSpecifiedPropertyDescriptor.ts +85 -0
- package/src/lib/reactivity/node-state/createSpecifiedState.ts +229 -0
- package/src/lib/reactivity/node-state/representations.ts +64 -0
- package/src/lib/reactivity/scope.ts +106 -0
- package/src/lib/reactivity/text/createFieldHint.ts +16 -0
- package/src/lib/reactivity/text/createNodeLabel.ts +16 -0
- package/src/lib/reactivity/text/createTextRange.ts +155 -0
- package/src/lib/reactivity/types.ts +27 -0
- package/src/lib/unique-id.ts +34 -0
- package/src/lib/xpath/analysis.ts +241 -0
- package/src/model/BindComputation.ts +88 -0
- package/src/model/BindDefinition.ts +104 -0
- package/src/model/BindElement.ts +8 -0
- package/src/model/DescendentNodeDefinition.ts +56 -0
- package/src/model/ModelBindMap.ts +71 -0
- package/src/model/ModelDefinition.ts +19 -0
- package/src/model/NodeDefinition.ts +146 -0
- package/src/model/RepeatInstanceDefinition.ts +39 -0
- package/src/model/RepeatSequenceDefinition.ts +53 -0
- package/src/model/RepeatTemplateDefinition.ts +150 -0
- package/src/model/RootDefinition.ts +121 -0
- package/src/model/SubtreeDefinition.ts +50 -0
- package/src/model/ValueNodeDefinition.ts +39 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { SubtreeDefinition as BaseSubtreeDefinition } from '../model/SubtreeDefinition.ts';
|
|
2
|
+
import type { BaseNode, BaseNodeState } from './BaseNode.ts';
|
|
3
|
+
import type { RootNode } from './RootNode.ts';
|
|
4
|
+
import type { GeneralChildNode, GeneralParentNode } from './hierarchy.ts';
|
|
5
|
+
export interface SubtreeNodeState extends BaseNodeState {
|
|
6
|
+
get label(): null;
|
|
7
|
+
get hint(): null;
|
|
8
|
+
get children(): readonly GeneralChildNode[];
|
|
9
|
+
get valueOptions(): null;
|
|
10
|
+
get value(): null;
|
|
11
|
+
}
|
|
12
|
+
export interface SubtreeDefinition extends BaseSubtreeDefinition {
|
|
13
|
+
readonly bodyElement: null;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A non-root node which has children, but **no** corresponding XForms
|
|
17
|
+
* `<group>`. A subtree node does not have any direct implications for
|
|
18
|
+
* presentation to users, but its descendants may specify presentational details
|
|
19
|
+
* in their own {@link BaseNode.definition | definition}s.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
*
|
|
23
|
+
* A common `SubtreeNode` case will be a form's `<meta>` element:
|
|
24
|
+
*
|
|
25
|
+
* ```xml
|
|
26
|
+
* <!-- /h:html/h:head/model -->
|
|
27
|
+
* <instance>
|
|
28
|
+
* <data>
|
|
29
|
+
* <some-group>
|
|
30
|
+
* <some-field />
|
|
31
|
+
* </some-group>
|
|
32
|
+
* <!-- Note that `meta` does not have a corresponding group body element -->
|
|
33
|
+
* <!-- SubtreeNode(/data/meta): { ... -->
|
|
34
|
+
* <meta>
|
|
35
|
+
* <instanceID/>
|
|
36
|
+
* </meta>
|
|
37
|
+
* <!-- } -->
|
|
38
|
+
* </data>
|
|
39
|
+
* </instance>
|
|
40
|
+
* <!-- /h:html/h:body -->
|
|
41
|
+
* <group ref="/data/some-group">
|
|
42
|
+
* <input ref="/data/some-group/some-field" />
|
|
43
|
+
* </group>
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export interface SubtreeNode extends BaseNode {
|
|
47
|
+
readonly nodeType: 'subtree';
|
|
48
|
+
readonly definition: SubtreeDefinition;
|
|
49
|
+
readonly root: RootNode;
|
|
50
|
+
readonly parent: GeneralParentNode;
|
|
51
|
+
readonly currentState: SubtreeNodeState;
|
|
52
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { ActiveLanguage } from './FormLanguage.ts';
|
|
2
|
+
export type TextChunkSource = 'itext' | 'output' | 'static';
|
|
3
|
+
/**
|
|
4
|
+
* @todo This (and everything else to do with {@link TextRange}s is for
|
|
5
|
+
* illustration purposes, as a starting point where any particular detail is of
|
|
6
|
+
* unknown utility. We can iterate on all aspects of text ranges in actual
|
|
7
|
+
* clients and refine from there.
|
|
8
|
+
*
|
|
9
|
+
* @see {@link TextRange}
|
|
10
|
+
*/
|
|
11
|
+
export interface TextChunk {
|
|
12
|
+
readonly source: TextChunkSource;
|
|
13
|
+
/**
|
|
14
|
+
* @see {@link ActiveLanguage} for additional commentary
|
|
15
|
+
*/
|
|
16
|
+
get language(): ActiveLanguage;
|
|
17
|
+
get asString(): string;
|
|
18
|
+
get formatted(): unknown;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Represents aspects of a form which produce text, which _might_ be:
|
|
22
|
+
*
|
|
23
|
+
* - Computed from multiple sources
|
|
24
|
+
* - Capable of conveying certain formatting (which may be presentational and/or
|
|
25
|
+
* structural)
|
|
26
|
+
*
|
|
27
|
+
* Computed text values may be updated by:
|
|
28
|
+
*
|
|
29
|
+
* - Changing a {@link RootNodeState.activeLanguage | form's active language}
|
|
30
|
+
* - Changes to any state referenced by an
|
|
31
|
+
* {@link https://getodk.github.io/xforms-spec/#body-elements | output},
|
|
32
|
+
* within any text-presenting aspect of a form (e.g. labels and hints, as well
|
|
33
|
+
* as itext translations referenced by those)
|
|
34
|
+
*
|
|
35
|
+
* As a client interface, the intent is to convey that this text may be dynamic
|
|
36
|
+
* (and thus potentially reactive for clients supplying a
|
|
37
|
+
* {@link OpaqueReactiveObjectFactory}), and may produce multiple spans of text
|
|
38
|
+
* (or none at all) depending on the structure and state of the form.
|
|
39
|
+
*
|
|
40
|
+
* @todo This interface should be considered **incomplete and in flux**, and
|
|
41
|
+
* subject to change as we evaluate client needs and engine responsibilities. In
|
|
42
|
+
* particular, we've deferred a notion of an interface for formatting aspects,
|
|
43
|
+
* while leaving open the possibility that it may come in future iterations.
|
|
44
|
+
*
|
|
45
|
+
* {@link role} is intended to convey that individual text ranges may be
|
|
46
|
+
* reasoned about differently by clients depending on their role (for instance,
|
|
47
|
+
* a text range's role may correspond to the "short" or "guidance" `form` of a
|
|
48
|
+
* {@link https://getodk.github.io/xforms-spec/#languages | translation}).
|
|
49
|
+
*/
|
|
50
|
+
export interface TextRange<Role extends string | null = null> {
|
|
51
|
+
readonly role: Role;
|
|
52
|
+
[Symbol.iterator](): Iterable<TextChunk>;
|
|
53
|
+
get asString(): string;
|
|
54
|
+
get formatted(): unknown;
|
|
55
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ExpandUnion } from '../../../common/types/helpers.d.ts';
|
|
2
|
+
import type { GroupNode } from './GroupNode.ts';
|
|
3
|
+
import type { RepeatInstanceNode } from './RepeatInstanceNode.ts';
|
|
4
|
+
import type { RepeatRangeNode } from './RepeatRangeNode.ts';
|
|
5
|
+
import type { RootNode } from './RootNode.ts';
|
|
6
|
+
import type { SelectNode } from './SelectNode.ts';
|
|
7
|
+
import type { StringNode } from './StringNode.ts';
|
|
8
|
+
import type { SubtreeNode } from './SubtreeNode.ts';
|
|
9
|
+
export type AnyLeafNode = SelectNode | StringNode;
|
|
10
|
+
/**
|
|
11
|
+
* Any of the concrete node types which may be a parent of any other node.
|
|
12
|
+
*
|
|
13
|
+
* This is an intermediate type, which shouldn't be referenced by other concrete
|
|
14
|
+
* node types directly. Instead:
|
|
15
|
+
*
|
|
16
|
+
* - Repeat instances should (continue to) specify {@link RepeatRangeNode}.
|
|
17
|
+
* - All other child nodes should specify {@link GeneralParentNode}.
|
|
18
|
+
*/
|
|
19
|
+
export type AnyParentNode = RootNode | SubtreeNode | GroupNode | RepeatRangeNode | RepeatInstanceNode;
|
|
20
|
+
/**
|
|
21
|
+
* Any of the concrete node types a client may get from the engine's form
|
|
22
|
+
* representation. This union should be updated when any new concrete node type
|
|
23
|
+
* is added (or when any of the current members is changed/removed).
|
|
24
|
+
*
|
|
25
|
+
* @see {@link GeneralParentNode}, which is derived from this type
|
|
26
|
+
* @see {@link GeneralChildNode}, which is derived from this type
|
|
27
|
+
*/
|
|
28
|
+
export type AnyNode = ExpandUnion<AnyLeafNode | AnyParentNode>;
|
|
29
|
+
/**
|
|
30
|
+
* Any of the concrete node types which may be a parent of non-repeat instance
|
|
31
|
+
* child nodes.
|
|
32
|
+
*/
|
|
33
|
+
export type GeneralParentNode = Exclude<AnyParentNode, RepeatRangeNode>;
|
|
34
|
+
/**
|
|
35
|
+
* Any of the concrete node types which may be a child of any other node.
|
|
36
|
+
*
|
|
37
|
+
* This is an intermediate type, which shouldn't be referenced by other concrete
|
|
38
|
+
* node types directly. Instead:
|
|
39
|
+
*
|
|
40
|
+
* - Repeat ranges should (continue to) specify {@link RepeatInstanceNode}.
|
|
41
|
+
* - All other parent nodes should specify {@link GeneralChildNode}.
|
|
42
|
+
*/
|
|
43
|
+
export type AnyChildNode = Exclude<AnyNode, RootNode>;
|
|
44
|
+
/**
|
|
45
|
+
* Any of the concrete node types which may be a child of non-repeat range
|
|
46
|
+
* parent nodes.
|
|
47
|
+
*/
|
|
48
|
+
export type GeneralChildNode = Exclude<AnyChildNode, RepeatInstanceNode>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { EngineConfig } from './EngineConfig.ts';
|
|
2
|
+
import type { RootNode } from './RootNode.ts';
|
|
3
|
+
export type FormResource = Blob | URL | string;
|
|
4
|
+
export interface InitializeFormOptions {
|
|
5
|
+
readonly config: EngineConfig;
|
|
6
|
+
readonly initialState?: FormResource;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Creates an instance of a form to be filled (or edited) by a client.
|
|
10
|
+
*/
|
|
11
|
+
export type InitializeForm = (input: FormResource, options?: InitializeFormOptions) => Promise<RootNode>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type InstanceNodeType = 'root' | 'repeat-range' | 'repeat-instance' | 'group' | 'subtree' | 'select' | 'string';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AnyDependentExpression } from './DependentExpression.ts';
|
|
2
|
+
export declare abstract class DependencyContext {
|
|
3
|
+
abstract get parentReference(): string | null;
|
|
4
|
+
abstract get reference(): string | null;
|
|
5
|
+
protected readonly dependentExpressions: Set<AnyDependentExpression>;
|
|
6
|
+
protected dependencyExpressionsCache: ReadonlySet<string> | null;
|
|
7
|
+
get dependencyExpressions(): ReadonlySet<string>;
|
|
8
|
+
get isTranslated(): boolean;
|
|
9
|
+
set isTranslated(value: true);
|
|
10
|
+
protected _isTranslated: boolean;
|
|
11
|
+
registerDependentExpression(expression: AnyDependentExpression): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { XFormsXPathEvaluator } from '@getodk/xpath';
|
|
2
|
+
import type { DependencyContext } from './DependencyContext.ts';
|
|
3
|
+
declare const evaluatorMethodsByResultType: {
|
|
4
|
+
readonly boolean: "evaluateBoolean";
|
|
5
|
+
readonly nodes: "evaluateNodes";
|
|
6
|
+
readonly string: "evaluateString";
|
|
7
|
+
};
|
|
8
|
+
type EvaluatorMethodsByResultType = typeof evaluatorMethodsByResultType;
|
|
9
|
+
export type DependentExpressionResultType = keyof EvaluatorMethodsByResultType;
|
|
10
|
+
export type DependentExpressionEvaluatorMethod<Type extends DependentExpressionResultType> = EvaluatorMethodsByResultType[Type];
|
|
11
|
+
export type DependentExpressionResult<Type extends DependentExpressionResultType> = ReturnType<XFormsXPathEvaluator[DependentExpressionEvaluatorMethod<Type>]>;
|
|
12
|
+
interface SemanticDependencyOptions {
|
|
13
|
+
/**
|
|
14
|
+
* @default false
|
|
15
|
+
*/
|
|
16
|
+
readonly parentContext?: boolean | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* @default false
|
|
19
|
+
*/
|
|
20
|
+
readonly translations?: boolean | undefined;
|
|
21
|
+
}
|
|
22
|
+
interface DependentExpressionOptions {
|
|
23
|
+
/**
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
readonly ignoreContextReference?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* @default true
|
|
29
|
+
*/
|
|
30
|
+
readonly ignoreNullExpressions?: boolean;
|
|
31
|
+
readonly semanticDependencies?: SemanticDependencyOptions;
|
|
32
|
+
}
|
|
33
|
+
export declare class DependentExpression<Type extends DependentExpressionResultType> {
|
|
34
|
+
readonly resultType: Type;
|
|
35
|
+
readonly expression: string;
|
|
36
|
+
readonly dependencyReferences: ReadonlySet<string>;
|
|
37
|
+
readonly isTranslated: boolean;
|
|
38
|
+
readonly evaluatorMethod: DependentExpressionEvaluatorMethod<Type>;
|
|
39
|
+
constructor(context: DependencyContext, resultType: Type, expression: string, options?: DependentExpressionOptions);
|
|
40
|
+
toString(): string | null;
|
|
41
|
+
}
|
|
42
|
+
export type AnyDependentExpression = DependentExpression<any>;
|
|
43
|
+
export {};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { InitializeForm } from './index.ts';
|
|
2
|
+
export declare const initializeForm: InitializeForm;
|
|
3
|
+
export type * from './client/EngineConfig.ts';
|
|
4
|
+
export type * from './client/FormLanguage.ts';
|
|
5
|
+
export type * from './client/GroupNode.ts';
|
|
6
|
+
export type * from './client/OpaqueReactiveObjectFactory.ts';
|
|
7
|
+
export type * from './client/RepeatInstanceNode.ts';
|
|
8
|
+
export type * from './client/RepeatRangeNode.ts';
|
|
9
|
+
export type * from './client/RootNode.ts';
|
|
10
|
+
export type * from './client/SelectNode.ts';
|
|
11
|
+
export type * from './client/StringNode.ts';
|
|
12
|
+
export type * from './client/SubtreeNode.ts';
|
|
13
|
+
export type * from './client/TextRange.ts';
|
|
14
|
+
export type { AnyChildNode, AnyLeafNode, AnyNode, AnyParentNode, GeneralChildNode, GeneralParentNode, } from './client/hierarchy.ts';
|
|
15
|
+
export type * from './client/index.ts';
|
|
16
|
+
export type { AnySelectDefinition, SelectDefinition, } from './body/control/select/SelectDefinition.ts';
|