@getodk/xforms-engine 0.14.0 → 0.15.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/AttributeNode.d.ts +53 -0
- package/dist/client/index.d.ts +1 -0
- package/dist/client/node-types.d.ts +1 -1
- package/dist/client/validation.d.ts +7 -1
- package/dist/index.js +436 -164
- package/dist/index.js.map +1 -1
- package/dist/instance/Attribute.d.ts +58 -0
- package/dist/instance/Group.d.ts +4 -0
- package/dist/instance/PrimaryInstance.d.ts +4 -0
- package/dist/instance/Root.d.ts +4 -0
- package/dist/instance/UploadControl.d.ts +4 -0
- package/dist/instance/abstract/InstanceNode.d.ts +7 -4
- package/dist/instance/abstract/ValueNode.d.ts +1 -0
- package/dist/instance/attachments/buildAttributes.d.ts +3 -0
- package/dist/instance/hierarchy.d.ts +2 -1
- package/dist/instance/internal-api/AttributeContext.d.ts +29 -0
- package/dist/instance/internal-api/serialization/ClientReactiveSerializableAttributeNode.d.ts +16 -0
- package/dist/instance/internal-api/serialization/ClientReactiveSerializableParentNode.d.ts +2 -0
- package/dist/instance/internal-api/serialization/ClientReactiveSerializableTemplatedNode.d.ts +2 -2
- package/dist/instance/repeat/BaseRepeatRange.d.ts +5 -0
- package/dist/instance/repeat/RepeatInstance.d.ts +4 -2
- package/dist/integration/xpath/adapter/XFormsXPathNode.d.ts +2 -2
- package/dist/lib/client-reactivity/instance-state/createAttributeNodeInstanceState.d.ts +3 -0
- package/dist/lib/client-reactivity/instance-state/createTemplatedNodeInstanceState.d.ts +0 -3
- package/dist/lib/names/NamespaceDeclarationMap.d.ts +1 -1
- package/dist/lib/reactivity/createAttributeState.d.ts +16 -0
- package/dist/lib/reactivity/createAttributeValueState.d.ts +15 -0
- package/dist/lib/xml-serialization.d.ts +5 -9
- package/dist/parse/XFormDOM.d.ts +1 -1
- package/dist/parse/model/AttributeDefinition.d.ts +22 -0
- package/dist/parse/model/{RootAttributeMap.d.ts → AttributeDefinitionMap.d.ts} +4 -10
- package/dist/parse/model/GroupDefinition.d.ts +4 -1
- package/dist/parse/model/LeafNodeDefinition.d.ts +1 -0
- package/dist/parse/model/NodeDefinition.d.ts +8 -3
- package/dist/parse/model/RepeatDefinition.d.ts +4 -1
- package/dist/parse/model/RootDefinition.d.ts +2 -2
- package/dist/solid.js +436 -164
- package/dist/solid.js.map +1 -1
- package/package.json +5 -5
- package/src/client/AttributeNode.ts +62 -0
- package/src/client/index.ts +1 -0
- package/src/client/node-types.ts +1 -0
- package/src/client/validation.ts +9 -1
- package/src/instance/Attribute.ts +164 -0
- package/src/instance/Group.ts +16 -0
- package/src/instance/InputControl.ts +1 -0
- package/src/instance/ModelValue.ts +1 -0
- package/src/instance/Note.ts +1 -0
- package/src/instance/PrimaryInstance.ts +17 -0
- package/src/instance/RangeControl.ts +1 -0
- package/src/instance/RankControl.ts +1 -0
- package/src/instance/Root.ts +16 -0
- package/src/instance/SelectControl.ts +1 -0
- package/src/instance/TriggerControl.ts +1 -0
- package/src/instance/UploadControl.ts +14 -0
- package/src/instance/abstract/DescendantNode.ts +5 -1
- package/src/instance/abstract/InstanceNode.ts +6 -3
- package/src/instance/abstract/ValueNode.ts +1 -0
- package/src/instance/attachments/buildAttributes.ts +8 -0
- package/src/instance/hierarchy.ts +3 -1
- package/src/instance/internal-api/AttributeContext.ts +34 -0
- package/src/instance/internal-api/serialization/ClientReactiveSerializableAttributeNode.ts +19 -0
- package/src/instance/internal-api/serialization/ClientReactiveSerializableParentNode.ts +2 -0
- package/src/instance/internal-api/serialization/ClientReactiveSerializableTemplatedNode.ts +2 -3
- package/src/instance/repeat/BaseRepeatRange.ts +14 -0
- package/src/instance/repeat/RepeatInstance.ts +14 -5
- package/src/integration/xpath/adapter/XFormsXPathNode.ts +3 -1
- package/src/lib/client-reactivity/instance-state/createAttributeNodeInstanceState.ts +16 -0
- package/src/lib/client-reactivity/instance-state/createParentNodeInstanceState.ts +5 -5
- package/src/lib/client-reactivity/instance-state/createRootInstanceState.ts +6 -9
- package/src/lib/client-reactivity/instance-state/createTemplatedNodeInstanceState.ts +5 -15
- package/src/lib/names/NamespaceDeclarationMap.ts +1 -1
- package/src/lib/reactivity/createAttributeState.ts +51 -0
- package/src/lib/reactivity/createAttributeValueState.ts +189 -0
- package/src/lib/xml-serialization.ts +30 -34
- package/src/parse/model/AttributeDefinition.ts +58 -0
- package/src/parse/model/{RootAttributeMap.ts → AttributeDefinitionMap.ts} +7 -13
- package/src/parse/model/GroupDefinition.ts +6 -0
- package/src/parse/model/LeafNodeDefinition.ts +1 -0
- package/src/parse/model/NodeDefinition.ts +11 -3
- package/src/parse/model/RepeatDefinition.ts +8 -1
- package/src/parse/model/RootDefinition.ts +5 -5
- package/src/parse/model/nodeDefinitionMap.ts +1 -1
- package/dist/error/TemplatedNodeAttributeSerializationError.d.ts +0 -22
- package/dist/parse/model/RootAttributeDefinition.d.ts +0 -21
- package/src/error/TemplatedNodeAttributeSerializationError.ts +0 -24
- package/src/parse/model/RootAttributeDefinition.ts +0 -44
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Root } from '../instance/Root.ts';
|
|
2
|
+
import { AttributeDefinition } from '../parse/model/AttributeDefinition.ts';
|
|
3
|
+
import { InstanceState } from './serialization/InstanceState.ts';
|
|
4
|
+
export interface AttributeNodeState {
|
|
5
|
+
get value(): string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Base interface for common/shared aspects of attributes.
|
|
9
|
+
*/
|
|
10
|
+
export interface AttributeNode {
|
|
11
|
+
/**
|
|
12
|
+
* Specifies the node's general type. This can be useful for narrowing types,
|
|
13
|
+
* e.g. those of children.
|
|
14
|
+
*/
|
|
15
|
+
readonly nodeType: 'attribute';
|
|
16
|
+
/**
|
|
17
|
+
* Each node has a definition which specifies aspects of the node defined in
|
|
18
|
+
* the form. These aspects include (but are not limited to) the node's data
|
|
19
|
+
* type, its body presentation constraints (if any), its bound nodeset, and
|
|
20
|
+
* so on...
|
|
21
|
+
*/
|
|
22
|
+
readonly definition: AttributeDefinition;
|
|
23
|
+
/**
|
|
24
|
+
* Each node links back to the node representing the root of the form.
|
|
25
|
+
*/
|
|
26
|
+
readonly root: Root;
|
|
27
|
+
/**
|
|
28
|
+
* Each node links back to its parent, if any. All nodes have a parent except
|
|
29
|
+
* the form's {@link root}.
|
|
30
|
+
*/
|
|
31
|
+
readonly parent: unknown;
|
|
32
|
+
/**
|
|
33
|
+
* Each node provides a discrete object representing the stateful aspects of
|
|
34
|
+
* that node which will change over time. This includes state which is either
|
|
35
|
+
* client-/user-mutable, or state which is computed based on the core XForms
|
|
36
|
+
* computation model. Each node also exposes {@link validationState}, which
|
|
37
|
+
* reflects the validity of the node, or its descendants.
|
|
38
|
+
*
|
|
39
|
+
* When a client provides a {@link OpaqueReactiveObjectFactory}, the engine
|
|
40
|
+
* will update the properties of this object as their respective states
|
|
41
|
+
* change, so a client can implement reactive updates that respond to changes
|
|
42
|
+
* as they occur.
|
|
43
|
+
*/
|
|
44
|
+
readonly currentState: AttributeNodeState;
|
|
45
|
+
/**
|
|
46
|
+
* Represents the current instance state of the node.
|
|
47
|
+
*
|
|
48
|
+
* @see {@link InstanceState.instanceXML} for additional detail.
|
|
49
|
+
*/
|
|
50
|
+
readonly instanceState: InstanceState;
|
|
51
|
+
readonly appearances: null;
|
|
52
|
+
readonly nodeOptions: null;
|
|
53
|
+
}
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type * from './attachments/InstanceAttachmentMeta.ts';
|
|
2
2
|
export type * from './attachments/InstanceAttachmentsConfig.ts';
|
|
3
|
+
export type * from './AttributeNode.ts';
|
|
3
4
|
export type * from './constants.ts';
|
|
4
5
|
export * as constants from './constants.ts';
|
|
5
6
|
export type * from './form/CreateFormInstance.ts';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export type RepeatRangeNodeType = 'repeat-range:controlled' | 'repeat-range:uncontrolled';
|
|
2
|
-
export type LeafNodeType = 'model-value' | 'note' | 'select' | 'input' | 'trigger' | 'range' | 'rank' | 'upload';
|
|
2
|
+
export type LeafNodeType = 'model-value' | 'note' | 'select' | 'input' | 'trigger' | 'range' | 'rank' | 'attribute' | 'upload';
|
|
3
3
|
export type InstanceNodeType = 'root' | RepeatRangeNodeType | 'repeat-instance' | 'group' | LeafNodeType;
|
|
@@ -158,5 +158,11 @@ export interface DescendantNodeViolationReference {
|
|
|
158
158
|
export interface AncestorNodeValidationState {
|
|
159
159
|
get violations(): readonly DescendantNodeViolationReference[];
|
|
160
160
|
}
|
|
161
|
-
|
|
161
|
+
/**
|
|
162
|
+
* Convenience interface for nodes that cannot be invalid.
|
|
163
|
+
*/
|
|
164
|
+
export interface NullValidationState {
|
|
165
|
+
get violations(): readonly [];
|
|
166
|
+
}
|
|
167
|
+
export type NodeValidationState = AncestorNodeValidationState | LeafNodeValidationState | NullValidationState;
|
|
162
168
|
export {};
|