@getodk/xforms-engine 0.1.0 → 0.2.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/.vite/manifest.json +1 -0
- package/dist/XFormDOM.d.ts +1 -0
- package/dist/XFormDataType.d.ts +2 -1
- package/dist/XFormDefinition.d.ts +1 -0
- package/dist/body/BodyDefinition.d.ts +27 -9
- package/dist/body/BodyElementDefinition.d.ts +5 -4
- package/dist/body/RepeatElementDefinition.d.ts +19 -0
- package/dist/body/UnsupportedBodyElementDefinition.d.ts +3 -2
- package/dist/body/appearance/inputAppearanceParser.d.ts +4 -0
- package/dist/body/appearance/selectAppearanceParser.d.ts +4 -0
- package/dist/body/appearance/structureElementAppearanceParser.d.ts +4 -0
- package/dist/body/control/ControlDefinition.d.ts +5 -2
- package/dist/body/control/InputDefinition.d.ts +6 -0
- package/dist/body/control/select/ItemDefinition.d.ts +4 -3
- package/dist/body/control/select/ItemsetDefinition.d.ts +4 -3
- package/dist/body/control/select/ItemsetNodesetContext.d.ts +3 -2
- package/dist/body/control/select/ItemsetNodesetExpression.d.ts +2 -1
- package/dist/body/control/select/ItemsetValueExpression.d.ts +2 -1
- package/dist/body/control/select/SelectDefinition.d.ts +16 -5
- package/dist/body/group/BaseGroupDefinition.d.ts +6 -10
- package/dist/body/group/LogicalGroupDefinition.d.ts +1 -0
- package/dist/body/group/PresentationGroupDefinition.d.ts +3 -2
- package/dist/body/group/StructuralGroupDefinition.d.ts +1 -0
- package/dist/body/text/HintDefinition.d.ts +4 -4
- package/dist/body/text/LabelDefinition.d.ts +9 -7
- package/dist/body/text/TextElementDefinition.d.ts +9 -8
- package/dist/body/text/TextElementOutputPart.d.ts +2 -1
- package/dist/body/text/TextElementPart.d.ts +5 -4
- package/dist/body/text/TextElementReferencePart.d.ts +2 -1
- package/dist/body/text/TextElementStaticPart.d.ts +2 -1
- package/dist/client/BaseNode.d.ts +9 -3
- package/dist/client/EngineConfig.d.ts +2 -1
- package/dist/client/GroupNode.d.ts +10 -6
- package/dist/client/NodeAppearances.d.ts +15 -0
- package/dist/client/RepeatInstanceNode.d.ts +10 -6
- package/dist/client/RepeatRangeNode.d.ts +11 -7
- package/dist/client/RootNode.d.ts +24 -4
- package/dist/client/SelectNode.d.ts +10 -6
- package/dist/client/StringNode.d.ts +9 -5
- package/dist/client/SubtreeNode.d.ts +6 -4
- package/dist/client/TextRange.d.ts +2 -1
- package/dist/client/hierarchy.d.ts +9 -8
- package/dist/client/index.d.ts +3 -2
- package/dist/expression/DependencyContext.d.ts +2 -1
- package/dist/expression/DependentExpression.d.ts +3 -2
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1882 -1757
- package/dist/index.js.map +1 -1
- package/dist/instance/Group.d.ts +15 -15
- package/dist/instance/RepeatInstance.d.ts +39 -15
- package/dist/instance/RepeatRange.d.ts +98 -20
- package/dist/instance/Root.d.ts +25 -39
- package/dist/instance/SelectField.d.ts +17 -17
- package/dist/instance/StringField.d.ts +17 -17
- package/dist/instance/Subtree.d.ts +13 -13
- package/dist/instance/abstract/DescendantNode.d.ts +26 -18
- package/dist/instance/abstract/InstanceNode.d.ts +44 -46
- package/dist/instance/children.d.ts +2 -1
- package/dist/instance/hierarchy.d.ts +8 -7
- package/dist/instance/index.d.ts +4 -3
- package/dist/instance/internal-api/EvaluationContext.d.ts +10 -8
- package/dist/instance/internal-api/InstanceConfig.d.ts +3 -2
- package/dist/instance/internal-api/SubscribableDependency.d.ts +2 -1
- package/dist/instance/internal-api/TranslationContext.d.ts +2 -1
- package/dist/instance/internal-api/ValueContext.d.ts +6 -5
- package/dist/instance/resource.d.ts +3 -2
- package/dist/instance/text/TextChunk.d.ts +4 -3
- package/dist/instance/text/TextRange.d.ts +2 -1
- package/dist/lib/TokenListParser.d.ts +84 -0
- package/dist/lib/dom/query.d.ts +8 -2
- package/dist/lib/reactivity/createChildrenState.d.ts +4 -3
- package/dist/lib/reactivity/createComputedExpression.d.ts +4 -3
- package/dist/lib/reactivity/createSelectItems.d.ts +4 -3
- package/dist/lib/reactivity/createValueState.d.ts +3 -2
- package/dist/lib/reactivity/materializeCurrentStateChildren.d.ts +6 -4
- package/dist/lib/reactivity/node-state/createClientState.d.ts +7 -6
- package/dist/lib/reactivity/node-state/createCurrentState.d.ts +5 -4
- package/dist/lib/reactivity/node-state/createEngineState.d.ts +4 -3
- package/dist/lib/reactivity/node-state/createSharedNodeState.d.ts +7 -6
- package/dist/lib/reactivity/node-state/createSpecifiedPropertyDescriptor.d.ts +2 -1
- package/dist/lib/reactivity/node-state/createSpecifiedState.d.ts +3 -2
- package/dist/lib/reactivity/node-state/representations.d.ts +2 -1
- package/dist/lib/reactivity/scope.d.ts +2 -1
- package/dist/lib/reactivity/text/createFieldHint.d.ts +4 -3
- package/dist/lib/reactivity/text/createNodeLabel.d.ts +4 -3
- package/dist/lib/reactivity/text/createTextRange.d.ts +6 -5
- package/dist/lib/reactivity/types.d.ts +2 -1
- package/dist/lib/xpath/analysis.d.ts +2 -1
- package/dist/model/BindComputation.d.ts +2 -1
- package/dist/model/BindDefinition.d.ts +6 -5
- package/dist/model/DescendentNodeDefinition.d.ts +6 -6
- package/dist/model/ModelBindMap.d.ts +4 -3
- package/dist/model/ModelDefinition.d.ts +2 -1
- package/dist/model/NodeDefinition.d.ts +20 -19
- package/dist/model/RepeatInstanceDefinition.d.ts +7 -7
- package/dist/model/{RepeatSequenceDefinition.d.ts → RepeatRangeDefinition.d.ts} +7 -6
- package/dist/model/RepeatTemplateDefinition.d.ts +8 -8
- package/dist/model/RootDefinition.d.ts +8 -5
- package/dist/model/SubtreeDefinition.d.ts +5 -4
- package/dist/model/ValueNodeDefinition.d.ts +5 -5
- package/dist/solid.js +1873 -1751
- package/dist/solid.js.map +1 -1
- package/package.json +14 -18
- package/src/XFormDOM.ts +81 -8
- package/src/body/BodyDefinition.ts +38 -23
- package/src/body/RepeatElementDefinition.ts +70 -0
- package/src/body/appearance/inputAppearanceParser.ts +39 -0
- package/src/body/appearance/selectAppearanceParser.ts +38 -0
- package/src/body/appearance/structureElementAppearanceParser.ts +7 -0
- package/src/body/control/ControlDefinition.ts +4 -0
- package/src/body/control/InputDefinition.ts +13 -0
- package/src/body/control/select/SelectDefinition.ts +14 -5
- package/src/body/group/BaseGroupDefinition.ts +11 -49
- package/src/body/text/LabelDefinition.ts +15 -1
- package/src/body/text/TextElementDefinition.ts +5 -5
- package/src/client/BaseNode.ts +9 -1
- package/src/client/GroupNode.ts +6 -2
- package/src/client/NodeAppearances.ts +22 -0
- package/src/client/RepeatInstanceNode.ts +4 -0
- package/src/client/RepeatRangeNode.ts +6 -2
- package/src/client/RootNode.ts +22 -0
- package/src/client/SelectNode.ts +4 -0
- package/src/client/StringNode.ts +4 -0
- package/src/client/SubtreeNode.ts +1 -0
- package/src/instance/Group.ts +14 -9
- package/src/instance/RepeatInstance.ts +59 -15
- package/src/instance/RepeatRange.ts +133 -15
- package/src/instance/Root.ts +20 -64
- package/src/instance/SelectField.ts +7 -7
- package/src/instance/StringField.ts +8 -7
- package/src/instance/Subtree.ts +10 -7
- package/src/instance/abstract/DescendantNode.ts +45 -43
- package/src/instance/abstract/InstanceNode.ts +69 -86
- package/src/instance/children.ts +17 -7
- package/src/instance/index.ts +1 -1
- package/src/instance/internal-api/EvaluationContext.ts +5 -6
- package/src/instance/internal-api/ValueContext.ts +2 -2
- package/src/lib/TokenListParser.ts +156 -0
- package/src/lib/dom/query.ts +13 -0
- package/src/lib/reactivity/createChildrenState.ts +51 -6
- package/src/lib/reactivity/createComputedExpression.ts +1 -1
- package/src/lib/reactivity/createSelectItems.ts +4 -6
- package/src/lib/reactivity/createValueState.ts +6 -6
- package/src/lib/reactivity/materializeCurrentStateChildren.ts +3 -1
- package/src/model/DescendentNodeDefinition.ts +1 -2
- package/src/model/ModelDefinition.ts +1 -1
- package/src/model/NodeDefinition.ts +12 -12
- package/src/model/RepeatInstanceDefinition.ts +8 -13
- package/src/model/{RepeatSequenceDefinition.ts → RepeatRangeDefinition.ts} +6 -6
- package/src/model/RepeatTemplateDefinition.ts +10 -15
- package/src/model/RootDefinition.ts +6 -12
- package/src/model/SubtreeDefinition.ts +3 -3
- package/src/model/ValueNodeDefinition.ts +2 -3
- package/dist/body/RepeatDefinition.d.ts +0 -15
- package/dist/body/group/RepeatGroupDefinition.d.ts +0 -12
- package/src/body/RepeatDefinition.ts +0 -54
- package/src/body/group/RepeatGroupDefinition.ts +0 -91
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { RepeatRangeDefinition } from '../model/RepeatRangeDefinition.ts';
|
|
2
|
+
import { BaseNode, BaseNodeState } from './BaseNode.ts';
|
|
3
|
+
import { NodeAppearances } from './NodeAppearances.ts';
|
|
4
|
+
import { RepeatInstanceNode } from './RepeatInstanceNode.ts';
|
|
5
|
+
import { RootNode } from './RootNode.ts';
|
|
6
|
+
import { TextRange } from './TextRange.ts';
|
|
7
|
+
import { GeneralParentNode } from './hierarchy.ts';
|
|
8
|
+
|
|
7
9
|
export interface RepeatRangeNodeState extends BaseNodeState {
|
|
8
10
|
get hint(): null;
|
|
9
11
|
get label(): TextRange<'label'> | null;
|
|
@@ -19,6 +21,7 @@ export interface RepeatRangeNodeState extends BaseNodeState {
|
|
|
19
21
|
get valueOptions(): null;
|
|
20
22
|
get value(): null;
|
|
21
23
|
}
|
|
24
|
+
export type RepeatRangeNodeAppearances = NodeAppearances<RepeatRangeDefinition>;
|
|
22
25
|
/**
|
|
23
26
|
* Represents a contiguous set of zero or more {@link RepeatInstanceNode}s
|
|
24
27
|
* (accessed by its
|
|
@@ -85,7 +88,8 @@ export interface RepeatRangeNodeState extends BaseNodeState {
|
|
|
85
88
|
*/
|
|
86
89
|
export interface RepeatRangeNode extends BaseNode {
|
|
87
90
|
readonly nodeType: 'repeat-range';
|
|
88
|
-
readonly
|
|
91
|
+
readonly appearances: RepeatRangeNodeAppearances;
|
|
92
|
+
readonly definition: RepeatRangeDefinition;
|
|
89
93
|
readonly root: RootNode;
|
|
90
94
|
readonly parent: GeneralParentNode;
|
|
91
95
|
readonly currentState: RepeatRangeNodeState;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { BodyClassList } from '../body/BodyDefinition.ts';
|
|
2
|
+
import { RootDefinition } from '../model/RootDefinition.ts';
|
|
3
|
+
import { BaseNode, BaseNodeState } from './BaseNode.ts';
|
|
4
|
+
import { ActiveLanguage, FormLanguage, FormLanguages } from './FormLanguage.ts';
|
|
5
|
+
import { GeneralChildNode } from './hierarchy.ts';
|
|
6
|
+
|
|
5
7
|
export interface RootNodeState extends BaseNodeState {
|
|
6
8
|
/**
|
|
7
9
|
* This, along with {@link RootNode.languages} is the most significant break
|
|
@@ -18,6 +20,24 @@ export interface RootNodeState extends BaseNodeState {
|
|
|
18
20
|
}
|
|
19
21
|
export interface RootNode extends BaseNode {
|
|
20
22
|
readonly nodeType: 'root';
|
|
23
|
+
/**
|
|
24
|
+
* @todo this along with {@link classes} is... awkward.
|
|
25
|
+
*/
|
|
26
|
+
readonly appearances: null;
|
|
27
|
+
/**
|
|
28
|
+
* @todo This is another odd deviation in {@link RootNode}. Unlike
|
|
29
|
+
* {@link languages}, it doesn't feel particularly **essential**. While it
|
|
30
|
+
* would deviate from XForms spec terminology, it seems like it _might be
|
|
31
|
+
* reasonable_ to instead convey `<h:body class="...">` as
|
|
32
|
+
* {@link RootNode.appearances} in the client interface. They do have slightly
|
|
33
|
+
* different spec semantics (i.e. a body class can be anything, to trigger
|
|
34
|
+
* styling in a form UI). But the **most likely anticipated** use case in Web
|
|
35
|
+
* Forms would be the "pages" class, and perhaps "theme-grid". The former is
|
|
36
|
+
* definitely conceptually similar to a XForms `appearance` (albeit
|
|
37
|
+
* form-global, which is not a spec concept). The latter does as well, and we
|
|
38
|
+
* already anticipate applying that concept in non-form-global ways.
|
|
39
|
+
*/
|
|
40
|
+
readonly classes: BodyClassList;
|
|
21
41
|
readonly definition: RootDefinition;
|
|
22
42
|
readonly root: RootNode;
|
|
23
43
|
readonly parent: null;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { AnySelectDefinition } from '../body/control/select/SelectDefinition.ts';
|
|
2
|
+
import { ValueNodeDefinition } from '../model/ValueNodeDefinition.ts';
|
|
3
|
+
import { BaseNode, BaseNodeState } from './BaseNode.ts';
|
|
4
|
+
import { NodeAppearances } from './NodeAppearances.ts';
|
|
5
|
+
import { RootNode } from './RootNode.ts';
|
|
6
|
+
import { TextRange } from './TextRange.ts';
|
|
7
|
+
import { GeneralParentNode } from './hierarchy.ts';
|
|
8
|
+
|
|
7
9
|
export interface SelectItem {
|
|
8
10
|
get value(): string;
|
|
9
11
|
get label(): TextRange<'label'> | null;
|
|
@@ -31,8 +33,10 @@ export interface SelectNodeState extends BaseNodeState {
|
|
|
31
33
|
export interface SelectDefinition extends ValueNodeDefinition {
|
|
32
34
|
readonly bodyElement: AnySelectDefinition;
|
|
33
35
|
}
|
|
36
|
+
export type SelectNodeAppearances = NodeAppearances<SelectDefinition>;
|
|
34
37
|
export interface SelectNode extends BaseNode {
|
|
35
38
|
readonly nodeType: 'select';
|
|
39
|
+
readonly appearances: SelectNodeAppearances;
|
|
36
40
|
readonly definition: SelectDefinition;
|
|
37
41
|
readonly root: RootNode;
|
|
38
42
|
readonly parent: GeneralParentNode;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { InputDefinition } from '../body/control/InputDefinition.ts';
|
|
2
|
+
import { ValueNodeDefinition } from '../model/ValueNodeDefinition.ts';
|
|
3
|
+
import { BaseNode, BaseNodeState } from './BaseNode.ts';
|
|
4
|
+
import { NodeAppearances } from './NodeAppearances.ts';
|
|
5
|
+
import { RootNode } from './RootNode.ts';
|
|
6
|
+
import { GeneralParentNode } from './hierarchy.ts';
|
|
7
|
+
|
|
6
8
|
export interface StringNodeState extends BaseNodeState {
|
|
7
9
|
get children(): null;
|
|
8
10
|
get valueOptions(): null;
|
|
@@ -17,6 +19,7 @@ export interface StringNodeState extends BaseNodeState {
|
|
|
17
19
|
export interface StringDefinition extends ValueNodeDefinition {
|
|
18
20
|
readonly bodyElement: InputDefinition | null;
|
|
19
21
|
}
|
|
22
|
+
export type StringNodeAppearances = NodeAppearances<StringDefinition>;
|
|
20
23
|
/**
|
|
21
24
|
* A node which can be assigned a string/text value. A string node **MAY**
|
|
22
25
|
* correspond to form field defined as an XForms `<input>`, which a user-facing
|
|
@@ -26,6 +29,7 @@ export interface StringDefinition extends ValueNodeDefinition {
|
|
|
26
29
|
*/
|
|
27
30
|
export interface StringNode extends BaseNode {
|
|
28
31
|
readonly nodeType: 'string';
|
|
32
|
+
readonly appearances: StringNodeAppearances;
|
|
29
33
|
readonly definition: StringDefinition;
|
|
30
34
|
readonly root: RootNode;
|
|
31
35
|
readonly parent: GeneralParentNode;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
import { SubtreeDefinition as BaseSubtreeDefinition } from '../model/SubtreeDefinition.ts';
|
|
2
|
+
import { BaseNode, BaseNodeState } from './BaseNode.ts';
|
|
3
|
+
import { RootNode } from './RootNode.ts';
|
|
4
|
+
import { GeneralChildNode, GeneralParentNode } from './hierarchy.ts';
|
|
5
|
+
|
|
5
6
|
export interface SubtreeNodeState extends BaseNodeState {
|
|
6
7
|
get label(): null;
|
|
7
8
|
get hint(): null;
|
|
@@ -45,6 +46,7 @@ export interface SubtreeDefinition extends BaseSubtreeDefinition {
|
|
|
45
46
|
*/
|
|
46
47
|
export interface SubtreeNode extends BaseNode {
|
|
47
48
|
readonly nodeType: 'subtree';
|
|
49
|
+
readonly appearances: null;
|
|
48
50
|
readonly definition: SubtreeDefinition;
|
|
49
51
|
readonly root: RootNode;
|
|
50
52
|
readonly parent: GeneralParentNode;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
1
|
+
import { ExpandUnion } from '../../../common/types/helpers.d.ts';
|
|
2
|
+
import { GroupNode } from './GroupNode.ts';
|
|
3
|
+
import { RepeatInstanceNode } from './RepeatInstanceNode.ts';
|
|
4
|
+
import { RepeatRangeNode } from './RepeatRangeNode.ts';
|
|
5
|
+
import { RootNode } from './RootNode.ts';
|
|
6
|
+
import { SelectNode } from './SelectNode.ts';
|
|
7
|
+
import { StringNode } from './StringNode.ts';
|
|
8
|
+
import { SubtreeNode } from './SubtreeNode.ts';
|
|
9
|
+
|
|
9
10
|
export type AnyLeafNode = SelectNode | StringNode;
|
|
10
11
|
/**
|
|
11
12
|
* Any of the concrete node types which may be a parent of any other node.
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { EngineConfig } from './EngineConfig.ts';
|
|
2
|
+
import { RootNode } from './RootNode.ts';
|
|
3
|
+
|
|
3
4
|
export type FormResource = Blob | URL | string;
|
|
4
5
|
export interface InitializeFormOptions {
|
|
5
6
|
readonly config: EngineConfig;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { AnyDependentExpression } from './DependentExpression.ts';
|
|
2
|
+
|
|
2
3
|
export declare abstract class DependencyContext {
|
|
3
4
|
abstract get parentReference(): string | null;
|
|
4
5
|
abstract get reference(): string | null;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { XFormsXPathEvaluator } from '@getodk/xpath';
|
|
2
|
+
import { DependencyContext } from './DependencyContext.ts';
|
|
3
|
+
|
|
3
4
|
declare const evaluatorMethodsByResultType: {
|
|
4
5
|
readonly boolean: "evaluateBoolean";
|
|
5
6
|
readonly nodes: "evaluateNodes";
|
package/dist/index.d.ts
CHANGED